summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Watson <jarrah@users.sourceforge.net>2003-10-05 05:15:10 +0000
committerGreg Watson <jarrah@users.sourceforge.net>2003-10-05 05:15:10 +0000
commitb6a259b0d26d1829ac38db646d267543daed216a (patch)
tree6fe052ab573d81d320e984ea1f7d55624887354c
parente046fbbb2cae62934ba4aae85d56456e7d7b3ff4 (diff)
no need for assembly
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1194 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--src/arch/ppc/lib/pci_ops.c51
1 files changed, 42 insertions, 9 deletions
diff --git a/src/arch/ppc/lib/pci_ops.c b/src/arch/ppc/lib/pci_ops.c
index eef6eef30c..ecbbe8bb0b 100644
--- a/src/arch/ppc/lib/pci_ops.c
+++ b/src/arch/ppc/lib/pci_ops.c
@@ -17,12 +17,41 @@ struct pci_ops {
struct pci_ops pci_direct_ppc;
-extern unsigned __pci_config_read_32(unsigned address);
-extern unsigned __pci_config_read_16(unsigned address);
-extern unsigned __pci_config_read_8(unsigned address);
-extern void __pci_config_write_32(unsigned address, unsigned data);
-extern void __pci_config_write_16(unsigned address, unsigned short data);
-extern void __pci_config_write_8(unsigned address, unsigned char data);
+static unsigned __pci_config_read_32(unsigned address)
+{
+ out_le32((unsigned *)PCIC0_CFGADDR, address);
+ return in_le32((unsigned *)PCIC0_CFGDATA);
+}
+
+static unsigned __pci_config_read_16(unsigned address)
+{
+ out_le32((unsigned *)PCIC0_CFGADDR, address);
+ return in_le16((unsigned short *)PCIC0_CFGDATA);
+}
+
+static unsigned __pci_config_read_8(unsigned address)
+{
+ out_le32((unsigned *)PCIC0_CFGADDR, address);
+ return in_8((unsigned char *)PCIC0_CFGDATA);
+}
+
+static void __pci_config_write_32(unsigned address, unsigned data)
+{
+ out_le32((unsigned *)PCIC0_CFGADDR, address);
+ out_le32((unsigned *)PCIC0_CFGDATA, data);
+}
+
+static void __pci_config_write_16(unsigned address, unsigned short data)
+{
+ out_le32((unsigned *)PCIC0_CFGADDR, address);
+ out_le16((unsigned short *)PCIC0_CFGDATA, data);
+}
+
+static void __pci_config_write_8(unsigned address, unsigned char data)
+{
+ out_le32((unsigned *)PCIC0_CFGADDR, address);
+ out_8((unsigned char *)PCIC0_CFGDATA, data);
+}
#define CONFIG_CMD(bus,devfn,where) (bus << 16 | devfn << 8 | where | 0x80000000)
@@ -50,13 +79,17 @@ static int pci_sanity_check(const struct pci_ops *o)
#define PCI_VENDOR_ID_COMPAQ 0x0e11
#define PCI_VENDOR_ID_INTEL 0x8086
#define PCI_VENDOR_ID_MOTOROLA 0x1057
+#define PCI_VENDOR_ID_IBM 0x1014
for (bus = 0, devfn = 0; devfn < 0x100; devfn++) {
class = o->read16(bus, devfn, PCI_CLASS_DEVICE);
vendor = o->read16(bus, devfn, PCI_VENDOR_ID);
- if (((class == PCI_CLASS_BRIDGE_HOST) || (class == PCI_CLASS_DISPLAY_VGA)) ||
- ((vendor == PCI_VENDOR_ID_INTEL) || (vendor == PCI_VENDOR_ID_COMPAQ) ||
- (vendor == PCI_VENDOR_ID_MOTOROLA))) {
+ if (((class == PCI_CLASS_BRIDGE_HOST) ||
+ (class == PCI_CLASS_DISPLAY_VGA)) ||
+ ((vendor == PCI_VENDOR_ID_INTEL) ||
+ (vendor == PCI_VENDOR_ID_COMPAQ) ||
+ (vendor == PCI_VENDOR_ID_MOTOROLA) ||
+ (vendor == PCI_VENDOR_ID_IBM))) {
return 1;
}
}