1)Add a new module CapsuleRuntime under EdkModulePkg\Universal\Capsule\RuntimeDxe.And add the module into Nt32.fpd
2)Modify the related files to fit for the runtime services UpdateCapsule/QueryCapsuleCapabilities defined in UEFI2.0 spec 3)Modify the related files to fit for the runtime services QueryVariableInfo defined in UEFI2.0 spec git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@790 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -114,6 +114,36 @@ Returns:
|
||||
);
|
||||
}
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
RuntimeServiceQueryVariableInfo (
|
||||
IN UINT32 Attributes,
|
||||
OUT UINT64 *MaximumVariableStorageSize,
|
||||
OUT UINT64 *RemainingVariableStorageSize,
|
||||
OUT UINT64 *MaximumVariableSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
return QueryVariableInfo (
|
||||
Attributes,
|
||||
MaximumVariableStorageSize,
|
||||
RemainingVariableStorageSize,
|
||||
MaximumVariableSize,
|
||||
&mVariableModuleGlobal->VariableBase[Physical],
|
||||
mVariableModuleGlobal->FvbInstance
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
VariableClassAddressChangeEvent (
|
||||
@ -166,6 +196,9 @@ Returns:
|
||||
SystemTable->RuntimeServices->GetVariable = RuntimeServiceGetVariable;
|
||||
SystemTable->RuntimeServices->GetNextVariableName = RuntimeServiceGetNextVariableName;
|
||||
SystemTable->RuntimeServices->SetVariable = RuntimeServiceSetVariable;
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
SystemTable->RuntimeServices->QueryVariableInfo = RuntimeServiceQueryVariableInfo;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Now install the Variable Runtime Architectural Protocol on a new handle
|
||||
|
@ -89,6 +89,19 @@ Returns:
|
||||
);
|
||||
return ReturnVal;
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
case EsalQueryVariableInfo:
|
||||
ReturnVal.Status = QueryVariableInfo (
|
||||
(UINT32) Arg2,
|
||||
(UINT64 *) Arg3,
|
||||
(UINT64 *) Arg4,
|
||||
(UINT64 *) Arg5,
|
||||
&Global->VariableBase[VirtualMode],
|
||||
Global->FvbInstance
|
||||
);
|
||||
return ReturnVal;
|
||||
#endif
|
||||
|
||||
default:
|
||||
ReturnVal.Status = EFI_SAL_INVALID_ARGUMENT;
|
||||
return ReturnVal;
|
||||
@ -160,6 +173,10 @@ Returns:
|
||||
EsalGetNextVariableName,
|
||||
EsalVariableCommonEntry,
|
||||
EsalSetVariable,
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
EsalVariableCommonEntry,
|
||||
EsalQueryVariableInfo,
|
||||
#endif
|
||||
NULL
|
||||
);
|
||||
|
||||
|
@ -1090,6 +1090,135 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
QueryVariableInfo (
|
||||
IN UINT32 Attributes,
|
||||
OUT UINT64 *MaximumVariableStorageSize,
|
||||
OUT UINT64 *RemainingVariableStorageSize,
|
||||
OUT UINT64 *MaximumVariableSize,
|
||||
IN VARIABLE_GLOBAL *Global,
|
||||
IN UINT32 Instance
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This code returns information about the EFI variables.
|
||||
|
||||
Arguments:
|
||||
|
||||
Attributes Attributes bitmask to specify the type of variables
|
||||
on which to return information.
|
||||
MaximumVariableStorageSize Pointer to the maximum size of the storage space available
|
||||
for the EFI variables associated with the attributes specified.
|
||||
RemainingVariableStorageSize Pointer to the remaining size of the storage space available
|
||||
for the EFI variables associated with the attributes specified.
|
||||
MaximumVariableSize Pointer to the maximum size of the individual EFI variables
|
||||
associated with the attributes specified.
|
||||
Global Pointer to VARIABLE_GLOBAL structure.
|
||||
Instance Instance of the Firmware Volume.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI STATUS
|
||||
EFI_INVALID_PARAMETER - An invalid combination of attribute bits was supplied.
|
||||
EFI_SUCCESS - Query successfully.
|
||||
EFI_UNSUPPORTED - The attribute is not supported on this platform.
|
||||
|
||||
--*/
|
||||
{
|
||||
VARIABLE_HEADER *Variable;
|
||||
VARIABLE_HEADER *NextVariable;
|
||||
UINT64 VariableSize;
|
||||
VARIABLE_STORE_HEADER *VariableStoreHeader;
|
||||
|
||||
if(MaximumVariableStorageSize == NULL || RemainingVariableStorageSize == NULL || MaximumVariableSize == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if((Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)) == 0) {
|
||||
//
|
||||
// Make sure the Attributes combination is supported by the platform.
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
} else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {
|
||||
//
|
||||
// Make sure if runtime bit is set, boot service bit is set also.
|
||||
//
|
||||
return EFI_INVALID_PARAMETER;
|
||||
} else if (EfiAtRuntime () && !(Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {
|
||||
//
|
||||
// Make sure RT Attribute is set if we are in Runtime phase.
|
||||
//
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {
|
||||
//
|
||||
// Query is Volatile related.
|
||||
//
|
||||
VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);
|
||||
} else {
|
||||
//
|
||||
// Query is Non-Volatile related.
|
||||
//
|
||||
VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->NonVolatileVariableBase);
|
||||
}
|
||||
|
||||
//
|
||||
// Now let's fill *MaximumVariableStorageSize *RemainingVariableStorageSize
|
||||
// with the storage size (excluding the storage header size).
|
||||
//
|
||||
*MaximumVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
|
||||
*RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
|
||||
|
||||
//
|
||||
// Let *MaximumVariableSize be MAX_VARIABLE_SIZE.
|
||||
//
|
||||
*MaximumVariableSize = MAX_VARIABLE_SIZE;
|
||||
|
||||
//
|
||||
// Point to the starting address of the variables.
|
||||
//
|
||||
Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
|
||||
|
||||
//
|
||||
// Now walk through the related variable store.
|
||||
//
|
||||
while (IsValidVariableHeader (Variable) && (Variable < GetEndPointer (VariableStoreHeader))) {
|
||||
NextVariable = GetNextVariablePtr (Variable);
|
||||
VariableSize = (UINT64) (UINTN) NextVariable - (UINT64) (UINTN) Variable;
|
||||
|
||||
if (EfiAtRuntime ()) {
|
||||
//
|
||||
// we don't take the state of the variables in mind
|
||||
// when calculating RemainingVariableStorageSize,
|
||||
// since the space occupied by variables not marked with
|
||||
// VAR_ADDED is not allowed to be reclaimed in Runtime.
|
||||
//
|
||||
*RemainingVariableStorageSize -= VariableSize;
|
||||
} else {
|
||||
//
|
||||
// Only care about Variables with State VAR_ADDED,because
|
||||
// the space not marked as VAR_ADDED is reclaimable now.
|
||||
//
|
||||
if (Variable->State == VAR_ADDED) {
|
||||
*RemainingVariableStorageSize -= VariableSize;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Go to the next one
|
||||
//
|
||||
Variable = NextVariable;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
VariableCommonInitialize (
|
||||
|
@ -140,4 +140,18 @@ SetVariable (
|
||||
)
|
||||
;
|
||||
|
||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
QueryVariableInfo (
|
||||
IN UINT32 Attributes,
|
||||
OUT UINT64 *MaximumVariableStorageSize,
|
||||
OUT UINT64 *RemainingVariableStorageSize,
|
||||
OUT UINT64 *MaximumVariableSize,
|
||||
IN VARIABLE_GLOBAL *Global,
|
||||
IN UINT32 Instance
|
||||
)
|
||||
;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user