Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39888
b: refs/heads/master
c: 49ed2b4
h: refs/heads/master
v: v3
  • Loading branch information
Kenji Kaneshige authored and Greg Kroah-Hartman committed Oct 18, 2006
1 parent e245577 commit 4853336
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 23 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: b4a1efffcf8070dbc7734f27da10ce49fb9f2a34
refs/heads/master: 49ed2b4963cd00993eab518b820a6700f94f222d
8 changes: 4 additions & 4 deletions trunk/drivers/pci/hotplug/pciehp.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ struct controller {
* error Messages
*/
#define msg_initialization_err "Initialization failure, error=%d\n"
#define msg_button_on "PCI slot #%d - powering on due to button press.\n"
#define msg_button_off "PCI slot #%d - powering off due to button press.\n"
#define msg_button_cancel "PCI slot #%d - action canceled due to button press.\n"
#define msg_button_ignore "PCI slot #%d - button press ignored. (action in progress...)\n"
#define msg_button_on "PCI slot #%s - powering on due to button press.\n"
#define msg_button_off "PCI slot #%s - powering off due to button press.\n"
#define msg_button_cancel "PCI slot #%s - action canceled due to button press.\n"
#define msg_button_ignore "PCI slot #%s - button press ignored. (action in progress...)\n"

/* controller functions */
extern int pciehp_event_start_thread (void);
Expand Down
47 changes: 29 additions & 18 deletions trunk/drivers/pci/hotplug/pciehp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ static int event_finished;
static unsigned long pushbutton_pending; /* = 0 */
static unsigned long surprise_rm_pending; /* = 0 */

static inline char *slot_name(struct slot *p_slot)
{
return p_slot->hotplug_slot->name;
}

u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id)
{
struct controller *ctrl = (struct controller *) inst_id;
Expand All @@ -68,7 +73,7 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id)
/*
* Button pressed - See if need to TAKE ACTION!!!
*/
info("Button pressed on Slot(%d)\n", ctrl->first_slot + hp_slot);
info("Button pressed on Slot(%s)\n", slot_name(p_slot));
taskInfo->event_type = INT_BUTTON_PRESS;

if ((p_slot->state == BLINKINGON_STATE)
Expand All @@ -78,15 +83,15 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id)
* or hot-remove
*/
taskInfo->event_type = INT_BUTTON_CANCEL;
info("Button cancel on Slot(%d)\n", ctrl->first_slot + hp_slot);
info("Button cancel on Slot(%s)\n", slot_name(p_slot));
} else if ((p_slot->state == POWERON_STATE)
|| (p_slot->state == POWEROFF_STATE)) {
/* Ignore if the slot is on power-on or power-off state; this
* means that the previous attention button action to hot-add or
* hot-remove is undergoing
*/
taskInfo->event_type = INT_BUTTON_IGNORE;
info("Button ignore on Slot(%d)\n", ctrl->first_slot + hp_slot);
info("Button ignore on Slot(%s)\n", slot_name(p_slot));
}

if (rc)
Expand Down Expand Up @@ -122,13 +127,13 @@ u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id)
/*
* Switch opened
*/
info("Latch open on Slot(%d)\n", ctrl->first_slot + hp_slot);
info("Latch open on Slot(%s)\n", slot_name(p_slot));
taskInfo->event_type = INT_SWITCH_OPEN;
} else {
/*
* Switch closed
*/
info("Latch close on Slot(%d)\n", ctrl->first_slot + hp_slot);
info("Latch close on Slot(%s)\n", slot_name(p_slot));
taskInfo->event_type = INT_SWITCH_CLOSE;
}

Expand Down Expand Up @@ -166,13 +171,13 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id)
/*
* Card Present
*/
info("Card present on Slot(%d)\n", ctrl->first_slot + hp_slot);
info("Card present on Slot(%s)\n", slot_name(p_slot));
taskInfo->event_type = INT_PRESENCE_ON;
} else {
/*
* Not Present
*/
info("Card not present on Slot(%d)\n", ctrl->first_slot + hp_slot);
info("Card not present on Slot(%s)\n", slot_name(p_slot));
taskInfo->event_type = INT_PRESENCE_OFF;
}

Expand Down Expand Up @@ -206,13 +211,13 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id)
/*
* power fault Cleared
*/
info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot);
info("Power fault cleared on Slot(%s)\n", slot_name(p_slot));
taskInfo->event_type = INT_POWER_FAULT_CLEAR;
} else {
/*
* power fault
*/
info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot);
info("Power fault on Slot(%s)\n", slot_name(p_slot));
taskInfo->event_type = INT_POWER_FAULT;
info("power fault bit %x set\n", hp_slot);
}
Expand Down Expand Up @@ -654,7 +659,7 @@ static void interrupt_event_handler(struct controller *ctrl)
warn("Not a valid state\n");
return;
}
info(msg_button_cancel, p_slot->number);
info(msg_button_cancel, slot_name(p_slot));
p_slot->state = STATIC_STATE;
}
/* ***********Button Pressed (No action on 1st press...) */
Expand All @@ -667,12 +672,12 @@ static void interrupt_event_handler(struct controller *ctrl)
/* slot is on */
dbg("slot is on\n");
p_slot->state = BLINKINGOFF_STATE;
info(msg_button_off, p_slot->number);
info(msg_button_off, slot_name(p_slot));
} else {
/* slot is off */
dbg("slot is off\n");
p_slot->state = BLINKINGON_STATE;
info(msg_button_on, p_slot->number);
info(msg_button_on, slot_name(p_slot));
}

/* Wait for exclusive access to hardware */
Expand Down Expand Up @@ -760,14 +765,16 @@ int pciehp_enable_slot(struct slot *p_slot)

rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
if (rc || !getstatus) {
info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number);
info("%s: no adapter on slot(%s)\n", __FUNCTION__,
slot_name(p_slot));
mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
if (MRL_SENS(p_slot->ctrl->ctrlcap)) {
rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
if (rc || getstatus) {
info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
info("%s: latch open on slot(%s)\n", __FUNCTION__,
slot_name(p_slot));
mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
Expand All @@ -776,7 +783,8 @@ int pciehp_enable_slot(struct slot *p_slot)
if (POWER_CTRL(p_slot->ctrl->ctrlcap)) {
rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (rc || getstatus) {
info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number);
info("%s: already enabled on slot(%s)\n", __FUNCTION__,
slot_name(p_slot));
mutex_unlock(&p_slot->ctrl->crit_sect);
return -EINVAL;
}
Expand Down Expand Up @@ -811,7 +819,8 @@ int pciehp_disable_slot(struct slot *p_slot)
if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) {
ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
if (ret || !getstatus) {
info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number);
info("%s: no adapter on slot(%s)\n", __FUNCTION__,
slot_name(p_slot));
mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
Expand All @@ -820,7 +829,8 @@ int pciehp_disable_slot(struct slot *p_slot)
if (MRL_SENS(p_slot->ctrl->ctrlcap)) {
ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
if (ret || getstatus) {
info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
info("%s: latch open on slot(%s)\n", __FUNCTION__,
slot_name(p_slot));
mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
Expand All @@ -829,7 +839,8 @@ int pciehp_disable_slot(struct slot *p_slot)
if (POWER_CTRL(p_slot->ctrl->ctrlcap)) {
ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (ret || !getstatus) {
info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number);
info("%s: already disabled slot(%s)\n", __FUNCTION__,
slot_name(p_slot));
mutex_unlock(&p_slot->ctrl->crit_sect);
return -EINVAL;
}
Expand Down

0 comments on commit 4853336

Please sign in to comment.