summaryrefslogtreecommitdiff
path: root/sys/arch/hppa
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-04-27 14:39:52 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-04-27 14:39:52 +0000
commitf2b38187f81579e7bf39ae016e22990fc3095ac7 (patch)
tree25231311d4cf2655bdb5cd3307ed1e6358502f58 /sys/arch/hppa
parent40bc344abbd1e4bd7a01917f5b47e1da92e10adc (diff)
Add gecko(4), a driver for the GeckoBOA BC GSC+ port.
Diffstat (limited to 'sys/arch/hppa')
-rw-r--r--sys/arch/hppa/conf/files.hppa7
-rw-r--r--sys/arch/hppa/dev/gecko.c91
2 files changed, 97 insertions, 1 deletions
diff --git a/sys/arch/hppa/conf/files.hppa b/sys/arch/hppa/conf/files.hppa
index f1942500283..c7e4e09021b 100644
--- a/sys/arch/hppa/conf/files.hppa
+++ b/sys/arch/hppa/conf/files.hppa
@@ -1,4 +1,4 @@
-# $OpenBSD: files.hppa,v 1.77 2008/04/25 14:51:35 jmc Exp $
+# $OpenBSD: files.hppa,v 1.78 2008/04/27 14:39:51 kettenis Exp $
#
# hppa-specific configuration info
@@ -126,6 +126,11 @@ device phantomas: gedoens
attach phantomas at gedoens
file arch/hppa/dev/phantomas.c phantomas
+# GeckoBOA BC GSC+ port
+device gecko: gedoens
+attach gecko at gedoens
+file arch/hppa/dev/gecko.c gecko
+
# U2/Uturn, Runway to GSC Bus bridge & IOA
device uturn: gedoens
attach uturn at gedoens
diff --git a/sys/arch/hppa/dev/gecko.c b/sys/arch/hppa/dev/gecko.c
new file mode 100644
index 00000000000..171b208513e
--- /dev/null
+++ b/sys/arch/hppa/dev/gecko.c
@@ -0,0 +1,91 @@
+/* $OpenBSD: gecko.c,v 1.1 2008/04/27 14:39:51 kettenis Exp $ */
+
+/*
+ * Copyright (c) 2007 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/kernel.h>
+#include <sys/systm.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/cpu.h>
+#include <machine/iomod.h>
+#include <machine/pdc.h>
+
+#include <hppa/dev/cpudevs.h>
+
+struct gecko_softc {
+ struct device sc_dv;
+
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_ioh;
+};
+
+int gecko_match(struct device *, void *, void *);
+void gecko_attach(struct device *, struct device *, void *);
+
+struct cfattach gecko_ca = {
+ sizeof(struct gecko_softc), gecko_match, gecko_attach
+};
+
+struct cfdriver gecko_cd = {
+ NULL, "gecko", DV_DULL
+};
+
+int
+gecko_match(struct device *parent, void *match, void *aux)
+{
+ struct confargs *ca = aux;
+
+ if (ca->ca_type.iodc_type != HPPA_TYPE_BCPORT ||
+ ca->ca_type.iodc_sv_model != HPPA_BCPORT_PORT)
+ return (0);
+
+ if (ca->ca_type.iodc_model == 0x50 &&
+ ca->ca_type.iodc_revision == 0x00)
+ return (1);
+
+ return (0);
+}
+
+void
+gecko_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct gecko_softc *sc = (struct gecko_softc *)self;
+ struct confargs *ca = aux, nca;
+ bus_space_handle_t ioh;
+ volatile struct iomod *regs;
+
+ sc->sc_iot = ca->ca_iot;
+ if (bus_space_map(sc->sc_iot, ca->ca_hpa, IOMOD_HPASIZE, 0,
+ &sc->sc_ioh)) {
+ printf(": can't map IO space\n");
+ return;
+ }
+ regs = bus_space_vaddr(ca->ca_iot, ioh);
+
+#if 1
+ printf(": %x-%x", regs->io_io_low, regs->io_io_high);
+#endif
+
+ printf("\n");
+
+ nca = *ca;
+ nca.ca_hpamask = HPPA_IOBEGIN;
+ pdc_scanbus(self, &nca, MAXMODBUS, regs->io_io_low);
+}