2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-29 13:28:01 +00:00

More efficient Super I/O detection. Should reduce the I/O ports

hammering a lot.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2416 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare 2004-04-06 19:14:45 +00:00
parent b81fc46380
commit d3e51c2084

View File

@ -1319,191 +1319,178 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
# The function should take three parameters: The ISA address, the # The function should take three parameters: The ISA address, the
# I2C bus number, and the I2C address. # I2C bus number, and the I2C address.
@superio_ids = ( @superio_ids = (
{
enter => [0x87, 0x01, 0x55, 0x55],
chips =>
[
{ {
name => "ITE 8702F Super IO Sensors", name => "ITE 8702F Super IO Sensors",
driver => "to-be-written", driver => "to-be-written",
enter => [0x87, 0x01, 0x55, 0x55],
devid => 0x8702, devid => 0x8702,
logdev => 0x04, logdev => 0x04,
}, },
{ {
name => "ITE 8705F Super IO Sensors", name => "ITE 8705F Super IO Sensors",
driver => "it87", driver => "it87",
enter => [0x87, 0x01, 0x55, 0x55],
devid => 0x8705, devid => 0x8705,
logdev => 0x04, logdev => 0x04,
}, },
{ {
name => "ITE 8712F Super IO Sensors", name => "ITE 8712F Super IO Sensors",
driver => "it87", driver => "it87",
enter => [0x87, 0x01, 0x55, 0x55],
devid => 0x8712, devid => 0x8712,
logdev => 0x04, logdev => 0x04,
}, },
],
},
{
enter => [],
chips =>
[
{ {
name => "Nat. Semi. PC87351 Super IO Fan Sensors", name => "Nat. Semi. PC87351 Super IO Fan Sensors",
driver => "to-be-written", driver => "to-be-written",
enter => [],
devid => 0xe2, devid => 0xe2,
logdev => 0x08, logdev => 0x08,
}, },
{ {
name => "Nat. Semi. PC87360 Super IO Fan Sensors", name => "Nat. Semi. PC87360 Super IO Fan Sensors",
driver => "pc87360-fan", driver => "pc87360-fan",
enter => [],
devid => 0xe1, devid => 0xe1,
logdev => 0x09, logdev => 0x09,
}, },
{ {
name => "Nat. Semi. PC87363 Super IO Fan Sensors", name => "Nat. Semi. PC87363 Super IO Fan Sensors",
driver => "pc87360-fan", driver => "pc87360-fan",
enter => [],
devid => 0xe8, devid => 0xe8,
logdev => 0x09, logdev => 0x09,
}, },
{ {
name => "Nat. Semi. PC87364 Super IO Fan Sensors", name => "Nat. Semi. PC87364 Super IO Fan Sensors",
driver => "pc87360-fan", driver => "pc87360-fan",
enter => [],
devid => 0xe4, devid => 0xe4,
logdev => 0x09, logdev => 0x09,
}, },
{ {
name => "Nat. Semi. PC87365 Super IO Sensors", name => "Nat. Semi. PC87365 Super IO Sensors",
driver => "to-be-written", driver => "to-be-written",
enter => [],
devid => 0xe5, devid => 0xe5,
logdev => 0x09, # fans; voltages at 0x0d; temps at 0x0e logdev => 0x09, # fans; voltages at 0x0d; temps at 0x0e
}, },
{ {
name => "Nat. Semi. PC87366 Super IO Sensors", name => "Nat. Semi. PC87366 Super IO Sensors",
driver => "to-be-written", driver => "to-be-written",
enter => [],
devid => 0xe9, devid => 0xe9,
logdev => 0x09, # fans; voltages at 0x0d; temps at 0x0e logdev => 0x09, # fans; voltages at 0x0d; temps at 0x0e
}, },
{ {
name => "Nat. Semi. PC87372 Super IO Fan Sensors", name => "Nat. Semi. PC87372 Super IO Fan Sensors",
driver => "to-be-written", driver => "to-be-written",
enter => [],
devid => 0xf0, devid => 0xf0,
logdev => 0x09, logdev => 0x09,
}, },
{ {
name => "Nat. Semi. PC8741x Super IO", name => "Nat. Semi. PC8741x Super IO",
driver => "not-a-sensor", driver => "not-a-sensor",
enter => [],
devid => 0xee, devid => 0xee,
}, },
],
},
{
enter => [0x55],
exit => [0xaa],
chips =>
[
{ {
name => "SMSC 47B27x Super IO Fan Sensors", name => "SMSC 47B27x Super IO Fan Sensors",
driver => "smsc47m1", driver => "smsc47m1",
enter => [0x55],
devid => 0x51, devid => 0x51,
logdev => 0x0a, logdev => 0x0a,
exit => [0xaa],
}, },
{ {
name => "SMSC 47M10x/13x Super IO Fan Sensors", name => "SMSC 47M10x/13x Super IO Fan Sensors",
driver => "smsc47m1", driver => "smsc47m1",
enter => [0x55],
devid => 0x59, devid => 0x59,
logdev => 0x0a, logdev => 0x0a,
exit => [0xaa],
}, },
{ {
name => "SMSC 47M14x Super IO Fan Sensors", name => "SMSC 47M14x Super IO Fan Sensors",
driver => "smsc47m1", driver => "smsc47m1",
enter => [0x55],
devid => 0x5f, devid => 0x5f,
logdev => 0x0a, logdev => 0x0a,
exit => [0xaa],
}, },
{ {
name => "SMSC 47M15x/192 Super IO Fan Sensors", name => "SMSC 47M15x/192 Super IO Fan Sensors",
driver => "to-be-written", driver => "to-be-written",
enter => [0x55],
devid => 0x60, devid => 0x60,
logdev => 0x0a, logdev => 0x0a,
exit => [0xaa],
}, },
{ {
name => "SMSC 47S42x Super IO Fan Sensors", name => "SMSC 47S42x Super IO Fan Sensors",
driver => "to-be-written", driver => "to-be-written",
enter => [0x55],
devid => 0x57, devid => 0x57,
logdev => 0x0a, logdev => 0x0a,
exit => [0xaa],
}, },
{ {
name => "SMSC 47S45x Super IO Fan Sensors", name => "SMSC 47S45x Super IO Fan Sensors",
driver => "to-be-written", driver => "to-be-written",
enter => [0x55],
devid => 0x62, devid => 0x62,
logdev => 0x0a, logdev => 0x0a,
exit => [0xaa],
}, },
{ {
name => "SMSC 47M172 Super IO", name => "SMSC 47M172 Super IO",
driver => "not-a-sensor", driver => "not-a-sensor",
enter => [0x55],
devid => 0x14, devid => 0x14,
exit => [0xaa],
}, },
],
},
{
enter => [0x87, 0x87],
exit => [0xaa],
chips =>
[
{ {
name => "VT1211 Super IO Sensors", name => "VT1211 Super IO Sensors",
driver => "vt1211", driver => "vt1211",
enter => [0x87, 0x87],
devid => 0x3c, devid => 0x3c,
logdev => 0x0b, logdev => 0x0b,
exit => [0xaa],
}, },
{ {
name => "Winbond W83627HF Super IO Sensors", name => "Winbond W83627HF Super IO Sensors",
driver => "w83627hf", driver => "w83627hf",
enter => [0x87, 0x87],
devid => 0x52, devid => 0x52,
logdev => 0x0b, logdev => 0x0b,
exit => [0xaa],
}, },
{ {
name => "Winbond W83627THF Super IO Sensors", name => "Winbond W83627THF Super IO Sensors",
driver => "w83627hf", driver => "w83627hf",
enter => [0x87, 0x87],
devid => 0x82, devid => 0x82,
logdev => 0x0b, logdev => 0x0b,
exit => [0xaa],
}, },
{ {
name => "Winbond W83637HF Super IO Sensors", name => "Winbond W83637HF Super IO Sensors",
driver => "w83627hf", driver => "w83627hf",
enter => [0x87, 0x87],
devid => 0x70, devid => 0x70,
logdev => 0x0b, logdev => 0x0b,
exit => [0xaa],
}, },
{ {
name => "Winbond W83697HF Super IO Sensors", name => "Winbond W83697HF Super IO Sensors",
driver => "w83627hf", driver => "w83627hf",
enter => [0x87, 0x87],
devid => 0x60, devid => 0x60,
logdev => 0x0b, logdev => 0x0b,
exit => [0xaa],
}, },
{ {
name => "Winbond W83697SF/UF Super IO PWM", name => "Winbond W83697SF/UF Super IO PWM",
driver => "to-be-written", driver => "to-be-written",
enter => [0x87, 0x87],
devid => 0x68, devid => 0x68,
logdev => 0x0b, logdev => 0x0b,
exit => [0xaa],
}, },
{ {
name => "Winbond W83L517D Super IO", name => "Winbond W83L517D Super IO",
driver => "not-a-sensor", driver => "not-a-sensor",
enter => [0x87, 0x87],
devid => 0x61, devid => 0x61,
exit => [0xaa], },
],
}, },
); );
@ -2418,11 +2405,11 @@ sub scan_isa_bus
sub exit_superio sub exit_superio
{ {
my ($addrreg, $datareg, $chip, $success) = @_; my ($addrreg, $datareg, $family, $success) = @_;
# If detection succeeded and an exit sequence exists, use it # If detection succeeded and an exit sequence exists, use it
if ($success && defined ($$chip{exit})) { if ($success && defined ($$family{exit})) {
foreach my $byte (@{$$chip{exit}}) { foreach my $byte (@{$$family{exit}}) {
outb($addrreg, $byte); outb($addrreg, $byte);
} }
return; return;
@ -2443,7 +2430,7 @@ sub exit_superio
sub scan_superio sub scan_superio
{ {
my ($addrreg, $datareg) = @_; my ($addrreg, $datareg) = @_;
my ($chip,$val,$addr,$conf); my ($val, $addr);
my %superio = ( my %superio = (
devidreg => 0x20, devidreg => 0x20,
@ -2453,25 +2440,34 @@ sub scan_superio
basereg => 0x60, basereg => 0x60,
); );
foreach $chip (@superio_ids) { FAMILY:
print "Probing for `$$chip{name}'\n"; foreach my $family (@superio_ids) {
# write the password # write the password
foreach $val (@{$$chip{enter}}) { foreach $val (@{$$family{enter}}) {
outb($addrreg, $val); outb($addrreg, $val);
} }
foreach my $chip (@{$$family{chips}}) {
print "Probing for `$$chip{name}'\n";
# check the device ID # check the device ID
outb($addrreg, $superio{devidreg}); outb($addrreg, $superio{devidreg});
$val = inb($datareg); $val = inb($datareg);
if($$chip{devid}>0xff) { if ($val == 0x00 || $val == 0xff) {
print " Failed! (skipping family)\n";
exit_superio($addrreg, $datareg, $family, 0);
next FAMILY;
}
if ($$chip{devid}>0xff) {
outb($addrreg, $superio{devidreg} + 1); outb($addrreg, $superio{devidreg} + 1);
$val = ($val << 8) | inb($datareg); $val = ($val << 8) | inb($datareg);
} }
if($val == $$chip{devid}) { if ($val != $$chip{devid}) {
printf " Failed! (0x%02x)\n", $val;
next;
}
print " Success..."; print " Success...";
# does it have hardware monitoring capabilities # does it have hardware monitoring capabilities
if($$chip{driver} eq "not-a-sensor") { if($$chip{driver} eq "not-a-sensor") {
print " (no hardware monitoring capabilities)\n"; print " (no hardware monitoring capabilities)\n";
exit_superio($addrreg, $datareg, $chip, 1);
next; next;
} }
# switch to the sensor logical device # switch to the sensor logical device
@ -2482,7 +2478,6 @@ sub scan_superio
$val = inb($datareg); $val = inb($datareg);
if(!($val & $superio{actmask})) { if(!($val & $superio{actmask})) {
print " but not activated\n"; print " but not activated\n";
exit_superio($addrreg, $datareg, $chip, 1);
next; next;
} }
# Get the IO base register # Get the IO base register
@ -2492,7 +2487,6 @@ sub scan_superio
$addr = ($addr << 8) | inb($datareg); $addr = ($addr << 8) | inb($datareg);
if($addr == 0) { if($addr == 0) {
print " but no address specified\n"; print " but no address specified\n";
exit_superio($addrreg, $datareg, $chip, 1);
next; next;
} }
printf " found at address 0x%04x\n", $addr; printf " found at address 0x%04x\n", $addr;
@ -2502,15 +2496,8 @@ sub scan_superio
}; };
add_isa_to_chips_detected $$chip{alias_detect},$$chip{driver}, add_isa_to_chips_detected $$chip{alias_detect},$$chip{driver},
$new_hash; $new_hash;
exit_superio($addrreg, $datareg, $chip, 1);
} else {
if($val == 0xff || $val == 0xffff || $val == 0) {
print " Failed!\n";
} else {
printf " Failed! (0x%02x)\n", $val;
}
exit_superio($addrreg, $datareg, $chip, 0);
} }
exit_superio($addrreg, $datareg, $family, 1);
} }
} }