diff options
author | jhb <jhb@FreeBSD.org> | 2014-02-05 19:24:16 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-02-05 19:24:16 +0000 |
commit | a8e0d205e9d59f91d4990734067ccfc6f924f49c (patch) | |
tree | 496a47e871595ad8ad4ae9ab79f6841872974518 /sys/dev/pci/pci.c | |
parent | dccd0931e63e1eac87760621b123aab50d03c7b4 (diff) | |
download | FreeBSD-src-a8e0d205e9d59f91d4990734067ccfc6f924f49c.zip FreeBSD-src-a8e0d205e9d59f91d4990734067ccfc6f924f49c.tar.gz |
Properly set the alignment flags when allocating the initial range for a
BAR. This only really matters when pci_do_realloc_bars is enabled and
the initial allocation of a specific range fails.
MFC after: 1 week
Diffstat (limited to 'sys/dev/pci/pci.c')
-rw-r--r-- | sys/dev/pci/pci.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 84aab9d..ed55ffb 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -2742,7 +2742,7 @@ pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl, struct pci_map *pm; pci_addr_t base, map, testval; pci_addr_t start, end, count; - int barlen, basezero, maprange, mapsize, type; + int barlen, basezero, flags, maprange, mapsize, type; uint16_t cmd; struct resource *res; @@ -2848,6 +2848,9 @@ pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl, } count = (pci_addr_t)1 << mapsize; + flags = RF_ALIGNMENT_LOG2(mapsize); + if (prefetch) + flags |= RF_PREFETCHABLE; if (basezero || base == pci_mapbase(testval)) { start = 0; /* Let the parent decide. */ end = ~0ul; @@ -2864,7 +2867,7 @@ pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl, * pci_alloc_resource(). */ res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, - prefetch ? RF_PREFETCHABLE : 0); + flags); if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0ul)) { /* * If the allocation fails, try to allocate a resource for @@ -2875,7 +2878,7 @@ pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl, resource_list_delete(rl, type, reg); resource_list_add(rl, type, reg, 0, ~0ul, count); res = resource_list_reserve(rl, bus, dev, type, ®, 0, ~0ul, - count, prefetch ? RF_PREFETCHABLE : 0); + count, flags); } if (res == NULL) { /* |