diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-07-06 08:52:27 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-07-06 08:52:27 +0000 |
commit | a14f82e3c4ea43249239586b1349333fdf16bb17 (patch) | |
tree | 704e0aa520c0c6acbd6113037f60f78f7f98524b /sys | |
parent | d4aa7926282deadb5c7adee66e0bf870ef46f238 (diff) |
Add ssm(4), a driver for the scalable shared memory device found on
Serengeti and Starcat systems.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sparc64/conf/files.sparc64 | 8 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/ssm.c | 89 |
2 files changed, 95 insertions, 2 deletions
diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64 index b7ffe67e729..e39ba327fec 100644 --- a/sys/arch/sparc64/conf/files.sparc64 +++ b/sys/arch/sparc64/conf/files.sparc64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.sparc64,v 1.107 2008/07/06 07:27:43 kettenis Exp $ +# $OpenBSD: files.sparc64,v 1.108 2008/07/06 08:52:26 kettenis Exp $ # $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $ # maxpartitions must be first item in files.${ARCH} @@ -9,11 +9,15 @@ maxusers 2 8 1024 define mainbus {} device mainbus: pcibus, mainbus attach mainbus at root -file arch/sparc64/dev/upa.c upa + +device ssm: mainbus +attach ssm at mainbus +file arch/sparc64/dev/ssm.c ssm define upa {} device upa attach upa at mainbus +file arch/sparc64/dev/upa.c upa define central {} device central diff --git a/sys/arch/sparc64/dev/ssm.c b/sys/arch/sparc64/dev/ssm.c new file mode 100644 index 00000000000..75ddf46a67c --- /dev/null +++ b/sys/arch/sparc64/dev/ssm.c @@ -0,0 +1,89 @@ +/* $OpenBSD: ssm.c,v 1.1 2008/07/06 08:51:44 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/malloc.h> +#include <sys/systm.h> + +#include <machine/autoconf.h> +#include <machine/openfirm.h> + +int ssm_match(struct device *, void *, void *); +void ssm_attach(struct device *, struct device *, void *); + +struct cfattach ssm_ca = { + sizeof(struct device), ssm_match, ssm_attach +}; + +struct cfdriver ssm_cd = { + NULL, "ssm", DV_DULL +}; + +int ssm_print(void *, const char *); + +int +ssm_match(struct device *parent, void *match, void *aux) +{ + struct mainbus_attach_args *ma = aux; + + if (strcmp(ma->ma_name, "ssm") == 0) + return (1); + + return (0); +} + +void +ssm_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_bustag = ma->ma_bustag; + nma.ma_dmatag = ma->ma_dmatag; + nma.ma_node = node; + nma.ma_name = buf; + nma.ma_upaid = getpropint(node, "portid", -1); + getprop(node, "reg", sizeof(*nma.ma_reg), + &nma.ma_nreg, (void **)&nma.ma_reg); + config_found(self, &nma, ssm_print); + free(nma.ma_reg, M_DEVBUF); + } +} + +int +ssm_print(void *aux, const char *name) +{ + struct mainbus_attach_args *ma = aux; + + if (name) + printf("\"%s\" at %s", ma->ma_name, name); + return (UNCONF); +} |