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