diff options
Diffstat (limited to 'arch/sparc64/kernel/pci.c')
| -rw-r--r-- | arch/sparc64/kernel/pci.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index 966861b212be..d85e1ed7c3e4 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c | |||
| @@ -14,12 +14,12 @@ | |||
| 14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 15 | #include <linux/capability.h> | 15 | #include <linux/capability.h> |
| 16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
| 17 | #include <linux/pci.h> | ||
| 17 | #include <linux/msi.h> | 18 | #include <linux/msi.h> |
| 18 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
| 19 | #include <linux/init.h> | 20 | #include <linux/init.h> |
| 20 | 21 | ||
| 21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
| 22 | #include <asm/pbm.h> | ||
| 23 | #include <asm/pgtable.h> | 23 | #include <asm/pgtable.h> |
| 24 | #include <asm/irq.h> | 24 | #include <asm/irq.h> |
| 25 | #include <asm/ebus.h> | 25 | #include <asm/ebus.h> |
| @@ -48,10 +48,10 @@ asmlinkage int sys_pciconfig_write(unsigned long bus, unsigned long dfn, | |||
| 48 | #else | 48 | #else |
| 49 | 49 | ||
| 50 | /* List of all PCI controllers found in the system. */ | 50 | /* List of all PCI controllers found in the system. */ |
| 51 | struct pci_controller_info *pci_controller_root = NULL; | 51 | struct pci_pbm_info *pci_pbm_root = NULL; |
| 52 | 52 | ||
| 53 | /* Each PCI controller found gets a unique index. */ | 53 | /* Each PBM found gets a unique index. */ |
| 54 | int pci_num_controllers = 0; | 54 | int pci_num_pbms = 0; |
| 55 | 55 | ||
| 56 | volatile int pci_poke_in_progress; | 56 | volatile int pci_poke_in_progress; |
| 57 | volatile int pci_poke_cpu = -1; | 57 | volatile int pci_poke_cpu = -1; |
| @@ -291,7 +291,7 @@ extern const struct pci_iommu_ops pci_sun4u_iommu_ops, | |||
| 291 | 291 | ||
| 292 | /* Find each controller in the system, attach and initialize | 292 | /* Find each controller in the system, attach and initialize |
| 293 | * software state structure for each and link into the | 293 | * software state structure for each and link into the |
| 294 | * pci_controller_root. Setup the controller enough such | 294 | * pci_pbm_root. Setup the controller enough such |
| 295 | * that bus scanning can be done. | 295 | * that bus scanning can be done. |
| 296 | */ | 296 | */ |
| 297 | static void __init pci_controller_probe(void) | 297 | static void __init pci_controller_probe(void) |
| @@ -743,7 +743,6 @@ int pci_host_bridge_write_pci_cfg(struct pci_bus *bus_dev, | |||
| 743 | 743 | ||
| 744 | struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm) | 744 | struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm) |
| 745 | { | 745 | { |
| 746 | struct pci_controller_info *p = pbm->parent; | ||
| 747 | struct device_node *node = pbm->prom_node; | 746 | struct device_node *node = pbm->prom_node; |
| 748 | struct pci_dev *host_pdev; | 747 | struct pci_dev *host_pdev; |
| 749 | struct pci_bus *bus; | 748 | struct pci_bus *bus; |
| @@ -751,7 +750,7 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm) | |||
| 751 | printk("PCI: Scanning PBM %s\n", node->full_name); | 750 | printk("PCI: Scanning PBM %s\n", node->full_name); |
| 752 | 751 | ||
| 753 | /* XXX parent device? XXX */ | 752 | /* XXX parent device? XXX */ |
| 754 | bus = pci_create_bus(NULL, pbm->pci_first_busno, p->pci_ops, pbm); | 753 | bus = pci_create_bus(NULL, pbm->pci_first_busno, pbm->pci_ops, pbm); |
| 755 | if (!bus) { | 754 | if (!bus) { |
| 756 | printk(KERN_ERR "Failed to create bus for %s\n", | 755 | printk(KERN_ERR "Failed to create bus for %s\n", |
| 757 | node->full_name); | 756 | node->full_name); |
| @@ -776,10 +775,10 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm) | |||
| 776 | 775 | ||
| 777 | static void __init pci_scan_each_controller_bus(void) | 776 | static void __init pci_scan_each_controller_bus(void) |
| 778 | { | 777 | { |
| 779 | struct pci_controller_info *p; | 778 | struct pci_pbm_info *pbm; |
| 780 | 779 | ||
| 781 | for (p = pci_controller_root; p; p = p->next) | 780 | for (pbm = pci_pbm_root; pbm; pbm = pbm->next) |
| 782 | p->scan_bus(p); | 781 | pbm->scan_bus(pbm); |
| 783 | } | 782 | } |
| 784 | 783 | ||
| 785 | extern void power_init(void); | 784 | extern void power_init(void); |
| @@ -787,7 +786,7 @@ extern void power_init(void); | |||
| 787 | static int __init pcibios_init(void) | 786 | static int __init pcibios_init(void) |
| 788 | { | 787 | { |
| 789 | pci_controller_probe(); | 788 | pci_controller_probe(); |
| 790 | if (pci_controller_root == NULL) | 789 | if (pci_pbm_root == NULL) |
| 791 | return 0; | 790 | return 0; |
| 792 | 791 | ||
| 793 | pci_scan_each_controller_bus(); | 792 | pci_scan_each_controller_bus(); |
| @@ -922,10 +921,8 @@ static int __pci_mmap_make_offset_bus(struct pci_dev *pdev, struct vm_area_struc | |||
| 922 | enum pci_mmap_state mmap_state) | 921 | enum pci_mmap_state mmap_state) |
| 923 | { | 922 | { |
| 924 | struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; | 923 | struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; |
| 925 | struct pci_controller_info *p; | ||
| 926 | unsigned long space_size, user_offset, user_size; | 924 | unsigned long space_size, user_offset, user_size; |
| 927 | 925 | ||
| 928 | p = pbm->parent; | ||
| 929 | if (mmap_state == pci_mmap_io) { | 926 | if (mmap_state == pci_mmap_io) { |
| 930 | space_size = (pbm->io_space.end - | 927 | space_size = (pbm->io_space.end - |
| 931 | pbm->io_space.start) + 1; | 928 | pbm->io_space.start) + 1; |
| @@ -1078,11 +1075,7 @@ int pci_domain_nr(struct pci_bus *pbus) | |||
| 1078 | if (pbm == NULL || pbm->parent == NULL) { | 1075 | if (pbm == NULL || pbm->parent == NULL) { |
| 1079 | ret = -ENXIO; | 1076 | ret = -ENXIO; |
| 1080 | } else { | 1077 | } else { |
| 1081 | struct pci_controller_info *p = pbm->parent; | 1078 | ret = pbm->index; |
| 1082 | |||
| 1083 | ret = p->index; | ||
| 1084 | ret = ((ret << 1) + | ||
| 1085 | ((pbm == &pbm->parent->pbm_B) ? 1 : 0)); | ||
| 1086 | } | 1079 | } |
| 1087 | 1080 | ||
| 1088 | return ret; | 1081 | return ret; |
| @@ -1093,17 +1086,12 @@ EXPORT_SYMBOL(pci_domain_nr); | |||
| 1093 | int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) | 1086 | int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) |
| 1094 | { | 1087 | { |
| 1095 | struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; | 1088 | struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; |
| 1096 | struct pci_controller_info *p = pbm->parent; | 1089 | int virt_irq; |
| 1097 | int virt_irq, err; | ||
| 1098 | 1090 | ||
| 1099 | if (!pbm->msi_num || !p->setup_msi_irq) | 1091 | if (!pbm->setup_msi_irq) |
| 1100 | return -EINVAL; | 1092 | return -EINVAL; |
| 1101 | 1093 | ||
| 1102 | err = p->setup_msi_irq(&virt_irq, pdev, desc); | 1094 | return pbm->setup_msi_irq(&virt_irq, pdev, desc); |
| 1103 | if (err) | ||
| 1104 | return err; | ||
| 1105 | |||
| 1106 | return 0; | ||
| 1107 | } | 1095 | } |
| 1108 | 1096 | ||
| 1109 | void arch_teardown_msi_irq(unsigned int virt_irq) | 1097 | void arch_teardown_msi_irq(unsigned int virt_irq) |
| @@ -1111,12 +1099,11 @@ void arch_teardown_msi_irq(unsigned int virt_irq) | |||
| 1111 | struct msi_desc *entry = get_irq_msi(virt_irq); | 1099 | struct msi_desc *entry = get_irq_msi(virt_irq); |
| 1112 | struct pci_dev *pdev = entry->dev; | 1100 | struct pci_dev *pdev = entry->dev; |
| 1113 | struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; | 1101 | struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; |
| 1114 | struct pci_controller_info *p = pbm->parent; | ||
| 1115 | 1102 | ||
| 1116 | if (!pbm->msi_num || !p->setup_msi_irq) | 1103 | if (!pbm->teardown_msi_irq) |
| 1117 | return; | 1104 | return; |
| 1118 | 1105 | ||
| 1119 | return p->teardown_msi_irq(virt_irq, pdev); | 1106 | return pbm->teardown_msi_irq(virt_irq, pdev); |
| 1120 | } | 1107 | } |
| 1121 | #endif /* !(CONFIG_PCI_MSI) */ | 1108 | #endif /* !(CONFIG_PCI_MSI) */ |
| 1122 | 1109 | ||
