* [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. @ 2016-12-23 16:02 Jiewen Yao 2016-12-26 2:56 ` Zeng, Star 2016-12-26 3:12 ` Zhang, Chao B 0 siblings, 2 replies; 5+ messages in thread From: Jiewen Yao @ 2016-12-23 16:02 UTC (permalink / raw) To: edk2-devel; +Cc: Feng Tian, Star Zeng, Chao Zhang UEFI spec requires CapsuleTarget to be a device path associated with FMP producer. Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Chao Zhang <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> --- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 15 +++++++++-- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 28 ++++++++++++++++---- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c | 4 ++- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c index af08886..2bb6ac8 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c @@ -100,6 +100,7 @@ RecordCapsuleStatusVariable ( @param[in] CapsuleStatus The capsule process stauts @param[in] PayloadIndex FMP payload index @param[in] ImageHeader FMP image header + @param[in] FmpDevicePath DevicePath associated with the FMP producer @retval EFI_SUCCESS The capsule status variable is recorded. @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. @@ -109,7 +110,8 @@ RecordFmpCapsuleStatusVariable ( IN EFI_CAPSULE_HEADER *CapsuleHeader, IN EFI_STATUS CapsuleStatus, IN UINTN PayloadIndex, - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL ); /** @@ -818,6 +820,7 @@ ProcessFmpCapsuleImage ( UINTN Index2; MEMMAP_DEVICE_PATH MemMapNode; EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath; + EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath; ESRT_MANAGEMENT_PROTOCOL *EsrtProtocol; EFI_SYSTEM_RESOURCE_ENTRY EsrtEntry; VOID *VendorCode; @@ -941,6 +944,13 @@ ProcessFmpCapsuleImage ( continue; } + FmpDevicePath = NULL; + gBS->HandleProtocol( + HandleBuffer[Index1], + &gEfiDevicePathProtocolGuid, + (VOID **)&FmpDevicePath + ); + ImageInfoSize = 0; Status = Fmp->GetImageInfo ( Fmp, @@ -1060,7 +1070,8 @@ ProcessFmpCapsuleImage ( CapsuleHeader, // CapsuleGuid Status, // CapsuleStatus Index - FmpCapsuleHeader->EmbeddedDriverCount, // PayloadIndex - ImageHeader // ImageHeader + ImageHeader, // ImageHeader + FmpDevicePath // FmpDevicePath ); if (StatusRet != EFI_SUCCESS) { StatusRet = Status; diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c index d34eb25..bba30b5 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c @@ -30,6 +30,7 @@ #include <Library/HobLib.h> #include <Library/PrintLib.h> #include <Library/ReportStatusCodeLib.h> +#include <Library/DevicePathLib.h> #include <Library/CapsuleLib.h> #include <IndustryStandard/WindowsUxCapsule.h> @@ -280,6 +281,7 @@ RecordCapsuleStatusVariable ( @param[in] CapsuleStatus The capsule process stauts @param[in] PayloadIndex FMP payload index @param[in] ImageHeader FMP image header + @param[in] FmpDevicePath DevicePath associated with the FMP producer @retval EFI_SUCCESS The capsule status variable is recorded. @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. @@ -289,26 +291,37 @@ RecordFmpCapsuleStatusVariable ( IN EFI_CAPSULE_HEADER *CapsuleHeader, IN EFI_STATUS CapsuleStatus, IN UINTN PayloadIndex, - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL ) { EFI_CAPSULE_RESULT_VARIABLE_HEADER *CapsuleResultVariableHeader; EFI_CAPSULE_RESULT_VARIABLE_FMP *CapsuleResultVariableFmp; EFI_STATUS Status; UINT8 *CapsuleResultVariable; - UINT32 CapsuleResultVariableSize; + UINTN CapsuleResultVariableSize; + CHAR16 *DevicePathStr; + UINTN DevicePathStrSize; - CapsuleResultVariable = NULL; + DevicePathStr = NULL; + if (FmpDevicePath != NULL) { + DevicePathStr = ConvertDevicePathToText (FmpDevicePath, FALSE, FALSE); + } + if (DevicePathStr != NULL) { + DevicePathStrSize = StrSize(DevicePathStr); + } else { + DevicePathStrSize = sizeof(CHAR16); + } // // Allocate zero CHAR16 for CapsuleFileName and CapsuleTarget. // - CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) * 2; + CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) + DevicePathStrSize; CapsuleResultVariable = AllocateZeroPool (CapsuleResultVariableSize); if (CapsuleResultVariable == NULL) { return EFI_OUT_OF_RESOURCES; } CapsuleResultVariableHeader = (VOID *)CapsuleResultVariable; - CapsuleResultVariableHeader->VariableTotalSize = CapsuleResultVariableSize; + CapsuleResultVariableHeader->VariableTotalSize = (UINT32)CapsuleResultVariableSize; CapsuleResultVariableHeader->Reserved = 0; CopyGuid(&CapsuleResultVariableHeader->CapsuleGuid, &CapsuleHeader->CapsuleGuid); ZeroMem(&CapsuleResultVariableHeader->CapsuleProcessed, sizeof(CapsuleResultVariableHeader->CapsuleProcessed)); @@ -320,6 +333,11 @@ RecordFmpCapsuleStatusVariable ( CapsuleResultVariableFmp->PayloadIndex = (UINT8)PayloadIndex; CapsuleResultVariableFmp->UpdateImageIndex = ImageHeader->UpdateImageIndex; CopyGuid (&CapsuleResultVariableFmp->UpdateImageTypeId, &ImageHeader->UpdateImageTypeId); + if (DevicePathStr != NULL) { + CopyMem ((UINT8 *)CapsuleResultVariableFmp + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16), DevicePathStr, DevicePathStrSize); + FreePool (DevicePathStr); + DevicePathStr = NULL; + } // // Save Local Cache diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c index bf550e5..6ab198d 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c @@ -64,6 +64,7 @@ RecordCapsuleStatusVariable ( @param[in] CapsuleStatus The capsule process stauts @param[in] PayloadIndex FMP payload index @param[in] ImageHeader FMP image header + @param[in] FmpDevicePath DevicePath associated with the FMP producer @retval EFI_SUCCESS The capsule status variable is recorded. @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. @@ -73,7 +74,8 @@ RecordFmpCapsuleStatusVariable ( IN EFI_CAPSULE_HEADER *CapsuleHeader, IN EFI_STATUS CapsuleStatus, IN UINTN PayloadIndex, - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL ) { return EFI_UNSUPPORTED; -- 2.7.4.windows.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. 2016-12-23 16:02 [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support Jiewen Yao @ 2016-12-26 2:56 ` Zeng, Star 2016-12-26 3:01 ` Yao, Jiewen 2016-12-26 3:12 ` Zhang, Chao B 1 sibling, 1 reply; 5+ messages in thread From: Zeng, Star @ 2016-12-26 2:56 UTC (permalink / raw) To: Jiewen Yao, edk2-devel; +Cc: Feng Tian, Chao Zhang, star.zeng Minor comment inline. On 2016/12/24 0:02, Jiewen Yao wrote: > UEFI spec requires CapsuleTarget to be a device path associated > with FMP producer. > > Cc: Feng Tian <feng.tian@intel.com> > Cc: Star Zeng <star.zeng@intel.com> > Cc: Chao Zhang <chao.b.zhang@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> > --- > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 15 +++++++++-- > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 28 ++++++++++++++++---- > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c | 4 ++- > 3 files changed, 39 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > index af08886..2bb6ac8 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > @@ -100,6 +100,7 @@ RecordCapsuleStatusVariable ( > @param[in] CapsuleStatus The capsule process stauts > @param[in] PayloadIndex FMP payload index > @param[in] ImageHeader FMP image header > + @param[in] FmpDevicePath DevicePath associated with the FMP producer > > @retval EFI_SUCCESS The capsule status variable is recorded. > @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. > @@ -109,7 +110,8 @@ RecordFmpCapsuleStatusVariable ( > IN EFI_CAPSULE_HEADER *CapsuleHeader, > IN EFI_STATUS CapsuleStatus, > IN UINTN PayloadIndex, > - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader > + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, > + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL > ); > > /** > @@ -818,6 +820,7 @@ ProcessFmpCapsuleImage ( > UINTN Index2; > MEMMAP_DEVICE_PATH MemMapNode; > EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath; > + EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath; > ESRT_MANAGEMENT_PROTOCOL *EsrtProtocol; > EFI_SYSTEM_RESOURCE_ENTRY EsrtEntry; > VOID *VendorCode; > @@ -941,6 +944,13 @@ ProcessFmpCapsuleImage ( > continue; > } > > + FmpDevicePath = NULL; > + gBS->HandleProtocol( > + HandleBuffer[Index1], > + &gEfiDevicePathProtocolGuid, > + (VOID **)&FmpDevicePath > + ); > + > ImageInfoSize = 0; > Status = Fmp->GetImageInfo ( > Fmp, > @@ -1060,7 +1070,8 @@ ProcessFmpCapsuleImage ( > CapsuleHeader, // CapsuleGuid > Status, // CapsuleStatus > Index - FmpCapsuleHeader->EmbeddedDriverCount, // PayloadIndex > - ImageHeader // ImageHeader > + ImageHeader, // ImageHeader > + FmpDevicePath // FmpDevicePath > ); > if (StatusRet != EFI_SUCCESS) { > StatusRet = Status; > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > index d34eb25..bba30b5 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > @@ -30,6 +30,7 @@ > #include <Library/HobLib.h> > #include <Library/PrintLib.h> > #include <Library/ReportStatusCodeLib.h> > +#include <Library/DevicePathLib.h> > #include <Library/CapsuleLib.h> > > #include <IndustryStandard/WindowsUxCapsule.h> > @@ -280,6 +281,7 @@ RecordCapsuleStatusVariable ( > @param[in] CapsuleStatus The capsule process stauts > @param[in] PayloadIndex FMP payload index > @param[in] ImageHeader FMP image header > + @param[in] FmpDevicePath DevicePath associated with the FMP producer > > @retval EFI_SUCCESS The capsule status variable is recorded. > @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. > @@ -289,26 +291,37 @@ RecordFmpCapsuleStatusVariable ( > IN EFI_CAPSULE_HEADER *CapsuleHeader, > IN EFI_STATUS CapsuleStatus, > IN UINTN PayloadIndex, > - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader > + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, > + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL > ) > { > EFI_CAPSULE_RESULT_VARIABLE_HEADER *CapsuleResultVariableHeader; > EFI_CAPSULE_RESULT_VARIABLE_FMP *CapsuleResultVariableFmp; > EFI_STATUS Status; > UINT8 *CapsuleResultVariable; > - UINT32 CapsuleResultVariableSize; > + UINTN CapsuleResultVariableSize; > + CHAR16 *DevicePathStr; > + UINTN DevicePathStrSize; > > - CapsuleResultVariable = NULL; > + DevicePathStr = NULL; > + if (FmpDevicePath != NULL) { > + DevicePathStr = ConvertDevicePathToText (FmpDevicePath, FALSE, FALSE); > + } > + if (DevicePathStr != NULL) { > + DevicePathStrSize = StrSize(DevicePathStr); > + } else { > + DevicePathStrSize = sizeof(CHAR16); > + } > // > // Allocate zero CHAR16 for CapsuleFileName and CapsuleTarget. Does the comment need to be updated? > // > - CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) * 2; > + CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) + DevicePathStrSize; > CapsuleResultVariable = AllocateZeroPool (CapsuleResultVariableSize); > if (CapsuleResultVariable == NULL) { > return EFI_OUT_OF_RESOURCES; > } > CapsuleResultVariableHeader = (VOID *)CapsuleResultVariable; > - CapsuleResultVariableHeader->VariableTotalSize = CapsuleResultVariableSize; > + CapsuleResultVariableHeader->VariableTotalSize = (UINT32)CapsuleResultVariableSize; > CapsuleResultVariableHeader->Reserved = 0; > CopyGuid(&CapsuleResultVariableHeader->CapsuleGuid, &CapsuleHeader->CapsuleGuid); > ZeroMem(&CapsuleResultVariableHeader->CapsuleProcessed, sizeof(CapsuleResultVariableHeader->CapsuleProcessed)); > @@ -320,6 +333,11 @@ RecordFmpCapsuleStatusVariable ( > CapsuleResultVariableFmp->PayloadIndex = (UINT8)PayloadIndex; > CapsuleResultVariableFmp->UpdateImageIndex = ImageHeader->UpdateImageIndex; > CopyGuid (&CapsuleResultVariableFmp->UpdateImageTypeId, &ImageHeader->UpdateImageTypeId); > + if (DevicePathStr != NULL) { > + CopyMem ((UINT8 *)CapsuleResultVariableFmp + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16), DevicePathStr, DevicePathStrSize); > + FreePool (DevicePathStr); > + DevicePathStr = NULL; > + } > > // > // Save Local Cache > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c > index bf550e5..6ab198d 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c > @@ -64,6 +64,7 @@ RecordCapsuleStatusVariable ( > @param[in] CapsuleStatus The capsule process stauts > @param[in] PayloadIndex FMP payload index > @param[in] ImageHeader FMP image header > + @param[in] FmpDevicePath DevicePath associated with the FMP producer > > @retval EFI_SUCCESS The capsule status variable is recorded. > @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. > @@ -73,7 +74,8 @@ RecordFmpCapsuleStatusVariable ( > IN EFI_CAPSULE_HEADER *CapsuleHeader, > IN EFI_STATUS CapsuleStatus, > IN UINTN PayloadIndex, > - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader > + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, > + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL > ) > { > return EFI_UNSUPPORTED; > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. 2016-12-26 2:56 ` Zeng, Star @ 2016-12-26 3:01 ` Yao, Jiewen 2016-12-26 3:03 ` Zeng, Star 0 siblings, 1 reply; 5+ messages in thread From: Yao, Jiewen @ 2016-12-26 3:01 UTC (permalink / raw) To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Tian, Feng, Zeng, Star, Zhang, Chao B Good catch. I will update comment From: > // Allocate zero CHAR16 for CapsuleFileName and CapsuleTarget. to > // Allocate zero CHAR16 for CapsuleFileName. Thank you Yao Jiewen From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zeng, Star Sent: Monday, December 26, 2016 10:56 AM To: Yao, Jiewen <jiewen.yao@intel.com>; edk2-devel@lists.01.org Cc: Tian, Feng <feng.tian@intel.com>; Zeng, Star <star.zeng@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com> Subject: Re: [edk2] [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. Minor comment inline. On 2016/12/24 0:02, Jiewen Yao wrote: > UEFI spec requires CapsuleTarget to be a device path associated > with FMP producer. > > Cc: Feng Tian <feng.tian@intel.com<mailto:feng.tian@intel.com>> > Cc: Star Zeng <star.zeng@intel.com<mailto:star.zeng@intel.com>> > Cc: Chao Zhang <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>> > --- > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 15 +++++++++-- > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 28 ++++++++++++++++---- > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c | 4 ++- > 3 files changed, 39 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > index af08886..2bb6ac8 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > @@ -100,6 +100,7 @@ RecordCapsuleStatusVariable ( > @param[in] CapsuleStatus The capsule process stauts > @param[in] PayloadIndex FMP payload index > @param[in] ImageHeader FMP image header > + @param[in] FmpDevicePath DevicePath associated with the FMP producer > > @retval EFI_SUCCESS The capsule status variable is recorded. > @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. > @@ -109,7 +110,8 @@ RecordFmpCapsuleStatusVariable ( > IN EFI_CAPSULE_HEADER *CapsuleHeader, > IN EFI_STATUS CapsuleStatus, > IN UINTN PayloadIndex, > - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader > + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, > + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL > ); > > /** > @@ -818,6 +820,7 @@ ProcessFmpCapsuleImage ( > UINTN Index2; > MEMMAP_DEVICE_PATH MemMapNode; > EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath; > + EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath; > ESRT_MANAGEMENT_PROTOCOL *EsrtProtocol; > EFI_SYSTEM_RESOURCE_ENTRY EsrtEntry; > VOID *VendorCode; > @@ -941,6 +944,13 @@ ProcessFmpCapsuleImage ( > continue; > } > > + FmpDevicePath = NULL; > + gBS->HandleProtocol( > + HandleBuffer[Index1], > + &gEfiDevicePathProtocolGuid, > + (VOID **)&FmpDevicePath > + ); > + > ImageInfoSize = 0; > Status = Fmp->GetImageInfo ( > Fmp, > @@ -1060,7 +1070,8 @@ ProcessFmpCapsuleImage ( > CapsuleHeader, // CapsuleGuid > Status, // CapsuleStatus > Index - FmpCapsuleHeader->EmbeddedDriverCount, // PayloadIndex > - ImageHeader // ImageHeader > + ImageHeader, // ImageHeader > + FmpDevicePath // FmpDevicePath > ); > if (StatusRet != EFI_SUCCESS) { > StatusRet = Status; > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > index d34eb25..bba30b5 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > @@ -30,6 +30,7 @@ > #include <Library/HobLib.h> > #include <Library/PrintLib.h> > #include <Library/ReportStatusCodeLib.h> > +#include <Library/DevicePathLib.h> > #include <Library/CapsuleLib.h> > > #include <IndustryStandard/WindowsUxCapsule.h> > @@ -280,6 +281,7 @@ RecordCapsuleStatusVariable ( > @param[in] CapsuleStatus The capsule process stauts > @param[in] PayloadIndex FMP payload index > @param[in] ImageHeader FMP image header > + @param[in] FmpDevicePath DevicePath associated with the FMP producer > > @retval EFI_SUCCESS The capsule status variable is recorded. > @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. > @@ -289,26 +291,37 @@ RecordFmpCapsuleStatusVariable ( > IN EFI_CAPSULE_HEADER *CapsuleHeader, > IN EFI_STATUS CapsuleStatus, > IN UINTN PayloadIndex, > - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader > + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, > + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL > ) > { > EFI_CAPSULE_RESULT_VARIABLE_HEADER *CapsuleResultVariableHeader; > EFI_CAPSULE_RESULT_VARIABLE_FMP *CapsuleResultVariableFmp; > EFI_STATUS Status; > UINT8 *CapsuleResultVariable; > - UINT32 CapsuleResultVariableSize; > + UINTN CapsuleResultVariableSize; > + CHAR16 *DevicePathStr; > + UINTN DevicePathStrSize; > > - CapsuleResultVariable = NULL; > + DevicePathStr = NULL; > + if (FmpDevicePath != NULL) { > + DevicePathStr = ConvertDevicePathToText (FmpDevicePath, FALSE, FALSE); > + } > + if (DevicePathStr != NULL) { > + DevicePathStrSize = StrSize(DevicePathStr); > + } else { > + DevicePathStrSize = sizeof(CHAR16); > + } > // > // Allocate zero CHAR16 for CapsuleFileName and CapsuleTarget. Does the comment need to be updated? > // > - CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) * 2; > + CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) + DevicePathStrSize; > CapsuleResultVariable = AllocateZeroPool (CapsuleResultVariableSize); > if (CapsuleResultVariable == NULL) { > return EFI_OUT_OF_RESOURCES; > } > CapsuleResultVariableHeader = (VOID *)CapsuleResultVariable; > - CapsuleResultVariableHeader->VariableTotalSize = CapsuleResultVariableSize; > + CapsuleResultVariableHeader->VariableTotalSize = (UINT32)CapsuleResultVariableSize; > CapsuleResultVariableHeader->Reserved = 0; > CopyGuid(&CapsuleResultVariableHeader->CapsuleGuid, &CapsuleHeader->CapsuleGuid); > ZeroMem(&CapsuleResultVariableHeader->CapsuleProcessed, sizeof(CapsuleResultVariableHeader->CapsuleProcessed)); > @@ -320,6 +333,11 @@ RecordFmpCapsuleStatusVariable ( > CapsuleResultVariableFmp->PayloadIndex = (UINT8)PayloadIndex; > CapsuleResultVariableFmp->UpdateImageIndex = ImageHeader->UpdateImageIndex; > CopyGuid (&CapsuleResultVariableFmp->UpdateImageTypeId, &ImageHeader->UpdateImageTypeId); > + if (DevicePathStr != NULL) { > + CopyMem ((UINT8 *)CapsuleResultVariableFmp + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16), DevicePathStr, DevicePathStrSize); > + FreePool (DevicePathStr); > + DevicePathStr = NULL; > + } > > // > // Save Local Cache > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c > index bf550e5..6ab198d 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c > @@ -64,6 +64,7 @@ RecordCapsuleStatusVariable ( > @param[in] CapsuleStatus The capsule process stauts > @param[in] PayloadIndex FMP payload index > @param[in] ImageHeader FMP image header > + @param[in] FmpDevicePath DevicePath associated with the FMP producer > > @retval EFI_SUCCESS The capsule status variable is recorded. > @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. > @@ -73,7 +74,8 @@ RecordFmpCapsuleStatusVariable ( > IN EFI_CAPSULE_HEADER *CapsuleHeader, > IN EFI_STATUS CapsuleStatus, > IN UINTN PayloadIndex, > - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader > + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, > + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL > ) > { > return EFI_UNSUPPORTED; > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. 2016-12-26 3:01 ` Yao, Jiewen @ 2016-12-26 3:03 ` Zeng, Star 0 siblings, 0 replies; 5+ messages in thread From: Zeng, Star @ 2016-12-26 3:03 UTC (permalink / raw) To: Yao, Jiewen, edk2-devel@lists.01.org Cc: Tian, Feng, Zhang, Chao B, Zeng, Star With that, Reviewed-by: Star Zeng <star.zeng@intel.com> From: Yao, Jiewen Sent: Monday, December 26, 2016 11:01 AM To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org Cc: Tian, Feng <feng.tian@intel.com>; Zeng, Star <star.zeng@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com> Subject: RE: [edk2] [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. Good catch. I will update comment From: > // Allocate zero CHAR16 for CapsuleFileName and CapsuleTarget. to > // Allocate zero CHAR16 for CapsuleFileName. Thank you Yao Jiewen From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zeng, Star Sent: Monday, December 26, 2016 10:56 AM To: Yao, Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Tian, Feng <feng.tian@intel.com<mailto:feng.tian@intel.com>>; Zeng, Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>; Zhang, Chao B <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>> Subject: Re: [edk2] [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. Minor comment inline. On 2016/12/24 0:02, Jiewen Yao wrote: > UEFI spec requires CapsuleTarget to be a device path associated > with FMP producer. > > Cc: Feng Tian <feng.tian@intel.com<mailto:feng.tian@intel.com>> > Cc: Star Zeng <star.zeng@intel.com<mailto:star.zeng@intel.com>> > Cc: Chao Zhang <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>> > --- > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 15 +++++++++-- > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 28 ++++++++++++++++---- > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c | 4 ++- > 3 files changed, 39 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > index af08886..2bb6ac8 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > @@ -100,6 +100,7 @@ RecordCapsuleStatusVariable ( > @param[in] CapsuleStatus The capsule process stauts > @param[in] PayloadIndex FMP payload index > @param[in] ImageHeader FMP image header > + @param[in] FmpDevicePath DevicePath associated with the FMP producer > > @retval EFI_SUCCESS The capsule status variable is recorded. > @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. > @@ -109,7 +110,8 @@ RecordFmpCapsuleStatusVariable ( > IN EFI_CAPSULE_HEADER *CapsuleHeader, > IN EFI_STATUS CapsuleStatus, > IN UINTN PayloadIndex, > - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader > + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, > + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL > ); > > /** > @@ -818,6 +820,7 @@ ProcessFmpCapsuleImage ( > UINTN Index2; > MEMMAP_DEVICE_PATH MemMapNode; > EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath; > + EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath; > ESRT_MANAGEMENT_PROTOCOL *EsrtProtocol; > EFI_SYSTEM_RESOURCE_ENTRY EsrtEntry; > VOID *VendorCode; > @@ -941,6 +944,13 @@ ProcessFmpCapsuleImage ( > continue; > } > > + FmpDevicePath = NULL; > + gBS->HandleProtocol( > + HandleBuffer[Index1], > + &gEfiDevicePathProtocolGuid, > + (VOID **)&FmpDevicePath > + ); > + > ImageInfoSize = 0; > Status = Fmp->GetImageInfo ( > Fmp, > @@ -1060,7 +1070,8 @@ ProcessFmpCapsuleImage ( > CapsuleHeader, // CapsuleGuid > Status, // CapsuleStatus > Index - FmpCapsuleHeader->EmbeddedDriverCount, // PayloadIndex > - ImageHeader // ImageHeader > + ImageHeader, // ImageHeader > + FmpDevicePath // FmpDevicePath > ); > if (StatusRet != EFI_SUCCESS) { > StatusRet = Status; > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > index d34eb25..bba30b5 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > @@ -30,6 +30,7 @@ > #include <Library/HobLib.h> > #include <Library/PrintLib.h> > #include <Library/ReportStatusCodeLib.h> > +#include <Library/DevicePathLib.h> > #include <Library/CapsuleLib.h> > > #include <IndustryStandard/WindowsUxCapsule.h> > @@ -280,6 +281,7 @@ RecordCapsuleStatusVariable ( > @param[in] CapsuleStatus The capsule process stauts > @param[in] PayloadIndex FMP payload index > @param[in] ImageHeader FMP image header > + @param[in] FmpDevicePath DevicePath associated with the FMP producer > > @retval EFI_SUCCESS The capsule status variable is recorded. > @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. > @@ -289,26 +291,37 @@ RecordFmpCapsuleStatusVariable ( > IN EFI_CAPSULE_HEADER *CapsuleHeader, > IN EFI_STATUS CapsuleStatus, > IN UINTN PayloadIndex, > - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader > + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, > + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL > ) > { > EFI_CAPSULE_RESULT_VARIABLE_HEADER *CapsuleResultVariableHeader; > EFI_CAPSULE_RESULT_VARIABLE_FMP *CapsuleResultVariableFmp; > EFI_STATUS Status; > UINT8 *CapsuleResultVariable; > - UINT32 CapsuleResultVariableSize; > + UINTN CapsuleResultVariableSize; > + CHAR16 *DevicePathStr; > + UINTN DevicePathStrSize; > > - CapsuleResultVariable = NULL; > + DevicePathStr = NULL; > + if (FmpDevicePath != NULL) { > + DevicePathStr = ConvertDevicePathToText (FmpDevicePath, FALSE, FALSE); > + } > + if (DevicePathStr != NULL) { > + DevicePathStrSize = StrSize(DevicePathStr); > + } else { > + DevicePathStrSize = sizeof(CHAR16); > + } > // > // Allocate zero CHAR16 for CapsuleFileName and CapsuleTarget. Does the comment need to be updated? > // > - CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) * 2; > + CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) + DevicePathStrSize; > CapsuleResultVariable = AllocateZeroPool (CapsuleResultVariableSize); > if (CapsuleResultVariable == NULL) { > return EFI_OUT_OF_RESOURCES; > } > CapsuleResultVariableHeader = (VOID *)CapsuleResultVariable; > - CapsuleResultVariableHeader->VariableTotalSize = CapsuleResultVariableSize; > + CapsuleResultVariableHeader->VariableTotalSize = (UINT32)CapsuleResultVariableSize; > CapsuleResultVariableHeader->Reserved = 0; > CopyGuid(&CapsuleResultVariableHeader->CapsuleGuid, &CapsuleHeader->CapsuleGuid); > ZeroMem(&CapsuleResultVariableHeader->CapsuleProcessed, sizeof(CapsuleResultVariableHeader->CapsuleProcessed)); > @@ -320,6 +333,11 @@ RecordFmpCapsuleStatusVariable ( > CapsuleResultVariableFmp->PayloadIndex = (UINT8)PayloadIndex; > CapsuleResultVariableFmp->UpdateImageIndex = ImageHeader->UpdateImageIndex; > CopyGuid (&CapsuleResultVariableFmp->UpdateImageTypeId, &ImageHeader->UpdateImageTypeId); > + if (DevicePathStr != NULL) { > + CopyMem ((UINT8 *)CapsuleResultVariableFmp + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16), DevicePathStr, DevicePathStrSize); > + FreePool (DevicePathStr); > + DevicePathStr = NULL; > + } > > // > // Save Local Cache > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c > index bf550e5..6ab198d 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c > @@ -64,6 +64,7 @@ RecordCapsuleStatusVariable ( > @param[in] CapsuleStatus The capsule process stauts > @param[in] PayloadIndex FMP payload index > @param[in] ImageHeader FMP image header > + @param[in] FmpDevicePath DevicePath associated with the FMP producer > > @retval EFI_SUCCESS The capsule status variable is recorded. > @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. > @@ -73,7 +74,8 @@ RecordFmpCapsuleStatusVariable ( > IN EFI_CAPSULE_HEADER *CapsuleHeader, > IN EFI_STATUS CapsuleStatus, > IN UINTN PayloadIndex, > - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader > + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, > + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL > ) > { > return EFI_UNSUPPORTED; > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. 2016-12-23 16:02 [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support Jiewen Yao 2016-12-26 2:56 ` Zeng, Star @ 2016-12-26 3:12 ` Zhang, Chao B 1 sibling, 0 replies; 5+ messages in thread From: Zhang, Chao B @ 2016-12-26 3:12 UTC (permalink / raw) To: Yao, Jiewen, edk2-devel@lists.01.org; +Cc: Tian, Feng, Zeng, Star Reviewed-by : Chao Zhang <chao.b.zhang@intel.com> Thanks & Best regards Chao Zhang -----Original Message----- From: Yao, Jiewen Sent: Saturday, December 24, 2016 12:03 AM To: edk2-devel@lists.01.org Cc: Tian, Feng; Zeng, Star; Zhang, Chao B Subject: [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. UEFI spec requires CapsuleTarget to be a device path associated with FMP producer. Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Chao Zhang <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> --- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 15 +++++++++-- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 28 ++++++++++++++++---- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c | 4 ++- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c index af08886..2bb6ac8 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c @@ -100,6 +100,7 @@ RecordCapsuleStatusVariable ( @param[in] CapsuleStatus The capsule process stauts @param[in] PayloadIndex FMP payload index @param[in] ImageHeader FMP image header + @param[in] FmpDevicePath DevicePath associated with the FMP producer @retval EFI_SUCCESS The capsule status variable is recorded. @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. @@ -109,7 +110,8 @@ RecordFmpCapsuleStatusVariable ( IN EFI_CAPSULE_HEADER *CapsuleHeader, IN EFI_STATUS CapsuleStatus, IN UINTN PayloadIndex, - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL ); /** @@ -818,6 +820,7 @@ ProcessFmpCapsuleImage ( UINTN Index2; MEMMAP_DEVICE_PATH MemMapNode; EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath; + EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath; ESRT_MANAGEMENT_PROTOCOL *EsrtProtocol; EFI_SYSTEM_RESOURCE_ENTRY EsrtEntry; VOID *VendorCode; @@ -941,6 +944,13 @@ ProcessFmpCapsuleImage ( continue; } + FmpDevicePath = NULL; + gBS->HandleProtocol( + HandleBuffer[Index1], + &gEfiDevicePathProtocolGuid, + (VOID **)&FmpDevicePath + ); + ImageInfoSize = 0; Status = Fmp->GetImageInfo ( Fmp, @@ -1060,7 +1070,8 @@ ProcessFmpCapsuleImage ( CapsuleHeader, // CapsuleGuid Status, // CapsuleStatus Index - FmpCapsuleHeader->EmbeddedDriverCount, // PayloadIndex - ImageHeader // ImageHeader + ImageHeader, // ImageHeader + FmpDevicePath // FmpDevicePath ); if (StatusRet != EFI_SUCCESS) { StatusRet = Status; diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c index d34eb25..bba30b5 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c @@ -30,6 +30,7 @@ #include <Library/HobLib.h> #include <Library/PrintLib.h> #include <Library/ReportStatusCodeLib.h> +#include <Library/DevicePathLib.h> #include <Library/CapsuleLib.h> #include <IndustryStandard/WindowsUxCapsule.h> @@ -280,6 +281,7 @@ RecordCapsuleStatusVariable ( @param[in] CapsuleStatus The capsule process stauts @param[in] PayloadIndex FMP payload index @param[in] ImageHeader FMP image header + @param[in] FmpDevicePath DevicePath associated with the FMP producer @retval EFI_SUCCESS The capsule status variable is recorded. @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. @@ -289,26 +291,37 @@ RecordFmpCapsuleStatusVariable ( IN EFI_CAPSULE_HEADER *CapsuleHeader, IN EFI_STATUS CapsuleStatus, IN UINTN PayloadIndex, - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL ) { EFI_CAPSULE_RESULT_VARIABLE_HEADER *CapsuleResultVariableHeader; EFI_CAPSULE_RESULT_VARIABLE_FMP *CapsuleResultVariableFmp; EFI_STATUS Status; UINT8 *CapsuleResultVariable; - UINT32 CapsuleResultVariableSize; + UINTN CapsuleResultVariableSize; + CHAR16 *DevicePathStr; + UINTN DevicePathStrSize; - CapsuleResultVariable = NULL; + DevicePathStr = NULL; + if (FmpDevicePath != NULL) { + DevicePathStr = ConvertDevicePathToText (FmpDevicePath, FALSE, FALSE); + } + if (DevicePathStr != NULL) { + DevicePathStrSize = StrSize(DevicePathStr); + } else { + DevicePathStrSize = sizeof(CHAR16); + } // // Allocate zero CHAR16 for CapsuleFileName and CapsuleTarget. // - CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) * 2; + CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) + DevicePathStrSize; CapsuleResultVariable = AllocateZeroPool (CapsuleResultVariableSize); if (CapsuleResultVariable == NULL) { return EFI_OUT_OF_RESOURCES; } CapsuleResultVariableHeader = (VOID *)CapsuleResultVariable; - CapsuleResultVariableHeader->VariableTotalSize = CapsuleResultVariableSize; + CapsuleResultVariableHeader->VariableTotalSize = (UINT32)CapsuleResultVariableSize; CapsuleResultVariableHeader->Reserved = 0; CopyGuid(&CapsuleResultVariableHeader->CapsuleGuid, &CapsuleHeader->CapsuleGuid); ZeroMem(&CapsuleResultVariableHeader->CapsuleProcessed, sizeof(CapsuleResultVariableHeader->CapsuleProcessed)); @@ -320,6 +333,11 @@ RecordFmpCapsuleStatusVariable ( CapsuleResultVariableFmp->PayloadIndex = (UINT8)PayloadIndex; CapsuleResultVariableFmp->UpdateImageIndex = ImageHeader->UpdateImageIndex; CopyGuid (&CapsuleResultVariableFmp->UpdateImageTypeId, &ImageHeader->UpdateImageTypeId); + if (DevicePathStr != NULL) { + CopyMem ((UINT8 *)CapsuleResultVariableFmp + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16), DevicePathStr, DevicePathStrSize); + FreePool (DevicePathStr); + DevicePathStr = NULL; + } // // Save Local Cache diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c index bf550e5..6ab198d 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c @@ -64,6 +64,7 @@ RecordCapsuleStatusVariable ( @param[in] CapsuleStatus The capsule process stauts @param[in] PayloadIndex FMP payload index @param[in] ImageHeader FMP image header + @param[in] FmpDevicePath DevicePath associated with the FMP producer @retval EFI_SUCCESS The capsule status variable is recorded. @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status variable. @@ -73,7 +74,8 @@ RecordFmpCapsuleStatusVariable ( IN EFI_CAPSULE_HEADER *CapsuleHeader, IN EFI_STATUS CapsuleStatus, IN UINTN PayloadIndex, - IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader + IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, + IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL ) { return EFI_UNSUPPORTED; -- 2.7.4.windows.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-12-26 3:12 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-12-23 16:02 [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support Jiewen Yao 2016-12-26 2:56 ` Zeng, Star 2016-12-26 3:01 ` Yao, Jiewen 2016-12-26 3:03 ` Zeng, Star 2016-12-26 3:12 ` Zhang, Chao B
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox