Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97403
b: refs/heads/master
c: dbd79ae
h: refs/heads/master
i:
  97401: 7de4403
  97399: 0ae94b8
v: v3
  • Loading branch information
Kenji Kaneshige authored and Jesse Barnes committed May 27, 2008
1 parent 4d0f5e5 commit a3fb4a1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 36 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: b3bd307c628af2f0a581c42d5d7e4bcdbbf64b6a
refs/heads/master: dbd79aed1aea2bece0bf43cc2ff3b2f9baf48a08
8 changes: 4 additions & 4 deletions trunk/drivers/pci/hotplug/pciehp.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ struct controller {

extern int pciehp_sysfs_enable_slot(struct slot *slot);
extern int pciehp_sysfs_disable_slot(struct slot *slot);
extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_attention_button(struct slot *p_slot);
extern u8 pciehp_handle_switch_change(struct slot *p_slot);
extern u8 pciehp_handle_presence_change(struct slot *p_slot);
extern u8 pciehp_handle_power_fault(struct slot *p_slot);
extern int pciehp_configure_device(struct slot *p_slot);
extern int pciehp_unconfigure_device(struct slot *p_slot);
extern void pciehp_queue_pushbutton_work(struct work_struct *work);
Expand Down
22 changes: 5 additions & 17 deletions trunk/drivers/pci/hotplug/pciehp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,13 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
return 0;
}

u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
u8 pciehp_handle_attention_button(struct slot *p_slot)
{
struct slot *p_slot;
u32 event_type;

/* Attention Button Change */
dbg("pciehp: Attention button interrupt received.\n");

p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);

/*
* Button pressed - See if need to TAKE ACTION!!!
*/
Expand All @@ -76,18 +73,15 @@ u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
return 0;
}

u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
u8 pciehp_handle_switch_change(struct slot *p_slot)
{
struct slot *p_slot;
u8 getstatus;
u32 event_type;

/* Switch Change */
dbg("pciehp: Switch interrupt received.\n");

p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);

if (getstatus) {
/*
* Switch opened
Expand All @@ -107,17 +101,14 @@ u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
return 1;
}

u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
u8 pciehp_handle_presence_change(struct slot *p_slot)
{
struct slot *p_slot;
u32 event_type;
u8 presence_save;

/* Presence Change */
dbg("pciehp: Presence/Notify input change.\n");

p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);

/* Switch is open, assume a presence change
* Save the presence state
*/
Expand All @@ -141,16 +132,13 @@ u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
return 1;
}

u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
u8 pciehp_handle_power_fault(struct slot *p_slot)
{
struct slot *p_slot;
u32 event_type;

/* power fault */
dbg("pciehp: Power fault interrupt received.\n");

p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);

if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) {
/*
* power fault Cleared
Expand All @@ -163,7 +151,7 @@ u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
*/
info("Power fault on Slot(%s)\n", p_slot->name);
event_type = INT_POWER_FAULT;
info("power fault bit %x set\n", hp_slot);
info("power fault bit %x set\n", 0);
}

queue_interrupt_event(p_slot, event_type);
Expand Down
42 changes: 28 additions & 14 deletions trunk/drivers/pci/hotplug/pciehp_hpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
{
struct controller *ctrl = (struct controller *)dev_id;
u16 detected, intr_loc;
struct slot *p_slot;

/*
* In order to guarantee that all interrupt events are
Expand Down Expand Up @@ -756,21 +757,38 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
wake_up_interruptible(&ctrl->queue);
}

if (!(intr_loc & ~CMD_COMPLETED))
return IRQ_HANDLED;

/*
* Return without handling events if this handler routine is
* called before controller initialization is done. This may
* happen if hotplug event or another interrupt that shares
* the IRQ with pciehp arrives before slot initialization is
* done after interrupt handler is registered.
*
* FIXME - Need more structural fixes. We need to be ready to
* handle the event before installing interrupt handler.
*/
p_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset);
if (!p_slot || !p_slot->hpc_ops)
return IRQ_HANDLED;

/* Check MRL Sensor Changed */
if (intr_loc & MRL_SENS_CHANGED)
pciehp_handle_switch_change(0, ctrl);
pciehp_handle_switch_change(p_slot);

/* Check Attention Button Pressed */
if (intr_loc & ATTN_BUTTN_PRESSED)
pciehp_handle_attention_button(0, ctrl);
pciehp_handle_attention_button(p_slot);

/* Check Presence Detect Changed */
if (intr_loc & PRSN_DETECT_CHANGED)
pciehp_handle_presence_change(0, ctrl);
pciehp_handle_presence_change(p_slot);

/* Check Power Fault Detected */
if (intr_loc & PWR_FAULT_DETECTED)
pciehp_handle_power_fault(0, ctrl);
pciehp_handle_power_fault(p_slot);

return IRQ_HANDLED;
}
Expand Down Expand Up @@ -1028,6 +1046,12 @@ static int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
static int pcie_init_hardware_part1(struct controller *ctrl,
struct pcie_device *dev)
{
/* Clear all remaining event bits in Slot Status register */
if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) {
err("%s: Cannot write to SLOTSTATUS register\n", __func__);
return -1;
}

/* Mask Hot-plug Interrupt Enable */
if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE)) {
err("%s: Cannot mask hotplug interrupt enable\n", __func__);
Expand All @@ -1040,16 +1064,6 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev)
{
u16 cmd, mask;

/*
* We need to clear all events before enabling hotplug interrupt
* notification mechanism in order for hotplug controler to
* generate interrupts.
*/
if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) {
err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__);
return -1;
}

cmd = PRSN_DETECT_ENABLE;
if (ATTN_BUTTN(ctrl))
cmd |= ATTN_BUTTN_ENABLE;
Expand Down

0 comments on commit a3fb4a1

Please sign in to comment.