1/*	$NetBSD: mainbus.c,v 1.10 2005/12/11 12:18:25 christos 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/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.10 2005/12/11 12:18:25 christos Exp $");
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/device.h>
37#include <sys/reboot.h>
38
39#include <machine/autoconf.h>
40#include <machine/apbus.h>
41
42/* Definition of the mainbus driver. */
43static int	mbmatch(device_t, cfdata_t, void *);
44static void	mbattach(device_t, device_t, void *);
45static int	mbprint(void *, const char *);
46
47CFATTACH_DECL_NEW(mainbus, 0,
48    mbmatch, mbattach, NULL, NULL);
49
50/* There can be only one. */
51static int mainbus_found;
52
53static int
54mbmatch(device_t parent, cfdata_t cf, void *aux)
55{
56
57	if (mainbus_found)
58		return 0;
59
60	return 1;
61}
62
63static void
64mbattach(device_t parent, device_t self, void *aux)
65{
66	struct confargs nca;
67
68	mainbus_found = 1;
69	aprint_normal("\n");
70
71	nca.ca_name = "cpu";
72	config_found(self, &nca, mbprint);
73
74	/* XXX */
75	if (_sip != NULL) {
76		nca.ca_name = "ap";
77		config_found(self, &nca, NULL);
78	} else {
79		nca.ca_name = "hb";
80		config_found(self, &nca, NULL);
81	}
82}
83
84static int
85mbprint(void *aux, const char *pnp)
86{
87
88	if (pnp)
89		return QUIET;
90	return UNCONF;
91}
92