xref: /openbmc/ipmitool/lib/dimm_spd.c (revision 02e4a036)
1 /*
2  * Copyright (c) 2003 Sun Microsystems, Inc.  All Rights Reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistribution of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistribution in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * Neither the name of Sun Microsystems, Inc. or the names of
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * This software is provided "AS IS," without a warranty of any kind.
20  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
21  * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
22  * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
23  * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
24  * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
25  * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL
26  * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
27  * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
28  * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
29  * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
30  * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
31  */
32 
33 #include <ipmitool/ipmi.h>
34 #include <ipmitool/log.h>
35 #include <ipmitool/helper.h>
36 #include <ipmitool/ipmi_intf.h>
37 #include <ipmitool/ipmi_fru.h>
38 
39 #include <stdlib.h>
40 #include <string.h>
41 
42 extern int verbose;
43 
44 /*
45  * Also, see ipmi_fru.c.
46  *
47  * Apparently some systems have problems with FRU access greater than 16 bytes
48  * at a time, even when using byte (not word) access.	 In order to ensure we
49  * work with the widest variety of hardware request size is capped at 16 bytes.
50  * Since this may result in slowdowns on some systems with lots of FRU data you
51  * can change this define to enable larger (up to 32 bytes at a time) access.
52  */
53 #define FRU_DATA_RQST_SIZE 16;
54 
55 const struct valstr spd_memtype_vals[] = {
56 	{ 0x01, "STD FPM DRAM" },
57 	{ 0x02, "EDO" },
58 	{ 0x04, "SDRAM" },
59 	{ 0x05, "ROM" },
60 	{ 0x06, "DDR SGRAM" },
61 	{ 0x07, "DDR SDRAM" },
62 	{ 0x08, "DDR2 SDRAM" },
63 	{ 0x09, "DDR2 SDRAM FB-DIMM" },
64 	{ 0x0A, "DDR2 SDRAM FB-DIMM Probe" },
65 	{ 0x0B, "DDR3 SDRAM" },
66 	{ 0x00, NULL },
67 };
68 
69 const struct valstr ddr3_density_vals[] =
70 {
71 	{ 0, "256 Mb" },
72 	{ 1, "512 Mb" },
73 	{ 2, "1 Gb" },
74 	{ 3, "2 Gb" },
75 	{ 4, "4 Gb" },
76 	{ 5, "8 Gb" },
77 	{ 6, "16 Gb" },
78 	{ 0x00, NULL },
79 };
80 
81 const struct valstr ddr3_banks_vals[] =
82 {
83 	{ 0, "3 (8 Banks)" },
84 	{ 1, "4 (16 Banks)" },
85 	{ 2, "5 (32 Banks)" },
86 	{ 3, "6 (64 Banks)" },
87 	{ 0x00, NULL },
88 };
89 
90 const struct valstr ddr3_ecc_vals[] =
91 {
92 	{ 0, "0 bits" },
93 	{ 1, "8 bits" },
94 	{ 0x00, NULL },
95 };
96 
97 const struct valstr spd_config_vals[] = {
98 	{ 0x00, "None" },
99 	{ 0x01, "Parity" },
100 	{ 0x02, "ECC" },
101 	{ 0x04, "Addr Cmd Parity" },
102 	{ 0x00, NULL },
103 };
104 
105 const struct valstr spd_voltage_vals[] = {
106 	{ 0x00, "5.0V TTL" },
107 	{ 0x01, "LVTTL" },
108 	{ 0x02, "HSTL 1.5V" },
109 	{ 0x03, "SSTL 3.3V" },
110 	{ 0x04, "SSTL 2.5V" },
111 	{ 0x05, "SSTL 1.8V" },
112 	{ 0x00, NULL },
113 };
114 
115 /*
116  * JEDEC Standard Manufacturers Identification Code
117  * publication JEP106N, December 2003
118  */
119 
120 const struct valstr jedec_id1_vals[] = {
121 	{ 0x01, "AMD" },
122 	{ 0x02, "AMI" },
123 	{ 0x83, "Fairchild" },
124 	{ 0x04, "Fujitsu" },
125 	{ 0x85, "GTE" },
126 	{ 0x86, "Harris" },
127 	{ 0x07, "Hitachi" },
128 	{ 0x08, "Inmos" },
129 	{ 0x89, "Intel" },
130 	{ 0x8a, "I.T.T." },
131 	{ 0x0b, "Intersil" },
132 	{ 0x8c, "Monolithic Memories" },
133 	{ 0x0d, "Mostek" },
134 	{ 0x0e, "Motorola" },
135 	{ 0x8f, "National" },
136 	{ 0x10, "NEC" },
137 	{ 0x91, "RCA" },
138 	{ 0x92, "Raytheon" },
139 	{ 0x13, "Conexant (Rockwell)" },
140 	{ 0x94, "Seeq" },
141 	{ 0x15, "Philips Semi. (Signetics)" },
142 	{ 0x16, "Synertek" },
143 	{ 0x97, "Texas Instruments" },
144 	{ 0x98, "Toshiba" },
145 	{ 0x19, "Xicor" },
146 	{ 0x1a, "Zilog" },
147 	{ 0x9b, "Eurotechnique" },
148 	{ 0x1c, "Mitsubishi" },
149 	{ 0x9d, "Lucent (AT&T)" },
150 	{ 0x9e, "Exel" },
151 	{ 0x1f, "Atmel" },
152 	{ 0x20, "SGS/Thomson" },
153 	{ 0xa1, "Lattice Semi." },
154 	{ 0xa2, "NCR" },
155 	{ 0x23, "Wafer Scale Integration" },
156 	{ 0xa4, "IBM" },
157 	{ 0x25, "Tristar" },
158 	{ 0x26, "Visic" },
159 	{ 0xa7, "Intl. CMOS Technology" },
160 	{ 0xa8, "SSSI" },
161 	{ 0x29, "Microchip Technology" },
162 	{ 0x2a, "Ricoh Ltd." },
163 	{ 0xab, "VLSI" },
164 	{ 0x2c, "Micron Technology" },
165 	{ 0xad, "Hyundai Electronics" },
166 	{ 0xae, "OKI Semiconductor" },
167 	{ 0x2f, "ACTEL" },
168 	{ 0xb0, "Sharp" },
169 	{ 0x31, "Catalyst" },
170 	{ 0x32, "Panasonic" },
171 	{ 0xb3, "IDT" },
172 	{ 0x34, "Cypress" },
173 	{ 0xb5, "DEC" },
174 	{ 0xb6, "LSI Logic" },
175 	{ 0x37, "Zarlink" },
176 	{ 0x38, "UTMC" },
177 	{ 0xb9, "Thinking Machine" },
178 	{ 0xba, "Thomson CSF" },
179 	{ 0x3b, "Integrated CMOS(Vertex)" },
180 	{ 0xbc, "Honeywell" },
181 	{ 0x3d, "Tektronix" },
182 	{ 0x3e, "Sun Microsystems" },
183 	{ 0xbf, "SST" },
184 	{ 0x40, "MOSEL" },
185 	{ 0xc1, "Infineon" },
186 	{ 0xc2, "Macronix" },
187 	{ 0x43, "Xerox" },
188 	{ 0xc4, "Plus Logic" },
189 	{ 0x45, "SunDisk" },
190 	{ 0x46, "Elan Circuit Tech." },
191 	{ 0xc7, "European Silicon Str." },
192 	{ 0xc8, "Apple Computer" },
193 	{ 0xc9, "Xilinx" },
194 	{ 0x4a, "Compaq" },
195 	{ 0xcb, "Protocol Engines" },
196 	{ 0x4c, "SCI" },
197 	{ 0xcd, "Seiko Instruments" },
198 	{ 0xce, "Samsung" },
199 	{ 0x4f, "I3 Design System" },
200 	{ 0xd0, "Klic" },
201 	{ 0x51, "Crosspoint Solutions" },
202 	{ 0x52, "Alliance Semiconductor" },
203 	{ 0xd3, "Tandem" },
204 	{ 0x54, "Hewlett-Packard" },
205 	{ 0xd5, "Intg. Silicon Solutions" },
206 	{ 0xd6, "Brooktree" },
207 	{ 0x57, "New Media" },
208 	{ 0x58, "MHS Electronic" },
209 	{ 0xd9, "Performance Semi." },
210 	{ 0xda, "Winbond Electronic" },
211 	{ 0x5b, "Kawasaki Steel" },
212 	{ 0xdc, "Bright Micro" },
213 	{ 0x5d, "TECMAR" },
214 	{ 0x5e, "Exar" },
215 	{ 0xdf, "PCMCIA" },
216 	{ 0xe0, "LG Semiconductor" },
217 	{ 0x61, "Northern Telecom" },
218 	{ 0x62, "Sanyo" },
219 	{ 0xe3, "Array Microsystems" },
220 	{ 0x64, "Crystal Semiconductor" },
221 	{ 0xe5, "Analog Devices" },
222 	{ 0xe6, "PMC-Sierra" },
223 	{ 0x67, "Asparix" },
224 	{ 0x68, "Convex Computer" },
225 	{ 0xe9, "Quality Semiconductor" },
226 	{ 0xea, "Nimbus Technology" },
227 	{ 0x6b, "Transwitch" },
228 	{ 0xec, "Micronas (ITT Intermetall)" },
229 	{ 0x6d, "Cannon" },
230 	{ 0x6e, "Altera" },
231 	{ 0xef, "NEXCOM" },
232 	{ 0x70, "QUALCOMM" },
233 	{ 0xf1, "Sony" },
234 	{ 0xf2, "Cray Research" },
235 	{ 0x73, "AMS (Austria Micro)" },
236 	{ 0xf4, "Vitesse" },
237 	{ 0x75, "Aster Electronics" },
238 	{ 0x76, "Bay Networks (Synoptic)" },
239 	{ 0xf7, "Zentrum" },
240 	{ 0xf8, "TRW" },
241 	{ 0x79, "Thesys" },
242 	{ 0x7a, "Solbourne Computer" },
243 	{ 0xfb, "Allied-Signal" },
244 	{ 0x7c, "Dialog" },
245 	{ 0xfd, "Media Vision" },
246 	{ 0xfe, "Level One Communication" },
247 	{ 0x00, NULL },
248 };
249 
250 const struct valstr jedec_id2_vals[] = {
251 	{ 0x01, "Cirrus Logic" },
252 	{ 0x02, "National Instruments" },
253 	{ 0x83, "ILC Data Device" },
254 	{ 0x04, "Alcatel Mietec" },
255 	{ 0x85, "Micro Linear" },
256 	{ 0x86, "Univ. of NC" },
257 	{ 0x07, "JTAG Technologies" },
258 	{ 0x08, "Loral" },
259 	{ 0x89, "Nchip" },
260 	{ 0x8A, "Galileo Tech" },
261 	{ 0x0B, "Bestlink Systems" },
262 	{ 0x8C, "Graychip" },
263 	{ 0x0D, "GENNUM" },
264 	{ 0x0E, "VideoLogic" },
265 	{ 0x8F, "Robert Bosch" },
266 	{ 0x10, "Chip Express" },
267 	{ 0x91, "DATARAM" },
268 	{ 0x92, "United Microelec Corp." },
269 	{ 0x13, "TCSI" },
270 	{ 0x94, "Smart Modular" },
271 	{ 0x15, "Hughes Aircraft" },
272 	{ 0x16, "Lanstar Semiconductor" },
273 	{ 0x97, "Qlogic" },
274 	{ 0x98, "Kingston" },
275 	{ 0x19, "Music Semi" },
276 	{ 0x1A, "Ericsson Components" },
277 	{ 0x9B, "SpaSE" },
278 	{ 0x1C, "Eon Silicon Devices" },
279 	{ 0x9D, "Programmable Micro Corp" },
280 	{ 0x9E, "DoD" },
281 	{ 0x1F, "Integ. Memories Tech." },
282 	{ 0x20, "Corollary Inc." },
283 	{ 0xA1, "Dallas Semiconductor" },
284 	{ 0xA2, "Omnivision" },
285 	{ 0x23, "EIV(Switzerland)" },
286 	{ 0xA4, "Novatel Wireless" },
287 	{ 0x25, "Zarlink (formerly Mitel)" },
288 	{ 0x26, "Clearpoint" },
289 	{ 0xA7, "Cabletron" },
290 	{ 0xA8, "Silicon Technology" },
291 	{ 0x29, "Vanguard" },
292 	{ 0x2A, "Hagiwara Sys-Com" },
293 	{ 0xAB, "Vantis" },
294 	{ 0x2C, "Celestica" },
295 	{ 0xAD, "Century" },
296 	{ 0xAE, "Hal Computers" },
297 	{ 0x2F, "Rohm Company Ltd." },
298 	{ 0xB0, "Juniper Networks" },
299 	{ 0x31, "Libit Signal Processing" },
300 	{ 0x32, "Enhanced Memories Inc." },
301 	{ 0xB3, "Tundra Semiconductor" },
302 	{ 0x34, "Adaptec Inc." },
303 	{ 0xB5, "LightSpeed Semi." },
304 	{ 0xB6, "ZSP Corp." },
305 	{ 0x37, "AMIC Technology" },
306 	{ 0x38, "Adobe Systems" },
307 	{ 0xB9, "Dynachip" },
308 	{ 0xBA, "PNY Electronics" },
309 	{ 0x3B, "Newport Digital" },
310 	{ 0xBC, "MMC Networks" },
311 	{ 0x3D, "T Square" },
312 	{ 0x3E, "Seiko Epson" },
313 	{ 0xBF, "Broadcom" },
314 	{ 0x40, "Viking Components" },
315 	{ 0xC1, "V3 Semiconductor" },
316 	{ 0xC2, "Flextronics (formerly Orbit)" },
317 	{ 0x43, "Suwa Electronics" },
318 	{ 0xC4, "Transmeta" },
319 	{ 0x45, "Micron CMS" },
320 	{ 0x46, "American Computer & Digital Components Inc" },
321 	{ 0xC7, "Enhance 3000 Inc" },
322 	{ 0xC8, "Tower Semiconductor" },
323 	{ 0x49, "CPU Design" },
324 	{ 0x4A, "Price Point" },
325 	{ 0xCB, "Maxim Integrated Product" },
326 	{ 0x4C, "Tellabs" },
327 	{ 0xCD, "Centaur Technology" },
328 	{ 0xCE, "Unigen Corporation" },
329 	{ 0x4F, "Transcend Information" },
330 	{ 0xD0, "Memory Card Technology" },
331 	{ 0x51, "CKD Corporation Ltd." },
332 	{ 0x52, "Capital Instruments, Inc." },
333 	{ 0xD3, "Aica Kogyo, Ltd." },
334 	{ 0x54, "Linvex Technology" },
335 	{ 0xD5, "MSC Vertriebs GmbH" },
336 	{ 0xD6, "AKM Company, Ltd." },
337 	{ 0x57, "Dynamem, Inc." },
338 	{ 0x58, "NERA ASA" },
339 	{ 0xD9, "GSI Technology" },
340 	{ 0xDA, "Dane-Elec (C Memory)" },
341 	{ 0x5B, "Acorn Computers" },
342 	{ 0xDC, "Lara Technology" },
343 	{ 0x5D, "Oak Technology, Inc." },
344 	{ 0x5E, "Itec Memory" },
345 	{ 0xDF, "Tanisys Technology" },
346 	{ 0xE0, "Truevision" },
347 	{ 0x61, "Wintec Industries" },
348 	{ 0x62, "Super PC Memory" },
349 	{ 0xE3, "MGV Memory" },
350 	{ 0x64, "Galvantech" },
351 	{ 0xE5, "Gadzoox Nteworks" },
352 	{ 0xE6, "Multi Dimensional Cons." },
353 	{ 0x67, "GateField" },
354 	{ 0x68, "Integrated Memory System" },
355 	{ 0xE9, "Triscend" },
356 	{ 0xEA, "XaQti" },
357 	{ 0x6B, "Goldenram" },
358 	{ 0xEC, "Clear Logic" },
359 	{ 0x6D, "Cimaron Communications" },
360 	{ 0x6E, "Nippon Steel Semi. Corp." },
361 	{ 0xEF, "Advantage Memory" },
362 	{ 0x70, "AMCC" },
363 	{ 0xF1, "LeCroy" },
364 	{ 0xF2, "Yamaha Corporation" },
365 	{ 0x73, "Digital Microwave" },
366 	{ 0xF4, "NetLogic Microsystems" },
367 	{ 0x75, "MIMOS Semiconductor" },
368 	{ 0x76, "Advanced Fibre" },
369 	{ 0xF7, "BF Goodrich Data." },
370 	{ 0xF8, "Epigram" },
371 	{ 0x79, "Acbel Polytech Inc." },
372 	{ 0x7A, "Apacer Technology" },
373 	{ 0xFB, "Admor Memory" },
374 	{ 0x7C, "FOXCONN" },
375 	{ 0xFD, "Quadratics Superconductor" },
376 	{ 0xFE, "3COM" },
377 	{ 0x00, NULL },
378 };
379 
380 const struct valstr jedec_id3_vals[] = {
381 	{ 0x01, "Camintonn Corporation" },
382 	{ 0x02, "ISOA Incorporated" },
383 	{ 0x83, "Agate Semiconductor" },
384 	{ 0x04, "ADMtek Incorporated" },
385 	{ 0x85, "HYPERTEC" },
386 	{ 0x86, "Adhoc Technologies" },
387 	{ 0x07, "MOSAID Technologies" },
388 	{ 0x08, "Ardent Technologies" },
389 	{ 0x89, "Switchcore" },
390 	{ 0x8A, "Cisco Systems, Inc." },
391 	{ 0x0B, "Allayer Technologies" },
392 	{ 0x8C, "WorkX AG" },
393 	{ 0x0D, "Oasis Semiconductor" },
394 	{ 0x0E, "Novanet Semiconductor" },
395 	{ 0x8F, "E-M Solutions" },
396 	{ 0x10, "Power General" },
397 	{ 0x91, "Advanced Hardware Arch." },
398 	{ 0x92, "Inova Semiconductors GmbH" },
399 	{ 0x13, "Telocity" },
400 	{ 0x94, "Delkin Devices" },
401 	{ 0x15, "Symagery Microsystems" },
402 	{ 0x16, "C-Port Corporation" },
403 	{ 0x97, "SiberCore Technologies" },
404 	{ 0x98, "Southland Microsystems" },
405 	{ 0x19, "Malleable Technologies" },
406 	{ 0x1A, "Kendin Communications" },
407 	{ 0x9B, "Great Technology Microcomputer" },
408 	{ 0x1C, "Sanmina Corporation" },
409 	{ 0x9D, "HADCO Corporation" },
410 	{ 0x9E, "Corsair" },
411 	{ 0x1F, "Actrans System Inc." },
412 	{ 0x20, "ALPHA Technologies" },
413 	{ 0xA1, "Cygnal Integrated Products Incorporated" },
414 	{ 0xA2, "Artesyn Technologies" },
415 	{ 0x23, "Align Manufacturing" },
416 	{ 0xA4, "Peregrine Semiconductor" },
417 	{ 0x25, "Chameleon Systems" },
418 	{ 0x26, "Aplus Flash Technology" },
419 	{ 0xA7, "MIPS Technologies" },
420 	{ 0xA8, "Chrysalis ITS" },
421 	{ 0x29, "ADTEC Corporation" },
422 	{ 0x2A, "Kentron Technologies" },
423 	{ 0xAB, "Win Technologies" },
424 	{ 0x2C, "ASIC Designs Inc" },
425 	{ 0xAD, "Extreme Packet Devices" },
426 	{ 0xAE, "RF Micro Devices" },
427 	{ 0x2F, "Siemens AG" },
428 	{ 0xB0, "Sarnoff Corporation" },
429 	{ 0x31, "Itautec Philco SA" },
430 	{ 0x32, "Radiata Inc." },
431 	{ 0xB3, "Benchmark Elect. (AVEX)" },
432 	{ 0x34, "Legend" },
433 	{ 0xB5, "SpecTek Incorporated" },
434 	{ 0xB6, "Hi/fn" },
435 	{ 0x37, "Enikia Incorporated" },
436 	{ 0x38, "SwitchOn Networks" },
437 	{ 0xB9, "AANetcom Incorporated" },
438 	{ 0xBA, "Micro Memory Bank" },
439 	{ 0x3B, "ESS Technology" },
440 	{ 0xBC, "Virata Corporation" },
441 	{ 0x3D, "Excess Bandwidth" },
442 	{ 0x3E, "West Bay Semiconductor" },
443 	{ 0xBF, "DSP Group" },
444 	{ 0x40, "Newport Communications" },
445 	{ 0xC1, "Chip2Chip Incorporated" },
446 	{ 0xC2, "Phobos Corporation" },
447 	{ 0x43, "Intellitech Corporation" },
448 	{ 0xC4, "Nordic VLSI ASA" },
449 	{ 0x45, "Ishoni Networks" },
450 	{ 0x46, "Silicon Spice" },
451 	{ 0xC7, "Alchemy Semiconductor" },
452 	{ 0xC8, "Agilent Technologies" },
453 	{ 0x49, "Centillium Communications" },
454 	{ 0x4A, "W.L. Gore" },
455 	{ 0xCB, "HanBit Electronics" },
456 	{ 0x4C, "GlobeSpan" },
457         { 0xCD, "Element 14" },
458 	{ 0xCE, "Pycon" },
459 	{ 0x4F, "Saifun Semiconductors" },
460 	{ 0xD0, "Sibyte, Incorporated" },
461 	{ 0x51, "MetaLink Technologies" },
462 	{ 0x52, "Feiya Technology" },
463 	{ 0xD3, "I & C Technology" },
464 	{ 0x54, "Shikatronics" },
465 	{ 0xD5, "Elektrobit" },
466 	{ 0xD6, "Megic" },
467 	{ 0x57, "Com-Tier" },
468 	{ 0x58, "Malaysia Micro Solutions" },
469 	{ 0xD9, "Hyperchip" },
470 	{ 0xDA, "Gemstone Communications" },
471 	{ 0x5B, "Anadyne Microelectronics" },
472 	{ 0xDC, "3ParData" },
473 	{ 0x5D, "Mellanox Technologies" },
474 	{ 0x5E, "Tenx Technologies" },
475 	{ 0xDF, "Helix AG" },
476 	{ 0xE0, "Domosys" },
477 	{ 0x61, "Skyup Technology" },
478 	{ 0x62, "HiNT Corporation" },
479 	{ 0xE3, "Chiaro" },
480 	{ 0x64, "MCI Computer GMBH" },
481 	{ 0xE5, "Exbit Technology A/S" },
482 	{ 0xE6, "Integrated Technology Express" },
483 	{ 0x67, "AVED Memory" },
484 	{ 0x68, "Legerity" },
485 	{ 0xE9, "Jasmine Networks" },
486 	{ 0xEA, "Caspian Networks" },
487 	{ 0x6B, "nCUBE" },
488 	{ 0xEC, "Silicon Access Networks" },
489 	{ 0x6D, "FDK Corporation" },
490 	{ 0x6E, "High Bandwidth Access" },
491 	{ 0xEF, "MultiLink Technology" },
492 	{ 0x70, "BRECIS" },
493 	{ 0xF1, "World Wide Packets" },
494 	{ 0xF2, "APW" },
495 	{ 0x73, "Chicory Systems" },
496 	{ 0xF4, "Xstream Logic" },
497 	{ 0x75, "Fast-Chip" },
498 	{ 0x76, "Zucotto Wireless" },
499 	{ 0xF7, "Realchip" },
500 	{ 0xF8, "Galaxy Power" },
501 	{ 0x79, "eSilicon" },
502 	{ 0x7A, "Morphics Technology" },
503 	{ 0xFB, "Accelerant Networks" },
504 	{ 0x7C, "Silicon Wave" },
505 	{ 0xFD, "SandCraft" },
506 	{ 0xFE, "Elpida" },
507 	{ 0x00, NULL },
508 };
509 
510 const struct valstr jedec_id4_vals[] = {
511 	{ 0x01, "Solectron" },
512 	{ 0x02, "Optosys Technologies" },
513 	{ 0x83, "Buffalo (Formerly Melco)" },
514 	{ 0x04, "TriMedia Technologies" },
515 	{ 0x85, "Cyan Technologies" },
516 	{ 0x86, "Global Locate" },
517 	{ 0x07, "Optillion" },
518 	{ 0x08, "Terago Communications" },
519 	{ 0x89, "Ikanos Communications" },
520 	{ 0x8A, "Princeton Technology" },
521 	{ 0x0B, "Nanya Technology" },
522 	{ 0x8C, "Elite Flash Storage" },
523 	{ 0x0D, "Mysticom" },
524 	{ 0x0E, "LightSand Communications" },
525 	{ 0x8F, "ATI Technologies" },
526 	{ 0x10, "Agere Systems" },
527 	{ 0x91, "NeoMagic" },
528 	{ 0x92, "AuroraNetics" },
529 	{ 0x13, "Golden Empire" },
530 	{ 0x94, "Muskin" },
531 	{ 0x15, "Tioga Technologies" },
532 	{ 0x16, "Netlist" },
533 	{ 0x97, "TeraLogic" },
534 	{ 0x98, "Cicada Semiconductor" },
535 	{ 0x19, "Centon Electronics" },
536 	{ 0x1A, "Tyco Electronics" },
537 	{ 0x9B, "Magis Works" },
538 	{ 0x1C, "Zettacom" },
539 	{ 0x9D, "Cogency Semiconductor" },
540 	{ 0x9E, "Chipcon AS" },
541 	{ 0x1F, "Aspex Technology" },
542 	{ 0x20, "F5 Networks" },
543 	{ 0xA1, "Programmable Silicon Solutions" },
544 	{ 0xA2, "ChipWrights" },
545 	{ 0x23, "Acorn Networks" },
546 	{ 0xA4, "Quicklogic" },
547 	{ 0x25, "Kingmax Semiconductor" },
548 	{ 0x26, "BOPS" },
549 	{ 0xA7, "Flasys" },
550 	{ 0xA8, "BitBlitz Communications" },
551 	{ 0x29, "eMemory Technology" },
552 	{ 0x2A, "Procket Networks" },
553 	{ 0xAB, "Purple Ray" },
554 	{ 0x2C, "Trebia Networks" },
555 	{ 0xAD, "Delta Electronics" },
556 	{ 0xAE, "Onex Communications" },
557 	{ 0x2F, "Ample Communications" },
558 	{ 0xB0, "Memory Experts Intl" },
559 	{ 0x31, "Astute Networks" },
560 	{ 0x32, "Azanda Network Devices" },
561 	{ 0xB3, "Dibcom" },
562 	{ 0x34, "Tekmos" },
563 	{ 0xB5, "API NetWorks" },
564 	{ 0xB6, "Bay Microsystems" },
565 	{ 0x37, "Firecron Ltd" },
566 	{ 0x38, "Resonext Communications" },
567 	{ 0xB9, "Tachys Technologies" },
568 	{ 0xBA, "Equator Technology" },
569 	{ 0x3B, "Concept Computer" },
570 	{ 0xBC, "SILCOM" },
571 	{ 0x3D, "3Dlabs" },
572 	{ 0x3E, "ct Magazine" },
573 	{ 0xBF, "Sanera Systems" },
574 	{ 0x40, "Silicon Packets" },
575 	{ 0xC1, "Viasystems Group" },
576 	{ 0xC2, "Simtek" },
577 	{ 0x43, "Semicon Devices Singapore" },
578 	{ 0xC4, "Satron Handelsges" },
579 	{ 0x45, "Improv Systems" },
580 	{ 0x46, "INDUSYS GmbH" },
581 	{ 0xC7, "Corrent" },
582 	{ 0xC8, "Infrant Technologies" },
583 	{ 0x49, "Ritek Corp" },
584 	{ 0x4A, "empowerTel Networks" },
585 	{ 0xCB, "Hypertec" },
586 	{ 0x4C, "Cavium Networks" },
587 	{ 0xCD, "PLX Technology" },
588 	{ 0xCE, "Massana Design" },
589 	{ 0x4F, "Intrinsity" },
590 	{ 0xD0, "Valence Semiconductor" },
591 	{ 0x51, "Terawave Communications" },
592 	{ 0x52, "IceFyre Semiconductor" },
593 	{ 0xD3, "Primarion" },
594 	{ 0x54, "Picochip Designs Ltd" },
595 	{ 0xD5, "Silverback Systems" },
596 	{ 0xD6, "Jade Star Technologies" },
597 	{ 0x57, "Pijnenburg Securealink" },
598 	{ 0x58, "MemorySolutioN" },
599 	{ 0xD9, "Cambridge Silicon Radio" },
600 	{ 0xDA, "Swissbit" },
601 	{ 0x5B, "Nazomi Communications" },
602 	{ 0xDC, "eWave System" },
603 	{ 0x5D, "Rockwell Collins" },
604 	{ 0x5E, "PAION" },
605 	{ 0xDF, "Alphamosaic Ltd" },
606 	{ 0xE0, "Sandburst" },
607 	{ 0x61, "SiCon Video" },
608 	{ 0x62, "NanoAmp Solutions" },
609 	{ 0xE3, "Ericsson Technology" },
610 	{ 0x64, "PrairieComm" },
611 	{ 0xE5, "Mitac International" },
612 	{ 0xE6, "Layer N Networks" },
613 	{ 0x67, "Atsana Semiconductor" },
614 	{ 0x68, "Allegro Networks" },
615 	{ 0xE9, "Marvell Semiconductors" },
616 	{ 0xEA, "Netergy Microelectronic" },
617 	{ 0x6B, "NVIDIA" },
618 	{ 0xEC, "Internet Machines" },
619 	{ 0x6D, "Peak Electronics" },
620 	{ 0xEF, "Accton Technology" },
621 	{ 0x70, "Teradiant Networks" },
622 	{ 0xF1, "Europe Technologies" },
623 	{ 0xF2, "Cortina Systems" },
624 	{ 0x73, "RAM Components" },
625 	{ 0xF4, "Raqia Networks" },
626 	{ 0x75, "ClearSpeed" },
627 	{ 0x76, "Matsushita Battery" },
628 	{ 0xF7, "Xelerated" },
629 	{ 0xF8, "SimpleTech" },
630 	{ 0x79, "Utron Technology" },
631 	{ 0x7A, "Astec International" },
632 	{ 0xFB, "AVM gmbH" },
633 	{ 0x7C, "Redux Communications" },
634 	{ 0xFD, "Dot Hill Systems" },
635 	{ 0xFE, "TeraChip" },
636 	{ 0x00, NULL },
637 };
638 
639 const struct valstr jedec_id5_vals[] = {
640 	{ 0x01, "T-RAM Incorporated" },
641 	{ 0x02, "Innovics Wireless" },
642 	{ 0x83, "Teknovus" },
643 	{ 0x04, "KeyEye Communications" },
644 	{ 0x85, "Runcom Technologies" },
645 	{ 0x86, "RedSwitch" },
646 	{ 0x07, "Dotcast" },
647 	{ 0x08, "Silicon Mountain Memory" },
648 	{ 0x89, "Signia Technologies" },
649 	{ 0x8A, "Pixim" },
650 	{ 0x0B, "Galazar Networks" },
651 	{ 0x8C, "White Electronic Designs" },
652 	{ 0x0D, "Patriot Scientific" },
653 	{ 0x0E, "Neoaxiom Corporation" },
654 	{ 0x8F, "3Y Power Technology" },
655 	{ 0x10, "Europe Technologies" },
656 	{ 0x91, "Potentia Power Systems" },
657 	{ 0x92, "C-guys Incorporated" },
658 	{ 0x13, "Digital Communications Technology Incorporated" },
659 	{ 0x94, "Silicon-Based Technology" },
660 	{ 0x15, "Fulcrum Microsystems" },
661 	{ 0x16, "Positivo Informatica Ltd" },
662 	{ 0x97, "XIOtech Corporation" },
663 	{ 0x98, "PortalPlayer" },
664 	{ 0x19, "Zhiying Software" },
665 	{ 0x1A, "Direct2Data" },
666 	{ 0x9B, "Phonex Broadband" },
667 	{ 0x1C, "Skyworks Solutions" },
668 	{ 0x9D, "Entropic Communications" },
669 	{ 0x9E, "Pacific Force Technology" },
670 	{ 0x1F, "Zensys A/S" },
671 	{ 0x20, "Legend Silicon Corp." },
672 	{ 0xA1, "sci-worx GmbH" },
673 	{ 0xA2, "Oasis Silicon Systems" },
674 	{ 0x23, "Renesas Technology" },
675 	{ 0xA4, "Raza Microelectronics" },
676 	{ 0x25, "Phyworks" },
677 	{ 0x26, "MediaTek" },
678 	{ 0xA7, "Non-cents Productions" },
679 	{ 0xA8, "US Modular" },
680 	{ 0x29, "Wintegra Ltd" },
681 	{ 0x2A, "Mathstar" },
682 	{ 0xAB, "StarCore" },
683 	{ 0x2C, "Oplus Technologies" },
684 	{ 0xAD, "Mindspeed" },
685 	{ 0xAE, "Just Young Computer" },
686 	{ 0x2F, "Radia Communications" },
687 	{ 0xB0, "OCZ" },
688 	{ 0x31, "Emuzed" },
689 	{ 0x32, "LOGIC Devices" },
690 	{ 0xB3, "Inphi Corporation" },
691 	{ 0x34, "Quake Technologies" },
692 	{ 0xB5, "Vixel" },
693 	{ 0xB6, "SolusTek" },
694 	{ 0x37, "Kongsberg Maritime" },
695 	{ 0x38, "Faraday Technology" },
696 	{ 0xB9, "Altium Ltd." },
697 	{ 0xBA, "Insyte" },
698 	{ 0x3B, "ARM Ltd." },
699 	{ 0xBC, "DigiVision" },
700 	{ 0x3D, "Vativ Technologies" },
701 	{ 0x3E, "Endicott Interconnect Technologies" },
702 	{ 0xBF, "Pericom" },
703 	{ 0x40, "Bandspeed" },
704 	{ 0xC1, "LeWiz Communications" },
705 	{ 0xC2, "CPU Technology" },
706 	{ 0x43, "Ramaxel Technology" },
707 	{ 0xC4, "DSP Group" },
708 	{ 0x45, "Axis Communications" },
709 	{ 0x46, "Legacy Electronics" },
710 	{ 0xC7, "Chrontel" },
711 	{ 0xC8, "Powerchip Semiconductor" },
712 	{ 0x49, "MobilEye Technologies" },
713 	{ 0x4A, "Excel Semiconductor" },
714 	{ 0xCB, "A-DATA Technology" },
715 	{ 0x4C, "VirtualDigm" },
716 	{ 0x00, NULL },
717 };
718 
719 int
720 ipmi_spd_print(uint8_t *spd_data, int len)
721 {
722 	int k = 0;
723 	int ii = 0;
724 
725 	if (len < 92)
726 		return -1; /* we need first 91 bytes to do our thing */
727 
728 	printf(" Memory Type           : %s\n",
729 	       val2str(spd_data[2], spd_memtype_vals));
730 
731 	if (spd_data[2] == 0x0B)	/* DDR3 SDRAM */
732 	{
733 		int iPN;
734 		char *pchPN = spd_data+128;
735 		int sdram_cap = 0;
736 		int pri_bus_width = 0;
737 		int sdram_width = 0;
738 		int ranks = 0;
739 		int mem_size = 0;
740 
741 		if (len < 148)
742 			return -1; /* we need first 91 bytes to do our thing */
743 
744 
745 		sdram_cap = ldexp(256,(spd_data[4]&15));
746 		pri_bus_width = ldexp(8,(spd_data[8]&7));
747 		sdram_width = ldexp(4,(spd_data[7]&7));
748 		ranks = ldexp(1,((spd_data[7]&0x3F)>>3));
749 		mem_size = (sdram_cap/8) * (pri_bus_width/sdram_width) * ranks;
750 		printf(" SDRAM Capacity        : %d MB\n", sdram_cap );
751 		printf(" Memory Banks          : %s\n", val2str(spd_data[4]>>4, ddr3_banks_vals));
752 		printf(" Primary Bus Width     : %d bits\n", pri_bus_width );
753 		printf(" SDRAM Device Width    : %d bits\n", sdram_width );
754 		printf(" Number of Ranks       : %d\n", ranks );
755 		printf(" Memory size           : %d MB\n", mem_size );
756 
757 		/* printf(" Memory Density        : %s\n", val2str(spd_data[4]&15, ddr3_density_vals)); */
758 		printf(" 1.5 V Nominal Op      : %s\n", (((spd_data[6]&1) != 0) ? "No":"Yes" ) );
759 		printf(" 1.35 V Nominal Op     : %s\n", (((spd_data[6]&2) != 0) ? "No":"Yes" ) );
760 		printf(" 1.2X V Nominal Op     : %s\n", (((spd_data[6]&4) != 0) ? "No":"Yes" ) );
761 		printf(" Error Detect/Cor      : %s\n", val2str(spd_data[8]>>3, ddr3_ecc_vals));
762 
763 		printf(" Manufacturer          : ");
764 		switch (spd_data[117]&127)
765 		{
766 		case	0:
767 			printf("%s\n", val2str(spd_data[118], jedec_id1_vals));
768 			break;
769 
770 		case	1:
771 			printf("%s\n", val2str(spd_data[118], jedec_id2_vals));
772 			break;
773 
774 		case	2:
775 			printf("%s\n", val2str(spd_data[118], jedec_id3_vals));
776 			break;
777 
778 		case	3:
779 			printf("%s\n", val2str(spd_data[118], jedec_id4_vals));
780 			break;
781 
782 		case	4:
783 			printf("%s\n", val2str(spd_data[118], jedec_id5_vals));
784 			break;
785 
786 		default:
787 			printf("%s\n", "JEDEC JEP106 update required" );
788 
789 		}
790 
791 		printf(" Manufacture Date      : year %c%c week %c%c\n",
792 		'0'+(spd_data[120]>>4), '0'+(spd_data[120]&15), '0'+(spd_data[121]>>4), '0'+(spd_data[121]&15) );
793 
794 		printf(" Serial Number         : %02x%02x%02x%02x\n",
795 		spd_data[122], spd_data[123], spd_data[124], spd_data[125]);
796 
797 		printf(" Part Number           : ");
798 		for (iPN=0; iPN < 19; iPN++)
799 		{
800 			printf( "%c", *pchPN++ );
801 		}
802 		printf("\n");
803 	}
804 	else
805 	{
806 		ii = (spd_data[3] & 0x0f) + (spd_data[4] & 0x0f) - 17;
807 		k = ((spd_data[5] & 0x7) + 1) * spd_data[17];
808 
809 		if(ii > 0 && ii <= 12 && k > 0) {
810 			printf(" Memory Size           : %d MB\n", ((1 << ii) * k));
811 		} else {
812 			printf(" Memory Size    INVALID: %d, %d, %d, %d\n", spd_data[3],
813 					spd_data[4], spd_data[5], spd_data[17]);
814 		}
815 		printf(" Voltage Intf          : %s\n",
816 		val2str(spd_data[8], spd_voltage_vals));
817 		printf(" Error Detect/Cor      : %s\n",
818 		val2str(spd_data[11], spd_config_vals));
819 
820 		/* handle jedec table bank continuation values */
821 		printf(" Manufacturer          : ");
822 		if (spd_data[64] != 0x7f)
823 			printf("%s\n",
824 			val2str(spd_data[64], jedec_id1_vals));
825 		else {
826 			if (spd_data[65] != 0x7f)
827 				printf("%s\n",
828 				val2str(spd_data[65], jedec_id2_vals));
829 			else {
830 				if (spd_data[66] != 0x7f)
831 					printf("%s\n",
832 					val2str(spd_data[66], jedec_id3_vals));
833 				else {
834 					if (spd_data[67] != 0x7f)
835 						printf("%s\n",
836 						val2str(spd_data[67],
837 							jedec_id4_vals));
838 					else
839 						printf("%s\n",
840 						val2str(spd_data[68],
841 							jedec_id5_vals));
842 				}
843 			}
844 		}
845 
846 		if (spd_data[73]) {
847 			char part[19];
848 			memcpy(part, spd_data+73, 18);
849 			part[18] = 0;
850 			printf(" Part Number           : %s\n", part);
851 		}
852 
853 		printf(" Serial Number         : %02x%02x%02x%02x\n",
854 		spd_data[95], spd_data[96], spd_data[97], spd_data[98]);
855 	}
856 
857 	if (verbose) {
858 		printf("\n");
859 		printbuf(spd_data, len, "SPD DATA");
860 	}
861 
862 	return 0;
863 }
864 
865 int
866 ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
867 {
868 	struct ipmi_rs * rsp;
869 	struct ipmi_rq req;
870 	struct fru_info fru;
871 	uint8_t spd_data[256], msg_data[4];
872 	int len, offset;
873 
874 	msg_data[0] = id;
875 
876 	memset(&req, 0, sizeof(req));
877 	req.msg.netfn = IPMI_NETFN_STORAGE;
878 	req.msg.cmd = GET_FRU_INFO;
879 	req.msg.data = msg_data;
880 	req.msg.data_len = 1;
881 
882 	rsp = intf->sendrecv(intf, &req);
883 	if (rsp == NULL) {
884 		printf(" Device not present (No Response)\n");
885 		return -1;
886 	}
887 	if (rsp->ccode > 0) {
888 		printf(" Device not present (%s)\n",
889 		       val2str(rsp->ccode, completion_code_vals));
890 		return -1;
891 	}
892 
893 	fru.size = (rsp->data[1] << 8) | rsp->data[0];
894 	fru.access = rsp->data[2] & 0x1;
895 
896 	lprintf(LOG_DEBUG, "fru.size = %d bytes (accessed by %s)",
897 		fru.size, fru.access ? "words" : "bytes");
898 
899 	if (fru.size < 1) {
900 		lprintf(LOG_ERR, " Invalid FRU size %d", fru.size);
901 		return -1;
902 	}
903 
904 	memset(&req, 0, sizeof(req));
905 	req.msg.netfn = IPMI_NETFN_STORAGE;
906 	req.msg.cmd = GET_FRU_DATA;
907 	req.msg.data = msg_data;
908 	req.msg.data_len = 4;
909 
910 	offset = 0;
911 	memset(spd_data, 0, 256);
912 	do {
913 		msg_data[0] = id;
914 		msg_data[1] = offset;
915 		msg_data[2] = 0;
916 		msg_data[3] = FRU_DATA_RQST_SIZE;
917 
918 		rsp = intf->sendrecv(intf, &req);
919 		if (rsp == NULL) {
920 			printf(" Device not present (No Response)\n");
921 			return -1;
922 		}
923 		if (rsp->ccode > 0) {
924 			printf(" Device not present (%s)\n",
925 			       val2str(rsp->ccode, completion_code_vals));
926 
927 			/* Timeouts are acceptable. No DIMM in the socket */
928 			if (rsp->ccode == 0xc3)
929 				return 1;
930 
931 			return -1;
932 		}
933 
934 		len = rsp->data[0];
935 		memcpy(&spd_data[offset], rsp->data + 1, len);
936 		offset += len;
937 	} while (offset < fru.size);
938 
939 	/* now print spd info */
940 	ipmi_spd_print(spd_data, offset);
941 
942 	return 0;
943 }
944