diff options
author | imp <imp@FreeBSD.org> | 2006-10-30 22:46:33 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2006-10-30 22:46:33 +0000 |
commit | 82791e6dba1cc9ea7aac2b1f1e01299f5e874419 (patch) | |
tree | c8b5c7636a22e0f2267928601e1cece8790f14ef | |
parent | 02d450964f3b7fa286520f9baca6c25197cff69d (diff) | |
download | FreeBSD-src-82791e6dba1cc9ea7aac2b1f1e01299f5e874419.zip FreeBSD-src-82791e6dba1cc9ea7aac2b1f1e01299f5e874419.tar.gz |
Assign start to the value we were able to allocate and use that to
write out the BAR. Otherwise, we were trying to shift a 32-bit
quantity on 32-bit platforms. Also, 'start' check sanity to where it
is known.
-rw-r--r-- | sys/dev/pci/pci.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index bbdff0f..c6dedb9 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1315,13 +1315,6 @@ pci_add_map(device_t pcib, device_t bus, device_t dev, start = base; end = base + (1 << ln2size) - 1; } - if ((u_long)start != start) { - /* Wait a minute! this platform can't do this address. */ - device_printf(bus, - "pci%d.%d.%x bar %#x start %#jx, too many bits.", - b, s, f, reg, (uintmax_t)start); - return (barlen); - } resource_list_add(rl, type, reg, start, end, count); /* @@ -1330,11 +1323,19 @@ pci_add_map(device_t pcib, device_t bus, device_t dev, */ res = resource_list_alloc(rl, bus, dev, type, ®, start, end, count, prefetch ? RF_PREFETCHABLE : 0); + start = rman_get_start(res); + if ((u_long)start != start) { + /* Wait a minute! this platform can't do this address. */ + device_printf(bus, + "pci%d.%d.%x bar %#x start %#jx, too many bits.", + b, s, f, reg, (uintmax_t)start); + resource_list_release(rl, bus, dev, type, reg, res); + return (barlen); + } if (res != NULL) { - pci_write_config(dev, reg, rman_get_start(res), 4); + pci_write_config(dev, reg, start, 4); if (ln2range == 64) - pci_write_config(dev, reg + 4, - rman_get_start(res) >> 32, 4); + pci_write_config(dev, reg + 4, start >> 32, 4); } return (barlen); } |