Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i5k_amb: support Intel 5400 chipset

Minor rework to support the Intel 5400 chipset.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Darrick J. Wong and committed by
Linus Torvalds
b8fdaf5a ca68d0ac

+37 -5
+34 -5
drivers/hwmon/i5k_amb.c
··· 111 111 void __iomem *amb_mmio; 112 112 struct i5k_device_attribute *attrs; 113 113 unsigned int num_attrs; 114 + unsigned long chipset_id; 114 115 }; 115 116 116 117 static ssize_t show_name(struct device *dev, struct device_attribute *devattr, ··· 383 382 return res; 384 383 } 385 384 386 - static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) 385 + static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data, 386 + unsigned long devid) 387 387 { 388 388 struct pci_dev *pcidev; 389 389 u32 val32; ··· 392 390 393 391 /* Find AMB register memory space */ 394 392 pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, 395 - PCI_DEVICE_ID_INTEL_5000_ERR, 393 + devid, 396 394 NULL); 397 395 if (!pcidev) 398 396 return -ENODEV; ··· 410 408 dev_err(&pcidev->dev, "AMB region too small!\n"); 411 409 goto out; 412 410 } 411 + 412 + data->chipset_id = devid; 413 413 414 414 res = 0; 415 415 out: ··· 445 441 return res; 446 442 } 447 443 444 + static unsigned long i5k_channel_pci_id(struct i5k_amb_data *data, 445 + unsigned long channel) 446 + { 447 + switch (data->chipset_id) { 448 + case PCI_DEVICE_ID_INTEL_5000_ERR: 449 + return PCI_DEVICE_ID_INTEL_5000_FBD0 + channel; 450 + case PCI_DEVICE_ID_INTEL_5400_ERR: 451 + return PCI_DEVICE_ID_INTEL_5400_FBD0 + channel; 452 + default: 453 + BUG(); 454 + } 455 + } 456 + 457 + static unsigned long chipset_ids[] = { 458 + PCI_DEVICE_ID_INTEL_5000_ERR, 459 + PCI_DEVICE_ID_INTEL_5400_ERR, 460 + 0 461 + }; 462 + 448 463 static int __devinit i5k_amb_probe(struct platform_device *pdev) 449 464 { 450 465 struct i5k_amb_data *data; 451 466 struct resource *reso; 467 + int i; 452 468 int res = -ENODEV; 453 469 454 470 data = kzalloc(sizeof(*data), GFP_KERNEL); ··· 476 452 return -ENOMEM; 477 453 478 454 /* Figure out where the AMB registers live */ 479 - res = i5k_find_amb_registers(data); 455 + i = 0; 456 + do { 457 + res = i5k_find_amb_registers(data, chipset_ids[i]); 458 + i++; 459 + } while (res && chipset_ids[i]); 460 + 480 461 if (res) 481 462 goto err; 482 463 483 464 /* Copy the DIMM presence map for the first two channels */ 484 465 res = i5k_channel_probe(&data->amb_present[0], 485 - PCI_DEVICE_ID_INTEL_5000_FBD0); 466 + i5k_channel_pci_id(data, 0)); 486 467 if (res) 487 468 goto err; 488 469 489 470 /* Copy the DIMM presence map for the optional second two channels */ 490 471 i5k_channel_probe(&data->amb_present[2], 491 - PCI_DEVICE_ID_INTEL_5000_FBD1); 472 + i5k_channel_pci_id(data, 1)); 492 473 493 474 /* Set up resource regions */ 494 475 reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME);
+3
include/linux/pci_ids.h
··· 2383 2383 #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2384 2384 #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2385 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 2389 #define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff 2387 2390 #define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 2388 2391 #define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032