summaryrefslogtreecommitdiff
path: root/drivers/pci/pci_auto.c
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2018-05-14 19:38:13 +0300
committerTom Rini <trini@konsulko.com>2018-05-26 19:46:50 +0300
commitd71975ae6e0f3dc1c0c96d3a8cc0120a266305b9 (patch)
treea7684ddd6ff0eb0c17fa38ca840a2636342d54b0 /drivers/pci/pci_auto.c
parented12a89d0738dd030c42a608efa7a72dd4a1f6da (diff)
downloadu-boot-d71975ae6e0f3dc1c0c96d3a8cc0120a266305b9.tar.xz
PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources
Currently, if we happen to allocate an address requiring 64 bits to a device only supporting 32-bit BARs, the address eventually gets silently truncated to 32 bits. Avoid this by adding a new flag to pciauto_region_allocate() to bail out in such situations. Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/pci/pci_auto.c')
-rw-r--r--drivers/pci/pci_auto.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c
index d1feb503a0..d7237f6eee 100644
--- a/drivers/pci/pci_auto.c
+++ b/drivers/pci/pci_auto.c
@@ -98,7 +98,8 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
}
if (!enum_only && pciauto_region_allocate(bar_res, bar_size,
- &bar_value) == 0) {
+ &bar_value,
+ found_mem64) == 0) {
/* Write it out and update our limit */
dm_pci_write_config32(dev, bar, (u32)bar_value);
@@ -140,7 +141,8 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
debug("PCI Autoconfig: ROM, size=%#x, ",
(unsigned int)bar_size);
if (pciauto_region_allocate(mem, bar_size,
- &bar_value) == 0) {
+ &bar_value,
+ false) == 0) {
dm_pci_write_config32(dev, rom_addr,
bar_value);
}