Changeset 4108

Show
Ignore:
Timestamp:
08/23/06 20:52:46 (7 years ago)
Author:
khali
Message:

sensors-detect: Simplify detection of SiS5595, VIA686 and VT8231.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r4106 r4108  
    6868                          Add Intel ICH8 SMBus detection 
    6969                          Add AMD K8 thermal sensors detection 
     70                          Simplify detection of SiS5595, VIA686 and VT8231 
    7071 
    7172 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r4107 r4108  
    14521452       driver => "sis5595", 
    14531453       isa_addrs => [ 0 ], 
    1454        isa_detect => sub { sis5595_isa_detect(@_); }, 
     1454       isa_detect => sub { sis5595_pci_detect(); }, 
    14551455     }, 
    14561456     { 
     
    14581458       driver => "via686a", 
    14591459       isa_addrs => [ 0 ], 
    1460        isa_detect => sub { via686a_isa_detect(@_); }, 
     1460       isa_detect => sub { via686a_pci_detect(); }, 
    14611461     }, 
    14621462     { 
     
    14641464       driver => "vt8231", 
    14651465       isa_addrs => [ 0 ], 
    1466        isa_detect => sub { via8231_isa_detect(@_); }, 
     1466       isa_detect => sub { via8231_pci_detect(); }, 
    14671467     }, 
    14681468     { 
     
    42844284} 
    42854285 
    4286 # $_[0]: Address 
    4287 # Returns: undef if not detected, (9) if detected. 
    4288 # Note: It is already 99% certain this chip exists if we find the PCI 
    4289 # entry. The exact address is encoded in PCI space. 
    4290 sub sis5595_isa_detect 
    4291 { 
    4292   my ($addr) = @_; 
    4293   my ($key,$adapter,$try,$local_try); 
    4294   my $found = 0; 
    4295   foreach $local_try (@pci_adapters) { 
    4296     if ($local_try->{procid} eq "Silicon Integrated Systems SIS5595") { 
    4297       $try = $local_try; 
    4298       $found = 1; 
    4299       last; 
    4300     } 
    4301   } 
    4302   return if not $found; 
    4303  
    4304   $found = 0; 
    4305   while ( ($key, $adapter) = each %pci_list) { 
    4306     if ((defined($adapter->{vendid}) and  
    4307          $try->{vendid} == $adapter->{vendid} and 
    4308          $try->{devid} == $adapter->{devid} and 
    4309          $try->{func} == $adapter->{func}) or 
    4310         (! defined($adapter->{vendid}) and 
    4311          $adapter->{desc} =~ /$try->{procid}/ and 
    4312          $try->{func} == $adapter->{func})) { 
    4313       $found = 1; 
    4314       last; 
    4315     } 
    4316   } 
    4317   return if not $found; 
    4318  
    4319   return 9; 
    4320 } 
    4321  
    4322 # $_[0]: Address 
    4323 # Returns: undef if not detected, (9) if detected. 
    4324 # Note: It is already 99% certain this chip exists if we find the PCI 
    4325 # entry. The exact address is encoded in PCI space. 
    4326 sub via686a_isa_detect 
    4327 { 
    4328   my ($addr) = @_; 
    4329   my ($key,$adapter,$try,$local_try); 
    4330   my $found = 0; 
    4331   foreach $local_try (@pci_adapters) { 
    4332     if ($local_try->{procid} eq "VIA Technologies VT82C686 Apollo ACPI") { 
    4333       $try = $local_try; 
    4334       $found = 1; 
    4335       last; 
    4336     } 
    4337   } 
    4338   return if not $found; 
    4339  
    4340   $found = 0; 
    4341   while ( ($key, $adapter) = each %pci_list) { 
    4342     if ((defined($adapter->{vendid}) and  
    4343          $try->{vendid} == $adapter->{vendid} and 
    4344          $try->{devid} == $adapter->{devid} and 
    4345          $try->{func} == $adapter->{func}) or 
    4346         (! defined($adapter->{vendid}) and 
    4347          $adapter->{desc} =~ /$try->{procid}/ and 
    4348          $try->{func} == $adapter->{func})) { 
    4349       $found = 1; 
    4350       last; 
    4351     } 
    4352   } 
    4353   return if not $found; 
    4354  
    4355   return 9; 
    4356 } 
    4357  
    4358 # $_[0]: Address 
    4359 # Returns: undef if not detected, (9) if detected. 
    4360 # Note: It is already 99% certain this chip exists if we find the PCI 
    4361 # entry. The exact address is encoded in PCI space. 
    4362 sub via8231_isa_detect 
    4363 { 
    4364   my ($addr) = @_; 
    4365   my ($key,$adapter,$try,$local_try); 
    4366   my $found = 0; 
    4367   foreach $local_try (@pci_adapters) { 
    4368     if ($local_try->{procid} eq "VIA Technologies VT8231 South Bridge") { 
    4369       $try = $local_try; 
    4370       $found = 1; 
    4371       last; 
    4372     } 
    4373   } 
    4374   return if not $found; 
    4375  
    4376   $found = 0; 
    4377   while ( ($key, $adapter) = each %pci_list) { 
    4378     if ((defined($adapter->{vendid}) and  
    4379          $try->{vendid} == $adapter->{vendid} and 
    4380          $try->{devid} == $adapter->{devid} and 
    4381          $try->{func} == $adapter->{func}) or 
    4382         (! defined($adapter->{vendid}) and 
    4383          $adapter->{desc} =~ /$try->{procid}/ and 
    4384          $try->{func} == $adapter->{func})) { 
    4385       $found = 1; 
    4386       last; 
    4387     } 
    4388   } 
    4389   return if not $found; 
    4390  
    4391   return 9; 
    4392 } 
    4393  
    43944286# $_[0]: A reference to the file descriptor to access this chip. 
    43954287# $_[1]: Address (unused) 
     
    50874979  } 
    50884980  return 1; 
     4981} 
     4982 
     4983 
     4984###################### 
     4985# PCI CHIP DETECTION # 
     4986###################### 
     4987 
     4988# Returns: undef if not detected, (7) or (9) if detected. 
     4989# The address is encoded in PCI space. We could decode it and print it. 
     4990# For Linux 2.4 we should probably check for invalid matches (SiS645). 
     4991sub sis5595_pci_detect 
     4992{ 
     4993        return unless exists $pci_list{'1039:0008'}; 
     4994        return (kernel_version_at_least(2, 6, 0) ? 9 : 7); 
     4995} 
     4996 
     4997# Returns: undef if not detected, (9) if detected. 
     4998# The address is encoded in PCI space. We could decode it and print it. 
     4999sub via686a_pci_detect 
     5000{ 
     5001        return unless exists $pci_list{'1106:3057'}; 
     5002        return 9; 
     5003} 
     5004 
     5005# Returns: undef if not detected, (9) if detected. 
     5006# The address is encoded in PCI space. We could decode it and print it. 
     5007sub via8231_pci_detect 
     5008{ 
     5009        return unless exists $pci_list{'1106:8235'}; 
     5010        return 9; 
    50895011} 
    50905012