Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Add support for all 4 slots of G-REX 4000D and G-RE...
details: https://anonhg.NetBSD.org/src/rev/16a704def97f
branches: trunk
changeset: 780081:16a704def97f
user: rkujawa <rkujawa%NetBSD.org@localhost>
date: Wed Jul 11 17:13:30 2012 +0000
description:
Add support for all 4 slots of G-REX 4000D and G-REX 1200. Also add
(untested yet) DMA support for G-REX bridges.
diffstat:
sys/arch/amiga/conf/files.amiga | 3 +-
sys/arch/amiga/include/pci_machdep.h | 6 ++-
sys/arch/amiga/pci/p5pb.c | 66 ++++++++++++++++++++++++++++++------
sys/arch/amiga/pci/p5pbreg.h | 6 +-
sys/arch/m68k/m68k/bus_dma.c | 6 +-
5 files changed, 67 insertions(+), 20 deletions(-)
diffs (231 lines):
diff -r c5ca8c9cf1d5 -r 16a704def97f sys/arch/amiga/conf/files.amiga
--- a/sys/arch/amiga/conf/files.amiga Wed Jul 11 16:59:55 2012 +0000
+++ b/sys/arch/amiga/conf/files.amiga Wed Jul 11 17:13:30 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.amiga,v 1.159 2012/06/07 23:30:52 rkujawa Exp $
+# $NetBSD: files.amiga,v 1.160 2012/07/11 17:13:31 rkujawa Exp $
# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@@ -455,6 +455,7 @@
file arch/m68k/m68k/procfs_machdep.c procfs
file arch/m68k/m68k/sys_machdep.c
file arch/m68k/m68k/vm_machdep.c
+file arch/m68k/m68k/bus_dma.c
define gayle
file arch/amiga/amiga/gayle.c gayle
diff -r c5ca8c9cf1d5 -r 16a704def97f sys/arch/amiga/include/pci_machdep.h
--- a/sys/arch/amiga/include/pci_machdep.h Wed Jul 11 16:59:55 2012 +0000
+++ b/sys/arch/amiga/include/pci_machdep.h Wed Jul 11 17:13:30 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.6 2012/06/01 09:41:35 rkujawa Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.7 2012/07/11 17:13:31 rkujawa Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
#include <machine/intr.h>
-/* #define __HAVE_PCI_CONF_HOOK */
+#define __HAVE_PCI_CONF_HOOK
/*
* Forward declarations.
@@ -50,6 +50,8 @@
typedef u_long pcitag_t;
typedef u_long pci_intr_handle_t;
+extern struct m68k_bus_dma_tag pci_bus_dma_tag;
+
/*
* amiga-specific PCI structure and type definitions.
* NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
diff -r c5ca8c9cf1d5 -r 16a704def97f sys/arch/amiga/pci/p5pb.c
--- a/sys/arch/amiga/pci/p5pb.c Wed Jul 11 16:59:55 2012 +0000
+++ b/sys/arch/amiga/pci/p5pb.c Wed Jul 11 17:13:30 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: p5pb.c,v 1.8 2012/01/29 15:32:52 para Exp $ */
+/* $NetBSD: p5pb.c,v 1.9 2012/07/11 17:13:31 rkujawa Exp $ */
/*-
* Copyright (c) 2011, 2012 The NetBSD Foundation, Inc.
@@ -41,6 +41,7 @@
#include <uvm/uvm_extern.h>
+#define _M68K_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <machine/cpu.h>
@@ -67,6 +68,19 @@
#define P5GFX_DEPTH 8
#define P5GFX_LINEBYTES 640
+struct m68k_bus_dma_tag p5pb_bus_dma_tag = {
+ 0,
+ 0,
+ _bus_dmamap_create,
+ _bus_dmamap_destroy,
+ _bus_dmamap_load_direct,
+ _bus_dmamap_load_mbuf_direct,
+ _bus_dmamap_load_uio_direct,
+ _bus_dmamap_load_raw_direct,
+ _bus_dmamap_unload,
+ _bus_dmamap_sync
+};
+
static int p5pb_match(struct device *, struct cfdata *, void *);
static void p5pb_attach(struct device *, struct device *, void *);
void p5pb_set_props(struct p5pb_softc *sc);
@@ -193,7 +207,7 @@
pba.pba_iot = &(sc->pci_io_area);
pba.pba_memt = &(sc->pci_mem_area);
- pba.pba_dmat = NULL;
+ pba.pba_dmat = &p5pb_bus_dma_tag;
pba.pba_dmat64 = NULL;
pba.pba_pc = pc;
pba.pba_flags = PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY;
@@ -337,11 +351,26 @@
{
uint32_t data;
uint32_t bus, dev, func;
-
+ uint32_t offset;
+
pci_decompose_tag(pc, tag, &bus, &dev, &func);
+ offset = (OFF_PCI_DEVICE << dev) + reg;
+
+ if(func == 0) /* ugly, ugly hack */
+ offset += 0;
+ else if(func == 1)
+ offset += OFF_PCI_FUNCTION;
+ else
+ return 0xFFFFFFFF;
+
+ if(badaddr((void *)__UNVOLATILE(((uint32_t)
+ bus_space_vaddr(pc->pci_conf_datat, pc->pci_conf_datah)
+ + offset))))
+ return 0xFFFFFFFF;
+
data = bus_space_read_4(pc->pci_conf_datat, pc->pci_conf_datah,
- + reg + (dev * OFF_PCI_DEVICE));
+ offset);
#ifdef P5PB_DEBUG_CONF
aprint_normal("p5pb conf read va: %lx, bus: %d, dev: %d, "
"func: %d, reg: %d -r-> data %x\n",
@@ -354,11 +383,26 @@
p5pb_pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t val)
{
uint32_t bus, dev, func;
-
+ uint32_t offset;
+
pci_decompose_tag(pc, tag, &bus, &dev, &func);
-
+
+ offset = (OFF_PCI_DEVICE << dev) + reg;
+
+ if(func == 0) /* ugly, ugly hack */
+ offset += 0;
+ else if(func == 1)
+ offset += OFF_PCI_FUNCTION;
+ else
+ return;
+
+ if(badaddr((void *)__UNVOLATILE(((uint32_t)
+ bus_space_vaddr(pc->pci_conf_datat, pc->pci_conf_datah)
+ + offset))))
+ return;
+
bus_space_write_4(pc->pci_conf_datat, pc->pci_conf_datah,
- + reg + (dev * OFF_PCI_DEVICE), val);
+ offset, val);
#ifdef P5PB_DEBUG_CONF
aprint_normal("p5pb conf write va: %lx, bus: %d, dev: %d, "
"func: %d, reg: %d -w-> data %x\n",
@@ -378,14 +422,14 @@
p5pb_pci_bus_maxdevs_grex4000(pci_chipset_tag_t pc, int busno)
{
/* G-REX 4000 has 4, G-REX 4000T has 3 slots? */
- return 1; /* XXX: 4 not yet! */
+ return 4;
}
int
p5pb_pci_bus_maxdevs_grex1200(pci_chipset_tag_t pc, int busno)
{
/* G-REX 1200 has 5 slots. */
- return 1; /* XXX: 5 not yet! */
+ return 4; /* XXX: 5 not yet! */
}
void
@@ -456,7 +500,7 @@
EX_NOWAIT);
memext = extent_create("p5pbmem", sc->pci_mem_lowest,
- sc->pci_mem_highest, NULL, 0, EX_NOWAIT);
+ sc->pci_mem_highest - 1, NULL, 0, EX_NOWAIT);
if ( (!ioext) || (!memext) )
return false;
@@ -515,7 +559,7 @@
sc->apc.pci_conf_datat = &(sc->pci_conf_area);
if (bus_space_map(sc->apc.pci_conf_datat, OFF_PCI_CONF_DATA,
- 256, 0, &sc->apc.pci_conf_datah))
+ P5BUS_PCI_CONF_SIZE, 0, &sc->apc.pci_conf_datah))
return false;
return true;
diff -r c5ca8c9cf1d5 -r 16a704def97f sys/arch/amiga/pci/p5pbreg.h
--- a/sys/arch/amiga/pci/p5pbreg.h Wed Jul 11 16:59:55 2012 +0000
+++ b/sys/arch/amiga/pci/p5pbreg.h Wed Jul 11 17:13:30 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: p5pbreg.h,v 1.6 2012/01/19 00:14:08 rkujawa Exp $ */
+/* $NetBSD: p5pbreg.h,v 1.7 2012/07/11 17:13:31 rkujawa Exp $ */
/*-
* Copyright (c) 2011, 2012 The NetBSD Foundation, Inc.
@@ -52,8 +52,8 @@
#define P5BUS_PCI_CONF_BASE 0xFFFC0000
#define P5BUS_PCI_CONF_SIZE 0x00020000 /* up to 128kB */
-#define OFF_PCI_CONF_DATA 0x00001000 /* also 0 on CVPPC */
-#define OFF_PCI_DEVICE 0x00002000
+#define OFF_PCI_CONF_DATA 0x00000000 /* also 0 on CVPPC */
+#define OFF_PCI_DEVICE 0x00001000
#define OFF_PCI_FUNCTION 0x00000100
#define P5BUS_PCI_IO_BASE 0xFFFA0000
diff -r c5ca8c9cf1d5 -r 16a704def97f sys/arch/m68k/m68k/bus_dma.c
--- a/sys/arch/m68k/m68k/bus_dma.c Wed Jul 11 16:59:55 2012 +0000
+++ b/sys/arch/m68k/m68k/bus_dma.c Wed Jul 11 17:13:30 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.32 2011/09/19 19:17:05 rkujawa Exp $ */
+/* $NetBSD: bus_dma.c,v 1.33 2012/07/11 17:13:30 rkujawa Exp $ */
/*
* This file was taken from from alpha/common/bus_dma.c
@@ -41,7 +41,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.32 2011/09/19 19:17:05 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.33 2012/07/11 17:13:30 rkujawa Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -152,7 +152,7 @@
/*
* Get the physical address for this segment.
*/
- rv = pmap_extract(pmap, vaddr, &curaddr);
+ rv = pmap_extract(pmap, vaddr, (paddr_t *) &curaddr);
KASSERT(rv);
cacheable = _pmap_page_is_cacheable(pmap, vaddr);
Home |
Main Index |
Thread Index |
Old Index