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