mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
Merge branches 'pci/host-xgene' and 'pci/hotplug' into next
* pci/host-xgene: PCI: xgene: Allow config access to Root Port even when link is down PCI: xgene: Disable Configuration Request Retry Status for v1 silicon * pci/hotplug: PCI: pciehp: Inline the "handle event" functions into the ISR PCI: pciehp: Rename queue_interrupt_event() to pciehp_queue_interrupt_event() PCI: pciehp: Make queue_interrupt_event() void PCI: pciehp: Clean up debug logging
This commit is contained in:
commit
207b074f82
5 changed files with 98 additions and 239 deletions
|
@ -59,6 +59,12 @@
|
|||
#define SZ_1T (SZ_1G*1024ULL)
|
||||
#define PIPE_PHY_RATE_RD(src) ((0xc000 & (u32)(src)) >> 0xe)
|
||||
|
||||
#define ROOT_CAP_AND_CTRL 0x5C
|
||||
|
||||
/* PCIe IP version */
|
||||
#define XGENE_PCIE_IP_VER_UNKN 0
|
||||
#define XGENE_PCIE_IP_VER_1 1
|
||||
|
||||
struct xgene_pcie_port {
|
||||
struct device_node *node;
|
||||
struct device *dev;
|
||||
|
@ -67,6 +73,7 @@ struct xgene_pcie_port {
|
|||
void __iomem *cfg_base;
|
||||
unsigned long cfg_addr;
|
||||
bool link_up;
|
||||
u32 version;
|
||||
};
|
||||
|
||||
static inline u32 pcie_bar_low_val(u32 addr, u32 flags)
|
||||
|
@ -130,9 +137,7 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset)
|
|||
static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
|
||||
int offset)
|
||||
{
|
||||
struct xgene_pcie_port *port = bus->sysdata;
|
||||
|
||||
if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up ||
|
||||
if ((pci_is_root_bus(bus) && devfn != 0) ||
|
||||
xgene_pcie_hide_rc_bars(bus, offset))
|
||||
return NULL;
|
||||
|
||||
|
@ -140,9 +145,37 @@ static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
|
|||
return xgene_pcie_get_cfg_base(bus) + offset;
|
||||
}
|
||||
|
||||
static int xgene_pcie_config_read32(struct pci_bus *bus, unsigned int devfn,
|
||||
int where, int size, u32 *val)
|
||||
{
|
||||
struct xgene_pcie_port *port = bus->sysdata;
|
||||
|
||||
if (pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val) !=
|
||||
PCIBIOS_SUCCESSFUL)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
|
||||
/*
|
||||
* The v1 controller has a bug in its Configuration Request
|
||||
* Retry Status (CRS) logic: when CRS is enabled and we read the
|
||||
* Vendor and Device ID of a non-existent device, the controller
|
||||
* fabricates return data of 0xFFFF0001 ("device exists but is not
|
||||
* ready") instead of 0xFFFFFFFF ("device does not exist"). This
|
||||
* causes the PCI core to retry the read until it times out.
|
||||
* Avoid this by not claiming to support CRS.
|
||||
*/
|
||||
if (pci_is_root_bus(bus) && (port->version == XGENE_PCIE_IP_VER_1) &&
|
||||
((where & ~0x3) == ROOT_CAP_AND_CTRL))
|
||||
*val &= ~(PCI_EXP_RTCAP_CRSVIS << 16);
|
||||
|
||||
if (size <= 2)
|
||||
*val = (*val >> (8 * (where & 3))) & ((1 << (size * 8)) - 1);
|
||||
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static struct pci_ops xgene_pcie_ops = {
|
||||
.map_bus = xgene_pcie_map_bus,
|
||||
.read = pci_generic_config_read32,
|
||||
.read = xgene_pcie_config_read32,
|
||||
.write = pci_generic_config_write32,
|
||||
};
|
||||
|
||||
|
@ -500,6 +533,10 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
|
|||
port->node = of_node_get(pdev->dev.of_node);
|
||||
port->dev = &pdev->dev;
|
||||
|
||||
port->version = XGENE_PCIE_IP_VER_UNKN;
|
||||
if (of_device_is_compatible(port->node, "apm,xgene-pcie"))
|
||||
port->version = XGENE_PCIE_IP_VER_1;
|
||||
|
||||
ret = xgene_pcie_map_reg(port, pdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
@ -132,11 +132,7 @@ struct controller {
|
|||
|
||||
int pciehp_sysfs_enable_slot(struct slot *slot);
|
||||
int pciehp_sysfs_disable_slot(struct slot *slot);
|
||||
u8 pciehp_handle_attention_button(struct slot *p_slot);
|
||||
u8 pciehp_handle_switch_change(struct slot *p_slot);
|
||||
u8 pciehp_handle_presence_change(struct slot *p_slot);
|
||||
u8 pciehp_handle_power_fault(struct slot *p_slot);
|
||||
void pciehp_handle_linkstate_change(struct slot *p_slot);
|
||||
void pciehp_queue_interrupt_event(struct slot *slot, u32 event_type);
|
||||
int pciehp_configure_device(struct slot *p_slot);
|
||||
int pciehp_unconfigure_device(struct slot *p_slot);
|
||||
void pciehp_queue_pushbutton_work(struct work_struct *work);
|
||||
|
|
|
@ -77,11 +77,6 @@ static int reset_slot (struct hotplug_slot *slot, int probe);
|
|||
*/
|
||||
static void release_slot(struct hotplug_slot *hotplug_slot)
|
||||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
|
||||
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
|
||||
__func__, hotplug_slot_name(hotplug_slot));
|
||||
|
||||
kfree(hotplug_slot->ops);
|
||||
kfree(hotplug_slot->info);
|
||||
kfree(hotplug_slot);
|
||||
|
@ -129,14 +124,10 @@ static int init_slot(struct controller *ctrl)
|
|||
slot->hotplug_slot = hotplug;
|
||||
snprintf(name, SLOT_NAME_SIZE, "%u", PSN(ctrl));
|
||||
|
||||
ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:00 sun=%x\n",
|
||||
pci_domain_nr(ctrl->pcie->port->subordinate),
|
||||
ctrl->pcie->port->subordinate->number, PSN(ctrl));
|
||||
retval = pci_hp_register(hotplug,
|
||||
ctrl->pcie->port->subordinate, 0, name);
|
||||
if (retval)
|
||||
ctrl_err(ctrl,
|
||||
"pci_hp_register failed with error %d\n", retval);
|
||||
ctrl_err(ctrl, "pci_hp_register failed: error %d\n", retval);
|
||||
out:
|
||||
if (retval) {
|
||||
kfree(ops);
|
||||
|
@ -158,9 +149,6 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
|
|||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
|
||||
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
|
||||
__func__, slot_name(slot));
|
||||
|
||||
pciehp_set_attention_status(slot, status);
|
||||
return 0;
|
||||
}
|
||||
|
@ -170,9 +158,6 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
|
|||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
|
||||
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
|
||||
__func__, slot_name(slot));
|
||||
|
||||
return pciehp_sysfs_enable_slot(slot);
|
||||
}
|
||||
|
||||
|
@ -181,9 +166,6 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
|
|||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
|
||||
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
|
||||
__func__, slot_name(slot));
|
||||
|
||||
return pciehp_sysfs_disable_slot(slot);
|
||||
}
|
||||
|
||||
|
@ -191,9 +173,6 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
|||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
|
||||
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
|
||||
__func__, slot_name(slot));
|
||||
|
||||
pciehp_get_power_status(slot, value);
|
||||
return 0;
|
||||
}
|
||||
|
@ -202,9 +181,6 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
|||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
|
||||
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
|
||||
__func__, slot_name(slot));
|
||||
|
||||
pciehp_get_attention_status(slot, value);
|
||||
return 0;
|
||||
}
|
||||
|
@ -213,9 +189,6 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
|||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
|
||||
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
|
||||
__func__, slot_name(slot));
|
||||
|
||||
pciehp_get_latch_status(slot, value);
|
||||
return 0;
|
||||
}
|
||||
|
@ -224,9 +197,6 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
|||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
|
||||
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
|
||||
__func__, slot_name(slot));
|
||||
|
||||
pciehp_get_adapter_status(slot, value);
|
||||
return 0;
|
||||
}
|
||||
|
@ -235,9 +205,6 @@ static int reset_slot(struct hotplug_slot *hotplug_slot, int probe)
|
|||
{
|
||||
struct slot *slot = hotplug_slot->private;
|
||||
|
||||
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
|
||||
__func__, slot_name(slot));
|
||||
|
||||
return pciehp_reset_slot(slot, probe);
|
||||
}
|
||||
|
||||
|
@ -272,14 +239,14 @@ static int pciehp_probe(struct pcie_device *dev)
|
|||
if (rc == -EBUSY)
|
||||
ctrl_warn(ctrl, "Slot already registered by another hotplug driver\n");
|
||||
else
|
||||
ctrl_err(ctrl, "Slot initialization failed\n");
|
||||
ctrl_err(ctrl, "Slot initialization failed (%d)\n", rc);
|
||||
goto err_out_release_ctlr;
|
||||
}
|
||||
|
||||
/* Enable events after we have setup the data structures */
|
||||
rc = pcie_init_notification(ctrl);
|
||||
if (rc) {
|
||||
ctrl_err(ctrl, "Notification initialization failed\n");
|
||||
ctrl_err(ctrl, "Notification initialization failed (%d)\n", rc);
|
||||
goto err_out_free_ctrl_slot;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,138 +37,20 @@
|
|||
|
||||
static void interrupt_event_handler(struct work_struct *work);
|
||||
|
||||
static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
|
||||
void pciehp_queue_interrupt_event(struct slot *p_slot, u32 event_type)
|
||||
{
|
||||
struct event_info *info;
|
||||
|
||||
info = kmalloc(sizeof(*info), GFP_ATOMIC);
|
||||
if (!info)
|
||||
return -ENOMEM;
|
||||
if (!info) {
|
||||
ctrl_err(p_slot->ctrl, "dropped event %d (ENOMEM)\n", event_type);
|
||||
return;
|
||||
}
|
||||
|
||||
INIT_WORK(&info->work, interrupt_event_handler);
|
||||
info->event_type = event_type;
|
||||
info->p_slot = p_slot;
|
||||
INIT_WORK(&info->work, interrupt_event_handler);
|
||||
|
||||
queue_work(p_slot->wq, &info->work);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 pciehp_handle_attention_button(struct slot *p_slot)
|
||||
{
|
||||
u32 event_type;
|
||||
struct controller *ctrl = p_slot->ctrl;
|
||||
|
||||
/* Attention Button Change */
|
||||
ctrl_dbg(ctrl, "Attention button interrupt received\n");
|
||||
|
||||
/*
|
||||
* Button pressed - See if need to TAKE ACTION!!!
|
||||
*/
|
||||
ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot));
|
||||
event_type = INT_BUTTON_PRESS;
|
||||
|
||||
queue_interrupt_event(p_slot, event_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 pciehp_handle_switch_change(struct slot *p_slot)
|
||||
{
|
||||
u8 getstatus;
|
||||
u32 event_type;
|
||||
struct controller *ctrl = p_slot->ctrl;
|
||||
|
||||
/* Switch Change */
|
||||
ctrl_dbg(ctrl, "Switch interrupt received\n");
|
||||
|
||||
pciehp_get_latch_status(p_slot, &getstatus);
|
||||
if (getstatus) {
|
||||
/*
|
||||
* Switch opened
|
||||
*/
|
||||
ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot));
|
||||
event_type = INT_SWITCH_OPEN;
|
||||
} else {
|
||||
/*
|
||||
* Switch closed
|
||||
*/
|
||||
ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot));
|
||||
event_type = INT_SWITCH_CLOSE;
|
||||
}
|
||||
|
||||
queue_interrupt_event(p_slot, event_type);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
u8 pciehp_handle_presence_change(struct slot *p_slot)
|
||||
{
|
||||
u32 event_type;
|
||||
u8 presence_save;
|
||||
struct controller *ctrl = p_slot->ctrl;
|
||||
|
||||
/* Presence Change */
|
||||
ctrl_dbg(ctrl, "Presence/Notify input change\n");
|
||||
|
||||
/* Switch is open, assume a presence change
|
||||
* Save the presence state
|
||||
*/
|
||||
pciehp_get_adapter_status(p_slot, &presence_save);
|
||||
if (presence_save) {
|
||||
/*
|
||||
* Card Present
|
||||
*/
|
||||
ctrl_info(ctrl, "Card present on Slot(%s)\n", slot_name(p_slot));
|
||||
event_type = INT_PRESENCE_ON;
|
||||
} else {
|
||||
/*
|
||||
* Not Present
|
||||
*/
|
||||
ctrl_info(ctrl, "Card not present on Slot(%s)\n",
|
||||
slot_name(p_slot));
|
||||
event_type = INT_PRESENCE_OFF;
|
||||
}
|
||||
|
||||
queue_interrupt_event(p_slot, event_type);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
u8 pciehp_handle_power_fault(struct slot *p_slot)
|
||||
{
|
||||
u32 event_type;
|
||||
struct controller *ctrl = p_slot->ctrl;
|
||||
|
||||
/* power fault */
|
||||
ctrl_dbg(ctrl, "Power fault interrupt received\n");
|
||||
ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot));
|
||||
event_type = INT_POWER_FAULT;
|
||||
ctrl_info(ctrl, "Power fault bit %x set\n", 0);
|
||||
queue_interrupt_event(p_slot, event_type);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void pciehp_handle_linkstate_change(struct slot *p_slot)
|
||||
{
|
||||
u32 event_type;
|
||||
struct controller *ctrl = p_slot->ctrl;
|
||||
|
||||
/* Link Status Change */
|
||||
ctrl_dbg(ctrl, "Data Link Layer State change\n");
|
||||
|
||||
if (pciehp_check_link_active(ctrl)) {
|
||||
ctrl_info(ctrl, "slot(%s): Link Up event\n",
|
||||
slot_name(p_slot));
|
||||
event_type = INT_LINK_UP;
|
||||
} else {
|
||||
ctrl_info(ctrl, "slot(%s): Link Down event\n",
|
||||
slot_name(p_slot));
|
||||
event_type = INT_LINK_DOWN;
|
||||
}
|
||||
|
||||
queue_interrupt_event(p_slot, event_type);
|
||||
}
|
||||
|
||||
/* The following routines constitute the bulk of the
|
||||
|
@ -298,10 +180,6 @@ static void pciehp_power_thread(struct work_struct *work)
|
|||
|
||||
switch (info->req) {
|
||||
case DISABLE_REQ:
|
||||
ctrl_dbg(p_slot->ctrl,
|
||||
"Disabling domain:bus:device=%04x:%02x:00\n",
|
||||
pci_domain_nr(p_slot->ctrl->pcie->port->subordinate),
|
||||
p_slot->ctrl->pcie->port->subordinate->number);
|
||||
mutex_lock(&p_slot->hotplug_lock);
|
||||
pciehp_disable_slot(p_slot);
|
||||
mutex_unlock(&p_slot->hotplug_lock);
|
||||
|
@ -310,10 +188,6 @@ static void pciehp_power_thread(struct work_struct *work)
|
|||
mutex_unlock(&p_slot->lock);
|
||||
break;
|
||||
case ENABLE_REQ:
|
||||
ctrl_dbg(p_slot->ctrl,
|
||||
"Enabling domain:bus:device=%04x:%02x:00\n",
|
||||
pci_domain_nr(p_slot->ctrl->pcie->port->subordinate),
|
||||
p_slot->ctrl->pcie->port->subordinate->number);
|
||||
mutex_lock(&p_slot->hotplug_lock);
|
||||
ret = pciehp_enable_slot(p_slot);
|
||||
mutex_unlock(&p_slot->hotplug_lock);
|
||||
|
@ -416,7 +290,7 @@ static void handle_button_press_event(struct slot *p_slot)
|
|||
ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot));
|
||||
break;
|
||||
default:
|
||||
ctrl_warn(ctrl, "Not a valid state\n");
|
||||
ctrl_warn(ctrl, "ignoring invalid state %#x\n", p_slot->state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -507,8 +381,8 @@ static void handle_link_event(struct slot *p_slot, u32 event)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
ctrl_err(ctrl, "Not a valid state on slot(%s)\n",
|
||||
slot_name(p_slot));
|
||||
ctrl_err(ctrl, "ignoring invalid state %#x on slot(%s)\n",
|
||||
p_slot->state, slot_name(p_slot));
|
||||
kfree(info);
|
||||
break;
|
||||
}
|
||||
|
@ -532,7 +406,6 @@ static void interrupt_event_handler(struct work_struct *work)
|
|||
pciehp_green_led_off(p_slot);
|
||||
break;
|
||||
case INT_PRESENCE_ON:
|
||||
ctrl_dbg(ctrl, "Surprise Insertion\n");
|
||||
handle_surprise_event(p_slot);
|
||||
break;
|
||||
case INT_PRESENCE_OFF:
|
||||
|
@ -540,7 +413,6 @@ static void interrupt_event_handler(struct work_struct *work)
|
|||
* Regardless of surprise capability, we need to
|
||||
* definitely remove a card that has been pulled out!
|
||||
*/
|
||||
ctrl_dbg(ctrl, "Surprise Removal\n");
|
||||
handle_surprise_event(p_slot);
|
||||
break;
|
||||
case INT_LINK_UP:
|
||||
|
@ -647,8 +519,8 @@ int pciehp_sysfs_enable_slot(struct slot *p_slot)
|
|||
slot_name(p_slot));
|
||||
break;
|
||||
default:
|
||||
ctrl_err(ctrl, "Not a valid state on slot %s\n",
|
||||
slot_name(p_slot));
|
||||
ctrl_err(ctrl, "invalid state %#x on slot %s\n",
|
||||
p_slot->state, slot_name(p_slot));
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&p_slot->lock);
|
||||
|
@ -682,8 +554,8 @@ int pciehp_sysfs_disable_slot(struct slot *p_slot)
|
|||
slot_name(p_slot));
|
||||
break;
|
||||
default:
|
||||
ctrl_err(ctrl, "Not a valid state on slot %s\n",
|
||||
slot_name(p_slot));
|
||||
ctrl_err(ctrl, "invalid state %#x on slot %s\n",
|
||||
p_slot->state, slot_name(p_slot));
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&p_slot->lock);
|
||||
|
|
|
@ -312,7 +312,8 @@ int pciehp_check_link_status(struct controller *ctrl)
|
|||
ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status);
|
||||
if ((lnk_status & PCI_EXP_LNKSTA_LT) ||
|
||||
!(lnk_status & PCI_EXP_LNKSTA_NLW)) {
|
||||
ctrl_err(ctrl, "Link Training Error occurs\n");
|
||||
ctrl_err(ctrl, "link training error: status %#06x\n",
|
||||
lnk_status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -534,6 +535,8 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
|
|||
struct pci_dev *dev;
|
||||
struct slot *slot = ctrl->slot;
|
||||
u16 detected, intr_loc;
|
||||
u8 open, present;
|
||||
bool link;
|
||||
|
||||
/*
|
||||
* In order to guarantee that all interrupt events are
|
||||
|
@ -556,7 +559,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
|
|||
intr_loc);
|
||||
} while (detected);
|
||||
|
||||
ctrl_dbg(ctrl, "%s: intr_loc %x\n", __func__, intr_loc);
|
||||
ctrl_dbg(ctrl, "pending interrupts %#06x from Slot Status\n", intr_loc);
|
||||
|
||||
/* Check Command Complete Interrupt Pending */
|
||||
if (intr_loc & PCI_EXP_SLTSTA_CC) {
|
||||
|
@ -579,25 +582,44 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
|
|||
return IRQ_HANDLED;
|
||||
|
||||
/* Check MRL Sensor Changed */
|
||||
if (intr_loc & PCI_EXP_SLTSTA_MRLSC)
|
||||
pciehp_handle_switch_change(slot);
|
||||
if (intr_loc & PCI_EXP_SLTSTA_MRLSC) {
|
||||
pciehp_get_latch_status(slot, &open);
|
||||
ctrl_info(ctrl, "Latch %s on Slot(%s)\n",
|
||||
open ? "open" : "close", slot_name(slot));
|
||||
pciehp_queue_interrupt_event(slot, open ? INT_SWITCH_OPEN :
|
||||
INT_SWITCH_CLOSE);
|
||||
}
|
||||
|
||||
/* Check Attention Button Pressed */
|
||||
if (intr_loc & PCI_EXP_SLTSTA_ABP)
|
||||
pciehp_handle_attention_button(slot);
|
||||
if (intr_loc & PCI_EXP_SLTSTA_ABP) {
|
||||
ctrl_info(ctrl, "Button pressed on Slot(%s)\n",
|
||||
slot_name(slot));
|
||||
pciehp_queue_interrupt_event(slot, INT_BUTTON_PRESS);
|
||||
}
|
||||
|
||||
/* Check Presence Detect Changed */
|
||||
if (intr_loc & PCI_EXP_SLTSTA_PDC)
|
||||
pciehp_handle_presence_change(slot);
|
||||
if (intr_loc & PCI_EXP_SLTSTA_PDC) {
|
||||
pciehp_get_adapter_status(slot, &present);
|
||||
ctrl_info(ctrl, "Card %spresent on Slot(%s)\n",
|
||||
present ? "" : "not ", slot_name(slot));
|
||||
pciehp_queue_interrupt_event(slot, present ? INT_PRESENCE_ON :
|
||||
INT_PRESENCE_OFF);
|
||||
}
|
||||
|
||||
/* Check Power Fault Detected */
|
||||
if ((intr_loc & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) {
|
||||
ctrl->power_fault_detected = 1;
|
||||
pciehp_handle_power_fault(slot);
|
||||
ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(slot));
|
||||
pciehp_queue_interrupt_event(slot, INT_POWER_FAULT);
|
||||
}
|
||||
|
||||
if (intr_loc & PCI_EXP_SLTSTA_DLLSC)
|
||||
pciehp_handle_linkstate_change(slot);
|
||||
if (intr_loc & PCI_EXP_SLTSTA_DLLSC) {
|
||||
link = pciehp_check_link_active(ctrl);
|
||||
ctrl_info(ctrl, "slot(%s): Link %s event\n",
|
||||
slot_name(slot), link ? "Up" : "Down");
|
||||
pciehp_queue_interrupt_event(slot, link ? INT_LINK_UP :
|
||||
INT_LINK_DOWN);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
@ -748,48 +770,13 @@ static void pcie_cleanup_slot(struct controller *ctrl)
|
|||
|
||||
static inline void dbg_ctrl(struct controller *ctrl)
|
||||
{
|
||||
int i;
|
||||
u16 reg16;
|
||||
struct pci_dev *pdev = ctrl->pcie->port;
|
||||
u16 reg16;
|
||||
|
||||
if (!pciehp_debug)
|
||||
return;
|
||||
|
||||
ctrl_info(ctrl, "Hotplug Controller:\n");
|
||||
ctrl_info(ctrl, " Seg/Bus/Dev/Func/IRQ : %s IRQ %d\n",
|
||||
pci_name(pdev), pdev->irq);
|
||||
ctrl_info(ctrl, " Vendor ID : 0x%04x\n", pdev->vendor);
|
||||
ctrl_info(ctrl, " Device ID : 0x%04x\n", pdev->device);
|
||||
ctrl_info(ctrl, " Subsystem ID : 0x%04x\n",
|
||||
pdev->subsystem_device);
|
||||
ctrl_info(ctrl, " Subsystem Vendor ID : 0x%04x\n",
|
||||
pdev->subsystem_vendor);
|
||||
ctrl_info(ctrl, " PCIe Cap offset : 0x%02x\n",
|
||||
pci_pcie_cap(pdev));
|
||||
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
|
||||
if (!pci_resource_len(pdev, i))
|
||||
continue;
|
||||
ctrl_info(ctrl, " PCI resource [%d] : %pR\n",
|
||||
i, &pdev->resource[i]);
|
||||
}
|
||||
ctrl_info(ctrl, "Slot Capabilities : 0x%08x\n", ctrl->slot_cap);
|
||||
ctrl_info(ctrl, " Physical Slot Number : %d\n", PSN(ctrl));
|
||||
ctrl_info(ctrl, " Attention Button : %3s\n",
|
||||
ATTN_BUTTN(ctrl) ? "yes" : "no");
|
||||
ctrl_info(ctrl, " Power Controller : %3s\n",
|
||||
POWER_CTRL(ctrl) ? "yes" : "no");
|
||||
ctrl_info(ctrl, " MRL Sensor : %3s\n",
|
||||
MRL_SENS(ctrl) ? "yes" : "no");
|
||||
ctrl_info(ctrl, " Attention Indicator : %3s\n",
|
||||
ATTN_LED(ctrl) ? "yes" : "no");
|
||||
ctrl_info(ctrl, " Power Indicator : %3s\n",
|
||||
PWR_LED(ctrl) ? "yes" : "no");
|
||||
ctrl_info(ctrl, " Hot-Plug Surprise : %3s\n",
|
||||
HP_SUPR_RM(ctrl) ? "yes" : "no");
|
||||
ctrl_info(ctrl, " EMI Present : %3s\n",
|
||||
EMI(ctrl) ? "yes" : "no");
|
||||
ctrl_info(ctrl, " Command Completed : %3s\n",
|
||||
NO_CMD_CMPL(ctrl) ? "no" : "yes");
|
||||
pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, ®16);
|
||||
ctrl_info(ctrl, "Slot Status : 0x%04x\n", reg16);
|
||||
pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, ®16);
|
||||
|
@ -818,10 +805,8 @@ struct controller *pcie_init(struct pcie_device *dev)
|
|||
|
||||
/* Check if Data Link Layer Link Active Reporting is implemented */
|
||||
pcie_capability_read_dword(pdev, PCI_EXP_LNKCAP, &link_cap);
|
||||
if (link_cap & PCI_EXP_LNKCAP_DLLLARC) {
|
||||
ctrl_dbg(ctrl, "Link Active Reporting supported\n");
|
||||
if (link_cap & PCI_EXP_LNKCAP_DLLLARC)
|
||||
ctrl->link_active_reporting = 1;
|
||||
}
|
||||
|
||||
/* Clear all remaining event bits in Slot Status register */
|
||||
pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
|
||||
|
@ -829,13 +814,15 @@ struct controller *pcie_init(struct pcie_device *dev)
|
|||
PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_PDC |
|
||||
PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC);
|
||||
|
||||
ctrl_info(ctrl, "Slot #%d AttnBtn%c AttnInd%c PwrInd%c PwrCtrl%c MRL%c Interlock%c NoCompl%c LLActRep%c\n",
|
||||
ctrl_info(ctrl, "Slot #%d AttnBtn%c PwrCtrl%c MRL%c AttnInd%c PwrInd%c HotPlug%c Surprise%c Interlock%c NoCompl%c LLActRep%c\n",
|
||||
(slot_cap & PCI_EXP_SLTCAP_PSN) >> 19,
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_ABP),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_AIP),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_PIP),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_PCP),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_MRLSP),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_AIP),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_PIP),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_HPC),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_HPS),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_EIP),
|
||||
FLAG(slot_cap, PCI_EXP_SLTCAP_NCCS),
|
||||
FLAG(link_cap, PCI_EXP_LNKCAP_DLLLARC));
|
||||
|
|
Loading…
Reference in a new issue