Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/dreamcast/dev/g2 Fixed the last raw accesses to use...



details:   https://anonhg.NetBSD.org/src/rev/8be07c89f368
branches:  trunk
changeset: 503147:8be07c89f368
user:      marcus <marcus%NetBSD.org@localhost>
date:      Thu Feb 01 19:35:04 2001 +0000

description:
Fixed the last raw accesses to use bus_space.  Also added DMA mem size field.

diffstat:

 sys/arch/dreamcast/dev/g2/gapspci.c     |  41 +++++++++++++++++++++-----------
 sys/arch/dreamcast/dev/g2/gapspci_dma.c |   6 ++--
 sys/arch/dreamcast/dev/g2/gapspcivar.h  |   4 ++-
 3 files changed, 33 insertions(+), 18 deletions(-)

diffs (119 lines):

diff -r 7026f57c80fb -r 8be07c89f368 sys/arch/dreamcast/dev/g2/gapspci.c
--- a/sys/arch/dreamcast/dev/g2/gapspci.c       Thu Feb 01 19:29:59 2001 +0000
+++ b/sys/arch/dreamcast/dev/g2/gapspci.c       Thu Feb 01 19:35:04 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gapspci.c,v 1.1 2001/02/01 01:04:55 thorpej Exp $      */
+/*     $NetBSD: gapspci.c,v 1.2 2001/02/01 19:35:04 marcus Exp $       */
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -67,14 +67,20 @@
 int
 gaps_match(struct device *parent, struct cfdata *match, void *aux)
 {
-  /*   struct g2bus_attach_args *ga = aux; */
+       struct g2bus_attach_args *ga = aux;
        char idbuf[16];
+       bus_space_handle_t tmp_memh;
 
        if(strcmp("gapspci", match->cf_driver->cd_name))
                return 0;
 
-       /* FIXME */
-       memcpy(idbuf, (void *)0xa1001400, sizeof(idbuf));
+       if (bus_space_map(ga->ga_memt, 0x01001400, 0x100, 0, &tmp_memh) != 0)
+               return 0;
+
+       bus_space_read_region_1(ga->ga_memt, tmp_memh, 0,
+                               idbuf, sizeof(idbuf));
+
+       bus_space_unmap(ga->ga_memt, tmp_memh, 0x100);
 
        if(strncmp(idbuf, "GAPSPCI_BRIDGE_2", 16))
                return 0;
@@ -92,23 +98,30 @@
 
        printf(": SEGA GAPS PCI Bridge\n");
 
-       sc->sc_dmabase = 0x1840000;
        sc->sc_memt = ga->ga_memt;
 
-  /* FIXME */  
-       *(volatile unsigned int *)(void *)(0xa1001418) = 0x5a14a501;
+       sc->sc_dmabase = 0x1840000;
+       sc->sc_dmasize = 32768;
+
+       if (bus_space_map(sc->sc_memt, 0x01001400, 0x100,
+                         0, &sc->sc_gaps_memh) != 0)
+               panic("gaps_attach: can't map GAPS register space");
+
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x18, 0x5a14a501);
 
        for(i=0; i<1000000; i++)
          ;
        
-       if(*(volatile unsigned int *)(void *)(0xa1001418) != 1)
-         return;
+       if(bus_space_read_4(sc->sc_memt, sc->sc_gaps_memh, 0x18) != 1)
+               panic("gaps_attach: GAPS PCI bridge not responding");
 
-       *(volatile unsigned int *)(void *)(0xa1001420) = 0x1000000;
-       *(volatile unsigned int *)(void *)(0xa1001424) = 0x1000000;
-       *(volatile unsigned int *)(void *)(0xa1001428) = sc->sc_dmabase;
-       *(volatile unsigned int *)(void *)(0xa1001414) = 1;
-       *(volatile unsigned int *)(void *)(0xa1001434) = 1;
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x20, 0x1000000);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x24, 0x1000000);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x28, sc->sc_dmabase);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x2c,
+                         sc->sc_dmabase + sc->sc_dmasize);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x14, 1);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x34, 1);
 
        gaps_pci_init(sc);
        gaps_dma_init(sc);
diff -r 7026f57c80fb -r 8be07c89f368 sys/arch/dreamcast/dev/g2/gapspci_dma.c
--- a/sys/arch/dreamcast/dev/g2/gapspci_dma.c   Thu Feb 01 19:29:59 2001 +0000
+++ b/sys/arch/dreamcast/dev/g2/gapspci_dma.c   Thu Feb 01 19:35:04 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gapspci_dma.c,v 1.1 2001/02/01 01:04:55 thorpej Exp $  */
+/*     $NetBSD: gapspci_dma.c,v 1.2 2001/02/01 19:35:04 marcus Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -114,10 +114,10 @@
         * with an extent map.
         */
        sc->sc_dma_ex = extent_create("gaps dma",
-           sc->sc_dmabase, sc->sc_dmabase + (32768 - 1),
+           sc->sc_dmabase, sc->sc_dmabase + (sc->sc_dmasize - 1),
            M_DEVBUF, NULL, 0, EX_WAITOK | EXF_NOCOALESCE);
 
-       if (bus_space_map(sc->sc_memt, sc->sc_dmabase, 32768,
+       if (bus_space_map(sc->sc_memt, sc->sc_dmabase, sc->sc_dmasize,
            0, &sc->sc_dma_memh) != 0)
                panic("gaps_dma_init: can't map SRAM buffer");
 }
diff -r 7026f57c80fb -r 8be07c89f368 sys/arch/dreamcast/dev/g2/gapspcivar.h
--- a/sys/arch/dreamcast/dev/g2/gapspcivar.h    Thu Feb 01 19:29:59 2001 +0000
+++ b/sys/arch/dreamcast/dev/g2/gapspcivar.h    Thu Feb 01 19:35:04 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gapspcivar.h,v 1.1 2001/02/01 01:04:55 thorpej Exp $   */
+/*     $NetBSD: gapspcivar.h,v 1.2 2001/02/01 19:35:04 marcus Exp $    */
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -38,11 +38,13 @@
 struct gaps_softc {
        struct device sc_dev;
        bus_space_tag_t sc_memt;
+       bus_space_handle_t sc_gaps_memh;
        bus_space_handle_t sc_pci_memh;
        bus_space_handle_t sc_dma_memh;
        struct dreamcast_pci_chipset sc_pc;
        struct dreamcast_bus_dma_tag sc_dmat;
        paddr_t sc_dmabase;
+       size_t sc_dmasize;
        struct extent *sc_dma_ex;
 };
 



Home | Main Index | Thread Index | Old Index