Module Name: src Committed By: jdc Date: Sun Mar 24 17:50:26 UTC 2013
Modified Files: src/sys/arch/sparc/dev: obio.c Log Message: Check if sbus is defined in the kernel configuration before using it. >From Taylor R Campbell. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sparc/dev/obio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc/dev/obio.c diff -u src/sys/arch/sparc/dev/obio.c:1.73 src/sys/arch/sparc/dev/obio.c:1.74 --- src/sys/arch/sparc/dev/obio.c:1.73 Sat Oct 27 17:18:11 2012 +++ src/sys/arch/sparc/dev/obio.c Sun Mar 24 17:50:26 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: obio.c,v 1.73 2012/10/27 17:18:11 chs Exp $ */ +/* $NetBSD: obio.c,v 1.74 2013/03/24 17:50:26 jdc Exp $ */ /*- * Copyright (c) 1997,1998 The NetBSD Foundation, Inc. @@ -30,10 +30,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.73 2012/10/27 17:18:11 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.74 2013/03/24 17:50:26 jdc Exp $"); #include "locators.h" +#ifdef _KERNEL_OPT +#include "sbus.h" +#endif + #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> @@ -47,7 +51,9 @@ __KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.7 #include <uvm/uvm_extern.h> #include <sys/bus.h> +#if NSBUS > 0 #include <sparc/dev/sbusvar.h> +#endif #include <machine/autoconf.h> #include <machine/oldmon.h> #include <machine/cpu.h> @@ -64,7 +70,9 @@ struct obio4_softc { union obio_softc { struct obio4_softc sc_obio; /* sun4 obio */ +#if NSBUS > 0 struct sbus_softc sc_sbus; /* sun4m obio is another sbus slot */ +#endif }; @@ -97,6 +105,7 @@ static int _obio_bus_map(bus_space_tag_t static struct sparc_bus_space_tag obio_space_tag; #endif +#if NSBUS > 0 /* * Translate obio `interrupts' property value to processor IPL (see sbus.c) * Apparently, the `interrupts' property on obio devices is just @@ -105,6 +114,7 @@ static struct sparc_bus_space_tag obio_s static int intr_obio2ipl[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; +#endif static int obiomatch(device_t parent, struct cfdata *cf, void *aux) @@ -163,6 +173,7 @@ obioattach(device_t parent, device_t sel #endif return; } else if (CPU_ISSUN4M) { +#if NSBUS > 0 /* * Attach the on-board I/O bus at on a sun4m. * In this case we treat the obio bus as another sbus slot. @@ -189,6 +200,7 @@ obioattach(device_t parent, device_t sel sc->sc_intr2ipl = intr_obio2ipl; sbus_attach_common(sc, "obio", ma->ma_node, special4m); +#endif } else { printf("obio on this machine?\n"); }