diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2013-08-05 13:29:34 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2013-08-06 12:55:52 -0400 |
commit | eafa5c8a10f52e5d05870a40e2ffb49537d4471f (patch) | |
tree | 4ef4edb261e8f7cede687c44e9b2d6e1bc5d87b4 /arch | |
parent | f62f73f6caedaa92dc84efeb6de74bec4d23eeba (diff) |
tile PCI RC: bomb comments and whitespace format
This change is purely stylistic but improves the readability
of the tile PCI RC driver.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/tile/kernel/pci_gx.c | 180 |
1 files changed, 56 insertions, 124 deletions
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c index 6837be272ddf..8352d85ab818 100644 --- a/arch/tile/kernel/pci_gx.c +++ b/arch/tile/kernel/pci_gx.c | |||
@@ -108,17 +108,15 @@ static struct pci_ops tile_cfg_ops; | |||
108 | /* Mask of CPUs that should receive PCIe interrupts. */ | 108 | /* Mask of CPUs that should receive PCIe interrupts. */ |
109 | static struct cpumask intr_cpus_map; | 109 | static struct cpumask intr_cpus_map; |
110 | 110 | ||
111 | /* | 111 | /* We don't need to worry about the alignment of resources. */ |
112 | * We don't need to worry about the alignment of resources. | ||
113 | */ | ||
114 | resource_size_t pcibios_align_resource(void *data, const struct resource *res, | 112 | resource_size_t pcibios_align_resource(void *data, const struct resource *res, |
115 | resource_size_t size, resource_size_t align) | 113 | resource_size_t size, |
114 | resource_size_t align) | ||
116 | { | 115 | { |
117 | return res->start; | 116 | return res->start; |
118 | } | 117 | } |
119 | EXPORT_SYMBOL(pcibios_align_resource); | 118 | EXPORT_SYMBOL(pcibios_align_resource); |
120 | 119 | ||
121 | |||
122 | /* | 120 | /* |
123 | * Pick a CPU to receive and handle the PCIe interrupts, based on the IRQ #. | 121 | * Pick a CPU to receive and handle the PCIe interrupts, based on the IRQ #. |
124 | * For now, we simply send interrupts to non-dataplane CPUs. | 122 | * For now, we simply send interrupts to non-dataplane CPUs. |
@@ -146,25 +144,19 @@ static int tile_irq_cpu(int irq) | |||
146 | return cpu; | 144 | return cpu; |
147 | } | 145 | } |
148 | 146 | ||
149 | /* | 147 | /* Open a file descriptor to the TRIO shim. */ |
150 | * Open a file descriptor to the TRIO shim. | ||
151 | */ | ||
152 | static int tile_pcie_open(int trio_index) | 148 | static int tile_pcie_open(int trio_index) |
153 | { | 149 | { |
154 | gxio_trio_context_t *context = &trio_contexts[trio_index]; | 150 | gxio_trio_context_t *context = &trio_contexts[trio_index]; |
155 | int ret; | 151 | int ret; |
156 | int mac; | 152 | int mac; |
157 | 153 | ||
158 | /* | 154 | /* This opens a file descriptor to the TRIO shim. */ |
159 | * This opens a file descriptor to the TRIO shim. | ||
160 | */ | ||
161 | ret = gxio_trio_init(context, trio_index); | 155 | ret = gxio_trio_init(context, trio_index); |
162 | if (ret < 0) | 156 | if (ret < 0) |
163 | goto gxio_trio_init_failure; | 157 | goto gxio_trio_init_failure; |
164 | 158 | ||
165 | /* | 159 | /* Allocate an ASID for the kernel. */ |
166 | * Allocate an ASID for the kernel. | ||
167 | */ | ||
168 | ret = gxio_trio_alloc_asids(context, 1, 0, 0); | 160 | ret = gxio_trio_alloc_asids(context, 1, 0, 0); |
169 | if (ret < 0) { | 161 | if (ret < 0) { |
170 | pr_err("PCI: ASID alloc failure on TRIO %d, give up\n", | 162 | pr_err("PCI: ASID alloc failure on TRIO %d, give up\n", |
@@ -285,20 +277,17 @@ static int __init tile_trio_init(void) | |||
285 | } | 277 | } |
286 | postcore_initcall(tile_trio_init); | 278 | postcore_initcall(tile_trio_init); |
287 | 279 | ||
288 | static void | 280 | static void tilegx_legacy_irq_ack(struct irq_data *d) |
289 | tilegx_legacy_irq_ack(struct irq_data *d) | ||
290 | { | 281 | { |
291 | __insn_mtspr(SPR_IPI_EVENT_RESET_K, 1UL << d->irq); | 282 | __insn_mtspr(SPR_IPI_EVENT_RESET_K, 1UL << d->irq); |
292 | } | 283 | } |
293 | 284 | ||
294 | static void | 285 | static void tilegx_legacy_irq_mask(struct irq_data *d) |
295 | tilegx_legacy_irq_mask(struct irq_data *d) | ||
296 | { | 286 | { |
297 | __insn_mtspr(SPR_IPI_MASK_SET_K, 1UL << d->irq); | 287 | __insn_mtspr(SPR_IPI_MASK_SET_K, 1UL << d->irq); |
298 | } | 288 | } |
299 | 289 | ||
300 | static void | 290 | static void tilegx_legacy_irq_unmask(struct irq_data *d) |
301 | tilegx_legacy_irq_unmask(struct irq_data *d) | ||
302 | { | 291 | { |
303 | __insn_mtspr(SPR_IPI_MASK_RESET_K, 1UL << d->irq); | 292 | __insn_mtspr(SPR_IPI_MASK_RESET_K, 1UL << d->irq); |
304 | } | 293 | } |
@@ -319,8 +308,7 @@ static struct irq_chip tilegx_legacy_irq_chip = { | |||
319 | * to Linux which just calls handle_level_irq() after clearing the | 308 | * to Linux which just calls handle_level_irq() after clearing the |
320 | * MAC INTx Assert status bit associated with this interrupt. | 309 | * MAC INTx Assert status bit associated with this interrupt. |
321 | */ | 310 | */ |
322 | static void | 311 | static void trio_handle_level_irq(unsigned int irq, struct irq_desc *desc) |
323 | trio_handle_level_irq(unsigned int irq, struct irq_desc *desc) | ||
324 | { | 312 | { |
325 | struct pci_controller *controller = irq_desc_get_handler_data(desc); | 313 | struct pci_controller *controller = irq_desc_get_handler_data(desc); |
326 | gxio_trio_context_t *trio_context = controller->trio; | 314 | gxio_trio_context_t *trio_context = controller->trio; |
@@ -386,9 +374,7 @@ static int tile_init_irqs(struct pci_controller *controller) | |||
386 | goto free_irqs; | 374 | goto free_irqs; |
387 | } | 375 | } |
388 | 376 | ||
389 | /* | 377 | /* Register the IRQ handler with the kernel. */ |
390 | * Register the IRQ handler with the kernel. | ||
391 | */ | ||
392 | irq_set_chip_and_handler(irq, &tilegx_legacy_irq_chip, | 378 | irq_set_chip_and_handler(irq, &tilegx_legacy_irq_chip, |
393 | trio_handle_level_irq); | 379 | trio_handle_level_irq); |
394 | irq_set_chip_data(irq, (void *)(uint64_t)i); | 380 | irq_set_chip_data(irq, (void *)(uint64_t)i); |
@@ -471,15 +457,11 @@ int __init tile_pci_init(void) | |||
471 | } | 457 | } |
472 | } | 458 | } |
473 | 459 | ||
474 | /* | 460 | /* Return if no PCIe ports are configured to operate in RC mode. */ |
475 | * Return if no PCIe ports are configured to operate in RC mode. | ||
476 | */ | ||
477 | if (num_rc_controllers == 0) | 461 | if (num_rc_controllers == 0) |
478 | return 0; | 462 | return 0; |
479 | 463 | ||
480 | /* | 464 | /* Set the TRIO pointer and MAC index for each PCIe RC port. */ |
481 | * Set the TRIO pointer and MAC index for each PCIe RC port. | ||
482 | */ | ||
483 | for (i = 0; i < TILEGX_NUM_TRIO; i++) { | 465 | for (i = 0; i < TILEGX_NUM_TRIO; i++) { |
484 | for (j = 0; j < TILEGX_TRIO_PCIES; j++) { | 466 | for (j = 0; j < TILEGX_TRIO_PCIES; j++) { |
485 | if (pcie_rc[i][j]) { | 467 | if (pcie_rc[i][j]) { |
@@ -495,14 +477,10 @@ int __init tile_pci_init(void) | |||
495 | } | 477 | } |
496 | 478 | ||
497 | out: | 479 | out: |
498 | /* | 480 | /* Configure each PCIe RC port. */ |
499 | * Configure each PCIe RC port. | ||
500 | */ | ||
501 | for (i = 0; i < num_rc_controllers; i++) { | 481 | for (i = 0; i < num_rc_controllers; i++) { |
502 | /* | ||
503 | * Configure the PCIe MAC to run in RC mode. | ||
504 | */ | ||
505 | 482 | ||
483 | /* Configure the PCIe MAC to run in RC mode. */ | ||
506 | struct pci_controller *controller = &pci_controllers[i]; | 484 | struct pci_controller *controller = &pci_controllers[i]; |
507 | 485 | ||
508 | controller->index = i; | 486 | controller->index = i; |
@@ -525,7 +503,6 @@ out: | |||
525 | * is in range [3GB, 4GB - 1] of a 4GB space beyond the | 503 | * is in range [3GB, 4GB - 1] of a 4GB space beyond the |
526 | * PA space. | 504 | * PA space. |
527 | */ | 505 | */ |
528 | |||
529 | controller->mem_offset = TILE_PCI_MEM_START + | 506 | controller->mem_offset = TILE_PCI_MEM_START + |
530 | (i * TILE_PCI_BAR_WINDOW_TOP); | 507 | (i * TILE_PCI_BAR_WINDOW_TOP); |
531 | controller->mem_space.start = controller->mem_offset + | 508 | controller->mem_space.start = controller->mem_offset + |
@@ -553,7 +530,6 @@ static int tile_map_irq(const struct pci_dev *dev, u8 device, u8 pin) | |||
553 | return controller->irq_intx_table[pin - 1]; | 530 | return controller->irq_intx_table[pin - 1]; |
554 | } | 531 | } |
555 | 532 | ||
556 | |||
557 | static void fixup_read_and_payload_sizes(struct pci_controller *controller) | 533 | static void fixup_read_and_payload_sizes(struct pci_controller *controller) |
558 | { | 534 | { |
559 | gxio_trio_context_t *trio_context = controller->trio; | 535 | gxio_trio_context_t *trio_context = controller->trio; |
@@ -567,9 +543,7 @@ static void fixup_read_and_payload_sizes(struct pci_controller *controller) | |||
567 | 543 | ||
568 | mac = controller->mac; | 544 | mac = controller->mac; |
569 | 545 | ||
570 | /* | 546 | /* Set our max read request size to be 4KB. */ |
571 | * Set our max read request size to be 4KB. | ||
572 | */ | ||
573 | reg_offset = | 547 | reg_offset = |
574 | (TRIO_PCIE_RC_DEVICE_CONTROL << | 548 | (TRIO_PCIE_RC_DEVICE_CONTROL << |
575 | TRIO_CFG_REGION_ADDR__REG_SHIFT) | | 549 | TRIO_CFG_REGION_ADDR__REG_SHIFT) | |
@@ -578,10 +552,10 @@ static void fixup_read_and_payload_sizes(struct pci_controller *controller) | |||
578 | (mac << TRIO_CFG_REGION_ADDR__MAC_SEL_SHIFT); | 552 | (mac << TRIO_CFG_REGION_ADDR__MAC_SEL_SHIFT); |
579 | 553 | ||
580 | dev_control.word = __gxio_mmio_read32(trio_context->mmio_base_mac + | 554 | dev_control.word = __gxio_mmio_read32(trio_context->mmio_base_mac + |
581 | reg_offset); | 555 | reg_offset); |
582 | dev_control.max_read_req_sz = 5; | 556 | dev_control.max_read_req_sz = 5; |
583 | __gxio_mmio_write32(trio_context->mmio_base_mac + reg_offset, | 557 | __gxio_mmio_write32(trio_context->mmio_base_mac + reg_offset, |
584 | dev_control.word); | 558 | dev_control.word); |
585 | 559 | ||
586 | /* | 560 | /* |
587 | * Set the max payload size supported by this Gx PCIe MAC. | 561 | * Set the max payload size supported by this Gx PCIe MAC. |
@@ -597,10 +571,10 @@ static void fixup_read_and_payload_sizes(struct pci_controller *controller) | |||
597 | (mac << TRIO_CFG_REGION_ADDR__MAC_SEL_SHIFT); | 571 | (mac << TRIO_CFG_REGION_ADDR__MAC_SEL_SHIFT); |
598 | 572 | ||
599 | rc_dev_cap.word = __gxio_mmio_read32(trio_context->mmio_base_mac + | 573 | rc_dev_cap.word = __gxio_mmio_read32(trio_context->mmio_base_mac + |
600 | reg_offset); | 574 | reg_offset); |
601 | rc_dev_cap.mps_sup = 1; | 575 | rc_dev_cap.mps_sup = 1; |
602 | __gxio_mmio_write32(trio_context->mmio_base_mac + reg_offset, | 576 | __gxio_mmio_write32(trio_context->mmio_base_mac + reg_offset, |
603 | rc_dev_cap.word); | 577 | rc_dev_cap.word); |
604 | 578 | ||
605 | /* Configure PCI Express MPS setting. */ | 579 | /* Configure PCI Express MPS setting. */ |
606 | list_for_each_entry(child, &root_bus->children, node) { | 580 | list_for_each_entry(child, &root_bus->children, node) { |
@@ -628,7 +602,7 @@ static void fixup_read_and_payload_sizes(struct pci_controller *controller) | |||
628 | dev_control.max_payload_size, | 602 | dev_control.max_payload_size, |
629 | dev_control.max_read_req_sz, | 603 | dev_control.max_read_req_sz, |
630 | mac); | 604 | mac); |
631 | if (err < 0) { | 605 | if (err < 0) { |
632 | pr_err("PCI: PCIE_CONFIGURE_MAC_MPS_MRS failure, " | 606 | pr_err("PCI: PCIE_CONFIGURE_MAC_MPS_MRS failure, " |
633 | "MAC %d on TRIO %d\n", | 607 | "MAC %d on TRIO %d\n", |
634 | mac, controller->trio_index); | 608 | mac, controller->trio_index); |
@@ -672,9 +646,7 @@ static int setup_pcie_rc_delay(char *str) | |||
672 | } | 646 | } |
673 | early_param("pcie_rc_delay", setup_pcie_rc_delay); | 647 | early_param("pcie_rc_delay", setup_pcie_rc_delay); |
674 | 648 | ||
675 | /* | 649 | /* PCI initialization entry point, called by subsys_initcall. */ |
676 | * PCI initialization entry point, called by subsys_initcall. | ||
677 | */ | ||
678 | int __init pcibios_init(void) | 650 | int __init pcibios_init(void) |
679 | { | 651 | { |
680 | resource_size_t offset; | 652 | resource_size_t offset; |
@@ -744,9 +716,7 @@ int __init pcibios_init(void) | |||
744 | pr_info("PCI: Found PCI controller #%d on TRIO %d MAC %d\n", i, | 716 | pr_info("PCI: Found PCI controller #%d on TRIO %d MAC %d\n", i, |
745 | trio_index, controller->mac); | 717 | trio_index, controller->mac); |
746 | 718 | ||
747 | /* | 719 | /* Delay the bus probe if needed. */ |
748 | * Delay the bus probe if needed. | ||
749 | */ | ||
750 | if (rc_delay[trio_index][mac]) { | 720 | if (rc_delay[trio_index][mac]) { |
751 | pr_info("Delaying PCIe RC bus enumerating %d sec" | 721 | pr_info("Delaying PCIe RC bus enumerating %d sec" |
752 | " on MAC %d on TRIO %d\n", | 722 | " on MAC %d on TRIO %d\n", |
@@ -761,9 +731,7 @@ int __init pcibios_init(void) | |||
761 | msleep(1000); | 731 | msleep(1000); |
762 | } | 732 | } |
763 | 733 | ||
764 | /* | 734 | /* Check for PCIe link-up status again. */ |
765 | * Check for PCIe link-up status again. | ||
766 | */ | ||
767 | port_status.word = | 735 | port_status.word = |
768 | __gxio_mmio_read(trio_context->mmio_base_mac + | 736 | __gxio_mmio_read(trio_context->mmio_base_mac + |
769 | reg_offset); | 737 | reg_offset); |
@@ -801,7 +769,6 @@ int __init pcibios_init(void) | |||
801 | * Change the device ID so that Linux bus crawl doesn't confuse | 769 | * Change the device ID so that Linux bus crawl doesn't confuse |
802 | * the internal bridge with any Tilera endpoints. | 770 | * the internal bridge with any Tilera endpoints. |
803 | */ | 771 | */ |
804 | |||
805 | reg_offset = | 772 | reg_offset = |
806 | (TRIO_PCIE_RC_DEVICE_ID_VEN_ID << | 773 | (TRIO_PCIE_RC_DEVICE_ID_VEN_ID << |
807 | TRIO_CFG_REGION_ADDR__REG_SHIFT) | | 774 | TRIO_CFG_REGION_ADDR__REG_SHIFT) | |
@@ -814,10 +781,7 @@ int __init pcibios_init(void) | |||
814 | TRIO_PCIE_RC_DEVICE_ID_VEN_ID__DEV_ID_SHIFT) | | 781 | TRIO_PCIE_RC_DEVICE_ID_VEN_ID__DEV_ID_SHIFT) | |
815 | TILERA_VENDOR_ID); | 782 | TILERA_VENDOR_ID); |
816 | 783 | ||
817 | /* | 784 | /* Set the internal P2P bridge class code. */ |
818 | * Set the internal P2P bridge class code. | ||
819 | */ | ||
820 | |||
821 | reg_offset = | 785 | reg_offset = |
822 | (TRIO_PCIE_RC_REVISION_ID << | 786 | (TRIO_PCIE_RC_REVISION_ID << |
823 | TRIO_CFG_REGION_ADDR__REG_SHIFT) | | 787 | TRIO_CFG_REGION_ADDR__REG_SHIFT) | |
@@ -828,26 +792,22 @@ int __init pcibios_init(void) | |||
828 | class_code_revision = | 792 | class_code_revision = |
829 | __gxio_mmio_read32(trio_context->mmio_base_mac + | 793 | __gxio_mmio_read32(trio_context->mmio_base_mac + |
830 | reg_offset); | 794 | reg_offset); |
831 | class_code_revision = (class_code_revision & 0xff ) | | 795 | class_code_revision = (class_code_revision & 0xff) | |
832 | (PCI_CLASS_BRIDGE_PCI << 16); | 796 | (PCI_CLASS_BRIDGE_PCI << 16); |
833 | 797 | ||
834 | __gxio_mmio_write32(trio_context->mmio_base_mac + | 798 | __gxio_mmio_write32(trio_context->mmio_base_mac + |
835 | reg_offset, class_code_revision); | 799 | reg_offset, class_code_revision); |
836 | 800 | ||
837 | #ifdef USE_SHARED_PCIE_CONFIG_REGION | 801 | #ifdef USE_SHARED_PCIE_CONFIG_REGION |
838 | 802 | ||
839 | /* | 803 | /* Map in the MMIO space for the PIO region. */ |
840 | * Map in the MMIO space for the PIO region. | ||
841 | */ | ||
842 | offset = HV_TRIO_PIO_OFFSET(trio_context->pio_cfg_index) | | 804 | offset = HV_TRIO_PIO_OFFSET(trio_context->pio_cfg_index) | |
843 | (((unsigned long long)mac) << | 805 | (((unsigned long long)mac) << |
844 | TRIO_TILE_PIO_REGION_SETUP_CFG_ADDR__MAC_SHIFT); | 806 | TRIO_TILE_PIO_REGION_SETUP_CFG_ADDR__MAC_SHIFT); |
845 | 807 | ||
846 | #else | 808 | #else |
847 | 809 | ||
848 | /* | 810 | /* Alloc a PIO region for PCI config access per MAC. */ |
849 | * Alloc a PIO region for PCI config access per MAC. | ||
850 | */ | ||
851 | ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0); | 811 | ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0); |
852 | if (ret < 0) { | 812 | if (ret < 0) { |
853 | pr_err("PCI: PCI CFG PIO alloc failure for mac %d " | 813 | pr_err("PCI: PCI CFG PIO alloc failure for mac %d " |
@@ -858,9 +818,7 @@ int __init pcibios_init(void) | |||
858 | 818 | ||
859 | trio_context->pio_cfg_index[mac] = ret; | 819 | trio_context->pio_cfg_index[mac] = ret; |
860 | 820 | ||
861 | /* | 821 | /* For PIO CFG, the bus_address_hi parameter is 0. */ |
862 | * For PIO CFG, the bus_address_hi parameter is 0. | ||
863 | */ | ||
864 | ret = gxio_trio_init_pio_region_aux(trio_context, | 822 | ret = gxio_trio_init_pio_region_aux(trio_context, |
865 | trio_context->pio_cfg_index[mac], | 823 | trio_context->pio_cfg_index[mac], |
866 | mac, 0, HV_TRIO_PIO_FLAG_CONFIG_SPACE); | 824 | mac, 0, HV_TRIO_PIO_FLAG_CONFIG_SPACE); |
@@ -887,9 +845,7 @@ int __init pcibios_init(void) | |||
887 | continue; | 845 | continue; |
888 | } | 846 | } |
889 | 847 | ||
890 | /* | 848 | /* Initialize the PCIe interrupts. */ |
891 | * Initialize the PCIe interrupts. | ||
892 | */ | ||
893 | if (tile_init_irqs(controller)) { | 849 | if (tile_init_irqs(controller)) { |
894 | pr_err("PCI: IRQs init failure for mac %d on TRIO %d\n", | 850 | pr_err("PCI: IRQs init failure for mac %d on TRIO %d\n", |
895 | mac, trio_index); | 851 | mac, trio_index); |
@@ -921,7 +877,6 @@ int __init pcibios_init(void) | |||
921 | * It allocates all of the resources (I/O memory, etc) | 877 | * It allocates all of the resources (I/O memory, etc) |
922 | * associated with the devices read in above. | 878 | * associated with the devices read in above. |
923 | */ | 879 | */ |
924 | |||
925 | pci_assign_unassigned_resources(); | 880 | pci_assign_unassigned_resources(); |
926 | 881 | ||
927 | /* Record the I/O resources in the PCI controller structure. */ | 882 | /* Record the I/O resources in the PCI controller structure. */ |
@@ -942,14 +897,12 @@ int __init pcibios_init(void) | |||
942 | /* Configure the max_payload_size values for this domain. */ | 897 | /* Configure the max_payload_size values for this domain. */ |
943 | fixup_read_and_payload_sizes(controller); | 898 | fixup_read_and_payload_sizes(controller); |
944 | 899 | ||
945 | /* | 900 | /* Alloc a PIO region for PCI memory access for each RC port. */ |
946 | * Alloc a PIO region for PCI memory access for each RC port. | ||
947 | */ | ||
948 | ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0); | 901 | ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0); |
949 | if (ret < 0) { | 902 | if (ret < 0) { |
950 | pr_err("PCI: MEM PIO alloc failure on TRIO %d mac %d, " | 903 | pr_err("PCI: MEM PIO alloc failure on TRIO %d mac %d, " |
951 | "give up\n", controller->trio_index, | 904 | "give up\n", controller->trio_index, |
952 | controller->mac); | 905 | controller->mac); |
953 | 906 | ||
954 | continue; | 907 | continue; |
955 | } | 908 | } |
@@ -967,8 +920,8 @@ int __init pcibios_init(void) | |||
967 | 0); | 920 | 0); |
968 | if (ret < 0) { | 921 | if (ret < 0) { |
969 | pr_err("PCI: MEM PIO init failure on TRIO %d mac %d, " | 922 | pr_err("PCI: MEM PIO init failure on TRIO %d mac %d, " |
970 | "give up\n", controller->trio_index, | 923 | "give up\n", controller->trio_index, |
971 | controller->mac); | 924 | controller->mac); |
972 | 925 | ||
973 | continue; | 926 | continue; |
974 | } | 927 | } |
@@ -980,8 +933,8 @@ int __init pcibios_init(void) | |||
980 | ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0); | 933 | ret = gxio_trio_alloc_pio_regions(trio_context, 1, 0, 0); |
981 | if (ret < 0) { | 934 | if (ret < 0) { |
982 | pr_err("PCI: I/O PIO alloc failure on TRIO %d mac %d, " | 935 | pr_err("PCI: I/O PIO alloc failure on TRIO %d mac %d, " |
983 | "give up\n", controller->trio_index, | 936 | "give up\n", controller->trio_index, |
984 | controller->mac); | 937 | controller->mac); |
985 | 938 | ||
986 | continue; | 939 | continue; |
987 | } | 940 | } |
@@ -999,8 +952,8 @@ int __init pcibios_init(void) | |||
999 | HV_TRIO_PIO_FLAG_IO_SPACE); | 952 | HV_TRIO_PIO_FLAG_IO_SPACE); |
1000 | if (ret < 0) { | 953 | if (ret < 0) { |
1001 | pr_err("PCI: I/O PIO init failure on TRIO %d mac %d, " | 954 | pr_err("PCI: I/O PIO init failure on TRIO %d mac %d, " |
1002 | "give up\n", controller->trio_index, | 955 | "give up\n", controller->trio_index, |
1003 | controller->mac); | 956 | controller->mac); |
1004 | 957 | ||
1005 | continue; | 958 | continue; |
1006 | } | 959 | } |
@@ -1020,9 +973,9 @@ int __init pcibios_init(void) | |||
1020 | 0); | 973 | 0); |
1021 | if (ret < 0) { | 974 | if (ret < 0) { |
1022 | pr_err("PCI: Mem-Map alloc failure on TRIO %d " | 975 | pr_err("PCI: Mem-Map alloc failure on TRIO %d " |
1023 | "mac %d for MC %d, give up\n", | 976 | "mac %d for MC %d, give up\n", |
1024 | controller->trio_index, | 977 | controller->trio_index, |
1025 | controller->mac, j); | 978 | controller->mac, j); |
1026 | 979 | ||
1027 | goto alloc_mem_map_failed; | 980 | goto alloc_mem_map_failed; |
1028 | } | 981 | } |
@@ -1053,9 +1006,9 @@ int __init pcibios_init(void) | |||
1053 | GXIO_TRIO_ORDER_MODE_UNORDERED); | 1006 | GXIO_TRIO_ORDER_MODE_UNORDERED); |
1054 | if (ret < 0) { | 1007 | if (ret < 0) { |
1055 | pr_err("PCI: Mem-Map init failure on TRIO %d " | 1008 | pr_err("PCI: Mem-Map init failure on TRIO %d " |
1056 | "mac %d for MC %d, give up\n", | 1009 | "mac %d for MC %d, give up\n", |
1057 | controller->trio_index, | 1010 | controller->trio_index, |
1058 | controller->mac, j); | 1011 | controller->mac, j); |
1059 | 1012 | ||
1060 | goto alloc_mem_map_failed; | 1013 | goto alloc_mem_map_failed; |
1061 | } | 1014 | } |
@@ -1064,22 +1017,18 @@ int __init pcibios_init(void) | |||
1064 | alloc_mem_map_failed: | 1017 | alloc_mem_map_failed: |
1065 | break; | 1018 | break; |
1066 | } | 1019 | } |
1067 | |||
1068 | } | 1020 | } |
1069 | 1021 | ||
1070 | return 0; | 1022 | return 0; |
1071 | } | 1023 | } |
1072 | subsys_initcall(pcibios_init); | 1024 | subsys_initcall(pcibios_init); |
1073 | 1025 | ||
1074 | /* Note: to be deleted after Linux 3.6 merge. */ | 1026 | /* No bus fixups needed. */ |
1075 | void pcibios_fixup_bus(struct pci_bus *bus) | 1027 | void pcibios_fixup_bus(struct pci_bus *bus) |
1076 | { | 1028 | { |
1077 | } | 1029 | } |
1078 | 1030 | ||
1079 | /* | 1031 | /* Process any "pci=" kernel boot arguments. */ |
1080 | * This can be called from the generic PCI layer, but doesn't need to | ||
1081 | * do anything. | ||
1082 | */ | ||
1083 | char *pcibios_setup(char *str) | 1032 | char *pcibios_setup(char *str) |
1084 | { | 1033 | { |
1085 | if (!strcmp(str, "off")) { | 1034 | if (!strcmp(str, "off")) { |
@@ -1130,7 +1079,6 @@ void __iomem *ioremap(resource_size_t phys_addr, unsigned long size) | |||
1130 | * By searching phys_addr in each controller's mem_space, we can | 1079 | * By searching phys_addr in each controller's mem_space, we can |
1131 | * determine the controller that should accept the PCI memory access. | 1080 | * determine the controller that should accept the PCI memory access. |
1132 | */ | 1081 | */ |
1133 | |||
1134 | for (i = 0; i < num_rc_controllers; i++) { | 1082 | for (i = 0; i < num_rc_controllers; i++) { |
1135 | /* | 1083 | /* |
1136 | * Skip controllers that are not properly initialized or | 1084 | * Skip controllers that are not properly initialized or |
@@ -1158,9 +1106,7 @@ void __iomem *ioremap(resource_size_t phys_addr, unsigned long size) | |||
1158 | 1106 | ||
1159 | offset = HV_TRIO_PIO_OFFSET(controller->pio_mem_index) + start; | 1107 | offset = HV_TRIO_PIO_OFFSET(controller->pio_mem_index) + start; |
1160 | 1108 | ||
1161 | /* | 1109 | /* We need to keep the PCI bus address's in-page offset in the VA. */ |
1162 | * We need to keep the PCI bus address's in-page offset in the VA. | ||
1163 | */ | ||
1164 | return iorpc_ioremap(trio_fd, offset, size) + | 1110 | return iorpc_ioremap(trio_fd, offset, size) + |
1165 | (start & (PAGE_SIZE - 1)); | 1111 | (start & (PAGE_SIZE - 1)); |
1166 | } | 1112 | } |
@@ -1186,7 +1132,6 @@ void __iomem *ioport_map(unsigned long port, unsigned int size) | |||
1186 | * By searching the port in each controller's io_space, we can | 1132 | * By searching the port in each controller's io_space, we can |
1187 | * determine the controller that should accept the PCI I/O access. | 1133 | * determine the controller that should accept the PCI I/O access. |
1188 | */ | 1134 | */ |
1189 | |||
1190 | for (i = 0; i < num_rc_controllers; i++) { | 1135 | for (i = 0; i < num_rc_controllers; i++) { |
1191 | /* | 1136 | /* |
1192 | * Skip controllers that are not properly initialized or | 1137 | * Skip controllers that are not properly initialized or |
@@ -1214,9 +1159,7 @@ void __iomem *ioport_map(unsigned long port, unsigned int size) | |||
1214 | 1159 | ||
1215 | offset = HV_TRIO_PIO_OFFSET(controller->pio_io_index) + port; | 1160 | offset = HV_TRIO_PIO_OFFSET(controller->pio_io_index) + port; |
1216 | 1161 | ||
1217 | /* | 1162 | /* We need to keep the PCI bus address's in-page offset in the VA. */ |
1218 | * We need to keep the PCI bus address's in-page offset in the VA. | ||
1219 | */ | ||
1220 | return iorpc_ioremap(trio_fd, offset, size) + (port & (PAGE_SIZE - 1)); | 1163 | return iorpc_ioremap(trio_fd, offset, size) + (port & (PAGE_SIZE - 1)); |
1221 | } | 1164 | } |
1222 | EXPORT_SYMBOL(ioport_map); | 1165 | EXPORT_SYMBOL(ioport_map); |
@@ -1249,7 +1192,6 @@ EXPORT_SYMBOL(pci_iounmap); | |||
1249 | * offset is in bytes, from the start of config space for the | 1192 | * offset is in bytes, from the start of config space for the |
1250 | * specified bus & device. | 1193 | * specified bus & device. |
1251 | */ | 1194 | */ |
1252 | |||
1253 | static int tile_cfg_read(struct pci_bus *bus, unsigned int devfn, int offset, | 1195 | static int tile_cfg_read(struct pci_bus *bus, unsigned int devfn, int offset, |
1254 | int size, u32 *val) | 1196 | int size, u32 *val) |
1255 | { | 1197 | { |
@@ -1299,7 +1241,6 @@ static int tile_cfg_read(struct pci_bus *bus, unsigned int devfn, int offset, | |||
1299 | * Accesses to the directly attached device have to be | 1241 | * Accesses to the directly attached device have to be |
1300 | * sent as type-0 configs. | 1242 | * sent as type-0 configs. |
1301 | */ | 1243 | */ |
1302 | |||
1303 | if (busnum == (controller->first_busno + 1)) { | 1244 | if (busnum == (controller->first_busno + 1)) { |
1304 | /* | 1245 | /* |
1305 | * There is only one device off of our built-in P2P bridge. | 1246 | * There is only one device off of our built-in P2P bridge. |
@@ -1321,9 +1262,8 @@ static int tile_cfg_read(struct pci_bus *bus, unsigned int devfn, int offset, | |||
1321 | * Note that we don't set the mac field in cfg_addr because the | 1262 | * Note that we don't set the mac field in cfg_addr because the |
1322 | * mapping is per port. | 1263 | * mapping is per port. |
1323 | */ | 1264 | */ |
1324 | |||
1325 | mmio_addr = trio_context->mmio_base_pio_cfg[controller->mac] + | 1265 | mmio_addr = trio_context->mmio_base_pio_cfg[controller->mac] + |
1326 | cfg_addr.word; | 1266 | cfg_addr.word; |
1327 | 1267 | ||
1328 | valid_device: | 1268 | valid_device: |
1329 | 1269 | ||
@@ -1427,7 +1367,6 @@ static int tile_cfg_write(struct pci_bus *bus, unsigned int devfn, int offset, | |||
1427 | * Accesses to the directly attached device have to be | 1367 | * Accesses to the directly attached device have to be |
1428 | * sent as type-0 configs. | 1368 | * sent as type-0 configs. |
1429 | */ | 1369 | */ |
1430 | |||
1431 | if (busnum == (controller->first_busno + 1)) { | 1370 | if (busnum == (controller->first_busno + 1)) { |
1432 | /* | 1371 | /* |
1433 | * There is only one device off of our built-in P2P bridge. | 1372 | * There is only one device off of our built-in P2P bridge. |
@@ -1449,7 +1388,6 @@ static int tile_cfg_write(struct pci_bus *bus, unsigned int devfn, int offset, | |||
1449 | * Note that we don't set the mac field in cfg_addr because the | 1388 | * Note that we don't set the mac field in cfg_addr because the |
1450 | * mapping is per port. | 1389 | * mapping is per port. |
1451 | */ | 1390 | */ |
1452 | |||
1453 | mmio_addr = trio_context->mmio_base_pio_cfg[controller->mac] + | 1391 | mmio_addr = trio_context->mmio_base_pio_cfg[controller->mac] + |
1454 | cfg_addr.word; | 1392 | cfg_addr.word; |
1455 | 1393 | ||
@@ -1487,11 +1425,8 @@ static struct pci_ops tile_cfg_ops = { | |||
1487 | }; | 1425 | }; |
1488 | 1426 | ||
1489 | 1427 | ||
1490 | /* | 1428 | /* MSI support starts here. */ |
1491 | * MSI support starts here. | 1429 | static unsigned int tilegx_msi_startup(struct irq_data *d) |
1492 | */ | ||
1493 | static unsigned int | ||
1494 | tilegx_msi_startup(struct irq_data *d) | ||
1495 | { | 1430 | { |
1496 | if (d->msi_desc) | 1431 | if (d->msi_desc) |
1497 | unmask_msi_irq(d); | 1432 | unmask_msi_irq(d); |
@@ -1499,21 +1434,18 @@ tilegx_msi_startup(struct irq_data *d) | |||
1499 | return 0; | 1434 | return 0; |
1500 | } | 1435 | } |
1501 | 1436 | ||
1502 | static void | 1437 | static void tilegx_msi_ack(struct irq_data *d) |
1503 | tilegx_msi_ack(struct irq_data *d) | ||
1504 | { | 1438 | { |
1505 | __insn_mtspr(SPR_IPI_EVENT_RESET_K, 1UL << d->irq); | 1439 | __insn_mtspr(SPR_IPI_EVENT_RESET_K, 1UL << d->irq); |
1506 | } | 1440 | } |
1507 | 1441 | ||
1508 | static void | 1442 | static void tilegx_msi_mask(struct irq_data *d) |
1509 | tilegx_msi_mask(struct irq_data *d) | ||
1510 | { | 1443 | { |
1511 | mask_msi_irq(d); | 1444 | mask_msi_irq(d); |
1512 | __insn_mtspr(SPR_IPI_MASK_SET_K, 1UL << d->irq); | 1445 | __insn_mtspr(SPR_IPI_MASK_SET_K, 1UL << d->irq); |
1513 | } | 1446 | } |
1514 | 1447 | ||
1515 | static void | 1448 | static void tilegx_msi_unmask(struct irq_data *d) |
1516 | tilegx_msi_unmask(struct irq_data *d) | ||
1517 | { | 1449 | { |
1518 | __insn_mtspr(SPR_IPI_MASK_RESET_K, 1UL << d->irq); | 1450 | __insn_mtspr(SPR_IPI_MASK_RESET_K, 1UL << d->irq); |
1519 | unmask_msi_irq(d); | 1451 | unmask_msi_irq(d); |