-/*++\r
-\r
-Copyright (c) 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-Module Name:\r
-\r
- HwErrRecSupport.c\r
-\r
-Abstract:\r
-\r
+/** @file\r
Set the level of support for Hardware Error Record Persistence that is\r
implemented by the platform.\r
\r
-Revision History\r
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
---*/\r
+**/\r
\r
#include "HwErrRecSupport.h"\r
\r
+/**\r
+ Set the HwErrRecSupport variable contains a binary UINT16 that supplies the\r
+ level of support for Hardware Error Record Persistence that is implemented\r
+ by the platform.\r
+\r
+**/\r
VOID\r
InitializeHwErrRecSupport (\r
- IN UINT16 HwErrRecSupportLevel\r
+ VOID\r
)\r
-/*++\r
-\r
- Routine Description:\r
- Set the HwErrRecSupport variable contains a binary UINT16 that supplies the\r
- level of support for Hardware Error Record Persistence that is implemented\r
- by the platform.\r
-\r
- Arguments:\r
- HwErrRecSupportLevel\r
- zero value - Indicates that the platform implements no support for\r
- Hardware Error Record Persistence.\r
- non-zero value - Indicates that the platform implements Hardware Error\r
- Record Persistence.\r
-\r
- Returns:\r
-\r
---*/\r
{\r
- EFI_STATUS Status;\r
-\r
- Status = gRT->SetVariable (\r
- L"HwErrRecSupport",\r
- &gEfiGlobalVariableGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
- sizeof (UINT16),\r
- &HwErrRecSupportLevel\r
- );\r
- if (EFI_ERROR (Status)) {\r
- DEBUG ((EFI_D_ERROR, "HwErrRecSupport: Can not set the variable\n"));\r
+ EFI_STATUS Status;\r
+ UINT16 HardwareErrorRecordLevel;\r
+\r
+ HardwareErrorRecordLevel = PcdGet16 (PcdHardwareErrorRecordLevel);\r
+\r
+ if (HardwareErrorRecordLevel != 0) {\r
+ //\r
+ // If level value equal 0, no need set to 0 to variable area because UEFI specification\r
+ // define same behavior between no value or 0 value for L"HwErrRecSupport".\r
+ //\r
+ Status = gRT->SetVariable (\r
+ L"HwErrRecSupport",\r
+ &gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+ sizeof (UINT16),\r
+ &HardwareErrorRecordLevel\r
+ );\r
+ ASSERT_EFI_ERROR(Status);\r
}\r
-\r
}\r