]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.c
Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Capsule Descriptor.
[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 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include <PiPei.h>
16 #include <Library/PcdLib.h>
17 #include <Library/PeiServicesLib.h>
18 #include <Library/DebugLib.h>
19 #include <Protocol/FirmwareManagement.h>
20 #include <Guid/EdkiiSystemFmpCapsule.h>
21
22 /**
23 Entrypoint for SystemFirmwareDescriptor PEIM.
24
25 @param[in] FileHandle Handle of the file being invoked.
26 @param[in] PeiServices Describes the list of possible PEI Services.
27
28 @retval EFI_SUCCESS PPI successfully installed.
29 **/
30 EFI_STATUS
31 EFIAPI
32 SystemFirmwareDescriptorPeimEntry (
33 IN EFI_PEI_FILE_HANDLE FileHandle,
34 IN CONST EFI_PEI_SERVICES **PeiServices
35 )
36 {
37 EFI_STATUS Status;
38 EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR *Descriptor;
39 UINTN Size;
40 UINTN Index;
41 UINT32 AuthenticationStatus;
42
43 //
44 // Search RAW section.
45 //
46 Index = 0;
47 while (TRUE) {
48 Status = PeiServicesFfsFindSectionData3(EFI_SECTION_RAW, Index, FileHandle, (VOID **)&Descriptor, &AuthenticationStatus);
49 if (EFI_ERROR(Status)) {
50 // Should not happen, must something wrong in FDF.
51 ASSERT(FALSE);
52 return EFI_NOT_FOUND;
53 }
54 if (Descriptor->Signature == EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE) {
55 break;
56 }
57 Index++;
58 }
59
60 DEBUG((DEBUG_INFO, "EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR size - 0x%x\n", Descriptor->Length));
61
62 Size = Descriptor->Length;
63 PcdSetPtrS (PcdEdkiiSystemFirmwareImageDescriptor, &Size, Descriptor);
64
65 return EFI_SUCCESS;
66 }