6a7b420b7e
for evbsh3, mmeye and dreamcast, use MI md_root.c
111 lines
3.2 KiB
C
111 lines
3.2 KiB
C
/* $NetBSD: mainbus.c,v 1.1 2001/02/06 16:45:22 uch Exp $ */
|
|
|
|
/*
|
|
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
* must display the following acknowledgement:
|
|
* This product includes software developed by Christopher G. Demetriou
|
|
* for the NetBSD Project.
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
* derived from this software without specific prior written permission
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
#include <sys/param.h>
|
|
#include <sys/systm.h>
|
|
#include <sys/device.h>
|
|
|
|
#include <machine/shbvar.h>
|
|
|
|
int mainbus_match __P((struct device *, struct cfdata *, void *));
|
|
void mainbus_attach __P((struct device *, struct device *, void *));
|
|
|
|
struct cfattach mainbus_ca = {
|
|
sizeof(struct device), mainbus_match, mainbus_attach
|
|
};
|
|
|
|
int mainbus_print __P((void *, const char *));
|
|
|
|
union mainbus_attach_args {
|
|
const char *mba_busname; /* first elem of all */
|
|
struct shbus_attach_args mba_sba;
|
|
#ifdef TODO
|
|
struct pcibus_attach_args mba_pba;
|
|
struct eisabus_attach_args mba_eba;
|
|
struct isabus_attach_args mba_iba;
|
|
#endif
|
|
};
|
|
|
|
/*
|
|
* This is set when the ISA bus is attached. If it's not set by the
|
|
* time it's checked below, then mainbus attempts to attach an ISA.
|
|
*/
|
|
int isa_has_been_seen;
|
|
|
|
/*
|
|
* Probe for the mainbus; always succeeds.
|
|
*/
|
|
int
|
|
mainbus_match(parent, cf, aux)
|
|
struct device *parent;
|
|
struct cfdata *cf;
|
|
void *aux;
|
|
{
|
|
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* Attach the mainbus.
|
|
*/
|
|
void
|
|
mainbus_attach(parent, self, aux)
|
|
struct device *parent, *self;
|
|
void *aux;
|
|
{
|
|
union mainbus_attach_args mba;
|
|
|
|
printf("\n");
|
|
|
|
mba.mba_sba.iba_busname = "shb";
|
|
mba.mba_sba.iba_iot = 0;
|
|
mba.mba_sba.iba_memt = 0;
|
|
|
|
config_found(self, &mba.mba_sba, mainbus_print);
|
|
}
|
|
|
|
int
|
|
mainbus_print(aux, pnp)
|
|
void *aux;
|
|
const char *pnp;
|
|
{
|
|
union mainbus_attach_args *mba = aux;
|
|
|
|
if (pnp)
|
|
printf("%s at %s", mba->mba_busname, pnp);
|
|
#ifdef TODO
|
|
if (!strcmp(mba->mba_busname, "pci"))
|
|
printf(" bus %d", mba->mba_pba.pba_bus);
|
|
#endif
|
|
return (UNCONF);
|
|
}
|