pci.c (d7cdc9e8ac82c43fdcd4fde6b5b53d2dcba7f707) | pci.c (959f85f8a3223c116bbe95dd8a9b207790b5d4d3) |
---|---|
1/* 2 * arch/sh/drivers/pci/pci.c 3 * 4 * Copyright (c) 2002 M. R. Brown <mrbrown@linux-sh.org> 5 * Copyright (c) 2004 - 2006 Paul Mundt <lethal@linux-sh.org> 6 * 7 * These functions are collected here to reduce duplication of common 8 * code amongst the many platform-specific PCI support code files. --- 7 unchanged lines hidden (view full) --- 16 * License. See the file "COPYING" in the main directory of this archive 17 * for more details. 18 */ 19#include <linux/kernel.h> 20#include <linux/pci.h> 21#include <linux/init.h> 22#include <asm/io.h> 23 | 1/* 2 * arch/sh/drivers/pci/pci.c 3 * 4 * Copyright (c) 2002 M. R. Brown <mrbrown@linux-sh.org> 5 * Copyright (c) 2004 - 2006 Paul Mundt <lethal@linux-sh.org> 6 * 7 * These functions are collected here to reduce duplication of common 8 * code amongst the many platform-specific PCI support code files. --- 7 unchanged lines hidden (view full) --- 16 * License. See the file "COPYING" in the main directory of this archive 17 * for more details. 18 */ 19#include <linux/kernel.h> 20#include <linux/pci.h> 21#include <linux/init.h> 22#include <asm/io.h> 23 |
24static inline u8 bridge_swizzle(u8 pin, u8 slot) 25{ 26 return (((pin - 1) + slot) % 4) + 1; 27} 28 29static u8 __init simple_swizzle(struct pci_dev *dev, u8 *pinp) 30{ 31 u8 pin = *pinp; 32 33 while (dev->bus->parent) { 34 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); 35 /* Move up the chain of bridges. */ 36 dev = dev->bus->self; 37 } 38 *pinp = pin; 39 40 /* The slot is the slot of the last bridge. */ 41 return PCI_SLOT(dev->devfn); 42} 43 |
|
24static int __init pcibios_init(void) 25{ 26 struct pci_channel *p; 27 struct pci_bus *bus; 28 int busno; 29 30#ifdef CONFIG_PCI_AUTO 31 /* assign resources */ 32 busno = 0; 33 for (p = board_pci_channels; p->pci_ops != NULL; p++) 34 busno = pciauto_assign_resources(busno, p) + 1; 35#endif 36 37 /* scan the buses */ 38 busno = 0; | 44static int __init pcibios_init(void) 45{ 46 struct pci_channel *p; 47 struct pci_bus *bus; 48 int busno; 49 50#ifdef CONFIG_PCI_AUTO 51 /* assign resources */ 52 busno = 0; 53 for (p = board_pci_channels; p->pci_ops != NULL; p++) 54 busno = pciauto_assign_resources(busno, p) + 1; 55#endif 56 57 /* scan the buses */ 58 busno = 0; |
39 for (p= board_pci_channels; p->pci_ops != NULL; p++) { | 59 for (p = board_pci_channels; p->pci_ops != NULL; p++) { |
40 bus = pci_scan_bus(busno, p->pci_ops, p); | 60 bus = pci_scan_bus(busno, p->pci_ops, p); |
41 busno = bus->subordinate+1; | 61 busno = bus->subordinate + 1; |
42 } 43 | 62 } 63 |
44 /* board-specific fixups */ 45 pcibios_fixup_irqs(); | 64 pci_fixup_irqs(simple_swizzle, pcibios_map_platform_irq); |
46 47 return 0; 48} | 65 66 return 0; 67} |
49 | |
50subsys_initcall(pcibios_init); 51 | 68subsys_initcall(pcibios_init); 69 |
70/* 71 * Called after each bus is probed, but before its children 72 * are examined. 73 */ 74void __init pcibios_fixup_bus(struct pci_bus *bus) 75{ 76 pci_read_bridge_bases(bus); 77} 78 |
|
52void 53pcibios_update_resource(struct pci_dev *dev, struct resource *root, 54 struct resource *res, int resource) 55{ 56 u32 new, check; 57 int reg; 58 59 new = res->start | (res->flags & PCI_REGION_FLAG_MASK); --- 127 unchanged lines hidden (view full) --- 187 * their own. 188 * -- PFM. 189 */ 190 if (flags & (IORESOURCE_IO | IORESOURCE_MEM)) 191 return ioport_map(start, len); 192 193 return NULL; 194} | 79void 80pcibios_update_resource(struct pci_dev *dev, struct resource *root, 81 struct resource *res, int resource) 82{ 83 u32 new, check; 84 int reg; 85 86 new = res->start | (res->flags & PCI_REGION_FLAG_MASK); --- 127 unchanged lines hidden (view full) --- 214 * their own. 215 * -- PFM. 216 */ 217 if (flags & (IORESOURCE_IO | IORESOURCE_MEM)) 218 return ioport_map(start, len); 219 220 return NULL; 221} |
222EXPORT_SYMBOL(pci_iomap); |
|
195 196void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 197{ 198 iounmap(addr); 199} | 223 224void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 225{ 226 iounmap(addr); 227} |
200 201EXPORT_SYMBOL(pci_iomap); | |
202EXPORT_SYMBOL(pci_iounmap); | 228EXPORT_SYMBOL(pci_iounmap); |