#define IS_BRIDGE(class_code) (((class_code)<<16) == PCI_BASE_CLASS_BRIDGE)
/**
- * rtas_slot_error_detail - Retrieve error log through RTAS call
+ * eeh_rtas_slot_error_detail - Retrieve error log through RTAS call
* @pdn: device node
* @severity: temporary or permanent error log
* @driver_log: driver log to be combined with the retrieved error log
* This routine should be called to retrieve error log through the dedicated
* RTAS call.
*/
-static void rtas_slot_error_detail(struct pci_dn *pdn, int severity,
+static void eeh_rtas_slot_error_detail(struct pci_dn *pdn, int severity,
char *driver_log, size_t loglen)
{
int config_addr;
}
/**
- * gather_pci_data - Copy assorted PCI config space registers to buff
+ * eeh_gather_pci_data - Copy assorted PCI config space registers to buff
* @pdn: device to report data for
* @buf: point to buffer in which to log
* @len: amount of room in buffer
* This routine captures assorted PCI configuration space data,
* and puts them into a buffer for RTAS error logging.
*/
-static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
+static size_t eeh_gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
{
struct pci_dev *dev = pdn->pcidev;
u32 cfg;
for_each_child_of_node(pdn->node, dn) {
pdn = PCI_DN(dn);
if (pdn)
- n += gather_pci_data(pdn, buf+n, len-n);
+ n += eeh_gather_pci_data(pdn, buf+n, len-n);
}
}
size_t loglen = 0;
pci_regs_buf[0] = 0;
- rtas_pci_enable(pdn, EEH_THAW_MMIO);
- rtas_configure_bridge(pdn);
+ eeh_pci_enable(pdn, EEH_THAW_MMIO);
+ eeh_configure_bridge(pdn);
eeh_restore_bars(pdn);
- loglen = gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN);
+ loglen = eeh_gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN);
- rtas_slot_error_detail(pdn, severity, pci_regs_buf, loglen);
+ eeh_rtas_slot_error_detail(pdn, severity, pci_regs_buf, loglen);
}
/**
- * read_slot_reset_state - Read the reset state of a device node's slot
+ * eeh_read_slot_reset_state - Read the reset state of a device node's slot
* @dn: device node to read
* @rets: array to return results in
*
* Read the reset state of a device node's slot through platform dependent
* function call.
*/
-static int read_slot_reset_state(struct pci_dn *pdn, int rets[])
+static int eeh_read_slot_reset_state(struct pci_dn *pdn, int rets[])
{
int token, outputs;
int config_addr;
* the max allowed wait time is exceeded, in which case
* a -2 is returned.
*/
-int
-eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs)
+int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs)
{
int rc;
int rets[3];
int mwait;
while (1) {
- rc = read_slot_reset_state(pdn, rets);
+ rc = eeh_read_slot_reset_state(pdn, rets);
if (rc) return rc;
if (rets[1] == 0) return -1; /* EEH is not supported */
}
/**
- * find_device_pe - Retrieve the PE for the given device
+ * eeh_find_device_pe - Retrieve the PE for the given device
* @dn: device node
*
* Return the PE under which this device lies
*/
-struct device_node * find_device_pe(struct device_node *dn)
+struct device_node *eeh_find_device_pe(struct device_node *dn)
{
while ((dn->parent) && PCI_DN(dn->parent) &&
(PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) {
void eeh_mark_slot(struct device_node *dn, int mode_flag)
{
struct pci_dev *dev;
- dn = find_device_pe(dn);
+ dn = eeh_find_device_pe(dn);
/* Back up one, since config addrs might be shared */
if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
unsigned long flags;
raw_spin_lock_irqsave(&confirm_error_lock, flags);
- dn = find_device_pe(dn);
+ dn = eeh_find_device_pe(dn);
/* Back up one, since config addrs might be shared */
if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
no_dn++;
return 0;
}
- dn = find_device_pe(dn);
+ dn = eeh_find_device_pe(dn);
pdn = PCI_DN(dn);
/* Access to IO BARs might get this far and still not want checking. */
* function zero of a multi-function device.
* In any case they must share a common PHB.
*/
- ret = read_slot_reset_state(pdn, rets);
+ ret = eeh_read_slot_reset_state(pdn, rets);
/* If the call to firmware failed, punt */
if (ret != 0) {
- printk(KERN_WARNING "EEH: read_slot_reset_state() failed; rc=%d dn=%s\n",
+ printk(KERN_WARNING "EEH: eeh_read_slot_reset_state() failed; rc=%d dn=%s\n",
ret, dn->full_name);
false_positives++;
pdn->eeh_false_positives ++;
/**
- * rtas_pci_enable - Enable MMIO or DMA transfers for this slot
+ * eeh_pci_enable - Enable MMIO or DMA transfers for this slot
* @pdn pci device node
*
* This routine should be called to reenable frozen MMIO or DMA
* so that it would work correctly again. It's useful while doing
* recovery or log collection on the indicated device.
*/
-int
-rtas_pci_enable(struct pci_dn *pdn, int function)
+int eeh_pci_enable(struct pci_dn *pdn, int function)
{
int config_addr;
int rc;
}
/**
- * rtas_pci_slot_reset - Raises/Lowers the pci #RST line
+ * eeh_slot_reset - Raises/Lowers the pci #RST line
* @pdn: pci device node
* @state: 1/0 to raise/lower the #RST
*
* and drops the #RST line if 'state is '0'. This routine is
* safe to call in an interrupt context.
*/
-static void
-rtas_pci_slot_reset(struct pci_dn *pdn, int state)
+static void eeh_slot_reset(struct pci_dn *pdn, int state)
{
int config_addr;
int rc;
switch (state) {
case pcie_deassert_reset:
- rtas_pci_slot_reset(pdn, 0);
+ eeh_slot_reset(pdn, 0);
break;
case pcie_hot_reset:
- rtas_pci_slot_reset(pdn, 1);
+ eeh_slot_reset(pdn, 1);
break;
case pcie_warm_reset:
- rtas_pci_slot_reset(pdn, 3);
+ eeh_slot_reset(pdn, 3);
break;
default:
return -EINVAL;
void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset)
{
struct pci_dev *dev;
- dn = find_device_pe(dn);
+ dn = eeh_find_device_pe(dn);
/* Back up one, since config addrs might be shared */
if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
}
/**
- * __rtas_set_slot_reset - Assert the pci #RST line for 1/4 second
+ * eeh_reset_pe_once - Assert the pci #RST line for 1/4 second
* @pdn: pci device node to be reset.
*
* Assert the PCI #RST line for 1/4 second.
*/
-static void __rtas_set_slot_reset(struct pci_dn *pdn)
+static void eeh_reset_pe_once(struct pci_dn *pdn)
{
unsigned int freset = 0;
eeh_set_pe_freset(pdn->node, &freset);
if (freset)
- rtas_pci_slot_reset(pdn, 3);
+ eeh_slot_reset(pdn, 3);
else
- rtas_pci_slot_reset(pdn, 1);
+ eeh_slot_reset(pdn, 1);
/* The PCI bus requires that the reset be held high for at least
* a 100 milliseconds. We wait a bit longer 'just in case'.
*/
eeh_clear_slot(pdn->node, EEH_MODE_ISOLATED);
- rtas_pci_slot_reset(pdn, 0);
+ eeh_slot_reset(pdn, 0);
/* After a PCI slot has been reset, the PCI Express spec requires
* a 1.5 second idle time for the bus to stabilize, before starting
}
/**
- * rtas_set_slot_reset - Reset the indicated PE
+ * eeh_reset_pe - Reset the indicated PE
* @pdn: PCI device node
*
* This routine should be called to reset indicated device, including
* PE. A PE might include multiple PCI devices and sometimes PCI bridges
* might be involved as well.
*/
-int rtas_set_slot_reset(struct pci_dn *pdn)
+int eeh_reset_pe(struct pci_dn *pdn)
{
int i, rc;
/* Take three shots at resetting the bus */
for (i=0; i<3; i++) {
- __rtas_set_slot_reset(pdn);
+ eeh_reset_pe_once(pdn);
rc = eeh_wait_for_slot_status(pdn, PCI_BUS_RESET_WAIT_MSEC);
if (rc == 0)
*/
/**
- * __restore_bars - Restore the Base Address Registers
+ * eeh_restore_one_device_bars - Restore the Base Address Registers for one device
* @pdn: pci device node
*
* Loads the PCI configuration space base address registers,
* the expansion ROM base address, the latency timer, and etc.
* from the saved values in the device node.
*/
-static inline void __restore_bars(struct pci_dn *pdn)
+static inline void eeh_restore_one_device_bars(struct pci_dn *pdn)
{
int i;
u32 cmd;
return;
if ((pdn->eeh_mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(pdn->class_code))
- __restore_bars(pdn);
+ eeh_restore_one_device_bars(pdn);
for_each_child_of_node(pdn->node, dn)
eeh_restore_bars(PCI_DN(dn));
}
/**
- * rtas_configure_bridge - Configure PCI bridges for the indicated PE
+ * eeh_configure_bridge - Configure PCI bridges for the indicated PE
* @pdn: PCI device node
*
* PCI bridges might be included in PE. In order to make the PE work
* again. The included PCI bridges should be recovered after the PE
* encounters frozen state.
*/
-void
-rtas_configure_bridge(struct pci_dn *pdn)
+void eeh_configure_bridge(struct pci_dn *pdn)
{
int config_addr;
int rc;
};
/**
- * get_pe_addr - Retrieve PE address with given BDF address
+ * eeh_get_pe_addr - Retrieve PE address with given BDF address
* @config_addr: BDF address
* @info: BUID of the associated PHB
*
* the given BDF address. Further more, we prefer PE address on BDF
* address in EEH core components.
*/
-static int get_pe_addr(int config_addr,
+static int eeh_get_pe_addr(int config_addr,
struct eeh_early_enable_info *info)
{
unsigned int rets[3];
}
/**
- * early_enable_eeh - Early enable EEH on the indicated device
+ * eeh_early_enable - Early enable EEH on the indicated device
* @dn: device node
* @data: BUID
*
* is expected to be called before real PCI probing is done. However,
* the PHBs have been initialized at this point.
*/
-static void *early_enable_eeh(struct device_node *dn, void *data)
+static void *eeh_early_enable(struct device_node *dn, void *data)
{
unsigned int rets[3];
struct eeh_early_enable_info *info = data;
/* If the newer, better, ibm,get-config-addr-info is supported,
* then use that instead.
*/
- pdn->eeh_pe_config_addr = get_pe_addr(pdn->eeh_config_addr, info);
+ pdn->eeh_pe_config_addr = eeh_get_pe_addr(pdn->eeh_config_addr, info);
/* Some older systems (Power4) allow the
* ibm,set-eeh-option call to succeed even on nodes
* where EEH is not supported. Verify support
* explicitly.
*/
- ret = read_slot_reset_state(pdn, rets);
+ ret = eeh_read_slot_reset_state(pdn, rets);
if ((ret == 0) && (rets[1] == 1))
enable = 1;
}
info.buid_lo = BUID_LO(buid);
info.buid_hi = BUID_HI(buid);
- traverse_pci_devices(phb, early_enable_eeh, &info);
+ traverse_pci_devices(phb, eeh_early_enable, &info);
}
if (eeh_subsystem_enabled)
info.buid_hi = BUID_HI(phb->buid);
info.buid_lo = BUID_LO(phb->buid);
- early_enable_eeh(dn, &info);
+ eeh_early_enable(dn, &info);
}
/**