Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Support 64bit BAR.



details:   https://anonhg.NetBSD.org/src/rev/c2a6aeba6118
branches:  trunk
changeset: 1025506:c2a6aeba6118
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Nov 10 14:36:28 2021 +0000

description:
Support 64bit BAR.

diffstat:

 sys/dev/pci/sdhc_pci.c |  21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r 7a273623756f -r c2a6aeba6118 sys/dev/pci/sdhc_pci.c
--- a/sys/dev/pci/sdhc_pci.c    Wed Nov 10 07:58:44 2021 +0000
+++ b/sys/dev/pci/sdhc_pci.c    Wed Nov 10 14:36:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhc_pci.c,v 1.17 2020/01/01 23:28:31 mlelstv Exp $    */
+/*     $NetBSD: sdhc_pci.c,v 1.18 2021/11/10 14:36:28 msaitoh Exp $    */
 /*     $OpenBSD: sdhc_pci.c,v 1.7 2007/10/30 18:13:45 chl Exp $        */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.17 2020/01/01 23:28:31 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.18 2021/11/10 14:36:28 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -252,6 +252,7 @@
        bus_space_handle_t ioh;
        bus_size_t size;
        uint32_t flags;
+       int width;
        char intrbuf[PCI_INTRSTR_LEN];
 
        sc->sc.sc_dev = self;
@@ -313,13 +314,23 @@
        if ((PCI_INTERFACE(pa->pa_class) == SDHC_PCI_INTERFACE_DMA))
                SET(sc->sc.sc_flags, SDHC_FLAG_USE_DMA);
 
-       /* XXX: handle 64-bit BARs */
        cnt = 0;
        for (reg = SDHC_PCI_BAR_START + SDHC_PCI_FIRST_BAR(slotinfo) *
                 sizeof(uint32_t);
             reg < SDHC_PCI_BAR_END && nslots > 0;
-            reg += sizeof(uint32_t), nslots--) {
-               if (pci_mapreg_map(pa, reg, PCI_MAPREG_TYPE_MEM, 0,
+            reg += width, nslots--) {
+               pcireg_t type;
+
+               type = pci_mapreg_type(pa->pa_pc, pa->pa_tag, reg);
+               if (type == PCI_MAPREG_TYPE_IO)
+                       break;
+               else if (PCI_MAPREG_MEM_TYPE(type)
+                   == PCI_MAPREG_MEM_TYPE_64BIT)
+                       width = 8;
+               else
+                       width = 4;
+
+               if (pci_mapreg_map(pa, reg, type, 0,
                    &iot, &ioh, NULL, &size)) {
                        continue;
                }



Home | Main Index | Thread Index | Old Index