Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Activate PCI memory-mapped I/O access in the PCI...



details:   https://anonhg.NetBSD.org/src/rev/52f8a3581276
branches:  trunk
changeset: 753323:52f8a3581276
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Mon Mar 22 22:39:48 2010 +0000

description:
Activate PCI memory-mapped I/O access in the PCI Control and Status
Register if the PCI BAR is the memory-mapped type.  The driver used to
decide whether to activate memory-mapped access by testing the truth of
pci_attach_args.pa_memt; that isn't MI, and it doesn't make sense.

diffstat:

 sys/dev/pci/viaide.c |  30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diffs (58 lines):

diff -r eba96185c56d -r 52f8a3581276 sys/dev/pci/viaide.c
--- a/sys/dev/pci/viaide.c      Mon Mar 22 22:36:07 2010 +0000
+++ b/sys/dev/pci/viaide.c      Mon Mar 22 22:39:48 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: viaide.c,v 1.68 2010/02/24 22:38:01 dyoung Exp $       */
+/*     $NetBSD: viaide.c,v 1.69 2010/03/22 22:39:48 dyoung Exp $       */
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.68 2010/02/24 22:38:01 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.69 2010/03/22 22:39:48 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -851,18 +851,6 @@
        pciide_mapreg_dma(sc, pa);
        aprint_verbose("\n");
 
-       /*
-        * Enable memory-space access if it isn't already there.
-        */
-       if (pa->pa_memt && (pa->pa_flags & PCI_FLAGS_MEM_ENABLED) == 0) {
-               pcireg_t csr;
-
-               pa->pa_flags |= PCI_FLAGS_MEM_ENABLED;
-               csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
-               pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
-                              csr | PCI_COMMAND_MEM_ENABLE);
-       }
-
        if (sc->sc_dma_ok) {
                sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_UDMA | ATAC_CAP_DMA;
                sc->sc_wdcdev.irqack = pciide_irqack;
@@ -890,6 +878,20 @@
                    NULL, &satasize);
                break;
        case PCI_MAPREG_MEM_TYPE_32BIT:
+               /*
+                * Enable memory-space access if it isn't already there.
+                */
+               if ((pa->pa_flags & PCI_FLAGS_MEM_ENABLED) == 0) {
+                       pcireg_t csr;
+
+                       pa->pa_flags |= PCI_FLAGS_MEM_ENABLED;
+                       csr = pci_conf_read(pa->pa_pc, pa->pa_tag,
+                           PCI_COMMAND_STATUS_REG);
+                       pci_conf_write(pa->pa_pc, pa->pa_tag,
+                           PCI_COMMAND_STATUS_REG,
+                           csr | PCI_COMMAND_MEM_ENABLE);
+               }
+
                ret = pci_mapreg_map(pa, PCI_MAPREG_START + 0x14,
                    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
                    0, &sc->sc_ba5_st, &sc->sc_ba5_sh,



Home | Main Index | Thread Index | Old Index