diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-07-11 14:23:54 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-07-11 14:23:54 +0000 |
commit | 5fda136d36e4c830bb52592a443eb469edbdec90 (patch) | |
tree | 7e5fd7f32ba462e0d9ef497dec6db1c56c9aa942 /sys/arch | |
parent | 222aec3d6d1af9cc8cdfe24f500574878dd66957 (diff) |
Fujitsu SPARC64-VI CPU's have two cores that have two threads each. Provide
a core(4) device, representing these cores and attach cpu(4) devices to it
for each thread.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/conf/files.sparc64 | 16 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/core.c | 82 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/cpu.c | 7 |
4 files changed, 100 insertions, 9 deletions
diff --git a/sys/arch/sparc64/conf/GENERIC b/sys/arch/sparc64/conf/GENERIC index 07b8fe8a802..f8a8b003eb8 100644 --- a/sys/arch/sparc64/conf/GENERIC +++ b/sys/arch/sparc64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.215 2008/07/06 08:53:38 kettenis Exp $ +# $OpenBSD: GENERIC,v 1.216 2008/07/11 14:23:53 kettenis Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -35,6 +35,8 @@ cpu0 at ssm? cmp* at mainbus0 cmp* at ssm? cpu0 at cmp? +core* at cmp? +cpu0 at core? # Bus types found on SPARC systems. sbus* at mainbus0 diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64 index 365e017abbb..47378f6ddd1 100644 --- a/sys/arch/sparc64/conf/files.sparc64 +++ b/sys/arch/sparc64/conf/files.sparc64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.sparc64,v 1.109 2008/07/07 14:46:18 kettenis Exp $ +# $OpenBSD: files.sparc64,v 1.110 2008/07/11 14:23:53 kettenis Exp $ # $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $ # maxpartitions must be first item in files.${ARCH} @@ -153,14 +153,18 @@ device eeprom attach eeprom at sbus, ebus file arch/sparc64/sparc64/clock.c -device cpu -attach cpu at mainbus -file arch/sparc64/sparc64/cpu.c - -device cmp: mainbus +device cmp {} attach cmp at mainbus file arch/sparc64/dev/cmp.c cmp +device core {} +attach core at cmp +file arch/sparc64/dev/core.c core + +device cpu +attach cpu at mainbus, cmp, core +file arch/sparc64/sparc64/cpu.c + device auxio attach auxio at ebus with auxio_ebus attach auxio at sbus with auxio_sbus diff --git a/sys/arch/sparc64/dev/core.c b/sys/arch/sparc64/dev/core.c new file mode 100644 index 00000000000..c958d4cf364 --- /dev/null +++ b/sys/arch/sparc64/dev/core.c @@ -0,0 +1,82 @@ +/* $OpenBSD: core.c,v 1.1 2008/07/11 14:23:53 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 core_match(struct device *, void *, void *); +void core_attach(struct device *, struct device *, void *); + +struct cfattach core_ca = { + sizeof(struct device), core_match, core_attach +}; + +struct cfdriver core_cd = { + NULL, "core", DV_DULL +}; + +int core_print(void *, const char *); + +int +core_match(struct device *parent, void *match, void *aux) +{ + struct mainbus_attach_args *ma = aux; + + if (strcmp(ma->ma_name, "core") == 0) + return (1); + + return (0); +} + +void +core_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(ma->ma_node, "compatible", buf, sizeof(buf)); + + bzero(&nma, sizeof(nma)); + nma.ma_node = node; + nma.ma_name = buf; + config_found(self, &nma, core_print); + } +} + +int +core_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/cpu.c b/sys/arch/sparc64/sparc64/cpu.c index 451da27f28c..589624f8ab8 100644 --- a/sys/arch/sparc64/sparc64/cpu.c +++ b/sys/arch/sparc64/sparc64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.41 2008/07/11 05:20:19 kettenis Exp $ */ +/* $OpenBSD: cpu.c,v 1.42 2008/07/11 14:23:53 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.13 2001/05/26 21:27:15 chs Exp $ */ /* @@ -241,7 +241,10 @@ cpu_attach(parent, dev, aux) vers = IU_VERS(ver); /* tell them what we have */ - node = ma->ma_node; + if (strncmp(parent->dv_xname, "core", 4) == 0) + node = OF_parent(ma->ma_node); + else + node = ma->ma_node; /* * Allocate cpu_info structure if needed. |