]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.c
d21ee5218475ebf386aeb0053f372b528adb4300
[mirror_edk2.git] / Vlv2TbltDevicePkg / Feature / Capsule / SystemFirmwareDescriptor / SystemFirmwareDescriptorPei.c
1 /** @file
2 System Firmware descriptor producer.
3
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <PiPei.h>
10 #include <Library/PcdLib.h>
11 #include <Library/PeiServicesLib.h>
12 #include <Library/DebugLib.h>
13 #include <Protocol/FirmwareManagement.h>
14 #include <Guid/EdkiiSystemFmpCapsule.h>
15
16 /**
17 Entrypoint for SystemFirmwareDescriptor PEIM.
18
19 @param[in] FileHandle Handle of the file being invoked.
20 @param[in] PeiServices Describes the list of possible PEI Services.
21
22 @retval EFI_SUCCESS PPI successfully installed.
23 **/
24 EFI_STATUS
25 EFIAPI
26 SystemFirmwareDescriptorPeimEntry (
27 IN EFI_PEI_FILE_HANDLE FileHandle,
28 IN CONST EFI_PEI_SERVICES **PeiServices
29 )
30 {
31 EFI_STATUS Status;
32 EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR *Descriptor;
33 UINTN Size;
34 UINTN Index;
35 UINT32 AuthenticationStatus;
36
37 //
38 // Search RAW section.
39 //
40 Index = 0;
41 while (TRUE) {
42 Status = PeiServicesFfsFindSectionData3(EFI_SECTION_RAW, Index, FileHandle, (VOID **)&Descriptor, &AuthenticationStatus);
43 if (EFI_ERROR(Status)) {
44 // Should not happen, must something wrong in FDF.
45 ASSERT(FALSE);
46 return EFI_NOT_FOUND;
47 }
48 if (Descriptor->Signature == EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE) {
49 break;
50 }
51 Index++;
52 }
53
54 DEBUG((DEBUG_INFO, "EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR size - 0x%x\n", Descriptor->Length));
55
56 Size = Descriptor->Length;
57 PcdSetPtrS (PcdEdkiiSystemFirmwareImageDescriptor, &Size, Descriptor);
58
59 return EFI_SUCCESS;
60 }