From nobody Thu Dec 26 00:30:41 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1505540622020748.8530522557205; Fri, 15 Sep 2017 22:43:42 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 064D320945BE0; Fri, 15 Sep 2017 22:40:40 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 04C0020945B9C for ; Fri, 15 Sep 2017 22:40:38 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Sep 2017 22:43:39 -0700 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 15 Sep 2017 22:43:38 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 15 Sep 2017 22:43:38 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 15 Sep 2017 22:43:36 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Sat, 16 Sep 2017 13:43:35 +0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,400,1500966000"; d="dat'59?scan'59,208,59";a="135985135" From: "Guo, Mang" To: "edk2-devel@lists.01.org" Thread-Topic: [Patch][edk2-platforms/minnowboard-max-udk2017] Vlv2TbltDevicePkg: Enable signed capsule. Thread-Index: AdMurryLzTsLoZnGQiizX7VAO43pEQ== Date: Sat, 16 Sep 2017 05:43:34 +0000 Message-ID: <22D2C85ED001C54AA20BFE3B0E4751D152567758@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <22D2C85ED001C54AA20BFE3B0E4751D152567758@SHSMSX103.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: [edk2] [Patch][edk2-platforms/minnowboard-max-udk2017] Vlv2TbltDevicePkg: Enable signed capsule. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Wei, David" Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Guo Mang --- .../PlatformFlashAccessLib.c | 638 +++++++++++++++++= ++++ .../PlatformFlashAccessLib.inf | 61 ++ .../SystemFirmwareDescriptor.acpi | Bin 0 -> 172 bytes .../SystemFirmwareDescriptor.aslc | 90 +++ .../SystemFirmwareDescriptor.inf | 45 ++ .../SystemFirmwareDescriptorPei.c | 81 +++ .../SystemFirmwareDescriptorTable.inf | 28 + .../SystemFirmwareUpdateConfig.ini | 67 +++ .../Library/PlatformBdsLib/BdsPlatform.c | 8 +- Vlv2TbltDevicePkg/PlatformPkg.dec | 24 +- Vlv2TbltDevicePkg/PlatformPkg.fdf | 114 +++- Vlv2TbltDevicePkg/PlatformPkgConfig.dsc | 1 + Vlv2TbltDevicePkg/PlatformPkgGcc.fdf | 114 +++- Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 65 ++- Vlv2TbltDevicePkg/PlatformPkgIA32.dsc | 65 ++- Vlv2TbltDevicePkg/PlatformPkgX64.dsc | 64 ++- 16 files changed, 1395 insertions(+), 70 deletions(-) create mode 100644 Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlash= AccessLib/PlatformFlashAccessLib.c create mode 100644 Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlash= AccessLib/PlatformFlashAccessLib.inf create mode 100644 Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescrip= tor/SystemFirmwareDescriptor.acpi create mode 100644 Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescrip= tor/SystemFirmwareDescriptor.aslc create mode 100644 Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescrip= tor/SystemFirmwareDescriptor.inf create mode 100644 Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescrip= tor/SystemFirmwareDescriptorPei.c create mode 100644 Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescrip= tor/SystemFirmwareDescriptorTable.inf create mode 100644 Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareUpdateC= onfig/SystemFirmwareUpdateConfig.ini diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessL= ib/PlatformFlashAccessLib.c b/Vlv2TbltDevicePkg/Feature/Capsule/Library/Pla= tformFlashAccessLib/PlatformFlashAccessLib.c new file mode 100644 index 0000000..ab21a95 --- /dev/null +++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/Plat= formFlashAccessLib.c @@ -0,0 +1,638 @@ +/** @file + Platform Flash Access library. + + Copyright (c) 2017, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ +#include + +#include + +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include "PchAccess.h" +#include +#include +#include +#include + +//#define SECTOR_SIZE_64KB 0x10000 // Common 64kBytes sector size +//#define ALINGED_SIZE SECTOR_SIZE_64KB + +#define BLOCK_SIZE 0x1000 +#define ALINGED_SIZE BLOCK_SIZE + +#define R_PCH_LPC_BIOS_CNTL 0xDC +#define B_PCH_LPC_BIOS_CNTL_SMM_BWP 0x20 ///< SMM= BIOS write protect disable + +// +// Prefix Opcode Index on the host SPI controller +// +typedef enum { + SPI_WREN, // Prefix Opcode 0: Write Enable + SPI_EWSR, // Prefix Opcode 1: Enable Write Status Register +} PREFIX_OPCODE_INDEX; +// +// Opcode Menu Index on the host SPI controller +// +typedef enum { + SPI_READ_ID, // Opcode 0: READ ID, Read cycle with address + SPI_READ, // Opcode 1: READ, Read cycle with address + SPI_RDSR, // Opcode 2: Read Status Register, No address + SPI_WRDI_SFDP, // Opcode 3: Write Disable or Discovery Parameters, = No address + SPI_SERASE, // Opcode 4: Sector Erase (4KB), Write cycle with ad= dress + SPI_BERASE, // Opcode 5: Block Erase (32KB), Write cycle with ad= dress + SPI_PROG, // Opcode 6: Byte Program, Write cycle with address + SPI_WRSR, // Opcode 7: Write Status Register, No address +} SPI_OPCODE_INDEX; + +STATIC EFI_PHYSICAL_ADDRESS mInternalFdAddress; + +EFI_SPI_PROTOCOL *mSpiProtocol; + +/** + Read NumBytes bytes of data from the address specified by + PAddress into Buffer. + + @param[in] Address The starting physical address of the read. + @param[in,out] NumBytes On input, the number of bytes to read. On = output, the number + of bytes actually read. + @param[out] Buffer The destination data buffer for the read. + + @retval EFI_SUCCESS Opertion is successful. + @retval EFI_DEVICE_ERROR If there is any device errors. =20 + =20 +**/ +EFI_STATUS +EFIAPI +SpiFlashRead ( + IN UINTN Address, + IN OUT UINT32 *NumBytes, + OUT UINT8 *Buffer + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + UINTN Offset =3D 0; + + ASSERT ((NumBytes !=3D NULL) && (Buffer !=3D NULL)); + + + //if (Address >=3D (UINTN)PcdGet32 (PcdGbeRomBase) && Address < (UINTN)P= cdGet32 (PcdPDRRomBase)) { + Offset =3D Address - (UINTN)PcdGet32 (PcdFlashChipBase); + + Status =3D mSpiProtocol->Execute ( + mSpiProtocol, + 1, //SPI_READ, + 0, //SPI_WREN, + TRUE, + TRUE, + FALSE, + Offset, + BLOCK_SIZE, + Buffer, + EnumSpiRegionAll + ); + return Status; +} + +/** + Write NumBytes bytes of data from Buffer to the address specified by + PAddresss. + + @param[in] Address The starting physical address of the wri= te. + @param[in,out] NumBytes On input, the number of bytes to write. = On output, + the actual number of bytes written. + @param[in] Buffer The source data buffer for the write. + + @retval EFI_SUCCESS Opertion is successful. + @retval EFI_DEVICE_ERROR If there is any device errors. =20 + +**/ +EFI_STATUS=20 +EFIAPI +SpiFlashWrite ( + IN UINTN Address, + IN OUT UINT32 *NumBytes, + IN UINT8 *Buffer + ) +{ + EFI_STATUS Status; + UINTN Offset; + UINT32 Length; + UINT32 RemainingBytes; + + ASSERT ((NumBytes !=3D NULL) && (Buffer !=3D NULL)); + ASSERT (Address >=3D (UINTN)PcdGet32 (PcdFlashChipBase)); + + Offset =3D Address - (UINTN)PcdGet32 (PcdFlashChipBase); + + ASSERT ((*NumBytes + Offset) <=3D (UINTN)PcdGet32 (PcdFlashChipSize)); + + Status =3D EFI_SUCCESS; + RemainingBytes =3D *NumBytes; + + while (RemainingBytes > 0) { + if (RemainingBytes > SIZE_4KB) { + Length =3D SIZE_4KB; + } else { + Length =3D RemainingBytes; + } + Status =3D mSpiProtocol->Execute ( + mSpiProtocol, + SPI_PROG, + SPI_WREN, + TRUE, + TRUE, + TRUE, + (UINT32) Offset, + Length, + Buffer, + EnumSpiRegionAll + ); + if (EFI_ERROR (Status)) { + break; =20 + } + RemainingBytes -=3D Length; + Offset +=3D Length; + Buffer +=3D Length; + } + =20 + // + // Actual number of bytes written + // + *NumBytes -=3D RemainingBytes; + + return Status; +} + + +EFI_STATUS +InternalReadBlock ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + OUT VOID *ReadBuffer + ) +{ + EFI_STATUS Status; + UINT32 BlockSize; + + BlockSize =3D BLOCK_SIZE; + + Status =3D SpiFlashRead ((UINTN) BaseAddress, &BlockSize, ReadBuffer); + + return Status; +} + +/** + Erase the block starting at Address. + + @param[in] Address The starting physical address of the block t= o be erased. + This library assume that caller garantee tha= t the PAddress + is at the starting address of this block. + @param[in] NumBytes On input, the number of bytes of the logical= block to be erased. + On output, the actual number of bytes erased. + =20 + @retval EFI_SUCCESS. Opertion is successful. + @retval EFI_DEVICE_ERROR If there is any device errors. =20 + +**/ +EFI_STATUS=20 +EFIAPI +SpiFlashBlockErase ( + IN UINTN Address, + IN UINTN *NumBytes + ) +{ + EFI_STATUS Status; + UINTN Offset; + UINTN RemainingBytes; + + ASSERT (NumBytes !=3D NULL); + ASSERT (Address >=3D (UINTN)PcdGet32 (PcdFlashChipBase)); + + Offset =3D Address - (UINTN)PcdGet32 (PcdFlashChipBase); + + ASSERT ((*NumBytes % SIZE_4KB) =3D=3D 0); + ASSERT ((*NumBytes + Offset) <=3D (UINTN)PcdGet32 (PcdFlashChipSize)); + + Status =3D EFI_SUCCESS; + RemainingBytes =3D *NumBytes; + + // + // To adjust the Offset with Bios/Gbe=20 + // +// if (Address >=3D (UINTN)PcdGet32 (PcdFlashChipBase)) { +// Offset =3D Address - (UINTN)PcdGet32 (PcdFlashChipBase); + =20 + while (RemainingBytes > 0) { + Status =3D mSpiProtocol->Execute ( + mSpiProtocol, + SPI_SERASE, + SPI_WREN, + FALSE, + TRUE, + FALSE, + (UINT32) Offset, + 0, + NULL, + EnumSpiRegionAll + ); + if (EFI_ERROR (Status)) { + break; =20 + } + RemainingBytes -=3D SIZE_4KB; + Offset +=3D SIZE_4KB; + } +// } + + // + // Actual number of bytes erased + // + *NumBytes -=3D RemainingBytes; + + return Status; +} + +/** + +Routine Description: + + Erase the whole block. + +Arguments: + + BaseAddress - Base address of the block to be erased. + +Returns: + + EFI_SUCCESS - The command completed successfully. + Other - Device error or wirte-locked, operation failed. + +**/ +EFI_STATUS +InternalEraseBlock ( + IN EFI_PHYSICAL_ADDRESS BaseAddress + ) +{ + EFI_STATUS Status; + UINTN NumBytes; + + NumBytes =3D BLOCK_SIZE; + + Status =3D SpiFlashBlockErase ((UINTN) BaseAddress, &NumBytes); + + return Status; +} + +EFI_STATUS +InternalCompareBlock ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT8 *Buffer + ) +{ + EFI_STATUS Status; + VOID *CompareBuffer; + UINT32 NumBytes; + INTN CompareResult; + + NumBytes =3D BLOCK_SIZE; + CompareBuffer =3D AllocatePool (NumBytes); + if (CompareBuffer =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto Done; + } + + Status =3D SpiFlashRead ((UINTN) BaseAddress, &NumBytes, CompareBuffer); + if (EFI_ERROR (Status)) { + goto Done; + } + CompareResult =3D CompareMem (CompareBuffer, Buffer, BLOCK_SIZE); + if (CompareResult !=3D 0) { + Status =3D EFI_VOLUME_CORRUPTED; + } + +Done: + if (CompareBuffer !=3D NULL) { + FreePool (CompareBuffer); + } + + return Status; +} + +/** + +Routine Description: + + Write a block of data. + +Arguments: + + BaseAddress - Base address of the block. + Buffer - Data buffer. + BufferSize - Size of the buffer. + +Returns: + + EFI_SUCCESS - The command completed successfully. + EFI_INVALID_PARAMETER - Invalid parameter, can not proceed. + Other - Device error or wirte-locked, operation failed. + +**/ +EFI_STATUS +InternalWriteBlock ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT8 *Buffer, + IN UINT32 BufferSize + ) +{ + EFI_STATUS Status; + + Status =3D SpiFlashWrite ((UINTN) BaseAddress, &BufferSize, Buffer); + =20 + if (EFI_ERROR (Status)) { + DEBUG((EFI_D_ERROR, "\nFlash write error.")); + return Status; + } + + WriteBackInvalidateDataCacheRange ((VOID *) (UINTN) BaseAddress, BLOCK_S= IZE); + + Status =3D InternalCompareBlock (BaseAddress, Buffer); + if (EFI_ERROR (Status)) { + DEBUG((EFI_D_ERROR, "\nError when writing to BaseAddress %x with diffe= rent at offset %x.", BaseAddress, Status)); + } else { + DEBUG((EFI_D_INFO, "\nVerified data written to Block at %x is correct.= ", BaseAddress)); + } + + return Status; + +} + + +/** + Perform flash write opreation. + + @param[in] FirmwareType The type of firmware. + @param[in] FlashAddress The address of flash device to be accessed. + @param[in] FlashAddressType The type of flash device address. + @param[in] Buffer The pointer to the data buffer. + @param[in] Length The length of data buffer in bytes. + + @retval EFI_SUCCESS The operation returns successfully. + @retval EFI_WRITE_PROTECTED The flash device is read only. + @retval EFI_UNSUPPORTED The flash device access is unsupported. + @retval EFI_INVALID_PARAMETER The input parameter is not valid. +**/ +EFI_STATUS +EFIAPI +PerformFlashWrite ( + IN PLATFORM_FIRMWARE_TYPE FirmwareType, + IN EFI_PHYSICAL_ADDRESS FlashAddress, + IN FLASH_ADDRESS_TYPE FlashAddressType, + IN VOID *Buffer, + IN UINTN Length + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + UINTN Index; + EFI_PHYSICAL_ADDRESS Address; + UINTN CountOfBlocks; + EFI_TPL OldTpl; + BOOLEAN FlashError; + UINT8 *Buf; + UINTN LpcBaseAddress; + UINT8 Data8Or; + UINT8 Data8And; + UINT8 BiosCntl; + + Index =3D 0; + Address =3D 0; + CountOfBlocks =3D 0; + FlashError =3D FALSE; + Buf =3D Buffer; + + DEBUG((DEBUG_INFO | DEBUG_ERROR, "PerformFlashWrite - 0x%x(%x) - 0x%x\n"= , (UINTN)FlashAddress, (UINTN)FlashAddressType, Length)); + if (FlashAddressType =3D=3D FlashAddressTypeRelativeAddress) { + FlashAddress =3D FlashAddress + mInternalFdAddress; + } + + CountOfBlocks =3D (UINTN) (Length / BLOCK_SIZE); + Address =3D FlashAddress; + =20 + LpcBaseAddress =3D MmPciAddress (0, + DEFAULT_PCI_BUS_NUMBER_PCH, + PCI_DEVICE_NUMBER_PCH_LPC, + PCI_FUNCTION_NUMBER_PCH_LPC, + 0 + ); + BiosCntl =3D MmioRead8 (LpcBaseAddress + R_PCH_LPC_BIOS_CNTL); + if ((BiosCntl & B_PCH_LPC_BIOS_CNTL_SMM_BWP) =3D=3D B_PCH_LPC_BIOS_CNTL_= SMM_BWP) { + /// + /// Clear SMM_BWP bit (D31:F0:RegDCh[5]) + /// + Data8And =3D (UINT8) ~B_PCH_LPC_BIOS_CNTL_SMM_BWP; + Data8Or =3D 0x00; + =20 + MmioAndThenOr8 ( + LpcBaseAddress + R_PCH_LPC_BIOS_CNTL, + Data8And, + Data8Or + ); + DEBUG((EFI_D_INFO, "PerformFlashWrite Clear SMM_BWP bit\n")); + } + + // + // Raise TPL to TPL_NOTIFY to block any event handler, + // while still allowing RaiseTPL(TPL_NOTIFY) within + // output driver during Print() + // + OldTpl =3D gBS->RaiseTPL (TPL_NOTIFY); + for (Index =3D 0; Index < CountOfBlocks; Index++) { + // + // Handle block based on address and contents. + // + if (!EFI_ERROR (InternalCompareBlock (Address, Buf))) { + DEBUG((EFI_D_INFO, "Skipping block at 0x%lx (already programmed)\n= ", Address)); + } else { + // + // Display a dot for each block being updated. + // + Print (L"."); + + // + // Make updating process uninterruptable, + // so that the flash memory area is not accessed by other entities + // which may interfere with the updating process + // + Status =3D InternalEraseBlock (Address); + if (EFI_ERROR (Status)) { + gBS->RestoreTPL (OldTpl); + FlashError =3D TRUE; + goto Done; + } + Status =3D InternalWriteBlock ( + Address, + Buf, + (UINT32)(Length > BLOCK_SIZE ? BLOCK_SIZE : Length) + ); + if (EFI_ERROR (Status)) { + gBS->RestoreTPL (OldTpl); + FlashError =3D TRUE; + goto Done; + } + } + + // + // Move to next block to update. + // + Address +=3D BLOCK_SIZE; + Buf +=3D BLOCK_SIZE; + if (Length > BLOCK_SIZE) { + Length -=3D BLOCK_SIZE; + } else { + Length =3D 0; + } + } + gBS->RestoreTPL (OldTpl); + =20 + Done: + if ((BiosCntl & B_PCH_LPC_BIOS_CNTL_SMM_BWP) =3D=3D B_PCH_LPC_BIOS_CNTL_= SMM_BWP) { + // + // Restore original control setting + // + MmioWrite8 (LpcBaseAddress + R_PCH_LPC_BIOS_CNTL, BiosCntl); + } + + // + // Print flash update failure message if error detected. + // + if (FlashError) { + Print (L"No %r\n", Status); + } + + return EFI_SUCCESS; +} + +/** + Perform microcode write opreation. + + @param[in] FlashAddress The address of flash device to be accessed. + @param[in] Buffer The pointer to the data buffer. + @param[in] Length The length of data buffer in bytes. + + @retval EFI_SUCCESS The operation returns successfully. + @retval EFI_WRITE_PROTECTED The flash device is read only. + @retval EFI_UNSUPPORTED The flash device access is unsupported. + @retval EFI_INVALID_PARAMETER The input parameter is not valid. +**/ +EFI_STATUS +EFIAPI +MicrocodeFlashWrite ( + IN EFI_PHYSICAL_ADDRESS FlashAddress, + IN VOID *Buffer, + IN UINTN Length + ) +{ + EFI_PHYSICAL_ADDRESS AlignedFlashAddress; + VOID *AlignedBuffer; + UINTN AlignedLength; + UINTN OffsetHead; + UINTN OffsetTail; + EFI_STATUS Status; + + DEBUG((DEBUG_INFO, "MicrocodeFlashWrite - 0x%x - 0x%x\n", (UINTN)FlashAd= dress, Length)); + + // + // Need make buffer 64K aligned to support ERASE + // + // [Aligned] FlashAddress [Aligned] + // | | | + // V V V + // +--------------+=3D=3D=3D=3D=3D=3D=3D=3D+------------+ + // | OffsetHeader | Length | OffsetTail | + // +--------------+=3D=3D=3D=3D=3D=3D=3D=3D+------------+ + // ^ + // |<-----------AlignedLength-----------> + // | + // AlignedFlashAddress + // + OffsetHead =3D FlashAddress & (ALINGED_SIZE - 1); + OffsetTail =3D (FlashAddress + Length) & (ALINGED_SIZE - 1); + if (OffsetTail !=3D 0) { + OffsetTail =3D ALINGED_SIZE - OffsetTail; + } + + if ((OffsetHead !=3D 0) || (OffsetTail !=3D 0)) { + AlignedFlashAddress =3D FlashAddress - OffsetHead; + AlignedLength =3D Length + OffsetHead + OffsetTail; + + AlignedBuffer =3D AllocatePool(AlignedLength); + if (AlignedBuffer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + // + // Save original buffer + // + if (OffsetHead !=3D 0) { + CopyMem((UINT8 *)AlignedBuffer, (VOID *)(UINTN)AlignedFlashAddress, = OffsetHead); + } + if (OffsetTail !=3D 0) { + CopyMem((UINT8 *)AlignedBuffer + OffsetHead + Length, (VOID *)(UINTN= )(AlignedFlashAddress + OffsetHead + Length), OffsetTail); + } + // + // Override new buffer + // + CopyMem((UINT8 *)AlignedBuffer + OffsetHead, Buffer, Length); + } else { + AlignedFlashAddress =3D FlashAddress; + AlignedBuffer =3D Buffer; + AlignedLength =3D Length; + } + + Status =3D PerformFlashWrite( + PlatformFirmwareTypeSystemFirmware, + AlignedFlashAddress, + FlashAddressTypeAbsoluteAddress, + AlignedBuffer, + AlignedLength + ); + if ((OffsetHead !=3D 0) || (OffsetTail !=3D 0)) { + FreePool (AlignedBuffer); + } + return Status; +} + +/** + Platform Flash Access Lib Constructor. +**/ +EFI_STATUS +EFIAPI +PerformFlashAccessLibConstructor ( + VOID + ) +{ + EFI_STATUS Status; + mInternalFdAddress =3D (EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32(PcdFlashAre= aBaseAddress); + DEBUG((DEBUG_INFO, "PcdFlashAreaBaseAddress - 0x%x\n", mInternalFdAddres= s)); + + Status =3D gBS->LocateProtocol ( + &gEfiSpiProtocolGuid, + NULL, + (VOID **) &mSpiProtocol + ); + ASSERT_EFI_ERROR(Status); + + return EFI_SUCCESS; +} diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessL= ib/PlatformFlashAccessLib.inf b/Vlv2TbltDevicePkg/Feature/Capsule/Library/P= latformFlashAccessLib/PlatformFlashAccessLib.inf new file mode 100644 index 0000000..144f2b3 --- /dev/null +++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/Plat= formFlashAccessLib.inf @@ -0,0 +1,61 @@ +## @file +# Platform Flash Access library. +# +# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PlatformFlashAccessLib + FILE_GUID =3D 31CF9CEC-DA4E-4505-AA20-33364A291A95 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PlatformFlashAccessLib + LIBRARY_CLASS =3D MicrocodeFlashAccessLib + CONSTRUCTOR =3D PerformFlashAccessLibConstructor + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC +# + +[Sources] + PlatformFlashAccessLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + SignedCapsulePkg/SignedCapsulePkg.dec + Vlv2TbltDevicePkg/PlatformPkg.dec + Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec + +[LibraryClasses] + BaseMemoryLib + IoLib + PcdLib + DebugLib +# FlashDeviceLib + MemoryAllocationLib + CacheMaintenanceLib + +[Guids] + gEdkiiSystemFmpCapsuleConfigFileGuid ## SOMETIMES_CONSUMES ## G= UID + +[Protocols] + gEfiSpiProtocolGuid ## CONSUMES + +[Pcd] + gPlatformModuleTokenSpaceGuid.PcdFlashAreaBaseAddress ## SOMETIMES_CONS= UMES + gPlatformModuleTokenSpaceGuid.PcdFlashChipBase ## SOMETIMES_CONS= UMES + gPlatformModuleTokenSpaceGuid.PcdFlashChipSize ## SOMETIMES_CONS= UMES + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## SOMETIMES_CONS= UMES + =20 \ No newline at end of file diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/Sys= temFirmwareDescriptor.acpi b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwa= reDescriptor/SystemFirmwareDescriptor.acpi new file mode 100644 index 0000000000000000000000000000000000000000..b355bb47e8715e083320305d761= 78667a50b0c6c GIT binary patch literal 172 zcmWG`^K_|TU|?7S#Q%X{4v=3DO9;%c>N4qUfhJ8gaa@3X8z&6Y5qFr)Z*w-k_CCLnGD zVhCseQ~XdKjD~W-X2ICVbQnVpLm7h+gBwE%P}qQ>0*H~J5l}RgA&(&&i1QiBfg}S1 E0K^~~$p8QV literal 0 HcmV?d00001 diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/Sys= temFirmwareDescriptor.aslc b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwa= reDescriptor/SystemFirmwareDescriptor.aslc new file mode 100644 index 0000000..35df7ef --- /dev/null +++ b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirm= wareDescriptor.aslc @@ -0,0 +1,90 @@ +/** @file + System Firmware descriptor. + + Copyright (c) 2017, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ + +#include +#include +#include + +#define PACKAGE_VERSION 0xFFFFFFFF +#define PACKAGE_VERSION_STRING L"Unknown" + +#define CURRENT_FIRMWARE_VERSION 0x00000002 +#define CURRENT_FIRMWARE_VERSION_STRING L"0x00000002" +#define LOWEST_SUPPORTED_FIRMWARE_VERSION 0x00000001 +#define FLASHAREASIZE 0x00800000 + +#define IMAGE_ID SIGNATURE_64('V', 'L', 'V', '2= ', '_', '_', 'F', 'd') +#define IMAGE_ID_STRING L"Vlv2Fd" + +// PcdSystemFmpCapsuleImageTypeIdGuid +#define IMAGE_TYPE_ID_GUID { 0x4096267b, 0xda0a, 0x42eb, = { 0xb5, 0xeb, 0xfe, 0xf3, 0x1d, 0x20, 0x7c, 0xb4 } } + +typedef struct { + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR Descriptor; + // real string data + CHAR16 ImageIdNameStr[sizeof(IMAGE_ID_S= TRING)/sizeof(CHAR16)]; + CHAR16 VersionNameStr[sizeof(CURRENT_FI= RMWARE_VERSION_STRING)/sizeof(CHAR16)]; + CHAR16 PackageVersionNameStr[sizeof(PAC= KAGE_VERSION_STRING)/sizeof(CHAR16)]; +} IMAGE_DESCRIPTOR; + +IMAGE_DESCRIPTOR mImageDescriptor =3D +{ + { + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE, + sizeof(EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR), + sizeof(IMAGE_DESCRIPTOR), + PACKAGE_VERSION, // PackageVersi= on + OFFSET_OF (IMAGE_DESCRIPTOR, PackageVersionNameStr), // PackageVersi= onName + 1, // ImageIndex; + {0x0}, // Reserved + IMAGE_TYPE_ID_GUID, // ImageTypeId; + IMAGE_ID, // ImageId; + OFFSET_OF (IMAGE_DESCRIPTOR, ImageIdNameStr), // ImageIdName; + CURRENT_FIRMWARE_VERSION, // Version; + OFFSET_OF (IMAGE_DESCRIPTOR, VersionNameStr), // VersionName; + {0x0}, // Reserved2 + FLASHAREASIZE, // Size; + IMAGE_ATTRIBUTE_IMAGE_UPDATABLE | + IMAGE_ATTRIBUTE_RESET_REQUIRED | + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED | + IMAGE_ATTRIBUTE_IN_USE, // AttributesSu= pported; + IMAGE_ATTRIBUTE_IMAGE_UPDATABLE | + IMAGE_ATTRIBUTE_RESET_REQUIRED | + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED | + IMAGE_ATTRIBUTE_IN_USE, // AttributesSe= tting; + 0x0, // Compatibilit= ies; + LOWEST_SUPPORTED_FIRMWARE_VERSION, // LowestSuppor= tedImageVersion; + 0x00000000, // LastAttemptV= ersion; + 0, // LastAttemptS= tatus; + {0x0}, // Reserved3 + 0, // HardwareInst= ance; + }, + // real string data + {IMAGE_ID_STRING}, + {CURRENT_FIRMWARE_VERSION_STRING}, + {PACKAGE_VERSION_STRING}, +}; + + +VOID* +ReferenceAcpiTable ( + VOID + ) +{ + // + // Reference the table being generated to prevent the optimizer from + // removing the data structure from the executable + // + return (VOID*)&mImageDescriptor; +} diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/Sys= temFirmwareDescriptor.inf b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwar= eDescriptor/SystemFirmwareDescriptor.inf new file mode 100644 index 0000000..3cae775 --- /dev/null +++ b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirm= wareDescriptor.inf @@ -0,0 +1,45 @@ +## @file +# System Firmware descriptor. +# +# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D SystemFirmwareDescriptor + FILE_GUID =3D A3E13E7F-9FD9-4057-84FA-37423C789612 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D SystemFirmwareDescriptorPeimEntry + +[Sources] + SystemFirmwareDescriptorPei.c + +[Packages] + MdePkg/MdePkg.dec + SignedCapsulePkg/SignedCapsulePkg.dec + Vlv2TbltDevicePkg/PlatformPkg.dec + +[Guids] + gEdkiiSystemFirmwareImageDescriptorFileGuid + +[LibraryClasses] + PcdLib + PeiServicesLib + DebugLib + PeimEntryPoint + +[Pcd] + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor + gPlatformModuleTokenSpaceGuid.PcdFlashAreaSize + +[Depex] + TRUE diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/Sys= temFirmwareDescriptorPei.c b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwa= reDescriptor/SystemFirmwareDescriptorPei.c new file mode 100644 index 0000000..792cbf8 --- /dev/null +++ b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirm= wareDescriptorPei.c @@ -0,0 +1,81 @@ +/** @file + System Firmware descriptor producer. + + Copyright (c) 2017, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ + +#include +#include +#include +#include +#include +#include + + + +/** + Entrypoint for SystemFirmwareDescriptor PEIM. + + @param[in] FileHandle Handle of the file being invoked. + @param[in] PeiServices Describes the list of possible PEI Services. + + @retval EFI_SUCCESS PPI successfully installed. +**/ +EFI_STATUS +EFIAPI +SystemFirmwareDescriptorPeimEntry ( + IN EFI_PEI_FILE_HANDLE PeiFileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR *Descriptor; + UINTN Size; + UINTN Index; + UINT32 AuthenticationStatus; + EFI_PEI_FV_HANDLE VolumeHandle; + EFI_PEI_FILE_HANDLE FileHandle; + + Index =3D 0; + while (TRUE) { + Status =3D PeiServicesFfsFindNextVolume (Index++, &VolumeHandle); + if (EFI_ERROR (Status)) { + return Status; + } + Status =3D PeiServicesFfsFindFileByName (&gEdkiiSystemFirmwareImageDes= criptorFileGuid, VolumeHandle, &FileHandle); + if (!EFI_ERROR (Status)) { + // + // Search RAW section. + // + Index =3D 0; + while (TRUE) { + Status =3D PeiServicesFfsFindSectionData3(EFI_SECTION_RAW, Index++= , FileHandle, (VOID **)&Descriptor, &AuthenticationStatus); + if (EFI_ERROR(Status)) { + // Should not happen, must something wrong in FDF. + ASSERT(FALSE); + return EFI_NOT_FOUND; + } + if (Descriptor->Signature =3D=3D EDKII_SYSTEM_FIRMWARE_IMAGE_DESCR= IPTOR_SIGNATURE) { + break; + } + } + break; + } + } + + DEBUG((DEBUG_INFO, "EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR size - 0x%x\n= ", Descriptor->Length)); + + Size =3D Descriptor->Length; + PcdSetPtrS (PcdEdkiiSystemFirmwareImageDescriptor, &Size, Descriptor); + + + return EFI_SUCCESS; +} diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/Sys= temFirmwareDescriptorTable.inf b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFi= rmwareDescriptor/SystemFirmwareDescriptorTable.inf new file mode 100644 index 0000000..5f491ef --- /dev/null +++ b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirm= wareDescriptorTable.inf @@ -0,0 +1,28 @@ +## @file +# System Firmware descriptor. +# +# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +# +## + +[Defines] + INF_VERSION =3D 0x00010017 + BASE_NAME =3D SystemFirmwareDescriptorTable + FILE_GUID =3D 90B2B846-CA6D-4D6E-A8D3-C140A8E110AC + MODULE_TYPE =3D USER_DEFINED + VERSION_STRING =3D 1.0 + +[Binaries] + BIN|SystemFirmwareDescriptor.acpi + +[Packages] + MdeModulePkg/MdeModulePkg.dec + SignedCapsulePkg/SignedCapsulePkg.dec + diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareUpdateConfig/S= ystemFirmwareUpdateConfig.ini b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFir= mwareUpdateConfig/SystemFirmwareUpdateConfig.ini new file mode 100644 index 0000000..c30eff1 --- /dev/null +++ b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareUpdateConfig/SystemFi= rmwareUpdateConfig.ini @@ -0,0 +1,67 @@ +## @file +# +# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +# +## + +[Head] +NumOfUpdate =3D 1 +NumOfRecovery =3D 1 +Update0 =3D Vlv2FvMain +Recovery0 =3D Vlv2FvMain + +[Vlv2FvMicrocode] +FirmwareType =3D 0 # SystemFirmware +AddressType =3D 0 # 0 - relative address, 1 - absolute address. +BaseAddress =3D 0x00000000 # Base address offset on flash +Length =3D 0x00040000 # Length +ImageOffset =3D 0x00000000 # Image offset of this SystemFirmware image +FileGuid =3D 14D83A59-A810-4556-8192-1C0A593C065C # PcdEdkiiSystemFirm= wareFileGuid + +[Vlv2FvNvRam] +FirmwareType =3D 1 # NvRam +AddressType =3D 0 # 0 - relative address, 1 - absolute address. +BaseAddress =3D 0x00040000 # Base address offset on flash +Length =3D 0x00080000 # Length +ImageOffset =3D 0x00040000 # Image offset of this SystemFirmware image +FileGuid =3D 14D83A59-A810-4556-8192-1C0A593C065C # PcdEdkiiSystemFirm= wareFileGuid + +[Vlv2FvBinary] +FirmwareType =3D 0 # SystemFirmware +AddressType =3D 0 # 0 - relative address, 1 - absolute address. +BaseAddress =3D 0x000C0000 # Base address offset on flash +Length =3D 0x00050000 # Length +ImageOffset =3D 0x000C0000 # Image offset of this SystemFirmware image +FileGuid =3D 14D83A59-A810-4556-8192-1C0A593C065C # PcdEdkiiSystemFirm= wareFileGuid + +[Vlv2FvMain] +FirmwareType =3D 0 # SystemFirmware +AddressType =3D 0 # 0 - relative address, 1 - absolute address. +BaseAddress =3D 0x00510000 # Base address offset on flash +Length =3D 0x00210000 # Length +ImageOffset =3D 0x00110000 # Image offset of this SystemFirmware image +FileGuid =3D 14D83A59-A810-4556-8192-1C0A593C065C # PcdEdkiiSystemFirm= wareFileGuid + +[Vlv2FvRecovery2] +FirmwareType =3D 0 # SystemFirmware +AddressType =3D 0 # 0 - relative address, 1 - absolute address. +BaseAddress =3D 0x00320000 # Base address offset on flash +Length =3D 0x00070000 # Length +ImageOffset =3D 0x00320000 # Image offset of this SystemFirmware image +FileGuid =3D 14D83A59-A810-4556-8192-1C0A593C065C # PcdEdkiiSystemFirm= wareFileGuid + +[Vlv2FvRecovery] +FirmwareType =3D 0 # SystemFirmware +AddressType =3D 0 # 0 - relative address, 1 - absolute address. +BaseAddress =3D 0x00390000 # Base address offset on flash +Length =3D 0x00070000 # Length +ImageOffset =3D 0x00390000 # Image offset of this SystemFirmware image +FileGuid =3D 14D83A59-A810-4556-8192-1C0A593C065C # PcdEdkiiSystemFirm= wareFileGuid + diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c b/Vlv2T= bltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c index 2e13a01..e9c3565 100644 --- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c +++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c @@ -1630,7 +1630,7 @@ EFIAPI PlatformBdsPolicyBehavior ( IN OUT LIST_ENTRY *DriverOptionList, IN OUT LIST_ENTRY *BootOptionList, - IN PROCESS_CAPSULES ProcessCapsules, + IN PROCESS_CAPSULES BdsProcessCapsules, IN BASEM_MEMORY_TEST BaseMemoryTest ) { @@ -1965,13 +1965,17 @@ PlatformBdsPolicyBehavior ( PcdSetBool(PcdEsrtSyncFmp, FALSE); } =20 + DEBUG((EFI_D_INFO, "ProcessCapsules Before EndOfDxe ......\n")); + Status =3D ProcessCapsules (); + DEBUG((EFI_D_INFO, "ProcessCapsules %r\n", Status)); + + // // Close boot script and install ready to lock // InstallReadyToLock (); =20 =20 - PlatformBootManagerProcessCapsules(); =20 =20 PlatformBdsLockNonUpdatableFlash (); diff --git a/Vlv2TbltDevicePkg/PlatformPkg.dec b/Vlv2TbltDevicePkg/Platform= Pkg.dec index 015a630..7002fdc 100644 --- a/Vlv2TbltDevicePkg/PlatformPkg.dec +++ b/Vlv2TbltDevicePkg/PlatformPkg.dec @@ -2,7 +2,7 @@ # Platform Package # # This package provides platform specific modules. -# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
# = =20 # This program and the accompanying materials are licensed and made availa= ble under # the terms and conditions of the BSD License that accompanies this distri= bution. =20 @@ -160,6 +160,28 @@ gPlatformModuleTokenSpaceGuid.PcdBiosRomSize|0x00400000|UINT32|0x4000000C gPlatformModuleTokenSpaceGuid.PcdFlashMinEraseSize|0x1000|UINT32|0x70000= 007 =20 +[PcdsPatchableInModule] + ## Provides the memory mapped base address of the BIOS Image Area. This= area + # must be within the memory mapped region defined by the BIOS Flash Dev= ice + # Base Address and the BIOS Flash Device Size.

+ # The address must be within the BIOS Flash Device address space.
+ # + # @Prompt BIOS Image Area Base Address + # + # @Expression 0x80000011 | gPlatformModuleTokenSpaceGuid.PcdBiosImageBas= e >=3D gPlatformModuleTokenSpaceGuid.PcdFlashAreaBaseAddress + #=20 + gPlatformModuleTokenSpaceGuid.PcdBiosImageBase|0xFF800000|UINT32|0x20000= 050 + ## Provides the size of the BIOS Image Area.

+ # Valid size values must not exceed the BIOS Flash Device address space= .
+ # + # @Prompt BIOS Image Area Size + # + # @Expression 0x80000012 | gPlatformModuleTokenSpaceGuid.PcdBiosImageSiz= e <=3D gPlatformModuleTokenSpaceGuid.PcdFlashAreaSize + # + gPlatformModuleTokenSpaceGuid.PcdBiosImageSize|0x800000|UINT32|0x20000051 + =20 + + =20 [PcdsFeatureFlag] ## This PCD specifies whether StatusCode is reported via ISA Serial port. gEfiSerialPortTokenSpaceGuid.PcdStatusCodeUseIsaSerial|TRUE|BOOLEAN|0x00= 000020 diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf b/Vlv2TbltDevicePkg/Platform= Pkg.fdf index 9af2f77..e767cb5 100644 --- a/Vlv2TbltDevicePkg/PlatformPkg.fdf +++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf @@ -333,6 +333,10 @@ INF IntelFspWrapperPkg/FspWrapperSecCore/FspWrapperSec= Core.inf INF RuleOverride =3D BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)= $(TARGET)/IA32/SecCore.inf !endif =20 +!if $(CAPSULE_GENERATE_ENABLE) +INF Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmw= areDescriptor.inf +INF USE=3DIA32 Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/= SystemFirmwareDescriptorTable.inf +!endif INF MdeModulePkg/Core/Pei/PeiMain.inf !if $(MINNOW2_FSP_BUILD) =3D=3D TRUE INF Vlv2TbltDevicePkg/FspSupport/BootModePei/BootModePei.inf @@ -742,10 +746,14 @@ FILE FREEFORM =3D 878AC2CC-5343-46F2-B563-51F89DAF56B= A { !endif !endif =20 -!if $(ESRT_ENABLE) =3D=3D TRUE - INF MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf - INF $(PLATFORM_PACKAGE)/PlatformEsrt/PlatformEsrtDxe.inf - INF $(PLATFORM_PACKAGE)/FmpSample/FmpSample.inf +!if $(CAPSULE_GENERATE_ENABLE) +INF MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf +INF SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportD= xe.inf + +FILE FREEFORM =3D PCD(gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiRsa2048Sh= a256TestPublicKeyFileGuid) { + SECTION RAW =3D BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigning= PublicKey.bin + SECTION UI =3D "Rsa2048Sha256TestSigningPublicKey" + } !endif =20 [FV.FVMAIN_COMPACT] @@ -889,31 +897,75 @@ FILE FV_IMAGE =3D EDBEDF47-6EA3-4512-83C1-70F4769D4BD= E { } } =20 -[Capsule.Capsule_Boot] -!if $(ESRT_ENABLE) =3D=3D TRUE -CAPSULE_GUID =3D 819b858e-c52c-402f-80e1-5b311b6c1959 -!else -CAPSULE_GUID =3D 3B6686BD-0D76-4030-B70E-B5519E2FC5A0=20 -!endif +!if $(CAPSULE_GENERATE_ENABLE) +[FV.CapsuleDispatchFv] +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + +INF SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateD= xe.inf + +[FV.SystemFirmwareUpdateCargo] +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE =20 -CAPSULE_FLAGS =3D PersistAcrossReset, InitiateReset -OEM_CAPSULE_FLAGS =3D 0x0001 +FILE RAW =3D 14D83A59-A810-4556-8192-1C0A593C065C { # PcdEdkiiSystemFirmwa= reFileGuid + FD =3D Vlv + } =20 -CAPSULE_HEADER_SIZE =3D 0x20 +FILE RAW =3D ce57b167-b0e4-41e8-a897-5f4feb781d40 { # gEdkiiSystemFmpCapsu= leDriverFvFileGuid + FV =3D CapsuleDispatchFv + } =20 -FV =3D BiosUpdate +FILE RAW =3D 812136D3-4D3A-433A-9418-29BB9BF78F6E { # gEdkiiSystemFmpCapsu= leConfigFileGuid + Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareUpdateConfig/SystemFir= mwareUpdateConfig.ini + } =20 -[Capsule.Capsule_Reset] -!if $(ESRT_ENABLE) =3D=3D TRUE -CAPSULE_GUID =3D 819b858e-c52c-402f-80e1-5b311b6c1959 -!else -CAPSULE_GUID =3D 3B6686BD-0D76-4030-B70E-B5519E2FC5A0=20 -!endif +[FmpPayload.FmpPayloadSystemFirmwareRsa2048] +IMAGE_HEADER_INIT_VERSION =3D 0x02 +IMAGE_TYPE_ID =3D 4096267b-da0a-42eb-b5eb-fef31d207cb4 # PcdSy= stemFmpCapsuleImageTypeIdGuid +IMAGE_INDEX =3D 0x1 +HARDWARE_INSTANCE =3D 0x0 +MONOTONIC_COUNT =3D 0x2 +CERTIFICATE_GUID =3D A7717414-C616-4977-9420-844712A735BF # RSA20= 48SHA256 =20 -CAPSULE_FLAGS =3D PersistAcrossReset -CAPSULE_HEADER_SIZE =3D 0x20 +FV =3D SystemFirmwareUpdateCargo =20 -FV =3D BiosUpdate +[Capsule.FVMAIN] +CAPSULE_GUID =3D 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # gEf= iFmpCapsuleGuid +CAPSULE_FLAGS =3D PersistAcrossReset,InitiateReset +CAPSULE_HEADER_SIZE =3D 0x20 +CAPSULE_HEADER_INIT_VERSION =3D 0x1 + +FMP_PAYLOAD =3D FmpPayloadSystemFirmwareRsa2048 +!endif =20 ##########################################################################= ###### # @@ -1144,3 +1196,19 @@ FV =3D BiosUpdate RAW ASL Optional |.aml } =20 +[Rule.Common.PEIM.FMP_IMAGE_DESC] + + FILE PEIM =3D $(NAMED_GUID) { + RAW BIN |.acpi + + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.USER_DEFINED.BINARY] + FILE FREEFORM =3D $(NAMED_GUID) { + UI STRING=3D"$(MODULE_NAME)" Optional + RAW BIN |.bin + } \ No newline at end of file diff --git a/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc b/Vlv2TbltDevicePkg/Pl= atformPkgConfig.dsc index f595ee9..f172f8f 100644 --- a/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc +++ b/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc @@ -93,3 +93,4 @@ DEFINE ESRT_ENABLE =3D TRUE # DEFINE SOURCE_DEBUG_ENABLE =3D FALSE =20 +DEFINE CAPSULE_GENERATE_ENABLE =3D FALSE diff --git a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf b/Vlv2TbltDevicePkg/Platf= ormPkgGcc.fdf index e450edc..5916503 100644 --- a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf +++ b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf @@ -290,6 +290,10 @@ INF IntelFspWrapperPkg/FspWrapperSecCore/FspWrapperSec= Core.inf INF RuleOverride =3D BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)= $(TARGET)/IA32/SecCore.inf !endif =20 +!if $(CAPSULE_GENERATE_ENABLE) +INF Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmw= areDescriptor.inf +INF USE=3DIA32 Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/= SystemFirmwareDescriptorTable.inf +!endif INF MdeModulePkg/Core/Pei/PeiMain.inf !if $(MINNOW2_FSP_BUILD) =3D=3D TRUE INF Vlv2TbltDevicePkg/FspSupport/BootModePei/BootModePei.inf @@ -695,10 +699,14 @@ FILE FREEFORM =3D 878AC2CC-5343-46F2-B563-51F89DAF56B= A { !endif !endif =20 -!if $(ESRT_ENABLE) =3D=3D TRUE - INF MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf - INF $(PLATFORM_PACKAGE)/PlatformEsrt/PlatformEsrtDxe.inf - INF $(PLATFORM_PACKAGE)/FmpSample/FmpSample.inf +!if $(CAPSULE_GENERATE_ENABLE) +INF MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf +INF SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportD= xe.inf + +FILE FREEFORM =3D PCD(gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiRsa2048Sh= a256TestPublicKeyFileGuid) { + SECTION RAW =3D BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigning= PublicKey.bin + SECTION UI =3D "Rsa2048Sha256TestSigningPublicKey" + } !endif =20 [FV.FVMAIN_COMPACT] @@ -844,31 +852,75 @@ FILE FV_IMAGE =3D EDBEDF47-6EA3-4512-83C1-70F4769D4BD= E { } } =20 -[Capsule.Capsule_Boot] -!if $(ESRT_ENABLE) =3D=3D TRUE -CAPSULE_GUID =3D 819b858e-c52c-402f-80e1-5b311b6c1959 -!else -CAPSULE_GUID =3D 3B6686BD-0D76-4030-B70E-B5519E2FC5A0=20 -!endif +!if $(CAPSULE_GENERATE_ENABLE) +[FV.CapsuleDispatchFv] +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + +INF SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateD= xe.inf + +[FV.SystemFirmwareUpdateCargo] +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE =20 -CAPSULE_FLAGS =3D PersistAcrossReset, InitiateReset -OEM_CAPSULE_FLAGS =3D 0x0001 +FILE RAW =3D 14D83A59-A810-4556-8192-1C0A593C065C { # PcdEdkiiSystemFirmwa= reFileGuid + FD =3D Vlv + } =20 -CAPSULE_HEADER_SIZE =3D 0x20 +FILE RAW =3D ce57b167-b0e4-41e8-a897-5f4feb781d40 { # gEdkiiSystemFmpCapsu= leDriverFvFileGuid + FV =3D CapsuleDispatchFv + } =20 -FV =3D BiosUpdate +FILE RAW =3D 812136D3-4D3A-433A-9418-29BB9BF78F6E { # gEdkiiSystemFmpCapsu= leConfigFileGuid + Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareUpdateConfig/SystemFir= mwareUpdateConfig.ini + } =20 -[Capsule.Capsule_Reset] -!if $(ESRT_ENABLE) =3D=3D TRUE -CAPSULE_GUID =3D 819b858e-c52c-402f-80e1-5b311b6c1959 -!else -CAPSULE_GUID =3D 3B6686BD-0D76-4030-B70E-B5519E2FC5A0=20 -!endif +[FmpPayload.FmpPayloadSystemFirmwareRsa2048] +IMAGE_HEADER_INIT_VERSION =3D 0x02 +IMAGE_TYPE_ID =3D 4096267b-da0a-42eb-b5eb-fef31d207cb4 # PcdSy= stemFmpCapsuleImageTypeIdGuid +IMAGE_INDEX =3D 0x1 +HARDWARE_INSTANCE =3D 0x0 +MONOTONIC_COUNT =3D 0x2 +CERTIFICATE_GUID =3D A7717414-C616-4977-9420-844712A735BF # RSA20= 48SHA256 =20 -CAPSULE_FLAGS =3D PersistAcrossReset -CAPSULE_HEADER_SIZE =3D 0x20 +FV =3D SystemFirmwareUpdateCargo =20 -FV =3D BiosUpdate +[Capsule.FVMAIN] +CAPSULE_GUID =3D 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # gEf= iFmpCapsuleGuid +CAPSULE_FLAGS =3D PersistAcrossReset,InitiateReset +CAPSULE_HEADER_SIZE =3D 0x20 +CAPSULE_HEADER_INIT_VERSION =3D 0x1 + +FMP_PAYLOAD =3D FmpPayloadSystemFirmwareRsa2048 +!endif =20 ##########################################################################= ###### # @@ -1103,3 +1155,19 @@ FV =3D BiosUpdate RAW ASL Optional |.aml } =20 +[Rule.Common.PEIM.FMP_IMAGE_DESC] + + FILE PEIM =3D $(NAMED_GUID) { + RAW BIN |.acpi + + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.USER_DEFINED.BINARY] + FILE FREEFORM =3D $(NAMED_GUID) { + UI STRING=3D"$(MODULE_NAME)" Optional + RAW BIN |.bin + } \ No newline at end of file diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc b/Vlv2TbltDevicePkg/Pl= atformPkgGccX64.dsc index c8229df..98d510a 100644 --- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc +++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc @@ -185,10 +185,18 @@ =20 OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf =20 -!if $(ESRT_ENABLE) =3D=3D TRUE - CapsuleLib|$(PLATFORM_PACKAGE)/Library/DxeEsrtCapsuleBsLib/DxeEsrtCapsul= eBsLib.inf +!if $(CAPSULE_ENABLE) =3D=3D TRUE + CapsuleLib|IntelFrameworkModulePkg/Library/DxeCapsuleLib/DxeCapsuleLib.inf !else - CapsuleLib|IntelFrameworkModulePkg/Library/DxeCapsuleLib/DxeCapsuleLib.i= nf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf +!endif + +!if $(CAPSULE_GENERATE_ENABLE) + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf + EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/Edk= iiSystemCapsuleLib.inf + FmpAuthenticationLib|MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAu= thenticationLibNull.inf + IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf + PlatformFlashAccessLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/Platfor= mFlashAccessLib/PlatformFlashAccessLib.inf !endif =20 UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf @@ -462,6 +470,10 @@ DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf !endif =20 +!if $(CAPSULE_GENERATE_ENABLE) + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf +!endif + [LibraryClasses.common.UEFI_DRIVER] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf =20 @@ -916,8 +928,23 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSystemRebootAfterCap= suleProcessFlag|0x0001 gEfiVLVTokenSpaceGuid.PcdCpuLockBoxSize|0 gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE =20 +!if $(CAPSULE_GENERATE_ENABLE) + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor= |{0x0}|VOID*|0x100 + gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{0x7b,= 0x26, 0x96, 0x40, 0x0a, 0xda, 0xeb, 0x42, 0xb5, 0xeb, 0xfe, 0xf3, 0x1d, 0x= 20, 0x7c, 0xb4} + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{0x59,= 0x3A, 0xD8, 0x14, 0x10, 0xA8, 0x56, 0x45, 0x81, 0x92, 0x1C, 0x0A, 0x59, 0x= 3C, 0x06, 0x5C} +!endif + =20 + =20 [Components.IA32] =20 +!if $(CAPSULE_GENERATE_ENABLE) + # FMP image decriptor + Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptor.inf { + + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + } +!endif + $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/SecCore.inf =20 !if $(MINNOW2_FSP_BUILD) =3D=3D TRUE @@ -1217,11 +1244,36 @@ $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TAR= GET)/IA32/fTPMInitPeim.inf !endif MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf { - !if $(ESRT_ENABLE) =3D=3D TRUE - CapsuleLib|$(PLATFORM_PACKAGE)/Library/DxeEsrtCapsuleRtLib/DxeEsrtCa= psuleRtLib.inf -!endif + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf } =20 +!if $(CAPSULE_GENERATE_ENABLE) + MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf + + SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.= inf { + + FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibRsa2048= Sha256/FmpAuthenticationLibRsa2048Sha256.inf + !if $(TARGET) !=3D RELEASE + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPor= t.inf + !endif + } + + SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.= inf { + + FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibRsa2048= Sha256/FmpAuthenticationLibRsa2048Sha256.inf + !if $(TARGET) !=3D RELEASE + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPor= t.inf + !endif + } + + MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + } +!endif + =20 + + =20 MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf @@ -1572,7 +1624,6 @@ IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVo= lDxe/FwVolDxe.inf !endif MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf !if $(ESRT_ENABLE) =3D=3D TRUE - MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf $(PLATFORM_PACKAGE)/PlatformEsrt/PlatformEsrtDxe.inf $(PLATFORM_PACKAGE)/FmpSample/FmpSample.inf !endif diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Vlv2TbltDevicePkg/Plat= formPkgIA32.dsc index cb2efe2..a1c2540 100644 --- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc +++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc @@ -185,10 +185,18 @@ =20 OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf =20 -!if $(ESRT_ENABLE) =3D=3D TRUE - CapsuleLib|$(PLATFORM_PACKAGE)/Library/DxeEsrtCapsuleBsLib/DxeEsrtCapsul= eBsLib.inf +!if $(CAPSULE_ENABLE) =3D=3D TRUE + CapsuleLib|IntelFrameworkModulePkg/Library/DxeCapsuleLib/DxeCapsuleLib.inf !else - CapsuleLib|IntelFrameworkModulePkg/Library/DxeCapsuleLib/DxeCapsuleLib.i= nf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf +!endif + +!if $(CAPSULE_GENERATE_ENABLE) + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf + EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/Edk= iiSystemCapsuleLib.inf + FmpAuthenticationLib|MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAu= thenticationLibNull.inf + IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf + PlatformFlashAccessLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/Platfor= mFlashAccessLib/PlatformFlashAccessLib.inf !endif =20 UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf @@ -462,6 +470,9 @@ DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf !endif =20 +!if $(CAPSULE_GENERATE_ENABLE) + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf +!endif [LibraryClasses.common.UEFI_DRIVER] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf =20 @@ -918,8 +929,23 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSystemRebootAfterCap= suleProcessFlag|0x0001 gEfiVLVTokenSpaceGuid.PcdCpuLockBoxSize|0 gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE =20 +!if $(CAPSULE_GENERATE_ENABLE) + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor= |{0x0}|VOID*|0x100 + gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{0x7b,= 0x26, 0x96, 0x40, 0x0a, 0xda, 0xeb, 0x42, 0xb5, 0xeb, 0xfe, 0xf3, 0x1d, 0x= 20, 0x7c, 0xb4} + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{0x59,= 0x3A, 0xD8, 0x14, 0x10, 0xA8, 0x56, 0x45, 0x81, 0x92, 0x1C, 0x0A, 0x59, 0x= 3C, 0x06, 0x5C} +!endif + =20 + =20 [Components.IA32] =20 +!if $(CAPSULE_GENERATE_ENABLE) + # FMP image decriptor + Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptor.inf { + + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + } +!endif + $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/SecCore.inf =20 !if $(MINNOW2_FSP_BUILD) =3D=3D TRUE @@ -1214,11 +1240,37 @@ $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TAR= GET)/IA32/fTPMInitPeim.inf !endif MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf { - !if $(ESRT_ENABLE) =3D=3D TRUE - CapsuleLib|$(PLATFORM_PACKAGE)/Library/DxeEsrtCapsuleRtLib/DxeEsrtCa= psuleRtLib.inf -!endif + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf } =20 +!if $(CAPSULE_GENERATE_ENABLE) + MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf + + SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.= inf { + + FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibRsa2048= Sha256/FmpAuthenticationLibRsa2048Sha256.inf + !if $(TARGET) !=3D RELEASE + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPor= t.inf + !endif + } + + SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.= inf { + + + FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibRsa2048= Sha256/FmpAuthenticationLibRsa2048Sha256.inf + + !if $(TARGET) !=3D RELEASE + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPor= t.inf + !endif + } + + MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + } +!endif + =20 + =20 MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf @@ -1575,7 +1627,6 @@ IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVo= lDxe/FwVolDxe.inf !endif MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf !if $(ESRT_ENABLE) =3D=3D TRUE - MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf $(PLATFORM_PACKAGE)/PlatformEsrt/PlatformEsrtDxe.inf $(PLATFORM_PACKAGE)/FmpSample/FmpSample.inf !endif diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Vlv2TbltDevicePkg/Platf= ormPkgX64.dsc index e37f73d..07c007f 100644 --- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc +++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc @@ -185,10 +185,18 @@ =20 OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf =20 -!if $(ESRT_ENABLE) =3D=3D TRUE - CapsuleLib|$(PLATFORM_PACKAGE)/Library/DxeEsrtCapsuleBsLib/DxeEsrtCapsul= eBsLib.inf +!if $(CAPSULE_ENABLE) =3D=3D TRUE + CapsuleLib|IntelFrameworkModulePkg/Library/DxeCapsuleLib/DxeCapsuleLib.inf !else - CapsuleLib|IntelFrameworkModulePkg/Library/DxeCapsuleLib/DxeCapsuleLib.i= nf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf +!endif + +!if $(CAPSULE_GENERATE_ENABLE) + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf + EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/Edk= iiSystemCapsuleLib.inf + FmpAuthenticationLib|MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAu= thenticationLibNull.inf + IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf + PlatformFlashAccessLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/Platfor= mFlashAccessLib/PlatformFlashAccessLib.inf !endif =20 UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf @@ -462,6 +470,10 @@ DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf !endif =20 +!if $(CAPSULE_GENERATE_ENABLE) + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf +!endif + [LibraryClasses.common.UEFI_DRIVER] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf =20 @@ -918,8 +930,23 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSystemRebootAfterCap= suleProcessFlag|0x0001 gEfiVLVTokenSpaceGuid.PcdCpuLockBoxSize|0 gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE =20 +!if $(CAPSULE_GENERATE_ENABLE) + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor= |{0x0}|VOID*|0x100 + gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{0x7b,= 0x26, 0x96, 0x40, 0x0a, 0xda, 0xeb, 0x42, 0xb5, 0xeb, 0xfe, 0xf3, 0x1d, 0x= 20, 0x7c, 0xb4} + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{0x59,= 0x3A, 0xD8, 0x14, 0x10, 0xA8, 0x56, 0x45, 0x81, 0x92, 0x1C, 0x0A, 0x59, 0x= 3C, 0x06, 0x5C} +!endif + =20 + =20 [Components.IA32] =20 +!if $(CAPSULE_GENERATE_ENABLE) + # FMP image decriptor + Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptor.inf { + + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + } +!endif + $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/SecCore.inf =20 !if $(MINNOW2_FSP_BUILD) =3D=3D TRUE @@ -1215,11 +1242,35 @@ $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TAR= GET)/IA32/fTPMInitPeim.inf !endif MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf { - !if $(ESRT_ENABLE) =3D=3D TRUE - CapsuleLib|$(PLATFORM_PACKAGE)/Library/DxeEsrtCapsuleRtLib/DxeEsrtCa= psuleRtLib.inf - !endif + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + } + +!if $(CAPSULE_GENERATE_ENABLE) + MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf + + SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.= inf { + + FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibRsa2048= Sha256/FmpAuthenticationLibRsa2048Sha256.inf + !if $(TARGET) !=3D RELEASE + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPor= t.inf + !endif + } + + SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.= inf { + + FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibRsa2048= Sha256/FmpAuthenticationLibRsa2048Sha256.inf + !if $(TARGET) !=3D RELEASE + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPor= t.inf + !endif } =20 + MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf { + + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + } +!endif + =20 + =20 MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf @@ -1577,7 +1628,6 @@ IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVo= lDxe/FwVolDxe.inf !endif MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf !if $(ESRT_ENABLE) =3D=3D TRUE - MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf $(PLATFORM_PACKAGE)/PlatformEsrt/PlatformEsrtDxe.inf $(PLATFORM_PACKAGE)/FmpSample/FmpSample.inf !endif --=20 2.10.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel