|
@@ -91,26 +91,14 @@ static int rtas_pci_read_config(struct pci_bus *bus,
|
|
unsigned int devfn,
|
|
unsigned int devfn,
|
|
int where, int size, u32 *val)
|
|
int where, int size, u32 *val)
|
|
{
|
|
{
|
|
- struct device_node *busdn, *dn;
|
|
|
|
struct pci_dn *pdn;
|
|
struct pci_dn *pdn;
|
|
- bool found = false;
|
|
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- /* Search only direct children of the bus */
|
|
|
|
*val = 0xFFFFFFFF;
|
|
*val = 0xFFFFFFFF;
|
|
- busdn = pci_bus_to_OF_node(bus);
|
|
|
|
- for (dn = busdn->child; dn; dn = dn->sibling) {
|
|
|
|
- pdn = PCI_DN(dn);
|
|
|
|
- if (pdn && pdn->devfn == devfn
|
|
|
|
- && of_device_is_available(dn)) {
|
|
|
|
- found = true;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- if (!found)
|
|
|
|
- return PCIBIOS_DEVICE_NOT_FOUND;
|
|
|
|
|
|
+ pdn = pci_get_pdn_by_devfn(bus, devfn);
|
|
|
|
|
|
|
|
+ /* Validity of pdn is checked in here */
|
|
ret = rtas_read_config(pdn, where, size, val);
|
|
ret = rtas_read_config(pdn, where, size, val);
|
|
if (*val == EEH_IO_ERROR_VALUE(size) &&
|
|
if (*val == EEH_IO_ERROR_VALUE(size) &&
|
|
eeh_dev_check_failure(pdn_to_eeh_dev(pdn)))
|
|
eeh_dev_check_failure(pdn_to_eeh_dev(pdn)))
|
|
@@ -153,24 +141,11 @@ static int rtas_pci_write_config(struct pci_bus *bus,
|
|
unsigned int devfn,
|
|
unsigned int devfn,
|
|
int where, int size, u32 val)
|
|
int where, int size, u32 val)
|
|
{
|
|
{
|
|
- struct device_node *busdn, *dn;
|
|
|
|
struct pci_dn *pdn;
|
|
struct pci_dn *pdn;
|
|
- bool found = false;
|
|
|
|
-
|
|
|
|
- /* Search only direct children of the bus */
|
|
|
|
- busdn = pci_bus_to_OF_node(bus);
|
|
|
|
- for (dn = busdn->child; dn; dn = dn->sibling) {
|
|
|
|
- pdn = PCI_DN(dn);
|
|
|
|
- if (pdn && pdn->devfn == devfn
|
|
|
|
- && of_device_is_available(dn)) {
|
|
|
|
- found = true;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- if (!found)
|
|
|
|
- return PCIBIOS_DEVICE_NOT_FOUND;
|
|
|
|
|
|
+ pdn = pci_get_pdn_by_devfn(bus, devfn);
|
|
|
|
|
|
|
|
+ /* Validity of pdn is checked in here. */
|
|
return rtas_write_config(pdn, where, size, val);
|
|
return rtas_write_config(pdn, where, size, val);
|
|
}
|
|
}
|
|
|
|
|