Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amiga Add a driver for Elbox Mediator 1200 PCI brid...
details: https://anonhg.NetBSD.org/src/rev/51832d6ec426
branches: trunk
changeset: 779482:51832d6ec426
user: rkujawa <rkujawa%NetBSD.org@localhost>
date: Wed May 30 18:01:51 2012 +0000
description:
Add a driver for Elbox Mediator 1200 PCI bridges. This is still a work in
progress, but now it is good enough to drive a NE2000 card. Support for
memory space accesses will be added soon(ish).
diffstat:
sys/arch/amiga/conf/GENERIC.in | 8 +-
sys/arch/amiga/conf/files.amiga | 10 +-
sys/arch/amiga/pci/emmem.c | 105 +++++++++++
sys/arch/amiga/pci/emmemvar.h | 41 ++++
sys/arch/amiga/pci/empb.c | 369 ++++++++++++++++++++++++++++++++++++++++
sys/arch/amiga/pci/empbreg.h | 84 +++++++++
6 files changed, 614 insertions(+), 3 deletions(-)
diffs (truncated from 675 to 300 lines):
diff -r 0cc99807b0a9 -r 51832d6ec426 sys/arch/amiga/conf/GENERIC.in
--- a/sys/arch/amiga/conf/GENERIC.in Wed May 30 15:17:00 2012 +0000
+++ b/sys/arch/amiga/conf/GENERIC.in Wed May 30 18:01:51 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.99 2012/05/15 17:35:44 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.100 2012/05/30 18:01:51 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -52,7 +52,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.99 $"
+#ident "GENERIC-$Revision: 1.100 $"
m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl
makeoptions COPTS="-Os"
@@ -577,6 +577,10 @@
mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge
pci* at mppb?
+empb0 at zbus0 # ELBOX Mediator PCI 1200
+emmem0 at zbus0 # ELBOX Mediator PCI memory space
+pci* at empb0
+
#cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge
#genfb* at pci? # generic fb, CVPPC/BVPPC only
diff -r 0cc99807b0a9 -r 51832d6ec426 sys/arch/amiga/conf/files.amiga
--- a/sys/arch/amiga/conf/files.amiga Wed May 30 15:17:00 2012 +0000
+++ b/sys/arch/amiga/conf/files.amiga Wed May 30 18:01:51 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.amiga,v 1.156 2012/05/15 17:35:44 rkujawa Exp $
+# $NetBSD: files.amiga,v 1.157 2012/05/30 18:01:51 rkujawa Exp $
# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@@ -522,6 +522,7 @@
# PCI bus
file arch/amiga/pci/p5pb.c pci
file arch/amiga/pci/mppb.c pci
+file arch/amiga/pci/empb.c pci
file arch/amiga/pci/cv3dpb.c pci
file arch/amiga/pci/pci_machdep.c pci
@@ -534,6 +535,13 @@
device cv3dpb: pcibus
attach cv3dpb at zbus
+device empb: pcibus
+attach empb at zbus
+
+device emmem {}
+attach emmem at zbus
+file arch/amiga/pci/emmem.c emmem
+
include "dev/i2o/files.i2o"
include "dev/pci/files.pci"
diff -r 0cc99807b0a9 -r 51832d6ec426 sys/arch/amiga/pci/emmem.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/pci/emmem.c Wed May 30 18:01:51 2012 +0000
@@ -0,0 +1,105 @@
+/* $NetBSD: emmem.c,v 1.1 2012/05/30 18:01:51 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Handle (optional) PCI memory space on Elbox Mediator bridges.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/extent.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+//#include <m68k/bus_dma.h>
+#include <amiga/dev/zbusvar.h>
+#include <amiga/pci/empbreg.h>
+#include <amiga/pci/emmemvar.h>
+
+static int emmem_match(struct device *, struct cfdata *, void *);
+static void emmem_attach(struct device *, struct device *, void *);
+
+CFATTACH_DECL_NEW(emmem, sizeof(struct emmem_softc),
+ emmem_match, emmem_attach, NULL, NULL);
+
+static int
+emmem_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct zbus_args *zap;
+
+ zap = aux;
+
+ if (zap->manid != ZORRO_MANID_ELBOX)
+ return 0;
+
+ switch (zap->prodid) {
+ case ZORRO_PRODID_MED1K2_MEM:
+ case ZORRO_PRODID_MED1K2SX_MEM:
+ case ZORRO_PRODID_MED1K2LT2_MEM:
+ case ZORRO_PRODID_MED1K2LT4_MEM:
+ case ZORRO_PRODID_MED1K2TX_MEM:
+ return 1;
+ }
+
+ return 0;
+}
+
+static void
+emmem_attach(device_t parent, device_t self, void *aux)
+{
+ struct zbus_args *zap;
+ struct emmem_softc *sc;
+
+ sc = device_private(self);
+ zap = aux;
+
+ sc->sc_dev = self;
+ sc->sc_base = zap->pa;
+ sc->sc_size = zap->size;
+
+ aprint_normal(": ELBOX Mediator PCI memory window, %d kB\n",
+ zap->size / 1024);
+
+ /*
+ * Do nothing here, empb should find the emmem devices
+ * and do the right(tm) thing.
+ */
+
+}
+
diff -r 0cc99807b0a9 -r 51832d6ec426 sys/arch/amiga/pci/emmemvar.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/pci/emmemvar.h Wed May 30 18:01:51 2012 +0000
@@ -0,0 +1,41 @@
+/* $NetBSD: emmemvar.h,v 1.1 2012/05/30 18:01:51 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/device.h>
+
+struct emmem_softc {
+ device_t sc_dev;
+
+ volatile char *sc_base; /* base PA */
+ uint32_t sc_size;
+};
+
diff -r 0cc99807b0a9 -r 51832d6ec426 sys/arch/amiga/pci/empb.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/pci/empb.c Wed May 30 18:01:51 2012 +0000
@@ -0,0 +1,369 @@
+/* $NetBSD: empb.c,v 1.1 2012/05/30 18:01:51 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Elbox Mediator PCI bridge driver. Currently supports Mediator 1200 models.*/
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/extent.h>
+#include <sys/kmem.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <m68k/bus_dma.h>
+#include <amiga/dev/zbusvar.h>
+#include <amiga/pci/empbreg.h>
+#include <amiga/pci/emmemvar.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcidevs.h>
+#include <dev/pci/pciconf.h>
+
+#include "opt_pci.h"
+
+/* #define EMPB_DEBUG 1 */
+
+#define PCI_CONF_LOCK(s) (s) = splhigh()
+#define PCI_CONF_UNLOCK(s) splx((s))
+
+struct empb_softc {
+ device_t sc_dev;
+
+ struct bus_space_tag setup_area;
+ bus_space_tag_t setup_area_t;
+ bus_space_handle_t setup_area_h;
+
+ struct bus_space_tag pci_confio_area;
+ bus_space_tag_t pci_confio_t;
+ bus_space_handle_t pci_confio_h;
+ uint8_t pci_confio_mode;
+
+ struct bus_space_tag pci_mem_window;
+ uint32_t pci_mem_window_size;
+
+ struct amiga_pci_chipset apc;
+
Home |
Main Index |
Thread Index |
Old Index