Hi All,

dlg@ managed to get access to a machine that actually uses 64-bit PCI
addresses behind a bridge.  This triggered some bugs in the so far
untested code.  Quelle suprprise!

I'd appreciate it if some people can verify that this doesn't break
other systems.  In particular I'm looking for testers on server-type
machines, both i386 and amd64.

Thanks,

Mark


Index: pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/pci.c,v
retrieving revision 1.106
diff -u -p -r1.106 pci.c
--- pci.c       26 Oct 2014 16:18:42 -0000      1.106
+++ pci.c       20 Nov 2014 09:04:51 -0000
@@ -936,6 +936,12 @@ pci_reserve_resources(struct pci_attach_
        blr = pci_conf_read(pc, tag, PPB_REG_PREFMEM);
        base = (blr & 0x0000fff0) << 16;
        limit = (blr & 0xfff00000) | 0x000fffff;
+#ifdef __LP64__
+       blr = pci_conf_read(pc, pa->pa_tag, PPB_REG_PREFBASE_HI32);
+       base |= ((uint64_t)blr) << 32;
+       blr = pci_conf_read(pc, pa->pa_tag, PPB_REG_PREFLIM_HI32);
+       limit |= ((uint64_t)blr) << 32;
+#endif
        if (limit > base)
                size = (limit - base + 1);
        else
Index: ppb.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ppb.c,v
retrieving revision 1.59
diff -u -p -r1.59 ppb.c
--- ppb.c       15 Sep 2014 14:22:07 -0000      1.59
+++ ppb.c       20 Nov 2014 09:04:51 -0000
@@ -261,7 +261,7 @@ ppbattach(struct device *parent, struct 
                name = malloc(32, M_DEVBUF, M_NOWAIT);
                if (name) {
                        snprintf(name, 32, "%s pcimem", sc->sc_dev.dv_xname);
-                       sc->sc_memex = extent_create(name, 0, 0xffffffff,
+                       sc->sc_memex = extent_create(name, 0, (u_long)-1L,
                            M_DEVBUF, NULL, 0, EX_NOWAIT | EX_FILLED);
                        extent_free(sc->sc_memex, sc->sc_membase,
                            sc->sc_memlimit - sc->sc_membase + 1,
@@ -273,7 +273,7 @@ ppbattach(struct device *parent, struct 
        blr = pci_conf_read(pc, pa->pa_tag, PPB_REG_PREFMEM);
        sc->sc_pmembase = (blr & 0x0000fff0) << 16;
        sc->sc_pmemlimit = (blr & 0xfff00000) | 0x000fffff;
-#ifdef __LP64__        /* XXX because extents use long... */
+#ifdef __LP64__
        blr = pci_conf_read(pc, pa->pa_tag, PPB_REG_PREFBASE_HI32);
        sc->sc_pmembase |= ((uint64_t)blr) << 32;
        blr = pci_conf_read(pc, pa->pa_tag, PPB_REG_PREFLIM_HI32);

Reply via email to