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 cv3dpb, a driver for CyberVision64/3D PCI...
details: https://anonhg.NetBSD.org/src/rev/0572ae2442a8
branches: trunk
changeset: 772677:0572ae2442a8
user: rkujawa <rkujawa%NetBSD.org@localhost>
date: Wed Jan 11 17:04:29 2012 +0000
description:
Add cv3dpb, a driver for CyberVision64/3D PCI bridge, which was split from p5pb.
diffstat:
sys/arch/amiga/conf/DRACO | 6 +-
sys/arch/amiga/conf/GENERIC | 8 +-
sys/arch/amiga/conf/GENERIC.in | 6 +-
sys/arch/amiga/conf/INSTALL | 8 +-
sys/arch/amiga/conf/files.amiga | 6 +-
sys/arch/amiga/pci/cv3dpb.c | 223 ++++++++++++++++++++++++++++++++++++++++
sys/arch/amiga/pci/cv3dpbreg.h | 45 ++++++++
sys/arch/amiga/pci/cv3dpbvar.h | 49 ++++++++
sys/arch/amiga/pci/p5pbreg.h | 9 +-
9 files changed, 343 insertions(+), 17 deletions(-)
diffs (truncated from 506 to 300 lines):
diff -r c6dc24b72d68 -r 0572ae2442a8 sys/arch/amiga/conf/DRACO
--- a/sys/arch/amiga/conf/DRACO Wed Jan 11 16:29:32 2012 +0000
+++ b/sys/arch/amiga/conf/DRACO Wed Jan 11 17:04:29 2012 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: DRACO,v 1.149 2012/01/10 20:29:49 rkujawa Exp $
+# $NetBSD: DRACO,v 1.150 2012/01/11 17:04:29 rkujawa Exp $
#
# This file was automatically created.
# Changes will be lost when make is run in this directory.
#
-# Created from: # NetBSD: GENERIC.in,v 1.90 2011/12/26 13:07:24 mlelstv Exp $
+# Created from: # NetBSD: GENERIC.in,v 1.91 2012/01/10 20:29:50 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -29,7 +29,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.149 $"
+#ident "GENERIC-$Revision: 1.150 $"
maxusers 8
diff -r c6dc24b72d68 -r 0572ae2442a8 sys/arch/amiga/conf/GENERIC
--- a/sys/arch/amiga/conf/GENERIC Wed Jan 11 16:29:32 2012 +0000
+++ b/sys/arch/amiga/conf/GENERIC Wed Jan 11 17:04:29 2012 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC,v 1.279 2012/01/10 20:29:49 rkujawa Exp $
+# $NetBSD: GENERIC,v 1.280 2012/01/11 17:04:29 rkujawa Exp $
#
# This file was automatically created.
# Changes will be lost when make is run in this directory.
#
-# Created from: # NetBSD: GENERIC.in,v 1.90 2011/12/26 13:07:24 mlelstv Exp $
+# Created from: # NetBSD: GENERIC.in,v 1.91 2012/01/10 20:29:50 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -29,7 +29,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.279 $"
+#ident "GENERIC-$Revision: 1.280 $"
maxusers 8
@@ -482,6 +482,8 @@
mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge
pci* at mppb?
+#cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge
+
#genfb* at pci? # generic fb, CVPPC/BVPPC only
ne* at pci? # NE2000 Ethernet
diff -r c6dc24b72d68 -r 0572ae2442a8 sys/arch/amiga/conf/GENERIC.in
--- a/sys/arch/amiga/conf/GENERIC.in Wed Jan 11 16:29:32 2012 +0000
+++ b/sys/arch/amiga/conf/GENERIC.in Wed Jan 11 17:04:29 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.91 2012/01/10 20:29:50 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.92 2012/01/11 17:04:29 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -52,7 +52,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.91 $"
+#ident "GENERIC-$Revision: 1.92 $"
m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl
makeoptions COPTS="-Os"
@@ -569,6 +569,8 @@
mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge
pci* at mppb?
+#cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge
+
#genfb* at pci? # generic fb, CVPPC/BVPPC only
ne* at pci? # NE2000 Ethernet
diff -r c6dc24b72d68 -r 0572ae2442a8 sys/arch/amiga/conf/INSTALL
--- a/sys/arch/amiga/conf/INSTALL Wed Jan 11 16:29:32 2012 +0000
+++ b/sys/arch/amiga/conf/INSTALL Wed Jan 11 17:04:29 2012 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: INSTALL,v 1.101 2012/01/10 20:29:50 rkujawa Exp $
+# $NetBSD: INSTALL,v 1.102 2012/01/11 17:04:29 rkujawa Exp $
#
# This file was automatically created.
# Changes will be lost when make is run in this directory.
#
-# Created from: # NetBSD: GENERIC.in,v 1.90 2011/12/26 13:07:24 mlelstv Exp $
+# Created from: # NetBSD: GENERIC.in,v 1.91 2012/01/10 20:29:50 rkujawa Exp $
#
##
# GENERIC machine description file
@@ -29,7 +29,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.101 $"
+#ident "GENERIC-$Revision: 1.102 $"
makeoptions COPTS="-Os"
@@ -426,6 +426,8 @@
mppb* at zbus0 # Matay Prometheus Zorro-PCI bridge
pci* at mppb?
+#cv3dpb* at zbus0 # CyberVision 64/3D PCI bridge
+
#genfb* at pci? # generic fb, CVPPC/BVPPC only
ne* at pci? # NE2000 Ethernet
diff -r c6dc24b72d68 -r 0572ae2442a8 sys/arch/amiga/conf/files.amiga
--- a/sys/arch/amiga/conf/files.amiga Wed Jan 11 16:29:32 2012 +0000
+++ b/sys/arch/amiga/conf/files.amiga Wed Jan 11 17:04:29 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.amiga,v 1.151 2012/01/10 20:29:50 rkujawa Exp $
+# $NetBSD: files.amiga,v 1.152 2012/01/11 17:04:29 rkujawa Exp $
# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@@ -514,6 +514,7 @@
# PCI bus
file arch/amiga/pci/p5pb.c pci
file arch/amiga/pci/mppb.c pci
+file arch/amiga/pci/cv3dpb.c pci
file arch/amiga/pci/pci_machdep.c pci
device p5pb: pcibus
@@ -522,6 +523,9 @@
device mppb: pcibus
attach mppb at zbus
+device cv3dpb: pcibus
+attach cv3dpb at zbus
+
include "dev/i2o/files.i2o"
include "dev/pci/files.pci"
#include "dev/wsfb/files.wsfb"
diff -r c6dc24b72d68 -r 0572ae2442a8 sys/arch/amiga/pci/cv3dpb.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/pci/cv3dpb.c Wed Jan 11 17:04:29 2012 +0000
@@ -0,0 +1,223 @@
+/* $NetBSD: cv3dpb.c,v 1.1 2012/01/11 17:04:29 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2011, 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/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 <amiga/dev/zbusvar.h>
+#include <amiga/pci/cv3dpbreg.h>
+#include <amiga/pci/cv3dpbvar.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcidevs.h>
+#include <dev/pci/pciconf.h>
+
+/* Zorro IDs */
+#define ZORRO_MANID_P5 8512
+#define ZORRO_PRODID_CV643D_Z3 67 /* CV64/3D on Z3 bus */
+
+static int cv3dpb_match(struct device *, struct cfdata *, void *);
+static void cv3dpb_attach(struct device *, struct device *, void *);
+pcireg_t cv3dpb_pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
+void cv3dpb_pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
+int cv3dpb_pci_bus_maxdevs(pci_chipset_tag_t pc, int busno);
+int cv3dpb_pci_intr_map(const struct pci_attach_args *pa,
+ pci_intr_handle_t *ihp);
+static bool cv3dpb_bus_map(struct cv3dpb_softc *sc);
+
+CFATTACH_DECL_NEW(cv3dpb, sizeof(struct cv3dpb_softc),
+ cv3dpb_match, cv3dpb_attach, NULL, NULL);
+
+static int
+cv3dpb_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct zbus_args *zap;
+
+ zap = aux;
+
+ if (zap->manid != ZORRO_MANID_P5)
+ return 0;
+
+ if (zap->prodid != ZORRO_PRODID_CV643D_Z3)
+ return 0;
+
+#ifdef P5PB_DEBUG
+ aprint_normal("cv3dpb matched by Zorro ID %d, %d\n", zap->manid,
+ zap->prodid);
+#endif
+
+ return 10;
+}
+
+
+static void
+cv3dpb_attach(device_t parent, device_t self, void *aux)
+{
+ struct cv3dpb_softc *sc;
+ struct pcibus_attach_args pba;
+ struct zbus_args *zap;
+
+ sc = device_private(self);
+ pci_chipset_tag_t pc = &sc->apc;
+ sc->sc_dev = self;
+ zap = aux;
+
+ sc->ba = zap->va;
+
+ if(!(cv3dpb_bus_map(sc))) {
+ aprint_error_dev(self,
+ "couldn't map PCI configuration registers\n");
+ return;
+ }
+
+ aprint_normal(": CyberVision 64/3D PCI bridge\n");
+
+#ifdef P5PB_DEBUG
+ aprint_normal("cv3dpb: mapped %x -> %x, %x -> %x\n, %x -> %x\n",
+ P5BUS_PCI_CONF_BASE, sc->pci_conf_area.base,
+ P5BUS_PCI_IO_BASE, sc->pci_io_area.base,
+ P5BUS_PCI_MEM_BASE, sc->pci_mem_area.base );
+#endif
+
+ /* Initialize the PCI chipset tag. */
+ sc->apc.pc_conf_v = (void*) pc;
+ sc->apc.pc_bus_maxdevs = cv3dpb_pci_bus_maxdevs;
+ sc->apc.pc_make_tag = amiga_pci_make_tag;
+ sc->apc.pc_decompose_tag = amiga_pci_decompose_tag;
+ sc->apc.pc_conf_read = cv3dpb_pci_conf_read;
+ sc->apc.pc_conf_write = cv3dpb_pci_conf_write;
+ //sc->apc.pc_attach_hook = cv3dpb_pci_attach_hook;
+
+ sc->apc.pc_intr_map = cv3dpb_pci_intr_map;
+ sc->apc.pc_intr_string = amiga_pci_intr_string;
+ sc->apc.pc_intr_establish = amiga_pci_intr_establish;
+ sc->apc.pc_intr_disestablish = amiga_pci_intr_disestablish;
+
+ pba.pba_iot = &(sc->pci_io_area);
+ pba.pba_memt = &(sc->pci_mem_area);
+ pba.pba_dmat = NULL;
+ pba.pba_dmat64 = NULL;
+ pba.pba_pc = pc;
+ pba.pba_flags = PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY;
+ pba.pba_bus = 0;
+ pba.pba_bridgetag = NULL;
+
+ config_found_ia(self, "pcibus", &pba, pcibusprint);
+}
+
+pcireg_t
+cv3dpb_pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
+{
+ uint32_t data;
+ uint32_t bus, dev, func;
Home |
Main Index |
Thread Index |
Old Index