Changeset 943

Show
Ignore:
Timestamp:
12/14/00 01:26:13 (8 years ago)
Author:
mds
Message:

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

On sis5595, refuse to load if chip not found.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/CHANGES

    r941 r943  
    3232  Module mtp008: new 
    3333  Module pcf8574: change update time to 5 seconds 
     34  Modules sis5595, i2c-sis5595: Check for uninitialized base addresses 
    3435  Module w83781d: fix beep setting via /proc 
    3536  Program mkpatch.pl: more fixes 
  • lm-sensors/trunk/kernel/busses/i2c-sis5595.c

    r838 r943  
    163163/* Determine the address of the SMBus areas */ 
    164164        pci_read_config_word(SIS5595_dev, ACPI_BASE, &sis5595_base); 
     165        if(sis5595_base == 0) { 
     166                printk("i2c-sis5595.o: ACPI base address uninitialized - upgrade BIOS?\n"); 
     167                error_return = -ENODEV; 
     168                goto END; 
     169        } 
     170 
    165171#ifdef DEBUG 
    166172        printk("ACPI Base address: %04x\n", sis5595_base); 
     
    170176        if (check_region(sis5595_base + SMB_INDEX, 2)) { 
    171177                printk 
    172                     ("i2c-sis5595.o: SMBus registers 0x%4x-0x%4x already in use!\n", 
     178                    ("i2c-sis5595.o: SMBus registers 0x%04x-0x%04x already in use!\n", 
    173179                     sis5595_base + SMB_INDEX, 
    174180                     sis5595_base + SMB_INDEX + 1); 
     
    374380{ 
    375381        int res; 
    376         printk("sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE); 
     382        printk("i2c-sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE); 
    377383#ifdef DEBUG 
    378384/* PE- It might be good to make this a permanent part of the code! */ 
  • lm-sensors/trunk/kernel/chips/sis5595.c

    r933 r943  
    6868#define SIS5595_EXTENT 8 
    6969#define SIS5595_BASE_REG 0x68 
     70#define SIS5595_ENABLE_REG 0x7B 
    7071 
    7172/* Where are the ISA address/data registers relative to the base address */ 
     
    278279        struct pci_dev *s_bridge; 
    279280        u16 val; 
     281        char c; 
    280282 
    281283        if (!pci_present()) 
    282284                return -ENODEV; 
    283285 
    284         if (! 
    285             (s_bridge = 
    286              pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, 
     286        if (!(s_bridge = 
     287              pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, 
    287288                             NULL))) 
    288  
    289289                return -ENODEV; 
    290290 
     
    295295 
    296296        *address = (val & 0xfff8); 
     297        if(*address == 0) { 
     298                printk("sis5595.o: Sensor base address uninitialized - upgrade BIOS?\n"); 
     299                return -ENODEV; 
     300        } 
     301 
     302        if (PCIBIOS_SUCCESSFUL != 
     303            pci_read_config_byte(s_bridge, SIS5595_ENABLE_REG, &c)) 
     304                return -ENODEV; 
     305        if((c & 0x80) == 0) { 
     306                printk("sis5595.o: Sensors not enabled - upgrade BIOS?\n"); 
     307                return -ENODEV; 
     308        } 
    297309        return 0; 
    298310} 
     
    470482 
    471483 
    472 /* The SMBus locks itself, but ISA access must be locked explicitely!  
    473    There are some ugly typecasts here, but the good new is - they should 
     484/* The SMBus locks itself, but ISA access must be locked explicitly!  
     485   There are some ugly typecasts here, but the good news is - they should 
    474486   nowhere else be necessary! */ 
    475487int sis5595_read_value(struct i2c_client *client, u8 reg) 
     
    484496} 
    485497 
    486 /* The SMBus locks itself, but ISA access muse be locked explicitely!  
    487    There are some ugly typecasts here, but the good new is - they should 
    488    nowhere else be necessary! */ 
    489498int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value) 
    490499{ 
     
    731740 
    732741        if (sis5595_find_sis(&addr)) { 
    733                 normal_isa[0] = SENSORS_ISA_END; 
    734                 printk 
    735                     ("sis5595.o: Warning: No SIS5595 southbridge found!\n"); 
    736         } else 
    737                 normal_isa[0] = addr; 
     742                printk("sis5595.o: SIS5595 not detected, module not inserted.\n"); 
     743                return -ENODEV; 
     744        } 
     745        normal_isa[0] = addr; 
    738746 
    739747        if ((res = i2c_add_driver(&sis5595_driver))) {