Adding upstream version 3.86+dfsg.
[syslinux-debian/hramrach.git] / com32 / gpllib / dmi / dmi_processor.c
blob1cd9d1ba9fc0f06751908b6e5c44b848f763268f
1 /* ----------------------------------------------------------------------- *
3 * Pportions of this file taken from the dmidecode project
5 * Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
6 * Copyright (C) 2002-2008 Jean Delvare <khali@linux-fr.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * For the avoidance of doubt the "preferred form" of this code is one which
23 * is in an open unpatent encumbered format. Where cryptographic key signing
24 * forms part of the process of creating an executable the information
25 * including keys needed to generate an equivalently functional executable
26 * are deemed to be part of the source code.
29 #include <dmi/dmi.h>
30 #include <stdio.h>
32 const char *dmi_processor_type(uint8_t code)
34 /* 3.3.5.1 */
35 static const char *type[] = {
36 "Other", /* 0x01 */
37 "Unknown",
38 "Central Processor",
39 "Math Processor",
40 "DSP Processor",
41 "Video Processor" /* 0x06 */
44 if (code >= 0x01 && code <= 0x06)
45 return type[code - 0x01];
46 return out_of_spec;
49 const char *dmi_processor_family(uint8_t code, char *manufacturer)
51 /* 3.3.5.2 */
52 static const char *family[256] = {
53 NULL, /* 0x00 */
54 "Other",
55 "Unknown",
56 "8086",
57 "80286",
58 "80386",
59 "80486",
60 "8087",
61 "80287",
62 "80387",
63 "80487",
64 "Pentium",
65 "Pentium Pro",
66 "Pentium II",
67 "Pentium MMX",
68 "Celeron",
69 "Pentium II Xeon",
70 "Pentium III",
71 "M1",
72 "M2",
73 "Celeron M", /* 0x14 */
74 "Pentium 4 HT",
75 NULL,
76 NULL, /* 0x17 */
77 "Duron",
78 "K5",
79 "K6",
80 "K6-2",
81 "K6-3",
82 "Athlon",
83 "AMD2900",
84 "K6-2+",
85 "Power PC",
86 "Power PC 601",
87 "Power PC 603",
88 "Power PC 603+",
89 "Power PC 604",
90 "Power PC 620",
91 "Power PC x704",
92 "Power PC 750",
93 "Core 2 Duo", /* 0x28 */
94 "Core 2 Duo Mobile",
95 "Core Solo Mobile",
96 "Atom",
97 NULL,
98 NULL,
99 NULL,
100 NULL, /* 0x2F */
101 "Alpha",
102 "Alpha 21064",
103 "Alpha 21066",
104 "Alpha 21164",
105 "Alpha 21164PC",
106 "Alpha 21164a",
107 "Alpha 21264",
108 "Alpha 21364",
109 NULL, /* 0x38 */
110 NULL,
111 NULL,
112 NULL,
113 NULL,
114 NULL,
115 NULL,
116 NULL, /* 0x3F */
117 "MIPS",
118 "MIPS R4000",
119 "MIPS R4200",
120 "MIPS R4400",
121 "MIPS R4600",
122 "MIPS R10000",
123 NULL, /* 0x46 */
124 NULL,
125 NULL,
126 NULL,
127 NULL,
128 NULL,
129 NULL,
130 NULL,
131 NULL,
132 NULL, /* 0x4F */
133 "SPARC",
134 "SuperSPARC",
135 "MicroSPARC II",
136 "MicroSPARC IIep",
137 "UltraSPARC",
138 "UltraSPARC II",
139 "UltraSPARC IIi",
140 "UltraSPARC III",
141 "UltraSPARC IIIi",
142 NULL, /* 0x59 */
143 NULL,
144 NULL,
145 NULL,
146 NULL,
147 NULL,
148 NULL, /* 0x5F */
149 "68040",
150 "68xxx",
151 "68000",
152 "68010",
153 "68020",
154 "68030",
155 NULL, /* 0x66 */
156 NULL,
157 NULL,
158 NULL,
159 NULL,
160 NULL,
161 NULL,
162 NULL,
163 NULL,
164 NULL, /* 0x6F */
165 "Hobbit",
166 NULL, /* 0x71 */
167 NULL,
168 NULL,
169 NULL,
170 NULL,
171 NULL,
172 NULL, /* 0x77 */
173 "Crusoe TM5000",
174 "Crusoe TM3000",
175 "Efficeon TM8000",
176 NULL, /* 0x7B */
177 NULL,
178 NULL,
179 NULL,
180 NULL, /* 0x7F */
181 "Weitek",
182 NULL, /* 0x81 */
183 "Itanium",
184 "Athlon 64",
185 "Opteron",
186 "Sempron",
187 "Turion 64", /* 0x86 */
188 "Dual-Core Opteron",
189 "Atlhon 64 X2",
190 "Turion 64 X2",
191 "Quad-Core Opteron",
192 "Third-Generation Opteron",
193 "Phenom FX",
194 "Phenom X4",
195 "Phenom X2",
196 "Athlon X2", /* 0x8F */
197 "PA-RISC",
198 "PA-RISC 8500",
199 "PA-RISC 8000",
200 "PA-RISC 7300LC",
201 "PA-RISC 7200",
202 "PA-RISC 7100LC",
203 "PA-RISC 7100",
204 NULL, /* 0x97 */
205 NULL,
206 NULL,
207 NULL,
208 NULL,
209 NULL,
210 NULL,
211 NULL,
212 NULL, /* 0x9F */
213 "V30",
214 "Quad-Core Xeon 3200", /* 0xA1 */
215 "Dual-Core Xeon 3000",
216 "Quad-Core Xeon 5300",
217 "Dual-Core Xeon 5100",
218 "Dual-Core Xeon 5000",
219 "Dual-Core Xeon LV",
220 "Dual-Core Xeon ULV",
221 "Dual-Core Xeon 7100",
222 "Quad-Core Xeon 5400",
223 "Quad-Core Xeon", /* 0xAA */
224 NULL,
225 NULL,
226 NULL,
227 NULL,
228 NULL, /* 0xAF */
229 "Pentium III Xeon",
230 "Pentium III Speedstep",
231 "Pentium 4",
232 "Xeon",
233 "AS400",
234 "Xeon MP",
235 "Athlon XP",
236 "Athlon MP",
237 "Itanium 2",
238 "Pentium M",
239 "Celeron D", /* 0xBA */
240 "Pentium D",
241 "Pentium EE",
242 "Core Solo", /* 0xBD */
243 NULL,
244 "Core 2 Duo",
245 "Core 2 Solo",
246 "Core 2 Extreme",
247 "Core 2 Quad",
248 "Core 2 Extreme Mobile",
249 "Core 2 Duo Mobile",
250 "Core 2 Solo Mobile",
251 NULL,
252 NULL, /* 0xC7 */
253 "IBM390",
254 "G4",
255 "G5",
256 "ESA/390 G6", /* 0xCB */
257 "z/Architectur",
258 NULL,
259 NULL,
260 NULL,
261 NULL, /*0xD0 */
262 NULL,
263 "C7-M",
264 "C7-D",
265 "C7",
266 "Eden",
267 NULL, /*0xD6 */
268 NULL,
269 NULL,
270 NULL,
271 NULL,
272 NULL,
273 NULL,
274 NULL,
275 NULL,
276 NULL,
277 NULL, /*0xE0 */
278 NULL,
279 NULL,
280 NULL,
281 NULL,
282 NULL,
283 "Embedded Opteron Quad-Core", /* 0xE6 */
284 "Phenom Triple-Core",
285 "Turion Ultra Dual-Core Mobile",
286 "Turion Dual-Core Mobile",
287 "Athlon Dual-Core",
288 "Sempron SI", /*0xEB */
289 NULL,
290 NULL,
291 NULL,
292 NULL,
293 NULL,
294 NULL,
295 NULL,
296 NULL,
297 NULL,
298 NULL,
299 NULL,
300 NULL,
301 NULL,
302 NULL, /* 0xF9 */
303 "i860",
304 "i960",
305 NULL, /* 0xFC */
306 NULL,
307 NULL,
308 NULL, /* 0xFF */
310 /* Special case for ambiguous value 0xBE */
311 if (code == 0xBE) {
312 /* Best bet based on manufacturer string */
313 if (strstr(manufacturer, "Intel") != NULL
314 || strncasecmp(manufacturer, "Intel", 5) == 0)
315 return "Core 2";
316 if (strstr(manufacturer, "AMD") != NULL
317 || strncasecmp(manufacturer, "AMD", 3) == 0)
318 return "K7";
319 return "Core 2 or K7";
322 if (family[code] != NULL) {
323 return family[code];
325 return out_of_spec;
328 const char *dmi_processor_status(uint8_t code)
330 static const char *status[] = {
331 "Unknown", /* 0x00 */
332 "Enabled",
333 "Disabled By User",
334 "Disabled By BIOS",
335 "Idle", /* 0x04 */
336 "<OUT OF SPEC>",
337 "<OUT OF SPEC>",
338 "Other" /* 0x07 */
341 if (code <= 0x04)
342 return status[code];
343 if (code == 0x07)
344 return status[0x05];
345 return out_of_spec;
348 const char *dmi_processor_upgrade(uint8_t code)
350 /* 3.3.5.5 */
351 static const char *upgrade[] = {
352 "Other", /* 0x01 */
353 "Unknown",
354 "Daughter Board",
355 "ZIF Socket",
356 "Replaceable Piggy Back",
357 "None",
358 "LIF Socket",
359 "Slot 1",
360 "Slot 2",
361 "370-pin Socket",
362 "Slot A",
363 "Slot M",
364 "Socket 423",
365 "Socket A (Socket 462)",
366 "Socket 478",
367 "Socket 754",
368 "Socket 940",
369 "Socket 939" /* 0x12 */
370 "Socket mPGA604",
371 "Socket LGA771",
372 "Socket LGA775",
373 "Socket S1",
374 "Socket AM2",
375 "Socket F (1207)"
378 if (code >= 0x01 && code <= 0x18)
379 return upgrade[code - 0x01];
380 return out_of_spec;
383 void dmi_processor_cache(uint16_t code, const char *level, uint16_t ver,
384 char *cache)
386 if (code == 0xFFFF) {
387 if (ver >= 0x0203)
388 sprintf(cache, "Not Provided");
389 else
390 sprintf(cache, "No %s Cache", level);
391 } else
392 sprintf(cache, "0x%04X", code);
395 /* Intel AP-485 revision 28, table 5 */
396 const char *cpu_flags_strings[PROCESSOR_FLAGS_ELEMENTS] = {
397 "FPU (Floating-point unit on-chip)", /* 0 */
398 "VME (Virtual mode extension)",
399 "DE (Debugging extension)",
400 "PSE (Page size extension)",
401 "TSC (Time stamp counter)",
402 "MSR (Model specific registers)",
403 "PAE (Physical address extension)",
404 "MCE (Machine check exception)",
405 "CX8 (CMPXCHG8 instruction supported)",
406 "APIC (On-chip APIC hardware supported)",
407 NULL, /* 10 */
408 "SEP (Fast system call)",
409 "MTRR (Memory type range registers)",
410 "PGE (Page global enable)",
411 "MCA (Machine check architecture)",
412 "CMOV (Conditional move instruction supported)",
413 "PAT (Page attribute table)",
414 "PSE-36 (36-bit page size extension)",
415 "PSN (Processor serial number present and enabled)",
416 "CLFSH (CLFLUSH instruction supported)",
417 NULL, /* 20 */
418 "DS (Debug store)",
419 "ACPI (ACPI supported)",
420 "MMX (MMX technology supported)",
421 "FXSR (Fast floating-point save and restore)",
422 "SSE (Streaming SIMD extensions)",
423 "SSE2 (Streaming SIMD extensions 2)",
424 "SS (Self-snoop)",
425 "HTT (Hyper-threading technology)",
426 "TM (Thermal monitor supported)",
427 "IA64 (IA64 capabilities)", /* 30 */
428 "PBE (Pending break enabled)" /* 31 */