1 | /* $Id: efi-fv.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT, EFI firmware volume (FV) definitions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2021-2022 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef IPRT_INCLUDED_formats_efi_fv_h
|
---|
38 | #define IPRT_INCLUDED_formats_efi_fv_h
|
---|
39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
40 | # pragma once
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #include <iprt/types.h>
|
---|
44 | #include <iprt/assertcompile.h>
|
---|
45 | #include <iprt/formats/efi-common.h>
|
---|
46 |
|
---|
47 |
|
---|
48 | /*
|
---|
49 | * Definitions come from the UEFI PI Spec 1.5 Volume 3 Firmware, chapter 3 "Firmware Storage Code Definitions"
|
---|
50 | */
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * The volume header.
|
---|
54 | */
|
---|
55 | typedef struct EFI_FIRMWARE_VOLUME_HEADER
|
---|
56 | {
|
---|
57 | /** Reserved data for the reset vector. */
|
---|
58 | uint8_t abZeroVec[16];
|
---|
59 | /** The filesystem GUID. */
|
---|
60 | EFI_GUID GuidFilesystem;
|
---|
61 | /** The firmware volume length in bytes including this header. */
|
---|
62 | uint64_t cbFv;
|
---|
63 | /** The signature of the firmware volume header (set to _FVH). */
|
---|
64 | uint32_t u32Signature;
|
---|
65 | /** Firmware volume attributes. */
|
---|
66 | uint32_t fAttr;
|
---|
67 | /** Size of the header in bytes. */
|
---|
68 | uint16_t cbFvHdr;
|
---|
69 | /** Checksum of the header. */
|
---|
70 | uint16_t u16Chksum;
|
---|
71 | /** Offset of the extended header (0 for no extended header). */
|
---|
72 | uint16_t offExtHdr;
|
---|
73 | /** Reserved MBZ. */
|
---|
74 | uint8_t bRsvd;
|
---|
75 | /** Revision of the header. */
|
---|
76 | uint8_t bRevision;
|
---|
77 | } EFI_FIRMWARE_VOLUME_HEADER;
|
---|
78 | AssertCompileSize(EFI_FIRMWARE_VOLUME_HEADER, 56);
|
---|
79 | /** Pointer to a EFI firmware volume header. */
|
---|
80 | typedef EFI_FIRMWARE_VOLUME_HEADER *PEFI_FIRMWARE_VOLUME_HEADER;
|
---|
81 | /** Pointer to a const EFI firmware volume header. */
|
---|
82 | typedef const EFI_FIRMWARE_VOLUME_HEADER *PCEFI_FIRMWARE_VOLUME_HEADER;
|
---|
83 |
|
---|
84 | /** The signature for a firmware volume header. */
|
---|
85 | #define EFI_FIRMWARE_VOLUME_HEADER_SIGNATURE RT_MAKE_U32_FROM_U8('_', 'F', 'V', 'H')
|
---|
86 | /** Revision of the firmware volume header. */
|
---|
87 | #define EFI_FIRMWARE_VOLUME_HEADER_REVISION 2
|
---|
88 |
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * Firmware block map entry.
|
---|
92 | */
|
---|
93 | typedef struct EFI_FW_BLOCK_MAP
|
---|
94 | {
|
---|
95 | /** Number of blocks for this entry. */
|
---|
96 | uint32_t cBlocks;
|
---|
97 | /** Block size in bytes. */
|
---|
98 | uint32_t cbBlock;
|
---|
99 | } EFI_FW_BLOCK_MAP;
|
---|
100 | AssertCompileSize(EFI_FW_BLOCK_MAP, 8);
|
---|
101 | /** Pointer to a firmware volume block map entry. */
|
---|
102 | typedef EFI_FW_BLOCK_MAP *PEFI_FW_BLOCK_MAP;
|
---|
103 | /** Pointer to a const firmware volume block map entry. */
|
---|
104 | typedef const EFI_FW_BLOCK_MAP *PCEFI_FW_BLOCK_MAP;
|
---|
105 |
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * Fault tolerant working block header.
|
---|
109 | */
|
---|
110 | typedef struct EFI_FTW_BLOCK_HEADER
|
---|
111 | {
|
---|
112 | /** GUID identifying the FTW block header. */
|
---|
113 | EFI_GUID GuidSignature;
|
---|
114 | /** The checksum. */
|
---|
115 | uint32_t u32Chksum;
|
---|
116 | /** Flags marking the working block area as valid/invalid. */
|
---|
117 | uint32_t fWorkingBlockValid;
|
---|
118 | /** Size of the write queue. */
|
---|
119 | uint64_t cbWriteQueue;
|
---|
120 | } EFI_FTW_BLOCK_HEADER;
|
---|
121 | /** Pointer to a fault tolerant working block header. */
|
---|
122 | typedef EFI_FTW_BLOCK_HEADER *PEFI_FTW_BLOCK_HEADER;
|
---|
123 | /** Pointer to a const fault tolerant working block header. */
|
---|
124 | typedef const EFI_FTW_BLOCK_HEADER *PCEFI_FTW_BLOCK_HEADER;
|
---|
125 |
|
---|
126 | /** The signature for the working block header. */
|
---|
127 | #define EFI_WORKING_BLOCK_SIGNATURE_GUID \
|
---|
128 | { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95 }}
|
---|
129 |
|
---|
130 | #endif /* !IPRT_INCLUDED_formats_efi_fv_h */
|
---|
131 |
|
---|