aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-06-30 00:41:35 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-07-02 17:04:05 -0400
commitbda142890e6bdd9b1115715e50b0276ea4b9978a (patch)
tree41b885fc4e9bb14eb7f7c57d93318acd2cdb4453 /drivers/edac
parent7e27d6e778cd87b6f2415515d7127eba53fe5d02 (diff)
i7core_edac: Properly discover the first QPI device
On Nehalem/Nehalem-EP/Westmere, the first QPI device is the last PCI bus. The last bus is generally at 0x3f or 0xff, but there are also other systems using different setups. For example, HP Z800 has 0x7f as the last bus. This patch adds a logic to discover the last bus, dynamically detecting it at runtime. Acked-by: Doug Thompson <dougthompson@xmission.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/i7core_edac.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 6b8b7b41ec5f..d7c76800988e 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1233,10 +1233,28 @@ static void __init i7core_xeon_pci_fixup(struct pci_id_table *table)
1233 for (i = 0; i < MAX_SOCKET_BUSES; i++) 1233 for (i = 0; i < MAX_SOCKET_BUSES; i++)
1234 pcibios_scan_specific_bus(255-i); 1234 pcibios_scan_specific_bus(255-i);
1235 } 1235 }
1236 pci_dev_put(pdev);
1236 table++; 1237 table++;
1237 } 1238 }
1238} 1239}
1239 1240
1241static unsigned i7core_pci_lastbus(void)
1242{
1243 int last_bus = 0, bus;
1244 struct pci_bus *b = NULL;
1245
1246 while ((b = pci_find_next_bus(b)) != NULL) {
1247 bus = b->number;
1248 debugf0("Found bus %d\n", bus);
1249 if (bus > last_bus)
1250 last_bus = bus;
1251 }
1252
1253 debugf0("Last bus %d\n", last_bus);
1254
1255 return last_bus;
1256}
1257
1240/* 1258/*
1241 * i7core_get_devices Find and perform 'get' operation on the MCH's 1259 * i7core_get_devices Find and perform 'get' operation on the MCH's
1242 * device/functions we want to reference for this driver 1260 * device/functions we want to reference for this driver
@@ -1244,7 +1262,8 @@ static void __init i7core_xeon_pci_fixup(struct pci_id_table *table)
1244 * Need to 'get' device 16 func 1 and func 2 1262 * Need to 'get' device 16 func 1 and func 2
1245 */ 1263 */
1246int i7core_get_onedevice(struct pci_dev **prev, int devno, 1264int i7core_get_onedevice(struct pci_dev **prev, int devno,
1247 struct pci_id_descr *dev_descr, unsigned n_devs) 1265 struct pci_id_descr *dev_descr, unsigned n_devs,
1266 unsigned last_bus)
1248{ 1267{
1249 struct i7core_dev *i7core_dev; 1268 struct i7core_dev *i7core_dev;
1250 1269
@@ -1291,10 +1310,7 @@ int i7core_get_onedevice(struct pci_dev **prev, int devno,
1291 } 1310 }
1292 bus = pdev->bus->number; 1311 bus = pdev->bus->number;
1293 1312
1294 if (bus == 0x3f) 1313 socket = last_bus - bus;
1295 socket = 0;
1296 else
1297 socket = 255 - bus;
1298 1314
1299 i7core_dev = get_i7core_dev(socket); 1315 i7core_dev = get_i7core_dev(socket);
1300 if (!i7core_dev) { 1316 if (!i7core_dev) {
@@ -1358,17 +1374,21 @@ int i7core_get_onedevice(struct pci_dev **prev, int devno,
1358 1374
1359static int i7core_get_devices(struct pci_id_table *table) 1375static int i7core_get_devices(struct pci_id_table *table)
1360{ 1376{
1361 int i, rc; 1377 int i, rc, last_bus;
1362 struct pci_dev *pdev = NULL; 1378 struct pci_dev *pdev = NULL;
1363 struct pci_id_descr *dev_descr; 1379 struct pci_id_descr *dev_descr;
1364 1380
1381 last_bus = i7core_pci_lastbus();
1382
1365 while (table && table->descr) { 1383 while (table && table->descr) {
1366 dev_descr = table->descr; 1384 dev_descr = table->descr;
1367 for (i = 0; i < table->n_devs; i++) { 1385 for (i = 0; i < table->n_devs; i++) {
1368 pdev = NULL; 1386 pdev = NULL;
1369 do { 1387 do {
1370 rc = i7core_get_onedevice(&pdev, i, &dev_descr[i], 1388 rc = i7core_get_onedevice(&pdev, i,
1371 table->n_devs); 1389 &dev_descr[i],
1390 table->n_devs,
1391 last_bus);
1372 if (rc < 0) { 1392 if (rc < 0) {
1373 if (i == 0) { 1393 if (i == 0) {
1374 i = table->n_devs; 1394 i = table->n_devs;