1 | /** @file
|
---|
2 | This file declares Read-only Variable Service2 PPI.
|
---|
3 | This ppi permits read-only access to the UEFI variable store during the PEI phase.
|
---|
4 |
|
---|
5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | @par Revision Reference:
|
---|
9 | This PPI is introduced in PI Version 1.0.
|
---|
10 |
|
---|
11 | **/
|
---|
12 |
|
---|
13 | #ifndef __PEI_READ_ONLY_VARIABLE2_PPI_H__
|
---|
14 | #define __PEI_READ_ONLY_VARIABLE2_PPI_H__
|
---|
15 |
|
---|
16 | #define EFI_PEI_READ_ONLY_VARIABLE2_PPI_GUID \
|
---|
17 | { 0x2ab86ef5, 0xecb5, 0x4134, { 0xb5, 0x56, 0x38, 0x54, 0xca, 0x1f, 0xe1, 0xb4 } }
|
---|
18 |
|
---|
19 |
|
---|
20 | typedef struct _EFI_PEI_READ_ONLY_VARIABLE2_PPI EFI_PEI_READ_ONLY_VARIABLE2_PPI;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | This service retrieves a variable's value using its name and GUID.
|
---|
24 |
|
---|
25 | Read the specified variable from the UEFI variable store. If the Data
|
---|
26 | buffer is too small to hold the contents of the variable,
|
---|
27 | the error EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the
|
---|
28 | required buffer size to obtain the data.
|
---|
29 |
|
---|
30 | @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.
|
---|
31 | @param VariableName A pointer to a null-terminated string that is the variable's name.
|
---|
32 | @param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of
|
---|
33 | VariableGuid and VariableName must be unique.
|
---|
34 | @param Attributes If non-NULL, on return, points to the variable's attributes.
|
---|
35 | @param DataSize On entry, points to the size in bytes of the Data buffer.
|
---|
36 | On return, points to the size of the data returned in Data.
|
---|
37 | @param Data Points to the buffer which will hold the returned variable value.
|
---|
38 | May be NULL with a zero DataSize in order to determine the size of the buffer needed.
|
---|
39 |
|
---|
40 | @retval EFI_SUCCESS The variable was read successfully.
|
---|
41 | @retval EFI_NOT_FOUND The variable was not found.
|
---|
42 | @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data.
|
---|
43 | DataSize is updated with the size required for
|
---|
44 | the specified variable.
|
---|
45 | @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.
|
---|
46 | @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.
|
---|
47 |
|
---|
48 | **/
|
---|
49 | typedef
|
---|
50 | EFI_STATUS
|
---|
51 | (EFIAPI *EFI_PEI_GET_VARIABLE2)(
|
---|
52 | IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
|
---|
53 | IN CONST CHAR16 *VariableName,
|
---|
54 | IN CONST EFI_GUID *VariableGuid,
|
---|
55 | OUT UINT32 *Attributes,
|
---|
56 | IN OUT UINTN *DataSize,
|
---|
57 | OUT VOID *Data OPTIONAL
|
---|
58 | );
|
---|
59 |
|
---|
60 |
|
---|
61 | /**
|
---|
62 | Return the next variable name and GUID.
|
---|
63 |
|
---|
64 | This function is called multiple times to retrieve the VariableName
|
---|
65 | and VariableGuid of all variables currently available in the system.
|
---|
66 | On each call, the previous results are passed into the interface,
|
---|
67 | and, on return, the interface returns the data for the next
|
---|
68 | interface. When the entire variable list has been returned,
|
---|
69 | EFI_NOT_FOUND is returned.
|
---|
70 |
|
---|
71 | @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.
|
---|
72 |
|
---|
73 | @param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName.
|
---|
74 | On return, the size of the variable name buffer.
|
---|
75 | @param VariableName On entry, a pointer to a null-terminated string that is the variable's name.
|
---|
76 | On return, points to the next variable's null-terminated name string.
|
---|
77 |
|
---|
78 | @param VariableGuid On entry, a pointer to an EFI_GUID that is the variable's GUID.
|
---|
79 | On return, a pointer to the next variable's GUID.
|
---|
80 |
|
---|
81 | @retval EFI_SUCCESS The variable was read successfully.
|
---|
82 | @retval EFI_NOT_FOUND The variable could not be found.
|
---|
83 | @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the resulting
|
---|
84 | data. VariableNameSize is updated with the size
|
---|
85 | required for the specified variable.
|
---|
86 | @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or
|
---|
87 | VariableNameSize is NULL.
|
---|
88 | @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.
|
---|
89 |
|
---|
90 | **/
|
---|
91 | typedef
|
---|
92 | EFI_STATUS
|
---|
93 | (EFIAPI *EFI_PEI_GET_NEXT_VARIABLE_NAME2)(
|
---|
94 | IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
|
---|
95 | IN OUT UINTN *VariableNameSize,
|
---|
96 | IN OUT CHAR16 *VariableName,
|
---|
97 | IN OUT EFI_GUID *VariableGuid
|
---|
98 | );
|
---|
99 |
|
---|
100 | ///
|
---|
101 | /// This PPI provides a lightweight, read-only variant of the full EFI
|
---|
102 | /// variable services.
|
---|
103 | ///
|
---|
104 | struct _EFI_PEI_READ_ONLY_VARIABLE2_PPI {
|
---|
105 | EFI_PEI_GET_VARIABLE2 GetVariable;
|
---|
106 | EFI_PEI_GET_NEXT_VARIABLE_NAME2 NextVariableName;
|
---|
107 | };
|
---|
108 |
|
---|
109 | extern EFI_GUID gEfiPeiReadOnlyVariable2PpiGuid;
|
---|
110 |
|
---|
111 | #endif
|
---|