This commit is contained in:
coypu 2018-07-25 04:00:03 +03:00
parent d9535cf077
commit 825c49f8b5
6 changed files with 105 additions and 36 deletions

View File

@ -1,5 +1,4 @@
decode-dimms is a small utility that displays the contents of DIMM memory
SPD ROMs in human-readable form.
This version of decode-dimms can even directly read the SPD ROM data from
the sysctl variables created by the spdmem device driver (NetBSD-only).
The decode-dimms utility provides a human-readable display of the contents
of the SPD ROMs on memory DIMMs. On NetBSD, it can use spdmem(4) as the
source of the ROM data. Output formats include a side-by-side HTML table
for multiple DIMMs so you can easily compare them.

View File

@ -1,25 +1,37 @@
# $NetBSD: Makefile,v 1.1 2018/03/01 22:45:58 pgoyette Exp $
# $NetBSD: Makefile,v 1.2 2017/06/05 14:22:55 ryoon Exp $
DISTNAME= decode-dimms-20171205
# no Release yet
GIT_COMMIT= 84da8192c7c409f37c1906b60ef166c58aafc847
DISTNAME= i2c-tools-${GIT_COMMIT}
PKGNAME= decode-dimms-0.0.20181205
CATEGORIES= sysutils
#MASTER_SITES= https://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git/tree/eeprom/decode-dimms
MAINTAINER= paul@whooppee.com
HOMEPAGE= https://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git/
COMMENT= Memory SPD ROM decoder
MASTER_SITES= https://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git/snapshot/
EXTRACT_SUFX= .tar.gz
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://git.kernel.org/pub/scm/utils/i2c-tools/
COMMENT= Decode memory DIMM SPD ROM info
LICENSE= gnu-gpl-v2
WRKSRC= ${WRKDIR}
NO_BUILD= yes
USE_LANGUAGES= # none
REPLACE_PERL+= decode-dimms
INSTALLATION_DIRS= bin
NO_CONFIGURE= yes
NO_BUILD= yes
do-configure:
USE_LANGUAGES= # empty
ONLY_FOR_PLATFORM= NetBSD-*-*
INSTALLATION_DIRS= bin ${PKGMANDIR}/man1
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/decode-dimms ${DESTDIR}${PREFIX}/bin/
${INSTALL_SCRIPT} ${WRKSRC}/eeprom/decode-dimms \
${DESTDIR}${PREFIX}/bin/decode-dimms
${INSTALL_MAN} ${WRKSRC}/eeprom/decode-dimms.1 \
${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/decode-dimms.1
.include "../../lang/perl5/module.mk"
.include "../../mk/bsd.pkg.mk"

View File

@ -1,2 +1,3 @@
@comment $NetBSD$
@comment $NetBSD: PLIST,v 1.1 2009/11/28 20:25:40 pgoyette Exp $
bin/decode-dimms
man/man1/decode-dimms.1

View File

@ -1,7 +1,8 @@
$NetBSD: distinfo,v 1.2 2018/03/01 22:54:05 pgoyette Exp $
$NetBSD$
SHA1 (decode-dimms-20171205.tar.gz) = b12887f74f321bc922c843f952875f0403697653
RMD160 (decode-dimms-20171205.tar.gz) = d9102651c663a2ea0c35d4560994065c265c1e77
SHA512 (decode-dimms-20171205.tar.gz) = f3c4a0b41e344d56a94eef22cb6a21717abb099700747b4b3508fc2116966663b508ce8d6b6321766f68972ff153785f16a53c18c86ee41919be1f34bf2e4199
Size (decode-dimms-20171205.tar.gz) = 27820 bytes
SHA1 (patch-decode-dimms) = 733a22ef2dc5c478d12ba7a60a26fed7d760c289
SHA1 (i2c-tools-84da8192c7c409f37c1906b60ef166c58aafc847.tar.gz) = 0765225f1f7ee63d0ebb3a3881ad819fa9d48d9e
RMD160 (i2c-tools-84da8192c7c409f37c1906b60ef166c58aafc847.tar.gz) = 0e1f9c86e5005bf8534789e4dea532bc8dda522a
SHA512 (i2c-tools-84da8192c7c409f37c1906b60ef166c58aafc847.tar.gz) = 4cd57f6cc4424888fe4e7bede28b7a5e15e7f658b57fa4df528cc3636cd5124036a69492de9636d81478e58b660275df2dee239999bd5ea0bec13313b240b352
Size (i2c-tools-84da8192c7c409f37c1906b60ef166c58aafc847.tar.gz) = 95860 bytes
SHA1 (patch-decode-dimms) = 7e24bc4eeb88dbf59924c6572089a55cd8f39246
SHA1 (patch-decode-dimms.1) = 7ac58a4e18de1d6f47abfd0544db06c998d71115

View File

@ -1,8 +1,14 @@
$NetBSD$
--- decode-dimms.orig 2018-03-01 23:05:59.000000000 +0000
+++ decode-dimms
@@ -42,8 +42,9 @@ use POSIX qw(ceil);
--- eeprom/decode-dimms.orig 2018-05-31 13:53:29.771907986 +0800
+++ eeprom/decode-dimms 2018-03-03 13:20:15.572272632 +0800
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/pkg/bin/perl -w
#
# EEPROM data decoder for SDRAM DIMM modules
#
@@ -42,15 +42,14 @@
use Fcntl qw(:DEFAULT :seek);
use File::Basename;
use vars qw($opt_html $opt_bodyonly $opt_side_by_side $opt_merge
@ -14,7 +20,15 @@ $NetBSD$
use constant LITTLEENDIAN => "little-endian";
use constant BIGENDIAN => "big-endian";
@@ -339,6 +340,7 @@ $revision = '20171205'
-$revision = '$Revision$ ($Date$)';
-$revision =~ s/\$\w+: (.*?) \$/$1/g;
-$revision =~ s/ \([^()]*\)//;
+$revision = '20171205';
@vendors = (
["AMD", "AMI", "Fairchild", "Fujitsu",
@@ -341,6 +340,7 @@
);
$use_sysfs = -d '/sys/bus';
@ -22,7 +36,7 @@ $NetBSD$
# We consider that no data was written to this area of the SPD EEPROM if
# all bytes read 0x00 or all bytes read 0xff
@@ -2250,6 +2252,26 @@ sub spd_sizes($)
@@ -2252,6 +2252,26 @@
}
}
@ -49,7 +63,7 @@ $NetBSD$
# Read bytes from SPD-EEPROM
# Note: offset must be a multiple of 16!
sub readspd($$$)
@@ -2259,6 +2281,9 @@ sub readspd($$$)
@@ -2261,6 +2281,9 @@
if ($use_hexdump) {
@bytes = read_hexdump($dimm_i);
return @bytes[$offset..($offset + $size - 1)];
@ -59,7 +73,7 @@ $NetBSD$
} elsif ($use_sysfs) {
# Kernel 2.6 with sysfs
sysopen(HANDLE, "$dimm_i/eeprom", O_RDONLY)
@@ -2335,7 +2360,7 @@ sub check_crc($)
@@ -2337,7 +2360,7 @@
# Parse command-line
foreach (@ARGV) {
if ($_ eq '-h' || $_ eq '--help') {
@ -68,7 +82,7 @@ $NetBSD$
" $0 -h\n\n",
" -f, --format Print nice html output\n",
" -b, --bodyonly Don't print html header\n",
@@ -2349,6 +2374,8 @@ foreach (@ARGV) {
@@ -2351,6 +2374,8 @@
" -x, Read data from hexdump files\n",
" -X, Same as -x except treat multibyte hex\n",
" data as little endian\n",
@ -77,7 +91,7 @@ $NetBSD$
" -h, --help Display this usage summary\n";
print <<"EOF";
@@ -2393,13 +2420,20 @@ EOF
@@ -2395,13 +2420,20 @@
$use_hexdump = LITTLEENDIAN;
next;
}
@ -99,7 +113,7 @@ $NetBSD$
}
# Default values
@@ -2477,7 +2511,7 @@ sub get_dimm_list
@@ -2479,7 +2511,7 @@
# * chk_spd: The checksum or CRC value found in the EEPROM
# * chk_calc: The checksum or CRC computed from the EEPROM data
# Keys are added over time.
@ -108,7 +122,7 @@ $NetBSD$
for my $i (0 .. $#dimm) {
my @bytes = readspd(0, 128, $dimm[$i]->{file});
@@ -2529,7 +2563,7 @@ for $current (0 .. $#dimm) {
@@ -2531,7 +2563,7 @@
printl("Decoding EEPROM", $dimm[$current]->{eeprom});
}
@ -117,3 +131,8 @@ $NetBSD$
if ($dimm[$current]->{file} =~ /-([\da-f]+)$/i) {
my $dimm_num = hex($1) - 0x50 + 1;
if ($dimm_num >= 1 && $dimm_num <= 8) {
@@ -2737,3 +2769,4 @@
printl2("\n\nNumber of SDRAM DIMMs detected and decoded", scalar @dimm);
print "</body></html>\n" if ($opt_html && !$opt_bodyonly);
+

View File

@ -0,0 +1,37 @@
$NetBSD$
--- eeprom/decode-dimms.1.orig 2018-07-25 07:26:21.321627123 +0800
+++ eeprom/decode-dimms.1 2018-07-25 07:26:56.967194551 +0800
@@ -22,7 +22,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]] [-x|-X|-s file [files..]]
.br
.B decode-dimms
-h
@@ -32,8 +32,7 @@
.B decode-dimms
tool is to decode the information found in memory module SPD EEPROMs.
The SPD data is read either from the running system or dump files.
-In the former case, the tool requires a kernel module to be loaded:
-eeprom, at24 or ee1004 (for DDR4 SDRAM.)
+In the former case, the tool requires the spdmem kernel module to be loaded.
.SH PARAMETERS
.TP
.B \-f, --format
@@ -60,9 +59,11 @@
.B \-X
Same as -x except treat multibyte hex data as little endian
.TP
+.B \-s
+Read the SPD data from the sysctl (9) node hw.<file>.spd_data instead of
+from a file.
+.TP
.B \-h, --help
Display the usage summary
-.SH SEE ALSO
-.BR decode-vaio (1)
.SH AUTHORS
Philip Edelbrock, Christian Zuckschwerdt, Burkart Lingner, Jean Delvare