Annotation of sys/arch/jornada/jornada/autoconf.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: autoconf.c,v 1.9 2007/06/01 19:25:09 deraadt Exp $ */
! 2: /* $NetBSD: autoconf.c,v 1.2 2001/09/05 16:17:36 matt Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1994-1998 Mark Brinicombe.
! 6: * Copyright (c) 1994 Brini.
! 7: * All rights reserved.
! 8: *
! 9: * Redistribution and use in source and binary forms, with or without
! 10: * modification, are permitted provided that the following conditions
! 11: * are met:
! 12: * 1. Redistributions of source code must retain the above copyright
! 13: * notice, this list of conditions and the following disclaimer.
! 14: * 2. Redistributions in binary form must reproduce the above copyright
! 15: * notice, this list of conditions and the following disclaimer in the
! 16: * documentation and/or other materials provided with the distribution.
! 17: * 3. All advertising materials mentioning features or use of this software
! 18: * must display the following acknowledgement:
! 19: * This product includes software developed by Mark Brinicombe for
! 20: * the NetBSD project.
! 21: * 4. The name of the company nor the name of the author may be used to
! 22: * endorse or promote products derived from this software without specific
! 23: * prior written permission.
! 24: *
! 25: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
! 26: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
! 27: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 28: * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
! 29: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
! 30: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
! 31: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 32: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 33: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 34: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 35: * SUCH DAMAGE.
! 36: *
! 37: * RiscBSD kernel project
! 38: *
! 39: * autoconf.c
! 40: *
! 41: * Autoconfiguration functions
! 42: */
! 43:
! 44: #include <sys/param.h>
! 45: #include <sys/systm.h>
! 46: #include <sys/reboot.h>
! 47: #include <sys/disklabel.h>
! 48: #include <sys/device.h>
! 49: #include <sys/conf.h>
! 50: #include <sys/kernel.h>
! 51: #include <sys/malloc.h>
! 52:
! 53: #include <uvm/uvm_extern.h>
! 54:
! 55: #include <machine/bootconfig.h>
! 56: #include <machine/intr.h>
! 57: #include <dev/cons.h>
! 58:
! 59: struct device *booted_device;
! 60: int booted_partition;
! 61: struct device *bootdv = NULL;
! 62: extern char *boot_file;
! 63:
! 64: void dumpconf(void);
! 65:
! 66: void
! 67: device_register(struct device *dev, void *aux)
! 68: {
! 69: }
! 70:
! 71: /*
! 72: * void cpu_configure()
! 73: *
! 74: * Configure all the root devices
! 75: * The root devices are expected to configure their own children
! 76: */
! 77: void
! 78: cpu_configure(void)
! 79: {
! 80: softintr_init();
! 81:
! 82: /*
! 83: * Since various PCI interrupts could be routed via the ICU
! 84: * (for PCI devices in the bridge) we need to set up the ICU
! 85: * now so that these interrupts can be established correctly
! 86: * i.e. This is a hack.
! 87: */
! 88:
! 89: config_rootfound("mainbus", NULL);
! 90:
! 91: /*
! 92: * We can not know which is our root disk, defer
! 93: * until we can checksum blocks to figure it out.
! 94: */
! 95: cold = 0;
! 96:
! 97: /* Time to start taking interrupts so lets open the flood gates .... */
! 98: (void)spl0();
! 99:
! 100: }
! 101:
! 102: /*
! 103: * Now that we are fully operational, we can checksum the
! 104: * disks, and using some heuristics, hopefully are able to
! 105: * always determine the correct root disk.
! 106: */
! 107: void
! 108: diskconf(void)
! 109: {
! 110: dev_t tmpdev;
! 111:
! 112: #if 0
! 113: /*
! 114: * Configure root, swap, and dump area. This is
! 115: * currently done by running the same checksum
! 116: * algorithm over all known disks, as was done in
! 117: * /boot. Then we basically fixup the *dev vars
! 118: * from the info we gleaned from this.
! 119: */
! 120: dkcsumattach();
! 121: #endif
! 122:
! 123: /* Lookup boot device from boot if not set by configuration */
! 124: if (bootdv == NULL) {
! 125: int len;
! 126: char *p;
! 127:
! 128: /* boot_file is of the form wd0a:/bsd, we want 'wd0a' */
! 129: if ((p = strchr(boot_file, ':')) != NULL)
! 130: len = p - boot_file;
! 131: else
! 132: len = strlen(boot_file);
! 133:
! 134: bootdv = parsedisk(boot_file, len, 0, &tmpdev);
! 135: }
! 136: if (bootdv == NULL)
! 137: printf("boot device: lookup '%s' failed.\n", boot_file);
! 138: else
! 139: printf("boot device: %s\n", bootdv->dv_xname);
! 140: setroot(bootdv, 0, RB_USERREQ);
! 141: dumpconf();
! 142: }
! 143:
! 144: struct nam2blk nam2blk[] = {
! 145: { "wd", 16 },
! 146: { "sd", 24 },
! 147: { "cd", 26 },
! 148: { "rd", 18 },
! 149: { "raid", 71 },
! 150: { NULL, -1 }
! 151: };
CVSweb