]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/FCE/BinaryCreate.h
BaseTools/FCE: Add a tool FCE
[mirror_edk2.git] / BaseTools / Source / C / FCE / BinaryCreate.h
1 /** @file
2
3 The API to create the binary.
4
5 Copyright (c) 2011-2019, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef _BINARY_CREATE_H_
11 #define _BINARY_CREATE_H_ 1
12
13 #include <FvLib.h>
14 #include "Compress.h"
15 #include "Decompress.h"
16 #include "CommonLib.h"
17 #include "EfiUtilityMsgs.h"
18 #include "FirmwareVolumeBufferLib.h"
19 #include "OsPath.h"
20 #include "ParseGuidedSectionTools.h"
21 #include "StringFuncs.h"
22 #include "ParseInf.h"
23 #include <Common/UefiBaseTypes.h>
24 #include <Common/UefiInternalFormRepresentation.h>
25 #include <Common/UefiCapsule.h>
26 #include <Common/PiFirmwareFile.h>
27 #include <Common/PiFirmwareVolume.h>
28 #include <Guid/PiFirmwareFileSystem.h>
29 #include <IndustryStandard/PeImage.h>
30 #include <Protocol/GuidedSectionExtraction.h>
31
32 //1AE42876-008F-4161-B2B7-1C0D15C5EF43
33 #define EFI_FFS_BFV_FOR_MULTIPLATFORM_GUID \
34 { 0x1ae42876, 0x008f, 0x4161, { 0xb2, 0xb7, 0x1c, 0xd, 0x15, 0xc5, 0xef, 0x43 }}
35
36 extern EFI_GUID gEfiFfsBfvForMultiPlatformGuid;
37
38 // {003E7B41-98A2-4BE2-B27A-6C30C7655225}
39 #define EFI_FFS_BFV_FOR_MULTIPLATFORM_GUID2 \
40 { 0x3e7b41, 0x98a2, 0x4be2, { 0xb2, 0x7a, 0x6c, 0x30, 0xc7, 0x65, 0x52, 0x25 }}
41
42 extern EFI_GUID gEfiFfsBfvForMultiPlatformGuid2;
43
44 typedef UINT64 SKU_ID;
45
46 typedef struct {
47 UINT32 Offset:24;
48 UINT32 Value:8;
49 } PCD_DATA_DELTA;
50
51 typedef struct {
52 SKU_ID SkuId;
53 UINT16 DefaultId;
54 UINT8 Reserved[6];
55 } PCD_DEFAULT_INFO;
56
57 typedef struct {
58 //
59 // Full size, it must be at 8 byte alignment.
60 //
61 UINT32 DataSize;
62 //
63 // HeaderSize includes HeaderSize fields and DefaultInfo arrays
64 //
65 UINT32 HeaderSize;
66 //
67 // DefaultInfo arrays those have the same default setting.
68 //
69 PCD_DEFAULT_INFO DefaultInfo[1];
70 //
71 // Default data is stored as variable storage or the array of DATA_DELTA.
72 //
73 } PCD_DEFAULT_DATA;
74
75 #define PCD_NV_STORE_DEFAULT_BUFFER_SIGNATURE SIGNATURE_32('N', 'S', 'D', 'B')
76
77 typedef struct {
78 //
79 // PCD_NV_STORE_DEFAULT_BUFFER_SIGNATURE
80 //
81 UINT32 Signature;
82 //
83 // Length of the taken default buffer
84 //
85 UINT32 Length;
86 //
87 // Length of the total reserved buffer
88 //
89 UINT32 MaxLength;
90 //
91 // Reserved for 8 byte alignment
92 //
93 UINT32 Reserved;
94 // one or more PCD_DEFAULT_DATA
95 } PCD_NV_STORE_DEFAULT_BUFFER_HEADER;
96
97 //
98 // NvStoreDefaultValueBuffer layout:
99 // +-------------------------------------+
100 // | PCD_NV_STORE_DEFAULT_BUFFER_HEADER |
101 // +-------------------------------------+
102 // | PCD_DEFAULT_DATA (DEFAULT, Standard)|
103 // +-------------------------------------+
104 // | PCD_DATA_DELTA (DEFAULT, Standard)|
105 // +-------------------------------------+
106 // | ...... |
107 // +-------------------------------------+
108 // | PCD_DEFAULT_DATA (SKU A, Standard) |
109 // +-------------------------------------+
110 // | PCD_DATA_DELTA (SKU A, Standard) |
111 // +-------------------------------------+
112 // | ...... |
113 // +-------------------------------------+
114 //
115
116 #pragma pack(1)
117
118 typedef struct {
119 UINT16 Offset;
120 UINT8 Value;
121 } DATA_DELTA;
122
123 #pragma pack()
124
125 /**
126 Create the Ras section in FFS
127
128 @param[in] InputFilePath The input file path and name.
129 @param[in] OutputFilePath The output file path and name.
130
131 @retval EFI_SUCCESS
132
133 **/
134 EFI_STATUS
135 CreateRawSection (
136 IN CHAR8* InputFilePath,
137 IN CHAR8* OutputFilePath
138 );
139
140 /**
141 Create the Ras type of FFS
142
143 @param[in] InputFilePath .efi file, it's optional unless process PE/TE section.
144 @param[in] OutputFilePath .te or .pe file
145
146 @retval EFI_SUCCESS
147
148 **/
149 EFI_STATUS
150 CreateRawFfs (
151 IN CHAR8** InputFilePaths,
152 IN CHAR8* OutputFilePath,
153 IN BOOLEAN SizeOptimized
154 );
155
156 #endif
157