summaryrefslogtreecommitdiff
path: root/EDK/Foundation/Framework/Include/EfiFirmwareFileSystem.h
blob: 0cd16f8de58858a1bcf1878b1aed3ec2b5213e24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*++

Copyright (c) 2004, Intel Corporation                                                         
All rights reserved. This program and the accompanying materials                          
are licensed and made available under the terms and conditions of the BSD License         
which accompanies this distribution.  The full text of the license may be found at        
http://opensource.org/licenses/bsd-license.php                                            
                                                                                          
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

Module Name:

  EfiFirmwareFileSystem.h

Abstract:

  This file defines the data structures that comprise the FFS file system.

--*/

#ifndef _EFI_FFS_FILE_SYSTEM_H_
#define _EFI_FFS_FILE_SYSTEM_H_

#include "EfiImageFormat.h"

//
// GUIDs defined by the FFS specification.
//
#define EFI_FIRMWARE_FILE_SYSTEM_GUID \
  { \
    0x7A9354D9, 0x0468, 0x444a, 0x81, 0xCE, 0x0B, 0xF6, 0x17, 0xD8, 0x90, 0xDF \
  }

#define EFI_FFS_VOLUME_TOP_FILE_GUID \
  { \
    0x1BA0062E, 0xC779, 0x4582, 0x85, 0x66, 0x33, 0x6A, 0xE8, 0xF7, 0x8F, 0x9 \
  }

//
// FFS specific file types
//
#define EFI_FV_FILETYPE_FFS_PAD 0xF0

//
// FFS File Attributes
//
#define FFS_ATTRIB_TAIL_PRESENT     0x01
#define FFS_ATTRIB_RECOVERY         0x02
#define FFS_ATTRIB_DATA_ALIGNMENT   0x38
#define FFS_ATTRIB_CHECKSUM         0x40
//;;## ...AMI_OVERRIDE... Support PI1.x
#if (PI_SPECIFICATION_VERSION < 0x00010000)
#define FFS_ATTRIB_HEADER_EXTENSION 0x04
#else
//
// PI 1.0 definition.
// 
#define FFS_ATTRIB_FIXED           0x04
#endif


//
// FFS_FIXED_CHECKSUM is the default checksum value used when the
// FFS_ATTRIB_CHECKSUM attribute bit is clear
//;;## ...AMI_OVERRIDE... Support PI1.x
#if (PI_SPECIFICATION_VERSION < 0x00010000)
#define FFS_FIXED_CHECKSUM  0x5A
#else
#define FFS_FIXED_CHECKSUM  0xAA
#endif

//
// File state definitions
//
#define EFI_FILE_HEADER_CONSTRUCTION  0x01
#define EFI_FILE_HEADER_VALID         0x02
#define EFI_FILE_DATA_VALID           0x04
#define EFI_FILE_MARKED_FOR_UPDATE    0x08
#define EFI_FILE_DELETED              0x10
#define EFI_FILE_HEADER_INVALID       0x20

#define EFI_FILE_ALL_STATE_BITS       (EFI_FILE_HEADER_CONSTRUCTION | \
                                 EFI_FILE_HEADER_VALID | \
                                 EFI_FILE_DATA_VALID | \
                                 EFI_FILE_MARKED_FOR_UPDATE | \
                                 EFI_FILE_DELETED | \
                                 EFI_FILE_HEADER_INVALID \
          )

#define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \
    ( \
      (BOOLEAN) ( \
          (FvbAttributes & EFI_FVB_ERASE_POLARITY) ? (((~TestAttributes) & Bit) == Bit) : ((TestAttributes & Bit) == Bit) \
        ) \
    )

//
// FFS file integrity check structure
//
typedef UINT16  EFI_FFS_FILE_TAIL;

typedef union {
  struct {
    UINT8 Header;
    UINT8 File;
  } Checksum;
//;;## ...AMI_OVERRIDE... Support PI1.x
#if (PI_SPECIFICATION_VERSION < 0x00010000)  
  UINT16  TailReference;
#else
  UINT16  Checksum16;
#endif
} EFI_FFS_INTEGRITY_CHECK;

//
// FFS file header definition
//
typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
typedef UINT8 EFI_FFS_FILE_STATE;

typedef struct {
  EFI_GUID                Name;
  EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
  EFI_FV_FILETYPE         Type;
  EFI_FFS_FILE_ATTRIBUTES Attributes;
  UINT8                   Size[3];
  EFI_FFS_FILE_STATE      State;
} EFI_FFS_FILE_HEADER;

#endif