diff options
author | John Baldwin <jhb@FreeBSD.org> | 2009-03-05 15:28:46 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2009-03-05 15:28:46 +0000 |
commit | d004885d3a458502c42e379ec19b024e5efcbb08 (patch) | |
tree | e781396c291762a35a9c98ab1879af7f38c227f3 /sys/dev/pci | |
parent | 9f960e98aa627a0242b65911cfa1c1cf9d3031e6 (diff) | |
download | src-d004885d3a458502c42e379ec19b024e5efcbb08.tar.gz src-d004885d3a458502c42e379ec19b024e5efcbb08.zip |
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
Notes
Notes:
svn path=/head/; revision=189400
Diffstat (limited to 'sys/dev/pci')
-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 df732ef21663..2eaff39c95bf 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 |