2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 05:48:07 +00:00

Reindent Super-I/O and CPU core detection functions.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5475 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare 2008-11-30 14:31:03 +00:00
parent 05db7e0c10
commit 15e40f9e18

View File

@ -2913,7 +2913,8 @@ sub probe_superio
}
print "Success!\n";
printf " (address 0x\%x, driver `%s')\n", $addr, $chip->{driver};
my $new_hash = { conf => 9,
my $new_hash = {
conf => 9,
isa_addr => $addr,
chipname => $chip->{name}
};
@ -2934,9 +2935,7 @@ sub smsc_ns_detect_superio
# read alternate device ID register
outb($addrreg, 0x0d);
$val = inb($datareg);
if ($val == 0x00 || $val == 0xff) {
return 0;
}
return 0 if $val == 0x00 || $val == 0xff;
print "Yes\n";
@ -2959,22 +2958,23 @@ sub scan_superio
printf("Probing for Super-I/O at 0x\%x/0x\%x\n", $addrreg, $datareg);
$| = 1;
# reset state to avoid false positives
# reset state to avoid false positives
exit_superio($addrreg, $datareg);
FAMILY:
foreach my $family (@superio_ids) {
printf("\%-60s", "Trying family `$family->{family}'... ");
# write the password
# write the password
foreach $val (@{$family->{enter}->{$addrreg}}) {
outb($addrreg, $val);
}
# call the non-standard detection routine first if it exists
# 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?
# did it work?
outb($addrreg, $superio{devidreg});
$val = inb($datareg);
outb($addrreg, $superio{devidreg} + 1);
@ -2987,8 +2987,10 @@ sub scan_superio
$found = 0;
foreach my $chip (@{$family->{chips}}) {
if (($chip->{devid} > 0xff && ($val & ($chip->{devid_mask} || 0xffff)) == $chip->{devid})
|| ($chip->{devid} <= 0xff && ($val >> 8) == $chip->{devid})) {
if (($chip->{devid} > 0xff &&
($val & ($chip->{devid_mask} || 0xffff)) == $chip->{devid})
|| ($chip->{devid} <= 0xff &&
($val >> 8) == $chip->{devid})) {
probe_superio($addrreg, $datareg, $chip);
$found++;
}