aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/tile/include/asm/pci.h27
-rw-r--r--arch/tile/kernel/pci_gx.c80
-rw-r--r--arch/tile/kernel/setup.c4
3 files changed, 47 insertions, 64 deletions
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index 553b7ff018c4..302cdf71ceed 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -128,15 +128,10 @@ static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {}
128#define TILE_PCI_MEM_MAP_BASE_OFFSET (1ULL << CHIP_PA_WIDTH()) 128#define TILE_PCI_MEM_MAP_BASE_OFFSET (1ULL << CHIP_PA_WIDTH())
129 129
130/* 130/*
131 * End of the PCI memory resource. 131 * Start of the PCI memory resource, which starts at the end of the
132 * maximum system physical RAM address.
132 */ 133 */
133#define TILE_PCI_MEM_END \ 134#define TILE_PCI_MEM_START (1ULL << CHIP_PA_WIDTH())
134 ((1ULL << CHIP_PA_WIDTH()) + TILE_PCI_BAR_WINDOW_TOP)
135
136/*
137 * Start of the PCI memory resource.
138 */
139#define TILE_PCI_MEM_START (TILE_PCI_MEM_END - TILE_PCI_BAR_WINDOW_SIZE)
140 135
141/* 136/*
142 * Structure of a PCI controller (host bridge) on Gx. 137 * Structure of a PCI controller (host bridge) on Gx.
@@ -159,17 +154,19 @@ struct pci_controller {
159 int index; /* PCI domain number */ 154 int index; /* PCI domain number */
160 struct pci_bus *root_bus; 155 struct pci_bus *root_bus;
161 156
157 /* PCI memory space resource for this controller. */
158 struct resource mem_space;
159 char mem_space_name[32];
160
162 uint64_t mem_offset; /* cpu->bus memory mapping offset. */ 161 uint64_t mem_offset; /* cpu->bus memory mapping offset. */
163 162
164 int last_busno; 163 int first_busno;
165 164
166 struct pci_ops *ops; 165 struct pci_ops *ops;
167 166
168 /* Table that maps the INTx numbers to Linux irq numbers. */ 167 /* Table that maps the INTx numbers to Linux irq numbers. */
169 int irq_intx_table[4]; 168 int irq_intx_table[4];
170 169
171 struct resource mem_space;
172
173 /* Address ranges that are routed to this controller/bridge. */ 170 /* Address ranges that are routed to this controller/bridge. */
174 struct resource mem_resources[3]; 171 struct resource mem_resources[3];
175}; 172};
@@ -179,14 +176,6 @@ extern gxio_trio_context_t trio_contexts[TILEGX_NUM_TRIO];
179 176
180extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 177extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
181 178
182extern void
183pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
184 struct resource *res);
185
186extern void
187pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
188 struct pci_bus_region *region);
189
190/* 179/*
191 * The PCI address space does not equal the physical memory address 180 * The PCI address space does not equal the physical memory address
192 * space (we have an IOMMU). The IDE and SCSI device layers use this 181 * space (we have an IOMMU). The IDE and SCSI device layers use this
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 27f7ab021137..fa75264a82ae 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -96,21 +96,6 @@ static struct pci_ops tile_cfg_ops;
96/* Mask of CPUs that should receive PCIe interrupts. */ 96/* Mask of CPUs that should receive PCIe interrupts. */
97static struct cpumask intr_cpus_map; 97static struct cpumask intr_cpus_map;
98 98
99/* PCI I/O space support is not implemented. */
100static struct resource pci_ioport_resource = {
101 .name = "PCI IO",
102 .start = 0,
103 .end = 0,
104 .flags = IORESOURCE_IO,
105};
106
107static struct resource pci_iomem_resource = {
108 .name = "PCI mem",
109 .start = TILE_PCI_MEM_START,
110 .end = TILE_PCI_MEM_END,
111 .flags = IORESOURCE_MEM,
112};
113
114/* 99/*
115 * We don't need to worry about the alignment of resources. 100 * We don't need to worry about the alignment of resources.
116 */ 101 */
@@ -437,9 +422,26 @@ out:
437 struct pci_controller *controller = &pci_controllers[i]; 422 struct pci_controller *controller = &pci_controllers[i];
438 423
439 controller->index = i; 424 controller->index = i;
440 controller->last_busno = 0xff;
441 controller->ops = &tile_cfg_ops; 425 controller->ops = &tile_cfg_ops;
442 426
427 /*
428 * The PCI memory resource is located above the PA space.
429 * For every host bridge, the BAR window or the MMIO aperture
430 * is in range [3GB, 4GB - 1] of a 4GB space beyond the
431 * PA space.
432 */
433
434 controller->mem_offset = TILE_PCI_MEM_START +
435 (i * TILE_PCI_BAR_WINDOW_TOP);
436 controller->mem_space.start = controller->mem_offset +
437 TILE_PCI_BAR_WINDOW_TOP - TILE_PCI_BAR_WINDOW_SIZE;
438 controller->mem_space.end = controller->mem_offset +
439 TILE_PCI_BAR_WINDOW_TOP - 1;
440 controller->mem_space.flags = IORESOURCE_MEM;
441 snprintf(controller->mem_space_name,
442 sizeof(controller->mem_space_name),
443 "PCI mem domain %d", i);
444 controller->mem_space.name = controller->mem_space_name;
443 } 445 }
444 446
445 return num_rc_controllers; 447 return num_rc_controllers;
@@ -588,6 +590,7 @@ int __init pcibios_init(void)
588{ 590{
589 resource_size_t offset; 591 resource_size_t offset;
590 LIST_HEAD(resources); 592 LIST_HEAD(resources);
593 int next_busno;
591 int i; 594 int i;
592 595
593 tile_pci_init(); 596 tile_pci_init();
@@ -628,7 +631,7 @@ int __init pcibios_init(void)
628 msleep(250); 631 msleep(250);
629 632
630 /* Scan all of the recorded PCI controllers. */ 633 /* Scan all of the recorded PCI controllers. */
631 for (i = 0; i < num_rc_controllers; i++) { 634 for (next_busno = 0, i = 0; i < num_rc_controllers; i++) {
632 struct pci_controller *controller = &pci_controllers[i]; 635 struct pci_controller *controller = &pci_controllers[i];
633 gxio_trio_context_t *trio_context = controller->trio; 636 gxio_trio_context_t *trio_context = controller->trio;
634 TRIO_PCIE_INTFC_PORT_CONFIG_t port_config; 637 TRIO_PCIE_INTFC_PORT_CONFIG_t port_config;
@@ -843,13 +846,14 @@ int __init pcibios_init(void)
843 * The memory range for the PCI root bus should not overlap 846 * The memory range for the PCI root bus should not overlap
844 * with the physical RAM 847 * with the physical RAM
845 */ 848 */
846 pci_add_resource_offset(&resources, &iomem_resource, 849 pci_add_resource_offset(&resources, &controller->mem_space,
847 1ULL << CHIP_PA_WIDTH()); 850 controller->mem_offset);
848 851
849 bus = pci_scan_root_bus(NULL, 0, controller->ops, 852 controller->first_busno = next_busno;
853 bus = pci_scan_root_bus(NULL, next_busno, controller->ops,
850 controller, &resources); 854 controller, &resources);
851 controller->root_bus = bus; 855 controller->root_bus = bus;
852 controller->last_busno = bus->subordinate; 856 next_busno = bus->subordinate + 1;
853 857
854 } 858 }
855 859
@@ -1011,20 +1015,9 @@ alloc_mem_map_failed:
1011} 1015}
1012subsys_initcall(pcibios_init); 1016subsys_initcall(pcibios_init);
1013 1017
1014/* 1018/* Note: to be deleted after Linux 3.6 merge. */
1015 * PCI scan code calls the arch specific pcibios_fixup_bus() each time it scans
1016 * a new bridge. Called after each bus is probed, but before its children are
1017 * examined.
1018 */
1019void __devinit pcibios_fixup_bus(struct pci_bus *bus) 1019void __devinit pcibios_fixup_bus(struct pci_bus *bus)
1020{ 1020{
1021 struct pci_dev *dev = bus->self;
1022
1023 if (!dev) {
1024 /* This is the root bus. */
1025 bus->resource[0] = &pci_ioport_resource;
1026 bus->resource[1] = &pci_iomem_resource;
1027 }
1028} 1021}
1029 1022
1030/* 1023/*
@@