2 Copyright © 2010-2011, 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>
18 #include "processor_intern.h"
20 /*****************************************************************************
23 #include <proto/processor.h>
25 AROS_LH1(void, GetCPUInfo
,
28 AROS_LHA(struct TagItem
*, tagList
, A0
),
31 struct ProcessorBase
*, ProcessorBase
, 1, Processor
)
35 Provides information about selected processor in the system
39 Function takes an array of tags. Data is returned for each tag. See
40 specific tag description. There is a control tag CGIT_SelectedProcessor.
44 GCIT_SelectedProcessor - (ULONG) When this tag is set correctly, information
45 about choosen processor is provided. If this
46 tag is missing or this tag has invalid value,
47 information about first processor is returned.
49 GCIT_NumberOfProcessors - (ULONG *) Provides the number of processors
50 present in the system.
52 GCIT_ModelString - (CONST_STRPTR *) Provides the name of the model of the
53 processor. The string is considered read-only.
55 GCIT_Family - (ULONG *) Provides designation of processor family using
56 one of the CPUFAMILY_XXX values.
58 GCIT_VectorUnit - (ULONG *) Provides designation of available vectory
59 unit using one of the VECTORTYPE_XXX values.
61 GCIT_Architecture - (ULONG *) Provides designation of processor
62 architecture using one of the PROCESSORARCH_XXX
65 GCIT_Endianness - (ULONG *) Provides designation of current processor
66 endianness using one of the ENDIANNESS_XXX values.
68 GCIT_ProcessorSpeed - (UQUAD *) Provides the current CPU speed in Hz
70 GCIT_FrontsideSpeed - (UQUAD *) Provides the current FSB speed in Hz
72 GCIT_ProcessorLoad - (ULONG *) Provides the current CPU load (0-0xffffffff)
74 Cache sizes - (ULONG *) Following tags are used to retrieve size of
79 GCIT_L1InstructionCacheSize
83 Size is returned in kB.
85 GCIT_CacheLineSize - (ULONG *) Provides the size of cache line in bytes.
86 In case these sizes differ per cache level, the
87 smallest size if provided.
89 Features - (BOOL *) Following tags are used to check availability of
90 certain features. The result is always a boolean.
118 GCIT_SupportsVirtualization
119 GCIT_SupportsNoExecutionBit
120 GCIT_Supports64BitMode
137 ******************************************************************************/
141 struct TagItem
* passedTag
= NULL
;
144 /* This is the default implementation */
146 while ((passedTag
= NextTagItem(&tagList
)) != NULL
)
148 if ((passedTag
->ti_Tag
> GCIT_FeaturesBase
) &&
149 (passedTag
->ti_Tag
<= GCIT_FeaturesLast
))
151 *((BOOL
*)passedTag
->ti_Data
) = FALSE
;
156 switch(passedTag
->ti_Tag
)
158 case(GCIT_NumberOfProcessors
):
159 *((ULONG
*)passedTag
->ti_Data
) = ProcessorBase
->cpucount
;
161 case(GCIT_ModelString
):
162 *((CONST_STRPTR
*)passedTag
->ti_Data
) = "Unknown";
165 *((ULONG
*)passedTag
->ti_Data
) = CPUFAMILY_UNKNOWN
;
167 case(GCIT_VectorUnit
):
168 *((ULONG
*)passedTag
->ti_Data
) = VECTORTYPE_NONE
;
170 case(GCIT_L1CacheSize
):
171 *((ULONG
*)passedTag
->ti_Data
) = 0;
173 case(GCIT_L1DataCacheSize
):
174 *((ULONG
*)passedTag
->ti_Data
) = 0;
176 case(GCIT_L1InstructionCacheSize
):
177 *((ULONG
*)passedTag
->ti_Data
) = 0;
179 case(GCIT_L2CacheSize
):
180 *((ULONG
*)passedTag
->ti_Data
) = 0;
182 case(GCIT_L3CacheSize
):
183 *((ULONG
*)passedTag
->ti_Data
) = 0;
185 case(GCIT_CacheLineSize
):
186 *((ULONG
*)passedTag
->ti_Data
) = 0;
188 case(GCIT_Architecture
):
189 *((ULONG
*)passedTag
->ti_Data
) = PROCESSORARCH_DEF
;
191 case(GCIT_Endianness
):
192 *((ULONG
*)passedTag
->ti_Data
) = ENDIANNESS_DEF
;
194 case(GCIT_ProcessorSpeed
):
195 *((UQUAD
*)passedTag
->ti_Data
) = 0;
197 case(GCIT_ProcessorLoad
):
198 *((ULONG
*)passedTag
->ti_Data
) = 0;
200 case(GCIT_FrontsideSpeed
):
201 *((UQUAD
*)passedTag
->ti_Data
) = 0;