revert commit 56204.
[AROS.git] / arch / all-pc / processor / processor_arch_intern.h
blob17793ce19c2b7e48bac22b3ba3935f42345335fe
1 /*
2 Copyright © 2010-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef PROCESSOR_ARCH_INTERN_H
7 #define PROCESSOR_ARCH_INTERN_H
9 #include <exec/types.h>
11 struct X86ProcessorInformation
13 TEXT VendorID[13]; /* 12 + \0 */
14 ULONG Vendor;
15 TEXT BrandStringBuffer[48];
16 STRPTR BrandString;
17 ULONG Family;
18 ULONG Model;
19 ULONG VectorUnit;
20 ULONG Features1; /* From EDX, function 00000001 */
21 ULONG Features2; /* From ECX, function 00000001 */
22 ULONG Features3; /* From EDX, function 80000001 */
23 ULONG Features4; /* From ECX, function 80000001 */
25 /* CPUID Information */
26 ULONG CPUIDHighestStandardFunction;
27 ULONG CPUIDHighestExtendedFunction;
29 /* Processor cache */
30 ULONG L1DataCacheSize;
31 ULONG L1InstructionCacheSize;
32 ULONG L2CacheSize;
33 ULONG L3CacheSize;
34 ULONG CacheLineSize; /* Min. of L1, L2, L3 */
36 /* MSR Support */
37 BOOL APERFMPERF;
39 /* Frequency information */
40 UQUAD MaxCPUFrequency;
41 UQUAD MaxFSBFrequency;
44 #define cpuid(num) \
45 do { asm volatile("cpuid":"=a"(eax),"=b"(ebx),"=c"(ecx),"=d"(edx):"a"(num)); } while(0)
47 static inline void __attribute__((always_inline)) rdmsr(ULONG msr_no, ULONG *ret_lo, ULONG *ret_hi)
49 ULONG ret1,ret2;
50 asm volatile("rdmsr":"=a"(ret1),"=d"(ret2):"c"(msr_no));
51 *ret_lo=ret1;
52 *ret_hi=ret2;
55 static inline ULONG __attribute__((always_inline)) rdmsri(ULONG msr_no)
57 ULONG ret;
59 asm volatile("rdmsr":"=a"(ret):"c"(msr_no));
60 return ret;
63 VOID ReadProcessorInformation(struct X86ProcessorInformation * info);
64 VOID ReadMaxFrequencyInformation(struct X86ProcessorInformation * info);
65 UQUAD GetCurrentProcessorFrequency(struct X86ProcessorInformation * info);
67 /* EDX 00000001 Flags */
68 #define FEATB_FPU 0
69 #define FEATB_VME 1
70 #define FEATB_PSE 3
71 #define FEATB_MSR 5
72 #define FEATB_PAE 6
73 #define FEATB_CX8 8
74 #define FEATB_APIC 9
75 #define FEATB_CMOV 15
76 #define FEATB_PSE36 17
77 #define FEATB_CLFSH 19
78 #define FEATB_ACPI 22
79 #define FEATB_MMX 23
80 #define FEATB_FXSR 24
81 #define FEATB_SSE 25
82 #define FEATB_SSE2 26
83 #define FEATB_HTT 28
85 #define FEATF_FPU (1 << FEATB_FPU)
86 #define FEATF_VME (1 << FEATB_VME)
87 #define FEATF_PSE (1 << FEATB_PSE)
88 #define FEATF_MSR (1 << FEATB_MSR)
89 #define FEATF_PAE (1 << FEATB_PAE)
90 #define FEATF_CX8 (1 << FEATB_CX8)
91 #define FEATF_APIC (1 << FEATB_APIC)
92 #define FEATF_CMOV (1 << FEATB_CMOV)
93 #define FEATF_PSE36 (1 << FEATB_PSE36)
94 #define FEATF_CLFSH (1 << FEATB_CLFSH)
95 #define FEATF_ACPI (1 << FEATB_ACPI)
96 #define FEATF_MMX (1 << FEATB_MMX)
97 #define FEATF_FXSR (1 << FEATB_FXSR)
98 #define FEATF_SSE (1 << FEATB_SSE)
99 #define FEATF_SSE2 (1 << FEATB_SSE2)
100 #define FEATF_HTT (1 << FEATB_HTT)
102 /* ECX 00000001 Flags */
103 #define FEATB_SSE3 0
104 #define FEATB_VMX 5
105 #define FEATB_SSSE3 9
106 #define FEATB_CX16 13
107 #define FEATB_SSE41 19
108 #define FEATB_SSE42 20
110 #define FEATF_SSE3 (1 << FEATB_SSE3)
111 #define FEATF_VMX (1 << FEATB_VMX)
112 #define FEATF_SSSE3 (1 << FEATB_SSSE3)
113 #define FEATF_CX16 (1 << FEATB_CX16)
114 #define FEATF_SSE41 (1 << FEATB_SSE41)
115 #define FEATF_SSE42 (1 << FEATB_SSE42)
117 /* EDX 80000001 AMD Flags */
118 #define FEATB_XDNX 20
119 #define FEATB_MMXEXT 22
120 #define FEATB_AMD64 29
121 #define FEATB_3DNOWEXT 30
122 #define FEATB_3DNOW 31
124 #define FEATF_XDNX (1 << FEATB_XDNX)
125 #define FEATF_MMXEXT (1 << FEATB_MMXEXT)
126 #define FEATF_AMD64 (1 << FEATB_AMD64)
127 #define FEATF_3DNOWEXT (1 << FEATB_3DNOWEXT)
128 #define FEATF_3DNOW (1 << FEATB_3DNOW)
130 /* ECX 80000001 AMD Flags */
131 #define FEATB_SVM 2
132 #define FEATB_SSE4A 6
134 #define FEATF_SVM (1 << FEATB_SVM)
135 #define FEATF_SSE4A (1 << FEATB_SSE4A)
137 /* Per manufacturer feature masks */
138 #define FEATURE_MASK_EDX_UNKNOWN 0
139 #define FEATURE_MASK_ECX_UNKNOWN 0
141 #define FEATURE_MASK_EDX_INTEL \
142 (FEATF_FPU | FEATF_VME | FEATF_PSE | FEATF_MSR | FEATF_PAE | FEATF_CX8 | FEATF_APIC | \
143 FEATF_CMOV | FEATF_PSE36 | FEATF_CLFSH | FEATF_ACPI | FEATF_MMX | \
144 FEATF_FXSR | FEATF_SSE | FEATF_SSE2 | FEATF_HTT)
145 #define FEATURE_MASK_ECX_INTEL \
146 (FEATF_SSE3 | FEATF_VMX | FEATF_SSSE3 | FEATF_CX16 | FEATF_SSE41 | \
147 FEATF_SSE42)
148 #define FEATURE_MASK_EDX_EXT_INTEL \
149 (FEATF_XDNX | FEATF_AMD64)
150 #define FEATURE_MASK_ECX_EXT_INTEL 0
152 #define FEATURE_MASK_EDX_AMD \
153 (FEATF_FPU | FEATF_VME | FEATF_PSE | FEATF_MSR | FEATF_PAE | FEATF_CX8 | FEATF_APIC | \
154 FEATF_CMOV | FEATF_PSE36 | FEATF_CLFSH | FEATF_MMX | FEATF_FXSR | \
155 FEATF_SSE | FEATF_SSE2 | FEATF_HTT)
156 #define FEATURE_MASK_ECX_AMD \
157 (FEATF_SSE3 | FEATF_SSSE3 | FEATF_CX16 | FEATF_SSE41)
158 #define FEATURE_MASK_EDX_EXT_AMD \
159 (FEATF_XDNX | FEATF_MMXEXT | FEATF_AMD64 | FEATF_3DNOWEXT | FEATF_3DNOW)
160 #define FEATURE_MASK_ECX_EXT_AMD \
161 (FEATF_SVM | FEATF_SSE4A)
163 #endif /* PROCESSOR_ARCH_INTERN_H */