| 2904 | | my ($addrreg, $datareg, $family, $success) = @_; |
| 2905 | | |
| 2906 | | # If detection succeeded and an exit sequence exists, use it |
| 2907 | | if ($success && defined ($family->{exit})) { |
| 2908 | | foreach my $byte (@{$family->{exit}}) { |
| 2909 | | outb($addrreg, $byte); |
| 2910 | | } |
| 2911 | | return; |
| 2912 | | } |
| 2913 | | |
| 2914 | | # Else return to "Wait For Key" state (PNP-ISA spec) |
| | 2906 | my ($addrreg, $datareg) = @_; |
| | 2907 | |
| | 2908 | # Some chips (SMSC, Winbond) want this |
| | 2909 | outb($addrreg, 0xaa); |
| | 2910 | |
| | 2911 | # Return to "Wait For Key" state (PNP-ISA spec) |
| | 2914 | } |
| | 2915 | |
| | 2916 | sub probe_superio($$$) |
| | 2917 | { |
| | 2918 | my ($addrreg, $datareg, $chip) = @_; |
| | 2919 | my ($val, $addr); |
| | 2920 | |
| | 2921 | printf "\%-60s", "Found `$chip->{name}'"; |
| | 2922 | |
| | 2923 | # Does it have hardware monitoring capabilities? |
| | 2924 | if (!exists $chip->{driver}) { |
| | 2925 | print "\n (no information available)\n"; |
| | 2926 | return; |
| | 2927 | } |
| | 2928 | if ($chip->{driver} eq "not-a-sensor") { |
| | 2929 | print "\n (no hardware monitoring capabilities)\n"; |
| | 2930 | return; |
| | 2931 | } |
| | 2932 | |
| | 2933 | # Switch to the sensor logical device |
| | 2934 | outb($addrreg, $superio{logdevreg}); |
| | 2935 | outb($datareg, $chip->{logdev}); |
| | 2936 | |
| | 2937 | # Check the activation register |
| | 2938 | outb($addrreg, $superio{actreg}); |
| | 2939 | $val = inb($datareg); |
| | 2940 | if (!($val & $superio{actmask})) { |
| | 2941 | print "\n (but not activated)\n"; |
| | 2942 | return; |
| | 2943 | } |
| | 2944 | |
| | 2945 | # Get the IO base register |
| | 2946 | outb($addrreg, $superio{basereg}); |
| | 2947 | $addr = inb($datareg); |
| | 2948 | outb($addrreg, $superio{basereg} + 1); |
| | 2949 | $addr = ($addr << 8) | inb($datareg); |
| | 2950 | if ($addr == 0) { |
| | 2951 | print "\n (but no address specified)\n"; |
| | 2952 | return; |
| | 2953 | } |
| | 2954 | print "Success!\n"; |
| | 2955 | printf " (address 0x\%x, driver `%s')\n", $addr, $chip->{driver}; |
| | 2956 | my $new_hash = { conf => 9, |
| | 2957 | isa_addr => $addr, |
| | 2958 | chipname => $chip->{name} |
| | 2959 | }; |
| | 2960 | add_isa_to_chips_detected $chip->{alias_detect},$chip->{driver}, |
| | 2961 | $new_hash; |
| 2948 | | $name = $chip->{name}; |
| 2949 | | $name =~ s/ Super IO//; |
| 2950 | | printf("\%-60s", sprintf("Probing for `\%s'... ", $name)); |
| 2951 | | # check the device ID |
| 2952 | | outb($addrreg, $superio{devidreg}); |
| 2953 | | $val = inb($datareg); |
| 2954 | | if ($val == 0x00 || $val == 0xff) { |
| 2955 | | print "No\n"; |
| 2956 | | exit_superio($addrreg, $datareg, $family, 0); |
| 2957 | | next FAMILY; |
| | 2998 | if (($chip->{devid} > 0xff && ($val & ($chip->{devid_mask} || 0xffff)) == $chip->{devid}) |
| | 2999 | || ($chip->{devid} <= 0xff && ($val >> 8) == $chip->{devid})) { |
| | 3000 | probe_superio($addrreg, $datareg, $chip); |
| | 3001 | $found++; |
| 2959 | | if ($chip->{devid}>0xff) { |
| 2960 | | outb($addrreg, $superio{devidreg} + 1); |
| 2961 | | $val = ($val << 8) | inb($datareg); |
| 2962 | | } |
| 2963 | | if (($val & ($chip->{devid_mask} || 0xffff)) != $chip->{devid}) { |
| 2964 | | printf "No (0x%0*x)\n", $chip->{devid}>0xff ? 4 : 2, $val; |
| 2965 | | next; |
| 2966 | | } |
| 2967 | | print "Success!\n"; |
| 2968 | | # does it have hardware monitoring capabilities |
| 2969 | | if (!exists $chip->{driver}) { |
| 2970 | | print " (no information available)\n"; |
| 2971 | | next; |
| 2972 | | } |
| 2973 | | if($chip->{driver} eq "not-a-sensor") { |
| 2974 | | print " (no hardware monitoring capabilities)\n"; |
| 2975 | | next; |
| 2976 | | } |
| 2977 | | # switch to the sensor logical device |
| 2978 | | outb($addrreg, $superio{logdevreg}); |
| 2979 | | outb($datareg, $chip->{logdev}); |
| 2980 | | # check the activation register |
| 2981 | | outb($addrreg, $superio{actreg}); |
| 2982 | | $val = inb($datareg); |
| 2983 | | if(!($val & $superio{actmask})) { |
| 2984 | | print " (but not activated)\n"; |
| 2985 | | next; |
| 2986 | | } |
| 2987 | | # Get the IO base register |
| 2988 | | outb($addrreg, $superio{basereg}); |
| 2989 | | $addr = inb($datareg); |
| 2990 | | outb($addrreg, $superio{basereg} + 1); |
| 2991 | | $addr = ($addr << 8) | inb($datareg); |
| 2992 | | if($addr == 0) { |
| 2993 | | print " (but no address specified)\n"; |
| 2994 | | next; |
| 2995 | | } |
| 2996 | | printf " (address 0x\%x, driver `%s')\n", $addr, $chip->{driver}; |
| 2997 | | my $new_hash = { conf => 9, |
| 2998 | | isa_addr => $addr, |
| 2999 | | chipname => $chip->{name} |
| 3000 | | }; |
| 3001 | | add_isa_to_chips_detected $chip->{alias_detect},$chip->{driver}, |
| 3002 | | $new_hash; |
| 5210 | | $modprobes .= "# Warning: the required module $chip->{driver} is not currently installed on your system.\n"; |
| 5211 | | $modprobes .= "# For status of 2.6 kernel ports see http://www.lm-sensors.org/wiki/SupportedDevices\n"; |
| 5212 | | $modprobes .= "# If driver is built-in to the kernel, or unavailable, comment out the following line.\n"; |
| | 5213 | $modprobes .= "# Warning: the required module $chip->{driver} is not currently installed on\n". |
| | 5214 | "# your system. For status of 2.6 kernel ports see\n". |
| | 5215 | "# http://www.lm-sensors.org/wiki/SupportedDevices and\n". |
| | 5216 | "# http://www.lm-sensors.org/wiki/SupportedDevices. If driver is built\n". |
| | 5217 | "# into the kernel, or unavailable, comment out the following line.\n"; |