Commit ee138334 authored by rajesh.shah@intel.com's avatar rajesh.shah@intel.com Committed by Greg Kroah-Hartman

[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: default avatarRajesh Shah <rajesh.shah@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2178bfad
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <asm/semaphore.h>
#include <asm/io.h>
#include "pci_hotplug.h" #include "pci_hotplug.h"
#if !defined(MODULE) #if !defined(MODULE)
...@@ -80,7 +78,7 @@ struct event_info { ...@@ -80,7 +78,7 @@ struct event_info {
struct controller { struct controller {
struct controller *next; struct controller *next;
struct semaphore crit_sect; /* critical section semaphore */ struct semaphore crit_sect; /* critical section semaphore */
void * hpc_ctlr_handle; /* HPC controller handle */ struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */
int num_slots; /* Number of slots on ctlr */ int num_slots; /* Number of slots on ctlr */
int slot_num_inc; /* 1 or -1 */ int slot_num_inc; /* 1 or -1 */
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
...@@ -234,7 +232,7 @@ enum ctrl_offsets { ...@@ -234,7 +232,7 @@ enum ctrl_offsets {
SLOT11 = offsetof(struct ctrl_reg, slot11), SLOT11 = offsetof(struct ctrl_reg, slot11),
SLOT12 = offsetof(struct ctrl_reg, slot12), SLOT12 = offsetof(struct ctrl_reg, slot12),
}; };
typedef u8(*php_intr_callback_t) (unsigned int change_id, void *instance_id); typedef u8(*php_intr_callback_t) (u8 hp_slot, void *instance_id);
struct php_ctlr_state_s { struct php_ctlr_state_s {
struct php_ctlr_state_s *pnext; struct php_ctlr_state_s *pnext;
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
...@@ -347,11 +345,7 @@ enum php_ctlr_type { ...@@ -347,11 +345,7 @@ enum php_ctlr_type {
ACPI ACPI
}; };
int shpc_init( struct controller *ctrl, struct pci_dev *pdev, int shpc_init( struct controller *ctrl, struct pci_dev *pdev);
php_intr_callback_t attention_button_callback,
php_intr_callback_t switch_change_callback,
php_intr_callback_t presence_change_callback,
php_intr_callback_t power_fault_callback);
int shpc_get_ctlr_slot_config( struct controller *ctrl, int shpc_get_ctlr_slot_config( struct controller *ctrl,
int *num_ctlr_slots, int *num_ctlr_slots,
...@@ -364,8 +358,6 @@ struct hpc_ops { ...@@ -364,8 +358,6 @@ struct hpc_ops {
int (*power_on_slot ) (struct slot *slot); int (*power_on_slot ) (struct slot *slot);
int (*slot_enable ) (struct slot *slot); int (*slot_enable ) (struct slot *slot);
int (*slot_disable ) (struct slot *slot); int (*slot_disable ) (struct slot *slot);
int (*enable_all_slots) (struct slot *slot);
int (*pwr_on_all_slots) (struct slot *slot);
int (*set_bus_speed_mode) (struct slot *slot, enum pci_bus_speed speed); int (*set_bus_speed_mode) (struct slot *slot, enum pci_bus_speed speed);
int (*get_power_status) (struct slot *slot, u8 *status); int (*get_power_status) (struct slot *slot, u8 *status);
int (*get_attention_status) (struct slot *slot, u8 *status); int (*get_attention_status) (struct slot *slot, u8 *status);
......
...@@ -27,17 +27,11 @@ ...@@ -27,17 +27,11 @@
* *
*/ */
#include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include "shpchp.h" #include "shpchp.h"
/* Global variables */ /* Global variables */
...@@ -381,11 +375,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -381,11 +375,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dbg("DRV_thread pid = %d\n", current->pid); dbg("DRV_thread pid = %d\n", current->pid);
rc = shpc_init(ctrl, pdev, rc = shpc_init(ctrl, pdev);
(php_intr_callback_t) shpchp_handle_attention_button,
(php_intr_callback_t) shpchp_handle_switch_change,
(php_intr_callback_t) shpchp_handle_presence_change,
(php_intr_callback_t) shpchp_handle_power_fault);
if (rc) { if (rc) {
dbg("%s: controller initialization failed\n", SHPC_MODULE_NAME); dbg("%s: controller initialization failed\n", SHPC_MODULE_NAME);
goto err_out_free_ctrl; goto err_out_free_ctrl;
......
...@@ -27,15 +27,9 @@ ...@@ -27,15 +27,9 @@
* *
*/ */
#include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/wait.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/pci.h> #include <linux/pci.h>
#include "../pci.h" #include "../pci.h"
...@@ -242,9 +236,10 @@ u8 shpchp_handle_power_fault(u8 hp_slot, void *inst_id) ...@@ -242,9 +236,10 @@ u8 shpchp_handle_power_fault(u8 hp_slot, void *inst_id)
/* The following routines constitute the bulk of the /* The following routines constitute the bulk of the
hotplug controller logic hotplug controller logic
*/ */
static u32 change_bus_speed(struct controller *ctrl, struct slot *p_slot, enum pci_bus_speed speed) static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
enum pci_bus_speed speed)
{ {
u32 rc = 0; int rc = 0;
dbg("%s: change to speed %d\n", __FUNCTION__, speed); dbg("%s: change to speed %d\n", __FUNCTION__, speed);
down(&ctrl->crit_sect); down(&ctrl->crit_sect);
...@@ -266,10 +261,11 @@ static u32 change_bus_speed(struct controller *ctrl, struct slot *p_slot, enum p ...@@ -266,10 +261,11 @@ static u32 change_bus_speed(struct controller *ctrl, struct slot *p_slot, enum p
return rc; return rc;
} }
static u32 fix_bus_speed(struct controller *ctrl, struct slot *pslot, u8 flag, static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
enum pci_bus_speed asp, enum pci_bus_speed bsp, enum pci_bus_speed msp) u8 flag, enum pci_bus_speed asp, enum pci_bus_speed bsp,
enum pci_bus_speed msp)
{ {
u32 rc = 0; int rc = 0;
if (flag != 0) { /* Other slots on the same bus are occupied */ if (flag != 0) { /* Other slots on the same bus are occupied */
if ( asp < bsp ) { if ( asp < bsp ) {
...@@ -308,11 +304,11 @@ enum pci_bus_speed asp, enum pci_bus_speed bsp, enum pci_bus_speed msp) ...@@ -308,11 +304,11 @@ enum pci_bus_speed asp, enum pci_bus_speed bsp, enum pci_bus_speed msp)
* Configures board * Configures board
* *
*/ */
static u32 board_added(struct slot *p_slot) static int board_added(struct slot *p_slot)
{ {
u8 hp_slot; u8 hp_slot;
u8 slots_not_empty = 0; u8 slots_not_empty = 0;
u32 rc = 0; int rc = 0;
enum pci_bus_speed adapter_speed, bus_speed, max_bus_speed; enum pci_bus_speed adapter_speed, bus_speed, max_bus_speed;
u8 pi, mode; u8 pi, mode;
struct controller *ctrl = p_slot->ctrl; struct controller *ctrl = p_slot->ctrl;
...@@ -580,11 +576,11 @@ static u32 board_added(struct slot *p_slot) ...@@ -580,11 +576,11 @@ static u32 board_added(struct slot *p_slot)
* remove_board - Turns off slot and LED's * remove_board - Turns off slot and LED's
* *
*/ */
static u32 remove_board(struct slot *p_slot) static int remove_board(struct slot *p_slot)
{ {
struct controller *ctrl = p_slot->ctrl; struct controller *ctrl = p_slot->ctrl;
u8 hp_slot; u8 hp_slot;
u32 rc; int rc;
if (shpchp_unconfigure_device(p_slot)) if (shpchp_unconfigure_device(p_slot))
return(1); return(1);
...@@ -961,7 +957,6 @@ int shpchp_enable_slot (struct slot *p_slot) ...@@ -961,7 +957,6 @@ int shpchp_enable_slot (struct slot *p_slot)
int shpchp_disable_slot (struct slot *p_slot) int shpchp_disable_slot (struct slot *p_slot)
{ {
u8 getstatus = 0; u8 getstatus = 0;
u32 rc = 0;
int ret = 0; int ret = 0;
if (!p_slot->ctrl) if (!p_slot->ctrl)
...@@ -990,8 +985,8 @@ int shpchp_disable_slot (struct slot *p_slot) ...@@ -990,8 +985,8 @@ int shpchp_disable_slot (struct slot *p_slot)
} }
up(&p_slot->ctrl->crit_sect); up(&p_slot->ctrl->crit_sect);
rc = remove_board(p_slot); ret = remove_board(p_slot);
update_slot_info(p_slot); update_slot_info(p_slot);
return rc; return ret;
} }
...@@ -27,17 +27,10 @@ ...@@ -27,17 +27,10 @@
* *
*/ */
#include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/system.h>
#include "shpchp.h" #include "shpchp.h"
#ifdef DEBUG #ifdef DEBUG
...@@ -282,7 +275,7 @@ static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds) ...@@ -282,7 +275,7 @@ static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds)
static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u16 cmd_status; u16 cmd_status;
int retval = 0; int retval = 0;
u16 temp_word; u16 temp_word;
...@@ -328,7 +321,7 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) ...@@ -328,7 +321,7 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
static int hpc_check_cmd_status(struct controller *ctrl) static int hpc_check_cmd_status(struct controller *ctrl)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle;
u16 cmd_status; u16 cmd_status;
int retval = 0; int retval = 0;
...@@ -368,7 +361,7 @@ static int hpc_check_cmd_status(struct controller *ctrl) ...@@ -368,7 +361,7 @@ static int hpc_check_cmd_status(struct controller *ctrl)
static int hpc_get_attention_status(struct slot *slot, u8 *status) static int hpc_get_attention_status(struct slot *slot, u8 *status)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u32 slot_reg; u32 slot_reg;
u16 slot_status; u16 slot_status;
u8 atten_led_state; u8 atten_led_state;
...@@ -408,7 +401,7 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status) ...@@ -408,7 +401,7 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status)
static int hpc_get_power_status(struct slot * slot, u8 *status) static int hpc_get_power_status(struct slot * slot, u8 *status)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u32 slot_reg; u32 slot_reg;
u16 slot_status; u16 slot_status;
u8 slot_state; u8 slot_state;
...@@ -450,7 +443,7 @@ static int hpc_get_power_status(struct slot * slot, u8 *status) ...@@ -450,7 +443,7 @@ static int hpc_get_power_status(struct slot * slot, u8 *status)
static int hpc_get_latch_status(struct slot *slot, u8 *status) static int hpc_get_latch_status(struct slot *slot, u8 *status)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u32 slot_reg; u32 slot_reg;
u16 slot_status; u16 slot_status;
...@@ -473,7 +466,7 @@ static int hpc_get_latch_status(struct slot *slot, u8 *status) ...@@ -473,7 +466,7 @@ static int hpc_get_latch_status(struct slot *slot, u8 *status)
static int hpc_get_adapter_status(struct slot *slot, u8 *status) static int hpc_get_adapter_status(struct slot *slot, u8 *status)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u32 slot_reg; u32 slot_reg;
u16 slot_status; u16 slot_status;
u8 card_state; u8 card_state;
...@@ -496,7 +489,7 @@ static int hpc_get_adapter_status(struct slot *slot, u8 *status) ...@@ -496,7 +489,7 @@ static int hpc_get_adapter_status(struct slot *slot, u8 *status)
static int hpc_get_prog_int(struct slot *slot, u8 *prog_int) static int hpc_get_prog_int(struct slot *slot, u8 *prog_int)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
DBG_ENTER_ROUTINE DBG_ENTER_ROUTINE
...@@ -513,7 +506,7 @@ static int hpc_get_prog_int(struct slot *slot, u8 *prog_int) ...@@ -513,7 +506,7 @@ static int hpc_get_prog_int(struct slot *slot, u8 *prog_int)
static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value) static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u32 slot_reg; u32 slot_reg;
u16 slot_status, sec_bus_status; u16 slot_status, sec_bus_status;
u8 m66_cap, pcix_cap, pi; 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,7 +587,7 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value)
static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode) static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u16 sec_bus_status; u16 sec_bus_status;
u8 pi; u8 pi;
int retval = 0; int retval = 0;
...@@ -623,7 +616,7 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode) ...@@ -623,7 +616,7 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode)
static int hpc_query_power_fault(struct slot * slot) static int hpc_query_power_fault(struct slot * slot)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u32 slot_reg; u32 slot_reg;
u16 slot_status; u16 slot_status;
u8 pwr_fault_state, status; u8 pwr_fault_state, status;
...@@ -647,7 +640,7 @@ static int hpc_query_power_fault(struct slot * slot) ...@@ -647,7 +640,7 @@ static int hpc_query_power_fault(struct slot * slot)
static int hpc_set_attention_status(struct slot *slot, u8 value) static int hpc_set_attention_status(struct slot *slot, u8 value)
{ {
struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd = 0; u8 slot_cmd = 0;
int rc = 0; int rc = 0;
...@@ -683,7 +676,7 @@ static int hpc_set_attention_status(struct slot *slot, u8 value) ...@@ -683,7 +676,7 @@ static int hpc_set_attention_status(struct slot *slot, u8 value)
static void hpc_set_green_led_on(struct slot *slot) static void hpc_set_green_led_on(struct slot *slot)
{ {
struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd; u8 slot_cmd;
if (!slot->ctrl->hpc_ctlr_handle) { if (!slot->ctrl->hpc_ctlr_handle) {
...@@ -705,7 +698,7 @@ static void hpc_set_green_led_on(struct slot *slot) ...@@ -705,7 +698,7 @@ static void hpc_set_green_led_on(struct slot *slot)
static void hpc_set_green_led_off(struct slot *slot) static void hpc_set_green_led_off(struct slot *slot)
{ {
struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd; u8 slot_cmd;
if (!slot->ctrl->hpc_ctlr_handle) { if (!slot->ctrl->hpc_ctlr_handle) {
...@@ -727,7 +720,7 @@ static void hpc_set_green_led_off(struct slot *slot) ...@@ -727,7 +720,7 @@ static void hpc_set_green_led_off(struct slot *slot)
static void hpc_set_green_led_blink(struct slot *slot) static void hpc_set_green_led_blink(struct slot *slot)
{ {
struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd; u8 slot_cmd;
if (!slot->ctrl->hpc_ctlr_handle) { if (!slot->ctrl->hpc_ctlr_handle) {
...@@ -754,7 +747,7 @@ int shpc_get_ctlr_slot_config(struct controller *ctrl, ...@@ -754,7 +747,7 @@ int shpc_get_ctlr_slot_config(struct controller *ctrl,
int *updown, /* physical_slot_num increament: 1 or -1 */ int *updown, /* physical_slot_num increament: 1 or -1 */
int *flags) int *flags)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle;
DBG_ENTER_ROUTINE DBG_ENTER_ROUTINE
...@@ -776,7 +769,7 @@ int shpc_get_ctlr_slot_config(struct controller *ctrl, ...@@ -776,7 +769,7 @@ int shpc_get_ctlr_slot_config(struct controller *ctrl,
static void hpc_release_ctlr(struct controller *ctrl) static void hpc_release_ctlr(struct controller *ctrl)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle;
struct php_ctlr_state_s *p, *p_prev; struct php_ctlr_state_s *p, *p_prev;
DBG_ENTER_ROUTINE DBG_ENTER_ROUTINE
...@@ -828,7 +821,7 @@ DBG_LEAVE_ROUTINE ...@@ -828,7 +821,7 @@ DBG_LEAVE_ROUTINE
static int hpc_power_on_slot(struct slot * slot) static int hpc_power_on_slot(struct slot * slot)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd; u8 slot_cmd;
int retval = 0; int retval = 0;
...@@ -859,7 +852,7 @@ static int hpc_power_on_slot(struct slot * slot) ...@@ -859,7 +852,7 @@ static int hpc_power_on_slot(struct slot * slot)
static int hpc_slot_enable(struct slot * slot) static int hpc_slot_enable(struct slot * slot)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd; u8 slot_cmd;
int retval = 0; int retval = 0;
...@@ -890,7 +883,7 @@ static int hpc_slot_enable(struct slot * slot) ...@@ -890,7 +883,7 @@ static int hpc_slot_enable(struct slot * slot)
static int hpc_slot_disable(struct slot * slot) static int hpc_slot_disable(struct slot * slot)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd; u8 slot_cmd;
int retval = 0; int retval = 0;
...@@ -920,51 +913,12 @@ static int hpc_slot_disable(struct slot * slot) ...@@ -920,51 +913,12 @@ static int hpc_slot_disable(struct slot * slot)
return retval; return retval;
} }
static int hpc_enable_all_slots( struct slot *slot )
{
int retval = 0;
DBG_ENTER_ROUTINE
if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}
retval = shpc_write_cmd(slot, 0, SET_ENABLE_ALL);
if (retval) {
err("%s: Write command failed!\n", __FUNCTION__);
return -1;
}
DBG_LEAVE_ROUTINE
return retval;
}
static int hpc_pwr_on_all_slots(struct slot *slot)
{
int retval = 0;
DBG_ENTER_ROUTINE
retval = shpc_write_cmd(slot, 0, SET_PWR_ON_ALL);
if (retval) {
err("%s: Write command failed!\n", __FUNCTION__);
return -1;
}
DBG_LEAVE_ROUTINE
return retval;
}
static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value) static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value)
{ {
u8 slot_cmd; u8 slot_cmd;
u8 pi; u8 pi;
int retval = 0; int retval = 0;
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
DBG_ENTER_ROUTINE DBG_ENTER_ROUTINE
...@@ -1184,7 +1138,7 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs) ...@@ -1184,7 +1138,7 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value) static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN; enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN;
int retval = 0; int retval = 0;
u8 pi; u8 pi;
...@@ -1253,7 +1207,7 @@ static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value) ...@@ -1253,7 +1207,7 @@ static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value)
static int hpc_get_cur_bus_speed (struct slot *slot, enum pci_bus_speed *value) static int hpc_get_cur_bus_speed (struct slot *slot, enum pci_bus_speed *value)
{ {
struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle; struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN; enum pci_bus_speed bus_speed = PCI_SPEED_UNKNOWN;
u16 sec_bus_status; u16 sec_bus_status;
int retval = 0; int retval = 0;
...@@ -1367,8 +1321,6 @@ static struct hpc_ops shpchp_hpc_ops = { ...@@ -1367,8 +1321,6 @@ static struct hpc_ops shpchp_hpc_ops = {
.power_on_slot = hpc_power_on_slot, .power_on_slot = hpc_power_on_slot,
.slot_enable = hpc_slot_enable, .slot_enable = hpc_slot_enable,
.slot_disable = hpc_slot_disable, .slot_disable = hpc_slot_disable,
.enable_all_slots = hpc_enable_all_slots,
.pwr_on_all_slots = hpc_pwr_on_all_slots,
.set_bus_speed_mode = hpc_set_bus_speed_mode, .set_bus_speed_mode = hpc_set_bus_speed_mode,
.set_attention_status = hpc_set_attention_status, .set_attention_status = hpc_set_attention_status,
.get_power_status = hpc_get_power_status, .get_power_status = hpc_get_power_status,
...@@ -1391,12 +1343,7 @@ static struct hpc_ops shpchp_hpc_ops = { ...@@ -1391,12 +1343,7 @@ static struct hpc_ops shpchp_hpc_ops = {
.check_cmd_status = hpc_check_cmd_status, .check_cmd_status = hpc_check_cmd_status,
}; };
int shpc_init(struct controller * ctrl, int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
struct pci_dev * pdev,
php_intr_callback_t attention_button_callback,
php_intr_callback_t switch_change_callback,
php_intr_callback_t presence_change_callback,
php_intr_callback_t power_fault_callback)
{ {
struct php_ctlr_state_s *php_ctlr, *p; struct php_ctlr_state_s *php_ctlr, *p;
void *instance_id = ctrl; void *instance_id = ctrl;
...@@ -1405,7 +1352,6 @@ int shpc_init(struct controller * ctrl, ...@@ -1405,7 +1352,6 @@ int shpc_init(struct controller * ctrl,
static int first = 1; static int first = 1;
u32 shpc_cap_offset, shpc_base_offset; u32 shpc_cap_offset, shpc_base_offset;
u32 tempdword, slot_reg; u32 tempdword, slot_reg;
u16 vendor_id, device_id;
u8 i; u8 i;
DBG_ENTER_ROUTINE DBG_ENTER_ROUTINE
...@@ -1422,21 +1368,8 @@ int shpc_init(struct controller * ctrl, ...@@ -1422,21 +1368,8 @@ int shpc_init(struct controller * ctrl,
php_ctlr->pci_dev = pdev; /* save pci_dev in context */ php_ctlr->pci_dev = pdev; /* save pci_dev in context */
rc = pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor_id); if ((pdev->vendor == PCI_VENDOR_ID_AMD) || (pdev->device ==
dbg("%s: Vendor ID: %x\n",__FUNCTION__, vendor_id); PCI_DEVICE_ID_AMD_GOLAM_7450)) {
if (rc) {
err("%s: unable to read PCI configuration data\n", __FUNCTION__);
goto abort_free_ctlr;
}
rc = pci_read_config_word(pdev, PCI_DEVICE_ID, &device_id);
dbg("%s: Device ID: %x\n",__FUNCTION__, device_id);
if (rc) {
err("%s: unable to read PCI configuration data\n", __FUNCTION__);
goto abort_free_ctlr;
}
if ((vendor_id == PCI_VENDOR_ID_AMD) || (device_id == PCI_DEVICE_ID_AMD_GOLAM_7450)) {
shpc_base_offset = 0; /* amd shpc driver doesn't use this; assume 0 */ shpc_base_offset = 0; /* amd shpc driver doesn't use this; assume 0 */
} else { } else {
if ((shpc_cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC)) == 0) { if ((shpc_cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC)) == 0) {
...@@ -1514,11 +1447,10 @@ int shpc_init(struct controller * ctrl, ...@@ -1514,11 +1447,10 @@ int shpc_init(struct controller * ctrl,
php_ctlr->irq = pdev->irq; php_ctlr->irq = pdev->irq;
dbg("HPC interrupt = %d\n", php_ctlr->irq); dbg("HPC interrupt = %d\n", php_ctlr->irq);
/* Save interrupt callback info */ php_ctlr->attention_button_callback = shpchp_handle_attention_button,
php_ctlr->attention_button_callback = attention_button_callback; php_ctlr->switch_change_callback = shpchp_handle_switch_change;
php_ctlr->switch_change_callback = switch_change_callback; php_ctlr->presence_change_callback = shpchp_handle_presence_change;
php_ctlr->presence_change_callback = presence_change_callback; php_ctlr->power_fault_callback = shpchp_handle_power_fault;
php_ctlr->power_fault_callback = power_fault_callback;
php_ctlr->callback_instance_id = instance_id; php_ctlr->callback_instance_id = instance_id;
/* Return PCI Controller Info */ /* Return PCI Controller Info */
......
...@@ -27,13 +27,9 @@ ...@@ -27,13 +27,9 @@
* *
*/ */
#include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/proc_fs.h>
#include <linux/pci.h> #include <linux/pci.h>
#include "../pci.h" #include "../pci.h"
#include "shpchp.h" #include "shpchp.h"
......
...@@ -26,12 +26,9 @@ ...@@ -26,12 +26,9 @@
* *
*/ */
#include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/workqueue.h>
#include <linux/pci.h> #include <linux/pci.h>
#include "shpchp.h" #include "shpchp.h"
......
...@@ -24,16 +24,10 @@ ...@@ -24,16 +24,10 @@
* *
*/ */
#include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/efi.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/actypes.h> #include <acpi/actypes.h>
......
...@@ -27,15 +27,11 @@ ...@@ -27,15 +27,11 @@
* *
*/ */
#include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include "shpchp.h" #include "shpchp.h"
#include "shpchprm.h"
int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
{ {
......
...@@ -32,10 +32,7 @@ ...@@ -32,10 +32,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include "shpchp.h" #include "shpchp.h"
#include "shpchprm.h"
int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment