Hello
We have a requirement to monitor setVariable calls, we'd like to get a
callback before and after the variable update.
Similar to VarCheckLib, except that VarCheckLib's set callbacks are
called after endOfDxe.
We were thinking of doing something like:
===============
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -2853,6 +2853,11 @@ VariableServiceSetVariable (
return Status;
}
+ Status = VarPreSetVariableCallback (VariableName, VendorGuid,
Attributes, PayloadSize, (VOID *)((UINTN)Data + DataSize - PayloadSize),
mRequestSource);^M
+ if (EFI_ERROR (Status)) {^M
+ return Status;^M
+ }^M
+^M
AcquireLockOnlyAtBootTime
(&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
//
@@ -2917,6 +2922,8 @@ Done:
InterlockedDecrement
(&mVariableModuleGlobal->VariableGlobal.ReentrantState);
ReleaseLockOnlyAtBootTime
(&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
+ Status = VarPostSetVariableCallback (VariableName, VendorGuid,
Attributes, PayloadSize, (VOID *)((UINTN)Data + DataSize - PayloadSize),
mRequestSource);^M
+^M
==========================
We were thinking of 4 options:
1. A new Library, platforms can include the Null implementation if they
don't need this.
2. A new protocol that is called from the Variable driver (similar to
the Fvb protocol, we let the Smm/Dxe Variable drivers get this protocol)
3. Expand the existing VarCheckLib to include these new callbacks.
(which can be called before end of dxe)
4. Something we don't know about (please let us know)
We are leaning toward option 1. Let us know your thoughts.
Best Regards
Girish
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108929): https://edk2.groups.io/g/devel/message/108929
Mute This Topic: https://groups.io/mt/101487036/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-