178342Sbenno/*-
278342Sbenno * Copyright (c) 1998 Doug Rabson
378342Sbenno * All rights reserved.
478342Sbenno *
578342Sbenno * Redistribution and use in source and binary forms, with or without
678342Sbenno * modification, are permitted provided that the following conditions
778342Sbenno * are met:
878342Sbenno * 1. Redistributions of source code must retain the above copyright
978342Sbenno *    notice, this list of conditions and the following disclaimer.
1078342Sbenno * 2. Redistributions in binary form must reproduce the above copyright
1178342Sbenno *    notice, this list of conditions and the following disclaimer in the
1278342Sbenno *    documentation and/or other materials provided with the distribution.
1378342Sbenno *
1478342Sbenno * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1578342Sbenno * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1678342Sbenno * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1778342Sbenno * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1878342Sbenno * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1978342Sbenno * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2078342Sbenno * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2178342Sbenno * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2278342Sbenno * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2378342Sbenno * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2478342Sbenno * SUCH DAMAGE.
2578342Sbenno */
2678342Sbenno
27191450Smarcel#include "opt_isa.h"
28191450Smarcel
29113038Sobrien#include <sys/cdefs.h>
30113038Sobrien__FBSDID("$FreeBSD$");
3178342Sbenno
3278342Sbenno#include <sys/param.h>
3378342Sbenno#include <sys/systm.h>
3478342Sbenno#include <sys/bus.h>
3578342Sbenno#include <sys/cons.h>
36103597Sgrehan#include <sys/kernel.h>
3778342Sbenno
38171805Smarcel#include <machine/intr_machdep.h>
39171805Smarcel
40191450Smarcel#ifdef DEV_ISA
41191450Smarcelextern void isa_probe_children(device_t dev);
42191450Smarcel
43191450Smarceldevice_t isa_bus_device;
44191450Smarcel#endif
45191450Smarcel
46108940Sgrehanstatic device_t nexusdev;
47108940Sgrehan
48143784Sgrehanstatic void	configure_first(void *);
4992842Salfredstatic void	configure(void *);
50143784Sgrehanstatic void	configure_final(void *);
5178342Sbenno
52143784SgrehanSYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL);
53143784Sgrehan/* SI_ORDER_SECOND is hookable */
54143784SgrehanSYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL);
55143784Sgrehan/* SI_ORDER_MIDDLE is hookable */
56143784SgrehanSYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL);
57143784Sgrehan
5878342Sbenno/*
5978342Sbenno * Determine i/o configuration for a machine.
6078342Sbenno */
6178342Sbennostatic void
62143784Sgrehanconfigure_first(void *dummy)
63143784Sgrehan{
64146794Smarcel
65146794Smarcel	nexusdev = device_add_child(root_bus, "nexus", 0);
66143784Sgrehan}
67143784Sgrehan
68143784Sgrehanstatic void
6978342Sbennoconfigure(void *dummy)
7078342Sbenno{
71143784Sgrehan
7284855Smp	root_bus_configure();
73191450Smarcel#ifdef DEV_ISA
74191450Smarcel	if (isa_bus_device)
75191450Smarcel		isa_probe_children(isa_bus_device);
76191450Smarcel#endif
77143784Sgrehan}
7884855Smp
79143784Sgrehanstatic void
80143784Sgrehanconfigure_final(void *dummy)
81143784Sgrehan{
82171805Smarcel
83103597Sgrehan	/*
84171805Smarcel	 * Now that we're guaranteed to have a PIC driver (or we'll never
85171805Smarcel	 * have one), program it with all the previously setup interrupts.
86103597Sgrehan	 */
87171805Smarcel	powerpc_enable_intr();
88171805Smarcel
89171805Smarcel	/* Enable external interrupts. */
90176771Sraj	mtmsr(mfmsr() | PSL_EE);
91183030Smarcel
92146792Smarcel	cninit_finish();
93103597Sgrehan	cold = 0;
9478342Sbenno}
95