pci: Add config for Enhanced Allocation
authorAndrew Scull <ascull@google.com>
Thu, 21 Apr 2022 16:11:16 +0000 (16:11 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 3 May 2022 22:33:29 +0000 (18:33 -0400)
Add a config to control whether Enhanced Allocation is supported by the
driver.

Signed-off-by: Andrew Scull <ascull@google.com>
drivers/pci/Kconfig
drivers/pci/pci-uclass.c

index 47cd074..fd22034 100644 (file)
@@ -67,6 +67,13 @@ config PCI_SRIOV
          if available on a PCI Physical Function device and probe for
          applicable drivers.
 
+config PCI_ENHANCED_ALLOCATION
+       bool "Enable support for Enhanced Allocation of resources"
+       default y
+       help
+         Enable support for Enhanced Allocation which can be used by supported
+         devices in place of traditional BARS for allocation of resources.
+
 config PCI_ARID
         bool "Enable Alternate Routing-ID support for PCI"
         help
index bb53e6b..970ee1a 100644 (file)
@@ -645,7 +645,11 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
                return log_msg_ret("probe", -EINVAL);
        }
 
-       ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
+       if (IS_ENABLED(CONFIG_PCI_ENHANCED_ALLOCATION))
+               ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
+       else
+               ea_pos = 0;
+
        if (ea_pos) {
                dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8),
                                    &reg);
@@ -1579,7 +1583,11 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, size_t offset, size_t len,
         * Incase of virtual functions, pdata will help read VF BEI
         * and EA entry size.
         */
-       ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
+       if (IS_ENABLED(CONFIG_PCI_ENHANCED_ALLOCATION))
+               ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
+       else
+               ea_off = 0;
+
        if (ea_off)
                return dm_pci_map_ea_bar(udev, bar, offset, len, ea_off, pdata);