aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorrajesh.shah@intel.com <rajesh.shah@intel.com>2005-10-13 15:05:42 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 18:37:00 -0400
commitee138334d5eb5ca662b2d69228420c1ccc051e0e (patch)
tree6c8f0d28ab39f4ea9abb0e9986f8c9a3fca6f470 /drivers/pci
parent2178bfad9ccb0cbeb79599dd1dc349dd4567aa49 (diff)
[PATCH] shpchp: miscellaneous cleanups
Remove un-necessary header includes, remove dead code, remove some type casts, receive function return in the correct data type... Signed-off-by: Rajesh Shah <rajesh.shah@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/shpchp.h14
-rw-r--r--drivers/pci/hotplug/shpchp_core.c12
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c31
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c126
-rw-r--r--drivers/pci/hotplug/shpchp_pci.c4
-rw-r--r--drivers/pci/hotplug/shpchp_sysfs.c3
-rw-r--r--drivers/pci/hotplug/shpchprm_acpi.c6
-rw-r--r--drivers/pci/hotplug/shpchprm_legacy.c4
-rw-r--r--drivers/pci/hotplug/shpchprm_nonacpi.c3
9 files changed, 46 insertions, 157 deletions
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index 052c11f14a79..ade8ec145e1e 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.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 "pci_hotplug.h" 35#include "pci_hotplug.h"
38 36
39#if !defined(MODULE) 37#if !defined(MODULE)
@@ -80,7 +78,7 @@ struct event_info {
80struct controller { 78struct controller {
81 struct controller *next; 79 struct controller *next;
82 struct semaphore crit_sect; /* critical section semaphore */ 80 struct semaphore crit_sect; /* critical section semaphore */
83 void * hpc_ctlr_handle; /* HPC controller handle */ 81 struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */
84 int num_slots; /* Number of slots on ctlr */ 82 int num_slots; /* Number of slots on ctlr */
85 int slot_num_inc; /* 1 or -1 */ 83 int slot_num_inc; /* 1 or -1 */
86 struct pci_dev *pci_dev; 84 struct pci_dev *pci_dev;
@@ -234,7 +232,7 @@ enum ctrl_offsets {
234 SLOT11 = offsetof(struct ctrl_reg, slot11), 232 SLOT11 = offsetof(struct ctrl_reg, slot11),
235 SLOT12 = offsetof(struct ctrl_reg, slot12), 233 SLOT12 = offsetof(struct ctrl_reg, slot12),
236}; 234};
237typedef u8(*php_intr_callback_t) (unsigned int change_id, void *instance_id); 235typedef u8(*php_intr_callback_t) (u8 hp_slot, void *instance_id);
238struct php_ctlr_state_s { 236struct php_ctlr_state_s {
239 struct php_ctlr_state_s *pnext; 237 struct php_ctlr_state_s *pnext;
240 struct pci_dev *pci_dev; 238 struct pci_dev *pci_dev;
@@ -347,11 +345,7 @@ enum php_ctlr_type {
347 ACPI 345 ACPI
348}; 346};
349 347
350int shpc_init( struct controller *ctrl, struct pci_dev *pdev, 348int shpc_init( struct controller *ctrl, struct pci_dev *pdev);
351 php_intr_callback_t attention_button_callback,
352 php_intr_callback_t switch_change_callback,
353 php_intr_callback_t presence_change_callback,
354 php_intr_callback_t power_fault_callback);
355 349
356int shpc_get_ctlr_slot_config( struct controller *ctrl, 350int shpc_get_ctlr_slot_config( struct controller *ctrl,
357 int *num_ctlr_slots, 351 int *num_ctlr_slots,
@@ -364,8 +358,6 @@ struct hpc_ops {
364 int (*power_on_slot ) (struct slot *slot); 358 int (*power_on_slot ) (struct slot *slot);
365 int (*slot_enable ) (struct slot *slot); 359 int (*slot_enable ) (struct slot *slot);
366 int (*slot_disable ) (struct slot *slot); 360 int (*slot_disable ) (struct slot *slot);
367 int (*enable_all_slots) (struct slot *slot);
368 int (*pwr_on_all_slots) (struct slot *slot);
369 int (*set_bus_speed_mode) (struct slot *slot, enum pci_bus_speed speed); 361 int (*set_bus_speed_mode) (struct slot *slot, enum pci_bus_speed speed);
370 int (*get_power_status) (struct slot *slot, u8 *status); 362 int (*get_power_status) (struct slot *slot, u8 *status);
371 int (*get_attention_status) (struct slot *slot, u8 *status); 363 int (*get_attention_status) (struct slot *slot, u8 *status);
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index b54edccbf2cc..28ed2dc9388a 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_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 "shpchp.h" 35#include "shpchp.h"
42 36
43/* Global variables */ 37/* Global variables */
@@ -381,11 +375,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
381 375
382 dbg("DRV_thread pid = %d\n", current->pid); 376 dbg("DRV_thread pid = %d\n", current->pid);
383 377
384 rc = shpc_init(ctrl, pdev, 378 rc = shpc_init(ctrl, pdev);
385 (php_intr_callback_t) shpchp_handle_attention_button,
386 (php_intr_callback_t) shpchp_handle_switch_change,
387 (php_intr_callback_t) shpchp_handle_presence_change,
388 (php_intr_callback_t) shpchp_handle_power_fault);
389 if (rc) { 379 if (rc) {
390 dbg("%s: controller initialization failed\n", SHPC_MODULE_NAME); 380 dbg("%s: controller initialization failed\n", SHPC_MODULE_NAME);
391 goto err_out_free_ctrl; 381 goto err_out_free_ctrl;
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index b6fde3565e55..8541180781e1 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_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"
@@ -242,9 +236,10 @@ u8 shpchp_handle_power_fault(u8 hp_slot, void *inst_id)
242/* The following routines constitute the bulk of the 236/* The following routines constitute the bulk of the
243 hotplug controller logic 237 hotplug controller logic
244 */ 238 */
245static u32 change_bus_speed(struct controller *ctrl, struct slot *p_slot, enum pci_bus_speed speed) 239static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
240 enum pci_bus_speed speed)
246{ 241{
247 u32 rc = 0; 242 int rc = 0;
248 243
249 dbg("%s: change to speed %d\n", __FUNCTION__, speed); 244 dbg("%s: change to speed %d\n", __FUNCTION__, speed);
250 down(&ctrl->crit_sect); 245 down(&ctrl->crit_sect);
@@ -266,10 +261,11 @@ static u32 change_bus_speed(struct controller *ctrl, struct slot *p_slot, enum p
266 return rc; 261 return rc;
267} 262}
268 263
269static u32 fix_bus_speed(struct controller *ctrl, struct slot *pslot, u8 flag, 264static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
270enum pci_bus_speed asp, enum pci_bus_speed bsp, enum pci_bus_speed msp) 265 u8 flag, enum pci_bus_speed asp, enum pci_bus_speed bsp,
266 enum pci_bus_speed msp)
271{ 267{
272 u32 rc = 0; 268 int rc = 0;
273 269
274 if (flag != 0) { /* Other slots on the same bus are occupied */ 270 if (flag != 0) { /* Other slots on the same bus are occupied */
275 if ( asp < bsp ) { 271 if ( asp < bsp ) {
@@ -308,11 +304,11 @@ enum pci_bus_speed asp, enum pci_bus_speed bsp, enum pci_bus_speed msp)
308 * Configures board 304 * Configures board
309 * 305 *
310 */ 306 */
311static u32 board_added(struct slot *p_slot) 307static int board_added(struct slot *p_slot)
312{ 308{
313 u8 hp_slot; 309 u8 hp_slot;
314 u8 slots_not_empty = 0; 310 u8 slots_not_empty = 0;
315 u32 rc = 0; 311 int rc = 0;
316 enum pci_bus_speed adapter_speed, bus_speed, max_bus_speed; 312 enum pci_bus_speed adapter_speed, bus_speed, max_bus_speed;
317 u8 pi, mode; 313 u8 pi, mode;
318 struct controller *ctrl = p_slot->ctrl; 314 struct controller *ctrl = p_slot->ctrl;
@@ -580,11 +576,11 @@ err_exit:
580 * remove_board - Turns off slot and LED's 576 * remove_board - Turns off slot and LED's
581 * 577 *
582 */ 578 */
583static u32 remove_board(struct slot *p_slot) 579static int remove_board(struct slot *p_slot)
584{ 580{
585 struct controller *ctrl = p_slot->ctrl; 581 struct controller *ctrl = p_slot->ctrl;
586 u8 hp_slot; 582 u8 hp_slot;
587 u32 rc; 583 int rc;
588 584
589 if (shpchp_unconfigure_device(p_slot)) 585 if (shpchp_unconfigure_device(p_slot))
590 return(1); 586 return(1);
@@ -961,7 +957,6 @@ int shpchp_enable_slot (struct slot *p_slot)
961int shpchp_disable_slot (struct slot *p_slot) 957int shpchp_disable_slot (struct slot *p_slot)
962{ 958{
963 u8 getstatus = 0; 959 u8 getstatus = 0;
964 u32 rc = 0;
965 int ret = 0; 960 int ret = 0;
966 961
967 if (!p_slot->ctrl) 962 if (!p_slot->ctrl)
@@ -990,8 +985,8 @@ int shpchp_disable_slot (struct slot *p_slot)
990 } 985 }
991 up(&p_slot->ctrl->crit_sect); 986 up(&p_slot->ctrl->crit_sect);
992 987
993 rc = remove_board(p_slot); 988 ret = remove_board(p_slot);
994 update_slot_info(p_slot); 989 update_slot_info(p_slot);
995 return rc; 990 return ret;
996} 991}
997 992
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index d55a9a7f8d2b..d46a47603386 100644
--- a/drivers/pci/hotplug/shpchp_hpc.c
+++ b/drivers/pci/hotplug/shpchp_hpc.c
@@ -27,17 +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/delay.h>
39#include <linux/pci.h> 33#include <linux/pci.h>
40#include <asm/system.h>
41#include "shpchp.h" 34#include "shpchp.h"
42 35
43#ifdef DEBUG 36#ifdef DEBUG
@@ -282,7 +275,7 @@ static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds)
282 275
283static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) 276static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
284{ 277{
285 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 278 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
286 u16 cmd_status; 279 u16 cmd_status;
287 int retval = 0; 280 int retval = 0;
288 u16 temp_word; 281 u16 temp_word;
@@ -328,7 +321,7 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
328 321
329static int hpc_check_cmd_status(struct controller *ctrl) 322static int hpc_check_cmd_status(struct controller *ctrl)
330{ 323{
331 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle; 324 struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle;
332 u16 cmd_status; 325 u16 cmd_status;
333 int retval = 0; 326 int retval = 0;
334 327
@@ -368,7 +361,7 @@ static int hpc_check_cmd_status(struct controller *ctrl)
368 361
369static int hpc_get_attention_status(struct slot *slot, u8 *status) 362static int hpc_get_attention_status(struct slot *slot, u8 *status)
370{ 363{
371 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 364 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
372 u32 slot_reg; 365 u32 slot_reg;
373 u16 slot_status; 366 u16 slot_status;
374 u8 atten_led_state; 367 u8 atten_led_state;
@@ -408,7 +401,7 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status)
408 401
409static int hpc_get_power_status(struct slot * slot, u8 *status) 402static int hpc_get_power_status(struct slot * slot, u8 *status)
410{ 403{
411 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 404 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
412 u32 slot_reg; 405 u32 slot_reg;
413 u16 slot_status; 406 u16 slot_status;
414 u8 slot_state; 407 u8 slot_state;
@@ -450,7 +443,7 @@ static int hpc_get_power_status(struct slot * slot, u8 *status)
450 443
451static int hpc_get_latch_status(struct slot *slot, u8 *status) 444static int hpc_get_latch_status(struct slot *slot, u8 *status)
452{ 445{
453 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 446 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
454 u32 slot_reg; 447 u32 slot_reg;
455 u16 slot_status; 448 u16 slot_status;
456 449
@@ -473,7 +466,7 @@ static int hpc_get_latch_status(struct slot *slot, u8 *status)
473 466
474static int hpc_get_adapter_status(struct slot *slot, u8 *status) 467static int hpc_get_adapter_status(struct slot *slot, u8 *status)
475{ 468{
476 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 469 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
477 u32 slot_reg; 470 u32 slot_reg;
478 u16 slot_status; 471 u16 slot_status;
479 u8 card_state; 472 u8 card_state;
@@ -496,7 +489,7 @@ static int hpc_get_adapter_status(struct slot *slot, u8 *status)
496 489
497static int hpc_get_prog_int(struct slot *slot, u8 *prog_int) 490static int hpc_get_prog_int(struct slot *slot, u8 *prog_int)
498{ 491{
499 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 492 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
500 493
501 DBG_ENTER_ROUTINE 494 DBG_ENTER_ROUTINE
502 495
@@ -513,7 +506,7 @@ static int hpc_get_prog_int(struct slot *slot, u8 *prog_int)
513 506
514static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value) 507static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
515{ 508{
516 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 509 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
517 u32 slot_reg; 510 u32 slot_reg;
518 u16 slot_status, sec_bus_status; 511 u16 slot_status, sec_bus_status;
519 u8 m66_cap, pcix_cap, pi; 512 u8 m66_cap, pcix_cap, pi;
@@ -594,7 +587,7 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
594 587
595static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode) 588static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode)
596{ 589{
597 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 590 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
598 u16 sec_bus_status; 591 u16 sec_bus_status;
599 u8 pi; 592 u8 pi;
600 int retval = 0; 593 int retval = 0;
@@ -623,7 +616,7 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode)
623 616
624static int hpc_query_power_fault(struct slot * slot) 617static int hpc_query_power_fault(struct slot * slot)
625{ 618{
626 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 619 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
627 u32 slot_reg; 620 u32 slot_reg;
628 u16 slot_status; 621 u16 slot_status;
629 u8 pwr_fault_state, status; 622 u8 pwr_fault_state, status;
@@ -647,7 +640,7 @@ static int hpc_query_power_fault(struct slot * slot)
647 640
648static int hpc_set_attention_status(struct slot *slot, u8 value) 641static int hpc_set_attention_status(struct slot *slot, u8 value)
649{ 642{
650 struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 643 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
651 u8 slot_cmd = 0; 644 u8 slot_cmd = 0;
652 int rc = 0; 645 int rc = 0;
653 646
@@ -683,7 +676,7 @@ static int hpc_set_attention_status(struct slot *slot, u8 value)
683 676
684static void hpc_set_green_led_on(struct slot *slot) 677static void hpc_set_green_led_on(struct slot *slot)
685{ 678{
686 struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 679 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
687 u8 slot_cmd; 680 u8 slot_cmd;
688 681
689 if (!slot->ctrl->hpc_ctlr_handle) { 682 if (!slot->ctrl->hpc_ctlr_handle) {
@@ -705,7 +698,7 @@ static void hpc_set_green_led_on(struct slot *slot)
705 698
706static void hpc_set_green_led_off(struct slot *slot) 699static void hpc_set_green_led_off(struct slot *slot)
707{ 700{
708 struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 701 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
709 u8 slot_cmd; 702 u8 slot_cmd;
710 703
711 if (!slot->ctrl->hpc_ctlr_handle) { 704 if (!slot->ctrl->hpc_ctlr_handle) {
@@ -727,7 +720,7 @@ static void hpc_set_green_led_off(struct slot *slot)
727 720
728static void hpc_set_green_led_blink(struct slot *slot) 721static void hpc_set_green_led_blink(struct slot *slot)
729{ 722{
730 struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 723 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
731 u8 slot_cmd; 724 u8 slot_cmd;
732 725
733 if (!slot->ctrl->hpc_ctlr_handle) { 726 if (!slot->ctrl->hpc_ctlr_handle) {
@@ -754,7 +747,7 @@ int shpc_get_ctlr_slot_config(struct controller *ctrl,
754 int *updown, /* physical_slot_num increament: 1 or -1 */ 747 int *updown, /* physical_slot_num increament: 1 or -1 */
755 int *flags) 748 int *flags)
756{ 749{
757 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle; 750 struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle;
758 751
759 DBG_ENTER_ROUTINE 752 DBG_ENTER_ROUTINE
760 753
@@ -776,7 +769,7 @@ int shpc_get_ctlr_slot_config(struct controller *ctrl,
776 769
777static void hpc_release_ctlr(struct controller *ctrl) 770static void hpc_release_ctlr(struct controller *ctrl)
778{ 771{
779 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle; 772 struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle;
780 struct php_ctlr_state_s *p, *p_prev; 773 struct php_ctlr_state_s *p, *p_prev;
781 774
782 DBG_ENTER_ROUTINE 775 DBG_ENTER_ROUTINE
@@ -828,7 +821,7 @@ DBG_LEAVE_ROUTINE
828 821
829static int hpc_power_on_slot(struct slot * slot) 822static int hpc_power_on_slot(struct slot * slot)
830{ 823{
831 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 824 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
832 u8 slot_cmd; 825 u8 slot_cmd;
833 int retval = 0; 826 int retval = 0;
834 827
@@ -859,7 +852,7 @@ static int hpc_power_on_slot(struct slot * slot)
859 852
860static int hpc_slot_enable(struct slot * slot) 853static int hpc_slot_enable(struct slot * slot)
861{ 854{
862 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 855 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
863 u8 slot_cmd; 856 u8 slot_cmd;
864 int retval = 0; 857 int retval = 0;
865 858
@@ -890,7 +883,7 @@ static int hpc_slot_enable(struct slot * slot)
890 883
891static int hpc_slot_disable(struct slot * slot) 884static int hpc_slot_disable(struct slot * slot)
892{ 885{
893 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 886 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
894 u8 slot_cmd; 887 u8 slot_cmd;
895 int retval = 0; 888 int retval = 0;
896 889
@@ -920,51 +913,12 @@ static int hpc_slot_disable(struct slot * slot)
920 return retval; 913 return retval;
921} 914}
922 915
923static int hpc_enable_all_slots( struct slot *slot )
924{
925 int retval = 0;
926
927 DBG_ENTER_ROUTINE
928
929 if (!slot->ctrl->hpc_ctlr_handle) {
930 err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
931 return -1;
932 }
933
934 retval = shpc_write_cmd(slot, 0, SET_ENABLE_ALL);
935 if (retval) {
936 err("%s: Write command failed!\n", __FUNCTION__);
937 return -1;
938 }
939
940 DBG_LEAVE_ROUTINE
941
942 return retval;
943}
944
945static int hpc_pwr_on_all_slots(struct slot *slot)
946{
947 int retval = 0;
948
949 DBG_ENTER_ROUTINE
950
951 retval = shpc_write_cmd(slot, 0, SET_PWR_ON_ALL);
952
953 if (retval) {
954 err("%s: Write command failed!\n", __FUNCTION__);
955 return -1;
956 }
957
958 DBG_LEAVE_ROUTINE
959 return retval;
960}
961
962static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value) 916static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value)
963{ 917{
964 u8 slot_cmd; 918 u8 slot_cmd;
965 u8 pi; 919 u8 pi;
966 int retval = 0; 920 int retval = 0;
967 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 921 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
968 922
969 DBG_ENTER_ROUTINE 923 DBG_ENTER_ROUTINE
970 924
@@ -1184,7 +1138,7 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
1184 1138
1185static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value) 1139static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value)
1186{ 1140{
1187 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 1141 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
1188 enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN; 1142 enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN;
1189 int retval = 0; 1143 int retval = 0;
1190 u8 pi; 1144 u8 pi;
@@ -1253,7 +1207,7 @@ static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value)
1253 1207
1254static int hpc_get_cur_bus_speed (struct slot *slot, enum pci_bus_speed *value) 1208static int hpc_get_cur_bus_speed (struct slot *slot, enum pci_bus_speed *value)
1255{ 1209{
1256 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; 1210 struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
1257 enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN; 1211 enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN;
1258 u16 sec_bus_status; 1212 u16 sec_bus_status;
1259 int retval = 0; 1213 int retval = 0;
@@ -1367,8 +1321,6 @@ static struct hpc_ops shpchp_hpc_ops = {
1367 .power_on_slot = hpc_power_on_slot, 1321 .power_on_slot = hpc_power_on_slot,
1368 .slot_enable = hpc_slot_enable, 1322 .slot_enable = hpc_slot_enable,
1369 .slot_disable = hpc_slot_disable, 1323 .slot_disable = hpc_slot_disable,
1370 .enable_all_slots = hpc_enable_all_slots,
1371 .pwr_on_all_slots = hpc_pwr_on_all_slots,
1372 .set_bus_speed_mode = hpc_set_bus_speed_mode, 1324 .set_bus_speed_mode = hpc_set_bus_speed_mode,
1373 .set_attention_status = hpc_set_attention_status, 1325 .set_attention_status = hpc_set_attention_status,
1374 .get_power_status = hpc_get_power_status, 1326 .get_power_status = hpc_get_power_status,
@@ -1391,12 +1343,7 @@ static struct hpc_ops shpchp_hpc_ops = {
1391 .check_cmd_status = hpc_check_cmd_status, 1343 .check_cmd_status = hpc_check_cmd_status,
1392}; 1344};
1393 1345
1394int shpc_init(struct controller * ctrl, 1346int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1395 struct pci_dev * pdev,
1396 php_intr_callback_t attention_button_callback,
1397 php_intr_callback_t switch_change_callback,
1398 php_intr_callback_t presence_change_callback,
1399 php_intr_callback_t power_fault_callback)
1400{ 1347{
1401 struct php_ctlr_state_s *php_ctlr, *p; 1348 struct php_ctlr_state_s *php_ctlr, *p;
1402 void *instance_id = ctrl; 1349 void *instance_id = ctrl;
@@ -1405,7 +1352,6 @@ int shpc_init(struct controller * ctrl,
1405 static int first = 1; 1352 static int first = 1;
1406 u32 shpc_cap_offset, shpc_base_offset; 1353 u32 shpc_cap_offset, shpc_base_offset;
1407 u32 tempdword, slot_reg; 1354 u32 tempdword, slot_reg;
1408 u16 vendor_id, device_id;
1409 u8 i; 1355 u8 i;
1410 1356
1411 DBG_ENTER_ROUTINE 1357 DBG_ENTER_ROUTINE
@@ -1422,21 +1368,8 @@ int shpc_init(struct controller * ctrl,
1422 1368
1423 php_ctlr->pci_dev = pdev; /* save pci_dev in context */ 1369 php_ctlr->pci_dev = pdev; /* save pci_dev in context */
1424 1370
1425 rc = pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor_id); 1371 if ((pdev->vendor == PCI_VENDOR_ID_AMD) || (pdev->device ==
1426 dbg("%s: Vendor ID: %x\n",__FUNCTION__, vendor_id); 1372 PCI_DEVICE_ID_AMD_GOLAM_7450)) {
1427 if (rc) {
1428 err("%s: unable to read PCI configuration data\n", __FUNCTION__);
1429 goto abort_free_ctlr;
1430 }
1431
1432 rc = pci_read_config_word(pdev, PCI_DEVICE_ID, &device_id);
1433 dbg("%s: Device ID: %x\n",__FUNCTION__, device_id);
1434 if (rc) {
1435 err("%s: unable to read PCI configuration data\n", __FUNCTION__);
1436 goto abort_free_ctlr;
1437 }
1438
1439 if ((vendor_id == PCI_VENDOR_ID_AMD) || (device_id == PCI_DEVICE_ID_AMD_GOLAM_7450)) {
1440 shpc_base_offset = 0; /* amd shpc driver doesn't use this; assume 0 */ 1373 shpc_base_offset = 0; /* amd shpc driver doesn't use this; assume 0 */
1441 } else { 1374 } else {
1442 if ((shpc_cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC)) == 0) { 1375 if ((shpc_cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC)) == 0) {
@@ -1514,11 +1447,10 @@ int shpc_init(struct controller * ctrl,
1514 php_ctlr->irq = pdev->irq; 1447 php_ctlr->irq = pdev->irq;
1515 dbg("HPC interrupt = %d\n", php_ctlr->irq); 1448 dbg("HPC interrupt = %d\n", php_ctlr->irq);
1516 1449
1517 /* Save interrupt callback info */ 1450 php_ctlr->attention_button_callback = shpchp_handle_attention_button,
1518 php_ctlr->attention_button_callback = attention_button_callback; 1451 php_ctlr->switch_change_callback = shpchp_handle_switch_change;
1519 php_ctlr->switch_change_callback = switch_change_callback; 1452 php_ctlr->presence_change_callback = shpchp_handle_presence_change;
1520 php_ctlr->presence_change_callback = presence_change_callback; 1453 php_ctlr->power_fault_callback = shpchp_handle_power_fault;
1521 php_ctlr->power_fault_callback = power_fault_callback;
1522 php_ctlr->callback_instance_id = instance_id; 1454 php_ctlr->callback_instance_id = instance_id;
1523 1455
1524 /* Return PCI Controller Info */ 1456 /* Return PCI Controller Info */
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c
index 8f0a1667f2e6..b8e95acea3b6 100644
--- a/drivers/pci/hotplug/shpchp_pci.c
+++ b/drivers/pci/hotplug/shpchp_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 "shpchp.h" 35#include "shpchp.h"
diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c
index ce41719a88f7..807ef66899c7 100644
--- a/drivers/pci/hotplug/shpchp_sysfs.c
+++ b/drivers/pci/hotplug/shpchp_sysfs.c
@@ -26,12 +26,9 @@
26 * 26 *
27 */ 27 */
28 28
29#include <linux/config.h>
30#include <linux/module.h> 29#include <linux/module.h>
31#include <linux/kernel.h> 30#include <linux/kernel.h>
32#include <linux/types.h> 31#include <linux/types.h>
33#include <linux/proc_fs.h>
34#include <linux/workqueue.h>
35#include <linux/pci.h> 32#include <linux/pci.h>
36#include "shpchp.h" 33#include "shpchp.h"
37 34
diff --git a/drivers/pci/hotplug/shpchprm_acpi.c b/drivers/pci/hotplug/shpchprm_acpi.c
index 3be518c7d47a..17145e52223a 100644
--- a/drivers/pci/hotplug/shpchprm_acpi.c
+++ b/drivers/pci/hotplug/shpchprm_acpi.c
@@ -24,16 +24,10 @@
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>
34#include <linux/efi.h>
35#include <asm/uaccess.h>
36#include <asm/system.h>
37#include <acpi/acpi.h> 31#include <acpi/acpi.h>
38#include <acpi/acpi_bus.h> 32#include <acpi/acpi_bus.h>
39#include <acpi/actypes.h> 33#include <acpi/actypes.h>
diff --git a/drivers/pci/hotplug/shpchprm_legacy.c b/drivers/pci/hotplug/shpchprm_legacy.c
index cfc6092e2afd..ed6c1254bf6f 100644
--- a/drivers/pci/hotplug/shpchprm_legacy.c
+++ b/drivers/pci/hotplug/shpchprm_legacy.c
@@ -27,15 +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/kernel.h> 31#include <linux/kernel.h>
33#include <linux/types.h> 32#include <linux/types.h>
34#include <linux/pci.h> 33#include <linux/pci.h>
35#include <linux/init.h>
36#include <asm/uaccess.h>
37#include "shpchp.h" 34#include "shpchp.h"
38#include "shpchprm.h"
39 35
40int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) 36int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
41{ 37{
diff --git a/drivers/pci/hotplug/shpchprm_nonacpi.c b/drivers/pci/hotplug/shpchprm_nonacpi.c
index f36c188c23eb..d70fe5408417 100644
--- a/drivers/pci/hotplug/shpchprm_nonacpi.c
+++ b/drivers/pci/hotplug/shpchprm_nonacpi.c
@@ -32,10 +32,7 @@
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/pci.h> 34#include <linux/pci.h>
35#include <linux/init.h>
36#include <asm/uaccess.h>
37#include "shpchp.h" 35#include "shpchp.h"
38#include "shpchprm.h"
39 36
40int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) 37int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
41{ 38{