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

Revision 1590, 19.0 KB (checked in by khali, 11 years ago)

Forgot to update the inline help

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