Skip to content

Commit c035ff1

Browse files
Gavin Shanozbenh
authored andcommitted
powerpc/pci: Trace more information from pci_dn
Originally, EEH probes on device_node or pci_dev and populates the corresponding eeh_dev. In the subsequent patches, EEH will probes on pci_dn and populates the corresponding eeh_dev. So we have to cache some information in pci_dn, either from device_node or SRIOV PF's enablement platform hook, to populate the eeh_dev properly. The motivation to probe pci_dn, instead of device node or pci_dev, to populate eeh_dev is SRIOV VFs are dynamically created and we don't have the corresponding device nodes for them. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent 3532a74 commit c035ff1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

arch/powerpc/include/asm/pci-bridge.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ struct pci_dn {
159159

160160
int busno; /* pci bus number */
161161
int devfn; /* pci device and function number */
162+
int vendor_id; /* Vendor ID */
163+
int device_id; /* Device ID */
164+
int class_code; /* Device class code */
162165

163166
struct pci_dn *parent;
164167
struct pci_controller *phb; /* for pci devices */

arch/powerpc/kernel/pci_dn.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ void *update_dn_pci_info(struct device_node *dn, void *data)
166166
pdn->devfn = (addr >> 8) & 0xff;
167167
}
168168

169+
/* vendor/device IDs and class code */
170+
regs = of_get_property(dn, "vendor-id", NULL);
171+
pdn->vendor_id = regs ? of_read_number(regs, 1) : 0;
172+
regs = of_get_property(dn, "device-id", NULL);
173+
pdn->device_id = regs ? of_read_number(regs, 1) : 0;
174+
regs = of_get_property(dn, "class-code", NULL);
175+
pdn->class_code = regs ? of_read_number(regs, 1) : 0;
176+
177+
/* Extended config space */
169178
pdn->pci_ext_config_space = (type && of_read_number(type, 1) == 1);
170179

171180
/* Attach to parent node */
@@ -255,6 +264,7 @@ void pci_devs_phb_init_dynamic(struct pci_controller *phb)
255264
pdn = dn->data;
256265
if (pdn) {
257266
pdn->devfn = pdn->busno = -1;
267+
pdn->vendor_id = pdn->device_id = pdn->class_code = 0;
258268
pdn->phb = phb;
259269
phb->pci_data = pdn;
260270
}

0 commit comments

Comments
 (0)