2 Copyright © 2010, The AROS Development Team. All rights reserved.
5 Desc: GetCPUInfo() - Provides information about installed CPUs
11 #include <aros/debug.h>
12 #include <exec/types.h>
13 #include <aros/libcall.h>
14 #include <proto/utility.h>
15 #include <resources/processor.h>
17 #include "processor_intern.h"
19 /*****************************************************************************
22 #include <proto/processor.h>
24 AROS_LH1(void, GetCPUInfo
,
27 AROS_LHA(struct TagItem
*, tagList
, A0
),
30 struct ProcessorBase
*, ProcessorBase
, 1, Processor
)
34 Provides information about selected processor in the system
38 Function takes an array of tags. Data is returned for each tag. See
39 specific tag description. There is a control tag CGIT_SelecetProcessor.
43 GCIT_SelectedProcessor - (ULONG) When this tag is set correctly, information
44 about choosen processor is provided. If this
45 tag is missing or this tag has invalid value,
46 information about first processor is returned.
48 GCIT_NumberOfProcessors - (ULONG *) Provides the number of processors
49 present in the system.
51 GCIT_ModelString - (CONST_STRPTR *) Provides the name of the model of the
52 processor. The string is considered read-only.
54 GCIT_Family - (ULONG *) Provides designation of processor family using
55 one of the CPUFAMILY_XXX values.
57 GCIT_VectorUnit - (ULONG *) Provides designation of available vectory
58 unit using one of the VECTORTYPE_XXX values.
60 GCIT_Architecture - (ULONG *) Provides designation of processor
61 architecture using one of the PROCESSORARCH_XXX
64 GCIT_Endianness - (ULONG *) Provides designation of current processor
65 endianness using one of the ENDIANNESS_XXX values.
67 GCIT_ProcessorSpeed - (UQUAD *) Provides the current CPU speed in Hz
69 GCIT_FrontsideSpeed - (UQUAD *) Provides the current FSB speed in Hz
71 GCIT_ProcessorLoad - (UBYTE *) Provides the current CPU load in % (0-100)
73 Cache sizes - (ULONG *) Following tags are used to retrieve size of
78 GCIT_L1InstructionCacheSize
82 Size is returned in kB.
84 GCIT_CacheLineSize - (ULONG *) Provides the size of cache line in bytes.
85 In case these sizes differ per cache level, the
86 smallest size if provided.
88 Features - (BOOL *) Following tags are used to check availability of
89 certain features. The result is always a boolean.
117 GCIT_SupportsVirtualization
118 GCIT_SupportsNoExecutionBit
119 GCIT_Supports64BitMode
136 ******************************************************************************/
140 struct TagItem
* passedTag
= NULL
;
143 /* This is the default implementation */
145 while ((passedTag
= NextTagItem((const struct TagItem
**)&tagList
)) != NULL
)
147 if ((passedTag
->ti_Tag
> GCIT_FeaturesBase
) &&
148 (passedTag
->ti_Tag
<= GCIT_FeaturesLast
))
150 *((BOOL
*)passedTag
->ti_Data
) = FALSE
;
155 switch(passedTag
->ti_Tag
)
157 case(GCIT_NumberOfProcessors
):
158 *((ULONG
*)passedTag
->ti_Data
) = 1;
160 case(GCIT_ModelString
):
161 *((CONST_STRPTR
*)passedTag
->ti_Data
) = "Unknown";
164 *((ULONG
*)passedTag
->ti_Data
) = CPUFAMILY_UNKNOWN
;
166 case(GCIT_VectorUnit
):
167 *((ULONG
*)passedTag
->ti_Data
) = VECTORTYPE_NONE
;
169 case(GCIT_L1CacheSize
):
170 *((ULONG
*)passedTag
->ti_Data
) = 0;
172 case(GCIT_L1DataCacheSize
):
173 *((ULONG
*)passedTag
->ti_Data
) = 0;
175 case(GCIT_L1InstructionCacheSize
):
176 *((ULONG
*)passedTag
->ti_Data
) = 0;
178 case(GCIT_L2CacheSize
):
179 *((ULONG
*)passedTag
->ti_Data
) = 0;
181 case(GCIT_L3CacheSize
):
182 *((ULONG
*)passedTag
->ti_Data
) = 0;
184 case(GCIT_CacheLineSize
):
185 *((ULONG
*)passedTag
->ti_Data
) = 0;
187 case(GCIT_Architecture
):
188 *((ULONG
*)passedTag
->ti_Data
) = PROCESSORARCH_UNKNOWN
;
190 case(GCIT_Endianness
):
191 *((ULONG
*)passedTag
->ti_Data
) = ENDIANNESS_UNKNOWN
;
193 case(GCIT_ProcessorSpeed
):
194 *((UQUAD
*)passedTag
->ti_Data
) = 0;
196 case(GCIT_ProcessorLoad
):
197 *((UBYTE
*)passedTag
->ti_Data
) = 0;
199 case(GCIT_FrontsideSpeed
):
200 *((UQUAD
*)passedTag
->ti_Data
) = 0;