diff options
-rw-r--r-- | arch/ppc64/kernel/rtas_pci.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/ppc64/kernel/rtas_pci.c b/arch/ppc64/kernel/rtas_pci.c index 1048817befb8..1dccadaddd1d 100644 --- a/arch/ppc64/kernel/rtas_pci.c +++ b/arch/ppc64/kernel/rtas_pci.c | |||
@@ -58,6 +58,21 @@ static int config_access_valid(struct device_node *dn, int where) | |||
58 | return 0; | 58 | return 0; |
59 | } | 59 | } |
60 | 60 | ||
61 | static int of_device_available(struct device_node * dn) | ||
62 | { | ||
63 | char * status; | ||
64 | |||
65 | status = get_property(dn, "status", NULL); | ||
66 | |||
67 | if (!status) | ||
68 | return 1; | ||
69 | |||
70 | if (!strcmp(status, "okay")) | ||
71 | return 1; | ||
72 | |||
73 | return 0; | ||
74 | } | ||
75 | |||
61 | static int rtas_read_config(struct device_node *dn, int where, int size, u32 *val) | 76 | static int rtas_read_config(struct device_node *dn, int where, int size, u32 *val) |
62 | { | 77 | { |
63 | int returnval = -1; | 78 | int returnval = -1; |
@@ -103,7 +118,7 @@ static int rtas_pci_read_config(struct pci_bus *bus, | |||
103 | 118 | ||
104 | /* Search only direct children of the bus */ | 119 | /* Search only direct children of the bus */ |
105 | for (dn = busdn->child; dn; dn = dn->sibling) | 120 | for (dn = busdn->child; dn; dn = dn->sibling) |
106 | if (dn->devfn == devfn) | 121 | if (dn->devfn == devfn && of_device_available(dn)) |
107 | return rtas_read_config(dn, where, size, val); | 122 | return rtas_read_config(dn, where, size, val); |
108 | return PCIBIOS_DEVICE_NOT_FOUND; | 123 | return PCIBIOS_DEVICE_NOT_FOUND; |
109 | } | 124 | } |
@@ -146,7 +161,7 @@ static int rtas_pci_write_config(struct pci_bus *bus, | |||
146 | 161 | ||
147 | /* Search only direct children of the bus */ | 162 | /* Search only direct children of the bus */ |
148 | for (dn = busdn->child; dn; dn = dn->sibling) | 163 | for (dn = busdn->child; dn; dn = dn->sibling) |
149 | if (dn->devfn == devfn) | 164 | if (dn->devfn == devfn && of_device_available(dn)) |
150 | return rtas_write_config(dn, where, size, val); | 165 | return rtas_write_config(dn, where, size, val); |
151 | return PCIBIOS_DEVICE_NOT_FOUND; | 166 | return PCIBIOS_DEVICE_NOT_FOUND; |
152 | } | 167 | } |