From 270c7b132a6a417edff852229d05ca791ed46b7c Mon Sep 17 00:00:00 2001 From: Guo Mang Date: Mon, 8 May 2017 11:01:15 +0800 Subject: Upgrade core Upgrade core to UDK2017 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang Reviewed-by: zwei4 --- .../Universal/Variable/RuntimeDxe/Variable.c | 5 +- .../ScPciExpressHelpersLibrary.h | 5 +- .../SouthCluster/ScInit/Smm/ScInitSmm.c | 14 +- .../SouthCluster/ScInit/Smm/ScInitSmm.h | 4 +- .../Txe/Library/HeciMsgLib/DxeSmmHeciMsgLib.c | 189 +-------------------- 5 files changed, 23 insertions(+), 194 deletions(-) (limited to 'Silicon') diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SampleCode/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/Silicon/BroxtonSoC/BroxtonSiPkg/SampleCode/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 43687dafe8..9fcb55197d 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/SampleCode/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SampleCode/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -16,7 +16,7 @@ VariableServiceSetVariable() should also check authenticate data to avoid buffer overflow, integer overflow. It should also check attribute to avoid authentication bypass. - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2017, 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 @@ -3448,6 +3448,9 @@ VariableExistsInHob ( VARIABLE_POINTER_TRACK Variable; EFI_STATUS Status; + if (mVariableModuleGlobal->VariableGlobal.HobVariableBase == 0) { + return FALSE; + } Variable.CurrPtr = NULL; Variable.StartPtr = GetStartPointer ((VARIABLE_STORE_HEADER *) (UINTN) mVariableModuleGlobal->VariableGlobal.HobVariableBase); Variable.EndPtr = GetEndPointer ((VARIABLE_STORE_HEADER *) (UINTN) mVariableModuleGlobal->VariableGlobal.HobVariableBase); diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/PeiDxeSmmScPciExpressHelpersLib/ScPciExpressHelpersLibrary.h b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/PeiDxeSmmScPciExpressHelpersLib/ScPciExpressHelpersLibrary.h index 9d20fb6797..a651501a80 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/PeiDxeSmmScPciExpressHelpersLib/ScPciExpressHelpersLibrary.h +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/PeiDxeSmmScPciExpressHelpersLib/ScPciExpressHelpersLibrary.h @@ -1,7 +1,7 @@ /** @file Header file for PCI Express helps library implementation. - Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2008 - 2017, 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 @@ -28,6 +28,9 @@ #include #include + +#define DEVICE_ID_NOCARE 0xFFFF + #define LTR_VALUE_MASK (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7 + BIT8 + BIT9) #define LTR_SCALE_MASK (BIT10 + BIT11 + BIT12) diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Smm/ScInitSmm.c b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Smm/ScInitSmm.c index ed8a74b1ce..c3c1756494 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Smm/ScInitSmm.c +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Smm/ScInitSmm.c @@ -1,7 +1,7 @@ /** @file SC Init Smm module for SC specific SMI handlers. - Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2013 - 2017, 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 @@ -14,6 +14,7 @@ **/ #include "ScInitSmm.h" +#include GLOBAL_REMOVE_IF_UNREFERENCED EFI_SMM_SW_DISPATCH2_PROTOCOL *mSwDispatch; GLOBAL_REMOVE_IF_UNREFERENCED EFI_SMM_SX_DISPATCH2_PROTOCOL *mSxDispatch; @@ -144,6 +145,7 @@ ScInitSmmEntryPoint ( { EFI_STATUS Status; EFI_PEI_HOB_POINTERS HobPtr; + SC_PCIE_CONFIG *PcieRpConfig; DEBUG ((DEBUG_INFO, "ScInitSmmEntryPoint()\n")); @@ -171,13 +173,21 @@ ScInitSmmEntryPoint ( ASSERT (HobPtr.Guid != NULL); mScPolicy = (SC_POLICY_HOB *) GET_GUID_HOB_DATA (HobPtr.Guid); - Status = GetConfigBlock ((VOID *) mScPolicy, &gPcieRpConfigGuid, (VOID *) &mPcieRpConfig); + Status = GetConfigBlock ((VOID *) mScPolicy, &gPcieRpConfigGuid, (VOID *) &PcieRpConfig); ASSERT_EFI_ERROR (Status); + + mPcieRpConfig = AllocatePool(sizeof (SC_PCIE_CONFIG)); + if (mPcieRpConfig != NULL) { + CopyMem (mPcieRpConfig, PcieRpConfig, sizeof (SC_PCIE_CONFIG)); + } + InitializeSxHandler (ImageHandle); Status = InitializeScPcieSmm (ImageHandle, SystemTable); ASSERT_EFI_ERROR (Status); + FreePool (mPcieRpConfig); + return EFI_SUCCESS; } diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Smm/ScInitSmm.h b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Smm/ScInitSmm.h index 81748ba1f0..b2e7fb447c 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Smm/ScInitSmm.h +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Smm/ScInitSmm.h @@ -1,7 +1,7 @@ /** @file Header file for SC Init SMM Handler - Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2012 - 2017, 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 @@ -59,8 +59,6 @@ extern UINTN mResvMmioSize; #define DeviceD0 0x00 #define DeviceD3 0x03 -#define ARRAY_SIZE (data) (sizeof (data) / sizeof (data[0])) - typedef enum { PciCfg, PciMmr diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/HeciMsgLib/DxeSmmHeciMsgLib.c b/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/HeciMsgLib/DxeSmmHeciMsgLib.c index 61e41a6054..f64f50ad5d 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/HeciMsgLib/DxeSmmHeciMsgLib.c +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/Txe/Library/HeciMsgLib/DxeSmmHeciMsgLib.c @@ -1,7 +1,7 @@ /** @file Implementation file DXE/SMM specific HECI Message functionality. - Copyright (c) 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2016 - 2017, 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 @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -32,197 +31,13 @@ #include #include #include +#include UINT8 Heci2DataBuffer[MAX (HECI2_BIOS_MAX_WRITE_MSG_SIZE, HECI2_BIOS_MAX_READ_MSG_SIZE)]; UINT32 mMonoCount = 0; UINT8 mHmacSha256Key[32] = {0}; -/** - Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations. - - @return The size, in bytes, of the context buffer required for HMAC-SHA1 operations. - -**/ -UINTN -EFIAPI -HmacSha256GetContextSize ( - VOID - ) -{ - // - // Retrieves the OpenSSL HMAC-SHA1 Context Size - // - return (UINTN) (sizeof (HMAC_CTX)); -} - - -/** - Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for - subsequent use. - - If HmacSha1Context is NULL, then return FALSE. - - @param[out] HmacSha1Context Pointer to HMAC-SHA1 context being initialized. - @param[in] Key Pointer to the user-supplied key. - @param[in] KeySize Key size in bytes. - - @retval TRUE HMAC-SHA1 context initialization succeeded. - @retval FALSE HMAC-SHA1 context initialization failed. - -**/ -BOOLEAN -EFIAPI -HmacSha256Init ( - OUT VOID *HmacSha256Context, - IN CONST UINT8 *Key, - IN UINTN KeySize - ) -{ - // - // Check input parameters. - // - if (HmacSha256Context == NULL || KeySize > INT_MAX) { - return FALSE; - } - - // - // OpenSSL HMAC-SHA1 Context Initialization - // - HMAC_CTX_init (HmacSha256Context); - HMAC_Init_ex (HmacSha256Context, Key, (UINT32) KeySize, EVP_sha256(), NULL); - - return TRUE; -} - - -/** - Makes a copy of an existing HMAC-SHA1 context. - - If HmacSha1Context is NULL, then return FALSE. - If NewHmacSha1Context is NULL, then return FALSE. - - @param[in] HmacSha1Context Pointer to HMAC-SHA1 context being copied. - @param[out] NewHmacSha1Context Pointer to new HMAC-SHA1 context. - - @retval TRUE HMAC-SHA1 context copy succeeded. - @retval FALSE HMAC-SHA1 context copy failed. - -**/ -BOOLEAN -EFIAPI -HmacSha256Duplicate ( - IN CONST VOID *HmacSha256Context, - OUT VOID *NewHmacSha256Context - ) -{ - // - // Check input parameters. - // - if (HmacSha256Context == NULL || NewHmacSha256Context == NULL) { - return FALSE; - } - - CopyMem (NewHmacSha256Context, HmacSha256Context, sizeof (HMAC_CTX)); - - return TRUE; -} - - -/** - Digests the input data and updates HMAC-SHA1 context. - - This function performs HMAC-SHA1 digest on a data buffer of the specified size. - It can be called multiple times to compute the digest of long or discontinuous data streams. - HMAC-SHA1 context should be already correctly intialized by HmacSha1Init(), and should not - be finalized by HmacSha1Final(). Behavior with invalid context is undefined. - - If HmacSha1Context is NULL, then return FALSE. - - @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context. - @param[in] Data Pointer to the buffer containing the data to be digested. - @param[in] DataSize Size of Data buffer in bytes. - - @retval TRUE HMAC-SHA1 data digest succeeded. - @retval FALSE HMAC-SHA1 data digest failed. - -**/ -BOOLEAN -EFIAPI -HmacSha256Update ( - IN OUT VOID *HmacSha256Context, - IN CONST VOID *Data, - IN UINTN DataSize - ) -{ - // - // Check input parameters. - // - if (HmacSha256Context == NULL) { - return FALSE; - } - - // - // Check invalid parameters, in case that only DataLength was checked in OpenSSL - // - if (Data == NULL && DataSize != 0) { - return FALSE; - } - - // - // OpenSSL HMAC-SHA1 digest update - // - HMAC_Update (HmacSha256Context, Data, DataSize); - - return TRUE; -} - - -/** - Completes computation of the HMAC-SHA1 digest value. - - This function completes HMAC-SHA1 digest computation and retrieves the digest value into - the specified memory. After this function has been called, the HMAC-SHA1 context cannot - be used again. - HMAC-SHA1 context should be already correctly intialized by HmacSha1Init(), and should - not be finalized by HmacSha1Final(). Behavior with invalid HMAC-SHA1 context is undefined. - - If HmacSha1Context is NULL, then return FALSE. - If HmacValue is NULL, then return FALSE. - - @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context. - @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA1 digest - value (20 bytes). - - @retval TRUE HMAC-SHA1 digest computation succeeded. - @retval FALSE HMAC-SHA1 digest computation failed. - -**/ -BOOLEAN -EFIAPI -HmacSha256Final ( - IN OUT VOID *HmacSha256Context, - OUT UINT8 *HmacValue - ) -{ - UINT32 Length; - - // - // Check input parameters. - // - if (HmacSha256Context == NULL || HmacValue == NULL) { - return FALSE; - } - - // - // OpenSSL HMAC-SHA1 digest finalization - // - HMAC_Final (HmacSha256Context, HmacValue, &Length); - HMAC_CTX_cleanup (HmacSha256Context); - - return TRUE; -} - EFI_STATUS ComputeHmacSha256Signature ( -- cgit v1.2.3