]>
Commit | Line | Data |
---|---|---|
0c18794e | 1 | /** @file\r |
2 | The internal header file includes the common header files, defines\r | |
3 | internal structure and functions used by PeiVariable module.\r | |
4 | \r | |
5 | Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials \r | |
7 | are licensed and made available under the terms and conditions of the BSD License \r | |
8 | which accompanies this distribution. The full text of the license may be found at \r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _PEI_VARIABLE_H_\r | |
17 | #define _PEI_VARIABLE_H_\r | |
18 | \r | |
19 | #include <PiPei.h>\r | |
20 | #include <Ppi/ReadOnlyVariable2.h>\r | |
21 | \r | |
22 | #include <Library/DebugLib.h>\r | |
23 | #include <Library/PeimEntryPoint.h>\r | |
24 | #include <Library/HobLib.h>\r | |
25 | #include <Library/PcdLib.h>\r | |
26 | #include <Library/BaseMemoryLib.h>\r | |
27 | #include <Library/PeiServicesTablePointerLib.h>\r | |
28 | #include <Library/PeiServicesLib.h>\r | |
29 | \r | |
30 | #include <Guid/AuthenticatedVariableFormat.h>\r | |
31 | #include <Guid/VariableIndexTable.h>\r | |
4d832aab | 32 | #include <Guid/SystemNvDataGuid.h>\r |
9a000b46 RN |
33 | \r |
34 | typedef enum {\r | |
35 | VariableStoreTypeHob,\r | |
36 | VariableStoreTypeNv,\r | |
37 | VariableStoreTypeMax\r | |
38 | } VARIABLE_STORE_TYPE;\r | |
39 | \r | |
0c18794e | 40 | //\r |
41 | // Functions\r | |
42 | //\r | |
43 | /**\r | |
44 | Provide the functionality of the variable services.\r | |
45 | \r | |
46 | @param FileHandle Handle of the file being invoked. \r | |
47 | Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().\r | |
48 | @param PeiServices General purpose services available to every PEIM.\r | |
49 | \r | |
50 | @retval EFI_SUCCESS If the interface could be successfully installed\r | |
51 | @retval Others Returned from PeiServicesInstallPpi()\r | |
52 | \r | |
53 | **/\r | |
54 | EFI_STATUS\r | |
55 | EFIAPI\r | |
56 | PeimInitializeVariableServices (\r | |
57 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
58 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
59 | );\r | |
60 | \r | |
61 | /**\r | |
62 | This service retrieves a variable's value using its name and GUID.\r | |
63 | \r | |
64 | Read the specified variable from the UEFI variable store. If the Data \r | |
65 | buffer is too small to hold the contents of the variable, the error\r | |
66 | EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer\r | |
67 | size to obtain the data.\r | |
68 | \r | |
69 | @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r | |
70 | @param VariableName A pointer to a null-terminated string that is the variable's name.\r | |
71 | @param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of\r | |
72 | VariableGuid and VariableName must be unique.\r | |
73 | @param Attributes If non-NULL, on return, points to the variable's attributes.\r | |
74 | @param DataSize On entry, points to the size in bytes of the Data buffer.\r | |
75 | On return, points to the size of the data returned in Data.\r | |
76 | @param Data Points to the buffer which will hold the returned variable value.\r | |
77 | \r | |
78 | @retval EFI_SUCCESS The variable was read successfully.\r | |
79 | @retval EFI_NOT_FOUND The variable could not be found.\r | |
80 | @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data. \r | |
81 | DataSize is updated with the size required for \r | |
82 | the specified variable.\r | |
83 | @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.\r | |
84 | @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r | |
85 | \r | |
86 | **/\r | |
87 | EFI_STATUS\r | |
88 | EFIAPI\r | |
89 | PeiGetVariable (\r | |
90 | IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r | |
91 | IN CONST CHAR16 *VariableName,\r | |
92 | IN CONST EFI_GUID *VariableGuid,\r | |
93 | OUT UINT32 *Attributes,\r | |
94 | IN OUT UINTN *DataSize,\r | |
95 | OUT VOID *Data\r | |
96 | );\r | |
97 | \r | |
98 | /**\r | |
99 | Return the next variable name and GUID.\r | |
100 | \r | |
101 | This function is called multiple times to retrieve the VariableName \r | |
102 | and VariableGuid of all variables currently available in the system. \r | |
103 | On each call, the previous results are passed into the interface, \r | |
104 | and, on return, the interface returns the data for the next \r | |
105 | interface. When the entire variable list has been returned, \r | |
106 | EFI_NOT_FOUND is returned.\r | |
107 | \r | |
108 | @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r | |
109 | \r | |
110 | @param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName.\r | |
111 | @param VariableName On entry, a pointer to a null-terminated string that is the variable's name.\r | |
112 | On return, points to the next variable's null-terminated name string.\r | |
113 | \r | |
114 | @param VariableGuid On entry, a pointer to an UEFI _GUID that is the variable's GUID. \r | |
115 | On return, a pointer to the next variable's GUID.\r | |
116 | \r | |
117 | @retval EFI_SUCCESS The variable was read successfully.\r | |
118 | @retval EFI_NOT_FOUND The variable could not be found.\r | |
119 | @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the resulting\r | |
120 | data. VariableNameSize is updated with the size\r | |
121 | required for the specified variable.\r | |
122 | @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or\r | |
123 | VariableNameSize is NULL.\r | |
124 | @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r | |
125 | \r | |
126 | **/\r | |
127 | EFI_STATUS\r | |
128 | EFIAPI\r | |
129 | PeiGetNextVariableName (\r | |
130 | IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r | |
131 | IN OUT UINTN *VariableNameSize,\r | |
132 | IN OUT CHAR16 *VariableName,\r | |
133 | IN OUT EFI_GUID *VariableGuid\r | |
134 | );\r | |
135 | \r | |
136 | #endif\r |