From 97eda71243fbcc1e9698d7d23b1a0240ea39fa13 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 19:00:08 +0000 Subject: [PATCH] Add detection for non-standard SMSC Super-I/Os. Patch from Juerg Haefliger. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4468 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 68 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/CHANGES b/CHANGES index 718d5213..d9535ba6 100644 --- a/CHANGES +++ b/CHANGES @@ -45,6 +45,7 @@ SVN HEAD Add Maxim MAX6680/MAX6681 detection Add IT8726F detection Fix IPMI support for 2.6 kernels + Add detection for non-standard SMSC Super-I/Os 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index e17ee22c..bc2f6fcf 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1832,6 +1832,38 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); devid => 0x77, }, ], + # Non-standard SMSC detection callback and chip list. These chips differ + # from the standard ones listed above in that the device ID register + # address is 0x0d instead of 0x20 (as specified by the ISA PNP spec). + ns_detect => \&smsc_ns_detect_superio, + ns_chips => + [ + { + name => "SMSC FDC37C665 Super IO", + driver => "not-a-sensor", + devid => 0x65, + }, + { + name => "SMSC FDC37C666 Super IO", + driver => "not-a-sensor", + devid => 0x66, + }, + { + name => "SMSC FDC37C669 Super IO", + driver => "not-a-sensor", + devid => 0x03, + }, + { + name => "SMSC FDC37N769 Super IO", + driver => "not-a-sensor", + devid => 0x28, + }, + { + name => "SMSC LPC47N227 Super IO", + driver => "not-a-sensor", + devid => 0x5a, + }, + ], }, { family => "VIA/Winbond/Fintek", @@ -3190,6 +3222,36 @@ sub probe_superio($$$) $new_hash; } +# Detection routine for non-standard SMSC Super I/O chips +# $_[0]: Super I/O LPC config/index port +# $_[1]: Super I/O LPC data port +# $_[2]: Reference to array of non-standard chips +# Return values: 1 if non-standard chip found, 0 otherwise +sub smsc_ns_detect_superio +{ + my ($addrreg, $datareg, $ns_chips) = @_; + my ($val, $chip); + + # read alternate device ID register + outb($addrreg, 0x0d); + $val = inb($datareg); + if ($val == 0x00 || $val == 0xff) { + return 0; + } + + print "Yes\n"; + + foreach $chip (@{$ns_chips}) { + if ($chip->{devid} == $val) { + probe_superio($addrreg, $datareg, $chip); + return 1; + } + } + + printf("Found unknown non-standard chip with ID 0x%02x\n", $val); + return 1; +} + sub scan_superio { my ($addrreg, $datareg) = @_; @@ -3207,6 +3269,12 @@ sub scan_superio foreach $val (@{$family->{enter}->{$addrreg}}) { outb($addrreg, $val); } +# call the non-standard detection routine first if it exists + if (defined($family->{ns_detect}) && + &{$family->{ns_detect}}($addrreg, $datareg, $family->{ns_chips})) { + exit_superio($addrreg, $datareg); + last FAMILY; + } # did it work? outb($addrreg, $superio{devidreg}); $val = inb($datareg);