aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMinda Chen2023-08-07 16:53:35 +0800
committerLeo Yu-Chi Liang2023-08-10 10:58:01 +0800
commit8d184d4b652bad455e17d2d0e451c0e08e112f34 (patch)
treec3045dcac9105d985acbe73c1d4217d5ed80254f /drivers
parent6982e6b04672440fce0eed93679aea89a024779f (diff)
pci: plda: Get correct ECAM offset in multiple PCIe RC case
Get the correct ECAM offset and record the secondary bus number in Multiple RC case. Signed-off-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pcie_plda_common.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/pcie_plda_common.c b/drivers/pci/pcie_plda_common.c
index 005b92616a7..cd74bb47116 100644
--- a/drivers/pci/pcie_plda_common.c
+++ b/drivers/pci/pcie_plda_common.c
@@ -36,8 +36,8 @@ static int plda_pcie_conf_address(const struct udevice *udev, pci_dev_t bdf,
uint offset, void **paddr)
{
struct pcie_plda *priv = dev_get_priv(udev);
- int where = PCIE_ECAM_OFFSET(PCI_BUS(bdf), PCI_DEV(bdf),
- PCI_FUNC(bdf), offset);
+ int where = PCIE_ECAM_OFFSET(PCI_BUS(bdf) - dev_seq(udev),
+ PCI_DEV(bdf), PCI_FUNC(bdf), offset);
if (!plda_pcie_addr_valid(priv, bdf))
return -ENODEV;
@@ -71,6 +71,7 @@ int plda_pcie_config_write(struct udevice *udev, pci_dev_t bdf,
(offset == PCI_PRIMARY_BUS && size != PCI_SIZE_8))) {
priv->sec_busno =
((offset == PCI_PRIMARY_BUS) ? (value >> 8) : value) & 0xff;
+ priv->sec_busno += dev_seq(udev);
debug("Secondary bus number was changed to %d\n",
priv->sec_busno);
}