Changeset 5695 for i2c-tools/trunk/eeprom/decode-dimms
- Timestamp:
- 03/20/09 15:10:53 (4 years ago)
- Files:
-
- 1 modified
-
i2c-tools/trunk/eeprom/decode-dimms (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
i2c-tools/trunk/eeprom/decode-dimms
r5694 r5695 42 42 use Fcntl qw(:DEFAULT :seek); 43 43 use vars qw($opt_html $opt_bodyonly $opt_igncheck $use_sysfs $use_hexdump 44 @vendors %decode_callback $revision @dimm _list%hexdump_cache);44 @vendors %decode_callback $revision @dimm %hexdump_cache); 45 45 46 46 use constant LITTLEENDIAN => "little-endian"; … … 1595 1595 } 1596 1596 1597 push @dimm _list, $_if $use_hexdump;1597 push @dimm, { file => $_ } if $use_hexdump; 1598 1598 } 1599 1599 … … 1628 1628 next if $use_sysfs && $file !~ /^\d+-[\da-f]+$/i; 1629 1629 next if !$use_sysfs && $file !~ /^eeprom-/; 1630 push @files, "$dir/$file";1630 push @files, { file => "$dir/$file" }; 1631 1631 } 1632 1632 close(DIR); 1633 return sort @files;1633 return sort { $a->{file} cmp $b->{file} } @files; 1634 1634 } elsif (! -d '/sys/module/eeprom') { 1635 1635 print "No EEPROM found, are you sure the eeprom module is loaded?\n"; … … 1638 1638 } 1639 1639 1640 @dimm_list = get_dimm_list() unless $use_hexdump; 1641 1642 for my $i (0 .. $#dimm_list) { 1643 my @bytes = readspd(0, 128, $dimm_list[$i]); 1640 # @dimm is a list of hashes. There's one hash for each EEPROM we found. 1641 # Each hash has the following keys: 1642 # * file: Full path to the eeprom data file 1643 # Keys are added over time. 1644 @dimm = get_dimm_list() unless $use_hexdump; 1645 1646 for my $i (0 .. $#dimm) { 1647 my @bytes = readspd(0, 128, $dimm[$i]->{file}); 1644 1648 my $is_rambus = $bytes[0] < 4; # Simple heuristic 1645 1649 my ($label, $chk_valid, $chk_spd, $chk_calc); … … 1656 1660 1657 1661 print "<b><u>" if $opt_html; 1658 printl2("\n\nDecoding EEPROM", $dimm _list[$i]);1662 printl2("\n\nDecoding EEPROM", $dimm[$i]->{file}); 1659 1663 print "</u></b>" if $opt_html; 1660 1664 print "<table border=1>\n" if $opt_html; 1661 1665 if (!$use_hexdump) { 1662 if ($dimm _list[$i]=~ /-([\da-f]+)$/i) {1666 if ($dimm[$i]->{file} =~ /-([\da-f]+)$/i) { 1663 1667 my $dimm_num = hex($1) - 0x50 + 1; 1664 1668 if ($dimm_num >= 1 && $dimm_num <= 8) { … … 1693 1697 push (@bytes, 1694 1698 readspd(@bytes, $spd_used - @bytes, 1695 $dimm _list[$i]));1699 $dimm[$i]->{file})); 1696 1700 } 1697 1701 }
