Changeset 5541 for i2c-tools/trunk

Show
Ignore:
Timestamp:
12/08/08 18:42:11 (3 years ago)
Author:
khali
Message:

Pass all EEPROM bytes to decoding functions, saving the need to
splice the bytes array.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • i2c-tools/trunk/eeprom/decode-dimms

    r5540 r5541  
    10671067); 
    10681068 
    1069 # Parameter: bytes 64-127 
     1069# Parameter: EEPROM bytes 0-127 (using 64-98) 
    10701070sub decode_manufacturing_information($) 
    10711071{ 
     
    10791079        # 7 extra bytes from the Manufacturer field. Sometimes 
    10801080        # these bytes are filled with interesting data. 
    1081         ($temp, $extra) = manufacturer(@{$bytes}[0..7]); 
     1081        ($temp, $extra) = manufacturer(@{$bytes}[64..71]); 
    10821082        printl $l, $temp; 
    10831083        $l = "Custom Manufacturer Data"; 
     
    10851085        printl $l, $temp if defined $temp; 
    10861086 
    1087         if (spd_written($bytes->[8])) { 
     1087        if (spd_written($bytes->[72])) { 
    10881088                # Try the location code as ASCII first, as earlier specifications 
    10891089                # suggested this. As newer specifications don't mention it anymore, 
    10901090                # we still fall back to binary. 
    10911091                $l = "Manufacturing Location Code"; 
    1092                 $temp = (chr($bytes->[8]) =~ m/^[\w\d]$/) ? chr($bytes->[8]) 
    1093                       : sprintf("0x%.2X", $bytes->[8]); 
     1092                $temp = (chr($bytes->[72]) =~ m/^[\w\d]$/) ? chr($bytes->[72]) 
     1093                      : sprintf("0x%.2X", $bytes->[72]); 
    10941094                printl $l, $temp; 
    10951095        } 
    10961096 
    10971097        $l = "Part Number"; 
    1098         $temp = part_number(@{$bytes}[9..26]); 
     1098        $temp = part_number(@{$bytes}[73..90]); 
    10991099        printl $l, $temp; 
    11001100 
    1101         if (spd_written(@{$bytes}[27..28])) { 
     1101        if (spd_written(@{$bytes}[91..92])) { 
    11021102                $l = "Revision Code"; 
    1103                 $temp = sprintf("0x%02X%02X\n", @{$bytes}[27..28]); 
     1103                $temp = sprintf("0x%02X%02X\n", @{$bytes}[91..92]); 
    11041104                printl $l, $temp; 
    11051105        } 
    11061106 
    1107         if (spd_written(@{$bytes}[29..30])) { 
     1107        if (spd_written(@{$bytes}[93..94])) { 
    11081108                $l = "Manufacturing Date"; 
    11091109                # In theory the year and week are in BCD format, but 
    11101110                # this is not always true in practice :( 
    1111                 if (($bytes->[29] & 0xf0) <= 0x90 
    1112                  && ($bytes->[29] & 0x0f) <= 0x09 
    1113                  && ($bytes->[30] & 0xf0) <= 0x90 
    1114                  && ($bytes->[30] & 0x0f) <= 0x09) { 
     1111                if (($bytes->[93] & 0xf0) <= 0x90 
     1112                 && ($bytes->[93] & 0x0f) <= 0x09 
     1113                 && ($bytes->[94] & 0xf0) <= 0x90 
     1114                 && ($bytes->[94] & 0x0f) <= 0x09) { 
    11151115                        # Note that this heuristic will break in year 2080 
    11161116                        $temp = sprintf("%d%02X-W%02X\n", 
    1117                                         $bytes->[29] >= 0x80 ? 19 : 20, 
    1118                                         @{$bytes}[29..30]); 
     1117                                        $bytes->[93] >= 0x80 ? 19 : 20, 
     1118                                        @{$bytes}[93..94]); 
    11191119                } else { 
    11201120                        $temp = sprintf("0x%02X%02X\n", 
    1121                                         @{$bytes}[29..30]); 
     1121                                        @{$bytes}[93..94]); 
    11221122                } 
    11231123                printl $l, $temp; 
    11241124        } 
    11251125 
    1126         if (spd_written(@{$bytes}[31..34])) { 
     1126        if (spd_written(@{$bytes}[95..98])) { 
    11271127                $l = "Assembly Serial Number"; 
    11281128                $temp = sprintf("0x%02X%02X%02X%02X\n", 
    1129                                 @{$bytes}[31..34]); 
     1129                                @{$bytes}[95..98]); 
    11301130                printl $l, $temp; 
    11311131        } 
    11321132} 
    11331133 
    1134 # Parameter: bytes 64-127 
     1134# Parameter: EEPROM bytes 0-127 (using 126-127) 
    11351135sub decode_intel_spec_freq($) 
    11361136{ 
     
    11411141 
    11421142        $l = "Frequency"; 
    1143         if ($bytes->[62] == 0x66) { $temp = "66MHz\n"; } 
    1144         elsif ($bytes->[62] == 100) { $temp = "100MHz or 133MHz\n"; } 
    1145         elsif ($bytes->[62] == 133) { $temp = "133MHz\n"; } 
     1143        if ($bytes->[126] == 0x66) { $temp = "66MHz\n"; } 
     1144        elsif ($bytes->[126] == 100) { $temp = "100MHz or 133MHz\n"; } 
     1145        elsif ($bytes->[126] == 133) { $temp = "133MHz\n"; } 
    11461146        else { $temp = "Undefined!\n"; } 
    11471147        printl $l, $temp; 
     
    11491149        $l = "Details for 100MHz Support"; 
    11501150        $temp = ""; 
    1151         if ($bytes->[63] & 1) { $temp .= "Intel Concurrent Auto-precharge\n"; } 
    1152         if ($bytes->[63] & 2) { $temp .= "CAS Latency = 2\n"; } 
    1153         if ($bytes->[63] & 4) { $temp .= "CAS Latency = 3\n"; } 
    1154         if ($bytes->[63] & 8) { $temp .= "Junction Temp A (100 degrees C)\n"; } 
     1151        if ($bytes->[127] & 1) { $temp .= "Intel Concurrent Auto-precharge\n"; } 
     1152        if ($bytes->[127] & 2) { $temp .= "CAS Latency = 2\n"; } 
     1153        if ($bytes->[127] & 4) { $temp .= "CAS Latency = 3\n"; } 
     1154        if ($bytes->[127] & 8) { $temp .= "Junction Temp A (100 degrees C)\n"; } 
    11551155        else { $temp .= "Junction Temp B (90 degrees C)\n"; } 
    1156         if ($bytes->[63] & 16) { $temp .= "CLK 3 Connected\n"; } 
    1157         if ($bytes->[63] & 32) { $temp .= "CLK 2 Connected\n"; } 
    1158         if ($bytes->[63] & 64) { $temp .= "CLK 1 Connected\n"; } 
    1159         if ($bytes->[63] & 128) { $temp .= "CLK 0 Connected\n"; } 
    1160         if (($bytes->[63] & 192) == 192) { $temp .= "Double-sided DIMM\n"; } 
    1161         elsif (($bytes->[63] & 192) != 0) { $temp .= "Single-sided DIMM\n"; } 
     1156        if ($bytes->[127] & 16) { $temp .= "CLK 3 Connected\n"; } 
     1157        if ($bytes->[127] & 32) { $temp .= "CLK 2 Connected\n"; } 
     1158        if ($bytes->[127] & 64) { $temp .= "CLK 1 Connected\n"; } 
     1159        if ($bytes->[127] & 128) { $temp .= "CLK 0 Connected\n"; } 
     1160        if (($bytes->[127] & 192) == 192) { $temp .= "Double-sided DIMM\n"; } 
     1161        elsif (($bytes->[127] & 192) != 0) { $temp .= "Single-sided DIMM\n"; } 
    11621162        printl $l, $temp; 
    11631163} 
     
    14081408 
    14091409# Decode next 35 bytes (64-98, common to all memory types) 
    1410                 splice(@bytes, 0, 64); 
    14111410                decode_manufacturing_information(\@bytes); 
    14121411