Browse Source

Refactor manufacturing data decoding.

git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5553 7894878c-1315-0410-8ee3-d5d059ff63e0
tags/v3.0.3
Jean Delvare 17 years ago
parent
commit
49b3d934ee
  1. 55
      eeprom/decode-dimms

55
eeprom/decode-dimms

@ -1285,6 +1285,25 @@ sub manufacture_date($$)
} }
} }
sub printl_mfg_location_code($)
{
my $code = shift;
my $letter = chr($code);
return unless spd_written($code);
# Try the location code as ASCII first, as earlier specifications
# suggested this. As newer specifications don't mention it anymore,
# we still fall back to binary.
printl("Manufacturing Location Code",
$letter =~ m/^[\w\d]$/ ? $letter : sprintf("0x%.2X", $code));
}
sub printl_mfg_assembly_serial(@)
{
return unless spd_written(@_);
printl("Assembly Serial Number", sprintf("0x%02X%02X%02X%02X\n", @_));
}
# Parameter: EEPROM bytes 0-175 (using 117-149) # Parameter: EEPROM bytes 0-175 (using 117-149)
sub decode_ddr3_mfg_data($) sub decode_ddr3_mfg_data($)
{ {
@ -1301,30 +1320,17 @@ sub decode_ddr3_mfg_data($)
manufacturer_ddr3($bytes->[148], $bytes->[149]); manufacturer_ddr3($bytes->[148], $bytes->[149]);
} }
if (spd_written($bytes->[119])) {
$l = "Manufacturing Location Code";
my $temp = (chr($bytes->[119]) =~ m/^[\w\d]$/) ? chr($bytes->[119])
: sprintf("0x%.2X", $bytes->[119]);
printl $l, $temp;
}
printl_mfg_location_code($bytes->[119]);
if (spd_written(@{$bytes}[120..121])) { if (spd_written(@{$bytes}[120..121])) {
$l = "Manufacturing Date"; $l = "Manufacturing Date";
printl $l, manufacture_date($bytes->[120], $bytes->[121]); printl $l, manufacture_date($bytes->[120], $bytes->[121]);
} }
if (spd_written(@{$bytes}[122..125])) {
$l = "Assembly Serial Number";
$temp = sprintf("0x%02X%02X%02X%02X\n", $bytes->[122], $bytes->[123],
$bytes->[124], $bytes->[125]);
printl $l, $temp;
}
printl_mfg_assembly_serial(@{$bytes}[122..125]);
$l = "Part Number"; $l = "Part Number";
$temp = "";
for (my $i = 128; $i <= 145; $i++) {
$temp .= chr($bytes->[$i]);
};
$temp = part_number(@{$bytes}[128..145]);
printl $l, $temp; printl $l, $temp;
if (spd_written(@{$bytes}[146..147])) { if (spd_written(@{$bytes}[146..147])) {
@ -1352,15 +1358,7 @@ sub decode_manufacturing_information($)
$temp = manufacturer_data(@{$extra}); $temp = manufacturer_data(@{$extra});
printl $l, $temp if defined $temp; printl $l, $temp if defined $temp;
if (spd_written($bytes->[72])) {
# Try the location code as ASCII first, as earlier specifications
# suggested this. As newer specifications don't mention it anymore,
# we still fall back to binary.
$l = "Manufacturing Location Code";
$temp = (chr($bytes->[72]) =~ m/^[\w\d]$/) ? chr($bytes->[72])
: sprintf("0x%.2X", $bytes->[72]);
printl $l, $temp;
}
printl_mfg_location_code($bytes->[72]);
$l = "Part Number"; $l = "Part Number";
$temp = part_number(@{$bytes}[73..90]); $temp = part_number(@{$bytes}[73..90]);
@ -1377,12 +1375,7 @@ sub decode_manufacturing_information($)
printl $l, manufacture_date($bytes->[93], $bytes->[94]); printl $l, manufacture_date($bytes->[93], $bytes->[94]);
} }
if (spd_written(@{$bytes}[95..98])) {
$l = "Assembly Serial Number";
$temp = sprintf("0x%02X%02X%02X%02X\n",
@{$bytes}[95..98]);
printl $l, $temp;
}
printl_mfg_assembly_serial(@{$bytes}[95..98]);
} }
# Parameter: EEPROM bytes 0-127 (using 126-127) # Parameter: EEPROM bytes 0-127 (using 126-127)

Loading…
Cancel
Save