• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*++
2 
3 Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13 
14   EfiFirmwareVolumeHeader.h
15 
16 Abstract:
17 
18   Defines data structure that is the volume header found at the beginning of
19   all firmware volumes that are either memory mapped, or have an
20   associated FirmwareVolumeBlock protocol.
21 
22 --*/
23 
24 #ifndef _EFI_FIRMWARE_VOLUME_HEADER_H_
25 #define _EFI_FIRMWARE_VOLUME_HEADER_H_
26 
27 
28 //
29 // Firmware Volume Block Attributes bit definitions
30 // They are the shared between Framework and PI1.0.
31 //
32 typedef UINT32  EFI_FVB_ATTRIBUTES;
33 
34 #define EFI_FVB_READ_DISABLED_CAP   0x00000001
35 #define EFI_FVB_READ_ENABLED_CAP    0x00000002
36 #define EFI_FVB_READ_STATUS         0x00000004
37 
38 #define EFI_FVB_WRITE_DISABLED_CAP  0x00000008
39 #define EFI_FVB_WRITE_ENABLED_CAP   0x00000010
40 #define EFI_FVB_WRITE_STATUS        0x00000020
41 
42 #define EFI_FVB_LOCK_CAP            0x00000040
43 #define EFI_FVB_LOCK_STATUS         0x00000080
44 
45 #define EFI_FVB_STICKY_WRITE        0x00000200
46 #define EFI_FVB_MEMORY_MAPPED       0x00000400
47 #define EFI_FVB_ERASE_POLARITY      0x00000800
48 
49 
50 #if (PI_SPECIFICATION_VERSION < 0x00010000)
51 
52 #define EFI_FVB_ALIGNMENT_CAP       0x00008000
53 #define EFI_FVB_ALIGNMENT_2         0x00010000
54 #define EFI_FVB_ALIGNMENT_4         0x00020000
55 #define EFI_FVB_ALIGNMENT_8         0x00040000
56 #define EFI_FVB_ALIGNMENT_16        0x00080000
57 #define EFI_FVB_ALIGNMENT_32        0x00100000
58 #define EFI_FVB_ALIGNMENT_64        0x00200000
59 #define EFI_FVB_ALIGNMENT_128       0x00400000
60 #define EFI_FVB_ALIGNMENT_256       0x00800000
61 #define EFI_FVB_ALIGNMENT_512       0x01000000
62 #define EFI_FVB_ALIGNMENT_1K        0x02000000
63 #define EFI_FVB_ALIGNMENT_2K        0x04000000
64 #define EFI_FVB_ALIGNMENT_4K        0x08000000
65 #define EFI_FVB_ALIGNMENT_8K        0x10000000
66 #define EFI_FVB_ALIGNMENT_16K       0x20000000
67 #define EFI_FVB_ALIGNMENT_32K       0x40000000
68 #define EFI_FVB_ALIGNMENT_64K       0x80000000
69 
70 #define EFI_FVB_CAPABILITIES  (EFI_FVB_READ_DISABLED_CAP | \
71                               EFI_FVB_READ_ENABLED_CAP | \
72                               EFI_FVB_WRITE_DISABLED_CAP | \
73                               EFI_FVB_WRITE_ENABLED_CAP | \
74                               EFI_FVB_LOCK_CAP \
75                               )
76 
77 #define EFI_FVB_STATUS    (EFI_FVB_READ_STATUS | EFI_FVB_WRITE_STATUS | EFI_FVB_LOCK_STATUS)
78 
79 
80 
81 #else
82 
83 #define EFI_FVB2_READ_LOCK_CAP        0x00001000
84 #define EFI_FVB2_READ_LOCK_STATUS     0x00002000
85 
86 #define EFI_FVB2_WRITE_LOCK_CAP       0x00004000
87 #define EFI_FVB2_WRITE_LOCK_STATUS    0x00008000
88 
89 #define EFI_FVB2_ALIGNMENT            0x001F0000
90 #define EFI_FVB2_ALIGNMENT_1          0x00000000
91 #define EFI_FVB2_ALIGNMENT_2          0x00010000
92 #define EFI_FVB2_ALIGNMENT_4          0x00020000
93 #define EFI_FVB2_ALIGNMENT_8          0x00030000
94 #define EFI_FVB2_ALIGNMENT_16         0x00040000
95 #define EFI_FVB2_ALIGNMENT_32         0x00050000
96 #define EFI_FVB2_ALIGNMENT_64         0x00060000
97 #define EFI_FVB2_ALIGNMENT_128        0x00070000
98 #define EFI_FVB2_ALIGNMENT_256        0x00080000
99 #define EFI_FVB2_ALIGNMENT_512        0x00090000
100 #define EFI_FVB2_ALIGNMENT_1K         0x000A0000
101 #define EFI_FVB2_ALIGNMENT_2K         0x000B0000
102 #define EFI_FVB2_ALIGNMENT_4K         0x000C0000
103 #define EFI_FVB2_ALIGNMENT_8K         0x000D0000
104 #define EFI_FVB2_ALIGNMENT_16K        0x000E0000
105 #define EFI_FVB2_ALIGNMENT_32K        0x000F0000
106 #define EFI_FVB2_ALIGNMENT_64K        0x00100000
107 #define EFI_FVB2_ALIGNMENT_128K       0x00110000
108 #define EFI_FVB2_ALIGNMENT_256K       0x00120000
109 #define EFI_FVB2_ALIGNMENT_512K       0x00130000
110 #define EFI_FVB2_ALIGNMENT_1M         0x00140000
111 #define EFI_FVB2_ALIGNMENT_2M         0x00150000
112 #define EFI_FVB2_ALIGNMENT_4M         0x00160000
113 #define EFI_FVB2_ALIGNMENT_8M         0x00170000
114 #define EFI_FVB2_ALIGNMENT_16M        0x00180000
115 #define EFI_FVB2_ALIGNMENT_32M        0x00190000
116 #define EFI_FVB2_ALIGNMENT_64M        0x001A0000
117 #define EFI_FVB2_ALIGNMENT_128M       0x001B0000
118 #define EFI_FVB2_ALIGNMENT_256M       0x001C0000
119 #define EFI_FVB2_ALIGNMENT_512M       0x001D0000
120 #define EFI_FVB2_ALIGNMENT_1G         0x001E0000
121 #define EFI_FVB2_ALIGNMENT_2G         0x001F0000
122 
123 #define EFI_FVB_CAPABILITIES  (EFI_FVB_READ_DISABLED_CAP | \
124                               EFI_FVB_READ_ENABLED_CAP   | \
125                               EFI_FVB_WRITE_DISABLED_CAP | \
126                               EFI_FVB_WRITE_ENABLED_CAP  | \
127                               EFI_FVB_LOCK_CAP           | \
128                               EFI_FVB2_READ_LOCK_CAP     | \
129                               EFI_FVB2_WRITE_LOCK_CAP    )
130 
131 #define EFI_FVB_STATUS    (EFI_FVB_READ_STATUS | EFI_FVB_WRITE_STATUS       | \
132                            EFI_FVB_LOCK_STATUS | EFI_FVB2_READ_LOCK_STATUS  | \
133                            EFI_FVB2_WRITE_LOCK_STATUS )
134 
135 
136 
137 //
138 // Extended Header Header. Located via ExtHeaderOffset.
139 // The extended headers follow each other in memory and are
140 // terminated by ExtHeaderType EFI_FV_EXT_TYPE_END
141 //
142 #define EFI_FV_EXT_TYPE_END   0x00
143 typedef struct {
144   UINT16  ExtEntrySize;
145   UINT16  ExtEntryType;
146 } EFI_FIRMWARE_VOLUME_EXT_ENTRY;
147 
148 //
149 // GUID that maps OEM file types to GUIDs
150 //
151 #define EFI_FV_EXT_TYPE_OEM_TYPE  0x01
152 typedef struct {
153   EFI_FIRMWARE_VOLUME_EXT_ENTRY   Hdr;
154   UINT32                          TypeMask;
155   EFI_GUID                        Types[1];
156 } EFI_FIRMWARE_VOLUME_EXT_HEADER_OEM_TYPE;
157 
158 //
159 // Unique name of the FV
160 //
161 typedef struct {
162   EFI_GUID          FvName;
163   UINT32            ExtHeaderSize;
164 } EFI_FIRMWARE_VOLUME_EXT_HEADER;
165 
166 
167 #endif
168 
169 
170 //
171 // Firmware Volume Header Revision definition
172 //
173 #define EFI_FVH_REVISION  0x01
174 //
175 // PI1.0 define Firmware Volume Header Revision to 2
176 //
177 #define EFI_FVH_PI_REVISION  0x02
178 
179 //
180 // Firmware Volume Header Signature definition
181 //
182 #define EFI_FVH_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', 'H')
183 
184 //
185 // Firmware Volume Header Block Map Entry definition
186 //
187 typedef struct {
188   UINT32  NumBlocks;
189   UINT32  BlockLength;
190 } EFI_FV_BLOCK_MAP_ENTRY;
191 
192 //
193 // Firmware Volume Header definition
194 //
195 typedef struct {
196   UINT8                   ZeroVector[16];
197   EFI_GUID                FileSystemGuid;
198   UINT64                  FvLength;
199   UINT32                  Signature;
200   EFI_FVB_ATTRIBUTES      Attributes;
201   UINT16                  HeaderLength;
202   UINT16                  Checksum;
203 #if (PI_SPECIFICATION_VERSION < 0x00010000)
204   UINT8                   Reserved[3];
205 #else
206   UINT16                  ExtHeaderOffset;
207   UINT8                   Reserved[1];
208 #endif
209   UINT8                   Revision;
210   EFI_FV_BLOCK_MAP_ENTRY  FvBlockMap[1];
211 } EFI_FIRMWARE_VOLUME_HEADER;
212 
213 #endif
214