ReadOnlyVariable.h 5.6 KB

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