Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28271
b: refs/heads/master
c: d4fbf60
h: refs/heads/master
i:
  28269: 1ca4a90
  28267: 31825aa
  28263: ef8a318
  28255: b5446e9
v: v3
  • Loading branch information
Kenji Kaneshige authored and Greg Kroah-Hartman committed Jun 19, 2006
1 parent 5749f84 commit 3654848
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 182 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 132066a9c84af6f5e8d893145a9c63f849143867
refs/heads/master: d4fbf600666569c3921d12bdcfcfdb2cdb4fd5fb
197 changes: 16 additions & 181 deletions trunk/drivers/pci/hotplug/shpchp_hpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ static inline int shpc_wait_cmd(struct controller *ctrl)

static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
{
struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
struct controller *ctrl = slot->ctrl;
u16 cmd_status;
int retval = 0;
Expand All @@ -341,12 +340,6 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)

mutex_lock(&slot->ctrl->cmd_lock);

if (!php_ctlr) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
retval = -EINVAL;
goto out;
}

for (i = 0; i < 10; i++) {
cmd_status = shpc_readw(ctrl, CMD_STATUS);

Expand Down Expand Up @@ -401,11 +394,6 @@ static int hpc_check_cmd_status(struct controller *ctrl)
int retval = 0;

DBG_ENTER_ROUTINE

if (!ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

cmd_status = shpc_readw(ctrl, CMD_STATUS) & 0x000F;

Expand Down Expand Up @@ -442,11 +430,6 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status)

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
state = (slot_reg & ATN_LED_STATE_MASK) >> ATN_LED_STATE_SHIFT;

Expand Down Expand Up @@ -477,11 +460,6 @@ static int hpc_get_power_status(struct slot * slot, u8 *status)

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
state = (slot_reg & SLOT_STATE_MASK) >> SLOT_STATE_SHIFT;

Expand Down Expand Up @@ -512,11 +490,6 @@ static int hpc_get_latch_status(struct slot *slot, u8 *status)

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
*status = !!(slot_reg & MRL_SENSOR); /* 0 -> close; 1 -> open */

Expand All @@ -532,11 +505,6 @@ static int hpc_get_adapter_status(struct slot *slot, u8 *status)

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
state = (slot_reg & PRSNT_MASK) >> PRSNT_SHIFT;
*status = (state != 0x3) ? 1 : 0;
Expand All @@ -550,11 +518,6 @@ static int hpc_get_prog_int(struct slot *slot, u8 *prog_int)
struct controller *ctrl = slot->ctrl;

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

*prog_int = shpc_readb(ctrl, PROG_INTERFACE);

Expand Down Expand Up @@ -626,11 +589,6 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode)

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

pi = shpc_readb(ctrl, PROG_INTERFACE);
sec_bus_status = shpc_readw(ctrl, SEC_BUS_CONFIG);

Expand All @@ -653,11 +611,6 @@ static int hpc_query_power_fault(struct slot * slot)

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));

DBG_LEAVE_ROUTINE
Expand All @@ -667,19 +620,7 @@ static int hpc_query_power_fault(struct slot * slot)

static int hpc_set_attention_status(struct slot *slot, u8 value)
{
struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd = 0;
int rc = 0;

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

if (slot->hp_slot >= php_ctlr->num_slots) {
err("%s: Invalid HPC slot number!\n", __FUNCTION__);
return -1;
}

switch (value) {
case 0 :
Expand All @@ -695,76 +636,23 @@ static int hpc_set_attention_status(struct slot *slot, u8 value)
return -1;
}

shpc_write_cmd(slot, slot->hp_slot, slot_cmd);

return rc;
return shpc_write_cmd(slot, slot->hp_slot, slot_cmd);
}


static void hpc_set_green_led_on(struct slot *slot)
{
struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd;

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return ;
}

if (slot->hp_slot >= php_ctlr->num_slots) {
err("%s: Invalid HPC slot number!\n", __FUNCTION__);
return ;
}

slot_cmd = 0x04;

shpc_write_cmd(slot, slot->hp_slot, slot_cmd);

return;
shpc_write_cmd(slot, slot->hp_slot, 0x04);
}

static void hpc_set_green_led_off(struct slot *slot)
{
struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd;

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return ;
}

if (slot->hp_slot >= php_ctlr->num_slots) {
err("%s: Invalid HPC slot number!\n", __FUNCTION__);
return ;
}

slot_cmd = 0x0C;

shpc_write_cmd(slot, slot->hp_slot, slot_cmd);

return;
shpc_write_cmd(slot, slot->hp_slot, 0x0c);
}

static void hpc_set_green_led_blink(struct slot *slot)
{
struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd;

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return ;
}

if (slot->hp_slot >= php_ctlr->num_slots) {
err("%s: Invalid HPC slot number!\n", __FUNCTION__);
return ;
}

slot_cmd = 0x08;

shpc_write_cmd(slot, slot->hp_slot, slot_cmd);

return;
shpc_write_cmd(slot, slot->hp_slot, 0x08);
}

int shpc_get_ctlr_slot_config(struct controller *ctrl,
Expand All @@ -778,11 +666,6 @@ int shpc_get_ctlr_slot_config(struct controller *ctrl,

DBG_ENTER_ROUTINE

if (!ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

slot_config = shpc_readl(ctrl, SLOT_CONFIG);
*first_device_num = (slot_config & FIRST_DEV_NUM) >> 8;
*num_ctlr_slots = slot_config & SLOT_NUM;
Expand All @@ -804,11 +687,6 @@ static void hpc_release_ctlr(struct controller *ctrl)

DBG_ENTER_ROUTINE

if (!ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return ;
}

/*
* Mask event interrupts and SERRs of all slots
*/
Expand Down Expand Up @@ -881,96 +759,53 @@ DBG_LEAVE_ROUTINE

static int hpc_power_on_slot(struct slot * slot)
{
struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd;
int retval = 0;
int retval;

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

if (slot->hp_slot >= php_ctlr->num_slots) {
err("%s: Invalid HPC slot number!\n", __FUNCTION__);
return -1;
}
slot_cmd = 0x01;

retval = shpc_write_cmd(slot, slot->hp_slot, slot_cmd);

retval = shpc_write_cmd(slot, slot->hp_slot, 0x01);
if (retval) {
err("%s: Write command failed!\n", __FUNCTION__);
return -1;
return retval;
}

DBG_LEAVE_ROUTINE

return retval;
return 0;
}

static int hpc_slot_enable(struct slot * slot)
{
struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd;
int retval = 0;
int retval;

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

if (slot->hp_slot >= php_ctlr->num_slots) {
err("%s: Invalid HPC slot number!\n", __FUNCTION__);
return -1;
}
/* 3A => Slot - Enable, Power Indicator - Blink, Attention Indicator - Off */
slot_cmd = 0x3A;

retval = shpc_write_cmd(slot, slot->hp_slot, slot_cmd);

retval = shpc_write_cmd(slot, slot->hp_slot, 0x3a);
if (retval) {
err("%s: Write command failed!\n", __FUNCTION__);
return -1;
return retval;
}

DBG_LEAVE_ROUTINE
return retval;
return 0;
}

static int hpc_slot_disable(struct slot * slot)
{
struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
u8 slot_cmd;
int retval = 0;
int retval;

DBG_ENTER_ROUTINE

if (!slot->ctrl->hpc_ctlr_handle) {
err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
return -1;
}

if (slot->hp_slot >= php_ctlr->num_slots) {
err("%s: Invalid HPC slot number!\n", __FUNCTION__);
return -1;
}

/* 1F => Slot - Disable, Power Indicator - Off, Attention Indicator - On */
slot_cmd = 0x1F;

retval = shpc_write_cmd(slot, slot->hp_slot, slot_cmd);

retval = shpc_write_cmd(slot, slot->hp_slot, 0x1f);
if (retval) {
err("%s: Write command failed!\n", __FUNCTION__);
return -1;
return retval;
}

DBG_LEAVE_ROUTINE
return retval;
return 0;
}

static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value)
Expand Down

0 comments on commit 3654848

Please sign in to comment.