Changeset 4143

Show
Ignore:
Timestamp:
09/05/06 13:35:51 (7 years ago)
Author:
khali
Message:

sensors-detect: Add generic PCI SMBus adapter detection.
The detection is based of the PCI device class (SMBus is 0x0c05).
This will let us spot new adapters. Of course we can't load or even
suggest a driver for an unknown adapter, but at least the user will
know there's something to be investigated, and this should help us
when users report such configurations.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r4142 r4143  
    8383                          Remove detection of nVidia graphics adapters 
    8484                          Use sysfs for PCI device enumeration 
     85                          Add generic PCI SMBus adapter detection 
    8586 
    8687 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r4142 r4143  
    22092209} 
    22102210 
     2211# Build and return a PCI device's bus ID 
     2212sub pci_busid($) 
     2213{ 
     2214  my $device = shift; 
     2215  my $busid; 
     2216 
     2217  $busid = sprintf("\%02x:\%02x.\%x", 
     2218                   $device->{bus}, $device->{slot}, $device->{func}); 
     2219  $busid = sprintf("\%04x:", $device->{domain}) . $busid 
     2220    if defined $device->{domain}; 
     2221 
     2222  return $busid; 
     2223} 
     2224 
    22112225sub adapter_pci_detection 
    22122226{ 
    2213   my ($key,$device,$try,@res); 
     2227  my ($key, $device, $try, @res, %smbus); 
    22142228  print "Probing for PCI bus adapters...\n"; 
    22152229 
     
    22172231  adapter_pci_detection_sis_96x(); 
    22182232 
    2219   # Generic detection loop 
     2233  # Build a list of detected SMBus devices 
     2234  foreach $key (keys %pci_list) { 
     2235    $device = $pci_list{$key}; 
     2236    $smbus{$key}++ 
     2237      if exists $device->{class} && $device->{class} == 0x0c05; # SMBus 
     2238  } 
     2239 
     2240  # Loop over the known I2C/SMBus adapters 
    22202241  foreach $try (@pci_adapters) { 
    22212242    $key = sprintf("%04x:%04x", $try->{vendid}, $try->{devid}); 
     
    22232244        $device = $pci_list{$key}; 
    22242245        printf "Use driver `\%s' for device \%s: \%s\n", 
    2225                $try->{driver}, 
    2226                (defined $device->{domain} ? 
    2227                 sprintf("\%04x:\%02x:\%02x.\%x", $device->{domain}, 
    2228                         $device->{bus}, $device->{slot}, $device->{func}) : 
    2229                 sprintf("\%02x:\%02x.\%x", 
    2230                         $device->{bus}, $device->{slot}, $device->{func})), 
    2231                $try->{procid}; 
     2246               $try->{driver}, pci_busid($device), $try->{procid}; 
    22322247        if ($try->{driver} eq "to-be-tested") { 
    22332248          print "\nWe are currently looking for testers for this adapter!\n". 
     
    22392254        } 
    22402255        push @res,$try->{driver}; 
     2256 
     2257        # Delete from detected SMBus device list 
     2258        delete $smbus{$key}; 
    22412259    } 
    22422260  } 
     2261 
     2262  # Now see if there are unknown SMBus devices left 
     2263  foreach $key (keys %smbus) { 
     2264    $device = $pci_list{$key}; 
     2265    printf "Found unknown SMBus adapter \%04x:\%04x at \%s.\n", 
     2266           $device->{vendid}, $device->{devid}, pci_busid($device); 
     2267  } 
     2268   
    22432269  if (! @res) { 
    2244     print ("Sorry, no PCI bus adapters found.\n"); 
    2245   } else { 
    2246     printf ("Probe successfully concluded.\n"); 
     2270    print "Sorry, no known PCI bus adapters found.\n"; 
    22472271  } 
    22482272  return @res;