From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atlmailgw1.ami.com (atlmailgw1.ami.com []) by mx.groups.io with SMTP id smtpd.web10.101.1589403361526785822 for ; Wed, 13 May 2020 13:56:07 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: ami.com, ip: , mailfrom: oleksiyy@ami.com) X-AuditID: ac1060b2-0f7ff700000018d4-d6-5ebc5ee48a03 Received: from atlms1.us.megatrends.com (atlms1.us.megatrends.com [172.16.96.144]) (using TLS with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client did not present a certificate) by atlmailgw1.ami.com (Symantec Messaging Gateway) with SMTP id 52.25.06356.4EE5CBE5; Wed, 13 May 2020 16:56:05 -0400 (EDT) Received: from Oleksiy77.us.megatrends.com (172.16.97.158) by atlms1.us.megatrends.com (172.16.96.144) with Microsoft SMTP Server id 14.3.468.0; Wed, 13 May 2020 16:55:21 -0400 From: "Oleksiy Yakovlev" To: CC: , , , , , , , Subject: [PATCH V5 5/6] MdeModulePkg: Add FMP Capsule Image Header extension Date: Wed, 13 May 2020 16:55:14 -0400 Message-ID: <20200513205515.56044-6-oleksiyy@ami.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20200513205515.56044-1-oleksiyy@ami.com> References: <20200513205515.56044-1-oleksiyy@ami.com> MIME-Version: 1.0 Return-Path: oleksiyy@ami.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWyRiBhgu7TuD1xBotWGFnMf1tt0T5hNpvF 1Vu/mCzmfZvBarHuo4fFinsb2C06Ov4xObB7bP9+gdFj8Z6XTAFMUQ2MNol5efkliSWpCimp xcm2SgFFmWWJyZVKCpkptkqGSgoFOYnJqbmpeSW2SokFBal5KUp2XAoYwAaoLDNPITUvOT8l My/dVskz2F/XwsLUUtdQyS4kI1UhMy8tvyg3sSQzP08hOT+vBKg6NQUoqpDQzZkx59wzpoIm pYqmT3tYGhgPyXQxcnJICJhITOjtZe1i5OIQEtjFJHHn9VkmCGcLo8ShH4uZQarYBDQlDhyb wghiiwhISUw5MJMJxGYWOMwo0fEJLC4s4CNxd+pDVhCbRUBV4uDzVywgNq+AqcTLbe+ZILZp SExbcxfI5uDgFDCTmLraFCQsBFRy6tU8JohyQYmTM5+wQIyXkDj44gUzRI2sRNvx5+wTGPln ISmbhaRsASPTKkahxJKc3MTMnPRyQ73E3Ey95PzcTYyQ+Nu0g7HlovkhRiYOxkOMEhzMSiK8 fut3xwnxpiRWVqUW5ccXleakFh9idAK6fyKzFDcoAIExEm9sYCAlCuMYmpiZmBuZG1qamBsb K4nzTl67Jk5IIB0Ys9mpqQWpRTBDmDg4pRoYJfxvzbt8cOYjxieNj5fIhPKomXzSys02WHDB 5mDPTJfDjLoxbhPO/H5Zfphh30ttk18fFnV/F3lypT9NUOB8/qwjmtoKv9erB564nDj/5LRW bhVf9aq3Kdf+SH1kcosOMqrY/mmn/gNmS/GD+R+2OVh+NHa/fi+WU2Bpb4tJh8pevafvmZbP VGIpzkg01GIuKk4EAP1j3mnUAgAA Content-Type: text/plain Add bitmask to structure which gives a binary-inspectable mechanism to determine if a capsule contains an authentication section or depex section. (UEFI 2.8 errata a, mantis 2026) Signed-off-by: Oleksiy Yakovlev --- MdeModulePkg/Application/CapsuleApp/CapsuleDump.c | 1 + .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c index 7e3e072..e3ab199 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c @@ -98,6 +98,7 @@ DumpFmpCapsule ( Print(L" UpdateVendorCodeSize - 0x%x\n", FmpImageHeader->UpdateVendorCodeSize); if (FmpImageHeader->Version >= EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { Print(L" UpdateHardwareInstance - 0x%lx\n", FmpImageHeader->UpdateHardwareInstance); + Print(L" ImageCapsuleSupport - 0x%lx\n", FmpImageHeader->ImageCapsuleSupport); } } } diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c index 5dda561..f9819a7 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c @@ -285,8 +285,10 @@ ValidateFmpCapsule ( DEBUG((DEBUG_ERROR, "ImageHeader->Version(0x%x) Unknown\n", ImageHeader->Version)); return EFI_INVALID_PARAMETER; } - if (ImageHeader->Version < EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { + if (ImageHeader->Version == 1) { FmpImageHeaderSize = OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, UpdateHardwareInstance); + } else { + FmpImageHeaderSize = OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, ImageCapsuleSupport); } if (FmpImageSize < FmpImageHeaderSize) { DEBUG((DEBUG_ERROR, "FmpImageSize(0x%lx) < FmpImageHeaderSize(0x%x)\n", FmpImageSize, FmpImageHeaderSize)); @@ -521,6 +523,7 @@ DumpFmpCapsule ( DEBUG((DEBUG_VERBOSE, " UpdateVendorCodeSize - 0x%x\n", ImageHeader->UpdateVendorCodeSize)); if (ImageHeader->Version >= EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { DEBUG((DEBUG_VERBOSE, " UpdateHardwareInstance - 0x%lx\n", ImageHeader->UpdateHardwareInstance)); + DEBUG((DEBUG_VERBOSE, " ImageCapsuleSupport - 0x%lx\n", ImageHeader->ImageCapsuleSupport)); } } } @@ -928,9 +931,14 @@ SetFmpImageData ( } else { // // If the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER is version 1, - // Header should exclude UpdateHardwareInstance field + // Header should exclude UpdateHardwareInstance field, and + // ImageCapsuleSupport field if version is 2. // - Image = (UINT8 *)ImageHeader + OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, UpdateHardwareInstance); + if (ImageHeader->Version == 1) { + Image = (UINT8 *)ImageHeader + OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, UpdateHardwareInstance); + } else { + Image = (UINT8 *)ImageHeader + OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, ImageCapsuleSupport); + } } if (ImageHeader->UpdateVendorCodeSize == 0) { @@ -945,6 +953,7 @@ SetFmpImageData ( DEBUG((DEBUG_INFO, "ImageIndex - 0x%x ", ImageHeader->UpdateImageIndex)); if (ImageHeader->Version >= EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { DEBUG((DEBUG_INFO, "(UpdateHardwareInstance - 0x%x)", ImageHeader->UpdateHardwareInstance)); + DEBUG((DEBUG_INFO, "(ImageCapsuleSupport - 0x%x)", ImageHeader->ImageCapsuleSupport)); } DEBUG((DEBUG_INFO, "\n")); @@ -1239,7 +1248,10 @@ ProcessFmpCapsuleImage ( ImageHeader = (EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *)((UINT8 *)FmpCapsuleHeader + ItemOffsetList[Index]); UpdateHardwareInstance = 0; - if (ImageHeader->Version >= EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) { + /// + /// UpdateHardwareInstance field was added in Version 2 + /// + if (ImageHeader->Version >= 2) { UpdateHardwareInstance = ImageHeader->UpdateHardwareInstance; } -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.