summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysutils/i2c-tools/Makefile4
-rw-r--r--sysutils/i2c-tools/distinfo6
-rw-r--r--sysutils/i2c-tools/files/patch-eeprom_decode-dimms204
3 files changed, 73 insertions, 141 deletions
diff --git a/sysutils/i2c-tools/Makefile b/sysutils/i2c-tools/Makefile
index f79d689fadfe..56e690c986a6 100644
--- a/sysutils/i2c-tools/Makefile
+++ b/sysutils/i2c-tools/Makefile
@@ -1,6 +1,6 @@
PORTNAME= i2c-tools
-PORTVERSION= 4.1
-PORTREVISION= 1
+DISTVERSION= 4.3
+#PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= https://mirrors.edge.kernel.org/pub/software/utils/i2c-tools/
diff --git a/sysutils/i2c-tools/distinfo b/sysutils/i2c-tools/distinfo
index 3ff83bf3265a..06619de2b221 100644
--- a/sysutils/i2c-tools/distinfo
+++ b/sysutils/i2c-tools/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1543829767
-SHA256 (i2c-tools-4.1.tar.xz) = 57b219efd183795bd545dd5a60d9eabbe9dcb6f8fb92bc7ba2122b87f98527d5
-SIZE (i2c-tools-4.1.tar.xz) = 83576
+TIMESTAMP = 1731517192
+SHA256 (i2c-tools-4.3.tar.xz) = 1f899e43603184fac32f34d72498fc737952dbc9c97a8dd9467fadfdf4600cf9
+SIZE (i2c-tools-4.3.tar.xz) = 81276
diff --git a/sysutils/i2c-tools/files/patch-eeprom_decode-dimms b/sysutils/i2c-tools/files/patch-eeprom_decode-dimms
index 7c95569ea628..0d4eaaa06df1 100644
--- a/sysutils/i2c-tools/files/patch-eeprom_decode-dimms
+++ b/sysutils/i2c-tools/files/patch-eeprom_decode-dimms
@@ -1,37 +1,29 @@
---- 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);
+--- eeprom/decode-dimms.orig 2024-11-13 19:00:52.000000000 +0200
++++ eeprom/decode-dimms 2024-11-13 19:37:51.930060000 +0200
+@@ -46,7 +46,8 @@
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 $opt_smbdev $use_smbdev $use_hexdump $sbs_col_width
- @vendors %decode_callback $revision @dimm $current %hexdump_cache);
+ $opt_igncheck $use_sysfs $use_hexdump $sbs_col_width
+- @vendors %decode_callback @dimm $current %hexdump_cache);
++ @vendors %decode_callback @dimm $current %hexdump_cache
++ $opt_smbdev $use_smbdev);
use constant LITTLEENDIAN => "little-endian";
-@@ -305,7 +305,7 @@
- "Silicon Space Technology"]
- );
+ use constant BIGENDIAN => "big-endian";
+@@ -498,6 +499,7 @@
+ }
--$use_sysfs = -d '/sys/bus';
+ $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
-@@ -1079,6 +1079,9 @@
- printl("Module Configuration Type",
- sdram_module_configuration_type($bytes->[11]));
-
-+ printl("Module Configuration Type",
-+ sdram_module_configuration_type($bytes->[11]));
-+
- printl("Refresh Rate", ddr2_refresh_rate($bytes->[12]));
+@@ -2435,8 +2437,38 @@
- my @burst;
-@@ -1624,6 +1628,28 @@
+ return ($size, ($bytes->[0] < 64) ? 64 : $bytes->[0]);
}
- }
-
++}
++
+sub freebsd_readbyte ($$) {
+ my ($offset, $dimm_i) = @_;
+
@@ -41,8 +33,8 @@
+ chomp($output);
+ my $byte = hex($output);
+ return $byte;
-+}
-+
+ }
+
+sub freebsd_readword ($$) {
+ my ($offset, $dimm_i) = @_;
+
@@ -54,40 +46,34 @@
+ return $word;
+}
+
++sub freebsd_spa_n($) {
++ my $page = shift;
++
++ my $command = sprintf('/usr/sbin/smbmsg -f %s -s %#02x -o 0 >/dev/null 2>&1',
++ $use_smbdev, 0x6c + 2 * $page);
++ `$command`;
++}
++
# Read bytes from SPD-EEPROM
# Note: offset must be a multiple of 16!
sub readspd($$$)
-@@ -1633,22 +1659,14 @@
- if ($use_hexdump) {
- @bytes = read_hexdump($dimm_i);
+@@ -2450,6 +2482,15 @@
+ $size = @bytes - $offset;
+ }
return @bytes[$offset..($offset + $size - 1)];
-- } elsif ($use_sysfs) {
-- # Kernel 2.6 with sysfs
-- sysopen(HANDLE, "$dimm_i/eeprom", O_RDONLY)
-- or die "Cannot open $dimm_i/eeprom";
-- binmode HANDLE;
-- sysseek(HANDLE, $offset, SEEK_SET)
-- or die "Cannot seek $dimm_i/eeprom";
-- sysread(HANDLE, my $eeprom, $size)
-- or die "Cannot read $dimm_i/eeprom";
-- close HANDLE;
-- @bytes = unpack("C*", $eeprom);
- } else {
-- # Kernel 2.4 with procfs
-- for my $i (0 .. ($size-1)/16) {
-- my $hexoff = sprintf('%02x', $offset + $i * 16);
-- push @bytes, split(" ", `cat $dimm_i/$hexoff`);
-+# for my $i (0 .. ($size - 1)) {
-+# push (@bytes, freebsd_readbyte($offset + $i, $dimm_i));
-+# }
++ } elsif ($use_smbdev) {
+ for my $i (0 .. (($size - 1) / 2)) {
-+ my $word = freebsd_readword($offset + 2 * $i, $dimm_i);
++ my $off = $offset + 2 * $i;
++
++ freebsd_spa_n($off / 256);
++ my $word = freebsd_readword($off % 256, $dimm_i);
+ push (@bytes, $word & 0xff);
+ push (@bytes, $word >> 8);
- }
- }
- return @bytes;
-@@ -1702,7 +1720,7 @@
++ }
+ } elsif ($use_sysfs) {
+ # Kernel 2.6 with sysfs
+ sysopen(HANDLE, "$dimm_i/eeprom", O_RDONLY)
+@@ -2529,7 +2570,7 @@
# Parse command-line
foreach (@ARGV) {
if ($_ eq '-h' || $_ eq '--help') {
@@ -96,15 +82,15 @@
" $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",
+@@ -2540,6 +2581,7 @@
+ " --no-merge-cells Don't 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 @@
+@@ -2579,6 +2621,10 @@
$opt_igncheck = 1;
next;
}
@@ -115,7 +101,7 @@
if ($_ eq '-x') {
$use_hexdump = BIGENDIAN;
next;
-@@ -1760,7 +1783,11 @@
+@@ -2593,7 +2639,11 @@
exit;
}
@@ -127,85 +113,31 @@
+ }
}
- if ($opt_html && !$opt_bodyonly) {
-@@ -1777,65 +1804,20 @@
- Jean Delvare, Trent Piepho and others');
-
-
--# From a sysfs device path and an attribute name, return the attribute
--# value, or undef (stolen from sensors-detect)
--sub sysfs_device_attribute
--{
-- my ($device, $attr) = @_;
-- my $value;
--
-- open(local *FILE, "$device/$attr") or return "";
-- $value = <FILE>;
-- close(FILE);
-- return unless defined $value;
--
-- chomp($value);
-- return $value;
--}
--
- sub get_dimm_list
- {
-- my (@dirs, $dir, $opened, $file, @files);
--
-- if ($use_sysfs) {
-- @dirs = ('/sys/bus/i2c/drivers/eeprom',
-- '/sys/bus/i2c/drivers/at24',
-- '/sys/bus/i2c/drivers/ee1004'); # DDR4
-- } else {
-- @dirs = ('/proc/sys/dev/sensors');
-- }
--
-- 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
-- next unless $file =~ /^\d+-[\da-f]+$/i;
-- next unless -d "$dir/$file";
--
-- # Device name must be eeprom (driver eeprom)
-- # or spd (driver at24)
-- my $attr = sysfs_device_attribute("$dir/$file", "name");
-- next unless defined $attr &&
-- ($attr eq "eeprom" ||
-- $attr eq "spd" ||
-- $attr eq "ee1004"); # DDR4
-- } else {
-- next unless $file =~ /^eeprom-/;
-- }
-- push @files, { eeprom => "$file",
-- file => "$dir/$file" };
-- }
-- close(DIR);
-- }
--
-- if (!$opened) {
-- print STDERR "No EEPROM found, try loading the eeprom or at24 module\n";
-- exit;
-+ my @dimms;
-+ if (! -c $use_smbdev) {
-+ print "SMBus device not found\n";
-+ exit;
-+ }
-+ for my $spd (0xA0 .. 0xAE) {
-+ next if ($spd % 2 != 0);
-+ my @test_bytes = readspd(0, 4, $spd);
-+ 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.
-@@ -2022,7 +2008,7 @@
+ # Default values
+@@ -2623,6 +2673,22 @@
+ @drivers = ('eeprom',
+ 'at24',
+ 'ee1004'); # DDR4
++ } elsif ($use_smbdev) {
++ my @dimms;
++
++ if (! -c $use_smbdev) {
++ print STDERR "SMBus device not found\n";
++ exit;
++ }
++ for my $spd (0xA0 .. 0xAE) {
++ next if ($spd % 2 != 0);
++ my @test_bytes = readspd(0, 4, $spd);
++ next unless spd_written(@test_bytes);
++ push @dimms, { eeprom => sprintf('0x%02X', $spd),
++ file => $spd,
++ driver => "smbus" };
++ }
++ return @dimms;
+ } else {
+ @drivers = ('eeprom');
+ $dir = '/proc/sys/dev/sensors';
+@@ -2910,7 +2976,7 @@
if ($opt_side_by_side) {
print "\n\n";
} else {
@@ -213,4 +145,4 @@
+ printl2("\n\nDecoding EEPROM", $dimm[$current]->{eeprom},
"text-decoration: underline; font-weight: bold;");
}
- print "<table border=1>\n" if $opt_html;
+ print "<table border=\"1\">\n" if $opt_html;