aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/i5k_amb.c39
-rw-r--r--include/linux/pci_ids.h3
2 files changed, 37 insertions, 5 deletions
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
index 6ac5c6f53585..f9e2ed621f7b 100644
--- a/drivers/hwmon/i5k_amb.c
+++ b/drivers/hwmon/i5k_amb.c
@@ -111,6 +111,7 @@ struct i5k_amb_data {
111 void __iomem *amb_mmio; 111 void __iomem *amb_mmio;
112 struct i5k_device_attribute *attrs; 112 struct i5k_device_attribute *attrs;
113 unsigned int num_attrs; 113 unsigned int num_attrs;
114 unsigned long chipset_id;
114}; 115};
115 116
116static ssize_t show_name(struct device *dev, struct device_attribute *devattr, 117static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
@@ -382,7 +383,8 @@ err:
382 return res; 383 return res;
383} 384}
384 385
385static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) 386static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data,
387 unsigned long devid)
386{ 388{
387 struct pci_dev *pcidev; 389 struct pci_dev *pcidev;
388 u32 val32; 390 u32 val32;
@@ -390,7 +392,7 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data)
390 392
391 /* Find AMB register memory space */ 393 /* Find AMB register memory space */
392 pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, 394 pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
393 PCI_DEVICE_ID_INTEL_5000_ERR, 395 devid,
394 NULL); 396 NULL);
395 if (!pcidev) 397 if (!pcidev)
396 return -ENODEV; 398 return -ENODEV;
@@ -409,6 +411,8 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data)
409 goto out; 411 goto out;
410 } 412 }
411 413
414 data->chipset_id = devid;
415
412 res = 0; 416 res = 0;
413out: 417out:
414 pci_dev_put(pcidev); 418 pci_dev_put(pcidev);
@@ -441,10 +445,30 @@ out:
441 return res; 445 return res;
442} 446}
443 447
448static unsigned long i5k_channel_pci_id(struct i5k_amb_data *data,
449 unsigned long channel)
450{
451 switch (data->chipset_id) {
452 case PCI_DEVICE_ID_INTEL_5000_ERR:
453 return PCI_DEVICE_ID_INTEL_5000_FBD0 + channel;
454 case PCI_DEVICE_ID_INTEL_5400_ERR:
455 return PCI_DEVICE_ID_INTEL_5400_FBD0 + channel;
456 default:
457 BUG();
458 }
459}
460
461static unsigned long chipset_ids[] = {
462 PCI_DEVICE_ID_INTEL_5000_ERR,
463 PCI_DEVICE_ID_INTEL_5400_ERR,
464 0
465};
466
444static int __devinit i5k_amb_probe(struct platform_device *pdev) 467static int __devinit i5k_amb_probe(struct platform_device *pdev)
445{ 468{
446 struct i5k_amb_data *data; 469 struct i5k_amb_data *data;
447 struct resource *reso; 470 struct resource *reso;
471 int i;
448 int res = -ENODEV; 472 int res = -ENODEV;
449 473
450 data = kzalloc(sizeof(*data), GFP_KERNEL); 474 data = kzalloc(sizeof(*data), GFP_KERNEL);
@@ -452,19 +476,24 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev)
452 return -ENOMEM; 476 return -ENOMEM;
453 477
454 /* Figure out where the AMB registers live */ 478 /* Figure out where the AMB registers live */
455 res = i5k_find_amb_registers(data); 479 i = 0;
480 do {
481 res = i5k_find_amb_registers(data, chipset_ids[i]);
482 i++;
483 } while (res && chipset_ids[i]);
484
456 if (res) 485 if (res)
457 goto err; 486 goto err;
458 487
459 /* Copy the DIMM presence map for the first two channels */ 488 /* Copy the DIMM presence map for the first two channels */
460 res = i5k_channel_probe(&data->amb_present[0], 489 res = i5k_channel_probe(&data->amb_present[0],
461 PCI_DEVICE_ID_INTEL_5000_FBD0); 490 i5k_channel_pci_id(data, 0));
462 if (res) 491 if (res)
463 goto err; 492 goto err;
464 493
465 /* Copy the DIMM presence map for the optional second two channels */ 494 /* Copy the DIMM presence map for the optional second two channels */
466 i5k_channel_probe(&data->amb_present[2], 495 i5k_channel_probe(&data->amb_present[2],
467 PCI_DEVICE_ID_INTEL_5000_FBD1); 496 i5k_channel_pci_id(data, 1));
468 497
469 /* Set up resource regions */ 498 /* Set up resource regions */
470 reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); 499 reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index cf6dbd759395..342b55afb0c3 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2383,6 +2383,9 @@
2383#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2383#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30
2384#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2384#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
2385#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2385#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2386#define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030
2387#define PCI_DEVICE_ID_INTEL_5400_FBD0 0x4035
2388#define PCI_DEVICE_ID_INTEL_5400_FBD1 0x4036
2386#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff 2389#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
2387#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 2390#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031
2388#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032 2391#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032