CpuCommonFeatures.h 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. /** @file
  2. CPU Common features library header file.
  3. Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _CPU_COMMON_FEATURES_H_
  7. #define _CPU_COMMON_FEATURES_H_
  8. #include <PiDxe.h>
  9. #include <Library/BaseLib.h>
  10. #include <Library/PcdLib.h>
  11. #include <Library/DebugLib.h>
  12. #include <Library/RegisterCpuFeaturesLib.h>
  13. #include <Library/BaseMemoryLib.h>
  14. #include <Library/MemoryAllocationLib.h>
  15. #include <Library/LocalApicLib.h>
  16. #include <Register/Intel/Cpuid.h>
  17. #include <Register/Intel/Msr.h>
  18. /**
  19. Prepares for the data used by CPU feature detection and initialization.
  20. @param[in] NumberOfProcessors The number of CPUs in the platform.
  21. @return Pointer to a buffer of CPU related configuration data.
  22. @note This service could be called by BSP only.
  23. **/
  24. VOID *
  25. EFIAPI
  26. AesniGetConfigData (
  27. IN UINTN NumberOfProcessors
  28. );
  29. /**
  30. Detects if AESNI feature supported on current processor.
  31. @param[in] ProcessorNumber The index of the CPU executing this function.
  32. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  33. structure for the CPU executing this function.
  34. @param[in] ConfigData A pointer to the configuration buffer returned
  35. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  36. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  37. RegisterCpuFeature().
  38. @retval TRUE AESNI feature is supported.
  39. @retval FALSE AESNI feature is not supported.
  40. @note This service could be called by BSP/APs.
  41. **/
  42. BOOLEAN
  43. EFIAPI
  44. AesniSupport (
  45. IN UINTN ProcessorNumber,
  46. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  47. IN VOID *ConfigData OPTIONAL
  48. );
  49. /**
  50. Initializes AESNI feature to specific state.
  51. @param[in] ProcessorNumber The index of the CPU executing this function.
  52. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  53. structure for the CPU executing this function.
  54. @param[in] ConfigData A pointer to the configuration buffer returned
  55. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  56. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  57. RegisterCpuFeature().
  58. @param[in] State If TRUE, then the AESNI feature must be enabled.
  59. If FALSE, then the AESNI feature must be disabled.
  60. @retval RETURN_SUCCESS AESNI feature is initialized.
  61. @note This service could be called by BSP only.
  62. **/
  63. RETURN_STATUS
  64. EFIAPI
  65. AesniInitialize (
  66. IN UINTN ProcessorNumber,
  67. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  68. IN VOID *ConfigData OPTIONAL,
  69. IN BOOLEAN State
  70. );
  71. /**
  72. Prepares for the data used by CPU feature detection and initialization.
  73. @param[in] NumberOfProcessors The number of CPUs in the platform.
  74. @return Pointer to a buffer of CPU related configuration data.
  75. @note This service could be called by BSP only.
  76. **/
  77. VOID *
  78. EFIAPI
  79. ClockModulationGetConfigData (
  80. IN UINTN NumberOfProcessors
  81. );
  82. /**
  83. Detects if Clock Modulation feature supported on current processor.
  84. @param[in] ProcessorNumber The index of the CPU executing this function.
  85. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  86. structure for the CPU executing this function.
  87. @param[in] ConfigData A pointer to the configuration buffer returned
  88. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  89. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  90. RegisterCpuFeature().
  91. @retval TRUE Clock Modulation feature is supported.
  92. @retval FALSE Clock Modulation feature is not supported.
  93. @note This service could be called by BSP/APs.
  94. **/
  95. BOOLEAN
  96. EFIAPI
  97. ClockModulationSupport (
  98. IN UINTN ProcessorNumber,
  99. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  100. IN VOID *ConfigData OPTIONAL
  101. );
  102. /**
  103. Initializes Clock Modulation feature to specific state.
  104. @param[in] ProcessorNumber The index of the CPU executing this function.
  105. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  106. structure for the CPU executing this function.
  107. @param[in] ConfigData A pointer to the configuration buffer returned
  108. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  109. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  110. RegisterCpuFeature().
  111. @param[in] State If TRUE, then the Clock Modulation feature must be enabled.
  112. If FALSE, then the Clock Modulation feature must be disabled.
  113. @retval RETURN_SUCCESS Clock Modulation feature is initialized.
  114. @note This service could be called by BSP only.
  115. **/
  116. RETURN_STATUS
  117. EFIAPI
  118. ClockModulationInitialize (
  119. IN UINTN ProcessorNumber,
  120. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  121. IN VOID *ConfigData OPTIONAL,
  122. IN BOOLEAN State
  123. );
  124. /**
  125. Detects if Enhanced Intel SpeedStep feature supported on current processor.
  126. @param[in] ProcessorNumber The index of the CPU executing this function.
  127. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  128. structure for the CPU executing this function.
  129. @param[in] ConfigData A pointer to the configuration buffer returned
  130. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  131. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  132. RegisterCpuFeature().
  133. @retval TRUE Enhanced Intel SpeedStep feature is supported.
  134. @retval FALSE Enhanced Intel SpeedStep feature is not supported.
  135. @note This service could be called by BSP/APs.
  136. **/
  137. BOOLEAN
  138. EFIAPI
  139. EistSupport (
  140. IN UINTN ProcessorNumber,
  141. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  142. IN VOID *ConfigData OPTIONAL
  143. );
  144. /**
  145. Initializes Enhanced Intel SpeedStep feature to specific state.
  146. @param[in] ProcessorNumber The index of the CPU executing this function.
  147. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  148. structure for the CPU executing this function.
  149. @param[in] ConfigData A pointer to the configuration buffer returned
  150. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  151. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  152. RegisterCpuFeature().
  153. @param[in] State If TRUE, then the Enhanced Intel SpeedStep feature
  154. must be enabled.
  155. If FALSE, then the Enhanced Intel SpeedStep feature
  156. must be disabled.
  157. @retval RETURN_SUCCESS Enhanced Intel SpeedStep feature is initialized.
  158. @note This service could be called by BSP only.
  159. **/
  160. RETURN_STATUS
  161. EFIAPI
  162. EistInitialize (
  163. IN UINTN ProcessorNumber,
  164. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  165. IN VOID *ConfigData OPTIONAL,
  166. IN BOOLEAN State
  167. );
  168. /**
  169. Detects if Execute Disable feature supported on current processor.
  170. @param[in] ProcessorNumber The index of the CPU executing this function.
  171. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  172. structure for the CPU executing this function.
  173. @param[in] ConfigData A pointer to the configuration buffer returned
  174. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  175. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  176. RegisterCpuFeature().
  177. @retval TRUE Execute Disable feature is supported.
  178. @retval FALSE Execute Disable feature is not supported.
  179. @note This service could be called by BSP/APs.
  180. **/
  181. BOOLEAN
  182. EFIAPI
  183. ExecuteDisableSupport (
  184. IN UINTN ProcessorNumber,
  185. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  186. IN VOID *ConfigData OPTIONAL
  187. );
  188. /**
  189. Initializes Execute Disable feature to specific state.
  190. @param[in] ProcessorNumber The index of the CPU executing this function.
  191. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  192. structure for the CPU executing this function.
  193. @param[in] ConfigData A pointer to the configuration buffer returned
  194. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  195. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  196. RegisterCpuFeature().
  197. @param[in] State If TRUE, then the Execute Disable feature must be enabled.
  198. If FALSE, then the Execute Disable feature must be disabled.
  199. @retval RETURN_SUCCESS Execute Disable feature is initialized.
  200. @note This service could be called by BSP only.
  201. **/
  202. RETURN_STATUS
  203. EFIAPI
  204. ExecuteDisableInitialize (
  205. IN UINTN ProcessorNumber,
  206. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  207. IN VOID *ConfigData OPTIONAL,
  208. IN BOOLEAN State
  209. );
  210. /**
  211. Initializes Fast-Strings feature to specific state.
  212. @param[in] ProcessorNumber The index of the CPU executing this function.
  213. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  214. structure for the CPU executing this function.
  215. @param[in] ConfigData A pointer to the configuration buffer returned
  216. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  217. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  218. RegisterCpuFeature().
  219. @param[in] State If TRUE, then the Fast-Strings feature must be enabled.
  220. If FALSE, then the Fast-Strings feature must be disabled.
  221. @retval RETURN_SUCCESS Fast-Strings feature is initialized.
  222. @note This service could be called by BSP only.
  223. **/
  224. RETURN_STATUS
  225. EFIAPI
  226. FastStringsInitialize (
  227. IN UINTN ProcessorNumber,
  228. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  229. IN VOID *ConfigData OPTIONAL,
  230. IN BOOLEAN State
  231. );
  232. /**
  233. Detects if MONITOR/MWAIT feature supported on current processor.
  234. @param[in] ProcessorNumber The index of the CPU executing this function.
  235. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  236. structure for the CPU executing this function.
  237. @param[in] ConfigData A pointer to the configuration buffer returned
  238. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  239. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  240. RegisterCpuFeature().
  241. @retval TRUE MONITOR/MWAIT feature is supported.
  242. @retval FALSE MONITOR/MWAIT feature is not supported.
  243. @note This service could be called by BSP/APs.
  244. **/
  245. BOOLEAN
  246. EFIAPI
  247. MonitorMwaitSupport (
  248. IN UINTN ProcessorNumber,
  249. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  250. IN VOID *ConfigData OPTIONAL
  251. );
  252. /**
  253. Initializes MONITOR/MWAIT feature to specific state.
  254. @param[in] ProcessorNumber The index of the CPU executing this function.
  255. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  256. structure for the CPU executing this function.
  257. @param[in] ConfigData A pointer to the configuration buffer returned
  258. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  259. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  260. RegisterCpuFeature().
  261. @param[in] State If TRUE, then the MONITOR/MWAIT feature must be enabled.
  262. If FALSE, then the MONITOR/MWAIT feature must be disabled.
  263. @retval RETURN_SUCCESS MONITOR/MWAIT feature is initialized.
  264. @note This service could be called by BSP only.
  265. **/
  266. RETURN_STATUS
  267. EFIAPI
  268. MonitorMwaitInitialize (
  269. IN UINTN ProcessorNumber,
  270. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  271. IN VOID *ConfigData OPTIONAL,
  272. IN BOOLEAN State
  273. );
  274. /**
  275. Detects if VMX feature supported on current processor.
  276. @param[in] ProcessorNumber The index of the CPU executing this function.
  277. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  278. structure for the CPU executing this function.
  279. @param[in] ConfigData A pointer to the configuration buffer returned
  280. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  281. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  282. RegisterCpuFeature().
  283. @retval TRUE VMX feature is supported.
  284. @retval FALSE VMX feature is not supported.
  285. @note This service could be called by BSP/APs.
  286. **/
  287. BOOLEAN
  288. EFIAPI
  289. VmxSupport (
  290. IN UINTN ProcessorNumber,
  291. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  292. IN VOID *ConfigData OPTIONAL
  293. );
  294. /**
  295. Initializes VMX feature to specific state.
  296. @param[in] ProcessorNumber The index of the CPU executing this function.
  297. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  298. structure for the CPU executing this function.
  299. @param[in] ConfigData A pointer to the configuration buffer returned
  300. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  301. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  302. RegisterCpuFeature().
  303. @param[in] State If TRUE, then the VMX feature must be enabled.
  304. If FALSE, then the VMX feature must be disabled.
  305. @retval RETURN_SUCCESS VMX feature is initialized.
  306. @note This service could be called by BSP only.
  307. **/
  308. RETURN_STATUS
  309. EFIAPI
  310. VmxInitialize (
  311. IN UINTN ProcessorNumber,
  312. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  313. IN VOID *ConfigData OPTIONAL,
  314. IN BOOLEAN State
  315. );
  316. /**
  317. Detects if Lock Feature Control Register feature supported on current processor.
  318. @param[in] ProcessorNumber The index of the CPU executing this function.
  319. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  320. structure for the CPU executing this function.
  321. @param[in] ConfigData A pointer to the configuration buffer returned
  322. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  323. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  324. RegisterCpuFeature().
  325. @retval TRUE Lock Feature Control Register feature is supported.
  326. @retval FALSE Lock Feature Control Register feature is not supported.
  327. @note This service could be called by BSP/APs.
  328. **/
  329. BOOLEAN
  330. EFIAPI
  331. LockFeatureControlRegisterSupport (
  332. IN UINTN ProcessorNumber,
  333. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  334. IN VOID *ConfigData OPTIONAL
  335. );
  336. /**
  337. Initializes Lock Feature Control Register feature to specific state.
  338. @param[in] ProcessorNumber The index of the CPU executing this function.
  339. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  340. structure for the CPU executing this function.
  341. @param[in] ConfigData A pointer to the configuration buffer returned
  342. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  343. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  344. RegisterCpuFeature().
  345. @param[in] State If TRUE, then the Lock Feature Control Register feature must be enabled.
  346. If FALSE, then the Lock Feature Control Register feature must be disabled.
  347. @retval RETURN_SUCCESS Lock Feature Control Register feature is initialized.
  348. @note This service could be called by BSP only.
  349. **/
  350. RETURN_STATUS
  351. EFIAPI
  352. LockFeatureControlRegisterInitialize (
  353. IN UINTN ProcessorNumber,
  354. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  355. IN VOID *ConfigData OPTIONAL,
  356. IN BOOLEAN State
  357. );
  358. /**
  359. Detects if SMX feature supported on current processor.
  360. @param[in] ProcessorNumber The index of the CPU executing this function.
  361. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  362. structure for the CPU executing this function.
  363. @param[in] ConfigData A pointer to the configuration buffer returned
  364. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  365. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  366. RegisterCpuFeature().
  367. @retval TRUE SMX feature is supported.
  368. @retval FALSE SMX feature is not supported.
  369. @note This service could be called by BSP/APs.
  370. **/
  371. BOOLEAN
  372. EFIAPI
  373. SmxSupport (
  374. IN UINTN ProcessorNumber,
  375. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  376. IN VOID *ConfigData OPTIONAL
  377. );
  378. /**
  379. Initializes SMX feature to specific state.
  380. @param[in] ProcessorNumber The index of the CPU executing this function.
  381. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  382. structure for the CPU executing this function.
  383. @param[in] ConfigData A pointer to the configuration buffer returned
  384. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  385. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  386. RegisterCpuFeature().
  387. @param[in] State If TRUE, then SMX feature must be enabled.
  388. If FALSE, then SMX feature must be disabled.
  389. @retval RETURN_SUCCESS SMX feature is initialized.
  390. @retval RETURN_UNSUPPORTED VMX not initialized.
  391. @note This service could be called by BSP only.
  392. **/
  393. RETURN_STATUS
  394. EFIAPI
  395. SmxInitialize (
  396. IN UINTN ProcessorNumber,
  397. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  398. IN VOID *ConfigData OPTIONAL,
  399. IN BOOLEAN State
  400. );
  401. /**
  402. Detects if LimitCpuidMaxval feature supported on current processor.
  403. @param[in] ProcessorNumber The index of the CPU executing this function.
  404. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  405. structure for the CPU executing this function.
  406. @param[in] ConfigData A pointer to the configuration buffer returned
  407. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  408. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  409. RegisterCpuFeature().
  410. @retval TRUE LimitCpuidMaxval feature is supported.
  411. @retval FALSE LimitCpuidMaxval feature is not supported.
  412. @note This service could be called by BSP/APs.
  413. **/
  414. BOOLEAN
  415. EFIAPI
  416. LimitCpuidMaxvalSupport (
  417. IN UINTN ProcessorNumber,
  418. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  419. IN VOID *ConfigData OPTIONAL
  420. );
  421. /**
  422. Initializes LimitCpuidMaxval feature to specific state.
  423. @param[in] ProcessorNumber The index of the CPU executing this function.
  424. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  425. structure for the CPU executing this function.
  426. @param[in] ConfigData A pointer to the configuration buffer returned
  427. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  428. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  429. RegisterCpuFeature().
  430. @param[in] State If TRUE, then the LimitCpuidMaxval feature must be enabled.
  431. If FALSE, then the LimitCpuidMaxval feature must be disabled.
  432. @retval RETURN_SUCCESS LimitCpuidMaxval feature is initialized.
  433. @note This service could be called by BSP only.
  434. **/
  435. RETURN_STATUS
  436. EFIAPI
  437. LimitCpuidMaxvalInitialize (
  438. IN UINTN ProcessorNumber,
  439. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  440. IN VOID *ConfigData OPTIONAL,
  441. IN BOOLEAN State
  442. );
  443. /**
  444. Detects if Machine Check Exception feature supported on current processor.
  445. @param[in] ProcessorNumber The index of the CPU executing this function.
  446. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  447. structure for the CPU executing this function.
  448. @param[in] ConfigData A pointer to the configuration buffer returned
  449. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  450. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  451. RegisterCpuFeature().
  452. @retval TRUE Machine Check Exception feature is supported.
  453. @retval FALSE Machine Check Exception feature is not supported.
  454. @note This service could be called by BSP/APs.
  455. **/
  456. BOOLEAN
  457. EFIAPI
  458. MceSupport (
  459. IN UINTN ProcessorNumber,
  460. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  461. IN VOID *ConfigData OPTIONAL
  462. );
  463. /**
  464. Initializes Machine Check Exception feature to specific state.
  465. @param[in] ProcessorNumber The index of the CPU executing this function.
  466. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  467. structure for the CPU executing this function.
  468. @param[in] ConfigData A pointer to the configuration buffer returned
  469. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  470. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  471. RegisterCpuFeature().
  472. @param[in] State If TRUE, then the Machine Check Exception feature must be enabled.
  473. If FALSE, then the Machine Check Exception feature must be disabled.
  474. @retval RETURN_SUCCESS Machine Check Exception feature is initialized.
  475. @note This service could be called by BSP only.
  476. **/
  477. RETURN_STATUS
  478. EFIAPI
  479. MceInitialize (
  480. IN UINTN ProcessorNumber,
  481. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  482. IN VOID *ConfigData OPTIONAL,
  483. IN BOOLEAN State
  484. );
  485. /**
  486. Detects if Machine Check Architecture feature supported on current processor.
  487. @param[in] ProcessorNumber The index of the CPU executing this function.
  488. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  489. structure for the CPU executing this function.
  490. @param[in] ConfigData A pointer to the configuration buffer returned
  491. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  492. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  493. RegisterCpuFeature().
  494. @retval TRUE Machine Check Architecture feature is supported.
  495. @retval FALSE Machine Check Architecture feature is not supported.
  496. @note This service could be called by BSP/APs.
  497. **/
  498. BOOLEAN
  499. EFIAPI
  500. McaSupport (
  501. IN UINTN ProcessorNumber,
  502. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  503. IN VOID *ConfigData OPTIONAL
  504. );
  505. /**
  506. Initializes Machine Check Architecture feature to specific state.
  507. @param[in] ProcessorNumber The index of the CPU executing this function.
  508. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  509. structure for the CPU executing this function.
  510. @param[in] ConfigData A pointer to the configuration buffer returned
  511. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  512. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  513. RegisterCpuFeature().
  514. @param[in] State If TRUE, then the Machine Check Architecture feature must be enabled.
  515. If FALSE, then the Machine Check Architecture feature must be disabled.
  516. @retval RETURN_SUCCESS Machine Check Architecture feature is initialized.
  517. @note This service could be called by BSP only.
  518. **/
  519. RETURN_STATUS
  520. EFIAPI
  521. McaInitialize (
  522. IN UINTN ProcessorNumber,
  523. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  524. IN VOID *ConfigData OPTIONAL,
  525. IN BOOLEAN State
  526. );
  527. /**
  528. Detects if IA32_MCG_CTL feature supported on current processor.
  529. @param[in] ProcessorNumber The index of the CPU executing this function.
  530. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  531. structure for the CPU executing this function.
  532. @param[in] ConfigData A pointer to the configuration buffer returned
  533. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  534. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  535. RegisterCpuFeature().
  536. @retval TRUE IA32_MCG_CTL feature is supported.
  537. @retval FALSE IA32_MCG_CTL feature is not supported.
  538. @note This service could be called by BSP/APs.
  539. **/
  540. BOOLEAN
  541. EFIAPI
  542. McgCtlSupport (
  543. IN UINTN ProcessorNumber,
  544. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  545. IN VOID *ConfigData OPTIONAL
  546. );
  547. /**
  548. Initializes IA32_MCG_CTL feature to specific state.
  549. @param[in] ProcessorNumber The index of the CPU executing this function.
  550. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  551. structure for the CPU executing this function.
  552. @param[in] ConfigData A pointer to the configuration buffer returned
  553. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  554. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  555. RegisterCpuFeature().
  556. @param[in] State If TRUE, then the IA32_MCG_CTL feature must be enabled.
  557. If FALSE, then the IA32_MCG_CTL feature must be disabled.
  558. @retval RETURN_SUCCESS IA32_MCG_CTL feature is initialized.
  559. @note This service could be called by BSP only.
  560. **/
  561. RETURN_STATUS
  562. EFIAPI
  563. McgCtlInitialize (
  564. IN UINTN ProcessorNumber,
  565. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  566. IN VOID *ConfigData OPTIONAL,
  567. IN BOOLEAN State
  568. );
  569. /**
  570. Detects if Pending Break feature supported on current processor.
  571. @param[in] ProcessorNumber The index of the CPU executing this function.
  572. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  573. structure for the CPU executing this function.
  574. @param[in] ConfigData A pointer to the configuration buffer returned
  575. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  576. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  577. RegisterCpuFeature().
  578. @retval TRUE Pending Break feature is supported.
  579. @retval FALSE Pending Break feature is not supported.
  580. @note This service could be called by BSP/APs.
  581. **/
  582. BOOLEAN
  583. EFIAPI
  584. PendingBreakSupport (
  585. IN UINTN ProcessorNumber,
  586. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  587. IN VOID *ConfigData OPTIONAL
  588. );
  589. /**
  590. Initializes Pending Break feature to specific state.
  591. @param[in] ProcessorNumber The index of the CPU executing this function.
  592. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  593. structure for the CPU executing this function.
  594. @param[in] ConfigData A pointer to the configuration buffer returned
  595. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  596. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  597. RegisterCpuFeature().
  598. @param[in] State If TRUE, then the Pending Break feature must be enabled.
  599. If FALSE, then the Pending Break feature must be disabled.
  600. @retval RETURN_SUCCESS Pending Break feature is initialized.
  601. @note This service could be called by BSP only.
  602. **/
  603. RETURN_STATUS
  604. EFIAPI
  605. PendingBreakInitialize (
  606. IN UINTN ProcessorNumber,
  607. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  608. IN VOID *ConfigData OPTIONAL,
  609. IN BOOLEAN State
  610. );
  611. /**
  612. Detects if C1E feature supported on current processor.
  613. @param[in] ProcessorNumber The index of the CPU executing this function.
  614. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  615. structure for the CPU executing this function.
  616. @param[in] ConfigData A pointer to the configuration buffer returned
  617. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  618. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  619. RegisterCpuFeature().
  620. @retval TRUE C1E feature is supported.
  621. @retval FALSE C1E feature is not supported.
  622. @note This service could be called by BSP/APs.
  623. **/
  624. BOOLEAN
  625. EFIAPI
  626. C1eSupport (
  627. IN UINTN ProcessorNumber,
  628. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  629. IN VOID *ConfigData OPTIONAL
  630. );
  631. /**
  632. Initializes C1E feature to specific state.
  633. @param[in] ProcessorNumber The index of the CPU executing this function.
  634. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  635. structure for the CPU executing this function.
  636. @param[in] ConfigData A pointer to the configuration buffer returned
  637. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  638. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  639. RegisterCpuFeature().
  640. @param[in] State If TRUE, then the C1E feature must be enabled.
  641. If FALSE, then the C1E feature must be disabled.
  642. @retval RETURN_SUCCESS C1E feature is initialized.
  643. @note This service could be called by BSP only.
  644. **/
  645. RETURN_STATUS
  646. EFIAPI
  647. C1eInitialize (
  648. IN UINTN ProcessorNumber,
  649. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  650. IN VOID *ConfigData OPTIONAL,
  651. IN BOOLEAN State
  652. );
  653. /**
  654. Prepares for the data used by CPU feature detection and initialization.
  655. @param[in] NumberOfProcessors The number of CPUs in the platform.
  656. @return Pointer to a buffer of CPU related configuration data.
  657. @note This service could be called by BSP only.
  658. **/
  659. VOID *
  660. EFIAPI
  661. X2ApicGetConfigData (
  662. IN UINTN NumberOfProcessors
  663. );
  664. /**
  665. Detects if X2Apci feature supported on current processor.
  666. Detect if X2Apci has been already enabled.
  667. @param[in] ProcessorNumber The index of the CPU executing this function.
  668. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  669. structure for the CPU executing this function.
  670. @param[in] ConfigData A pointer to the configuration buffer returned
  671. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  672. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  673. RegisterCpuFeature().
  674. @retval TRUE X2Apci feature is supported.
  675. @retval FALSE X2Apci feature is not supported.
  676. @note This service could be called by BSP/APs.
  677. **/
  678. BOOLEAN
  679. EFIAPI
  680. X2ApicSupport (
  681. IN UINTN ProcessorNumber,
  682. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  683. IN VOID *ConfigData OPTIONAL
  684. );
  685. /**
  686. Initializes X2Apci feature to specific state.
  687. @param[in] ProcessorNumber The index of the CPU executing this function.
  688. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  689. structure for the CPU executing this function.
  690. @param[in] ConfigData A pointer to the configuration buffer returned
  691. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  692. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  693. RegisterCpuFeature().
  694. @param[in] State If TRUE, then the X2Apci feature must be enabled.
  695. If FALSE, then the X2Apci feature must be disabled.
  696. @retval RETURN_SUCCESS X2Apci feature is initialized.
  697. @note This service could be called by BSP only.
  698. **/
  699. RETURN_STATUS
  700. EFIAPI
  701. X2ApicInitialize (
  702. IN UINTN ProcessorNumber,
  703. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  704. IN VOID *ConfigData OPTIONAL,
  705. IN BOOLEAN State
  706. );
  707. /**
  708. Prepares for the data used by CPU feature detection and initialization.
  709. @param[in] NumberOfProcessors The number of CPUs in the platform.
  710. @return Pointer to a buffer of CPU related configuration data.
  711. @note This service could be called by BSP only.
  712. **/
  713. VOID *
  714. EFIAPI
  715. PpinGetConfigData (
  716. IN UINTN NumberOfProcessors
  717. );
  718. /**
  719. Detects if Protected Processor Inventory Number feature supported on current
  720. processor.
  721. @param[in] ProcessorNumber The index of the CPU executing this function.
  722. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  723. structure for the CPU executing this function.
  724. @param[in] ConfigData A pointer to the configuration buffer returned
  725. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  726. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  727. RegisterCpuFeature().
  728. @retval TRUE Protected Processor Inventory Number feature is supported.
  729. @retval FALSE Protected Processor Inventory Number feature is not supported.
  730. @note This service could be called by BSP/APs.
  731. **/
  732. BOOLEAN
  733. EFIAPI
  734. PpinSupport (
  735. IN UINTN ProcessorNumber,
  736. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  737. IN VOID *ConfigData OPTIONAL
  738. );
  739. /**
  740. Initializes Protected Processor Inventory Number feature to specific state.
  741. @param[in] ProcessorNumber The index of the CPU executing this function.
  742. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  743. structure for the CPU executing this function.
  744. @param[in] ConfigData A pointer to the configuration buffer returned
  745. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  746. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  747. RegisterCpuFeature().
  748. @param[in] State If TRUE, then the Protected Processor Inventory
  749. Number feature must be enabled.
  750. If FALSE, then the Protected Processor Inventory
  751. Number feature must be disabled.
  752. @retval RETURN_SUCCESS Protected Processor Inventory Number feature is
  753. initialized.
  754. @retval RETURN_DEVICE_ERROR Device can't change state because it has been
  755. locked.
  756. **/
  757. RETURN_STATUS
  758. EFIAPI
  759. PpinInitialize (
  760. IN UINTN ProcessorNumber,
  761. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  762. IN VOID *ConfigData OPTIONAL,
  763. IN BOOLEAN State
  764. );
  765. /**
  766. Detects if Local machine check exception feature supported on current
  767. processor.
  768. @param[in] ProcessorNumber The index of the CPU executing this function.
  769. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  770. structure for the CPU executing this function.
  771. @param[in] ConfigData A pointer to the configuration buffer returned
  772. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  773. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  774. RegisterCpuFeature().
  775. @retval TRUE Local machine check exception feature is supported.
  776. @retval FALSE Local machine check exception feature is not supported.
  777. @note This service could be called by BSP/APs.
  778. **/
  779. BOOLEAN
  780. EFIAPI
  781. LmceSupport (
  782. IN UINTN ProcessorNumber,
  783. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  784. IN VOID *ConfigData OPTIONAL
  785. );
  786. /**
  787. Initializes Local machine check exception feature to specific state.
  788. @param[in] ProcessorNumber The index of the CPU executing this function.
  789. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  790. structure for the CPU executing this function.
  791. @param[in] ConfigData A pointer to the configuration buffer returned
  792. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  793. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  794. RegisterCpuFeature().
  795. @param[in] State If TRUE, then the Local machine check exception
  796. feature must be enabled.
  797. If FALSE, then the Local machine check exception
  798. feature must be disabled.
  799. @retval RETURN_SUCCESS Local machine check exception feature is initialized.
  800. **/
  801. RETURN_STATUS
  802. EFIAPI
  803. LmceInitialize (
  804. IN UINTN ProcessorNumber,
  805. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  806. IN VOID *ConfigData OPTIONAL,
  807. IN BOOLEAN State
  808. );
  809. /**
  810. Prepares for the data used by CPU feature detection and initialization.
  811. @param[in] NumberOfProcessors The number of CPUs in the platform.
  812. @return Pointer to a buffer of CPU related configuration data.
  813. @note This service could be called by BSP only.
  814. **/
  815. VOID *
  816. EFIAPI
  817. ProcTraceGetConfigData (
  818. IN UINTN NumberOfProcessors
  819. );
  820. /**
  821. Detects if Intel Processor Trace feature supported on current processor.
  822. @param[in] ProcessorNumber The index of the CPU executing this function.
  823. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  824. structure for the CPU executing this function.
  825. @param[in] ConfigData A pointer to the configuration buffer returned
  826. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  827. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  828. RegisterCpuFeature().
  829. @retval TRUE Processor Trace feature is supported.
  830. @retval FALSE Processor Trace feature is not supported.
  831. @note This service could be called by BSP/APs.
  832. **/
  833. BOOLEAN
  834. EFIAPI
  835. ProcTraceSupport (
  836. IN UINTN ProcessorNumber,
  837. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  838. IN VOID *ConfigData OPTIONAL
  839. );
  840. /**
  841. Initializes Intel Processor Trace feature to specific state.
  842. @param[in] ProcessorNumber The index of the CPU executing this function.
  843. @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
  844. structure for the CPU executing this function.
  845. @param[in] ConfigData A pointer to the configuration buffer returned
  846. by CPU_FEATURE_GET_CONFIG_DATA. NULL if
  847. CPU_FEATURE_GET_CONFIG_DATA was not provided in
  848. RegisterCpuFeature().
  849. @param[in] State If TRUE, then the Processor Trace feature must be
  850. enabled.
  851. If FALSE, then the Processor Trace feature must be
  852. disabled.
  853. @retval RETURN_SUCCESS Intel Processor Trace feature is initialized.
  854. **/
  855. RETURN_STATUS
  856. EFIAPI
  857. ProcTraceInitialize (
  858. IN UINTN ProcessorNumber,
  859. IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo,
  860. IN VOID *ConfigData OPTIONAL,
  861. IN BOOLEAN State
  862. );
  863. #endif