From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 817818184D for ; Sun, 25 Dec 2016 19:03:51 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP; 25 Dec 2016 19:03:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,404,1477983600"; d="scan'208,217";a="46738639" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 25 Dec 2016 19:03:51 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 25 Dec 2016 19:03:50 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Mon, 26 Dec 2016 11:03:45 +0800 From: "Zeng, Star" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Tian, Feng" , "Zhang, Chao B" , "Zeng, Star" Thread-Topic: [edk2] [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. Thread-Index: AQHSXTYE4vfQfXbCm0KegIUJE9owdKEZBqiAgAABaQCAAIaioA== Date: Mon, 26 Dec 2016 03:03:45 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B7F0FC9@shsmsx102.ccr.corp.intel.com> References: <1482508959-16144-1-git-send-email-jiewen.yao@intel.com> <63065c0b-9508-327c-693e-11a4f595aa09@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503A8D52B8@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503A8D52B8@shsmsx102.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget support. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 03:03:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable With that, Reviewed-by: Star Zeng From: Yao, Jiewen Sent: Monday, December 26, 2016 11:01 AM To: Zeng, Star ; edk2-devel@lists.01.org Cc: Tian, Feng ; Zeng, Star ; Zha= ng, Chao B Subject: RE: [edk2] [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget s= upport. 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 >; edk2-d= evel@lists.01.org Cc: Tian, Feng >; Zeng, Sta= r >; Zhang, Chao B > Subject: Re: [edk2] [PATCH V2] MdeModulePkg/CapsuleLib: Add CapsuleTarget s= upport. 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 > > Cc: Star Zeng > > Cc: Chao Zhang > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao > > --- > 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/MdeM= odulePkg/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 OPTION= AL > ); > > /** > @@ -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 =3D NULL; > + gBS->HandleProtocol( > + HandleBuffer[Index1], > + &gEfiDevicePathProtocolGuid, > + (VOID **)&FmpDevicePath > + ); > + > ImageInfoSize =3D 0; > Status =3D Fmp->GetImageInfo ( > Fmp, > @@ -1060,7 +1070,8 @@ ProcessFmpCapsuleImage ( > CapsuleHeader, // CapsuleG= uid > Status, // CapsuleS= tatus > Index - FmpCapsuleHeader->EmbeddedDriverCount, // PayloadI= ndex > - ImageHeader // ImageHea= der > + ImageHeader, // ImageHea= der > + FmpDevicePath // FmpDevic= ePath > ); > if (StatusRet !=3D EFI_SUCCESS) { > StatusRet =3D 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 > #include > #include > +#include > #include > > #include > @@ -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 OPTION= AL > ) > { > 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 =3D NULL; > + DevicePathStr =3D NULL; > + if (FmpDevicePath !=3D NULL) { > + DevicePathStr =3D ConvertDevicePathToText (FmpDevicePath, FALSE, FAL= SE); > + } > + if (DevicePathStr !=3D NULL) { > + DevicePathStrSize =3D StrSize(DevicePathStr); > + } else { > + DevicePathStrSize =3D sizeof(CHAR16); > + } > // > // Allocate zero CHAR16 for CapsuleFileName and CapsuleTarget. Does the comment need to be updated? > // > - CapsuleResultVariableSize =3D sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADE= R) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) * 2; > + CapsuleResultVariableSize =3D sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADE= R) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) + DevicePathS= trSize; > CapsuleResultVariable =3D AllocateZeroPool (CapsuleResultVariableS= ize); > if (CapsuleResultVariable =3D=3D NULL) { > return EFI_OUT_OF_RESOURCES; > } > CapsuleResultVariableHeader =3D (VOID *)CapsuleResultVariable; > - CapsuleResultVariableHeader->VariableTotalSize =3D CapsuleResultVariab= leSize; > + CapsuleResultVariableHeader->VariableTotalSize =3D (UINT32)CapsuleResu= ltVariableSize; > CapsuleResultVariableHeader->Reserved =3D 0; > CopyGuid(&CapsuleResultVariableHeader->CapsuleGuid, &CapsuleHeader->Ca= psuleGuid); > ZeroMem(&CapsuleResultVariableHeader->CapsuleProcessed, sizeof(Capsule= ResultVariableHeader->CapsuleProcessed)); > @@ -320,6 +333,11 @@ RecordFmpCapsuleStatusVariable ( > CapsuleResultVariableFmp->PayloadIndex =3D (UINT8)PayloadIndex; > CapsuleResultVariableFmp->UpdateImageIndex =3D ImageHeader->UpdateImag= eIndex; > CopyGuid (&CapsuleResultVariableFmp->UpdateImageTypeId, &ImageHeader->= UpdateImageTypeId); > + if (DevicePathStr !=3D NULL) { > + CopyMem ((UINT8 *)CapsuleResultVariableFmp + sizeof(EFI_CAPSULE_RESU= LT_VARIABLE_FMP) + sizeof(CHAR16), DevicePathStr, DevicePathStrSize); > + FreePool (DevicePathStr); > + DevicePathStr =3D NULL; > + } > > // > // Save Local Cache > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNul= l.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 OPTION= AL > ) > { > return EFI_UNSUPPORTED; > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel