diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-07-04 23:12:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-07-04 23:12:06 -0400 |
commit | 62fd98571727a22ef77f1a9c1637260ad5a10baa (patch) | |
tree | 0b0118c028b5de70ba42d45f18b08cd7cea96dad /drivers | |
parent | 404504470177d5ca1b46db5197ee0b78d639a2eb (diff) | |
parent | 67c8931677090540e31b4f816e5fe315ff51f262 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/i7core
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/i7core:
MAINTAINERS: Add an entry for i7core_edac
i7core_edac: Avoid doing multiple probes for the same card
i7core_edac: Properly discover the first QPI device
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/edac/i7core_edac.c | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 6b8b7b41ec5f..cc9357da0e34 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 | ||
1241 | static 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 | */ |
1246 | int i7core_get_onedevice(struct pci_dev **prev, int devno, | 1264 | int 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 | ||
1359 | static int i7core_get_devices(struct pci_id_table *table) | 1375 | static 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; |
@@ -1927,21 +1947,26 @@ fail: | |||
1927 | * 0 for FOUND a device | 1947 | * 0 for FOUND a device |
1928 | * < 0 for error code | 1948 | * < 0 for error code |
1929 | */ | 1949 | */ |
1950 | |||
1951 | static int probed = 0; | ||
1952 | |||
1930 | static int __devinit i7core_probe(struct pci_dev *pdev, | 1953 | static int __devinit i7core_probe(struct pci_dev *pdev, |
1931 | const struct pci_device_id *id) | 1954 | const struct pci_device_id *id) |
1932 | { | 1955 | { |
1933 | int dev_idx = id->driver_data; | ||
1934 | int rc; | 1956 | int rc; |
1935 | struct i7core_dev *i7core_dev; | 1957 | struct i7core_dev *i7core_dev; |
1936 | 1958 | ||
1959 | /* get the pci devices we want to reserve for our use */ | ||
1960 | mutex_lock(&i7core_edac_lock); | ||
1961 | |||
1937 | /* | 1962 | /* |
1938 | * All memory controllers are allocated at the first pass. | 1963 | * All memory controllers are allocated at the first pass. |
1939 | */ | 1964 | */ |
1940 | if (unlikely(dev_idx >= 1)) | 1965 | if (unlikely(probed >= 1)) { |
1966 | mutex_unlock(&i7core_edac_lock); | ||
1941 | return -EINVAL; | 1967 | return -EINVAL; |
1942 | 1968 | } | |
1943 | /* get the pci devices we want to reserve for our use */ | 1969 | probed++; |
1944 | mutex_lock(&i7core_edac_lock); | ||
1945 | 1970 | ||
1946 | rc = i7core_get_devices(pci_dev_table); | 1971 | rc = i7core_get_devices(pci_dev_table); |
1947 | if (unlikely(rc < 0)) | 1972 | if (unlikely(rc < 0)) |
@@ -2013,6 +2038,8 @@ static void __devexit i7core_remove(struct pci_dev *pdev) | |||
2013 | i7core_dev->socket); | 2038 | i7core_dev->socket); |
2014 | } | 2039 | } |
2015 | } | 2040 | } |
2041 | probed--; | ||
2042 | |||
2016 | mutex_unlock(&i7core_edac_lock); | 2043 | mutex_unlock(&i7core_edac_lock); |
2017 | } | 2044 | } |
2018 | 2045 | ||