Skip to content

Commit e078723

Browse files
jaszczyk-grzegorzLorenzo Pieralisi
authored andcommitted
PCI: aardvark: Fix big endian support
Initialise every multiple-byte field of emulated PCI bridge config space with proper cpu_to_le* macro. This is required since the structure describing config space of emulated bridge assumes little-endian convention. Signed-off-by: Grzegorz Jaszczyk <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]>
1 parent 7fbcb5d commit e078723

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/pci/controller/pci-aardvark.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,18 +519,20 @@ static void advk_sw_pci_bridge_init(struct advk_pcie *pcie)
519519
{
520520
struct pci_bridge_emul *bridge = &pcie->bridge;
521521

522-
bridge->conf.vendor = advk_readl(pcie, PCIE_CORE_DEV_ID_REG) & 0xffff;
523-
bridge->conf.device = advk_readl(pcie, PCIE_CORE_DEV_ID_REG) >> 16;
522+
bridge->conf.vendor =
523+
cpu_to_le16(advk_readl(pcie, PCIE_CORE_DEV_ID_REG) & 0xffff);
524+
bridge->conf.device =
525+
cpu_to_le16(advk_readl(pcie, PCIE_CORE_DEV_ID_REG) >> 16);
524526
bridge->conf.class_revision =
525-
advk_readl(pcie, PCIE_CORE_DEV_REV_REG) & 0xff;
527+
cpu_to_le32(advk_readl(pcie, PCIE_CORE_DEV_REV_REG) & 0xff);
526528

527529
/* Support 32 bits I/O addressing */
528530
bridge->conf.iobase = PCI_IO_RANGE_TYPE_32;
529531
bridge->conf.iolimit = PCI_IO_RANGE_TYPE_32;
530532

531533
/* Support 64 bits memory pref */
532-
bridge->conf.pref_mem_base = PCI_PREF_RANGE_TYPE_64;
533-
bridge->conf.pref_mem_limit = PCI_PREF_RANGE_TYPE_64;
534+
bridge->conf.pref_mem_base = cpu_to_le16(PCI_PREF_RANGE_TYPE_64);
535+
bridge->conf.pref_mem_limit = cpu_to_le16(PCI_PREF_RANGE_TYPE_64);
534536

535537
/* Support interrupt A for MSI feature */
536538
bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE;

0 commit comments

Comments
 (0)