]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Common/FirmwareFileSystem.h
Add in OFFSET_OF macro as defined in MDE Library spec
[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 typedef UINT16 EFI_FFS_FILE_TAIL;
64
65 ///
66 /// FFS file integrity check structure
67 ///
68 typedef union {
69 struct {
70 UINT8 Header;
71 UINT8 File;
72 } Checksum;
73 UINT16 TailReference;
74 } EFI_FFS_INTEGRITY_CHECK;
75
76 //
77 // FFS file header definition
78 //
79 typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
80 typedef UINT8 EFI_FFS_FILE_STATE;
81
82 typedef struct {
83 EFI_GUID Name;
84 EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
85 EFI_FV_FILETYPE Type;
86 EFI_FFS_FILE_ATTRIBUTES Attributes;
87 UINT8 Size[3];
88 EFI_FFS_FILE_STATE State;
89 } EFI_FFS_FILE_HEADER;
90
91 #endif