aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2021-02-10 21:13:53 +0100
committerHelge Deller <deller@gmx.de>2021-09-24 11:10:17 +0200
commitb02c1d1dc72c2c7f55641ff68c3c04434d2f0de5 (patch)
tree9231d4ccf4db8ddbf7cc76e4dd7e861142208345
parent9a6adef8e50bbdf076936af8b5f39e44982fe923 (diff)
downloadseabios-hppa-b02c1d1dc72c2c7f55641ff68c3c04434d2f0de5.zip
seabios-hppa-b02c1d1dc72c2c7f55641ff68c3c04434d2f0de5.tar.gz
seabios-hppa-b02c1d1dc72c2c7f55641ff68c3c04434d2f0de5.tar.bz2
pci.c: Add PCI ports for PA-RISC and access PCI bus in little-endian
Add the IO-Ports for the PCI bus on PA-RISC. The PCI bus is little-endian on x86 and PA-RISC, so add the necessary conversions for PA-RISC. Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--src/hw/pci.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/hw/pci.c b/src/hw/pci.c
index 3df1dae..ecc724b 100644
--- a/src/hw/pci.c
+++ b/src/hw/pci.c
@@ -8,11 +8,16 @@
#include "output.h" // dprintf
#include "pci.h" // pci_config_writel
#include "pci_regs.h" // PCI_VENDOR_ID
+#include "byteorder.h" // cpu_to_le16
#include "util.h" // udelay
#include "x86.h" // outl
+#if CONFIG_X86
#define PORT_PCI_CMD 0x0cf8
#define PORT_PCI_DATA 0x0cfc
+#elif CONFIG_PARISC
+#include "parisc/hppa_hardware.h"
+#endif
static u32 mmconfig;
@@ -32,7 +37,7 @@ void pci_config_writel(u16 bdf, u32 addr, u32 val)
writel(mmconfig_addr(bdf, addr), val);
} else {
outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD);
- outl(val, PORT_PCI_DATA);
+ outl(cpu_to_le32(val), PORT_PCI_DATA);
}
}
@@ -42,7 +47,7 @@ void pci_config_writew(u16 bdf, u32 addr, u16 val)
writew(mmconfig_addr(bdf, addr), val);
} else {
outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD);
- outw(val, PORT_PCI_DATA + (addr & 2));
+ outw(cpu_to_le16(val), PORT_PCI_DATA + (addr & 2));
}
}
@@ -62,7 +67,7 @@ u32 pci_config_readl(u16 bdf, u32 addr)
return readl(mmconfig_addr(bdf, addr));
} else {
outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD);
- return inl(PORT_PCI_DATA);
+ return le32_to_cpu(inl(PORT_PCI_DATA));
}
}
@@ -72,7 +77,7 @@ u16 pci_config_readw(u16 bdf, u32 addr)
return readw(mmconfig_addr(bdf, addr));
} else {
outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD);
- return inw(PORT_PCI_DATA + (addr & 2));
+ return le16_to_cpu(inw(PORT_PCI_DATA + (addr & 2)));
}
}