]> git.sur5r.net Git - u-boot/blobdiff - drivers/pci/pci_auto_common.c
spi: mxc: Fix compilation problem of DM_SPI class driver
[u-boot] / drivers / pci / pci_auto_common.c
index 677f094b419f4557ec7ef77001694223bcbd36db..183787333e9a83e73e94c98baaa976e60685b97f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * PCI auto-configuration library
  *
@@ -8,8 +9,6 @@
  * Modifications for driver model:
  * Copyright 2015 Google, Inc
  * Written by Simon Glass <sjg@chromium.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -33,12 +32,12 @@ void pciauto_region_align(struct pci_region *res, pci_size_t size)
 }
 
 int pciauto_region_allocate(struct pci_region *res, pci_size_t size,
-       pci_addr_t *bar)
+       pci_addr_t *bar, bool supports_64bit)
 {
        pci_addr_t addr;
 
        if (!res) {
-               debug("No resource");
+               debug("No resource\n");
                goto error;
        }
 
@@ -49,9 +48,14 @@ int pciauto_region_allocate(struct pci_region *res, pci_size_t size,
                goto error;
        }
 
+       if (upper_32_bits(addr) && !supports_64bit) {
+               debug("Cannot assign 64-bit address to 32-bit-only resource\n");
+               goto error;
+       }
+
        res->bus_lower = addr + size;
 
-       debug("address=0x%llx bus_lower=0x%llx", (unsigned long long)addr,
+       debug("address=0x%llx bus_lower=0x%llx\n", (unsigned long long)addr,
              (unsigned long long)res->bus_lower);
 
        *bar = addr;