Home | History | Annotate | Line # | Download | only in wii
autoconf.c revision 1.1
      1  1.1  jmcneill /*	$NetBSD: autoconf.c,v 1.1 2024/01/20 21:36:00 jmcneill Exp $	*/
      2  1.1  jmcneill 
      3  1.1  jmcneill /*-
      4  1.1  jmcneill  * Copyright (c) 1990 The Regents of the University of California.
      5  1.1  jmcneill  * All rights reserved.
      6  1.1  jmcneill  *
      7  1.1  jmcneill  * This code is derived from software contributed to Berkeley by
      8  1.1  jmcneill  * William Jolitz.
      9  1.1  jmcneill  *
     10  1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
     11  1.1  jmcneill  * modification, are permitted provided that the following conditions
     12  1.1  jmcneill  * are met:
     13  1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     14  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     15  1.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     18  1.1  jmcneill  * 3. Neither the name of the University nor the names of its contributors
     19  1.1  jmcneill  *    may be used to endorse or promote products derived from this software
     20  1.1  jmcneill  *    without specific prior written permission.
     21  1.1  jmcneill  *
     22  1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  1.1  jmcneill  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  1.1  jmcneill  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  1.1  jmcneill  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  1.1  jmcneill  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  1.1  jmcneill  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  1.1  jmcneill  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1  jmcneill  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1  jmcneill  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1  jmcneill  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1  jmcneill  * SUCH DAMAGE.
     33  1.1  jmcneill  *
     34  1.1  jmcneill  *	@(#)autoconf.c	7.1 (Berkeley) 5/9/91
     35  1.1  jmcneill  */
     36  1.1  jmcneill 
     37  1.1  jmcneill /*
     38  1.1  jmcneill  * Setup the system to run on the current machine.
     39  1.1  jmcneill  *
     40  1.1  jmcneill  * Configure() is called at boot time and initializes the vba
     41  1.1  jmcneill  * device tables and the memory controller monitoring.  Available
     42  1.1  jmcneill  * devices are determined (from possibilities mentioned in ioconf.c),
     43  1.1  jmcneill  * and the drivers are initialized.
     44  1.1  jmcneill  */
     45  1.1  jmcneill 
     46  1.1  jmcneill #include <sys/cdefs.h>
     47  1.1  jmcneill __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2024/01/20 21:36:00 jmcneill Exp $");
     48  1.1  jmcneill 
     49  1.1  jmcneill #include <sys/param.h>
     50  1.1  jmcneill #include <sys/systm.h>
     51  1.1  jmcneill #include <sys/buf.h>
     52  1.1  jmcneill #include <sys/disklabel.h>
     53  1.1  jmcneill #include <sys/conf.h>
     54  1.1  jmcneill #include <sys/reboot.h>
     55  1.1  jmcneill #include <sys/device.h>
     56  1.1  jmcneill 
     57  1.1  jmcneill #include <powerpc/pte.h>
     58  1.1  jmcneill 
     59  1.1  jmcneill void findroot(void);
     60  1.1  jmcneill void disable_intr(void);
     61  1.1  jmcneill void enable_intr(void);
     62  1.1  jmcneill 
     63  1.1  jmcneill /*
     64  1.1  jmcneill  * Determine i/o configuration for a machine.
     65  1.1  jmcneill  */
     66  1.1  jmcneill void
     67  1.1  jmcneill cpu_configure(void)
     68  1.1  jmcneill {
     69  1.1  jmcneill 
     70  1.1  jmcneill 	if (config_rootfound("mainbus", NULL) == NULL)
     71  1.1  jmcneill 		panic("configure: mainbus not configured");
     72  1.1  jmcneill 
     73  1.1  jmcneill 	genppc_cpu_configure();
     74  1.1  jmcneill }
     75  1.1  jmcneill 
     76  1.1  jmcneill void
     77  1.1  jmcneill cpu_rootconf(void)
     78  1.1  jmcneill {
     79  1.1  jmcneill 	findroot();
     80  1.1  jmcneill 
     81  1.1  jmcneill 	printf("boot device: %s\n",
     82  1.1  jmcneill 	    booted_device ? device_xname(booted_device) : "<unknown>");
     83  1.1  jmcneill 
     84  1.1  jmcneill 	rootconf();
     85  1.1  jmcneill }
     86  1.1  jmcneill 
     87  1.1  jmcneill void
     88  1.1  jmcneill findroot(void)
     89  1.1  jmcneill {
     90  1.1  jmcneill 	device_t dev;
     91  1.1  jmcneill 
     92  1.1  jmcneill 	if (booted_device != NULL) {
     93  1.1  jmcneill 		return;
     94  1.1  jmcneill 	}
     95  1.1  jmcneill 
     96  1.1  jmcneill 	if ((dev = device_find_by_driver_unit("ld", 0)) != NULL) {
     97  1.1  jmcneill 		booted_device = dev;
     98  1.1  jmcneill 		booted_partition = 0;
     99  1.1  jmcneill 		return;
    100  1.1  jmcneill 	}
    101  1.1  jmcneill }
    102  1.1  jmcneill 
    103  1.1  jmcneill void
    104  1.1  jmcneill device_register(device_t dev, void *aux)
    105  1.1  jmcneill {
    106  1.1  jmcneill 	/* do nothing */
    107  1.1  jmcneill }
    108