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