revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-all / processor / getcpuinfo.c
blob8432e65e4446ae2d52430a4c8914321e0d0f49bb
1 /*
2 Copyright © 2011-2013, 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 <aros/libcall.h>
13 #include <resources/processor.h>
14 #include <proto/utility.h>
16 #include "processor_intern.h"
17 #include "processor_arch_intern.h"
19 #include <proto/processor.h>
21 /* See rom/processor/getcpuinfo.c for documentation */
23 AROS_LH1(void, GetCPUInfo,
24 AROS_LHA(struct TagItem *, tagList, A0),
25 struct ProcessorBase *, ProcessorBase, 1, Processor)
27 AROS_LIBFUNC_INIT
29 struct TagItem * passedTag = NULL;
30 struct M68KProcessorInformation * processor = NULL;
31 struct SystemProcessors * sysprocs = (struct SystemProcessors *)ProcessorBase->Private1;
32 struct Library *UtilityBase = TaggedOpenLibrary(TAGGEDOPEN_UTILITY);
34 if (!UtilityBase)
35 return;
37 /* GCIT_SelectedProcessor is ignored for now. In future it might be used to
38 distinguish between M68K processor and PowerPC turbo card processor (?)*/
39 processor = &sysprocs->processor;
41 while ((passedTag = NextTagItem(&tagList)) != NULL)
43 if ((passedTag->ti_Tag > GCIT_FeaturesBase) &&
44 (passedTag->ti_Tag <= GCIT_FeaturesLast))
46 switch(passedTag->ti_Tag)
48 case(GCIT_SupportsFPU):
49 *((BOOL *)passedTag->ti_Data) = (BOOL)(
50 (processor->FPUModel == FPUMODEL_68881) ||
51 (processor->FPUModel == FPUMODEL_68882) ||
52 (processor->FPUModel == FPUMODEL_INTERNAL));
53 break;
54 default:
55 *((BOOL *)passedTag->ti_Data) = FALSE; break;
58 else
60 switch(passedTag->ti_Tag)
62 case(GCIT_NumberOfProcessors):
63 *((ULONG *)passedTag->ti_Data) = 1;
64 break;
65 case(GCIT_ModelString):
66 *((CONST_STRPTR *)passedTag->ti_Data) = processor->ModelString;
67 break;
68 case(GCIT_Family):
69 *((ULONG *)passedTag->ti_Data) = CPUFAMILY_MOTOROLA_68000;
70 break;
71 case(GCIT_VectorUnit):
72 *((ULONG *)passedTag->ti_Data) = VECTORTYPE_NONE;
73 break;
74 case(GCIT_L1CacheSize):
75 *((ULONG *)passedTag->ti_Data) =
76 (processor->L1DataCacheSize + processor->L1InstructionCacheSize);
77 break;
78 case(GCIT_L1DataCacheSize):
79 *((ULONG *)passedTag->ti_Data) = processor->L1DataCacheSize;
80 break;
81 case(GCIT_L1InstructionCacheSize):
82 *((ULONG *)passedTag->ti_Data) = processor->L1InstructionCacheSize;
83 break;
84 case(GCIT_L2CacheSize):
85 *((ULONG *)passedTag->ti_Data) = 0;
86 break;
87 case(GCIT_L3CacheSize):
88 *((ULONG *)passedTag->ti_Data) = 0;
89 break;
90 case(GCIT_CacheLineSize):
91 *((ULONG *)passedTag->ti_Data) = 0;
92 break;
93 case(GCIT_Architecture):
94 *((ULONG *)passedTag->ti_Data) = PROCESSORARCH_M68K;
95 break;
96 case(GCIT_Endianness):
97 *((ULONG *)passedTag->ti_Data) = ENDIANNESS_BE;
98 break;
99 case(GCIT_ProcessorSpeed):
100 *((UQUAD *)passedTag->ti_Data) = processor->CPUFrequency;
101 break;
102 case(GCIT_ProcessorLoad):
103 *((ULONG *)passedTag->ti_Data) = 0; /* TODO: IMPLEMENT */
104 break;
105 case(GCIT_FrontsideSpeed):
106 *((UQUAD *)passedTag->ti_Data) = 0;
107 break;
112 CloseLibrary(UtilityBase);
114 AROS_LIBFUNC_EXIT
115 } /* GetCPUInfo() */