2 Copyright © 2000, The AROS Development Team. All rights reserved.
5 Desc: Probe installed Cyrix CPUs and display relevant information
9 /* BIG TO DO - SEPERATE THE INDIVIDUAL PROCESSOR FAMILY "PROBES" INTO RUNTIME SHARED LIBS OR SIMILAR */
11 /****************************************************************************************************
14 i386 compatable families...
15 Cyrix 5x86/M1/MediaGX/M2
17 *****************************************************************************************************/
21 /********************************************
23 ********************************************/
25 char *Cyrix_standard_feature_flags_5
[] = {
26 "FPU : Floating Point Unit",
27 "V86 : Virtual Mode Extensions",
30 " : Time Stamp Counter",
31 " : i386_rdmsr/WRMSR (Model Specific Registers)",
33 " : Machine Check Exception",
34 " : COMPXCHG8B Instruction",
35 "APIC : APIC - On-chip Advanced Programmable Interrupt Controller present and enabled",
38 "MTRR : Memory Type Range Registers",
41 "CMOV : Conditional Move Instruction",
49 " : MMX instructions",
59 char *Cyrix_standard_feature_flags_not5
[] = {
60 "FPU : Floating Point Unit",
61 "V86 : Virtual Mode Extensions",
64 " : Time Stamp Counter",
65 " : i386_rdmsr/WRMSR (Model Specific Registers)",
67 " : Machine Check Exception",
68 " : COMPXCHG8B Instruction",
69 " : APIC - On-chip Advanced Programmable Interrupt Controller present and enabled",
72 "MTRR : Memory Type Range Registers",
73 " : Global Paging Extension",
75 "CMOV : Conditional Move Instruction",
83 " : MMX instructions",
93 char *Cyrix_extended_feature_flags
[] = {
94 "FPU : Floating Point Unit",
95 "V86 : Virtual Mode Extensions",
97 " : Page Size Extensions",
98 " : Time Stamp Counter",
125 " : 3DNow instructions",
128 /********************************************
129 Cyrix specific information
130 ********************************************/
132 char *i386_cyrix_TLB_decode ( int tlb
, char *BUFF_STR
)
139 sprintf( BUFF_STR
, " TLB: 32 entries 4-way associative 4KB pages\n" );
142 sprintf( BUFF_STR
, " L1 Cache: 16KB 4-way associative 16 bytes/line\n" );
149 /********************************************/
151 void parse_i386_Cyrix ( int maxi
, struct i386_compat_intern
* CPUi386
)
153 struct CPU_INTERN_DATA
*global
;
154 ULONG __unused__ speed
, maxei
,unused
;
155 int __unused__ family
= 0;
156 char *BUFF_STR
, *Cyrix_CPU_NAME
, *Cyrix_CPU_IDENTITY
, *Cyrix_CPU_FEATURES
, *Cyrix_CPU_CACHE
, *Cyrix_CPU_ADDR
;
157 int Cyrix_CPU_NAME_cnt
, Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_FEATURES_cnt
, Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_ADDR_cnt
;
159 if ((global
= AllocMem(sizeof(struct CPU_INTERN_DATA
),MEMF_PUBLIC
|MEMF_CLEAR
)))
161 Cyrix_CPU_NAME
= global
->CPU_NAME
;
162 Cyrix_CPU_IDENTITY
= global
->CPU_IDENTITY
;
163 Cyrix_CPU_FEATURES
= global
->CPU_FEATURES
;
164 Cyrix_CPU_CACHE
= global
->CPU_CACHE
;
165 Cyrix_CPU_ADDR
= global
->CPU_ADDR
;
166 BUFF_STR
= global
->CPU_BUFF
;
168 Cyrix_CPU_NAME_cnt
= Cyrix_CPU_IDENTITY_cnt
= Cyrix_CPU_FEATURES_cnt
= Cyrix_CPU_CACHE_cnt
= Cyrix_CPU_ADDR_cnt
= 0;
170 Cyrix_CPU_FEATURES_cnt
= AddBufferLine( Cyrix_CPU_FEATURES_cnt
, Cyrix_CPU_FEATURES
, " Cyrix-specific functions\n" );
172 i386_cpuid(0x80000000,maxei
,unused
,unused
,unused
);
174 /* Do standard stuff */
177 unsigned long eax
,unused
,edx
;
178 int __unused__ stepping
,model
,family
,reserved
;
180 i386_cpuid(1,eax
,unused
,unused
,edx
);
182 stepping
= eax
& 0xf;
183 model
= (eax
>> 4) & 0xf;
184 family
= (eax
>> 8) & 0xf;
185 reserved
= eax
>> 12;
187 sprintf( BUFF_STR
," Family: %d Model: %d [",family
,model
);
188 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, BUFF_STR
);
195 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "5x86");
203 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "6x86");
206 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "GX, GXm");
214 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "6x86MX");
219 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "]\n\n");
221 if ( family
== 5 && model
== 0 )
225 for ( i
=0 ; i
<32 ; i
++ )
229 sprintf( BUFF_STR
," %s\n",Cyrix_standard_feature_flags_5
[i
]);
230 Cyrix_CPU_FEATURES_cnt
= AddBufferLine(Cyrix_CPU_FEATURES_cnt
, Cyrix_CPU_FEATURES
, BUFF_STR
);
238 for ( i
=0 ; i
<32 ; i
++ )
242 sprintf( BUFF_STR
," %s\n",Cyrix_standard_feature_flags_not5
[i
]);
243 Cyrix_CPU_FEATURES_cnt
= AddBufferLine(Cyrix_CPU_FEATURES_cnt
, Cyrix_CPU_FEATURES
, BUFF_STR
);
249 if ( maxi
>= 2 ) /* TLB and L1 Cache info */
254 for( i
=0 ; i
<ntlb
; i
++ )
256 unsigned long eax
,edx
,unused
;
258 i386_cpuid( 2, eax
, unused
, unused
, edx
);
261 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( eax
>> 8, BUFF_STR
));
262 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( eax
>> 16, BUFF_STR
));
263 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( eax
>> 24, BUFF_STR
));
265 /* ebx and ecx are reserved */
267 if (( edx
& 0x80000000 ) == 0 )
269 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( edx
, BUFF_STR
));
270 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( edx
>> 8, BUFF_STR
));
271 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( edx
>> 16, BUFF_STR
));
272 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( edx
>> 24, BUFF_STR
));
278 if ( maxei
< 0x80000000 ) return; /* Check for presence of extended info */
281 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "\n Extended info:\n");
283 if ( maxei
>= 0x80000001 )
285 unsigned long eax
, ebx
, ecx
, edx
;
286 int __unused__ stepping
, model
, family
, reserved
, i
;
288 i386_cpuid( 0x80000001, eax
, ebx
, ecx
, edx
);
290 stepping
= eax
& 0xf;
291 model
= (eax
>> 4) & 0xf;
292 family
= (eax
>> 8) & 0xf;
293 reserved
= eax
>> 12;
295 sprintf( BUFF_STR
," Family: %d Model: %d [",family
,model
);
296 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, BUFF_STR
);
300 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "MediaGX");
303 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "6x86/GXm");
306 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "6x86/MX");
308 Cyrix_CPU_IDENTITY_cnt
= AddBufferLine(Cyrix_CPU_IDENTITY_cnt
, Cyrix_CPU_IDENTITY
, "]\n\n");
310 Cyrix_CPU_FEATURES_cnt
= AddBufferLine(Cyrix_CPU_FEATURES_cnt
, Cyrix_CPU_FEATURES
, "Extended feature flags:\n");
311 for( i
=0 ; i
<32 ; i
++ )
315 sprintf( BUFF_STR
," %s\n",Cyrix_extended_feature_flags
[i
]);
316 Cyrix_CPU_FEATURES_cnt
= AddBufferLine(Cyrix_CPU_FEATURES_cnt
, Cyrix_CPU_FEATURES
, BUFF_STR
);
320 Cyrix_CPU_FEATURES_cnt
= AddBufferLine(Cyrix_CPU_FEATURES_cnt
, Cyrix_CPU_FEATURES
, "\n");
322 if ( maxei
>= 0x80000002 ) /* Processor identification string */
324 char __unused__ namestring
[49],*cp
;
328 Cyrix_CPU_NAME_cnt
= AddBufferLine(Cyrix_CPU_NAME_cnt
, Cyrix_CPU_NAME
, " Processor name string: ");
329 for ( j
=0x80000002 ; j
<=0x80000004 ; j
++ )
331 unsigned long eax
, ebx
, ecx
, edx
;
333 i386_cpuid( j
, eax
, ebx
, ecx
, edx
);
334 Cyrix_CPU_NAME_cnt
= i386_sprintregs(Cyrix_CPU_NAME_cnt
, Cyrix_CPU_NAME
, eax
,ebx
,ecx
,edx
);
338 if ( maxei
>= 0x80000005 ) /* TLB and L1 Cache info */
343 for ( i
=0 ; i
<ntlb
; i
++ )
345 unsigned long eax
, ebx
, ecx
, unused
;
347 i386_cpuid( 0x80000005, eax
, ebx
, ecx
, unused
);
350 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( ebx
>> 8, BUFF_STR
));
351 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( ebx
>> 16, BUFF_STR
));
352 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( ebx
>> 24, BUFF_STR
));
354 /* eax and edx are reserved */
356 if (( ecx
& 0x80000000 ) == 0 )
358 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( ecx
, BUFF_STR
));
359 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( ecx
>> 8, BUFF_STR
));
360 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( ecx
>> 16, BUFF_STR
));
361 Cyrix_CPU_CACHE_cnt
= AddBufferLine(Cyrix_CPU_CACHE_cnt
, Cyrix_CPU_CACHE
, i386_cyrix_TLB_decode( ecx
>> 24, BUFF_STR
));
367 //for(i=0x80000000;i<=maxei;i++) /* Dump extended info, if any, in raw hex */
369 // unsigned long eax,ebx,ecx,edx;
371 // i386_cpuid(i,eax,ebx,ecx,edx);
372 // printf("eax in: 0x%x, eax = %08lx ebx = %08lx ecx = %08lx edx = %08lx\n",i,eax,ebx,ecx,edx);
375 if ( Cyrix_CPU_NAME_cnt
> 0 ) printf( Cyrix_CPU_NAME
); /* CPUs Retail Name */
377 speed
= i386_approx_mhz();
379 /* TODO : Calculate FSB .. */
381 if ( Cyrix_CPU_IDENTITY_cnt
> 0 ) printf( Cyrix_CPU_IDENTITY
); /* CPUs Internal Name */
382 if ( Cyrix_CPU_FEATURES_cnt
> 0 ) printf( Cyrix_CPU_FEATURES
); /* CPUs Feature Set */
383 if ( Cyrix_CPU_ADDR_cnt
> 0 ) printf( Cyrix_CPU_ADDR
); /* CPUs Address Range */
384 if ( Cyrix_CPU_CACHE_cnt
> 0 ) printf( Cyrix_CPU_CACHE
); /* CPUs Cache Details */
389 printf( "ERROR: Couldn't allocate memory to parse CPU information .." );
392 FreeMem(global
,sizeof(struct CPU_INTERN_DATA
));