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