Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 If we have sparse PCI spaces we can...



details:   https://anonhg.NetBSD.org/src/rev/13cfab8f6de9
branches:  trunk
changeset: 486531:13cfab8f6de9
user:      eeh <eeh%NetBSD.org@localhost>
date:      Wed May 24 20:24:58 2000 +0000

description:
If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space.  Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in.  Instead we use MMU bypass ASI accesses to read
and write PCI config space.

diffstat:

 sys/arch/sparc64/sparc64/machdep.c |  46 +++++++++++++++++++++++--------------
 1 files changed, 29 insertions(+), 17 deletions(-)

diffs (100 lines):

diff -r a754e55c8d96 -r 13cfab8f6de9 sys/arch/sparc64/sparc64/machdep.c
--- a/sys/arch/sparc64/sparc64/machdep.c        Wed May 24 19:53:11 2000 +0000
+++ b/sys/arch/sparc64/sparc64/machdep.c        Wed May 24 20:24:58 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.60 2000/04/22 17:06:06 mrg Exp $ */
+/*     $NetBSD: machdep.c,v 1.61 2000/05/24 20:24:58 eeh Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -169,7 +169,7 @@
 int bus_type_asi[] = {
        ASI_PRIMARY,
        ASI_PRIMARY,
-       ASI_PRIMARY,
+       ASI_PHYS_NON_CACHED_LITTLE,             /* PCI configuration space */
        ASI_PRIMARY,
        ASI_PRIMARY,
        0
@@ -1234,6 +1234,7 @@
                /* Nothing to do */
                break;
        default:
+               __asm("membar #Sync" : );
                printf("_bus_dmamap_sync: unknown sync op\n");
        }
 }
@@ -1480,6 +1481,7 @@
        paddr_t pm_flags;
 static vaddr_t iobase = IODEV_BASE;
 
+       t->type = iospace;
        if (iobase == NULL)
                iobase = IODEV_BASE;
 
@@ -1488,6 +1490,28 @@
                printf("sparc_bus_map: zero size\n");
                return (EINVAL);
        }
+       switch (iospace) {
+       case PCI_CONFIG_BUS_SPACE:
+               /* 
+                * PCI config space is special.
+                *
+                * It's really big and seldom used.  In order not to run
+                * out of IO mappings, config space will not be mapped in,
+                * rather it will be accessed through MMU bypass ASI accesses.
+                */
+               *hp = (bus_space_handle_t)addr;
+               if (!vaddr) return (0);
+               /* FALLTHROUGH */
+       case PCI_IO_BUS_SPACE:
+               pm_flags = PMAP_NC|PMAP_LITTLE;
+               break;
+       case PCI_MEMORY_BUS_SPACE:
+               pm_flags = PMAP_LITTLE|PMAP_NC;
+               break;
+       default:
+               pm_flags = PMAP_NC;
+               break;
+       }
 
        if (vaddr)
                v = trunc_page(vaddr);
@@ -1507,18 +1531,6 @@
        printf("\nsparc_bus_map: type %x addr %016llx virt %llx paddr %016llx\n",
                       (int)iospace, (u_int64_t)addr, (u_int64_t)*hp, (u_int64_t)pa);
 #endif
-       switch (iospace) {
-       case PCI_CONFIG_BUS_SPACE:
-       case PCI_IO_BUS_SPACE:
-               pm_flags = PMAP_NC|PMAP_LITTLE;
-               break;
-       case PCI_MEMORY_BUS_SPACE:
-               pm_flags = PMAP_LITTLE|PMAP_NC;
-               break;
-       default:
-               pm_flags = PMAP_NC;
-               break;
-       }
 
        do {
 #ifdef NOTDEF_DEBUG
@@ -1576,14 +1588,14 @@
        void            *arg;
 {
        bus_space_handle_t bh;
-       caddr_t tmp;
+       paddr_t tmp;
        int result;
 
        if (bus_space_map2(tag, btype, paddr, size, flags, TMPMAP_VA, &bh) != 0)
                return (0);
 
-       tmp = (caddr_t)(u_long)bh;
-       result = (probeget((u_long)tmp + offset, bus_type_asi[tag->type], size) != -1);
+       tmp = (paddr_t)bh;
+       result = (probeget(tmp + offset, bus_type_asi[tag->type], size) != -1);
        if (result && callback != NULL)
                result = (*callback)(tmp, arg);
        bus_space_unmap(tag, bh, size);



Home | Main Index | Thread Index | Old Index