[PATCH] PCI device-node failure detection
Jake Moilanen
moilanen at austin.ibm.com
Wed Jun 1 07:55:07 EST 2005
> "fail" is not the only possible state that would indicate that the
> device is unusable, if I'm reading IEEE 1275 right. There is also
> "disabled" and "fail-xxx" where xxx is additional info about the
> fault. I've never seen "fail-xxx" myself but I've seen "disabled" on
> devices that were deconfigured by firmware (failing cpu iirc).
I haven't seen this on an adapter, but better to follow the spec.
> Unless we want to treat "disabled" and "fail[-xxx]" differently, I
> think we should be checking that the status property, if present,
> says "okay".
>
> Something like:
>
> int dn_failed(struct device_node *dn)
> {
> char *status = get_property(dn, "status", NULL);
>
> if (!status)
> return 0;
>
> if (!strcmp(status, "okay"))
> return 0;
>
> return 1;
> }
I like that much more.
> Also, I think this function could be made a static helper in
> pSeries_pci.c until something outside of that file needs it.
Hmm...I thought we were trying to keep all device-tree specific items in
prom.c.
Here's a fixed up version of the dn_failed().
Signed-off-by: Jake Moilanen <moilanen at austin.ibm.com>
Index: 2.6.12/arch/ppc64/kernel/prom.c
===================================================================
--- 2.6.12.orig/arch/ppc64/kernel/prom.c 2005-03-02 01:38:13.000000000 -0600
+++ 2.6.12/arch/ppc64/kernel/prom.c 2005-05-31 21:05:58.674114874 -0500
@@ -1887,6 +1887,22 @@
*next = prop;
}
+int
+dn_failed(struct device_node * dn)
+{
+ char * status;
+
+ status = get_property(dn, "status", NULL);
+
+ if (!status)
+ return 0;
+
+ if (!strcmp(status, "okay"))
+ return 0;
+
+ return 1;
+}
+
#if 0
void
print_properties(struct device_node *np)
Index: 2.6.12/arch/ppc64/kernel/pSeries_pci.c
===================================================================
--- 2.6.12.orig/arch/ppc64/kernel/pSeries_pci.c 2005-03-02 01:38:34.000000000 -0600
+++ 2.6.12/arch/ppc64/kernel/pSeries_pci.c 2005-05-27 18:44:33.000000000 -0500
@@ -96,7 +96,7 @@
/* Search only direct children of the bus */
for (dn = busdn->child; dn; dn = dn->sibling)
- if (dn->devfn == devfn)
+ if (dn->devfn == devfn && !dn_failed(dn))
return rtas_read_config(dn, where, size, val);
return PCIBIOS_DEVICE_NOT_FOUND;
}
@@ -138,7 +138,7 @@
/* Search only direct children of the bus */
for (dn = busdn->child; dn; dn = dn->sibling)
- if (dn->devfn == devfn)
+ if (dn->devfn == devfn && !dn_failed(dn))
return rtas_write_config(dn, where, size, val);
return PCIBIOS_DEVICE_NOT_FOUND;
}
Index: 2.6.12/include/asm-ppc64/prom.h
===================================================================
--- 2.6.12.orig/include/asm-ppc64/prom.h 2005-03-02 01:38:33.000000000 -0600
+++ 2.6.12/include/asm-ppc64/prom.h 2005-05-27 18:44:33.000000000 -0500
@@ -225,5 +225,6 @@
extern int prom_n_intr_cells(struct device_node* np);
extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
extern void prom_add_property(struct device_node* np, struct property* prop);
+extern int dn_failed(struct device_node * dn);
#endif /* _PPC64_PROM_H */
More information about the Linuxppc64-dev
mailing list