]>
Commit | Line | Data |
---|---|---|
50944545 | 1 | /** @file |
2 | Save Non-Volatile Variables to a file system. | |
3 | ||
56d7640a HT |
4 | Copyright (c) 2009, Intel Corporation. All rights reserved.<BR> |
5 | This program and the accompanying materials | |
50944545 | 6 | are licensed and made available under the terms and conditions of the BSD License |
7 | which accompanies this distribution. The full text of the license may be found at | |
8 | http://opensource.org/licenses/bsd-license.php | |
9 | ||
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
12 | ||
13 | **/ | |
14 | ||
15 | #ifndef __NV_VARS_FILE_LIB_INSTANCE__ | |
16 | #define __NV_VARS_FILE_LIB_INSTANCE__ | |
17 | ||
18 | #include <Uefi.h> | |
19 | ||
20 | #include <Guid/FileInfo.h> | |
21 | ||
22 | #include <Protocol/SimpleFileSystem.h> | |
23 | ||
24 | #include <Library/BaseLib.h> | |
25 | #include <Library/FileHandleLib.h> | |
26 | #include <Library/UefiBootServicesTableLib.h> | |
27 | #include <Library/UefiRuntimeServicesTableLib.h> | |
28 | #include <Library/UefiLib.h> | |
29 | ||
30 | /** | |
31 | Loads the non-volatile variables from the NvVars file on the | |
32 | given file system. | |
33 | ||
34 | @param[in] FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance | |
35 | ||
36 | @return EFI_STATUS based on the success or failure of load operation | |
37 | ||
38 | **/ | |
39 | EFI_STATUS | |
40 | LoadNvVarsFromFs ( | |
41 | EFI_HANDLE FsHandle | |
42 | ); | |
43 | ||
44 | ||
45 | /** | |
46 | Saves the non-volatile variables into the NvVars file on the | |
47 | given file system. | |
48 | ||
49 | @param[in] FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance | |
50 | ||
51 | @return EFI_STATUS based on the success or failure of load operation | |
52 | ||
53 | **/ | |
54 | EFI_STATUS | |
55 | SaveNvVarsToFs ( | |
56 | EFI_HANDLE FsHandle | |
57 | ); | |
58 | ||
59 | ||
60 | /** | |
61 | Examines the NvVars file contents, and updates variables based on it. | |
62 | ||
63 | @param[in] VarsBuffer - Buffer with NvVars data | |
64 | @param[in] VarsBufferSize - Size of VarsBuffer in bytes | |
65 | ||
66 | @return EFI_STATUS based on the success or failure of the operation | |
67 | ||
68 | **/ | |
69 | EFI_STATUS | |
70 | SetVariablesFromBuffer ( | |
71 | IN VOID *VarsBuffer, | |
72 | IN UINTN VarsBufferSize | |
73 | ); | |
74 | ||
75 | ||
76 | /** | |
77 | Writes the variable into the file so it can be restored from | |
78 | the file on future boots of the system. | |
79 | ||
80 | @param[in] File - The file to write to | |
81 | @param[in] Name - Variable name string | |
82 | @param[in] NameSize - Size of Name in bytes | |
83 | @param[in] Guid - GUID of variable | |
84 | @param[in] Attributes - Attributes of variable | |
85 | @param[in] Data - Buffer containing Data for variable | |
86 | @param[in] DataSize - Size of Data in bytes | |
87 | ||
88 | @return EFI_STATUS based on the success or failure of the operation | |
89 | ||
90 | **/ | |
91 | EFI_STATUS | |
92 | PackVariableIntoFile ( | |
93 | IN EFI_FILE_HANDLE File, | |
94 | IN CHAR16 *Name, | |
95 | IN UINT32 NameSize, | |
96 | IN EFI_GUID *Guid, | |
97 | IN UINT32 Attributes, | |
98 | IN VOID *Data, | |
99 | IN UINT32 DataSize | |
100 | ); | |
101 | ||
102 | #endif | |
103 |