config PPC_CHRP
        bool "  Common Hardware Reference Platform (CHRP) based machines"
        depends on PPC_MULTIPLATFORM && PPC32
+       select PPC_INDIRECT_PCI
        default y
 
 config PPC_PMAC
        bool "  Apple PowerMac based machines"
        depends on PPC_MULTIPLATFORM
+       select PPC_INDIRECT_PCI if PPC32
        default y
 
 config PPC_PMAC64
 config PPC_PREP
        bool "  PowerPC Reference Platform (PReP) based machines"
        depends on PPC_MULTIPLATFORM && PPC32
+       select PPC_INDIRECT_PCI
        default y
 
 config PPC_MAPLE
        depends on PPC64 || POWER4 || 6xx && !CPM2
        default y
 
+config PPC_INDIRECT_PCI
+       bool
+       depends on PCI
+       default y if 40x || 44x || 85xx || 83xx
+       default n
+
 config EISA
        bool
 
 config PCI_8260
        bool
        depends on PCI && 8260
+       select PPC_INDIRECT_PCI
        default y
 
 config 8260_PCI9
 
 
 config SPRUCE
        bool "IBM-Spruce"
+       select PPC_INDIRECT_PCI
 
 config HDPU
        bool "Sky-HDPU"
 
 config MVME5100
        bool "Motorola-MVME5100"
+       select PPC_INDIRECT_PCI
 
 config PPLUS
        bool "Motorola-PowerPlus"
+       select PPC_INDIRECT_PCI
 
 config PRPMC750
        bool "Motorola-PrPMC750"
+       select PPC_INDIRECT_PCI
 
 config PRPMC800
        bool "Motorola-PrPMC800"
+       select PPC_INDIRECT_PCI
 
 config SANDPOINT
        bool "Motorola-Sandpoint"
 
 config GEMINI
        bool "Synergy-Gemini"
+       select PPC_INDIRECT_PCI
        depends on BROKEN
        help
          Select Gemini if configuring for a Synergy Microsystems' Gemini
 config MV64X60
        bool
        depends on (GT64260 || MV64360)
+       select PPC_INDIRECT_PCI
        default y
 
 menu "Set bridge options"
 config MPC10X_BRIDGE
        bool
        depends on POWERPMC250 || LOPEC || SANDPOINT
+       select PPC_INDIRECT_PCI
        default y
 
 config MPC10X_OPENPIC
 
 obj-$(CONFIG_MPIC)             += mpic.o
-indirectpci-$(CONFIG_PPC_PMAC) = indirect_pci.o
-obj-$(CONFIG_PPC32)            += $(indirectpci-y)
+obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
 
 
 config SPRUCE
        bool "IBM-Spruce"
+       select PPC_INDIRECT_PCI
 
 config HDPU
        bool "Sky-HDPU"
 
 config MVME5100
        bool "Motorola-MVME5100"
+       select PPC_INDIRECT_PCI
 
 config PPLUS
        bool "Motorola-PowerPlus"
+       select PPC_INDIRECT_PCI
 
 config PRPMC750
        bool "Motorola-PrPMC750"
+       select PPC_INDIRECT_PCI
 
 config PRPMC800
        bool "Motorola-PrPMC800"
+       select PPC_INDIRECT_PCI
 
 config SANDPOINT
        bool "Motorola-Sandpoint"
 config GEMINI
        bool "Synergy-Gemini"
        depends on BROKEN
+       select PPC_INDIRECT_PCI
        help
          Select Gemini if configuring for a Synergy Microsystems' Gemini
          series Single Board Computer.  More information is available at:
 config PPC_CHRP
        bool "  Common Hardware Reference Platform (CHRP) based machines"
        depends on PPC_MULTIPLATFORM
+       select PPC_INDIRECT_PCI
        default y
 
 config PPC_PMAC
        bool "  Apple PowerMac based machines"
        depends on PPC_MULTIPLATFORM
+       select PPC_INDIRECT_PCI
        default y
 
 config PPC_PMAC64
 config PPC_PREP
        bool "  PowerPC Reference Platform (PReP) based machines"
        depends on PPC_MULTIPLATFORM
+       select PPC_INDIRECT_PCI
        default y
 
 config PPC_OF
 config MV64X60
        bool
        depends on (GT64260 || MV64360)
+       select PPC_INDIRECT_PCI
        default y
 
 menu "Set bridge options"
 config MPC10X_BRIDGE
        bool
        depends on POWERPMC250 || LOPEC || SANDPOINT
+       select PPC_INDIRECT_PCI
        default y
 
 config MPC10X_OPENPIC
        depends on POWER3 || POWER4 || 6xx && !CPM2
        default y
 
+config PPC_INDIRECT_PCI
+       bool
+       depends on PCI
+       default y if 40x || 44x || 85xx || 83xx
+       default n
+
 config EISA
        bool
        help
 config PCI_8260
        bool
        depends on PCI && 8260
+       select PPC_INDIRECT_PCI
        default y
 
 config 8260_PCI9
 
 
 core-y                         += arch/ppc/kernel/ arch/powerpc/kernel/ \
                                   arch/ppc/platforms/ \
-                                  arch/ppc/mm/ arch/ppc/lib/ arch/ppc/syslib/
+                                  arch/ppc/mm/ arch/ppc/lib/ \
+                                  arch/ppc/syslib/ arch/powerpc/sysdev/
 core-$(CONFIG_4xx)             += arch/ppc/platforms/4xx/
 core-$(CONFIG_83xx)            += arch/ppc/platforms/83xx/
 core-$(CONFIG_85xx)            += arch/ppc/platforms/85xx/
 
 obj-$(CONFIG_PPC4xx_DMA)       += ppc4xx_dma.o
 obj-$(CONFIG_PPC4xx_EDMA)      += ppc4xx_sgdma.o
 ifeq ($(CONFIG_40x),y)
-obj-$(CONFIG_PCI)              += indirect_pci.o pci_auto.o ppc405_pci.o
+obj-$(CONFIG_PCI)              += pci_auto.o ppc405_pci.o
 endif
 endif
 obj-$(CONFIG_8xx)              += m8xx_setup.o ppc8xx_pic.o $(wdt-mpc8xx-y) \
 obj-$(CONFIG_PCI)              += qspan_pci.o i8259.o
 endif
 obj-$(CONFIG_PPC_OF)           += prom_init.o prom.o
-obj-$(CONFIG_PPC_PMAC)         += open_pic.o indirect_pci.o
+obj-$(CONFIG_PPC_PMAC)         += open_pic.o
 obj-$(CONFIG_POWER4)           += open_pic2.o
-obj-$(CONFIG_PPC_CHRP)         += open_pic.o indirect_pci.o i8259.o
-obj-$(CONFIG_PPC_PREP)         += open_pic.o indirect_pci.o i8259.o todc_time.o
-obj-$(CONFIG_BAMBOO)           += indirect_pci.o pci_auto.o todc_time.o
+obj-$(CONFIG_PPC_CHRP)         += open_pic.o i8259.o
+obj-$(CONFIG_PPC_PREP)         += open_pic.o i8259.o todc_time.o
+obj-$(CONFIG_BAMBOO)           += pci_auto.o todc_time.o
 obj-$(CONFIG_CPCI690)          += todc_time.o pci_auto.o
-obj-$(CONFIG_EBONY)            += indirect_pci.o pci_auto.o todc_time.o
+obj-$(CONFIG_EBONY)            += pci_auto.o todc_time.o
 obj-$(CONFIG_EV64260)          += todc_time.o pci_auto.o
 obj-$(CONFIG_CHESTNUT)         += mv64360_pic.o pci_auto.o
-obj-$(CONFIG_GEMINI)           += open_pic.o indirect_pci.o
+obj-$(CONFIG_GEMINI)           += open_pic.o
 obj-$(CONFIG_GT64260)          += gt64260_pic.o
 obj-$(CONFIG_LOPEC)            += i8259.o pci_auto.o todc_time.o
 obj-$(CONFIG_HDPU)             += pci_auto.o
-obj-$(CONFIG_LUAN)             += indirect_pci.o pci_auto.o todc_time.o
+obj-$(CONFIG_LUAN)             += pci_auto.o todc_time.o
 obj-$(CONFIG_KATANA)           += pci_auto.o
 obj-$(CONFIG_MV64360)          += mv64360_pic.o
-obj-$(CONFIG_MV64X60)          += mv64x60.o mv64x60_win.o indirect_pci.o
-obj-$(CONFIG_MVME5100)         += open_pic.o todc_time.o indirect_pci.o \
+obj-$(CONFIG_MV64X60)          += mv64x60.o mv64x60_win.o
+obj-$(CONFIG_MVME5100)         += open_pic.o todc_time.o \
                                        pci_auto.o hawk_common.o
 obj-$(CONFIG_MVME5100_IPMC761_PRESENT) += i8259.o
-obj-$(CONFIG_OCOTEA)           += indirect_pci.o pci_auto.o todc_time.o
+obj-$(CONFIG_OCOTEA)           += pci_auto.o todc_time.o
 obj-$(CONFIG_PAL4)             += cpc700_pic.o
 obj-$(CONFIG_POWERPMC250)      += pci_auto.o
 obj-$(CONFIG_PPLUS)            += hawk_common.o open_pic.o i8259.o \
-                                  indirect_pci.o todc_time.o pci_auto.o
-obj-$(CONFIG_PRPMC750)         += open_pic.o indirect_pci.o pci_auto.o \
+                                  todc_time.o pci_auto.o
+obj-$(CONFIG_PRPMC750)         += open_pic.o pci_auto.o \
                                        hawk_common.o
 obj-$(CONFIG_HARRIER)          += harrier.o
-obj-$(CONFIG_PRPMC800)         += open_pic.o indirect_pci.o pci_auto.o
+obj-$(CONFIG_PRPMC800)         += open_pic.o pci_auto.o
 obj-$(CONFIG_RADSTONE_PPC7D)   += i8259.o pci_auto.o
 obj-$(CONFIG_SANDPOINT)                += i8259.o pci_auto.o todc_time.o
 obj-$(CONFIG_SBC82xx)          += todc_time.o
-obj-$(CONFIG_SPRUCE)           += cpc700_pic.o indirect_pci.o pci_auto.o \
+obj-$(CONFIG_SPRUCE)           += cpc700_pic.o pci_auto.o \
                                   todc_time.o
 obj-$(CONFIG_8260)             += m8260_setup.o pq2_devices.o pq2_sys.o \
                                   ppc_sys.o
-obj-$(CONFIG_PCI_8260)         += m82xx_pci.o indirect_pci.o pci_auto.o
+obj-$(CONFIG_PCI_8260)         += m82xx_pci.o pci_auto.o
 obj-$(CONFIG_8260_PCI9)                += m8260_pci_erratum9.o
 obj-$(CONFIG_CPM2)             += cpm2_common.o cpm2_pic.o
 ifeq ($(CONFIG_PPC_GEN550),y)
 obj-$(CONFIG_SERIAL_TEXT_DEBUG)        += mv64x60_dbg.o
 endif
 obj-$(CONFIG_BOOTX_TEXT)       += btext.o
-obj-$(CONFIG_MPC10X_BRIDGE)    += mpc10x_common.o indirect_pci.o ppc_sys.o
+obj-$(CONFIG_MPC10X_BRIDGE)    += mpc10x_common.o ppc_sys.o
 obj-$(CONFIG_MPC10X_OPENPIC)   += open_pic.o
 obj-$(CONFIG_40x)              += dcr.o
 obj-$(CONFIG_BOOKE)            += dcr.o
                                        ppc_sys.o i8259.o mpc85xx_sys.o \
                                        mpc85xx_devices.o
 ifeq ($(CONFIG_85xx),y)
-obj-$(CONFIG_PCI)              += indirect_pci.o pci_auto.o
+obj-$(CONFIG_PCI)              += pci_auto.o
 endif
 obj-$(CONFIG_83xx)             += ipic.o ppc83xx_setup.o ppc_sys.o \
                                        mpc83xx_sys.o mpc83xx_devices.o
 ifeq ($(CONFIG_83xx),y)
-obj-$(CONFIG_PCI)              += indirect_pci.o pci_auto.o
+obj-$(CONFIG_PCI)              += pci_auto.o
 endif
 obj-$(CONFIG_MPC8548_CDS)      += todc_time.o
 obj-$(CONFIG_MPC8555_CDS)      += todc_time.o
 
+++ /dev/null
-/*
- * Support for indirect PCI bridges.
- *
- * Copyright (C) 1998 Gabriel Paubert.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <linux/string.h>
-#include <linux/init.h>
-
-#include <asm/io.h>
-#include <asm/prom.h>
-#include <asm/pci-bridge.h>
-#include <asm/machdep.h>
-
-#ifdef CONFIG_PPC_INDIRECT_PCI_BE
-#define PCI_CFG_OUT out_be32
-#else
-#define PCI_CFG_OUT out_le32
-#endif
-
-static int
-indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
-                    int len, u32 *val)
-{
-       struct pci_controller *hose = bus->sysdata;
-       volatile void __iomem *cfg_data;
-       u8 cfg_type = 0;
-
-       if (ppc_md.pci_exclude_device)
-               if (ppc_md.pci_exclude_device(bus->number, devfn))
-                       return PCIBIOS_DEVICE_NOT_FOUND;
-       
-       if (hose->set_cfg_type)
-               if (bus->number != hose->first_busno)
-                       cfg_type = 1;
-
-       PCI_CFG_OUT(hose->cfg_addr,                                      
-                (0x80000000 | ((bus->number - hose->bus_offset) << 16)
-                 | (devfn << 8) | ((offset & 0xfc) | cfg_type)));
-
-       /*
-        * Note: the caller has already checked that offset is
-        * suitably aligned and that len is 1, 2 or 4.
-        */
-       cfg_data = hose->cfg_data + (offset & 3);
-       switch (len) {
-       case 1:
-               *val = in_8(cfg_data);
-               break;
-       case 2:
-               *val = in_le16(cfg_data);
-               break;
-       default:
-               *val = in_le32(cfg_data);
-               break;
-       }
-       return PCIBIOS_SUCCESSFUL;
-}
-
-static int
-indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
-                     int len, u32 val)
-{
-       struct pci_controller *hose = bus->sysdata;
-       volatile void __iomem *cfg_data;
-       u8 cfg_type = 0;
-
-       if (ppc_md.pci_exclude_device)
-               if (ppc_md.pci_exclude_device(bus->number, devfn))
-                       return PCIBIOS_DEVICE_NOT_FOUND;
-
-       if (hose->set_cfg_type)
-               if (bus->number != hose->first_busno)
-                       cfg_type = 1;
-
-       PCI_CFG_OUT(hose->cfg_addr,                                      
-                (0x80000000 | ((bus->number - hose->bus_offset) << 16)
-                 | (devfn << 8) | ((offset & 0xfc) | cfg_type)));
-
-       /*
-        * Note: the caller has already checked that offset is
-        * suitably aligned and that len is 1, 2 or 4.
-        */
-       cfg_data = hose->cfg_data + (offset & 3);
-       switch (len) {
-       case 1:
-               out_8(cfg_data, val);
-               break;
-       case 2:
-               out_le16(cfg_data, val);
-               break;
-       default:
-               out_le32(cfg_data, val);
-               break;
-       }
-       return PCIBIOS_SUCCESSFUL;
-}
-
-static struct pci_ops indirect_pci_ops =
-{
-       indirect_read_config,
-       indirect_write_config
-};
-
-void __init
-setup_indirect_pci_nomap(struct pci_controller* hose, void __iomem * cfg_addr,
-       void __iomem * cfg_data)
-{
-       hose->cfg_addr = cfg_addr;
-       hose->cfg_data = cfg_data;
-       hose->ops = &indirect_pci_ops;
-}
-
-void __init
-setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
-{
-       unsigned long base = cfg_addr & PAGE_MASK;
-       void __iomem *mbase, *addr, *data;
-
-       mbase = ioremap(base, PAGE_SIZE);
-       addr = mbase + (cfg_addr & ~PAGE_MASK);
-       if ((cfg_data & PAGE_MASK) != base)
-               mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE);
-       data = mbase + (cfg_data & ~PAGE_MASK);
-       setup_indirect_pci_nomap(hose, addr, data);
-}