ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / pci / hotplug / cpci_hotplug.h
1 /*
2  * CompactPCI Hot Plug Core Functions
3  *
4  * Copyright (C) 2002 SOMA Networks, Inc.
5  * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
6  * Copyright (C) 2001 IBM Corp.
7  *
8  * All rights reserved.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or (at
13  * your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
18  * NON INFRINGEMENT.  See the GNU General Public License for more
19  * details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  *
25  * Send feedback to <scottm@somanetworks.com>
26  */
27
28 #ifndef _CPCI_HOTPLUG_H
29 #define _CPCI_HOTPLUG_H
30
31 #include <linux/types.h>
32 #include <linux/pci.h>
33
34 /* PICMG 2.12 R2.0 HS CSR bits: */
35 #define HS_CSR_INS      0x0080
36 #define HS_CSR_EXT      0x0040
37 #define HS_CSR_PI       0x0030
38 #define HS_CSR_LOO      0x0008
39 #define HS_CSR_PIE      0x0004
40 #define HS_CSR_EIM      0x0002
41 #define HS_CSR_DHA      0x0001
42
43 #define SLOT_MAGIC      0x67267322
44 struct slot {
45         u32 magic;
46         u8 number;
47         unsigned int devfn;
48         struct pci_bus *bus;
49         struct pci_dev *dev;
50         unsigned int extracting;
51         struct hotplug_slot *hotplug_slot;
52         struct list_head slot_list;
53 };
54
55 struct cpci_hp_controller_ops {
56         int (*query_enum) (void);
57         int (*enable_irq) (void);
58         int (*disable_irq) (void);
59         int (*check_irq) (void *dev_id);
60         int (*hardware_test) (struct slot* slot, u32 value);
61         u8  (*get_power) (struct slot* slot);
62         int (*set_power) (struct slot* slot, int value);
63 };
64
65 struct cpci_hp_controller {
66         unsigned int irq;
67         unsigned long irq_flags;
68         char *devname;
69         void *dev_id;
70         char *name;
71         struct cpci_hp_controller_ops *ops;
72 };
73
74 extern int cpci_hp_register_controller(struct cpci_hp_controller *controller);
75 extern int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
76 extern int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
77 extern int cpci_hp_unregister_bus(struct pci_bus *bus);
78 extern int cpci_hp_start(void);
79 extern int cpci_hp_stop(void);
80
81 /*
82  * Internal function prototypes, these functions should not be used by
83  * board/chassis drivers.
84  */
85 extern u8 cpci_get_attention_status(struct slot *slot);
86 extern u8 cpci_get_latch_status(struct slot *slot);
87 extern u8 cpci_get_adapter_status(struct slot *slot);
88 extern u16 cpci_get_hs_csr(struct slot * slot);
89 extern u16 cpci_set_hs_csr(struct slot * slot, u16 hs_csr);
90 extern int cpci_set_attention_status(struct slot *slot, int status);
91 extern int cpci_check_and_clear_ins(struct slot * slot);
92 extern int cpci_check_ext(struct slot * slot);
93 extern int cpci_clear_ext(struct slot * slot);
94 extern int cpci_led_on(struct slot * slot);
95 extern int cpci_led_off(struct slot * slot);
96 extern int cpci_configure_slot(struct slot *slot);
97 extern int cpci_unconfigure_slot(struct slot *slot);
98
99 #endif  /* _CPCI_HOTPLUG_H */