]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Common/FirmwareFileSystem.h
Sync this file with MiscSubClass spec and add some struture alias to use them more...
[mirror_edk2.git] / MdePkg / Include / Common / FirmwareFileSystem.h
1 /** @file
2 This file defines the data structures that comprise the FFS file system.
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. 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 Module Name: FirmwareFileSystem.h
14
15 @par Revision Reference:
16 These definitions are from Firmware File System Spec 0.9.
17
18 **/
19
20 #ifndef __EFI_FFS_FILE_SYSTEM_H__
21 #define __EFI_FFS_FILE_SYSTEM_H__
22
23 ///
24 /// FFS specific file types
25 ///
26 #define EFI_FV_FILETYPE_FFS_PAD 0xF0
27
28 //
29 // FFS File Attributes
30 //
31 #define FFS_ATTRIB_TAIL_PRESENT 0x01
32 #define FFS_ATTRIB_RECOVERY 0x02
33 #define FFS_ATTRIB_HEADER_EXTENSION 0x04
34 #define FFS_ATTRIB_DATA_ALIGNMENT 0x38
35 #define FFS_ATTRIB_CHECKSUM 0x40
36
37 ///
38 /// FFS_FIXED_CHECKSUM is the default checksum value used when the
39 /// FFS_ATTRIB_CHECKSUM attribute bit is clear
40 /// note this is NOT an architecturally defined value, but is in this file for
41 /// implementation convenience
42 ///
43 #define FFS_FIXED_CHECKSUM 0x5A
44
45 //
46 // File state definitions
47 //
48 #define EFI_FILE_HEADER_CONSTRUCTION 0x01
49 #define EFI_FILE_HEADER_VALID 0x02
50 #define EFI_FILE_DATA_VALID 0x04
51 #define EFI_FILE_MARKED_FOR_UPDATE 0x08
52 #define EFI_FILE_DELETED 0x10
53 #define EFI_FILE_HEADER_INVALID 0x20
54
55 #define EFI_FILE_ALL_STATE_BITS (EFI_FILE_HEADER_CONSTRUCTION | \
56 EFI_FILE_HEADER_VALID | \
57 EFI_FILE_DATA_VALID | \
58 EFI_FILE_MARKED_FOR_UPDATE | \
59 EFI_FILE_DELETED | \
60 EFI_FILE_HEADER_INVALID \
61 )
62
63 #define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \
64 ( \
65 (BOOLEAN) ( \
66 (FvbAttributes & EFI_FVB_ERASE_POLARITY) ? (((~TestAttributes) & Bit) == Bit) : ((TestAttributes & Bit) == Bit) \
67 ) \
68 )
69
70 typedef UINT16 EFI_FFS_FILE_TAIL;
71
72 ///
73 /// FFS file integrity check structure
74 ///
75 typedef union {
76 struct {
77 UINT8 Header;
78 UINT8 File;
79 } Checksum;
80 UINT16 TailReference;
81 } EFI_FFS_INTEGRITY_CHECK;
82
83 //
84 // FFS file header definition
85 //
86 typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
87 typedef UINT8 EFI_FFS_FILE_STATE;
88
89 typedef struct {
90 EFI_GUID Name;
91 EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
92 EFI_FV_FILETYPE Type;
93 EFI_FFS_FILE_ATTRIBUTES Attributes;
94 UINT8 Size[3];
95 EFI_FFS_FILE_STATE State;
96 } EFI_FFS_FILE_HEADER;
97
98 #endif