[Skiboot] [PATCH v2 1/4] core/pci: Use cached VDID when populating device node
Oliver O'Halloran
oohall at gmail.com
Wed Nov 20 11:28:00 AEDT 2019
On Mon, Jun 19, 2017 at 4:48 PM Gavin Shan <gwshan at linux.vnet.ibm.com> wrote:
>
> No need to read the VDID from HW when populating the PCI device
> node, as it has been cached in pd->vdid.
>
> Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
Merged as 8f33688a0259a6fd6bd94d206bcb399e669e910a
> ---
> core/pci.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/core/pci.c b/core/pci.c
> index 63d9d24..7cd29fd 100644
> --- a/core/pci.c
> +++ b/core/pci.c
> @@ -1435,12 +1435,9 @@ static void pci_print_summary_line(struct phb *phb, struct pci_device *pd,
> const char *cname)
> {
> const char *label, *dtype, *s;
> - u32 vdid;
> #define MAX_SLOTSTR 32
> char slotstr[MAX_SLOTSTR + 1] = { 0, };
>
> - pci_cfg_read32(phb, pd->bdfn, 0, &vdid);
> -
> /* If it's a slot, it has a slot-label */
> label = dt_prop_get_def(np, "ibm,slot-label", NULL);
> if (label) {
> @@ -1479,13 +1476,15 @@ static void pci_print_summary_line(struct phb *phb, struct pci_device *pd,
> if (pd->is_bridge)
> PCINOTICE(phb, pd->bdfn,
> "[%s] %04x %04x R:%02x C:%06x B:%02x..%02x %s\n",
> - dtype, vdid & 0xffff, vdid >> 16,
> + dtype, PCI_VENDOR_ID(pd->vdid),
> + PCI_DEVICE_ID(pd->vdid),
> rev_class & 0xff, rev_class >> 8, pd->secondary_bus,
> pd->subordinate_bus, slotstr);
> else
> PCINOTICE(phb, pd->bdfn,
> "[%s] %04x %04x R:%02x C:%06x (%14s) %s\n",
> - dtype, vdid & 0xffff, vdid >> 16,
> + dtype, PCI_VENDOR_ID(pd->vdid),
> + PCI_DEVICE_ID(pd->vdid),
> rev_class & 0xff, rev_class >> 8, cname, slotstr);
> }
>
> @@ -1500,7 +1499,7 @@ static void pci_add_one_device_node(struct phb *phb,
> #define MAX_NAME 256
> char name[MAX_NAME];
> char compat[MAX_NAME];
> - uint32_t rev_class, vdid;
> + uint32_t rev_class;
> uint32_t reg[5];
> uint8_t intpin;
> const uint32_t ranges_direct[] = {
> @@ -1511,7 +1510,6 @@ static void pci_add_one_device_node(struct phb *phb,
> 0x02000000, 0x0, 0x0,
> 0xf0000000, 0x0};
>
> - pci_cfg_read32(phb, pd->bdfn, 0, &vdid);
> pci_cfg_read32(phb, pd->bdfn, PCI_CFG_REV_ID, &rev_class);
> pci_cfg_read8(phb, pd->bdfn, PCI_CFG_INT_PIN, &intpin);
>
> @@ -1536,17 +1534,17 @@ static void pci_add_one_device_node(struct phb *phb,
> /* XXX FIXME: make proper "compatible" properties */
> if (pci_has_cap(pd, PCI_CFG_CAP_ID_EXP, false)) {
> snprintf(compat, MAX_NAME, "pciex%x,%x",
> - vdid & 0xffff, vdid >> 16);
> + PCI_VENDOR_ID(pd->vdid), PCI_DEVICE_ID(pd->vdid));
> dt_add_property_cells(np, "ibm,pci-config-space-type", 1);
> } else {
> snprintf(compat, MAX_NAME, "pci%x,%x",
> - vdid & 0xffff, vdid >> 16);
> + PCI_VENDOR_ID(pd->vdid), PCI_DEVICE_ID(pd->vdid));
> dt_add_property_cells(np, "ibm,pci-config-space-type", 0);
> }
> dt_add_property_cells(np, "class-code", rev_class >> 8);
> dt_add_property_cells(np, "revision-id", rev_class & 0xff);
> - dt_add_property_cells(np, "vendor-id", vdid & 0xffff);
> - dt_add_property_cells(np, "device-id", vdid >> 16);
> + dt_add_property_cells(np, "vendor-id", PCI_VENDOR_ID(pd->vdid));
> + dt_add_property_cells(np, "device-id", PCI_DEVICE_ID(pd->vdid));
> if (intpin)
> dt_add_property_cells(np, "interrupts", intpin);
>
> --
> 2.7.4
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
More information about the Skiboot
mailing list