180708Sjake/*-
280708Sjake * Copyright (c) 2001 Jake Burkholder.
380708Sjake * All rights reserved.
480708Sjake *
580708Sjake * Redistribution and use in source and binary forms, with or without
680708Sjake * modification, are permitted provided that the following conditions
780708Sjake * are met:
880708Sjake * 1. Redistributions of source code must retain the above copyright
980708Sjake *    notice, this list of conditions and the following disclaimer.
1080708Sjake * 2. Redistributions in binary form must reproduce the above copyright
1180708Sjake *    notice, this list of conditions and the following disclaimer in the
1280708Sjake *    documentation and/or other materials provided with the distribution.
1380708Sjake *
1481337Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1580708Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1680708Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1781337Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1880708Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1980708Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2080708Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2180708Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2280708Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2380708Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2480708Sjake * SUCH DAMAGE.
2580708Sjake */
2680708Sjake
27180664Smarius#include <sys/cdefs.h>
28180664Smarius__FBSDID("$FreeBSD: releng/10.3/sys/sparc64/sparc64/autoconf.c 221869 2011-05-14 01:53:38Z attilio $");
29180664Smarius
3086227Stmm#include "opt_isa.h"
3186227Stmm
3280708Sjake#include <sys/param.h>
3380709Sjake#include <sys/systm.h>
3480709Sjake#include <sys/bus.h>
3580709Sjake#include <sys/cons.h>
3680709Sjake#include <sys/kernel.h>
3780708Sjake
3886227Stmm#ifdef DEV_ISA
3986227Stmm#include <isa/isavar.h>
4086227Stmmextern device_t isa_bus_device;
4186227Stmm#endif
4286227Stmm
4388368Stmmstatic device_t nexusdev;
4480709Sjake
45143765Siedowsestatic void	configure_first(void *);
46143765Siedowsestatic void	configure(void *);
47143765Siedowsestatic void	configure_final(void *);
4880709Sjake
49143765SiedowseSYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL);
50143765Siedowse/* SI_ORDER_SECOND is hookable */
51143765SiedowseSYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL);
52143765Siedowse/* SI_ORDER_MIDDLE is hookable */
53143765SiedowseSYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL);
5480709Sjake
55143765Siedowse/*
56143765Siedowse * Determine i/o configuration for a machine.
57143765Siedowse */
5880709Sjakestatic void
59143765Siedowseconfigure_first(void *dummy)
6080709Sjake{
61146794Smarcel
62146794Smarcel	nexusdev = device_add_child(root_bus, "nexus", 0);
63143765Siedowse}
6486227Stmm
65143765Siedowsestatic void
66143765Siedowseconfigure(void *dummy)
67143765Siedowse{
68143765Siedowse
6980709Sjake	root_bus_configure();
7086227Stmm#ifdef DEV_ISA
71182688Smarius	/*
72182688Smarius	 * We bypass isa_probe_children(9) here in order to avoid
73182688Smarius	 * invasive probes done by identify-routines of ISA drivers,
74182688Smarius	 * which in turn can trigger master/target aborts, and the
75182688Smarius	 * addition of ISA hints, which might erroneously exist.
76182688Smarius	 */
7786227Stmm	if (isa_bus_device != NULL)
78182688Smarius		(void)bus_generic_attach(isa_bus_device);
7986227Stmm#endif
80143765Siedowse}
81143765Siedowse
82143765Siedowsestatic void
83143765Siedowseconfigure_final(void *dummy)
84143765Siedowse{
85143765Siedowse
86146792Smarcel	cninit_finish();
8780709Sjake	cold = 0;
8880709Sjake}
89