autoconf.c revision 146794
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 146794 2005-05-29 23:44:22Z marcel $
2766458Sdfr */
2866458Sdfr
29131840Sbrian#include "opt_bootp.h"
3071785Speter#include "opt_isa.h"
3166458Sdfr
3266458Sdfr#include <sys/param.h>
3366458Sdfr#include <sys/systm.h>
3466458Sdfr#include <sys/conf.h>
3566458Sdfr#include <sys/reboot.h>
3666458Sdfr#include <sys/kernel.h>
3766458Sdfr#include <sys/mount.h>
3866458Sdfr#include <sys/sysctl.h>
3966458Sdfr#include <sys/bus.h>
4066458Sdfr#include <sys/cons.h>
4166458Sdfr
4266458Sdfr#include <machine/md_var.h>
4366458Sdfr#include <machine/bootinfo.h>
4466458Sdfr
4566458Sdfr#include <cam/cam.h>
4666458Sdfr#include <cam/cam_ccb.h>
4766458Sdfr#include <cam/cam_sim.h>
4866458Sdfr#include <cam/cam_periph.h>
4966458Sdfr#include <cam/cam_xpt_sim.h>
5066458Sdfr#include <cam/cam_debug.h>
5166458Sdfr
52143796Siedowsestatic void	configure_first(void *);
5392843Salfredstatic void	configure(void *);
54143796Siedowsestatic void	configure_final(void *);
5566458Sdfr
56143796SiedowseSYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL);
57143796Siedowse/* SI_ORDER_SECOND is hookable */
58143796SiedowseSYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL);
59143796Siedowse/* SI_ORDER_MIDDLE is hookable */
60143796SiedowseSYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL);
61143796Siedowse
62131840Sbrian#ifdef BOOTP
6393997Smarcelvoid bootpc_init(void);
64131840Sbrian#endif
6593997Smarcel
6671785Speter#ifdef DEV_ISA
6766458Sdfr#include <isa/isavar.h>
6866458Sdfrdevice_t isa_bus_device = 0;
6966458Sdfr#endif
7066458Sdfr
7166458Sdfr/*
7266458Sdfr * Determine i/o configuration for a machine.
7366458Sdfr */
7466458Sdfrstatic void
75143796Siedowseconfigure_first(void *dummy)
76143796Siedowse{
77146794Smarcel
78146794Smarcel	device_add_child(root_bus, "nexus", 0);
79143796Siedowse}
80143796Siedowse
81143796Siedowsestatic void
8266458Sdfrconfigure(void *dummy)
8366458Sdfr{
84146791Smarcel
8566458Sdfr	root_bus_configure();
8666458Sdfr
8766458Sdfr	/*
8866458Sdfr	 * Probe ISA devices after everything.
8966458Sdfr	 */
9071785Speter#ifdef DEV_ISA
9166458Sdfr	if (isa_bus_device)
9266458Sdfr		isa_probe_children(isa_bus_device);
9366458Sdfr#endif
94143796Siedowse}
9566458Sdfr
96143796Siedowsestatic void
97143796Siedowseconfigure_final(void *dummy)
98143796Siedowse{
99143796Siedowse
10066458Sdfr	/*
10166458Sdfr	 * Now we're ready to handle (pending) interrupts.
10266458Sdfr	 * XXX this is slightly misplaced.
10366458Sdfr	 */
10467032Sdfr	enable_intr();
10566458Sdfr
106146791Smarcel	cninit_finish();
10766458Sdfr	cold = 0;
10866458Sdfr}
109