mirror of
https://xff.cz/git/u-boot/
synced 2025-10-26 16:13:55 +01:00
pci: Add standard PCIe ECAM macros
Lot of PCIe controllers are using ECAM addressing. So add common ECAM macros into U-Boot's pci.h header file which can be suitable for most PCI controller drivers. Replace custom ECAM address macros in every PCI controller driver by new ECAM macros from U-Boot's pci.h header file. Similar macros are defined also in Linux kernel. There is a small difference between Linux and these new U-Boot macros. U-Boot's PCIE_ECAM_OFFSET() takes device and function numbers in separate arguments. Linux's PCIE_ECAM_OFFSET() takes device and function numbers encoded in one argument. The reason is that U-Boot's PCI_DEVFN() macro is different than Linux's PCI_SLOT() macro. So having device and function numbers in separate arguments makes code more straightforward. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
@@ -76,10 +76,7 @@ static int pcie_xilinx_config_address(const struct udevice *udev, pci_dev_t bdf,
|
||||
return -ENODEV;
|
||||
|
||||
addr = pcie->cfg_base;
|
||||
addr += bus << 20;
|
||||
addr += dev << 15;
|
||||
addr += func << 12;
|
||||
addr += offset;
|
||||
addr += PCIE_ECAM_OFFSET(bus, dev, func, offset);
|
||||
*paddress = addr;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user