]>
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 | |
6 | Copyright (c) 2006 - 2008, Intel Corporation\r | |
8d3a5c82 | 7 | All rights reserved. This program and the accompanying materials\r |
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 |
8d3a5c82 | 32 | \r |
8d3a5c82 | 33 | typedef struct {\r |
34 | VARIABLE_HEADER *CurrPtr;\r | |
35 | VARIABLE_HEADER *EndPtr;\r | |
36 | VARIABLE_HEADER *StartPtr;\r | |
37 | } VARIABLE_POINTER_TRACK;\r | |
38 | \r | |
39 | #define VARIABLE_INDEX_TABLE_VOLUME 122\r | |
40 | \r | |
41 | #define EFI_VARIABLE_INDEX_TABLE_GUID \\r | |
42 | { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }\r | |
43 | \r | |
841014ba | 44 | ///\r |
45 | /// Use this data structure to store variable-related info, which can decrease\r | |
46 | /// the cost of access to NV.\r | |
47 | ///\r | |
8d3a5c82 | 48 | typedef struct {\r |
49 | UINT16 Length;\r | |
50 | UINT16 GoneThrough;\r | |
51 | VARIABLE_HEADER *EndPtr;\r | |
52 | VARIABLE_HEADER *StartPtr;\r | |
841014ba | 53 | ///\r |
54 | /// This field is used to store the distance of two neighbouring VAR_ADDED type variables.\r | |
55 | /// The meaning of the field is implement-dependent.\r | |
8d3a5c82 | 56 | UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];\r |
57 | } VARIABLE_INDEX_TABLE;\r | |
58 | \r | |
59 | \r | |
60 | //\r | |
61 | // Functions\r | |
62 | //\r | |
33479ddf | 63 | /**\r |
64 | Provide the functionality of the variable services.\r | |
65 | \r | |
66 | @param FileHandle Handle of the file being invoked. \r | |
67 | Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().\r | |
68 | @param PeiServices General purpose services available to every PEIM.\r | |
69 | \r | |
70 | @retval EFI_SUCCESS If the interface could be successfully installed\r | |
71 | @retval Others Returned from PeiServicesInstallPpi()\r | |
72 | \r | |
73 | **/\r | |
8d3a5c82 | 74 | EFI_STATUS\r |
75 | EFIAPI\r | |
76 | PeimInitializeVariableServices (\r | |
33479ddf | 77 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
78 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
79 | );\r | |
8d3a5c82 | 80 | \r |
33479ddf | 81 | /**\r |
82 | This service retrieves a variable's value using its name and GUID.\r | |
83 | \r | |
84 | Read the specified variable from the UEFI variable store. If the Data \r | |
85 | buffer is too small to hold the contents of the variable, the error\r | |
86 | EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer\r | |
87 | size to obtain the data.\r | |
88 | \r | |
89 | @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r | |
90 | @param VariableName A pointer to a null-terminated string that is the variable's name.\r | |
91 | @param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of\r | |
92 | VariableGuid and VariableName must be unique.\r | |
93 | @param Attributes If non-NULL, on return, points to the variable's attributes.\r | |
94 | @param DataSize On entry, points to the size in bytes of the Data buffer.\r | |
95 | On return, points to the size of the data returned in Data.\r | |
96 | @param Data Points to the buffer which will hold the returned variable value.\r | |
97 | \r | |
98 | @retval EFI_SUCCESS The variable was read successfully.\r | |
99 | @retval EFI_NOT_FOUND The variable could not be found.\r | |
100 | @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data. \r | |
101 | DataSize is updated with the size required for \r | |
102 | the specified variable.\r | |
103 | @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.\r | |
104 | @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r | |
8d3a5c82 | 105 | \r |
33479ddf | 106 | **/\r |
8d3a5c82 | 107 | EFI_STATUS\r |
108 | EFIAPI\r | |
109 | PeiGetVariable (\r | |
110 | IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r | |
111 | IN CONST CHAR16 *VariableName,\r | |
112 | IN CONST EFI_GUID *VariableGuid,\r | |
113 | OUT UINT32 *Attributes,\r | |
114 | IN OUT UINTN *DataSize,\r | |
115 | OUT VOID *Data\r | |
33479ddf | 116 | );\r |
8d3a5c82 | 117 | \r |
33479ddf | 118 | /**\r |
119 | Return the next variable name and GUID.\r | |
8d3a5c82 | 120 | \r |
33479ddf | 121 | This function is called multiple times to retrieve the VariableName \r |
122 | and VariableGuid of all variables currently available in the system. \r | |
123 | On each call, the previous results are passed into the interface, \r | |
124 | and, on return, the interface returns the data for the next \r | |
125 | interface. When the entire variable list has been returned, \r | |
126 | EFI_NOT_FOUND is returned.\r | |
8d3a5c82 | 127 | \r |
33479ddf | 128 | @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r |
8d3a5c82 | 129 | \r |
33479ddf | 130 | @param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName.\r |
131 | @param VariableName On entry, a pointer to a null-terminated string that is the variable's name.\r | |
132 | On return, points to the next variable's null-terminated name string.\r | |
8d3a5c82 | 133 | \r |
33479ddf | 134 | @param VariableGuid On entry, a pointer to an UEFI _GUID that is the variable's GUID. \r |
135 | On return, a pointer to the next variable's GUID.\r | |
8d3a5c82 | 136 | \r |
33479ddf | 137 | @retval EFI_SUCCESS The variable was read successfully.\r |
138 | @retval EFI_NOT_FOUND The variable could not be found.\r | |
139 | @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the resulting\r | |
140 | data. VariableNameSize is updated with the size\r | |
141 | required for the specified variable.\r | |
142 | @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or\r | |
143 | VariableNameSize is NULL.\r | |
144 | @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r | |
8d3a5c82 | 145 | \r |
33479ddf | 146 | **/\r |
8d3a5c82 | 147 | EFI_STATUS\r |
148 | EFIAPI\r | |
149 | PeiGetNextVariableName (\r | |
150 | IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r | |
151 | IN OUT UINTN *VariableNameSize,\r | |
152 | IN OUT CHAR16 *VariableName,\r | |
153 | IN OUT EFI_GUID *VariableGuid\r | |
33479ddf | 154 | );\r |
8d3a5c82 | 155 | \r |
33479ddf | 156 | #endif\r |