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

Undid outb() fix by Jim Morris.

Fixed faulty outb() calls.
        Armored outb() against future faulty calls.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1783 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare 2003-06-11 08:28:55 +00:00
parent 2c31ea166c
commit 0b7a7b9787

View File

@ -1330,7 +1330,15 @@ sub inb
# Returns: -1 on failure, 0 on success. # Returns: -1 on failure, 0 on success.
sub outb sub outb
{ {
my $towrite = pack("C", $_[1] & 0x7f); if ($_[1] > 0xff)
{
my ($package, $filename, $line, $sub) = caller(1);
print "\n*** Called outb with value=$_[1] from line $line\n",
"*** (in $sub). PLEASE REPORT!\n",
"*** Terminating.\n";
exit(-1);
}
my $towrite = pack "C", $_[1];
sysseek IOPORTS, $_[0], 0 or return -1; sysseek IOPORTS, $_[0], 0 or return -1;
my $nrchars = syswrite IOPORTS, $towrite, 1; my $nrchars = syswrite IOPORTS, $towrite, 1;
return -1 if not defined $nrchars or $nrchars != 1; return -1 if not defined $nrchars or $nrchars != 1;
@ -2186,7 +2194,7 @@ sub lm78_isa_detect
inb ($addr + 7) != $val; inb ($addr + 7) != $val;
$val = inb($addr + 5) & 0x7f; $val = inb($addr + 5) & 0x7f;
outb($addr+5,~ $val); outb($addr + 5, ~$val & 0xff);
if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) { if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) {
outb($addr+5,$val); outb($addr+5,$val);
return; return;
@ -2402,7 +2410,7 @@ sub w83781d_isa_detect
inb ($addr + 7) != $val; inb ($addr + 7) != $val;
$val = inb($addr + 5) & 0x7f; $val = inb($addr + 5) & 0x7f;
outb($addr+5,~ $val); outb($addr+5, ~$val & 0xff);
if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) { if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) {
outb($addr+5,$val); outb($addr+5,$val);
return; return;
@ -2757,7 +2765,7 @@ sub ite_isa_detect
inb ($addr + 7) != $val; inb ($addr + 7) != $val;
$val = inb($addr + 5) & 0x7f; $val = inb($addr + 5) & 0x7f;
outb($addr+5,~ $val); outb($addr+5, ~$val & 0xff);
if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) { if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) {
outb($addr+5,$val); outb($addr+5,$val);
return; return;