Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci - Force the memory mapping uncacheable.



details:   https://anonhg.NetBSD.org/src/rev/3007f7af038e
branches:  trunk
changeset: 500003:3007f7af038e
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Dec 03 13:05:14 2000 +0000

description:
- Force the memory mapping uncacheable.
- We don't need a record of the I/O space mapping.

diffstat:

 sys/dev/pci/iop_pci.c |  43 ++++++++++++++++++++-----------------------
 1 files changed, 20 insertions(+), 23 deletions(-)

diffs (81 lines):

diff -r 01178e673181 -r 3007f7af038e sys/dev/pci/iop_pci.c
--- a/sys/dev/pci/iop_pci.c     Sun Dec 03 13:03:30 2000 +0000
+++ b/sys/dev/pci/iop_pci.c     Sun Dec 03 13:05:14 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iop_pci.c,v 1.1 2000/11/08 19:45:30 ad Exp $   */
+/*     $NetBSD: iop_pci.c,v 1.2 2000/12/03 13:05:14 ad Exp $   */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -73,8 +73,8 @@
 iop_pci_match(struct device *parent, struct cfdata *match, void *aux)
 {
        struct pci_attach_args *pa;
-       
-       pa = (struct pci_attach_args *)aux;
+
+       pa = aux;
 
        /* 
         * Look for an "intelligent I/O processor" that adheres to the I2O
@@ -98,43 +98,40 @@
        pci_intr_handle_t ih;
        const char *intrstr;
        pcireg_t reg;
-       int i;
-       
+       int i, flags, rv;
+
        sc = (struct iop_softc *)self;
        pa = (struct pci_attach_args *)aux;
        pc = pa->pa_pc;
        printf(": ");
 
-       /* 
-        * Record the first two regions that we find describing I/O space
-        * and memory space.  These are needed when we fill the IOP system
-        * table.  The kernel always uses the memory mapping to communicate
+       /*
+        * The kernel always uses the first memory mapping to communicate
         * with the IOP.
         */
        for (i = PCI_MAPREG_START; i < PCI_MAPREG_END; i += 4) {
                reg = pci_conf_read(pc, pa->pa_tag, i);
-               if (PCI_MAPREG_TYPE(reg) == PCI_MAPREG_TYPE_IO)
-                       break;
-       }
-       sc->sc_ioaddr = PCI_MAPREG_IO_ADDR(reg);
-       sc->sc_iosize = PCI_MAPREG_IO_SIZE(reg);
-
-       for (i = PCI_MAPREG_START; i < PCI_MAPREG_END; i += 4) {
-               reg = pci_conf_read(pc, pa->pa_tag, i);
                if (PCI_MAPREG_TYPE(reg) == PCI_MAPREG_TYPE_MEM)
                        break;
        }
-       sc->sc_memaddr = PCI_MAPREG_MEM_ADDR(reg);
-       sc->sc_memsize = PCI_MAPREG_MEM_SIZE(reg);
-
        if (i == PCI_MAPREG_END) {
                printf("can't find mapping\n");
                return;
        }
 
-       /* XXX We should limit the size of the mapping. */
-       if (pci_mapreg_map(pa, i, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_iot, 
-           &sc->sc_ioh, NULL, NULL)) {
+       /*
+        * Map the register window as uncacheable.
+        */
+       rv = pci_mapreg_info(pa->pa_pc, pa->pa_tag, i,
+           PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
+           &sc->sc_memaddr, &sc->sc_memsize, &flags);
+       if (rv == 0) {
+               flags &= ~BUS_SPACE_MAP_PREFETCHABLE;
+               rv = bus_space_map(pa->pa_memt, sc->sc_memaddr, sc->sc_memsize,
+                   flags, &sc->sc_ioh);
+               sc->sc_iot = pa->pa_memt;
+       }
+       if (rv != 0) {
                printf("can't map board\n");
                return;
        }



Home | Main Index | Thread Index | Old Index