]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/VariableFlashInfo.h
MdeModulePkg: Add Variable Flash Info HOB
[mirror_edk2.git] / MdeModulePkg / Include / Guid / VariableFlashInfo.h
CommitLineData
0903042b
MK
1/** @file\r
2 This file defines the GUID and data structure used to pass information about\r
3 a variable store mapped on flash (i.e. a MMIO firmware volume) to the modules\r
4 that consume that information such as the DXE and MM UEFI variable drivers.\r
5\r
6 The HOB described in this file is currently optional. It is primarily provided\r
7 to allow a platform to dynamically describe the flash information to environments\r
8 such as Standalone MM that cannot access the prior method using dynamic PCDs.\r
9\r
10 Even for platforms that use Standalone MM, if the information is only stored\r
11 statically such as with FixedAtBuild PCDs, the HOB is not required.\r
12\r
13 Every point of consumption in this package that uses the PCDs will first check\r
14 for the HOB and use its value if present.\r
15\r
16 Early modules such as the PEI UEFI variable driver might also consume this\r
17 information. For modules such as these, that execute early in the boot flow,\r
18 at least two approaches are possible depending on platform design.\r
19\r
20 1. If the information in the HOB exactly matches the information in the PCDs,\r
21 (i.e. the HOB values are set using the PCD values), let the driver read\r
22 the information from the PCD and produce the HOB later in boot.\r
23\r
24 2. Produce the HOB very early in boot. For example, the earliest point the HOB\r
25 is currently consumed is in FaultTolerantWritePei. Note that FaultTolerantWritePei\r
26 produces gEdkiiFaultTolerantWriteGuid which is a dependency for VariablePei.\r
27\r
28 Therefore, attaching a NULL class library to FaultTolerantWritePei with a\r
29 constructor that produces the HOB will guarantee it is produced before the first\r
30 point of consumption as the constructor is executed before the module entry point.\r
31\r
32 Copyright (c) Microsoft Corporation.<BR>\r
33\r
34 SPDX-License-Identifier: BSD-2-Clause-Patent\r
35\r
36**/\r
37\r
38#ifndef VARIABLE_FLASH_INFO_H_\r
39#define VARIABLE_FLASH_INFO_H_\r
40\r
41#define VARIABLE_FLASH_INFO_HOB_GUID \\r
42 { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20, 0xfc, 0x90 }}\r
43\r
44#define VARIABLE_FLASH_INFO_HOB_VERSION 1\r
45\r
46extern EFI_GUID gVariableFlashInfoHobGuid;\r
47\r
48#pragma pack (push, 1)\r
49\r
50///\r
51/// This structure can be used to describe UEFI variable\r
52/// flash information.\r
53///\r
54typedef struct {\r
55 ///\r
56 /// Version of this structure.\r
57 ///\r
58 /// Increment the value when the structure is modified.\r
59 ///\r
60 UINT32 Version;\r
61 ///\r
62 /// Reserved field.\r
63 ///\r
64 /// Currently reserved for natural alignment.\r
65 ///\r
66 UINT32 Reserved;\r
67 ///\r
68 /// Base address of the non-volatile variable range in the flash device.\r
69 ///\r
70 /// Note that this address should align with the block size requirements of the flash device.\r
71 ///\r
72 EFI_PHYSICAL_ADDRESS NvVariableBaseAddress;\r
73 ///\r
74 /// Size of the non-volatile variable range in the flash device.\r
75 ///\r
76 /// Note that this value should be less than or equal to FtwSpareLength to support reclaim of\r
77 /// entire variable store area.\r
78 /// Note that this address should align with the block size requirements of the flash device.\r
79 ///\r
80 UINT64 NvVariableLength;\r
81 ///\r
82 /// Base address of the FTW spare block range in the flash device.\r
83 ///\r
84 /// Note that this address should align with the block size requirements of the flash device.\r
85 ///\r
86 EFI_PHYSICAL_ADDRESS FtwSpareBaseAddress;\r
87 ///\r
88 /// Size of the FTW spare block range in the flash device.\r
89 ///\r
90 /// Note that this value should be greater than or equal to NvVariableLength.\r
91 /// Note that this address should align with the block size requirements of the flash device.\r
92 ///\r
93 UINT64 FtwSpareLength;\r
94 ///\r
95 /// Base address of the FTW working block range in the flash device.\r
96 ///\r
97 /// Note that if FtwWorkingLength is larger than on block size, this value should be block size aligned.\r
98 ///\r
99 EFI_PHYSICAL_ADDRESS FtwWorkingBaseAddress;\r
100 ///\r
101 /// Size of the FTW working block range in the flash device.\r
102 ///\r
103 /// Note that if the value is less than on block size, the range should not span blocks.\r
104 /// Note that if the value is larger than one block size, this value should be block size aligned.\r
105 ///\r
106 UINT64 FtwWorkingLength;\r
107} VARIABLE_FLASH_INFO;\r
108\r
109#pragma pack (pop)\r
110\r
111#endif\r