Compare commits
16 Commits
edk2-stabl
...
edk2-stabl
Author | SHA1 | Date | |
---|---|---|---|
16779ede2d | |||
07c0c2eb0a | |||
9c733f0b90 | |||
a21a3438f7 | |||
a72d552f19 | |||
1f026ababf | |||
a7d3d4e7c4 | |||
a69eac7578 | |||
524a15c1fa | |||
8db39c60cd | |||
4dbebc2d10 | |||
60b519456c | |||
0903042b66 | |||
2189c71026 | |||
7b126978e1 | |||
2d1138a1a8 |
@ -17,6 +17,6 @@ steps:
|
|||||||
#checkLatest: false # Optional
|
#checkLatest: false # Optional
|
||||||
condition: and(gt(variables.pkg_count, 0), succeeded())
|
condition: and(gt(variables.pkg_count, 0), succeeded())
|
||||||
|
|
||||||
- script: npm install -g cspell
|
- script: npm install -g cspell@5.20.0
|
||||||
displayName: 'Install cspell npm'
|
displayName: 'Install cspell npm'
|
||||||
condition: and(gt(variables.pkg_count, 0), succeeded())
|
condition: and(gt(variables.pkg_count, 0), succeeded())
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"*.jpg"
|
"*.jpg"
|
||||||
],
|
],
|
||||||
"minWordLength": 5,
|
"minWordLength": 5,
|
||||||
"allowCompoundWords": false,
|
"allowCompoundWords": true,
|
||||||
"maxNumberOfProblems": 200,
|
"maxNumberOfProblems": 200,
|
||||||
"maxDuplicateProblems": 200,
|
"maxDuplicateProblems": 200,
|
||||||
"ignoreWords": [
|
"ignoreWords": [
|
||||||
@ -178,6 +178,117 @@
|
|||||||
"vcruntimed",
|
"vcruntimed",
|
||||||
"ucrtd",
|
"ucrtd",
|
||||||
"msvcrtd",
|
"msvcrtd",
|
||||||
"XIPFLAGS"
|
"XIPFLAGS",
|
||||||
|
"bootflow",
|
||||||
|
"bootup",
|
||||||
|
"cacheability",
|
||||||
|
"cachetype",
|
||||||
|
"conout",
|
||||||
|
"deadloop",
|
||||||
|
"devicepath",
|
||||||
|
"hisilicon",
|
||||||
|
"littleendian",
|
||||||
|
"nonsecure",
|
||||||
|
"pagetable",
|
||||||
|
"postmem",
|
||||||
|
"premem",
|
||||||
|
"reglist",
|
||||||
|
"semihalf",
|
||||||
|
"subvendor",
|
||||||
|
"subhierarchy",
|
||||||
|
"targetlist",
|
||||||
|
"tmpname",
|
||||||
|
"watchdogtimer",
|
||||||
|
"writeback",
|
||||||
|
"langcode",
|
||||||
|
"langcodes",
|
||||||
|
"autoreload",
|
||||||
|
"bootable",
|
||||||
|
"endiannness",
|
||||||
|
"fvmain",
|
||||||
|
"prefetchable",
|
||||||
|
"multiboot",
|
||||||
|
"ramdisk",
|
||||||
|
"unbootable",
|
||||||
|
"setjump",
|
||||||
|
"bytecodes",
|
||||||
|
"bytelist",
|
||||||
|
"bytestream",
|
||||||
|
"countof",
|
||||||
|
"deregistering",
|
||||||
|
"devicetree",
|
||||||
|
"mainpage",
|
||||||
|
"mismanipulation",
|
||||||
|
"pytool",
|
||||||
|
"wbinvd",
|
||||||
|
"armltd",
|
||||||
|
"datacache",
|
||||||
|
"lastattemptstatus",
|
||||||
|
"lastattemptversion",
|
||||||
|
"lowestsupportedversion",
|
||||||
|
"updateable",
|
||||||
|
"pecoff",
|
||||||
|
"autodetect",
|
||||||
|
"harddisk",
|
||||||
|
"toctou",
|
||||||
|
"bugbug",
|
||||||
|
"depexes",
|
||||||
|
"fwvol",
|
||||||
|
"hoblist",
|
||||||
|
"imagehandle",
|
||||||
|
"schedulable",
|
||||||
|
"StandaloneMMCore",
|
||||||
|
"systemtable",
|
||||||
|
"uncacheable",
|
||||||
|
"devpath",
|
||||||
|
"testsuites",
|
||||||
|
"testcase",
|
||||||
|
"pxmldoc",
|
||||||
|
"pcxml",
|
||||||
|
"pclutf",
|
||||||
|
"pcunicode",
|
||||||
|
"ntxmltransformcharacter",
|
||||||
|
"ntxmlcomparestrings",
|
||||||
|
"pcxmldoc",
|
||||||
|
"ntxmlfetchcharacterdecoder",
|
||||||
|
"ntxml",
|
||||||
|
"ntxmlspecialstringcompare",
|
||||||
|
"rtlxmlcallback",
|
||||||
|
"xmlef",
|
||||||
|
"osruntime",
|
||||||
|
"readytoboot",
|
||||||
|
"hwerrrec",
|
||||||
|
"xformed",
|
||||||
|
"xform",
|
||||||
|
"undock",
|
||||||
|
"qrencoder",
|
||||||
|
"selawik",
|
||||||
|
"ntxmlrawnextcharacter",
|
||||||
|
"undocked",
|
||||||
|
"reprompt",
|
||||||
|
"yesno",
|
||||||
|
"okcancel",
|
||||||
|
"qrencoding",
|
||||||
|
"qrlevel",
|
||||||
|
"shiftn",
|
||||||
|
"unenroll",
|
||||||
|
"pcxmlstructure",
|
||||||
|
"pxmlstructure",
|
||||||
|
"pcencoder",
|
||||||
|
"pcvoid",
|
||||||
|
"nofailure",
|
||||||
|
"blockio",
|
||||||
|
"lockv",
|
||||||
|
"uefishelldebug",
|
||||||
|
"mtrrcap",
|
||||||
|
"drhds",
|
||||||
|
"rmrrs",
|
||||||
|
"creatorid",
|
||||||
|
"dxeipl",
|
||||||
|
"swmdialogs",
|
||||||
|
"unrecovered",
|
||||||
|
"cmocka",
|
||||||
|
"unenrolling",
|
||||||
|
"unconfigure"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,7 @@
|
|||||||
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
||||||
!endif
|
!endif
|
||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
||||||
|
@ -122,6 +122,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
|
SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
|
||||||
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
||||||
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
|
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
|
||||||
|
111
MdeModulePkg/Include/Guid/VariableFlashInfo.h
Normal file
111
MdeModulePkg/Include/Guid/VariableFlashInfo.h
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
/** @file
|
||||||
|
This file defines the GUID and data structure used to pass information about
|
||||||
|
a variable store mapped on flash (i.e. a MMIO firmware volume) to the modules
|
||||||
|
that consume that information such as the DXE and MM UEFI variable drivers.
|
||||||
|
|
||||||
|
The HOB described in this file is currently optional. It is primarily provided
|
||||||
|
to allow a platform to dynamically describe the flash information to environments
|
||||||
|
such as Standalone MM that cannot access the prior method using dynamic PCDs.
|
||||||
|
|
||||||
|
Even for platforms that use Standalone MM, if the information is only stored
|
||||||
|
statically such as with FixedAtBuild PCDs, the HOB is not required.
|
||||||
|
|
||||||
|
Every point of consumption in this package that uses the PCDs will first check
|
||||||
|
for the HOB and use its value if present.
|
||||||
|
|
||||||
|
Early modules such as the PEI UEFI variable driver might also consume this
|
||||||
|
information. For modules such as these, that execute early in the boot flow,
|
||||||
|
at least two approaches are possible depending on platform design.
|
||||||
|
|
||||||
|
1. If the information in the HOB exactly matches the information in the PCDs,
|
||||||
|
(i.e. the HOB values are set using the PCD values), let the driver read
|
||||||
|
the information from the PCD and produce the HOB later in boot.
|
||||||
|
|
||||||
|
2. Produce the HOB very early in boot. For example, the earliest point the HOB
|
||||||
|
is currently consumed is in FaultTolerantWritePei. Note that FaultTolerantWritePei
|
||||||
|
produces gEdkiiFaultTolerantWriteGuid which is a dependency for VariablePei.
|
||||||
|
|
||||||
|
Therefore, attaching a NULL class library to FaultTolerantWritePei with a
|
||||||
|
constructor that produces the HOB will guarantee it is produced before the first
|
||||||
|
point of consumption as the constructor is executed before the module entry point.
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.<BR>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef VARIABLE_FLASH_INFO_H_
|
||||||
|
#define VARIABLE_FLASH_INFO_H_
|
||||||
|
|
||||||
|
#define VARIABLE_FLASH_INFO_HOB_GUID \
|
||||||
|
{ 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20, 0xfc, 0x90 }}
|
||||||
|
|
||||||
|
#define VARIABLE_FLASH_INFO_HOB_VERSION 1
|
||||||
|
|
||||||
|
extern EFI_GUID gVariableFlashInfoHobGuid;
|
||||||
|
|
||||||
|
#pragma pack (push, 1)
|
||||||
|
|
||||||
|
///
|
||||||
|
/// This structure can be used to describe UEFI variable
|
||||||
|
/// flash information.
|
||||||
|
///
|
||||||
|
typedef struct {
|
||||||
|
///
|
||||||
|
/// Version of this structure.
|
||||||
|
///
|
||||||
|
/// Increment the value when the structure is modified.
|
||||||
|
///
|
||||||
|
UINT32 Version;
|
||||||
|
///
|
||||||
|
/// Reserved field.
|
||||||
|
///
|
||||||
|
/// Currently reserved for natural alignment.
|
||||||
|
///
|
||||||
|
UINT32 Reserved;
|
||||||
|
///
|
||||||
|
/// Base address of the non-volatile variable range in the flash device.
|
||||||
|
///
|
||||||
|
/// Note that this address should align with the block size requirements of the flash device.
|
||||||
|
///
|
||||||
|
EFI_PHYSICAL_ADDRESS NvVariableBaseAddress;
|
||||||
|
///
|
||||||
|
/// Size of the non-volatile variable range in the flash device.
|
||||||
|
///
|
||||||
|
/// Note that this value should be less than or equal to FtwSpareLength to support reclaim of
|
||||||
|
/// entire variable store area.
|
||||||
|
/// Note that this address should align with the block size requirements of the flash device.
|
||||||
|
///
|
||||||
|
UINT64 NvVariableLength;
|
||||||
|
///
|
||||||
|
/// Base address of the FTW spare block range in the flash device.
|
||||||
|
///
|
||||||
|
/// Note that this address should align with the block size requirements of the flash device.
|
||||||
|
///
|
||||||
|
EFI_PHYSICAL_ADDRESS FtwSpareBaseAddress;
|
||||||
|
///
|
||||||
|
/// Size of the FTW spare block range in the flash device.
|
||||||
|
///
|
||||||
|
/// Note that this value should be greater than or equal to NvVariableLength.
|
||||||
|
/// Note that this address should align with the block size requirements of the flash device.
|
||||||
|
///
|
||||||
|
UINT64 FtwSpareLength;
|
||||||
|
///
|
||||||
|
/// Base address of the FTW working block range in the flash device.
|
||||||
|
///
|
||||||
|
/// Note that if FtwWorkingLength is larger than on block size, this value should be block size aligned.
|
||||||
|
///
|
||||||
|
EFI_PHYSICAL_ADDRESS FtwWorkingBaseAddress;
|
||||||
|
///
|
||||||
|
/// Size of the FTW working block range in the flash device.
|
||||||
|
///
|
||||||
|
/// Note that if the value is less than on block size, the range should not span blocks.
|
||||||
|
/// Note that if the value is larger than one block size, this value should be block size aligned.
|
||||||
|
///
|
||||||
|
UINT64 FtwWorkingLength;
|
||||||
|
} VARIABLE_FLASH_INFO;
|
||||||
|
|
||||||
|
#pragma pack (pop)
|
||||||
|
|
||||||
|
#endif
|
68
MdeModulePkg/Include/Library/VariableFlashInfoLib.h
Normal file
68
MdeModulePkg/Include/Library/VariableFlashInfoLib.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/** @file
|
||||||
|
Variable Flash Information Library
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation<BR>
|
||||||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef VARIABLE_FLASH_INFO_LIB_H_
|
||||||
|
#define VARIABLE_FLASH_INFO_LIB_H_
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the base address and size for the NV storage area used for UEFI variable storage.
|
||||||
|
|
||||||
|
@param[out] BaseAddress The NV storage base address.
|
||||||
|
@param[out] Length The NV storage length in bytes.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS NV storage information was found successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
|
||||||
|
@retval EFI_NOT_FOUND NV storage information could not be found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetVariableFlashNvStorageInfo (
|
||||||
|
OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
|
||||||
|
OUT UINT64 *Length
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the base address and size for the fault tolerant write (FTW) spare
|
||||||
|
area used for UEFI variable storage.
|
||||||
|
|
||||||
|
@param[out] BaseAddress The FTW spare base address.
|
||||||
|
@param[out] Length The FTW spare length in bytes.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS FTW spare information was found successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
|
||||||
|
@retval EFI_NOT_FOUND FTW spare information could not be found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetVariableFlashFtwSpareInfo (
|
||||||
|
OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
|
||||||
|
OUT UINT64 *Length
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the base address and size for the fault tolerant write (FTW) working
|
||||||
|
area used for UEFI variable storage.
|
||||||
|
|
||||||
|
@param[out] BaseAddress The FTW working area base address.
|
||||||
|
@param[out] Length The FTW working area length in bytes.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS FTW working information was found successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
|
||||||
|
@retval EFI_NOT_FOUND FTW working information could not be found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetVariableFlashFtwWorkingInfo (
|
||||||
|
OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
|
||||||
|
OUT UINT64 *Length
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,179 @@
|
|||||||
|
/** @file
|
||||||
|
Variable Flash Information Library
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation<BR>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
#include <Pi/PiMultiPhase.h>
|
||||||
|
#include <Guid/VariableFlashInfo.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/HobLib.h>
|
||||||
|
#include <Library/VariableFlashInfoLib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the HOB that contains variable flash information.
|
||||||
|
|
||||||
|
@param[out] VariableFlashInfo Pointer to a pointer to set to the variable flash information structure.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Variable flash information was found successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER The VariableFlashInfo pointer given is NULL.
|
||||||
|
@retval EFI_NOT_FOUND Variable flash information could not be found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
|
EFI_STATUS
|
||||||
|
GetVariableFlashInfoFromHob (
|
||||||
|
OUT VARIABLE_FLASH_INFO **VariableFlashInfo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_HOB_GUID_TYPE *GuidHob;
|
||||||
|
|
||||||
|
if (VariableFlashInfo == NULL) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
GuidHob = GetFirstGuidHob (&gVariableFlashInfoHobGuid);
|
||||||
|
if (GuidHob == NULL) {
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
*VariableFlashInfo = GET_GUID_HOB_DATA (GuidHob);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Assert if more than one variable flash information HOB is present.
|
||||||
|
//
|
||||||
|
DEBUG_CODE (
|
||||||
|
if ((GetNextGuidHob (&gVariableFlashInfoHobGuid, GET_NEXT_HOB (GuidHob)) != NULL)) {
|
||||||
|
DEBUG ((DEBUG_ERROR, "ERROR: Found two variable flash information HOBs\n"));
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the base address and size for the NV storage area used for UEFI variable storage.
|
||||||
|
|
||||||
|
@param[out] BaseAddress The NV storage base address.
|
||||||
|
@param[out] Length The NV storage length in bytes.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS NV storage information was found successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetVariableFlashNvStorageInfo (
|
||||||
|
OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
|
||||||
|
OUT UINT64 *Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
VARIABLE_FLASH_INFO *VariableFlashInfo;
|
||||||
|
|
||||||
|
if ((BaseAddress == NULL) || (Length == NULL)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = GetVariableFlashInfoFromHob (&VariableFlashInfo);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
*BaseAddress = VariableFlashInfo->NvVariableBaseAddress;
|
||||||
|
*Length = VariableFlashInfo->NvVariableLength;
|
||||||
|
} else {
|
||||||
|
*BaseAddress = (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStorageVariableBase64) != 0 ?
|
||||||
|
PcdGet64 (PcdFlashNvStorageVariableBase64) :
|
||||||
|
PcdGet32 (PcdFlashNvStorageVariableBase)
|
||||||
|
);
|
||||||
|
*Length = (UINT64)PcdGet32 (PcdFlashNvStorageVariableSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the base address and size for the fault tolerant write (FTW) spare
|
||||||
|
area used for UEFI variable storage.
|
||||||
|
|
||||||
|
@param[out] BaseAddress The FTW spare base address.
|
||||||
|
@param[out] Length The FTW spare length in bytes.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS FTW spare information was found successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
|
||||||
|
@retval EFI_NOT_FOUND FTW spare information could not be found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetVariableFlashFtwSpareInfo (
|
||||||
|
OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
|
||||||
|
OUT UINT64 *Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
VARIABLE_FLASH_INFO *VariableFlashInfo;
|
||||||
|
|
||||||
|
if ((BaseAddress == NULL) || (Length == NULL)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = GetVariableFlashInfoFromHob (&VariableFlashInfo);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
*BaseAddress = VariableFlashInfo->FtwSpareBaseAddress;
|
||||||
|
*Length = VariableFlashInfo->FtwSpareLength;
|
||||||
|
} else {
|
||||||
|
*BaseAddress = (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStorageFtwSpareBase64) != 0 ?
|
||||||
|
PcdGet64 (PcdFlashNvStorageFtwSpareBase64) :
|
||||||
|
PcdGet32 (PcdFlashNvStorageFtwSpareBase)
|
||||||
|
);
|
||||||
|
*Length = (UINT64)PcdGet32 (PcdFlashNvStorageFtwSpareSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the base address and size for the fault tolerant write (FTW) working
|
||||||
|
area used for UEFI variable storage.
|
||||||
|
|
||||||
|
@param[out] BaseAddress The FTW working area base address.
|
||||||
|
@param[out] Length The FTW working area length in bytes.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS FTW working information was found successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
|
||||||
|
@retval EFI_NOT_FOUND FTW working information could not be found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetVariableFlashFtwWorkingInfo (
|
||||||
|
OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
|
||||||
|
OUT UINT64 *Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
VARIABLE_FLASH_INFO *VariableFlashInfo;
|
||||||
|
|
||||||
|
if ((BaseAddress == NULL) || (Length == NULL)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = GetVariableFlashInfoFromHob (&VariableFlashInfo);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
*BaseAddress = VariableFlashInfo->FtwWorkingBaseAddress;
|
||||||
|
*Length = VariableFlashInfo->FtwWorkingLength;
|
||||||
|
} else {
|
||||||
|
*BaseAddress = (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStorageFtwWorkingBase64) != 0 ?
|
||||||
|
PcdGet64 (PcdFlashNvStorageFtwWorkingBase64) :
|
||||||
|
PcdGet32 (PcdFlashNvStorageFtwWorkingBase)
|
||||||
|
);
|
||||||
|
*Length = (UINT64)PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
## @file
|
||||||
|
# Variable Flash Information Library
|
||||||
|
#
|
||||||
|
# Provides services to access UEFI variable flash information.
|
||||||
|
#
|
||||||
|
# Copyright (c) Microsoft Corporation<BR>
|
||||||
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
##
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = BaseVariableFlashInfoLib
|
||||||
|
MODULE_UNI_FILE = BaseVariableFlashInfoLib.uni
|
||||||
|
FILE_GUID = DEC426C9-C92E-4BAD-8E93-3F61C261118B
|
||||||
|
MODULE_TYPE = BASE
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
LIBRARY_CLASS = VariableFlashInfoLib
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = ANY
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
BaseVariableFlashInfoLib.c
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
DebugLib
|
||||||
|
HobLib
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gVariableFlashInfoHobGuid ## CONSUMES ## HOB
|
||||||
|
|
||||||
|
[Pcd]
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOMETIMES_CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## SOMETIMES_CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## SOMETIMES_CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOMETIMES_CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## SOMETIMES_CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## SOMETIMES_CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOMETIMES_CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## SOMETIMES_CONSUMES
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## SOMETIMES_CONSUMES
|
@ -0,0 +1,12 @@
|
|||||||
|
// /** @file
|
||||||
|
// Variable Flash Information Library
|
||||||
|
//
|
||||||
|
// Copyright (c) Microsoft Corporation<BR>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
//
|
||||||
|
// **/
|
||||||
|
|
||||||
|
#string STR_MODULE_ABSTRACT #language en-US "UEFI variable flash information library"
|
||||||
|
|
||||||
|
#string STR_MODULE_DESCRIPTION #language en-US "Provides services to access UEFI variable flash information."
|
@ -154,6 +154,10 @@
|
|||||||
#
|
#
|
||||||
VariablePolicyHelperLib|Include/Library/VariablePolicyHelperLib.h
|
VariablePolicyHelperLib|Include/Library/VariablePolicyHelperLib.h
|
||||||
|
|
||||||
|
## @libraryclass Provides services to access UEFI variable flash information.
|
||||||
|
#
|
||||||
|
VariableFlashInfoLib|Include/Library/VariableFlashInfoLib.h
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
## MdeModule package token space guid
|
## MdeModule package token space guid
|
||||||
# Include/Guid/MdeModulePkgTokenSpace.h
|
# Include/Guid/MdeModulePkgTokenSpace.h
|
||||||
@ -226,6 +230,10 @@
|
|||||||
# Include/Guid/SmmVariableCommon.h
|
# Include/Guid/SmmVariableCommon.h
|
||||||
gSmmVariableWriteGuid = { 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 }}
|
gSmmVariableWriteGuid = { 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 }}
|
||||||
|
|
||||||
|
## Guid of the variable flash information HOB.
|
||||||
|
# Include/Guid/VariableFlashInfo.h
|
||||||
|
gVariableFlashInfoHobGuid = { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20, 0xfc, 0x90 }}
|
||||||
|
|
||||||
## Performance protocol guid that also acts as the performance HOB guid and performance variable GUID
|
## Performance protocol guid that also acts as the performance HOB guid and performance variable GUID
|
||||||
# Include/Guid/Performance.h
|
# Include/Guid/Performance.h
|
||||||
gPerformanceProtocolGuid = { 0x76B6BDFA, 0x2ACD, 0x4462, { 0x9E, 0x3F, 0xCB, 0x58, 0xC9, 0x69, 0xD9, 0x37 } }
|
gPerformanceProtocolGuid = { 0x76B6BDFA, 0x2ACD, 0x4462, { 0x9E, 0x3F, 0xCB, 0x58, 0xC9, 0x69, 0xD9, 0x37 } }
|
||||||
|
@ -103,6 +103,7 @@
|
|||||||
DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
|
DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
|
MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
[LibraryClasses.EBC.PEIM]
|
[LibraryClasses.EBC.PEIM]
|
||||||
IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
|
IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
|
||||||
@ -440,6 +441,7 @@
|
|||||||
MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.inf
|
MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.inf
|
||||||
MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
|
MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
|
||||||
MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
|
MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
|
||||||
|
MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
[Components.IA32, Components.X64, Components.AARCH64]
|
[Components.IA32, Components.X64, Components.AARCH64]
|
||||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||||
|
@ -26,6 +26,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/ReportStatusCodeLib.h>
|
#include <Library/ReportStatusCodeLib.h>
|
||||||
|
#include <Library/SafeIntLib.h>
|
||||||
|
#include <Library/VariableFlashInfoLib.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Flash erase polarity is 1
|
// Flash erase polarity is 1
|
||||||
@ -708,10 +710,13 @@ InitFtwProtocol (
|
|||||||
|
|
||||||
Since Signature and WriteQueueSize have been known, Crc can be calculated out,
|
Since Signature and WriteQueueSize have been known, Crc can be calculated out,
|
||||||
then the work space header will be fixed.
|
then the work space header will be fixed.
|
||||||
|
|
||||||
|
@param[in] WorkSpaceLength Length in bytes of the FTW workspace area.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializeLocalWorkSpaceHeader (
|
InitializeLocalWorkSpaceHeader (
|
||||||
VOID
|
IN UINTN WorkSpaceLength
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
UefiLib
|
UefiLib
|
||||||
PcdLib
|
PcdLib
|
||||||
ReportStatusCodeLib
|
ReportStatusCodeLib
|
||||||
|
SafeIntLib
|
||||||
|
VariableFlashInfoLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
#
|
#
|
||||||
@ -65,14 +67,6 @@
|
|||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFullFtwServiceEnable ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFullFtwServiceEnable ## CONSUMES
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CONSUMES
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# gBS->CalculateCrc32() is consumed in EntryPoint.
|
# gBS->CalculateCrc32() is consumed in EntryPoint.
|
||||||
# PI spec said: When the DXE Foundation is notified that the EFI_RUNTIME_ARCH_PROTOCOL
|
# PI spec said: When the DXE Foundation is notified that the EFI_RUNTIME_ARCH_PROTOCOL
|
||||||
|
@ -52,6 +52,8 @@
|
|||||||
ReportStatusCodeLib
|
ReportStatusCodeLib
|
||||||
SmmMemLib
|
SmmMemLib
|
||||||
BaseLib
|
BaseLib
|
||||||
|
SafeIntLib
|
||||||
|
VariableFlashInfoLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
#
|
#
|
||||||
@ -74,14 +76,6 @@
|
|||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFullFtwServiceEnable ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFullFtwServiceEnable ## CONSUMES
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CONSUMES
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# gBS->CalculateCrc32() is consumed in EntryPoint.
|
# gBS->CalculateCrc32() is consumed in EntryPoint.
|
||||||
# PI spec said: When the DXE Foundation is notified that the EFI_RUNTIME_ARCH_PROTOCOL
|
# PI spec said: When the DXE Foundation is notified that the EFI_RUNTIME_ARCH_PROTOCOL
|
||||||
|
@ -50,7 +50,9 @@
|
|||||||
MmServicesTableLib
|
MmServicesTableLib
|
||||||
PcdLib
|
PcdLib
|
||||||
ReportStatusCodeLib
|
ReportStatusCodeLib
|
||||||
|
SafeIntLib
|
||||||
StandaloneMmDriverEntryPoint
|
StandaloneMmDriverEntryPoint
|
||||||
|
VariableFlashInfoLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
#
|
#
|
||||||
@ -73,13 +75,5 @@
|
|||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFullFtwServiceEnable ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFullFtwServiceEnable ## CONSUMES
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CONSUMES
|
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
TRUE
|
TRUE
|
||||||
|
@ -987,22 +987,43 @@ InitFtwDevice (
|
|||||||
OUT EFI_FTW_DEVICE **FtwData
|
OUT EFI_FTW_DEVICE **FtwData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_FTW_DEVICE *FtwDevice;
|
EFI_STATUS Status;
|
||||||
|
EFI_PHYSICAL_ADDRESS WorkSpaceAddress;
|
||||||
|
UINT64 Size;
|
||||||
|
UINTN FtwWorkingSize;
|
||||||
|
EFI_FTW_DEVICE *FtwDevice;
|
||||||
|
|
||||||
|
FtwWorkingSize = 0;
|
||||||
|
|
||||||
|
Status = GetVariableFlashFtwWorkingInfo (&WorkSpaceAddress, &Size);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = SafeUint64ToUintn (Size, &FtwWorkingSize);
|
||||||
|
// This driver currently assumes the size will be UINTN so assert the value is safe for now.
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate private data of this driver,
|
// Allocate private data of this driver,
|
||||||
// Including the FtwWorkSpace[FTW_WORK_SPACE_SIZE].
|
// Including the FtwWorkSpace[FTW_WORK_SPACE_SIZE].
|
||||||
//
|
//
|
||||||
FtwDevice = AllocateZeroPool (sizeof (EFI_FTW_DEVICE) + PcdGet32 (PcdFlashNvStorageFtwWorkingSize));
|
FtwDevice = AllocateZeroPool (sizeof (EFI_FTW_DEVICE) + FtwWorkingSize);
|
||||||
if (FtwDevice == NULL) {
|
if (FtwDevice == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FtwDevice->WorkSpaceAddress = WorkSpaceAddress;
|
||||||
|
FtwDevice->WorkSpaceLength = FtwWorkingSize;
|
||||||
|
|
||||||
|
Status = GetVariableFlashFtwSpareInfo (&FtwDevice->SpareAreaAddress, &Size);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = SafeUint64ToUintn (Size, &FtwDevice->SpareAreaLength);
|
||||||
|
// This driver currently assumes the size will be UINTN so assert the value is safe for now.
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize other parameters, and set WorkSpace as FTW_ERASED_BYTE.
|
// Initialize other parameters, and set WorkSpace as FTW_ERASED_BYTE.
|
||||||
//
|
//
|
||||||
FtwDevice->WorkSpaceLength = (UINTN)PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
|
|
||||||
FtwDevice->SpareAreaLength = (UINTN)PcdGet32 (PcdFlashNvStorageFtwSpareSize);
|
|
||||||
if ((FtwDevice->WorkSpaceLength == 0) || (FtwDevice->SpareAreaLength == 0)) {
|
if ((FtwDevice->WorkSpaceLength == 0) || (FtwDevice->SpareAreaLength == 0)) {
|
||||||
DEBUG ((DEBUG_ERROR, "Ftw: Workspace or Spare block does not exist!\n"));
|
DEBUG ((DEBUG_ERROR, "Ftw: Workspace or Spare block does not exist!\n"));
|
||||||
FreePool (FtwDevice);
|
FreePool (FtwDevice);
|
||||||
@ -1015,16 +1036,6 @@ InitFtwDevice (
|
|||||||
FtwDevice->FtwWorkSpaceLba = (EFI_LBA)(-1);
|
FtwDevice->FtwWorkSpaceLba = (EFI_LBA)(-1);
|
||||||
FtwDevice->FtwSpareLba = (EFI_LBA)(-1);
|
FtwDevice->FtwSpareLba = (EFI_LBA)(-1);
|
||||||
|
|
||||||
FtwDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFlashNvStorageFtwWorkingBase64);
|
|
||||||
if (FtwDevice->WorkSpaceAddress == 0) {
|
|
||||||
FtwDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFlashNvStorageFtwWorkingBase);
|
|
||||||
}
|
|
||||||
|
|
||||||
FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFlashNvStorageFtwSpareBase64);
|
|
||||||
if (FtwDevice->SpareAreaAddress == 0) {
|
|
||||||
FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFlashNvStorageFtwSpareBase);
|
|
||||||
}
|
|
||||||
|
|
||||||
*FtwData = FtwDevice;
|
*FtwData = FtwDevice;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1277,7 +1288,7 @@ InitFtwProtocol (
|
|||||||
FtwDevice->FtwLastWriteHeader = NULL;
|
FtwDevice->FtwLastWriteHeader = NULL;
|
||||||
FtwDevice->FtwLastWriteRecord = NULL;
|
FtwDevice->FtwLastWriteRecord = NULL;
|
||||||
|
|
||||||
InitializeLocalWorkSpaceHeader ();
|
InitializeLocalWorkSpaceHeader (FtwDevice->WorkSpaceLength);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Refresh the working space data from working block
|
// Refresh the working space data from working block
|
||||||
|
@ -16,10 +16,13 @@ EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER mWorkingBlockHeader = { ZERO_GUID, 0, 0
|
|||||||
|
|
||||||
Since Signature and WriteQueueSize have been known, Crc can be calculated out,
|
Since Signature and WriteQueueSize have been known, Crc can be calculated out,
|
||||||
then the work space header will be fixed.
|
then the work space header will be fixed.
|
||||||
|
|
||||||
|
@param[in] WorkSpaceLength Length in bytes of the FTW workspace area.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
InitializeLocalWorkSpaceHeader (
|
InitializeLocalWorkSpaceHeader (
|
||||||
VOID
|
IN UINTN WorkSpaceLength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@ -46,7 +49,7 @@ InitializeLocalWorkSpaceHeader (
|
|||||||
&gEdkiiWorkingBlockSignatureGuid,
|
&gEdkiiWorkingBlockSignatureGuid,
|
||||||
sizeof (EFI_GUID)
|
sizeof (EFI_GUID)
|
||||||
);
|
);
|
||||||
mWorkingBlockHeader.WriteQueueSize = PcdGet32 (PcdFlashNvStorageFtwWorkingSize) - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER);
|
mWorkingBlockHeader.WriteQueueSize = WorkSpaceLength - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Crc is calculated with all the fields except Crc and STATE, so leave them as FTW_ERASED_BYTE.
|
// Crc is calculated with all the fields except Crc and STATE, so leave them as FTW_ERASED_BYTE.
|
||||||
|
@ -16,6 +16,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/HobLib.h>
|
#include <Library/HobLib.h>
|
||||||
|
#include <Library/SafeIntLib.h>
|
||||||
|
#include <Library/VariableFlashInfoLib.h>
|
||||||
|
|
||||||
EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {
|
EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {
|
||||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||||
@ -212,25 +214,31 @@ PeimFaultTolerantWriteInitialize (
|
|||||||
EFI_PHYSICAL_ADDRESS SpareAreaAddress;
|
EFI_PHYSICAL_ADDRESS SpareAreaAddress;
|
||||||
UINTN SpareAreaLength;
|
UINTN SpareAreaLength;
|
||||||
EFI_PHYSICAL_ADDRESS WorkSpaceInSpareArea;
|
EFI_PHYSICAL_ADDRESS WorkSpaceInSpareArea;
|
||||||
|
UINT64 Size;
|
||||||
FAULT_TOLERANT_WRITE_LAST_WRITE_DATA FtwLastWrite;
|
FAULT_TOLERANT_WRITE_LAST_WRITE_DATA FtwLastWrite;
|
||||||
|
|
||||||
FtwWorkingBlockHeader = NULL;
|
FtwWorkingBlockHeader = NULL;
|
||||||
FtwLastWriteHeader = NULL;
|
FtwLastWriteHeader = NULL;
|
||||||
FtwLastWriteRecord = NULL;
|
FtwLastWriteRecord = NULL;
|
||||||
|
|
||||||
WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFlashNvStorageFtwWorkingBase64);
|
SpareAreaAddress = 0;
|
||||||
if (WorkSpaceAddress == 0) {
|
SpareAreaLength = 0;
|
||||||
WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFlashNvStorageFtwWorkingBase);
|
WorkSpaceAddress = 0;
|
||||||
}
|
WorkSpaceLength = 0;
|
||||||
|
|
||||||
WorkSpaceLength = (UINTN)PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
|
Status = GetVariableFlashFtwWorkingInfo (&WorkSpaceAddress, &Size);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
SpareAreaAddress = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFlashNvStorageFtwSpareBase64);
|
Status = SafeUint64ToUintn (Size, &WorkSpaceLength);
|
||||||
if (SpareAreaAddress == 0) {
|
// This driver currently assumes the size will be UINTN so assert the value is safe for now.
|
||||||
SpareAreaAddress = (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFlashNvStorageFtwSpareBase);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
|
||||||
|
|
||||||
SpareAreaLength = (UINTN)PcdGet32 (PcdFlashNvStorageFtwSpareSize);
|
Status = GetVariableFlashFtwSpareInfo (&SpareAreaAddress, &Size);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = SafeUint64ToUintn (Size, &SpareAreaLength);
|
||||||
|
// This driver currently assumes the size will be UINTN so assert the value is safe for now.
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// The address of FTW working base and spare base must not be 0.
|
// The address of FTW working base and spare base must not be 0.
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
HobLib
|
HobLib
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
SafeIntLib
|
||||||
|
VariableFlashInfoLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
## SOMETIMES_PRODUCES ## HOB
|
## SOMETIMES_PRODUCES ## HOB
|
||||||
@ -47,14 +49,6 @@
|
|||||||
gEdkiiWorkingBlockSignatureGuid ## SOMETIMES_CONSUMES ## GUID
|
gEdkiiWorkingBlockSignatureGuid ## SOMETIMES_CONSUMES ## GUID
|
||||||
gEfiSystemNvDataFvGuid ## SOMETIMES_CONSUMES ## GUID
|
gEfiSystemNvDataFvGuid ## SOMETIMES_CONSUMES ## GUID
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CONSUMES
|
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
TRUE
|
TRUE
|
||||||
|
|
||||||
|
@ -567,11 +567,13 @@ GetVariableStore (
|
|||||||
OUT VARIABLE_STORE_INFO *StoreInfo
|
OUT VARIABLE_STORE_INFO *StoreInfo
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
EFI_HOB_GUID_TYPE *GuidHob;
|
EFI_HOB_GUID_TYPE *GuidHob;
|
||||||
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
|
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
|
||||||
VARIABLE_STORE_HEADER *VariableStoreHeader;
|
VARIABLE_STORE_HEADER *VariableStoreHeader;
|
||||||
EFI_PHYSICAL_ADDRESS NvStorageBase;
|
EFI_PHYSICAL_ADDRESS NvStorageBase;
|
||||||
UINT32 NvStorageSize;
|
UINT32 NvStorageSize;
|
||||||
|
UINT64 NvStorageSize64;
|
||||||
FAULT_TOLERANT_WRITE_LAST_WRITE_DATA *FtwLastWriteData;
|
FAULT_TOLERANT_WRITE_LAST_WRITE_DATA *FtwLastWriteData;
|
||||||
UINT32 BackUpOffset;
|
UINT32 BackUpOffset;
|
||||||
|
|
||||||
@ -591,11 +593,13 @@ GetVariableStore (
|
|||||||
// Emulated non-volatile variable mode is not enabled.
|
// Emulated non-volatile variable mode is not enabled.
|
||||||
//
|
//
|
||||||
|
|
||||||
NvStorageSize = PcdGet32 (PcdFlashNvStorageVariableSize);
|
Status = GetVariableFlashNvStorageInfo (&NvStorageBase, &NvStorageSize64);
|
||||||
NvStorageBase = (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStorageVariableBase64) != 0 ?
|
ASSERT_EFI_ERROR (Status);
|
||||||
PcdGet64 (PcdFlashNvStorageVariableBase64) :
|
|
||||||
PcdGet32 (PcdFlashNvStorageVariableBase)
|
Status = SafeUint64ToUint32 (NvStorageSize64, &NvStorageSize);
|
||||||
);
|
// This driver currently assumes the size will be UINT32 so assert the value is safe for now.
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
ASSERT (NvStorageBase != 0);
|
ASSERT (NvStorageBase != 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -20,6 +20,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/PeiServicesTablePointerLib.h>
|
#include <Library/PeiServicesTablePointerLib.h>
|
||||||
#include <Library/PeiServicesLib.h>
|
#include <Library/PeiServicesLib.h>
|
||||||
|
#include <Library/SafeIntLib.h>
|
||||||
|
#include <Library/VariableFlashInfoLib.h>
|
||||||
|
|
||||||
#include <Guid/VariableFormat.h>
|
#include <Guid/VariableFormat.h>
|
||||||
#include <Guid/VariableIndexTable.h>
|
#include <Guid/VariableIndexTable.h>
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
PeiServicesTablePointerLib
|
PeiServicesTablePointerLib
|
||||||
PeiServicesLib
|
PeiServicesLib
|
||||||
|
SafeIntLib
|
||||||
|
VariableFlashInfoLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
## CONSUMES ## GUID # Variable store header
|
## CONSUMES ## GUID # Variable store header
|
||||||
@ -59,9 +61,6 @@
|
|||||||
gEfiPeiReadOnlyVariable2PpiGuid ## PRODUCES
|
gEfiPeiReadOnlyVariable2PpiGuid ## PRODUCES
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable ## SOMETIMES_CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable ## SOMETIMES_CONSUMES
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
|
@ -31,6 +31,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/AuthVariableLib.h>
|
#include <Library/AuthVariableLib.h>
|
||||||
#include <Library/VarCheckLib.h>
|
#include <Library/VarCheckLib.h>
|
||||||
|
#include <Library/VariableFlashInfoLib.h>
|
||||||
|
#include <Library/SafeIntLib.h>
|
||||||
#include <Guid/GlobalVariable.h>
|
#include <Guid/GlobalVariable.h>
|
||||||
#include <Guid/EventGroup.h>
|
#include <Guid/EventGroup.h>
|
||||||
#include <Guid/VariableFormat.h>
|
#include <Guid/VariableFormat.h>
|
||||||
@ -40,11 +42,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "PrivilegePolymorphic.h"
|
#include "PrivilegePolymorphic.h"
|
||||||
|
|
||||||
#define NV_STORAGE_VARIABLE_BASE (EFI_PHYSICAL_ADDRESS)\
|
|
||||||
(PcdGet64 (PcdFlashNvStorageVariableBase64) != 0 ? \
|
|
||||||
PcdGet64 (PcdFlashNvStorageVariableBase64) : \
|
|
||||||
PcdGet32 (PcdFlashNvStorageVariableBase))
|
|
||||||
|
|
||||||
#define EFI_VARIABLE_ATTRIBUTES_MASK (EFI_VARIABLE_NON_VOLATILE |\
|
#define EFI_VARIABLE_ATTRIBUTES_MASK (EFI_VARIABLE_NON_VOLATILE |\
|
||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | \
|
EFI_VARIABLE_BOOTSERVICE_ACCESS | \
|
||||||
EFI_VARIABLE_RUNTIME_ACCESS | \
|
EFI_VARIABLE_RUNTIME_ACCESS | \
|
||||||
|
@ -423,6 +423,8 @@ FtwNotificationEvent (
|
|||||||
EFI_PHYSICAL_ADDRESS VariableStoreBase;
|
EFI_PHYSICAL_ADDRESS VariableStoreBase;
|
||||||
UINT64 VariableStoreLength;
|
UINT64 VariableStoreLength;
|
||||||
UINTN FtwMaxBlockSize;
|
UINTN FtwMaxBlockSize;
|
||||||
|
UINT32 NvStorageVariableSize;
|
||||||
|
UINT64 NvStorageVariableSize64;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ensure FTW protocol is installed.
|
// Ensure FTW protocol is installed.
|
||||||
@ -432,14 +434,20 @@ FtwNotificationEvent (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = GetVariableFlashNvStorageInfo (&NvStorageVariableBase, &NvStorageVariableSize64);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = SafeUint64ToUint32 (NvStorageVariableSize64, &NvStorageVariableSize);
|
||||||
|
// This driver currently assumes the size will be UINT32 so assert the value is safe for now.
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
|
||||||
|
|
||||||
Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);
|
Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <= FtwMaxBlockSize);
|
ASSERT (NvStorageVariableSize <= FtwMaxBlockSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvStorageVariableBase = NV_STORAGE_VARIABLE_BASE;
|
|
||||||
VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Let NonVolatileVariableBase point to flash variable store base directly after FTW ready.
|
// Let NonVolatileVariableBase point to flash variable store base directly after FTW ready.
|
||||||
//
|
//
|
||||||
|
@ -142,6 +142,7 @@ InitRealNonVolatileVariableStore (
|
|||||||
EFI_PHYSICAL_ADDRESS NvStorageBase;
|
EFI_PHYSICAL_ADDRESS NvStorageBase;
|
||||||
UINT8 *NvStorageData;
|
UINT8 *NvStorageData;
|
||||||
UINT32 NvStorageSize;
|
UINT32 NvStorageSize;
|
||||||
|
UINT64 NvStorageSize64;
|
||||||
FAULT_TOLERANT_WRITE_LAST_WRITE_DATA *FtwLastWriteData;
|
FAULT_TOLERANT_WRITE_LAST_WRITE_DATA *FtwLastWriteData;
|
||||||
UINT32 BackUpOffset;
|
UINT32 BackUpOffset;
|
||||||
UINT32 BackUpSize;
|
UINT32 BackUpSize;
|
||||||
@ -153,19 +154,24 @@ InitRealNonVolatileVariableStore (
|
|||||||
|
|
||||||
mVariableModuleGlobal->FvbInstance = NULL;
|
mVariableModuleGlobal->FvbInstance = NULL;
|
||||||
|
|
||||||
|
Status = GetVariableFlashNvStorageInfo (&NvStorageBase, &NvStorageSize64);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = SafeUint64ToUint32 (NvStorageSize64, &NvStorageSize);
|
||||||
|
// This driver currently assumes the size will be UINT32 so assert the value is safe for now.
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
ASSERT (NvStorageBase != 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate runtime memory used for a memory copy of the FLASH region.
|
// Allocate runtime memory used for a memory copy of the FLASH region.
|
||||||
// Keep the memory and the FLASH in sync as updates occur.
|
// Keep the memory and the FLASH in sync as updates occur.
|
||||||
//
|
//
|
||||||
NvStorageSize = PcdGet32 (PcdFlashNvStorageVariableSize);
|
|
||||||
NvStorageData = AllocateRuntimeZeroPool (NvStorageSize);
|
NvStorageData = AllocateRuntimeZeroPool (NvStorageSize);
|
||||||
if (NvStorageData == NULL) {
|
if (NvStorageData == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvStorageBase = NV_STORAGE_VARIABLE_BASE;
|
|
||||||
ASSERT (NvStorageBase != 0);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copy NV storage data to the memory buffer.
|
// Copy NV storage data to the memory buffer.
|
||||||
//
|
//
|
||||||
|
@ -71,8 +71,10 @@
|
|||||||
TpmMeasurementLib
|
TpmMeasurementLib
|
||||||
AuthVariableLib
|
AuthVariableLib
|
||||||
VarCheckLib
|
VarCheckLib
|
||||||
|
VariableFlashInfoLib
|
||||||
VariablePolicyLib
|
VariablePolicyLib
|
||||||
VariablePolicyHelperLib
|
VariablePolicyHelperLib
|
||||||
|
SafeIntLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiFirmwareVolumeBlockProtocolGuid ## CONSUMES
|
gEfiFirmwareVolumeBlockProtocolGuid ## CONSUMES
|
||||||
@ -125,9 +127,6 @@
|
|||||||
gEfiImageSecurityDatabaseGuid
|
gEfiImageSecurityDatabaseGuid
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CONSUMES
|
||||||
|
@ -1084,6 +1084,8 @@ SmmFtwNotificationEvent (
|
|||||||
EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol;
|
EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol;
|
||||||
EFI_PHYSICAL_ADDRESS NvStorageVariableBase;
|
EFI_PHYSICAL_ADDRESS NvStorageVariableBase;
|
||||||
UINTN FtwMaxBlockSize;
|
UINTN FtwMaxBlockSize;
|
||||||
|
UINT32 NvStorageVariableSize;
|
||||||
|
UINT64 NvStorageVariableSize64;
|
||||||
|
|
||||||
if (mVariableModuleGlobal->FvbInstance != NULL) {
|
if (mVariableModuleGlobal->FvbInstance != NULL) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -1097,14 +1099,21 @@ SmmFtwNotificationEvent (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = GetVariableFlashNvStorageInfo (&NvStorageVariableBase, &NvStorageVariableSize64);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = SafeUint64ToUint32 (NvStorageVariableSize64, &NvStorageVariableSize);
|
||||||
|
// This driver currently assumes the size will be UINT32 so assert the value is safe for now.
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
ASSERT (NvStorageVariableBase != 0);
|
||||||
|
VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
|
||||||
|
|
||||||
Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);
|
Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <= FtwMaxBlockSize);
|
ASSERT (NvStorageVariableSize <= FtwMaxBlockSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvStorageVariableBase = NV_STORAGE_VARIABLE_BASE;
|
|
||||||
VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Let NonVolatileVariableBase point to flash variable store base directly after FTW ready.
|
// Let NonVolatileVariableBase point to flash variable store base directly after FTW ready.
|
||||||
//
|
//
|
||||||
|
@ -80,8 +80,10 @@
|
|||||||
AuthVariableLib
|
AuthVariableLib
|
||||||
VarCheckLib
|
VarCheckLib
|
||||||
UefiBootServicesTableLib
|
UefiBootServicesTableLib
|
||||||
|
VariableFlashInfoLib
|
||||||
VariablePolicyLib
|
VariablePolicyLib
|
||||||
VariablePolicyHelperLib
|
VariablePolicyHelperLib
|
||||||
|
SafeIntLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES
|
gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES
|
||||||
@ -127,9 +129,6 @@
|
|||||||
gEdkiiVarErrorFlagGuid
|
gEdkiiVarErrorFlagGuid
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CONSUMES
|
||||||
|
@ -73,9 +73,11 @@
|
|||||||
HobLib
|
HobLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
MmServicesTableLib
|
MmServicesTableLib
|
||||||
|
SafeIntLib
|
||||||
StandaloneMmDriverEntryPoint
|
StandaloneMmDriverEntryPoint
|
||||||
SynchronizationLib
|
SynchronizationLib
|
||||||
VarCheckLib
|
VarCheckLib
|
||||||
|
VariableFlashInfoLib
|
||||||
VariablePolicyLib
|
VariablePolicyLib
|
||||||
VariablePolicyHelperLib
|
VariablePolicyHelperLib
|
||||||
|
|
||||||
@ -120,9 +122,6 @@
|
|||||||
gEdkiiVarErrorFlagGuid
|
gEdkiiVarErrorFlagGuid
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOMETIMES_CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSUMES
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CONSUMES
|
||||||
|
@ -196,6 +196,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
!if $(BUILD_SHELL) == TRUE
|
!if $(BUILD_SHELL) == TRUE
|
||||||
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
||||||
@ -577,7 +578,7 @@
|
|||||||
|
|
||||||
!include OvmfPkg/OvmfTpmPcds.dsc.inc
|
!include OvmfPkg/OvmfTpmPcds.dsc.inc
|
||||||
|
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|100000000
|
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1000000000
|
||||||
|
|
||||||
[PcdsDynamicHii]
|
[PcdsDynamicHii]
|
||||||
!include OvmfPkg/OvmfTpmPcdsHii.dsc.inc
|
!include OvmfPkg/OvmfTpmPcdsHii.dsc.inc
|
||||||
|
@ -206,6 +206,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# Network libraries
|
# Network libraries
|
||||||
|
@ -217,6 +217,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -190,6 +190,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
||||||
ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
|
ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
|
||||||
@ -510,7 +511,7 @@
|
|||||||
# Set ConfidentialComputing defaults
|
# Set ConfidentialComputing defaults
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
|
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
|
||||||
|
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|100000000
|
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1000000000
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
|
@ -207,6 +207,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -214,6 +214,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -650,7 +651,7 @@
|
|||||||
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
|
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
|
||||||
|
|
||||||
!if $(CSM_ENABLE) == FALSE
|
!if $(CSM_ENABLE) == FALSE
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|100000000
|
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1000000000
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
[PcdsDynamicHii]
|
[PcdsDynamicHii]
|
||||||
|
@ -76,6 +76,9 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpaceGuid.
|
|||||||
0x007000|0x001000
|
0x007000|0x001000
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize
|
gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize
|
||||||
|
|
||||||
|
0x008000|0x001000
|
||||||
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize
|
||||||
|
|
||||||
0x010000|0x010000
|
0x010000|0x010000
|
||||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
|
||||||
|
|
||||||
@ -87,6 +90,14 @@ FV = PEIFV
|
|||||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
|
||||||
FV = DXEFV
|
FV = DXEFV
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Set the SEV-ES specific work area PCDs (used for all forms of SEV since the
|
||||||
|
# the SEV STATUS MSR is now saved in the work area)
|
||||||
|
#
|
||||||
|
SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase = $(MEMFD_BASE_ADDRESS) + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
|
||||||
|
SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaSize = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize - gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
[FV.SECFV]
|
[FV.SECFV]
|
||||||
|
@ -218,6 +218,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -658,7 +659,7 @@
|
|||||||
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
|
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
|
||||||
|
|
||||||
!if $(CSM_ENABLE) == FALSE
|
!if $(CSM_ENABLE) == FALSE
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|100000000
|
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1000000000
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
[PcdsDynamicDefault.X64]
|
[PcdsDynamicDefault.X64]
|
||||||
|
@ -90,6 +90,14 @@ FV = PEIFV
|
|||||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
|
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
|
||||||
FV = DXEFV
|
FV = DXEFV
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Set the SEV-ES specific work area PCDs (used for all forms of SEV since the
|
||||||
|
# the SEV STATUS MSR is now saved in the work area)
|
||||||
|
#
|
||||||
|
SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase = $(MEMFD_BASE_ADDRESS) + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
|
||||||
|
SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaSize = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize - gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
[FV.SECFV]
|
[FV.SECFV]
|
||||||
|
@ -171,7 +171,6 @@
|
|||||||
PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf
|
PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf
|
||||||
PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPciSegmentLib.inf
|
PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPciSegmentLib.inf
|
||||||
PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf
|
PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf
|
||||||
CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
|
|
||||||
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
|
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
|
||||||
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
|
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
|
||||||
SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
|
SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
|
||||||
@ -198,6 +197,9 @@
|
|||||||
|
|
||||||
!if $(SMM_REQUIRE) == FALSE
|
!if $(SMM_REQUIRE) == FALSE
|
||||||
LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
|
LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
|
||||||
|
CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
|
||||||
|
!else
|
||||||
|
CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
|
||||||
!endif
|
!endif
|
||||||
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
|
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
|
||||||
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
|
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
|
||||||
@ -232,6 +234,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -681,7 +684,7 @@
|
|||||||
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
|
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
|
||||||
|
|
||||||
!if $(CSM_ENABLE) == FALSE
|
!if $(CSM_ENABLE) == FALSE
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|100000000
|
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1000000000
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
[PcdsDynamicHii]
|
[PcdsDynamicHii]
|
||||||
|
@ -106,7 +106,8 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvm
|
|||||||
FV = DXEFV
|
FV = DXEFV
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# Set the SEV-ES specific work area PCDs
|
# Set the SEV-ES specific work area PCDs (used for all forms of SEV since the
|
||||||
|
# the SEV STATUS MSR is now saved in the work area)
|
||||||
#
|
#
|
||||||
SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase = $(MEMFD_BASE_ADDRESS) + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
|
SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase = $(MEMFD_BASE_ADDRESS) + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
|
||||||
SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaSize = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize - gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
|
SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaSize = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize - gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
|
||||||
|
@ -196,6 +196,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -150,6 +150,8 @@ BITS 32
|
|||||||
SevEsUnexpectedRespTerminate:
|
SevEsUnexpectedRespTerminate:
|
||||||
TerminateVmgExit TERM_UNEXPECTED_RESP_CODE
|
TerminateVmgExit TERM_UNEXPECTED_RESP_CODE
|
||||||
|
|
||||||
|
%ifdef ARCH_X64
|
||||||
|
|
||||||
; If SEV-ES is enabled then initialize and make the GHCB page shared
|
; If SEV-ES is enabled then initialize and make the GHCB page shared
|
||||||
SevClearPageEncMaskForGhcbPage:
|
SevClearPageEncMaskForGhcbPage:
|
||||||
; Check if SEV is enabled
|
; Check if SEV is enabled
|
||||||
@ -209,6 +211,8 @@ GetSevCBitMaskAbove31:
|
|||||||
GetSevCBitMaskAbove31Exit:
|
GetSevCBitMaskAbove31Exit:
|
||||||
OneTimeCallRet GetSevCBitMaskAbove31
|
OneTimeCallRet GetSevCBitMaskAbove31
|
||||||
|
|
||||||
|
%endif
|
||||||
|
|
||||||
; Check if Secure Encrypted Virtualization (SEV) features are enabled.
|
; Check if Secure Encrypted Virtualization (SEV) features are enabled.
|
||||||
;
|
;
|
||||||
; Register usage is tight in this routine, so multiple calls for the
|
; Register usage is tight in this routine, so multiple calls for the
|
||||||
|
@ -75,6 +75,12 @@ SearchBfv:
|
|||||||
|
|
||||||
%ifdef ARCH_IA32
|
%ifdef ARCH_IA32
|
||||||
|
|
||||||
|
;
|
||||||
|
; SEV support can be built and run using the Ia32/X64 split environment.
|
||||||
|
; Set the OVMF/SEV work area as appropriate.
|
||||||
|
;
|
||||||
|
OneTimeCall CheckSevFeatures
|
||||||
|
|
||||||
;
|
;
|
||||||
; Restore initial EAX value into the EAX register
|
; Restore initial EAX value into the EAX register
|
||||||
;
|
;
|
||||||
|
@ -47,7 +47,36 @@
|
|||||||
%include "Ia32/SearchForBfvBase.asm"
|
%include "Ia32/SearchForBfvBase.asm"
|
||||||
%include "Ia32/SearchForSecEntry.asm"
|
%include "Ia32/SearchForSecEntry.asm"
|
||||||
|
|
||||||
%define WORK_AREA_GUEST_TYPE (FixedPcdGet32 (PcdOvmfWorkAreaBase))
|
%define WORK_AREA_GUEST_TYPE (FixedPcdGet32 (PcdOvmfWorkAreaBase))
|
||||||
|
%define PT_ADDR(Offset) (FixedPcdGet32 (PcdOvmfSecPageTablesBase) + (Offset))
|
||||||
|
|
||||||
|
%define GHCB_PT_ADDR (FixedPcdGet32 (PcdOvmfSecGhcbPageTableBase))
|
||||||
|
%define GHCB_BASE (FixedPcdGet32 (PcdOvmfSecGhcbBase))
|
||||||
|
%define GHCB_SIZE (FixedPcdGet32 (PcdOvmfSecGhcbSize))
|
||||||
|
%define SEV_ES_WORK_AREA (FixedPcdGet32 (PcdSevEsWorkAreaBase))
|
||||||
|
%define SEV_ES_WORK_AREA_SIZE 25
|
||||||
|
%define SEV_ES_WORK_AREA_STATUS_MSR (FixedPcdGet32 (PcdSevEsWorkAreaBase))
|
||||||
|
%define SEV_ES_WORK_AREA_RDRAND (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 8)
|
||||||
|
%define SEV_ES_WORK_AREA_ENC_MASK (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 16)
|
||||||
|
%define SEV_ES_WORK_AREA_RECEIVED_VC (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 24)
|
||||||
|
%define SEV_ES_VC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))
|
||||||
|
%define SEV_SNP_SECRETS_BASE (FixedPcdGet32 (PcdOvmfSnpSecretsBase))
|
||||||
|
%define SEV_SNP_SECRETS_SIZE (FixedPcdGet32 (PcdOvmfSnpSecretsSize))
|
||||||
|
%define CPUID_BASE (FixedPcdGet32 (PcdOvmfCpuidBase))
|
||||||
|
%define CPUID_SIZE (FixedPcdGet32 (PcdOvmfCpuidSize))
|
||||||
|
%define SNP_SEC_MEM_BASE_DESC_1 (FixedPcdGet32 (PcdOvmfSecPageTablesBase))
|
||||||
|
%define SNP_SEC_MEM_SIZE_DESC_1 (FixedPcdGet32 (PcdOvmfSecGhcbBase) - SNP_SEC_MEM_BASE_DESC_1)
|
||||||
|
;
|
||||||
|
; The PcdOvmfSecGhcbBase reserves two GHCB pages. The first page is used
|
||||||
|
; as GHCB shared page and second is used for bookkeeping to support the
|
||||||
|
; nested GHCB in SEC phase. The bookkeeping page is mapped private. The VMM
|
||||||
|
; does not need to validate the shared page but it need to validate the
|
||||||
|
; bookkeeping page.
|
||||||
|
;
|
||||||
|
%define SNP_SEC_MEM_BASE_DESC_2 (GHCB_BASE + 0x1000)
|
||||||
|
%define SNP_SEC_MEM_SIZE_DESC_2 (SEV_SNP_SECRETS_BASE - SNP_SEC_MEM_BASE_DESC_2)
|
||||||
|
%define SNP_SEC_MEM_BASE_DESC_3 (CPUID_BASE + CPUID_SIZE)
|
||||||
|
%define SNP_SEC_MEM_SIZE_DESC_3 (FixedPcdGet32 (PcdOvmfPeiMemFvBase) - SNP_SEC_MEM_BASE_DESC_3)
|
||||||
|
|
||||||
%ifdef ARCH_X64
|
%ifdef ARCH_X64
|
||||||
#include <AutoGen.h>
|
#include <AutoGen.h>
|
||||||
@ -94,44 +123,15 @@
|
|||||||
%define TDX_WORK_AREA_PGTBL_READY (FixedPcdGet32 (PcdOvmfWorkAreaBase) + 4)
|
%define TDX_WORK_AREA_PGTBL_READY (FixedPcdGet32 (PcdOvmfWorkAreaBase) + 4)
|
||||||
%define TDX_WORK_AREA_GPAW (FixedPcdGet32 (PcdOvmfWorkAreaBase) + 8)
|
%define TDX_WORK_AREA_GPAW (FixedPcdGet32 (PcdOvmfWorkAreaBase) + 8)
|
||||||
|
|
||||||
%define PT_ADDR(Offset) (FixedPcdGet32 (PcdOvmfSecPageTablesBase) + (Offset))
|
%include "X64/IntelTdxMetadata.asm"
|
||||||
|
%include "Ia32/Flat32ToFlat64.asm"
|
||||||
%define GHCB_PT_ADDR (FixedPcdGet32 (PcdOvmfSecGhcbPageTableBase))
|
%include "Ia32/PageTables64.asm"
|
||||||
%define GHCB_BASE (FixedPcdGet32 (PcdOvmfSecGhcbBase))
|
%include "Ia32/IntelTdx.asm"
|
||||||
%define GHCB_SIZE (FixedPcdGet32 (PcdOvmfSecGhcbSize))
|
%include "X64/OvmfSevMetadata.asm"
|
||||||
%define SEV_ES_WORK_AREA (FixedPcdGet32 (PcdSevEsWorkAreaBase))
|
|
||||||
%define SEV_ES_WORK_AREA_SIZE 25
|
|
||||||
%define SEV_ES_WORK_AREA_STATUS_MSR (FixedPcdGet32 (PcdSevEsWorkAreaBase))
|
|
||||||
%define SEV_ES_WORK_AREA_RDRAND (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 8)
|
|
||||||
%define SEV_ES_WORK_AREA_ENC_MASK (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 16)
|
|
||||||
%define SEV_ES_WORK_AREA_RECEIVED_VC (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 24)
|
|
||||||
%define SEV_ES_VC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))
|
|
||||||
%define SEV_SNP_SECRETS_BASE (FixedPcdGet32 (PcdOvmfSnpSecretsBase))
|
|
||||||
%define SEV_SNP_SECRETS_SIZE (FixedPcdGet32 (PcdOvmfSnpSecretsSize))
|
|
||||||
%define CPUID_BASE (FixedPcdGet32 (PcdOvmfCpuidBase))
|
|
||||||
%define CPUID_SIZE (FixedPcdGet32 (PcdOvmfCpuidSize))
|
|
||||||
%define SNP_SEC_MEM_BASE_DESC_1 (FixedPcdGet32 (PcdOvmfSecPageTablesBase))
|
|
||||||
%define SNP_SEC_MEM_SIZE_DESC_1 (FixedPcdGet32 (PcdOvmfSecGhcbBase) - SNP_SEC_MEM_BASE_DESC_1)
|
|
||||||
;
|
|
||||||
; The PcdOvmfSecGhcbBase reserves two GHCB pages. The first page is used
|
|
||||||
; as GHCB shared page and second is used for bookkeeping to support the
|
|
||||||
; nested GHCB in SEC phase. The bookkeeping page is mapped private. The VMM
|
|
||||||
; does not need to validate the shared page but it need to validate the
|
|
||||||
; bookkeeping page.
|
|
||||||
;
|
|
||||||
%define SNP_SEC_MEM_BASE_DESC_2 (GHCB_BASE + 0x1000)
|
|
||||||
%define SNP_SEC_MEM_SIZE_DESC_2 (SEV_SNP_SECRETS_BASE - SNP_SEC_MEM_BASE_DESC_2)
|
|
||||||
%define SNP_SEC_MEM_BASE_DESC_3 (CPUID_BASE + CPUID_SIZE)
|
|
||||||
%define SNP_SEC_MEM_SIZE_DESC_3 (FixedPcdGet32 (PcdOvmfPeiMemFvBase) - SNP_SEC_MEM_BASE_DESC_3)
|
|
||||||
|
|
||||||
%include "X64/IntelTdxMetadata.asm"
|
|
||||||
%include "Ia32/Flat32ToFlat64.asm"
|
|
||||||
%include "Ia32/AmdSev.asm"
|
|
||||||
%include "Ia32/PageTables64.asm"
|
|
||||||
%include "Ia32/IntelTdx.asm"
|
|
||||||
%include "X64/OvmfSevMetadata.asm"
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%include "Ia32/AmdSev.asm"
|
||||||
|
|
||||||
%include "Ia16/Real16ToFlat32.asm"
|
%include "Ia16/Real16ToFlat32.asm"
|
||||||
%include "Ia16/Init16.asm"
|
%include "Ia16/Init16.asm"
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ MailBoxWakeUp:
|
|||||||
mov rax, [rbx + WakeupVectorOffset]
|
mov rax, [rbx + WakeupVectorOffset]
|
||||||
; OS sends a wakeup command for a given APIC ID, firmware is supposed to reset
|
; OS sends a wakeup command for a given APIC ID, firmware is supposed to reset
|
||||||
; the command field back to zero as acknowledgement.
|
; the command field back to zero as acknowledgement.
|
||||||
mov qword [rbx + WakeupVectorOffset], 0
|
mov qword [rbx + CommandOffset], 0
|
||||||
jmp rax
|
jmp rax
|
||||||
MailBoxSleep:
|
MailBoxSleep:
|
||||||
jmp $
|
jmp $
|
||||||
@ -83,7 +83,7 @@ AsmRelocateApMailBoxLoopEnd:
|
|||||||
;-------------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------------
|
||||||
global ASM_PFX(AsmGetRelocationMap)
|
global ASM_PFX(AsmGetRelocationMap)
|
||||||
ASM_PFX(AsmGetRelocationMap):
|
ASM_PFX(AsmGetRelocationMap):
|
||||||
lea rax, [ASM_PFX(AsmRelocateApMailBoxLoopStart)]
|
lea rax, [AsmRelocateApMailBoxLoopStart]
|
||||||
mov qword [rcx], rax
|
mov qword [rcx], rax
|
||||||
mov qword [rcx + 8h], AsmRelocateApMailBoxLoopEnd - AsmRelocateApMailBoxLoopStart
|
mov qword [rcx + 8h], AsmRelocateApMailBoxLoopEnd - AsmRelocateApMailBoxLoopStart
|
||||||
ret
|
ret
|
||||||
|
@ -272,6 +272,7 @@
|
|||||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||||
|
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
|
||||||
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
|
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
|
||||||
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
|
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user