/** * pseries_eeh_read_config - Read PCI config space * @dn: device node * @where: PCI address * @size: size to read * @val: return value * * Read config space from the speicifed device */ static int pseries_eeh_read_config(struct device_node *dn, int where, int size, u32 *val) { struct pci_dn *pdn; pdn = PCI_DN(dn); return rtas_read_config(pdn, where, size, val); }
/** * eeh_save_bars - save device bars * * Save the values of the device bars. Unlike the restore * routine, this routine is *not* recursive. This is because * PCI devices are added individuallly; but, for the restore, * an entire slot is reset at a time. */ static void eeh_save_bars(struct pci_dn *pdn) { int i; if (!pdn ) return; for (i = 0; i < 16; i++) rtas_read_config(pdn, i * 4, 4, &pdn->config_space[i]); }
static int rtas_pci_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) { struct device_node *busdn, *dn; busdn = pci_bus_to_OF_node(bus); /* Search only direct children of the bus */ for (dn = busdn->child; dn; dn = dn->sibling) { struct pci_dn *pdn = PCI_DN(dn); if (pdn && pdn->devfn == devfn && of_device_is_available(dn)) return rtas_read_config(pdn, where, size, val); } return PCIBIOS_DEVICE_NOT_FOUND; }