2 * Copyright (c) 1998 Doug Rabson
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include "opt_bootp.h"
31 #include "opt_cd9660.h"
33 #include "opt_nfsroot.h"
35 #include <sys/param.h>
36 #include <sys/systm.h>
38 #include <sys/disklabel.h>
39 #include <sys/diskslice.h> /* for BASE_SLICE, MAX_SLICES */
40 #include <sys/reboot.h>
41 #include <sys/kernel.h>
42 #include <sys/mount.h>
43 #include <sys/sysctl.h>
45 #include <sys/devicestat.h>
48 #include <machine/ipl.h>
49 #include <machine/md_var.h>
50 #include <machine/cpuconf.h>
51 #include <machine/rpb.h>
52 #include <machine/bootinfo.h>
55 #include <cam/cam_ccb.h>
56 #include <cam/cam_sim.h>
57 #include <cam/cam_periph.h>
58 #include <cam/cam_xpt_sim.h>
59 #include <cam/cam_debug.h>
61 static void configure __P((void *));
62 SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL)
64 static void configure_finish __P((void));
65 static void configure_start __P((void));
69 #include <isa/isavar.h>
70 device_t isa_bus_device = 0;
73 extern int nfs_diskless_valid;
75 dev_t rootdev = NODEV;
76 dev_t dumpdev = NODEV;
94 while (*s >= '0' && *s <= '9')
95 n = n * 10 + (*s++ - '0');
100 bootdev_field(int which)
102 char *p = bootinfo.booted_dev;
104 static char field[128];
106 /* Skip characters to find the right field */
107 for (; which; which--) {
108 while (*p != ' ' && *p != '\0')
114 /* Copy out the field and return it */
116 while (*p != ' ' && *p != '\0')
124 bootdev_protocol(void)
126 return bootdev_field(0);
132 return atoi(bootdev_field(2));
138 return atoi(bootdev_field(5));
144 return atoi(bootdev_field(1));
148 bootdev_channel(void)
150 return atoi(bootdev_field(3));
154 bootdev_remote_address(void)
156 return bootdev_field(4);
160 bootdev_boot_dev_type(void)
162 return atoi(bootdev_field(6));
166 bootdev_ctrl_dev_type(void)
168 return bootdev_field(7);
174 * Determine i/o configuration for a machine.
177 configure(void *dummy)
181 device_add_child(root_bus, platform.iobus, 0);
183 root_bus_configure();
185 if((hwrpb->rpb_type != ST_DEC_3000_300) &&
186 (hwrpb->rpb_type != ST_DEC_3000_500)){
188 * Probe ISA devices after everything.
192 isa_probe_children(isa_bus_device);
200 * Now we're ready to handle (pending) interrupts.
201 * XXX this is slightly misplaced.
209 * Do legacy root filesystem discovery. This isn't really
210 * needed on the Alpha, which has always used the loader.
216 #if defined(NFS) && defined(NFS_ROOT)
217 #if !defined(BOOTP_NFSROOT)
218 if (nfs_diskless_valid)
220 rootdevnames[order++] = "nfs:";
223 #if defined(FFS) && defined(FFS_ROOT)
224 rootdevnames[order++] = "ufs:da0a";
227 SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL)