[BACK]Return to autoconf.c CVS log [TXT][DIR] Up to [local] / sys / arch / ipaq / ipaq

Annotation of sys/arch/ipaq/ipaq/autoconf.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: autoconf.c,v 1.12 2007/06/01 19:25:10 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/timeout.h>
                     52: #include <sys/malloc.h>
                     53:
                     54: #include <uvm/uvm_extern.h>
                     55:
                     56: #include <machine/bootconfig.h>
                     57: #include <machine/intr.h>
                     58: #include <dev/cons.h>
                     59:
                     60: int booted_partition;
                     61: struct device *bootdv = NULL;
                     62: extern char *boot_file;
                     63:
                     64: void dumpconf(void);
                     65:
                     66: /*
                     67:  * Now that we are fully operational, we can checksum the
                     68:  * disks, and using some heuristics, hopefully are able to
                     69:  * always determine the correct root disk.
                     70:  */
                     71: void
                     72: diskconf()
                     73: {
                     74:        extern struct timeout   scoop_checkdisk;
                     75:        dev_t tmpdev;
                     76:
                     77: #if 0
                     78:        /*
                     79:         * Configure root, swap, and dump area.  This is
                     80:         * currently done by running the same checksum
                     81:         * algorithm over all known disks, as was done in
                     82:         * /boot.  Then we basically fixup the *dev vars
                     83:         * from the info we gleaned from this.
                     84:         */
                     85:        dkcsumattach();
                     86: #endif
                     87:
                     88:        /*
                     89:         * XXX
                     90:         * zaurus bootblocks currently pass in "bsd" instead of
                     91:         * "device:bsd", or any such thing, making this a real pain.
                     92:         */
                     93:        if (bootdv == NULL)
                     94:                bootdv = parsedisk("wd0a", strlen("wd0a"), 0, &tmpdev);
                     95:        if (bootdv == NULL)
                     96:                printf("boot device: lookup '%s' failed.\n", boot_file);
                     97:        else
                     98:                printf("boot device: %s\n", bootdv->dv_xname);
                     99:
                    100:        setroot(bootdv, 0, RB_USERREQ);
                    101:        dumpconf();
                    102:
                    103:        timeout_add(&scoop_checkdisk, hz/25);
                    104: }
                    105:
                    106: void
                    107: device_register(struct device *dev, void *aux)
                    108: {
                    109: }
                    110:
                    111: /*
                    112:  * void cpu_configure()
                    113:  *
                    114:  * Configure all the root devices
                    115:  * The root devices are expected to configure their own children
                    116:  */
                    117: void
                    118: cpu_configure(void)
                    119: {
                    120:        softintr_init();
                    121:
                    122:        /*
                    123:         * Since various PCI interrupts could be routed via the ICU
                    124:         * (for PCI devices in the bridge) we need to set up the ICU
                    125:         * now so that these interrupts can be established correctly
                    126:         * i.e. This is a hack.
                    127:         */
                    128:
                    129:        config_rootfound("mainbus", NULL);
                    130:
                    131:        /*
                    132:         * We can not know which is our root disk, defer
                    133:         * until we can checksum blocks to figure it out.
                    134:         */
                    135:        cold = 0;
                    136:
                    137:        /* Time to start taking interrupts so lets open the flood gates .... */
                    138:        (void)spl0();
                    139:
                    140: }
                    141:
                    142: struct nam2blk nam2blk[] = {
                    143:        { "wd",         16 },
                    144:        { "sd",         24 },
                    145:        { "cd",         26 },
                    146:        { "rd",         18 },
                    147:        { "raid",       71 },
                    148:        { NULL,         -1 }
                    149: };

CVSweb