autoconf.c revision 183030
11541Srgrimes/*- 21541Srgrimes * Copyright (c) 1998 Doug Rabson 31541Srgrimes * All rights reserved. 41541Srgrimes * 51541Srgrimes * Redistribution and use in source and binary forms, with or without 61541Srgrimes * modification, are permitted provided that the following conditions 71541Srgrimes * are met: 81541Srgrimes * 1. Redistributions of source code must retain the above copyright 91541Srgrimes * notice, this list of conditions and the following disclaimer. 101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer in the 121541Srgrimes * documentation and/or other materials provided with the distribution. 131541Srgrimes * 141541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 151541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 161541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 171541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 181541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 191541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 201541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 211541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 221541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 231541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 241541Srgrimes * SUCH DAMAGE. 251541Srgrimes */ 261541Srgrimes 271541Srgrimes#include <sys/cdefs.h> 281541Srgrimes__FBSDID("$FreeBSD: head/sys/powerpc/powerpc/autoconf.c 183030 2008-09-15 01:03:16Z marcel $"); 291541Srgrimes 301541Srgrimes#include <sys/param.h> 311541Srgrimes#include <sys/systm.h> 321541Srgrimes#include <sys/bus.h> 3310939Swollman#include <sys/cons.h> 3450477Speter#include <sys/kernel.h> 351541Srgrimes 361541Srgrimes#include <machine/intr_machdep.h> 372169Spaul 382169Spaulstatic device_t nexusdev; 392169Spaul 407280Swollmanstatic void configure_first(void *); 417280Swollmanstatic void configure(void *); 421541Srgrimesstatic void configure_final(void *); 431541Srgrimes 4421666SwollmanSYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL); 451541Srgrimes/* SI_ORDER_SECOND is hookable */ 461541SrgrimesSYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL); 471541Srgrimes/* SI_ORDER_MIDDLE is hookable */ 481541SrgrimesSYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL); 491541Srgrimes 501541Srgrimes/* 511541Srgrimes * Determine i/o configuration for a machine. 521541Srgrimes */ 531541Srgrimesstatic void 541541Srgrimesconfigure_first(void *dummy) 551541Srgrimes{ 561541Srgrimes 571541Srgrimes nexusdev = device_add_child(root_bus, "nexus", 0); 5820407Swollman} 591541Srgrimes 601541Srgrimesstatic void 611541Srgrimesconfigure(void *dummy) 621541Srgrimes{ 631541Srgrimes 641541Srgrimes root_bus_configure(); 651541Srgrimes} 661541Srgrimes 671541Srgrimesstatic void 681541Srgrimesconfigure_final(void *dummy) 691541Srgrimes{ 701541Srgrimes 711541Srgrimes /* 721541Srgrimes * Now that we're guaranteed to have a PIC driver (or we'll never 731541Srgrimes * have one), program it with all the previously setup interrupts. 741541Srgrimes */ 751541Srgrimes powerpc_enable_intr(); 763865Sswallace 773865Sswallace /* Enable external interrupts. */ 781541Srgrimes mtmsr(mfmsr() | PSL_EE); 791541Srgrimes 801541Srgrimes cninit_finish(); 811541Srgrimes cold = 0; 828876Srgrimes} 831541Srgrimes