mirror of https://gitee.com/openkylin/linux.git
powerpc/pseries: Fix endian issues in pseries EEH code
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
parent
0c4888ef1d
commit
b91da2d4ce
|
@ -189,8 +189,9 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
|
||||||
struct eeh_dev *edev;
|
struct eeh_dev *edev;
|
||||||
struct eeh_pe pe;
|
struct eeh_pe pe;
|
||||||
struct pci_dn *pdn = PCI_DN(dn);
|
struct pci_dn *pdn = PCI_DN(dn);
|
||||||
const u32 *class_code, *vendor_id, *device_id;
|
const __be32 *classp, *vendorp, *devicep;
|
||||||
const u32 *regs;
|
u32 class_code;
|
||||||
|
const __be32 *regs;
|
||||||
u32 pcie_flags;
|
u32 pcie_flags;
|
||||||
int enable = 0;
|
int enable = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -201,22 +202,24 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Retrieve class/vendor/device IDs */
|
/* Retrieve class/vendor/device IDs */
|
||||||
class_code = of_get_property(dn, "class-code", NULL);
|
classp = of_get_property(dn, "class-code", NULL);
|
||||||
vendor_id = of_get_property(dn, "vendor-id", NULL);
|
vendorp = of_get_property(dn, "vendor-id", NULL);
|
||||||
device_id = of_get_property(dn, "device-id", NULL);
|
devicep = of_get_property(dn, "device-id", NULL);
|
||||||
|
|
||||||
/* Skip for bad OF node or PCI-ISA bridge */
|
/* Skip for bad OF node or PCI-ISA bridge */
|
||||||
if (!class_code || !vendor_id || !device_id)
|
if (!classp || !vendorp || !devicep)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (dn->type && !strcmp(dn->type, "isa"))
|
if (dn->type && !strcmp(dn->type, "isa"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
class_code = of_read_number(classp, 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update class code and mode of eeh device. We need
|
* Update class code and mode of eeh device. We need
|
||||||
* correctly reflects that current device is root port
|
* correctly reflects that current device is root port
|
||||||
* or PCIe switch downstream port.
|
* or PCIe switch downstream port.
|
||||||
*/
|
*/
|
||||||
edev->class_code = *class_code;
|
edev->class_code = class_code;
|
||||||
edev->pcie_cap = pseries_eeh_find_cap(dn, PCI_CAP_ID_EXP);
|
edev->pcie_cap = pseries_eeh_find_cap(dn, PCI_CAP_ID_EXP);
|
||||||
edev->mode &= 0xFFFFFF00;
|
edev->mode &= 0xFFFFFF00;
|
||||||
if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) {
|
if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) {
|
||||||
|
@ -243,12 +246,12 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
|
||||||
/* Initialize the fake PE */
|
/* Initialize the fake PE */
|
||||||
memset(&pe, 0, sizeof(struct eeh_pe));
|
memset(&pe, 0, sizeof(struct eeh_pe));
|
||||||
pe.phb = edev->phb;
|
pe.phb = edev->phb;
|
||||||
pe.config_addr = regs[0];
|
pe.config_addr = of_read_number(regs, 1);
|
||||||
|
|
||||||
/* Enable EEH on the device */
|
/* Enable EEH on the device */
|
||||||
ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE);
|
ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
edev->config_addr = regs[0];
|
edev->config_addr = of_read_number(regs, 1);
|
||||||
/* Retrieve PE address */
|
/* Retrieve PE address */
|
||||||
edev->pe_config_addr = eeh_ops->get_pe_addr(&pe);
|
edev->pe_config_addr = eeh_ops->get_pe_addr(&pe);
|
||||||
pe.addr = edev->pe_config_addr;
|
pe.addr = edev->pe_config_addr;
|
||||||
|
|
Loading…
Reference in New Issue