]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/iseries/pci.c
[POWERPC] iSeries: DeCamelCase vpdinfo.c
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / iseries / pci.c
index 4a06d9c349869cdcb1fda45c516034b8cf992867..5466975bc9068894fd90ca1caaf2737b755b025d 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/ide.h>
 #include <linux/pci.h>
 
 #include <asm/io.h>
 #include "pci.h"
 #include "call_pci.h"
 
-/*
- * Forward declares of prototypes.
- */
-static struct device_node *find_Device_Node(int bus, int devfn);
-
-static int Pci_Retry_Max = 3;  /* Only retry 3 times  */
-static int Pci_Error_Flag = 1; /* Set Retry Error on. */
-
-static struct pci_ops iSeries_pci_ops;
+#define PCI_RETRY_MAX  3
+static int limit_pci_retries = 1;      /* Set Retry Error on. */
 
 /*
  * Table defines
@@ -76,6 +68,17 @@ static u8 iobar_table[IOMM_TABLE_MAX_ENTRIES];
 static const char pci_io_text[] = "iSeries PCI I/O";
 static DEFINE_SPINLOCK(iomm_table_lock);
 
+/*
+ * Generate a Direct Select Address for the Hypervisor
+ */
+static inline u64 iseries_ds_addr(struct device_node *node)
+{
+       struct pci_dn *pdn = PCI_DN(node);
+
+       return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
+                       + ((u64)0x10 << 32);
+}
+
 /*
  * iomm_table_allocate_entry
  *
@@ -88,7 +91,7 @@ static DEFINE_SPINLOCK(iomm_table_lock);
  * - CurrentIndex is incremented to keep track of the last entry.
  * - Builds the resource entry for allocated BARs.
  */
-static void iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
+static void __init iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
 {
        struct resource *bar_res = &dev->resource[bar_num];
        long bar_size = pci_resource_len(dev, bar_num);
@@ -131,7 +134,7 @@ static void iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
  * - Loops through The Bar resources(0 - 5) including the ROM
  *   is resource(6).
  */
-static void allocate_device_bars(struct pci_dev *dev)
+static void __init allocate_device_bars(struct pci_dev *dev)
 {
        int bar_num;
 
@@ -146,79 +149,19 @@ static void allocate_device_bars(struct pci_dev *dev)
  * PCI: Read Vendor Failed 0x18.58.10 Rc: 0x00xx
  * PCI: Connect Bus Unit Failed 0x18.58.10 Rc: 0x00xx
  */
-static void pci_Log_Error(char *Error_Text, int Bus, int SubBus,
-               int AgentId, int HvRc)
+static void pci_log_error(char *error, int bus, int subbus,
+               int agent, int hv_res)
 {
-       if (HvRc == 0x0302)
+       if (hv_res == 0x0302)
                return;
        printk(KERN_ERR "PCI: %s Failed: 0x%02X.%02X.%02X Rc: 0x%04X",
-              Error_Text, Bus, SubBus, AgentId, HvRc);
-}
-
-/*
- * iSeries_pci_final_fixup(void)
- */
-void __init iSeries_pci_final_fixup(void)
-{
-       struct pci_dev *pdev = NULL;
-       struct device_node *node;
-       int DeviceCount = 0;
-
-       /* Fix up at the device node and pci_dev relationship */
-       mf_display_src(0xC9000100);
-
-       printk("pcibios_final_fixup\n");
-       for_each_pci_dev(pdev) {
-               node = find_Device_Node(pdev->bus->number, pdev->devfn);
-               printk("pci dev %p (%x.%x), node %p\n", pdev,
-                      pdev->bus->number, pdev->devfn, node);
-
-               if (node != NULL) {
-                       struct pci_dn *pdn = PCI_DN(node);
-                       const u32 *agent;
-
-                       agent = get_property(node, "linux,agent-id", NULL);
-                       if ((pdn != NULL) && (agent != NULL)) {
-                               u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
-                                               pdn->bussubno);
-                               int err;
-
-                               err = HvCallXm_connectBusUnit(pdn->busno, pdn->bussubno,
-                                               *agent, irq);
-                               if (err)
-                                       pci_Log_Error("Connect Bus Unit",
-                                               pdn->busno, pdn->bussubno, *agent, err);
-                               else {
-                                       err = HvCallPci_configStore8(pdn->busno, pdn->bussubno,
-                                                       *agent,
-                                                       PCI_INTERRUPT_LINE,
-                                                       irq);
-                                       if (err)
-                                               pci_Log_Error("PciCfgStore Irq Failed!",
-                                                       pdn->busno, pdn->bussubno, *agent, err);
-                               }
-                               if (!err)
-                                       pdev->irq = irq;
-                       }
-
-                       ++DeviceCount;
-                       pdev->sysdata = (void *)node;
-                       PCI_DN(node)->pcidev = pdev;
-                       allocate_device_bars(pdev);
-                       iSeries_Device_Information(pdev, DeviceCount);
-                       iommu_devnode_init_iSeries(pdev, node);
-               } else
-                       printk("PCI: Device Tree not found for 0x%016lX\n",
-                                       (unsigned long)pdev);
-       }
-       iSeries_activate_IRQs();
-       mf_display_src(0xC9000200);
+              error, bus, subbus, agent, hv_res);
 }
 
 /*
  * Look down the chain to find the matching Device Device
  */
-static struct device_node *find_Device_Node(int bus, int devfn)
+static struct device_node *find_device_node(int bus, int devfn)
 {
        struct device_node *node;
 
@@ -231,22 +174,65 @@ static struct device_node *find_Device_Node(int bus, int devfn)
        return NULL;
 }
 
-#if 0
 /*
- * Returns the device node for the passed pci_dev
- * Sanity Check Node PciDev to passed pci_dev
- * If none is found, returns a NULL which the client must handle.
+ * iSeries_pci_final_fixup(void)
  */
-static struct device_node *get_Device_Node(struct pci_dev *pdev)
+void __init iSeries_pci_final_fixup(void)
 {
+       struct pci_dev *pdev = NULL;
        struct device_node *node;
+       int num_dev = 0;
+
+       /* Fix up at the device node and pci_dev relationship */
+       mf_display_src(0xC9000100);
+
+       printk("pcibios_final_fixup\n");
+       for_each_pci_dev(pdev) {
+               const u32 *agent;
+               const u32 *sub_bus;
+               unsigned char bus = pdev->bus->number;
+
+               node = find_device_node(bus, pdev->devfn);
+               printk("pci dev %p (%x.%x), node %p\n", pdev, bus,
+                       pdev->devfn, node);
+               if (!node) {
+                       printk("PCI: Device Tree not found for 0x%016lX\n",
+                                       (unsigned long)pdev);
+                       continue;
+               }
 
-       node = pdev->sysdata;
-       if (node == NULL || PCI_DN(node)->pcidev != pdev)
-               node = find_Device_Node(pdev->bus->number, pdev->devfn);
-       return node;
+               agent = of_get_property(node, "linux,agent-id", NULL);
+               sub_bus = of_get_property(node, "linux,subbus", NULL);
+               if (agent && sub_bus) {
+                       u8 irq = iSeries_allocate_IRQ(bus, 0, *sub_bus);
+                       int err;
+
+                       err = HvCallXm_connectBusUnit(bus, *sub_bus,
+                                       *agent, irq);
+                       if (err)
+                               pci_log_error("Connect Bus Unit",
+                                       bus, *sub_bus, *agent, err);
+                       else {
+                               err = HvCallPci_configStore8(bus, *sub_bus,
+                                       *agent, PCI_INTERRUPT_LINE, irq);
+                               if (err)
+                                       pci_log_error("PciCfgStore Irq Failed!",
+                                               bus, *sub_bus, *agent, err);
+                               else
+                                       pdev->irq = irq;
+                       }
+               }
+
+               num_dev++;
+               pdev->sysdata = node;
+               PCI_DN(node)->pcidev = pdev;
+               allocate_device_bars(pdev);
+               iseries_device_information(pdev, num_dev, bus, *sub_bus);
+               iommu_devnode_init_iSeries(pdev, node);
+       }
+       iSeries_activate_IRQs();
+       mf_display_src(0xC9000200);
 }
-#endif
 
 /*
  * Config space read and write functions.
@@ -270,7 +256,7 @@ static u64 hv_cfg_write_func[4] = {
 static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
                int offset, int size, u32 *val)
 {
-       struct device_node *node = find_Device_Node(bus->number, devfn);
+       struct device_node *node = find_device_node(bus->number, devfn);
        u64 fn;
        struct HvCallPci_LoadReturn ret;
 
@@ -300,7 +286,7 @@ static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
 static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
                int offset, int size, u32 val)
 {
-       struct device_node *node = find_Device_Node(bus->number, devfn);
+       struct device_node *node = find_device_node(bus->number, devfn);
        u64 fn;
        u64 ret;
 
@@ -332,22 +318,22 @@ static struct pci_ops iSeries_pci_ops = {
  * PCI: Device 23.90 ReadL Retry( 1)
  * PCI: Device 23.90 ReadL Retry Successful(1)
  */
-static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
+static int check_return_code(char *type, struct device_node *dn,
                int *retry, u64 ret)
 {
        if (ret != 0)  {
-               struct pci_dn *pdn = PCI_DN(DevNode);
+               struct pci_dn *pdn = PCI_DN(dn);
 
                (*retry)++;
                printk("PCI: %s: Device 0x%04X:%02X  I/O Error(%2d): 0x%04X\n",
-                               TextHdr, pdn->busno, pdn->devfn,
+                               type, pdn->busno, pdn->devfn,
                                *retry, (int)ret);
                /*
                 * Bump the retry and check for retry count exceeded.
                 * If, Exceeded, panic the system.
                 */
-               if (((*retry) > Pci_Retry_Max) &&
-                               (Pci_Error_Flag > 0)) {
+               if (((*retry) > PCI_RETRY_MAX) &&
+                               (limit_pci_retries > 0)) {
                        mf_display_src(0xB6000103);
                        panic_timeout = 0;
                        panic("PCI: Hardware I/O Error, SRC B6000103, "
@@ -364,28 +350,40 @@ static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
  * the exposure of being device global.
  */
 static inline struct device_node *xlate_iomm_address(
-               const volatile void __iomem *IoAddress,
-               u64 *dsaptr, u64 *BarOffsetPtr)
+               const volatile void __iomem *addr,
+               u64 *dsaptr, u64 *bar_offset, const char *func)
 {
-       unsigned long OrigIoAddr;
-       unsigned long BaseIoAddr;
-       unsigned long TableIndex;
-       struct device_node *DevNode;
+       unsigned long orig_addr;
+       unsigned long base_addr;
+       unsigned long ind;
+       struct device_node *dn;
+
+       orig_addr = (unsigned long __force)addr;
+       if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory)) {
+               static unsigned long last_jiffies;
+               static int num_printed;
 
-       OrigIoAddr = (unsigned long __force)IoAddress;
-       if ((OrigIoAddr < BASE_IO_MEMORY) || (OrigIoAddr >= max_io_memory))
+               if ((jiffies - last_jiffies) > 60 * HZ) {
+                       last_jiffies = jiffies;
+                       num_printed = 0;
+               }
+               if (num_printed++ < 10)
+                       printk(KERN_ERR
+                               "iSeries_%s: invalid access at IO address %p\n",
+                               func, addr);
                return NULL;
-       BaseIoAddr = OrigIoAddr - BASE_IO_MEMORY;
-       TableIndex = BaseIoAddr / IOMM_TABLE_ENTRY_SIZE;
-       DevNode = iomm_table[TableIndex];
-
-       if (DevNode != NULL) {
-               int barnum = iobar_table[TableIndex];
-               *dsaptr = iseries_ds_addr(DevNode) | (barnum << 24);
-               *BarOffsetPtr = BaseIoAddr % IOMM_TABLE_ENTRY_SIZE;
+       }
+       base_addr = orig_addr - BASE_IO_MEMORY;
+       ind = base_addr / IOMM_TABLE_ENTRY_SIZE;
+       dn = iomm_table[ind];
+
+       if (dn != NULL) {
+               int barnum = iobar_table[ind];
+               *dsaptr = iseries_ds_addr(dn) | (barnum << 24);
+               *bar_offset = base_addr % IOMM_TABLE_ENTRY_SIZE;
        } else
-               panic("PCI: Invalid PCI IoAddress detected!\n");
-       return DevNode;
+               panic("PCI: Invalid PCI IO address detected!\n");
+       return dn;
 }
 
 /*
@@ -393,91 +391,58 @@ static inline struct device_node *xlate_iomm_address(
  * On MM I/O error, all ones are returned and iSeries_pci_IoError is cal
  * else, data is returned in Big Endian format.
  */
-static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
+static u8 iseries_readb(const volatile void __iomem *addr)
 {
-       u64 BarOffset;
+       u64 bar_offset;
        u64 dsa;
        int retry = 0;
        struct HvCallPci_LoadReturn ret;
-       struct device_node *DevNode =
-               xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+       struct device_node *dn =
+               xlate_iomm_address(addr, &dsa, &bar_offset, "read_byte");
 
-       if (DevNode == NULL) {
-               static unsigned long last_jiffies;
-               static int num_printed;
-
-               if ((jiffies - last_jiffies) > 60 * HZ) {
-                       last_jiffies = jiffies;
-                       num_printed = 0;
-               }
-               if (num_printed++ < 10)
-                       printk(KERN_ERR "iSeries_Read_Byte: invalid access at IO address %p\n",
-                              IoAddress);
+       if (dn == NULL)
                return 0xff;
-       }
        do {
-               HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, BarOffset, 0);
-       } while (CheckReturnCode("RDB", DevNode, &retry, ret.rc) != 0);
+               HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, bar_offset, 0);
+       } while (check_return_code("RDB", dn, &retry, ret.rc) != 0);
 
        return ret.value;
 }
 
-static u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
+static u16 iseries_readw_be(const volatile void __iomem *addr)
 {
-       u64 BarOffset;
+       u64 bar_offset;
        u64 dsa;
        int retry = 0;
        struct HvCallPci_LoadReturn ret;
-       struct device_node *DevNode =
-               xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+       struct device_node *dn =
+               xlate_iomm_address(addr, &dsa, &bar_offset, "read_word");
 
-       if (DevNode == NULL) {
-               static unsigned long last_jiffies;
-               static int num_printed;
-
-               if ((jiffies - last_jiffies) > 60 * HZ) {
-                       last_jiffies = jiffies;
-                       num_printed = 0;
-               }
-               if (num_printed++ < 10)
-                       printk(KERN_ERR "iSeries_Read_Word: invalid access at IO address %p\n",
-                              IoAddress);
+       if (dn == NULL)
                return 0xffff;
-       }
        do {
                HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa,
-                               BarOffset, 0);
-       } while (CheckReturnCode("RDW", DevNode, &retry, ret.rc) != 0);
+                               bar_offset, 0);
+       } while (check_return_code("RDW", dn, &retry, ret.rc) != 0);
 
        return ret.value;
 }
 
-static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
+static u32 iseries_readl_be(const volatile void __iomem *addr)
 {
-       u64 BarOffset;
+       u64 bar_offset;
        u64 dsa;
        int retry = 0;
        struct HvCallPci_LoadReturn ret;
-       struct device_node *DevNode =
-               xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+       struct device_node *dn =
+               xlate_iomm_address(addr, &dsa, &bar_offset, "read_long");
 
-       if (DevNode == NULL) {
-               static unsigned long last_jiffies;
-               static int num_printed;
-
-               if ((jiffies - last_jiffies) > 60 * HZ) {
-                       last_jiffies = jiffies;
-                       num_printed = 0;
-               }
-               if (num_printed++ < 10)
-                       printk(KERN_ERR "iSeries_Read_Long: invalid access at IO address %p\n",
-                              IoAddress);
+       if (dn == NULL)
                return 0xffffffff;
-       }
        do {
                HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa,
-                               BarOffset, 0);
-       } while (CheckReturnCode("RDL", DevNode, &retry, ret.rc) != 0);
+                               bar_offset, 0);
+       } while (check_return_code("RDL", dn, &retry, ret.rc) != 0);
 
        return ret.value;
 }
@@ -486,134 +451,72 @@ static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
  * Write MM I/O Instructions for the iSeries
  *
  */
-static void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
+static void iseries_writeb(u8 data, volatile void __iomem *addr)
 {
-       u64 BarOffset;
+       u64 bar_offset;
        u64 dsa;
        int retry = 0;
        u64 rc;
-       struct device_node *DevNode =
-               xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+       struct device_node *dn =
+               xlate_iomm_address(addr, &dsa, &bar_offset, "write_byte");
 
-       if (DevNode == NULL) {
-               static unsigned long last_jiffies;
-               static int num_printed;
-
-               if ((jiffies - last_jiffies) > 60 * HZ) {
-                       last_jiffies = jiffies;
-                       num_printed = 0;
-               }
-               if (num_printed++ < 10)
-                       printk(KERN_ERR "iSeries_Write_Byte: invalid access at IO address %p\n", IoAddress);
+       if (dn == NULL)
                return;
-       }
        do {
-               rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0);
-       } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0);
+               rc = HvCall4(HvCallPciBarStore8, dsa, bar_offset, data, 0);
+       } while (check_return_code("WWB", dn, &retry, rc) != 0);
 }
 
-static void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
+static void iseries_writew_be(u16 data, volatile void __iomem *addr)
 {
-       u64 BarOffset;
+       u64 bar_offset;
        u64 dsa;
        int retry = 0;
        u64 rc;
-       struct device_node *DevNode =
-               xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+       struct device_node *dn =
+               xlate_iomm_address(addr, &dsa, &bar_offset, "write_word");
 
-       if (DevNode == NULL) {
-               static unsigned long last_jiffies;
-               static int num_printed;
-
-               if ((jiffies - last_jiffies) > 60 * HZ) {
-                       last_jiffies = jiffies;
-                       num_printed = 0;
-               }
-               if (num_printed++ < 10)
-                       printk(KERN_ERR "iSeries_Write_Word: invalid access at IO address %p\n",
-                              IoAddress);
+       if (dn == NULL)
                return;
-       }
        do {
-               rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, data, 0);
-       } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0);
+               rc = HvCall4(HvCallPciBarStore16, dsa, bar_offset, data, 0);
+       } while (check_return_code("WWW", dn, &retry, rc) != 0);
 }
 
-static void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
+static void iseries_writel_be(u32 data, volatile void __iomem *addr)
 {
-       u64 BarOffset;
+       u64 bar_offset;
        u64 dsa;
        int retry = 0;
        u64 rc;
-       struct device_node *DevNode =
-               xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+       struct device_node *dn =
+               xlate_iomm_address(addr, &dsa, &bar_offset, "write_long");
 
-       if (DevNode == NULL) {
-               static unsigned long last_jiffies;
-               static int num_printed;
-
-               if ((jiffies - last_jiffies) > 60 * HZ) {
-                       last_jiffies = jiffies;
-                       num_printed = 0;
-               }
-               if (num_printed++ < 10)
-                       printk(KERN_ERR "iSeries_Write_Long: invalid access at IO address %p\n",
-                              IoAddress);
+       if (dn == NULL)
                return;
-       }
        do {
-               rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, data, 0);
-       } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0);
-}
-
-static u8 iseries_readb(const volatile void __iomem *addr)
-{
-       return iSeries_Read_Byte(addr);
+               rc = HvCall4(HvCallPciBarStore32, dsa, bar_offset, data, 0);
+       } while (check_return_code("WWL", dn, &retry, rc) != 0);
 }
 
 static u16 iseries_readw(const volatile void __iomem *addr)
 {
-       return le16_to_cpu(iSeries_Read_Word(addr));
+       return le16_to_cpu(iseries_readw_be(addr));
 }
 
 static u32 iseries_readl(const volatile void __iomem *addr)
 {
-       return le32_to_cpu(iSeries_Read_Long(addr));
-}
-
-static u16 iseries_readw_be(const volatile void __iomem *addr)
-{
-       return iSeries_Read_Word(addr);
-}
-
-static u32 iseries_readl_be(const volatile void __iomem *addr)
-{
-       return iSeries_Read_Long(addr);
-}
-
-static void iseries_writeb(u8 data, volatile void __iomem *addr)
-{
-       iSeries_Write_Byte(data, addr);
+       return le32_to_cpu(iseries_readl_be(addr));
 }
 
 static void iseries_writew(u16 data, volatile void __iomem *addr)
 {
-       iSeries_Write_Word(cpu_to_le16(data), addr);
+       iseries_writew_be(cpu_to_le16(data), addr);
 }
 
 static void iseries_writel(u32 data, volatile void __iomem *addr)
 {
-       iSeries_Write_Long(cpu_to_le32(data), addr);
-}
-
-static void iseries_writew_be(u16 data, volatile void __iomem *addr)
-{
-       iSeries_Write_Word(data, addr);
-}
-
-static void iseries_writel_be(u32 data, volatile void __iomem *addr)
-{
-       iSeries_Write_Long(data, addr);
+       iseries_writel(cpu_to_le32(data), addr);
 }
 
 static void iseries_readsb(const volatile void __iomem *addr, void *buf,
@@ -621,7 +524,7 @@ static void iseries_readsb(const volatile void __iomem *addr, void *buf,
 {
        u8 *dst = buf;
        while(count-- > 0)
-               *(dst++) = iSeries_Read_Byte(addr);
+               *(dst++) = iseries_readb(addr);
 }
 
 static void iseries_readsw(const volatile void __iomem *addr, void *buf,
@@ -629,7 +532,7 @@ static void iseries_readsw(const volatile void __iomem *addr, void *buf,
 {
        u16 *dst = buf;
        while(count-- > 0)
-               *(dst++) = iSeries_Read_Word(addr);
+               *(dst++) = iseries_readw_be(addr);
 }
 
 static void iseries_readsl(const volatile void __iomem *addr, void *buf,
@@ -637,7 +540,7 @@ static void iseries_readsl(const volatile void __iomem *addr, void *buf,
 {
        u32 *dst = buf;
        while(count-- > 0)
-               *(dst++) = iSeries_Read_Long(addr);
+               *(dst++) = iseries_readl_be(addr);
 }
 
 static void iseries_writesb(volatile void __iomem *addr, const void *buf,
@@ -645,7 +548,7 @@ static void iseries_writesb(volatile void __iomem *addr, const void *buf,
 {
        const u8 *src = buf;
        while(count-- > 0)
-               iSeries_Write_Byte(*(src++), addr);
+               iseries_writeb(*(src++), addr);
 }
 
 static void iseries_writesw(volatile void __iomem *addr, const void *buf,
@@ -653,7 +556,7 @@ static void iseries_writesw(volatile void __iomem *addr, const void *buf,
 {
        const u16 *src = buf;
        while(count-- > 0)
-               iSeries_Write_Word(*(src++), addr);
+               iseries_writew_be(*(src++), addr);
 }
 
 static void iseries_writesl(volatile void __iomem *addr, const void *buf,
@@ -661,7 +564,7 @@ static void iseries_writesl(volatile void __iomem *addr, const void *buf,
 {
        const u32 *src = buf;
        while(count-- > 0)
-               iSeries_Write_Long(*(src++), addr);
+               iseries_writel_be(*(src++), addr);
 }
 
 static void iseries_memset_io(volatile void __iomem *addr, int c,
@@ -670,7 +573,7 @@ static void iseries_memset_io(volatile void __iomem *addr, int c,
        volatile char __iomem *d = addr;
 
        while (n-- > 0)
-               iSeries_Write_Byte(c, d++);
+               iseries_writeb(c, d++);
 }
 
 static void iseries_memcpy_fromio(void *dest, const volatile void __iomem *src,
@@ -680,7 +583,7 @@ static void iseries_memcpy_fromio(void *dest, const volatile void __iomem *src,
        const volatile char __iomem *s = src;
 
        while (n-- > 0)
-               *d++ = iSeries_Read_Byte(s++);
+               *d++ = iseries_readb(s++);
 }
 
 static void iseries_memcpy_toio(volatile void __iomem *dest, const void *src,
@@ -690,7 +593,7 @@ static void iseries_memcpy_toio(volatile void __iomem *dest, const void *src,
        volatile char __iomem *d = dest;
 
        while (n-- > 0)
-               iSeries_Write_Byte(*s++, d++);
+               iseries_writeb(*s++, d++);
 }
 
 /* We only set MMIO ops. The default PIO ops will be default
@@ -743,6 +646,13 @@ void __init iSeries_pcibios_init(void)
        /* Install IO hooks */
        ppc_pci_io = iseries_pci_io;
 
+       pci_probe_only = 1;
+
+       /* iSeries has no IO space in the common sense, it needs to set
+        * the IO base to 0
+        */
+       pci_io_base = 0;
+
        if (root == NULL) {
                printk(KERN_CRIT "iSeries_pcibios_init: can't find root "
                                "of device tree\n");
@@ -755,7 +665,7 @@ void __init iSeries_pcibios_init(void)
                if ((node->type == NULL) || (strcmp(node->type, "pci") != 0))
                        continue;
 
-               busp = get_property(node, "bus-range", NULL);
+               busp = of_get_property(node, "bus-range", NULL);
                if (busp == NULL)
                        continue;
                bus = *busp;
@@ -763,8 +673,10 @@ void __init iSeries_pcibios_init(void)
                phb = pcibios_alloc_controller(node);
                if (phb == NULL)
                        continue;
+               /* All legacy iSeries PHBs are in domain zero */
+               phb->global_number = 0;
 
-               phb->pci_mem_offset = phb->local_number = bus;
+               phb->pci_mem_offset = bus;
                phb->first_busno = bus;
                phb->last_busno = bus;
                phb->ops = &iSeries_pci_ops;