Revert "pci: Scale MAX_PCI_REGIONS based on CONFIG_NR_DRAM_BANKS"
authorSimon Glass <sjg@chromium.org>
Wed, 8 May 2019 03:41:15 +0000 (21:41 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Wed, 8 May 2019 05:02:10 +0000 (13:02 +0800)
commit62c72995e3cbb2aa356da7dd403d52de47a11072
tree19fc1590c5d9f7984016a9e0d7bf3d737cf3fce1
parent16f4d05164eb5418d4bafd5a058813c97a431273
Revert "pci: Scale MAX_PCI_REGIONS based on CONFIG_NR_DRAM_BANKS"

This reverts commit aec4298ccb337106fd0115b91d846a022fdf301d.

Unfortunately this has a dramatic impact on the pre-relocation memory
used on x86 platforms (increasing it by 2KB) since it increases the
overhead for each PCI device from 220 bytes to 412 bytes.

The offending line is in UCLASS_DRIVER(pci):

.per_device_auto_alloc_size = sizeof(struct pci_controller),

This means that all PCI devices have the controller struct associated
with them. The solution is to move the regions[] member out of the array,
makes its size dynamic, or split UCLASS_PCI into controllers and
non-controllers, as the comment suggests.

For now, revert the commit to get things running again.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
include/pci.h