2 Local machine check exception feature.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "CpuCommonFeatures.h"
18 Detects if Local machine check exception feature supported on current
21 @param[in] ProcessorNumber The index of the CPU executing this function.
22 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
23 structure for the CPU executing this function.
24 @param[in] ConfigData A pointer to the configuration buffer returned
25 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
26 CPU_FEATURE_GET_CONFIG_DATA was not provided in
29 @retval TRUE Local machine check exception feature is supported.
30 @retval FALSE Local machine check exception feature is not supported.
32 @note This service could be called by BSP/APs.
37 IN UINTN ProcessorNumber
,
38 IN REGISTER_CPU_FEATURE_INFORMATION
*CpuInfo
,
39 IN VOID
*ConfigData OPTIONAL
42 MSR_IA32_MCG_CAP_REGISTER McgCap
;
44 McgCap
.Uint64
= AsmReadMsr64 (MSR_IA32_MCG_CAP
);
45 if (ProcessorNumber
== 0) {
46 DEBUG ((EFI_D_INFO
, "LMCE eanble = %x\n", (BOOLEAN
) (McgCap
.Bits
.MCG_LMCE_P
!= 0)));
48 return (BOOLEAN
) (McgCap
.Bits
.MCG_LMCE_P
!= 0);
52 Initializes Local machine check exception feature to specific state.
54 @param[in] ProcessorNumber The index of the CPU executing this function.
55 @param[in] CpuInfo A pointer to the REGISTER_CPU_FEATURE_INFORMATION
56 structure for the CPU executing this function.
57 @param[in] ConfigData A pointer to the configuration buffer returned
58 by CPU_FEATURE_GET_CONFIG_DATA. NULL if
59 CPU_FEATURE_GET_CONFIG_DATA was not provided in
61 @param[in] State If TRUE, then the Local machine check exception
62 feature must be enabled.
63 If FALSE, then the Local machine check exception
64 feature must be disabled.
66 @retval RETURN_SUCCESS Local machine check exception feature is initialized.
72 IN UINTN ProcessorNumber
,
73 IN REGISTER_CPU_FEATURE_INFORMATION
*CpuInfo
,
74 IN VOID
*ConfigData
, OPTIONAL
78 MSR_IA32_FEATURE_CONTROL_REGISTER
*MsrRegister
;
80 ASSERT (ConfigData
!= NULL
);
81 MsrRegister
= (MSR_IA32_FEATURE_CONTROL_REGISTER
*) ConfigData
;
82 if (MsrRegister
[ProcessorNumber
].Bits
.Lock
== 0) {
83 CPU_REGISTER_TABLE_WRITE_FIELD (
86 MSR_IA32_FEATURE_CONTROL
,
87 MSR_IA32_FEATURE_CONTROL_REGISTER
,
92 return RETURN_SUCCESS
;