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