/** @file\r
Include file that supports UEFI.\r
\r
- This include file must contain things defined in the UEFI 2.5 specification.\r
- If a code construct is defined in the UEFI 2.5 specification it must be included\r
+ This include file must contain things defined in the UEFI 2.7 specification.\r
+ If a code construct is defined in the UEFI 2.7 specification it must be included\r
by this include file.\r
\r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under \r
-the terms and conditions of the BSD License that accompanies this distribution. \r
-The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php. \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
+Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
+\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
///\r
AllocateAnyPages,\r
///\r
- /// Allocate any available range of pages whose uppermost address is less than \r
+ /// Allocate any available range of pages whose uppermost address is less than\r
/// or equal to a specified maximum address.\r
///\r
AllocateMaxAddress,\r
#define EFI_MEMORY_XP 0x0000000000004000ULL\r
#define EFI_MEMORY_RO 0x0000000000020000ULL\r
//\r
-// Physical memory persistence attribute. \r
+// Physical memory persistence attribute.\r
// The memory region supports byte-addressable non-volatility.\r
//\r
#define EFI_MEMORY_NV 0x0000000000008000ULL\r
// If all memory has the same reliability, then this bit is not used.\r
//\r
#define EFI_MEMORY_MORE_RELIABLE 0x0000000000010000ULL\r
+\r
+//\r
+// Note: UEFI spec 2.8 and following:\r
+//\r
+// Specific-purpose memory (SPM). The memory is earmarked for\r
+// specific purposes such as for specific device drivers or applications.\r
+// The SPM attribute serves as a hint to the OS to avoid allocating this\r
+// memory for core OS data or code that can not be relocated.\r
+//\r
+#define EFI_MEMORY_SP 0x0000000000040000ULL\r
+//\r
+// If this flag is set, the memory region is capable of being\r
+// protected with the CPU?s memory cryptographic\r
+// capabilities. If this flag is clear, the memory region is not\r
+// capable of being protected with the CPU?s memory\r
+// cryptographic capabilities or the CPU does not support CPU\r
+// memory cryptographic capabilities.\r
+//\r
+#define EFI_MEMORY_CPU_CRYPTO 0x0000000000080000ULL\r
+\r
//\r
// Runtime memory attribute\r
//\r
///\r
typedef struct {\r
///\r
- /// Type of the memory region. See EFI_MEMORY_TYPE.\r
+ /// Type of the memory region.\r
+ /// Type EFI_MEMORY_TYPE is defined in the\r
+ /// AllocatePages() function description.\r
///\r
UINT32 Type;\r
///\r
- /// Physical address of the first byte of the memory region. Must aligned \r
- /// on a 4 KB boundary.\r
+ /// Physical address of the first byte in the memory region. PhysicalStart must be\r
+ /// aligned on a 4 KiB boundary, and must not be above 0xfffffffffffff000. Type\r
+ /// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function description\r
///\r
EFI_PHYSICAL_ADDRESS PhysicalStart;\r
///\r
- /// Virtual address of the first byte of the memory region. Must aligned \r
- /// on a 4 KB boundary.\r
+ /// Virtual address of the first byte in the memory region.\r
+ /// VirtualStart must be aligned on a 4 KiB boundary,\r
+ /// and must not be above 0xfffffffffffff000.\r
///\r
EFI_VIRTUAL_ADDRESS VirtualStart;\r
///\r
- /// Number of 4KB pages in the memory region.\r
+ /// NumberOfPagesNumber of 4 KiB pages in the memory region.\r
+ /// NumberOfPages must not be 0, and must not be any value\r
+ /// that would represent a memory page with a start address,\r
+ /// either physical or virtual, above 0xfffffffffffff000.\r
///\r
UINT64 NumberOfPages;\r
///\r
/// Attributes of the memory region that describe the bit mask of capabilities\r
- /// for that memory region, and not necessarily the current settings for that \r
+ /// for that memory region, and not necessarily the current settings for that\r
/// memory region.\r
///\r
UINT64 Attribute;\r
MemoryType values in the range 0x70000000..0x7FFFFFFF\r
are reserved for OEM use. MemoryType values in the range\r
0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders\r
- that are provided by operating system vendors. The only illegal\r
- memory type values are those in the range EfiMaxMemoryType..0x6FFFFFFF.\r
+ that are provided by operating system vendors.\r
@param[in] Pages The number of contiguous 4 KB pages to allocate.\r
@param[in, out] Memory The pointer to a physical address. On input, the way in which the address is\r
used depends on the value of Type.\r
2) MemoryType is in the range\r
EfiMaxMemoryType..0x6FFFFFFF.\r
3) Memory is NULL.\r
- 4) MemoryType was EfiPersistentMemory.\r
+ 4) MemoryType is EfiPersistentMemory.\r
@retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
@retval EFI_NOT_FOUND The requested pages could not be found.\r
\r
MemoryType values in the range 0x70000000..0x7FFFFFFF\r
are reserved for OEM use. MemoryType values in the range\r
0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders\r
- that are provided by operating system vendors. The only illegal\r
- memory type values are those in the range EfiMaxMemoryType..0x6FFFFFFF.\r
+ that are provided by operating system vendors.\r
@param[in] Size The number of bytes to allocate from the pool.\r
@param[out] Buffer A pointer to a pointer to the allocated buffer if the call succeeds;\r
undefined otherwise.\r
\r
@retval EFI_SUCCESS The requested number of bytes was allocated.\r
@retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.\r
- @retval EFI_INVALID_PARAMETER PoolType was invalid or Buffer is NULL.\r
- PoolType was EfiPersistentMemory.\r
+ @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
+ PoolType is in the range EfiMaxMemoryType..0x6FFFFFFF.\r
+ PoolType is EfiPersistentMemory.\r
\r
**/\r
typedef\r
@retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
present in the system.\r
2) No drivers were connected to ControllerHandle.\r
- @retval EFI_SECURITY_VIOLATION \r
- The user has no permission to start UEFI device drivers on the device path \r
+ @retval EFI_SECURITY_VIOLATION\r
+ The user has no permission to start UEFI device drivers on the device path\r
associated with the ControllerHandle or specified by the RemainingDevicePath.\r
**/\r
typedef\r
/**\r
Enumerates the current variable names.\r
\r
- @param[in, out] VariableNameSize The size of the VariableName buffer.\r
+ @param[in, out] VariableNameSize The size of the VariableName buffer. The size must be large\r
+ enough to fit input string supplied in VariableName buffer.\r
@param[in, out] VariableName On input, supplies the last VariableName that was returned\r
by GetNextVariableName(). On output, returns the Nullterminated\r
string of the current variable.\r
@retval EFI_SUCCESS The function completed successfully.\r
@retval EFI_NOT_FOUND The next variable was not found.\r
@retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.\r
+ VariableNameSize has been updated with the size needed to complete the request.\r
@retval EFI_INVALID_PARAMETER VariableNameSize is NULL.\r
@retval EFI_INVALID_PARAMETER VariableName is NULL.\r
@retval EFI_INVALID_PARAMETER VendorGuid is NULL.\r
+ @retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and\r
+ GUID of an existing variable.\r
+ @retval EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of\r
+ the input VariableName buffer.\r
@retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
\r
**/\r
then EFI_INVALID_PARAMETER is returned.\r
@param[in] VendorGuid A unique identifier for the vendor.\r
@param[in] Attributes Attributes bitmask to set for the variable.\r
- @param[in] DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE, \r
- EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or \r
- EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero \r
- causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is \r
- set, then a SetVariable() call with a DataSize of zero will not cause any change to \r
- the variable value (the timestamp associated with the variable may be updated however \r
- even if no new data value is provided,see the description of the \r
- EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not \r
- be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated). \r
+ @param[in] DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE or\r
+ EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero\r
+ causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is\r
+ set, then a SetVariable() call with a DataSize of zero will not cause any change to\r
+ the variable value (the timestamp associated with the variable may be updated however\r
+ even if no new data value is provided,see the description of the\r
+ EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not\r
+ be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).\r
@param[in] Data The contents for the variable.\r
\r
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as\r
@retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
@retval EFI_WRITE_PROTECTED The variable in question is read-only.\r
@retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.\r
- @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS \r
- or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo \r
- does NOT pass the validation check carried out by the firmware.\r
- \r
+ @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set,\r
+ but the AuthInfo does NOT pass the validation check carried out by the firmware.\r
+\r
@retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.\r
\r
**/\r
@retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
understood.\r
@retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
- @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the \r
+ @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the\r
image from being loaded. NULL is returned in *ImageHandle.\r
- @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a \r
- valid EFI_LOADED_IMAGE_PROTOCOL. However, the current \r
+ @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a\r
+ valid EFI_LOADED_IMAGE_PROTOCOL. However, the current\r
platform policy specifies that the image should not be started.\r
**/\r
typedef\r
/**\r
Terminates a loaded EFI image and returns control to boot services.\r
\r
- @param[in] ImageHandle Handle that identifies the image. This parameter is passed to the \r
+ @param[in] ImageHandle Handle that identifies the image. This parameter is passed to the\r
image on entry.\r
@param[in] ExitStatus The image's exit code.\r
@param[in] ExitDataSize The size, in bytes, of ExitData. Ignored if ExitStatus is EFI_SUCCESS.\r
@param[in] ExitData The pointer to a data buffer that includes a Null-terminated string,\r
- optionally followed by additional binary data. The string is a \r
- description that the caller may use to further indicate the reason \r
- for the image's exit. ExitData is only valid if ExitStatus \r
- is something other than EFI_SUCCESS. The ExitData buffer \r
+ optionally followed by additional binary data. The string is a\r
+ description that the caller may use to further indicate the reason\r
+ for the image's exit. ExitData is only valid if ExitStatus\r
+ is something other than EFI_SUCCESS. The ExitData buffer\r
must be allocated by calling AllocatePool().\r
\r
@retval EFI_SUCCESS The image specified by ImageHandle was unloaded.\r
\r
@param[in] ResetType The type of reset to perform.\r
@param[in] ResetStatus The status code for the reset.\r
- @param[in] DataSize The size, in bytes, of WatchdogData.\r
+ @param[in] DataSize The size, in bytes, of ResetData.\r
@param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or\r
EfiResetShutdown the data buffer starts with a Null-terminated\r
string, optionally followed by additional binary data.\r
-\r
+ The string is a description that the caller may use to further\r
+ indicate the reason for the system reset.\r
+ For a ResetType of EfiResetPlatformSpecific the data buffer\r
+ also starts with a Null-terminated string that is followed\r
+ by an EFI_GUID that describes the specific type of reset to perform.\r
**/\r
typedef\r
VOID\r
///\r
ByRegisterNotify,\r
///\r
- /// Retrieve the set of handles from the handle database that support a \r
+ /// Retrieve the set of handles from the handle database that support a\r
/// specified protocol.\r
///\r
ByProtocol\r
@retval EFI_NOT_FOUND No protocol instances were found that match Protocol and\r
Registration.\r
@retval EFI_INVALID_PARAMETER Interface is NULL.\r
+ Protocol is NULL.\r
\r
**/\r
typedef\r
@retval EFI_INVALID_PARAMETER CapsuleCount is 0.\r
@retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.\r
@retval EFI_UNSUPPORTED The capsule type is not supported on this platform.\r
- @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule \r
- is compatible with this platform but is not capable of being submitted or processed \r
+ @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule\r
+ is compatible with this platform but is not capable of being submitted or processed\r
in runtime. The caller may resubmit the capsule prior to ExitBootServices().\r
- @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates \r
+ @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates\r
the capsule is compatible with this platform but there are insufficient resources to process.\r
\r
**/\r
@retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and\r
MaximumCapsuleSize and ResetType are undefined.\r
@retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.\r
- @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule \r
- is compatible with this platform but is not capable of being submitted or processed \r
+ @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule\r
+ is compatible with this platform but is not capable of being submitted or processed\r
in runtime. The caller may resubmit the capsule prior to ExitBootServices().\r
- @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates \r
+ @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates\r
the capsule is compatible with this platform but there are insufficient resources to process.\r
\r
**/\r
// EFI Runtime Services Table\r
//\r
#define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')\r
+#define EFI_2_70_SYSTEM_TABLE_REVISION ((2 << 16) | (70))\r
+#define EFI_2_60_SYSTEM_TABLE_REVISION ((2 << 16) | (60))\r
#define EFI_2_50_SYSTEM_TABLE_REVISION ((2 << 16) | (50))\r
#define EFI_2_40_SYSTEM_TABLE_REVISION ((2 << 16) | (40))\r
#define EFI_2_31_SYSTEM_TABLE_REVISION ((2 << 16) | (31))\r
#define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00))\r
#define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10))\r
#define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02))\r
-#define EFI_SYSTEM_TABLE_REVISION EFI_2_50_SYSTEM_TABLE_REVISION\r
+#define EFI_SYSTEM_TABLE_REVISION EFI_2_70_SYSTEM_TABLE_REVISION\r
#define EFI_SPECIFICATION_VERSION EFI_SYSTEM_TABLE_REVISION\r
\r
#define EFI_RUNTIME_SERVICES_SIGNATURE SIGNATURE_64 ('R','U','N','T','S','E','R','V')\r
#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"\r
#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"\r
#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"\r
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"\r
\r
#if defined (MDE_CPU_IA32)\r
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32\r
-#elif defined (MDE_CPU_IPF)\r
- #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA64\r
#elif defined (MDE_CPU_X64)\r
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64\r
#elif defined (MDE_CPU_EBC)\r
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_ARM\r
#elif defined (MDE_CPU_AARCH64)\r
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64\r
+#elif defined (MDE_CPU_RISCV64)\r
+ #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64\r
#else\r
#error Unknown Processor Type\r
#endif\r
\r
+//\r
+// The directory within the active EFI System Partition defined for delivery of capsule to firmware\r
+//\r
+#define EFI_CAPSULE_FILE_DIRECTORY L"\\EFI\\UpdateCapsule\\"\r
+\r
#include <Uefi/UefiPxe.h>\r
#include <Uefi/UefiGpt.h>\r
#include <Uefi/UefiInternalFormRepresentation.h>\r