diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2013-09-09 12:54:08 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2013-09-09 12:54:08 +0000 |
commit | 62b453e543862c477058f22dfd7d6a7b72e79281 (patch) | |
tree | 6868ab54b3b19d9dfd9492213d75ea10e7abf8b4 | |
parent | b2fa807b0ea69fe87722e720c585c3117956f5ae (diff) | |
download | FreeBSD-src-62b453e543862c477058f22dfd7d6a7b72e79281.zip FreeBSD-src-62b453e543862c477058f22dfd7d6a7b72e79281.tar.gz |
Attach only on hardware that is actually supported as opposed to hardware
that seems like it has some of the problems we might want.
Approved by: re (kib)
-rw-r--r-- | sys/powerpc/ofw/ofw_syscons.c | 14 | ||||
-rw-r--r-- | sys/powerpc/powermac/platform_powermac.c | 18 |
2 files changed, 29 insertions, 3 deletions
diff --git a/sys/powerpc/ofw/ofw_syscons.c b/sys/powerpc/ofw/ofw_syscons.c index 84ba302..fe8444c 100644 --- a/sys/powerpc/ofw/ofw_syscons.c +++ b/sys/powerpc/ofw/ofw_syscons.c @@ -218,6 +218,7 @@ ofwfb_configure(int flags) ihandle_t stdout; phandle_t node; uint32_t fb_phys; + ssize_t proplen; int depth; int disable; int len; @@ -264,12 +265,21 @@ ofwfb_configure(int flags) } else return (0); + if (OF_getproplen(node, "height") != sizeof(sc->sc_height) || + OF_getproplen(node, "width") != sizeof(sc->sc_width)) + return (0); + sc->sc_depth = depth; sc->sc_node = node; sc->sc_console = 1; + sc->sc_stride = -1; OF_getprop(node, "height", &sc->sc_height, sizeof(sc->sc_height)); OF_getprop(node, "width", &sc->sc_width, sizeof(sc->sc_width)); - OF_getprop(node, "linebytes", &sc->sc_stride, sizeof(sc->sc_stride)); + proplen = OF_getprop(node, "linebytes", &sc->sc_stride, + sizeof(sc->sc_stride)); + if (proplen != sizeof(sc->sc_stride) || + sc->sc_stride < sc->sc_width*sc->sc_depth/4) + sc->sc_stride = sc->sc_width*sc->sc_depth/4; /* * Grab the physical address of the framebuffer, and then map it @@ -278,6 +288,8 @@ ofwfb_configure(int flags) * * XXX We assume #address-cells is 1 at this point. */ + if (OF_getproplen(node, "address") != sizeof(fb_phys)) + return (0); OF_getprop(node, "address", &fb_phys, sizeof(fb_phys)); bus_space_map(&bs_be_tag, fb_phys, sc->sc_height * sc->sc_stride, diff --git a/sys/powerpc/powermac/platform_powermac.c b/sys/powerpc/powermac/platform_powermac.c index 52d5c4a..e21a48c 100644 --- a/sys/powerpc/powermac/platform_powermac.c +++ b/sys/powerpc/powermac/platform_powermac.c @@ -91,8 +91,22 @@ PLATFORM_DEF(powermac_platform); static int powermac_probe(platform_t plat) { - if (OF_finddevice("/memory") != -1 || OF_finddevice("/memory@0") != -1) - return (BUS_PROBE_GENERIC); + char compat[255]; + ssize_t compatlen; + char *curstr; + phandle_t root; + + root = OF_peer(0); + if (root == 0) + return (ENXIO); + + compatlen = OF_getprop(root, "compatible", compat, sizeof(compat)); + + for (curstr = compat; curstr < compat + compatlen; + curstr += strlen(curstr) + 1) { + if (strncmp(curstr, "MacRISC", 7) == 0) + return (BUS_PROBE_SPECIFIC); + } return (ENXIO); } |