autoconf.c revision 92843
166458Sdfr/*-
266458Sdfr * Copyright (c) 1998 Doug Rabson
366458Sdfr * All rights reserved.
466458Sdfr *
566458Sdfr * Redistribution and use in source and binary forms, with or without
666458Sdfr * modification, are permitted provided that the following conditions
766458Sdfr * are met:
866458Sdfr * 1. Redistributions of source code must retain the above copyright
966458Sdfr *    notice, this list of conditions and the following disclaimer.
1066458Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1166458Sdfr *    notice, this list of conditions and the following disclaimer in the
1266458Sdfr *    documentation and/or other materials provided with the distribution.
1366458Sdfr *
1466458Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1566458Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1666458Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1766458Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1866458Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1966458Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2066458Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2166458Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2266458Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2366458Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2466458Sdfr * SUCH DAMAGE.
2566458Sdfr *
2666458Sdfr * $FreeBSD: head/sys/ia64/ia64/autoconf.c 92843 2002-03-20 23:30:31Z alfred $
2766458Sdfr */
2866458Sdfr
2966458Sdfr#include "opt_bootp.h"
3071785Speter#include "opt_isa.h"
3166458Sdfr#include "opt_nfs.h"
3266458Sdfr#include "opt_nfsroot.h"
3366458Sdfr
3466458Sdfr#include <sys/param.h>
3566458Sdfr#include <sys/systm.h>
3666458Sdfr#include <sys/conf.h>
3766458Sdfr#include <sys/disklabel.h>
3866458Sdfr#include <sys/diskslice.h> /* for BASE_SLICE, MAX_SLICES */
3966458Sdfr#include <sys/reboot.h>
4066458Sdfr#include <sys/kernel.h>
4166458Sdfr#include <sys/mount.h>
4266458Sdfr#include <sys/sysctl.h>
4366458Sdfr#include <sys/bus.h>
4466458Sdfr#include <sys/devicestat.h>
4566458Sdfr#include <sys/cons.h>
4666458Sdfr
4766458Sdfr#include <machine/md_var.h>
4866458Sdfr#include <machine/bootinfo.h>
4966458Sdfr
5066458Sdfr#include <cam/cam.h>
5166458Sdfr#include <cam/cam_ccb.h>
5266458Sdfr#include <cam/cam_sim.h>
5366458Sdfr#include <cam/cam_periph.h>
5466458Sdfr#include <cam/cam_xpt_sim.h>
5566458Sdfr#include <cam/cam_debug.h>
5666458Sdfr
5792843Salfredstatic void	configure(void *);
5866458SdfrSYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL)
5966458Sdfr
6071785Speter#ifdef DEV_ISA
6166458Sdfr#include <isa/isavar.h>
6266458Sdfrdevice_t isa_bus_device = 0;
6366458Sdfr#endif
6466458Sdfr
6583651Speterextern int nfs_diskless_valid;		/* XXX use include file */
6666458Sdfr
6766458Sdfrdev_t	rootdev = NODEV;
6866458Sdfrdev_t	dumpdev = NODEV;
6966458Sdfr
7066458Sdfr/*
7166458Sdfr * Determine i/o configuration for a machine.
7266458Sdfr */
7366458Sdfrstatic void
7466458Sdfrconfigure(void *dummy)
7566458Sdfr{
7666458Sdfr	device_add_child(root_bus, "nexus", 0);
7766458Sdfr
7866458Sdfr	root_bus_configure();
7966458Sdfr
8066458Sdfr	/*
8166458Sdfr	 * Probe ISA devices after everything.
8266458Sdfr	 */
8371785Speter#ifdef DEV_ISA
8466458Sdfr	if (isa_bus_device)
8566458Sdfr		isa_probe_children(isa_bus_device);
8666458Sdfr#endif
8766458Sdfr
8866458Sdfr	/*
8966458Sdfr	 * Now we're ready to handle (pending) interrupts.
9066458Sdfr	 * XXX this is slightly misplaced.
9166458Sdfr	 */
9267032Sdfr	enable_intr();
9366458Sdfr
9466458Sdfr	cold = 0;
9566458Sdfr}
9666458Sdfr
9766458Sdfr/*
9866458Sdfr * Do legacy root filesystem discovery.  This isn't really
9966458Sdfr * needed on the Alpha, which has always used the loader.
10066458Sdfr */
10166458Sdfrvoid
10266458Sdfrcpu_rootconf()
10366458Sdfr{
10492676Speter#if defined(NFSCLIENT) && defined(NFS_ROOT)
10566458Sdfr	int	order = 0;
10692676Speter#endif
10792676Speter
10884557Sdfr#ifdef BOOTP
10984557Sdfr	if (!ia64_running_in_simulator())
11084557Sdfr		bootpc_init();
11184557Sdfr#endif
11283651Speter#if defined(NFSCLIENT) && defined(NFS_ROOT)
11366458Sdfr#if !defined(BOOTP_NFSROOT)
11466458Sdfr	if (nfs_diskless_valid)
11566458Sdfr#endif
11666458Sdfr		rootdevnames[order++] = "nfs:";
11766458Sdfr#endif
11866458Sdfr}
11966458SdfrSYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL)
120