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
|
/** @file
This file defines NvDataFv GUID and FTW working block structures.
The NvDataFv GUID can be used as FileSystemGuid in EFI_FIRMWARE_VOLUME_HEADER if
this FV image contains NV data, such as NV variable data.
This file also defines WorkingBlockSignature GUID for FTW working block signature.
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that 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.
**/
#ifndef __SYSTEM_NV_DATA_GUID_H__
#define __SYSTEM_NV_DATA_GUID_H__
#define EFI_SYSTEM_NV_DATA_FV_GUID \
{0xfff12b8d, 0x7696, 0x4c8b, {0xa9, 0x85, 0x27, 0x47, 0x7, 0x5b, 0x4f, 0x50} }
#define EDKII_WORKING_BLOCK_SIGNATURE_GUID \
{0x9e58292b, 0x7c68, 0x497d, {0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95} }
extern EFI_GUID gEfiSystemNvDataFvGuid;
extern EFI_GUID gEdkiiWorkingBlockSignatureGuid;
#define WORKING_BLOCK_VALID 0x1
#define WORKING_BLOCK_INVALID 0x2
///
/// The EDKII Fault tolerant working block header.
/// The header is immediately followed by the write queue data.
///
typedef struct {
///
/// FTW working block signature.
/// Its value has be updated from gEfiSystemNvDataFvGuid to gEdkiiWorkingBlockSignatureGuid,
/// because its write queue data format has been updated to support the crossing archs.
///
EFI_GUID Signature;
///
/// 32bit CRC caculated for this header.
///
UINT32 Crc;
///
/// Working block valid bit.
///
UINT8 WorkingBlockValid : 1;
UINT8 WorkingBlockInvalid : 1;
UINT8 Reserved : 6;
UINT8 Reserved3[3];
///
/// Total size of the following write queue range.
///
UINT64 WriteQueueSize;
///
/// Write Queue data.
///
/// EFI_FAULT_TOLERANT_WRITE_HEADER FtwHeader;
/// EFI_FAULT_TOLERANT_WRITE_RECORD FtwRecord[FtwHeader.NumberOfWrites]
/// EFI_FAULT_TOLERANT_WRITE_HEADER FtwHeader2;
/// EFI_FAULT_TOLERANT_WRITE_RECORD FtwRecord2[FtwHeader2.NumberOfWrites]
/// ...
///
} EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER;
#define FTW_VALID_STATE 0
#define FTW_INVALID_STATE 1
//
// EFI Fault tolerant block update write queue entry.
//
typedef struct {
UINT8 HeaderAllocated : 1;
UINT8 WritesAllocated : 1;
UINT8 Complete : 1;
UINT8 Reserved : 5;
EFI_GUID CallerId;
UINT64 NumberOfWrites;
UINT64 PrivateDataSize;
} EFI_FAULT_TOLERANT_WRITE_HEADER;
//
// EFI Fault tolerant block update write queue record.
//
typedef struct {
UINT8 BootBlockUpdate : 1;
UINT8 SpareComplete : 1;
UINT8 DestinationComplete : 1;
UINT8 Reserved : 5;
EFI_LBA Lba;
UINT64 Offset;
UINT64 Length;
//
// Relative offset to spare block.
//
INT64 RelativeOffset;
//
// UINT8 PrivateData[PrivateDataSize]
//
} EFI_FAULT_TOLERANT_WRITE_RECORD;
#define FTW_RECORD_SIZE(PrivateDataSize) (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + (UINTN) PrivateDataSize)
#define FTW_RECORD_TOTAL_SIZE(NumberOfWrites, PrivateDataSize) \
((UINTN) (NumberOfWrites) * (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + (UINTN) PrivateDataSize))
#define FTW_WRITE_TOTAL_SIZE(NumberOfWrites, PrivateDataSize) \
( \
sizeof (EFI_FAULT_TOLERANT_WRITE_HEADER) + (UINTN) (NumberOfWrites) * \
(sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + (UINTN) PrivateDataSize) \
)
#endif
|