Skip to content

Commit a8f2b96

Browse files
madscientist159maddy-kerneldev
authored andcommitted
PCI: pnv_php: Enable third attention indicator state
The PCIe specification allows three attention indicator states, on, off, and blink. Enable all three states instead of basic on / off control. This changes the userspace API (writes to the sysfs "attention" file) to match the behavior of pciehp. Here's the comparison of previous and new indicator behavior: Value Previous New Behavior ----- -------- ------------------------ 0 off (reserved, so undefined) 1 on on 2 on blink 3 on off Signed-off-by: Timothy Pearson <[email protected]> [bhelgaas: add specifics of behavior change] Signed-off-by: Bjorn Helgaas <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/1210309411.1359866.1752615582001.JavaMail.zimbra@raptorengineeringinc.com
1 parent a2a2a6f commit a8f2b96

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/pci/hotplug/pnv_php.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,23 @@ static int pnv_php_get_adapter_state(struct hotplug_slot *slot, u8 *state)
441441
return ret;
442442
}
443443

444+
static int pnv_php_get_raw_indicator_status(struct hotplug_slot *slot, u8 *state)
445+
{
446+
struct pnv_php_slot *php_slot = to_pnv_php_slot(slot);
447+
struct pci_dev *bridge = php_slot->pdev;
448+
u16 status;
449+
450+
pcie_capability_read_word(bridge, PCI_EXP_SLTCTL, &status);
451+
*state = (status & (PCI_EXP_SLTCTL_AIC | PCI_EXP_SLTCTL_PIC)) >> 6;
452+
return 0;
453+
}
454+
455+
444456
static int pnv_php_get_attention_state(struct hotplug_slot *slot, u8 *state)
445457
{
446458
struct pnv_php_slot *php_slot = to_pnv_php_slot(slot);
447459

460+
pnv_php_get_raw_indicator_status(slot, &php_slot->attention_state);
448461
*state = php_slot->attention_state;
449462
return 0;
450463
}
@@ -462,7 +475,7 @@ static int pnv_php_set_attention_state(struct hotplug_slot *slot, u8 state)
462475
mask = PCI_EXP_SLTCTL_AIC;
463476

464477
if (state)
465-
new = PCI_EXP_SLTCTL_ATTN_IND_ON;
478+
new = FIELD_PREP(PCI_EXP_SLTCTL_AIC, state);
466479
else
467480
new = PCI_EXP_SLTCTL_ATTN_IND_OFF;
468481

0 commit comments

Comments
 (0)