2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 13:57:41 +00:00

Move the k8temp detection to a separate subsection.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4211 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2006-10-15 09:30:45 +00:00
parent 2c570ccc6f
commit 2684e287cf

View File

@@ -47,7 +47,7 @@ $ENV{PATH} = '/usr/local/sbin:'.$ENV{PATH}
# CONSTANT DECLARATIONS # # CONSTANT DECLARATIONS #
######################### #########################
use vars qw(@pci_adapters @chip_ids @superio_ids $revision); use vars qw(@pci_adapters @chip_ids @superio_ids @cpu_ids $revision);
$revision = '$Revision$ ($Date$)'; $revision = '$Revision$ ($Date$)';
$revision =~ s/\$\w+: (.*?) \$/$1/g; $revision =~ s/\$\w+: (.*?) \$/$1/g;
@@ -1384,12 +1384,6 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x);
i2c_addrs => [0x2f], i2c_addrs => [0x2f],
i2c_detect => sub { fintek_detect(7, @_); }, i2c_detect => sub { fintek_detect(7, @_); },
}, },
{
name => "AMD K8 thermal sensors",
driver => "k8temp",
isa_addrs => [ 0 ],
isa_detect => sub { k8temp_pci_detect(); },
},
{ {
name => "Philips Semiconductors SAA1064", name => "Philips Semiconductors SAA1064",
driver => "saa1064", driver => "saa1064",
@@ -1840,6 +1834,22 @@ $chip_kern26_w83791d = {
}, },
); );
# Drivers for CPU embedded sensors
# Each entry must have the following fields:
# name: The CPU family name
# driver: The driver name. Put "to-be-written" if no driver is available.
# detect: Detection callback function. No parameter will be passed to
# this function, it must use global lists of PCI devices, CPU,
# etc. It must return a confidence value, undef if no supported
# CPU is found.
@cpu_ids = (
{
name => "AMD K8 thermal sensors",
driver => "k8temp",
detect => sub { k8temp_pci_detect(); },
},
);
####################### #######################
# AUXILIARY FUNCTIONS # # AUXILIARY FUNCTIONS #
####################### #######################
@@ -2699,6 +2709,7 @@ sub add_isa_to_chips_detected
$misdetected_ref = $main_entry->{misdetected}; $misdetected_ref = $main_entry->{misdetected};
for ($i = 0; $i < @{$main_entry->{detected}}; $i++) { for ($i = 0; $i < @{$main_entry->{detected}}; $i++) {
if (exists $detected_ref->[$i]->{isa_addr} and if (exists $detected_ref->[$i]->{isa_addr} and
exists $datahash->{isa_addr} and
$detected_ref->[$i]->{isa_addr} == $datahash->{isa_addr}) { $detected_ref->[$i]->{isa_addr} == $datahash->{isa_addr}) {
if ($detected_ref->[$i]->{conf} >= $datahash->{conf}) { if ($detected_ref->[$i]->{conf} >= $datahash->{conf}) {
push @$new_misdetected_ref, $datahash push @$new_misdetected_ref, $datahash
@@ -3023,6 +3034,26 @@ sub scan_superio
} }
sub scan_cpu($)
{
my $entry = shift;
my $confidence;
printf("\%-60s", "$entry->{name}... ");
if (defined ($confidence = $entry->{detect}())) {
print "Success!\n";
printf " (driver `%s')\n", $entry->{driver};
my $new_hash = {
conf => $confidence,
chipname => $entry->{name},
};
add_isa_to_chips_detected(undef, $entry->{driver}, $new_hash);
} else {
print "No\n";
}
}
################## ##################
# CHIP DETECTION # # CHIP DETECTION #
################## ##################
@@ -5120,18 +5151,18 @@ sub print_chips_report
} }
print ")" print ")"
} }
print "\n"; print "\n ";
} }
if ($is_isa) { if ($is_isa) {
print " " if $is_i2c; print "ISA bus";
if ($data->{isa_addr}) { if ($data->{isa_addr}) {
printf "ISA bus address 0x%04x (Busdriver `i2c-isa')\n", printf ", address 0x%x", $data->{isa_addr};
$data->{isa_addr};
} else {
print "ISA bus, undetermined address (Busdriver `i2c-isa')\n";
} }
print " (Busdriver `i2c-isa')"
unless kernel_version_at_least(2, 6, 18);
print "\n ";
} }
printf " Chip `%s' (confidence: %d)\n", printf "Chip `%s' (confidence: %d)\n",
$data->{chipname}, $data->{conf}; $data->{chipname}, $data->{conf};
} }
} }
@@ -5175,7 +5206,6 @@ sub generate_modprobes
# Collect all adapters used # Collect all adapters used
$nr = 0; $nr = 0;
$isa = 0; $isa = 0;
$modprobes .= "# I2C adapter drivers\n";
foreach $chip (@chips_detected) { foreach $chip (@chips_detected) {
foreach $detection (@{$chip->{detected}}) { foreach $detection (@{$chip->{detected}}) {
# If there is more than one bus detected by a driver, they are # If there is more than one bus detected by a driver, they are
@@ -5198,6 +5228,7 @@ sub generate_modprobes
} }
} }
$modprobes .= "# I2C adapter drivers\n" if $nr;
for ($i = 0; $i < $nr; $i++) { for ($i = 0; $i < $nr; $i++) {
foreach $adap (@adapters) { foreach $adap (@adapters) {
next unless exists $adap->{nr_later} and $adap->{nr_later} == $i; next unless exists $adap->{nr_later} and $adap->{nr_later} == $i;
@@ -5432,6 +5463,15 @@ sub main
} }
print "\n"; print "\n";
print "Some CPU may also contain embedded sensors.\n";
print "Do you want to scan for CPU embedded sensors? (YES/no): ";
unless (<STDIN> =~ /^\s*n/i) {
foreach my $entry (@cpu_ids) {
scan_cpu($entry);
}
}
print "\n";
if(! @chips_detected) { if(! @chips_detected) {
print "Sorry, no sensors were detected.\n", print "Sorry, no sensors were detected.\n",
"Either your sensors are not supported, or they are connected to an\n", "Either your sensors are not supported, or they are connected to an\n",