mainbus.c revision 1.1
11.1Such/* $NetBSD: mainbus.c,v 1.1 2001/02/06 16:45:20 uch Exp $ */ 21.1Such 31.1Such/* 41.1Such * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 51.1Such * 61.1Such * Redistribution and use in source and binary forms, with or without 71.1Such * modification, are permitted provided that the following conditions 81.1Such * are met: 91.1Such * 1. Redistributions of source code must retain the above copyright 101.1Such * notice, this list of conditions and the following disclaimer. 111.1Such * 2. Redistributions in binary form must reproduce the above copyright 121.1Such * notice, this list of conditions and the following disclaimer in the 131.1Such * documentation and/or other materials provided with the distribution. 141.1Such * 3. All advertising materials mentioning features or use of this software 151.1Such * must display the following acknowledgement: 161.1Such * This product includes software developed by Christopher G. Demetriou 171.1Such * for the NetBSD Project. 181.1Such * 4. The name of the author may not be used to endorse or promote products 191.1Such * derived from this software without specific prior written permission 201.1Such * 211.1Such * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 221.1Such * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 231.1Such * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 241.1Such * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 251.1Such * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 261.1Such * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 271.1Such * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 281.1Such * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 291.1Such * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 301.1Such * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 311.1Such */ 321.1Such 331.1Such#include <sys/param.h> 341.1Such#include <sys/systm.h> 351.1Such#include <sys/device.h> 361.1Such 371.1Such#include <machine/shbvar.h> 381.1Such 391.1Suchint mainbus_match __P((struct device *, struct cfdata *, void *)); 401.1Suchvoid mainbus_attach __P((struct device *, struct device *, void *)); 411.1Such 421.1Suchstruct cfattach mainbus_ca = { 431.1Such sizeof(struct device), mainbus_match, mainbus_attach 441.1Such}; 451.1Such 461.1Suchint mainbus_print __P((void *, const char *)); 471.1Such 481.1Suchunion mainbus_attach_args { 491.1Such const char *mba_busname; /* first elem of all */ 501.1Such struct shbus_attach_args mba_sba; 511.1Such#ifdef TODO 521.1Such struct pcibus_attach_args mba_pba; 531.1Such struct eisabus_attach_args mba_eba; 541.1Such struct isabus_attach_args mba_iba; 551.1Such#endif 561.1Such}; 571.1Such 581.1Such/* 591.1Such * This is set when the ISA bus is attached. If it's not set by the 601.1Such * time it's checked below, then mainbus attempts to attach an ISA. 611.1Such */ 621.1Suchint isa_has_been_seen; 631.1Such 641.1Such/* 651.1Such * Probe for the mainbus; always succeeds. 661.1Such */ 671.1Suchint 681.1Suchmainbus_match(parent, cf, aux) 691.1Such struct device *parent; 701.1Such struct cfdata *cf; 711.1Such void *aux; 721.1Such{ 731.1Such 741.1Such return 1; 751.1Such} 761.1Such 771.1Such/* 781.1Such * Attach the mainbus. 791.1Such */ 801.1Suchvoid 811.1Suchmainbus_attach(parent, self, aux) 821.1Such struct device *parent, *self; 831.1Such void *aux; 841.1Such{ 851.1Such union mainbus_attach_args mba; 861.1Such 871.1Such printf("\n"); 881.1Such 891.1Such mba.mba_sba.iba_busname = "shb"; 901.1Such mba.mba_sba.iba_iot = 0; 911.1Such mba.mba_sba.iba_memt = 0; 921.1Such 931.1Such config_found(self, &mba.mba_sba, mainbus_print); 941.1Such} 951.1Such 961.1Suchint 971.1Suchmainbus_print(aux, pnp) 981.1Such void *aux; 991.1Such const char *pnp; 1001.1Such{ 1011.1Such union mainbus_attach_args *mba = aux; 1021.1Such 1031.1Such if (pnp) 1041.1Such printf("%s at %s", mba->mba_busname, pnp); 1051.1Such#ifdef TODO 1061.1Such if (!strcmp(mba->mba_busname, "pci")) 1071.1Such printf(" bus %d", mba->mba_pba.pba_bus); 1081.1Such#endif 1091.1Such return (UNCONF); 1101.1Such} 111