Date: Tue, 15 Jun 2004 12:04:29 GMT From: Juli Mallett <jmallett@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 55012 for review Message-ID: <200406151204.i5FC4Tvk040864@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=55012 Change 55012 by jmallett@jmallett_oingo on 2004/06/15 12:04:10 Attach cpu as a device, attach mainbus off that, make mainbus a property of the platform, kill platform_configure() in favor of something that goes through newbus. This is in preparation of being able to hang the main interrupt stuff and clock off the cpu. Affected files ... .. //depot/projects/mips/sys/conf/files.mips#37 edit .. //depot/projects/mips/sys/mips/include/hwfunc.h#5 edit .. //depot/projects/mips/sys/mips/mips/autoconf.c#5 edit .. //depot/projects/mips/sys/mips/mips/cpu.c#3 edit .. //depot/projects/mips/sys/mips/mips/machdep.c#45 edit .. //depot/projects/mips/sys/mips/sgimips/imc/imc.c#9 edit .. //depot/projects/mips/sys/mips/sgimips/machdep_sgimips.c#35 edit .. //depot/projects/mips/sys/mips/sgimips/mainbus.c#1 add Differences ... ==== //depot/projects/mips/sys/conf/files.mips#37 (text+ko) ==== @@ -47,6 +47,7 @@ geom/geom_fx.c optional sgimips mips/sgimips/clock.c optional sgimips mips/sgimips/machdep_sgimips.c optional sgimips +mips/sgimips/mainbus.c optional sgimips mips/sbmips/clock.c optional sbmips mips/sbmips/machdep_sbmips.c optional sbmips ==== //depot/projects/mips/sys/mips/include/hwfunc.h#5 (text+ko) ==== @@ -34,7 +34,6 @@ * Hooks downward into hardware functionality. */ -void platform_configure(void); void platform_halt(void); void platform_intr(struct trapframe *); void platform_reset(void); ==== //depot/projects/mips/sys/mips/mips/autoconf.c#5 (text+ko) ==== @@ -38,7 +38,13 @@ static void configure(void *arg) { - platform_configure(); + device_t cpu; + + cpu = device_add_child(root_bus, "cpu", 0); /* XXX mp_ncpus */ + if (cpu == NULL) + panic("cpu didn't attach"); + device_add_child(cpu, "mainbus", 0); + root_bus_configure(); /* Enable interrupts. */ ==== //depot/projects/mips/sys/mips/mips/cpu.c#3 (text+ko) ==== @@ -184,3 +184,43 @@ printf("\n"); printf("XXX should print cache identification here\n"); } + +static devclass_t cpu_devclass; + +/* + * Device methods + */ +static int cpu_probe(device_t); + +static device_method_t cpu_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, cpu_probe), + DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_detach, bus_generic_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + /* XXXJM TODO DONGS ETC. Allocate hard/soft intrs off this. */ + /* Bus interface */ + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t cpu_driver = { + "cpu", cpu_methods, 1 +}; + +static int +cpu_probe(device_t dev) +{ + struct wtf wtf; + + if (device_get_unit(dev) != 0) + panic("can't attach more cpus"); + + mips_wtf(&wtf); + device_set_desc(dev, wtf.wtf_type); + return (0); +} +DRIVER_MODULE(cpu, root, cpu_driver, cpu_devclass, 0, 0); ==== //depot/projects/mips/sys/mips/mips/machdep.c#45 (text+ko) ==== ==== //depot/projects/mips/sys/mips/sgimips/imc/imc.c#9 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/mips/sys/mips/sgimips/imc/imc.c#8 $ + * $P4: //depot/projects/mips/sys/mips/sgimips/imc/imc.c#9 $ */ #include <sys/cdefs.h> @@ -205,4 +205,4 @@ IMC_WRITE_4(port, IMC_GIO_ERRSTAT, 0); } -DRIVER_MODULE(imc, root, imc_driver, imc_devclass, 0, 0); +DRIVER_MODULE(imc, mainbus, imc_driver, imc_devclass, 0, 0); ==== //depot/projects/mips/sys/mips/sgimips/machdep_sgimips.c#35 (text+ko) ==== @@ -247,20 +247,6 @@ KASSERT(i == 0, ("all interrupts handled")); } -void -platform_configure(void) -{ - switch (mach_type) { - case MACH_SGI_IP22: - device_add_child(root_bus, "imc", 0); - device_add_child(root_bus, "arcs_disk", 0); - break; - default: - panic("cannot autoconfigure type %d", mach_type); - break; - } -} - /* * XXX Maybe return the state of the watchdog in enter, and pass it to * exit? Like spl().
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406151204.i5FC4Tvk040864>