From cbb496e1340e7613c479872a68cea846ae4f234a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Nov 2008 15:50:00 +0000 Subject: [PATCH] Refactor IPMI detection functions. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5419 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 4892db11..d8611aa8 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1330,13 +1330,13 @@ use vars qw(@i2c_adapter_names); name => "IPMI BMC KCS", driver => "ipmisensors", isa_addrs => [0x0ca0], - isa_detect => sub { ipmi_kcs_detect(@_); }, + isa_detect => sub { ipmi_detect(@_); }, }, { name => "IPMI BMC SMIC", driver => "ipmisensors", isa_addrs => [0x0ca8], - isa_detect => sub { ipmi_smic_detect(@_); }, + isa_detect => sub { ipmi_detect(@_); }, }, ); @@ -5211,18 +5211,13 @@ sub w83781d_isa_detect return 8; } -# These are simple detectors that only look for a register at the -# standard location. +# We simply look for a register at standard locations. # For KCS, use the STATUS register. For SMIC, use the FLAGS register. -sub ipmi_kcs_detect +# Incidentally they live at the same offset. +sub ipmi_detect { - return if inb(0x0ca3) == 0xff; - return 4; -} - -sub ipmi_smic_detect -{ - return if inb(0x0cab) == 0xff; + my ($addr) = @_; + return if inb($addr + 3) == 0xff; return 4; }