1 /** @file 2 This file declares the Read-only Variable Service PPI, which is required by the framework spec. 3 4 These services provide a lightweight, read-only variant of the full EFI variable services. The 5 reason that these services are read-only is to reduce the complexity of flash management. Also, 6 some implementation of the PEI may use the same physical flash part for variable and PEIM 7 storage. As such, a write command to certain technologies would alter the contents of the entire part, 8 making the PEIM execution in the original position not follow the required flow. 9 10 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> 11 This program and the accompanying materials are licensed and made available under 12 the terms and conditions of the BSD License that accompanies this distribution. 13 The full text of the license may be found at 14 http://opensource.org/licenses/bsd-license.php. 15 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 18 19 @par Revision Reference: 20 This PPI is defined in PEI CIS 21 Version 0.91. 22 **/ 23 24 #ifndef __PEI_READ_ONLY_VARIABLE_PPI_H__ 25 #define __PEI_READ_ONLY_VARIABLE_PPI_H__ 26 27 #define EFI_PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID \ 28 { \ 29 0x3cdc90c6, 0x13fb, 0x4a75, {0x9e, 0x79, 0x59, 0xe9, 0xdd, 0x78, 0xb9, 0xfa } \ 30 } 31 32 typedef struct _EFI_PEI_READ_ONLY_VARIABLE_PPI EFI_PEI_READ_ONLY_VARIABLE_PPI; 33 34 /// 35 /// Variable attributes. 36 ///@{ 37 #define EFI_VARIABLE_NON_VOLATILE 0x00000001 38 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 39 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 40 /// 41 /// Inconsistent with specification here: 42 /// In Framework Spec, PeiCis0.91, neither the macro or its value is defined. 43 /// Keeping this inconsistancy for backward compatibility. 44 /// 45 #define EFI_VARIABLE_READ_ONLY 0x00000008 46 ///@} 47 48 /** 49 Get Variable value by Name and GUID pair. 50 51 @param[in] PeiServices An indirect pointer to the PEI Services Table published 52 by the PEI Foundation. 53 @param[in] VariableName A NULL-terminated Unicode string that is the name of the vendor's variable. 54 @param[in] VendorGuid A unique identifier for the vendor. 55 @param[out] Attributes This OPTIONAL parameter may be either NULL or 56 a pointer to the location in which to return 57 the attributes bitmask for the variable. 58 @param[in,out] DataSize On input, the size in bytes of the return Data buffer. 59 On output, the size of data returned in Data. 60 @param[out] Data The buffer to return the contents of the variable. 61 62 @retval EFI_SUCCESS The function completed successfully. 63 @retval EFI_NOT_FOUND The variable was not found. 64 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result. 65 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. 66 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. 67 68 **/ 69 typedef 70 EFI_STATUS 71 (EFIAPI *EFI_PEI_GET_VARIABLE)( 72 IN EFI_PEI_SERVICES **PeiServices, 73 IN CHAR16 *VariableName, 74 IN EFI_GUID *VendorGuid, 75 OUT UINT32 *Attributes OPTIONAL, 76 IN OUT UINTN *DataSize, 77 OUT VOID *Data 78 ); 79 80 /** 81 This function can be called multiple times to retrieve the VariableName 82 and VendorGuid of all variables currently available in the system. On each call 83 to GetNextVariableName(), the previous results are passed into the interface, 84 and on output the interface returns the next variable name data. When the 85 entire variable list has been returned, the error EFI_NOT_FOUND is returned. 86 87 @param[in] PeiServices An indirect pointer to the PEI Services Table 88 published by the PEI Foundation. 89 @param[in] VariableNameSize The size of the VariableName buffer. 90 @param[in] VariableName On input, supplies the last VariableName that was 91 returned by GetNextVariableName(). On output, 92 returns the Null-terminated Unicode string of the 93 current variable. 94 @param[in] VendorGuid On input, supplies the last VendorGuid that was 95 returned by GetNextVariableName(). On output, 96 returns the VendorGuid of the current variable. 97 98 @retval EFI_SUCCESS The function completed successfully. 99 @retval EFI_NOT_FOUND The next variable was not found. 100 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result. 101 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. 102 @retval EFI_DEVICE_ERROR The variable name could not be retrieved due to 103 a hardware error. 104 105 **/ 106 typedef 107 EFI_STATUS 108 (EFIAPI *EFI_PEI_GET_NEXT_VARIABLE_NAME)( 109 IN EFI_PEI_SERVICES **PeiServices, 110 IN OUT UINTN *VariableNameSize, 111 IN OUT CHAR16 *VariableName, 112 IN OUT EFI_GUID *VendorGuid 113 ); 114 115 /// 116 /// This PPI provides a lightweight, read-only variant of the full EFI 117 /// variable services. 118 /// 119 struct _EFI_PEI_READ_ONLY_VARIABLE_PPI { 120 /// 121 /// Inconsistent with specification here: 122 /// In Framework Spec, PeiCis0.91, the field is named as GetVariable and GetNextVariableName. 123 /// Keeping this inconsistancy for backward compatibility. 124 /// 125 EFI_PEI_GET_VARIABLE PeiGetVariable; ///< A service to ascertain a given variable name. 126 EFI_PEI_GET_NEXT_VARIABLE_NAME PeiGetNextVariableName; ///< A service to ascertain a variable based upon a given, known variable 127 }; 128 129 extern EFI_GUID gEfiPeiReadOnlyVariablePpiGuid; 130 131 #endif /* __PEI_READ_ONLY_VARIABLE_PPI_H__ */ 132 133