gallium: Unused variable cleanups
[AROS.git] / rom / processor / getcpuinfo.c
blob175ed5e6c9eee3fc1be632030729897e74973d34
1 /*
2 Copyright © 2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: GetCPUInfo() - Provides information about installed CPUs
6 Lang: english
7 */
9 #define DEBUG 0
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 /*****************************************************************************
21 NAME */
22 #include <proto/processor.h>
24 AROS_LH1(void, GetCPUInfo,
26 /* SYNOPSIS */
27 AROS_LHA(struct TagItem *, tagList, A0),
29 /* LOCATION */
30 struct ProcessorBase *, ProcessorBase, 1, Processor)
32 /* FUNCTION
34 Provides information about selected processor in the system
36 INPUTS
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.
41 TAGS
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
62 values.
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
74 specified caches.
76 GCIT_L1CacheSize
77 GCIT_L1DataCacheSize
78 GCIT_L1InstructionCacheSize
79 GCIT_L2CacheSize
80 GCIT_L3CacheSize
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.
91 GCIT_SupportsFPU
92 GCIT_SupportsAltiVec
93 GCIT_SupportsVMX
94 GCIT_SupportsMMX
95 GCIT_SupportsMMXEXT
96 GCIT_Supports3DNOW
97 GCIT_Supports3DNOWEXT
98 GCIT_SupportsSSE
99 GCIT_SupportsSSE2
100 GCIT_SupportsSSE3
101 GCIT_SupportsSSSE3
102 GCIT_SupportsSSE41
103 GCIT_SupportsSSE42
104 GCIT_SupportsSSE4A
105 GCIT_SupportsVME
106 GCIT_SupportsPSE
107 GCIT_SupportsPAE
108 GCIT_SupportsCX8
109 GCIT_SupportsAPIC
110 GCIT_SupportsCMOV
111 GCIT_SupportsPSE36
112 GCIT_SupportsCLFSH
113 GCIT_SupportsACPI
114 GCIT_SupportsFXSR
115 GCIT_SupportsHTT
116 GCIT_SupportsCX16
117 GCIT_SupportsVirtualization
118 GCIT_SupportsNoExecutionBit
119 GCIT_Supports64BitMode
120 GCIT_SupportsMSR
122 RESULT
124 None
126 NOTES
128 EXAMPLE
130 BUGS
132 SEE ALSO
134 INTERNALS
136 ******************************************************************************/
138 AROS_LIBFUNC_INIT
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;
151 continue;
153 else
155 switch(passedTag->ti_Tag)
157 case(GCIT_NumberOfProcessors):
158 *((ULONG *)passedTag->ti_Data) = 1;
159 break;
160 case(GCIT_ModelString):
161 *((CONST_STRPTR *)passedTag->ti_Data) = "Unknown";
162 break;
163 case(GCIT_Family):
164 *((ULONG *)passedTag->ti_Data) = CPUFAMILY_UNKNOWN;
165 break;
166 case(GCIT_VectorUnit):
167 *((ULONG *)passedTag->ti_Data) = VECTORTYPE_NONE;
168 break;
169 case(GCIT_L1CacheSize):
170 *((ULONG *)passedTag->ti_Data) = 0;
171 break;
172 case(GCIT_L1DataCacheSize):
173 *((ULONG *)passedTag->ti_Data) = 0;
174 break;
175 case(GCIT_L1InstructionCacheSize):
176 *((ULONG *)passedTag->ti_Data) = 0;
177 break;
178 case(GCIT_L2CacheSize):
179 *((ULONG *)passedTag->ti_Data) = 0;
180 break;
181 case(GCIT_L3CacheSize):
182 *((ULONG *)passedTag->ti_Data) = 0;
183 break;
184 case(GCIT_CacheLineSize):
185 *((ULONG *)passedTag->ti_Data) = 0;
186 break;
187 case(GCIT_Architecture):
188 *((ULONG *)passedTag->ti_Data) = PROCESSORARCH_UNKNOWN;
189 break;
190 case(GCIT_Endianness):
191 *((ULONG *)passedTag->ti_Data) = ENDIANNESS_UNKNOWN;
192 break;
193 case(GCIT_ProcessorSpeed):
194 *((UQUAD *)passedTag->ti_Data) = 0;
195 break;
196 case(GCIT_ProcessorLoad):
197 *((UBYTE *)passedTag->ti_Data) = 0;
198 break;
199 case(GCIT_FrontsideSpeed):
200 *((UQUAD *)passedTag->ti_Data) = 0;
201 break;
206 AROS_LIBFUNC_EXIT
207 } /* GetCPUInfo() */