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>
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 @@
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 @@
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 @@
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 @@
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)));
}
}