xref: /netbsd/sys/arch/pmax/pmax/mainbus.c (revision bf9ec67e)
1 /* $NetBSD: mainbus.c,v 1.32 1999/11/15 09:50:20 nisimura Exp $ */
2 
3 /*
4  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
5  * All rights reserved.
6  *
7  * Author: Chris G. Demetriou
8  * DECstation port: Jonathan Stone
9  *
10  * Permission to use, copy, modify and distribute this software and
11  * its documentation is hereby granted, provided that both the copyright
12  * notice and this permission notice appear in all copies of the
13  * software, derivative works or modified versions, and any portions
14  * thereof, and that both notices appear in supporting documentation.
15  *
16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19  *
20  * Carnegie Mellon requests users of this software to return to
21  *
22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23  *  School of Computer Science
24  *  Carnegie Mellon University
25  *  Pittsburgh PA 15213-3890
26  *
27  * any improvements or extensions that they make and grant Carnegie the
28  * rights to redistribute these changes.
29  */
30 
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/device.h>
34 
35 #include <machine/sysconf.h>
36 #include <machine/autoconf.h>
37 
38 /* Definition of the mainbus driver. */
39 static int	mbmatch __P((struct device *, struct cfdata *, void *));
40 static void	mbattach __P((struct device *, struct device *, void *));
41 static int	mbprint __P((void *, const char *));
42 
43 struct cfattach mainbus_ca = {
44 	sizeof(struct device), mbmatch, mbattach
45 };
46 
47 static int mainbus_found;
48 
49 static int
50 mbmatch(parent, cf, aux)
51 	struct device *parent;
52 	struct cfdata *cf;
53 	void *aux;
54 {
55 
56 	if (mainbus_found)
57 		return (0);
58 
59 	return (1);
60 }
61 
62 int ncpus = 0;	/* only support uniprocessors, for now */
63 
64 static void
65 mbattach(parent, self, aux)
66 	struct device *parent;
67 	struct device *self;
68 	void *aux;
69 {
70 	struct mainbus_attach_args ma;
71 
72 	mainbus_found = 1;
73 
74 	printf("\n");
75 
76 	/*
77 	 * if we ever support multi-processor DECsystem (5800 family),
78 	 * the Alpha port's mainbus.c has an example of attaching
79 	 * multiple CPUs.
80 	 *
81 	 * For now, we only have one. Attach it directly.
82 	 */
83  	ma.ma_name = "cpu";
84 	ma.ma_slot = 0;
85 	config_found(self, &ma, mbprint);
86 
87 	ma.ma_name = platform.iobus;
88 	ma.ma_slot = 0;
89 	config_found(self, &ma, mbprint);
90 }
91 
92 static int
93 mbprint(aux, pnp)
94 	void *aux;
95 	const char *pnp;
96 {
97 
98 	if (pnp)
99 		return (QUIET);
100 	return (UNCONF);
101 }
102