mainbus.c revision 1.1
11.1Ssimonb/* $NetBSD: mainbus.c,v 1.1 2002/07/29 16:22:57 simonb Exp $ */
21.1Ssimonb
31.1Ssimonb/*
41.1Ssimonb * Copyright 2002 Wasabi Systems, Inc.
51.1Ssimonb * All rights reserved.
61.1Ssimonb *
71.1Ssimonb * Written by Simon Burge for Wasabi Systems, Inc.
81.1Ssimonb *
91.1Ssimonb * Redistribution and use in source and binary forms, with or without
101.1Ssimonb * modification, are permitted provided that the following conditions
111.1Ssimonb * are met:
121.1Ssimonb * 1. Redistributions of source code must retain the above copyright
131.1Ssimonb *    notice, this list of conditions and the following disclaimer.
141.1Ssimonb * 2. Redistributions in binary form must reproduce the above copyright
151.1Ssimonb *    notice, this list of conditions and the following disclaimer in the
161.1Ssimonb *    documentation and/or other materials provided with the distribution.
171.1Ssimonb * 3. All advertising materials mentioning features or use of this software
181.1Ssimonb *    must display the following acknowledgement:
191.1Ssimonb *      This product includes software developed for the NetBSD Project by
201.1Ssimonb *      Wasabi Systems, Inc.
211.1Ssimonb * 4. The name of Wasabi Systems, Inc. may not be used to endorse
221.1Ssimonb *    or promote products derived from this software without specific prior
231.1Ssimonb *    written permission.
241.1Ssimonb *
251.1Ssimonb * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
261.1Ssimonb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
271.1Ssimonb * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
281.1Ssimonb * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
291.1Ssimonb * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
301.1Ssimonb * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
311.1Ssimonb * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
321.1Ssimonb * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
331.1Ssimonb * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
341.1Ssimonb * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
351.1Ssimonb * POSSIBILITY OF SUCH DAMAGE.
361.1Ssimonb */
371.1Ssimonb
381.1Ssimonb#include <sys/param.h>
391.1Ssimonb#include <sys/systm.h>
401.1Ssimonb#include <sys/device.h>
411.1Ssimonb
421.1Ssimonb#include <mips/cache.h>
431.1Ssimonb#include <mips/cpuregs.h>
441.1Ssimonb
451.1Ssimonb// #include <evbmips/malta/autoconf.h>
461.1Ssimonb// #include <evbmips/malta/maltareg.h>
471.1Ssimonb// #include <evbmips/malta/maltavar.h>
481.1Ssimonb
491.1Ssimonb#include "locators.h"
501.1Ssimonb
511.1Ssimonbstatic int	mainbus_match(struct device *, struct cfdata *, void *);
521.1Ssimonbstatic void	mainbus_attach(struct device *, struct device *, void *);
531.1Ssimonbstatic int	mainbus_submatch(struct device *, struct cfdata *, void *);
541.1Ssimonbstatic int	mainbus_print(void *, const char *);
551.1Ssimonb
561.1Ssimonbstruct cfattach mainbus_ca = {
571.1Ssimonb	sizeof(struct device), mainbus_match, mainbus_attach
581.1Ssimonb};
591.1Ssimonb
601.1Ssimonb/* There can be only one. */
611.1Ssimonbint	mainbus_found;
621.1Ssimonb
631.1Ssimonbstruct mainbusdev {
641.1Ssimonb	const char *md_name;
651.1Ssimonb};
661.1Ssimonb
671.1Ssimonbstruct mainbusdev mainbusdevs[] = {
681.1Ssimonb	{ "cpu",	},
691.1Ssimonb	{ "aubus",	},
701.1Ssimonb	{ "obio",	},
711.1Ssimonb	{ NULL,		}
721.1Ssimonb};
731.1Ssimonb
741.1Ssimonbstatic int
751.1Ssimonbmainbus_match(parent, match, aux)
761.1Ssimonb	struct device *parent;
771.1Ssimonb	struct cfdata *match;
781.1Ssimonb	void *aux;
791.1Ssimonb{
801.1Ssimonb
811.1Ssimonb	if (mainbus_found)
821.1Ssimonb		return (0);
831.1Ssimonb
841.1Ssimonb	return (1);
851.1Ssimonb}
861.1Ssimonb
871.1Ssimonbstatic void
881.1Ssimonbmainbus_attach(parent, self, aux)
891.1Ssimonb	struct device *parent;
901.1Ssimonb	struct device *self;
911.1Ssimonb	void *aux;
921.1Ssimonb{
931.1Ssimonb	struct mainbusdev *md;
941.1Ssimonb
951.1Ssimonb	mainbus_found = 1;
961.1Ssimonb	printf("\n");
971.1Ssimonb
981.1Ssimonb	for (md = mainbusdevs; md->md_name != NULL; md++) {
991.1Ssimonb		config_found_sm(self, NULL, mainbus_print, mainbus_submatch);
1001.1Ssimonb	}
1011.1Ssimonb}
1021.1Ssimonb
1031.1Ssimonbstatic int
1041.1Ssimonbmainbus_submatch(struct device *parent, struct cfdata *cf, void *aux)
1051.1Ssimonb{
1061.1Ssimonb
1071.1Ssimonb	return ((*cf->cf_attach->ca_match)(parent, cf, aux));
1081.1Ssimonb}
1091.1Ssimonb
1101.1Ssimonbstatic int
1111.1Ssimonbmainbus_print(void *aux, const char *pnp)
1121.1Ssimonb{
1131.1Ssimonb
1141.1Ssimonb	return (UNCONF);
1151.1Ssimonb}
116