aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/machdep.h6
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h35
-rw-r--r--arch/powerpc/kernel/pci-common.c71
-rw-r--r--arch/powerpc/kernel/pci_32.c71
4 files changed, 90 insertions, 93 deletions
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 11d1fc3a896..9efa2be7833 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -209,14 +209,14 @@ struct machdep_calls {
209 /* 209 /*
210 * optional PCI "hooks" 210 * optional PCI "hooks"
211 */ 211 */
212 /* Called in indirect_* to avoid touching devices */
213 int (*pci_exclude_device)(struct pci_controller *, unsigned char, unsigned char);
214
215 /* Called at then very end of pcibios_init() */ 212 /* Called at then very end of pcibios_init() */
216 void (*pcibios_after_init)(void); 213 void (*pcibios_after_init)(void);
217 214
218#endif /* CONFIG_PPC32 */ 215#endif /* CONFIG_PPC32 */
219 216
217 /* Called in indirect_* to avoid touching devices */
218 int (*pci_exclude_device)(struct pci_controller *, unsigned char, unsigned char);
219
220 /* Called after PPC generic resource fixup to perform 220 /* Called after PPC generic resource fixup to perform
221 machine specific fixups */ 221 machine specific fixups */
222 void (*pcibios_fixup_resources)(struct pci_dev *); 222 void (*pcibios_fixup_resources)(struct pci_dev *);
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 3faf575f6b0..76e1f313a58 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -77,9 +77,7 @@ struct pci_controller {
77 77
78 int first_busno; 78 int first_busno;
79 int last_busno; 79 int last_busno;
80#ifndef CONFIG_PPC64
81 int self_busno; 80 int self_busno;
82#endif
83 81
84 void __iomem *io_base_virt; 82 void __iomem *io_base_virt;
85#ifdef CONFIG_PPC64 83#ifdef CONFIG_PPC64
@@ -104,7 +102,6 @@ struct pci_controller {
104 unsigned int __iomem *cfg_addr; 102 unsigned int __iomem *cfg_addr;
105 void __iomem *cfg_data; 103 void __iomem *cfg_data;
106 104
107#ifndef CONFIG_PPC64
108 /* 105 /*
109 * Used for variants of PCI indirect handling and possible quirks: 106 * Used for variants of PCI indirect handling and possible quirks:
110 * SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1 107 * SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1
@@ -128,7 +125,6 @@ struct pci_controller {
128#define PPC_INDIRECT_TYPE_BIG_ENDIAN 0x00000010 125#define PPC_INDIRECT_TYPE_BIG_ENDIAN 0x00000010
129#define PPC_INDIRECT_TYPE_BROKEN_MRM 0x00000020 126#define PPC_INDIRECT_TYPE_BROKEN_MRM 0x00000020
130 u32 indirect_type; 127 u32 indirect_type;
131#endif /* !CONFIG_PPC64 */
132 /* Currently, we limit ourselves to 1 IO range and 3 mem 128 /* Currently, we limit ourselves to 1 IO range and 3 mem
133 * ranges since the common pci_bus structure can't handle more 129 * ranges since the common pci_bus structure can't handle more
134 */ 130 */
@@ -146,21 +142,6 @@ struct pci_controller {
146#endif /* CONFIG_PPC64 */ 142#endif /* CONFIG_PPC64 */
147}; 143};
148 144
149#ifndef CONFIG_PPC64
150
151static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
152{
153 return bus->sysdata;
154}
155
156static inline int isa_vaddr_is_ioport(void __iomem *address)
157{
158 /* No specific ISA handling on ppc32 at this stage, it
159 * all goes through PCI
160 */
161 return 0;
162}
163
164/* These are used for config access before all the PCI probing 145/* These are used for config access before all the PCI probing
165 has been done. */ 146 has been done. */
166extern int early_read_config_byte(struct pci_controller *hose, int bus, 147extern int early_read_config_byte(struct pci_controller *hose, int bus,
@@ -182,6 +163,22 @@ extern int early_find_capability(struct pci_controller *hose, int bus,
182extern void setup_indirect_pci(struct pci_controller* hose, 163extern void setup_indirect_pci(struct pci_controller* hose,
183 resource_size_t cfg_addr, 164 resource_size_t cfg_addr,
184 resource_size_t cfg_data, u32 flags); 165 resource_size_t cfg_data, u32 flags);
166
167#ifndef CONFIG_PPC64
168
169static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
170{
171 return bus->sysdata;
172}
173
174static inline int isa_vaddr_is_ioport(void __iomem *address)
175{
176 /* No specific ISA handling on ppc32 at this stage, it
177 * all goes through PCI
178 */
179 return 0;
180}
181
185#else /* CONFIG_PPC64 */ 182#else /* CONFIG_PPC64 */
186 183
187/* 184/*
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 725ea9144e3..8f84a9a8428 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1617,3 +1617,74 @@ void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
1617 (unsigned long)hose->io_base_virt - _IO_BASE); 1617 (unsigned long)hose->io_base_virt - _IO_BASE);
1618 1618
1619} 1619}
1620
1621/*
1622 * Null PCI config access functions, for the case when we can't
1623 * find a hose.
1624 */
1625#define NULL_PCI_OP(rw, size, type) \
1626static int \
1627null_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \
1628{ \
1629 return PCIBIOS_DEVICE_NOT_FOUND; \
1630}
1631
1632static int
1633null_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
1634 int len, u32 *val)
1635{
1636 return PCIBIOS_DEVICE_NOT_FOUND;
1637}
1638
1639static int
1640null_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
1641 int len, u32 val)
1642{
1643 return PCIBIOS_DEVICE_NOT_FOUND;
1644}
1645
1646static struct pci_ops null_pci_ops =
1647{
1648 .read = null_read_config,
1649 .write = null_write_config,
1650};
1651
1652/*
1653 * These functions are used early on before PCI scanning is done
1654 * and all of the pci_dev and pci_bus structures have been created.
1655 */
1656static struct pci_bus *
1657fake_pci_bus(struct pci_controller *hose, int busnr)
1658{
1659 static struct pci_bus bus;
1660
1661 if (hose == 0) {
1662 printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr);
1663 }
1664 bus.number = busnr;
1665 bus.sysdata = hose;
1666 bus.ops = hose? hose->ops: &null_pci_ops;
1667 return &bus;
1668}
1669
1670#define EARLY_PCI_OP(rw, size, type) \
1671int early_##rw##_config_##size(struct pci_controller *hose, int bus, \
1672 int devfn, int offset, type value) \
1673{ \
1674 return pci_bus_##rw##_config_##size(fake_pci_bus(hose, bus), \
1675 devfn, offset, value); \
1676}
1677
1678EARLY_PCI_OP(read, byte, u8 *)
1679EARLY_PCI_OP(read, word, u16 *)
1680EARLY_PCI_OP(read, dword, u32 *)
1681EARLY_PCI_OP(write, byte, u8)
1682EARLY_PCI_OP(write, word, u16)
1683EARLY_PCI_OP(write, dword, u32)
1684
1685extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap);
1686int early_find_capability(struct pci_controller *hose, int bus, int devfn,
1687 int cap)
1688{
1689 return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);
1690}
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 1e807fe7ad2..8cf15d961c3 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -469,75 +469,4 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
469 return result; 469 return result;
470} 470}
471 471
472/*
473 * Null PCI config access functions, for the case when we can't
474 * find a hose.
475 */
476#define NULL_PCI_OP(rw, size, type) \
477static int \
478null_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \
479{ \
480 return PCIBIOS_DEVICE_NOT_FOUND; \
481}
482
483static int
484null_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
485 int len, u32 *val)
486{
487 return PCIBIOS_DEVICE_NOT_FOUND;
488}
489
490static int
491null_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
492 int len, u32 val)
493{
494 return PCIBIOS_DEVICE_NOT_FOUND;
495}
496
497static struct pci_ops null_pci_ops =
498{
499 .read = null_read_config,
500 .write = null_write_config,
501};
502 472
503/*
504 * These functions are used early on before PCI scanning is done
505 * and all of the pci_dev and pci_bus structures have been created.
506 */
507static struct pci_bus *
508fake_pci_bus(struct pci_controller *hose, int busnr)
509{
510 static struct pci_bus bus;
511
512 if (hose == 0) {
513 hose = pci_bus_to_hose(busnr);
514 if (hose == 0)
515 printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr);
516 }
517 bus.number = busnr;
518 bus.sysdata = hose;
519 bus.ops = hose? hose->ops: &null_pci_ops;
520 return &bus;
521}
522
523#define EARLY_PCI_OP(rw, size, type) \
524int early_##rw##_config_##size(struct pci_controller *hose, int bus, \
525 int devfn, int offset, type value) \
526{ \
527 return pci_bus_##rw##_config_##size(fake_pci_bus(hose, bus), \
528 devfn, offset, value); \
529}
530
531EARLY_PCI_OP(read, byte, u8 *)
532EARLY_PCI_OP(read, word, u16 *)
533EARLY_PCI_OP(read, dword, u32 *)
534EARLY_PCI_OP(write, byte, u8)
535EARLY_PCI_OP(write, word, u16)
536EARLY_PCI_OP(write, dword, u32)
537
538extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap);
539int early_find_capability(struct pci_controller *hose, int bus, int devfn,
540 int cap)
541{
542 return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);
543}