- 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)
This commit is contained in:
Jung-uk Kim 2014-07-08 06:13:23 +00:00
parent e87617613d
commit ac656c92fd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=361174
4 changed files with 113 additions and 64 deletions

View File

@ -2,22 +2,25 @@
# $FreeBSD$
PORTNAME= i2c-tools
PORTVERSION= 3.1.0
PORTVERSION= 3.1.1
CATEGORIES= sysutils
MASTER_SITES= http://dl.lm-sensors.org/i2c-tools/releases/
MAINTAINER= avg@icyb.net.ua
COMMENT= A heterogeneous set of I2C tools
MAINTAINER= avg@FreeBSD.org
COMMENT= Heterogeneous set of I2C tools
LICENSE= GPLv2
USE_BZIP2= yes
NO_BUILD= yes
USES= perl5 shebangfix
USES= perl5 shebangfix tar:bzip2
USE_PERL5= run
PLIST_FILES= sbin/decode-dimms
PLIST_FILES= man/man1/decode-dimms.1.gz sbin/decode-dimms
SHEBANG_FILES= eeprom/decode-dimms
do-install:
${INSTALL_MAN} ${WRKSRC}/eeprom/decode-dimms.1 \
${STAGEDIR}${PREFIX}/man/man1/
${INSTALL_SCRIPT} ${WRKSRC}/eeprom/decode-dimms \
${STAGEDIR}${PREFIX}/sbin

View File

@ -1,2 +1,2 @@
SHA256 (i2c-tools-3.1.0.tar.bz2) = 960023f61de292c6dd757fcedec4bffa7dd036e8594e24b26a706094ca4c142a
SIZE (i2c-tools-3.1.0.tar.bz2) = 66840
SHA256 (i2c-tools-3.1.1.tar.bz2) = 14d4d7d60d1c12e43f2befe239c682a5c44c27682f153d4b58c1e392d2db1700
SIZE (i2c-tools-3.1.1.tar.bz2) = 71789

View File

@ -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;

View File

@ -0,0 +1,21 @@
--- eeprom/decode-dimms.1.orig 2014-02-20 04:59:56.488360000 -0500
+++ eeprom/decode-dimms.1 2014-06-19 16:20:15.000000000 -0400
@@ -21,7 +21,7 @@
decode-dimms \- decode the information found in memory module SPD EEPROMs
.SH SYNOPSIS
.B decode-dimms
-[-c] [-f [-b]] [-x|-X file [files..]]
+[-c] [-f [-b]] [-d|-x|-X file [files..]]
.br
.B decode-dimms
-h
@@ -53,6 +53,9 @@
.B \-c, --checksum
Decode completely even if checksum fails
.TP
+.B \-d
+Read data from the device
+.TP
.B \-x
Read data from hexdump files
.TP