From 1be9baa09340bbe3329aab3bd0d41076f59c8f22 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Tue, 9 Dec 2008 16:12:07 -0700 Subject: PCI: alpha: use generic pci_swizzle_interrupt_pin() Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code. Cc: Ivan Kokshaysky Signed-off-by: Bjorn Helgaas Signed-off-by: Jesse Barnes --- arch/alpha/kernel/pci.c | 2 +- arch/alpha/kernel/pci_impl.h | 9 ++------- arch/alpha/kernel/sys_dp264.c | 2 +- arch/alpha/kernel/sys_eiger.c | 2 +- arch/alpha/kernel/sys_miata.c | 2 +- arch/alpha/kernel/sys_noritake.c | 2 +- arch/alpha/kernel/sys_ruffian.c | 2 +- arch/alpha/kernel/sys_sable.c | 2 +- 8 files changed, 9 insertions(+), 14 deletions(-) (limited to 'arch/alpha/kernel') diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index ff8cb638472e..b03d9f420425 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c @@ -328,7 +328,7 @@ common_swizzle(struct pci_dev *dev, u8 *pinp) u8 pin = *pinp; while (dev->bus->parent) { - pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); + pin = pci_swizzle_interrupt_pin(dev, pin); /* Move up the chain of bridges. */ dev = dev->bus->self; } diff --git a/arch/alpha/kernel/pci_impl.h b/arch/alpha/kernel/pci_impl.h index f8b74995a002..7336651592a3 100644 --- a/arch/alpha/kernel/pci_impl.h +++ b/arch/alpha/kernel/pci_impl.h @@ -106,16 +106,11 @@ struct pci_iommu_arena; * Where A = pin 1, B = pin 2 and so on and pin=0 = default = A. * Thus, each swizzle is ((pin-1) + (device#-4)) % 4 * - * The following code swizzles for exactly one bridge. The routine + * pci_swizzle_interrupt_pin() swizzles for exactly one bridge. The routine * common_swizzle below handles multiple bridges. But there are a - * couple boards that do strange things, so we define this here. + * couple boards that do strange things. */ -static inline u8 bridge_swizzle(u8 pin, u8 slot) -{ - return (((pin-1) + slot) % 4) + 1; -} - /* The following macro is used to implement the table-based irq mapping function for all single-bus Alphas. */ diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c index ab44c164d9d4..9c9d1fd4155f 100644 --- a/arch/alpha/kernel/sys_dp264.c +++ b/arch/alpha/kernel/sys_dp264.c @@ -481,7 +481,7 @@ monet_swizzle(struct pci_dev *dev, u8 *pinp) slot = PCI_SLOT(dev->devfn); break; } - pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)) ; + pin = pci_swizzle_interrupt_pin(dev, pin); /* Move up the chain of bridges. */ dev = dev->bus->self; diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c index 7ef3b6fb3700..baf60f36cbd7 100644 --- a/arch/alpha/kernel/sys_eiger.c +++ b/arch/alpha/kernel/sys_eiger.c @@ -204,7 +204,7 @@ eiger_swizzle(struct pci_dev *dev, u8 *pinp) break; } /* Must be a card-based bridge. */ - pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); + pin = pci_swizzle_interrupt_pin(dev, pin); /* Move up the chain of bridges. */ dev = dev->bus->self; diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c index 910b43cd63e8..61ccd95579ec 100644 --- a/arch/alpha/kernel/sys_miata.c +++ b/arch/alpha/kernel/sys_miata.c @@ -219,7 +219,7 @@ miata_swizzle(struct pci_dev *dev, u8 *pinp) slot = PCI_SLOT(dev->devfn) + 9; break; } - pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); + pin = pci_swizzle_interrupt_pin(dev, pin); /* Move up the chain of bridges. */ dev = dev->bus->self; diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c index eb2a1d63f484..538876b62449 100644 --- a/arch/alpha/kernel/sys_noritake.c +++ b/arch/alpha/kernel/sys_noritake.c @@ -257,7 +257,7 @@ noritake_swizzle(struct pci_dev *dev, u8 *pinp) slot = PCI_SLOT(dev->devfn) + 15; break; } - pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)) ; + pin = pci_swizzle_interrupt_pin(dev, pin); /* Move up the chain of bridges. */ dev = dev->bus->self; diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c index 5b99cf3cd69c..f15a329b6011 100644 --- a/arch/alpha/kernel/sys_ruffian.c +++ b/arch/alpha/kernel/sys_ruffian.c @@ -160,7 +160,7 @@ ruffian_swizzle(struct pci_dev *dev, u8 *pinp) slot = PCI_SLOT(dev->devfn) + 10; break; } - pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); + pin = pci_swizzle_interrupt_pin(dev, pin); /* Move up the chain of bridges. */ dev = dev->bus->self; diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c index a4555f497639..d232e42be018 100644 --- a/arch/alpha/kernel/sys_sable.c +++ b/arch/alpha/kernel/sys_sable.c @@ -425,7 +425,7 @@ lynx_swizzle(struct pci_dev *dev, u8 *pinp) slot = PCI_SLOT(dev->devfn) + 11; break; } - pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)) ; + pin = pci_swizzle_interrupt_pin(dev, pin); /* Move up the chain of bridges. */ dev = dev->bus->self; -- cgit v1.2.1 From 3e08601f7f9b497abcb383491058bfb9e1dc6ec9 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Tue, 16 Dec 2008 21:37:00 -0700 Subject: PCI: alpha: use generic INTx swizzle from PCI core Use the generic pci_common_swizzle() instead of arch-specific code. Note that pci_common_swizzle() loops based on dev->bus->self, not dev->bus->parent as the alpha common_swizzle() did. I think they are equivalent for this purpose. Signed-off-by: Bjorn Helgaas Signed-off-by: Jesse Barnes --- arch/alpha/kernel/pci.c | 18 ------------------ arch/alpha/kernel/pci_impl.h | 4 ++-- 2 files changed, 2 insertions(+), 20 deletions(-) (limited to 'arch/alpha/kernel') diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index b03d9f420425..a3b938811400 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c @@ -320,24 +320,6 @@ pcibios_update_irq(struct pci_dev *dev, int irq) pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); } -/* Most Alphas have straight-forward swizzling needs. */ - -u8 __init -common_swizzle(struct pci_dev *dev, u8 *pinp) -{ - u8 pin = *pinp; - - while (dev->bus->parent) { - pin = pci_swizzle_interrupt_pin(dev, pin); - /* Move up the chain of bridges. */ - dev = dev->bus->self; - } - *pinp = pin; - - /* The slot is the slot of the last bridge. */ - return PCI_SLOT(dev->devfn); -} - void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res) diff --git a/arch/alpha/kernel/pci_impl.h b/arch/alpha/kernel/pci_impl.h index 7336651592a3..00edd04b585e 100644 --- a/arch/alpha/kernel/pci_impl.h +++ b/arch/alpha/kernel/pci_impl.h @@ -107,7 +107,7 @@ struct pci_iommu_arena; * Thus, each swizzle is ((pin-1) + (device#-4)) % 4 * * pci_swizzle_interrupt_pin() swizzles for exactly one bridge. The routine - * common_swizzle below handles multiple bridges. But there are a + * pci_common_swizzle() handles multiple bridges. But there are a * couple boards that do strange things. */ @@ -179,7 +179,7 @@ extern int pci_probe_only; extern unsigned long alpha_agpgart_size; extern void common_init_pci(void); -extern u8 common_swizzle(struct pci_dev *, u8 *); +#define common_swizzle pci_common_swizzle extern struct pci_controller *alloc_pci_controller(void); extern struct resource *alloc_resource(void); -- cgit v1.2.1