diff options
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 71 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_32.c | 71 |
2 files changed, 71 insertions, 71 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 725ea9144e38..8f84a9a8428e 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) \ | ||
1626 | static int \ | ||
1627 | null_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \ | ||
1628 | { \ | ||
1629 | return PCIBIOS_DEVICE_NOT_FOUND; \ | ||
1630 | } | ||
1631 | |||
1632 | static int | ||
1633 | null_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 | |||
1639 | static int | ||
1640 | null_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 | |||
1646 | static 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 | */ | ||
1656 | static struct pci_bus * | ||
1657 | fake_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) \ | ||
1671 | int 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 | |||
1678 | EARLY_PCI_OP(read, byte, u8 *) | ||
1679 | EARLY_PCI_OP(read, word, u16 *) | ||
1680 | EARLY_PCI_OP(read, dword, u32 *) | ||
1681 | EARLY_PCI_OP(write, byte, u8) | ||
1682 | EARLY_PCI_OP(write, word, u16) | ||
1683 | EARLY_PCI_OP(write, dword, u32) | ||
1684 | |||
1685 | extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap); | ||
1686 | int 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 1e807fe7ad2c..8cf15d961c38 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) \ | ||
477 | static int \ | ||
478 | null_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \ | ||
479 | { \ | ||
480 | return PCIBIOS_DEVICE_NOT_FOUND; \ | ||
481 | } | ||
482 | |||
483 | static int | ||
484 | null_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 | |||
490 | static int | ||
491 | null_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 | |||
497 | static 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 | */ | ||
507 | static struct pci_bus * | ||
508 | fake_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) \ | ||
524 | int 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 | |||
531 | EARLY_PCI_OP(read, byte, u8 *) | ||
532 | EARLY_PCI_OP(read, word, u16 *) | ||
533 | EARLY_PCI_OP(read, dword, u32 *) | ||
534 | EARLY_PCI_OP(write, byte, u8) | ||
535 | EARLY_PCI_OP(write, word, u16) | ||
536 | EARLY_PCI_OP(write, dword, u32) | ||
537 | |||
538 | extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap); | ||
539 | int 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 | } | ||