2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-03 15:55:15 +00:00

add Super I/O chip detection. Current chips supported are

smsc47m1xx, vt1211, w83627hf, w83697hf.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1668 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker
2002-12-09 03:01:23 +00:00
parent 1d0d09cc26
commit 18c7ce9011
2 changed files with 181 additions and 1 deletions

View File

@@ -17,6 +17,12 @@ ask CVS about it:
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
2.7.1 (2003????)
File sensors.conf.eg: Fix vt1211/vt8231 thermistor calculations
Library: Add support for exponents and logarithms for vt1211/vt8235
Program sensors-detect: Add super i/o detection (smsc47m1, vt1211,
w83627hf, w83697hf)
2.7.0 (20021208) 2.7.0 (20021208)
NOTE: Requires i2c-2.7.0 or newer. NOTE: Requires i2c-2.7.0 or newer.
File doc/busses/i2c-ali1535: Add license, miscellaneous changes File doc/busses/i2c-ali1535: Add license, miscellaneous changes

View File

@@ -35,7 +35,7 @@ use POSIX;
# CONSTANT DECLARATIONS # # CONSTANT DECLARATIONS #
######################### #########################
use vars qw(@pci_adapters @chip_ids @undetectable_adapters @dmidecode); use vars qw(@pci_adapters @chip_ids @superio_ids @undetectable_adapters @dmidecode);
@dmidecode = ( '/usr/local/sbin/dmidecode', '/usr/sbin/dmidecode' ); @dmidecode = ( '/usr/local/sbin/dmidecode', '/usr/sbin/dmidecode' );
@@ -1049,6 +1049,111 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
}, },
); );
# This is a list of all recognized superio chips.
# Each entry must have the following fields:
# name: The full chip name
# driver: The driver name (without .o extension). Put in something like
# "Unwritten: <drivername>" if it is not yet available.
# addrreg: The address register
# datareg: The data register
# enter: The password sequence to write to the address register
# devidreg: The device ID register(s)
# devid: The device ID(s) we have to match (base device)
# logdevreg: The logical device register
# logdev: The logical device containing the sensors
# actreg (optional): The activation register within the logical device
# actmask (optional): The activation bit in the activation register
# basereg: The I/O base register within the logical device
# exitreg: The register to write the exit value to
# exit: The value to write to the exit register to exit
# alias_detect (optional): For chips which can be both on the ISA and the
# I2C bus, a function which detectes whether two entries are the same.
# The function should take three parameters: The ISA address, the
# I2C bus number, and the I2C address.
@superio_ids = (
# {
# name => "ITE 8705 Super IO Sensors",
# driver => "it87",
# addrreg => 0x2e,
# datareg => 0x2f,
# enter => [0x55, 0x01, 0x55, 0x55].
# code doesn't handle multiple devid regs yet
# devidreg => [0x20, 0x21],
# devid => [0x87, 0x05],
# logdevreg => 0x07,
# logdev => 0x04,
# actreg => 0x30,
# actmask => 0x01,
# basereg => 0x60,
# exit is writing 0x01 to reg 0x02. - not compatible with other superio chips
# exitreg => 0x02,
# exit => 0x01,
# },
{
name => "SMSC 47M1xx Super IO Fan Sensors",
driver => "smsc47m1",
addrreg => 0x2e,
exitreg => 0x2e,
datareg => 0x2f,
enter => [0x55],
devidreg => 0x20,
devid => 0x59,
logdevreg => 0x07,
logdev => 0x0a,
actreg => 0x20,
actmask => 0x01,
basereg => 0x60,
exit => 0xaa,
},
{
name => "VT1211 Super IO Sensors",
driver => "vt1211",
addrreg => 0x2e,
exitreg => 0x2e,
datareg => 0x2f,
enter => [0x87, 0x87],
devidreg => 0x20,
devid => 0x3c,
logdevreg => 0x07,
logdev => 0x0b,
actreg => 0x30,
actmask => 0x01,
basereg => 0x60,
exit => 0xaa,
},
{
name => "Winbond W83627HF Super IO Sensors",
driver => "w83781d",
addrreg => 0x2e,
exitreg => 0x2e,
datareg => 0x2f,
enter => [0x87, 0x87],
devidreg => 0x20,
devid => 0x52,
logdevreg => 0x07,
logdev => 0x0b,
actreg => 0x30,
actmask => 0x01,
basereg => 0x60,
exit => 0xaa,
},
{
name => "Winbond W83697HF Super IO Sensors",
driver => "w83781d",
addrreg => 0x2e,
exitreg => 0x2e,
datareg => 0x2f,
enter => [0x87, 0x87],
devidreg => 0x20,
devid => 0x60,
logdevreg => 0x07,
logdev => 0x0b,
actreg => 0x30,
actmask => 0x01,
basereg => 0x60,
exit => 0xaa,
},
);
####################### #######################
# AUXILIARY FUNCTIONS # # AUXILIARY FUNCTIONS #
@@ -1867,6 +1972,57 @@ sub scan_isa_bus
} }
} }
sub scan_superio
{
my ($chip,$val,$addr,$conf);
foreach $chip (@superio_ids) {
print "Probing for `$$chip{name}'\n";
# write the password
foreach $val (@{$$chip{enter}}) {
outb($$chip{addrreg}, $val);
}
# check the device ID
outb($$chip{addrreg}, $$chip{devidreg});
$val = inb($$chip{datareg});
if($val == $$chip{devid}) {
print " Success...";
# switch to the sensor logical device
outb($$chip{addrreg}, $$chip{logdevreg});
outb($$chip{datareg}, $$chip{logdev});
# check the activation register
if(exists $$chip{actreg}) {
outb($$chip{addrreg}, $$chip{actreg});
$val = inb($$chip{datareg});
if(!($val & $$chip{actmask})) {
print " but not activated, module may not find\n";
outb($$chip{exitreg}, $$chip{exit});
next;
}
}
# Get the IO base register
outb($$chip{addrreg}, $$chip{basereg});
$addr = inb($$chip{datareg});
outb($$chip{addrreg}, $$chip{basereg} + 1);
$addr = ($addr << 8) | inb($$chip{datareg});
if($addr == 0) {
print " but not activated, module may not find\n";
outb($$chip{addrreg}, $$chip{exit});
next;
}
printf " found at address 0x%04x\n", $addr;
my $new_hash = { conf => 8,
isa_addr => $addr,
chipname => $$chip{name}
};
add_isa_to_chips_detected $$chip{alias_detect},$$chip{driver},
$new_hash;
} else {
print " Failed!\n";
}
outb($$chip{exitreg}, $$chip{exit});
}
}
################## ##################
# CHIP DETECTION # # CHIP DETECTION #
@@ -3221,6 +3377,21 @@ sub main
} }
} }
print "\n Some Super I/O chips may also contain sensors. Super I/O probes ",
"are\n",
" typically a bit more dangerous, as we have to write to I/O ports ",
"to do\n",
" this. ";
if ($> != 0) {
print "As you are not root, we shall skip this step.\n";
} else {
print " Do you want to scan for Super I/O sensors? (YES/no): ";
if (not <STDIN> =~ /^\s*[Nn]/) {
initialize_ioports or die "Sorry, can't access /dev/port ($!)?!?";
scan_superio;
}
}
if(! @chips_detected) { if(! @chips_detected) {
print "\n Sorry, no chips were detected.\n", print "\n Sorry, no chips were detected.\n",
" Either your sensors are not supported, or they are\n", " Either your sensors are not supported, or they are\n",
@@ -3281,6 +3452,9 @@ sub main
"file:\n\n"; "file:\n\n";
print "#----cut here----\n"; print "#----cut here----\n";
print $modprobes; print $modprobes;
print "# Next 2 lines are optional\n",
"sleep 3\n",
"sensors -s\n";
print "#----cut here----\n"; print "#----cut here----\n";
print "\nTo make the sensors modules behave correctly, add these lines to ", print "\nTo make the sensors modules behave correctly, add these lines to ",
"either\n", "either\n",