diff options
author | Jake Moilanen <moilanen@austin.ibm.com> | 2005-06-09 10:31:12 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-08-28 20:53:31 -0400 |
commit | 293da76b3d4c2f362f906bce8c5d2e053bdf8d44 (patch) | |
tree | 8df51f65e8fafd152ce0fa57fd0fe9ef56659ef1 /arch/ppc64 | |
parent | 34153fa3af45d84f3221d9b67ba2ab7e8a220d28 (diff) |
[PATCH] ppc64: PCI device-node failure detection
OpenFirmware marks devices as failed in the device-tree when a hardware
problem is detected. The kernel needs to fail config reads/writes to
prevent a kernel crash when incorrect data is read.
This patch validates that the device-node is not marked "fail" when
config space reads/writes are attempted.
Signed-off-by: Jake Moilanen <moilanen@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64')
-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 | } |