pciehp: Fix wrong slot capability check
Current pciehp saves only 8bits of Slot Capability registers in
ctrl->ctrlcap. But it refers more than 8bit for checking EMI capability.
It is clearly a bug and EMI would never work. To fix this problem,
this patch saves full Slot Capability contens in ctrl->slot_cap. It also
reduce the redundant reads of Slot Capability register. And this pach
also cleans up the macros to check the slot capabilitys (e.g. MRL_SENS(),
and so on).
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 7104a15..58f8018 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -1058,11 +1058,11 @@
}
cmd = PRSN_DETECT_ENABLE;
- if (ATTN_BUTTN(ctrl->ctrlcap))
+ if (ATTN_BUTTN(ctrl))
cmd |= ATTN_BUTTN_ENABLE;
- if (POWER_CTRL(ctrl->ctrlcap))
+ if (POWER_CTRL(ctrl))
cmd |= PWR_FAULT_DETECT_ENABLE;
- if (MRL_SENS(ctrl->ctrlcap))
+ if (MRL_SENS(ctrl))
cmd |= MRL_DETECT_ENABLE;
if (!pciehp_poll_mode)
cmd |= HP_INTR_ENABLE;
@@ -1181,7 +1181,7 @@
ctrl->slot_device_offset = 0;
ctrl->num_slots = 1;
ctrl->first_slot = slot_cap >> 19;
- ctrl->ctrlcap = slot_cap & 0x0000007f;
+ ctrl->slot_cap = slot_cap;
rc = pcie_init_hardware_part1(ctrl, dev);
if (rc)