aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-05 13:18:34 -0400
committerChris Metcalf <cmetcalf@tilera.com>2013-08-06 12:55:44 -0400
commit1198168733c8d6fbc6898fd8d7fcfb42befabb41 (patch)
tree6c50165c655b69d8375c9c2fe919161911b07923
parent1c43649a9929ca4394ae389b4510c61f3876a12b (diff)
tile PCI RC: eliminate pci_controller.mem_resources field
The .mem_resources[] field in the pci_controller struct is now obsoleted by the .mem_space and .io_space fields. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
-rw-r--r--arch/tile/include/asm/pci.h3
-rw-r--r--arch/tile/kernel/pci_gx.c71
2 files changed, 12 insertions, 62 deletions
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index 1f1b65443bad..2c001b2bf7c3 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -173,9 +173,6 @@ struct pci_controller {
173 173
174 /* Table that maps the INTx numbers to Linux irq numbers. */ 174 /* Table that maps the INTx numbers to Linux irq numbers. */
175 int irq_intx_table[4]; 175 int irq_intx_table[4];
176
177 /* Address ranges that are routed to this controller/bridge. */
178 struct resource mem_resources[3];
179}; 176};
180 177
181extern struct pci_controller pci_controllers[TILEGX_NUM_TRIO * TILEGX_TRIO_PCIES]; 178extern struct pci_controller pci_controllers[TILEGX_NUM_TRIO * TILEGX_TRIO_PCIES];
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 805163838dce..6837be272ddf 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -929,9 +929,6 @@ int __init pcibios_init(void)
929 struct pci_controller *controller = &pci_controllers[i]; 929 struct pci_controller *controller = &pci_controllers[i];
930 gxio_trio_context_t *trio_context = controller->trio; 930 gxio_trio_context_t *trio_context = controller->trio;
931 struct pci_bus *root_bus = pci_controllers[i].root_bus; 931 struct pci_bus *root_bus = pci_controllers[i].root_bus;
932 struct pci_bus *next_bus;
933 uint32_t bus_address_hi;
934 struct pci_dev *dev;
935 int ret; 932 int ret;
936 int j; 933 int j;
937 934
@@ -945,35 +942,6 @@ int __init pcibios_init(void)
945 /* Configure the max_payload_size values for this domain. */ 942 /* Configure the max_payload_size values for this domain. */
946 fixup_read_and_payload_sizes(controller); 943 fixup_read_and_payload_sizes(controller);
947 944
948 list_for_each_entry(dev, &root_bus->devices, bus_list) {
949 /* Find the PCI host controller, ie. the 1st bridge. */
950 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI &&
951 (PCI_SLOT(dev->devfn) == 0)) {
952 next_bus = dev->subordinate;
953 pci_controllers[i].mem_resources[0] =
954 *next_bus->resource[0];
955 pci_controllers[i].mem_resources[1] =
956 *next_bus->resource[1];
957 pci_controllers[i].mem_resources[2] =
958 *next_bus->resource[2];
959
960 break;
961 }
962 }
963
964 if (pci_controllers[i].mem_resources[1].flags & IORESOURCE_MEM)
965 bus_address_hi =
966 pci_controllers[i].mem_resources[1].start >> 32;
967 else if (pci_controllers[i].mem_resources[2].flags & IORESOURCE_PREFETCH)
968 bus_address_hi =
969 pci_controllers[i].mem_resources[2].start >> 32;
970 else {
971 /* This is unlikely. */
972 pr_err("PCI: no memory resources on TRIO %d mac %d\n",
973 controller->trio_index, controller->mac);
974 continue;
975 }
976
977 /* 945 /*
978 * 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.
979 */ 947 */
@@ -1153,16 +1121,13 @@ void __iomem *ioremap(resource_size_t phys_addr, unsigned long size)
1153 resource_size_t start; 1121 resource_size_t start;
1154 resource_size_t end; 1122 resource_size_t end;
1155 int trio_fd; 1123 int trio_fd;
1156 int i, j; 1124 int i;
1157 1125
1158 start = phys_addr; 1126 start = phys_addr;
1159 end = phys_addr + size - 1; 1127 end = phys_addr + size - 1;
1160 1128
1161 /* 1129 /*
1162 * In the following, each PCI controller's mem_resources[1] 1130 * By searching phys_addr in each controller's mem_space, we can
1163 * represents its (non-prefetchable) PCI memory resource and
1164 * mem_resources[2] refers to its prefetchable PCI memory resource.
1165 * By searching phys_addr in each controller's mem_resources[], we can
1166 * determine the controller that should accept the PCI memory access. 1131 * determine the controller that should accept the PCI memory access.
1167 */ 1132 */
1168 1133
@@ -1174,25 +1139,18 @@ void __iomem *ioremap(resource_size_t phys_addr, unsigned long size)
1174 if (pci_controllers[i].root_bus == NULL) 1139 if (pci_controllers[i].root_bus == NULL)
1175 continue; 1140 continue;
1176 1141
1177 for (j = 1; j < 3; j++) { 1142 bar_start = pci_controllers[i].mem_space.start;
1178 bar_start = 1143 bar_end = pci_controllers[i].mem_space.end;
1179 pci_controllers[i].mem_resources[j].start;
1180 bar_end =
1181 pci_controllers[i].mem_resources[j].end;
1182
1183 if ((start >= bar_start) && (end <= bar_end)) {
1184 1144
1185 controller = &pci_controllers[i]; 1145 if ((start >= bar_start) && (end <= bar_end)) {
1186 1146 controller = &pci_controllers[i];
1187 goto got_it; 1147 break;
1188 }
1189 } 1148 }
1190 } 1149 }
1191 1150
1192 if (controller == NULL) 1151 if (controller == NULL)
1193 return NULL; 1152 return NULL;
1194 1153
1195got_it:
1196 trio_fd = controller->trio->fd; 1154 trio_fd = controller->trio->fd;
1197 1155
1198 /* Convert the resource start to the bus address offset. */ 1156 /* Convert the resource start to the bus address offset. */
@@ -1225,10 +1183,8 @@ void __iomem *ioport_map(unsigned long port, unsigned int size)
1225 end = port + size - 1; 1183 end = port + size - 1;
1226 1184
1227 /* 1185 /*
1228 * In the following, each PCI controller's mem_resources[0] 1186 * By searching the port in each controller's io_space, we can
1229 * represents its PCI I/O resource. By searching port in each 1187 * determine the controller that should accept the PCI I/O access.
1230 * controller's mem_resources[0], we can determine the controller
1231 * that should accept the PCI I/O access.
1232 */ 1188 */
1233 1189
1234 for (i = 0; i < num_rc_controllers; i++) { 1190 for (i = 0; i < num_rc_controllers; i++) {
@@ -1239,21 +1195,18 @@ void __iomem *ioport_map(unsigned long port, unsigned int size)
1239 if (pci_controllers[i].root_bus == NULL) 1195 if (pci_controllers[i].root_bus == NULL)
1240 continue; 1196 continue;
1241 1197
1242 bar_start = pci_controllers[i].mem_resources[0].start; 1198 bar_start = pci_controllers[i].io_space.start;
1243 bar_end = pci_controllers[i].mem_resources[0].end; 1199 bar_end = pci_controllers[i].io_space.end;
1244 1200
1245 if ((start >= bar_start) && (end <= bar_end)) { 1201 if ((start >= bar_start) && (end <= bar_end)) {
1246
1247 controller = &pci_controllers[i]; 1202 controller = &pci_controllers[i];
1248 1203 break;
1249 goto got_it;
1250 } 1204 }
1251 } 1205 }
1252 1206
1253 if (controller == NULL) 1207 if (controller == NULL)
1254 return NULL; 1208 return NULL;
1255 1209
1256got_it:
1257 trio_fd = controller->trio->fd; 1210 trio_fd = controller->trio->fd;
1258 1211
1259 /* Convert the resource start to the bus address offset. */ 1212 /* Convert the resource start to the bus address offset. */