X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FVariable%2FPei%2FVariable.c;h=1bcab3b770a5d4d3b40365601e5424d14f6e8100;hp=4060f4711dd07dd4ea533971ee099895f809b585;hb=09808bd39b0c76559354253639766458ec24da79;hpb=e25a76785e44061a1b5e29f3228febacf6f50932 diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c index 4060f4711d..1bcab3b770 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -2,7 +2,7 @@ Implement ReadOnly Variable Services required by PEIM and install PEI ReadOnly Varaiable2 PPI. These services operates the non volatile storage space. -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -495,6 +495,31 @@ CompareWithValidVariable ( return EFI_NOT_FOUND; } +/** + Get HOB variable store. + +**/ +VOID +GetHobVariableStore ( + OUT VARIABLE_STORE_INFO *StoreInfo, + OUT VARIABLE_STORE_HEADER **VariableStoreHeader + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + + GuidHob = GetFirstGuidHob (&gEfiAuthenticatedVariableGuid); + if (GuidHob != NULL) { + *VariableStoreHeader = (VARIABLE_STORE_HEADER *) GET_GUID_HOB_DATA (GuidHob); + StoreInfo->AuthFlag = TRUE; + } else { + GuidHob = GetFirstGuidHob (&gEfiVariableGuid); + if (GuidHob != NULL) { + *VariableStoreHeader = (VARIABLE_STORE_HEADER *) GET_GUID_HOB_DATA (GuidHob); + StoreInfo->AuthFlag = FALSE; + } + } +} + /** Return the variable store header and the store info based on the Index. @@ -523,17 +548,8 @@ GetVariableStore ( VariableStoreHeader = NULL; switch (Type) { case VariableStoreTypeHob: - GuidHob = GetFirstGuidHob (&gEfiAuthenticatedVariableGuid); - if (GuidHob != NULL) { - VariableStoreHeader = (VARIABLE_STORE_HEADER *) GET_GUID_HOB_DATA (GuidHob); - StoreInfo->AuthFlag = TRUE; - } else { - GuidHob = GetFirstGuidHob (&gEfiVariableGuid); - if (GuidHob != NULL) { - VariableStoreHeader = (VARIABLE_STORE_HEADER *) GET_GUID_HOB_DATA (GuidHob); - StoreInfo->AuthFlag = FALSE; - } - } + GetHobVariableStore (StoreInfo, &VariableStoreHeader); + break; case VariableStoreTypeNv: