Add a "blacklist" to the 5595 drivers so that they refuse to load

when encountering a long list of unsupported chips.
      All these chips have the same 1039/0008 ID as the 5595 but are
      incompatible.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1150 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2001-07-29 22:48:15 +00:00
1 parent 40bc42db26
commit 290bdb74ad
3 files changed
+110

No files matched your search

+2
View File
@@ -25,9 +25,11 @@ ask CVS about it:
Library: ds1621 and it87 updates
Module i2c-ali15x3: Allow force_addr=0xaddr; enable if not enabled.
Module i2c-i801: Fix 82801BA detection broken by kernel 2.4.6
Module i2c-sis5595: Recognize unsupported chips and refuse to load
Module adm1025: Fixed temp2 min/max writes
Module ds1621: Add 12-bit precision mode
Module it87: Enable all alarms, add in8 support, add sensor type selection
Module sis5595: Recognize unsupported chips and refuse to load
Module w83781d: Fix fan speed for as99127f (broken by 2.6.0)
Program sensors: it87 updates
Program sensors-detect: Fix ADM1024 and ADM1025 detection.
+58
View File
@@ -21,6 +21,27 @@
/* Note: we assume there can only be one SIS5595 with one SMBus interface */
/*
Note: all have mfr. ID 0x1039.
SUPPORTED PCI ID
5595 0008
Note: these chips contain a 0008 device which is incompatible with the
5595. We recognize these by the presence of the listed
"blacklist" PCI ID and refuse to load.
NOT SUPPORTED PCI ID BLACKLIST PCI ID
540 0008 0540
550 0008 0550
5513 0008 5511
5581 0008 5597
5582 0008 5597
5597 0008 5597
5598 0008 5597/5598
630 0008 0630
730 0008 0730
*/
/* TO DO:
* Add Block Transfers (ugly, but supported by the adapter)
* Add adapter resets
@@ -39,6 +60,34 @@
#include <linux/init.h>
#ifndef PCI_DEVICE_ID_SI_540
#define PCI_DEVICE_ID_SI_540 0x0540
#endif
#ifndef PCI_DEVICE_ID_SI_550
#define PCI_DEVICE_ID_SI_550 0x0550
#endif
#ifndef PCI_DEVICE_ID_SI_630
#define PCI_DEVICE_ID_SI_630 0x0630
#endif
#ifndef PCI_DEVICE_ID_SI_730
#define PCI_DEVICE_ID_SI_730 0x0730
#endif
#ifndef PCI_DEVICE_ID_SI_5598
#define PCI_DEVICE_ID_SI_5598 0x5598
#endif
static int blacklist[] = {
PCI_DEVICE_ID_SI_540,
PCI_DEVICE_ID_SI_550,
PCI_DEVICE_ID_SI_630,
PCI_DEVICE_ID_SI_730,
PCI_DEVICE_ID_SI_5511, /* 5513 chip has the 0008 device but
that ID shows up in other chips so we
use the 5511 ID for recognition */
PCI_DEVICE_ID_SI_5597,
PCI_DEVICE_ID_SI_5598,
0 };
/* Length of ISA address segment */
#define SIS5595_EXTENT 8
/* SIS5595 SMBus registers */
@@ -152,6 +201,7 @@ int sis5595_setup(void)
u16 a;
u8 val;
struct pci_dev *SIS5595_dev;
int *i;
/* First check whether we can access PCI at all */
if (pci_present() == 0) {
@@ -168,6 +218,14 @@ int sis5595_setup(void)
return -ENODEV;
}
/* Look for imposters */
for(i = blacklist; *i != 0; i++) {
if (pci_find_device(PCI_VENDOR_ID_SI, *i, NULL)) {
printk("i2c-sis5595.o: Error: Looked for SIS5595 but found unsupported device %.4X\n", *i);
return -ENODEV;
}
}
/* Determine the address of the SMBus areas */
pci_read_config_word(SIS5595_dev, ACPI_BASE, &sis5595_base);
if(sis5595_base == 0 && force_addr == 0) {
+50
View File
@@ -26,6 +26,21 @@
Version PCI ID PCI Revision
1 1039/0008 01
2 1039/0008 C0
Note: these chips contain a 0008 device which is incompatible with the
5595. We recognize these by the presence of the listed
"blacklist" PCI ID and refuse to load.
NOT SUPPORTED PCI ID BLACKLIST PCI ID
540 0008 0540
550 0008 0550
5513 0008 5511
5581 0008 5597
5582 0008 5597
5597 0008 5597
5598 0008 5597/5598
630 0008 0630
730 0008 0730
*/
#include <linux/version.h>
@@ -71,6 +86,33 @@ static unsigned int normal_isa_range[] = { SENSORS_ISA_END };
/* Insmod parameters */
SENSORS_INSMOD_1(sis5595);
#ifndef PCI_DEVICE_ID_SI_540
#define PCI_DEVICE_ID_SI_540 0x0540
#endif
#ifndef PCI_DEVICE_ID_SI_550
#define PCI_DEVICE_ID_SI_550 0x0550
#endif
#ifndef PCI_DEVICE_ID_SI_630
#define PCI_DEVICE_ID_SI_630 0x0630
#endif
#ifndef PCI_DEVICE_ID_SI_730
#define PCI_DEVICE_ID_SI_730 0x0730
#endif
#ifndef PCI_DEVICE_ID_SI_5598
#define PCI_DEVICE_ID_SI_5598 0x5598
#endif
static int blacklist[] = {
PCI_DEVICE_ID_SI_540,
PCI_DEVICE_ID_SI_550,
PCI_DEVICE_ID_SI_630,
PCI_DEVICE_ID_SI_730,
PCI_DEVICE_ID_SI_5511, /* 5513 chip has the 0008 device but
that ID shows up in other chips so we
use the 5511 ID for recognition */
PCI_DEVICE_ID_SI_5597,
PCI_DEVICE_ID_SI_5598,
0 };
/*
SiS southbridge has a LM78-like chip integrated on the same IC.
This driver is a customized copy of lm78.c
@@ -311,6 +353,7 @@ int sis5595_attach_adapter(struct i2c_adapter *adapter)
int sis5595_find_sis(int *address)
{
u16 val;
int *i;
if (!pci_present())
return -ENODEV;
@@ -320,6 +363,13 @@ int sis5595_find_sis(int *address)
NULL)))
return -ENODEV;
/* Look for imposters */
for(i = blacklist; *i != 0; i++) {
if (pci_find_device(PCI_VENDOR_ID_SI, *i, NULL)) {
printk("sis5595.o: Error: Looked for SIS5595 but found unsupported device %.4X\n", *i);
return -ENODEV;
}
}
if (PCIBIOS_SUCCESSFUL !=
pci_read_config_word(s_bridge, SIS5595_BASE_REG, &val))