BPA is using rtas for PCI but should not be confused by
(BpSeries code. This also avoids some #ifdefs. Other
(Bplatforms that want to use rtas_pci.c should also create
(Btheir own platform_pci.c with platform specific fixups.
(B
(BSigned-off-by: Arnd Bergmann <[EMAIL PROTECTED]>
(B
(B--- linux-2.6-ppc.orig/arch/ppc64/kernel/mpic.h 2005-04-01 13:29:21.078978944
(B-0500
(B+++ linux-2.6-ppc/arch/ppc64/kernel/mpic.h 2005-04-01 13:30:10.431932216
(B-0500
(B@@ -265,3 +265,6 @@ extern void mpic_send_ipi(unsigned int i
(B extern int mpic_get_one_irq(struct mpic *mpic, struct pt_regs *regs);
(B /* This one gets to the primary mpic */
(B extern int mpic_get_irq(struct pt_regs *regs);
(B+
(B+/* global mpic for pSeries */
(B+extern struct mpic *pSeries_mpic;
(B--- linux-2.6-ppc.orig/arch/ppc64/kernel/pSeries_pci.c 1969-12-31
(B19:00:00.000000000 -0500
(B+++ linux-2.6-ppc/arch/ppc64/kernel/pSeries_pci.c 2005-04-01
(B13:29:25.018912520 -0500
(B@@ -0,0 +1,138 @@
(B+/*
(B+ * arch/ppc64/kernel/pSeries_pci.c
(B+ *
(B+ * Copyright (C) 2001 Dave Engebretsen, IBM Corporation
(B+ * Copyright (C) 2003 Anton Blanchard <[EMAIL PROTECTED]>, IBM
(B+ *
(B+ * pSeries specific routines for PCI.
(B+ *
(B+ * This program is free software; you can redistribute it and/or modify
(B+ * it under the terms of the GNU General Public License as published by
(B+ * the Free Software Foundation; either version 2 of the License, or
(B+ * (at your option) any later version.
(B+ *
(B+ * This program is distributed in the hope that it will be useful,
(B+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
(B+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(B+ * GNU General Public License for more details.
(B+ *
(B+ * You should have received a copy of the GNU General Public License
(B+ * along with this program; if not, write to the Free Software
(B+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(B+ */
(B+
(B+#include <linux/init.h>
(B+#include <linux/ioport.h>
(B+#include <linux/kernel.h>
(B+#include <linux/pci.h>
(B+#include <linux/string.h>
(B+
(B+#include <asm/pci-bridge.h>
(B+#include <asm/prom.h>
(B+
(B+#include "pci.h"
(B+
(B+static int __initdata s7a_workaround;
(B+
(B+#if 0
(B+void pcibios_name_device(struct pci_dev *dev)
(B+{
(B+ struct device_node *dn;
(B+
(B+ /*
(B+ * Add IBM loc code (slot) as a prefix to the device names for service
(B+ */
(B+ dn = pci_device_to_OF_node(dev);
(B+ if (dn) {
(B+ char *loc_code = get_property(dn, "ibm,loc-code", 0);
(B+ if (loc_code) {
(B+ int loc_len = strlen(loc_code);
(B+ if (loc_len < sizeof(dev->dev.name)) {
(B+ memmove(dev->dev.name+loc_len+1, dev->dev.name,
(B+ sizeof(dev->dev.name)-loc_len-1);
(B+ memcpy(dev->dev.name, loc_code, loc_len);
(B+ dev->dev.name[loc_len] = ' ';
(B+ dev->dev.name[sizeof(dev->dev.name)-1] = '\0';
(B+ }
(B+ }
(B+ }
(B+}
(B+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device);
(B+#endif
(B+
(B+static void __init check_s7a(void)
(B+{
(B+ struct device_node *root;
(B+ char *model;
(B+
(B+ root = of_find_node_by_path("/");
(B+ if (root) {
(B+ model = get_property(root, "model", NULL);
(B+ if (model && !strcmp(model, "IBM,7013-S7A"))
(B+ s7a_workaround = 1;
(B+ of_node_put(root);
(B+ }
(B+}
(B+
(B+static void __init pSeries_request_regions(void)
(B+{
(B+ if (!isa_io_base)
(B+ return;
(B+
(B+ request_region(0x20,0x20,"pic1");
(B+ request_region(0xa0,0x20,"pic2");
(B+ request_region(0x00,0x20,"dma1");
(B+ request_region(0x40,0x20,"timer");
(B+ request_region(0x80,0x10,"dma page reg");
(B+ request_region(0xc0,0x20,"dma2");
(B+}
(B+
(B+void __init pSeries_final_fixup(void)
(B+{
(B+ struct pci_dev *dev = NULL;
(B+
(B+ check_s7a();
(B+
(B+ for_each_pci_dev(dev) {
(B+ pci_read_irq_line(dev);
(B+ if (s7a_workaround) {
(B+ if (dev->irq > 16) {
(B+ dev->irq -= 3;
(B+ pci_write_config_byte(dev, PCI_INTERRUPT_LINE,
(Bdev->irq);
(B+ }
(B+ }
(B+ }
(B+
(B+ phbs_remap_io();
(B+ pSeries_request_regions();
(B+
(B+ pci_addr_cache_build();
(B+}
(B+
(B+/*
(B+ * Assume the winbond 82c105 is the IDE controller on a
(B+ * p610. We should probably be more careful in case
(B+ * someone tries to plug in a similar adapter.
(B+ */
(B+static void fixup_winbond_82c105(struct pci_dev* dev)
(B+{
(B+ int i;
(B+ unsigned int reg;
(B+
(B+ if (!(systemcfg->platform & PLATFORM_PSERIES))
(B+ return;
(B+
(B+ printk("Using INTC for W82c105 IDE controller.\n");
(B+ pci_read_config_dword(dev, 0x40, ®);
(B+ /* Enable LEGIRQ to use INTC instead of ISA interrupts */
(B+ pci_write_config_dword(dev, 0x40, reg | (1<<11));
(B+
(B+ for (i = 0; i < DEVICE_COUNT_RESOURCE; ++i) {
(B+ /* zap the 2nd function of the winbond chip */
(B+ if (dev->resource[i].flags & IORESOURCE_IO
(B+ && dev->bus->number == 0 && dev->devfn == 0x81)
(B+ dev->resource[i].flags &= ~IORESOURCE_IO;
(B+ }
(B+}
(B+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
(B+ fixup_winbond_82c105);
(B--- linux-2.6-ppc.orig/arch/ppc64/kernel/rtas_pci.c 2005-04-01
(B13:28:56.169905768 -0500
(B+++ linux-2.6-ppc/arch/ppc64/kernel/rtas_pci.c 2005-04-01 13:29:25.019912368
(B-0500
(B@@ -1,12 +1,12 @@
(B /*
(B- * pSeries_pci.c
(B+ * arch/ppc64/kernel/rtas_pci.c
(B *
(B * Copyright (C) 2001 Dave Engebretsen, IBM Corporation
(B * Copyright (C) 2003 Anton Blanchard <[EMAIL PROTECTED]>, IBM
(B *
(B- * pSeries specific routines for PCI.
(B+ * RTAS specific routines for PCI.
(B *
(B- * Based on code from pci.c and chrp_pci.c
(B+ * Based on code from pci.c, chrp_pci.c and pSeries_pci.c
(B *
(B * This program is free software; you can redistribute it and/or modify
(B * it under the terms of the GNU General Public License as published by
(B@@ -48,10 +48,6 @@ static int write_pci_config;
(B static int ibm_read_pci_config;
(B static int ibm_write_pci_config;
(B
(B-static int s7a_workaround;
(B-
(B-extern struct mpic *pSeries_mpic;
(B-
(B static int config_access_valid(struct device_node *dn, int where)
(B {
(B if (where < 256)
(B@@ -385,12 +381,12 @@ unsigned long __init find_and_init_phbs(
(B
(B pci_process_bridge_OF_ranges(phb, node);
(B pci_setup_phb_io(phb, index == 0);
(B-
(B+#ifdef CONFIG_PPC_PSERIES
(B if (ppc64_interrupt_controller == IC_OPEN_PIC && pSeries_mpic) {
(B int addr = root_size_cells * (index + 2) - 1;
(B mpic_assign_isu(pSeries_mpic, index, opprop[addr]);
(B }
(B-
(B+#endif
(B index++;
(B }
(B
(B@@ -448,46 +444,6 @@ struct pci_controller * __devinit init_p
(B }
(B EXPORT_SYMBOL(init_phb_dynamic);
(B
(B-#if 0
(B-void pcibios_name_device(struct pci_dev *dev)
(B-{
(B- struct device_node *dn;
(B-
(B- /*
(B- * Add IBM loc code (slot) as a prefix to the device names for service
(B- */
(B- dn = pci_device_to_OF_node(dev);
(B- if (dn) {
(B- char *loc_code = get_property(dn, "ibm,loc-code", 0);
(B- if (loc_code) {
(B- int loc_len = strlen(loc_code);
(B- if (loc_len < sizeof(dev->dev.name)) {
(B- memmove(dev->dev.name+loc_len+1, dev->dev.name,
(B- sizeof(dev->dev.name)-loc_len-1);
(B- memcpy(dev->dev.name, loc_code, loc_len);
(B- dev->dev.name[loc_len] = ' ';
(B- dev->dev.name[sizeof(dev->dev.name)-1] = '\0';
(B- }
(B- }
(B- }
(B-}
(B-DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device);
(B-#endif
(B-
(B-static void check_s7a(void)
(B-{
(B- struct device_node *root;
(B- char *model;
(B-
(B- root = of_find_node_by_path("/");
(B- if (root) {
(B- model = get_property(root, "model", NULL);
(B- if (model && !strcmp(model, "IBM,7013-S7A"))
(B- s7a_workaround = 1;
(B- of_node_put(root);
(B- }
(B-}
(B-
(B /* RPA-specific bits for removing PHBs */
(B int pcibios_remove_root_bus(struct pci_controller *phb)
(B {
(B@@ -537,66 +493,3 @@ int pcibios_remove_root_bus(struct pci_c
(B return 0;
(B }
(B EXPORT_SYMBOL(pcibios_remove_root_bus);
(B-
(B-static void __init pSeries_request_regions(void)
(B-{
(B- if (!isa_io_base)
(B- return;
(B-
(B- request_region(0x20,0x20,"pic1");
(B- request_region(0xa0,0x20,"pic2");
(B- request_region(0x00,0x20,"dma1");
(B- request_region(0x40,0x20,"timer");
(B- request_region(0x80,0x10,"dma page reg");
(B- request_region(0xc0,0x20,"dma2");
(B-}
(B-
(B-void __init pSeries_final_fixup(void)
(B-{
(B- struct pci_dev *dev = NULL;
(B-
(B- check_s7a();
(B-
(B- for_each_pci_dev(dev) {
(B- pci_read_irq_line(dev);
(B- if (s7a_workaround) {
(B- if (dev->irq > 16) {
(B- dev->irq -= 3;
(B- pci_write_config_byte(dev, PCI_INTERRUPT_LINE,
(Bdev->irq);
(B- }
(B- }
(B- }
(B-
(B- phbs_remap_io();
(B- pSeries_request_regions();
(B-
(B- pci_addr_cache_build();
(B-}
(B-
(B-/*
(B- * Assume the winbond 82c105 is the IDE controller on a
(B- * p610. We should probably be more careful in case
(B- * someone tries to plug in a similar adapter.
(B- */
(B-static void fixup_winbond_82c105(struct pci_dev* dev)
(B-{
(B- int i;
(B- unsigned int reg;
(B-
(B- if (!(systemcfg->platform & PLATFORM_PSERIES))
(B- return;
(B-
(B- printk("Using INTC for W82c105 IDE controller.\n");
(B- pci_read_config_dword(dev, 0x40, ®);
(B- /* Enable LEGIRQ to use INTC instead of ISA interrupts */
(B- pci_write_config_dword(dev, 0x40, reg | (1<<11));
(B-
(B- for (i = 0; i < DEVICE_COUNT_RESOURCE; ++i) {
(B- /* zap the 2nd function of the winbond chip */
(B- if (dev->resource[i].flags & IORESOURCE_IO
(B- && dev->bus->number == 0 && dev->devfn == 0x81)
(B- dev->resource[i].flags &= ~IORESOURCE_IO;
(B- }
(B-}
(B-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
(B- fixup_winbond_82c105);
(B
(B-
(BTo unsubscribe from this list: send the line "unsubscribe linux-kernel" in
(Bthe body of a message to [EMAIL PROTECTED]
(BMore majordomo info at http://vger.kernel.org/majordomo-info.html
(BPlease read the FAQ at http://www.tux.org/lkml/