mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-30 22:05:11 +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:
@@ -2913,7 +2913,8 @@ sub probe_superio
|
|||||||
}
|
}
|
||||||
print "Success!\n";
|
print "Success!\n";
|
||||||
printf " (address 0x\%x, driver `%s')\n", $addr, $chip->{driver};
|
printf " (address 0x\%x, driver `%s')\n", $addr, $chip->{driver};
|
||||||
my $new_hash = { conf => 9,
|
my $new_hash = {
|
||||||
|
conf => 9,
|
||||||
isa_addr => $addr,
|
isa_addr => $addr,
|
||||||
chipname => $chip->{name}
|
chipname => $chip->{name}
|
||||||
};
|
};
|
||||||
@@ -2934,9 +2935,7 @@ sub smsc_ns_detect_superio
|
|||||||
# read alternate device ID register
|
# read alternate device ID register
|
||||||
outb($addrreg, 0x0d);
|
outb($addrreg, 0x0d);
|
||||||
$val = inb($datareg);
|
$val = inb($datareg);
|
||||||
if ($val == 0x00 || $val == 0xff) {
|
return 0 if $val == 0x00 || $val == 0xff;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
print "Yes\n";
|
print "Yes\n";
|
||||||
|
|
||||||
@@ -2959,22 +2958,23 @@ sub scan_superio
|
|||||||
printf("Probing for Super-I/O at 0x\%x/0x\%x\n", $addrreg, $datareg);
|
printf("Probing for Super-I/O at 0x\%x/0x\%x\n", $addrreg, $datareg);
|
||||||
|
|
||||||
$| = 1;
|
$| = 1;
|
||||||
# reset state to avoid false positives
|
# reset state to avoid false positives
|
||||||
exit_superio($addrreg, $datareg);
|
exit_superio($addrreg, $datareg);
|
||||||
FAMILY:
|
FAMILY:
|
||||||
foreach my $family (@superio_ids) {
|
foreach my $family (@superio_ids) {
|
||||||
printf("\%-60s", "Trying family `$family->{family}'... ");
|
printf("\%-60s", "Trying family `$family->{family}'... ");
|
||||||
# write the password
|
# write the password
|
||||||
foreach $val (@{$family->{enter}->{$addrreg}}) {
|
foreach $val (@{$family->{enter}->{$addrreg}}) {
|
||||||
outb($addrreg, $val);
|
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}) &&
|
if (defined($family->{ns_detect}) &&
|
||||||
&{$family->{ns_detect}}($addrreg, $datareg, $family->{ns_chips})) {
|
&{$family->{ns_detect}}($addrreg, $datareg, $family->{ns_chips})) {
|
||||||
exit_superio($addrreg, $datareg);
|
exit_superio($addrreg, $datareg);
|
||||||
last FAMILY;
|
last FAMILY;
|
||||||
}
|
}
|
||||||
# did it work?
|
|
||||||
|
# did it work?
|
||||||
outb($addrreg, $superio{devidreg});
|
outb($addrreg, $superio{devidreg});
|
||||||
$val = inb($datareg);
|
$val = inb($datareg);
|
||||||
outb($addrreg, $superio{devidreg} + 1);
|
outb($addrreg, $superio{devidreg} + 1);
|
||||||
@@ -2987,8 +2987,10 @@ sub scan_superio
|
|||||||
|
|
||||||
$found = 0;
|
$found = 0;
|
||||||
foreach my $chip (@{$family->{chips}}) {
|
foreach my $chip (@{$family->{chips}}) {
|
||||||
if (($chip->{devid} > 0xff && ($val & ($chip->{devid_mask} || 0xffff)) == $chip->{devid})
|
if (($chip->{devid} > 0xff &&
|
||||||
|| ($chip->{devid} <= 0xff && ($val >> 8) == $chip->{devid})) {
|
($val & ($chip->{devid_mask} || 0xffff)) == $chip->{devid})
|
||||||
|
|| ($chip->{devid} <= 0xff &&
|
||||||
|
($val >> 8) == $chip->{devid})) {
|
||||||
probe_superio($addrreg, $datareg, $chip);
|
probe_superio($addrreg, $datareg, $chip);
|
||||||
$found++;
|
$found++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user