Changeset 5399

Show
Ignore:
Timestamp:
11/22/08 16:52:52 (5 years ago)
Author:
khali
Message:

Drop support for Linux 2.4.

Location:
lm-sensors/branches/lm-sensors-3.0.0
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/CHANGES

    r5395 r5399  
    1515                  Fix detection of SMSC LPC47M292 
    1616                  Add SMSC LPC47M233 support 
     17                  Drop support for Linux 2.4 (#2325) 
    1718 
    18193.0.3 (2008-09-28) 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/detect/sensors-detect

    r5397 r5399  
    5555# driver (Driver Name) field to "to-be-written". 
    5656# The match (Match Description) field should contain a regular expression 
    57 # matching the adapter name as it would appear in /proc/bus/i2c or /sys. 
     57# matching the adapter name as it would appear in /sys/class/i2c-adapter. 
    5858@pci_adapters = ( 
    5959     { 
     
    546546# routine before we add them to the @pci_adapters list. 
    547547# 
    548 use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); 
     548use vars qw(@pci_adapters_sis5595 @pci_adapters_sis96x); 
    549549@pci_adapters_sis5595 = ( 
    550550     { 
     
    554554       driver => "i2c-sis5595", 
    555555       match => qr/^SMBus SIS5595 adapter at [0-9a-f]{4}/, 
    556      }, 
    557 ); 
    558  
    559 @pci_adapters_sis645 = ( 
    560      { 
    561        vendid => 0x1039, 
    562        devid  => 0x0008, 
    563        procid => "Silicon Integrated Systems SIS5595", 
    564        driver => "i2c-sis645", 
    565        match => qr/^SiS645 SMBus adapter at [0-9a-f]{4}/, 
    566      }, 
    567      { 
    568        vendid => 0x1039, 
    569        devid  => 0x0016, 
    570        procid => "Silicon Integrated Systems SMBus Controller", 
    571        driver => "i2c-sis645", 
    572        match => qr/^SiS645 SMBus adapter at 0x[0-9a-f]{4}/, 
    573      }, 
    574      { 
    575        vendid => 0x1039, 
    576        devid  => 0x0018, 
    577        procid => "Silicon Integrated Systems 85C503/5513 (LPC Bridge)", 
    578        driver => "i2c-sis645", 
    579        match => qr/^SiS645 SMBus adapter at 0x[0-9a-f]{4}/, 
    580556     }, 
    581557); 
     
    785761     }, 
    786762     { 
     763       name => "Analog Devices ADM1024", 
     764       driver => "lm87", 
     765       i2c_addrs => [0x2c..0x2e], 
     766       i2c_detect => sub { adm1024_detect(0, @_); }, 
     767     }, 
     768     { 
    787769       name => "National Semiconductor LM93", 
    788770       driver => "lm93", 
     
    815797     }, 
    816798     { 
     799       name => "Winbond W83791D", 
     800       driver => "w83791d", 
     801       i2c_addrs => [0x2c..0x2f], 
     802       i2c_detect => sub { w83781d_detect(7, @_); }, 
     803     }, 
     804     { 
    817805       name => "Winbond W83792D", 
    818806       driver => "w83792d", 
     
    13061294     }, 
    13071295     { 
     1296       name => "FSC Scylla", 
     1297       driver => "fschmd", 
     1298       i2c_addrs => [0x73], 
     1299       i2c_detect => sub { fscscy_detect(@_); }, 
     1300     }, 
     1301     { 
    13081302       name => "FSC Heimdal", 
    13091303       driver => "fschmd", 
     
    13951389       i2c_detect => sub { smartbatt_detect(@_); }, 
    13961390     }, 
    1397 ); 
    1398  
    1399 # Special case chip information goes here and would be included in 
    1400 # the chip_special_cases routine below 
    1401 use vars qw(@chip_kern24_ids @chip_kern26_ids 
    1402             @chip_oldfsc_ids @chip_fschmd_ids); 
    1403 @chip_kern24_ids = ( 
    1404      { 
    1405        name => "Analog Devices ADM1024", 
    1406        driver => "adm1024", 
    1407        i2c_addrs => [0x2c..0x2e], 
    1408        i2c_detect => sub { adm1024_detect(0, @_); }, 
    1409      }, 
    1410      { 
    1411        name => "Winbond W83791D", 
    1412        driver => "w83781d", 
    1413        i2c_addrs => [0x2c..0x2f], 
    1414        i2c_detect => sub { w83781d_detect(7, @_); }, 
    1415      }, 
    1416      { 
    1417        name => "FSC Scylla", 
    1418        driver => "fscscy", 
    1419        i2c_addrs => [0x73], 
    1420        i2c_detect => sub { fscscy_detect(@_); }, 
    1421      }, 
    1422      { 
    1423        name => "IPMI BMC KCS", 
    1424        driver => "bmcsensors", 
    1425        isa_addrs => [0x0ca0], 
    1426        isa_detect => sub { ipmi_kcs_detect(@_); }, 
    1427      }, 
    1428      { 
    1429        name => "IPMI BMC SMIC", 
    1430        driver => "bmcsensors", 
    1431        isa_addrs => [0x0ca8], 
    1432        isa_detect => sub { ipmi_smic_detect(@_); }, 
    1433      }, 
    1434 ); 
    1435  
    1436 @chip_kern26_ids = ( 
    1437      { 
    1438        name => "Analog Devices ADM1024", 
    1439        driver => "lm87", 
    1440        i2c_addrs => [0x2c..0x2e], 
    1441        i2c_detect => sub { adm1024_detect(0, @_); }, 
    1442      }, 
    1443      { 
    1444        name => "Winbond W83791D", 
    1445        driver => "w83791d", 
    1446        i2c_addrs => [0x2c..0x2f], 
    1447        i2c_detect => sub { w83781d_detect(7, @_); }, 
    1448      }, 
    1449      { 
    1450        name => "FSC Scylla", 
    1451        driver => "fschmd", 
    1452        i2c_addrs => [0x73], 
    1453        i2c_detect => sub { fscscy_detect(@_); }, 
    1454      }, 
    14551391     { 
    14561392       name => "IPMI BMC KCS", 
     
    14661402     }, 
    14671403); 
     1404 
     1405# Special case chip information goes here and would be included in 
     1406# the chip_special_cases routine below 
     1407use vars qw(@chip_oldfsc_ids @chip_fschmd_ids); 
    14681408 
    14691409# sigh special case for old seperate FSC drivers to new merged one mapping 
     
    23072247################# 
    23082248 
    2309 use vars qw($modules_conf $dev_i2c $sysfs_root); 
     2249use vars qw($dev_i2c $sysfs_root); 
    23102250 
    23112251sub initialize_conf 
     
    23242264  } 
    23252265  close(INPUTFILE); 
     2266 
     2267  # We need sysfs for many things 
     2268  if (!defined $sysfs_root) { 
     2269      print "Sysfs not mounted?\n"; 
     2270      exit -1; 
     2271  } 
    23262272 
    23272273  my $use_udev = 0; 
     
    23462292      $dev_i2c = '/dev/i2c-'; 
    23472293    } 
    2348   } 
    2349  
    2350   if (kernel_version_at_least(2, 6, 0)) { 
    2351     $modules_conf = '/etc/modprobe.conf'; 
    2352   } else { 
    2353     $modules_conf = '/etc/modules.conf'; 
    23542294  } 
    23552295 
     
    23822322  @kernel_version = ($1, $2, $3, $4); 
    23832323  chomp($kernel_arch = `uname -m`); 
     2324 
     2325  # We only support kernels >= 2.6.0 
     2326  if (!kernel_version_at_least(2, 6, 0)) { 
     2327      print "Kernel version is unsupported (too old, >= 2.6.0 needed)\n"; 
     2328      exit -1; 
     2329  } 
    23842330} 
    23852331 
     
    24272373# @i2c_adapters is a list of references to hashes, one hash per I2C/SMBus 
    24282374# adapter present on the system. Each entry has the following keys: name 
    2429 # (directly taken from either /proc/bus/i2c or /sys/class/i2c-adapter) and 
    2430 # driver. 
     2375# (directly taken from /sys/class/i2c-adapter) and driver. 
    24312376use vars qw(@i2c_adapters); 
    24322377 
     
    24362381  local $_; 
    24372382 
    2438   if (defined $sysfs_root) { 
    2439     my $class_dir = "${sysfs_root}/class/i2c-adapter"; 
    2440     opendir(local *ADAPTERS, $class_dir) or return; 
    2441  
    2442     while (defined($_ = readdir(ADAPTERS))) { 
    2443       next unless m/^i2c-(\d+)$/; 
    2444       $entry = {}; # New entry 
    2445       $entry->{'name'} = sysfs_device_attribute("${class_dir}/i2c-$1", "name") 
    2446                       || sysfs_device_attribute("${class_dir}/i2c-$1/device", "name"); 
    2447       next if $entry->{'name'} eq "ISA main adapter"; 
    2448       $entry->{'driver'} = find_adapter_driver($entry->{'name'}); 
    2449       $i2c_adapters[$1] = $entry; 
    2450     } 
    2451     closedir(ADAPTERS); 
    2452   } else { 
    2453     open(local *INPUTFILE, "/proc/bus/i2c") or return; 
    2454  
    2455     while (<INPUTFILE>) { 
    2456       my ($nr, $type, $name) = /^i2c-(\d+)\s+(\S+)\s+(.*?) *(\t|$)/; 
    2457       next if ($type eq "dummy" || $type eq "isa"); 
    2458       $entry = {}; # New entry 
    2459       $entry->{'name'} = $name; 
    2460       $entry->{'driver'} = find_adapter_driver($name); 
    2461       $i2c_adapters[$nr] = $entry; 
    2462     } 
    2463     close(INPUTFILE); 
    2464   } 
     2383  my $class_dir = "${sysfs_root}/class/i2c-adapter"; 
     2384  opendir(local *ADAPTERS, $class_dir) or return; 
     2385 
     2386  while (defined($_ = readdir(ADAPTERS))) { 
     2387    next unless m/^i2c-(\d+)$/; 
     2388    $entry = {}; # New entry 
     2389    $entry->{'name'} = sysfs_device_attribute("${class_dir}/i2c-$1", "name") 
     2390                    || sysfs_device_attribute("${class_dir}/i2c-$1/device", "name"); 
     2391    next if $entry->{'name'} eq "ISA main adapter"; 
     2392    $entry->{'driver'} = find_adapter_driver($entry->{'name'}); 
     2393    $i2c_adapters[$1] = $entry; 
     2394  } 
     2395  closedir(ADAPTERS); 
    24652396} 
    24662397 
     
    25272458# computer; 'vendid' and 'devid' uniquely identify a type of device. 
    25282459# 'class' lets us spot unknown SMBus adapters. 
    2529 # This function is used when sysfs is available (Linux 2.6). 
    25302460sub read_sys_dev_pci($) 
    25312461{ 
     
    25572487} 
    25582488 
    2559 # This function returns a list of hashes. Each hash has some PCI information: 
    2560 # 'bus', 'slot' and 'func' uniquely identify a PCI device in a computer; 
    2561 # 'vendid' and 'devid' uniquely identify a type of device. 
    2562 # This function is used when sysfs is not available (Linux 2.4). 
    2563 sub read_proc_dev_pci 
    2564 { 
    2565   my ($dfn, $vend, @pci_list); 
    2566   open(local *INPUTFILE, "/proc/bus/pci/devices") 
    2567     or die "/proc/bus/pci/devices: $!"; 
    2568   local $_; 
    2569   while (<INPUTFILE>) { 
    2570     my %record; 
    2571     ($dfn, $vend) = map { hex } (split) [0..1]; 
    2572     $record{bus} = $dfn >> 8; 
    2573     $record{slot} = ($dfn & 0xf8) >> 3; 
    2574     $record{func} = $dfn & 0x07; 
    2575     $record{vendid} = $vend >> 16; 
    2576     $record{devid} = $vend & 0xffff; 
    2577  
    2578     push @pci_list, \%record; 
    2579   } 
    2580   return \@pci_list; 
    2581 } 
    2582  
    2583 sub initialize_proc_pci 
     2489sub initialize_pci 
    25842490{ 
    25852491  my $pci_list; 
    25862492 
    2587   if (defined $sysfs_root) { 
    2588     $pci_list = read_sys_dev_pci("$sysfs_root/bus/pci/devices"); 
    2589   } else { 
    2590     $pci_list = read_proc_dev_pci(); 
    2591   } 
     2493  $pci_list = read_sys_dev_pci("$sysfs_root/bus/pci/devices"); 
    25922494 
    25932495  # Note that we lose duplicate devices at this point, but we don't 
     
    26082510 
    26092511  # first, determine which driver if any... 
    2610   if (kernel_version_at_least(2, 6, 0)) { 
    2611     if (exists $pci_list{"1039:0016"}) { 
    2612       $driver = "i2c-sis96x"; 
    2613     } elsif (exists $pci_list{"1039:0008"}) { 
    2614       $driver = "i2c-sis5595"; 
    2615     } 
    2616   } elsif (kernel_version_at_least(2, 4, 0)) { 
    2617     if (exists $pci_list{"1039:0008"}) { 
    2618       if ((exists $pci_list{"1039:0645"}) || 
    2619           (exists $pci_list{"1039:0646"}) || 
    2620           (exists $pci_list{"1039:0648"}) || 
    2621           (exists $pci_list{"1039:0650"}) || 
    2622           (exists $pci_list{"1039:0651"}) || 
    2623           (exists $pci_list{"1039:0655"}) || 
    2624           (exists $pci_list{"1039:0661"}) || 
    2625           (exists $pci_list{"1039:0735"}) || 
    2626           (exists $pci_list{"1039:0745"}) || 
    2627           (exists $pci_list{"1039:0746"})) { 
    2628         $driver = "i2c-sis645"; 
    2629       } else { 
    2630         $driver = "i2c-sis5595"; 
    2631       } 
    2632     } elsif ((exists $pci_list{"1039:0016"}) || 
    2633              (exists $pci_list{"1039:0018"})) { 
    2634       $driver = "i2c-sis645"; 
    2635     } 
     2512  if (exists $pci_list{"1039:0016"}) { 
     2513    $driver = "i2c-sis96x"; 
     2514  } elsif (exists $pci_list{"1039:0008"}) { 
     2515    $driver = "i2c-sis5595"; 
    26362516  } 
    26372517 
     
    26392519  if ($driver eq "i2c-sis5595") { 
    26402520    push @pci_adapters, @pci_adapters_sis5595; 
    2641   } elsif ($driver eq "i2c-sis645") { 
    2642     push @pci_adapters, @pci_adapters_sis645; 
    26432521  } elsif ($driver eq "i2c-sis96x") { 
    26442522    push @pci_adapters, @pci_adapters_sis96x; 
     
    27162594} 
    27172595 
    2718 # $_[0]: Adapter description as found in /proc/bus/i2c or sysfs 
     2596# $_[0]: Adapter description as found in /sys/class/i2c-adapter 
    27192597sub find_adapter_driver 
    27202598{ 
     
    29332811# A hash 
    29342812#   with field 'i2c_adap' containing an adapter string as appearing 
    2935 #        in /proc/bus/i2c (if this is an I2C detection) 
     2813#        in /sys/class/i2c-adapter (if this is an I2C detection) 
    29362814#  with field 'i2c_devnr', contianing the /dev/i2c-* number of this 
    29372815#       adapter (if this is an I2C detection) 
     
    31783056 
    31793057# $_[0]: The number of the adapter to scan 
    3180 # $_[1]: The name of the adapter, as appearing in /proc/bus/i2c 
     3058# $_[1]: The name of the adapter, as appearing in /sys/class/i2c-adapter 
    31813059# $_[2]: The driver of the adapter 
    31823060# @_[3]: Addresses not to scan (array reference) 
     
    32193097 
    32203098    if (!i2c_set_slave_addr(\*FILE, $addr)) { 
    3221       # If the address is busy, in Linux 2.6 we can find out which driver 
    3222       # is using it, and we assume it is the right one. In Linux 2.4 we 
    3223       # just give up and warn the user. 
     3099      # If the address is busy, we can normally find out which driver 
     3100      # is using it, and we assume it is the right one. 
    32243101      my ($device, $driver); 
    3225       if (defined($sysfs_root)) { 
    3226         $device = sprintf("$sysfs_root/bus/i2c/devices/\%d-\%04x", 
     3102 
     3103      $device = sprintf("$sysfs_root/bus/i2c/devices/\%d-\%04x", 
    32273104                             $adapter_nr, $addr); 
    3228         $driver = sysfs_device_driver($device); 
    3229       } 
     3105      $driver = sysfs_device_driver($device); 
     3106 
    32303107      if (defined($driver)) { 
    32313108        $new_hash = { 
     
    35743451                push @chip_ids, @chip_oldfsc_ids; 
    35753452        } 
    3576  
    3577         if (kernel_version_at_least(2, 6, 0)) { 
    3578                 push @chip_ids, @chip_kern26_ids; 
    3579         } else { 
    3580                 push @chip_ids, @chip_kern24_ids; 
    3581         } 
    35823453} 
    35833454 
     
    56125483###################### 
    56135484 
    5614 # Returns: undef if not detected, (7) or (9) if detected. 
     5485# Returns: undef if not detected, (9) if detected. 
    56155486# The address is encoded in PCI space. We could decode it and print it. 
    5616 # For Linux 2.4 we should probably check for invalid matches (SiS645). 
    56175487sub sis5595_pci_detect 
    56185488{ 
    56195489        return unless exists $pci_list{'1039:0008'}; 
    5620         return (kernel_version_at_least(2, 6, 0) ? 9 : 7); 
     5490        return 9; 
    56215491} 
    56225492 
     
    57935663  if ($ipmi) { 
    57945664    $modprobes .= "# You must also install and load the IPMI modules\n"; 
    5795     if (kernel_version_at_least(2, 6, 0)) { 
    5796       $modprobes .= "modprobe ipmi-si\n"; 
    5797     } else { 
    5798       $modprobes .= "modprobe i2c-ipmi\n"; 
    5799     } 
     5665    $modprobes .= "modprobe ipmi-si\n"; 
    58005666  } 
    58015667 
     
    58075673      $modprobes .= "# no driver for $chip->{detected}[0]{chipname} yet\n"; 
    58085674    } else { 
    5809        # need the * for 2.4 kernels, won't necessarily be an exact match 
    5810        open(local *INPUTFILE, "modprobe -l $chip->{driver}\\* 2>/dev/null |"); 
     5675       open(local *INPUTFILE, "modprobe -l $chip->{driver} 2>/dev/null |"); 
    58115676       local $_; 
    58125677       my $modulefound = 0; 
     
    58855750  initialize_kernel_version(); 
    58865751  initialize_conf(); 
    5887   initialize_proc_pci(); 
     5752  initialize_pci(); 
    58885753  initialize_modules_list(); 
    58895754  # make sure any special case chips are added to the chip_ids list before 
     
    58995764        "and recommended to accept the default answers to all questions,\n", 
    59005765        "unless you know what you're doing.\n"; 
    5901   print "You need to have i2c and lm_sensors installed before running this\n", 
    5902         "program.\n" 
    5903     unless kernel_version_at_least(2, 6, 0); 
    59045766  print "\n"; 
    59055767 
     
    59365798  initialize_i2c_adapters_list(); 
    59375799 
    5938   if (!exists($modules_list{"i2c-dev"}) 
    5939    && !(defined $sysfs_root && -e "$sysfs_root/class/i2c-dev")) { 
     5800  if (! -e "$sysfs_root/class/i2c-dev") { 
    59405801    print "To continue, we need module `i2c-dev' to be loaded.\n"; 
    5941     print "If it is built-in into your kernel, you can safely skip this.\n" 
    5942       unless kernel_version_at_least(2, 6, 0); 
    59435802    print "Do you want to load `i2c-dev' now? (YES/no): "; 
    59445803    if (<STDIN> =~ /^\s*n/i) { 
     
    60845943    } else { 
    60855944      print "To make the sensors modules behave correctly, add these lines to\n". 
    6086             "$modules_conf:\n\n"; 
     5945            "/etc/modprobe.conf:\n\n"; 
    60875946      print "#----cut here----\n". 
    60885947            $configfile.