rmixl_mainbus.c revision 1.2
11.2Smatt/*	$NetBSD: rmixl_mainbus.c,v 1.2 2009/12/14 00:46:07 matt Exp $	*/
21.2Smatt
31.2Smatt/*
41.2Smatt * Copyright (c) 1994,1995 Mark Brinicombe.
51.2Smatt * Copyright (c) 1994 Brini.
61.2Smatt * All rights reserved.
71.2Smatt *
81.2Smatt * Redistribution and use in source and binary forms, with or without
91.2Smatt * modification, are permitted provided that the following conditions
101.2Smatt * are met:
111.2Smatt * 1. Redistributions of source code must retain the above copyright
121.2Smatt *    notice, this list of conditions and the following disclaimer.
131.2Smatt * 2. Redistributions in binary form must reproduce the above copyright
141.2Smatt *    notice, this list of conditions and the following disclaimer in the
151.2Smatt *    documentation and/or other materials provided with the distribution.
161.2Smatt * 3. All advertising materials mentioning features or use of this software
171.2Smatt *    must display the following acknowledgement:
181.2Smatt *	This product includes software developed by Brini.
191.2Smatt * 4. The name of the company nor the name of the author may be used to
201.2Smatt *    endorse or promote products derived from this software without specific
211.2Smatt *    prior written permission.
221.2Smatt *
231.2Smatt * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
241.2Smatt * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
251.2Smatt * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
261.2Smatt * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
271.2Smatt * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
281.2Smatt * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
291.2Smatt * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
301.2Smatt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
311.2Smatt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
321.2Smatt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
331.2Smatt * SUCH DAMAGE.
341.2Smatt *
351.2Smatt * RiscBSD kernel project
361.2Smatt *
371.2Smatt * mainbus.c
381.2Smatt *
391.2Smatt * mainbus configuration
401.2Smatt *
411.2Smatt * Created      : 15/12/94
421.2Smatt */
431.2Smatt
441.2Smatt#include <sys/cdefs.h>
451.2Smatt__KERNEL_RCSID(0, "$NetBSD: rmixl_mainbus.c,v 1.2 2009/12/14 00:46:07 matt Exp $");
461.2Smatt
471.2Smatt#include <sys/param.h>
481.2Smatt#include <sys/systm.h>
491.2Smatt#include <sys/kernel.h>
501.2Smatt#include <sys/conf.h>
511.2Smatt#include <sys/malloc.h>
521.2Smatt#include <sys/device.h>
531.2Smatt
541.2Smatt#include <machine/bus.h>
551.2Smatt#include "locators.h"
561.2Smatt
571.2Smattstatic int  mainbusmatch(device_t,  cfdata_t, void *);
581.2Smattstatic void mainbusattach(device_t,  device_t,  void *);
591.2Smattstatic int  mainbussearch(device_t,  cfdata_t, const int *, void *);
601.2Smatt
611.2SmattCFATTACH_DECL_NEW(mainbus, 0, mainbusmatch, mainbusattach, NULL, NULL);
621.2Smatt
631.2Smattstatic int mainbus_found;
641.2Smatt
651.2Smattstatic int
661.2Smattmainbusmatch(device_t parent, cfdata_t cf, void *aux)
671.2Smatt{
681.2Smatt	if (mainbus_found)
691.2Smatt		return 0;
701.2Smatt	return 1;
711.2Smatt}
721.2Smatt
731.2Smattstatic int
741.2Smattmainbussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
751.2Smatt{
761.2Smatt	if (config_match(parent, cf, NULL) > 0)
771.2Smatt		config_attach(parent, cf, aux, NULL);
781.2Smatt
791.2Smatt	return 0;
801.2Smatt}
811.2Smatt
821.2Smattstatic void
831.2Smattmainbusattach(device_t parent, device_t self, void *aux)
841.2Smatt{
851.2Smatt	aprint_naive("\n");
861.2Smatt	aprint_normal("\n");
871.2Smatt
881.2Smatt	mainbus_found = 1;
891.2Smatt	config_search_ia(mainbussearch, self, "mainbus", NULL);
901.2Smatt}
91