Changeset 4144

Show
Ignore:
Timestamp:
09/05/06 14:09:30 (7 years ago)
Author:
khali
Message:

sensors-detect: Add generic Super-I/O logical device detection.
For families where it makes sense (ITE, Winbond, Fintek), when we have
an unknown Super-I/O, we scan all logical devices in search of one
with the typical address for hardware monitoring (0x290). If we find
it, we let the user know there are probably sensors in the chip.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r4143 r4144  
    8484                          Use sysfs for PCI device enumeration 
    8585                          Add generic PCI SMBus adapter detection 
     86                          Add generic Super-I/O logical device detection 
    8687 
    8788 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r4143 r4144  
    14721472#      capabilities (listing such chips here removes the need of manual 
    14731473#      lookup when people report them). 
    1474 #  enter: The password sequence to write to the address register 
    14751474#  devid: The device ID(s) we have to match (base device) 
    14761475#  devid_mask (optional): Bitmask to apply before checking the device ID 
    14771476#  logdev: The logical device containing the sensors 
    1478 #  exit (optional): Sequence to write to the address register to exit config 
    1479 #      mode. If not provided, a default reset operation is performed. 
    14801477#  alias_detect (optional): For chips which can be both on the ISA and the 
    14811478#      I2C bus, a function which detectes whether two entries are the same. 
    14821479#      The function should take three parameters: The ISA address, the 
    14831480#      I2C bus number, and the I2C address. 
     1481# Entries are grouped by family. Each family entry has the following fields: 
     1482#  family: The family name 
     1483#  guess (optional): Typical logical device address. This lets us do 
     1484#      generic probing if we fail to recognize the chip. 
     1485#  enter: The password sequence to write to the address register 
     1486#  chips: Array of chips 
    14841487@superio_ids = ( 
    14851488  { 
    14861489    family => "ITE", 
     1490    guess => 0x290, 
    14871491    enter => 
    14881492    { 
     
    17171721  { 
    17181722    family => "VIA/Winbond/Fintek", 
     1723    guess => 0x290, 
    17191724    enter => 
    17201725    { 
     
    28322837} 
    28332838 
     2839# Guess if an unknown Super-I/O chip has sensors 
     2840sub guess_superio_ld($$$) 
     2841{ 
     2842  my ($addrreg, $datareg, $typical_addr) = @_; 
     2843  my ($oldldn, $ldn, $addr); 
     2844 
     2845  # Save logical device number 
     2846  outb($addrreg, $superio{logdevreg}); 
     2847  $oldldn = inb($datareg); 
     2848 
     2849  for ($ldn = 0; $ldn < 16; $ldn++) { 
     2850    # Select logical device 
     2851    outb($addrreg, $superio{logdevreg}); 
     2852    outb($datareg, $ldn); 
     2853 
     2854    # Read base I/O address 
     2855    outb($addrreg, $superio{basereg}); 
     2856    $addr = inb($datareg) << 8; 
     2857    outb($addrreg, $superio{basereg} + 1); 
     2858    $addr |= inb($datareg); 
     2859    next unless ($addr & 0xfff8) == $typical_addr; 
     2860 
     2861    printf "    (logical device \%X has address 0x\%x, could be sensors)\n", 
     2862           $ldn, $addr; 
     2863    last; 
     2864  } 
     2865 
     2866  # Be nice, restore original logical device 
     2867  outb($addrreg, $superio{logdevreg}); 
     2868  outb($datareg, $oldldn); 
     2869} 
     2870 
    28342871sub probe_superio($$$) 
    28352872{ 
     
    29212958    } 
    29222959 
    2923     printf("  Found unknown chip with ID 0x%04x\n", $val) 
    2924         unless $found; 
     2960    if (!$found) { 
     2961      printf("Found unknown chip with ID 0x%04x\n", $val); 
     2962      # Guess if a logical device could correspond to sensors 
     2963      guess_superio_ld($addrreg, $datareg, $family->{guess}) 
     2964        if defined $family->{guess}; 
     2965    } 
     2966 
    29252967    exit_superio($addrreg, $datareg); 
    29262968  }