Home | History | Annotate | Line # | Download | only in emips
      1 /* $NetBSD: mainbus.c,v 1.5 2021/08/07 16:18:48 thorpej 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 (at) 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.5 2021/08/07 16:18:48 thorpej Exp $");
     33 
     34 #include <sys/param.h>
     35 #include <sys/systm.h>
     36 #include <sys/device.h>
     37 
     38 #include <machine/sysconf.h>
     39 #include <machine/autoconf.h>
     40 
     41 /* Definition of the mainbus driver. */
     42 static int	mbmatch(device_t, cfdata_t, void *);
     43 static void	mbattach(device_t, device_t, void *);
     44 static int	mbprint(void *, const char *);
     45 
     46 CFATTACH_DECL_NEW(mainbus, 0,
     47     mbmatch, mbattach, NULL, NULL);
     48 
     49 static int mainbus_found;
     50 
     51 static int
     52 mbmatch(device_t parent, cfdata_t cf, void *aux)
     53 {
     54 
     55 	if (mainbus_found)
     56 		return (0);
     57 
     58 	return (1);
     59 }
     60 
     61 int ncpus = 0;	/* only support uniprocessors, for now */
     62 
     63 static void
     64 mbattach(device_t parent, device_t self, void *aux)
     65 {
     66 	struct mainbus_attach_args ma;
     67 
     68 	mainbus_found = 1;
     69 
     70 	printf("\n");
     71 
     72  	ma.ma_name = "cpu";
     73 	ma.ma_slot = 0;
     74 	config_found(self, &ma, mbprint, CFARGS_NONE);
     75 
     76 	ma.ma_name = platform.iobus;
     77 	ma.ma_slot = 0;
     78 	config_found(self, &ma, mbprint, CFARGS_NONE);
     79 }
     80 
     81 static int
     82 mbprint(void *aux, const char *pnp)
     83 {
     84 
     85 	if (pnp)
     86 		return (QUIET);
     87 	return (UNCONF);
     88 }
     89