grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / c / CPUInfo / x86_Intel.c
blob584fc709ce2acbc8ff319c4e129c98c4c3c3abb2
1 /*
2 Copyright © 2000, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Probe installed Intel CPUs and display relevant information
6 Lang: english
7 */
9 /* BIG TO DO - SEPERATE THE INDIVIDUAL PROCESSOR FAMILY "PROBES" INTO RUNTIME SHARED LIBS OR SIMILAR */
11 /****************************************************************************************************
12 Currently Supports:
14 i386 compatable families...
15 Intel P5/P54C/P55C/P24T/P6/P2/P3/PM/Itanium(IA-64)
17 *****************************************************************************************************/
19 #include "x86.h"
21 /********************************************
22 Structures
23 ********************************************/
25 #define i386_intel_MAXBRANDS 23
26 char *i386_intel_Brands[i386_intel_MAXBRANDS] = {
27 "not supported",
28 "0.18 µm Intel Celeron processor",
29 "0.18 µm Intel Pentium III processor",
30 "0.18 µm Intel Pentium III Xeon processor/0.13 µm Intel Celeron",
31 "0.13 µm Intel Pentium III processor",
32 "not supported",
33 "not supported",
34 "0.13 µm Intel Celeron mobile processor",
35 "0.18 µm Intel Pentium 4 processor/0.13 µm Intel Celeron 4 mobile (0F24h)",
36 "0.13 µm Intel Pentium 4 processor",
37 "0.18 µm Intel Celeron 4 ",
38 "0.18 µm Intel Pentium 4 Xeon MP/0.13 µm Intel Pentium 4 Xeon ",
39 "0.13 µm Intel Pentium 4 Xeon MP",
40 "not supported",
41 "0.13 µm Intel Pentium 4 mobile (production)",
42 "0.13 µm Intel Celeron 4 mobile (0F27h)/0.13 µm Intel Pentium 4 mobile (samples)",
43 "not supported",
44 "not supported",
45 "not supported",
46 "not supported",
47 "not supported",
48 "not supported",
49 "0.13 µm Intel Pentium M",
52 /********************************************
53 Intel CPU Features
54 ********************************************/
56 char *Intel_feature_flags[] = {
57 "FPU : Floating Point Unit",
58 "VME : Virtual 8086 Mode Enhancements",
59 "DE : Debugging Extensions",
60 "PSE : Page Size Extensions",
61 "TSC : Time Stamp Counter",
62 "MSR : Model Specific Registers",
63 "PAE : Physical Address Extension",
64 "MCE : Machine Check Exception",
65 "CX8 : COMPXCHG8B Instruction",
66 "APIC : On-chip Advanced Programmable Interrupt Controller present and enabled",
67 "10 : Reserved",
68 "SEP : Fast System Call",
69 "MTRR : Memory Type Range Registers",
70 "PGE : PTE Global Flag",
71 "MCA : Machine Check Architecture",
72 "CMOV : Conditional Move and Compare Instructions",
73 "FGPAT : Page Attribute Table",
74 "PSE-36 : 36-bit Page Size Extension",
75 "PN : Processor Serial Number present and enabled",
76 "CLFSH : CFLUSH instruction",
77 "20 : reserved",
78 "DS : Debug store",
79 "ACPI : Thermal Monitor and Clock Ctrl",
80 "MMX : MMX instruction set",
81 "FXSR : Fast FP/MMX Streaming SIMD Extensions save/restore",
82 "SSE : Streaming SIMD Extensions instruction set",
83 "SSE2 : SSE2 extensions",
84 "SS : Self Snoop",
85 "HT : Hyper Threading",
86 "TM : Thermal monitor",
87 "30 : reserved",
88 "31 : reserved",
91 /********************************************
92 Intel specific information
93 ********************************************/
95 /* Decode Intel TLB and cache info descriptors */
97 char *i386_intel_TLB_decode ( int tlb, char *BUFF_STR )
99 tlb &= 0xff;
100 if(tlb != 0) sprintf( BUFF_STR,"%02x: ",tlb);
102 sprintf( BUFF_STR," ");
104 switch ( tlb )
106 case 0:
107 break;
108 case 0x1:
109 sprintf( BUFF_STR,"Instruction TLB: 4KB pages, 4-way set assoc, 32 entries\n" );
110 break;
111 case 0x2:
112 sprintf( BUFF_STR,"Instruction TLB: 4MB pages, 4-way set assoc, 2 entries\n" );
113 break;
114 case 0x3:
115 sprintf( BUFF_STR,"Data TLB: 4KB pages, 4-way set assoc, 64 entries\n" );
116 break;
117 case 0x4:
118 sprintf( BUFF_STR,"Data TLB: 4MB pages, 4-way set assoc, 8 entries\n" );
119 break;
120 case 0x6:
121 sprintf( BUFF_STR,"1st-level instruction cache: 8KB, 4-way set assoc, 32 byte line size\n" );
122 break;
123 case 0x8:
124 sprintf( BUFF_STR,"1st-level instruction cache: 16KB, 4-way set assoc, 32 byte line size\n" );
125 break;
126 case 0xa:
127 sprintf( BUFF_STR,"1st-level data cache: 8KB, 2-way set assoc, 32 byte line size\n" );
128 break;
129 case 0xc:
130 sprintf( BUFF_STR,"1st-level data cache: 16KB, 4-way set assoc, 32 byte line size\n" );
131 break;
134 case 0x40:
135 sprintf( BUFF_STR,"No 2nd-level cache, or if 2nd-level cache exists, no 3rd-level cache\n" );
136 break;
137 case 0x41:
138 sprintf( BUFF_STR,"2nd-level cache: 128KB, 4-way set assoc, 32 byte line size\n" );
139 break;
140 case 0x42:
141 sprintf( BUFF_STR,"2nd-level cache: 256KB, 4-way set assoc, 32 byte line size\n" );
142 break;
143 case 0x43:
144 sprintf( BUFF_STR,"2nd-level cache: 512KB, 4-way set assoc, 32 byte line size\n" );
145 break;
146 case 0x44:
147 sprintf( BUFF_STR,"2nd-level cache: 1MB, 4-way set assoc, 32 byte line size\n" );
148 break;
149 case 0x45:
150 sprintf( BUFF_STR,"2nd-level cache: 2MB, 4-way set assoc, 32 byte line size\n" );
151 break;
154 case 0x50:
155 sprintf( BUFF_STR,"Instruction TLB: 4KB and 2MB or 4MB pages, 64 entries\n" );
156 break;
157 case 0x51:
158 sprintf( BUFF_STR,"Instruction TLB: 4KB and 2MB or 4MB pages, 128 entries\n" );
159 break;
160 case 0x52:
161 sprintf( BUFF_STR,"Instruction TLB: 4KB and 2MB or 4MB pages, 256 entries\n" );
162 break;
163 case 0x5b:
164 sprintf( BUFF_STR,"Data TLB: 4KB and 4MB pages, 64 entries\n" );
165 break;
166 case 0x5c:
167 sprintf( BUFF_STR,"Data TLB: 4KB and 4MB pages, 128 entries\n" );
168 break;
169 case 0x5d:
170 sprintf( BUFF_STR,"Data TLB: 4KB and 4MB pages, 256 entries\n" );
171 break;
174 case 0x66:
175 sprintf( BUFF_STR,"1st-level data cache: 8KB, 4-way set assoc, 64 byte line size\n" );
176 break;
177 case 0x67:
178 sprintf( BUFF_STR,"1st-level data cache: 16KB, 4-way set assoc, 64 byte line size\n" );
179 break;
180 case 0x68:
181 sprintf( BUFF_STR,"1st-level data cache: 32KB, 4-way set assoc, 64 byte line size\n" );
182 break;
185 case 0x70:
186 sprintf( BUFF_STR,"Trace cache: 12K-micro-op, 4-way set assoc\n" );
187 break;
188 case 0x71:
189 sprintf( BUFF_STR,"Trace cache: 16K-micro-op, 4-way set assoc\n" );
190 break;
191 case 0x72:
192 sprintf( BUFF_STR,"Trace cache: 32K-micro-op, 4-way set assoc\n" );
193 break;
196 case 0x79:
197 sprintf( BUFF_STR,"2nd-level cache: 128KB, 8-way set assoc, sectored, 64 byte line size\n" );
198 break;
199 case 0x7a:
200 sprintf( BUFF_STR,"2nd-level cache: 256KB, 8-way set assoc, sectored, 64 byte line size\n" );
201 break;
202 case 0x7b:
203 sprintf( BUFF_STR,"2nd-level cache: 512KB, 8-way set assoc, sectored, 64 byte line size\n" );
204 break;
205 case 0x7c:
206 sprintf( BUFF_STR,"2nd-level cache: 1MB, 8-way set assoc, sectored, 64 byte line size\n" );
207 break;
210 case 0x82:
211 sprintf( BUFF_STR,"2nd-level cache: 256KB, 8-way set assoc, 32 byte line size\n" );
212 break;
213 case 0x83:
214 sprintf( BUFF_STR,"2nd-level cache: 512KB, 8-way set assoc 32 byte line size\n" );
215 break;
216 case 0x84:
217 sprintf( BUFF_STR,"2nd-level cache: 1MB, 8-way set assoc, 32 byte line size\n" );
218 break;
219 case 0x85:
220 sprintf( BUFF_STR,"2nd-level cache: 2MB, 8-way set assoc, 32 byte line size\n" );
221 break;
224 default:
225 sprintf( BUFF_STR,"unknown TLB/cache descriptor\n" );
226 break;
229 return BUFF_STR;
232 /********************************************/
234 void parse_i386_Intel ( int maxi, struct i386_compat_intern * CPUi386 )
236 struct CPU_INTERN_DATA *global;
237 ULONG __unused__ speed, maxei,unused;
238 int __unused__ family = 0;
239 char *BUFF_STR, *Intel_CPU_NAME, *Intel_CPU_IDENTITY, *Intel_CPU_FEATURES, *Intel_CPU_CACHE, *Intel_CPU_ADDR;
240 int Intel_CPU_NAME_cnt, Intel_CPU_IDENTITY_cnt, Intel_CPU_FEATURES_cnt, Intel_CPU_CACHE_cnt, Intel_CPU_ADDR_cnt;
242 if ((global = AllocMem(sizeof(struct CPU_INTERN_DATA),MEMF_PUBLIC|MEMF_CLEAR)))
244 Intel_CPU_NAME = global->CPU_NAME;
245 Intel_CPU_IDENTITY = global->CPU_IDENTITY;
246 Intel_CPU_FEATURES = global->CPU_FEATURES;
247 Intel_CPU_CACHE = global->CPU_CACHE;
248 Intel_CPU_ADDR = global->CPU_ADDR;
249 BUFF_STR = global->CPU_BUFF;
251 Intel_CPU_NAME_cnt = Intel_CPU_IDENTITY_cnt = Intel_CPU_FEATURES_cnt = Intel_CPU_CACHE_cnt = Intel_CPU_ADDR_cnt = 0;
253 Intel_CPU_FEATURES_cnt = AddBufferLine( Intel_CPU_FEATURES_cnt, Intel_CPU_FEATURES, " Intel-specific functions\n" );
255 if ( maxi >= 1 ) /* Family/model/type etc */
257 int clf,apic_id,feature_flags;
258 int extended_model = -1,extended_family = -1;
259 unsigned long eax,ebx,edx,unused;
260 int stepping,model,family,type,reserved,brand,siblings;
261 int i;
263 i386_cpuid( 1, eax, ebx, unused, edx );
265 sprintf( BUFF_STR," Version %08lx:\n",eax);
266 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
268 stepping = eax & 0xf;
269 model = (eax >> 4) & 0xf;
270 family = (eax >> 8) & 0xf;
271 type = (eax >> 12) & 0x3;
272 reserved = eax >> 14;
274 clf = (ebx >> 8) & 0xff;
275 siblings = (ebx >> 16) & 0xff;
276 apic_id = (ebx >> 24) & 0xff;
278 feature_flags = edx;
280 sprintf( BUFF_STR," Type [%d] - ",type );
281 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
282 switch ( type )
284 case 0:
285 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Primary");
286 break;
287 case 1:
288 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Overdrive");
289 break;
290 case 2:
291 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Secondary");
292 break;
293 case 3:
294 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Reserved");
295 break;
298 sprintf( BUFF_STR," Family [%d] - ",family);
299 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
300 switch ( family )
302 case 3:
303 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "i386" );
304 break;
305 case 4:
306 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "i486" );
307 break;
308 case 5:
309 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium" );
310 break;
311 case 6:
312 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium Pro" );
313 break;
314 case 15:
315 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium 4" );
317 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "\n");
319 if ( family == 15 )
321 extended_family = (eax >> 20) & 0xff;
322 sprintf( BUFF_STR," Extended family %d",extended_family);
323 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
325 switch ( extended_family )
327 case 0:
328 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Intel P4" );
329 break;
330 case 1:
331 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Intel Itanium 2 (IA-64)" );
332 break;
336 sprintf( BUFF_STR," Model %d - ",model);
337 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
338 switch ( family )
340 case 3:
341 break;
342 case 4:
343 switch ( model )
345 case 0:
346 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "486DX-25/33");
347 break;
348 case 1:
349 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "486DX-50");
350 break;
351 case 2:
352 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "486SX");
353 break;
354 case 3:
355 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "486DX2");
356 break;
357 case 4:
358 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "486SL");
359 break;
360 case 5:
361 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "486SX2");
362 break;
363 case 7:
364 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "486DX2-WB (write-back enhanced)");
365 break;
366 case 8:
367 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "486DX4");
368 break;
369 case 9:
370 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "486DX4-WB (write-back enhanced)");
371 break;
373 break;
374 case 5:
375 switch ( model )
377 case 0:
378 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "P5 A-step");
379 break;
380 case 1:
381 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "P5");
382 break;
383 case 2:
384 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "P54C");
385 break;
386 case 3:
387 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "P24T Overdrive");
388 break;
389 case 4:
390 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "P55C");
391 break;
392 case 7:
393 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "P54C");
394 break;
395 case 8:
396 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "P55C (0.25µm)");
397 break;
399 break;
400 case 6:
401 switch ( model )
403 case 0:
404 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium Pro (P6 A-step)");
405 break;
406 case 1:
407 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium Pro (P6)");
408 break;
409 case 3:
410 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium II Model 3 (0.28 µm)");
411 break;
412 case 5:
413 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium II Model 5/Xeon/Celeron (0.25 µm)");
414 break;
415 case 6:
416 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Celeron (PII with on-die L2 cache)");
417 break;
418 case 7:
419 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium III/Pentium III Xeon external L2 cache (0.25 µm)");
420 break;
421 case 8:
422 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium III/Pentium III Xeon with 256 KB on-die L2 cache (0.18 µm)");
423 break;
424 case 9:
425 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "PM - with 1 MB on-die L2 cache (0.13 µm)");
426 break;
427 case 10:
428 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium III with 1 or 2 MB on-die L2 cache (0.18 µm)");
429 break;
430 case 11:
431 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium III with 256 or 512 KB on-die L2 cache (0.13 µm)");
432 break;
434 break;
435 case 15:
436 switch ( model )
438 case 0:
439 case 1:
440 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium 4/Celeron (0.18)");
441 break;
442 case 2:
443 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium 4/Celeron (0.13)");
444 break;
445 case 3:
446 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "Pentium 4 (0.09)");
447 break;
449 break;
452 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "\n");
454 if ( model == 15 )
456 extended_model = (eax >> 16) & 0xf;
457 sprintf( BUFF_STR," Extended model %d\n",extended_model);
458 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
461 sprintf( BUFF_STR," Stepping %d\n",stepping);
462 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
464 sprintf( BUFF_STR," Reserved %d\n\n",reserved);
465 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
467 brand = ebx & 0xff;
468 if ( brand > 0 )
470 sprintf( BUFF_STR," Brand index: %d [",brand);
471 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
472 if (brand < i386_intel_MAXBRANDS)
474 sprintf( BUFF_STR,"%s]\n",i386_intel_Brands[brand]);
475 Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, BUFF_STR);
477 else Intel_CPU_IDENTITY_cnt = AddBufferLine(Intel_CPU_IDENTITY_cnt, Intel_CPU_IDENTITY, "not in table]\n");
480 i386_cpuid( 0x80000000, eax, ebx, unused, edx );
481 if ( eax & 0x80000000 ) /* Extended feature/signature bits supported */
483 int maxe = eax;
484 if( maxe >= 0x80000004 )
486 int i;
488 Intel_CPU_NAME_cnt = AddBufferLine(Intel_CPU_NAME_cnt, Intel_CPU_NAME, " Extended brand string: \"" );
489 for( i=0x80000002; i<=0x80000004 ;i++ )
491 unsigned long eax,ebx,ecx,edx;
493 i386_cpuid(i,eax,ebx,ecx,edx);
494 Intel_CPU_NAME_cnt = i386_sprintregs(Intel_CPU_NAME_cnt, Intel_CPU_NAME, eax,ebx,ecx,edx);
496 Intel_CPU_NAME_cnt = AddBufferLine(Intel_CPU_NAME_cnt, Intel_CPU_NAME, "\"\n");
499 if ( clf )
501 sprintf( BUFF_STR," CLFLUSH instruction cache line size: %d\n", clf );
502 Intel_CPU_FEATURES_cnt = AddBufferLine(Intel_CPU_FEATURES_cnt, Intel_CPU_FEATURES, BUFF_STR);
505 if ( apic_id )
507 sprintf( BUFF_STR," Initial APIC ID: %d\n", apic_id );
508 Intel_CPU_FEATURES_cnt = AddBufferLine(Intel_CPU_FEATURES_cnt, Intel_CPU_FEATURES, BUFF_STR);
511 if ( feature_flags & (1<<28) )
513 sprintf( BUFF_STR," Hyper threading siblings: %d\n", siblings );
514 Intel_CPU_FEATURES_cnt = AddBufferLine(Intel_CPU_FEATURES_cnt, Intel_CPU_FEATURES, BUFF_STR);
517 sprintf( BUFF_STR,"\n Feature flags [%08x]:\n", feature_flags );
518 Intel_CPU_FEATURES_cnt = AddBufferLine(Intel_CPU_FEATURES_cnt, Intel_CPU_FEATURES, BUFF_STR);
519 for(i=0;i<32;i++)
521 if( feature_flags & (1<<i) )
523 sprintf( BUFF_STR," %s\n", Intel_feature_flags[i] );
524 Intel_CPU_FEATURES_cnt = AddBufferLine(Intel_CPU_FEATURES_cnt, Intel_CPU_FEATURES, BUFF_STR);
527 Intel_CPU_FEATURES_cnt = AddBufferLine(Intel_CPU_FEATURES_cnt, Intel_CPU_FEATURES, "\n");
530 if ( maxi >= 2 ) /* Decode TLB and cache info */
532 int ntlb,i;
534 ntlb = 255;
535 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, " TLB and cache info:\n");
536 for( i=0; i<ntlb ;i++ )
538 unsigned long eax,ebx,ecx,edx;
540 i386_cpuid(2,eax,ebx,ecx,edx);
541 ntlb = eax & 0xff;
542 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( eax >> 8, BUFF_STR ));
543 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( eax >> 16, BUFF_STR ));
544 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( eax >> 24, BUFF_STR ));
546 if (( ebx & 0x80000000 ) == 0 )
548 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( ebx, BUFF_STR ));
549 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( ebx >> 8, BUFF_STR ));
550 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( ebx >> 16, BUFF_STR ));
551 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( ebx >> 24, BUFF_STR ));
553 if (( ecx & 0x80000000 ) == 0 )
555 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( ecx, BUFF_STR ));
556 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( ecx >> 8, BUFF_STR ));
557 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( ecx >> 16, BUFF_STR ));
558 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( ecx >> 24, BUFF_STR ));
560 if (( edx & 0x80000000 ) == 0 )
562 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( edx, BUFF_STR ));
563 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( edx >> 8, BUFF_STR ));
564 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( edx >> 16, BUFF_STR ));
565 Intel_CPU_CACHE_cnt = AddBufferLine(Intel_CPU_CACHE_cnt, Intel_CPU_CACHE, i386_intel_TLB_decode( edx >> 24, BUFF_STR ));
570 if ( maxi >= 3 ) /* Pentium III CPU serial number */
572 unsigned long signature,unused,ecx,edx;
574 i386_cpuid(1,signature,unused,unused,unused);
575 i386_cpuid(3,unused,unused,ecx,edx);
577 Intel_CPU_NAME_cnt = AddBufferLine(Intel_CPU_NAME_cnt, Intel_CPU_NAME, " Processor serial: ");
579 sprintf( BUFF_STR,"%04lX",signature >> 16);
580 Intel_CPU_NAME_cnt = AddBufferLine(Intel_CPU_NAME_cnt, Intel_CPU_NAME, BUFF_STR);
581 sprintf( BUFF_STR,"-%04lX",signature & 0xffff);
582 Intel_CPU_NAME_cnt = AddBufferLine(Intel_CPU_NAME_cnt, Intel_CPU_NAME, BUFF_STR);
583 sprintf( BUFF_STR,"-%04lX",edx >> 16);
584 Intel_CPU_NAME_cnt = AddBufferLine(Intel_CPU_NAME_cnt, Intel_CPU_NAME, BUFF_STR);
585 sprintf( BUFF_STR,"-%04lX",edx & 0xffff);
586 Intel_CPU_NAME_cnt = AddBufferLine(Intel_CPU_NAME_cnt, Intel_CPU_NAME, BUFF_STR);
587 sprintf( BUFF_STR,"-%04lX",ecx >> 16);
588 Intel_CPU_NAME_cnt = AddBufferLine(Intel_CPU_NAME_cnt, Intel_CPU_NAME, BUFF_STR);
589 sprintf( BUFF_STR,"-%04lX\n",ecx & 0xffff);
590 Intel_CPU_NAME_cnt = AddBufferLine(Intel_CPU_NAME_cnt, Intel_CPU_NAME, BUFF_STR);
593 /** DUMP ALL THE INFORMATION WE HAVE GATHERED **/
595 if ( Intel_CPU_NAME_cnt > 0 ) printf( Intel_CPU_NAME ); /* CPUs Retail Name */
597 speed = i386_approx_mhz();
599 /* TODO : Calculate FSB .. */
601 if ( Intel_CPU_IDENTITY_cnt > 0 ) printf( Intel_CPU_IDENTITY ); /* CPUs Internal Name */
602 if ( Intel_CPU_FEATURES_cnt > 0 ) printf( Intel_CPU_FEATURES ); /* CPUs Feature Set */
603 if ( Intel_CPU_ADDR_cnt > 0 ) printf( Intel_CPU_ADDR ); /* CPUs Address Range */
604 if ( Intel_CPU_CACHE_cnt > 0 ) printf( Intel_CPU_CACHE ); /* CPUs Cache Details */
606 else
608 printf( "ERROR: Couldn't allocate memory to parse CPU information .." );
609 return;
611 FreeMem(global,sizeof(struct CPU_INTERN_DATA));