svn commit: r227031 - projects/pseries/powerpc/ofw
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Wed Nov 2 20:11:19 UTC 2011
Author: nwhitehorn
Date: Wed Nov 2 20:11:19 2011
New Revision: 227031
URL: http://svn.freebsd.org/changeset/base/227031
Log:
Use the phandle cross-reference tools here and avoid making requests with
invalid phandles that could crash certain badly-written OF implementations.
Modified:
projects/pseries/powerpc/ofw/ofw_pcibus.c
Modified: projects/pseries/powerpc/ofw/ofw_pcibus.c
==============================================================================
--- projects/pseries/powerpc/ofw/ofw_pcibus.c Wed Nov 2 19:35:31 2011 (r227030)
+++ projects/pseries/powerpc/ofw/ofw_pcibus.c Wed Nov 2 20:11:19 2011 (r227031)
@@ -213,11 +213,13 @@ ofw_pcibus_enum_devtree(device_t dev, u_
icells = 1;
OF_getprop(child, "interrupt-parent", &iparent,
sizeof(iparent));
- OF_getprop(iparent, "#interrupt-cells", &icells,
- sizeof(icells));
+ iparent = OF_xref_phandle(iparent);
- if (iparent != 0)
+ if (iparent != 0) {
+ OF_getprop(iparent, "#interrupt-cells",
+ &icells, sizeof(icells));
intr[0] = MAP_IRQ(iparent, intr[0]);
+ }
if (iparent != 0 && icells > 1) {
powerpc_config_intr(intr[0],
@@ -344,6 +346,8 @@ ofw_pcibus_assign_interrupt(device_t dev
iparent = -1;
if (OF_getprop(node, "interrupt-parent", &iparent, sizeof(iparent)) < 0)
iparent = -1;
+ else
+ iparent = OF_xref_phandle(iparent);
/*
* Any AAPL,interrupts property gets priority and is
More information about the svn-src-projects
mailing list