Merge branch 'pci/printk-portdrv'

- Change some desirable KERN_DEBUG messages to KERN_INFO/KERN_ERR
    (Frederick Lawler)

  - Log PCIe port service messages with pci_dev, not the pcie_device
    (Frederick Lawler)

  - Convert pciehp from pciehp_debug module parameter to generic dynamic
    debug (Frederick Lawler)

* pci/printk-portdrv:
  PCI: pciehp: Remove pointless MY_NAME definition
  PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition
  PCI: pciehp: Remove unused dbg/err/info/warn() wrappers
  PCI: pciehp: Log messages with pci_dev, not pcie_device
  PCI: pciehp: Replace pciehp_debug module param with dyndbg
  PCI: pciehp: Remove pciehp_debug uses
  PCI/AER: Log messages with pci_dev, not pcie_device
  PCI/DPC: Log messages with pci_dev, not pcie_device
  PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
  PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info()
This commit is contained in:
Bjorn Helgaas 2019-05-13 18:34:47 -05:00
commit f8587c80c6
9 changed files with 78 additions and 89 deletions

View File

@ -25,36 +25,21 @@
#include "../pcie/portdrv.h" #include "../pcie/portdrv.h"
#define MY_NAME "pciehp"
extern bool pciehp_poll_mode; extern bool pciehp_poll_mode;
extern int pciehp_poll_time; extern int pciehp_poll_time;
extern bool pciehp_debug;
#define dbg(format, arg...) \
do { \
if (pciehp_debug) \
printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg); \
} while (0)
#define err(format, arg...) \
printk(KERN_ERR "%s: " format, MY_NAME, ## arg)
#define info(format, arg...) \
printk(KERN_INFO "%s: " format, MY_NAME, ## arg)
#define warn(format, arg...) \
printk(KERN_WARNING "%s: " format, MY_NAME, ## arg)
/*
* Set CONFIG_DYNAMIC_DEBUG=y and boot with 'dyndbg="file pciehp* +p"' to
* enable debug messages.
*/
#define ctrl_dbg(ctrl, format, arg...) \ #define ctrl_dbg(ctrl, format, arg...) \
do { \ pci_dbg(ctrl->pcie->port, format, ## arg)
if (pciehp_debug) \
dev_printk(KERN_DEBUG, &ctrl->pcie->device, \
format, ## arg); \
} while (0)
#define ctrl_err(ctrl, format, arg...) \ #define ctrl_err(ctrl, format, arg...) \
dev_err(&ctrl->pcie->device, format, ## arg) pci_err(ctrl->pcie->port, format, ## arg)
#define ctrl_info(ctrl, format, arg...) \ #define ctrl_info(ctrl, format, arg...) \
dev_info(&ctrl->pcie->device, format, ## arg) pci_info(ctrl->pcie->port, format, ## arg)
#define ctrl_warn(ctrl, format, arg...) \ #define ctrl_warn(ctrl, format, arg...) \
dev_warn(&ctrl->pcie->device, format, ## arg) pci_warn(ctrl->pcie->port, format, ## arg)
#define SLOT_NAME_SIZE 10 #define SLOT_NAME_SIZE 10

View File

@ -17,6 +17,9 @@
* Dely Sy <dely.l.sy@intel.com>" * Dely Sy <dely.l.sy@intel.com>"
*/ */
#define pr_fmt(fmt) "pciehp: " fmt
#define dev_fmt pr_fmt
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
@ -27,7 +30,6 @@
#include "../pci.h" #include "../pci.h"
/* Global variables */ /* Global variables */
bool pciehp_debug;
bool pciehp_poll_mode; bool pciehp_poll_mode;
int pciehp_poll_time; int pciehp_poll_time;
@ -35,15 +37,11 @@ int pciehp_poll_time;
* not really modular, but the easiest way to keep compat with existing * not really modular, but the easiest way to keep compat with existing
* bootargs behaviour is to continue using module_param here. * bootargs behaviour is to continue using module_param here.
*/ */
module_param(pciehp_debug, bool, 0644);
module_param(pciehp_poll_mode, bool, 0644); module_param(pciehp_poll_mode, bool, 0644);
module_param(pciehp_poll_time, int, 0644); module_param(pciehp_poll_time, int, 0644);
MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not");
MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not"); MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not");
MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds"); MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds");
#define PCIE_MODULE_NAME "pciehp"
static int set_attention_status(struct hotplug_slot *slot, u8 value); static int set_attention_status(struct hotplug_slot *slot, u8 value);
static int get_power_status(struct hotplug_slot *slot, u8 *value); static int get_power_status(struct hotplug_slot *slot, u8 *value);
static int get_latch_status(struct hotplug_slot *slot, u8 *value); static int get_latch_status(struct hotplug_slot *slot, u8 *value);
@ -182,14 +180,14 @@ static int pciehp_probe(struct pcie_device *dev)
if (!dev->port->subordinate) { if (!dev->port->subordinate) {
/* Can happen if we run out of bus numbers during probe */ /* Can happen if we run out of bus numbers during probe */
dev_err(&dev->device, pci_err(dev->port,
"Hotplug bridge without secondary bus, ignoring\n"); "Hotplug bridge without secondary bus, ignoring\n");
return -ENODEV; return -ENODEV;
} }
ctrl = pcie_init(dev); ctrl = pcie_init(dev);
if (!ctrl) { if (!ctrl) {
dev_err(&dev->device, "Controller initialization failed\n"); pci_err(dev->port, "Controller initialization failed\n");
return -ENODEV; return -ENODEV;
} }
set_service_data(dev, ctrl); set_service_data(dev, ctrl);
@ -307,7 +305,7 @@ static int pciehp_runtime_resume(struct pcie_device *dev)
#endif /* PM */ #endif /* PM */
static struct pcie_port_service_driver hpdriver_portdrv = { static struct pcie_port_service_driver hpdriver_portdrv = {
.name = PCIE_MODULE_NAME, .name = "pciehp",
.port_type = PCIE_ANY_PORT, .port_type = PCIE_ANY_PORT,
.service = PCIE_PORT_SERVICE_HP, .service = PCIE_PORT_SERVICE_HP,
@ -328,9 +326,9 @@ int __init pcie_hp_init(void)
int retval = 0; int retval = 0;
retval = pcie_port_service_register(&hpdriver_portdrv); retval = pcie_port_service_register(&hpdriver_portdrv);
dbg("pcie_port_service_register = %d\n", retval); pr_debug("pcie_port_service_register = %d\n", retval);
if (retval) if (retval)
dbg("Failure to register service\n"); pr_debug("Failure to register service\n");
return retval; return retval;
} }

View File

@ -13,6 +13,8 @@
* *
*/ */
#define dev_fmt(fmt) "pciehp: " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>

View File

@ -12,6 +12,8 @@
* Send feedback to <greg@kroah.com>,<kristen.c.accardi@intel.com> * Send feedback to <greg@kroah.com>,<kristen.c.accardi@intel.com>
*/ */
#define dev_fmt(fmt) "pciehp: " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
@ -46,7 +48,7 @@ static inline int pciehp_request_irq(struct controller *ctrl)
/* Installs the interrupt handler */ /* Installs the interrupt handler */
retval = request_threaded_irq(irq, pciehp_isr, pciehp_ist, retval = request_threaded_irq(irq, pciehp_isr, pciehp_ist,
IRQF_SHARED, MY_NAME, ctrl); IRQF_SHARED, "pciehp", ctrl);
if (retval) if (retval)
ctrl_err(ctrl, "Cannot get irq %d for the hotplug controller\n", ctrl_err(ctrl, "Cannot get irq %d for the hotplug controller\n",
irq); irq);
@ -232,8 +234,8 @@ static bool pci_bus_check_dev(struct pci_bus *bus, int devfn)
delay -= step; delay -= step;
} while (delay > 0); } while (delay > 0);
if (count > 1 && pciehp_debug) if (count > 1)
printk(KERN_DEBUG "pci %04x:%02x:%02x.%d id reading try %d times with interval %d ms to get %08x\n", pr_debug("pci %04x:%02x:%02x.%d id reading try %d times with interval %d ms to get %08x\n",
pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
PCI_FUNC(devfn), count, step, l); PCI_FUNC(devfn), count, step, l);
@ -822,14 +824,11 @@ static inline void dbg_ctrl(struct controller *ctrl)
struct pci_dev *pdev = ctrl->pcie->port; struct pci_dev *pdev = ctrl->pcie->port;
u16 reg16; u16 reg16;
if (!pciehp_debug) ctrl_dbg(ctrl, "Slot Capabilities : 0x%08x\n", ctrl->slot_cap);
return;
ctrl_info(ctrl, "Slot Capabilities : 0x%08x\n", ctrl->slot_cap);
pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &reg16); pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &reg16);
ctrl_info(ctrl, "Slot Status : 0x%04x\n", reg16); ctrl_dbg(ctrl, "Slot Status : 0x%04x\n", reg16);
pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &reg16); pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &reg16);
ctrl_info(ctrl, "Slot Control : 0x%04x\n", reg16); ctrl_dbg(ctrl, "Slot Control : 0x%04x\n", reg16);
} }
#define FLAG(x, y) (((x) & (y)) ? '+' : '-') #define FLAG(x, y) (((x) & (y)) ? '+' : '-')

View File

@ -13,6 +13,8 @@
* *
*/ */
#define dev_fmt(fmt) "pciehp: " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h> #include <linux/pci.h>

View File

@ -12,6 +12,9 @@
* Andrew Patterson <andrew.patterson@hp.com> * Andrew Patterson <andrew.patterson@hp.com>
*/ */
#define pr_fmt(fmt) "AER: " fmt
#define dev_fmt pr_fmt
#include <linux/cper.h> #include <linux/cper.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pci-acpi.h> #include <linux/pci-acpi.h>
@ -779,10 +782,11 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)
u8 bus = info->id >> 8; u8 bus = info->id >> 8;
u8 devfn = info->id & 0xff; u8 devfn = info->id & 0xff;
pci_info(dev, "AER: %s%s error received: %04x:%02x:%02x.%d\n", pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n",
info->multi_error_valid ? "Multiple " : "", info->multi_error_valid ? "Multiple " : "",
aer_error_severity_string[info->severity], aer_error_severity_string[info->severity],
pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),
PCI_FUNC(devfn));
} }
#ifdef CONFIG_ACPI_APEI_PCIEAER #ifdef CONFIG_ACPI_APEI_PCIEAER
@ -964,8 +968,7 @@ static bool find_source_device(struct pci_dev *parent,
pci_walk_bus(parent->subordinate, find_device_iter, e_info); pci_walk_bus(parent->subordinate, find_device_iter, e_info);
if (!e_info->error_dev_num) { if (!e_info->error_dev_num) {
pci_printk(KERN_DEBUG, parent, "can't find device of ID%04x\n", pci_info(parent, "can't find device of ID%04x\n", e_info->id);
e_info->id);
return false; return false;
} }
return true; return true;
@ -1377,25 +1380,24 @@ static int aer_probe(struct pcie_device *dev)
int status; int status;
struct aer_rpc *rpc; struct aer_rpc *rpc;
struct device *device = &dev->device; struct device *device = &dev->device;
struct pci_dev *port = dev->port;
rpc = devm_kzalloc(device, sizeof(struct aer_rpc), GFP_KERNEL); rpc = devm_kzalloc(device, sizeof(struct aer_rpc), GFP_KERNEL);
if (!rpc) { if (!rpc)
dev_printk(KERN_DEBUG, device, "alloc AER rpc failed\n");
return -ENOMEM; return -ENOMEM;
}
rpc->rpd = dev->port; rpc->rpd = port;
set_service_data(dev, rpc); set_service_data(dev, rpc);
status = devm_request_threaded_irq(device, dev->irq, aer_irq, aer_isr, status = devm_request_threaded_irq(device, dev->irq, aer_irq, aer_isr,
IRQF_SHARED, "aerdrv", dev); IRQF_SHARED, "aerdrv", dev);
if (status) { if (status) {
dev_printk(KERN_DEBUG, device, "request AER IRQ %d failed\n", pci_err(port, "request AER IRQ %d failed\n", dev->irq);
dev->irq);
return status; return status;
} }
aer_enable_rootport(rpc); aer_enable_rootport(rpc);
dev_info(device, "AER enabled with IRQ %d\n", dev->irq); pci_info(port, "enabled with IRQ %d\n", dev->irq);
return 0; return 0;
} }
@ -1419,7 +1421,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
pci_write_config_dword(dev, pos + PCI_ERR_ROOT_COMMAND, reg32); pci_write_config_dword(dev, pos + PCI_ERR_ROOT_COMMAND, reg32);
rc = pci_bus_error_reset(dev); rc = pci_bus_error_reset(dev);
pci_printk(KERN_DEBUG, dev, "Root Port link has been reset\n"); pci_info(dev, "Root Port link has been reset\n");
/* Clear Root Error Status */ /* Clear Root Error Status */
pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, &reg32); pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, &reg32);

View File

@ -12,6 +12,8 @@
* Huang Ying <ying.huang@intel.com> * Huang Ying <ying.huang@intel.com>
*/ */
#define dev_fmt(fmt) "aer_inject: " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
@ -332,14 +334,14 @@ static int aer_inject(struct aer_error_inj *einj)
return -ENODEV; return -ENODEV;
rpdev = pcie_find_root_port(dev); rpdev = pcie_find_root_port(dev);
if (!rpdev) { if (!rpdev) {
pci_err(dev, "aer_inject: Root port not found\n"); pci_err(dev, "Root port not found\n");
ret = -ENODEV; ret = -ENODEV;
goto out_put; goto out_put;
} }
pos_cap_err = dev->aer_cap; pos_cap_err = dev->aer_cap;
if (!pos_cap_err) { if (!pos_cap_err) {
pci_err(dev, "aer_inject: Device doesn't support AER\n"); pci_err(dev, "Device doesn't support AER\n");
ret = -EPROTONOSUPPORT; ret = -EPROTONOSUPPORT;
goto out_put; goto out_put;
} }
@ -350,7 +352,7 @@ static int aer_inject(struct aer_error_inj *einj)
rp_pos_cap_err = rpdev->aer_cap; rp_pos_cap_err = rpdev->aer_cap;
if (!rp_pos_cap_err) { if (!rp_pos_cap_err) {
pci_err(rpdev, "aer_inject: Root port doesn't support AER\n"); pci_err(rpdev, "Root port doesn't support AER\n");
ret = -EPROTONOSUPPORT; ret = -EPROTONOSUPPORT;
goto out_put; goto out_put;
} }
@ -398,14 +400,14 @@ static int aer_inject(struct aer_error_inj *einj)
if (!aer_mask_override && einj->cor_status && if (!aer_mask_override && einj->cor_status &&
!(einj->cor_status & ~cor_mask)) { !(einj->cor_status & ~cor_mask)) {
ret = -EINVAL; ret = -EINVAL;
pci_warn(dev, "aer_inject: The correctable error(s) is masked by device\n"); pci_warn(dev, "The correctable error(s) is masked by device\n");
spin_unlock_irqrestore(&inject_lock, flags); spin_unlock_irqrestore(&inject_lock, flags);
goto out_put; goto out_put;
} }
if (!aer_mask_override && einj->uncor_status && if (!aer_mask_override && einj->uncor_status &&
!(einj->uncor_status & ~uncor_mask)) { !(einj->uncor_status & ~uncor_mask)) {
ret = -EINVAL; ret = -EINVAL;
pci_warn(dev, "aer_inject: The uncorrectable error(s) is masked by device\n"); pci_warn(dev, "The uncorrectable error(s) is masked by device\n");
spin_unlock_irqrestore(&inject_lock, flags); spin_unlock_irqrestore(&inject_lock, flags);
goto out_put; goto out_put;
} }
@ -460,19 +462,17 @@ static int aer_inject(struct aer_error_inj *einj)
if (device) { if (device) {
edev = to_pcie_device(device); edev = to_pcie_device(device);
if (!get_service_data(edev)) { if (!get_service_data(edev)) {
dev_warn(&edev->device, pci_warn(edev->port, "AER service is not initialized\n");
"aer_inject: AER service is not initialized\n");
ret = -EPROTONOSUPPORT; ret = -EPROTONOSUPPORT;
goto out_put; goto out_put;
} }
dev_info(&edev->device, pci_info(edev->port, "Injecting errors %08x/%08x into device %s\n",
"aer_inject: Injecting errors %08x/%08x into device %s\n",
einj->cor_status, einj->uncor_status, pci_name(dev)); einj->cor_status, einj->uncor_status, pci_name(dev));
local_irq_disable(); local_irq_disable();
generic_handle_irq(edev->irq); generic_handle_irq(edev->irq);
local_irq_enable(); local_irq_enable();
} else { } else {
pci_err(rpdev, "aer_inject: AER device not found\n"); pci_err(rpdev, "AER device not found\n");
ret = -ENODEV; ret = -ENODEV;
} }
out_put: out_put:

View File

@ -6,6 +6,8 @@
* Copyright (C) 2016 Intel Corp. * Copyright (C) 2016 Intel Corp.
*/ */
#define dev_fmt(fmt) "DPC: " fmt
#include <linux/aer.h> #include <linux/aer.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
@ -100,7 +102,6 @@ static int dpc_wait_rp_inactive(struct dpc_dev *dpc)
{ {
unsigned long timeout = jiffies + HZ; unsigned long timeout = jiffies + HZ;
struct pci_dev *pdev = dpc->dev->port; struct pci_dev *pdev = dpc->dev->port;
struct device *dev = &dpc->dev->device;
u16 cap = dpc->cap_pos, status; u16 cap = dpc->cap_pos, status;
pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status); pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status);
@ -110,7 +111,7 @@ static int dpc_wait_rp_inactive(struct dpc_dev *dpc)
pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status); pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status);
} }
if (status & PCI_EXP_DPC_RP_BUSY) { if (status & PCI_EXP_DPC_RP_BUSY) {
dev_warn(dev, "DPC root port still busy\n"); pci_warn(pdev, "root port still busy\n");
return -EBUSY; return -EBUSY;
} }
return 0; return 0;
@ -148,7 +149,6 @@ static pci_ers_result_t dpc_reset_link(struct pci_dev *pdev)
static void dpc_process_rp_pio_error(struct dpc_dev *dpc) static void dpc_process_rp_pio_error(struct dpc_dev *dpc)
{ {
struct device *dev = &dpc->dev->device;
struct pci_dev *pdev = dpc->dev->port; struct pci_dev *pdev = dpc->dev->port;
u16 cap = dpc->cap_pos, dpc_status, first_error; u16 cap = dpc->cap_pos, dpc_status, first_error;
u32 status, mask, sev, syserr, exc, dw0, dw1, dw2, dw3, log, prefix; u32 status, mask, sev, syserr, exc, dw0, dw1, dw2, dw3, log, prefix;
@ -156,13 +156,13 @@ static void dpc_process_rp_pio_error(struct dpc_dev *dpc)
pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_STATUS, &status); pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_STATUS, &status);
pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_MASK, &mask); pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_MASK, &mask);
dev_err(dev, "rp_pio_status: %#010x, rp_pio_mask: %#010x\n", pci_err(pdev, "rp_pio_status: %#010x, rp_pio_mask: %#010x\n",
status, mask); status, mask);
pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_SEVERITY, &sev); pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_SEVERITY, &sev);
pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_SYSERROR, &syserr); pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_SYSERROR, &syserr);
pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_EXCEPTION, &exc); pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_EXCEPTION, &exc);
dev_err(dev, "RP PIO severity=%#010x, syserror=%#010x, exception=%#010x\n", pci_err(pdev, "RP PIO severity=%#010x, syserror=%#010x, exception=%#010x\n",
sev, syserr, exc); sev, syserr, exc);
/* Get First Error Pointer */ /* Get First Error Pointer */
@ -171,7 +171,7 @@ static void dpc_process_rp_pio_error(struct dpc_dev *dpc)
for (i = 0; i < ARRAY_SIZE(rp_pio_error_string); i++) { for (i = 0; i < ARRAY_SIZE(rp_pio_error_string); i++) {
if ((status & ~mask) & (1 << i)) if ((status & ~mask) & (1 << i))
dev_err(dev, "[%2d] %s%s\n", i, rp_pio_error_string[i], pci_err(pdev, "[%2d] %s%s\n", i, rp_pio_error_string[i],
first_error == i ? " (First)" : ""); first_error == i ? " (First)" : "");
} }
@ -185,18 +185,18 @@ static void dpc_process_rp_pio_error(struct dpc_dev *dpc)
&dw2); &dw2);
pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_HEADER_LOG + 12, pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_HEADER_LOG + 12,
&dw3); &dw3);
dev_err(dev, "TLP Header: %#010x %#010x %#010x %#010x\n", pci_err(pdev, "TLP Header: %#010x %#010x %#010x %#010x\n",
dw0, dw1, dw2, dw3); dw0, dw1, dw2, dw3);
if (dpc->rp_log_size < 5) if (dpc->rp_log_size < 5)
goto clear_status; goto clear_status;
pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_IMPSPEC_LOG, &log); pci_read_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_IMPSPEC_LOG, &log);
dev_err(dev, "RP PIO ImpSpec Log %#010x\n", log); pci_err(pdev, "RP PIO ImpSpec Log %#010x\n", log);
for (i = 0; i < dpc->rp_log_size - 5; i++) { for (i = 0; i < dpc->rp_log_size - 5; i++) {
pci_read_config_dword(pdev, pci_read_config_dword(pdev,
cap + PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG, &prefix); cap + PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG, &prefix);
dev_err(dev, "TLP Prefix Header: dw%d, %#010x\n", i, prefix); pci_err(pdev, "TLP Prefix Header: dw%d, %#010x\n", i, prefix);
} }
clear_status: clear_status:
pci_write_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_STATUS, status); pci_write_config_dword(pdev, cap + PCI_EXP_DPC_RP_PIO_STATUS, status);
@ -229,18 +229,17 @@ static irqreturn_t dpc_handler(int irq, void *context)
struct aer_err_info info; struct aer_err_info info;
struct dpc_dev *dpc = context; struct dpc_dev *dpc = context;
struct pci_dev *pdev = dpc->dev->port; struct pci_dev *pdev = dpc->dev->port;
struct device *dev = &dpc->dev->device;
u16 cap = dpc->cap_pos, status, source, reason, ext_reason; u16 cap = dpc->cap_pos, status, source, reason, ext_reason;
pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status); pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status);
pci_read_config_word(pdev, cap + PCI_EXP_DPC_SOURCE_ID, &source); pci_read_config_word(pdev, cap + PCI_EXP_DPC_SOURCE_ID, &source);
dev_info(dev, "DPC containment event, status:%#06x source:%#06x\n", pci_info(pdev, "containment event, status:%#06x source:%#06x\n",
status, source); status, source);
reason = (status & PCI_EXP_DPC_STATUS_TRIGGER_RSN) >> 1; reason = (status & PCI_EXP_DPC_STATUS_TRIGGER_RSN) >> 1;
ext_reason = (status & PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT) >> 5; ext_reason = (status & PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT) >> 5;
dev_warn(dev, "DPC %s detected\n", pci_warn(pdev, "%s detected\n",
(reason == 0) ? "unmasked uncorrectable error" : (reason == 0) ? "unmasked uncorrectable error" :
(reason == 1) ? "ERR_NONFATAL" : (reason == 1) ? "ERR_NONFATAL" :
(reason == 2) ? "ERR_FATAL" : (reason == 2) ? "ERR_FATAL" :
@ -307,7 +306,7 @@ static int dpc_probe(struct pcie_device *dev)
dpc_handler, IRQF_SHARED, dpc_handler, IRQF_SHARED,
"pcie-dpc", dpc); "pcie-dpc", dpc);
if (status) { if (status) {
dev_warn(device, "request IRQ%d failed: %d\n", dev->irq, pci_warn(pdev, "request IRQ%d failed: %d\n", dev->irq,
status); status);
return status; return status;
} }
@ -319,7 +318,7 @@ static int dpc_probe(struct pcie_device *dev)
if (dpc->rp_extensions) { if (dpc->rp_extensions) {
dpc->rp_log_size = (cap & PCI_EXP_DPC_RP_PIO_LOG_SIZE) >> 8; dpc->rp_log_size = (cap & PCI_EXP_DPC_RP_PIO_LOG_SIZE) >> 8;
if (dpc->rp_log_size < 4 || dpc->rp_log_size > 9) { if (dpc->rp_log_size < 4 || dpc->rp_log_size > 9) {
dev_err(device, "RP PIO log size %u is invalid\n", pci_err(pdev, "RP PIO log size %u is invalid\n",
dpc->rp_log_size); dpc->rp_log_size);
dpc->rp_log_size = 0; dpc->rp_log_size = 0;
} }
@ -328,11 +327,11 @@ static int dpc_probe(struct pcie_device *dev)
ctl = (ctl & 0xfff4) | PCI_EXP_DPC_CTL_EN_FATAL | PCI_EXP_DPC_CTL_INT_EN; ctl = (ctl & 0xfff4) | PCI_EXP_DPC_CTL_EN_FATAL | PCI_EXP_DPC_CTL_INT_EN;
pci_write_config_word(pdev, dpc->cap_pos + PCI_EXP_DPC_CTL, ctl); pci_write_config_word(pdev, dpc->cap_pos + PCI_EXP_DPC_CTL, ctl);
dev_info(device, "DPC error containment capabilities: Int Msg #%d, RPExt%c PoisonedTLP%c SwTrigger%c RP PIO Log %d, DL_ActiveErr%c\n", pci_info(pdev, "error containment capabilities: Int Msg #%d, RPExt%c PoisonedTLP%c SwTrigger%c RP PIO Log %d, DL_ActiveErr%c\n",
cap & PCI_EXP_DPC_IRQ, FLAG(cap, PCI_EXP_DPC_CAP_RP_EXT), cap & PCI_EXP_DPC_IRQ, FLAG(cap, PCI_EXP_DPC_CAP_RP_EXT),
FLAG(cap, PCI_EXP_DPC_CAP_POISONED_TLP), FLAG(cap, PCI_EXP_DPC_CAP_POISONED_TLP),
FLAG(cap, PCI_EXP_DPC_CAP_SW_TRIGGER), dpc->rp_log_size, FLAG(cap, PCI_EXP_DPC_CAP_SW_TRIGGER), dpc->rp_log_size,
FLAG(cap, PCI_EXP_DPC_CAP_DL_ACTIVE)); FLAG(cap, PCI_EXP_DPC_CAP_DL_ACTIVE));
pci_add_ext_cap_save_buffer(pdev, PCI_EXT_CAP_ID_DPC, sizeof(u16)); pci_add_ext_cap_save_buffer(pdev, PCI_EXT_CAP_ID_DPC, sizeof(u16));
return status; return status;

View File

@ -7,6 +7,8 @@
* Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
*/ */
#define dev_fmt(fmt) "PME: " fmt
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
@ -194,14 +196,14 @@ static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id)
* assuming that the PME was reported by a PCIe-PCI bridge that * assuming that the PME was reported by a PCIe-PCI bridge that
* used devfn different from zero. * used devfn different from zero.
*/ */
pci_dbg(port, "PME interrupt generated for non-existent device %02x:%02x.%d\n", pci_info(port, "interrupt generated for non-existent device %02x:%02x.%d\n",
busnr, PCI_SLOT(devfn), PCI_FUNC(devfn)); busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
found = pcie_pme_from_pci_bridge(bus, 0); found = pcie_pme_from_pci_bridge(bus, 0);
} }
out: out:
if (!found) if (!found)
pci_dbg(port, "Spurious native PME interrupt!\n"); pci_info(port, "Spurious native interrupt!\n");
} }
/** /**
@ -341,7 +343,7 @@ static int pcie_pme_probe(struct pcie_device *srv)
return ret; return ret;
} }
pci_info(port, "Signaling PME with IRQ %d\n", srv->irq); pci_info(port, "Signaling with IRQ %d\n", srv->irq);
pcie_pme_mark_devices(port); pcie_pme_mark_devices(port);
pcie_pme_interrupt_enable(port, true); pcie_pme_interrupt_enable(port, true);