2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 06:15:15 +00:00

(mds) Check for uninitialized base addresses. Check for unenabled sensors.

On sis5595, refuse to load if chip not found.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@943 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker
2000-12-14 00:26:13 +00:00
parent 7879f5cf8a
commit 7ccaa7f419
3 changed files with 31 additions and 16 deletions

View File

@@ -31,6 +31,7 @@ ask CVS about it:
Module lm87: update voltage calculations
Module mtp008: new
Module pcf8574: change update time to 5 seconds
Modules sis5595, i2c-sis5595: Check for uninitialized base addresses
Module w83781d: fix beep setting via /proc
Program mkpatch.pl: more fixes
Program sensors: Add ds1621, mtp008 support; add -f (Fahrenheit) option;

View File

@@ -162,6 +162,12 @@ int sis5595_setup(void)
/* Determine the address of the SMBus areas */
pci_read_config_word(SIS5595_dev, ACPI_BASE, &sis5595_base);
if(sis5595_base == 0) {
printk("i2c-sis5595.o: ACPI base address uninitialized - upgrade BIOS?\n");
error_return = -ENODEV;
goto END;
}
#ifdef DEBUG
printk("ACPI Base address: %04x\n", sis5595_base);
#endif
@@ -169,7 +175,7 @@ int sis5595_setup(void)
* interfere with ACPI :-( */
if (check_region(sis5595_base + SMB_INDEX, 2)) {
printk
("i2c-sis5595.o: SMBus registers 0x%4x-0x%4x already in use!\n",
("i2c-sis5595.o: SMBus registers 0x%04x-0x%04x already in use!\n",
sis5595_base + SMB_INDEX,
sis5595_base + SMB_INDEX + 1);
error_return = -ENODEV;
@@ -373,7 +379,7 @@ u32 sis5595_func(struct i2c_adapter *adapter)
int __init i2c_sis5595_init(void)
{
int res;
printk("sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE);
printk("i2c-sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE);
#ifdef DEBUG
/* PE- It might be good to make this a permanent part of the code! */
if (sis5595_initialized) {

View File

@@ -67,6 +67,7 @@ SENSORS_INSMOD_1(sis5595);
/* Length of ISA address segment */
#define SIS5595_EXTENT 8
#define SIS5595_BASE_REG 0x68
#define SIS5595_ENABLE_REG 0x7B
/* Where are the ISA address/data registers relative to the base address */
#define SIS5595_ADDR_REG_OFFSET 5
@@ -277,15 +278,14 @@ int sis5595_find_sis(int *address)
{
struct pci_dev *s_bridge;
u16 val;
char c;
if (!pci_present())
return -ENODEV;
if (!
(s_bridge =
pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503,
if (!(s_bridge =
pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503,
NULL)))
return -ENODEV;
@@ -294,6 +294,18 @@ int sis5595_find_sis(int *address)
return -ENODEV;
*address = (val & 0xfff8);
if(*address == 0) {
printk("sis5595.o: Sensor base address uninitialized - upgrade BIOS?\n");
return -ENODEV;
}
if (PCIBIOS_SUCCESSFUL !=
pci_read_config_byte(s_bridge, SIS5595_ENABLE_REG, &c))
return -ENODEV;
if((c & 0x80) == 0) {
printk("sis5595.o: Sensors not enabled - upgrade BIOS?\n");
return -ENODEV;
}
return 0;
}
@@ -469,8 +481,8 @@ void sis5595_dec_use(struct i2c_client *client)
}
/* The SMBus locks itself, but ISA access must be locked explicitely!
There are some ugly typecasts here, but the good new is - they should
/* The SMBus locks itself, but ISA access must be locked explicitly!
There are some ugly typecasts here, but the good news is - they should
nowhere else be necessary! */
int sis5595_read_value(struct i2c_client *client, u8 reg)
{
@@ -483,9 +495,6 @@ int sis5595_read_value(struct i2c_client *client, u8 reg)
return res;
}
/* The SMBus locks itself, but ISA access muse be locked explicitely!
There are some ugly typecasts here, but the good new is - they should
nowhere else be necessary! */
int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
{
down(&(((struct sis5595_data *) (client->data))->lock));
@@ -730,11 +739,10 @@ int __init sensors_sis5595_init(void)
sis5595_initialized = 0;
if (sis5595_find_sis(&addr)) {
normal_isa[0] = SENSORS_ISA_END;
printk
("sis5595.o: Warning: No SIS5595 southbridge found!\n");
} else
normal_isa[0] = addr;
printk("sis5595.o: SIS5595 not detected, module not inserted.\n");
return -ENODEV;
}
normal_isa[0] = addr;
if ((res = i2c_add_driver(&sis5595_driver))) {
printk