Re: [edk2] [Patch 1/2] CryptoPkg/TlsLib: Remove the redundant free of BIO objects
Reviewed-by: Long Qin -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu Sent: Monday, July 31, 2017 1:41 PM To: edk2-devel@lists.01.org Cc: Ye, Ting ; Wu, Jiaxin ; Long, Qin Subject: [edk2] [Patch 1/2] CryptoPkg/TlsLib: Remove the redundant free of BIO objects TLS BIO objects (InBio/OutBio) will be freed by SSL_free() function. So, the following free operation (BIO_free) in TlsFree is redundant. It can be removed directly. Cc: Ye Ting Cc: Long Qin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- CryptoPkg/Library/TlsLib/TlsInit.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/CryptoPkg/Library/TlsLib/TlsInit.c b/CryptoPkg/Library/TlsLib/TlsInit.c index e2c9744..e524647 100644 --- a/CryptoPkg/Library/TlsLib/TlsInit.c +++ b/CryptoPkg/Library/TlsLib/TlsInit.c @@ -128,24 +128,16 @@ TlsFree ( if (TlsConn == NULL) { return; } // - // Free the internal TLS and BIO objects. + // Free the internal TLS and related BIO objects. // if (TlsConn->Ssl != NULL) { SSL_free (TlsConn->Ssl); } - if (TlsConn->InBio != NULL) { -BIO_free (TlsConn->InBio); - } - - if (TlsConn->OutBio != NULL) { -BIO_free (TlsConn->OutBio); - } - OPENSSL_free (Tls); } /** Create a new TLS object for a connection. -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 1/2] CryptoPkg/TlsLib: Remove the redundant free of BIO objects
TLS BIO objects (InBio/OutBio) will be freed by SSL_free() function. So, the following free operation (BIO_free) in TlsFree is redundant. It can be removed directly. Cc: Ye Ting Cc: Long Qin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- CryptoPkg/Library/TlsLib/TlsInit.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/CryptoPkg/Library/TlsLib/TlsInit.c b/CryptoPkg/Library/TlsLib/TlsInit.c index e2c9744..e524647 100644 --- a/CryptoPkg/Library/TlsLib/TlsInit.c +++ b/CryptoPkg/Library/TlsLib/TlsInit.c @@ -128,24 +128,16 @@ TlsFree ( if (TlsConn == NULL) { return; } // - // Free the internal TLS and BIO objects. + // Free the internal TLS and related BIO objects. // if (TlsConn->Ssl != NULL) { SSL_free (TlsConn->Ssl); } - if (TlsConn->InBio != NULL) { -BIO_free (TlsConn->InBio); - } - - if (TlsConn->OutBio != NULL) { -BIO_free (TlsConn->OutBio); - } - OPENSSL_free (Tls); } /** Create a new TLS object for a connection. -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/2] NetworkPkg/HttpDxe: Destroy the TLS instance when cleaning up the HTTP child
During clean up the HTTP child, all resources used by it should be cleaned. But currently, TLS instance is not destroyed. This patch is to fix this issue. Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/HttpDxe/HttpImpl.c | 1 + NetworkPkg/HttpDxe/HttpProto.c| 7 +++ NetworkPkg/HttpDxe/HttpProto.h| 3 ++- NetworkPkg/HttpDxe/HttpsSupport.c | 14 +++--- NetworkPkg/HttpDxe/HttpsSupport.h | 4 +++- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index 1f7a4fa..9570053 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -378,10 +378,11 @@ EfiHttpRequest ( ImageHandle = HttpInstance->Service->Ip4DriverBindingHandle; } HttpInstance->TlsChildHandle = TlsCreateChild ( ImageHandle, + &(HttpInstance->TlsSb), &(HttpInstance->Tls), &(HttpInstance->TlsConfiguration) ); if (HttpInstance->TlsChildHandle == NULL) { return EFI_DEVICE_ERROR; diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 3fda294..ab00f3d 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -862,10 +862,17 @@ HttpCleanProtocol ( } NetMapClean (&HttpInstance->TxTokens); NetMapClean (&HttpInstance->RxTokens); + if (HttpInstance->TlsSb != NULL && HttpInstance->TlsChildHandle != NULL) { +// +// Destroy the TLS instance. +// +HttpInstance->TlsSb->DestroyChild (HttpInstance->TlsSb, HttpInstance->TlsChildHandle); + } + if (HttpInstance->Tcp4ChildHandle != NULL) { gBS->CloseProtocol ( HttpInstance->Tcp4ChildHandle, &gEfiTcp4ProtocolGuid, HttpInstance->Service->Ip4DriverBindingHandle, diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h index 95fb484..04d36aa 100644 --- a/NetworkPkg/HttpDxe/HttpProto.h +++ b/NetworkPkg/HttpDxe/HttpProto.h @@ -164,11 +164,12 @@ typedef struct _HTTP_PROTOCOL { // // Https Support // BOOLEAN UseHttps; - + + EFI_SERVICE_BINDING_PROTOCOL *TlsSb; EFI_HANDLE TlsChildHandle; /// Tls ChildHandle TLS_CONFIG_DATA TlsConfigData; EFI_TLS_PROTOCOL *Tls; EFI_TLS_CONFIGURATION_PROTOCOL *TlsConfiguration; EFI_TLS_SESSION_STATETlsSessionState; diff --git a/NetworkPkg/HttpDxe/HttpsSupport.c b/NetworkPkg/HttpDxe/HttpsSupport.c index e4d9a37..e6f4d5a 100644 --- a/NetworkPkg/HttpDxe/HttpsSupport.c +++ b/NetworkPkg/HttpDxe/HttpsSupport.c @@ -138,44 +138,44 @@ IsHttpsUrl ( /** Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL. @param[in] ImageHandle The firmware allocated handle for the UEFI image. + @param[out] TlsSb Pointer to the TLS SERVICE_BINDING_PROTOCOL. @param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL instance. @param[out] TlsConfiguration Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance. @return The child handle with opened EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL. **/ EFI_HANDLE EFIAPI TlsCreateChild ( IN EFI_HANDLE ImageHandle, + OUT EFI_SERVICE_BINDING_PROTOCOL **TlsSb, OUT EFI_TLS_PROTOCOL **TlsProto, OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration ) { EFI_STATUSStatus; - EFI_SERVICE_BINDING_PROTOCOL *TlsSb; EFI_HANDLETlsChildHandle; - TlsSb = NULL; TlsChildHandle = 0; // // Locate TlsServiceBinding protocol. // gBS->LocateProtocol ( &gEfiTlsServiceBindingProtocolGuid, NULL, - (VOID **) &TlsSb + (VOID **) TlsSb ); - if (TlsSb == NULL) { + if (*TlsSb == NULL) { return NULL; } - Status = TlsSb->CreateChild (TlsSb, &TlsChildHandle); + Status = (*TlsSb)->CreateChild (*TlsSb, &TlsChildHandle); if (EFI_ERROR (Status)) { return NULL; } Status = gBS->OpenProtocol ( @@ -185,11 +185,11 @@ TlsCreateChild ( ImageHandle, TlsChildHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { -TlsSb->DestroyChild (TlsSb, TlsChildHandle); +(*TlsSb)->DestroyChild (*TlsSb, TlsChildHandle); return NULL; } Status = gBS->OpenProtocol ( TlsChildHandle, @@ -198,11 +198,11 @@ TlsCreateChild ( ImageHandle, TlsChildHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { -TlsSb->DestroyChild (
[edk2] [Patch 0/2] Fix the bug when cleaning up the TLS instance
Cc: Ye Ting Cc: Fu Siyuan Cc: Long Qin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Jiaxin Wu (2): CryptoPkg/TlsLib: Remove the redundant free of BIO objects NetworkPkg/HttpDxe: Destroy the TLS instance when cleaning up the HTTP child CryptoPkg/Library/TlsLib/TlsInit.c | 10 +- NetworkPkg/HttpDxe/HttpImpl.c | 1 + NetworkPkg/HttpDxe/HttpProto.c | 7 +++ NetworkPkg/HttpDxe/HttpProto.h | 3 ++- NetworkPkg/HttpDxe/HttpsSupport.c | 14 +++--- NetworkPkg/HttpDxe/HttpsSupport.h | 4 +++- 6 files changed, 21 insertions(+), 18 deletions(-) -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack
Reviewed-by: Jeff Fan -Original Message- From: Zeng, Star Sent: Monday, July 31, 2017 11:32 AM To: edk2-devel@lists.01.org Cc: Zeng, Star; Gao, Liming; Fan, Jeff Subject: [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack Add SecPerformancePpiCallBack to get SEC performance data and build HOB to convey the SEC performance data to DXE phase. Cc: Liming Gao Cc: Jeff Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- UefiCpuPkg/SecCore/SecCore.inf | 7 +++ UefiCpuPkg/SecCore/SecMain.c | 46 ++ UefiCpuPkg/SecCore/SecMain.h | 25 ++- 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/SecCore/SecCore.inf b/UefiCpuPkg/SecCore/SecCore.inf index 0d135e62ec33..a8f8a6da2728 100644 --- a/UefiCpuPkg/SecCore/SecCore.inf +++ b/UefiCpuPkg/SecCore/SecCore.inf @@ -71,6 +71,13 @@ [Ppis] ## SOMETIMES_PRODUCES gEfiSecPlatformInformation2PpiGuid gEfiTemporaryRamDonePpiGuid ## PRODUCES + ## NOTIFY + ## SOMETIMES_CONSUMES + gPeiSecPerformancePpiGuid + +[Guids] + ## SOMETIMES_PRODUCES ## HOB + gEfiFirmwarePerformanceGuid [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdPeiTemporaryRamStackSize ## CONSUMES diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index a53fa04cc303..3d4e6ac92a5e 100644 --- a/UefiCpuPkg/SecCore/SecMain.c +++ b/UefiCpuPkg/SecCore/SecMain.c @@ -22,6 +22,14 @@ EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformationPpi = { SecPlatformInfo EFI_PEI_PPI_DESCRIPTORmPeiSecPlatformInformationPpi[] = { { +// +// SecPerformance PPI notify descriptor. +// +EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, +&gPeiSecPerformancePpiGuid, +(VOID *) (UINTN) SecPerformancePpiCallBack }, { EFI_PEI_PPI_DESCRIPTOR_PPI, &gEfiTemporaryRamDonePpiGuid, &gSecTemporaryRamDonePpi @@ -56,6 +64,44 @@ SecStartupPhase2( ); /** + Entry point of the notification callback function itself within the PEIM. + It is to get SEC performance data and build HOB to convey the SEC + performance data to DXE phase. + + @param PeiServices Indirect reference to the PEI Services Table. + @param NotifyDescriptor Address of the notification descriptor data structure. + @param Ppi Address of the PPI that was installed. + + @return Status of the notification. + The status code returned from this function is ignored. +**/ +EFI_STATUS +EFIAPI +SecPerformancePpiCallBack ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ) +{ + EFI_STATUSStatus; + PEI_SEC_PERFORMANCE_PPI *SecPerf; + FIRMWARE_SEC_PERFORMANCE Performance; + + SecPerf = (PEI_SEC_PERFORMANCE_PPI *) Ppi; Status = + SecPerf->GetPerformance (PeiServices, SecPerf, &Performance); if + (!EFI_ERROR (Status)) { +BuildGuidDataHob ( + &gEfiFirmwarePerformanceGuid, + &Performance, + sizeof (FIRMWARE_SEC_PERFORMANCE) +); +DEBUG ((DEBUG_INFO, "FPDT: SEC Performance Hob ResetEnd = %ld\n", + Performance.ResetEnd)); } + + return Status; +} + +/** Entry point to the C language phase of SEC. After the SEC assembly code has initialized some temporary memory and set up the stack, diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h index 6e31a953f757..46c7d41c6e3e 100644 --- a/UefiCpuPkg/SecCore/SecMain.h +++ b/UefiCpuPkg/SecCore/SecMain.h @@ -1,7 +1,7 @@ /** @file Master header file for SecCore. - 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 which accompanies this distribution. The full text of the license may be found at @@ -20,6 +20,9 @@ #include #include #include +#include + +#include #include #include @@ -157,4 +160,24 @@ RepublishSecPlatformInformationPpi ( VOID ); +/** + Entry point of the notification callback function itself within the PEIM. + It is to get SEC performance data and build HOB to convey the SEC +performance + data to DXE phase. + + @param PeiServices Indirect reference to the PEI Services Table. + @param NotifyDescriptor Address of the notification descriptor data structure. + @param Ppi Address of the PPI that was installed. + + @return Status of the notification. + The status code returned from this function is ignored. +**/ +EFI_STATUS +EFIAPI +SecPerformancePpiCallBack ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ); + #endif -- 2.7.0.windows.1 ___ edk2-devel mai
Re: [edk2] [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned
Reviewed-by: Jeff Fan -Original Message- From: Zeng, Star Sent: Monday, July 31, 2017 11:32 AM To: edk2-devel@lists.01.org Cc: Zeng, Star; Gao, Liming; Fan, Jeff Subject: [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned As HOB which has 8byte aligned requirement will be built based on them in PEI phase. Cc: Liming Gao Cc: Jeff Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- UefiCpuPkg/SecCore/SecMain.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index 077d0db49f53..a53fa04cc303 100644 --- a/UefiCpuPkg/SecCore/SecMain.c +++ b/UefiCpuPkg/SecCore/SecMain.c @@ -1,7 +1,7 @@ /** @file C functions in SEC - 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 which accompanies this distribution. The full text of the license may be found at @@ -230,6 +230,11 @@ SecStartupPhase2( ASSERT (SecCoreData->PeiTemporaryRamSize > Index * sizeof (EFI_PEI_PPI_DESCRIPTOR)); SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN) SecCoreData->PeiTemporaryRamBase + Index * sizeof (EFI_PEI_PPI_DESCRIPTOR)); SecCoreData->PeiTemporaryRamSize = SecCoreData->PeiTemporaryRamSize - Index * sizeof (EFI_PEI_PPI_DESCRIPTOR); +// +// Adjust the Base and Size to be 8-byte aligned. +// +SecCoreData->PeiTemporaryRamBase = (VOID *)(((UINTN)SecCoreData->PeiTemporaryRamBase + 7) & ~0x07); +SecCoreData->PeiTemporaryRamSize &= ~0x07; } else { // // No addition PPI, PpiList directly point to the common PPI list. -- 2.7.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH 2/3] UefiCpuPkg SecCore: Add SecPerformancePpiCallBack
Add SecPerformancePpiCallBack to get SEC performance data and build HOB to convey the SEC performance data to DXE phase. Cc: Liming Gao Cc: Jeff Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- UefiCpuPkg/SecCore/SecCore.inf | 7 +++ UefiCpuPkg/SecCore/SecMain.c | 46 ++ UefiCpuPkg/SecCore/SecMain.h | 25 ++- 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/SecCore/SecCore.inf b/UefiCpuPkg/SecCore/SecCore.inf index 0d135e62ec33..a8f8a6da2728 100644 --- a/UefiCpuPkg/SecCore/SecCore.inf +++ b/UefiCpuPkg/SecCore/SecCore.inf @@ -71,6 +71,13 @@ [Ppis] ## SOMETIMES_PRODUCES gEfiSecPlatformInformation2PpiGuid gEfiTemporaryRamDonePpiGuid ## PRODUCES + ## NOTIFY + ## SOMETIMES_CONSUMES + gPeiSecPerformancePpiGuid + +[Guids] + ## SOMETIMES_PRODUCES ## HOB + gEfiFirmwarePerformanceGuid [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdPeiTemporaryRamStackSize ## CONSUMES diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index a53fa04cc303..3d4e6ac92a5e 100644 --- a/UefiCpuPkg/SecCore/SecMain.c +++ b/UefiCpuPkg/SecCore/SecMain.c @@ -22,6 +22,14 @@ EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformationPpi = { SecPlatformInfo EFI_PEI_PPI_DESCRIPTORmPeiSecPlatformInformationPpi[] = { { +// +// SecPerformance PPI notify descriptor. +// +EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, +&gPeiSecPerformancePpiGuid, +(VOID *) (UINTN) SecPerformancePpiCallBack + }, + { EFI_PEI_PPI_DESCRIPTOR_PPI, &gEfiTemporaryRamDonePpiGuid, &gSecTemporaryRamDonePpi @@ -56,6 +64,44 @@ SecStartupPhase2( ); /** + Entry point of the notification callback function itself within the PEIM. + It is to get SEC performance data and build HOB to convey the SEC performance + data to DXE phase. + + @param PeiServices Indirect reference to the PEI Services Table. + @param NotifyDescriptor Address of the notification descriptor data structure. + @param Ppi Address of the PPI that was installed. + + @return Status of the notification. + The status code returned from this function is ignored. +**/ +EFI_STATUS +EFIAPI +SecPerformancePpiCallBack ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ) +{ + EFI_STATUSStatus; + PEI_SEC_PERFORMANCE_PPI *SecPerf; + FIRMWARE_SEC_PERFORMANCE Performance; + + SecPerf = (PEI_SEC_PERFORMANCE_PPI *) Ppi; + Status = SecPerf->GetPerformance (PeiServices, SecPerf, &Performance); + if (!EFI_ERROR (Status)) { +BuildGuidDataHob ( + &gEfiFirmwarePerformanceGuid, + &Performance, + sizeof (FIRMWARE_SEC_PERFORMANCE) +); +DEBUG ((DEBUG_INFO, "FPDT: SEC Performance Hob ResetEnd = %ld\n", Performance.ResetEnd)); + } + + return Status; +} + +/** Entry point to the C language phase of SEC. After the SEC assembly code has initialized some temporary memory and set up the stack, diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h index 6e31a953f757..46c7d41c6e3e 100644 --- a/UefiCpuPkg/SecCore/SecMain.h +++ b/UefiCpuPkg/SecCore/SecMain.h @@ -1,7 +1,7 @@ /** @file Master header file for SecCore. - 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 which accompanies this distribution. The full text of the license may be found at @@ -20,6 +20,9 @@ #include #include #include +#include + +#include #include #include @@ -157,4 +160,24 @@ RepublishSecPlatformInformationPpi ( VOID ); +/** + Entry point of the notification callback function itself within the PEIM. + It is to get SEC performance data and build HOB to convey the SEC performance + data to DXE phase. + + @param PeiServices Indirect reference to the PEI Services Table. + @param NotifyDescriptor Address of the notification descriptor data structure. + @param Ppi Address of the PPI that was installed. + + @return Status of the notification. + The status code returned from this function is ignored. +**/ +EFI_STATUS +EFIAPI +SecPerformancePpiCallBack ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ); + #endif -- 2.7.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH 3/3] MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting code
Current SEC performance data getting code in FirmwarePerformancePei may get wrong SEC performance data if FirmwarePerformancePei executes after memory discovered. And as SecCore has added SecPerformancePpiCallBack to get SEC performance data and build HOB to convey the SEC performance data to DXE phase. This patch is to remove the SEC performance data getting code in FirmwarePerformancePei. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- .../FirmwarePerformancePei.c | 39 ++ .../FirmwarePerformancePei.inf | 9 + .../FirmwarePerformancePei.uni | 6 ++-- 3 files changed, 6 insertions(+), 48 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c index 396462e7aa97..e4800b7bdd8a 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c @@ -1,13 +1,11 @@ /** @file This module updates S3 Resume Performance Record in ACPI Firmware Performance - Data Table in S3 resume boot mode. In normal boot mode, this module consumes - SecPerformance PPI produced by SEC phase and build Hob to convey the SEC - performance data to DXE phase. + Data Table in S3 resume boot mode. This module register report status code listener to collect performance data for S3 Resume Performance Record on S3 resume boot path. - Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved. + Copyright (c) 2011 - 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 which accompanies this distribution. The full text of the license may be found at @@ -21,7 +19,6 @@ #include #include -#include #include @@ -31,7 +28,6 @@ #include #include #include -#include #include /** @@ -79,7 +75,7 @@ FpdtStatusCodeListenerPei ( // Check whether status code is what we are interested in. // if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) || - (Value != (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE))) { + (Value != (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE))) { return EFI_UNSUPPORTED; } @@ -157,8 +153,6 @@ FirmwarePerformancePeiEntryPoint ( { EFI_STATUS Status; EFI_PEI_RSC_HANDLER_PPI *RscHandler; - PEI_SEC_PERFORMANCE_PPI *SecPerf; - FIRMWARE_SEC_PERFORMANCE Performance; if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) { // @@ -176,32 +170,5 @@ FirmwarePerformancePeiEntryPoint ( ASSERT_EFI_ERROR (Status); } - // - // Normal boot - build Hob for SEC performance data. - // - Status = PeiServicesLocatePpi ( - &gPeiSecPerformancePpiGuid, - 0, - NULL, - (VOID **) &SecPerf - ); - if (!EFI_ERROR (Status)) { -Status = SecPerf->GetPerformance (PeiServices, SecPerf, &Performance); - } - if (!EFI_ERROR (Status)) { -BuildGuidDataHob ( - &gEfiFirmwarePerformanceGuid, - &Performance, - sizeof (FIRMWARE_SEC_PERFORMANCE) -); -DEBUG ((EFI_D_INFO, "FPDT: SEC Performance Hob ResetEnd = %ld\n", Performance.ResetEnd)); - } else { -// -// SEC performance PPI is not installed or fail to get performance data -// from SEC Performance PPI. -// -DEBUG ((EFI_D_ERROR, "FPDT: WARNING: SEC Performance PPI not installed or failed!\n")); - } - return EFI_SUCCESS; } diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf index 25049f832371..88cd0af8a1b2 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf @@ -2,13 +2,11 @@ # Firmware Performance Pei Module. # # In S3 resume boot mode, it updates S3 Resume Performance Record in ACPI Firmware Performance Data Table. -# In normal boot mode, it consumes SecPerformance PPI produced by SEC phase -# and build Hob to convey the SEC performance data to DXE phase. # # This module register report status code listener to collect performance data # for S3 Resume Performance Record on S3 resume boot path. # -# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved. +# Copyright (c) 2011 - 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 # which accompanies this distribution. The full text of the l
[edk2] [PATCH 0/3] Add SecPerformancePpiCallBack to get SEC performance data in SecCore
Current SEC performance data getting code in FirmwarePerformancePei may get wrong SEC performance data if FirmwarePerformancePei executes after memory discovered, it can be removed after SecPerformancePpiCallBack is added in SecCore. Cc: Liming Gao Cc: Jeff Fan Star Zeng (3): UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned UefiCpuPkg SecCore: Add SecPerformancePpiCallBack MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting code .../FirmwarePerformancePei.c | 39 ++-- .../FirmwarePerformancePei.inf | 9 +--- .../FirmwarePerformancePei.uni | 6 +-- UefiCpuPkg/SecCore/SecCore.inf | 7 +++ UefiCpuPkg/SecCore/SecMain.c | 53 +- UefiCpuPkg/SecCore/SecMain.h | 25 +- 6 files changed, 89 insertions(+), 50 deletions(-) -- 2.7.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH 1/3] UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned
As HOB which has 8byte aligned requirement will be built based on them in PEI phase. Cc: Liming Gao Cc: Jeff Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- UefiCpuPkg/SecCore/SecMain.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index 077d0db49f53..a53fa04cc303 100644 --- a/UefiCpuPkg/SecCore/SecMain.c +++ b/UefiCpuPkg/SecCore/SecMain.c @@ -1,7 +1,7 @@ /** @file C functions in SEC - 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 which accompanies this distribution. The full text of the license may be found at @@ -230,6 +230,11 @@ SecStartupPhase2( ASSERT (SecCoreData->PeiTemporaryRamSize > Index * sizeof (EFI_PEI_PPI_DESCRIPTOR)); SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN) SecCoreData->PeiTemporaryRamBase + Index * sizeof (EFI_PEI_PPI_DESCRIPTOR)); SecCoreData->PeiTemporaryRamSize = SecCoreData->PeiTemporaryRamSize - Index * sizeof (EFI_PEI_PPI_DESCRIPTOR); +// +// Adjust the Base and Size to be 8-byte aligned. +// +SecCoreData->PeiTemporaryRamBase = (VOID *)(((UINTN)SecCoreData->PeiTemporaryRamBase + 7) & ~0x07); +SecCoreData->PeiTemporaryRamSize &= ~0x07; } else { // // No addition PPI, PpiList directly point to the common PPI list. -- 2.7.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 0/2] Handle notification PPI from SEC
Reviewed-by: Liming Gao >-Original Message- >From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Star >Zeng >Sent: Friday, July 28, 2017 5:12 PM >To: edk2-devel@lists.01.org >Cc: Zeng, Star >Subject: [edk2] [PATCH 0/2] Handle notification PPI from SEC > >This patch series is to follow latest (>= 1.5) PI spec to >handle notification PPI from SEC. > >Star Zeng (2): > MdePkg PiPeiCis.h: Add description for notification PPI from SEC > MdeModulePkg PeiCore: Handle notification PPI from SEC > > MdeModulePkg/Core/Pei/PeiMain.h | 14 > MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 7 +- > MdeModulePkg/Core/Pei/Ppi/Ppi.c | 140 > > MdePkg/Include/Pi/PiPeiCis.h| 17 ++-- > 4 files changed, 151 insertions(+), 27 deletions(-) > >-- >2.7.0.windows.1 > >___ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v3 1/2] EmbeddedPkg/AndroidBoot: boot android kernel from storage
On Sun, Jul 30, 2017 at 10:22:15PM +0800, Jun Nie wrote: > >> + Status = EfiGetSystemConfigurationTable (&gFdtTableGuid, (VOID > >> **)&FdtBase); > >> + if (!EFI_ERROR (Status)) { > >> >>> > >> >>>Should this not be > >> >>> if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) > >> >>>? > >> >> > >> >>I mean, if fdt is found, we shall return to avoid installing another fdt. > >> > > >> >An FDT presented to you by firmware is just the hardware description. > >> >Any command line or initrd updates that are required will still need > >> >to happen in order to boot. So the same manipulations that happen to > >> >the DT embedded in boot.img need to happen to one presented via a > >> >configuration table. > >> > > >> >>But actually, I expect fdt is tied with kernel in Android boot image in > >> >>standard Android boot image usage cases. > >> >>Though it is agreed to decouple fdt and kernel in community in 2013, > >> >>Android boot image format has been decided several years before that :) . > >> >> > >> >>We can make change in future if Android boot image usage case changes. > >> >>Maybe I can add a warning message to highlight the new case. > >> > > >> >No. > >> > > >> >We can tolerate booting broken existing images, but we should not > >> >design to intentionally break things ourselves. > >> > > >> >I guess as this is an application, you could even add a command-line > >> >option to let you override an existing registered DT with one embedded > >> >in boot.img. > >> > > >> >But ignoring an existing registered DT is not an option. > >> > >> So you suggest to override existing registered fdt data with the one in > >> boot.img. > > > > No, I think that is a horrible idea, but you are saying that some > > platforms are so fundamentally broken as to need a different DT for > > every different kernel image. > > > > If this is the case, I can stretch to accepting a mechanism to > > override the sane default behaviour of using the existing device tree > > provided by the platform. > > > > But the platform registered device tree will still need the same > > chosen node updates as the one extracted from boot.img. > > > >> How to add a command-line, in kernel argument that is embedded in > >> boot.img? It is a bit strange if so. > > > > The command line argument would be to AndroidBootApp, not the kernel. > > > >> I prefer to override existing registered fdt data directly in current > >> Android boot image usage. > > > > The alternative to using the registered device tree by default, with a > > mechanism to override, is to always use the registered device tree and > > always ignore anything provided in boot.img. > > So the solution should be like this. the existing registered device tree will > be > used and chosen node will be updated. If no existing registered device tree > is found, the one provided by boot.img will be used. As I do not expect > existing registered device tree case for Android boot usage, fdt in boot.img > will be used in most cases. If exception happens, we can check the detail > situation. Sure, that works for me. / Leif ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v3 1/2] EmbeddedPkg/AndroidBoot: boot android kernel from storage
2017-07-28 22:52 GMT+08:00 Leif Lindholm : > On Fri, Jul 28, 2017 at 10:18:49PM +0800, Jun Nie wrote: >> On 2017年07月28日 21:06, Leif Lindholm wrote: >> >On Fri, Jul 28, 2017 at 05:47:46PM +0800, Jun Nie wrote: >> >>On 2017年07月27日 22:09, Leif Lindholm wrote: >> >>>On Thu, Jul 27, 2017 at 06:07:19PM +0800, Jun Nie wrote: >> Add an android kernel loader that could load kernel from storage >> device. This patch is from Haojian's code as below link. The minor >> change is that alternative dtb is searched in second loader binary >> of Android bootimage if dtb is not found after Linux kernel. >> https://patches.linaro.org/patch/94683/ >> >> This android boot image BDS add addtitional cmdline/dtb/ramfs >> support besides kernel that is introduced by Android boot header. >> >>> >> >>>Getting there. A few more comments below. >> >>> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Jun Nie >> --- >> ArmPkg/Include/Library/BdsLib.h| 3 + >> ArmPkg/Library/BdsLib/BdsFilePath.c| 3 - >> .../Application/AndroidBoot/AndroidBootApp.c | 127 +++ >> .../Application/AndroidBoot/AndroidBootApp.inf | 64 >> .../Application/AndroidFastboot/AndroidBootImg.c | 35 +- >> .../AndroidFastboot/AndroidFastbootApp.h | 1 + >> .../AndroidFastboot/Arm/BootAndroidBootImg.c | 2 +- >> EmbeddedPkg/Include/Library/AndroidBootImgLib.h| 67 >> EmbeddedPkg/Include/Protocol/AndroidBootImg.h | 47 +++ >> .../Library/AndroidBootImgLib/AndroidBootImgLib.c | 419 >> + >> .../AndroidBootImgLib/AndroidBootImgLib.inf| 48 +++ >> 11 files changed, 782 insertions(+), 34 deletions(-) >> create mode 100644 EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.c >> create mode 100644 >> EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.inf >> create mode 100644 EmbeddedPkg/Include/Library/AndroidBootImgLib.h >> create mode 100644 EmbeddedPkg/Include/Protocol/AndroidBootImg.h >> create mode 100644 >> EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c >> create mode 100644 >> EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf >> >> > > >> diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c >> b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c >> new file mode 100644 >> index 000..72c6322 >> --- /dev/null >> +++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c >> @@ -0,0 +1,419 @@ >> +/** @file >> + >> + Copyright (c) 2013-2014, ARM Ltd. All rights reserved. >> + Copyright (c) 2017, Linaro. 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 >> + http://opensource.org/licenses/bsd-license.php >> + >> + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR >> IMPLIED. >> + >> +**/ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include >> +#include >> + >> +#include >> + >> +#define FDT_ADDITIONAL_ENTRIES_SIZE 0x400 >> + >> +typedef struct { >> + MEMMAP_DEVICE_PATH Node1; >> + EFI_DEVICE_PATH_PROTOCOLEnd; >> +} MEMORY_DEVICE_PATH; >> + >> +STATIC ABOOTIMG_PROTOCOL *mAbootimg; >> >>> >> >>>mAndroidBootImg. >> >> >> >>Will do. >> >>> >> + >> +STATIC CONST MEMORY_DEVICE_PATH MemoryDevicePathTemplate = >> >>> >> >>>Should also have an 'm'-prefix. >> >> >> >>Will do. But what 'm' prefix stand for? >> >>> >> +{ >> + { >> +{ >> + HARDWARE_DEVICE_PATH, >> + HW_MEMMAP_DP, >> + { >> +(UINT8)(sizeof (MEMMAP_DEVICE_PATH)), >> +(UINT8)((sizeof (MEMMAP_DEVICE_PATH)) >> 8), >> + }, >> +}, // Header >> +0, // StartingAddress (set at runtime) >> +0 // EndingAddress (set at runtime) >> + }, // Node1 >> + { >> +END_DEVICE_PATH_TYPE, >> +END_ENTIRE_DEVICE_PATH_SUBTYPE, >> +{ sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 } >> + } // End >> +}; >> + >> +EFI_STATUS >> +AbootimgGetImgSize ( >> >>> >> >>>AndroidBootImgGetImageSize. >> >> >> >>Will do. >> >>> >> + IN VOID*BootImg, >> + OUT UINTN *ImgSize >> + ) >> +{ >> + ANDROID_BOOTIMG_HEADER *Header; >> + >> + Header = (ANDROID_BOOTIMG_HEADER *) BootImg; >> + >> + if (AsciiStrnCmp ((CON
[edk2] [Patch] NetworkPkg/Ip6Dxe: Fix the IPv6 PXE boot option goes missing issue
This patch is to fix the potential issue recorded at Bugzilla 636: https://bugzilla.tianocore.org/show_bug.cgi?id=636 The issue is caused by the IPv6 policy switching after PXEv6 boot. When IP policy is changing, the IPv6 children used by PXE.UdpRead() will be destroyed. Then, PXE Stop() function is called to uninstall the devicePath protocol, which leads to the IPv6 PXE boot option goes missing. Through the above analysis, the IP driver should take the responsibility for the upper layer network stacks recovery by using ConnectController(). Cc: Hegde Nagaraj P Cc: Subramanian Sriram Cc: Ni Ruiyu Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c | 72 --- 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c index 7c7acc7..f170716 100644 --- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c +++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c @@ -45,16 +45,21 @@ VOID Ip6ConfigOnPolicyChanged ( IN IP6_SERVICE*IpSb, IN EFI_IP6_CONFIG_POLICY NewPolicy ) { - LIST_ENTRY *Entry; - LIST_ENTRY *Entry2; - LIST_ENTRY *Next; - IP6_INTERFACE *IpIf; - IP6_DAD_ENTRY *DadEntry; - IP6_DELAY_JOIN_LIST *DelayNode; + LIST_ENTRY *Entry; + LIST_ENTRY *Entry2; + LIST_ENTRY *Next; + IP6_INTERFACE *IpIf; + IP6_DAD_ENTRY *DadEntry; + IP6_DELAY_JOIN_LIST *DelayNode; + IP6_ADDRESS_INFO*AddrInfo; + IP6_PROTOCOL*Instance; + BOOLEAN Recovery; + + Recovery = FALSE; // // Currently there are only two policies: Manual and Automatic. Regardless of // what transition is going on, i.e., Manual -> Automatic and Automatic -> // Manual, we have to free default router list, on-link prefix list, autonomous @@ -78,22 +83,52 @@ Ip6ConfigOnPolicyChanged ( IP6_LINK_LOCAL_PREFIX_LENGTH, &IpSb->LinkLocalAddr ); } - // - // All IPv6 children that use global unicast address as it's source address - // should be destryoed now. The survivers are those use the link-local address - // or the unspecified address as the source address. - // TODO: Conduct a check here. - Ip6RemoveAddr ( -IpSb, -&IpSb->DefaultInterface->AddressList, -&IpSb->DefaultInterface->AddressCount, -NULL, -0 -); + if (!IsListEmpty (&IpSb->DefaultInterface->AddressList) && IpSb->DefaultInterface->AddressCount > 0) { +// +// If any IPv6 children (Instance) in configured state and use global unicast address, it will be +// destroyed in Ip6RemoveAddr() function later. Then, the upper layer driver's Stop() function will be +// called, which may break the upper layer network stacks. So, the driver should take the responsibility +// for the recovery by using ConnectController() after Ip6RemoveAddr(). +// Here, just check whether need to recover the upper layer network stacks later. +// +NET_LIST_FOR_EACH (Entry, &IpSb->DefaultInterface->AddressList) { + AddrInfo = NET_LIST_USER_STRUCT_S (Entry, IP6_ADDRESS_INFO, Link, IP6_ADDR_INFO_SIGNATURE); + if (!IsListEmpty (&IpSb->Children)) { +NET_LIST_FOR_EACH (Entry2, &IpSb->Children) { + Instance = NET_LIST_USER_STRUCT_S (Entry2, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE); + if ((Instance->State == IP6_STATE_CONFIGED) && EFI_IP6_EQUAL (&Instance->ConfigData.StationAddress, &AddrInfo->Address)) { +Recovery = TRUE; +break; + } +} + } +} + +// +// All IPv6 children that use global unicast address as it's source address +// should be destroyed now. The survivers are those use the link-local address +// or the unspecified address as the source address. +// TODO: Conduct a check here. +Ip6RemoveAddr ( + IpSb, + &IpSb->DefaultInterface->AddressList, + &IpSb->DefaultInterface->AddressCount, + NULL, + 0 + ); + +if (IpSb->Controller != NULL && Recovery) { + // + // ConnectController() to recover the upper layer network stacks. + // + gBS->ConnectController (IpSb->Controller, NULL, NULL, TRUE); +} + } + NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) { // // remove all pending delay node and DAD entries for the global addresses. // @@ -128,11 +163,10 @@ Ip6ConfigOnPolicyChanged ( // // delay 1 second // IpSb->Ticks = (UINT32) IP6_GET_TICKS (IP6_ONE_SECOND_IN_MS); } - } /** The work function to trigger the DHCPv6 process to perform a stateful autoconfiguration. -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel