diff options
author | jhb <jhb@FreeBSD.org> | 2009-03-05 15:28:46 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-03-05 15:28:46 +0000 |
commit | c99b9aca9c2962ef4be1bf3cda8d110e16faab67 (patch) | |
tree | e781396c291762a35a9c98ab1879af7f38c227f3 | |
parent | 9d2aa84a7ad0a2b35c0f60cb92df273ced7fb87a (diff) | |
download | FreeBSD-src-c99b9aca9c2962ef4be1bf3cda8d110e16faab67.zip FreeBSD-src-c99b9aca9c2962ef4be1bf3cda8d110e16faab67.tar.gz |
Honor the prefetchable flag in memory BARs by setting the RF_PREFETCHABLE
flag when calling bus_alloc_resource() to allocate resources from a parent
PCI bridge. For PCI-PCI bridges this asks the bridge to satisfy the
request using the prefetchable memory range rather than the normal
memory range.
Reviewed by: imp
Reported by: scottl
MFC after: 1 week
-rw-r--r-- | sys/dev/pci/pci.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index df732ef..2eaff39 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -2313,9 +2313,11 @@ pci_add_map(device_t pcib, device_t bus, device_t dev, PCIB_WRITE_CONFIG(pcib, b, s, f, reg, map, 4); PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2); - if (PCI_BAR_MEM(map)) + if (PCI_BAR_MEM(map)) { type = SYS_RES_MEMORY; - else + if (map & PCIM_BAR_MEM_PREFETCH) + prefetch = 1; + } else type = SYS_RES_IOPORT; ln2size = pci_mapsize(testval); ln2range = pci_maprange(testval); @@ -3488,6 +3490,8 @@ pci_alloc_map(device_t dev, device_t child, int type, int *rid, count = 1UL << mapsize; if (RF_ALIGNMENT(flags) < mapsize) flags = (flags & ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize); + if (PCI_BAR_MEM(testval) && (testval & PCIM_BAR_MEM_PREFETCH)) + flags |= RF_PREFETCHABLE; /* * Allocate enough resource, and then write back the |