root/lm-sensors/trunk/prog/eeprom/decode-dimms.pl @ 1589

Revision 1589, 18.9 KB (checked in by khali, 11 years ago)

decode-dimms.pl pass -w and use strict

Valid HTML 3.2 output (--format mode)
Miscellaneous formatting enhancements and bug fixes
Clearer HTML output (original patch by Nick Kurshev

<nickols_k@…>)

Stop decoding on checksum error by default (--checksum option

forces)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/usr/bin/perl -w
2#
3# Copyright 1998, 1999 Philip Edelbrock <phil@netroedge.com>
4# modified by Christian Zuckschwerdt <zany@triq.net>
5#
6#    This program is free software; you can redistribute it and/or modify
7#    it under the terms of the GNU General Public License as published by
8#    the Free Software Foundation; either version 2 of the License, or
9#    (at your option) any later version.
10#
11#    This program is distributed in the hope that it will be useful,
12#    but WITHOUT ANY WARRANTY; without even the implied warranty of
13#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#    GNU General Public License for more details.
15#
16#    You should have received a copy of the GNU General Public License
17#    along with this program; if not, write to the Free Software
18#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19#
20# Version 0.4  1999  Philip Edelbrock <phil@netroedge.com>
21# Version 0.5  2000-03-30  Christian Zuckschwerdt <zany@triq.net>
22#  html output (selectable by commandline switches)
23# Version 0.6  2000-09-16  Christian Zuckschwerdt <zany@triq.net>
24#  updated according to SPD Spec Rev 1.2B
25#  see http://developer.intel.com/technology/memory/pc133sdram/spec/Spdsd12b.htm
26# Version 0.7  2002-11-08  Jean Delvare <khali@linux-fr.org>
27#  pass -w and use strict
28#  valid HTML 3.2 output (--format mode)
29#  miscellaneous formatting enhancements and bug fixes
30#  clearer HTML output (original patch by Nick Kurshev <nickols_k@mail.ru>)
31#  stop decoding on checksum error by default (--checksum option forces)
32#
33#
34# EEPROM data decoding for SDRAM DIMM modules.
35#
36# Two assumptions: lm_sensors-2.x installed,
37# and Perl is at /usr/bin/perl
38#
39# use the following command line switches
40#  -f, --format            print nice html output
41#  -b, --bodyonly          don't printhtml header
42#                          (useful for postprocessing the output)
43#  -h, --help              display this usage summary
44#
45# References:
46# PC SDRAM Serial Presence
47# Detect (SPD) Specification, Intel,
48# 1997,1999, Rev 1.2B
49#
50# Jedec Standards 4.1.x & 4.5.x
51# http://www.jedec.org
52#
53
54use strict;
55use vars qw($opt_html $opt_body $opt_bodyonly $opt_igncheck);
56
57sub printl ($$) # print a line w/ label and value
58{
59   my ($label, $value) = @_;
60   if ($opt_html) {
61       $label =~ s/</\&lt;/sg;
62       $label =~ s/>/\&gt;/sg;
63       $label =~ s/\n/<br>\n/sg;
64       $value =~ s/</\&lt;/sg;
65       $value =~ s/>/\&gt;/sg;
66       $value =~ s/\n/<br>\n/sg;
67       print "<tr><td valign=top>$label</td><td>$value</td></tr>\n";
68   } else {
69       $value =~ s%\n%\n\t\t%sg;
70       print "$label\t$value\n";
71   }
72}
73
74sub printl2 ($$) # print a line w/ label and value (outside a table)
75{
76   my ($label, $value) = @_;
77   if ($opt_html) {
78       $label =~ s/</\&lt;/sg;
79       $label =~ s/>/\&gt;/sg;
80       $label =~ s/\n/<br>\n/sg;
81       $value =~ s/</\&lt;/sg;
82       $value =~ s/>/\&gt;/sg;
83       $value =~ s/\n/<br>\n/sg;
84       print "$label: $value\n";
85   } else {
86       $value =~ s%\n%\n\t\t%sg;
87       print "$label\t$value\n";
88   }
89}
90
91sub prints ($) # print seperator w/ given text
92{
93   my ($label) = @_;
94   if ($opt_html) {
95       $label =~ s/</\&lt;/sg;
96       $label =~ s/>/\&gt;/sg;
97       $label =~ s/\n/<br>\n/sg;
98       print "<tr><td align=center colspan=2><b>$label</b></td></tr>\n";
99   } else {
100       print "\n---=== $label ===---\n";
101   }
102}
103
104sub printh ($) # print header w/ given text
105{
106   my ($label) = @_;
107   if ($opt_html) {
108       $label =~ s/</\&lt;/sg;
109       $label =~ s/>/\&gt;/sg;
110       $label =~ s/\n/<br>\n/sg;
111       print "<h1>$label</h1>\n";
112   } else {
113        print "\n$label\n";
114   }
115}
116
117for (@ARGV) {
118    if (/-h/) {
119                print "Usage: $0 [-f|-b|-h]\n\n",
120                        "  -f, --format            print nice html output\n",
121                        "  -b, --bodyonly          don't printhtml header\n",
122                        "                          (useful for postprocessing the output)\n",
123                        "  -c, --checksum          decode completely even if checksum fails\n",
124                        "  -h, --help              display this usage summary\n";
125                exit;
126    }
127    $opt_html = 1 if (/-f/);
128    $opt_bodyonly = 1 if (/-b/);
129    $opt_igncheck = 1 if (/-c/);
130}
131$opt_body = $opt_html && ! $opt_bodyonly;
132
133if ($opt_body)
134{
135        print "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n",
136              "<html><head>\n",
137                  "\t<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n",
138                  "\t<title>PC DIMM Serial Presence Detect Tester/Decoder Output</title>\n",
139                  "</head><body>\n";
140}
141
142printh '
143PC DIMM Serial Presence Detect Tester/Decoder
144By Philip Edelbrock, Christian Zuckschwerdt and others
145Version 2.6.6
146';
147
148
149my $dimm_count=0;
150$_=`ls /proc/sys/dev/sensors/`;
151my @dimm_list=split();
152
153for my $i ( 0 .. $#dimm_list ) {
154        $_=$dimm_list[$i];
155        if (/^eeprom-/) {
156                my $dimm_checksum=0;
157                $dimm_count += 1;
158               
159                print "<b><u><br><br>" if $opt_html;
160                printl2 "Decoding EEPROM" , " /proc/sys/dev/sensors/$dimm_list[$i]";
161                print "</u></b>" if $opt_html;
162                print "<table border=1>\n" if $opt_html;
163                if (/^[^-]+-[^-]+-[^-]+-([^-]+)$/) {
164                        my $dimm_num=$1 - 49;
165                        printl "Guessing DIMM is in", "bank $dimm_num";
166                }
167# Decode first 16 bytes
168                prints "The Following is Required Data and is Applicable to all DIMM Types";
169
170                $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/00`;
171                my @bytes=split(" ");
172                for my $j ( 0 .. 15 ) { $dimm_checksum = $dimm_checksum + $bytes[$j];  }
173               
174                printl "# of bytes written to SDRAM EEPROM",$bytes[0];
175
176                my $l = "Total number of bytes in EEPROM";
177                if ($bytes[1] <= 13) {
178                        printl $l, 2**$bytes[1];
179                } elsif ($bytes[1] == 0) {
180                        printl $l, "RFU"; 
181                } else { printl $l, "ERROR!"; }
182
183                $l = "Fundemental Memory type";
184                if ($bytes[2] == 2) { printl $l, "EDO"; }
185                elsif ($bytes[2] == 4) { printl $l, "SDRAM"; }
186                else { printl $l, "???"; }
187
188                $l = "Number of Row Address Bits (SDRAM only)";
189                if ($bytes[3] == 0) { printl $l, "Undefined!" }                 
190                elsif ($bytes[3] == 1) { printl $l, "1/16" }           
191                elsif ($bytes[3] == 2) { printl $l, "2/17" }           
192                elsif ($bytes[3] == 3) { printl $l, "3/18" }
193                else { printl $l, $bytes[3]; }
194
195                $l = "Number of Col Address Bits (SDRAM only)";
196                if ($bytes[4] == 0) { printl $l, "Undefined!" }                 
197                elsif ($bytes[4] == 1) { printl $l, "1/16" }           
198                elsif ($bytes[4] == 2) { printl $l, "2/17" }           
199                elsif ($bytes[4] == 3) { printl $l, "3/18" }
200                else { printl $l, $bytes[4]; }
201
202                $l = "Number of Module Rows";
203                if ($bytes[5] == 0 ) { printl $l, "Undefined!"; }
204                else { printl $l, $bytes[5]; }
205
206                $l = "Data Width (SDRAM only)";
207                if ($bytes[7] > 1) { printl $l, "Undefined!" } else {
208                        my $temp=($bytes[7]*256) + $bytes[6];
209                        printl $l, $temp; }
210
211                $l = "Module Interface Signal Levels";
212                if ($bytes[8] == 0) { printl $l, "5.0 Volt/TTL";}
213                elsif ($bytes[8] == 1) { printl $l, "LVTTL";}
214                elsif ($bytes[8] == 2) { printl $l, "HSTL 1.5";}
215                elsif ($bytes[8] == 3) { printl $l, "SSTL 3.3";}
216                elsif ($bytes[8] == 4) { printl $l, "SSTL 2.5";}
217                elsif ($bytes[8] == 255) { printl $l, "New Table";}
218                else { printl $l, "Undefined!";}
219               
220                $l = "Cycle Time (SDRAM) highest CAS latency";
221                my $temp=($bytes[9] >> 4) + ($bytes[9] & 0xf) * 0.1;
222                printl $l, "${temp}ns";
223               
224                $l = "Access Time (SDRAM)";
225                $temp=($bytes[10] >> 4) + ($bytes[10] & 0xf) * 0.1;
226                printl $l, "${temp}ns";
227               
228                $l = "Module Configuration Type";
229                if ($bytes[11] == 0) { printl $l, "No Parity"; }
230                elsif ($bytes[11] == 1) { printl $l, "Parity"; }
231                elsif ($bytes[11] == 2) { printl $l, "ECC"; }
232                else { printl $l, "Undefined!"; }
233                       
234                $l = "Refresh Type";
235                if ($bytes[12] > 126) { printl $l, "Self Refreshing"; }
236                else { printl $l, "Not Self Refreshing"; }
237               
238                $l = "Refresh Rate";
239                $temp=$bytes[12] & 0x7f;
240                if ($temp == 0) { printl $l, "Normal (15.625uS)"; }
241                elsif ($temp == 1) { printl $l, "Reduced (3.9uS)"; }
242                elsif ($temp == 2) { printl $l, "Reduced (7.8uS)"; }
243                elsif ($temp == 3) { printl $l, "Extended (31.3uS)"; }
244                elsif ($temp == 4) { printl $l, "Extended (62.5uS)"; }
245                elsif ($temp == 5) { printl $l, "Extended (125uS)"; }
246                else { printl $l, "Undefined!";}
247               
248                $l = "Primary SDRAM Component Bank Config";
249                if ($bytes[13]>126) { printl $l, "Bank2 = 2 x Bank1";}
250                else { printl $l, "No Bank2 OR Bank2 = Bank1 width";}
251               
252                $l = "Primary SDRAM Component Widths";
253                $temp=$bytes[13] & 0x7f;
254                if ($temp == 0) { printl $l, "Undefined!\n"; }
255                else { printl $l, $temp; }
256               
257                $l = "Error Checking SDRAM Component Bank Config";
258                if ($bytes[14]>126) { printl $l, "Bank2 = 2 x Bank1";}
259                else { printl $l, "No Bank2 OR Bank2 = Bank1 width";}
260               
261                $l = "Error Checking SDRAM Component Widths";
262                $temp=$bytes[14] & 0x7f;
263                if ($temp == 0) { printl $l, "Undefined!"; }
264                else { printl $l, $temp; }
265               
266                $l = "Min Clock Delay for Back to Back Random Access";
267                if ($bytes[15] == 0) { printl $l, "Undefined!"; }
268                else { printl $l, $bytes[15]; }
269               
270                prints "The Following Apply to SDRAM DIMMs ONLY";
271               
272# Decode next 16 bytes
273                $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/10`;
274                @bytes=split(" ");
275                for my $j ( 0 .. 15 ) { $dimm_checksum = $dimm_checksum + $bytes[$j]; }
276               
277                $l = "Burst lengths supported";
278                $temp="";
279                if (($bytes[0] & 1) > 0) { $temp .= "Burst Length = 1\n"; }
280                if (($bytes[0] & 2) > 0) { $temp .= "Burst Length = 2\n"; }
281                if (($bytes[0] & 4) > 0) { $temp .= "Burst Length = 4\n"; }
282                if (($bytes[0] & 8) > 0) { $temp .= "Burst Length = 8\n"; }
283                if (($bytes[0] & 16) > 0) { $temp .= "Undefined! (bit 4)\n"; }
284                if (($bytes[0] & 32) > 0) { $temp .= "Undefined! (bit 5)\n"; }
285                if (($bytes[0] & 64) > 0) { $temp .= "Undefined! (bit 6)\n"; }
286                if (($bytes[0] & 128) > 0) { $temp .= "Burst Length = Page\n"; }
287                if ($bytes[0] == 0) { $temp .= "(None Supported)\n";}
288                printl $l, $temp;
289               
290                $l = "Number of Device Banks";
291                if ($bytes[1] == 0) { printl $l, "Undefined/Reserved!"; }
292                else { printl $l, $bytes[1]; }
293               
294                $l = "Supported CAS Latencies";
295                $temp="";
296                if (($bytes[2] & 1) > 0) { $temp .= "CAS Latency = 1\n";}
297                if (($bytes[2] & 2) > 0) { $temp .= "CAS Latency = 2\n"; }
298                if (($bytes[2] & 4) > 0) { $temp .= "CAS Latency = 3\n"; }
299                if (($bytes[2] & 8) > 0) { $temp .= "CAS Latency = 4\n"; }
300                if (($bytes[2] & 16) > 0) { $temp .= "CAS Latency = 5\n"; }
301                if (($bytes[2] & 32) > 0) { $temp .= "CAS Latency = 6\n"; }
302                if (($bytes[2] & 64) > 0) { $temp .= "CAS Latency = 7\n"; }
303                if (($bytes[2] & 128) > 0) { $temp .= "Undefined (bit 7)\n"; }
304                if ($bytes[2] == 0) { $temp .= "(None Supported)\n";}
305                printl $l, $temp;
306               
307                $l = "Supported CS Latencies";
308                $temp="";
309                if (($bytes[3] & 1) > 0) { $temp .= "CS Latency = 0\n";}
310                if (($bytes[3] & 2) > 0) { $temp .= "CS Latency = 1\n"; }
311                if (($bytes[3] & 4) > 0) { $temp .= "CS Latency = 2\n"; }
312                if (($bytes[3] & 8) > 0) { $temp .= "CS Latency = 3\n"; }
313                if (($bytes[3] & 16) > 0) { $temp .= "CS Latency = 4\n"; }
314                if (($bytes[3] & 32) > 0) { $temp .= "CS Latency = 5\n"; }
315                if (($bytes[3] & 64) > 0) { $temp .= "CS Latency = 6\n"; }
316                if (($bytes[3] & 128) > 0) { $temp .= "Undefined (bit 7)\n"; }
317                if ($bytes[3] == 0) { $temp .= "(None Supported)\n";}
318                printl $l, $temp;
319               
320                $l = "Supported WE Latencies";
321                $temp="";
322                if (($bytes[4] & 1) > 0) { $temp .= "WE Latency = 0\n";}
323                if (($bytes[4] & 2) > 0) { $temp .= "WE Latency = 1\n"; }
324                if (($bytes[4] & 4) > 0) { $temp .= "WE Latency = 2\n"; }
325                if (($bytes[4] & 8) > 0) { $temp .= "WE Latency = 3\n"; }
326                if (($bytes[4] & 16) > 0) { $temp .= "WE Latency = 4\n"; }
327                if (($bytes[4] & 32) > 0) { $temp .= "WE Latency = 5\n"; }
328                if (($bytes[4] & 64) > 0) { $temp .= "WE Latency = 6\n"; }
329                if (($bytes[4] & 128) > 0) { $temp .= "Undefined (bit 7)\n"; }
330                if ($bytes[4] == 0) { $temp .= "(None Supported)\n";}
331                printl $l, $temp;
332               
333                $l = "SDRAM Module Attributes";
334                $temp="";
335                if (($bytes[5] & 1) > 0) { $temp .= "Buffered Address/Control Inputs\n";}
336                if (($bytes[5] & 2) > 0) { $temp .= "Registered Address/Control Inputs\n"; }
337                if (($bytes[5] & 4) > 0) { $temp .= "On card PLL (clock)\n"; }
338                if (($bytes[5] & 8) > 0) { $temp .= "Buffered DQMB Inputs\n"; }
339                if (($bytes[5] & 16) > 0) { $temp .= "Registered DQMB Inputs\n"; }
340                if (($bytes[5] & 32) > 0) { $temp .= "Differential Clock Input\n"; }
341                if (($bytes[5] & 64) > 0) { $temp .= "Redundant Row Address\n"; }
342                if (($bytes[5] & 128) > 0) { $temp .= "Undefined (bit 7)\n"; }
343                if ($bytes[5] == 0) { $temp .= "(None Reported)\n";}
344                printl $l, $temp;
345               
346                $l = "SDRAM Device Attributes (General)";
347                $temp="";
348                if (($bytes[6] & 1) > 0) { $temp .= "Supports Early RAS# Recharge\n";}
349                if (($bytes[6] & 2) > 0) { $temp .= "Supports Auto-Precharge\n"; }
350                if (($bytes[6] & 4) > 0) { $temp .= "Supports Precharge All\n"; }
351                if (($bytes[6] & 8) > 0) { $temp .= "Supports Write1/Read Burst\n"; }
352                if (($bytes[6] & 16) > 0) { $temp .= "Lower VCC Tolerance:5%\n"; }
353                if (($bytes[6] & 16) == 0) { $temp .= "Lower VCC Tolerance:10%\n"; }
354                if (($bytes[6] & 32) > 0) { $temp .= "Upper VCC Tolerance:5%\n"; }
355                if (($bytes[6] & 32) == 0) { $temp .= "Upper VCC Tolerance:10%\n"; }
356                if (($bytes[6] & 64) > 0) { $temp .= "Undefined (bit 6)\n"; }
357                if (($bytes[6] & 128) > 0) { $temp .= "Undefined (bit 7)\n"; }
358                printl $l, $temp;
359               
360                $l = "SDRAM Cycle Time (2nd highest CAS)";
361                $temp = $bytes[7] >> 4;
362                if ($temp == 0) { printl $l, "Undefined!"; }
363                else {
364                        if ($temp < 4 ) {$temp=$temp + 15;}
365                        printl $l, $temp + (($bytes[7] & 0xf) * 0.1) . "nS";
366                }
367               
368                $l = "SDRAM Access from Clock Time (2nd highest CAS)";
369                $temp = $bytes[8] >> 4;
370                if ($temp == 0) { printl $l, "Undefined!"; }
371                else {
372                        if ($temp < 4 ) {$temp=$temp + 15;}
373                        printl $l, $temp + (($bytes[8] & 0xf) * 0.1) . "nS";
374                }
375               
376                prints "The Following are Optional (may be Bogus)";
377               
378                $l = "SDRAM Cycle Time (3rd highest CAS)";
379                $temp = $bytes[9] >> 2;
380                if ($temp == 0) { printl $l, "Undefined!"; }
381                else { printl $l, $temp + ($bytes[9] & 0x3) * 0.25 . "nS"; }
382               
383                $l = "SDRAM Access from Clock Time (3rd highest CAS)";
384                $temp = $bytes[10] >> 2;
385                if ($temp == 0) { printl $l, "Undefined!"; }
386                else { printl $l, $temp + ($bytes[10] & 0x3) * 0.25 . "nS"; }
387               
388                prints "The Following are Required (for SDRAMs)";
389               
390                $l = "Minumum Row Precharge Time";
391                if ($bytes[11] == 0) { printl $l, "Undefined!"; }
392                else { printl $l, "$bytes[11]nS"; }
393               
394                $l = "Row Active to Row Active Min";
395                if ($bytes[12] == 0) { printl $l, "Undefined!"; }
396                else { printl $l, "$bytes[12]nS"; }
397               
398                $l = "RAS to CAS Delay";
399                if ($bytes[13] == 0) { printl $l, "Undefined!"; }
400                else { printl $l, "$bytes[13]nS"; }
401               
402                $l = "Min RAS Pulse Width";
403                if ($bytes[14] == 0) { printl $l, "Undefined!"; }
404                else { printl $l, "$bytes[14]nS"; }
405               
406               
407                prints "The Following are Required and Apply to ALL DIMMs";
408               
409                $l = "Row Densities";
410                $temp="";
411                if (($bytes[15] & 1) > 0) { $temp .= "4 MByte\n";}
412                if (($bytes[15] & 2) > 0) { $temp .= "8 MByte\n"; }
413                if (($bytes[15] & 4) > 0) { $temp .= "16 MByte\n"; }
414                if (($bytes[15] & 8) > 0) { $temp .= "32 MByte\n"; }
415                if (($bytes[15] & 16) > 0) { $temp .= "64 MByte\n"; }
416                if (($bytes[15] & 32) > 0) { $temp .= "128 MByte\n"; }
417                if (($bytes[15] & 64) > 0) { $temp .= "256 MByte\n"; }
418                if (($bytes[15] & 128) > 0) { $temp .= "512 MByte\n"; }
419                if ($bytes[15] == 0) { $temp .= "(Undefined! -- None Reported!)\n";}
420                printl $l, $temp;
421               
422               
423# Decode next 16 bytes (32-47)
424                $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/20`;
425                @bytes=split(" ");
426                for my $j ( 0 .. 15 ) { $dimm_checksum = $dimm_checksum + $bytes[$j];  }
427               
428                prints "The Following are Proposed and Apply to SDRAM DIMMs";
429               
430                $l = "Command and Address Signal Setup Time";
431                $temp = (($bytes[0] & 0x7f) >> 4) + ($bytes[0] & 0xf) * 0.1;
432                printl $l, ( ($bytes[0] >> 7) ? -$temp : $temp ) . "nS";
433               
434                $l = "Command and Address Signal Hold Time";
435                $temp = (($bytes[1] & 0x7f) >> 4) + ($bytes[1] & 0xf) * 0.1;
436                printl $l, ( ($bytes[1] >> 7) ? -$temp : $temp ) . "nS";
437               
438                $l = "Data Signal Setup Time";
439                $temp =(($bytes[2] & 0x7f) >> 4) + ($bytes[2] & 0xf) * 0.1;
440                printl $l, ( ($bytes[2] >> 7) ? -$temp : $temp ) . "nS";
441               
442                $l = "Data Signal Hold Time";
443                $temp = (($bytes[3] & 0x7f) >> 4) + ($bytes[3] & 0xf) * 0.1;
444                printl $l, ( ($bytes[3] >> 7) ? -$temp : $temp ) . "nS";
445
446# That's it for the lower part of an SDRAM EEPROM's memory!
447# Decode next 16 bytes (48-63)
448                $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/30`;
449                @bytes=split(" ");
450                for my $j ( 0 .. 14 ) { $dimm_checksum = $dimm_checksum + $bytes[$j];  }
451
452                printl "SPD Revision code ", sprintf("%x", $bytes[14]);
453                $l = "EEPROM Checksum of bytes 0-62";
454                $dimm_checksum &= 0xff;
455                printl $l, ($bytes[15]==$dimm_checksum?
456                        sprintf("OK (0x%.2X)",$bytes[15]):
457                        sprintf("Bad (found 0x%.2X, calculated 0x%.2X)\n",$bytes[15],$dimm_checksum));
458
459                if($bytes[15]==$dimm_checksum || $opt_igncheck) {
460# Decode next 16 bytes (64-79)
461                $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/40`;
462                @bytes=split(" ");
463               
464                $l = "Manufacturer's JEDEC ID Code";
465                $temp = sprintf("0x%.2X%.2X%.2X%.2X%.2X%.2X%.2X%.2X\n",$bytes[0],$bytes[1],$bytes[2],$bytes[3],$bytes[4],$bytes[5],$bytes[6],$bytes[7]);
466                printl $l, $temp;
467                $temp = pack("c8",
468                        $bytes[0],$bytes[1],$bytes[2],$bytes[3],$bytes[4],$bytes[5],$bytes[6],$bytes[7]);
469                printl $l, "(\"$temp\")";
470               
471                $l = "Manufacturing Location Code";
472                $temp = sprintf("0x%.2X\n",$bytes[8]);
473                printl $l, $temp;
474               
475                $l = "Manufacurer's Part Number";
476# Decode next 16 bytes (80-95)
477                $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/50`;
478                my @bytes2 = split ' ';
479                $temp = pack("c18",$bytes[9],$bytes[10],$bytes[11],$bytes[12],$bytes[13],$bytes[14],$bytes[15],
480                        $bytes2[0],$bytes2[1],$bytes2[2],$bytes2[3],$bytes2[4],$bytes2[5],$bytes2[6],$bytes2[7],$bytes2[8],$bytes2[9],$bytes2[10]);
481                printl $l, $temp;
482               
483                $l = "Revision Code";
484                $temp = sprintf("0x%.2X%.2X\n",$bytes2[11],$bytes2[12]);
485                printl $l, $temp;
486               
487                $l = "Manufacturing Date";
488                $temp = sprintf("0x%.2X%.2X\n",$bytes2[13],$bytes2[14]);
489                printl $l, $temp;
490               
491                $l = "Assembly Serial Number";
492# Decode next 16 bytes (96-111)
493                $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/60`;
494                @bytes=split(" ");
495               
496                $temp = sprintf("0x%.2X%.2X%.2X%.2X\n",$bytes2[15],$bytes[0],$bytes[1],$bytes[2]);
497# Decode next 16 bytes (112-127)
498                $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/70`;
499                @bytes=split(" ");
500               
501                $l = "Intel Specification for Frequency";
502                if ($bytes[14] == 102) { printl $l, "66MHz\n"; }
503                elsif ($bytes[14] == 100) { printl $l, "100MHz\n"; }
504                else { printl $l, "Undefined!\n"; }
505               
506                $l = "Intel Spec Details for 100MHz Support";
507                $temp="";
508                if (($bytes[15] & 1) > 0) { $temp .= "Intel Concurrent AutoPrecharge\n";}
509                if (($bytes[15] & 2) > 0) { $temp .= "CAS Latency = 2\n";}
510                if (($bytes[15] & 4) > 0) { $temp .= "CAS Latency = 3\n";}
511                if (($bytes[15] & 8) > 0) { $temp .= "Junction Temp A (90 degrees C)\n";}
512                if (($bytes[15] & 8) == 0) { $temp .= "Junction Temp B (100 degrees C)\n";}
513                if (($bytes[15] & 16) > 0) { $temp .= "CLK 3 Connected\n";}
514                if (($bytes[15] & 32) > 0) { $temp .= "CLK 2 Connected\n";}
515                if (($bytes[15] & 64) > 0) { $temp .= "CLK 1 Connected\n";}
516                if (($bytes[15] & 128) > 0) { $temp .= "CLK 0 Connected\n";}
517                if ($bytes[15] > 175) { $temp .= "Double Sided DIMM\n"; }
518                else { $temp .= "Single Sided DIMM\n";}
519                printl $l, $temp;
520                }
521               
522                print "</table>\n" if $opt_html;
523        }
524}
525print '<br><br>' if $opt_html;
526printl2 "Number of SDRAM DIMMs detected and decoded", $dimm_count;
527
528print "</body></html>\n" if $opt_body;
529print "\nTry '$0 --format' for html output.\n" unless $opt_html;
Note: See TracBrowser for help on using the browser.