Home | History | Annotate | Line # | Download | only in pmax
      1 /* $NetBSD: mainbus.c,v 1.44 2021/08/07 16:19:02 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.44 2021/08/07 16:19:02 thorpej Exp $");
     33 
     34 #include <sys/param.h>
     35 #include <sys/systm.h>
     36 #include <sys/device.h>
     37 
     38 #include <pmax/sysconf.h>
     39 #include <pmax/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 	aprint_normal("\n");
     71 
     72 	/*
     73 	 * if we ever support multi-processor DECsystem (5800 family),
     74 	 * the Alpha port's mainbus.c has an example of attaching
     75 	 * multiple CPUs.
     76 	 *
     77 	 * For now, we only have one. Attach it directly.
     78 	 */
     79  	ma.ma_name = "cpu";
     80 	ma.ma_slot = 0;
     81 	config_found(self, &ma, mbprint, CFARGS_NONE);
     82 
     83 	ma.ma_name = platform.iobus;
     84 	ma.ma_slot = 0;
     85 	config_found(self, &ma, mbprint, CFARGS_NONE);
     86 }
     87 
     88 static int
     89 mbprint(void *aux, const char *pnp)
     90 {
     91 
     92 	if (pnp)
     93 		return QUIET;
     94 	return UNCONF;
     95 }
     96