From owner-p4-projects@FreeBSD.ORG Tue Jun 15 12:04:38 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 496E416A4D0; Tue, 15 Jun 2004 12:04:38 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 05B9916A4CE for ; Tue, 15 Jun 2004 12:04:38 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E1BFE43D41 for ; Tue, 15 Jun 2004 12:04:37 +0000 (GMT) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i5FC4Tp9040867 for ; Tue, 15 Jun 2004 12:04:29 GMT (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5FC4Tvk040864 for perforce@freebsd.org; Tue, 15 Jun 2004 12:04:29 GMT (envelope-from jmallett@freebsd.org) Date: Tue, 15 Jun 2004 12:04:29 GMT Message-Id: <200406151204.i5FC4Tvk040864@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 55012 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2004 12:04:38 -0000 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 @@ -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().