diff options
author | rajesh.shah@intel.com <rajesh.shah@intel.com> | 2005-10-13 15:05:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 18:36:59 -0400 |
commit | dbd7a78818d125a0ebd5507d4edb4dd5900006ab (patch) | |
tree | 682a1681aad47f70bfb760fca077f54589be92c6 /drivers/pci/hotplug/shpchp.h | |
parent | e3b1bd572f1cdb247bb4266a593b6894dc578d6a (diff) |
[PATCH] shpchp: use the PCI core for hotplug resource management
This patch converts the standard hotplug controller driver to use
the PCI core for resource management. This eliminates a whole lot
of duplicated code, and integrates shpchp in the system's normal
PCI handling code.
Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/shpchp.h')
-rw-r--r-- | drivers/pci/hotplug/shpchp.h | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index b7d1c61d6bbb..deea56c73cf2 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -63,14 +63,7 @@ struct pci_func { | |||
63 | u8 switch_save; | 63 | u8 switch_save; |
64 | u8 presence_save; | 64 | u8 presence_save; |
65 | u8 pwr_save; | 65 | u8 pwr_save; |
66 | u32 base_length[0x06]; | ||
67 | u8 base_type[0x06]; | ||
68 | u16 reserved2; | ||
69 | u32 config_space[0x20]; | 66 | u32 config_space[0x20]; |
70 | struct pci_resource *mem_head; | ||
71 | struct pci_resource *p_mem_head; | ||
72 | struct pci_resource *io_head; | ||
73 | struct pci_resource *bus_head; | ||
74 | struct pci_dev* pci_dev; | 67 | struct pci_dev* pci_dev; |
75 | }; | 68 | }; |
76 | 69 | ||
@@ -96,12 +89,6 @@ struct slot { | |||
96 | struct list_head slot_list; | 89 | struct list_head slot_list; |
97 | }; | 90 | }; |
98 | 91 | ||
99 | struct pci_resource { | ||
100 | struct pci_resource * next; | ||
101 | u32 base; | ||
102 | u32 length; | ||
103 | }; | ||
104 | |||
105 | struct event_info { | 92 | struct event_info { |
106 | u32 event_type; | 93 | u32 event_type; |
107 | u8 hp_slot; | 94 | u8 hp_slot; |
@@ -113,10 +100,6 @@ struct controller { | |||
113 | void * hpc_ctlr_handle; /* HPC controller handle */ | 100 | void * hpc_ctlr_handle; /* HPC controller handle */ |
114 | int num_slots; /* Number of slots on ctlr */ | 101 | int num_slots; /* Number of slots on ctlr */ |
115 | int slot_num_inc; /* 1 or -1 */ | 102 | int slot_num_inc; /* 1 or -1 */ |
116 | struct pci_resource *mem_head; | ||
117 | struct pci_resource *p_mem_head; | ||
118 | struct pci_resource *io_head; | ||
119 | struct pci_resource *bus_head; | ||
120 | struct pci_dev *pci_dev; | 103 | struct pci_dev *pci_dev; |
121 | struct pci_bus *pci_bus; | 104 | struct pci_bus *pci_bus; |
122 | struct event_info event_queue[10]; | 105 | struct event_info event_queue[10]; |
@@ -139,20 +122,6 @@ struct controller { | |||
139 | u16 vendor_id; | 122 | u16 vendor_id; |
140 | }; | 123 | }; |
141 | 124 | ||
142 | struct irq_mapping { | ||
143 | u8 barber_pole; | ||
144 | u8 valid_INT; | ||
145 | u8 interrupt[4]; | ||
146 | }; | ||
147 | |||
148 | struct resource_lists { | ||
149 | struct pci_resource *mem_head; | ||
150 | struct pci_resource *p_mem_head; | ||
151 | struct pci_resource *io_head; | ||
152 | struct pci_resource *bus_head; | ||
153 | struct irq_mapping *irqs; | ||
154 | }; | ||
155 | |||
156 | /* Define AMD SHPC ID */ | 125 | /* Define AMD SHPC ID */ |
157 | #define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450 | 126 | #define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450 |
158 | 127 | ||
@@ -197,7 +166,6 @@ struct resource_lists { | |||
197 | #define msg_HPC_rev_error "Unsupported revision of the PCI hot plug controller found.\n" | 166 | #define msg_HPC_rev_error "Unsupported revision of the PCI hot plug controller found.\n" |
198 | #define msg_HPC_non_shpc "The PCI hot plug controller is not supported by this driver.\n" | 167 | #define msg_HPC_non_shpc "The PCI hot plug controller is not supported by this driver.\n" |
199 | #define msg_HPC_not_supported "This system is not supported by this version of shpcphd mdoule. Upgrade to a newer version of shpchpd\n" | 168 | #define msg_HPC_not_supported "This system is not supported by this version of shpcphd mdoule. Upgrade to a newer version of shpchpd\n" |
200 | #define msg_unable_to_save "Unable to store PCI hot plug add resource information. This system must be rebooted before adding any PCI devices.\n" | ||
201 | #define msg_button_on "PCI slot #%d - powering on due to button press.\n" | 169 | #define msg_button_on "PCI slot #%d - powering on due to button press.\n" |
202 | #define msg_button_off "PCI slot #%d - powering off due to button press.\n" | 170 | #define msg_button_off "PCI slot #%d - powering off due to button press.\n" |
203 | #define msg_button_cancel "PCI slot #%d - action canceled due to button press.\n" | 171 | #define msg_button_cancel "PCI slot #%d - action canceled due to button press.\n" |
@@ -207,7 +175,6 @@ struct resource_lists { | |||
207 | extern void shpchp_create_ctrl_files (struct controller *ctrl); | 175 | extern void shpchp_create_ctrl_files (struct controller *ctrl); |
208 | 176 | ||
209 | /* controller functions */ | 177 | /* controller functions */ |
210 | extern int shpchprm_find_available_resources(struct controller *ctrl); | ||
211 | extern int shpchp_event_start_thread(void); | 178 | extern int shpchp_event_start_thread(void); |
212 | extern void shpchp_event_stop_thread(void); | 179 | extern void shpchp_event_stop_thread(void); |
213 | extern struct pci_func *shpchp_slot_create(unsigned char busnumber); | 180 | extern struct pci_func *shpchp_slot_create(unsigned char busnumber); |
@@ -220,19 +187,10 @@ extern u8 shpchp_handle_switch_change(u8 hp_slot, void *inst_id); | |||
220 | extern u8 shpchp_handle_presence_change(u8 hp_slot, void *inst_id); | 187 | extern u8 shpchp_handle_presence_change(u8 hp_slot, void *inst_id); |
221 | extern u8 shpchp_handle_power_fault(u8 hp_slot, void *inst_id); | 188 | extern u8 shpchp_handle_power_fault(u8 hp_slot, void *inst_id); |
222 | 189 | ||
223 | /* resource functions */ | ||
224 | extern int shpchp_resource_sort_and_combine(struct pci_resource **head); | ||
225 | |||
226 | /* pci functions */ | 190 | /* pci functions */ |
227 | extern int shpchp_set_irq(u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num); | ||
228 | /*extern int shpchp_get_bus_dev(struct controller *ctrl, u8 *bus_num, u8 *dev_num, struct slot *slot);*/ | ||
229 | extern int shpchp_save_config(struct controller *ctrl, int busnumber, int num_ctlr_slots, int first_device_num); | 191 | extern int shpchp_save_config(struct controller *ctrl, int busnumber, int num_ctlr_slots, int first_device_num); |
230 | extern int shpchp_save_used_resources(struct controller *ctrl, struct pci_func * func, int flag); | ||
231 | extern int shpchp_save_slot_config(struct controller *ctrl, struct pci_func * new_slot); | 192 | extern int shpchp_save_slot_config(struct controller *ctrl, struct pci_func * new_slot); |
232 | extern void shpchp_destroy_board_resources(struct pci_func * func); | 193 | extern int shpchp_configure_device(struct slot *p_slot); |
233 | extern int shpchp_return_board_resources(struct pci_func * func, struct resource_lists * resources); | ||
234 | extern void shpchp_destroy_resource_list(struct resource_lists * resources); | ||
235 | extern int shpchp_configure_device(struct controller* ctrl, struct pci_func* func); | ||
236 | extern int shpchp_unconfigure_device(struct pci_func* func); | 194 | extern int shpchp_unconfigure_device(struct pci_func* func); |
237 | 195 | ||
238 | 196 | ||
@@ -240,10 +198,6 @@ extern int shpchp_unconfigure_device(struct pci_func* func); | |||
240 | extern struct controller *shpchp_ctrl_list; | 198 | extern struct controller *shpchp_ctrl_list; |
241 | extern struct pci_func *shpchp_slot_list[256]; | 199 | extern struct pci_func *shpchp_slot_list[256]; |
242 | 200 | ||
243 | /* These are added to support AMD shpc */ | ||
244 | extern u8 shpchp_nic_irq; | ||
245 | extern u8 shpchp_disk_irq; | ||
246 | |||
247 | struct ctrl_reg { | 201 | struct ctrl_reg { |
248 | volatile u32 base_offset; | 202 | volatile u32 base_offset; |
249 | volatile u32 slot_avail1; | 203 | volatile u32 slot_avail1; |
@@ -398,15 +352,6 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl) | |||
398 | return retval; | 352 | return retval; |
399 | } | 353 | } |
400 | 354 | ||
401 | /* Puts node back in the resource list pointed to by head */ | ||
402 | static inline void return_resource(struct pci_resource **head, struct pci_resource *node) | ||
403 | { | ||
404 | if (!node || !head) | ||
405 | return; | ||
406 | node->next = *head; | ||
407 | *head = node; | ||
408 | } | ||
409 | |||
410 | #define SLOT_NAME_SIZE 10 | 355 | #define SLOT_NAME_SIZE 10 |
411 | 356 | ||
412 | static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot) | 357 | static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot) |