[PATCH] PCI device-node failure detection

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Jun 1 09:34:46 EST 2005


On Tue, 2005-05-31 at 10:12 -0500, Jake Moilanen wrote:
> 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 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-27 18:44:33.172559207 -0500
> @@ -1887,6 +1887,19 @@
>  	*next = prop;
>  }
>  
> +int
> +dn_failed(struct device_node * dn)
> +{
> +	char * status;
> +
> +	status = get_property(dn, "status", NULL);
> +
> +	if (status && !strcmp(status, "fail"))
> +		return 1;
> +
> +	return 0;
> +}
> +

Please, keep that out of prom.c (and I don't like the function name :)

Ben.





More information about the Linuxppc64-dev mailing list