diff options
author | rajesh.shah@intel.com <rajesh.shah@intel.com> | 2005-10-31 19:20:09 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-11-10 19:09:15 -0500 |
commit | ed6cbcf2ac706aa47194fd2f7a99865cc06833d7 (patch) | |
tree | 7c0dfc9a0c8078618f662f5d7a5dcad25d05ac77 /drivers/pci/hotplug | |
parent | ca22a5e4d70620b7f3d809e424daa5214b0aa00d (diff) |
[PATCH] pciehp: miscellaneous cleanups
Remove un-necessary header includes, remove dead code, remove
some hardcoded constants...
Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r-- | drivers/pci/hotplug/pciehp.h | 44 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 14 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_ctrl.c | 56 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 38 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_pci.c | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehprm_acpi.c | 6 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehprm_nonacpi.c | 12 |
7 files changed, 41 insertions, 133 deletions
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 3e17e3d4dd65..314989a3a933 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -32,8 +32,6 @@ | |||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <asm/semaphore.h> | ||
36 | #include <asm/io.h> | ||
37 | #include <linux/pcieport_if.h> | 35 | #include <linux/pcieport_if.h> |
38 | #include "pci_hotplug.h" | 36 | #include "pci_hotplug.h" |
39 | 37 | ||
@@ -62,13 +60,7 @@ struct slot { | |||
62 | u8 device; | 60 | u8 device; |
63 | u16 status; | 61 | u16 status; |
64 | u32 number; | 62 | u32 number; |
65 | u8 is_a_board; | ||
66 | u8 configured; | ||
67 | u8 state; | 63 | u8 state; |
68 | u8 switch_save; | ||
69 | u8 presence_save; | ||
70 | u32 capabilities; | ||
71 | u16 reserved2; | ||
72 | struct timer_list task_event; | 64 | struct timer_list task_event; |
73 | u8 hp_slot; | 65 | u8 hp_slot; |
74 | struct controller *ctrl; | 66 | struct controller *ctrl; |
@@ -82,27 +74,42 @@ struct event_info { | |||
82 | u8 hp_slot; | 74 | u8 hp_slot; |
83 | }; | 75 | }; |
84 | 76 | ||
77 | typedef u8(*php_intr_callback_t) (u8 hp_slot, void *instance_id); | ||
78 | |||
79 | struct php_ctlr_state_s { | ||
80 | struct php_ctlr_state_s *pnext; | ||
81 | struct pci_dev *pci_dev; | ||
82 | unsigned int irq; | ||
83 | unsigned long flags; /* spinlock's */ | ||
84 | u32 slot_device_offset; | ||
85 | u32 num_slots; | ||
86 | struct timer_list int_poll_timer; /* Added for poll event */ | ||
87 | php_intr_callback_t attention_button_callback; | ||
88 | php_intr_callback_t switch_change_callback; | ||
89 | php_intr_callback_t presence_change_callback; | ||
90 | php_intr_callback_t power_fault_callback; | ||
91 | void *callback_instance_id; | ||
92 | struct ctrl_reg *creg; /* Ptr to controller register space */ | ||
93 | }; | ||
94 | |||
95 | #define MAX_EVENTS 10 | ||
85 | struct controller { | 96 | struct controller { |
86 | struct controller *next; | 97 | struct controller *next; |
87 | struct semaphore crit_sect; /* critical section semaphore */ | 98 | struct semaphore crit_sect; /* critical section semaphore */ |
88 | void *hpc_ctlr_handle; /* HPC controller handle */ | 99 | struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ |
89 | int num_slots; /* Number of slots on ctlr */ | 100 | int num_slots; /* Number of slots on ctlr */ |
90 | int slot_num_inc; /* 1 or -1 */ | 101 | int slot_num_inc; /* 1 or -1 */ |
91 | struct pci_dev *pci_dev; | 102 | struct pci_dev *pci_dev; |
92 | struct pci_bus *pci_bus; | 103 | struct pci_bus *pci_bus; |
93 | struct event_info event_queue[10]; | 104 | struct event_info event_queue[MAX_EVENTS]; |
94 | struct slot *slot; | 105 | struct slot *slot; |
95 | struct hpc_ops *hpc_ops; | 106 | struct hpc_ops *hpc_ops; |
96 | wait_queue_head_t queue; /* sleep & wake process */ | 107 | wait_queue_head_t queue; /* sleep & wake process */ |
97 | u8 next_event; | 108 | u8 next_event; |
98 | u8 seg; | ||
99 | u8 bus; | 109 | u8 bus; |
100 | u8 device; | 110 | u8 device; |
101 | u8 function; | 111 | u8 function; |
102 | u8 rev; | ||
103 | u8 slot_device_offset; | 112 | u8 slot_device_offset; |
104 | u8 add_support; | ||
105 | enum pci_bus_speed speed; | ||
106 | u32 first_slot; /* First physical slot number */ /* PCIE only has 1 slot */ | 113 | u32 first_slot; /* First physical slot number */ /* PCIE only has 1 slot */ |
107 | u8 slot_bus; /* Bus where the slots handled by this controller sit */ | 114 | u8 slot_bus; /* Bus where the slots handled by this controller sit */ |
108 | u8 ctrlcap; | 115 | u8 ctrlcap; |
@@ -250,14 +257,7 @@ enum php_ctlr_type { | |||
250 | ACPI | 257 | ACPI |
251 | }; | 258 | }; |
252 | 259 | ||
253 | typedef u8(*php_intr_callback_t) (unsigned int change_id, void *instance_id); | 260 | int pcie_init(struct controller *ctrl, struct pcie_device *dev); |
254 | |||
255 | int pcie_init(struct controller *ctrl, struct pcie_device *dev, | ||
256 | php_intr_callback_t attention_button_callback, | ||
257 | php_intr_callback_t switch_change_callback, | ||
258 | php_intr_callback_t presence_change_callback, | ||
259 | php_intr_callback_t power_fault_callback); | ||
260 | |||
261 | 261 | ||
262 | /* This has no meaning for PCI Express, as there is only 1 slot per port */ | 262 | /* This has no meaning for PCI Express, as there is only 1 slot per port */ |
263 | int pcie_get_ctlr_slot_config(struct controller *ctrl, | 263 | int pcie_get_ctlr_slot_config(struct controller *ctrl, |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index be608563e8b6..701243ea5894 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -27,17 +27,11 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
33 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
34 | #include <linux/types.h> | 33 | #include <linux/types.h> |
35 | #include <linux/proc_fs.h> | ||
36 | #include <linux/slab.h> | ||
37 | #include <linux/workqueue.h> | ||
38 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
39 | #include <linux/init.h> | ||
40 | #include <asm/uaccess.h> | ||
41 | #include "pciehp.h" | 35 | #include "pciehp.h" |
42 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
43 | 37 | ||
@@ -381,11 +375,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
381 | pdev = dev->port; | 375 | pdev = dev->port; |
382 | ctrl->pci_dev = pdev; | 376 | ctrl->pci_dev = pdev; |
383 | 377 | ||
384 | rc = pcie_init(ctrl, dev, | 378 | rc = pcie_init(ctrl, dev); |
385 | (php_intr_callback_t) pciehp_handle_attention_button, | ||
386 | (php_intr_callback_t) pciehp_handle_switch_change, | ||
387 | (php_intr_callback_t) pciehp_handle_presence_change, | ||
388 | (php_intr_callback_t) pciehp_handle_power_fault); | ||
389 | if (rc) { | 379 | if (rc) { |
390 | dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME); | 380 | dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME); |
391 | goto err_out_free_ctrl; | 381 | goto err_out_free_ctrl; |
@@ -421,8 +411,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
421 | first_device_num = ctrl->slot_device_offset; | 411 | first_device_num = ctrl->slot_device_offset; |
422 | num_ctlr_slots = ctrl->num_slots; | 412 | num_ctlr_slots = ctrl->num_slots; |
423 | 413 | ||
424 | ctrl->add_support = 1; | ||
425 | |||
426 | /* Setup the slot information structures */ | 414 | /* Setup the slot information structures */ |
427 | rc = init_slots(ctrl); | 415 | rc = init_slots(ctrl); |
428 | if (rc) { | 416 | if (rc) { |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index b60e4973289c..dcfbfffa17c6 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -27,15 +27,9 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/types.h> | 32 | #include <linux/types.h> |
34 | #include <linux/slab.h> | ||
35 | #include <linux/workqueue.h> | ||
36 | #include <linux/interrupt.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include <linux/wait.h> | ||
39 | #include <linux/smp_lock.h> | 33 | #include <linux/smp_lock.h> |
40 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
41 | #include "../pci.h" | 35 | #include "../pci.h" |
@@ -64,10 +58,9 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) | |||
64 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); | 58 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); |
65 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | 59 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); |
66 | 60 | ||
67 | p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); | ||
68 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 61 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
69 | 62 | ||
70 | ctrl->next_event = (ctrl->next_event + 1) % 10; | 63 | ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; |
71 | taskInfo->hp_slot = hp_slot; | 64 | taskInfo->hp_slot = hp_slot; |
72 | 65 | ||
73 | rc++; | 66 | rc++; |
@@ -118,12 +111,11 @@ u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id) | |||
118 | * what to do | 111 | * what to do |
119 | */ | 112 | */ |
120 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); | 113 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); |
121 | ctrl->next_event = (ctrl->next_event + 1) % 10; | 114 | ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; |
122 | taskInfo->hp_slot = hp_slot; | 115 | taskInfo->hp_slot = hp_slot; |
123 | 116 | ||
124 | rc++; | 117 | rc++; |
125 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | 118 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); |
126 | p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); | ||
127 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 119 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
128 | 120 | ||
129 | if (getstatus) { | 121 | if (getstatus) { |
@@ -131,14 +123,12 @@ u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id) | |||
131 | * Switch opened | 123 | * Switch opened |
132 | */ | 124 | */ |
133 | info("Latch open on Slot(%d)\n", ctrl->first_slot + hp_slot); | 125 | info("Latch open on Slot(%d)\n", ctrl->first_slot + hp_slot); |
134 | p_slot->switch_save = 0; | ||
135 | taskInfo->event_type = INT_SWITCH_OPEN; | 126 | taskInfo->event_type = INT_SWITCH_OPEN; |
136 | } else { | 127 | } else { |
137 | /* | 128 | /* |
138 | * Switch closed | 129 | * Switch closed |
139 | */ | 130 | */ |
140 | info("Latch close on Slot(%d)\n", ctrl->first_slot + hp_slot); | 131 | info("Latch close on Slot(%d)\n", ctrl->first_slot + hp_slot); |
141 | p_slot->switch_save = 0x10; | ||
142 | taskInfo->event_type = INT_SWITCH_CLOSE; | 132 | taskInfo->event_type = INT_SWITCH_CLOSE; |
143 | } | 133 | } |
144 | 134 | ||
@@ -152,7 +142,7 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id) | |||
152 | { | 142 | { |
153 | struct controller *ctrl = (struct controller *) inst_id; | 143 | struct controller *ctrl = (struct controller *) inst_id; |
154 | struct slot *p_slot; | 144 | struct slot *p_slot; |
155 | u8 rc = 0; | 145 | u8 presence_save, rc = 0; |
156 | struct event_info *taskInfo; | 146 | struct event_info *taskInfo; |
157 | 147 | ||
158 | /* Presence Change */ | 148 | /* Presence Change */ |
@@ -162,7 +152,7 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id) | |||
162 | * what to do | 152 | * what to do |
163 | */ | 153 | */ |
164 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); | 154 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); |
165 | ctrl->next_event = (ctrl->next_event + 1) % 10; | 155 | ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; |
166 | taskInfo->hp_slot = hp_slot; | 156 | taskInfo->hp_slot = hp_slot; |
167 | 157 | ||
168 | rc++; | 158 | rc++; |
@@ -171,8 +161,8 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id) | |||
171 | /* Switch is open, assume a presence change | 161 | /* Switch is open, assume a presence change |
172 | * Save the presence state | 162 | * Save the presence state |
173 | */ | 163 | */ |
174 | p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); | 164 | p_slot->hpc_ops->get_adapter_status(p_slot, &presence_save); |
175 | if (p_slot->presence_save) { | 165 | if (presence_save) { |
176 | /* | 166 | /* |
177 | * Card Present | 167 | * Card Present |
178 | */ | 168 | */ |
@@ -206,7 +196,7 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
206 | * what to do | 196 | * what to do |
207 | */ | 197 | */ |
208 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); | 198 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); |
209 | ctrl->next_event = (ctrl->next_event + 1) % 10; | 199 | ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; |
210 | taskInfo->hp_slot = hp_slot; | 200 | taskInfo->hp_slot = hp_slot; |
211 | 201 | ||
212 | rc++; | 202 | rc++; |
@@ -279,11 +269,10 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
279 | * Configures board | 269 | * Configures board |
280 | * | 270 | * |
281 | */ | 271 | */ |
282 | static u32 board_added(struct slot *p_slot) | 272 | static int board_added(struct slot *p_slot) |
283 | { | 273 | { |
284 | u8 hp_slot; | 274 | u8 hp_slot; |
285 | u32 temp_register = 0xFFFFFFFF; | 275 | int rc = 0; |
286 | u32 rc = 0; | ||
287 | struct controller *ctrl = p_slot->ctrl; | 276 | struct controller *ctrl = p_slot->ctrl; |
288 | 277 | ||
289 | hp_slot = p_slot->device - ctrl->slot_device_offset; | 278 | hp_slot = p_slot->device - ctrl->slot_device_offset; |
@@ -333,8 +322,6 @@ static u32 board_added(struct slot *p_slot) | |||
333 | /* Check for a power fault */ | 322 | /* Check for a power fault */ |
334 | if (p_slot->status == 0xFF) { | 323 | if (p_slot->status == 0xFF) { |
335 | /* power fault occurred, but it was benign */ | 324 | /* power fault occurred, but it was benign */ |
336 | temp_register = 0xFFFFFFFF; | ||
337 | dbg("%s: temp register set to %x by power fault\n", __FUNCTION__, temp_register); | ||
338 | rc = POWER_FAILURE; | 325 | rc = POWER_FAILURE; |
339 | p_slot->status = 0; | 326 | p_slot->status = 0; |
340 | goto err_exit; | 327 | goto err_exit; |
@@ -348,8 +335,6 @@ static u32 board_added(struct slot *p_slot) | |||
348 | } | 335 | } |
349 | 336 | ||
350 | p_slot->status = 0; | 337 | p_slot->status = 0; |
351 | p_slot->switch_save = 0x10; | ||
352 | p_slot->is_a_board = 0x01; | ||
353 | 338 | ||
354 | /* | 339 | /* |
355 | * Some PCI Express root ports require fixup after hot-plug operation. | 340 | * Some PCI Express root ports require fixup after hot-plug operation. |
@@ -380,11 +365,11 @@ err_exit: | |||
380 | * remove_board - Turns off slot and LED's | 365 | * remove_board - Turns off slot and LED's |
381 | * | 366 | * |
382 | */ | 367 | */ |
383 | static u32 remove_board(struct slot *p_slot) | 368 | static int remove_board(struct slot *p_slot) |
384 | { | 369 | { |
385 | u8 device; | 370 | u8 device; |
386 | u8 hp_slot; | 371 | u8 hp_slot; |
387 | u32 rc; | 372 | int rc; |
388 | struct controller *ctrl = p_slot->ctrl; | 373 | struct controller *ctrl = p_slot->ctrl; |
389 | 374 | ||
390 | if (pciehp_unconfigure_device(p_slot)) | 375 | if (pciehp_unconfigure_device(p_slot)) |
@@ -398,9 +383,7 @@ static u32 remove_board(struct slot *p_slot) | |||
398 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); | 383 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); |
399 | 384 | ||
400 | /* Change status to shutdown */ | 385 | /* Change status to shutdown */ |
401 | if (p_slot->is_a_board) | 386 | p_slot->status = 0x01; |
402 | p_slot->status = 0x01; | ||
403 | p_slot->configured = 0; | ||
404 | 387 | ||
405 | /* Wait for exclusive access to hardware */ | 388 | /* Wait for exclusive access to hardware */ |
406 | down(&ctrl->crit_sect); | 389 | down(&ctrl->crit_sect); |
@@ -428,9 +411,6 @@ static u32 remove_board(struct slot *p_slot) | |||
428 | /* Done with exclusive hardware access */ | 411 | /* Done with exclusive hardware access */ |
429 | up(&ctrl->crit_sect); | 412 | up(&ctrl->crit_sect); |
430 | 413 | ||
431 | p_slot->switch_save = 0x10; | ||
432 | p_slot->is_a_board = 0; | ||
433 | |||
434 | return 0; | 414 | return 0; |
435 | } | 415 | } |
436 | 416 | ||
@@ -633,7 +613,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
633 | while (change) { | 613 | while (change) { |
634 | change = 0; | 614 | change = 0; |
635 | 615 | ||
636 | for (loop = 0; loop < 10; loop++) { | 616 | for (loop = 0; loop < MAX_EVENTS; loop++) { |
637 | if (ctrl->event_queue[loop].event_type != 0) { | 617 | if (ctrl->event_queue[loop].event_type != 0) { |
638 | hp_slot = ctrl->event_queue[loop].hp_slot; | 618 | hp_slot = ctrl->event_queue[loop].hp_slot; |
639 | 619 | ||
@@ -816,21 +796,11 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
816 | } | 796 | } |
817 | up(&p_slot->ctrl->crit_sect); | 797 | up(&p_slot->ctrl->crit_sect); |
818 | 798 | ||
819 | p_slot->configured = 0; | ||
820 | p_slot->is_a_board = 1; | ||
821 | |||
822 | /* We have to save the presence info for these slots */ | ||
823 | p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); | ||
824 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 799 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
825 | p_slot->switch_save = !getstatus? 0x10:0; | ||
826 | 800 | ||
827 | rc = board_added(p_slot); | 801 | rc = board_added(p_slot); |
828 | if (rc) { | 802 | if (rc) { |
829 | /* We have to save the presence info for these slots */ | ||
830 | p_slot->hpc_ops->get_adapter_status(p_slot, | ||
831 | &(p_slot->presence_save)); | ||
832 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 803 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
833 | p_slot->switch_save = !getstatus? 0x10:0; | ||
834 | } | 804 | } |
835 | 805 | ||
836 | if (p_slot) | 806 | if (p_slot) |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index ef79ca1f38da..5358547f9ee1 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -27,16 +27,10 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
32 | #include <linux/module.h> | 31 | #include <linux/module.h> |
33 | #include <linux/types.h> | 32 | #include <linux/types.h> |
34 | #include <linux/slab.h> | ||
35 | #include <linux/vmalloc.h> | ||
36 | #include <linux/interrupt.h> | ||
37 | #include <linux/spinlock.h> | ||
38 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
39 | #include <asm/system.h> | ||
40 | #include "../pci.h" | 34 | #include "../pci.h" |
41 | #include "pciehp.h" | 35 | #include "pciehp.h" |
42 | 36 | ||
@@ -217,23 +211,6 @@ static int pcie_cap_base = 0; /* Base of the PCI Express capability item struct | |||
217 | #define MRL_STATE 0x0020 | 211 | #define MRL_STATE 0x0020 |
218 | #define PRSN_STATE 0x0040 | 212 | #define PRSN_STATE 0x0040 |
219 | 213 | ||
220 | struct php_ctlr_state_s { | ||
221 | struct php_ctlr_state_s *pnext; | ||
222 | struct pci_dev *pci_dev; | ||
223 | unsigned int irq; | ||
224 | unsigned long flags; /* spinlock's */ | ||
225 | u32 slot_device_offset; | ||
226 | u32 num_slots; | ||
227 | struct timer_list int_poll_timer; /* Added for poll event */ | ||
228 | php_intr_callback_t attention_button_callback; | ||
229 | php_intr_callback_t switch_change_callback; | ||
230 | php_intr_callback_t presence_change_callback; | ||
231 | php_intr_callback_t power_fault_callback; | ||
232 | void *callback_instance_id; | ||
233 | struct ctrl_reg *creg; /* Ptr to controller register space */ | ||
234 | }; | ||
235 | |||
236 | |||
237 | static spinlock_t hpc_event_lock; | 214 | static spinlock_t hpc_event_lock; |
238 | 215 | ||
239 | DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */ | 216 | DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */ |
@@ -1248,12 +1225,7 @@ static struct hpc_ops pciehp_hpc_ops = { | |||
1248 | .check_lnk_status = hpc_check_lnk_status, | 1225 | .check_lnk_status = hpc_check_lnk_status, |
1249 | }; | 1226 | }; |
1250 | 1227 | ||
1251 | int pcie_init(struct controller * ctrl, | 1228 | int pcie_init(struct controller * ctrl, struct pcie_device *dev) |
1252 | struct pcie_device *dev, | ||
1253 | php_intr_callback_t attention_button_callback, | ||
1254 | php_intr_callback_t switch_change_callback, | ||
1255 | php_intr_callback_t presence_change_callback, | ||
1256 | php_intr_callback_t power_fault_callback) | ||
1257 | { | 1229 | { |
1258 | struct php_ctlr_state_s *php_ctlr, *p; | 1230 | struct php_ctlr_state_s *php_ctlr, *p; |
1259 | void *instance_id = ctrl; | 1231 | void *instance_id = ctrl; |
@@ -1362,10 +1334,10 @@ int pcie_init(struct controller * ctrl, | |||
1362 | dbg("HPC interrupt = %d\n", php_ctlr->irq); | 1334 | dbg("HPC interrupt = %d\n", php_ctlr->irq); |
1363 | 1335 | ||
1364 | /* Save interrupt callback info */ | 1336 | /* Save interrupt callback info */ |
1365 | php_ctlr->attention_button_callback = attention_button_callback; | 1337 | php_ctlr->attention_button_callback = pciehp_handle_attention_button; |
1366 | php_ctlr->switch_change_callback = switch_change_callback; | 1338 | php_ctlr->switch_change_callback = pciehp_handle_switch_change; |
1367 | php_ctlr->presence_change_callback = presence_change_callback; | 1339 | php_ctlr->presence_change_callback = pciehp_handle_presence_change; |
1368 | php_ctlr->power_fault_callback = power_fault_callback; | 1340 | php_ctlr->power_fault_callback = pciehp_handle_power_fault; |
1369 | php_ctlr->callback_instance_id = instance_id; | 1341 | php_ctlr->callback_instance_id = instance_id; |
1370 | 1342 | ||
1371 | /* return PCI Controller Info */ | 1343 | /* return PCI Controller Info */ |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 1d185c1bc77a..647673a7d224 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
@@ -27,13 +27,9 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/types.h> | 32 | #include <linux/types.h> |
34 | #include <linux/slab.h> | ||
35 | #include <linux/workqueue.h> | ||
36 | #include <linux/proc_fs.h> | ||
37 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
38 | #include "../pci.h" | 34 | #include "../pci.h" |
39 | #include "pciehp.h" | 35 | #include "pciehp.h" |
diff --git a/drivers/pci/hotplug/pciehprm_acpi.c b/drivers/pci/hotplug/pciehprm_acpi.c index c823cfa42eec..5d184582331e 100644 --- a/drivers/pci/hotplug/pciehprm_acpi.c +++ b/drivers/pci/hotplug/pciehprm_acpi.c | |||
@@ -24,18 +24,12 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
29 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
30 | #include <linux/types.h> | 29 | #include <linux/types.h> |
31 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
32 | #include <linux/init.h> | ||
33 | #include <linux/acpi.h> | 31 | #include <linux/acpi.h> |
34 | #include <linux/efi.h> | ||
35 | #include <linux/pci-acpi.h> | 32 | #include <linux/pci-acpi.h> |
36 | #include <asm/uaccess.h> | ||
37 | #include <asm/system.h> | ||
38 | #include <acpi/acpi.h> | ||
39 | #include <acpi/acpi_bus.h> | 33 | #include <acpi/acpi_bus.h> |
40 | #include <acpi/actypes.h> | 34 | #include <acpi/actypes.h> |
41 | #include "pciehp.h" | 35 | #include "pciehp.h" |
diff --git a/drivers/pci/hotplug/pciehprm_nonacpi.c b/drivers/pci/hotplug/pciehprm_nonacpi.c index 32371cd19e34..6447642f78c5 100644 --- a/drivers/pci/hotplug/pciehprm_nonacpi.c +++ b/drivers/pci/hotplug/pciehprm_nonacpi.c | |||
@@ -27,25 +27,13 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/types.h> | 32 | #include <linux/types.h> |
34 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
35 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
36 | #include <linux/init.h> | ||
37 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
38 | #include <asm/uaccess.h> | ||
39 | #include "pciehp.h" | 36 | #include "pciehp.h" |
40 | #include "pciehprm_nonacpi.h" | ||
41 | |||
42 | |||
43 | int pciehprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) | ||
44 | { | ||
45 | |||
46 | *sun = (u8) (ctrl->first_slot); | ||
47 | return 0; | ||
48 | } | ||
49 | 37 | ||
50 | void get_hp_params_from_firmware(struct pci_dev *dev, | 38 | void get_hp_params_from_firmware(struct pci_dev *dev, |
51 | struct hotplug_params *hpp) | 39 | struct hotplug_params *hpp) |