2 Copyright © 2011-2013, The AROS Development Team. All rights reserved.
5 Desc: GetCPUInfo() - Provides information about installed CPUs
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
)
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
);
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
));
55 *((BOOL
*)passedTag
->ti_Data
) = FALSE
; break;
60 switch(passedTag
->ti_Tag
)
62 case(GCIT_NumberOfProcessors
):
63 *((ULONG
*)passedTag
->ti_Data
) = 1;
65 case(GCIT_ModelString
):
66 *((CONST_STRPTR
*)passedTag
->ti_Data
) = processor
->ModelString
;
69 *((ULONG
*)passedTag
->ti_Data
) = CPUFAMILY_MOTOROLA_68000
;
71 case(GCIT_VectorUnit
):
72 *((ULONG
*)passedTag
->ti_Data
) = VECTORTYPE_NONE
;
74 case(GCIT_L1CacheSize
):
75 *((ULONG
*)passedTag
->ti_Data
) =
76 (processor
->L1DataCacheSize
+ processor
->L1InstructionCacheSize
);
78 case(GCIT_L1DataCacheSize
):
79 *((ULONG
*)passedTag
->ti_Data
) = processor
->L1DataCacheSize
;
81 case(GCIT_L1InstructionCacheSize
):
82 *((ULONG
*)passedTag
->ti_Data
) = processor
->L1InstructionCacheSize
;
84 case(GCIT_L2CacheSize
):
85 *((ULONG
*)passedTag
->ti_Data
) = 0;
87 case(GCIT_L3CacheSize
):
88 *((ULONG
*)passedTag
->ti_Data
) = 0;
90 case(GCIT_CacheLineSize
):
91 *((ULONG
*)passedTag
->ti_Data
) = 0;
93 case(GCIT_Architecture
):
94 *((ULONG
*)passedTag
->ti_Data
) = PROCESSORARCH_M68K
;
96 case(GCIT_Endianness
):
97 *((ULONG
*)passedTag
->ti_Data
) = ENDIANNESS_BE
;
99 case(GCIT_ProcessorSpeed
):
100 *((UQUAD
*)passedTag
->ti_Data
) = processor
->CPUFrequency
;
102 case(GCIT_ProcessorLoad
):
103 *((ULONG
*)passedTag
->ti_Data
) = 0; /* TODO: IMPLEMENT */
105 case(GCIT_FrontsideSpeed
):
106 *((UQUAD
*)passedTag
->ti_Data
) = 0;
112 CloseLibrary(UtilityBase
);