1 /** @file
2   Guid & data structure used for Delivering Capsules Containing Updates to
3   EDKII System Firmware Management Protocol
4 
5   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
6   This program and the accompanying materials
7   are licensed and made available under the terms and conditions of the BSD License
8   which accompanies this distribution.  The full text of the license may be found at
9   http://opensource.org/licenses/bsd-license.php
10 
11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 
17 #ifndef __EDKII_SYSTEM_FMP_CAPSULE_GUID_H__
18 #define __EDKII_SYSTEM_FMP_CAPSULE_GUID_H__
19 
20 /**
21 
22   1. Capsule Layout is below:
23   +------------------------------------------+
24   |    Capsule Header (OPTIONAL, WFU)        | <== ESRT.FwClass (Optional)
25   +------------------------------------------+
26   |          FMP Capsule Header              | <== EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID
27   +------------------------------------------+
28   | FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER | <== PcdSystemFmpCapsuleImageTypeIdGuid
29   +------------------------------------------+
30   |     EFI_FIRMWARE_IMAGE_AUTHENTICATION    |
31   +------------------------------------------+
32   |             FMP Payload                  |
33   +------------------------------------------+
34 
35   2. System FMP Payload is below:
36   +------------------------------------------+
37   |            EFI_FIRMWARE_VOLUME           |
38   |  +------------------------------------+  |
39   |  |       FFS (Configure File)         |  | <== gEdkiiSystemFmpCapsuleConfigFileGuid
40   |  +------------------------------------+  |
41   |  |         FFS (Driver FV)            |  | <== gEdkiiSystemFmpCapsuleDriverFvFileGuid
42   |  +------------------------------------+  |
43   |  |    FFS (System Firmware Image)     |  | <== PcdEdkiiSystemFirmwareFileGuid
44   |  |  +------------------------------+  |  |
45   |  |  |          FV Recovery         |  |  |
46   |  |  |------------------------------|  |  |
47   |  |  |           FV Main            |  |  |
48   |  |  +------------------------------+  |  |
49   |  +------------------------------------+  |
50   +------------------------------------------+
51 
52   NOTE: There might be multiple FFS (System Firmware Image) exist in the System FMP Capsule.
53   Only the one, whose FFS GUID matches PcdEdkiiSystemFirmwareFileGuid, takes effect.
54   The other FFS is ignored.
55 
56   3. The format of the recovery configuration is below:
57 
58   [Head]
59   NumOfRecovery = <Num>     # Decimal
60   Recovery0 = <Name1>       # String
61   Recovery1 = <Name2>       # String
62   Recovery<Num-1> = <NameX> # String
63 
64   [Name?]
65   Length      = <Length>         # Fv Length (HEX)
66   ImageOffset = <ImageOffset>    # Fv offset of this SystemFirmware image (HEX)
67   FileGuid    = XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  # PcdEdkiiSystemFirmwareFileGuid
68 
69   NOTE: The [Name?] entry may have differnt FileGuid.
70   Only the one, whose FileGuid matches PcdEdkiiSystemFirmwareFileGuid, takes effect.
71   The other entry is ignored.
72 
73   4. The format of the capsule update configuration is below:
74 
75   [Head]
76   NumOfUpdate = <Num>     # Decimal
77   Update0 = <Name1>       # String
78   Update1 = <Name2>       # String
79   Update<Num-1> = <NameX> # String
80 
81   [Name?]
82   FirmwareType = 0               # 0 - SystemFirmware, 1 - NvRam
83   AddressType = 0                # 0 - relative address, 1 - absolute address.
84   BaseAddress = <BaseAddress>    # Base address offset on flash (HEX)
85   Length      = <Length>         # Image Length (HEX)
86   ImageOffset = <ImageOffset>    # Image offset of this SystemFirmware image (HEX)
87   FileGuid    = XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  # PcdEdkiiSystemFirmwareFileGuid
88 
89   NOTE: The [Name?] entry may have differnt FileGuid.
90   Only the one, whose FileGuid matches PcdEdkiiSystemFirmwareFileGuid, takes effect.
91   The other entry is ignored.
92 
93 **/
94 
95 #define EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE  SIGNATURE_32('S', 'F', 'I', 'D')
96 
97 #pragma pack(1)
98 typedef struct {
99   UINT32                                Signature;
100   UINT32                                HeaderLength; // Length of EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR, excluding NameString
101   UINT32                                Length;       // Length of the data structure, including NameString
102   // Below structure is similar as UEFI EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetPackageInfo()
103   UINT32                                PackageVersion;
104   UINT32                                PackageVersionNameStringOffset; // Offset from head, CHAR16 string including NULL terminate char
105   // Below structure is similar as UEFI EFI_FIRMWARE_IMAGE_DESCRIPTOR
106   UINT8                                 ImageIndex;
107   UINT8                                 Reserved[3];
108   EFI_GUID                              ImageTypeId;
109   UINT64                                ImageId;
110   UINT32                                ImageIdNameStringOffset; // Offset from head, CHAR16 string including NULL terminate char
111   UINT32                                Version;
112   UINT32                                VersionNameStringOffset; // Offset from head, CHAR16 string including NULL terminate char
113   UINT8                                 Reserved2[4];
114   UINT64                                Size;
115   UINT64                                AttributesSupported;
116   UINT64                                AttributesSetting;
117   UINT64                                Compatibilities;
118   UINT32                                LowestSupportedImageVersion;
119   UINT32                                LastAttemptVersion;
120   UINT32                                LastAttemptStatus;
121   UINT8                                 Reserved3[4];
122   UINT64                                HardwareInstance;
123   // real string data
124 //CHAR16                                ImageIdNameStr[];        // CHAR16 string including NULL terminate char
125 //CHAR16                                VersionNameStr[];        // CHAR16 string including NULL terminate char
126 //CHAR16                                PackageVersionNameStr[]; // CHAR16 string including NULL terminate char
127 } EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR;
128 #pragma pack()
129 
130 /**
131   System Firmware Image Descriptor is below:
132             +----------------------+
133             | System Firmware (FV) |
134             |+--------------------+|
135             ||   FFS (Freeform)   || <== gEdkiiSystemFirmwareImageDescriptorFileGuid
136             ||+------------------+||
137             |||   SECTION (RAW)  |||
138             |||  System Firmware |||
139             ||| Image Descriptor |||
140             ||+------------------+||
141             |+--------------------+|
142             |                      |
143             |                      |
144             +----------------------+
145 **/
146 
147 extern EFI_GUID gEdkiiSystemFirmwareImageDescriptorFileGuid;
148 extern EFI_GUID gEdkiiSystemFmpCapsuleConfigFileGuid;
149 extern EFI_GUID gEdkiiSystemFmpCapsuleDriverFvFileGuid;
150 
151 #endif
152