Annotation of sys/arch/alpha/alpha/mainbus.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: mainbus.c,v 1.13 2005/10/17 18:34:22 miod Exp $ */
! 2: /* $NetBSD: mainbus.c,v 1.27 1998/06/24 01:10:35 ross Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
! 6: * All rights reserved.
! 7: *
! 8: * Author: Chris G. Demetriou
! 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: #include <sys/reboot.h>
! 35: #include <sys/conf.h>
! 36:
! 37: #include <machine/autoconf.h>
! 38: #include <machine/rpb.h>
! 39: #include <machine/cpuconf.h>
! 40:
! 41: /* Definition of the mainbus driver. */
! 42: static int mbmatch(struct device *, void *, void *);
! 43: static void mbattach(struct device *, struct device *, void *);
! 44: static int mbprint(void *, const char *);
! 45:
! 46: struct cfattach mainbus_ca = {
! 47: sizeof(struct device), mbmatch, mbattach
! 48: };
! 49:
! 50: struct cfdriver mainbus_cd = {
! 51: NULL, "mainbus", DV_DULL
! 52: };
! 53:
! 54: /* There can be only one. */
! 55: int mainbus_found;
! 56:
! 57: static int
! 58: mbmatch(parent, cf, aux)
! 59: struct device *parent;
! 60: void *cf;
! 61: void *aux;
! 62: {
! 63:
! 64: if (mainbus_found)
! 65: return (0);
! 66:
! 67: return (1);
! 68: }
! 69:
! 70: static void
! 71: mbattach(parent, self, aux)
! 72: struct device *parent;
! 73: struct device *self;
! 74: void *aux;
! 75: {
! 76: struct mainbus_attach_args ma;
! 77: struct pcs *pcsp;
! 78: int i, cpuattachcnt;
! 79: extern int alpha_cpus;
! 80:
! 81: mainbus_found = 1;
! 82:
! 83: printf("\n");
! 84:
! 85: /*
! 86: * Try to find and attach all of the CPUs in the machine.
! 87: */
! 88: cpuattachcnt = 0;
! 89: for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
! 90: pcsp = LOCATE_PCS(hwrpb, i);
! 91: if ((pcsp->pcs_flags & PCS_PP) == 0)
! 92: continue;
! 93:
! 94: ma.ma_name = "cpu";
! 95: ma.ma_slot = i;
! 96: if (config_found(self, &ma, mbprint) != NULL)
! 97: cpuattachcnt++;
! 98: }
! 99: if (alpha_cpus != cpuattachcnt)
! 100: printf("WARNING: %d cpus in machine, %d attached\n",
! 101: alpha_cpus, cpuattachcnt);
! 102:
! 103: if (platform.iobus != NULL) {
! 104: ma.ma_name = platform.iobus;
! 105: ma.ma_slot = 0; /* meaningless */
! 106: config_found(self, &ma, mbprint);
! 107: }
! 108: }
! 109:
! 110: static int
! 111: mbprint(aux, pnp)
! 112: void *aux;
! 113: const char *pnp;
! 114: {
! 115: struct mainbus_attach_args *ma = aux;
! 116:
! 117: if (pnp)
! 118: printf("%s at %s", ma->ma_name, pnp);
! 119:
! 120: return (UNCONF);
! 121: }
CVSweb