diff options
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/conf/GENERIC.MP | 3 | ||||
-rw-r--r-- | sys/arch/sparc64/conf/files.sparc64 | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/cmp.c | 84 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/autoconf.c | 36 |
5 files changed, 109 insertions, 24 deletions
diff --git a/sys/arch/sparc64/conf/GENERIC b/sys/arch/sparc64/conf/GENERIC index 3ddf593e3f3..e92ee9a98e1 100644 --- a/sys/arch/sparc64/conf/GENERIC +++ b/sys/arch/sparc64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.203 2008/05/25 07:48:46 brad Exp $ +# $OpenBSD: GENERIC,v 1.204 2008/06/10 00:02:09 kettenis Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -30,6 +30,8 @@ config bsd swap generic # Main bus and CPU .. all systems. mainbus0 at root cpu0 at mainbus0 +cmp* at mainbus0 +cpu0 at cmp? # Bus types found on SPARC systems. sbus* at mainbus0 diff --git a/sys/arch/sparc64/conf/GENERIC.MP b/sys/arch/sparc64/conf/GENERIC.MP index da7d6b4075a..d0ce3793311 100644 --- a/sys/arch/sparc64/conf/GENERIC.MP +++ b/sys/arch/sparc64/conf/GENERIC.MP @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC.MP,v 1.1 2007/10/17 21:31:13 kettenis Exp $ +# $OpenBSD: GENERIC.MP,v 1.2 2008/06/10 00:02:09 kettenis Exp $ include "arch/sparc64/conf/GENERIC" @@ -6,3 +6,4 @@ option MULTIPROCESSOR #option MP_LOCKDEBUG cpu* at mainbus? +cpu* at cmp? diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64 index 70f9b5270af..f687c16acc5 100644 --- a/sys/arch/sparc64/conf/files.sparc64 +++ b/sys/arch/sparc64/conf/files.sparc64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.sparc64,v 1.105 2008/04/21 04:50:22 deraadt Exp $ +# $OpenBSD: files.sparc64,v 1.106 2008/06/10 00:02:09 kettenis Exp $ # $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $ # maxpartitions must be first item in files.${ARCH} @@ -149,6 +149,10 @@ device cpu attach cpu at mainbus file arch/sparc64/sparc64/cpu.c +device cmp: mainbus +attach cmp at mainbus +file arch/sparc64/dev/cmp.c cmp + device auxio attach auxio at ebus with auxio_ebus attach auxio at sbus with auxio_sbus diff --git a/sys/arch/sparc64/dev/cmp.c b/sys/arch/sparc64/dev/cmp.c new file mode 100644 index 00000000000..bcc9c3b4c32 --- /dev/null +++ b/sys/arch/sparc64/dev/cmp.c @@ -0,0 +1,84 @@ +/* $OpenBSD: cmp.c,v 1.1 2008/06/10 00:02:09 kettenis Exp $ */ +/* + * Copyright (c) 2008 Mark Kettenis + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <sys/device.h> +#include <sys/systm.h> + +#include <machine/autoconf.h> +#include <machine/openfirm.h> + +int cmp_match(struct device *, void *, void *); +void cmp_attach(struct device *, struct device *, void *); + +struct cfattach cmp_ca = { + sizeof(struct device), cmp_match, cmp_attach +}; + +struct cfdriver cmp_cd = { + NULL, "cmp", DV_DULL +}; + +int cmp_print(void *, const char *); + +int +cmp_match(struct device *parent, void *match, void *aux) +{ + struct mainbus_attach_args *ma = aux; + + if (strcmp(ma->ma_name, "cmp") == 0) + return (1); + + return (0); +} + +void +cmp_attach(struct device *parent, struct device *self, void *aux) +{ + struct mainbus_attach_args *ma = aux; + struct mainbus_attach_args nma; + char buf[32]; + int node; + + printf("\n"); + + for (node = OF_child(ma->ma_node); node; node = OF_peer(node)) { + if (!checkstatus(node)) + continue; + + OF_getprop(node, "name", buf, sizeof(buf)); + if (strcmp(buf, "cpu") == 0) + OF_getprop(node, "compatible", buf, sizeof(buf)); + + bzero(&nma, sizeof(nma)); + nma.ma_node = node; + nma.ma_name = buf; + getprop(node, "reg", sizeof(*nma.ma_reg), + &nma.ma_nreg, (void **)&nma.ma_reg); + config_found(self, &nma, cmp_print); + } +} + +int +cmp_print(void *aux, const char *name) +{ + struct mainbus_attach_args *ma = aux; + + if (name) + printf("\"%s\" at %s", ma->ma_name, name); + return (UNCONF); +} diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index fa50d98f044..a4a09316de7 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.89 2008/05/24 20:02:19 kettenis Exp $ */ +/* $OpenBSD: autoconf.c,v 1.90 2008/06/10 00:02:09 kettenis Exp $ */ /* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */ /* @@ -733,7 +733,7 @@ extern bus_space_tag_t mainbus_space_tag; struct mainbus_attach_args ma; char buf[32], *p; const char *const *ssp, *sp = NULL; - int node0, node, rv, len, ncpus; + int node0, node, rv, len; static const char *const openboot_special[] = { /* ignore these (end with NULL) */ @@ -781,30 +781,30 @@ extern bus_space_tag_t mainbus_space_tag; node = findroot(); - ncpus = 0; - for (node = OF_child(node), node0 = 0; node; node = OF_peer(node)) { + for (node = OF_child(node); node; node = OF_peer(node)) { if (!checkstatus(node)) continue; /* * UltraSPARC-IV cpus appear as two "cpu" nodes below - * a "cmp" node. Go down one level, but remember - * where we came from, such that we can go up again - * after we've handled both "cpu" nodes. + * a "cmp" node. */ if (OF_getprop(node, "name", buf, sizeof(buf)) <= 0) continue; if (strcmp(buf, "cmp") == 0) { - node0 = node; - node = OF_child(node0); + bzero(&ma, sizeof(ma)); + ma.ma_node = node; + ma.ma_name = buf; + getprop(node, "reg", sizeof(*ma.ma_reg), + &ma.ma_nreg, (void **)&ma.ma_reg); + config_found(dev, &ma, mbprint); + continue; } if (OF_getprop(node, "device_type", buf, sizeof(buf)) <= 0) continue; if (strcmp(buf, "cpu") == 0) { bzero(&ma, sizeof(ma)); - ma.ma_bustag = mainbus_space_tag; - ma.ma_dmatag = &mainbus_dma_tag; ma.ma_node = node; OF_getprop(node, "name", buf, sizeof(buf)); if (strcmp(buf, "cpu") == 0) @@ -813,18 +813,10 @@ extern bus_space_tag_t mainbus_space_tag; getprop(node, "reg", sizeof(*ma.ma_reg), &ma.ma_nreg, (void **)&ma.ma_reg); config_found(dev, &ma, mbprint); - ncpus++; - } - - if (node0 && OF_peer(node) == 0) { - node = node0; - node0 = 0; + continue; } } - if (ncpus == 0) - panic("None of the CPUs found"); - node = findroot(); /* re-init root node */ /* Find the "options" node */ @@ -845,7 +837,9 @@ extern bus_space_tag_t mainbus_space_tag; if (OF_getprop(node, "device_type", buf, sizeof(buf)) > 0 && strcmp(buf, "cpu") == 0) continue; - OF_getprop(node, "name", buf, sizeof(buf)); + if (OF_getprop(node, "name", buf, sizeof(buf)) > 0 && + strcmp(buf, "cmp") == 0) + continue; DPRINTF(ACDB_PROBE, (" name %s\n", buf)); for (ssp = openboot_special; (sp = *ssp) != NULL; ssp++) if (strcmp(buf, sp) == 0) |