diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2014-07-08 06:13:23 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2014-07-08 06:13:23 +0000 |
commit | ac656c92fd0f96ac8923089a60ee2b943dc1747d (patch) | |
tree | 307664e6be99ccc9df025a24b94033e8c6d25945 /sysutils/i2c-tools/files/patch-eeprom_decode-dimms | |
parent | Stagify. (diff) |
- Update to 3.1.1.
- Add a recommended patch from upstream (r6250).
- Add an option to specify device other than /dev/smb0.
- Install manual page.
- Update MAINTAINER to use FreeBSD address.
- Remove the leading article from COMMENT.
- Add LICENSE.
- Convert to USES=tar:bzip2.
PR: 191198
Approved by: avg (maintainer, timeout > 2 weeks)
Notes
Notes:
svn path=/head/; revision=361174
Diffstat (limited to 'sysutils/i2c-tools/files/patch-eeprom_decode-dimms')
-rw-r--r-- | sysutils/i2c-tools/files/patch-eeprom_decode-dimms | 137 |
1 files changed, 81 insertions, 56 deletions
diff --git a/sysutils/i2c-tools/files/patch-eeprom_decode-dimms b/sysutils/i2c-tools/files/patch-eeprom_decode-dimms index 17e27cfba2eb..617264df64bd 100644 --- a/sysutils/i2c-tools/files/patch-eeprom_decode-dimms +++ b/sysutils/i2c-tools/files/patch-eeprom_decode-dimms @@ -1,57 +1,26 @@ ---- eeprom/decode-dimms.orig 2012-04-18 10:02:28.495892381 +0300 -+++ eeprom/decode-dimms 2012-04-18 10:02:38.695897992 +0300 -@@ -41,9 +41,9 @@ use strict; - use POSIX qw(ceil); +--- eeprom/decode-dimms.orig 2014-06-19 15:50:29.000000000 -0400 ++++ eeprom/decode-dimms 2014-06-19 16:18:34.000000000 -0400 +@@ -42,7 +42,7 @@ use Fcntl qw(:DEFAULT :seek); + use File::Basename; use vars qw($opt_html $opt_bodyonly $opt_side_by_side $opt_merge - $opt_igncheck $use_sysfs $use_hexdump $sbs_col_width -+ $opt_igncheck $use_hexdump $sbs_col_width ++ $opt_igncheck $opt_smbdev $use_smbdev $use_hexdump $sbs_col_width @vendors %decode_callback $revision @dimm $current %hexdump_cache); use constant LITTLEENDIAN => "little-endian"; - use constant BIGENDIAN => "big-endian"; - -@@ -252,8 +252,6 @@ $revision =~ s/ \([^()]*\)//; - "Edgewater Computer Systems", "XMOS Semiconductor Ltd.", "GENUSION, Inc.", "Memory Corp NV", - "SiliconBlue Technologies", "Rambus Inc."]); +@@ -305,7 +305,7 @@ + "Silicon Space Technology"] + ); -$use_sysfs = -d '/sys/bus'; -- ++$use_smbdev = '/dev/smb0'; + # We consider that no data was written to this area of the SPD EEPROM if # all bytes read 0x00 or all bytes read 0xff - sub spd_written(@) -@@ -525,16 +523,21 @@ sub sdram_voltage_interface_level($) - return ($_[0] < @levels) ? $levels[$_[0]] : "Undefined!"; - } - --# Common to SDR and DDR SDRAM -+# Common to SDR, DDR and DDR2 SDRAM - sub sdram_module_configuration_type($) - { -- my @types = ( -- "No Parity", # 0 -- "Parity", # 1 -- "ECC", # 2 -- ); -+ my $byte = $_[0] & 0x07; -+ my @edc; -+ -+ return "No Parity" if $byte == 0; - -- return ($_[0] < @types) ? $types[$_[0]] : "Undefined!"; -+ # Data ECC includes Data Parity so don't print both -+ push @edc, "Data Parity" if ($byte & 0x03) == 0x01; -+ push @edc, "Data ECC" if ($byte & 0x02); -+ # New in DDR2 specification -+ push @edc, "Address/Command Parity" if ($byte & 0x04); -+ -+ return join ", ", @edc; - } - - # Parameter: EEPROM bytes 0-127 (using 3-62) -@@ -1019,6 +1022,9 @@ sub decode_ddr2_sdram($) - printl("Voltage Interface Level", - sdram_voltage_interface_level($bytes->[8])); +@@ -1079,6 +1079,9 @@ + printl("Module Configuration Type", + sdram_module_configuration_type($bytes->[11])); + printl("Module Configuration Type", + sdram_module_configuration_type($bytes->[11])); @@ -59,14 +28,27 @@ printl("Refresh Rate", ddr2_refresh_rate($bytes->[12])); my @burst; -@@ -1557,6 +1563,26 @@ sub spd_sizes($) +@@ -1289,8 +1292,9 @@ + printl("DLL-Off Mode supported?", ($bytes->[30] & 128) ? "Yes" : "No"); + printl("Operating temperature range", sprintf "0-%d degrees C", + ($bytes->[31] & 1) ? 95 : 85); +- printl("Refresh Rate in extended temp range", +- ($bytes->[31] & 2) ? "2X" : "1X"); ++ printl_cond($bytes->[31] & 1, ++ "Refresh Rate in extended temp range", ++ ($bytes->[31] & 2) ? "1X" : "2X"); + printl("Auto Self-Refresh?", ($bytes->[31] & 4) ? "Yes" : "No"); + printl("On-Die Thermal Sensor readout?", + ($bytes->[31] & 8) ? "Yes" : "No"); +@@ -1624,6 +1628,28 @@ } } +sub freebsd_readbyte ($$) { + my ($offset, $dimm_i) = @_; + -+ my $command = sprintf('/usr/sbin/smbmsg -s %#02x -c %d -i 1 -F %%02x 2>/dev/null', $dimm_i, $offset); ++ my $command = sprintf('/usr/sbin/smbmsg -f %s -s %#02x -c %d -i 1 -F %%02x 2>/dev/null', ++ $use_smbdev, $dimm_i, $offset); + my $output = `$command`; + chomp($output); + my $byte = hex($output); @@ -76,7 +58,8 @@ +sub freebsd_readword ($$) { + my ($offset, $dimm_i) = @_; + -+ my $command = sprintf('/usr/sbin/smbmsg -s %#02x -c %d -w -i 2 -F %%04x 2>/dev/null', $dimm_i, $offset); ++ my $command = sprintf('/usr/sbin/smbmsg -f %s -s %#02x -c %d -w -i 2 -F %%04x 2>/dev/null', ++ $use_smbdev, $dimm_i, $offset); + my $output = `$command`; + chomp($output); + my $word = hex($output); @@ -86,7 +69,7 @@ # Read bytes from SPD-EEPROM # Note: offset must be a multiple of 16! sub readspd($$$) -@@ -1566,22 +1592,14 @@ sub readspd($$$) +@@ -1633,22 +1659,14 @@ if ($use_hexdump) { @bytes = read_hexdump($dimm_i); return @bytes[$offset..($offset + $size - 1)]; @@ -116,7 +99,48 @@ } } return @bytes; -@@ -1710,60 +1728,20 @@ printh('Memory Serial Presence Detect De +@@ -1702,7 +1720,7 @@ + # Parse command-line + foreach (@ARGV) { + if ($_ eq '-h' || $_ eq '--help') { +- print "Usage: $0 [-c] [-f [-b]] [-x|-X file [files..]]\n", ++ print "Usage: $0 [-c] [-f [-b]] [-d|-x|-X file [files..]]\n", + " $0 -h\n\n", + " -f, --format Print nice html output\n", + " -b, --bodyonly Don't print html header\n", +@@ -1711,6 +1729,7 @@ + " --merge-cells Merge neighbour cells with identical values\n", + " (side-by-side output only)\n", + " -c, --checksum Decode completely even if checksum fails\n", ++ " -d, Read data from the device\n", + " -x, Read data from hexdump files\n", + " -X, Same as -x except treat multibyte hex\n", + " data as little endian\n", +@@ -1746,6 +1765,10 @@ + $opt_igncheck = 1; + next; + } ++ if ($_ eq '-d') { ++ $opt_smbdev = 1; ++ next; ++ } + if ($_ eq '-x') { + $use_hexdump = BIGENDIAN; + next; +@@ -1760,7 +1783,11 @@ + exit; + } + +- push @dimm, { eeprom => basename($_), file => $_ } if $use_hexdump; ++ if ($opt_smbdev) { ++ $use_smbdev = $_; ++ } else { ++ push @dimm, { eeprom => basename($_), file => $_ } if $use_hexdump; ++ } + } + + if ($opt_html && !$opt_bodyonly) { +@@ -1777,61 +1804,20 @@ Jean Delvare, Trent Piepho and others'); @@ -138,7 +162,7 @@ - sub get_dimm_list { -- my (@dirs, $dir, $file, @files); +- my (@dirs, $dir, $opened, $file, @files); - - if ($use_sysfs) { - @dirs = ('/sys/bus/i2c/drivers/eeprom', '/sys/bus/i2c/drivers/at24'); @@ -148,6 +172,7 @@ - - foreach $dir (@dirs) { - next unless opendir(local *DIR, $dir); +- $opened++; - while (defined($file = readdir(DIR))) { - if ($use_sysfs) { - # We look for I2C devices like 0-0050 or 2-0051 @@ -168,13 +193,11 @@ - close(DIR); - } - -- if (@files) { -- return sort { $a->{file} cmp $b->{file} } @files; -- } elsif (! -d '/sys/module/eeprom') { -- print "No EEPROM found, are you sure the eeprom module is loaded?\n"; +- if (!$opened) { +- print STDERR "No EEPROM found, try loading the eeprom or at24 module\n"; - exit; + my @dimms; -+ if (! -c '/dev/smb0') { ++ if (! -c $use_smbdev) { + print "SMBus device not found\n"; + exit; + } @@ -184,11 +207,13 @@ + next unless spd_written(@test_bytes); + push @dimms, { eeprom => sprintf('0x%02X', $spd), file => $spd }; } +- +- return sort { $a->{file} cmp $b->{file} } @files; + return @dimms; } # @dimm is a list of hashes. There's one hash for each EEPROM we found. -@@ -1954,7 +1932,7 @@ for $current (0 .. $#dimm) { +@@ -2022,7 +2008,7 @@ print "\n\n"; } else { print "<b><u>" if $opt_html; |