TianoCore EDK2 master
Loading...
Searching...
No Matches
NvVarsFileLib.c
Go to the documentation of this file.
1
9#include "NvVarsFileLib.h"
10#include <Library/DebugLib.h>
12
13EFI_HANDLE mNvVarsFileLibFsHandle = NULL;
14
26EFIAPI
28 IN EFI_HANDLE FsHandle
29 )
30{
31 EFI_STATUS Status;
32
33 if (FeaturePcdGet (PcdSecureBootSupported) ||
34 FeaturePcdGet (PcdBootRestrictToFirmware))
35 {
36 return EFI_UNSUPPORTED;
37 }
38
39 //
40 // We might fail to load the variable, since the file system initially
41 // will not have the NvVars file.
42 //
43 LoadNvVarsFromFs (FsHandle);
44
45 //
46 // We must be able to save the variables successfully to the file system
47 // to have connected successfully.
48 //
49 Status = SaveNvVarsToFs (FsHandle);
50 if (!EFI_ERROR (Status)) {
51 mNvVarsFileLibFsHandle = FsHandle;
52 }
53
54 return Status;
55}
56
67EFIAPI
69 )
70{
71 if (mNvVarsFileLibFsHandle == NULL) {
72 //
73 // A file system had not been connected to the library.
74 //
75 return EFI_NOT_STARTED;
76 } else {
77 return SaveNvVarsToFs (mNvVarsFileLibFsHandle);
78 }
79}
EFI_STATUS LoadNvVarsFromFs(EFI_HANDLE FsHandle)
Definition: FsAccess.c:305
EFI_STATUS SaveNvVarsToFs(EFI_HANDLE FsHandle)
Definition: FsAccess.c:406
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
EFI_STATUS EFIAPI UpdateNvVarsOnFileSystem()
Definition: NvVarsFileLib.c:68
EFI_STATUS EFIAPI ConnectNvVarsToFileSystem(IN EFI_HANDLE FsHandle)
Definition: NvVarsFileLib.c:27
#define FeaturePcdGet(TokenName)
Definition: PcdLib.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33