Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/ixp12x0 change flags of pmap_enter() in ixp12x0...



details:   https://anonhg.NetBSD.org/src/rev/a5973fe7e253
branches:  trunk
changeset: 540261:a5973fe7e253
user:      ichiro <ichiro%NetBSD.org@localhost>
date:      Sun Dec 08 13:21:44 2002 +0000

description:
change flags of pmap_enter() in ixp12x0_io.c, ixpsip_io.c
bug fix: ixp12x0_pci.c

diffstat:

 sys/arch/arm/ixp12x0/ixp12x0_io.c  |  11 +++++----
 sys/arch/arm/ixp12x0/ixp12x0_pci.c |  42 +++++++++++++++++++++++--------------
 sys/arch/arm/ixp12x0/ixpsip_io.c   |   5 ++-
 3 files changed, 35 insertions(+), 23 deletions(-)

diffs (140 lines):

diff -r 47dd7b363244 -r a5973fe7e253 sys/arch/arm/ixp12x0/ixp12x0_io.c
--- a/sys/arch/arm/ixp12x0/ixp12x0_io.c Sun Dec 08 11:20:22 2002 +0000
+++ b/sys/arch/arm/ixp12x0/ixp12x0_io.c Sun Dec 08 13:21:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp12x0_io.c,v 1.2 2002/09/27 15:35:48 provos Exp $ */
+/*     $NetBSD: ixp12x0_io.c,v 1.3 2002/12/08 13:21:44 ichiro Exp $ */
 
 /*
  * Copyright (c) 2002
@@ -189,14 +189,14 @@
        paddr_t pa, endpa;
        vaddr_t va;
 
-       if ((bpa + size) >= IXP12X0_PCI_MEM_SIZE)
+       if ((bpa + size) >= IXP12X0_PCI_MEM_VBASE + IXP12X0_PCI_MEM_SIZE)
                return (EINVAL);
        /*
         * PCI MEM space is mapped same address as real memory
         */
 
-       pa = trunc_page(bpa + IXP12X0_PCI_MEM_VBASE);
-       endpa = round_page((bpa + IXP12X0_PCI_MEM_VBASE) + size);
+       pa = trunc_page(bpa);
+       endpa = round_page(bpa + size);
 
        /* XXX use extent manager to check duplicate mapping */
 
@@ -209,7 +209,8 @@
 
        for(; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
                pmap_enter(pmap_kernel(), va, pa,
-                   VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
+                   VM_PROT_READ | VM_PROT_WRITE,
+                   VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED);
        }
        pmap_update(pmap_kernel());
 
diff -r 47dd7b363244 -r a5973fe7e253 sys/arch/arm/ixp12x0/ixp12x0_pci.c
--- a/sys/arch/arm/ixp12x0/ixp12x0_pci.c        Sun Dec 08 11:20:22 2002 +0000
+++ b/sys/arch/arm/ixp12x0/ixp12x0_pci.c        Sun Dec 08 13:21:44 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixp12x0_pci.c,v 1.2 2002/10/09 00:11:15 thorpej Exp $ */
+/* $NetBSD: ixp12x0_pci.c,v 1.3 2002/12/08 13:21:44 ichiro Exp $ */
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -65,7 +65,17 @@
 pcireg_t ixp12x0_pci_conf_read(void *, pcitag_t, int);
 void ixp12x0_pci_conf_write(void *, pcitag_t, int, pcireg_t);
 
-#define        MAX_PCI_DEVICES 21
+#define        MAX_PCI_DEVICES 4
+
+/*
+ * IXM1200 PCI configuration Cycles
+ *  Device               Address
+ * -------------------------------------
+ *   0    IXP1200        0x0800 - 0x08FF
+ *   1    i21555         0x1000 - 0x10FF
+ *   2    i82559         0x2000 - 0x20FF
+ *   3    PMC expansion  0x4000 - 0x40FF
+ */
 
 void
 ixp12x0_pci_init(pc, cookie)
@@ -115,6 +125,10 @@
        printf("ixp12x0_pci_make_tag(v=%p, bus=%d, device=%d, function=%d)\n",
                v, bus, device, function);
 #endif
+#ifdef PCI_DEBUG2
+       printf("ixp12x0_pci_make_tag return = 0x%x\n", 
+               ((bus << 16) | (device << 11) | (function << 8)));
+#endif
        return ((bus << 16) | (device << 11) | (function << 8));
 }
 
@@ -149,13 +163,9 @@
 
        ixp12x0_pci_decompose_tag(v, tag, &bus, &device, &function);
 
-        if (bus != 0)
-               address = IXP12X0_PCI_TYPE1_VBASE | ((bus & 0xff) << 16) |
-                         ((device & 0x1F) << 8) | (offset & 0xff);
-       else /* bus == 0 */
-               address = IXP12X0_PCI_TYPE0_VBASE | 0xc00000 | 
-                         ((device &0x1f) << 3 | (function & 0x7)) << 8 |
-                         (offset & 0xff);
+       /* bus == 0 */
+       address = IXP12X0_PCI_TYPE0_VBASE |
+                 ((0x1) << (device)) << 11 | (offset & 0xff); /* XXX */
 
        val = *((unsigned int *)address);
 
@@ -163,6 +173,9 @@
        printf("ixp12x0_pci_conf_read(addr=%08x)(v=%p tag=0x%08lx offset=0x%02x)=0x%08x\n",
                address, v, tag, offset, val);
 #endif
+#ifdef PCI_DEBUG2
+       printf("ixp12x0_pci_conf_read(addr=%08x)(bus=0x%08x device=0x%08x function=0x%08x offset=0x%02x)\n", address, bus, device, function, offset);
+#endif
        return(val);
 }
 
@@ -178,13 +191,10 @@
 
        ixp12x0_pci_decompose_tag(v, tag, &bus, &device, &function);
 
-        if (bus != 0)
-               address = IXP12X0_PCI_TYPE1_VBASE | ((bus & 0xff) << 16) |
-                         ((device & 0x1F) << 8) | (offset & 0xff);
-       else /* bus == 0 */
-               address = IXP12X0_PCI_TYPE0_VBASE | 0xc00000 | 
-                         ((device &0x1f) << 3 | (function & 0x7)) << 8 |
-                         (offset & 0xff);
+       /* bus == 0 */
+       address = IXP12X0_PCI_TYPE0_VBASE |
+                 ((0x1) << (device)) << 11 | (offset & 0xff); /* XXX */
+
 
 #ifdef PCI_DEBUG
        printf("ixp12x0_pci_conf_write(addr=%08x)(v=%p tag=0x%08lx offset=0x%02x)=0x%08x\n",
diff -r 47dd7b363244 -r a5973fe7e253 sys/arch/arm/ixp12x0/ixpsip_io.c
--- a/sys/arch/arm/ixp12x0/ixpsip_io.c  Sun Dec 08 11:20:22 2002 +0000
+++ b/sys/arch/arm/ixp12x0/ixpsip_io.c  Sun Dec 08 13:21:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixpsip_io.c,v 1.2 2002/09/27 15:35:48 provos Exp $ */
+/*     $NetBSD: ixpsip_io.c,v 1.3 2002/12/08 13:21:44 ichiro Exp $ */
 
 /*
  * Copyright (c) 2002
@@ -159,7 +159,8 @@
        *bshp = va + (bpa & PAGE_MASK);
        for(; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
                pmap_enter(pmap_kernel(), va, pa,
-                   VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
+                   VM_PROT_READ | VM_PROT_WRITE,
+                   VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED);
        }
        pmap_update(pmap_kernel());
 



Home | Main Index | Thread Index | Old Index