PageRenderTime 26ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/edk2/EdkCompatibilityPkg/Foundation/Cpu/Pentium/Include/CpuIA32.h

https://gitlab.com/envieidoc/Clover
C Header | 358 lines | 181 code | 33 blank | 144 comment | 0 complexity | 146abe7a07a7a514b386359d548c32aa MD5 | raw file
  1. /*++
  2. Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
  3. This program and the accompanying materials
  4. are licensed and made available under the terms and conditions of the BSD License
  5. which accompanies this distribution. The full text of the license may be found at
  6. http://opensource.org/licenses/bsd-license.php
  7. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  9. Module Name:
  10. CpuIA32.h
  11. Abstract:
  12. --*/
  13. #ifndef _CPU_IA32_H
  14. #define _CPU_IA32_H
  15. #include "Tiano.h"
  16. typedef struct {
  17. UINT32 RegEax;
  18. UINT32 RegEbx;
  19. UINT32 RegEcx;
  20. UINT32 RegEdx;
  21. } EFI_CPUID_REGISTER;
  22. typedef struct {
  23. UINT32 HeaderVersion;
  24. UINT32 UpdateRevision;
  25. UINT32 Date;
  26. UINT32 ProcessorId;
  27. UINT32 Checksum;
  28. UINT32 LoaderRevision;
  29. UINT32 ProcessorFlags;
  30. UINT32 DataSize;
  31. UINT32 TotalSize;
  32. UINT8 Reserved[12];
  33. } EFI_CPU_MICROCODE_HEADER;
  34. typedef struct {
  35. UINT32 ExtendedSignatureCount;
  36. UINT32 ExtendedTableChecksum;
  37. UINT8 Reserved[12];
  38. } EFI_CPU_MICROCODE_EXTENDED_TABLE_HEADER;
  39. typedef struct {
  40. UINT32 ProcessorSignature;
  41. UINT32 ProcessorFlag;
  42. UINT32 ProcessorChecksum;
  43. } EFI_CPU_MICROCODE_EXTENDED_TABLE;
  44. typedef struct {
  45. UINT32 Stepping : 4;
  46. UINT32 Model : 4;
  47. UINT32 Family : 4;
  48. UINT32 Type : 2;
  49. UINT32 Reserved1 : 2;
  50. UINT32 ExtendedModel : 4;
  51. UINT32 ExtendedFamily : 8;
  52. UINT32 Reserved2 : 4;
  53. } EFI_CPU_VERSION;
  54. #define EFI_CPUID_SIGNATURE 0x0
  55. #define EFI_CPUID_VERSION_INFO 0x1
  56. #define EFI_CPUID_CACHE_INFO 0x2
  57. #define EFI_CPUID_SERIAL_NUMBER 0x3
  58. #define EFI_CPUID_EXTENDED_FUNCTION 0x80000000
  59. #define EFI_CPUID_EXTENDED_CPU_SIG 0x80000001
  60. #define EFI_CPUID_BRAND_STRING1 0x80000002
  61. #define EFI_CPUID_BRAND_STRING2 0x80000003
  62. #define EFI_CPUID_BRAND_STRING3 0x80000004
  63. #define EFI_MSR_IA32_PLATFORM_ID 0x17
  64. #define EFI_MSR_IA32_APIC_BASE 0x1B
  65. #define EFI_MSR_EBC_HARD_POWERON 0x2A
  66. #define EFI_MSR_EBC_SOFT_POWERON 0x2B
  67. #define BINIT_DRIVER_DISABLE 0x40
  68. #define INTERNAL_MCERR_DISABLE 0x20
  69. #define INITIATOR_MCERR_DISABLE 0x10
  70. #define EFI_MSR_EBC_FREQUENCY_ID 0x2C
  71. #define EFI_MSR_IA32_BIOS_UPDT_TRIG 0x79
  72. #define EFI_MSR_IA32_BIOS_SIGN_ID 0x8B
  73. #define EFI_MSR_PSB_CLOCK_STATUS 0xCD
  74. #define EFI_APIC_GLOBAL_ENABLE 0x800
  75. #define EFI_MSR_IA32_MISC_ENABLE 0x1A0
  76. #define LIMIT_CPUID_MAXVAL_ENABLE_BIT 0x00400000
  77. #define AUTOMATIC_THERMAL_CONTROL_ENABLE_BIT 0x00000008
  78. #define COMPATIBLE_FPU_OPCODE_ENABLE_BIT 0x00000004
  79. #define LOGICAL_PROCESSOR_PRIORITY_ENABLE_BIT 0x00000002
  80. #define FAST_STRING_ENABLE_BIT 0x00000001
  81. #define EFI_CACHE_VARIABLE_MTRR_BASE 0x200
  82. #define EFI_CACHE_VARIABLE_MTRR_END 0x20F
  83. #define EFI_CACHE_IA32_MTRR_DEF_TYPE 0x2FF
  84. #define EFI_CACHE_MTRR_VALID 0x800
  85. #define EFI_CACHE_FIXED_MTRR_VALID 0x400
  86. #define EFI_CACHE_VALID_ADDRESS 0xFFFFFF000
  87. #define EFI_MSR_VALID_MASK 0xFFFFFFFFF
  88. #define EFI_CACHE_VALID_EXTENDED_ADDRESS 0xFFFFFFFFFF000
  89. #define EFI_MSR_VALID_EXTENDED_MASK 0xFFFFFFFFFFFFF
  90. #define EFI_IA32_MTRR_FIX64K_00000 0x250
  91. #define EFI_IA32_MTRR_FIX16K_80000 0x258
  92. #define EFI_IA32_MTRR_FIX16K_A0000 0x259
  93. #define EFI_IA32_MTRR_FIX4K_C0000 0x268
  94. #define EFI_IA32_MTRR_FIX4K_C8000 0x269
  95. #define EFI_IA32_MTRR_FIX4K_D0000 0x26A
  96. #define EFI_IA32_MTRR_FIX4K_D8000 0x26B
  97. #define EFI_IA32_MTRR_FIX4K_E0000 0x26C
  98. #define EFI_IA32_MTRR_FIX4K_E8000 0x26D
  99. #define EFI_IA32_MTRR_FIX4K_F0000 0x26E
  100. #define EFI_IA32_MTRR_FIX4K_F8000 0x26F
  101. #define EFI_IA32_MCG_CAP 0x179
  102. #define EFI_IA32_MCG_CTL 0x17B
  103. #define EFI_IA32_MC0_CTL 0x400
  104. #define EFI_IA32_MC0_STATUS 0x401
  105. #define EFI_IA32_PERF_STATUS 0x198
  106. #define EFI_IA32_PERF_CTL 0x199
  107. #define EFI_CACHE_UNCACHEABLE 0
  108. #define EFI_CACHE_WRITECOMBINING 1
  109. #define EFI_CACHE_WRITETHROUGH 4
  110. #define EFI_CACHE_WRITEPROTECTED 5
  111. #define EFI_CACHE_WRITEBACK 6
  112. //
  113. // Combine f(FamilyId), m(Model), s(SteppingId) to a single 32 bit number
  114. //
  115. #define EfiMakeCpuVersion(f, m, s) \
  116. (((UINT32) (f) << 16) | ((UINT32) (m) << 8) | ((UINT32) (s)))
  117. VOID
  118. EFIAPI
  119. EfiHalt (
  120. VOID
  121. );
  122. /*++
  123. Routine Description:
  124. Halt the Cpu
  125. Arguments:
  126. None
  127. Returns:
  128. None
  129. --*/
  130. VOID
  131. EFIAPI
  132. EfiWbinvd (
  133. VOID
  134. );
  135. /*++
  136. Routine Description:
  137. Write back and invalidate the Cpu cache
  138. Arguments:
  139. None
  140. Returns:
  141. None
  142. --*/
  143. VOID
  144. EFIAPI
  145. EfiInvd (
  146. VOID
  147. );
  148. /*++
  149. Routine Description:
  150. Invalidate the Cpu cache
  151. Arguments:
  152. None
  153. Returns:
  154. None
  155. --*/
  156. VOID
  157. EFIAPI
  158. EfiCpuid (
  159. IN UINT32 RegisterInEax,
  160. OUT EFI_CPUID_REGISTER *Regs
  161. );
  162. /*++
  163. Routine Description:
  164. Get the Cpu info by excute the CPUID instruction
  165. Arguments:
  166. RegisterInEax: -The input value to put into register EAX
  167. Regs: -The Output value
  168. Returns:
  169. None
  170. --*/
  171. VOID
  172. EFIAPI
  173. EfiCpuidExt (
  174. IN UINT32 RegisterInEax,
  175. IN UINT32 CacheLevel,
  176. OUT EFI_CPUID_REGISTER *Regs
  177. )
  178. /*++
  179. Routine Description:
  180. When RegisterInEax != 4, the functionality is the same as EfiCpuid.
  181. When RegisterInEax == 4, the function return the deterministic cache
  182. parameters by excuting the CPUID instruction
  183. Arguments:
  184. RegisterInEax: - The input value to put into register EAX
  185. CacheLevel: - The deterministic cache level
  186. Regs: - The Output value
  187. Returns:
  188. None
  189. --*/
  190. ;
  191. UINT64
  192. EFIAPI
  193. EfiReadMsr (
  194. IN UINT32 Index
  195. );
  196. /*++
  197. Routine Description:
  198. Read Cpu MSR
  199. Arguments:
  200. Index: -The index value to select the register
  201. Returns:
  202. Return the read data
  203. --*/
  204. VOID
  205. EFIAPI
  206. EfiWriteMsr (
  207. IN UINT32 Index,
  208. IN UINT64 Value
  209. );
  210. /*++
  211. Routine Description:
  212. Write Cpu MSR
  213. Arguments:
  214. Index: -The index value to select the register
  215. Value: -The value to write to the selected register
  216. Returns:
  217. None
  218. --*/
  219. UINT64
  220. EFIAPI
  221. EfiReadTsc (
  222. VOID
  223. );
  224. /*++
  225. Routine Description:
  226. Read Time stamp
  227. Arguments:
  228. None
  229. Returns:
  230. Return the read data
  231. --*/
  232. VOID
  233. EFIAPI
  234. EfiDisableCache (
  235. VOID
  236. );
  237. /*++
  238. Routine Description:
  239. Writing back and invalidate the cache,then diable it
  240. Arguments:
  241. None
  242. Returns:
  243. None
  244. --*/
  245. VOID
  246. EFIAPI
  247. EfiEnableCache (
  248. VOID
  249. );
  250. /*++
  251. Routine Description:
  252. Invalidate the cache,then Enable it
  253. Arguments:
  254. None
  255. Returns:
  256. None
  257. --*/
  258. UINT32
  259. EFIAPI
  260. EfiGetEflags (
  261. VOID
  262. );
  263. /*++
  264. Routine Description:
  265. Get Eflags
  266. Arguments:
  267. None
  268. Returns:
  269. Return the Eflags value
  270. --*/
  271. VOID
  272. EFIAPI
  273. EfiDisableInterrupts (
  274. VOID
  275. );
  276. /*++
  277. Routine Description:
  278. Disable Interrupts
  279. Arguments:
  280. None
  281. Returns:
  282. None
  283. --*/
  284. VOID
  285. EFIAPI
  286. EfiEnableInterrupts (
  287. VOID
  288. );
  289. /*++
  290. Routine Description:
  291. Enable Interrupts
  292. Arguments:
  293. None
  294. Returns:
  295. None
  296. --*/
  297. VOID
  298. EFIAPI
  299. EfiCpuVersion (
  300. IN UINT16 *FamilyId, OPTIONAL
  301. IN UINT8 *Model, OPTIONAL
  302. IN UINT8 *SteppingId, OPTIONAL
  303. IN UINT8 *Processor OPTIONAL
  304. )
  305. /*++
  306. Routine Description:
  307. Extract CPU detail version infomation
  308. Arguments:
  309. FamilyId - FamilyId, including ExtendedFamilyId
  310. Model - Model, including ExtendedModel
  311. SteppingId - SteppingId
  312. Processor - Processor
  313. --*/
  314. ;
  315. #endif