autoconf.c revision 93794
113240Sprr/*-
213240Sprr * Copyright (c) 1998 Doug Rabson
313240Sprr * All rights reserved.
413240Sprr *
513240Sprr * Redistribution and use in source and binary forms, with or without
613240Sprr * modification, are permitted provided that the following conditions
713240Sprr * are met:
813240Sprr * 1. Redistributions of source code must retain the above copyright
913240Sprr *    notice, this list of conditions and the following disclaimer.
1013240Sprr * 2. Redistributions in binary form must reproduce the above copyright
1113240Sprr *    notice, this list of conditions and the following disclaimer in the
1213240Sprr *    documentation and/or other materials provided with the distribution.
1313240Sprr *
1413240Sprr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1513240Sprr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1613240Sprr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1713240Sprr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1813240Sprr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1913240Sprr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2013240Sprr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2113240Sprr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2213240Sprr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2313240Sprr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2413240Sprr * SUCH DAMAGE.
2513240Sprr *
2613240Sprr * $FreeBSD: head/sys/ia64/ia64/autoconf.c 93794 2002-04-04 17:58:21Z brian $
2713240Sprr */
2813240Sprr
2913240Sprr#include "opt_bootp.h"
3013240Sprr#include "opt_isa.h"
3113240Sprr#include "opt_nfs.h"
3213240Sprr#include "opt_nfsroot.h"
3313240Sprr
3413240Sprr#include <sys/param.h>
3513240Sprr#include <sys/systm.h>
3613240Sprr#include <sys/conf.h>
3713240Sprr#include <sys/disklabel.h>
3813240Sprr#include <sys/diskslice.h> /* for BASE_SLICE, MAX_SLICES */
3913240Sprr#include <sys/reboot.h>
4013240Sprr#include <sys/kernel.h>
4113240Sprr#include <sys/mount.h>
4213240Sprr#include <sys/sysctl.h>
4313240Sprr#include <sys/bus.h>
4413240Sprr#include <sys/devicestat.h>
4513240Sprr#include <sys/cons.h>
4613240Sprr
4713240Sprr#include <machine/md_var.h>
4813240Sprr#include <machine/bootinfo.h>
4913240Sprr
5016538Sprr#include <cam/cam.h>
5116538Sprr#include <cam/cam_ccb.h>
5216538Sprr#include <cam/cam_sim.h>
5313240Sprr#include <cam/cam_periph.h>
5413240Sprr#include <cam/cam_xpt_sim.h>
5513240Sprr#include <cam/cam_debug.h>
5613240Sprr
5716538Sprrstatic void	configure(void *);
5816538SprrSYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL)
5916538Sprr
6016538Sprr#ifdef DEV_ISA
6113240Sprr#include <isa/isavar.h>
6213240Sprrdevice_t isa_bus_device = 0;
6313240Sprr#endif
6413240Sprr
6513240Sprrextern int nfs_diskless_valid;		/* XXX use include file */
6613240Sprr
6713240Sprr/*
68 * Determine i/o configuration for a machine.
69 */
70static void
71configure(void *dummy)
72{
73	device_add_child(root_bus, "nexus", 0);
74
75	root_bus_configure();
76
77	/*
78	 * Probe ISA devices after everything.
79	 */
80#ifdef DEV_ISA
81	if (isa_bus_device)
82		isa_probe_children(isa_bus_device);
83#endif
84
85	/*
86	 * Now we're ready to handle (pending) interrupts.
87	 * XXX this is slightly misplaced.
88	 */
89	enable_intr();
90
91	cold = 0;
92}
93
94/*
95 * Do legacy root filesystem discovery.  This isn't really
96 * needed on the Alpha, which has always used the loader.
97 */
98void
99cpu_rootconf()
100{
101#if defined(NFSCLIENT) && defined(NFS_ROOT)
102	int	order = 0;
103#endif
104
105#ifdef BOOTP
106	if (!ia64_running_in_simulator())
107		bootpc_init();
108#endif
109#if defined(NFSCLIENT) && defined(NFS_ROOT)
110#if !defined(BOOTP_NFSROOT)
111	if (nfs_diskless_valid)
112#endif
113		rootdevnames[order++] = "nfs:";
114#endif
115}
116SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL)
117