diff options
| author | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
|---|---|---|
| committer | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
| commit | 7e2ccccace24636f29ddc210b94606abd4c7e42b (patch) | |
| tree | 545d43ea12671048956cafeb12303e84d601e571 /MdeModulePkg/Include | |
| parent | 27b044605cd5f6b33a3d231576003850b3fe305b (diff) | |
| download | edk2-trunk.tar.xz | |
Renormalized end-of-lines from master@27b044605cd5f6b33a3d231576003850b3fe305btrunk
Diffstat (limited to 'MdeModulePkg/Include')
173 files changed, 19563 insertions, 19563 deletions
diff --git a/MdeModulePkg/Include/Guid/AcpiS3Context.h b/MdeModulePkg/Include/Guid/AcpiS3Context.h index 72d173c4fd..b3e2f436c3 100644 --- a/MdeModulePkg/Include/Guid/AcpiS3Context.h +++ b/MdeModulePkg/Include/Guid/AcpiS3Context.h @@ -1,66 +1,66 @@ -/** @file
- Definitions for data structures used in S3 resume.
-
-Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _ACPI_S3_DATA_H_
-#define _ACPI_S3_DATA_H_
-
-#include <Library/BaseLib.h>
-
-#define SMM_S3_RESUME_SMM_32 SIGNATURE_64 ('S','M','M','S','3','_','3','2')
-#define SMM_S3_RESUME_SMM_64 SIGNATURE_64 ('S','M','M','S','3','_','6','4')
-
-#pragma pack(1)
-
-typedef struct {
- UINT64 Signature;
- EFI_PHYSICAL_ADDRESS SmmS3ResumeEntryPoint;
- EFI_PHYSICAL_ADDRESS SmmS3StackBase;
- UINT64 SmmS3StackSize;
- UINT64 SmmS3Cr0;
- UINT64 SmmS3Cr3;
- UINT64 SmmS3Cr4;
- UINT16 ReturnCs;
- EFI_PHYSICAL_ADDRESS ReturnEntryPoint;
- EFI_PHYSICAL_ADDRESS ReturnContext1;
- EFI_PHYSICAL_ADDRESS ReturnContext2;
- EFI_PHYSICAL_ADDRESS ReturnStackPointer;
- EFI_PHYSICAL_ADDRESS MpService2Ppi;
- EFI_PHYSICAL_ADDRESS Smst;
-} SMM_S3_RESUME_STATE;
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS AcpiFacsTable;
- EFI_PHYSICAL_ADDRESS IdtrProfile;
- EFI_PHYSICAL_ADDRESS S3NvsPageTableAddress;
- EFI_PHYSICAL_ADDRESS BootScriptStackBase;
- UINT64 BootScriptStackSize;
- EFI_PHYSICAL_ADDRESS S3DebugBufferAddress;
-} ACPI_S3_CONTEXT;
-
-typedef struct {
- UINT16 ReturnCs;
- UINT64 ReturnStatus;
- EFI_PHYSICAL_ADDRESS ReturnEntryPoint;
- EFI_PHYSICAL_ADDRESS ReturnStackPointer;
- EFI_PHYSICAL_ADDRESS AsmTransferControl;
- IA32_DESCRIPTOR Idtr;
-} PEI_S3_RESUME_STATE;
-
-#pragma pack()
-
-#define EFI_ACPI_S3_CONTEXT_GUID \
- { \
- 0xef98d3a, 0x3e33, 0x497a, {0xa4, 0x1, 0x77, 0xbe, 0x3e, 0xb7, 0x4f, 0x38} \
- }
-
-extern EFI_GUID gEfiAcpiS3ContextGuid;
-
-extern EFI_GUID gEfiAcpiVariableGuid;
-
-#endif
+/** @file + Definitions for data structures used in S3 resume. + +Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _ACPI_S3_DATA_H_ +#define _ACPI_S3_DATA_H_ + +#include <Library/BaseLib.h> + +#define SMM_S3_RESUME_SMM_32 SIGNATURE_64 ('S','M','M','S','3','_','3','2') +#define SMM_S3_RESUME_SMM_64 SIGNATURE_64 ('S','M','M','S','3','_','6','4') + +#pragma pack(1) + +typedef struct { + UINT64 Signature; + EFI_PHYSICAL_ADDRESS SmmS3ResumeEntryPoint; + EFI_PHYSICAL_ADDRESS SmmS3StackBase; + UINT64 SmmS3StackSize; + UINT64 SmmS3Cr0; + UINT64 SmmS3Cr3; + UINT64 SmmS3Cr4; + UINT16 ReturnCs; + EFI_PHYSICAL_ADDRESS ReturnEntryPoint; + EFI_PHYSICAL_ADDRESS ReturnContext1; + EFI_PHYSICAL_ADDRESS ReturnContext2; + EFI_PHYSICAL_ADDRESS ReturnStackPointer; + EFI_PHYSICAL_ADDRESS MpService2Ppi; + EFI_PHYSICAL_ADDRESS Smst; +} SMM_S3_RESUME_STATE; + +typedef struct { + EFI_PHYSICAL_ADDRESS AcpiFacsTable; + EFI_PHYSICAL_ADDRESS IdtrProfile; + EFI_PHYSICAL_ADDRESS S3NvsPageTableAddress; + EFI_PHYSICAL_ADDRESS BootScriptStackBase; + UINT64 BootScriptStackSize; + EFI_PHYSICAL_ADDRESS S3DebugBufferAddress; +} ACPI_S3_CONTEXT; + +typedef struct { + UINT16 ReturnCs; + UINT64 ReturnStatus; + EFI_PHYSICAL_ADDRESS ReturnEntryPoint; + EFI_PHYSICAL_ADDRESS ReturnStackPointer; + EFI_PHYSICAL_ADDRESS AsmTransferControl; + IA32_DESCRIPTOR Idtr; +} PEI_S3_RESUME_STATE; + +#pragma pack() + +#define EFI_ACPI_S3_CONTEXT_GUID \ + { \ + 0xef98d3a, 0x3e33, 0x497a, {0xa4, 0x1, 0x77, 0xbe, 0x3e, 0xb7, 0x4f, 0x38} \ + } + +extern EFI_GUID gEfiAcpiS3ContextGuid; + +extern EFI_GUID gEfiAcpiVariableGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h b/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h index 69b5309530..6c43db29c3 100644 --- a/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h +++ b/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h @@ -1,23 +1,23 @@ -/** @file
- Definition for structure & defines exported by Boot Discovery Policy UI
-
- Copyright (c) 2021, ARM Ltd. All rights reserved.<BR>
- Copyright (c) 2021, Semihalf All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef BOOT_DISCOVERY_POLICY_UI_LIB_H_
-#define BOOT_DISCOVERY_POLICY_UI_LIB_H_
-
-#define BDP_CONNECT_MINIMAL 0 /* Do not connect any additional devices */
-#define BDP_CONNECT_NET 1
-#define BDP_CONNECT_ALL 2
-
-#define BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID { 0x5b6f7107, 0xbb3c, 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } }
-
-#define BOOT_DISCOVERY_POLICY_VAR L"BootDiscoveryPolicy"
-#define BOOT_DISCOVERY_POLICY_OLD_VAR L"BootDiscoveryPolicyOld"
-
-#endif
+/** @file + Definition for structure & defines exported by Boot Discovery Policy UI + + Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> + Copyright (c) 2021, Semihalf All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef BOOT_DISCOVERY_POLICY_UI_LIB_H_ +#define BOOT_DISCOVERY_POLICY_UI_LIB_H_ + +#define BDP_CONNECT_MINIMAL 0 /* Do not connect any additional devices */ +#define BDP_CONNECT_NET 1 +#define BDP_CONNECT_ALL 2 + +#define BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID { 0x5b6f7107, 0xbb3c, 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } } + +#define BOOT_DISCOVERY_POLICY_VAR L"BootDiscoveryPolicy" +#define BOOT_DISCOVERY_POLICY_OLD_VAR L"BootDiscoveryPolicyOld" + +#endif diff --git a/MdeModulePkg/Include/Guid/BootScriptExecutorVariable.h b/MdeModulePkg/Include/Guid/BootScriptExecutorVariable.h index d780b1b853..e16e572b6c 100644 --- a/MdeModulePkg/Include/Guid/BootScriptExecutorVariable.h +++ b/MdeModulePkg/Include/Guid/BootScriptExecutorVariable.h @@ -1,42 +1,42 @@ -/** @file
- Define Name, GUID and data format for an EFI Variable that is used to save the entry point
- of a code segment which will be loaded and executed by a standalone boot script
- executor on S3 boot path.
-
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _BOOT_SCRIPT_EXECUTOR_VARIABLE_H_
-#define _BOOT_SCRIPT_EXECUTOR_VARIABLE_H_
-
-#define EFI_BOOT_SCRIPT_EXECUTOR_VARIABLE_GUID \
- { \
- 0x3079818c, 0x46d4, 0x4a73, {0xae, 0xf3, 0xe3, 0xe4, 0x6c, 0xf1, 0xee, 0xdb} \
- }
-
-//
-// The following structure boosts performance by combining structure all ACPI related variables into one.
-//
-#pragma pack(1)
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS BootScriptExecutorEntrypoint;
-} BOOT_SCRIPT_EXECUTOR_VARIABLE;
-
-#pragma pack()
-
-#define BOOT_SCRIPT_EXECUTOR_VARIABLE_NAME L"BootScriptExecutorVariable"
-
-extern EFI_GUID gEfiBootScriptExecutorVariableGuid;
-
-#define EFI_BOOT_SCRIPT_EXECUTOR_CONTEXT_GUID \
- { \
- 0x79cb58c4, 0xac51, 0x442f, {0xaf, 0xd7, 0x98, 0xe4, 0x7d, 0x2e, 0x99, 0x8} \
- }
-
-extern EFI_GUID gEfiBootScriptExecutorContextGuid;
-
-#endif
+/** @file + Define Name, GUID and data format for an EFI Variable that is used to save the entry point + of a code segment which will be loaded and executed by a standalone boot script + executor on S3 boot path. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _BOOT_SCRIPT_EXECUTOR_VARIABLE_H_ +#define _BOOT_SCRIPT_EXECUTOR_VARIABLE_H_ + +#define EFI_BOOT_SCRIPT_EXECUTOR_VARIABLE_GUID \ + { \ + 0x3079818c, 0x46d4, 0x4a73, {0xae, 0xf3, 0xe3, 0xe4, 0x6c, 0xf1, 0xee, 0xdb} \ + } + +// +// The following structure boosts performance by combining structure all ACPI related variables into one. +// +#pragma pack(1) + +typedef struct { + EFI_PHYSICAL_ADDRESS BootScriptExecutorEntrypoint; +} BOOT_SCRIPT_EXECUTOR_VARIABLE; + +#pragma pack() + +#define BOOT_SCRIPT_EXECUTOR_VARIABLE_NAME L"BootScriptExecutorVariable" + +extern EFI_GUID gEfiBootScriptExecutorVariableGuid; + +#define EFI_BOOT_SCRIPT_EXECUTOR_CONTEXT_GUID \ + { \ + 0x79cb58c4, 0xac51, 0x442f, {0xaf, 0xd7, 0x98, 0xe4, 0x7d, 0x2e, 0x99, 0x8} \ + } + +extern EFI_GUID gEfiBootScriptExecutorContextGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/CapsuleVendor.h b/MdeModulePkg/Include/Guid/CapsuleVendor.h index 46615adb25..de09e575ab 100644 --- a/MdeModulePkg/Include/Guid/CapsuleVendor.h +++ b/MdeModulePkg/Include/Guid/CapsuleVendor.h @@ -1,59 +1,59 @@ -/** @file
- This file defines:
- * the capsule vendor GUID for capsule variables and the HOB.
- * the capsule variable name.
- * the capsule GUID HOB data structure.
- The capsule HOB and variable can be used to store the capsule image start address and length.
- They are used by EDKII implementation of capsule update across a system reset.
-
- @par Note: EDKII implementation of capsule updating has discarded this capsule GUID HOB data
- structure and used one UEFI Capsule HOB (defined in PI Specification 1.2) instead.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EFI_CAPSULE_VENDOR_GUID_H__
-#define __EFI_CAPSULE_VENDOR_GUID_H__
-
-///
-/// This guid is used as a variable GUID for the capsule variable
-/// if the capsule pointer is passed through reset via a variable.
-///
-/// This guid is also used as a hob GUID for the capsule data
-/// when the capsule pointer is passed from PEI phase to DXE phase.
-///
-#define EFI_CAPSULE_VENDOR_GUID \
- { 0x711C703F, 0xC285, 0x4B10, { 0xA3, 0xB0, 0x36, 0xEC, 0xBD, 0x3C, 0x8B, 0xE2 } }
-
-///
-/// Name of capsule variable.
-///
-#define EFI_CAPSULE_VARIABLE_NAME L"CapsuleUpdateData"
-
-///
-/// The data structure of the capsule guid hob entry.
-/// Note: EDKII implementation has discarded this structure and used
-/// UEFI_CAPSULE_HOB instead.
-///
-typedef struct {
- EFI_PHYSICAL_ADDRESS BaseAddress; ///< Capsule data start address.
- UINT32 Length; ///< Length of capsule data.
-} CAPSULE_HOB_INFO;
-
-//
-// The variable describes the long mode buffer used by IA32 Capsule PEIM
-// to call X64 CapsuleCoalesce code to handle >4GB capsule blocks.
-//
-#define EFI_CAPSULE_LONG_MODE_BUFFER_NAME L"CapsuleLongModeBuffer"
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS PageTableAddress;
- EFI_PHYSICAL_ADDRESS StackBaseAddress;
- UINT64 StackSize;
-} EFI_CAPSULE_LONG_MODE_BUFFER;
-
-extern EFI_GUID gEfiCapsuleVendorGuid;
-
-#endif // #ifndef _EFI_CAPSULE_VENDOR_GUID_H_
+/** @file + This file defines: + * the capsule vendor GUID for capsule variables and the HOB. + * the capsule variable name. + * the capsule GUID HOB data structure. + The capsule HOB and variable can be used to store the capsule image start address and length. + They are used by EDKII implementation of capsule update across a system reset. + + @par Note: EDKII implementation of capsule updating has discarded this capsule GUID HOB data + structure and used one UEFI Capsule HOB (defined in PI Specification 1.2) instead. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EFI_CAPSULE_VENDOR_GUID_H__ +#define __EFI_CAPSULE_VENDOR_GUID_H__ + +/// +/// This guid is used as a variable GUID for the capsule variable +/// if the capsule pointer is passed through reset via a variable. +/// +/// This guid is also used as a hob GUID for the capsule data +/// when the capsule pointer is passed from PEI phase to DXE phase. +/// +#define EFI_CAPSULE_VENDOR_GUID \ + { 0x711C703F, 0xC285, 0x4B10, { 0xA3, 0xB0, 0x36, 0xEC, 0xBD, 0x3C, 0x8B, 0xE2 } } + +/// +/// Name of capsule variable. +/// +#define EFI_CAPSULE_VARIABLE_NAME L"CapsuleUpdateData" + +/// +/// The data structure of the capsule guid hob entry. +/// Note: EDKII implementation has discarded this structure and used +/// UEFI_CAPSULE_HOB instead. +/// +typedef struct { + EFI_PHYSICAL_ADDRESS BaseAddress; ///< Capsule data start address. + UINT32 Length; ///< Length of capsule data. +} CAPSULE_HOB_INFO; + +// +// The variable describes the long mode buffer used by IA32 Capsule PEIM +// to call X64 CapsuleCoalesce code to handle >4GB capsule blocks. +// +#define EFI_CAPSULE_LONG_MODE_BUFFER_NAME L"CapsuleLongModeBuffer" + +typedef struct { + EFI_PHYSICAL_ADDRESS PageTableAddress; + EFI_PHYSICAL_ADDRESS StackBaseAddress; + UINT64 StackSize; +} EFI_CAPSULE_LONG_MODE_BUFFER; + +extern EFI_GUID gEfiCapsuleVendorGuid; + +#endif // #ifndef _EFI_CAPSULE_VENDOR_GUID_H_ diff --git a/MdeModulePkg/Include/Guid/ConnectConInEvent.h b/MdeModulePkg/Include/Guid/ConnectConInEvent.h index 6feeca2291..d47fc3c902 100644 --- a/MdeModulePkg/Include/Guid/ConnectConInEvent.h +++ b/MdeModulePkg/Include/Guid/ConnectConInEvent.h @@ -1,18 +1,18 @@ -/** @file
- GUID for an event that is signaled on the first attempt to check for a keystroke
- from the ConIn device.
-
- Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CONNECT_CONIN_EVENT_GUID_H__
-#define __CONNECT_CONIN_EVENT_GUID_H__
-
-#define CONNECT_CONIN_EVENT_GUID \
- { 0xdb4e8151, 0x57ed, 0x4bed, { 0x88, 0x33, 0x67, 0x51, 0xb5, 0xd1, 0xa8, 0xd7 }}
-
-extern EFI_GUID gConnectConInEventGuid;
-
-#endif
+/** @file + GUID for an event that is signaled on the first attempt to check for a keystroke + from the ConIn device. + + Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CONNECT_CONIN_EVENT_GUID_H__ +#define __CONNECT_CONIN_EVENT_GUID_H__ + +#define CONNECT_CONIN_EVENT_GUID \ + { 0xdb4e8151, 0x57ed, 0x4bed, { 0x88, 0x33, 0x67, 0x51, 0xb5, 0xd1, 0xa8, 0xd7 }} + +extern EFI_GUID gConnectConInEventGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/ConsoleInDevice.h b/MdeModulePkg/Include/Guid/ConsoleInDevice.h index 597f0c248e..e174e05ba5 100644 --- a/MdeModulePkg/Include/Guid/ConsoleInDevice.h +++ b/MdeModulePkg/Include/Guid/ConsoleInDevice.h @@ -1,18 +1,18 @@ -/** @file
- This GUID can be installed to the device handle to specify that the device is the console-in device.
-
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CONSOLE_IN_DEVICE_H__
-#define __CONSOLE_IN_DEVICE_H__
-
-#define EFI_CONSOLE_IN_DEVICE_GUID \
- { 0xd3b36f2b, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
-
-extern EFI_GUID gEfiConsoleInDeviceGuid;
-
-#endif
+/** @file + This GUID can be installed to the device handle to specify that the device is the console-in device. + + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CONSOLE_IN_DEVICE_H__ +#define __CONSOLE_IN_DEVICE_H__ + +#define EFI_CONSOLE_IN_DEVICE_GUID \ + { 0xd3b36f2b, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } + +extern EFI_GUID gEfiConsoleInDeviceGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/ConsoleOutDevice.h b/MdeModulePkg/Include/Guid/ConsoleOutDevice.h index 9cf13b8d54..615384dcaa 100644 --- a/MdeModulePkg/Include/Guid/ConsoleOutDevice.h +++ b/MdeModulePkg/Include/Guid/ConsoleOutDevice.h @@ -1,17 +1,17 @@ -/** @file
- This GUID can be installed to the device handle to specify that the device is the console-out device.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CONSOLE_OUT_DEVICE_H__
-#define __CONSOLE_OUT_DEVICE_H__
-
-#define EFI_CONSOLE_OUT_DEVICE_GUID \
- { 0xd3b36f2c, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
-
-extern EFI_GUID gEfiConsoleOutDeviceGuid;
-
-#endif
+/** @file + This GUID can be installed to the device handle to specify that the device is the console-out device. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CONSOLE_OUT_DEVICE_H__ +#define __CONSOLE_OUT_DEVICE_H__ + +#define EFI_CONSOLE_OUT_DEVICE_GUID \ + { 0xd3b36f2c, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } + +extern EFI_GUID gEfiConsoleOutDeviceGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/Crc32GuidedSectionExtraction.h b/MdeModulePkg/Include/Guid/Crc32GuidedSectionExtraction.h index 84c7c09ac3..c1d4c16d77 100644 --- a/MdeModulePkg/Include/Guid/Crc32GuidedSectionExtraction.h +++ b/MdeModulePkg/Include/Guid/Crc32GuidedSectionExtraction.h @@ -1,18 +1,18 @@ -/** @file
- This file defines CRC32 GUID to specify the CRC32
- encapsulation scheme for the GUIDed section.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CRC32_GUIDED_SECTION_EXTRACTION_H__
-#define __CRC32_GUIDED_SECTION_EXTRACTION_H__
-
-#define EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID \
- { 0xFC1BCDB0, 0x7D31, 0x49aa, {0x93, 0x6A, 0xA4, 0x60, 0x0D, 0x9D, 0xD0, 0x83 } }
-
-extern EFI_GUID gEfiCrc32GuidedSectionExtractionGuid;
-
-#endif
+/** @file + This file defines CRC32 GUID to specify the CRC32 + encapsulation scheme for the GUIDed section. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CRC32_GUIDED_SECTION_EXTRACTION_H__ +#define __CRC32_GUIDED_SECTION_EXTRACTION_H__ + +#define EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID \ + { 0xFC1BCDB0, 0x7D31, 0x49aa, {0x93, 0x6A, 0xA4, 0x60, 0x0D, 0x9D, 0xD0, 0x83 } } + +extern EFI_GUID gEfiCrc32GuidedSectionExtractionGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/DebugMask.h b/MdeModulePkg/Include/Guid/DebugMask.h index 427bcbb147..203831724f 100644 --- a/MdeModulePkg/Include/Guid/DebugMask.h +++ b/MdeModulePkg/Include/Guid/DebugMask.h @@ -1,68 +1,68 @@ -/** @file
-
- Debug Mask Protocol.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DEBUG_MASK_H__
-#define __DEBUG_MASK_H__
-
-///
-/// Protocol GUID for DXE Phase Debug Mask support
-///
-#define EFI_DEBUG_MASK_PROTOCOL_GUID \
- { 0x4c8a2451, 0xc207, 0x405b, {0x96, 0x94, 0x99, 0xea, 0x13, 0x25, 0x13, 0x41} }
-
-///
-/// Forward reference for pure ANSI compatability
-///
-typedef struct _EFI_DEBUG_MASK_PROTOCOL EFI_DEBUG_MASK_PROTOCOL;
-
-///
-///
-///
-#define EFI_DEBUG_MASK_REVISION 0x00010000
-
-//
-// DebugMask member functions definition
-//
-typedef
-EFI_STATUS
-(EFIAPI *EFI_GET_DEBUG_MASK)(
- IN EFI_DEBUG_MASK_PROTOCOL *This,
- IN OUT UINTN *CurrentDebugMask
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SET_DEBUG_MASK)(
- IN EFI_DEBUG_MASK_PROTOCOL *This,
- IN UINTN NewDebugMask
- );
-
-///
-/// DebugMask protocol definition
-///
-struct _EFI_DEBUG_MASK_PROTOCOL {
- INT64 Revision;
- EFI_GET_DEBUG_MASK GetDebugMask;
- EFI_SET_DEBUG_MASK SetDebugMask;
-};
-
-extern EFI_GUID gEfiDebugMaskProtocolGuid;
-
-///
-/// GUID used to store the global debug mask in an the "EFIDebug" EFI Variabe
-/// Also used as a GUIDed HOB that contains a UINT32 debug mask default value
-///
-#define EFI_GENERIC_VARIABLE_GUID \
- { 0x59d1c24f, 0x50f1, 0x401a, {0xb1, 0x01, 0xf3, 0x3e, 0x0d, 0xae, 0xd4, 0x43} }
-
-#define DEBUG_MASK_VARIABLE_NAME L"EFIDebug"
-
-extern EFI_GUID gEfiGenericVariableGuid;
-
-#endif
+/** @file + + Debug Mask Protocol. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DEBUG_MASK_H__ +#define __DEBUG_MASK_H__ + +/// +/// Protocol GUID for DXE Phase Debug Mask support +/// +#define EFI_DEBUG_MASK_PROTOCOL_GUID \ + { 0x4c8a2451, 0xc207, 0x405b, {0x96, 0x94, 0x99, 0xea, 0x13, 0x25, 0x13, 0x41} } + +/// +/// Forward reference for pure ANSI compatability +/// +typedef struct _EFI_DEBUG_MASK_PROTOCOL EFI_DEBUG_MASK_PROTOCOL; + +/// +/// +/// +#define EFI_DEBUG_MASK_REVISION 0x00010000 + +// +// DebugMask member functions definition +// +typedef +EFI_STATUS +(EFIAPI *EFI_GET_DEBUG_MASK)( + IN EFI_DEBUG_MASK_PROTOCOL *This, + IN OUT UINTN *CurrentDebugMask + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_SET_DEBUG_MASK)( + IN EFI_DEBUG_MASK_PROTOCOL *This, + IN UINTN NewDebugMask + ); + +/// +/// DebugMask protocol definition +/// +struct _EFI_DEBUG_MASK_PROTOCOL { + INT64 Revision; + EFI_GET_DEBUG_MASK GetDebugMask; + EFI_SET_DEBUG_MASK SetDebugMask; +}; + +extern EFI_GUID gEfiDebugMaskProtocolGuid; + +/// +/// GUID used to store the global debug mask in an the "EFIDebug" EFI Variabe +/// Also used as a GUIDed HOB that contains a UINT32 debug mask default value +/// +#define EFI_GENERIC_VARIABLE_GUID \ + { 0x59d1c24f, 0x50f1, 0x401a, {0xb1, 0x01, 0xf3, 0x3e, 0x0d, 0xae, 0xd4, 0x43} } + +#define DEBUG_MASK_VARIABLE_NAME L"EFIDebug" + +extern EFI_GUID gEfiGenericVariableGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/DriverSampleHii.h b/MdeModulePkg/Include/Guid/DriverSampleHii.h index b8d8c79845..00751e3b99 100644 --- a/MdeModulePkg/Include/Guid/DriverSampleHii.h +++ b/MdeModulePkg/Include/Guid/DriverSampleHii.h @@ -1,31 +1,31 @@ -/** @file
- GUIDs used as HII FormSet and HII Package list GUID in Driver Sample driver.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DRIVER_SAMPLE_HII_GUID_H__
-#define __DRIVER_SAMPLE_HII_GUID_H__
-
-#define DRIVER_SAMPLE_FORMSET_GUID \
- { \
- 0xA04A27f4, 0xDF00, 0x4D42, {0xB5, 0x52, 0x39, 0x51, 0x13, 0x02, 0x11, 0x3D} \
- }
-
-#define DRIVER_SAMPLE_INVENTORY_GUID \
- { \
- 0xb3f56470, 0x6141, 0x4621, {0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8} \
- }
-
-#define EFI_IFR_REFRESH_ID_OP_GUID \
- { \
- 0xF5E655D9, 0x02A6, 0x46f2, {0x9E, 0x76, 0xB8, 0xBE, 0x8E, 0x60, 0xAB, 0x22} \
- }
-
-extern EFI_GUID gDriverSampleFormSetGuid;
-extern EFI_GUID gDriverSampleInventoryGuid;
-extern EFI_GUID gEfiIfrRefreshIdOpGuid;
-
-#endif
+/** @file + GUIDs used as HII FormSet and HII Package list GUID in Driver Sample driver. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DRIVER_SAMPLE_HII_GUID_H__ +#define __DRIVER_SAMPLE_HII_GUID_H__ + +#define DRIVER_SAMPLE_FORMSET_GUID \ + { \ + 0xA04A27f4, 0xDF00, 0x4D42, {0xB5, 0x52, 0x39, 0x51, 0x13, 0x02, 0x11, 0x3D} \ + } + +#define DRIVER_SAMPLE_INVENTORY_GUID \ + { \ + 0xb3f56470, 0x6141, 0x4621, {0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8} \ + } + +#define EFI_IFR_REFRESH_ID_OP_GUID \ + { \ + 0xF5E655D9, 0x02A6, 0x46f2, {0x9E, 0x76, 0xB8, 0xBE, 0x8E, 0x60, 0xAB, 0x22} \ + } + +extern EFI_GUID gDriverSampleFormSetGuid; +extern EFI_GUID gDriverSampleInventoryGuid; +extern EFI_GUID gEfiIfrRefreshIdOpGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/EndOfS3Resume.h b/MdeModulePkg/Include/Guid/EndOfS3Resume.h index 1b89f3cc6e..aa7f10f474 100644 --- a/MdeModulePkg/Include/Guid/EndOfS3Resume.h +++ b/MdeModulePkg/Include/Guid/EndOfS3Resume.h @@ -1,20 +1,20 @@ -/** @file
- This GUID will be installed at the end of S3 resume phase as protocol in SMM environment.
- It allows for SMM drivers to hook this point and do the required tasks.
-
- Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __END_OF_S3_RESUME_H__
-#define __END_OF_S3_RESUME_H__
-
-#define EDKII_END_OF_S3_RESUME_GUID \
- { \
- 0x96f5296d, 0x05f7, 0x4f3c, {0x84, 0x67, 0xe4, 0x56, 0x89, 0x0e, 0x0c, 0xb5 } \
- }
-
-extern EFI_GUID gEdkiiEndOfS3ResumeGuid;
-
-#endif
+/** @file + This GUID will be installed at the end of S3 resume phase as protocol in SMM environment. + It allows for SMM drivers to hook this point and do the required tasks. + + Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __END_OF_S3_RESUME_H__ +#define __END_OF_S3_RESUME_H__ + +#define EDKII_END_OF_S3_RESUME_GUID \ + { \ + 0x96f5296d, 0x05f7, 0x4f3c, {0x84, 0x67, 0xe4, 0x56, 0x89, 0x0e, 0x0c, 0xb5 } \ + } + +extern EFI_GUID gEdkiiEndOfS3ResumeGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/EventExitBootServiceFailed.h b/MdeModulePkg/Include/Guid/EventExitBootServiceFailed.h index fbed870afb..b696ffed51 100644 --- a/MdeModulePkg/Include/Guid/EventExitBootServiceFailed.h +++ b/MdeModulePkg/Include/Guid/EventExitBootServiceFailed.h @@ -1,18 +1,18 @@ -/** @file
- GUID is the name of events used with ExitBootServices in order to be notified
- when this ExitBootServices Call is failed.
-
- Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EVENT_EXIT_BOOT_FAILED_GUID_H__
-#define __EVENT_EXIT_BOOT_FAILED_GUID_H__
-
-#define EVENT_GROUP_EXIT_BOOT_SERVICES_FAILED \
- { 0x4f6c5507, 0x232f, 0x4787, { 0xb9, 0x5e, 0x72, 0xf8, 0x62, 0x49, 0xc, 0xb1 } }
-
-extern EFI_GUID gEventExitBootServicesFailedGuid;
-
-#endif
+/** @file + GUID is the name of events used with ExitBootServices in order to be notified + when this ExitBootServices Call is failed. + + Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EVENT_EXIT_BOOT_FAILED_GUID_H__ +#define __EVENT_EXIT_BOOT_FAILED_GUID_H__ + +#define EVENT_GROUP_EXIT_BOOT_SERVICES_FAILED \ + { 0x4f6c5507, 0x232f, 0x4787, { 0xb9, 0x5e, 0x72, 0xf8, 0x62, 0x49, 0xc, 0xb1 } } + +extern EFI_GUID gEventExitBootServicesFailedGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/ExtendedFirmwarePerformance.h b/MdeModulePkg/Include/Guid/ExtendedFirmwarePerformance.h index 20be7654c8..52ae89eb06 100644 --- a/MdeModulePkg/Include/Guid/ExtendedFirmwarePerformance.h +++ b/MdeModulePkg/Include/Guid/ExtendedFirmwarePerformance.h @@ -1,254 +1,254 @@ -/** @file
- This file defines edk2 extended firmware performance records.
- These records will be added into ACPI FPDT Firmware Basic Boot Performance Table.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EXTENDED_FIRMWARE_PERFORMANCE_H__
-#define __EXTENDED_FIRMWARE_PERFORMANCE_H__
-
-#include <IndustryStandard/Acpi.h>
-
-//
-// Known performance tokens
-//
-#define SEC_TOK "SEC" ///< SEC Phase
-#define DXE_TOK "DXE" ///< DXE Phase
-#define PEI_TOK "PEI" ///< PEI Phase
-#define BDS_TOK "BDS" ///< BDS Phase
-#define DRIVERBINDING_START_TOK "DB:Start:" ///< Driver Binding Start() function call
-#define DRIVERBINDING_SUPPORT_TOK "DB:Support:" ///< Driver Binding Support() function call
-#define DRIVERBINDING_STOP_TOK "DB:Stop:" ///< Driver Binding Stop() function call
-#define LOAD_IMAGE_TOK "LoadImage:" ///< Load a dispatched module
-#define START_IMAGE_TOK "StartImage:" ///< Dispatched Modules Entry Point execution
-#define PEIM_TOK "PEIM" ///< PEIM Modules Entry Point execution
-
-//
-// Misc defines
-//
-#define FPDT_RECORD_REVISION_1 (0x01)
-
-//
-// Length field in EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER is a UINT8, thus:
-//
-#define FPDT_MAX_PERF_RECORD_SIZE (MAX_UINT8)
-
-//
-// FPDT Record Types
-//
-#define FPDT_GUID_EVENT_TYPE 0x1010
-#define FPDT_DYNAMIC_STRING_EVENT_TYPE 0x1011
-#define FPDT_DUAL_GUID_STRING_EVENT_TYPE 0x1012
-#define FPDT_GUID_QWORD_EVENT_TYPE 0x1013
-#define FPDT_GUID_QWORD_STRING_EVENT_TYPE 0x1014
-
-//
-// EDKII extended Fpdt record structures
-//
-#define FPDT_STRING_EVENT_RECORD_NAME_LENGTH 24
-
-#pragma pack(1)
-//
-// FPDT Boot Performance Guid Event Record Structure
-//
-typedef struct {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
- ///
- /// ProgressID < 0x10 are reserved for core performance entries.
- /// Start measurement point shall have lowered one nibble set to zero and
- /// corresponding end points shall have lowered one nibble set to non-zero value;
- /// keeping other nibbles same as start point.
- ///
- UINT16 ProgressID;
- ///
- /// APIC ID for the processor in the system used as a timestamp clock source.
- /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
- ///
- UINT32 ApicID;
- ///
- /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
- ///
- UINT64 Timestamp;
- ///
- /// If ProgressID < 0x10, GUID of the referenced module; otherwise, GUID of the module logging the event.
- ///
- EFI_GUID Guid;
-} FPDT_GUID_EVENT_RECORD;
-
-//
-// FPDT Boot Performance Dynamic String Event Record Structure
-//
-typedef struct {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
- ///
- /// ProgressID < 0x10 are reserved for core performance entries.
- /// Start measurement point shall have lowered one nibble set to zero and
- /// corresponding end points shall have lowered one nibble set to non-zero value;
- /// keeping other nibbles same as start point.
- ///
- UINT16 ProgressID;
- ///
- /// APIC ID for the processor in the system used as a timestamp clock source.
- /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
- ///
- UINT32 ApicID;
- ///
- /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
- ///
- UINT64 Timestamp;
- ///
- /// If ProgressID < 0x10, GUID of the referenced module; otherwise, GUID of the module logging the event.
- ///
- EFI_GUID Guid;
- ///
- /// ASCII string describing the module. Padding supplied at the end if necessary with null characters (0x00).
- /// It may be module name, function name, or token name.
- ///
- CHAR8 String[0];
-} FPDT_DYNAMIC_STRING_EVENT_RECORD;
-
-//
-// FPDT Boot Performance Dual GUID String Event Record Structure
-//
-typedef struct {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
- ///
- /// ProgressID < 0x10 are reserved for core performance entries.
- /// Start measurement point shall have lowered one nibble set to zero and
- /// corresponding end points shall have lowered one nibble set to non-zero value;
- /// keeping other nibbles same as start point.
- ///
- UINT16 ProgressID;
- ///
- /// APIC ID for the processor in the system used as a timestamp clock source.
- /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
- ///
- UINT32 ApicID;
- ///
- /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
- ///
- UINT64 Timestamp;
- ///
- /// GUID of the module logging the event.
- ///
- EFI_GUID Guid1;
- ///
- /// Event or Ppi or Protocol GUID for Callback.
- ///
- EFI_GUID Guid2;
- ///
- /// ASCII string describing the module. Padding supplied at the end if necessary with null characters (0x00).
- /// It is the function name.
- ///
- CHAR8 String[0];
-} FPDT_DUAL_GUID_STRING_EVENT_RECORD;
-
-//
-// FPDT Boot Performance GUID Qword Event Record Structure
-//
-typedef struct {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
- ///
- /// ProgressID < 0x10 are reserved for core performance entries.
- /// Start measurement point shall have lowered one nibble set to zero and
- /// corresponding end points shall have lowered one nibble set to non-zero value;
- /// keeping other nibbles same as start point.
- ///
- UINT16 ProgressID;
- ///
- /// APIC ID for the processor in the system used as a timestamp clock source.
- /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
- ///
- UINT32 ApicID;
- ///
- /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
- ///
- UINT64 Timestamp;
- ///
- /// GUID of the module logging the event
- ///
- EFI_GUID Guid;
- ///
- /// Qword of misc data, meaning depends on the ProgressId
- ///
- UINT64 Qword;
-} FPDT_GUID_QWORD_EVENT_RECORD;
-
-//
-// FPDT Boot Performance GUID Qword String Event Record Structure
-//
-typedef struct {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header;
- ///
- /// ProgressID < 0x10 are reserved for core performance entries.
- /// Start measurement point shall have lowered one nibble set to zero and
- /// corresponding end points shall have lowered one nibble set to non-zero value;
- /// keeping other nibbles same as start point.
- ///
- UINT16 ProgressID;
- ///
- /// APIC ID for the processor in the system used as a timestamp clock source.
- /// If only one timestamp clock source is used, this field is Reserved and populated as 0.
- ///
- UINT32 ApicID;
- ///
- /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset.
- ///
- UINT64 Timestamp;
- ///
- /// GUID of the module logging the event
- ///
- EFI_GUID Guid;
- ///
- /// Qword of misc data, meaning depends on the ProgressId
- ///
- UINT64 Qword;
- ///
- /// ASCII string describing the module. Padding supplied at the end if necessary with null characters (0x00).
- ///
- CHAR8 String[0];
-} FPDT_GUID_QWORD_STRING_EVENT_RECORD;
-
-#pragma pack()
-
-//
-// Union of all FPDT records
-//
-typedef union {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER RecordHeader;
- FPDT_GUID_EVENT_RECORD GuidEvent;
- FPDT_DYNAMIC_STRING_EVENT_RECORD DynamicStringEvent;
- FPDT_DUAL_GUID_STRING_EVENT_RECORD DualGuidStringEvent;
- FPDT_GUID_QWORD_EVENT_RECORD GuidQwordEvent;
- FPDT_GUID_QWORD_STRING_EVENT_RECORD GuidQwordStringEvent;
-} FPDT_RECORD;
-
-//
-// Union of all pointers to FPDT records
-//
-typedef union {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *RecordHeader;
- FPDT_GUID_EVENT_RECORD *GuidEvent;
- FPDT_DYNAMIC_STRING_EVENT_RECORD *DynamicStringEvent;
- FPDT_DUAL_GUID_STRING_EVENT_RECORD *DualGuidStringEvent;
- FPDT_GUID_QWORD_EVENT_RECORD *GuidQwordEvent;
- FPDT_GUID_QWORD_STRING_EVENT_RECORD *GuidQwordStringEvent;
-} FPDT_RECORD_PTR;
-
-///
-/// Hob:
-/// GUID - gEdkiiFpdtExtendedFirmwarePerformanceGuid;
-/// Data - FPDT_PEI_EXT_PERF_HEADER + one or more FPDT records
-///
-typedef struct {
- UINT32 SizeOfAllEntries;
- UINT32 LoadImageCount;
- UINT32 HobIsFull;
-} FPDT_PEI_EXT_PERF_HEADER;
-
-extern EFI_GUID gEdkiiFpdtExtendedFirmwarePerformanceGuid;
-
-#endif
+/** @file + This file defines edk2 extended firmware performance records. + These records will be added into ACPI FPDT Firmware Basic Boot Performance Table. + +Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EXTENDED_FIRMWARE_PERFORMANCE_H__ +#define __EXTENDED_FIRMWARE_PERFORMANCE_H__ + +#include <IndustryStandard/Acpi.h> + +// +// Known performance tokens +// +#define SEC_TOK "SEC" ///< SEC Phase +#define DXE_TOK "DXE" ///< DXE Phase +#define PEI_TOK "PEI" ///< PEI Phase +#define BDS_TOK "BDS" ///< BDS Phase +#define DRIVERBINDING_START_TOK "DB:Start:" ///< Driver Binding Start() function call +#define DRIVERBINDING_SUPPORT_TOK "DB:Support:" ///< Driver Binding Support() function call +#define DRIVERBINDING_STOP_TOK "DB:Stop:" ///< Driver Binding Stop() function call +#define LOAD_IMAGE_TOK "LoadImage:" ///< Load a dispatched module +#define START_IMAGE_TOK "StartImage:" ///< Dispatched Modules Entry Point execution +#define PEIM_TOK "PEIM" ///< PEIM Modules Entry Point execution + +// +// Misc defines +// +#define FPDT_RECORD_REVISION_1 (0x01) + +// +// Length field in EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER is a UINT8, thus: +// +#define FPDT_MAX_PERF_RECORD_SIZE (MAX_UINT8) + +// +// FPDT Record Types +// +#define FPDT_GUID_EVENT_TYPE 0x1010 +#define FPDT_DYNAMIC_STRING_EVENT_TYPE 0x1011 +#define FPDT_DUAL_GUID_STRING_EVENT_TYPE 0x1012 +#define FPDT_GUID_QWORD_EVENT_TYPE 0x1013 +#define FPDT_GUID_QWORD_STRING_EVENT_TYPE 0x1014 + +// +// EDKII extended Fpdt record structures +// +#define FPDT_STRING_EVENT_RECORD_NAME_LENGTH 24 + +#pragma pack(1) +// +// FPDT Boot Performance Guid Event Record Structure +// +typedef struct { + EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header; + /// + /// ProgressID < 0x10 are reserved for core performance entries. + /// Start measurement point shall have lowered one nibble set to zero and + /// corresponding end points shall have lowered one nibble set to non-zero value; + /// keeping other nibbles same as start point. + /// + UINT16 ProgressID; + /// + /// APIC ID for the processor in the system used as a timestamp clock source. + /// If only one timestamp clock source is used, this field is Reserved and populated as 0. + /// + UINT32 ApicID; + /// + /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset. + /// + UINT64 Timestamp; + /// + /// If ProgressID < 0x10, GUID of the referenced module; otherwise, GUID of the module logging the event. + /// + EFI_GUID Guid; +} FPDT_GUID_EVENT_RECORD; + +// +// FPDT Boot Performance Dynamic String Event Record Structure +// +typedef struct { + EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header; + /// + /// ProgressID < 0x10 are reserved for core performance entries. + /// Start measurement point shall have lowered one nibble set to zero and + /// corresponding end points shall have lowered one nibble set to non-zero value; + /// keeping other nibbles same as start point. + /// + UINT16 ProgressID; + /// + /// APIC ID for the processor in the system used as a timestamp clock source. + /// If only one timestamp clock source is used, this field is Reserved and populated as 0. + /// + UINT32 ApicID; + /// + /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset. + /// + UINT64 Timestamp; + /// + /// If ProgressID < 0x10, GUID of the referenced module; otherwise, GUID of the module logging the event. + /// + EFI_GUID Guid; + /// + /// ASCII string describing the module. Padding supplied at the end if necessary with null characters (0x00). + /// It may be module name, function name, or token name. + /// + CHAR8 String[0]; +} FPDT_DYNAMIC_STRING_EVENT_RECORD; + +// +// FPDT Boot Performance Dual GUID String Event Record Structure +// +typedef struct { + EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header; + /// + /// ProgressID < 0x10 are reserved for core performance entries. + /// Start measurement point shall have lowered one nibble set to zero and + /// corresponding end points shall have lowered one nibble set to non-zero value; + /// keeping other nibbles same as start point. + /// + UINT16 ProgressID; + /// + /// APIC ID for the processor in the system used as a timestamp clock source. + /// If only one timestamp clock source is used, this field is Reserved and populated as 0. + /// + UINT32 ApicID; + /// + /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset. + /// + UINT64 Timestamp; + /// + /// GUID of the module logging the event. + /// + EFI_GUID Guid1; + /// + /// Event or Ppi or Protocol GUID for Callback. + /// + EFI_GUID Guid2; + /// + /// ASCII string describing the module. Padding supplied at the end if necessary with null characters (0x00). + /// It is the function name. + /// + CHAR8 String[0]; +} FPDT_DUAL_GUID_STRING_EVENT_RECORD; + +// +// FPDT Boot Performance GUID Qword Event Record Structure +// +typedef struct { + EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header; + /// + /// ProgressID < 0x10 are reserved for core performance entries. + /// Start measurement point shall have lowered one nibble set to zero and + /// corresponding end points shall have lowered one nibble set to non-zero value; + /// keeping other nibbles same as start point. + /// + UINT16 ProgressID; + /// + /// APIC ID for the processor in the system used as a timestamp clock source. + /// If only one timestamp clock source is used, this field is Reserved and populated as 0. + /// + UINT32 ApicID; + /// + /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset. + /// + UINT64 Timestamp; + /// + /// GUID of the module logging the event + /// + EFI_GUID Guid; + /// + /// Qword of misc data, meaning depends on the ProgressId + /// + UINT64 Qword; +} FPDT_GUID_QWORD_EVENT_RECORD; + +// +// FPDT Boot Performance GUID Qword String Event Record Structure +// +typedef struct { + EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER Header; + /// + /// ProgressID < 0x10 are reserved for core performance entries. + /// Start measurement point shall have lowered one nibble set to zero and + /// corresponding end points shall have lowered one nibble set to non-zero value; + /// keeping other nibbles same as start point. + /// + UINT16 ProgressID; + /// + /// APIC ID for the processor in the system used as a timestamp clock source. + /// If only one timestamp clock source is used, this field is Reserved and populated as 0. + /// + UINT32 ApicID; + /// + /// 64-bit value (nanosecond) describing elapsed time since the most recent deassertion of processor reset. + /// + UINT64 Timestamp; + /// + /// GUID of the module logging the event + /// + EFI_GUID Guid; + /// + /// Qword of misc data, meaning depends on the ProgressId + /// + UINT64 Qword; + /// + /// ASCII string describing the module. Padding supplied at the end if necessary with null characters (0x00). + /// + CHAR8 String[0]; +} FPDT_GUID_QWORD_STRING_EVENT_RECORD; + +#pragma pack() + +// +// Union of all FPDT records +// +typedef union { + EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER RecordHeader; + FPDT_GUID_EVENT_RECORD GuidEvent; + FPDT_DYNAMIC_STRING_EVENT_RECORD DynamicStringEvent; + FPDT_DUAL_GUID_STRING_EVENT_RECORD DualGuidStringEvent; + FPDT_GUID_QWORD_EVENT_RECORD GuidQwordEvent; + FPDT_GUID_QWORD_STRING_EVENT_RECORD GuidQwordStringEvent; +} FPDT_RECORD; + +// +// Union of all pointers to FPDT records +// +typedef union { + EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *RecordHeader; + FPDT_GUID_EVENT_RECORD *GuidEvent; + FPDT_DYNAMIC_STRING_EVENT_RECORD *DynamicStringEvent; + FPDT_DUAL_GUID_STRING_EVENT_RECORD *DualGuidStringEvent; + FPDT_GUID_QWORD_EVENT_RECORD *GuidQwordEvent; + FPDT_GUID_QWORD_STRING_EVENT_RECORD *GuidQwordStringEvent; +} FPDT_RECORD_PTR; + +/// +/// Hob: +/// GUID - gEdkiiFpdtExtendedFirmwarePerformanceGuid; +/// Data - FPDT_PEI_EXT_PERF_HEADER + one or more FPDT records +/// +typedef struct { + UINT32 SizeOfAllEntries; + UINT32 LoadImageCount; + UINT32 HobIsFull; +} FPDT_PEI_EXT_PERF_HEADER; + +extern EFI_GUID gEdkiiFpdtExtendedFirmwarePerformanceGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/FaultTolerantWrite.h b/MdeModulePkg/Include/Guid/FaultTolerantWrite.h index 29c4aeba6a..875ab204c7 100644 --- a/MdeModulePkg/Include/Guid/FaultTolerantWrite.h +++ b/MdeModulePkg/Include/Guid/FaultTolerantWrite.h @@ -1,48 +1,48 @@ -/** @file
- Define the GUID gEdkiiFaultTolerantWriteGuid that will be used to build
- FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob and install PPI to inform the check
- for FTW last write data has been done. The GUID hob will be only built if FTW last write was
- still in progress with SpareComplete set and DestinationComplete not set.
-
-Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _FAULT_TOLERANT_WRITE_H_
-#define _FAULT_TOLERANT_WRITE_H_
-
-#define EDKII_FAULT_TOLERANT_WRITE_GUID \
- { \
- 0x1d3e9cb8, 0x43af, 0x490b, { 0x83, 0xa, 0x35, 0x16, 0xaa, 0x53, 0x20, 0x47 } \
- }
-
-//
-// FTW Last write data. It will be used as gEdkiiFaultTolerantWriteGuid GUID hob data.
-//
-typedef struct {
- ///
- /// Target address to be updated in FTW last write.
- ///
- EFI_PHYSICAL_ADDRESS TargetAddress;
- ///
- /// Spare address to back up the updated buffer.
- ///
- EFI_PHYSICAL_ADDRESS SpareAddress;
- ///
- /// The length of data that have been backed up in spare block.
- /// It is also the length of target block that has been erased.
- ///
- UINT64 Length;
-} FAULT_TOLERANT_WRITE_LAST_WRITE_DATA;
-
-//
-// This GUID will be used to install PPI to inform the check for FTW last write data has been done.
-// The related FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob will be only built if
-// FTW last write was still in progress with SpareComplete set and DestinationComplete not set.
-// It means the target buffer has been backed up in spare block, then target block has been erased,
-// but the target buffer has not been writen in target block from spare block.
-//
-extern EFI_GUID gEdkiiFaultTolerantWriteGuid;
-
-#endif
+/** @file + Define the GUID gEdkiiFaultTolerantWriteGuid that will be used to build + FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob and install PPI to inform the check + for FTW last write data has been done. The GUID hob will be only built if FTW last write was + still in progress with SpareComplete set and DestinationComplete not set. + +Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _FAULT_TOLERANT_WRITE_H_ +#define _FAULT_TOLERANT_WRITE_H_ + +#define EDKII_FAULT_TOLERANT_WRITE_GUID \ + { \ + 0x1d3e9cb8, 0x43af, 0x490b, { 0x83, 0xa, 0x35, 0x16, 0xaa, 0x53, 0x20, 0x47 } \ + } + +// +// FTW Last write data. It will be used as gEdkiiFaultTolerantWriteGuid GUID hob data. +// +typedef struct { + /// + /// Target address to be updated in FTW last write. + /// + EFI_PHYSICAL_ADDRESS TargetAddress; + /// + /// Spare address to back up the updated buffer. + /// + EFI_PHYSICAL_ADDRESS SpareAddress; + /// + /// The length of data that have been backed up in spare block. + /// It is also the length of target block that has been erased. + /// + UINT64 Length; +} FAULT_TOLERANT_WRITE_LAST_WRITE_DATA; + +// +// This GUID will be used to install PPI to inform the check for FTW last write data has been done. +// The related FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob will be only built if +// FTW last write was still in progress with SpareComplete set and DestinationComplete not set. +// It means the target buffer has been backed up in spare block, then target block has been erased, +// but the target buffer has not been writen in target block from spare block. +// +extern EFI_GUID gEdkiiFaultTolerantWriteGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/FirmwarePerformance.h b/MdeModulePkg/Include/Guid/FirmwarePerformance.h index 3ce146eba1..1883a5961c 100644 --- a/MdeModulePkg/Include/Guid/FirmwarePerformance.h +++ b/MdeModulePkg/Include/Guid/FirmwarePerformance.h @@ -1,139 +1,139 @@ -/** @file
- ACPI Firmware Performance Data Table (FPDT) implementation specific definitions.
-
- Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _FIRMWARE_PERFORMANCE_GUID_H_
-#define _FIRMWARE_PERFORMANCE_GUID_H_
-
-#include <PiPei.h>
-#include <IndustryStandard/Acpi.h>
-#include <Ppi/SecPerformance.h>
-
-///
-/// This GUID is used for FPDT implementation specific EFI Variable, LockBox and Hob.
-///
-/// EFI Variable:
-/// GUID - gEfiFirmwarePerformanceGuid
-/// Name - EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME
-/// Data - FIRMWARE_PERFORMANCE_VARIABLE
-///
-/// LockBox:
-/// GUID - gEfiFirmwarePerformanceGuid
-/// Data - EFI_ACPI_BASIC_S3_SUSPEND_PERFORMANCE_RECORD
-///
-/// Hob:
-/// GUID - gEfiFirmwarePerformanceGuid
-/// Data - FIRMWARE_SEC_PERFORMANCE (defined in <Ppi/SecPerformance.h>)
-///
-/// SMI:
-/// GUID - gEfiFirmwarePerformanceGuid
-/// Data - SMM_BOOT_RECORD_COMMUNICATE
-///
-/// StatusCodeData:
-/// Type - gEfiFirmwarePerformanceGuid
-/// Data - One or more boot record
-///
-#define EFI_FIRMWARE_PERFORMANCE_GUID \
- { \
- 0xc095791a, 0x3001, 0x47b2, {0x80, 0xc9, 0xea, 0xc7, 0x31, 0x9f, 0x2f, 0xa4 } \
- }
-
-#define EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME L"FirmwarePerformance"
-
-/// LockBox:
-/// GUID - gFirmwarePerformanceS3PointerGuid
-/// Data - S3 performance table pointer
-///
-#define FIRMWARE_PERFORMANCE_S3_POINTER_GUID \
- { \
- 0xdc65adc, 0xa973, 0x4130, { 0x8d, 0xf0, 0x2a, 0xdb, 0xeb, 0x9e, 0x4a, 0x31 } \
- }
-
-#pragma pack(1)
-
-///
-/// Firmware Performance Data Table.
-/// This structure will be installed into ACPI table as FPDT in normal boot path.
-///
-typedef struct {
- EFI_ACPI_DESCRIPTION_HEADER Header; ///< Common ACPI description table header.
- EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_POINTER_RECORD BootPointerRecord; ///< Basic Boot Performance Table Pointer record.
- EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_POINTER_RECORD S3PointerRecord; ///< S3 Performance Table Pointer record.
-} FIRMWARE_PERFORMANCE_TABLE;
-
-///
-/// S3 Performance Data Table.
-/// This structure contains S3 performance records which will be updated in S3
-/// suspend and S3 resume boot path.
-///
-typedef struct {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER Header; ///< Common ACPI table header.
- EFI_ACPI_5_0_FPDT_S3_RESUME_RECORD S3Resume; ///< Basic S3 Resume performance record.
- EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD S3Suspend; ///< Basic S3 Suspend performance record.
-} S3_PERFORMANCE_TABLE;
-
-///
-/// Basic Boot Performance Data Table.
-/// This structure contains BasicBoot performance record.
-///
-typedef struct {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER Header; ///< Common ACPI table header.
- EFI_ACPI_5_0_FPDT_FIRMWARE_BASIC_BOOT_RECORD BasicBoot; ///< Basic Boot Resume performance record.
- //
- // one or more boot performance records.
- //
-} BOOT_PERFORMANCE_TABLE;
-
-///
-/// Boot performance table for the performance record in SMM phase.
-///
-///
-typedef struct {
- EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER Header; ///< Common ACPI table header.
- //
- // one or more boot performance records.
- //
-} SMM_BOOT_PERFORMANCE_TABLE;
-
-///
-/// Performance data pointed by Performance Pointer Record.
-///
-typedef struct {
- BOOT_PERFORMANCE_TABLE BootPerformance; ///< Basic Boot Performance.
- S3_PERFORMANCE_TABLE S3Performance; ///< S3 performance.
-} FIRMWARE_PERFORMANCE_RUNTIME_DATA;
-
-///
-/// Variable defined for FPDT implementation.
-/// This Variable is produced by FPDT DXE module.
-///
-typedef struct {
- EFI_PHYSICAL_ADDRESS BootPerformanceTablePointer; ///< Pointer to Boot Performance Table.
- EFI_PHYSICAL_ADDRESS S3PerformanceTablePointer; ///< Pointer to S3 Performance Table.
-} FIRMWARE_PERFORMANCE_VARIABLE;
-
-#pragma pack()
-
-//
-// Log BOOT RECORD from SMM driver on boot time.
-//
-#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE 1
-#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA 2
-#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET 3
-
-typedef struct {
- UINTN Function;
- EFI_STATUS ReturnStatus;
- UINTN BootRecordSize;
- VOID *BootRecordData;
- UINTN BootRecordOffset;
-} SMM_BOOT_RECORD_COMMUNICATE;
-
-extern EFI_GUID gEfiFirmwarePerformanceGuid;
-extern EFI_GUID gFirmwarePerformanceS3PointerGuid;
-
-#endif
+/** @file + ACPI Firmware Performance Data Table (FPDT) implementation specific definitions. + + Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _FIRMWARE_PERFORMANCE_GUID_H_ +#define _FIRMWARE_PERFORMANCE_GUID_H_ + +#include <PiPei.h> +#include <IndustryStandard/Acpi.h> +#include <Ppi/SecPerformance.h> + +/// +/// This GUID is used for FPDT implementation specific EFI Variable, LockBox and Hob. +/// +/// EFI Variable: +/// GUID - gEfiFirmwarePerformanceGuid +/// Name - EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME +/// Data - FIRMWARE_PERFORMANCE_VARIABLE +/// +/// LockBox: +/// GUID - gEfiFirmwarePerformanceGuid +/// Data - EFI_ACPI_BASIC_S3_SUSPEND_PERFORMANCE_RECORD +/// +/// Hob: +/// GUID - gEfiFirmwarePerformanceGuid +/// Data - FIRMWARE_SEC_PERFORMANCE (defined in <Ppi/SecPerformance.h>) +/// +/// SMI: +/// GUID - gEfiFirmwarePerformanceGuid +/// Data - SMM_BOOT_RECORD_COMMUNICATE +/// +/// StatusCodeData: +/// Type - gEfiFirmwarePerformanceGuid +/// Data - One or more boot record +/// +#define EFI_FIRMWARE_PERFORMANCE_GUID \ + { \ + 0xc095791a, 0x3001, 0x47b2, {0x80, 0xc9, 0xea, 0xc7, 0x31, 0x9f, 0x2f, 0xa4 } \ + } + +#define EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME L"FirmwarePerformance" + +/// LockBox: +/// GUID - gFirmwarePerformanceS3PointerGuid +/// Data - S3 performance table pointer +/// +#define FIRMWARE_PERFORMANCE_S3_POINTER_GUID \ + { \ + 0xdc65adc, 0xa973, 0x4130, { 0x8d, 0xf0, 0x2a, 0xdb, 0xeb, 0x9e, 0x4a, 0x31 } \ + } + +#pragma pack(1) + +/// +/// Firmware Performance Data Table. +/// This structure will be installed into ACPI table as FPDT in normal boot path. +/// +typedef struct { + EFI_ACPI_DESCRIPTION_HEADER Header; ///< Common ACPI description table header. + EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_POINTER_RECORD BootPointerRecord; ///< Basic Boot Performance Table Pointer record. + EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_POINTER_RECORD S3PointerRecord; ///< S3 Performance Table Pointer record. +} FIRMWARE_PERFORMANCE_TABLE; + +/// +/// S3 Performance Data Table. +/// This structure contains S3 performance records which will be updated in S3 +/// suspend and S3 resume boot path. +/// +typedef struct { + EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER Header; ///< Common ACPI table header. + EFI_ACPI_5_0_FPDT_S3_RESUME_RECORD S3Resume; ///< Basic S3 Resume performance record. + EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD S3Suspend; ///< Basic S3 Suspend performance record. +} S3_PERFORMANCE_TABLE; + +/// +/// Basic Boot Performance Data Table. +/// This structure contains BasicBoot performance record. +/// +typedef struct { + EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER Header; ///< Common ACPI table header. + EFI_ACPI_5_0_FPDT_FIRMWARE_BASIC_BOOT_RECORD BasicBoot; ///< Basic Boot Resume performance record. + // + // one or more boot performance records. + // +} BOOT_PERFORMANCE_TABLE; + +/// +/// Boot performance table for the performance record in SMM phase. +/// +/// +typedef struct { + EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER Header; ///< Common ACPI table header. + // + // one or more boot performance records. + // +} SMM_BOOT_PERFORMANCE_TABLE; + +/// +/// Performance data pointed by Performance Pointer Record. +/// +typedef struct { + BOOT_PERFORMANCE_TABLE BootPerformance; ///< Basic Boot Performance. + S3_PERFORMANCE_TABLE S3Performance; ///< S3 performance. +} FIRMWARE_PERFORMANCE_RUNTIME_DATA; + +/// +/// Variable defined for FPDT implementation. +/// This Variable is produced by FPDT DXE module. +/// +typedef struct { + EFI_PHYSICAL_ADDRESS BootPerformanceTablePointer; ///< Pointer to Boot Performance Table. + EFI_PHYSICAL_ADDRESS S3PerformanceTablePointer; ///< Pointer to S3 Performance Table. +} FIRMWARE_PERFORMANCE_VARIABLE; + +#pragma pack() + +// +// Log BOOT RECORD from SMM driver on boot time. +// +#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE 1 +#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA 2 +#define SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET 3 + +typedef struct { + UINTN Function; + EFI_STATUS ReturnStatus; + UINTN BootRecordSize; + VOID *BootRecordData; + UINTN BootRecordOffset; +} SMM_BOOT_RECORD_COMMUNICATE; + +extern EFI_GUID gEfiFirmwarePerformanceGuid; +extern EFI_GUID gFirmwarePerformanceS3PointerGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/HiiBootMaintenanceFormset.h b/MdeModulePkg/Include/Guid/HiiBootMaintenanceFormset.h index 7c58557499..f303dad652 100644 --- a/MdeModulePkg/Include/Guid/HiiBootMaintenanceFormset.h +++ b/MdeModulePkg/Include/Guid/HiiBootMaintenanceFormset.h @@ -1,20 +1,20 @@ -/** @file
- Guid definition for Boot Maintainence Formset.
-
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __HII_BOOT_MAINTENANCE_FORMSET_H__
-#define __HII_BOOT_MAINTENANCE_FORMSET_H__
-
-///
-/// Guid define to group the item show on the Boot Menaintenance Manager Menu.
-///
-#define EFI_IFR_BOOT_MAINTENANCE_GUID \
- { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89, 0x8a, 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 } }
-
-extern EFI_GUID gEfiIfrBootMaintenanceGuid;
-
-#endif
+/** @file + Guid definition for Boot Maintainence Formset. + +Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __HII_BOOT_MAINTENANCE_FORMSET_H__ +#define __HII_BOOT_MAINTENANCE_FORMSET_H__ + +/// +/// Guid define to group the item show on the Boot Menaintenance Manager Menu. +/// +#define EFI_IFR_BOOT_MAINTENANCE_GUID \ + { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89, 0x8a, 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 } } + +extern EFI_GUID gEfiIfrBootMaintenanceGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/HiiResourceSampleHii.h b/MdeModulePkg/Include/Guid/HiiResourceSampleHii.h index e59a7c47ee..a4a17227ba 100644 --- a/MdeModulePkg/Include/Guid/HiiResourceSampleHii.h +++ b/MdeModulePkg/Include/Guid/HiiResourceSampleHii.h @@ -1,17 +1,17 @@ -/** @file
- GUID used as HII FormSet GUID in HII Resource Sample driver.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __HII_RESOURCE_SAMPLE_HII_GUID_H__
-#define __HII_RESOURCE_SAMPLE_HII_GUID_H__
-
-#define HII_RESOURCE_SAMPLE_FORM_SET_GUID \
- { 0x4f4ef7f0, 0xaa29, 0x4ce9, { 0xba, 0x41, 0x64, 0x3e, 0x1, 0x23, 0xa9, 0x9f }}
-
-extern EFI_GUID gHiiResourceSamleFormSetGuid;
-
-#endif
+/** @file + GUID used as HII FormSet GUID in HII Resource Sample driver. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __HII_RESOURCE_SAMPLE_HII_GUID_H__ +#define __HII_RESOURCE_SAMPLE_HII_GUID_H__ + +#define HII_RESOURCE_SAMPLE_FORM_SET_GUID \ + { 0x4f4ef7f0, 0xaa29, 0x4ce9, { 0xba, 0x41, 0x64, 0x3e, 0x1, 0x23, 0xa9, 0x9f }} + +extern EFI_GUID gHiiResourceSamleFormSetGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/IdleLoopEvent.h b/MdeModulePkg/Include/Guid/IdleLoopEvent.h index 7afc9dcbcf..507db3fcc0 100644 --- a/MdeModulePkg/Include/Guid/IdleLoopEvent.h +++ b/MdeModulePkg/Include/Guid/IdleLoopEvent.h @@ -1,18 +1,18 @@ -/** @file
- GUID is the name of events used with CreateEventEx in order to be notified
- when the DXE Core is idle.
-
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __IDLE_LOOP_EVENT_GUID_H__
-#define __IDLE_LOOP_EVENT_GUID_H__
-
-#define IDLE_LOOP_EVENT_GUID \
- { 0x3c8d294c, 0x5fc3, 0x4451, { 0xbb, 0x31, 0xc4, 0xc0, 0x32, 0x29, 0x5e, 0x6c } }
-
-extern EFI_GUID gIdleLoopEventGuid;
-
-#endif
+/** @file + GUID is the name of events used with CreateEventEx in order to be notified + when the DXE Core is idle. + + Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __IDLE_LOOP_EVENT_GUID_H__ +#define __IDLE_LOOP_EVENT_GUID_H__ + +#define IDLE_LOOP_EVENT_GUID \ + { 0x3c8d294c, 0x5fc3, 0x4451, { 0xbb, 0x31, 0xc4, 0xc0, 0x32, 0x29, 0x5e, 0x6c } } + +extern EFI_GUID gIdleLoopEventGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/LoadModuleAtFixedAddress.h b/MdeModulePkg/Include/Guid/LoadModuleAtFixedAddress.h index bf1f47531d..a5193b86af 100644 --- a/MdeModulePkg/Include/Guid/LoadModuleAtFixedAddress.h +++ b/MdeModulePkg/Include/Guid/LoadModuleAtFixedAddress.h @@ -1,27 +1,27 @@ -/** @file
- This file defines a configuration Table Guid for Load module at fixed address.
-
- This configuration table is to hold the top address below which the Dxe runtime code and
- boot time code will be loaded and Tseg base. When this feature is enabled, Build tools will assigned
- module loading address relative to these two addresses.
-
-
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __LOAD_MODULE_AT_FIX_ADDRESS_GUID_H__
-#define __LOAD_MODULE_AT_FIX_ADDRESS_GUID_H__
-
-#define EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE_GUID \
- { 0x2CA88B53,0xD296,0x4080, { 0xA4,0xA5,0xCA,0xD9,0xBA,0xE2,0x4B,0x9} }
-
-extern EFI_GUID gLoadFixedAddressConfigurationTableGuid;
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS DxeCodeTopAddress; ///< The top address below which the Dxe runtime code and below which the Dxe runtime/boot code and PEI code.
- EFI_PHYSICAL_ADDRESS SmramBase; ///< SMRAM base address. The build tool assigns an offset relative to the SMRAM base for a SMM driver.
-} EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE;
-
-#endif
+/** @file + This file defines a configuration Table Guid for Load module at fixed address. + + This configuration table is to hold the top address below which the Dxe runtime code and + boot time code will be loaded and Tseg base. When this feature is enabled, Build tools will assigned + module loading address relative to these two addresses. + + +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __LOAD_MODULE_AT_FIX_ADDRESS_GUID_H__ +#define __LOAD_MODULE_AT_FIX_ADDRESS_GUID_H__ + +#define EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE_GUID \ + { 0x2CA88B53,0xD296,0x4080, { 0xA4,0xA5,0xCA,0xD9,0xBA,0xE2,0x4B,0x9} } + +extern EFI_GUID gLoadFixedAddressConfigurationTableGuid; + +typedef struct { + EFI_PHYSICAL_ADDRESS DxeCodeTopAddress; ///< The top address below which the Dxe runtime code and below which the Dxe runtime/boot code and PEI code. + EFI_PHYSICAL_ADDRESS SmramBase; ///< SMRAM base address. The build tool assigns an offset relative to the SMRAM base for a SMM driver. +} EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE; + +#endif diff --git a/MdeModulePkg/Include/Guid/LzmaDecompress.h b/MdeModulePkg/Include/Guid/LzmaDecompress.h index b2b6d61c94..b292e25ceb 100644 --- a/MdeModulePkg/Include/Guid/LzmaDecompress.h +++ b/MdeModulePkg/Include/Guid/LzmaDecompress.h @@ -1,29 +1,29 @@ -/** @file
- Lzma Custom decompress algorithm Guid definition.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __LZMA_DECOMPRESS_GUID_H__
-#define __LZMA_DECOMPRESS_GUID_H__
-
-///
-/// The Global ID used to identify a section of an FFS file of type
-/// EFI_SECTION_GUID_DEFINED, whose contents have been compressed using LZMA.
-///
-#define LZMA_CUSTOM_DECOMPRESS_GUID \
- { 0xEE4E5898, 0x3914, 0x4259, { 0x9D, 0x6E, 0xDC, 0x7B, 0xD7, 0x94, 0x03, 0xCF } }
-
-///
-/// The Global ID used to identify a section of an FFS file of type
-/// EFI_SECTION_GUID_DEFINED, whose contents have been compressed using LZMA with X86 code Converter.
-///
-#define LZMAF86_CUSTOM_DECOMPRESS_GUID \
- { 0xD42AE6BD, 0x1352, 0x4bfb, { 0x90, 0x9A, 0xCA, 0x72, 0xA6, 0xEA, 0xE8, 0x89 } }
-
-extern GUID gLzmaCustomDecompressGuid;
-extern GUID gLzmaF86CustomDecompressGuid;
-
-#endif
+/** @file + Lzma Custom decompress algorithm Guid definition. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __LZMA_DECOMPRESS_GUID_H__ +#define __LZMA_DECOMPRESS_GUID_H__ + +/// +/// The Global ID used to identify a section of an FFS file of type +/// EFI_SECTION_GUID_DEFINED, whose contents have been compressed using LZMA. +/// +#define LZMA_CUSTOM_DECOMPRESS_GUID \ + { 0xEE4E5898, 0x3914, 0x4259, { 0x9D, 0x6E, 0xDC, 0x7B, 0xD7, 0x94, 0x03, 0xCF } } + +/// +/// The Global ID used to identify a section of an FFS file of type +/// EFI_SECTION_GUID_DEFINED, whose contents have been compressed using LZMA with X86 code Converter. +/// +#define LZMAF86_CUSTOM_DECOMPRESS_GUID \ + { 0xD42AE6BD, 0x1352, 0x4bfb, { 0x90, 0x9A, 0xCA, 0x72, 0xA6, 0xEA, 0xE8, 0x89 } } + +extern GUID gLzmaCustomDecompressGuid; +extern GUID gLzmaF86CustomDecompressGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/MdeModuleHii.h b/MdeModulePkg/Include/Guid/MdeModuleHii.h index 798bcbaaae..7165525d57 100644 --- a/MdeModulePkg/Include/Guid/MdeModuleHii.h +++ b/MdeModulePkg/Include/Guid/MdeModuleHii.h @@ -1,231 +1,231 @@ -/** @file
- EDKII extented HII IFR guid opcodes.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __MDEMODULE_HII_H__
-#define __MDEMODULE_HII_H__
-
-#define NARROW_CHAR 0xFFF0
-#define WIDE_CHAR 0xFFF1
-#define NON_BREAKING_CHAR 0xFFF2
-
-///
-/// State defined for password statemachine .
-///
-#define BROWSER_STATE_VALIDATE_PASSWORD 0
-#define BROWSER_STATE_SET_PASSWORD 1
-
-///
-/// GUIDed opcodes defined for EDKII implementation.
-///
-#define EFI_IFR_TIANO_GUID \
- { 0xf0b1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce} }
-
-#pragma pack(1)
-
-///
-/// EDKII implementation extension opcodes, new extension can be added here later.
-///
-#define EFI_IFR_EXTEND_OP_LABEL 0x0
-#define EFI_IFR_EXTEND_OP_BANNER 0x1
-#define EFI_IFR_EXTEND_OP_TIMEOUT 0x2
-#define EFI_IFR_EXTEND_OP_CLASS 0x3
-#define EFI_IFR_EXTEND_OP_SUBCLASS 0x4
-
-///
-/// Label opcode.
-///
-typedef struct _EFI_IFR_GUID_LABEL {
- EFI_IFR_OP_HEADER Header;
- ///
- /// EFI_IFR_TIANO_GUID.
- ///
- EFI_GUID Guid;
- ///
- /// EFI_IFR_EXTEND_OP_LABEL.
- ///
- UINT8 ExtendOpCode;
- ///
- /// Label Number.
- ///
- UINT16 Number;
-} EFI_IFR_GUID_LABEL;
-
-#define EFI_IFR_BANNER_ALIGN_LEFT 0
-#define EFI_IFR_BANNER_ALIGN_CENTER 1
-#define EFI_IFR_BANNER_ALIGN_RIGHT 2
-
-///
-/// Banner opcode.
-///
-typedef struct _EFI_IFR_GUID_BANNER {
- EFI_IFR_OP_HEADER Header;
- ///
- /// EFI_IFR_TIANO_GUID.
- ///
- EFI_GUID Guid;
- ///
- /// EFI_IFR_EXTEND_OP_BANNER
- ///
- UINT8 ExtendOpCode;
- EFI_STRING_ID Title; ///< The string token for the banner title.
- UINT16 LineNumber; ///< 1-based line number.
- UINT8 Alignment; ///< left, center, or right-aligned.
-} EFI_IFR_GUID_BANNER;
-
-///
-/// Timeout opcode.
-///
-typedef struct _EFI_IFR_GUID_TIMEOUT {
- EFI_IFR_OP_HEADER Header;
- ///
- /// EFI_IFR_TIANO_GUID.
- ///
- EFI_GUID Guid;
- ///
- /// EFI_IFR_EXTEND_OP_TIMEOUT.
- ///
- UINT8 ExtendOpCode;
- UINT16 TimeOut; ///< TimeOut Value.
-} EFI_IFR_GUID_TIMEOUT;
-
-#define EFI_NON_DEVICE_CLASS 0x00
-#define EFI_DISK_DEVICE_CLASS 0x01
-#define EFI_VIDEO_DEVICE_CLASS 0x02
-#define EFI_NETWORK_DEVICE_CLASS 0x04
-#define EFI_INPUT_DEVICE_CLASS 0x08
-#define EFI_ON_BOARD_DEVICE_CLASS 0x10
-#define EFI_OTHER_DEVICE_CLASS 0x20
-
-///
-/// Device Class opcode.
-///
-typedef struct _EFI_IFR_GUID_CLASS {
- EFI_IFR_OP_HEADER Header;
- ///
- /// EFI_IFR_TIANO_GUID.
- ///
- EFI_GUID Guid;
- ///
- /// EFI_IFR_EXTEND_OP_CLASS.
- ///
- UINT8 ExtendOpCode;
- UINT16 Class; ///< Device Class from the above.
-} EFI_IFR_GUID_CLASS;
-
-#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
-#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
-#define EFI_FRONT_PAGE_SUBCLASS 0x02
-#define EFI_SINGLE_USE_SUBCLASS 0x03
-
-///
-/// SubClass opcode
-///
-typedef struct _EFI_IFR_GUID_SUBCLASS {
- EFI_IFR_OP_HEADER Header;
- ///
- /// EFI_IFR_TIANO_GUID.
- ///
- EFI_GUID Guid;
- ///
- /// EFI_IFR_EXTEND_OP_SUBCLASS.
- ///
- UINT8 ExtendOpCode;
- UINT16 SubClass; ///< Sub Class type from the above.
-} EFI_IFR_GUID_SUBCLASS;
-
-///
-/// GUIDed opcodes support for framework vfr.
-///
-#define EFI_IFR_FRAMEWORK_GUID \
- { 0x31ca5d1a, 0xd511, 0x4931, { 0xb7, 0x82, 0xae, 0x6b, 0x2b, 0x17, 0x8c, 0xd7 } }
-
-///
-/// Two extended opcodes are added, and new extensions can be added here later.
-/// One is for framework OneOf question Option Key value;
-/// another is for framework vareqval.
-///
-#define EFI_IFR_EXTEND_OP_OPTIONKEY 0x0
-#define EFI_IFR_EXTEND_OP_VAREQNAME 0x1
-
-///
-/// Store the framework vfr option key value.
-///
-typedef struct _EFI_IFR_GUID_OPTIONKEY {
- EFI_IFR_OP_HEADER Header;
- ///
- /// EFI_IFR_FRAMEWORK_GUID.
- ///
- EFI_GUID Guid;
- ///
- /// EFI_IFR_EXTEND_OP_OPTIONKEY.
- ///
- UINT8 ExtendOpCode;
- ///
- /// OneOf Questiond ID binded by OneOf Option.
- ///
- EFI_QUESTION_ID QuestionId;
- ///
- /// The OneOf Option Value.
- ///
- EFI_IFR_TYPE_VALUE OptionValue;
- ///
- /// The Framework OneOf Option Key Value.
- ///
- UINT16 KeyValue;
-} EFI_IFR_GUID_OPTIONKEY;
-
-///
-/// Store the framework vfr vareqval name number.
-///
-typedef struct _EFI_IFR_GUID_VAREQNAME {
- EFI_IFR_OP_HEADER Header;
- ///
- /// EFI_IFR_FRAMEWORK_GUID.
- ///
- EFI_GUID Guid;
- ///
- /// EFI_IFR_EXTEND_OP_VAREQNAME.
- ///
- UINT8 ExtendOpCode;
- ///
- /// Question ID of the Numeric Opcode created.
- ///
- EFI_QUESTION_ID QuestionId;
- ///
- /// For vareqval (0x100), NameId is 0x100.
- /// This value will convert to a Unicode String following this rule;
- /// sprintf(StringBuffer, "%d", NameId) .
- /// The the Unicode String will be used as a EFI Variable Name.
- ///
- UINT16 NameId;
-} EFI_IFR_GUID_VAREQNAME;
-
-///
-/// EDKII implementation extension GUID, used to indaicate there are bit fields in the varstore.
-///
-#define EDKII_IFR_BIT_VARSTORE_GUID \
- {0x82DDD68B, 0x9163, 0x4187, {0x9B, 0x27, 0x20, 0xA8, 0xFD, 0x60,0xA7, 0x1D}}
-
-///
-/// EDKII implementation extension flags, used to indaicate the disply style and bit width for bit filed storage.
-/// Two high bits for display style and the low six bits for bit width.
-///
-#define EDKII_IFR_DISPLAY_BIT 0xC0
-#define EDKII_IFR_DISPLAY_INT_DEC_BIT 0x00
-#define EDKII_IFR_DISPLAY_UINT_DEC_BIT 0x40
-#define EDKII_IFR_DISPLAY_UINT_HEX_BIT 0x80
-
-#define EDKII_IFR_NUMERIC_SIZE_BIT 0x3F
-
-#pragma pack()
-
-extern EFI_GUID gEfiIfrTianoGuid;
-extern EFI_GUID gEfiIfrFrameworkGuid;
-extern EFI_GUID gEdkiiIfrBitVarstoreGuid;
-
-#endif
+/** @file + EDKII extented HII IFR guid opcodes. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __MDEMODULE_HII_H__ +#define __MDEMODULE_HII_H__ + +#define NARROW_CHAR 0xFFF0 +#define WIDE_CHAR 0xFFF1 +#define NON_BREAKING_CHAR 0xFFF2 + +/// +/// State defined for password statemachine . +/// +#define BROWSER_STATE_VALIDATE_PASSWORD 0 +#define BROWSER_STATE_SET_PASSWORD 1 + +/// +/// GUIDed opcodes defined for EDKII implementation. +/// +#define EFI_IFR_TIANO_GUID \ + { 0xf0b1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce} } + +#pragma pack(1) + +/// +/// EDKII implementation extension opcodes, new extension can be added here later. +/// +#define EFI_IFR_EXTEND_OP_LABEL 0x0 +#define EFI_IFR_EXTEND_OP_BANNER 0x1 +#define EFI_IFR_EXTEND_OP_TIMEOUT 0x2 +#define EFI_IFR_EXTEND_OP_CLASS 0x3 +#define EFI_IFR_EXTEND_OP_SUBCLASS 0x4 + +/// +/// Label opcode. +/// +typedef struct _EFI_IFR_GUID_LABEL { + EFI_IFR_OP_HEADER Header; + /// + /// EFI_IFR_TIANO_GUID. + /// + EFI_GUID Guid; + /// + /// EFI_IFR_EXTEND_OP_LABEL. + /// + UINT8 ExtendOpCode; + /// + /// Label Number. + /// + UINT16 Number; +} EFI_IFR_GUID_LABEL; + +#define EFI_IFR_BANNER_ALIGN_LEFT 0 +#define EFI_IFR_BANNER_ALIGN_CENTER 1 +#define EFI_IFR_BANNER_ALIGN_RIGHT 2 + +/// +/// Banner opcode. +/// +typedef struct _EFI_IFR_GUID_BANNER { + EFI_IFR_OP_HEADER Header; + /// + /// EFI_IFR_TIANO_GUID. + /// + EFI_GUID Guid; + /// + /// EFI_IFR_EXTEND_OP_BANNER + /// + UINT8 ExtendOpCode; + EFI_STRING_ID Title; ///< The string token for the banner title. + UINT16 LineNumber; ///< 1-based line number. + UINT8 Alignment; ///< left, center, or right-aligned. +} EFI_IFR_GUID_BANNER; + +/// +/// Timeout opcode. +/// +typedef struct _EFI_IFR_GUID_TIMEOUT { + EFI_IFR_OP_HEADER Header; + /// + /// EFI_IFR_TIANO_GUID. + /// + EFI_GUID Guid; + /// + /// EFI_IFR_EXTEND_OP_TIMEOUT. + /// + UINT8 ExtendOpCode; + UINT16 TimeOut; ///< TimeOut Value. +} EFI_IFR_GUID_TIMEOUT; + +#define EFI_NON_DEVICE_CLASS 0x00 +#define EFI_DISK_DEVICE_CLASS 0x01 +#define EFI_VIDEO_DEVICE_CLASS 0x02 +#define EFI_NETWORK_DEVICE_CLASS 0x04 +#define EFI_INPUT_DEVICE_CLASS 0x08 +#define EFI_ON_BOARD_DEVICE_CLASS 0x10 +#define EFI_OTHER_DEVICE_CLASS 0x20 + +/// +/// Device Class opcode. +/// +typedef struct _EFI_IFR_GUID_CLASS { + EFI_IFR_OP_HEADER Header; + /// + /// EFI_IFR_TIANO_GUID. + /// + EFI_GUID Guid; + /// + /// EFI_IFR_EXTEND_OP_CLASS. + /// + UINT8 ExtendOpCode; + UINT16 Class; ///< Device Class from the above. +} EFI_IFR_GUID_CLASS; + +#define EFI_SETUP_APPLICATION_SUBCLASS 0x00 +#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01 +#define EFI_FRONT_PAGE_SUBCLASS 0x02 +#define EFI_SINGLE_USE_SUBCLASS 0x03 + +/// +/// SubClass opcode +/// +typedef struct _EFI_IFR_GUID_SUBCLASS { + EFI_IFR_OP_HEADER Header; + /// + /// EFI_IFR_TIANO_GUID. + /// + EFI_GUID Guid; + /// + /// EFI_IFR_EXTEND_OP_SUBCLASS. + /// + UINT8 ExtendOpCode; + UINT16 SubClass; ///< Sub Class type from the above. +} EFI_IFR_GUID_SUBCLASS; + +/// +/// GUIDed opcodes support for framework vfr. +/// +#define EFI_IFR_FRAMEWORK_GUID \ + { 0x31ca5d1a, 0xd511, 0x4931, { 0xb7, 0x82, 0xae, 0x6b, 0x2b, 0x17, 0x8c, 0xd7 } } + +/// +/// Two extended opcodes are added, and new extensions can be added here later. +/// One is for framework OneOf question Option Key value; +/// another is for framework vareqval. +/// +#define EFI_IFR_EXTEND_OP_OPTIONKEY 0x0 +#define EFI_IFR_EXTEND_OP_VAREQNAME 0x1 + +/// +/// Store the framework vfr option key value. +/// +typedef struct _EFI_IFR_GUID_OPTIONKEY { + EFI_IFR_OP_HEADER Header; + /// + /// EFI_IFR_FRAMEWORK_GUID. + /// + EFI_GUID Guid; + /// + /// EFI_IFR_EXTEND_OP_OPTIONKEY. + /// + UINT8 ExtendOpCode; + /// + /// OneOf Questiond ID binded by OneOf Option. + /// + EFI_QUESTION_ID QuestionId; + /// + /// The OneOf Option Value. + /// + EFI_IFR_TYPE_VALUE OptionValue; + /// + /// The Framework OneOf Option Key Value. + /// + UINT16 KeyValue; +} EFI_IFR_GUID_OPTIONKEY; + +/// +/// Store the framework vfr vareqval name number. +/// +typedef struct _EFI_IFR_GUID_VAREQNAME { + EFI_IFR_OP_HEADER Header; + /// + /// EFI_IFR_FRAMEWORK_GUID. + /// + EFI_GUID Guid; + /// + /// EFI_IFR_EXTEND_OP_VAREQNAME. + /// + UINT8 ExtendOpCode; + /// + /// Question ID of the Numeric Opcode created. + /// + EFI_QUESTION_ID QuestionId; + /// + /// For vareqval (0x100), NameId is 0x100. + /// This value will convert to a Unicode String following this rule; + /// sprintf(StringBuffer, "%d", NameId) . + /// The the Unicode String will be used as a EFI Variable Name. + /// + UINT16 NameId; +} EFI_IFR_GUID_VAREQNAME; + +/// +/// EDKII implementation extension GUID, used to indaicate there are bit fields in the varstore. +/// +#define EDKII_IFR_BIT_VARSTORE_GUID \ + {0x82DDD68B, 0x9163, 0x4187, {0x9B, 0x27, 0x20, 0xA8, 0xFD, 0x60,0xA7, 0x1D}} + +/// +/// EDKII implementation extension flags, used to indaicate the disply style and bit width for bit filed storage. +/// Two high bits for display style and the low six bits for bit width. +/// +#define EDKII_IFR_DISPLAY_BIT 0xC0 +#define EDKII_IFR_DISPLAY_INT_DEC_BIT 0x00 +#define EDKII_IFR_DISPLAY_UINT_DEC_BIT 0x40 +#define EDKII_IFR_DISPLAY_UINT_HEX_BIT 0x80 + +#define EDKII_IFR_NUMERIC_SIZE_BIT 0x3F + +#pragma pack() + +extern EFI_GUID gEfiIfrTianoGuid; +extern EFI_GUID gEfiIfrFrameworkGuid; +extern EFI_GUID gEdkiiIfrBitVarstoreGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/MdeModulePkgTokenSpace.h b/MdeModulePkg/Include/Guid/MdeModulePkgTokenSpace.h index 210f42f0ae..8f251f55e0 100644 --- a/MdeModulePkg/Include/Guid/MdeModulePkgTokenSpace.h +++ b/MdeModulePkg/Include/Guid/MdeModulePkgTokenSpace.h @@ -1,19 +1,19 @@ -/** @file
- GUID for MdeModulePkg PCD Token Space.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _MDEMODULEPKG_TOKEN_SPACE_GUID_H_
-#define _MDEMODULEPKG_TOKEN_SPACE_GUID_H_
-
-#define MDEMODULEPKG_TOKEN_SPACE_GUID \
- { \
- 0xA1AFF049, 0xFDEB, 0x442a, { 0xB3, 0x20, 0x13, 0xAB, 0x4C, 0xB7, 0x2B, 0xBC } \
- }
-
-extern EFI_GUID gEfiMdeModulePkgTokenSpaceGuid;
-
-#endif
+/** @file + GUID for MdeModulePkg PCD Token Space. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _MDEMODULEPKG_TOKEN_SPACE_GUID_H_ +#define _MDEMODULEPKG_TOKEN_SPACE_GUID_H_ + +#define MDEMODULEPKG_TOKEN_SPACE_GUID \ + { \ + 0xA1AFF049, 0xFDEB, 0x442a, { 0xB3, 0x20, 0x13, 0xAB, 0x4C, 0xB7, 0x2B, 0xBC } \ + } + +extern EFI_GUID gEfiMdeModulePkgTokenSpaceGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/MemoryProfile.h b/MdeModulePkg/Include/Guid/MemoryProfile.h index 8194b06330..846c2d7b42 100644 --- a/MdeModulePkg/Include/Guid/MemoryProfile.h +++ b/MdeModulePkg/Include/Guid/MemoryProfile.h @@ -1,466 +1,466 @@ -/** @file
- Memory profile data structure.
-
- Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _MEMORY_PROFILE_H_
-#define _MEMORY_PROFILE_H_
-
-#include <Pi/PiFirmwareFile.h>
-
-//
-// For BIOS MemoryType (0 ~ EfiMaxMemoryType - 1), it is recorded in UsageByType[MemoryType]. (Each valid entry has one entry)
-// For OS MemoryType (0x80000000 ~ 0xFFFFFFFF), it is recorded in UsageByType[EfiMaxMemoryType]. (All types are combined into one entry)
-// For OEM MemoryType (0x70000000 ~ 0x7FFFFFFF), it is recorded in UsageByType[EfiMaxMemoryType + 1]. (All types are combined into one entry)
-//
-
-typedef struct {
- UINT32 Signature;
- UINT16 Length;
- UINT16 Revision;
-} MEMORY_PROFILE_COMMON_HEADER;
-
-#define MEMORY_PROFILE_CONTEXT_SIGNATURE SIGNATURE_32 ('M','P','C','T')
-#define MEMORY_PROFILE_CONTEXT_REVISION 0x0002
-
-typedef struct {
- MEMORY_PROFILE_COMMON_HEADER Header;
- UINT64 CurrentTotalUsage;
- UINT64 PeakTotalUsage;
- UINT64 CurrentTotalUsageByType[EfiMaxMemoryType + 2];
- UINT64 PeakTotalUsageByType[EfiMaxMemoryType + 2];
- UINT64 TotalImageSize;
- UINT32 ImageCount;
- UINT32 SequenceCount;
-} MEMORY_PROFILE_CONTEXT;
-
-#define MEMORY_PROFILE_DRIVER_INFO_SIGNATURE SIGNATURE_32 ('M','P','D','I')
-#define MEMORY_PROFILE_DRIVER_INFO_REVISION 0x0003
-
-typedef struct {
- MEMORY_PROFILE_COMMON_HEADER Header;
- EFI_GUID FileName;
- PHYSICAL_ADDRESS ImageBase;
- UINT64 ImageSize;
- PHYSICAL_ADDRESS EntryPoint;
- UINT16 ImageSubsystem;
- EFI_FV_FILETYPE FileType;
- UINT8 Reserved[1];
- UINT32 AllocRecordCount;
- UINT64 CurrentUsage;
- UINT64 PeakUsage;
- UINT64 CurrentUsageByType[EfiMaxMemoryType + 2];
- UINT64 PeakUsageByType[EfiMaxMemoryType + 2];
- UINT16 PdbStringOffset;
- UINT8 Reserved2[6];
- // CHAR8 PdbString[];
-} MEMORY_PROFILE_DRIVER_INFO;
-
-typedef enum {
- MemoryProfileActionAllocatePages = 1,
- MemoryProfileActionFreePages = 2,
- MemoryProfileActionAllocatePool = 3,
- MemoryProfileActionFreePool = 4,
-} MEMORY_PROFILE_ACTION;
-
-//
-// Below is the detailed MEMORY_PROFILE_ACTION definition.
-//
-// 31 15 9 8 8 7 7 6 6 5-4 3 - 0
-// +----------------------------------------------+
-// |User | |Lib| |Re|Copy|Zero|Align|Type|Basic|
-// +----------------------------------------------+
-//
-
-//
-// Basic Action
-// 1 : AllocatePages
-// 2 : FreePages
-// 3 : AllocatePool
-// 4 : FreePool
-//
-#define MEMORY_PROFILE_ACTION_BASIC_MASK 0xF
-
-//
-// Extension
-//
-#define MEMORY_PROFILE_ACTION_EXTENSION_MASK 0xFFF0
-#define MEMORY_PROFILE_ACTION_EXTENSION_LIB_MASK 0x8000
-#define MEMORY_PROFILE_ACTION_EXTENSION_REALLOC_MASK 0x0200
-#define MEMORY_PROFILE_ACTION_EXTENSION_COPY_MASK 0x0100
-#define MEMORY_PROFILE_ACTION_EXTENSION_ZERO_MASK 0x0080
-#define MEMORY_PROFILE_ACTION_EXTENSION_ALIGN_MASK 0x0040
-#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_MASK 0x0030
-#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_BASIC 0x0000
-#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_RUNTIME 0x0010
-#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_RESERVED 0x0020
-
-//
-// Extension (used by memory allocation lib)
-//
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES 0x8001
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES 0x8011
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_PAGES 0x8021
-#define MEMORY_PROFILE_ACTION_LIB_FREE_PAGES 0x8002
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES 0x8041
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RUNTIME_PAGES 0x8051
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RESERVED_PAGES 0x8061
-#define MEMORY_PROFILE_ACTION_LIB_FREE_ALIGNED_PAGES 0x8042
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL 0x8003
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_POOL 0x8013
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_POOL 0x8023
-#define MEMORY_PROFILE_ACTION_LIB_FREE_POOL 0x8004
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL 0x8083
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL 0x8093
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_ZERO_POOL 0x80a3
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL 0x8103
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_COPY_POOL 0x8113
-#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_COPY_POOL 0x8123
-#define MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL 0x8203
-#define MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RUNTIME_POOL 0x8213
-#define MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RESERVED_POOL 0x8223
-
-//
-// User defined: 0x80000000~0xFFFFFFFF
-//
-// NOTE: User defined action MUST OR the basic action,
-// so that core can know the action is allocate or free,
-// and the type is pages (can be freed partially)
-// or pool (cannot be freed partially).
-//
-#define MEMORY_PROFILE_ACTION_USER_DEFINED_MASK 0x80000000
-
-#define MEMORY_PROFILE_ALLOC_INFO_SIGNATURE SIGNATURE_32 ('M','P','A','I')
-#define MEMORY_PROFILE_ALLOC_INFO_REVISION 0x0002
-
-typedef struct {
- MEMORY_PROFILE_COMMON_HEADER Header;
- PHYSICAL_ADDRESS CallerAddress;
- UINT32 SequenceId;
- UINT8 Reserved[2];
- UINT16 ActionStringOffset;
- MEMORY_PROFILE_ACTION Action;
- EFI_MEMORY_TYPE MemoryType;
- PHYSICAL_ADDRESS Buffer;
- UINT64 Size;
- // CHAR8 ActionString[];
-} MEMORY_PROFILE_ALLOC_INFO;
-
-#define MEMORY_PROFILE_DESCRIPTOR_SIGNATURE SIGNATURE_32 ('M','P','D','R')
-#define MEMORY_PROFILE_DESCRIPTOR_REVISION 0x0001
-
-typedef struct {
- MEMORY_PROFILE_COMMON_HEADER Header;
- PHYSICAL_ADDRESS Address;
- UINT64 Size;
-} MEMORY_PROFILE_DESCRIPTOR;
-
-#define MEMORY_PROFILE_FREE_MEMORY_SIGNATURE SIGNATURE_32 ('M','P','R','M')
-#define MEMORY_PROFILE_FREE_MEMORY_REVISION 0x0001
-
-typedef struct {
- MEMORY_PROFILE_COMMON_HEADER Header;
- UINT64 TotalFreeMemoryPages;
- UINT32 FreeMemoryEntryCount;
- UINT8 Reserved[4];
- // MEMORY_PROFILE_DESCRIPTOR MemoryDescriptor[FreeMemoryEntryCount];
-} MEMORY_PROFILE_FREE_MEMORY;
-
-#define MEMORY_PROFILE_MEMORY_RANGE_SIGNATURE SIGNATURE_32 ('M','P','M','R')
-#define MEMORY_PROFILE_MEMORY_RANGE_REVISION 0x0001
-
-typedef struct {
- MEMORY_PROFILE_COMMON_HEADER Header;
- UINT32 MemoryRangeCount;
- UINT8 Reserved[4];
- // MEMORY_PROFILE_DESCRIPTOR MemoryDescriptor[MemoryRangeCount];
-} MEMORY_PROFILE_MEMORY_RANGE;
-
-//
-// UEFI memory profile layout:
-// +--------------------------------+
-// | CONTEXT |
-// +--------------------------------+
-// | DRIVER_INFO(1) |
-// +--------------------------------+
-// | ALLOC_INFO(1, 1) |
-// +--------------------------------+
-// | ALLOC_INFO(1, m1) |
-// +--------------------------------+
-// | DRIVER_INFO(n) |
-// +--------------------------------+
-// | ALLOC_INFO(n, 1) |
-// +--------------------------------+
-// | ALLOC_INFO(n, mn) |
-// +--------------------------------+
-//
-
-typedef struct _EDKII_MEMORY_PROFILE_PROTOCOL EDKII_MEMORY_PROFILE_PROTOCOL;
-
-/**
- Get memory profile data.
-
- @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance.
- @param[in, out] ProfileSize On entry, points to the size in bytes of the ProfileBuffer.
- On return, points to the size of the data returned in ProfileBuffer.
- @param[out] ProfileBuffer Profile buffer.
-
- @return EFI_SUCCESS Get the memory profile data successfully.
- @return EFI_UNSUPPORTED Memory profile is unsupported.
- @return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data.
- ProfileSize is updated with the size required.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_MEMORY_PROFILE_GET_DATA)(
- IN EDKII_MEMORY_PROFILE_PROTOCOL *This,
- IN OUT UINT64 *ProfileSize,
- OUT VOID *ProfileBuffer
- );
-
-/**
- Register image to memory profile.
-
- @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance.
- @param[in] FilePath File path of the image.
- @param[in] ImageBase Image base address.
- @param[in] ImageSize Image size.
- @param[in] FileType File type of the image.
-
- @return EFI_SUCCESS Register successfully.
- @return EFI_UNSUPPORTED Memory profile is unsupported,
- or memory profile for the image is not required.
- @return EFI_OUT_OF_RESOURCES No enough resource for this register.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_MEMORY_PROFILE_REGISTER_IMAGE)(
- IN EDKII_MEMORY_PROFILE_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN PHYSICAL_ADDRESS ImageBase,
- IN UINT64 ImageSize,
- IN EFI_FV_FILETYPE FileType
- );
-
-/**
- Unregister image from memory profile.
-
- @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance.
- @param[in] FilePath File path of the image.
- @param[in] ImageBase Image base address.
- @param[in] ImageSize Image size.
-
- @return EFI_SUCCESS Unregister successfully.
- @return EFI_UNSUPPORTED Memory profile is unsupported,
- or memory profile for the image is not required.
- @return EFI_NOT_FOUND The image is not found.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_MEMORY_PROFILE_UNREGISTER_IMAGE)(
- IN EDKII_MEMORY_PROFILE_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN PHYSICAL_ADDRESS ImageBase,
- IN UINT64 ImageSize
- );
-
-#define MEMORY_PROFILE_RECORDING_ENABLE TRUE
-#define MEMORY_PROFILE_RECORDING_DISABLE FALSE
-
-/**
- Get memory profile recording state.
-
- @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance.
- @param[out] RecordingState Recording state.
-
- @return EFI_SUCCESS Memory profile recording state is returned.
- @return EFI_UNSUPPORTED Memory profile is unsupported.
- @return EFI_INVALID_PARAMETER RecordingState is NULL.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_MEMORY_PROFILE_GET_RECORDING_STATE)(
- IN EDKII_MEMORY_PROFILE_PROTOCOL *This,
- OUT BOOLEAN *RecordingState
- );
-
-/**
- Set memory profile recording state.
-
- @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance.
- @param[in] RecordingState Recording state.
-
- @return EFI_SUCCESS Set memory profile recording state successfully.
- @return EFI_UNSUPPORTED Memory profile is unsupported.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_MEMORY_PROFILE_SET_RECORDING_STATE)(
- IN EDKII_MEMORY_PROFILE_PROTOCOL *This,
- IN BOOLEAN RecordingState
- );
-
-/**
- Record memory profile of multilevel caller.
-
- @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance.
- @param[in] CallerAddress Address of caller.
- @param[in] Action Memory profile action.
- @param[in] MemoryType Memory type.
- EfiMaxMemoryType means the MemoryType is unknown.
- @param[in] Buffer Buffer address.
- @param[in] Size Buffer size.
- @param[in] ActionString String for memory profile action.
- Only needed for user defined allocate action.
-
- @return EFI_SUCCESS Memory profile is updated.
- @return EFI_UNSUPPORTED Memory profile is unsupported,
- or memory profile for the image is not required,
- or memory profile for the memory type is not required.
- @return EFI_ACCESS_DENIED It is during memory profile data getting.
- @return EFI_ABORTED Memory profile recording is not enabled.
- @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
- @return EFI_NOT_FOUND No matched allocate info found for free action.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_MEMORY_PROFILE_RECORD)(
- IN EDKII_MEMORY_PROFILE_PROTOCOL *This,
- IN PHYSICAL_ADDRESS CallerAddress,
- IN MEMORY_PROFILE_ACTION Action,
- IN EFI_MEMORY_TYPE MemoryType,
- IN VOID *Buffer,
- IN UINTN Size,
- IN CHAR8 *ActionString OPTIONAL
- );
-
-struct _EDKII_MEMORY_PROFILE_PROTOCOL {
- EDKII_MEMORY_PROFILE_GET_DATA GetData;
- EDKII_MEMORY_PROFILE_REGISTER_IMAGE RegisterImage;
- EDKII_MEMORY_PROFILE_UNREGISTER_IMAGE UnregisterImage;
- EDKII_MEMORY_PROFILE_GET_RECORDING_STATE GetRecordingState;
- EDKII_MEMORY_PROFILE_SET_RECORDING_STATE SetRecordingState;
- EDKII_MEMORY_PROFILE_RECORD Record;
-};
-
-//
-// SMRAM profile layout:
-// +--------------------------------+
-// | CONTEXT |
-// +--------------------------------+
-// | DRIVER_INFO(1) |
-// +--------------------------------+
-// | ALLOC_INFO(1, 1) |
-// +--------------------------------+
-// | ALLOC_INFO(1, m1) |
-// +--------------------------------+
-// | DRIVER_INFO(n) |
-// +--------------------------------+
-// | ALLOC_INFO(n, 1) |
-// +--------------------------------+
-// | ALLOC_INFO(n, mn) |
-// +--------------------------------+
-// | FREE_MEMORY |
-// +--------------------------------+
-// | FREE MEMORY DESCRIPTOR(1) |
-// +--------------------------------+
-// | FREE MEMORY DESCRIPTOR(p) |
-// +--------------------------------+
-// | MEMORY_RANGE |
-// +--------------------------------+
-// | MEMORY RANGE DESCRIPTOR(1) |
-// +--------------------------------+
-// | MEMORY RANGE DESCRIPTOR(q) |
-// +--------------------------------+
-//
-
-//
-// SMRAM profile command
-//
-#define SMRAM_PROFILE_COMMAND_GET_PROFILE_INFO 0x1
-#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA 0x2
-//
-// Below 2 commands have been deprecated. They may not be re-used.
-//
-#define SMRAM_PROFILE_COMMAND_DEPRECATED1 0x3
-#define SMRAM_PROFILE_COMMAND_DEPRECATED2 0x4
-
-#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET 0x5
-#define SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE 0x6
-#define SMRAM_PROFILE_COMMAND_SET_RECORDING_STATE 0x7
-
-typedef struct {
- UINT32 Command;
- UINT32 DataLength;
- UINT64 ReturnStatus;
-} SMRAM_PROFILE_PARAMETER_HEADER;
-
-typedef struct {
- SMRAM_PROFILE_PARAMETER_HEADER Header;
- UINT64 ProfileSize;
-} SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO;
-
-typedef struct {
- SMRAM_PROFILE_PARAMETER_HEADER Header;
- UINT64 ProfileSize;
- PHYSICAL_ADDRESS ProfileBuffer;
-} SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA;
-
-typedef struct {
- SMRAM_PROFILE_PARAMETER_HEADER Header;
- //
- // On input, profile buffer size.
- // On output, actual profile data size copied.
- //
- UINT64 ProfileSize;
- PHYSICAL_ADDRESS ProfileBuffer;
- //
- // On input, profile buffer offset to copy.
- // On output, next time profile buffer offset to copy.
- //
- UINT64 ProfileOffset;
-} SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET;
-
-typedef struct {
- SMRAM_PROFILE_PARAMETER_HEADER Header;
- BOOLEAN RecordingState;
-} SMRAM_PROFILE_PARAMETER_RECORDING_STATE;
-
-typedef struct {
- SMRAM_PROFILE_PARAMETER_HEADER Header;
- EFI_GUID FileName;
- PHYSICAL_ADDRESS ImageBuffer;
- UINT64 NumberOfPage;
-} SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE;
-
-typedef struct {
- SMRAM_PROFILE_PARAMETER_HEADER Header;
- EFI_GUID FileName;
- PHYSICAL_ADDRESS ImageBuffer;
- UINT64 NumberOfPage;
-} SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE;
-
-#define EDKII_MEMORY_PROFILE_GUID {\
- 0x821c9a09, 0x541a, 0x40f6, { 0x9f, 0x43, 0xa, 0xd1, 0x93, 0xa1, 0x2c, 0xfe } \
-}
-
-extern EFI_GUID gEdkiiMemoryProfileGuid;
-
-typedef EDKII_MEMORY_PROFILE_PROTOCOL EDKII_SMM_MEMORY_PROFILE_PROTOCOL;
-
-#define EDKII_SMM_MEMORY_PROFILE_GUID {\
- 0xe22bbcca, 0x516a, 0x46a8, { 0x80, 0xe2, 0x67, 0x45, 0xe8, 0x36, 0x93, 0xbd } \
-}
-
-extern EFI_GUID gEdkiiSmmMemoryProfileGuid;
-
-#endif
+/** @file + Memory profile data structure. + + Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _MEMORY_PROFILE_H_ +#define _MEMORY_PROFILE_H_ + +#include <Pi/PiFirmwareFile.h> + +// +// For BIOS MemoryType (0 ~ EfiMaxMemoryType - 1), it is recorded in UsageByType[MemoryType]. (Each valid entry has one entry) +// For OS MemoryType (0x80000000 ~ 0xFFFFFFFF), it is recorded in UsageByType[EfiMaxMemoryType]. (All types are combined into one entry) +// For OEM MemoryType (0x70000000 ~ 0x7FFFFFFF), it is recorded in UsageByType[EfiMaxMemoryType + 1]. (All types are combined into one entry) +// + +typedef struct { + UINT32 Signature; + UINT16 Length; + UINT16 Revision; +} MEMORY_PROFILE_COMMON_HEADER; + +#define MEMORY_PROFILE_CONTEXT_SIGNATURE SIGNATURE_32 ('M','P','C','T') +#define MEMORY_PROFILE_CONTEXT_REVISION 0x0002 + +typedef struct { + MEMORY_PROFILE_COMMON_HEADER Header; + UINT64 CurrentTotalUsage; + UINT64 PeakTotalUsage; + UINT64 CurrentTotalUsageByType[EfiMaxMemoryType + 2]; + UINT64 PeakTotalUsageByType[EfiMaxMemoryType + 2]; + UINT64 TotalImageSize; + UINT32 ImageCount; + UINT32 SequenceCount; +} MEMORY_PROFILE_CONTEXT; + +#define MEMORY_PROFILE_DRIVER_INFO_SIGNATURE SIGNATURE_32 ('M','P','D','I') +#define MEMORY_PROFILE_DRIVER_INFO_REVISION 0x0003 + +typedef struct { + MEMORY_PROFILE_COMMON_HEADER Header; + EFI_GUID FileName; + PHYSICAL_ADDRESS ImageBase; + UINT64 ImageSize; + PHYSICAL_ADDRESS EntryPoint; + UINT16 ImageSubsystem; + EFI_FV_FILETYPE FileType; + UINT8 Reserved[1]; + UINT32 AllocRecordCount; + UINT64 CurrentUsage; + UINT64 PeakUsage; + UINT64 CurrentUsageByType[EfiMaxMemoryType + 2]; + UINT64 PeakUsageByType[EfiMaxMemoryType + 2]; + UINT16 PdbStringOffset; + UINT8 Reserved2[6]; + // CHAR8 PdbString[]; +} MEMORY_PROFILE_DRIVER_INFO; + +typedef enum { + MemoryProfileActionAllocatePages = 1, + MemoryProfileActionFreePages = 2, + MemoryProfileActionAllocatePool = 3, + MemoryProfileActionFreePool = 4, +} MEMORY_PROFILE_ACTION; + +// +// Below is the detailed MEMORY_PROFILE_ACTION definition. +// +// 31 15 9 8 8 7 7 6 6 5-4 3 - 0 +// +----------------------------------------------+ +// |User | |Lib| |Re|Copy|Zero|Align|Type|Basic| +// +----------------------------------------------+ +// + +// +// Basic Action +// 1 : AllocatePages +// 2 : FreePages +// 3 : AllocatePool +// 4 : FreePool +// +#define MEMORY_PROFILE_ACTION_BASIC_MASK 0xF + +// +// Extension +// +#define MEMORY_PROFILE_ACTION_EXTENSION_MASK 0xFFF0 +#define MEMORY_PROFILE_ACTION_EXTENSION_LIB_MASK 0x8000 +#define MEMORY_PROFILE_ACTION_EXTENSION_REALLOC_MASK 0x0200 +#define MEMORY_PROFILE_ACTION_EXTENSION_COPY_MASK 0x0100 +#define MEMORY_PROFILE_ACTION_EXTENSION_ZERO_MASK 0x0080 +#define MEMORY_PROFILE_ACTION_EXTENSION_ALIGN_MASK 0x0040 +#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_MASK 0x0030 +#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_BASIC 0x0000 +#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_RUNTIME 0x0010 +#define MEMORY_PROFILE_ACTION_EXTENSION_MEM_TYPE_RESERVED 0x0020 + +// +// Extension (used by memory allocation lib) +// +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES 0x8001 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES 0x8011 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_PAGES 0x8021 +#define MEMORY_PROFILE_ACTION_LIB_FREE_PAGES 0x8002 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES 0x8041 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RUNTIME_PAGES 0x8051 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RESERVED_PAGES 0x8061 +#define MEMORY_PROFILE_ACTION_LIB_FREE_ALIGNED_PAGES 0x8042 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL 0x8003 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_POOL 0x8013 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_POOL 0x8023 +#define MEMORY_PROFILE_ACTION_LIB_FREE_POOL 0x8004 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL 0x8083 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL 0x8093 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_ZERO_POOL 0x80a3 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL 0x8103 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_COPY_POOL 0x8113 +#define MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_COPY_POOL 0x8123 +#define MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL 0x8203 +#define MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RUNTIME_POOL 0x8213 +#define MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RESERVED_POOL 0x8223 + +// +// User defined: 0x80000000~0xFFFFFFFF +// +// NOTE: User defined action MUST OR the basic action, +// so that core can know the action is allocate or free, +// and the type is pages (can be freed partially) +// or pool (cannot be freed partially). +// +#define MEMORY_PROFILE_ACTION_USER_DEFINED_MASK 0x80000000 + +#define MEMORY_PROFILE_ALLOC_INFO_SIGNATURE SIGNATURE_32 ('M','P','A','I') +#define MEMORY_PROFILE_ALLOC_INFO_REVISION 0x0002 + +typedef struct { + MEMORY_PROFILE_COMMON_HEADER Header; + PHYSICAL_ADDRESS CallerAddress; + UINT32 SequenceId; + UINT8 Reserved[2]; + UINT16 ActionStringOffset; + MEMORY_PROFILE_ACTION Action; + EFI_MEMORY_TYPE MemoryType; + PHYSICAL_ADDRESS Buffer; + UINT64 Size; + // CHAR8 ActionString[]; +} MEMORY_PROFILE_ALLOC_INFO; + +#define MEMORY_PROFILE_DESCRIPTOR_SIGNATURE SIGNATURE_32 ('M','P','D','R') +#define MEMORY_PROFILE_DESCRIPTOR_REVISION 0x0001 + +typedef struct { + MEMORY_PROFILE_COMMON_HEADER Header; + PHYSICAL_ADDRESS Address; + UINT64 Size; +} MEMORY_PROFILE_DESCRIPTOR; + +#define MEMORY_PROFILE_FREE_MEMORY_SIGNATURE SIGNATURE_32 ('M','P','R','M') +#define MEMORY_PROFILE_FREE_MEMORY_REVISION 0x0001 + +typedef struct { + MEMORY_PROFILE_COMMON_HEADER Header; + UINT64 TotalFreeMemoryPages; + UINT32 FreeMemoryEntryCount; + UINT8 Reserved[4]; + // MEMORY_PROFILE_DESCRIPTOR MemoryDescriptor[FreeMemoryEntryCount]; +} MEMORY_PROFILE_FREE_MEMORY; + +#define MEMORY_PROFILE_MEMORY_RANGE_SIGNATURE SIGNATURE_32 ('M','P','M','R') +#define MEMORY_PROFILE_MEMORY_RANGE_REVISION 0x0001 + +typedef struct { + MEMORY_PROFILE_COMMON_HEADER Header; + UINT32 MemoryRangeCount; + UINT8 Reserved[4]; + // MEMORY_PROFILE_DESCRIPTOR MemoryDescriptor[MemoryRangeCount]; +} MEMORY_PROFILE_MEMORY_RANGE; + +// +// UEFI memory profile layout: +// +--------------------------------+ +// | CONTEXT | +// +--------------------------------+ +// | DRIVER_INFO(1) | +// +--------------------------------+ +// | ALLOC_INFO(1, 1) | +// +--------------------------------+ +// | ALLOC_INFO(1, m1) | +// +--------------------------------+ +// | DRIVER_INFO(n) | +// +--------------------------------+ +// | ALLOC_INFO(n, 1) | +// +--------------------------------+ +// | ALLOC_INFO(n, mn) | +// +--------------------------------+ +// + +typedef struct _EDKII_MEMORY_PROFILE_PROTOCOL EDKII_MEMORY_PROFILE_PROTOCOL; + +/** + Get memory profile data. + + @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance. + @param[in, out] ProfileSize On entry, points to the size in bytes of the ProfileBuffer. + On return, points to the size of the data returned in ProfileBuffer. + @param[out] ProfileBuffer Profile buffer. + + @return EFI_SUCCESS Get the memory profile data successfully. + @return EFI_UNSUPPORTED Memory profile is unsupported. + @return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data. + ProfileSize is updated with the size required. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_MEMORY_PROFILE_GET_DATA)( + IN EDKII_MEMORY_PROFILE_PROTOCOL *This, + IN OUT UINT64 *ProfileSize, + OUT VOID *ProfileBuffer + ); + +/** + Register image to memory profile. + + @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance. + @param[in] FilePath File path of the image. + @param[in] ImageBase Image base address. + @param[in] ImageSize Image size. + @param[in] FileType File type of the image. + + @return EFI_SUCCESS Register successfully. + @return EFI_UNSUPPORTED Memory profile is unsupported, + or memory profile for the image is not required. + @return EFI_OUT_OF_RESOURCES No enough resource for this register. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_MEMORY_PROFILE_REGISTER_IMAGE)( + IN EDKII_MEMORY_PROFILE_PROTOCOL *This, + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN PHYSICAL_ADDRESS ImageBase, + IN UINT64 ImageSize, + IN EFI_FV_FILETYPE FileType + ); + +/** + Unregister image from memory profile. + + @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance. + @param[in] FilePath File path of the image. + @param[in] ImageBase Image base address. + @param[in] ImageSize Image size. + + @return EFI_SUCCESS Unregister successfully. + @return EFI_UNSUPPORTED Memory profile is unsupported, + or memory profile for the image is not required. + @return EFI_NOT_FOUND The image is not found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_MEMORY_PROFILE_UNREGISTER_IMAGE)( + IN EDKII_MEMORY_PROFILE_PROTOCOL *This, + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN PHYSICAL_ADDRESS ImageBase, + IN UINT64 ImageSize + ); + +#define MEMORY_PROFILE_RECORDING_ENABLE TRUE +#define MEMORY_PROFILE_RECORDING_DISABLE FALSE + +/** + Get memory profile recording state. + + @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance. + @param[out] RecordingState Recording state. + + @return EFI_SUCCESS Memory profile recording state is returned. + @return EFI_UNSUPPORTED Memory profile is unsupported. + @return EFI_INVALID_PARAMETER RecordingState is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_MEMORY_PROFILE_GET_RECORDING_STATE)( + IN EDKII_MEMORY_PROFILE_PROTOCOL *This, + OUT BOOLEAN *RecordingState + ); + +/** + Set memory profile recording state. + + @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance. + @param[in] RecordingState Recording state. + + @return EFI_SUCCESS Set memory profile recording state successfully. + @return EFI_UNSUPPORTED Memory profile is unsupported. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_MEMORY_PROFILE_SET_RECORDING_STATE)( + IN EDKII_MEMORY_PROFILE_PROTOCOL *This, + IN BOOLEAN RecordingState + ); + +/** + Record memory profile of multilevel caller. + + @param[in] This The EDKII_MEMORY_PROFILE_PROTOCOL instance. + @param[in] CallerAddress Address of caller. + @param[in] Action Memory profile action. + @param[in] MemoryType Memory type. + EfiMaxMemoryType means the MemoryType is unknown. + @param[in] Buffer Buffer address. + @param[in] Size Buffer size. + @param[in] ActionString String for memory profile action. + Only needed for user defined allocate action. + + @return EFI_SUCCESS Memory profile is updated. + @return EFI_UNSUPPORTED Memory profile is unsupported, + or memory profile for the image is not required, + or memory profile for the memory type is not required. + @return EFI_ACCESS_DENIED It is during memory profile data getting. + @return EFI_ABORTED Memory profile recording is not enabled. + @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action. + @return EFI_NOT_FOUND No matched allocate info found for free action. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_MEMORY_PROFILE_RECORD)( + IN EDKII_MEMORY_PROFILE_PROTOCOL *This, + IN PHYSICAL_ADDRESS CallerAddress, + IN MEMORY_PROFILE_ACTION Action, + IN EFI_MEMORY_TYPE MemoryType, + IN VOID *Buffer, + IN UINTN Size, + IN CHAR8 *ActionString OPTIONAL + ); + +struct _EDKII_MEMORY_PROFILE_PROTOCOL { + EDKII_MEMORY_PROFILE_GET_DATA GetData; + EDKII_MEMORY_PROFILE_REGISTER_IMAGE RegisterImage; + EDKII_MEMORY_PROFILE_UNREGISTER_IMAGE UnregisterImage; + EDKII_MEMORY_PROFILE_GET_RECORDING_STATE GetRecordingState; + EDKII_MEMORY_PROFILE_SET_RECORDING_STATE SetRecordingState; + EDKII_MEMORY_PROFILE_RECORD Record; +}; + +// +// SMRAM profile layout: +// +--------------------------------+ +// | CONTEXT | +// +--------------------------------+ +// | DRIVER_INFO(1) | +// +--------------------------------+ +// | ALLOC_INFO(1, 1) | +// +--------------------------------+ +// | ALLOC_INFO(1, m1) | +// +--------------------------------+ +// | DRIVER_INFO(n) | +// +--------------------------------+ +// | ALLOC_INFO(n, 1) | +// +--------------------------------+ +// | ALLOC_INFO(n, mn) | +// +--------------------------------+ +// | FREE_MEMORY | +// +--------------------------------+ +// | FREE MEMORY DESCRIPTOR(1) | +// +--------------------------------+ +// | FREE MEMORY DESCRIPTOR(p) | +// +--------------------------------+ +// | MEMORY_RANGE | +// +--------------------------------+ +// | MEMORY RANGE DESCRIPTOR(1) | +// +--------------------------------+ +// | MEMORY RANGE DESCRIPTOR(q) | +// +--------------------------------+ +// + +// +// SMRAM profile command +// +#define SMRAM_PROFILE_COMMAND_GET_PROFILE_INFO 0x1 +#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA 0x2 +// +// Below 2 commands have been deprecated. They may not be re-used. +// +#define SMRAM_PROFILE_COMMAND_DEPRECATED1 0x3 +#define SMRAM_PROFILE_COMMAND_DEPRECATED2 0x4 + +#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET 0x5 +#define SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE 0x6 +#define SMRAM_PROFILE_COMMAND_SET_RECORDING_STATE 0x7 + +typedef struct { + UINT32 Command; + UINT32 DataLength; + UINT64 ReturnStatus; +} SMRAM_PROFILE_PARAMETER_HEADER; + +typedef struct { + SMRAM_PROFILE_PARAMETER_HEADER Header; + UINT64 ProfileSize; +} SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO; + +typedef struct { + SMRAM_PROFILE_PARAMETER_HEADER Header; + UINT64 ProfileSize; + PHYSICAL_ADDRESS ProfileBuffer; +} SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA; + +typedef struct { + SMRAM_PROFILE_PARAMETER_HEADER Header; + // + // On input, profile buffer size. + // On output, actual profile data size copied. + // + UINT64 ProfileSize; + PHYSICAL_ADDRESS ProfileBuffer; + // + // On input, profile buffer offset to copy. + // On output, next time profile buffer offset to copy. + // + UINT64 ProfileOffset; +} SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET; + +typedef struct { + SMRAM_PROFILE_PARAMETER_HEADER Header; + BOOLEAN RecordingState; +} SMRAM_PROFILE_PARAMETER_RECORDING_STATE; + +typedef struct { + SMRAM_PROFILE_PARAMETER_HEADER Header; + EFI_GUID FileName; + PHYSICAL_ADDRESS ImageBuffer; + UINT64 NumberOfPage; +} SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE; + +typedef struct { + SMRAM_PROFILE_PARAMETER_HEADER Header; + EFI_GUID FileName; + PHYSICAL_ADDRESS ImageBuffer; + UINT64 NumberOfPage; +} SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE; + +#define EDKII_MEMORY_PROFILE_GUID {\ + 0x821c9a09, 0x541a, 0x40f6, { 0x9f, 0x43, 0xa, 0xd1, 0x93, 0xa1, 0x2c, 0xfe } \ +} + +extern EFI_GUID gEdkiiMemoryProfileGuid; + +typedef EDKII_MEMORY_PROFILE_PROTOCOL EDKII_SMM_MEMORY_PROFILE_PROTOCOL; + +#define EDKII_SMM_MEMORY_PROFILE_GUID {\ + 0xe22bbcca, 0x516a, 0x46a8, { 0x80, 0xe2, 0x67, 0x45, 0xe8, 0x36, 0x93, 0xbd } \ +} + +extern EFI_GUID gEdkiiSmmMemoryProfileGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h b/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h index a924c592c9..14e3177495 100644 --- a/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h +++ b/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h @@ -1,97 +1,97 @@ -/** @file
- GUID used to identify status code records HOB that originate from the PEI status code.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __MEMORY_STATUS_CODE_RECORD_H__
-#define __MEMORY_STATUS_CODE_RECORD_H__
-
-///
-/// Global ID used to identify GUIDed HOBs that start with a structure of type
-/// MEMORY_STATUSCODE_PACKET_HEADER, followed by an array of structures of type
-/// MEMORY_STATUSCODE_RECORD. These GUIDed HOBs record all the information
-/// passed into the ReportStatusCode() service of PEI Services Table.
-///
-/// <pre>
-/// Memory status code records packet structure :
-/// +---------------+----------+----------+-----+----------+-----+----------+
-/// | Packet Header | Record 1 | Record 2 | ... + Record n | ... | Record m |
-/// +---------------+----------+----------+-----+----------+-----+----------+
-/// ^ ^ ^
-/// +--------- RecordIndex -----------+ |
-/// +---------------- MaxRecordsNumber----------------------+
-/// </pre>
-///
-#define MEMORY_STATUS_CODE_RECORD_GUID \
- { \
- 0x60cc026, 0x4c0d, 0x4dda, {0x8f, 0x41, 0x59, 0x5f, 0xef, 0x0, 0xa5, 0x2} \
- }
-
-///
-/// A header structure that is followed by an array of records that contain the
-/// parameters passed into the ReportStatusCode() service in the PEI Services Table.
-///
-typedef struct {
- ///
- /// Index of the packet.
- ///
- UINT16 PacketIndex;
- ///
- /// The number of active records in the packet.
- ///
- UINT16 RecordIndex;
- ///
- /// The maximum number of records that the packet can store.
- ///
- UINT32 MaxRecordsNumber;
-} MEMORY_STATUSCODE_PACKET_HEADER;
-
-///
-/// A header structure that is followed by an array of records that contain the
-/// parameters passed into the ReportStatusCode() service in the DXE Services Table.
-///
-typedef struct {
- ///
- /// The index pointing to the last recored being stored.
- ///
- UINT32 RecordIndex;
- ///
- /// The number of records being stored.
- ///
- UINT32 NumberOfRecords;
- ///
- /// The maximum number of records that can be stored.
- ///
- UINT32 MaxRecordsNumber;
-} RUNTIME_MEMORY_STATUSCODE_HEADER;
-
-///
-/// A structure that contains the parameters passed into the ReportStatusCode()
-/// service in the PEI Services Table.
-///
-typedef struct {
- ///
- /// Status Code type to be reported.
- ///
- EFI_STATUS_CODE_TYPE CodeType;
-
- ///
- /// An operation, plus value information about the class and subclass, used to
- /// classify the hardware and software entity.
- ///
- EFI_STATUS_CODE_VALUE Value;
-
- ///
- /// The enumeration of a hardware or software entity within
- /// the system. Valid instance numbers start with the number 1.
- ///
- UINT32 Instance;
-} MEMORY_STATUSCODE_RECORD;
-
-extern EFI_GUID gMemoryStatusCodeRecordGuid;
-
-#endif
+/** @file + GUID used to identify status code records HOB that originate from the PEI status code. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __MEMORY_STATUS_CODE_RECORD_H__ +#define __MEMORY_STATUS_CODE_RECORD_H__ + +/// +/// Global ID used to identify GUIDed HOBs that start with a structure of type +/// MEMORY_STATUSCODE_PACKET_HEADER, followed by an array of structures of type +/// MEMORY_STATUSCODE_RECORD. These GUIDed HOBs record all the information +/// passed into the ReportStatusCode() service of PEI Services Table. +/// +/// <pre> +/// Memory status code records packet structure : +/// +---------------+----------+----------+-----+----------+-----+----------+ +/// | Packet Header | Record 1 | Record 2 | ... + Record n | ... | Record m | +/// +---------------+----------+----------+-----+----------+-----+----------+ +/// ^ ^ ^ +/// +--------- RecordIndex -----------+ | +/// +---------------- MaxRecordsNumber----------------------+ +/// </pre> +/// +#define MEMORY_STATUS_CODE_RECORD_GUID \ + { \ + 0x60cc026, 0x4c0d, 0x4dda, {0x8f, 0x41, 0x59, 0x5f, 0xef, 0x0, 0xa5, 0x2} \ + } + +/// +/// A header structure that is followed by an array of records that contain the +/// parameters passed into the ReportStatusCode() service in the PEI Services Table. +/// +typedef struct { + /// + /// Index of the packet. + /// + UINT16 PacketIndex; + /// + /// The number of active records in the packet. + /// + UINT16 RecordIndex; + /// + /// The maximum number of records that the packet can store. + /// + UINT32 MaxRecordsNumber; +} MEMORY_STATUSCODE_PACKET_HEADER; + +/// +/// A header structure that is followed by an array of records that contain the +/// parameters passed into the ReportStatusCode() service in the DXE Services Table. +/// +typedef struct { + /// + /// The index pointing to the last recored being stored. + /// + UINT32 RecordIndex; + /// + /// The number of records being stored. + /// + UINT32 NumberOfRecords; + /// + /// The maximum number of records that can be stored. + /// + UINT32 MaxRecordsNumber; +} RUNTIME_MEMORY_STATUSCODE_HEADER; + +/// +/// A structure that contains the parameters passed into the ReportStatusCode() +/// service in the PEI Services Table. +/// +typedef struct { + /// + /// Status Code type to be reported. + /// + EFI_STATUS_CODE_TYPE CodeType; + + /// + /// An operation, plus value information about the class and subclass, used to + /// classify the hardware and software entity. + /// + EFI_STATUS_CODE_VALUE Value; + + /// + /// The enumeration of a hardware or software entity within + /// the system. Valid instance numbers start with the number 1. + /// + UINT32 Instance; +} MEMORY_STATUSCODE_RECORD; + +extern EFI_GUID gMemoryStatusCodeRecordGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/MemoryTypeInformation.h b/MdeModulePkg/Include/Guid/MemoryTypeInformation.h index 65adcf478b..3f792e9b48 100644 --- a/MdeModulePkg/Include/Guid/MemoryTypeInformation.h +++ b/MdeModulePkg/Include/Guid/MemoryTypeInformation.h @@ -1,34 +1,34 @@ -/** @file
- This file defines:
- * Memory Type Information GUID for Guided HOB and Variable.
- * Memory Type Information Variable Name.
- * Memory Type Information GUID HOB data structure.
-
- The memory type information HOB and variable can be used to store information
- for each memory type in Variable or HOB.
-
- The Memory Type Information GUID can also be optionally used as the Owner
- field of a Resource Descriptor HOB to provide the preferred memory range
- for the memory types described in the Memory Type Information GUID HOB.
-
- Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __MEMORY_TYPE_INFORMATION_GUID_H__
-#define __MEMORY_TYPE_INFORMATION_GUID_H__
-
-#define EFI_MEMORY_TYPE_INFORMATION_GUID \
- { 0x4c19049f,0x4137,0x4dd3, { 0x9c,0x10,0x8b,0x97,0xa8,0x3f,0xfd,0xfa } }
-
-#define EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME L"MemoryTypeInformation"
-
-extern EFI_GUID gEfiMemoryTypeInformationGuid;
-
-typedef struct {
- UINT32 Type; ///< EFI memory type defined in UEFI specification.
- UINT32 NumberOfPages; ///< The pages of this type memory.
-} EFI_MEMORY_TYPE_INFORMATION;
-
-#endif
+/** @file + This file defines: + * Memory Type Information GUID for Guided HOB and Variable. + * Memory Type Information Variable Name. + * Memory Type Information GUID HOB data structure. + + The memory type information HOB and variable can be used to store information + for each memory type in Variable or HOB. + + The Memory Type Information GUID can also be optionally used as the Owner + field of a Resource Descriptor HOB to provide the preferred memory range + for the memory types described in the Memory Type Information GUID HOB. + + Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __MEMORY_TYPE_INFORMATION_GUID_H__ +#define __MEMORY_TYPE_INFORMATION_GUID_H__ + +#define EFI_MEMORY_TYPE_INFORMATION_GUID \ + { 0x4c19049f,0x4137,0x4dd3, { 0x9c,0x10,0x8b,0x97,0xa8,0x3f,0xfd,0xfa } } + +#define EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME L"MemoryTypeInformation" + +extern EFI_GUID gEfiMemoryTypeInformationGuid; + +typedef struct { + UINT32 Type; ///< EFI memory type defined in UEFI specification. + UINT32 NumberOfPages; ///< The pages of this type memory. +} EFI_MEMORY_TYPE_INFORMATION; + +#endif diff --git a/MdeModulePkg/Include/Guid/MigratedFvInfo.h b/MdeModulePkg/Include/Guid/MigratedFvInfo.h index 1c8b0dfefc..a4306a89f2 100644 --- a/MdeModulePkg/Include/Guid/MigratedFvInfo.h +++ b/MdeModulePkg/Include/Guid/MigratedFvInfo.h @@ -1,61 +1,61 @@ -/** @file
- Migrated FV information
-
-Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EDKII_MIGRATED_FV_INFO_GUID_H__
-#define __EDKII_MIGRATED_FV_INFO_GUID_H__
-
-//
-// FLAGS_FV_RAW_DATA_COPY indicates FV raw data will be copied to permanent memory
-// or not. When FV is migrated to permanent memory, it will be rebased and raw
-// data will be lost. This bit can be configured as below values:
-// 0: FV raw data will not be used in later phase, and the copy will be skipped to
-// optimize boot performance.
-// 1: FV raw data will be copied to permanent memory for later phase use (such as
-// FV measurement).
-//
-#define FLAGS_FV_RAW_DATA_COPY BIT0
-
-///
-/// In real use cases, not all FVs need migrate to permanent memory before TempRam tears
-/// down. EDKII_MIGRATION_INFO hob should be published by platform to indicate which
-/// FVs need migration to optimize boot performance. If this hob is not detected by Pei
-/// Core, all FVs on TempRam will be migrated and FV raw data will also be copied.
-/// Only one EDKII_MIGRATION_INFO hob should be published by platform, and this hob will
-/// take effect only when migration feature is enabled by PCD.
-///
-typedef struct {
- UINT32 FvOrgBaseOnTempRam; // Original FV address on Temporary Ram
- //
- // FV Migration Flags:
- // Bit0: Indicate to copy FV raw data or not
- // Others: Reserved bits
- //
- UINT32 FvMigrationFlags;
-} TO_MIGRATE_FV_INFO;
-
-typedef struct {
- BOOLEAN MigrateAll; // Migrate all FVs and also copy FV raw data
- //
- // ToMigrateFvCount and ToMigrateFvInfo array indicate which FVs need be migrated, and
- // these info should be ignored when MigrateAll field is set to TRUE.
- //
- UINT32 ToMigrateFvCount;
- // TO_MIGRATE_FV_INFO ToMigrateFvInfo[];
-} EDKII_MIGRATION_INFO;
-
-typedef struct {
- UINT32 FvOrgBase; // original FV address
- UINT32 FvNewBase; // new FV address
- UINT32 FvDataBase; // original FV data, 0 means raw data is not copied
- UINT32 FvLength; // Fv Length
-} EDKII_MIGRATED_FV_INFO;
-
-extern EFI_GUID gEdkiiMigrationInfoGuid;
-extern EFI_GUID gEdkiiMigratedFvInfoGuid;
-
-#endif // #ifndef __EDKII_MIGRATED_FV_INFO_GUID_H__
+/** @file + Migrated FV information + +Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EDKII_MIGRATED_FV_INFO_GUID_H__ +#define __EDKII_MIGRATED_FV_INFO_GUID_H__ + +// +// FLAGS_FV_RAW_DATA_COPY indicates FV raw data will be copied to permanent memory +// or not. When FV is migrated to permanent memory, it will be rebased and raw +// data will be lost. This bit can be configured as below values: +// 0: FV raw data will not be used in later phase, and the copy will be skipped to +// optimize boot performance. +// 1: FV raw data will be copied to permanent memory for later phase use (such as +// FV measurement). +// +#define FLAGS_FV_RAW_DATA_COPY BIT0 + +/// +/// In real use cases, not all FVs need migrate to permanent memory before TempRam tears +/// down. EDKII_MIGRATION_INFO hob should be published by platform to indicate which +/// FVs need migration to optimize boot performance. If this hob is not detected by Pei +/// Core, all FVs on TempRam will be migrated and FV raw data will also be copied. +/// Only one EDKII_MIGRATION_INFO hob should be published by platform, and this hob will +/// take effect only when migration feature is enabled by PCD. +/// +typedef struct { + UINT32 FvOrgBaseOnTempRam; // Original FV address on Temporary Ram + // + // FV Migration Flags: + // Bit0: Indicate to copy FV raw data or not + // Others: Reserved bits + // + UINT32 FvMigrationFlags; +} TO_MIGRATE_FV_INFO; + +typedef struct { + BOOLEAN MigrateAll; // Migrate all FVs and also copy FV raw data + // + // ToMigrateFvCount and ToMigrateFvInfo array indicate which FVs need be migrated, and + // these info should be ignored when MigrateAll field is set to TRUE. + // + UINT32 ToMigrateFvCount; + // TO_MIGRATE_FV_INFO ToMigrateFvInfo[]; +} EDKII_MIGRATION_INFO; + +typedef struct { + UINT32 FvOrgBase; // original FV address + UINT32 FvNewBase; // new FV address + UINT32 FvDataBase; // original FV data, 0 means raw data is not copied + UINT32 FvLength; // Fv Length +} EDKII_MIGRATED_FV_INFO; + +extern EFI_GUID gEdkiiMigrationInfoGuid; +extern EFI_GUID gEdkiiMigratedFvInfoGuid; + +#endif // #ifndef __EDKII_MIGRATED_FV_INFO_GUID_H__ diff --git a/MdeModulePkg/Include/Guid/MtcVendor.h b/MdeModulePkg/Include/Guid/MtcVendor.h index 74163972aa..dae3fd7e46 100644 --- a/MdeModulePkg/Include/Guid/MtcVendor.h +++ b/MdeModulePkg/Include/Guid/MtcVendor.h @@ -1,25 +1,25 @@ -/** @file
- GUID is for MTC variable.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __MTC_VENDOR_GUID_H__
-#define __MTC_VENDOR_GUID_H__
-
-//
-// Vendor GUID of the variable for the high part of monotonic counter (UINT32).
-//
-#define MTC_VENDOR_GUID \
- { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } }
-
-//
-// Name of the variable for the high part of monotonic counter
-//
-#define MTC_VARIABLE_NAME L"MTC"
-
-extern EFI_GUID gMtcVendorGuid;
-
-#endif
+/** @file + GUID is for MTC variable. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __MTC_VENDOR_GUID_H__ +#define __MTC_VENDOR_GUID_H__ + +// +// Vendor GUID of the variable for the high part of monotonic counter (UINT32). +// +#define MTC_VENDOR_GUID \ + { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } } + +// +// Name of the variable for the high part of monotonic counter +// +#define MTC_VARIABLE_NAME L"MTC" + +extern EFI_GUID gMtcVendorGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/NonDiscoverableDevice.h b/MdeModulePkg/Include/Guid/NonDiscoverableDevice.h index 26fa5d28a1..b16840aeda 100644 --- a/MdeModulePkg/Include/Guid/NonDiscoverableDevice.h +++ b/MdeModulePkg/Include/Guid/NonDiscoverableDevice.h @@ -1,51 +1,51 @@ -/** @file
- GUIDs to identify devices that are not on a discoverable bus but can be
- controlled by a standard class driver
-
- Copyright (c) 2016, Linaro, Ltd. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __NON_DISCOVERABLE_DEVICE_GUID_H__
-#define __NON_DISCOVERABLE_DEVICE_GUID_H__
-
-#define EDKII_NON_DISCOVERABLE_AHCI_DEVICE_GUID \
- { 0xC7D35798, 0xE4D2, 0x4A93, {0xB1, 0x45, 0x54, 0x88, 0x9F, 0x02, 0x58, 0x4B } }
-
-#define EDKII_NON_DISCOVERABLE_AMBA_DEVICE_GUID \
- { 0x94440339, 0xCC93, 0x4506, {0xB4, 0xC6, 0xEE, 0x8D, 0x0F, 0x4C, 0xA1, 0x91 } }
-
-#define EDKII_NON_DISCOVERABLE_EHCI_DEVICE_GUID \
- { 0xEAEE5615, 0x0CFD, 0x45FC, {0x87, 0x69, 0xA0, 0xD8, 0x56, 0x95, 0xAF, 0x85 } }
-
-#define EDKII_NON_DISCOVERABLE_NVME_DEVICE_GUID \
- { 0xC5F25542, 0x2A79, 0x4A26, {0x81, 0xBB, 0x4E, 0xA6, 0x32, 0x33, 0xB3, 0x09 } }
-
-#define EDKII_NON_DISCOVERABLE_OHCI_DEVICE_GUID \
- { 0xB20005B0, 0xBB2D, 0x496F, {0x86, 0x9C, 0x23, 0x0B, 0x44, 0x79, 0xE7, 0xD1 } }
-
-#define EDKII_NON_DISCOVERABLE_SDHCI_DEVICE_GUID \
- { 0x1DD1D619, 0xF9B8, 0x463E, {0x86, 0x81, 0xD1, 0xDC, 0x7C, 0x07, 0xB7, 0x2C } }
-
-#define EDKII_NON_DISCOVERABLE_UFS_DEVICE_GUID \
- { 0x2EA77912, 0x80A8, 0x4947, {0xBE, 0x69, 0xCD, 0xD0, 0x0A, 0xFB, 0xE5, 0x56 } }
-
-#define EDKII_NON_DISCOVERABLE_UHCI_DEVICE_GUID \
- { 0xA8CDA0A2, 0x4F37, 0x4A1B, {0x8E, 0x10, 0x8E, 0xF3, 0xCC, 0x3B, 0xF3, 0xA8 } }
-
-#define EDKII_NON_DISCOVERABLE_XHCI_DEVICE_GUID \
- { 0xB1BE0BC5, 0x6C28, 0x442D, {0xAA, 0x37, 0x15, 0x1B, 0x42, 0x57, 0xBD, 0x78 } }
-
-extern EFI_GUID gEdkiiNonDiscoverableAhciDeviceGuid;
-extern EFI_GUID gEdkiiNonDiscoverableAmbaDeviceGuid;
-extern EFI_GUID gEdkiiNonDiscoverableEhciDeviceGuid;
-extern EFI_GUID gEdkiiNonDiscoverableNvmeDeviceGuid;
-extern EFI_GUID gEdkiiNonDiscoverableOhciDeviceGuid;
-extern EFI_GUID gEdkiiNonDiscoverableSdhciDeviceGuid;
-extern EFI_GUID gEdkiiNonDiscoverableUfsDeviceGuid;
-extern EFI_GUID gEdkiiNonDiscoverableUhciDeviceGuid;
-extern EFI_GUID gEdkiiNonDiscoverableXhciDeviceGuid;
-
-#endif
+/** @file + GUIDs to identify devices that are not on a discoverable bus but can be + controlled by a standard class driver + + Copyright (c) 2016, Linaro, Ltd. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __NON_DISCOVERABLE_DEVICE_GUID_H__ +#define __NON_DISCOVERABLE_DEVICE_GUID_H__ + +#define EDKII_NON_DISCOVERABLE_AHCI_DEVICE_GUID \ + { 0xC7D35798, 0xE4D2, 0x4A93, {0xB1, 0x45, 0x54, 0x88, 0x9F, 0x02, 0x58, 0x4B } } + +#define EDKII_NON_DISCOVERABLE_AMBA_DEVICE_GUID \ + { 0x94440339, 0xCC93, 0x4506, {0xB4, 0xC6, 0xEE, 0x8D, 0x0F, 0x4C, 0xA1, 0x91 } } + +#define EDKII_NON_DISCOVERABLE_EHCI_DEVICE_GUID \ + { 0xEAEE5615, 0x0CFD, 0x45FC, {0x87, 0x69, 0xA0, 0xD8, 0x56, 0x95, 0xAF, 0x85 } } + +#define EDKII_NON_DISCOVERABLE_NVME_DEVICE_GUID \ + { 0xC5F25542, 0x2A79, 0x4A26, {0x81, 0xBB, 0x4E, 0xA6, 0x32, 0x33, 0xB3, 0x09 } } + +#define EDKII_NON_DISCOVERABLE_OHCI_DEVICE_GUID \ + { 0xB20005B0, 0xBB2D, 0x496F, {0x86, 0x9C, 0x23, 0x0B, 0x44, 0x79, 0xE7, 0xD1 } } + +#define EDKII_NON_DISCOVERABLE_SDHCI_DEVICE_GUID \ + { 0x1DD1D619, 0xF9B8, 0x463E, {0x86, 0x81, 0xD1, 0xDC, 0x7C, 0x07, 0xB7, 0x2C } } + +#define EDKII_NON_DISCOVERABLE_UFS_DEVICE_GUID \ + { 0x2EA77912, 0x80A8, 0x4947, {0xBE, 0x69, 0xCD, 0xD0, 0x0A, 0xFB, 0xE5, 0x56 } } + +#define EDKII_NON_DISCOVERABLE_UHCI_DEVICE_GUID \ + { 0xA8CDA0A2, 0x4F37, 0x4A1B, {0x8E, 0x10, 0x8E, 0xF3, 0xCC, 0x3B, 0xF3, 0xA8 } } + +#define EDKII_NON_DISCOVERABLE_XHCI_DEVICE_GUID \ + { 0xB1BE0BC5, 0x6C28, 0x442D, {0xAA, 0x37, 0x15, 0x1B, 0x42, 0x57, 0xBD, 0x78 } } + +extern EFI_GUID gEdkiiNonDiscoverableAhciDeviceGuid; +extern EFI_GUID gEdkiiNonDiscoverableAmbaDeviceGuid; +extern EFI_GUID gEdkiiNonDiscoverableEhciDeviceGuid; +extern EFI_GUID gEdkiiNonDiscoverableNvmeDeviceGuid; +extern EFI_GUID gEdkiiNonDiscoverableOhciDeviceGuid; +extern EFI_GUID gEdkiiNonDiscoverableSdhciDeviceGuid; +extern EFI_GUID gEdkiiNonDiscoverableUfsDeviceGuid; +extern EFI_GUID gEdkiiNonDiscoverableUhciDeviceGuid; +extern EFI_GUID gEdkiiNonDiscoverableXhciDeviceGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/PcdDataBaseHobGuid.h b/MdeModulePkg/Include/Guid/PcdDataBaseHobGuid.h index 0cfe8bc68d..4ae1400ff3 100644 --- a/MdeModulePkg/Include/Guid/PcdDataBaseHobGuid.h +++ b/MdeModulePkg/Include/Guid/PcdDataBaseHobGuid.h @@ -1,19 +1,19 @@ -/** @file
- Hob guid for Pcd DataBase.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PCD_DATABASE_HOB_GUID_H_
-#define _PCD_DATABASE_HOB_GUID_H_
-
-#define PCD_DATABASE_HOB_GUID \
- { \
- 0xEA296D92, 0x0B69, 0x423C, { 0x8C, 0x28, 0x33, 0xB4, 0xE0, 0xA9, 0x12, 0x68 } \
- }
-
-extern EFI_GUID gPcdDataBaseHobGuid;
-
-#endif
+/** @file + Hob guid for Pcd DataBase. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PCD_DATABASE_HOB_GUID_H_ +#define _PCD_DATABASE_HOB_GUID_H_ + +#define PCD_DATABASE_HOB_GUID \ + { \ + 0xEA296D92, 0x0B69, 0x423C, { 0x8C, 0x28, 0x33, 0xB4, 0xE0, 0xA9, 0x12, 0x68 } \ + } + +extern EFI_GUID gPcdDataBaseHobGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h b/MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h index bac8fd59bf..1f0b012708 100644 --- a/MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h +++ b/MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h @@ -1,226 +1,226 @@ -/** @file
- Guid for Pcd DataBase Signature.
-
-Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PCD_DATABASE_SIGNATURE_GUID_H_
-#define _PCD_DATABASE_SIGNATURE_GUID_H_
-
-#define PCD_DATA_BASE_SIGNATURE_GUID \
-{ 0x3c7d193c, 0x682c, 0x4c14, { 0xa6, 0x8f, 0x55, 0x2d, 0xea, 0x4f, 0x43, 0x7e } }
-
-extern EFI_GUID gPcdDataBaseSignatureGuid;
-
-//
-// Common definitions
-//
-typedef UINT64 SKU_ID;
-
-#define PCD_TYPE_SHIFT 28
-
-#define PCD_TYPE_DATA (0x0U << PCD_TYPE_SHIFT)
-#define PCD_TYPE_HII (0x8U << PCD_TYPE_SHIFT)
-#define PCD_TYPE_VPD (0x4U << PCD_TYPE_SHIFT)
-#define PCD_TYPE_STRING (0x1U << PCD_TYPE_SHIFT)
-
-#define PCD_TYPE_ALL_SET (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_STRING)
-
-#define PCD_DATUM_TYPE_SHIFT 24
-
-#define PCD_DATUM_TYPE_POINTER (0x0U << PCD_DATUM_TYPE_SHIFT)
-#define PCD_DATUM_TYPE_UINT8 (0x1U << PCD_DATUM_TYPE_SHIFT)
-#define PCD_DATUM_TYPE_UINT16 (0x2U << PCD_DATUM_TYPE_SHIFT)
-#define PCD_DATUM_TYPE_UINT32 (0x4U << PCD_DATUM_TYPE_SHIFT)
-#define PCD_DATUM_TYPE_UINT64 (0x8U << PCD_DATUM_TYPE_SHIFT)
-
-#define PCD_DATUM_TYPE_ALL_SET (PCD_DATUM_TYPE_POINTER | \
- PCD_DATUM_TYPE_UINT8 | \
- PCD_DATUM_TYPE_UINT16 | \
- PCD_DATUM_TYPE_UINT32 | \
- PCD_DATUM_TYPE_UINT64)
-
-#define PCD_DATUM_TYPE_SHIFT2 20
-
-#define PCD_DATUM_TYPE_UINT8_BOOLEAN (0x1U << PCD_DATUM_TYPE_SHIFT2)
-
-#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET | PCD_DATUM_TYPE_ALL_SET | PCD_DATUM_TYPE_UINT8_BOOLEAN))
-
-typedef struct {
- UINT32 ExTokenNumber;
- UINT16 TokenNumber; // Token Number for Dynamic-Ex PCD.
- UINT16 ExGuidIndex; // Index of GuidTable in units of GUID.
-} DYNAMICEX_MAPPING;
-
-typedef struct {
- UINT32 StringIndex; // Offset in String Table in units of UINT8.
- UINT32 DefaultValueOffset; // Offset of the Default Value.
- UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.
- UINT16 Offset; // Offset in Variable.
- UINT32 Attributes; // Variable attributes.
- UINT16 Property; // Variable property.
- UINT16 Reserved;
-} VARIABLE_HEAD;
-
-typedef struct {
- UINT32 Offset;
-} VPD_HEAD;
-
-typedef UINT32 STRING_HEAD;
-
-typedef UINT16 SIZE_INFO;
-
-typedef struct {
- UINT32 TokenSpaceCNameIndex; // Offset in String Table in units of UINT8.
- UINT32 PcdCNameIndex; // Offset in String Table in units of UINT8.
-} PCD_NAME_INDEX;
-
-typedef UINT32 TABLE_OFFSET;
-
-typedef struct {
- GUID Signature; // PcdDataBaseGuid.
- UINT32 BuildVersion;
- UINT32 Length; // Length of DEFAULT SKU PCD DB
- SKU_ID SystemSkuId; // Current SkuId value.
- UINT32 LengthForAllSkus; // Length of all SKU PCD DB
- UINT32 UninitDataBaseSize; // Total size for PCD those default value with 0.
- TABLE_OFFSET LocalTokenNumberTableOffset;
- TABLE_OFFSET ExMapTableOffset;
- TABLE_OFFSET GuidTableOffset;
- TABLE_OFFSET StringTableOffset;
- TABLE_OFFSET SizeTableOffset;
- TABLE_OFFSET SkuIdTableOffset;
- TABLE_OFFSET PcdNameTableOffset;
- UINT16 LocalTokenCount; // LOCAL_TOKEN_NUMBER for all.
- UINT16 ExTokenCount; // EX_TOKEN_NUMBER for DynamicEx.
- UINT16 GuidTableCount; // The Number of Guid in GuidTable.
- UINT8 Pad[6]; // Pad bytes to satisfy the alignment.
-
- //
- // Default initialized external PCD database binary structure
- //
- // Padding is needed to keep necessary alignment
- //
- // SKU_ID SkuIdTable[]; // SkuIds system supports.
- // UINT64 ValueUint64[];
- // UINT32 ValueUint32[];
- // VPD_HEAD VpdHead[]; // VPD Offset
- // DYNAMICEX_MAPPING ExMapTable[]; // DynamicEx PCD mapped to LocalIndex in LocalTokenNumberTable. It can be accessed by the ExMapTableOffset.
- // UINT32 LocalTokenNumberTable[]; // Offset | DataType | PCD Type. It can be accessed by LocalTokenNumberTableOffset.
- // GUID GuidTable[]; // GUID for DynamicEx and HII PCD variable Guid. It can be accessed by the GuidTableOffset.
- // STRING_HEAD StringHead[]; // String PCD
- // PCD_NAME_INDEX PcdNameTable[]; // PCD name index info. It can be accessed by the PcdNameTableOffset.
- // VARIABLE_HEAD VariableHead[]; // HII PCD
- // UINT8 StringTable[]; // String for String PCD value and HII PCD Variable Name. It can be accessed by StringTableOffset.
- // SIZE_INFO SizeTable[]; // MaxSize and CurSize for String PCD. It can be accessed by SizeTableOffset.
- // UINT16 ValueUint16[];
- // UINT8 ValueUint8[];
- // BOOLEAN ValueBoolean[];
-} PCD_DATABASE_INIT;
-
-//
-// PEI and DXE Pcd driver use the same PCD database
-//
-typedef PCD_DATABASE_INIT PEI_PCD_DATABASE;
-typedef PCD_DATABASE_INIT DXE_PCD_DATABASE;
-
-typedef struct {
- PEI_PCD_DATABASE *PeiDb;
- DXE_PCD_DATABASE *DxeDb;
-} PCD_DATABASE;
-
-typedef struct {
- UINT32 Offset : 24;
- UINT32 Value : 8;
-} PCD_DATA_DELTA;
-
-typedef struct {
- SKU_ID SkuId;
- UINT16 DefaultId;
- UINT8 Reserved[6];
-} PCD_DEFAULT_INFO;
-
-typedef struct {
- //
- // Full size, it must be at 8 byte alignment.
- //
- UINT32 DataSize;
- //
- // HeaderSize includes HeaderSize fields and DefaultInfo arrays
- //
- UINT32 HeaderSize;
- //
- // DefaultInfo arrays those have the same default setting.
- //
- PCD_DEFAULT_INFO DefaultInfo[1];
- //
- // Default data is stored as variable storage or the array of DATA_DELTA.
- //
-} PCD_DEFAULT_DATA;
-
-#define PCD_NV_STORE_DEFAULT_BUFFER_SIGNATURE SIGNATURE_32('N', 'S', 'D', 'B')
-
-typedef struct {
- //
- // PCD_NV_STORE_DEFAULT_BUFFER_SIGNATURE
- //
- UINT32 Signature;
- //
- // Length of the taken default buffer
- //
- UINT32 Length;
- //
- // Length of the total reserved buffer
- //
- UINT32 MaxLength;
- //
- // Reserved for 8 byte alignment
- //
- UINT32 Reserved;
- // one or more PCD_DEFAULT_DATA
-} PCD_NV_STORE_DEFAULT_BUFFER_HEADER;
-
-//
-// NvStoreDefaultValueBuffer layout:
-// +-------------------------------------+
-// | PCD_NV_STORE_DEFAULT_BUFFER_HEADER |
-// +-------------------------------------+
-// | PCD_DEFAULT_DATA (DEFAULT, Standard)|
-// +-------------------------------------+
-// | PCD_DATA_DELTA (DEFAULT, Standard)|
-// +-------------------------------------+
-// | ...... |
-// +-------------------------------------+
-// | PCD_DEFAULT_DATA (SKU A, Standard) |
-// +-------------------------------------+
-// | PCD_DATA_DELTA (SKU A, Standard) |
-// +-------------------------------------+
-// | ...... |
-// +-------------------------------------+
-//
-
-#pragma pack(1)
-typedef struct {
- SKU_ID SkuId;
- SKU_ID SkuIdCompared;
- UINT32 Length;
- // PCD_DATA_DELTA DeltaData[]
-} PCD_DATABASE_SKU_DELTA;
-
-//
-// PCD database layout:
-// +---------------------------------+
-// | PCD_DATABASE_INIT (DEFAULT SKU) |
-// +---------------------------------+
-// | PCD_DATABASE_SKU_DELTA (SKU A) |
-// +---------------------------------+
-// | PCD_DATABASE_SKU_DELTA (SKU B) |
-// +---------------------------------+
-// | ...... |
-// +---------------------------------+
-//
-#pragma pack()
-
-#endif
+/** @file + Guid for Pcd DataBase Signature. + +Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PCD_DATABASE_SIGNATURE_GUID_H_ +#define _PCD_DATABASE_SIGNATURE_GUID_H_ + +#define PCD_DATA_BASE_SIGNATURE_GUID \ +{ 0x3c7d193c, 0x682c, 0x4c14, { 0xa6, 0x8f, 0x55, 0x2d, 0xea, 0x4f, 0x43, 0x7e } } + +extern EFI_GUID gPcdDataBaseSignatureGuid; + +// +// Common definitions +// +typedef UINT64 SKU_ID; + +#define PCD_TYPE_SHIFT 28 + +#define PCD_TYPE_DATA (0x0U << PCD_TYPE_SHIFT) +#define PCD_TYPE_HII (0x8U << PCD_TYPE_SHIFT) +#define PCD_TYPE_VPD (0x4U << PCD_TYPE_SHIFT) +#define PCD_TYPE_STRING (0x1U << PCD_TYPE_SHIFT) + +#define PCD_TYPE_ALL_SET (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_STRING) + +#define PCD_DATUM_TYPE_SHIFT 24 + +#define PCD_DATUM_TYPE_POINTER (0x0U << PCD_DATUM_TYPE_SHIFT) +#define PCD_DATUM_TYPE_UINT8 (0x1U << PCD_DATUM_TYPE_SHIFT) +#define PCD_DATUM_TYPE_UINT16 (0x2U << PCD_DATUM_TYPE_SHIFT) +#define PCD_DATUM_TYPE_UINT32 (0x4U << PCD_DATUM_TYPE_SHIFT) +#define PCD_DATUM_TYPE_UINT64 (0x8U << PCD_DATUM_TYPE_SHIFT) + +#define PCD_DATUM_TYPE_ALL_SET (PCD_DATUM_TYPE_POINTER | \ + PCD_DATUM_TYPE_UINT8 | \ + PCD_DATUM_TYPE_UINT16 | \ + PCD_DATUM_TYPE_UINT32 | \ + PCD_DATUM_TYPE_UINT64) + +#define PCD_DATUM_TYPE_SHIFT2 20 + +#define PCD_DATUM_TYPE_UINT8_BOOLEAN (0x1U << PCD_DATUM_TYPE_SHIFT2) + +#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET | PCD_DATUM_TYPE_ALL_SET | PCD_DATUM_TYPE_UINT8_BOOLEAN)) + +typedef struct { + UINT32 ExTokenNumber; + UINT16 TokenNumber; // Token Number for Dynamic-Ex PCD. + UINT16 ExGuidIndex; // Index of GuidTable in units of GUID. +} DYNAMICEX_MAPPING; + +typedef struct { + UINT32 StringIndex; // Offset in String Table in units of UINT8. + UINT32 DefaultValueOffset; // Offset of the Default Value. + UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID. + UINT16 Offset; // Offset in Variable. + UINT32 Attributes; // Variable attributes. + UINT16 Property; // Variable property. + UINT16 Reserved; +} VARIABLE_HEAD; + +typedef struct { + UINT32 Offset; +} VPD_HEAD; + +typedef UINT32 STRING_HEAD; + +typedef UINT16 SIZE_INFO; + +typedef struct { + UINT32 TokenSpaceCNameIndex; // Offset in String Table in units of UINT8. + UINT32 PcdCNameIndex; // Offset in String Table in units of UINT8. +} PCD_NAME_INDEX; + +typedef UINT32 TABLE_OFFSET; + +typedef struct { + GUID Signature; // PcdDataBaseGuid. + UINT32 BuildVersion; + UINT32 Length; // Length of DEFAULT SKU PCD DB + SKU_ID SystemSkuId; // Current SkuId value. + UINT32 LengthForAllSkus; // Length of all SKU PCD DB + UINT32 UninitDataBaseSize; // Total size for PCD those default value with 0. + TABLE_OFFSET LocalTokenNumberTableOffset; + TABLE_OFFSET ExMapTableOffset; + TABLE_OFFSET GuidTableOffset; + TABLE_OFFSET StringTableOffset; + TABLE_OFFSET SizeTableOffset; + TABLE_OFFSET SkuIdTableOffset; + TABLE_OFFSET PcdNameTableOffset; + UINT16 LocalTokenCount; // LOCAL_TOKEN_NUMBER for all. + UINT16 ExTokenCount; // EX_TOKEN_NUMBER for DynamicEx. + UINT16 GuidTableCount; // The Number of Guid in GuidTable. + UINT8 Pad[6]; // Pad bytes to satisfy the alignment. + + // + // Default initialized external PCD database binary structure + // + // Padding is needed to keep necessary alignment + // + // SKU_ID SkuIdTable[]; // SkuIds system supports. + // UINT64 ValueUint64[]; + // UINT32 ValueUint32[]; + // VPD_HEAD VpdHead[]; // VPD Offset + // DYNAMICEX_MAPPING ExMapTable[]; // DynamicEx PCD mapped to LocalIndex in LocalTokenNumberTable. It can be accessed by the ExMapTableOffset. + // UINT32 LocalTokenNumberTable[]; // Offset | DataType | PCD Type. It can be accessed by LocalTokenNumberTableOffset. + // GUID GuidTable[]; // GUID for DynamicEx and HII PCD variable Guid. It can be accessed by the GuidTableOffset. + // STRING_HEAD StringHead[]; // String PCD + // PCD_NAME_INDEX PcdNameTable[]; // PCD name index info. It can be accessed by the PcdNameTableOffset. + // VARIABLE_HEAD VariableHead[]; // HII PCD + // UINT8 StringTable[]; // String for String PCD value and HII PCD Variable Name. It can be accessed by StringTableOffset. + // SIZE_INFO SizeTable[]; // MaxSize and CurSize for String PCD. It can be accessed by SizeTableOffset. + // UINT16 ValueUint16[]; + // UINT8 ValueUint8[]; + // BOOLEAN ValueBoolean[]; +} PCD_DATABASE_INIT; + +// +// PEI and DXE Pcd driver use the same PCD database +// +typedef PCD_DATABASE_INIT PEI_PCD_DATABASE; +typedef PCD_DATABASE_INIT DXE_PCD_DATABASE; + +typedef struct { + PEI_PCD_DATABASE *PeiDb; + DXE_PCD_DATABASE *DxeDb; +} PCD_DATABASE; + +typedef struct { + UINT32 Offset : 24; + UINT32 Value : 8; +} PCD_DATA_DELTA; + +typedef struct { + SKU_ID SkuId; + UINT16 DefaultId; + UINT8 Reserved[6]; +} PCD_DEFAULT_INFO; + +typedef struct { + // + // Full size, it must be at 8 byte alignment. + // + UINT32 DataSize; + // + // HeaderSize includes HeaderSize fields and DefaultInfo arrays + // + UINT32 HeaderSize; + // + // DefaultInfo arrays those have the same default setting. + // + PCD_DEFAULT_INFO DefaultInfo[1]; + // + // Default data is stored as variable storage or the array of DATA_DELTA. + // +} PCD_DEFAULT_DATA; + +#define PCD_NV_STORE_DEFAULT_BUFFER_SIGNATURE SIGNATURE_32('N', 'S', 'D', 'B') + +typedef struct { + // + // PCD_NV_STORE_DEFAULT_BUFFER_SIGNATURE + // + UINT32 Signature; + // + // Length of the taken default buffer + // + UINT32 Length; + // + // Length of the total reserved buffer + // + UINT32 MaxLength; + // + // Reserved for 8 byte alignment + // + UINT32 Reserved; + // one or more PCD_DEFAULT_DATA +} PCD_NV_STORE_DEFAULT_BUFFER_HEADER; + +// +// NvStoreDefaultValueBuffer layout: +// +-------------------------------------+ +// | PCD_NV_STORE_DEFAULT_BUFFER_HEADER | +// +-------------------------------------+ +// | PCD_DEFAULT_DATA (DEFAULT, Standard)| +// +-------------------------------------+ +// | PCD_DATA_DELTA (DEFAULT, Standard)| +// +-------------------------------------+ +// | ...... | +// +-------------------------------------+ +// | PCD_DEFAULT_DATA (SKU A, Standard) | +// +-------------------------------------+ +// | PCD_DATA_DELTA (SKU A, Standard) | +// +-------------------------------------+ +// | ...... | +// +-------------------------------------+ +// + +#pragma pack(1) +typedef struct { + SKU_ID SkuId; + SKU_ID SkuIdCompared; + UINT32 Length; + // PCD_DATA_DELTA DeltaData[] +} PCD_DATABASE_SKU_DELTA; + +// +// PCD database layout: +// +---------------------------------+ +// | PCD_DATABASE_INIT (DEFAULT SKU) | +// +---------------------------------+ +// | PCD_DATABASE_SKU_DELTA (SKU A) | +// +---------------------------------+ +// | PCD_DATABASE_SKU_DELTA (SKU B) | +// +---------------------------------+ +// | ...... | +// +---------------------------------+ +// +#pragma pack() + +#endif diff --git a/MdeModulePkg/Include/Guid/Performance.h b/MdeModulePkg/Include/Guid/Performance.h index 58e8f5ec5b..b4d9b6bbd6 100644 --- a/MdeModulePkg/Include/Guid/Performance.h +++ b/MdeModulePkg/Include/Guid/Performance.h @@ -1,336 +1,336 @@ -/** @file
- This file defines performance-related definitions, including the format of:
- * performance GUID HOB.
- * performance protocol interfaces.
- * performance variables.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PERFORMANCE_DATA_H__
-#define __PERFORMANCE_DATA_H__
-
-#define PERFORMANCE_PROPERTY_REVISION 0x1
-
-typedef struct {
- UINT32 Revision;
- UINT32 Reserved;
- UINT64 Frequency;
- UINT64 TimerStartValue;
- UINT64 TimerEndValue;
-} PERFORMANCE_PROPERTY;
-
-//
-// PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
-//
-#define PEI_PERFORMANCE_STRING_SIZE 8
-#define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS Handle;
- CHAR8 Token[PEI_PERFORMANCE_STRING_SIZE]; ///< Measured token string name.
- CHAR8 Module[PEI_PERFORMANCE_STRING_SIZE]; ///< Module string name.
- UINT64 StartTimeStamp; ///< Start time point.
- UINT64 EndTimeStamp; ///< End time point.
-} PEI_PERFORMANCE_LOG_ENTRY;
-
-//
-// The header must be aligned at 8 bytes.
-//
-typedef struct {
- UINT32 NumberOfEntries; ///< The number of all performance log entries.
- UINT32 Reserved;
-} PEI_PERFORMANCE_LOG_HEADER;
-
-#define PERFORMANCE_PROTOCOL_GUID \
- { 0x76b6bdfa, 0x2acd, 0x4462, { 0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }
-
-#define PERFORMANCE_EX_PROTOCOL_GUID \
- { 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1, 0x4a, 0x61, 0xce, 0x2f, 0xc0, 0x22 } }
-
-//
-// Forward reference for pure ANSI compatibility
-//
-typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;
-typedef struct _PERFORMANCE_EX_PROTOCOL PERFORMANCE_EX_PROTOCOL;
-
-//
-// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.
-//
-#define DXE_PERFORMANCE_STRING_SIZE 32
-#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)
-
-//
-// The default guage entries number for DXE phase.
-//
-#define INIT_DXE_GAUGE_DATA_ENTRIES 800
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS Handle;
- CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name.
- CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.
- UINT64 StartTimeStamp; ///< Start time point.
- UINT64 EndTimeStamp; ///< End time point.
-} GAUGE_DATA_ENTRY;
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS Handle;
- CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name.
- CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.
- UINT64 StartTimeStamp; ///< Start time point.
- UINT64 EndTimeStamp; ///< End time point.
- UINT32 Identifier; ///< Identifier.
-} GAUGE_DATA_ENTRY_EX;
-
-//
-// The header must be aligned at 8 bytes
-//
-typedef struct {
- UINT32 NumberOfEntries; ///< The number of all performance gauge entries.
- UINT32 Reserved;
-} GAUGE_DATA_HEADER;
-
-//
-// SMM Performance Protocol definitions
-//
-
-#define SMM_PERFORMANCE_PROTOCOL_GUID \
- { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }
-
-#define SMM_PERFORMANCE_EX_PROTOCOL_GUID \
- { 0x931fc048, 0xc71d, 0x4455, { 0x89, 0x30, 0x47, 0x6, 0x30, 0xe3, 0xe, 0xe5 } }
-
-//
-// SMM_PERFORMANCE_STRING_SIZE.
-//
-#define SMM_PERFORMANCE_STRING_SIZE 32
-#define SMM_PERFORMANCE_STRING_LENGTH (SMM_PERFORMANCE_STRING_SIZE - 1)
-
-//
-// The default guage entries number for SMM phase.
-//
-#define INIT_SMM_GAUGE_DATA_ENTRIES 200
-
-typedef struct {
- UINTN Function;
- EFI_STATUS ReturnStatus;
- UINTN NumberOfEntries;
- UINTN LogEntryKey;
- GAUGE_DATA_ENTRY *GaugeData;
-} SMM_PERF_COMMUNICATE;
-
-typedef struct {
- UINTN Function;
- EFI_STATUS ReturnStatus;
- UINTN NumberOfEntries;
- UINTN LogEntryKey;
- GAUGE_DATA_ENTRY_EX *GaugeDataEx;
-} SMM_PERF_COMMUNICATE_EX;
-
-#define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER 1
-#define SMM_PERF_FUNCTION_GET_GAUGE_DATA 2
-
-/**
- Adds a record at the end of the performance measurement log
- that records the start time of a performance measurement.
-
- The added record contains the Handle, Token, and Module.
- The end time of the new record is not recorded, so it is set to zero.
- If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
- If TimeStamp is zero, the start time in the record is filled in with the value
- read from the current time stamp.
-
- @param Handle The pointer to environment specific context used
- to identify the component being measured.
- @param Token The pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module The pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp The 64-bit time stamp.
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PERFORMANCE_START_GAUGE)(
- IN CONST VOID *Handle OPTIONAL,
- IN CONST CHAR8 *Token OPTIONAL,
- IN CONST CHAR8 *Module OPTIONAL,
- IN UINT64 TimeStamp
- );
-
-/**
- Searches the performance measurement log from the beginning of the log
- for the first matching record that contains a zero end time and fills in a valid end time.
-
- Searches the performance measurement log from the beginning of the log
- for the first record that matches Handle, Token, and Module, and has an end time value of zero.
- If the record can not be found then return EFI_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then the end time in the record is filled in with the value specified by TimeStamp.
- If the record is found and TimeStamp is zero, then the end time in the matching record
- is filled in with the current time stamp value.
-
- @param Handle The pointer to environment specific context used
- to identify the component being measured.
- @param Token The pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module The pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp The 64-bit time stamp.
-
- @retval EFI_SUCCESS The end of the measurement was recorded.
- @retval EFI_NOT_FOUND The specified measurement record could not be found.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PERFORMANCE_END_GAUGE)(
- IN CONST VOID *Handle OPTIONAL,
- IN CONST CHAR8 *Token OPTIONAL,
- IN CONST CHAR8 *Module OPTIONAL,
- IN UINT64 TimeStamp
- );
-
-/**
- Retrieves a previously logged performance measurement.
- It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,
- and then eliminate the Identifier.
-
- Retrieves the performance log entry from the performance log specified by LogEntryKey.
- If it stands for a valid entry, then EFI_SUCCESS is returned and
- GaugeDataEntry stores the pointer to that entry.
-
- @param LogEntryKey The key for the previous performance measurement log entry.
- If 0, then the first performance measurement log entry is retrieved.
- @param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.
-
- @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.
- @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
- @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PERFORMANCE_GET_GAUGE)(
- IN UINTN LogEntryKey,
- OUT GAUGE_DATA_ENTRY **GaugeDataEntry
- );
-
-/**
- Adds a record at the end of the performance measurement log
- that records the start time of a performance measurement.
-
- The added record contains the Handle, Token, Module and Identifier.
- The end time of the new record is not recorded, so it is set to zero.
- If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
- If TimeStamp is zero, the start time in the record is filled in with the value
- read from the current time stamp.
-
- @param Handle The pointer to environment specific context used
- to identify the component being measured.
- @param Token The pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module The pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp The 64-bit time stamp.
- @param Identifier 32-bit identifier. If the value is 0, the created record
- is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PERFORMANCE_START_GAUGE_EX)(
- IN CONST VOID *Handle OPTIONAL,
- IN CONST CHAR8 *Token OPTIONAL,
- IN CONST CHAR8 *Module OPTIONAL,
- IN UINT64 TimeStamp,
- IN UINT32 Identifier
- );
-
-/**
- Searches the performance measurement log from the beginning of the log
- for the first matching record that contains a zero end time and fills in a valid end time.
-
- Searches the performance measurement log from the beginning of the log
- for the first record that matches Handle, Token, Module and Identifier, and has an end time value of zero.
- If the record can not be found then return EFI_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then the end time in the record is filled in with the value specified by TimeStamp.
- If the record is found and TimeStamp is zero, then the end time in the matching record
- is filled in with the current time stamp value.
-
- @param Handle The pointer to environment specific context used
- to identify the component being measured.
- @param Token The pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module The pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp The 64-bit time stamp.
- @param Identifier 32-bit identifier. If the value is 0, the found record
- is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.
-
- @retval EFI_SUCCESS The end of the measurement was recorded.
- @retval EFI_NOT_FOUND The specified measurement record could not be found.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PERFORMANCE_END_GAUGE_EX)(
- IN CONST VOID *Handle OPTIONAL,
- IN CONST CHAR8 *Token OPTIONAL,
- IN CONST CHAR8 *Module OPTIONAL,
- IN UINT64 TimeStamp,
- IN UINT32 Identifier
- );
-
-/**
- Retrieves a previously logged performance measurement.
- It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,
- and then assign the Identifier with 0.
-
- Retrieves the performance log entry from the performance log specified by LogEntryKey.
- If it stands for a valid entry, then EFI_SUCCESS is returned and
- GaugeDataEntryEx stores the pointer to that entry.
-
- @param LogEntryKey The key for the previous performance measurement log entry.
- If 0, then the first performance measurement log entry is retrieved.
- @param GaugeDataEntryEx Out parameter for the indirect pointer to the extented gauge data entry specified by LogEntryKey.
-
- @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.
- @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
- @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntryEx is NULL.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PERFORMANCE_GET_GAUGE_EX)(
- IN UINTN LogEntryKey,
- OUT GAUGE_DATA_ENTRY_EX **GaugeDataEntryEx
- );
-
-struct _PERFORMANCE_PROTOCOL {
- PERFORMANCE_START_GAUGE StartGauge;
- PERFORMANCE_END_GAUGE EndGauge;
- PERFORMANCE_GET_GAUGE GetGauge;
-};
-
-struct _PERFORMANCE_EX_PROTOCOL {
- PERFORMANCE_START_GAUGE_EX StartGaugeEx;
- PERFORMANCE_END_GAUGE_EX EndGaugeEx;
- PERFORMANCE_GET_GAUGE_EX GetGaugeEx;
-};
-
-extern EFI_GUID gPerformanceProtocolGuid;
-extern EFI_GUID gSmmPerformanceProtocolGuid;
-extern EFI_GUID gPerformanceExProtocolGuid;
-extern EFI_GUID gSmmPerformanceExProtocolGuid;
-
-#endif
+/** @file + This file defines performance-related definitions, including the format of: + * performance GUID HOB. + * performance protocol interfaces. + * performance variables. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PERFORMANCE_DATA_H__ +#define __PERFORMANCE_DATA_H__ + +#define PERFORMANCE_PROPERTY_REVISION 0x1 + +typedef struct { + UINT32 Revision; + UINT32 Reserved; + UINT64 Frequency; + UINT64 TimerStartValue; + UINT64 TimerEndValue; +} PERFORMANCE_PROPERTY; + +// +// PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8. +// +#define PEI_PERFORMANCE_STRING_SIZE 8 +#define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1) + +typedef struct { + EFI_PHYSICAL_ADDRESS Handle; + CHAR8 Token[PEI_PERFORMANCE_STRING_SIZE]; ///< Measured token string name. + CHAR8 Module[PEI_PERFORMANCE_STRING_SIZE]; ///< Module string name. + UINT64 StartTimeStamp; ///< Start time point. + UINT64 EndTimeStamp; ///< End time point. +} PEI_PERFORMANCE_LOG_ENTRY; + +// +// The header must be aligned at 8 bytes. +// +typedef struct { + UINT32 NumberOfEntries; ///< The number of all performance log entries. + UINT32 Reserved; +} PEI_PERFORMANCE_LOG_HEADER; + +#define PERFORMANCE_PROTOCOL_GUID \ + { 0x76b6bdfa, 0x2acd, 0x4462, { 0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } } + +#define PERFORMANCE_EX_PROTOCOL_GUID \ + { 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1, 0x4a, 0x61, 0xce, 0x2f, 0xc0, 0x22 } } + +// +// Forward reference for pure ANSI compatibility +// +typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL; +typedef struct _PERFORMANCE_EX_PROTOCOL PERFORMANCE_EX_PROTOCOL; + +// +// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8. +// +#define DXE_PERFORMANCE_STRING_SIZE 32 +#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1) + +// +// The default guage entries number for DXE phase. +// +#define INIT_DXE_GAUGE_DATA_ENTRIES 800 + +typedef struct { + EFI_PHYSICAL_ADDRESS Handle; + CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name. + CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name. + UINT64 StartTimeStamp; ///< Start time point. + UINT64 EndTimeStamp; ///< End time point. +} GAUGE_DATA_ENTRY; + +typedef struct { + EFI_PHYSICAL_ADDRESS Handle; + CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name. + CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name. + UINT64 StartTimeStamp; ///< Start time point. + UINT64 EndTimeStamp; ///< End time point. + UINT32 Identifier; ///< Identifier. +} GAUGE_DATA_ENTRY_EX; + +// +// The header must be aligned at 8 bytes +// +typedef struct { + UINT32 NumberOfEntries; ///< The number of all performance gauge entries. + UINT32 Reserved; +} GAUGE_DATA_HEADER; + +// +// SMM Performance Protocol definitions +// + +#define SMM_PERFORMANCE_PROTOCOL_GUID \ + { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa, 0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } } + +#define SMM_PERFORMANCE_EX_PROTOCOL_GUID \ + { 0x931fc048, 0xc71d, 0x4455, { 0x89, 0x30, 0x47, 0x6, 0x30, 0xe3, 0xe, 0xe5 } } + +// +// SMM_PERFORMANCE_STRING_SIZE. +// +#define SMM_PERFORMANCE_STRING_SIZE 32 +#define SMM_PERFORMANCE_STRING_LENGTH (SMM_PERFORMANCE_STRING_SIZE - 1) + +// +// The default guage entries number for SMM phase. +// +#define INIT_SMM_GAUGE_DATA_ENTRIES 200 + +typedef struct { + UINTN Function; + EFI_STATUS ReturnStatus; + UINTN NumberOfEntries; + UINTN LogEntryKey; + GAUGE_DATA_ENTRY *GaugeData; +} SMM_PERF_COMMUNICATE; + +typedef struct { + UINTN Function; + EFI_STATUS ReturnStatus; + UINTN NumberOfEntries; + UINTN LogEntryKey; + GAUGE_DATA_ENTRY_EX *GaugeDataEx; +} SMM_PERF_COMMUNICATE_EX; + +#define SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER 1 +#define SMM_PERF_FUNCTION_GET_GAUGE_DATA 2 + +/** + Adds a record at the end of the performance measurement log + that records the start time of a performance measurement. + + The added record contains the Handle, Token, and Module. + The end time of the new record is not recorded, so it is set to zero. + If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record. + If TimeStamp is zero, the start time in the record is filled in with the value + read from the current time stamp. + + @param Handle The pointer to environment specific context used + to identify the component being measured. + @param Token The pointer to a Null-terminated ASCII string + that identifies the component being measured. + @param Module The pointer to a Null-terminated ASCII string + that identifies the module being measured. + @param TimeStamp The 64-bit time stamp. + + @retval EFI_SUCCESS The data was read correctly from the device. + @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement. + +**/ +typedef +EFI_STATUS +(EFIAPI *PERFORMANCE_START_GAUGE)( + IN CONST VOID *Handle OPTIONAL, + IN CONST CHAR8 *Token OPTIONAL, + IN CONST CHAR8 *Module OPTIONAL, + IN UINT64 TimeStamp + ); + +/** + Searches the performance measurement log from the beginning of the log + for the first matching record that contains a zero end time and fills in a valid end time. + + Searches the performance measurement log from the beginning of the log + for the first record that matches Handle, Token, and Module, and has an end time value of zero. + If the record can not be found then return EFI_NOT_FOUND. + If the record is found and TimeStamp is not zero, + then the end time in the record is filled in with the value specified by TimeStamp. + If the record is found and TimeStamp is zero, then the end time in the matching record + is filled in with the current time stamp value. + + @param Handle The pointer to environment specific context used + to identify the component being measured. + @param Token The pointer to a Null-terminated ASCII string + that identifies the component being measured. + @param Module The pointer to a Null-terminated ASCII string + that identifies the module being measured. + @param TimeStamp The 64-bit time stamp. + + @retval EFI_SUCCESS The end of the measurement was recorded. + @retval EFI_NOT_FOUND The specified measurement record could not be found. + +**/ +typedef +EFI_STATUS +(EFIAPI *PERFORMANCE_END_GAUGE)( + IN CONST VOID *Handle OPTIONAL, + IN CONST CHAR8 *Token OPTIONAL, + IN CONST CHAR8 *Module OPTIONAL, + IN UINT64 TimeStamp + ); + +/** + Retrieves a previously logged performance measurement. + It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL, + and then eliminate the Identifier. + + Retrieves the performance log entry from the performance log specified by LogEntryKey. + If it stands for a valid entry, then EFI_SUCCESS is returned and + GaugeDataEntry stores the pointer to that entry. + + @param LogEntryKey The key for the previous performance measurement log entry. + If 0, then the first performance measurement log entry is retrieved. + @param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey. + + @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey. + @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey. + @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *PERFORMANCE_GET_GAUGE)( + IN UINTN LogEntryKey, + OUT GAUGE_DATA_ENTRY **GaugeDataEntry + ); + +/** + Adds a record at the end of the performance measurement log + that records the start time of a performance measurement. + + The added record contains the Handle, Token, Module and Identifier. + The end time of the new record is not recorded, so it is set to zero. + If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record. + If TimeStamp is zero, the start time in the record is filled in with the value + read from the current time stamp. + + @param Handle The pointer to environment specific context used + to identify the component being measured. + @param Token The pointer to a Null-terminated ASCII string + that identifies the component being measured. + @param Module The pointer to a Null-terminated ASCII string + that identifies the module being measured. + @param TimeStamp The 64-bit time stamp. + @param Identifier 32-bit identifier. If the value is 0, the created record + is same as the one created by StartGauge of PERFORMANCE_PROTOCOL. + + @retval EFI_SUCCESS The data was read correctly from the device. + @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement. + +**/ +typedef +EFI_STATUS +(EFIAPI *PERFORMANCE_START_GAUGE_EX)( + IN CONST VOID *Handle OPTIONAL, + IN CONST CHAR8 *Token OPTIONAL, + IN CONST CHAR8 *Module OPTIONAL, + IN UINT64 TimeStamp, + IN UINT32 Identifier + ); + +/** + Searches the performance measurement log from the beginning of the log + for the first matching record that contains a zero end time and fills in a valid end time. + + Searches the performance measurement log from the beginning of the log + for the first record that matches Handle, Token, Module and Identifier, and has an end time value of zero. + If the record can not be found then return EFI_NOT_FOUND. + If the record is found and TimeStamp is not zero, + then the end time in the record is filled in with the value specified by TimeStamp. + If the record is found and TimeStamp is zero, then the end time in the matching record + is filled in with the current time stamp value. + + @param Handle The pointer to environment specific context used + to identify the component being measured. + @param Token The pointer to a Null-terminated ASCII string + that identifies the component being measured. + @param Module The pointer to a Null-terminated ASCII string + that identifies the module being measured. + @param TimeStamp The 64-bit time stamp. + @param Identifier 32-bit identifier. If the value is 0, the found record + is same as the one found by EndGauge of PERFORMANCE_PROTOCOL. + + @retval EFI_SUCCESS The end of the measurement was recorded. + @retval EFI_NOT_FOUND The specified measurement record could not be found. + +**/ +typedef +EFI_STATUS +(EFIAPI *PERFORMANCE_END_GAUGE_EX)( + IN CONST VOID *Handle OPTIONAL, + IN CONST CHAR8 *Token OPTIONAL, + IN CONST CHAR8 *Module OPTIONAL, + IN UINT64 TimeStamp, + IN UINT32 Identifier + ); + +/** + Retrieves a previously logged performance measurement. + It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL, + and then assign the Identifier with 0. + + Retrieves the performance log entry from the performance log specified by LogEntryKey. + If it stands for a valid entry, then EFI_SUCCESS is returned and + GaugeDataEntryEx stores the pointer to that entry. + + @param LogEntryKey The key for the previous performance measurement log entry. + If 0, then the first performance measurement log entry is retrieved. + @param GaugeDataEntryEx Out parameter for the indirect pointer to the extented gauge data entry specified by LogEntryKey. + + @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey. + @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey. + @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntryEx is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *PERFORMANCE_GET_GAUGE_EX)( + IN UINTN LogEntryKey, + OUT GAUGE_DATA_ENTRY_EX **GaugeDataEntryEx + ); + +struct _PERFORMANCE_PROTOCOL { + PERFORMANCE_START_GAUGE StartGauge; + PERFORMANCE_END_GAUGE EndGauge; + PERFORMANCE_GET_GAUGE GetGauge; +}; + +struct _PERFORMANCE_EX_PROTOCOL { + PERFORMANCE_START_GAUGE_EX StartGaugeEx; + PERFORMANCE_END_GAUGE_EX EndGaugeEx; + PERFORMANCE_GET_GAUGE_EX GetGaugeEx; +}; + +extern EFI_GUID gPerformanceProtocolGuid; +extern EFI_GUID gSmmPerformanceProtocolGuid; +extern EFI_GUID gPerformanceExProtocolGuid; +extern EFI_GUID gSmmPerformanceExProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/PerformanceMeasurement.h b/MdeModulePkg/Include/Guid/PerformanceMeasurement.h index ddee8bfe5b..83a069dd75 100644 --- a/MdeModulePkg/Include/Guid/PerformanceMeasurement.h +++ b/MdeModulePkg/Include/Guid/PerformanceMeasurement.h @@ -1,72 +1,72 @@ -/** @file
-
-Performance measurement protocol, allows logging performance data.
-
-Copyright (c) 2017, Microsoft Corporation<BR>
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PERFORMANCE_MEASUREMENT_H_
-#define _PERFORMANCE_MEASUREMENT_H_
-
-//
-// GUID for Performance measurement Protocol
-//
-#define PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \
- { 0xc85d06be, 0x5f75, 0x48ce, {0xa8, 0x0f, 0x12, 0x36, 0xba, 0x3b, 0x87, 0xb1 } }
-
-#define SMM_PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \
- { 0xd56b6d73, 0x1a7b, 0x4015, {0x9b, 0xb4, 0x7b, 0x07, 0x17, 0x29, 0xed, 0x24 } }
-
-typedef struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL;
-
-typedef enum {
- PerfStartEntry, // used in StartPerformanceMeasurement()/StartPerformanceMeasurementEx()
- // (map to PERF_START/PERF_START_EX)
- PerfEndEntry, // used in EndPerformanceMeasurement()/EndPerformanceMeasurementEx()
- // (map to PERF_END/PERF_END_EX)
- PerfEntry // used in LogPerformanceMeasurement()
- // (map to other Perf macros except above 4 macros)
-} PERF_MEASUREMENT_ATTRIBUTE;
-
-/**
- Create performance record with event description and a timestamp.
-
- @param CallerIdentifier - Image handle or pointer to caller ID GUID.
- @param Guid - Pointer to a GUID.
- @param String - Pointer to a string describing the measurement.
- @param TimeStamp - 64-bit time stamp.
- @param Address - Pointer to a location in memory relevant to the measurement.
- @param Identifier - Performance identifier describing the type of measurement.
- @param Attribute - The attribute of the measurement. According to attribute can create a start
- record for PERF_START/PERF_START_EX, or a end record for PERF_END/PERF_END_EX,
- or a general record for other Perf macros.
-
- @retval EFI_SUCCESS - Successfully created performance record.
- @retval EFI_OUT_OF_RESOURCES - Ran out of space to store the records.
- @retval EFI_INVALID_PARAMETER - Invalid parameter passed to function - NULL
- pointer or invalid PerfId.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *CREATE_PERFORMANCE_MEASUREMENT)(
- IN CONST VOID *CallerIdentifier OPTIONAL,
- IN CONST VOID *Guid OPTIONAL,
- IN CONST CHAR8 *String OPTIONAL,
- IN UINT64 TimeStamp OPTIONAL,
- IN UINT64 Address OPTIONAL,
- IN UINT32 Identifier,
- IN PERF_MEASUREMENT_ATTRIBUTE Attribute
- );
-
-struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL {
- CREATE_PERFORMANCE_MEASUREMENT CreatePerformanceMeasurement;
-};
-
-extern EFI_GUID gEdkiiPerformanceMeasurementProtocolGuid;
-extern EFI_GUID gEdkiiSmmPerformanceMeasurementProtocolGuid;
-
-#endif // _PERFORMANCE_MEASUREMENT_H_
+/** @file + +Performance measurement protocol, allows logging performance data. + +Copyright (c) 2017, Microsoft Corporation<BR> +Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PERFORMANCE_MEASUREMENT_H_ +#define _PERFORMANCE_MEASUREMENT_H_ + +// +// GUID for Performance measurement Protocol +// +#define PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \ + { 0xc85d06be, 0x5f75, 0x48ce, {0xa8, 0x0f, 0x12, 0x36, 0xba, 0x3b, 0x87, 0xb1 } } + +#define SMM_PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \ + { 0xd56b6d73, 0x1a7b, 0x4015, {0x9b, 0xb4, 0x7b, 0x07, 0x17, 0x29, 0xed, 0x24 } } + +typedef struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL; + +typedef enum { + PerfStartEntry, // used in StartPerformanceMeasurement()/StartPerformanceMeasurementEx() + // (map to PERF_START/PERF_START_EX) + PerfEndEntry, // used in EndPerformanceMeasurement()/EndPerformanceMeasurementEx() + // (map to PERF_END/PERF_END_EX) + PerfEntry // used in LogPerformanceMeasurement() + // (map to other Perf macros except above 4 macros) +} PERF_MEASUREMENT_ATTRIBUTE; + +/** + Create performance record with event description and a timestamp. + + @param CallerIdentifier - Image handle or pointer to caller ID GUID. + @param Guid - Pointer to a GUID. + @param String - Pointer to a string describing the measurement. + @param TimeStamp - 64-bit time stamp. + @param Address - Pointer to a location in memory relevant to the measurement. + @param Identifier - Performance identifier describing the type of measurement. + @param Attribute - The attribute of the measurement. According to attribute can create a start + record for PERF_START/PERF_START_EX, or a end record for PERF_END/PERF_END_EX, + or a general record for other Perf macros. + + @retval EFI_SUCCESS - Successfully created performance record. + @retval EFI_OUT_OF_RESOURCES - Ran out of space to store the records. + @retval EFI_INVALID_PARAMETER - Invalid parameter passed to function - NULL + pointer or invalid PerfId. + +**/ +typedef +EFI_STATUS +(EFIAPI *CREATE_PERFORMANCE_MEASUREMENT)( + IN CONST VOID *CallerIdentifier OPTIONAL, + IN CONST VOID *Guid OPTIONAL, + IN CONST CHAR8 *String OPTIONAL, + IN UINT64 TimeStamp OPTIONAL, + IN UINT64 Address OPTIONAL, + IN UINT32 Identifier, + IN PERF_MEASUREMENT_ATTRIBUTE Attribute + ); + +struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL { + CREATE_PERFORMANCE_MEASUREMENT CreatePerformanceMeasurement; +}; + +extern EFI_GUID gEdkiiPerformanceMeasurementProtocolGuid; +extern EFI_GUID gEdkiiSmmPerformanceMeasurementProtocolGuid; + +#endif // _PERFORMANCE_MEASUREMENT_H_ diff --git a/MdeModulePkg/Include/Guid/PiSmmCommunicationRegionTable.h b/MdeModulePkg/Include/Guid/PiSmmCommunicationRegionTable.h index 93fa39771f..c001f583c4 100644 --- a/MdeModulePkg/Include/Guid/PiSmmCommunicationRegionTable.h +++ b/MdeModulePkg/Include/Guid/PiSmmCommunicationRegionTable.h @@ -1,57 +1,57 @@ -/** @file
-
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PI_SMM_COMMUNICATION_REGION_TABLE_H_
-#define _PI_SMM_COMMUNICATION_REGION_TABLE_H_
-
-#define EDKII_PI_SMM_COMMUNICATION_REGION_TABLE_GUID {\
- 0x4e28ca50, 0xd582, 0x44ac, {0xa1, 0x1f, 0xe3, 0xd5, 0x65, 0x26, 0xdb, 0x34} \
-}
-
-//
-// This table to declare the generic SMM communication buffer location.
-// If this table is present, it means the SMM communication buffer is restricted to
-// EfiReservedMemoryType, EfiACPIMemoryNVS, or EfiRuntimeServicesData.
-//
-// This table is installed to UEFI configuration table by generic driver
-// or platform driver, at early DXE phase.
-//
-// The EFI_MEMORY_DESCRIPTOR entry must contain at least one entry.
-// The entries must be normal memory region in EfiReservedMemoryType, EfiACPIMemoryNVS,
-// or EfiRuntimeServicesData.
-// If the Entry.Type is EfiConventionalMemory, it means this entry is free to use.
-// If the Entry.Type is other, it means this entry is occupied.
-//
-// Any non-SMM component may put communication data there, then use
-// UEFI defined SMM Communication ACPI Table, or PI defined EFI_SMM_COMMUNICATION_PROTOCOL
-// to communicate with SMI handler. The process is:
-// 1) Find an entry whose type is EfiConventional.
-// 2) Change type to be EfiReservedMemoryType before use.
-// 3) Use it.
-// 4) Restore type be EfiConventional.
-// The step 2) must be performed as an atomic transaction, if there might be conflict during runtime.
-// For example, on IA-32/x64 platforms, this can be done using the CMPXCHG CPU instruction.
-// If there is guarantee on no conflict during boot time, these steps can be skipped.
-// For example, DXE, UEFI driver and UEFI application runs in sequence.
-//
-// For example, FPDT driver can use this communication buffer to get SMM
-// performance data in SMM. Profile driver can use this communication buffer
-// to get SMM profile data in SMM.
-//
-typedef struct {
- UINT32 Version;
- UINT32 NumberOfEntries;
- UINT32 DescriptorSize;
- UINT32 Reserved;
- // EFI_MEMORY_DESCRIPTOR Entry[1];
-} EDKII_PI_SMM_COMMUNICATION_REGION_TABLE;
-
-#define EDKII_PI_SMM_COMMUNICATION_REGION_TABLE_VERSION 0x00000001
-
-extern EFI_GUID gEdkiiPiSmmCommunicationRegionTableGuid;
-
-#endif
+/** @file + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PI_SMM_COMMUNICATION_REGION_TABLE_H_ +#define _PI_SMM_COMMUNICATION_REGION_TABLE_H_ + +#define EDKII_PI_SMM_COMMUNICATION_REGION_TABLE_GUID {\ + 0x4e28ca50, 0xd582, 0x44ac, {0xa1, 0x1f, 0xe3, 0xd5, 0x65, 0x26, 0xdb, 0x34} \ +} + +// +// This table to declare the generic SMM communication buffer location. +// If this table is present, it means the SMM communication buffer is restricted to +// EfiReservedMemoryType, EfiACPIMemoryNVS, or EfiRuntimeServicesData. +// +// This table is installed to UEFI configuration table by generic driver +// or platform driver, at early DXE phase. +// +// The EFI_MEMORY_DESCRIPTOR entry must contain at least one entry. +// The entries must be normal memory region in EfiReservedMemoryType, EfiACPIMemoryNVS, +// or EfiRuntimeServicesData. +// If the Entry.Type is EfiConventionalMemory, it means this entry is free to use. +// If the Entry.Type is other, it means this entry is occupied. +// +// Any non-SMM component may put communication data there, then use +// UEFI defined SMM Communication ACPI Table, or PI defined EFI_SMM_COMMUNICATION_PROTOCOL +// to communicate with SMI handler. The process is: +// 1) Find an entry whose type is EfiConventional. +// 2) Change type to be EfiReservedMemoryType before use. +// 3) Use it. +// 4) Restore type be EfiConventional. +// The step 2) must be performed as an atomic transaction, if there might be conflict during runtime. +// For example, on IA-32/x64 platforms, this can be done using the CMPXCHG CPU instruction. +// If there is guarantee on no conflict during boot time, these steps can be skipped. +// For example, DXE, UEFI driver and UEFI application runs in sequence. +// +// For example, FPDT driver can use this communication buffer to get SMM +// performance data in SMM. Profile driver can use this communication buffer +// to get SMM profile data in SMM. +// +typedef struct { + UINT32 Version; + UINT32 NumberOfEntries; + UINT32 DescriptorSize; + UINT32 Reserved; + // EFI_MEMORY_DESCRIPTOR Entry[1]; +} EDKII_PI_SMM_COMMUNICATION_REGION_TABLE; + +#define EDKII_PI_SMM_COMMUNICATION_REGION_TABLE_VERSION 0x00000001 + +extern EFI_GUID gEdkiiPiSmmCommunicationRegionTableGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/PiSmmMemoryAttributesTable.h b/MdeModulePkg/Include/Guid/PiSmmMemoryAttributesTable.h index 88f67232bd..8303126ca1 100644 --- a/MdeModulePkg/Include/Guid/PiSmmMemoryAttributesTable.h +++ b/MdeModulePkg/Include/Guid/PiSmmMemoryAttributesTable.h @@ -1,45 +1,45 @@ -/** @file
- Define the GUID of the EDKII PI SMM memory attribute table, which
- is published by PI SMM Core.
-
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PI_SMM_MEMORY_ATTRIBUTES_TABLE_H_
-#define _PI_SMM_MEMORY_ATTRIBUTES_TABLE_H_
-
-#define EDKII_PI_SMM_MEMORY_ATTRIBUTES_TABLE_GUID {\
- 0x6b9fd3f7, 0x16df, 0x45e8, {0xbd, 0x39, 0xb9, 0x4a, 0x66, 0x54, 0x1a, 0x5d} \
-}
-
-//
-// The PI SMM memory attribute table contains the SMM memory map for SMM image.
-//
-// This table is installed to SMST as SMM configuration table.
-//
-// This table is published at gEfiSmmEndOfDxeProtocolGuid notification, because
-// there should be no more SMM driver loaded after that. The EfiRuntimeServicesCode
-// region should not be changed any more.
-//
-// This table is published, if and only if all SMM PE/COFF have aligned section
-// as specified in UEFI specification Section 2.3. For example, IA32/X64 alignment is 4KiB.
-//
-// If this table is published, the EfiRuntimeServicesCode contains code only
-// and it is EFI_MEMORY_RO; the EfiRuntimeServicesData contains data only
-// and it is EFI_MEMORY_XP.
-//
-typedef struct {
- UINT32 Version;
- UINT32 NumberOfEntries;
- UINT32 DescriptorSize;
- UINT32 Reserved;
- // EFI_MEMORY_DESCRIPTOR Entry[1];
-} EDKII_PI_SMM_MEMORY_ATTRIBUTES_TABLE;
-
-#define EDKII_PI_SMM_MEMORY_ATTRIBUTES_TABLE_VERSION 0x00000001
-
-extern EFI_GUID gEdkiiPiSmmMemoryAttributesTableGuid;
-
-#endif
+/** @file + Define the GUID of the EDKII PI SMM memory attribute table, which + is published by PI SMM Core. + +Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PI_SMM_MEMORY_ATTRIBUTES_TABLE_H_ +#define _PI_SMM_MEMORY_ATTRIBUTES_TABLE_H_ + +#define EDKII_PI_SMM_MEMORY_ATTRIBUTES_TABLE_GUID {\ + 0x6b9fd3f7, 0x16df, 0x45e8, {0xbd, 0x39, 0xb9, 0x4a, 0x66, 0x54, 0x1a, 0x5d} \ +} + +// +// The PI SMM memory attribute table contains the SMM memory map for SMM image. +// +// This table is installed to SMST as SMM configuration table. +// +// This table is published at gEfiSmmEndOfDxeProtocolGuid notification, because +// there should be no more SMM driver loaded after that. The EfiRuntimeServicesCode +// region should not be changed any more. +// +// This table is published, if and only if all SMM PE/COFF have aligned section +// as specified in UEFI specification Section 2.3. For example, IA32/X64 alignment is 4KiB. +// +// If this table is published, the EfiRuntimeServicesCode contains code only +// and it is EFI_MEMORY_RO; the EfiRuntimeServicesData contains data only +// and it is EFI_MEMORY_XP. +// +typedef struct { + UINT32 Version; + UINT32 NumberOfEntries; + UINT32 DescriptorSize; + UINT32 Reserved; + // EFI_MEMORY_DESCRIPTOR Entry[1]; +} EDKII_PI_SMM_MEMORY_ATTRIBUTES_TABLE; + +#define EDKII_PI_SMM_MEMORY_ATTRIBUTES_TABLE_VERSION 0x00000001 + +extern EFI_GUID gEdkiiPiSmmMemoryAttributesTableGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/PlatDriOverrideHii.h b/MdeModulePkg/Include/Guid/PlatDriOverrideHii.h index 811160433a..0c24c88dcc 100644 --- a/MdeModulePkg/Include/Guid/PlatDriOverrideHii.h +++ b/MdeModulePkg/Include/Guid/PlatDriOverrideHii.h @@ -1,19 +1,19 @@ -/** @file
- GUIDs used as HII FormSet and HII Package list GUID in PlatDriOverride driver.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PLATFORM_DRIVER_OVERRIDE_HII_GUID_H__
-#define __PLATFORM_DRIVER_OVERRIDE_HII_GUID_H__
-
-#define PLAT_OVER_MNGR_GUID \
- { \
- 0x8614567d, 0x35be, 0x4415, {0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0} \
- }
-
-extern EFI_GUID gPlatformOverridesManagerGuid;
-
-#endif
+/** @file + GUIDs used as HII FormSet and HII Package list GUID in PlatDriOverride driver. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLATFORM_DRIVER_OVERRIDE_HII_GUID_H__ +#define __PLATFORM_DRIVER_OVERRIDE_HII_GUID_H__ + +#define PLAT_OVER_MNGR_GUID \ + { \ + 0x8614567d, 0x35be, 0x4415, {0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0} \ + } + +extern EFI_GUID gPlatformOverridesManagerGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/PlatformHasAcpi.h b/MdeModulePkg/Include/Guid/PlatformHasAcpi.h index d54fad77c0..d690839cba 100644 --- a/MdeModulePkg/Include/Guid/PlatformHasAcpi.h +++ b/MdeModulePkg/Include/Guid/PlatformHasAcpi.h @@ -1,28 +1,28 @@ -/** @file
- EDKII Platform Has ACPI GUID
-
- A NULL protocol instance with this GUID in the DXE protocol database, and/or
- a NULL PPI with this GUID in the PPI database, implies that the platform
- provides the operating system with an ACPI-based hardware description. Note
- that this is not necessarily exclusive with different kinds of hardware
- description (for example, a Device Tree-based one). A platform driver and/or
- PEIM is supposed to produce a single instance of the protocol and/or PPI
- (with NULL contents), if appropriate.
-
- Copyright (C) 2017, Red Hat, Inc.
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef __EDKII_PLATFORM_HAS_ACPI_H__
-#define __EDKII_PLATFORM_HAS_ACPI_H__
-
-#define EDKII_PLATFORM_HAS_ACPI_GUID \
- { \
- 0xf0966b41, 0xc23f, 0x41b9, \
- { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } \
- }
-
-extern EFI_GUID gEdkiiPlatformHasAcpiGuid;
-
-#endif
+/** @file + EDKII Platform Has ACPI GUID + + A NULL protocol instance with this GUID in the DXE protocol database, and/or + a NULL PPI with this GUID in the PPI database, implies that the platform + provides the operating system with an ACPI-based hardware description. Note + that this is not necessarily exclusive with different kinds of hardware + description (for example, a Device Tree-based one). A platform driver and/or + PEIM is supposed to produce a single instance of the protocol and/or PPI + (with NULL contents), if appropriate. + + Copyright (C) 2017, Red Hat, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef __EDKII_PLATFORM_HAS_ACPI_H__ +#define __EDKII_PLATFORM_HAS_ACPI_H__ + +#define EDKII_PLATFORM_HAS_ACPI_GUID \ + { \ + 0xf0966b41, 0xc23f, 0x41b9, \ + { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } \ + } + +extern EFI_GUID gEdkiiPlatformHasAcpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/RamDiskHii.h b/MdeModulePkg/Include/Guid/RamDiskHii.h index 3c8dfadf6b..1176ddcb1f 100644 --- a/MdeModulePkg/Include/Guid/RamDiskHii.h +++ b/MdeModulePkg/Include/Guid/RamDiskHii.h @@ -1,19 +1,19 @@ -/** @file
- GUIDs used as HII FormSet and HII Package list GUID in RamDiskDxe driver.
-
- Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __RAM_DISK_HII_GUID_H__
-#define __RAM_DISK_HII_GUID_H__
-
-#define RAM_DISK_FORM_SET_GUID \
- { \
- 0x2a46715f, 0x3581, 0x4a55, {0x8e, 0x73, 0x2b, 0x76, 0x9a, 0xaa, 0x30, 0xc5} \
- }
-
-extern EFI_GUID gRamDiskFormSetGuid;
-
-#endif
+/** @file + GUIDs used as HII FormSet and HII Package list GUID in RamDiskDxe driver. + + Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __RAM_DISK_HII_GUID_H__ +#define __RAM_DISK_HII_GUID_H__ + +#define RAM_DISK_FORM_SET_GUID \ + { \ + 0x2a46715f, 0x3581, 0x4a55, {0x8e, 0x73, 0x2b, 0x76, 0x9a, 0xaa, 0x30, 0xc5} \ + } + +extern EFI_GUID gRamDiskFormSetGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/RecoveryDevice.h b/MdeModulePkg/Include/Guid/RecoveryDevice.h index c920ce04a3..f6211ee160 100644 --- a/MdeModulePkg/Include/Guid/RecoveryDevice.h +++ b/MdeModulePkg/Include/Guid/RecoveryDevice.h @@ -1,62 +1,62 @@ -/** @file
- Defines Name GUIDs to represent a Recovery Capsule loaded from a recovery device.
-
- These are contracts between the recovery module and device recovery module
- that convey the name of a given recovery module type.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _RECOVERY_DEVICE_H_
-#define _RECOVERY_DEVICE_H_
-
-///
-/// The Global ID used to identify a recovery capsule that was loaded from a CD/DVD device.
-///
-#define RECOVERY_ON_DATA_CD_GUID \
- { \
- 0x5cac0099, 0x0dc9, 0x48e5, {0x80, 0x68, 0xbb, 0x95, 0xf5, 0x40, 0x0a, 0x9f } \
- }
-
-///
-/// The Global ID used to identify a recovery capsule that was loaded from floppy device.
-///
-#define RECOVERY_ON_FAT_FLOPPY_DISK_GUID \
- { \
- 0x2e3d2e75, 0x9b2e, 0x412d, {0xb4, 0xb1, 0x70, 0x41, 0x6b, 0x87, 0x0, 0xff } \
- }
-
-///
-/// The Global ID used to identify a recovery capsule that was loaded from IDE hard drive.
-///
-#define RECOVERY_ON_FAT_IDE_DISK_GUID \
- { \
- 0xb38573b6, 0x6200, 0x4ac5, {0xb5, 0x1d, 0x82, 0xe6, 0x59, 0x38, 0xd7, 0x83 } \
- }
-
-///
-/// The Global ID used to identify a recovery capsule that was loaded from USB BOT device.
-///
-#define RECOVERY_ON_FAT_USB_DISK_GUID \
- { \
- 0x0ffbce19, 0x324c, 0x4690, {0xa0, 0x09, 0x98, 0xc6, 0xae, 0x2e, 0xb1, 0x86 } \
- }
-
-///
-/// The Global ID used to identify a recovery capsule that was loaded from NVM Express device.
-///
-#define RECOVERY_ON_FAT_NVME_DISK_GUID \
- { \
- 0xc770a27f, 0x956a, 0x497a, {0x85, 0x48, 0xe0, 0x61, 0x97, 0x58, 0x8b, 0xf6 } \
- }
-
-extern EFI_GUID gRecoveryOnDataCdGuid;
-extern EFI_GUID gRecoveryOnFatFloppyDiskGuid;
-extern EFI_GUID gRecoveryOnFatIdeDiskGuid;
-extern EFI_GUID gRecoveryOnFatUsbDiskGuid;
-extern EFI_GUID gRecoveryOnFatNvmeDiskGuid;
-
-#endif
+/** @file + Defines Name GUIDs to represent a Recovery Capsule loaded from a recovery device. + + These are contracts between the recovery module and device recovery module + that convey the name of a given recovery module type. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _RECOVERY_DEVICE_H_ +#define _RECOVERY_DEVICE_H_ + +/// +/// The Global ID used to identify a recovery capsule that was loaded from a CD/DVD device. +/// +#define RECOVERY_ON_DATA_CD_GUID \ + { \ + 0x5cac0099, 0x0dc9, 0x48e5, {0x80, 0x68, 0xbb, 0x95, 0xf5, 0x40, 0x0a, 0x9f } \ + } + +/// +/// The Global ID used to identify a recovery capsule that was loaded from floppy device. +/// +#define RECOVERY_ON_FAT_FLOPPY_DISK_GUID \ + { \ + 0x2e3d2e75, 0x9b2e, 0x412d, {0xb4, 0xb1, 0x70, 0x41, 0x6b, 0x87, 0x0, 0xff } \ + } + +/// +/// The Global ID used to identify a recovery capsule that was loaded from IDE hard drive. +/// +#define RECOVERY_ON_FAT_IDE_DISK_GUID \ + { \ + 0xb38573b6, 0x6200, 0x4ac5, {0xb5, 0x1d, 0x82, 0xe6, 0x59, 0x38, 0xd7, 0x83 } \ + } + +/// +/// The Global ID used to identify a recovery capsule that was loaded from USB BOT device. +/// +#define RECOVERY_ON_FAT_USB_DISK_GUID \ + { \ + 0x0ffbce19, 0x324c, 0x4690, {0xa0, 0x09, 0x98, 0xc6, 0xae, 0x2e, 0xb1, 0x86 } \ + } + +/// +/// The Global ID used to identify a recovery capsule that was loaded from NVM Express device. +/// +#define RECOVERY_ON_FAT_NVME_DISK_GUID \ + { \ + 0xc770a27f, 0x956a, 0x497a, {0x85, 0x48, 0xe0, 0x61, 0x97, 0x58, 0x8b, 0xf6 } \ + } + +extern EFI_GUID gRecoveryOnDataCdGuid; +extern EFI_GUID gRecoveryOnFatFloppyDiskGuid; +extern EFI_GUID gRecoveryOnFatIdeDiskGuid; +extern EFI_GUID gRecoveryOnFatUsbDiskGuid; +extern EFI_GUID gRecoveryOnFatNvmeDiskGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/RngAlgorithm.h b/MdeModulePkg/Include/Guid/RngAlgorithm.h index e2ac2ba3e5..c3121f873b 100644 --- a/MdeModulePkg/Include/Guid/RngAlgorithm.h +++ b/MdeModulePkg/Include/Guid/RngAlgorithm.h @@ -1,23 +1,23 @@ -/** @file
- Rng Algorithm
-
- Copyright (c) 2023, Arm Limited. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef RNG_ALGORITHM_GUID_H_
-#define RNG_ALGORITHM_GUID_H_
-
-///
-/// The implementation of a Random Number Generator might be unsafe, when using
-/// a dummy implementation for instance. Allow identifying such implementation
-/// with this GUID.
-///
-#define EDKII_RNG_ALGORITHM_UNSAFE \
- { \
- 0x869f728c, 0x409d, 0x4ab4, {0xac, 0x03, 0x71, 0xd3, 0x09, 0xc1, 0xb3, 0xf4 } \
- }
-
-extern EFI_GUID gEdkiiRngAlgorithmUnSafe;
-
-#endif // #ifndef RNG_ALGORITHM_GUID_H_
+/** @file + Rng Algorithm + + Copyright (c) 2023, Arm Limited. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef RNG_ALGORITHM_GUID_H_ +#define RNG_ALGORITHM_GUID_H_ + +/// +/// The implementation of a Random Number Generator might be unsafe, when using +/// a dummy implementation for instance. Allow identifying such implementation +/// with this GUID. +/// +#define EDKII_RNG_ALGORITHM_UNSAFE \ + { \ + 0x869f728c, 0x409d, 0x4ab4, {0xac, 0x03, 0x71, 0xd3, 0x09, 0xc1, 0xb3, 0xf4 } \ + } + +extern EFI_GUID gEdkiiRngAlgorithmUnSafe; + +#endif // #ifndef RNG_ALGORITHM_GUID_H_ diff --git a/MdeModulePkg/Include/Guid/S3SmmInitDone.h b/MdeModulePkg/Include/Guid/S3SmmInitDone.h index 7deea2b968..88c40e4367 100644 --- a/MdeModulePkg/Include/Guid/S3SmmInitDone.h +++ b/MdeModulePkg/Include/Guid/S3SmmInitDone.h @@ -1,21 +1,21 @@ -/** @file
- After S3 SMM initialization is done and before S3 boot script is executed,
- this GUID is installed as PPI in PEI and protocol in SMM environment.
- It allows for PEIMs or SMM drivers to hook this point and do the required tasks.
-
- Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __S3_SMM_INIT_DONE_H__
-#define __S3_SMM_INIT_DONE_H__
-
-#define EDKII_S3_SMM_INIT_DONE_GUID \
- { \
- 0x8f9d4825, 0x797d, 0x48fc, { 0x84, 0x71, 0x84, 0x50, 0x25, 0x79, 0x2e, 0xf6 } \
- }
-
-extern EFI_GUID gEdkiiS3SmmInitDoneGuid;
-
-#endif
+/** @file + After S3 SMM initialization is done and before S3 boot script is executed, + this GUID is installed as PPI in PEI and protocol in SMM environment. + It allows for PEIMs or SMM drivers to hook this point and do the required tasks. + + Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __S3_SMM_INIT_DONE_H__ +#define __S3_SMM_INIT_DONE_H__ + +#define EDKII_S3_SMM_INIT_DONE_GUID \ + { \ + 0x8f9d4825, 0x797d, 0x48fc, { 0x84, 0x71, 0x84, 0x50, 0x25, 0x79, 0x2e, 0xf6 } \ + } + +extern EFI_GUID gEdkiiS3SmmInitDoneGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/S3StorageDeviceInitList.h b/MdeModulePkg/Include/Guid/S3StorageDeviceInitList.h index 5cc545de90..b2e85eb1cc 100644 --- a/MdeModulePkg/Include/Guid/S3StorageDeviceInitList.h +++ b/MdeModulePkg/Include/Guid/S3StorageDeviceInitList.h @@ -1,57 +1,57 @@ -/** @file
- Define the LockBox GUID for list of storage devices need to be initialized in
- S3.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __S3_STORAGE_DEVICE_INIT_LIST_H__
-#define __S3_STORAGE_DEVICE_INIT_LIST_H__
-
-#define S3_STORAGE_DEVICE_INIT_LIST \
- { \
- 0x310e9b8c, 0xcf90, 0x421e, { 0x8e, 0x9b, 0x9e, 0xef, 0xb6, 0x17, 0xc8, 0xef } \
- }
-
-//
-// The LockBox will store a DevicePath structure that contains one or more
-// DevicePath instances. Each instance denotes a storage device that needs to
-// get initialized during the S3 resume.
-//
-// For example, if there is only one storage device stored in the list, the
-// content of this LockBox will be:
-//
-// +-------------------------------------------------------+
-// | DevPath Instance #1 |
-// | (Terminated by an End of Hardware Device Path node |
-// | with an End Entire Device Path sub-type) |
-// +-------------------------------------------------------+
-//
-// If there are n (n > 1) storage devices in the list, the content of this
-// LockBox will be:
-//
-// +-------------------------------------------------------+
-// | DevPath Instance #1 |
-// | (Terminated by an End of Hardware Device Path node |
-// | with an End This Instance of a Device Path sub-type) |
-// +-------------------------------------------------------+
-// | DevPath Instance #2 |
-// | (Terminated by an End of Hardware Device Path node |
-// | with an End This Instance of a Device Path sub-type) |
-// +-------------------------------------------------------+
-// | ... |
-// +-------------------------------------------------------+
-// | DevPath Instance #n |
-// | (Terminated by an End of Hardware Device Path node |
-// | with an End Entire Device Path sub-type) |
-// +-------------------------------------------------------+
-//
-// The attribute of the LockBox should be set to
-// 'LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY'.
-//
-extern EFI_GUID gS3StorageDeviceInitListGuid;
-
-#endif // __S3_STORAGE_DEVICE_INIT_LIST_H__
+/** @file + Define the LockBox GUID for list of storage devices need to be initialized in + S3. + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __S3_STORAGE_DEVICE_INIT_LIST_H__ +#define __S3_STORAGE_DEVICE_INIT_LIST_H__ + +#define S3_STORAGE_DEVICE_INIT_LIST \ + { \ + 0x310e9b8c, 0xcf90, 0x421e, { 0x8e, 0x9b, 0x9e, 0xef, 0xb6, 0x17, 0xc8, 0xef } \ + } + +// +// The LockBox will store a DevicePath structure that contains one or more +// DevicePath instances. Each instance denotes a storage device that needs to +// get initialized during the S3 resume. +// +// For example, if there is only one storage device stored in the list, the +// content of this LockBox will be: +// +// +-------------------------------------------------------+ +// | DevPath Instance #1 | +// | (Terminated by an End of Hardware Device Path node | +// | with an End Entire Device Path sub-type) | +// +-------------------------------------------------------+ +// +// If there are n (n > 1) storage devices in the list, the content of this +// LockBox will be: +// +// +-------------------------------------------------------+ +// | DevPath Instance #1 | +// | (Terminated by an End of Hardware Device Path node | +// | with an End This Instance of a Device Path sub-type) | +// +-------------------------------------------------------+ +// | DevPath Instance #2 | +// | (Terminated by an End of Hardware Device Path node | +// | with an End This Instance of a Device Path sub-type) | +// +-------------------------------------------------------+ +// | ... | +// +-------------------------------------------------------+ +// | DevPath Instance #n | +// | (Terminated by an End of Hardware Device Path node | +// | with an End Entire Device Path sub-type) | +// +-------------------------------------------------------+ +// +// The attribute of the LockBox should be set to +// 'LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY'. +// +extern EFI_GUID gS3StorageDeviceInitListGuid; + +#endif // __S3_STORAGE_DEVICE_INIT_LIST_H__ diff --git a/MdeModulePkg/Include/Guid/SerialPortLibVendor.h b/MdeModulePkg/Include/Guid/SerialPortLibVendor.h index 6cb8e003c6..2b319e69cb 100644 --- a/MdeModulePkg/Include/Guid/SerialPortLibVendor.h +++ b/MdeModulePkg/Include/Guid/SerialPortLibVendor.h @@ -1,19 +1,19 @@ -/** @file
- Define the SerialDxe GUID.
-
- Copyright (c) 2019, Citrix Systems, Inc.
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef __SERIAL_PORT_LIB_VENDOR_H__
-#define __SERIAL_PORT_LIB_VENDOR_H__
-
-#define EDKII_SERIAL_PORT_LIB_VENDOR_GUID {\
- 0xD3987D4B, 0x971A, 0x435F, \
- { 0x8C, 0xAF, 0x49, 0x67, 0xEB, 0x62, 0x72, 0x41 } \
- }
-
-extern EFI_GUID gEdkiiSerialPortLibVendorGuid;
-
-#endif // __SERIAL_PORT_LIB_VENDOR_H__
+/** @file + Define the SerialDxe GUID. + + Copyright (c) 2019, Citrix Systems, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef __SERIAL_PORT_LIB_VENDOR_H__ +#define __SERIAL_PORT_LIB_VENDOR_H__ + +#define EDKII_SERIAL_PORT_LIB_VENDOR_GUID {\ + 0xD3987D4B, 0x971A, 0x435F, \ + { 0x8C, 0xAF, 0x49, 0x67, 0xEB, 0x62, 0x72, 0x41 } \ + } + +extern EFI_GUID gEdkiiSerialPortLibVendorGuid; + +#endif // __SERIAL_PORT_LIB_VENDOR_H__ diff --git a/MdeModulePkg/Include/Guid/SmiHandlerProfile.h b/MdeModulePkg/Include/Guid/SmiHandlerProfile.h index 6f155a09e0..daad6d898c 100644 --- a/MdeModulePkg/Include/Guid/SmiHandlerProfile.h +++ b/MdeModulePkg/Include/Guid/SmiHandlerProfile.h @@ -1,209 +1,209 @@ -/** @file
- Header file for SMI handler profile definition.
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMI_HANDLER_PROFILE_H_
-#define _SMI_HANDLER_PROFILE_H_
-
-#include <PiSmm.h>
-#include <Protocol/SmmGpiDispatch2.h>
-#include <Protocol/SmmIoTrapDispatch2.h>
-#include <Protocol/SmmPeriodicTimerDispatch2.h>
-#include <Protocol/SmmPowerButtonDispatch2.h>
-#include <Protocol/SmmStandbyButtonDispatch2.h>
-#include <Protocol/SmmSwDispatch2.h>
-#include <Protocol/SmmSxDispatch2.h>
-#include <Protocol/SmmUsbDispatch2.h>
-
-typedef struct {
- UINT32 Signature;
- UINT32 Length;
- UINT32 Revision;
- UINT8 Reserved[4];
-} SMM_CORE_DATABASE_COMMON_HEADER;
-
-#define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')
-#define SMM_CORE_IMAGE_DATABASE_REVISION 0x0001
-
-typedef struct {
- SMM_CORE_DATABASE_COMMON_HEADER Header;
- EFI_GUID FileGuid;
- PHYSICAL_ADDRESS EntryPoint;
- PHYSICAL_ADDRESS ImageBase;
- UINT64 ImageSize;
- UINT32 ImageRef;
- UINT16 PdbStringOffset;
- UINT8 Reserved[2];
- // CHAR8 PdbString[];
-} SMM_CORE_IMAGE_DATABASE_STRUCTURE;
-
-#define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D')
-#define SMM_CORE_SMI_DATABASE_REVISION 0x0001
-
-typedef enum {
- SmmCoreSmiHandlerCategoryRootHandler,
- SmmCoreSmiHandlerCategoryGuidHandler,
- SmmCoreSmiHandlerCategoryHardwareHandler,
-} SMM_CORE_SMI_HANDLER_CATEGORY;
-
-//
-// Context for SmmCoreSmiHandlerCategoryRootHandler:
-// NULL
-// Context for SmmCoreSmiHandlerCategoryGuidHandler:
-// NULL
-// Context for SmmCoreSmiHandlerCategoryHardwareHandler:
-// (NOTE: The context field should NOT include any data pointer.)
-// gEfiSmmSwDispatch2ProtocolGuid: (EFI_SMM_SW_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT)
-// gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT
-// gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT
-// gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT
-// gEfiSmmPeriodicTimerDispatch2ProtocolGuid: EFI_SMM_PERIODIC_TIMER_CONTEXT
-// gEfiSmmGpiDispatch2ProtocolGuid: EFI_SMM_GPI_REGISTER_CONTEXT
-// gEfiSmmIoTrapDispatch2ProtocolGuid: EFI_SMM_IO_TRAP_REGISTER_CONTEXT
-// gEfiSmmUsbDispatch2ProtocolGuid: (EFI_SMM_USB_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT)
-// Other: GUID specific
-
-typedef struct {
- EFI_USB_SMI_TYPE Type;
- UINT32 DevicePathSize;
- // UINT8 DevicePath[DevicePathSize];
-} SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT;
-
-typedef struct {
- UINT64 SwSmiInputValue;
-} SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT;
-
-typedef struct {
- UINT32 Length;
- UINT32 ImageRef;
- PHYSICAL_ADDRESS CallerAddr;
- PHYSICAL_ADDRESS Handler;
- UINT16 ContextBufferOffset;
- UINT8 Reserved[2];
- UINT32 ContextBufferSize;
- // UINT8 ContextBuffer[];
-} SMM_CORE_SMI_HANDLER_STRUCTURE;
-
-typedef struct {
- SMM_CORE_DATABASE_COMMON_HEADER Header;
- EFI_GUID HandlerType;
- UINT32 HandlerCategory;
- UINT32 HandlerCount;
- // SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount];
-} SMM_CORE_SMI_DATABASE_STRUCTURE;
-
-//
-// Layout:
-// +-------------------------------------+
-// | SMM_CORE_IMAGE_DATABASE_STRUCTURE |
-// +-------------------------------------+
-// | SMM_CORE_SMI_DATABASE_STRUCTURE |
-// +-------------------------------------+
-//
-
-//
-// SMM_CORE dump command
-//
-#define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1
-#define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2
-
-typedef struct {
- UINT32 Command;
- UINT32 DataLength;
- UINT64 ReturnStatus;
-} SMI_HANDLER_PROFILE_PARAMETER_HEADER;
-
-typedef struct {
- SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;
- UINT64 DataSize;
-} SMI_HANDLER_PROFILE_PARAMETER_GET_INFO;
-
-typedef struct {
- SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;
- //
- // On input, data buffer size.
- // On output, actual data buffer size copied.
- //
- UINT64 DataSize;
- PHYSICAL_ADDRESS DataBuffer;
- //
- // On input, data buffer offset to copy.
- // On output, next time data buffer offset to copy.
- //
- UINT64 DataOffset;
-} SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET;
-
-#define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}
-
-extern EFI_GUID gSmiHandlerProfileGuid;
-
-typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL;
-
-/**
- This function is called by SmmChildDispatcher module to report
- a new SMI handler is registered, to SmmCore.
-
- @param This The protocol instance
- @param HandlerGuid The GUID to identify the type of the handler.
- For the SmmChildDispatch protocol, the HandlerGuid
- must be the GUID of SmmChildDispatch protocol.
- @param Handler The SMI handler.
- @param CallerAddress The address of the module who registers the SMI handler.
- @param Context The context of the SMI handler.
- For the SmmChildDispatch protocol, the Context
- must match the one defined for SmmChildDispatch protocol.
- @param ContextSize The size of the context in bytes.
- For the SmmChildDispatch protocol, the Context
- must match the one defined for SmmChildDispatch protocol.
-
- @retval EFI_SUCCESS The information is recorded.
- @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *SMI_HANDLER_PROFILE_REGISTER_HANDLER)(
- IN SMI_HANDLER_PROFILE_PROTOCOL *This,
- IN EFI_GUID *HandlerGuid,
- IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
- IN PHYSICAL_ADDRESS CallerAddress,
- IN VOID *Context OPTIONAL,
- IN UINTN ContextSize OPTIONAL
- );
-
-/**
- This function is called by SmmChildDispatcher module to report
- an existing SMI handler is unregistered, to SmmCore.
-
- @param This The protocol instance
- @param HandlerGuid The GUID to identify the type of the handler.
- For the SmmChildDispatch protocol, the HandlerGuid
- must be the GUID of SmmChildDispatch protocol.
- @param Handler The SMI handler.
- @param Context The context of the SMI handler.
- If it is NOT NULL, it will be used to check what is registered.
- @param ContextSize The size of the context in bytes.
- If Context is NOT NULL, it will be used to check what is registered.
-
- @retval EFI_SUCCESS The original record is removed.
- @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *SMI_HANDLER_PROFILE_UNREGISTER_HANDLER)(
- IN SMI_HANDLER_PROFILE_PROTOCOL *This,
- IN EFI_GUID *HandlerGuid,
- IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
- IN VOID *Context OPTIONAL,
- IN UINTN ContextSize OPTIONAL
- );
-
-struct _SMI_HANDLER_PROFILE_PROTOCOL {
- SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler;
- SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler;
-};
-
-#endif
+/** @file + Header file for SMI handler profile definition. + +Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMI_HANDLER_PROFILE_H_ +#define _SMI_HANDLER_PROFILE_H_ + +#include <PiSmm.h> +#include <Protocol/SmmGpiDispatch2.h> +#include <Protocol/SmmIoTrapDispatch2.h> +#include <Protocol/SmmPeriodicTimerDispatch2.h> +#include <Protocol/SmmPowerButtonDispatch2.h> +#include <Protocol/SmmStandbyButtonDispatch2.h> +#include <Protocol/SmmSwDispatch2.h> +#include <Protocol/SmmSxDispatch2.h> +#include <Protocol/SmmUsbDispatch2.h> + +typedef struct { + UINT32 Signature; + UINT32 Length; + UINT32 Revision; + UINT8 Reserved[4]; +} SMM_CORE_DATABASE_COMMON_HEADER; + +#define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D') +#define SMM_CORE_IMAGE_DATABASE_REVISION 0x0001 + +typedef struct { + SMM_CORE_DATABASE_COMMON_HEADER Header; + EFI_GUID FileGuid; + PHYSICAL_ADDRESS EntryPoint; + PHYSICAL_ADDRESS ImageBase; + UINT64 ImageSize; + UINT32 ImageRef; + UINT16 PdbStringOffset; + UINT8 Reserved[2]; + // CHAR8 PdbString[]; +} SMM_CORE_IMAGE_DATABASE_STRUCTURE; + +#define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D') +#define SMM_CORE_SMI_DATABASE_REVISION 0x0001 + +typedef enum { + SmmCoreSmiHandlerCategoryRootHandler, + SmmCoreSmiHandlerCategoryGuidHandler, + SmmCoreSmiHandlerCategoryHardwareHandler, +} SMM_CORE_SMI_HANDLER_CATEGORY; + +// +// Context for SmmCoreSmiHandlerCategoryRootHandler: +// NULL +// Context for SmmCoreSmiHandlerCategoryGuidHandler: +// NULL +// Context for SmmCoreSmiHandlerCategoryHardwareHandler: +// (NOTE: The context field should NOT include any data pointer.) +// gEfiSmmSwDispatch2ProtocolGuid: (EFI_SMM_SW_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT) +// gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT +// gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT +// gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT +// gEfiSmmPeriodicTimerDispatch2ProtocolGuid: EFI_SMM_PERIODIC_TIMER_CONTEXT +// gEfiSmmGpiDispatch2ProtocolGuid: EFI_SMM_GPI_REGISTER_CONTEXT +// gEfiSmmIoTrapDispatch2ProtocolGuid: EFI_SMM_IO_TRAP_REGISTER_CONTEXT +// gEfiSmmUsbDispatch2ProtocolGuid: (EFI_SMM_USB_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT) +// Other: GUID specific + +typedef struct { + EFI_USB_SMI_TYPE Type; + UINT32 DevicePathSize; + // UINT8 DevicePath[DevicePathSize]; +} SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT; + +typedef struct { + UINT64 SwSmiInputValue; +} SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT; + +typedef struct { + UINT32 Length; + UINT32 ImageRef; + PHYSICAL_ADDRESS CallerAddr; + PHYSICAL_ADDRESS Handler; + UINT16 ContextBufferOffset; + UINT8 Reserved[2]; + UINT32 ContextBufferSize; + // UINT8 ContextBuffer[]; +} SMM_CORE_SMI_HANDLER_STRUCTURE; + +typedef struct { + SMM_CORE_DATABASE_COMMON_HEADER Header; + EFI_GUID HandlerType; + UINT32 HandlerCategory; + UINT32 HandlerCount; + // SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount]; +} SMM_CORE_SMI_DATABASE_STRUCTURE; + +// +// Layout: +// +-------------------------------------+ +// | SMM_CORE_IMAGE_DATABASE_STRUCTURE | +// +-------------------------------------+ +// | SMM_CORE_SMI_DATABASE_STRUCTURE | +// +-------------------------------------+ +// + +// +// SMM_CORE dump command +// +#define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1 +#define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2 + +typedef struct { + UINT32 Command; + UINT32 DataLength; + UINT64 ReturnStatus; +} SMI_HANDLER_PROFILE_PARAMETER_HEADER; + +typedef struct { + SMI_HANDLER_PROFILE_PARAMETER_HEADER Header; + UINT64 DataSize; +} SMI_HANDLER_PROFILE_PARAMETER_GET_INFO; + +typedef struct { + SMI_HANDLER_PROFILE_PARAMETER_HEADER Header; + // + // On input, data buffer size. + // On output, actual data buffer size copied. + // + UINT64 DataSize; + PHYSICAL_ADDRESS DataBuffer; + // + // On input, data buffer offset to copy. + // On output, next time data buffer offset to copy. + // + UINT64 DataOffset; +} SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET; + +#define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}} + +extern EFI_GUID gSmiHandlerProfileGuid; + +typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL; + +/** + This function is called by SmmChildDispatcher module to report + a new SMI handler is registered, to SmmCore. + + @param This The protocol instance + @param HandlerGuid The GUID to identify the type of the handler. + For the SmmChildDispatch protocol, the HandlerGuid + must be the GUID of SmmChildDispatch protocol. + @param Handler The SMI handler. + @param CallerAddress The address of the module who registers the SMI handler. + @param Context The context of the SMI handler. + For the SmmChildDispatch protocol, the Context + must match the one defined for SmmChildDispatch protocol. + @param ContextSize The size of the context in bytes. + For the SmmChildDispatch protocol, the Context + must match the one defined for SmmChildDispatch protocol. + + @retval EFI_SUCCESS The information is recorded. + @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information. +**/ +typedef +EFI_STATUS +(EFIAPI *SMI_HANDLER_PROFILE_REGISTER_HANDLER)( + IN SMI_HANDLER_PROFILE_PROTOCOL *This, + IN EFI_GUID *HandlerGuid, + IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler, + IN PHYSICAL_ADDRESS CallerAddress, + IN VOID *Context OPTIONAL, + IN UINTN ContextSize OPTIONAL + ); + +/** + This function is called by SmmChildDispatcher module to report + an existing SMI handler is unregistered, to SmmCore. + + @param This The protocol instance + @param HandlerGuid The GUID to identify the type of the handler. + For the SmmChildDispatch protocol, the HandlerGuid + must be the GUID of SmmChildDispatch protocol. + @param Handler The SMI handler. + @param Context The context of the SMI handler. + If it is NOT NULL, it will be used to check what is registered. + @param ContextSize The size of the context in bytes. + If Context is NOT NULL, it will be used to check what is registered. + + @retval EFI_SUCCESS The original record is removed. + @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler. +**/ +typedef +EFI_STATUS +(EFIAPI *SMI_HANDLER_PROFILE_UNREGISTER_HANDLER)( + IN SMI_HANDLER_PROFILE_PROTOCOL *This, + IN EFI_GUID *HandlerGuid, + IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler, + IN VOID *Context OPTIONAL, + IN UINTN ContextSize OPTIONAL + ); + +struct _SMI_HANDLER_PROFILE_PROTOCOL { + SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler; + SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler; +}; + +#endif diff --git a/MdeModulePkg/Include/Guid/SmmLockBox.h b/MdeModulePkg/Include/Guid/SmmLockBox.h index 3447c58728..570df8a9ea 100644 --- a/MdeModulePkg/Include/Guid/SmmLockBox.h +++ b/MdeModulePkg/Include/Guid/SmmLockBox.h @@ -1,66 +1,66 @@ -/** @file
- SmmLockBox guid header file.
-
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMM_LOCK_BOX_GUID_H_
-#define _SMM_LOCK_BOX_GUID_H_
-
-#define EFI_SMM_LOCK_BOX_COMMUNICATION_GUID \
- {0x2a3cfebd, 0x27e8, 0x4d0a, {0x8b, 0x79, 0xd6, 0x88, 0xc2, 0xa3, 0xe1, 0xc0}}
-
-//
-// Below data structure is used for communication between PEI/DXE to SMM.
-//
-
-#define EFI_SMM_LOCK_BOX_COMMAND_SAVE 0x1
-#define EFI_SMM_LOCK_BOX_COMMAND_UPDATE 0x2
-#define EFI_SMM_LOCK_BOX_COMMAND_RESTORE 0x3
-#define EFI_SMM_LOCK_BOX_COMMAND_SET_ATTRIBUTES 0x4
-#define EFI_SMM_LOCK_BOX_COMMAND_RESTORE_ALL_IN_PLACE 0x5
-
-typedef struct {
- UINT32 Command;
- UINT32 DataLength;
- UINT64 ReturnStatus;
-} EFI_SMM_LOCK_BOX_PARAMETER_HEADER;
-
-typedef struct {
- EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header;
- GUID Guid;
- PHYSICAL_ADDRESS Buffer;
- UINT64 Length;
-} EFI_SMM_LOCK_BOX_PARAMETER_SAVE;
-
-typedef struct {
- EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header;
- GUID Guid;
- UINT64 Offset;
- PHYSICAL_ADDRESS Buffer;
- UINT64 Length;
-} EFI_SMM_LOCK_BOX_PARAMETER_UPDATE;
-
-typedef struct {
- EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header;
- GUID Guid;
- PHYSICAL_ADDRESS Buffer;
- UINT64 Length;
-} EFI_SMM_LOCK_BOX_PARAMETER_RESTORE;
-
-typedef struct {
- EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header;
- GUID Guid;
- UINT64 Attributes;
-} EFI_SMM_LOCK_BOX_PARAMETER_SET_ATTRIBUTES;
-
-typedef struct {
- EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header;
-} EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE;
-
-extern EFI_GUID gEfiSmmLockBoxCommunicationGuid;
-
-#endif
+/** @file + SmmLockBox guid header file. + +Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMM_LOCK_BOX_GUID_H_ +#define _SMM_LOCK_BOX_GUID_H_ + +#define EFI_SMM_LOCK_BOX_COMMUNICATION_GUID \ + {0x2a3cfebd, 0x27e8, 0x4d0a, {0x8b, 0x79, 0xd6, 0x88, 0xc2, 0xa3, 0xe1, 0xc0}} + +// +// Below data structure is used for communication between PEI/DXE to SMM. +// + +#define EFI_SMM_LOCK_BOX_COMMAND_SAVE 0x1 +#define EFI_SMM_LOCK_BOX_COMMAND_UPDATE 0x2 +#define EFI_SMM_LOCK_BOX_COMMAND_RESTORE 0x3 +#define EFI_SMM_LOCK_BOX_COMMAND_SET_ATTRIBUTES 0x4 +#define EFI_SMM_LOCK_BOX_COMMAND_RESTORE_ALL_IN_PLACE 0x5 + +typedef struct { + UINT32 Command; + UINT32 DataLength; + UINT64 ReturnStatus; +} EFI_SMM_LOCK_BOX_PARAMETER_HEADER; + +typedef struct { + EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header; + GUID Guid; + PHYSICAL_ADDRESS Buffer; + UINT64 Length; +} EFI_SMM_LOCK_BOX_PARAMETER_SAVE; + +typedef struct { + EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header; + GUID Guid; + UINT64 Offset; + PHYSICAL_ADDRESS Buffer; + UINT64 Length; +} EFI_SMM_LOCK_BOX_PARAMETER_UPDATE; + +typedef struct { + EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header; + GUID Guid; + PHYSICAL_ADDRESS Buffer; + UINT64 Length; +} EFI_SMM_LOCK_BOX_PARAMETER_RESTORE; + +typedef struct { + EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header; + GUID Guid; + UINT64 Attributes; +} EFI_SMM_LOCK_BOX_PARAMETER_SET_ATTRIBUTES; + +typedef struct { + EFI_SMM_LOCK_BOX_PARAMETER_HEADER Header; +} EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE; + +extern EFI_GUID gEfiSmmLockBoxCommunicationGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/SmmVariableCommon.h b/MdeModulePkg/Include/Guid/SmmVariableCommon.h index 1a1ab4fcc1..ae477d4921 100644 --- a/MdeModulePkg/Include/Guid/SmmVariableCommon.h +++ b/MdeModulePkg/Include/Guid/SmmVariableCommon.h @@ -1,150 +1,150 @@ -/** @file
- The file defined some common structures used for communicating between SMM variable module and SMM variable wrapper module.
-
-Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMM_VARIABLE_COMMON_H_
-#define _SMM_VARIABLE_COMMON_H_
-
-#include <Guid/VariableFormat.h>
-#include <Protocol/VarCheck.h>
-
-#define EFI_SMM_VARIABLE_WRITE_GUID \
- { 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 } }
-
-extern EFI_GUID gSmmVariableWriteGuid;
-
-//
-// This structure is used for SMM variable. the collected statistics data is saved in SMRAM. It can be got from
-// SMI handler. The communication buffer should be:
-// EFI_MM_COMMUNICATE_HEADER + SMM_VARIABLE_COMMUNICATE_HEADER + payload.
-//
-typedef struct {
- UINTN Function;
- EFI_STATUS ReturnStatus;
- UINT8 Data[1];
-} SMM_VARIABLE_COMMUNICATE_HEADER;
-
-//
-// The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
-//
-#define SMM_VARIABLE_FUNCTION_GET_VARIABLE 1
-//
-// The payload for this function is SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME.
-//
-#define SMM_VARIABLE_FUNCTION_GET_NEXT_VARIABLE_NAME 2
-//
-// The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
-//
-#define SMM_VARIABLE_FUNCTION_SET_VARIABLE 3
-//
-// The payload for this function is SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO.
-//
-#define SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO 4
-//
-// It is a notify event, no extra payload for this function.
-//
-#define SMM_VARIABLE_FUNCTION_READY_TO_BOOT 5
-//
-// It is a notify event, no extra payload for this function.
-//
-#define SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE 6
-//
-// The payload for this function is VARIABLE_INFO_ENTRY. The GUID in EFI_MM_COMMUNICATE_HEADER
-// is gEfiSmmVariableProtocolGuid.
-//
-#define SMM_VARIABLE_FUNCTION_GET_STATISTICS 7
-//
-// The payload for this function is SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE
-//
-#define SMM_VARIABLE_FUNCTION_LOCK_VARIABLE 8
-
-#define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_SET 9
-
-#define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_GET 10
-
-#define SMM_VARIABLE_FUNCTION_GET_PAYLOAD_SIZE 11
-//
-// The payload for this function is SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT
-//
-#define SMM_VARIABLE_FUNCTION_INIT_RUNTIME_VARIABLE_CACHE_CONTEXT 12
-
-#define SMM_VARIABLE_FUNCTION_SYNC_RUNTIME_CACHE 13
-//
-// The payload for this function is SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO
-//
-#define SMM_VARIABLE_FUNCTION_GET_RUNTIME_CACHE_INFO 14
-
-///
-/// Size of SMM communicate header, without including the payload.
-///
-#define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data))
-
-///
-/// Size of SMM variable communicate header, without including the payload.
-///
-#define SMM_VARIABLE_COMMUNICATE_HEADER_SIZE (OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data))
-
-///
-/// This structure is used to communicate with SMI handler by SetVariable and GetVariable.
-///
-typedef struct {
- EFI_GUID Guid;
- UINTN DataSize;
- UINTN NameSize;
- UINT32 Attributes;
- CHAR16 Name[1];
-} SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE;
-
-///
-/// This structure is used to communicate with SMI handler by GetNextVariableName.
-///
-typedef struct {
- EFI_GUID Guid;
- UINTN NameSize; // Return name buffer size
- CHAR16 Name[1];
-} SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME;
-
-///
-/// This structure is used to communicate with SMI handler by QueryVariableInfo.
-///
-typedef struct {
- UINT64 MaximumVariableStorageSize;
- UINT64 RemainingVariableStorageSize;
- UINT64 MaximumVariableSize;
- UINT32 Attributes;
-} SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO;
-
-typedef SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE;
-
-typedef struct {
- EFI_GUID Guid;
- UINTN NameSize;
- VAR_CHECK_VARIABLE_PROPERTY VariableProperty;
- CHAR16 Name[1];
-} SMM_VARIABLE_COMMUNICATE_VAR_CHECK_VARIABLE_PROPERTY;
-
-typedef struct {
- UINTN VariablePayloadSize;
-} SMM_VARIABLE_COMMUNICATE_GET_PAYLOAD_SIZE;
-
-typedef struct {
- BOOLEAN *ReadLock;
- BOOLEAN *PendingUpdate;
- BOOLEAN *HobFlushComplete;
- VARIABLE_STORE_HEADER *RuntimeHobCache;
- VARIABLE_STORE_HEADER *RuntimeNvCache;
- VARIABLE_STORE_HEADER *RuntimeVolatileCache;
-} SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT;
-
-typedef struct {
- UINTN TotalHobStorageSize;
- UINTN TotalNvStorageSize;
- UINTN TotalVolatileStorageSize;
- BOOLEAN AuthenticatedVariableUsage;
-} SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO;
-
-#endif // _SMM_VARIABLE_COMMON_H_
+/** @file + The file defined some common structures used for communicating between SMM variable module and SMM variable wrapper module. + +Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMM_VARIABLE_COMMON_H_ +#define _SMM_VARIABLE_COMMON_H_ + +#include <Guid/VariableFormat.h> +#include <Protocol/VarCheck.h> + +#define EFI_SMM_VARIABLE_WRITE_GUID \ + { 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 } } + +extern EFI_GUID gSmmVariableWriteGuid; + +// +// This structure is used for SMM variable. the collected statistics data is saved in SMRAM. It can be got from +// SMI handler. The communication buffer should be: +// EFI_MM_COMMUNICATE_HEADER + SMM_VARIABLE_COMMUNICATE_HEADER + payload. +// +typedef struct { + UINTN Function; + EFI_STATUS ReturnStatus; + UINT8 Data[1]; +} SMM_VARIABLE_COMMUNICATE_HEADER; + +// +// The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE. +// +#define SMM_VARIABLE_FUNCTION_GET_VARIABLE 1 +// +// The payload for this function is SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME. +// +#define SMM_VARIABLE_FUNCTION_GET_NEXT_VARIABLE_NAME 2 +// +// The payload for this function is SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE. +// +#define SMM_VARIABLE_FUNCTION_SET_VARIABLE 3 +// +// The payload for this function is SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO. +// +#define SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO 4 +// +// It is a notify event, no extra payload for this function. +// +#define SMM_VARIABLE_FUNCTION_READY_TO_BOOT 5 +// +// It is a notify event, no extra payload for this function. +// +#define SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE 6 +// +// The payload for this function is VARIABLE_INFO_ENTRY. The GUID in EFI_MM_COMMUNICATE_HEADER +// is gEfiSmmVariableProtocolGuid. +// +#define SMM_VARIABLE_FUNCTION_GET_STATISTICS 7 +// +// The payload for this function is SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE +// +#define SMM_VARIABLE_FUNCTION_LOCK_VARIABLE 8 + +#define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_SET 9 + +#define SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_GET 10 + +#define SMM_VARIABLE_FUNCTION_GET_PAYLOAD_SIZE 11 +// +// The payload for this function is SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT +// +#define SMM_VARIABLE_FUNCTION_INIT_RUNTIME_VARIABLE_CACHE_CONTEXT 12 + +#define SMM_VARIABLE_FUNCTION_SYNC_RUNTIME_CACHE 13 +// +// The payload for this function is SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO +// +#define SMM_VARIABLE_FUNCTION_GET_RUNTIME_CACHE_INFO 14 + +/// +/// Size of SMM communicate header, without including the payload. +/// +#define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data)) + +/// +/// Size of SMM variable communicate header, without including the payload. +/// +#define SMM_VARIABLE_COMMUNICATE_HEADER_SIZE (OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data)) + +/// +/// This structure is used to communicate with SMI handler by SetVariable and GetVariable. +/// +typedef struct { + EFI_GUID Guid; + UINTN DataSize; + UINTN NameSize; + UINT32 Attributes; + CHAR16 Name[1]; +} SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE; + +/// +/// This structure is used to communicate with SMI handler by GetNextVariableName. +/// +typedef struct { + EFI_GUID Guid; + UINTN NameSize; // Return name buffer size + CHAR16 Name[1]; +} SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME; + +/// +/// This structure is used to communicate with SMI handler by QueryVariableInfo. +/// +typedef struct { + UINT64 MaximumVariableStorageSize; + UINT64 RemainingVariableStorageSize; + UINT64 MaximumVariableSize; + UINT32 Attributes; +} SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO; + +typedef SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME SMM_VARIABLE_COMMUNICATE_LOCK_VARIABLE; + +typedef struct { + EFI_GUID Guid; + UINTN NameSize; + VAR_CHECK_VARIABLE_PROPERTY VariableProperty; + CHAR16 Name[1]; +} SMM_VARIABLE_COMMUNICATE_VAR_CHECK_VARIABLE_PROPERTY; + +typedef struct { + UINTN VariablePayloadSize; +} SMM_VARIABLE_COMMUNICATE_GET_PAYLOAD_SIZE; + +typedef struct { + BOOLEAN *ReadLock; + BOOLEAN *PendingUpdate; + BOOLEAN *HobFlushComplete; + VARIABLE_STORE_HEADER *RuntimeHobCache; + VARIABLE_STORE_HEADER *RuntimeNvCache; + VARIABLE_STORE_HEADER *RuntimeVolatileCache; +} SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT; + +typedef struct { + UINTN TotalHobStorageSize; + UINTN TotalNvStorageSize; + UINTN TotalVolatileStorageSize; + BOOLEAN AuthenticatedVariableUsage; +} SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO; + +#endif // _SMM_VARIABLE_COMMON_H_ diff --git a/MdeModulePkg/Include/Guid/StandardErrorDevice.h b/MdeModulePkg/Include/Guid/StandardErrorDevice.h index 400d9a039c..d6cfc60706 100644 --- a/MdeModulePkg/Include/Guid/StandardErrorDevice.h +++ b/MdeModulePkg/Include/Guid/StandardErrorDevice.h @@ -1,18 +1,18 @@ -/** @file
- This GUID is installed to the device handler to specify that the device is a StdErr device.
-
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __STANDARD_ERROR_DEVICE_H__
-#define __STANDARD_ERROR_DEVICE_H__
-
-#define EFI_STANDARD_ERROR_DEVICE_GUID \
- { 0xd3b36f2d, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
-
-extern EFI_GUID gEfiStandardErrorDeviceGuid;
-
-#endif
+/** @file + This GUID is installed to the device handler to specify that the device is a StdErr device. + + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __STANDARD_ERROR_DEVICE_H__ +#define __STANDARD_ERROR_DEVICE_H__ + +#define EFI_STANDARD_ERROR_DEVICE_GUID \ + { 0xd3b36f2d, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } + +extern EFI_GUID gEfiStandardErrorDeviceGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/StatusCodeCallbackGuid.h b/MdeModulePkg/Include/Guid/StatusCodeCallbackGuid.h index 0e5af6aff6..195a490cf5 100644 --- a/MdeModulePkg/Include/Guid/StatusCodeCallbackGuid.h +++ b/MdeModulePkg/Include/Guid/StatusCodeCallbackGuid.h @@ -1,20 +1,20 @@ -/** @file
- GUID used to identify HOB for pointers to callback functios registered on
- PEI report status code router.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __STATUS_CODE_CALLBACK_H__
-#define __STATUS_CODE_CALLBACK_H__
-
-#define STATUS_CODE_CALLBACK_GUID \
- { \
- 0xe701458c, 0x4900, 0x4ca5, {0xb7, 0x72, 0x3d, 0x37, 0x94, 0x9f, 0x79, 0x27} \
- }
-
-extern EFI_GUID gStatusCodeCallbackGuid;
-
-#endif
+/** @file + GUID used to identify HOB for pointers to callback functios registered on + PEI report status code router. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __STATUS_CODE_CALLBACK_H__ +#define __STATUS_CODE_CALLBACK_H__ + +#define STATUS_CODE_CALLBACK_GUID \ + { \ + 0xe701458c, 0x4900, 0x4ca5, {0xb7, 0x72, 0x3d, 0x37, 0x94, 0x9f, 0x79, 0x27} \ + } + +extern EFI_GUID gStatusCodeCallbackGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/StatusCodeDataTypeDebug.h b/MdeModulePkg/Include/Guid/StatusCodeDataTypeDebug.h index 6f2688064b..451e829b00 100644 --- a/MdeModulePkg/Include/Guid/StatusCodeDataTypeDebug.h +++ b/MdeModulePkg/Include/Guid/StatusCodeDataTypeDebug.h @@ -1,51 +1,51 @@ -/** @file
- This file defines the GUID and data structure used to pass DEBUG() macro
- information to the Status Code Protocol and Status Code PPI.
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _STATUS_CODE_DATA_TYPE_DEBUG_H_
-#define _STATUS_CODE_DATA_TYPE_DEBUG_H_
-
-#include <Pi/PiStatusCode.h>
-
-///
-/// The Global ID used to identify a structure of type EFI_DEBUG_INFO.
-///
-#define EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID \
- { \
- 0x9A4E9246, 0xD553, 0x11D5, { 0x87, 0xE2, 0x00, 0x06, 0x29, 0x45, 0xC3, 0xb9 } \
- }
-
-///
-/// The maximum size of an EFI_DEBUG_INFO structure.
-///
-#define EFI_STATUS_CODE_DATA_MAX_SIZE 0x200
-
-///
-/// Define the maximum extended data size that is supported when a
-/// status code is reported.
-///
-#define MAX_EXTENDED_DATA_SIZE (EFI_STATUS_CODE_DATA_MAX_SIZE + sizeof(EFI_STATUS_CODE_DATA))
-
-///
-/// This structure contains the ErrorLevel passed into the DEBUG() macro, followed
-/// by a 96-byte buffer that contains the variable argument list passed to the
-/// DEBUG() macro that has been converted to a BASE_LIST. The 96-byte buffer is
-/// followed by a Null-terminated ASCII string that is the Format string passed
-/// to the DEBUG() macro. The maximum size of this structure is defined by
-/// EFI_STATUS_CODE_DATA_MAX_SIZE.
-///
-typedef struct {
- ///
- /// The debug error level passed into a DEBUG() macro.
- ///
- UINT32 ErrorLevel;
-} EFI_DEBUG_INFO;
-
-extern EFI_GUID gEfiStatusCodeDataTypeDebugGuid;
-
-#endif // _STATUS_CODE_DATA_TYPE_DEBUG_H_
+/** @file + This file defines the GUID and data structure used to pass DEBUG() macro + information to the Status Code Protocol and Status Code PPI. + +Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _STATUS_CODE_DATA_TYPE_DEBUG_H_ +#define _STATUS_CODE_DATA_TYPE_DEBUG_H_ + +#include <Pi/PiStatusCode.h> + +/// +/// The Global ID used to identify a structure of type EFI_DEBUG_INFO. +/// +#define EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID \ + { \ + 0x9A4E9246, 0xD553, 0x11D5, { 0x87, 0xE2, 0x00, 0x06, 0x29, 0x45, 0xC3, 0xb9 } \ + } + +/// +/// The maximum size of an EFI_DEBUG_INFO structure. +/// +#define EFI_STATUS_CODE_DATA_MAX_SIZE 0x200 + +/// +/// Define the maximum extended data size that is supported when a +/// status code is reported. +/// +#define MAX_EXTENDED_DATA_SIZE (EFI_STATUS_CODE_DATA_MAX_SIZE + sizeof(EFI_STATUS_CODE_DATA)) + +/// +/// This structure contains the ErrorLevel passed into the DEBUG() macro, followed +/// by a 96-byte buffer that contains the variable argument list passed to the +/// DEBUG() macro that has been converted to a BASE_LIST. The 96-byte buffer is +/// followed by a Null-terminated ASCII string that is the Format string passed +/// to the DEBUG() macro. The maximum size of this structure is defined by +/// EFI_STATUS_CODE_DATA_MAX_SIZE. +/// +typedef struct { + /// + /// The debug error level passed into a DEBUG() macro. + /// + UINT32 ErrorLevel; +} EFI_DEBUG_INFO; + +extern EFI_GUID gEfiStatusCodeDataTypeDebugGuid; + +#endif // _STATUS_CODE_DATA_TYPE_DEBUG_H_ diff --git a/MdeModulePkg/Include/Guid/StatusCodeDataTypeVariable.h b/MdeModulePkg/Include/Guid/StatusCodeDataTypeVariable.h index a0edac365f..6770c45f43 100644 --- a/MdeModulePkg/Include/Guid/StatusCodeDataTypeVariable.h +++ b/MdeModulePkg/Include/Guid/StatusCodeDataTypeVariable.h @@ -1,34 +1,34 @@ -/** @file
- This file defines the GUID and data structure used to pass variable setting
- failure information to the Status Code Protocol.
-
-Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _STATUS_CODE_DATA_TYPE_VARIABLE_H_
-#define _STATUS_CODE_DATA_TYPE_VARIABLE_H_
-
-///
-/// The Global ID used to identify a structure of type EDKII_SET_VARIABLE_STATUS.
-/// The status code value is PcdGet32 (PcdErrorCodeSetVariable).
-///
-#define EDKII_STATUS_CODE_DATA_TYPE_VARIABLE_GUID \
- { \
- 0xf6ee6dbb, 0xd67f, 0x4ea0, { 0x8b, 0x96, 0x6a, 0x71, 0xb1, 0x9d, 0x84, 0xad } \
- }
-
-typedef struct {
- EFI_GUID Guid;
- UINTN NameSize;
- UINTN DataSize;
- EFI_STATUS SetStatus;
- UINT32 Attributes;
- // CHAR16 Name[];
- // UINT8 Data[];
-} EDKII_SET_VARIABLE_STATUS;
-
-extern EFI_GUID gEdkiiStatusCodeDataTypeVariableGuid;
-
-#endif // _STATUS_CODE_DATA_TYPE_VARIABLE_H_
+/** @file + This file defines the GUID and data structure used to pass variable setting + failure information to the Status Code Protocol. + +Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _STATUS_CODE_DATA_TYPE_VARIABLE_H_ +#define _STATUS_CODE_DATA_TYPE_VARIABLE_H_ + +/// +/// The Global ID used to identify a structure of type EDKII_SET_VARIABLE_STATUS. +/// The status code value is PcdGet32 (PcdErrorCodeSetVariable). +/// +#define EDKII_STATUS_CODE_DATA_TYPE_VARIABLE_GUID \ + { \ + 0xf6ee6dbb, 0xd67f, 0x4ea0, { 0x8b, 0x96, 0x6a, 0x71, 0xb1, 0x9d, 0x84, 0xad } \ + } + +typedef struct { + EFI_GUID Guid; + UINTN NameSize; + UINTN DataSize; + EFI_STATUS SetStatus; + UINT32 Attributes; + // CHAR16 Name[]; + // UINT8 Data[]; +} EDKII_SET_VARIABLE_STATUS; + +extern EFI_GUID gEdkiiStatusCodeDataTypeVariableGuid; + +#endif // _STATUS_CODE_DATA_TYPE_VARIABLE_H_ diff --git a/MdeModulePkg/Include/Guid/SystemNvDataGuid.h b/MdeModulePkg/Include/Guid/SystemNvDataGuid.h index 85f226d0cc..f01be386b4 100644 --- a/MdeModulePkg/Include/Guid/SystemNvDataGuid.h +++ b/MdeModulePkg/Include/Guid/SystemNvDataGuid.h @@ -1,111 +1,111 @@ -/** @file
- This file defines NvDataFv GUID and FTW working block structures.
- The NvDataFv GUID can be used as FileSystemGuid in EFI_FIRMWARE_VOLUME_HEADER if
- this FV image contains NV data, such as NV variable data.
- This file also defines WorkingBlockSignature GUID for FTW working block signature.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SYSTEM_NV_DATA_GUID_H__
-#define __SYSTEM_NV_DATA_GUID_H__
-
-#define EFI_SYSTEM_NV_DATA_FV_GUID \
- {0xfff12b8d, 0x7696, 0x4c8b, {0xa9, 0x85, 0x27, 0x47, 0x7, 0x5b, 0x4f, 0x50} }
-
-#define EDKII_WORKING_BLOCK_SIGNATURE_GUID \
- {0x9e58292b, 0x7c68, 0x497d, {0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95} }
-
-extern EFI_GUID gEfiSystemNvDataFvGuid;
-extern EFI_GUID gEdkiiWorkingBlockSignatureGuid;
-
-#define WORKING_BLOCK_VALID 0x1
-#define WORKING_BLOCK_INVALID 0x2
-
-///
-/// The EDKII Fault tolerant working block header.
-/// The header is immediately followed by the write queue data.
-///
-typedef struct {
- ///
- /// FTW working block signature.
- /// Its value has be updated from gEfiSystemNvDataFvGuid to gEdkiiWorkingBlockSignatureGuid,
- /// because its write queue data format has been updated to support the crossing archs.
- ///
- EFI_GUID Signature;
- ///
- /// 32bit CRC calculated for this header.
- ///
- UINT32 Crc;
- ///
- /// Working block valid bit.
- ///
- UINT8 WorkingBlockValid : 1;
- UINT8 WorkingBlockInvalid : 1;
- UINT8 Reserved : 6;
- UINT8 Reserved3[3];
- ///
- /// Total size of the following write queue range.
- ///
- UINT64 WriteQueueSize;
- ///
- /// Write Queue data.
- ///
- /// EFI_FAULT_TOLERANT_WRITE_HEADER FtwHeader;
- /// EFI_FAULT_TOLERANT_WRITE_RECORD FtwRecord[FtwHeader.NumberOfWrites]
- /// EFI_FAULT_TOLERANT_WRITE_HEADER FtwHeader2;
- /// EFI_FAULT_TOLERANT_WRITE_RECORD FtwRecord2[FtwHeader2.NumberOfWrites]
- /// ...
- ///
-} EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER;
-
-#define FTW_VALID_STATE 0
-#define FTW_INVALID_STATE 1
-
-//
-// EFI Fault tolerant block update write queue entry.
-//
-typedef struct {
- UINT8 HeaderAllocated : 1;
- UINT8 WritesAllocated : 1;
- UINT8 Complete : 1;
- UINT8 Reserved : 5;
- EFI_GUID CallerId;
- UINT64 NumberOfWrites;
- UINT64 PrivateDataSize;
-} EFI_FAULT_TOLERANT_WRITE_HEADER;
-
-//
-// EFI Fault tolerant block update write queue record.
-//
-typedef struct {
- UINT8 BootBlockUpdate : 1;
- UINT8 SpareComplete : 1;
- UINT8 DestinationComplete : 1;
- UINT8 Reserved : 5;
- EFI_LBA Lba;
- UINT64 Offset;
- UINT64 Length;
- //
- // Relative offset to spare block.
- //
- INT64 RelativeOffset;
- //
- // UINT8 PrivateData[PrivateDataSize]
- //
-} EFI_FAULT_TOLERANT_WRITE_RECORD;
-
-#define FTW_RECORD_SIZE(PrivateDataSize) (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + (UINTN) PrivateDataSize)
-
-#define FTW_RECORD_TOTAL_SIZE(NumberOfWrites, PrivateDataSize) \
- ((UINTN) (NumberOfWrites) * (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + (UINTN) PrivateDataSize))
-
-#define FTW_WRITE_TOTAL_SIZE(NumberOfWrites, PrivateDataSize) \
- ( \
- sizeof (EFI_FAULT_TOLERANT_WRITE_HEADER) + (UINTN) (NumberOfWrites) * \
- (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + (UINTN) PrivateDataSize) \
- )
-
-#endif
+/** @file + This file defines NvDataFv GUID and FTW working block structures. + The NvDataFv GUID can be used as FileSystemGuid in EFI_FIRMWARE_VOLUME_HEADER if + this FV image contains NV data, such as NV variable data. + This file also defines WorkingBlockSignature GUID for FTW working block signature. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SYSTEM_NV_DATA_GUID_H__ +#define __SYSTEM_NV_DATA_GUID_H__ + +#define EFI_SYSTEM_NV_DATA_FV_GUID \ + {0xfff12b8d, 0x7696, 0x4c8b, {0xa9, 0x85, 0x27, 0x47, 0x7, 0x5b, 0x4f, 0x50} } + +#define EDKII_WORKING_BLOCK_SIGNATURE_GUID \ + {0x9e58292b, 0x7c68, 0x497d, {0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95} } + +extern EFI_GUID gEfiSystemNvDataFvGuid; +extern EFI_GUID gEdkiiWorkingBlockSignatureGuid; + +#define WORKING_BLOCK_VALID 0x1 +#define WORKING_BLOCK_INVALID 0x2 + +/// +/// The EDKII Fault tolerant working block header. +/// The header is immediately followed by the write queue data. +/// +typedef struct { + /// + /// FTW working block signature. + /// Its value has be updated from gEfiSystemNvDataFvGuid to gEdkiiWorkingBlockSignatureGuid, + /// because its write queue data format has been updated to support the crossing archs. + /// + EFI_GUID Signature; + /// + /// 32bit CRC calculated for this header. + /// + UINT32 Crc; + /// + /// Working block valid bit. + /// + UINT8 WorkingBlockValid : 1; + UINT8 WorkingBlockInvalid : 1; + UINT8 Reserved : 6; + UINT8 Reserved3[3]; + /// + /// Total size of the following write queue range. + /// + UINT64 WriteQueueSize; + /// + /// Write Queue data. + /// + /// EFI_FAULT_TOLERANT_WRITE_HEADER FtwHeader; + /// EFI_FAULT_TOLERANT_WRITE_RECORD FtwRecord[FtwHeader.NumberOfWrites] + /// EFI_FAULT_TOLERANT_WRITE_HEADER FtwHeader2; + /// EFI_FAULT_TOLERANT_WRITE_RECORD FtwRecord2[FtwHeader2.NumberOfWrites] + /// ... + /// +} EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER; + +#define FTW_VALID_STATE 0 +#define FTW_INVALID_STATE 1 + +// +// EFI Fault tolerant block update write queue entry. +// +typedef struct { + UINT8 HeaderAllocated : 1; + UINT8 WritesAllocated : 1; + UINT8 Complete : 1; + UINT8 Reserved : 5; + EFI_GUID CallerId; + UINT64 NumberOfWrites; + UINT64 PrivateDataSize; +} EFI_FAULT_TOLERANT_WRITE_HEADER; + +// +// EFI Fault tolerant block update write queue record. +// +typedef struct { + UINT8 BootBlockUpdate : 1; + UINT8 SpareComplete : 1; + UINT8 DestinationComplete : 1; + UINT8 Reserved : 5; + EFI_LBA Lba; + UINT64 Offset; + UINT64 Length; + // + // Relative offset to spare block. + // + INT64 RelativeOffset; + // + // UINT8 PrivateData[PrivateDataSize] + // +} EFI_FAULT_TOLERANT_WRITE_RECORD; + +#define FTW_RECORD_SIZE(PrivateDataSize) (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + (UINTN) PrivateDataSize) + +#define FTW_RECORD_TOTAL_SIZE(NumberOfWrites, PrivateDataSize) \ + ((UINTN) (NumberOfWrites) * (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + (UINTN) PrivateDataSize)) + +#define FTW_WRITE_TOTAL_SIZE(NumberOfWrites, PrivateDataSize) \ + ( \ + sizeof (EFI_FAULT_TOLERANT_WRITE_HEADER) + (UINTN) (NumberOfWrites) * \ + (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + (UINTN) PrivateDataSize) \ + ) + +#endif diff --git a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h index 367f97dc90..409af3aacf 100644 --- a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h +++ b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h @@ -1,24 +1,24 @@ -/** @file
-This header file declares Trace Hub related structure.
-
-Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef TRACE_HUB_DEBUG_INFO_HOB_H_
-#define TRACE_HUB_DEBUG_INFO_HOB_H_
-
-#define TRACEHUB_DEBUG_INFO_HOB_REVISION 1
-
-typedef struct {
- UINT16 Revision; // Structure revision
- BOOLEAN Flag; // Flag to enable or disable Trace Hub debug message.
- UINT8 DebugLevel; // Debug level for Trace Hub.
- UINT8 Rvsd[4]; // Reserved for future use
- UINT64 TraceHubMmioAddress; // MMIO address where Trace Hub debug message output to.
-} TRACEHUB_DEBUG_INFO_HOB;
-
-extern GUID gTraceHubDebugInfoHobGuid;
-
-#endif // TRACE_HUB_DEBUG_INFO_HOB_H_
+/** @file +This header file declares Trace Hub related structure. + +Copyright (c) 2023, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef TRACE_HUB_DEBUG_INFO_HOB_H_ +#define TRACE_HUB_DEBUG_INFO_HOB_H_ + +#define TRACEHUB_DEBUG_INFO_HOB_REVISION 1 + +typedef struct { + UINT16 Revision; // Structure revision + BOOLEAN Flag; // Flag to enable or disable Trace Hub debug message. + UINT8 DebugLevel; // Debug level for Trace Hub. + UINT8 Rvsd[4]; // Reserved for future use + UINT64 TraceHubMmioAddress; // MMIO address where Trace Hub debug message output to. +} TRACEHUB_DEBUG_INFO_HOB; + +extern GUID gTraceHubDebugInfoHobGuid; + +#endif // TRACE_HUB_DEBUG_INFO_HOB_H_ diff --git a/MdeModulePkg/Include/Guid/TtyTerm.h b/MdeModulePkg/Include/Guid/TtyTerm.h index 6bd999cc96..b5e47edb79 100644 --- a/MdeModulePkg/Include/Guid/TtyTerm.h +++ b/MdeModulePkg/Include/Guid/TtyTerm.h @@ -1,36 +1,36 @@ -/** @file
-GUID definition for TtyTerm terminal type. The TtyTerm terminal aims to
-provide support for modern *nix terminals.
-
-
-Copyright (c) 2015 Linaro Ltd.
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __TTYTERM_H__
-#define __TTYTERM_H__
-
-#define EFI_TTY_TERM_GUID \
- {0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } }
-
-#define EDKII_LINUX_TERM_GUID \
- {0xe4364a7f, 0xf825, 0x430e, {0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 } }
-
-#define EDKII_XTERM_R6_GUID \
- {0xfbfca56b, 0xbb36, 0x4b78, {0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb } }
-
-#define EDKII_VT400_GUID \
- {0x8e46dddd, 0x3d49, 0x4a9d, {0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd } }
-
-#define EDKII_SCO_TERM_GUID \
- {0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a } }
-
-extern EFI_GUID gEfiTtyTermGuid;
-extern EFI_GUID gEdkiiLinuxTermGuid;
-extern EFI_GUID gEdkiiXtermR6Guid;
-extern EFI_GUID gEdkiiVT400Guid;
-extern EFI_GUID gEdkiiSCOTermGuid;
-
-#endif
+/** @file +GUID definition for TtyTerm terminal type. The TtyTerm terminal aims to +provide support for modern *nix terminals. + + +Copyright (c) 2015 Linaro Ltd. +Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __TTYTERM_H__ +#define __TTYTERM_H__ + +#define EFI_TTY_TERM_GUID \ + {0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } } + +#define EDKII_LINUX_TERM_GUID \ + {0xe4364a7f, 0xf825, 0x430e, {0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 } } + +#define EDKII_XTERM_R6_GUID \ + {0xfbfca56b, 0xbb36, 0x4b78, {0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb } } + +#define EDKII_VT400_GUID \ + {0x8e46dddd, 0x3d49, 0x4a9d, {0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd } } + +#define EDKII_SCO_TERM_GUID \ + {0xfc7dd6e0, 0x813c, 0x434d, {0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a } } + +extern EFI_GUID gEfiTtyTermGuid; +extern EFI_GUID gEdkiiLinuxTermGuid; +extern EFI_GUID gEdkiiXtermR6Guid; +extern EFI_GUID gEdkiiVT400Guid; +extern EFI_GUID gEdkiiSCOTermGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/UsbKeyBoardLayout.h b/MdeModulePkg/Include/Guid/UsbKeyBoardLayout.h index c43f0656ea..c8a321110e 100644 --- a/MdeModulePkg/Include/Guid/UsbKeyBoardLayout.h +++ b/MdeModulePkg/Include/Guid/UsbKeyBoardLayout.h @@ -1,31 +1,31 @@ -/** @file
- USB KeyBoard Layout GUIDs
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __USB_KEYBOARD_LAYOUT_GUID_H__
-#define __USB_KEYBOARD_LAYOUT_GUID_H__
-
-//
-// GUID for USB keyboard HII package list.
-//
-#define USB_KEYBOARD_LAYOUT_PACKAGE_GUID \
- { \
- 0xc0f3b43, 0x44de, 0x4907, { 0xb4, 0x78, 0x22, 0x5f, 0x6f, 0x62, 0x89, 0xdc } \
- }
-
-//
-// GUID for USB keyboard layout
-//
-#define USB_KEYBOARD_LAYOUT_KEY_GUID \
- { \
- 0x3a4d7a7c, 0x18a, 0x4b42, { 0x81, 0xb3, 0xdc, 0x10, 0xe3, 0xb5, 0x91, 0xbd } \
- }
-
-extern EFI_GUID gUsbKeyboardLayoutPackageGuid;
-extern EFI_GUID gUsbKeyboardLayoutKeyGuid;
-
-#endif
+/** @file + USB KeyBoard Layout GUIDs + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __USB_KEYBOARD_LAYOUT_GUID_H__ +#define __USB_KEYBOARD_LAYOUT_GUID_H__ + +// +// GUID for USB keyboard HII package list. +// +#define USB_KEYBOARD_LAYOUT_PACKAGE_GUID \ + { \ + 0xc0f3b43, 0x44de, 0x4907, { 0xb4, 0x78, 0x22, 0x5f, 0x6f, 0x62, 0x89, 0xdc } \ + } + +// +// GUID for USB keyboard layout +// +#define USB_KEYBOARD_LAYOUT_KEY_GUID \ + { \ + 0x3a4d7a7c, 0x18a, 0x4b42, { 0x81, 0xb3, 0xdc, 0x10, 0xe3, 0xb5, 0x91, 0xbd } \ + } + +extern EFI_GUID gUsbKeyboardLayoutPackageGuid; +extern EFI_GUID gUsbKeyboardLayoutKeyGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/VarCheckPolicyMmi.h b/MdeModulePkg/Include/Guid/VarCheckPolicyMmi.h index a692fa40c9..9e470adecd 100644 --- a/MdeModulePkg/Include/Guid/VarCheckPolicyMmi.h +++ b/MdeModulePkg/Include/Guid/VarCheckPolicyMmi.h @@ -1,83 +1,83 @@ -/** @file -- VarCheckPolicyMmiCommon.h
-This header contains communication definitions that are shared between DXE
-and the MM component of VarCheckPolicy.
-
-Copyright (c) Microsoft Corporation.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef _VAR_CHECK_POLICY_MMI_COMMON_H_
-#define _VAR_CHECK_POLICY_MMI_COMMON_H_
-
-#define VAR_CHECK_POLICY_COMM_SIG SIGNATURE_32('V', 'C', 'P', 'C')
-#define VAR_CHECK_POLICY_COMM_REVISION 1
-
-#pragma pack(push, 1)
-
-typedef struct _VAR_CHECK_POLICY_COMM_HEADER {
- UINT32 Signature;
- UINT32 Revision;
- UINT32 Command;
- EFI_STATUS Result;
-} VAR_CHECK_POLICY_COMM_HEADER;
-
-typedef struct _VAR_CHECK_POLICY_COMM_IS_ENABLED_PARAMS {
- BOOLEAN State;
-} VAR_CHECK_POLICY_COMM_IS_ENABLED_PARAMS;
-
-typedef struct _VAR_CHECK_POLICY_COMM_DUMP_PARAMS {
- UINT32 PageRequested;
- UINT32 TotalSize;
- UINT32 PageSize;
- BOOLEAN HasMore;
-} VAR_CHECK_POLICY_COMM_DUMP_PARAMS;
-
-typedef union {
- VARIABLE_POLICY_ENTRY VariablePolicy;
- VARIABLE_LOCK_ON_VAR_STATE_POLICY LockOnVarStatePolicy;
-} VAR_CHECK_POLICY_OUTPUT_POLICY_ENTRY;
-
-typedef struct _VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS {
- EFI_GUID InputVendorGuid;
- UINT32 InputVariableNameSize;
- UINT32 OutputVariableNameSize;
- VAR_CHECK_POLICY_OUTPUT_POLICY_ENTRY OutputPolicyEntry;
- CHAR16 InputVariableName[1];
-} VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS;
-
-#pragma pack(pop)
-
-#define VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS_END \
- (OFFSET_OF(VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS, InputVariableName))
-
-// Make sure that we will hold at least the headers.
-#define VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE MAX((OFFSET_OF(EFI_MM_COMMUNICATE_HEADER, Data) + sizeof (VAR_CHECK_POLICY_COMM_HEADER) + EFI_PAGES_TO_SIZE(1)), EFI_PAGES_TO_SIZE(4))
-#define VAR_CHECK_POLICY_MM_DUMP_BUFFER_SIZE (VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE - \
- (OFFSET_OF(EFI_MM_COMMUNICATE_HEADER, Data) + \
- sizeof(VAR_CHECK_POLICY_COMM_HEADER) + \
- sizeof(VAR_CHECK_POLICY_COMM_DUMP_PARAMS)))
-
-#define VAR_CHECK_POLICY_MM_GET_INFO_BUFFER_SIZE (VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE - \
- (OFFSET_OF(EFI_MM_COMMUNICATE_HEADER, Data) + \
- sizeof(VAR_CHECK_POLICY_COMM_HEADER) + \
- OFFSET_OF(VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS, InputVariableName)))
-
-STATIC_ASSERT (
- VAR_CHECK_POLICY_MM_DUMP_BUFFER_SIZE < VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE,
- "an integer underflow may have occurred calculating VAR_CHECK_POLICY_MM_DUMP_BUFFER_SIZE"
- );
-
-STATIC_ASSERT (
- VAR_CHECK_POLICY_MM_GET_INFO_BUFFER_SIZE < VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE,
- "an integer underflow may have occurred calculating VAR_CHECK_POLICY_MM_GET_INFO_BUFFER_SIZE"
- );
-
-#define VAR_CHECK_POLICY_COMMAND_DISABLE 0x0001
-#define VAR_CHECK_POLICY_COMMAND_IS_ENABLED 0x0002
-#define VAR_CHECK_POLICY_COMMAND_REGISTER 0x0003
-#define VAR_CHECK_POLICY_COMMAND_DUMP 0x0004
-#define VAR_CHECK_POLICY_COMMAND_LOCK 0x0005
-#define VAR_CHECK_POLICY_COMMAND_GET_INFO 0x0006
-#define VAR_CHECK_POLICY_COMMAND_GET_LOCK_VAR_STATE_INFO 0x0007
-
-#endif // _VAR_CHECK_POLICY_MMI_COMMON_H_
+/** @file -- VarCheckPolicyMmiCommon.h +This header contains communication definitions that are shared between DXE +and the MM component of VarCheckPolicy. + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef _VAR_CHECK_POLICY_MMI_COMMON_H_ +#define _VAR_CHECK_POLICY_MMI_COMMON_H_ + +#define VAR_CHECK_POLICY_COMM_SIG SIGNATURE_32('V', 'C', 'P', 'C') +#define VAR_CHECK_POLICY_COMM_REVISION 1 + +#pragma pack(push, 1) + +typedef struct _VAR_CHECK_POLICY_COMM_HEADER { + UINT32 Signature; + UINT32 Revision; + UINT32 Command; + EFI_STATUS Result; +} VAR_CHECK_POLICY_COMM_HEADER; + +typedef struct _VAR_CHECK_POLICY_COMM_IS_ENABLED_PARAMS { + BOOLEAN State; +} VAR_CHECK_POLICY_COMM_IS_ENABLED_PARAMS; + +typedef struct _VAR_CHECK_POLICY_COMM_DUMP_PARAMS { + UINT32 PageRequested; + UINT32 TotalSize; + UINT32 PageSize; + BOOLEAN HasMore; +} VAR_CHECK_POLICY_COMM_DUMP_PARAMS; + +typedef union { + VARIABLE_POLICY_ENTRY VariablePolicy; + VARIABLE_LOCK_ON_VAR_STATE_POLICY LockOnVarStatePolicy; +} VAR_CHECK_POLICY_OUTPUT_POLICY_ENTRY; + +typedef struct _VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS { + EFI_GUID InputVendorGuid; + UINT32 InputVariableNameSize; + UINT32 OutputVariableNameSize; + VAR_CHECK_POLICY_OUTPUT_POLICY_ENTRY OutputPolicyEntry; + CHAR16 InputVariableName[1]; +} VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS; + +#pragma pack(pop) + +#define VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS_END \ + (OFFSET_OF(VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS, InputVariableName)) + +// Make sure that we will hold at least the headers. +#define VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE MAX((OFFSET_OF(EFI_MM_COMMUNICATE_HEADER, Data) + sizeof (VAR_CHECK_POLICY_COMM_HEADER) + EFI_PAGES_TO_SIZE(1)), EFI_PAGES_TO_SIZE(4)) +#define VAR_CHECK_POLICY_MM_DUMP_BUFFER_SIZE (VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE - \ + (OFFSET_OF(EFI_MM_COMMUNICATE_HEADER, Data) + \ + sizeof(VAR_CHECK_POLICY_COMM_HEADER) + \ + sizeof(VAR_CHECK_POLICY_COMM_DUMP_PARAMS))) + +#define VAR_CHECK_POLICY_MM_GET_INFO_BUFFER_SIZE (VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE - \ + (OFFSET_OF(EFI_MM_COMMUNICATE_HEADER, Data) + \ + sizeof(VAR_CHECK_POLICY_COMM_HEADER) + \ + OFFSET_OF(VAR_CHECK_POLICY_COMM_GET_INFO_PARAMS, InputVariableName))) + +STATIC_ASSERT ( + VAR_CHECK_POLICY_MM_DUMP_BUFFER_SIZE < VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE, + "an integer underflow may have occurred calculating VAR_CHECK_POLICY_MM_DUMP_BUFFER_SIZE" + ); + +STATIC_ASSERT ( + VAR_CHECK_POLICY_MM_GET_INFO_BUFFER_SIZE < VAR_CHECK_POLICY_MM_COMM_BUFFER_SIZE, + "an integer underflow may have occurred calculating VAR_CHECK_POLICY_MM_GET_INFO_BUFFER_SIZE" + ); + +#define VAR_CHECK_POLICY_COMMAND_DISABLE 0x0001 +#define VAR_CHECK_POLICY_COMMAND_IS_ENABLED 0x0002 +#define VAR_CHECK_POLICY_COMMAND_REGISTER 0x0003 +#define VAR_CHECK_POLICY_COMMAND_DUMP 0x0004 +#define VAR_CHECK_POLICY_COMMAND_LOCK 0x0005 +#define VAR_CHECK_POLICY_COMMAND_GET_INFO 0x0006 +#define VAR_CHECK_POLICY_COMMAND_GET_LOCK_VAR_STATE_INFO 0x0007 + +#endif // _VAR_CHECK_POLICY_MMI_COMMON_H_ diff --git a/MdeModulePkg/Include/Guid/VarErrorFlag.h b/MdeModulePkg/Include/Guid/VarErrorFlag.h index e59ad79283..2b3d806009 100644 --- a/MdeModulePkg/Include/Guid/VarErrorFlag.h +++ b/MdeModulePkg/Include/Guid/VarErrorFlag.h @@ -1,34 +1,34 @@ -/** @file
- Variable error flag definitions.
-
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _VARIABLE_ERROR_FLAG_H_
-#define _VARIABLE_ERROR_FLAG_H_
-
-//
-// Before EndOfDxe, the variable indicates the last boot variable error flag,
-// then it means the last boot variable error flag must be got before EndOfDxe.
-// After EndOfDxe, the variable indicates the current boot variable error flag,
-// then it means the current boot variable error flag must be got after EndOfDxe.
-//
-// If the variable is not present, it has the same meaning with VAR_ERROR_FLAG_NO_ERROR.
-//
-#define VAR_ERROR_FLAG_NAME L"VarErrorFlag"
-
-#define VAR_ERROR_FLAG_NO_ERROR 0xFF // 1111-1111
-#define VAR_ERROR_FLAG_SYSTEM_ERROR 0xEF // 1110-1111
-#define VAR_ERROR_FLAG_USER_ERROR 0xFE // 1111-1110
-
-typedef UINT8 VAR_ERROR_FLAG;
-
-#define EDKII_VAR_ERROR_FLAG_GUID {\
- 0x4b37fe8, 0xf6ae, 0x480b, { 0xbd, 0xd5, 0x37, 0xd9, 0x8c, 0x5e, 0x89, 0xaa } \
-};
-
-extern EFI_GUID gEdkiiVarErrorFlagGuid;
-
-#endif
+/** @file + Variable error flag definitions. + + Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _VARIABLE_ERROR_FLAG_H_ +#define _VARIABLE_ERROR_FLAG_H_ + +// +// Before EndOfDxe, the variable indicates the last boot variable error flag, +// then it means the last boot variable error flag must be got before EndOfDxe. +// After EndOfDxe, the variable indicates the current boot variable error flag, +// then it means the current boot variable error flag must be got after EndOfDxe. +// +// If the variable is not present, it has the same meaning with VAR_ERROR_FLAG_NO_ERROR. +// +#define VAR_ERROR_FLAG_NAME L"VarErrorFlag" + +#define VAR_ERROR_FLAG_NO_ERROR 0xFF // 1111-1111 +#define VAR_ERROR_FLAG_SYSTEM_ERROR 0xEF // 1110-1111 +#define VAR_ERROR_FLAG_USER_ERROR 0xFE // 1111-1110 + +typedef UINT8 VAR_ERROR_FLAG; + +#define EDKII_VAR_ERROR_FLAG_GUID {\ + 0x4b37fe8, 0xf6ae, 0x480b, { 0xbd, 0xd5, 0x37, 0xd9, 0x8c, 0x5e, 0x89, 0xaa } \ +}; + +extern EFI_GUID gEdkiiVarErrorFlagGuid; + +#endif diff --git a/MdeModulePkg/Include/Guid/VariableFlashInfo.h b/MdeModulePkg/Include/Guid/VariableFlashInfo.h index 992a0dcdd3..5d836f3ea9 100644 --- a/MdeModulePkg/Include/Guid/VariableFlashInfo.h +++ b/MdeModulePkg/Include/Guid/VariableFlashInfo.h @@ -1,111 +1,111 @@ -/** @file
- This file defines the GUID and data structure used to pass information about
- a variable store mapped on flash (i.e. a MMIO firmware volume) to the modules
- that consume that information such as the DXE and MM UEFI variable drivers.
-
- The HOB described in this file is currently optional. It is primarily provided
- to allow a platform to dynamically describe the flash information to environments
- such as Standalone MM that cannot access the prior method using dynamic PCDs.
-
- Even for platforms that use Standalone MM, if the information is only stored
- statically such as with FixedAtBuild PCDs, the HOB is not required.
-
- Every point of consumption in this package that uses the PCDs will first check
- for the HOB and use its value if present.
-
- Early modules such as the PEI UEFI variable driver might also consume this
- information. For modules such as these, that execute early in the boot flow,
- at least two approaches are possible depending on platform design.
-
- 1. If the information in the HOB exactly matches the information in the PCDs,
- (i.e. the HOB values are set using the PCD values), let the driver read
- the information from the PCD and produce the HOB later in boot.
-
- 2. Produce the HOB very early in boot. For example, the earliest point the HOB
- is currently consumed is in FaultTolerantWritePei. Note that FaultTolerantWritePei
- produces gEdkiiFaultTolerantWriteGuid which is a dependency for VariablePei.
-
- Therefore, attaching a NULL class library to FaultTolerantWritePei with a
- constructor that produces the HOB will guarantee it is produced before the first
- point of consumption as the constructor is executed before the module entry point.
-
- Copyright (c) Microsoft Corporation.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef VARIABLE_FLASH_INFO_H_
-#define VARIABLE_FLASH_INFO_H_
-
-#define VARIABLE_FLASH_INFO_HOB_GUID \
- { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20, 0xfc, 0x90 }}
-
-#define VARIABLE_FLASH_INFO_HOB_VERSION 1
-
-extern EFI_GUID gVariableFlashInfoHobGuid;
-
-#pragma pack (push, 1)
-
-///
-/// This structure can be used to describe UEFI variable
-/// flash information.
-///
-typedef struct {
- ///
- /// Version of this structure.
- ///
- /// Increment the value when the structure is modified.
- ///
- UINT32 Version;
- ///
- /// Reserved field.
- ///
- /// Currently reserved for natural alignment.
- ///
- UINT32 Reserved;
- ///
- /// Base address of the non-volatile variable range in the flash device.
- ///
- /// Note that this address should align with the block size requirements of the flash device.
- ///
- EFI_PHYSICAL_ADDRESS NvVariableBaseAddress;
- ///
- /// Size of the non-volatile variable range in the flash device.
- ///
- /// Note that this value should be less than or equal to FtwSpareLength to support reclaim of
- /// entire variable store area.
- /// Note that this address should align with the block size requirements of the flash device.
- ///
- UINT64 NvVariableLength;
- ///
- /// Base address of the FTW spare block range in the flash device.
- ///
- /// Note that this address should align with the block size requirements of the flash device.
- ///
- EFI_PHYSICAL_ADDRESS FtwSpareBaseAddress;
- ///
- /// Size of the FTW spare block range in the flash device.
- ///
- /// Note that this value should be greater than or equal to NvVariableLength.
- /// Note that this address should align with the block size requirements of the flash device.
- ///
- UINT64 FtwSpareLength;
- ///
- /// Base address of the FTW working block range in the flash device.
- ///
- /// Note that if FtwWorkingLength is larger than on block size, this value should be block size aligned.
- ///
- EFI_PHYSICAL_ADDRESS FtwWorkingBaseAddress;
- ///
- /// Size of the FTW working block range in the flash device.
- ///
- /// Note that if the value is less than on block size, the range should not span blocks.
- /// Note that if the value is larger than one block size, this value should be block size aligned.
- ///
- UINT64 FtwWorkingLength;
-} VARIABLE_FLASH_INFO;
-
-#pragma pack (pop)
-
-#endif
+/** @file + This file defines the GUID and data structure used to pass information about + a variable store mapped on flash (i.e. a MMIO firmware volume) to the modules + that consume that information such as the DXE and MM UEFI variable drivers. + + The HOB described in this file is currently optional. It is primarily provided + to allow a platform to dynamically describe the flash information to environments + such as Standalone MM that cannot access the prior method using dynamic PCDs. + + Even for platforms that use Standalone MM, if the information is only stored + statically such as with FixedAtBuild PCDs, the HOB is not required. + + Every point of consumption in this package that uses the PCDs will first check + for the HOB and use its value if present. + + Early modules such as the PEI UEFI variable driver might also consume this + information. For modules such as these, that execute early in the boot flow, + at least two approaches are possible depending on platform design. + + 1. If the information in the HOB exactly matches the information in the PCDs, + (i.e. the HOB values are set using the PCD values), let the driver read + the information from the PCD and produce the HOB later in boot. + + 2. Produce the HOB very early in boot. For example, the earliest point the HOB + is currently consumed is in FaultTolerantWritePei. Note that FaultTolerantWritePei + produces gEdkiiFaultTolerantWriteGuid which is a dependency for VariablePei. + + Therefore, attaching a NULL class library to FaultTolerantWritePei with a + constructor that produces the HOB will guarantee it is produced before the first + point of consumption as the constructor is executed before the module entry point. + + Copyright (c) Microsoft Corporation.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef VARIABLE_FLASH_INFO_H_ +#define VARIABLE_FLASH_INFO_H_ + +#define VARIABLE_FLASH_INFO_HOB_GUID \ + { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20, 0xfc, 0x90 }} + +#define VARIABLE_FLASH_INFO_HOB_VERSION 1 + +extern EFI_GUID gVariableFlashInfoHobGuid; + +#pragma pack (push, 1) + +/// +/// This structure can be used to describe UEFI variable +/// flash information. +/// +typedef struct { + /// + /// Version of this structure. + /// + /// Increment the value when the structure is modified. + /// + UINT32 Version; + /// + /// Reserved field. + /// + /// Currently reserved for natural alignment. + /// + UINT32 Reserved; + /// + /// Base address of the non-volatile variable range in the flash device. + /// + /// Note that this address should align with the block size requirements of the flash device. + /// + EFI_PHYSICAL_ADDRESS NvVariableBaseAddress; + /// + /// Size of the non-volatile variable range in the flash device. + /// + /// Note that this value should be less than or equal to FtwSpareLength to support reclaim of + /// entire variable store area. + /// Note that this address should align with the block size requirements of the flash device. + /// + UINT64 NvVariableLength; + /// + /// Base address of the FTW spare block range in the flash device. + /// + /// Note that this address should align with the block size requirements of the flash device. + /// + EFI_PHYSICAL_ADDRESS FtwSpareBaseAddress; + /// + /// Size of the FTW spare block range in the flash device. + /// + /// Note that this value should be greater than or equal to NvVariableLength. + /// Note that this address should align with the block size requirements of the flash device. + /// + UINT64 FtwSpareLength; + /// + /// Base address of the FTW working block range in the flash device. + /// + /// Note that if FtwWorkingLength is larger than on block size, this value should be block size aligned. + /// + EFI_PHYSICAL_ADDRESS FtwWorkingBaseAddress; + /// + /// Size of the FTW working block range in the flash device. + /// + /// Note that if the value is less than on block size, the range should not span blocks. + /// Note that if the value is larger than one block size, this value should be block size aligned. + /// + UINT64 FtwWorkingLength; +} VARIABLE_FLASH_INFO; + +#pragma pack (pop) + +#endif diff --git a/MdeModulePkg/Include/Guid/VariableFormat.h b/MdeModulePkg/Include/Guid/VariableFormat.h index 534007a710..36196067a1 100644 --- a/MdeModulePkg/Include/Guid/VariableFormat.h +++ b/MdeModulePkg/Include/Guid/VariableFormat.h @@ -1,221 +1,221 @@ -/** @file
- The variable data structures are related to EDK II-specific implementation of UEFI variables.
- VariableFormat.h defines variable data headers and variable storage region headers.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __VARIABLE_FORMAT_H__
-#define __VARIABLE_FORMAT_H__
-
-#define EFI_VARIABLE_GUID \
- { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d } }
-
-#define EFI_AUTHENTICATED_VARIABLE_GUID \
- { 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 } }
-
-extern EFI_GUID gEfiVariableGuid;
-extern EFI_GUID gEfiAuthenticatedVariableGuid;
-
-///
-/// Alignment of variable name and data, according to the architecture:
-/// * For IA-32 and Intel(R) 64 architectures: 1.
-///
-#define ALIGNMENT 1
-
-//
-// GET_PAD_SIZE calculates the miminal pad bytes needed to make the current pad size satisfy the alignment requirement.
-//
-#if (ALIGNMENT == 1)
-#define GET_PAD_SIZE(a) (0)
-#else
-#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
-#endif
-
-///
-/// Alignment of Variable Data Header in Variable Store region.
-///
-#define HEADER_ALIGNMENT 4
-#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
-
-///
-/// Status of Variable Store Region.
-///
-typedef enum {
- EfiRaw,
- EfiValid,
- EfiInvalid,
- EfiUnknown
-} VARIABLE_STORE_STATUS;
-
-#pragma pack(1)
-
-#define VARIABLE_STORE_SIGNATURE EFI_VARIABLE_GUID
-#define AUTHENTICATED_VARIABLE_STORE_SIGNATURE EFI_AUTHENTICATED_VARIABLE_GUID
-
-///
-/// Variable Store Header Format and State.
-///
-#define VARIABLE_STORE_FORMATTED 0x5a
-#define VARIABLE_STORE_HEALTHY 0xfe
-
-///
-/// Variable Store region header.
-///
-typedef struct {
- ///
- /// Variable store region signature.
- ///
- EFI_GUID Signature;
- ///
- /// Size of entire variable store,
- /// including size of variable store header but not including the size of FvHeader.
- ///
- UINT32 Size;
- ///
- /// Variable region format state.
- ///
- UINT8 Format;
- ///
- /// Variable region healthy state.
- ///
- UINT8 State;
- UINT16 Reserved;
- UINT32 Reserved1;
-} VARIABLE_STORE_HEADER;
-
-///
-/// Variable data start flag.
-///
-#define VARIABLE_DATA 0x55AA
-
-///
-/// Variable State flags.
-///
-#define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transition.
-#define VAR_DELETED 0xfd ///< Variable is obsolete.
-#define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid.
-#define VAR_ADDED 0x3f ///< Variable has been completely added.
-
-///
-/// Variable Attribute combinations.
-///
-#define VARIABLE_ATTRIBUTE_NV_BS (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)
-#define VARIABLE_ATTRIBUTE_BS_RT (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)
-#define VARIABLE_ATTRIBUTE_BS_RT_AT (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
-#define VARIABLE_ATTRIBUTE_NV_BS_RT (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_NON_VOLATILE)
-#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_HARDWARE_ERROR_RECORD)
-#define VARIABLE_ATTRIBUTE_NV_BS_RT_AT (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
-#define VARIABLE_ATTRIBUTE_AT EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS
-#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR_AT (VARIABLE_ATTRIBUTE_NV_BS_RT_HR | VARIABLE_ATTRIBUTE_AT)
-///
-/// EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and should be considered as reserved
-///
-#define VARIABLE_ATTRIBUTE_AT_AW (EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
-#define VARIABLE_ATTRIBUTE_NV_BS_RT_AW (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
-#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR_AT_AW (VARIABLE_ATTRIBUTE_NV_BS_RT_HR | VARIABLE_ATTRIBUTE_AT_AW)
-
-///
-/// Single Variable Data Header Structure.
-///
-typedef struct {
- ///
- /// Variable Data Start Flag.
- ///
- UINT16 StartId;
- ///
- /// Variable State defined above.
- ///
- UINT8 State;
- UINT8 Reserved;
- ///
- /// Attributes of variable defined in UEFI specification.
- ///
- UINT32 Attributes;
- ///
- /// Size of variable null-terminated Unicode string name.
- ///
- UINT32 NameSize;
- ///
- /// Size of the variable data without this header.
- ///
- UINT32 DataSize;
- ///
- /// A unique identifier for the vendor that produces and consumes this varaible.
- ///
- EFI_GUID VendorGuid;
-} VARIABLE_HEADER;
-
-///
-/// Single Authenticated Variable Data Header Structure.
-///
-typedef struct {
- ///
- /// Variable Data Start Flag.
- ///
- UINT16 StartId;
- ///
- /// Variable State defined above.
- ///
- UINT8 State;
- UINT8 Reserved;
- ///
- /// Attributes of variable defined in UEFI specification.
- ///
- UINT32 Attributes;
- ///
- /// Associated monotonic count value against replay attack.
- ///
- UINT64 MonotonicCount;
- ///
- /// Associated TimeStamp value against replay attack.
- ///
- EFI_TIME TimeStamp;
- ///
- /// Index of associated public key in database.
- ///
- UINT32 PubKeyIndex;
- ///
- /// Size of variable null-terminated Unicode string name.
- ///
- UINT32 NameSize;
- ///
- /// Size of the variable data without this header.
- ///
- UINT32 DataSize;
- ///
- /// A unique identifier for the vendor that produces and consumes this varaible.
- ///
- EFI_GUID VendorGuid;
-} AUTHENTICATED_VARIABLE_HEADER;
-
-typedef struct {
- EFI_GUID *Guid;
- CHAR16 *Name;
- UINTN VariableSize;
-} VARIABLE_ENTRY_CONSISTENCY;
-
-#pragma pack()
-
-typedef struct _VARIABLE_INFO_ENTRY VARIABLE_INFO_ENTRY;
-
-///
-/// This structure contains the variable list that is put in EFI system table.
-/// The variable driver collects all variables that were used at boot service time and produces this list.
-/// This is an optional feature to dump all used variables in shell environment.
-///
-struct _VARIABLE_INFO_ENTRY {
- VARIABLE_INFO_ENTRY *Next; ///< Pointer to next entry.
- EFI_GUID VendorGuid; ///< Guid of Variable.
- CHAR16 *Name; ///< Name of Variable.
- UINT32 Attributes; ///< Attributes of variable defined in UEFI specification.
- UINT32 ReadCount; ///< Number of times to read this variable.
- UINT32 WriteCount; ///< Number of times to write this variable.
- UINT32 DeleteCount; ///< Number of times to delete this variable.
- UINT32 CacheCount; ///< Number of times that cache hits this variable.
- BOOLEAN Volatile; ///< TRUE if volatile, FALSE if non-volatile.
-};
-
-#endif // _EFI_VARIABLE_H_
+/** @file + The variable data structures are related to EDK II-specific implementation of UEFI variables. + VariableFormat.h defines variable data headers and variable storage region headers. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __VARIABLE_FORMAT_H__ +#define __VARIABLE_FORMAT_H__ + +#define EFI_VARIABLE_GUID \ + { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d } } + +#define EFI_AUTHENTICATED_VARIABLE_GUID \ + { 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 } } + +extern EFI_GUID gEfiVariableGuid; +extern EFI_GUID gEfiAuthenticatedVariableGuid; + +/// +/// Alignment of variable name and data, according to the architecture: +/// * For IA-32 and Intel(R) 64 architectures: 1. +/// +#define ALIGNMENT 1 + +// +// GET_PAD_SIZE calculates the miminal pad bytes needed to make the current pad size satisfy the alignment requirement. +// +#if (ALIGNMENT == 1) +#define GET_PAD_SIZE(a) (0) +#else +#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1)) +#endif + +/// +/// Alignment of Variable Data Header in Variable Store region. +/// +#define HEADER_ALIGNMENT 4 +#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1))) + +/// +/// Status of Variable Store Region. +/// +typedef enum { + EfiRaw, + EfiValid, + EfiInvalid, + EfiUnknown +} VARIABLE_STORE_STATUS; + +#pragma pack(1) + +#define VARIABLE_STORE_SIGNATURE EFI_VARIABLE_GUID +#define AUTHENTICATED_VARIABLE_STORE_SIGNATURE EFI_AUTHENTICATED_VARIABLE_GUID + +/// +/// Variable Store Header Format and State. +/// +#define VARIABLE_STORE_FORMATTED 0x5a +#define VARIABLE_STORE_HEALTHY 0xfe + +/// +/// Variable Store region header. +/// +typedef struct { + /// + /// Variable store region signature. + /// + EFI_GUID Signature; + /// + /// Size of entire variable store, + /// including size of variable store header but not including the size of FvHeader. + /// + UINT32 Size; + /// + /// Variable region format state. + /// + UINT8 Format; + /// + /// Variable region healthy state. + /// + UINT8 State; + UINT16 Reserved; + UINT32 Reserved1; +} VARIABLE_STORE_HEADER; + +/// +/// Variable data start flag. +/// +#define VARIABLE_DATA 0x55AA + +/// +/// Variable State flags. +/// +#define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transition. +#define VAR_DELETED 0xfd ///< Variable is obsolete. +#define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid. +#define VAR_ADDED 0x3f ///< Variable has been completely added. + +/// +/// Variable Attribute combinations. +/// +#define VARIABLE_ATTRIBUTE_NV_BS (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS) +#define VARIABLE_ATTRIBUTE_BS_RT (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS) +#define VARIABLE_ATTRIBUTE_BS_RT_AT (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) +#define VARIABLE_ATTRIBUTE_NV_BS_RT (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_NON_VOLATILE) +#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_HARDWARE_ERROR_RECORD) +#define VARIABLE_ATTRIBUTE_NV_BS_RT_AT (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) +#define VARIABLE_ATTRIBUTE_AT EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS +#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR_AT (VARIABLE_ATTRIBUTE_NV_BS_RT_HR | VARIABLE_ATTRIBUTE_AT) +/// +/// EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and should be considered as reserved +/// +#define VARIABLE_ATTRIBUTE_AT_AW (EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) +#define VARIABLE_ATTRIBUTE_NV_BS_RT_AW (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) +#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR_AT_AW (VARIABLE_ATTRIBUTE_NV_BS_RT_HR | VARIABLE_ATTRIBUTE_AT_AW) + +/// +/// Single Variable Data Header Structure. +/// +typedef struct { + /// + /// Variable Data Start Flag. + /// + UINT16 StartId; + /// + /// Variable State defined above. + /// + UINT8 State; + UINT8 Reserved; + /// + /// Attributes of variable defined in UEFI specification. + /// + UINT32 Attributes; + /// + /// Size of variable null-terminated Unicode string name. + /// + UINT32 NameSize; + /// + /// Size of the variable data without this header. + /// + UINT32 DataSize; + /// + /// A unique identifier for the vendor that produces and consumes this varaible. + /// + EFI_GUID VendorGuid; +} VARIABLE_HEADER; + +/// +/// Single Authenticated Variable Data Header Structure. +/// +typedef struct { + /// + /// Variable Data Start Flag. + /// + UINT16 StartId; + /// + /// Variable State defined above. + /// + UINT8 State; + UINT8 Reserved; + /// + /// Attributes of variable defined in UEFI specification. + /// + UINT32 Attributes; + /// + /// Associated monotonic count value against replay attack. + /// + UINT64 MonotonicCount; + /// + /// Associated TimeStamp value against replay attack. + /// + EFI_TIME TimeStamp; + /// + /// Index of associated public key in database. + /// + UINT32 PubKeyIndex; + /// + /// Size of variable null-terminated Unicode string name. + /// + UINT32 NameSize; + /// + /// Size of the variable data without this header. + /// + UINT32 DataSize; + /// + /// A unique identifier for the vendor that produces and consumes this varaible. + /// + EFI_GUID VendorGuid; +} AUTHENTICATED_VARIABLE_HEADER; + +typedef struct { + EFI_GUID *Guid; + CHAR16 *Name; + UINTN VariableSize; +} VARIABLE_ENTRY_CONSISTENCY; + +#pragma pack() + +typedef struct _VARIABLE_INFO_ENTRY VARIABLE_INFO_ENTRY; + +/// +/// This structure contains the variable list that is put in EFI system table. +/// The variable driver collects all variables that were used at boot service time and produces this list. +/// This is an optional feature to dump all used variables in shell environment. +/// +struct _VARIABLE_INFO_ENTRY { + VARIABLE_INFO_ENTRY *Next; ///< Pointer to next entry. + EFI_GUID VendorGuid; ///< Guid of Variable. + CHAR16 *Name; ///< Name of Variable. + UINT32 Attributes; ///< Attributes of variable defined in UEFI specification. + UINT32 ReadCount; ///< Number of times to read this variable. + UINT32 WriteCount; ///< Number of times to write this variable. + UINT32 DeleteCount; ///< Number of times to delete this variable. + UINT32 CacheCount; ///< Number of times that cache hits this variable. + BOOLEAN Volatile; ///< TRUE if volatile, FALSE if non-volatile. +}; + +#endif // _EFI_VARIABLE_H_ diff --git a/MdeModulePkg/Include/Guid/VariableIndexTable.h b/MdeModulePkg/Include/Guid/VariableIndexTable.h index f18a5e3c43..252bc3a84d 100644 --- a/MdeModulePkg/Include/Guid/VariableIndexTable.h +++ b/MdeModulePkg/Include/Guid/VariableIndexTable.h @@ -1,41 +1,41 @@ -/** @file
- The variable data structures are related to EDK II-specific implementation of UEFI variables.
- VariableFormat.h defines variable data headers and variable storage region headers.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __VARIABLE_INDEX_TABLE_H__
-#define __VARIABLE_INDEX_TABLE_H__
-
-typedef struct {
- VARIABLE_HEADER *CurrPtr;
- VARIABLE_HEADER *EndPtr;
- VARIABLE_HEADER *StartPtr;
-} VARIABLE_POINTER_TRACK;
-
-#define VARIABLE_INDEX_TABLE_VOLUME 122
-
-#define EFI_VARIABLE_INDEX_TABLE_GUID \
- { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }
-
-extern EFI_GUID gEfiVariableIndexTableGuid;
-
-///
-/// Use this data structure to store variable-related info, which can decrease
-/// the cost of access to NV.
-///
-typedef struct {
- UINT16 Length;
- UINT16 GoneThrough;
- VARIABLE_HEADER *EndPtr;
- VARIABLE_HEADER *StartPtr;
- ///
- /// This field is used to store the distance of two neighbouring VAR_ADDED type variables.
- /// The meaning of the field is implement-dependent.
- UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];
-} VARIABLE_INDEX_TABLE;
-
-#endif // __VARIABLE_INDEX_TABLE_H__
+/** @file + The variable data structures are related to EDK II-specific implementation of UEFI variables. + VariableFormat.h defines variable data headers and variable storage region headers. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __VARIABLE_INDEX_TABLE_H__ +#define __VARIABLE_INDEX_TABLE_H__ + +typedef struct { + VARIABLE_HEADER *CurrPtr; + VARIABLE_HEADER *EndPtr; + VARIABLE_HEADER *StartPtr; +} VARIABLE_POINTER_TRACK; + +#define VARIABLE_INDEX_TABLE_VOLUME 122 + +#define EFI_VARIABLE_INDEX_TABLE_GUID \ + { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } } + +extern EFI_GUID gEfiVariableIndexTableGuid; + +/// +/// Use this data structure to store variable-related info, which can decrease +/// the cost of access to NV. +/// +typedef struct { + UINT16 Length; + UINT16 GoneThrough; + VARIABLE_HEADER *EndPtr; + VARIABLE_HEADER *StartPtr; + /// + /// This field is used to store the distance of two neighbouring VAR_ADDED type variables. + /// The meaning of the field is implement-dependent. + UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME]; +} VARIABLE_INDEX_TABLE; + +#endif // __VARIABLE_INDEX_TABLE_H__ diff --git a/MdeModulePkg/Include/Guid/ZeroGuid.h b/MdeModulePkg/Include/Guid/ZeroGuid.h index bcdca8353c..d1716e1fa8 100644 --- a/MdeModulePkg/Include/Guid/ZeroGuid.h +++ b/MdeModulePkg/Include/Guid/ZeroGuid.h @@ -1,19 +1,19 @@ -/** @file
- GUID has all zero values.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __ZERO_GUID_H__
-#define __ZERO_GUID_H__
-
-#define ZERO_GUID \
- { \
- 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} \
- }
-
-extern EFI_GUID gZeroGuid;
-
-#endif
+/** @file + GUID has all zero values. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __ZERO_GUID_H__ +#define __ZERO_GUID_H__ + +#define ZERO_GUID \ + { \ + 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} \ + } + +extern EFI_GUID gZeroGuid; + +#endif diff --git a/MdeModulePkg/Include/Library/AuthVariableLib.h b/MdeModulePkg/Include/Library/AuthVariableLib.h index 37aceba699..1f2c292902 100644 --- a/MdeModulePkg/Include/Library/AuthVariableLib.h +++ b/MdeModulePkg/Include/Library/AuthVariableLib.h @@ -1,254 +1,254 @@ -/** @file
- Provides services to initialize and process authenticated variables.
-
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _AUTH_VARIABLE_LIB_H_
-#define _AUTH_VARIABLE_LIB_H_
-
-#include <Protocol/VarCheck.h>
-
-///
-/// Size of AuthInfo prior to the data payload.
-///
-#define AUTHINFO_SIZE ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION, AuthInfo)) +\
- (OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)) + \
- sizeof (EFI_CERT_BLOCK_RSA_2048_SHA256))
-
-#define AUTHINFO2_SIZE(VarAuth2) ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo)) +\
- (UINTN) ((EFI_VARIABLE_AUTHENTICATION_2 *) (VarAuth2))->AuthInfo.Hdr.dwLength)
-
-#define OFFSET_OF_AUTHINFO2_CERT_DATA ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo)) +\
- (OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)))
-
-typedef struct {
- CHAR16 *VariableName;
- EFI_GUID *VendorGuid;
- UINT32 Attributes;
- UINTN DataSize;
- VOID *Data;
- UINT32 PubKeyIndex;
- UINT64 MonotonicCount;
- EFI_TIME *TimeStamp;
-} AUTH_VARIABLE_INFO;
-
-/**
- Finds variable in storage blocks of volatile and non-volatile storage areas.
-
- This code finds variable in storage blocks of volatile and non-volatile storage areas.
- If VariableName is an empty string, then we just return the first
- qualified variable without comparing VariableName and VendorGuid.
-
- @param[in] VariableName Name of the variable to be found.
- @param[in] VendorGuid Variable vendor GUID to be found.
- @param[out] AuthVariableInfo Pointer to AUTH_VARIABLE_INFO structure for
- output of the variable found.
-
- @retval EFI_INVALID_PARAMETER If VariableName is not an empty string,
- while VendorGuid is NULL.
- @retval EFI_SUCCESS Variable successfully found.
- @retval EFI_NOT_FOUND Variable not found
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *AUTH_VAR_LIB_FIND_VARIABLE)(
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT AUTH_VARIABLE_INFO *AuthVariableInfo
- );
-
-/**
- Finds next variable in storage blocks of volatile and non-volatile storage areas.
-
- This code finds next variable in storage blocks of volatile and non-volatile storage areas.
- If VariableName is an empty string, then we just return the first
- qualified variable without comparing VariableName and VendorGuid.
-
- @param[in] VariableName Name of the variable to be found.
- @param[in] VendorGuid Variable vendor GUID to be found.
- @param[out] AuthVariableInfo Pointer to AUTH_VARIABLE_INFO structure for
- output of the next variable.
-
- @retval EFI_INVALID_PARAMETER If VariableName is not an empty string,
- while VendorGuid is NULL.
- @retval EFI_SUCCESS Variable successfully found.
- @retval EFI_NOT_FOUND Variable not found
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *AUTH_VAR_LIB_FIND_NEXT_VARIABLE)(
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT AUTH_VARIABLE_INFO *AuthVariableInfo
- );
-
-/**
- Update the variable region with Variable information.
-
- @param[in] AuthVariableInfo Pointer AUTH_VARIABLE_INFO structure for
- input of the variable.
-
- @retval EFI_SUCCESS The update operation is success.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_WRITE_PROTECTED Variable is write-protected.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *AUTH_VAR_LIB_UPDATE_VARIABLE)(
- IN AUTH_VARIABLE_INFO *AuthVariableInfo
- );
-
-/**
- Get scratch buffer.
-
- @param[in, out] ScratchBufferSize Scratch buffer size. If input size is greater than
- the maximum supported buffer size, this value contains
- the maximum supported buffer size as output.
- @param[out] ScratchBuffer Pointer to scratch buffer address.
-
- @retval EFI_SUCCESS Get scratch buffer successfully.
- @retval EFI_UNSUPPORTED If input size is greater than the maximum supported buffer size.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *AUTH_VAR_LIB_GET_SCRATCH_BUFFER)(
- IN OUT UINTN *ScratchBufferSize,
- OUT VOID **ScratchBuffer
- );
-
-/**
- This function is to check if the remaining variable space is enough to set
- all Variables from argument list successfully. The purpose of the check
- is to keep the consistency of the Variables to be in variable storage.
-
- Note: Variables are assumed to be in same storage.
- The set sequence of Variables will be same with the sequence of VariableEntry from argument list,
- so follow the argument sequence to check the Variables.
-
- @param[in] Attributes Variable attributes for Variable entries.
- @param ... The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *.
- A NULL terminates the list. The VariableSize of
- VARIABLE_ENTRY_CONSISTENCY is the variable data size as input.
- It will be changed to variable total size as output.
-
- @retval TRUE Have enough variable space to set the Variables successfully.
- @retval FALSE No enough variable space to set the Variables successfully.
-
-**/
-typedef
-BOOLEAN
-(EFIAPI *AUTH_VAR_LIB_CHECK_REMAINING_SPACE)(
- IN UINT32 Attributes,
- ...
- );
-
-/**
- Return TRUE if at OS runtime.
-
- @retval TRUE If at OS runtime.
- @retval FALSE If at boot time.
-
-**/
-typedef
-BOOLEAN
-(EFIAPI *AUTH_VAR_LIB_AT_RUNTIME)(
- VOID
- );
-
-#define AUTH_VAR_LIB_CONTEXT_IN_STRUCT_VERSION 0x01
-
-typedef struct {
- UINTN StructVersion;
- UINTN StructSize;
- //
- // Reflect the overhead associated with the saving
- // of a single EFI authenticated variable with the exception
- // of the overhead associated with the length
- // of the string name of the EFI variable.
- //
- UINTN MaxAuthVariableSize;
- AUTH_VAR_LIB_FIND_VARIABLE FindVariable;
- AUTH_VAR_LIB_FIND_NEXT_VARIABLE FindNextVariable;
- AUTH_VAR_LIB_UPDATE_VARIABLE UpdateVariable;
- AUTH_VAR_LIB_GET_SCRATCH_BUFFER GetScratchBuffer;
- AUTH_VAR_LIB_CHECK_REMAINING_SPACE CheckRemainingSpaceForConsistency;
- AUTH_VAR_LIB_AT_RUNTIME AtRuntime;
-} AUTH_VAR_LIB_CONTEXT_IN;
-
-#define AUTH_VAR_LIB_CONTEXT_OUT_STRUCT_VERSION 0x01
-
-typedef struct {
- UINTN StructVersion;
- UINTN StructSize;
- //
- // Caller needs to set variable property for the variables.
- //
- VARIABLE_ENTRY_PROPERTY *AuthVarEntry;
- UINTN AuthVarEntryCount;
- //
- // Caller needs to ConvertPointer() for the pointers.
- //
- VOID ***AddressPointer;
- UINTN AddressPointerCount;
-} AUTH_VAR_LIB_CONTEXT_OUT;
-
-/**
- Initialization for authenticated varibale services.
- If this initialization returns error status, other APIs will not work
- and expect to be not called then.
-
- @param[in] AuthVarLibContextIn Pointer to input auth variable lib context.
- @param[out] AuthVarLibContextOut Pointer to output auth variable lib context.
-
- @retval EFI_SUCCESS Function successfully executed.
- @retval EFI_INVALID_PARAMETER If AuthVarLibContextIn == NULL or AuthVarLibContextOut == NULL.
- @retval EFI_OUT_OF_RESOURCES Fail to allocate enough resource.
- @retval EFI_UNSUPPORTED Unsupported to process authenticated variable.
-
-**/
-EFI_STATUS
-EFIAPI
-AuthVariableLibInitialize (
- IN AUTH_VAR_LIB_CONTEXT_IN *AuthVarLibContextIn,
- OUT AUTH_VAR_LIB_CONTEXT_OUT *AuthVarLibContextOut
- );
-
-/**
- Process variable with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set.
-
- @param[in] VariableName Name of the variable.
- @param[in] VendorGuid Variable vendor GUID.
- @param[in] Data Data pointer.
- @param[in] DataSize Size of Data.
- @param[in] Attributes Attribute value of the variable.
-
- @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
- defined by the Attributes.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_WRITE_PROTECTED Variable is write-protected.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource.
- @retval EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS
- set, but the AuthInfo does NOT pass the validation
- check carried out by the firmware.
- @retval EFI_UNSUPPORTED Unsupported to process authenticated variable.
-
-**/
-EFI_STATUS
-EFIAPI
-AuthVariableLibProcessVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN VOID *Data,
- IN UINTN DataSize,
- IN UINT32 Attributes
- );
-
-#endif
+/** @file + Provides services to initialize and process authenticated variables. + +Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _AUTH_VARIABLE_LIB_H_ +#define _AUTH_VARIABLE_LIB_H_ + +#include <Protocol/VarCheck.h> + +/// +/// Size of AuthInfo prior to the data payload. +/// +#define AUTHINFO_SIZE ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION, AuthInfo)) +\ + (OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)) + \ + sizeof (EFI_CERT_BLOCK_RSA_2048_SHA256)) + +#define AUTHINFO2_SIZE(VarAuth2) ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo)) +\ + (UINTN) ((EFI_VARIABLE_AUTHENTICATION_2 *) (VarAuth2))->AuthInfo.Hdr.dwLength) + +#define OFFSET_OF_AUTHINFO2_CERT_DATA ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo)) +\ + (OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData))) + +typedef struct { + CHAR16 *VariableName; + EFI_GUID *VendorGuid; + UINT32 Attributes; + UINTN DataSize; + VOID *Data; + UINT32 PubKeyIndex; + UINT64 MonotonicCount; + EFI_TIME *TimeStamp; +} AUTH_VARIABLE_INFO; + +/** + Finds variable in storage blocks of volatile and non-volatile storage areas. + + This code finds variable in storage blocks of volatile and non-volatile storage areas. + If VariableName is an empty string, then we just return the first + qualified variable without comparing VariableName and VendorGuid. + + @param[in] VariableName Name of the variable to be found. + @param[in] VendorGuid Variable vendor GUID to be found. + @param[out] AuthVariableInfo Pointer to AUTH_VARIABLE_INFO structure for + output of the variable found. + + @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, + while VendorGuid is NULL. + @retval EFI_SUCCESS Variable successfully found. + @retval EFI_NOT_FOUND Variable not found + +**/ +typedef +EFI_STATUS +(EFIAPI *AUTH_VAR_LIB_FIND_VARIABLE)( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + OUT AUTH_VARIABLE_INFO *AuthVariableInfo + ); + +/** + Finds next variable in storage blocks of volatile and non-volatile storage areas. + + This code finds next variable in storage blocks of volatile and non-volatile storage areas. + If VariableName is an empty string, then we just return the first + qualified variable without comparing VariableName and VendorGuid. + + @param[in] VariableName Name of the variable to be found. + @param[in] VendorGuid Variable vendor GUID to be found. + @param[out] AuthVariableInfo Pointer to AUTH_VARIABLE_INFO structure for + output of the next variable. + + @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, + while VendorGuid is NULL. + @retval EFI_SUCCESS Variable successfully found. + @retval EFI_NOT_FOUND Variable not found + +**/ +typedef +EFI_STATUS +(EFIAPI *AUTH_VAR_LIB_FIND_NEXT_VARIABLE)( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + OUT AUTH_VARIABLE_INFO *AuthVariableInfo + ); + +/** + Update the variable region with Variable information. + + @param[in] AuthVariableInfo Pointer AUTH_VARIABLE_INFO structure for + input of the variable. + + @retval EFI_SUCCESS The update operation is success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_WRITE_PROTECTED Variable is write-protected. + @retval EFI_OUT_OF_RESOURCES There is not enough resource. + +**/ +typedef +EFI_STATUS +(EFIAPI *AUTH_VAR_LIB_UPDATE_VARIABLE)( + IN AUTH_VARIABLE_INFO *AuthVariableInfo + ); + +/** + Get scratch buffer. + + @param[in, out] ScratchBufferSize Scratch buffer size. If input size is greater than + the maximum supported buffer size, this value contains + the maximum supported buffer size as output. + @param[out] ScratchBuffer Pointer to scratch buffer address. + + @retval EFI_SUCCESS Get scratch buffer successfully. + @retval EFI_UNSUPPORTED If input size is greater than the maximum supported buffer size. + +**/ +typedef +EFI_STATUS +(EFIAPI *AUTH_VAR_LIB_GET_SCRATCH_BUFFER)( + IN OUT UINTN *ScratchBufferSize, + OUT VOID **ScratchBuffer + ); + +/** + This function is to check if the remaining variable space is enough to set + all Variables from argument list successfully. The purpose of the check + is to keep the consistency of the Variables to be in variable storage. + + Note: Variables are assumed to be in same storage. + The set sequence of Variables will be same with the sequence of VariableEntry from argument list, + so follow the argument sequence to check the Variables. + + @param[in] Attributes Variable attributes for Variable entries. + @param ... The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *. + A NULL terminates the list. The VariableSize of + VARIABLE_ENTRY_CONSISTENCY is the variable data size as input. + It will be changed to variable total size as output. + + @retval TRUE Have enough variable space to set the Variables successfully. + @retval FALSE No enough variable space to set the Variables successfully. + +**/ +typedef +BOOLEAN +(EFIAPI *AUTH_VAR_LIB_CHECK_REMAINING_SPACE)( + IN UINT32 Attributes, + ... + ); + +/** + Return TRUE if at OS runtime. + + @retval TRUE If at OS runtime. + @retval FALSE If at boot time. + +**/ +typedef +BOOLEAN +(EFIAPI *AUTH_VAR_LIB_AT_RUNTIME)( + VOID + ); + +#define AUTH_VAR_LIB_CONTEXT_IN_STRUCT_VERSION 0x01 + +typedef struct { + UINTN StructVersion; + UINTN StructSize; + // + // Reflect the overhead associated with the saving + // of a single EFI authenticated variable with the exception + // of the overhead associated with the length + // of the string name of the EFI variable. + // + UINTN MaxAuthVariableSize; + AUTH_VAR_LIB_FIND_VARIABLE FindVariable; + AUTH_VAR_LIB_FIND_NEXT_VARIABLE FindNextVariable; + AUTH_VAR_LIB_UPDATE_VARIABLE UpdateVariable; + AUTH_VAR_LIB_GET_SCRATCH_BUFFER GetScratchBuffer; + AUTH_VAR_LIB_CHECK_REMAINING_SPACE CheckRemainingSpaceForConsistency; + AUTH_VAR_LIB_AT_RUNTIME AtRuntime; +} AUTH_VAR_LIB_CONTEXT_IN; + +#define AUTH_VAR_LIB_CONTEXT_OUT_STRUCT_VERSION 0x01 + +typedef struct { + UINTN StructVersion; + UINTN StructSize; + // + // Caller needs to set variable property for the variables. + // + VARIABLE_ENTRY_PROPERTY *AuthVarEntry; + UINTN AuthVarEntryCount; + // + // Caller needs to ConvertPointer() for the pointers. + // + VOID ***AddressPointer; + UINTN AddressPointerCount; +} AUTH_VAR_LIB_CONTEXT_OUT; + +/** + Initialization for authenticated varibale services. + If this initialization returns error status, other APIs will not work + and expect to be not called then. + + @param[in] AuthVarLibContextIn Pointer to input auth variable lib context. + @param[out] AuthVarLibContextOut Pointer to output auth variable lib context. + + @retval EFI_SUCCESS Function successfully executed. + @retval EFI_INVALID_PARAMETER If AuthVarLibContextIn == NULL or AuthVarLibContextOut == NULL. + @retval EFI_OUT_OF_RESOURCES Fail to allocate enough resource. + @retval EFI_UNSUPPORTED Unsupported to process authenticated variable. + +**/ +EFI_STATUS +EFIAPI +AuthVariableLibInitialize ( + IN AUTH_VAR_LIB_CONTEXT_IN *AuthVarLibContextIn, + OUT AUTH_VAR_LIB_CONTEXT_OUT *AuthVarLibContextOut + ); + +/** + Process variable with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set. + + @param[in] VariableName Name of the variable. + @param[in] VendorGuid Variable vendor GUID. + @param[in] Data Data pointer. + @param[in] DataSize Size of Data. + @param[in] Attributes Attribute value of the variable. + + @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as + defined by the Attributes. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_WRITE_PROTECTED Variable is write-protected. + @retval EFI_OUT_OF_RESOURCES There is not enough resource. + @retval EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS + set, but the AuthInfo does NOT pass the validation + check carried out by the firmware. + @retval EFI_UNSUPPORTED Unsupported to process authenticated variable. + +**/ +EFI_STATUS +EFIAPI +AuthVariableLibProcessVariable ( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + IN VOID *Data, + IN UINTN DataSize, + IN UINT32 Attributes + ); + +#endif diff --git a/MdeModulePkg/Include/Library/BmpSupportLib.h b/MdeModulePkg/Include/Library/BmpSupportLib.h index 3f1f4beaee..6361653d4e 100644 --- a/MdeModulePkg/Include/Library/BmpSupportLib.h +++ b/MdeModulePkg/Include/Library/BmpSupportLib.h @@ -1,89 +1,89 @@ -/** @file
-
-Provides services to convert a BMP graphics image to a GOP BLT buffer
-and to convert a GOP BLT buffer to a BMP graphics image.
-
-Copyright (c) 2016, Microsoft Corporation
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-
-All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __BMP_SUPPORT_LIB_H__
-#define __BMP_SUPPORT_LIB_H__
-
-#include <Protocol/GraphicsOutput.h>
-
-/**
- Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
- is passed in a GopBlt buffer will be allocated by this routine using
- EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it will be
- used if it is big enough.
-
- @param [in] BmpImage Pointer to BMP file.
- @param [in] BmpImageSize Number of bytes in BmpImage.
- @param [in, out] GopBlt Buffer containing GOP version of BmpImage.
- @param [in, out] GopBltSize Size of GopBlt in bytes.
- @param [out] PixelHeight Height of GopBlt/BmpImage in pixels.
- @param [out] PixelWidth Width of GopBlt/BmpImage in pixels.
-
- @retval RETURN_SUCCESS GopBlt and GopBltSize are returned.
- @retval RETURN_INVALID_PARAMETER BmpImage is NULL.
- @retval RETURN_INVALID_PARAMETER GopBlt is NULL.
- @retval RETURN_INVALID_PARAMETER GopBltSize is NULL.
- @retval RETURN_INVALID_PARAMETER PixelHeight is NULL.
- @retval RETURN_INVALID_PARAMETER PixelWidth is NULL.
- @retval RETURN_UNSUPPORTED BmpImage is not a valid *.BMP image.
- @retval RETURN_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big
- enough. The required size is returned in
- GopBltSize.
- @retval RETURN_OUT_OF_RESOURCES The GopBlt buffer could not be allocated.
-
-**/
-RETURN_STATUS
-EFIAPI
-TranslateBmpToGopBlt (
- IN VOID *BmpImage,
- IN UINTN BmpImageSize,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **GopBlt,
- IN OUT UINTN *GopBltSize,
- OUT UINTN *PixelHeight,
- OUT UINTN *PixelWidth
- );
-
-/**
- Translate a GOP blt buffer to an uncompressed 24-bit per pixel BMP graphics
- image. If a NULL BmpImage is passed in a BmpImage buffer will be allocated by
- this routine using EFI_BOOT_SERVICES.AllocatePool(). If a BmpImage buffer is
- passed in it will be used if it is big enough.
-
- @param [in] GopBlt Pointer to GOP blt buffer.
- @param [in] PixelHeight Height of GopBlt/BmpImage in pixels.
- @param [in] PixelWidth Width of GopBlt/BmpImage in pixels.
- @param [in, out] BmpImage Buffer containing BMP version of GopBlt.
- @param [in, out] BmpImageSize Size of BmpImage in bytes.
-
- @retval RETURN_SUCCESS BmpImage and BmpImageSize are returned.
- @retval RETURN_INVALID_PARAMETER GopBlt is NULL.
- @retval RETURN_INVALID_PARAMETER BmpImage is NULL.
- @retval RETURN_INVALID_PARAMETER BmpImageSize is NULL.
- @retval RETURN_UNSUPPORTED GopBlt cannot be converted to a *.BMP image.
- @retval RETURN_BUFFER_TOO_SMALL The passed in BmpImage buffer is not big
- enough. The required size is returned in
- BmpImageSize.
- @retval RETURN_OUT_OF_RESOURCES The BmpImage buffer could not be allocated.
-
-**/
-RETURN_STATUS
-EFIAPI
-TranslateGopBltToBmp (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GopBlt,
- IN UINT32 PixelHeight,
- IN UINT32 PixelWidth,
- IN OUT VOID **BmpImage,
- IN OUT UINT32 *BmpImageSize
- );
-
-#endif
+/** @file + +Provides services to convert a BMP graphics image to a GOP BLT buffer +and to convert a GOP BLT buffer to a BMP graphics image. + +Copyright (c) 2016, Microsoft Corporation +Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> + +All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __BMP_SUPPORT_LIB_H__ +#define __BMP_SUPPORT_LIB_H__ + +#include <Protocol/GraphicsOutput.h> + +/** + Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer + is passed in a GopBlt buffer will be allocated by this routine using + EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it will be + used if it is big enough. + + @param [in] BmpImage Pointer to BMP file. + @param [in] BmpImageSize Number of bytes in BmpImage. + @param [in, out] GopBlt Buffer containing GOP version of BmpImage. + @param [in, out] GopBltSize Size of GopBlt in bytes. + @param [out] PixelHeight Height of GopBlt/BmpImage in pixels. + @param [out] PixelWidth Width of GopBlt/BmpImage in pixels. + + @retval RETURN_SUCCESS GopBlt and GopBltSize are returned. + @retval RETURN_INVALID_PARAMETER BmpImage is NULL. + @retval RETURN_INVALID_PARAMETER GopBlt is NULL. + @retval RETURN_INVALID_PARAMETER GopBltSize is NULL. + @retval RETURN_INVALID_PARAMETER PixelHeight is NULL. + @retval RETURN_INVALID_PARAMETER PixelWidth is NULL. + @retval RETURN_UNSUPPORTED BmpImage is not a valid *.BMP image. + @retval RETURN_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big + enough. The required size is returned in + GopBltSize. + @retval RETURN_OUT_OF_RESOURCES The GopBlt buffer could not be allocated. + +**/ +RETURN_STATUS +EFIAPI +TranslateBmpToGopBlt ( + IN VOID *BmpImage, + IN UINTN BmpImageSize, + IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **GopBlt, + IN OUT UINTN *GopBltSize, + OUT UINTN *PixelHeight, + OUT UINTN *PixelWidth + ); + +/** + Translate a GOP blt buffer to an uncompressed 24-bit per pixel BMP graphics + image. If a NULL BmpImage is passed in a BmpImage buffer will be allocated by + this routine using EFI_BOOT_SERVICES.AllocatePool(). If a BmpImage buffer is + passed in it will be used if it is big enough. + + @param [in] GopBlt Pointer to GOP blt buffer. + @param [in] PixelHeight Height of GopBlt/BmpImage in pixels. + @param [in] PixelWidth Width of GopBlt/BmpImage in pixels. + @param [in, out] BmpImage Buffer containing BMP version of GopBlt. + @param [in, out] BmpImageSize Size of BmpImage in bytes. + + @retval RETURN_SUCCESS BmpImage and BmpImageSize are returned. + @retval RETURN_INVALID_PARAMETER GopBlt is NULL. + @retval RETURN_INVALID_PARAMETER BmpImage is NULL. + @retval RETURN_INVALID_PARAMETER BmpImageSize is NULL. + @retval RETURN_UNSUPPORTED GopBlt cannot be converted to a *.BMP image. + @retval RETURN_BUFFER_TOO_SMALL The passed in BmpImage buffer is not big + enough. The required size is returned in + BmpImageSize. + @retval RETURN_OUT_OF_RESOURCES The BmpImage buffer could not be allocated. + +**/ +RETURN_STATUS +EFIAPI +TranslateGopBltToBmp ( + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GopBlt, + IN UINT32 PixelHeight, + IN UINT32 PixelWidth, + IN OUT VOID **BmpImage, + IN OUT UINT32 *BmpImageSize + ); + +#endif diff --git a/MdeModulePkg/Include/Library/BootLogoLib.h b/MdeModulePkg/Include/Library/BootLogoLib.h index 2d6209a278..6e0017c14b 100644 --- a/MdeModulePkg/Include/Library/BootLogoLib.h +++ b/MdeModulePkg/Include/Library/BootLogoLib.h @@ -1,63 +1,63 @@ -/** @file
- This library is only intended to be used by PlatformBootManagerLib
- to show progress bar and LOGO.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _BOOT_LOGO_LIB_H_
-#define _BOOT_LOGO_LIB_H_
-
-#include <Protocol/PlatformLogo.h>
-#include <Protocol/GraphicsOutput.h>
-
-/**
- Show LOGO returned from Edkii Platform Logo protocol on all consoles.
-**/
-EFI_STATUS
-EFIAPI
-BootLogoEnableLogo (
- VOID
- );
-
-/**
- Use SystemTable ConOut to turn on video based Simple Text Out consoles. The
- Simple Text Out screens will now be synced up with all non-video output devices.
-
- @retval EFI_SUCCESS UGA devices are back in text mode and synced up.
-
-**/
-EFI_STATUS
-EFIAPI
-BootLogoDisableLogo (
- VOID
- );
-
-/**
-
- Update progress bar with title above it. It only works in Graphics mode.
-
- @param TitleForeground Foreground color for Title.
- @param TitleBackground Background color for Title.
- @param Title Title above progress bar.
- @param ProgressColor Progress bar color.
- @param Progress Progress (0-100)
- @param PreviousValue The previous value of the progress.
-
- @retval EFI_STATUS Successly update the progress bar
-
-**/
-EFI_STATUS
-EFIAPI
-BootLogoUpdateProgress (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
- IN CHAR16 *Title,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
- IN UINTN Progress,
- IN UINTN PreviousValue
- );
-
-#endif
+/** @file + This library is only intended to be used by PlatformBootManagerLib + to show progress bar and LOGO. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _BOOT_LOGO_LIB_H_ +#define _BOOT_LOGO_LIB_H_ + +#include <Protocol/PlatformLogo.h> +#include <Protocol/GraphicsOutput.h> + +/** + Show LOGO returned from Edkii Platform Logo protocol on all consoles. +**/ +EFI_STATUS +EFIAPI +BootLogoEnableLogo ( + VOID + ); + +/** + Use SystemTable ConOut to turn on video based Simple Text Out consoles. The + Simple Text Out screens will now be synced up with all non-video output devices. + + @retval EFI_SUCCESS UGA devices are back in text mode and synced up. + +**/ +EFI_STATUS +EFIAPI +BootLogoDisableLogo ( + VOID + ); + +/** + + Update progress bar with title above it. It only works in Graphics mode. + + @param TitleForeground Foreground color for Title. + @param TitleBackground Background color for Title. + @param Title Title above progress bar. + @param ProgressColor Progress bar color. + @param Progress Progress (0-100) + @param PreviousValue The previous value of the progress. + + @retval EFI_STATUS Successly update the progress bar + +**/ +EFI_STATUS +EFIAPI +BootLogoUpdateProgress ( + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground, + IN CHAR16 *Title, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor, + IN UINTN Progress, + IN UINTN PreviousValue + ); + +#endif diff --git a/MdeModulePkg/Include/Library/CapsuleLib.h b/MdeModulePkg/Include/Library/CapsuleLib.h index 92904ebfb6..66f755ba8c 100644 --- a/MdeModulePkg/Include/Library/CapsuleLib.h +++ b/MdeModulePkg/Include/Library/CapsuleLib.h @@ -1,160 +1,160 @@ -/** @file
-
- This library class defines a set of interfaces for how to process capsule image updates.
-
-Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CAPSULE_LIB_H__
-#define __CAPSULE_LIB_H__
-
-//
-// BOOLEAN Variable to indicate whether system is in the capsule on disk state.
-//
-#define COD_RELOCATION_INFO_VAR_NAME L"CodRelocationInfo"
-
-/**
- The firmware checks whether the capsule image is supported
- by the CapsuleGuid in CapsuleHeader or if there is other specific information in
- the capsule image.
-
- Caution: This function may receive untrusted input.
-
- @param CapsuleHeader Pointer to the UEFI capsule image to be checked.
-
- @retval EFI_SUCESS Input capsule is supported by firmware.
- @retval EFI_UNSUPPORTED Input capsule is not supported by the firmware.
-**/
-EFI_STATUS
-EFIAPI
-SupportCapsuleImage (
- IN EFI_CAPSULE_HEADER *CapsuleHeader
- );
-
-/**
- The firmware-specific implementation processes the capsule image
- if it recognized the format of this capsule image.
-
- Caution: This function may receive untrusted input.
-
- @param CapsuleHeader Pointer to the UEFI capsule image to be processed.
-
- @retval EFI_SUCESS Capsule Image processed successfully.
- @retval EFI_UNSUPPORTED Capsule image is not supported by the firmware.
-**/
-EFI_STATUS
-EFIAPI
-ProcessCapsuleImage (
- IN EFI_CAPSULE_HEADER *CapsuleHeader
- );
-
-/**
-
- This routine is called to process capsules.
-
- Caution: This function may receive untrusted input.
-
- The capsules reported in EFI_HOB_UEFI_CAPSULE are processed.
- If there is no EFI_HOB_UEFI_CAPSULE, this routine does nothing.
-
- This routine should be called twice in BDS.
- 1) The first call must be before EndOfDxe. The system capsules is processed.
- If device capsule FMP protocols are exposted at this time and device FMP
- capsule has zero EmbeddedDriverCount, the device capsules are processed.
- Each individual capsule result is recorded in capsule record variable.
- System may reset in this function, if reset is required by capsule and
- all capsules are processed.
- If not all capsules are processed, reset will be defered to second call.
-
- 2) The second call must be after EndOfDxe and after ConnectAll, so that all
- device capsule FMP protocols are exposed.
- The system capsules are skipped. If the device capsules are NOT processed
- in first call, they are processed here.
- Each individual capsule result is recorded in capsule record variable.
- System may reset in this function, if reset is required by capsule
- processed in first call and second call.
-
- @retval EFI_SUCCESS There is no error when processing capsules.
- @retval EFI_OUT_OF_RESOURCES No enough resource to process capsules.
-
-**/
-EFI_STATUS
-EFIAPI
-ProcessCapsules (
- VOID
- );
-
-/**
- This routine is called to check if CapsuleOnDisk flag in OsIndications Variable
- is enabled.
-
- @retval TRUE Flag is enabled
- @retval FALSE Flag is not enabled
-
-**/
-BOOLEAN
-EFIAPI
-CoDCheckCapsuleOnDiskFlag (
- VOID
- );
-
-/**
- This routine is called to clear CapsuleOnDisk flags including OsIndications and BootNext variable.
-
- @retval EFI_SUCCESS All Capsule On Disk flags are cleared
-
-**/
-EFI_STATUS
-EFIAPI
-CoDClearCapsuleOnDiskFlag (
- VOID
- );
-
-/**
- Relocate Capsule on Disk from EFI system partition.
-
- Two solution to deliver Capsule On Disk:
- Solution A: If PcdCapsuleInRamSupport is enabled, relocate Capsule On Disk to memory and call UpdateCapsule().
- Solution B: If PcdCapsuleInRamSupport is disabled, relocate Capsule On Disk to a platform-specific NV storage
- device with BlockIo protocol.
-
- Device enumeration like USB costs time, user can input MaxRetry to tell function to retry.
- Function will stall 100ms between each retry.
-
- Side Effects:
- Capsule Delivery Supported Flag in OsIndication variable and BootNext variable will be cleared.
- Solution B: Content corruption. Block IO write directly touches low level write. Orignal partitions, file
- systems of the relocation device will be corrupted.
-
- @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure
- devices like USB can get enumerated. Input 0 means no retry.
-
- @retval EFI_SUCCESS Capsule on Disk images are successfully relocated.
-
-**/
-EFI_STATUS
-EFIAPI
-CoDRelocateCapsule (
- UINTN MaxRetry
- );
-
-/**
- Remove the temp file from the root of EFI System Partition.
- Device enumeration like USB costs time, user can input MaxRetry to tell function to retry.
- Function will stall 100ms between each retry.
-
- @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure
- devices like USB can get enumerated. Input 0 means no retry.
-
- @retval EFI_SUCCESS Remove the temp file successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-CoDRemoveTempFile (
- UINTN MaxRetry
- );
-
-#endif
+/** @file + + This library class defines a set of interfaces for how to process capsule image updates. + +Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CAPSULE_LIB_H__ +#define __CAPSULE_LIB_H__ + +// +// BOOLEAN Variable to indicate whether system is in the capsule on disk state. +// +#define COD_RELOCATION_INFO_VAR_NAME L"CodRelocationInfo" + +/** + The firmware checks whether the capsule image is supported + by the CapsuleGuid in CapsuleHeader or if there is other specific information in + the capsule image. + + Caution: This function may receive untrusted input. + + @param CapsuleHeader Pointer to the UEFI capsule image to be checked. + + @retval EFI_SUCESS Input capsule is supported by firmware. + @retval EFI_UNSUPPORTED Input capsule is not supported by the firmware. +**/ +EFI_STATUS +EFIAPI +SupportCapsuleImage ( + IN EFI_CAPSULE_HEADER *CapsuleHeader + ); + +/** + The firmware-specific implementation processes the capsule image + if it recognized the format of this capsule image. + + Caution: This function may receive untrusted input. + + @param CapsuleHeader Pointer to the UEFI capsule image to be processed. + + @retval EFI_SUCESS Capsule Image processed successfully. + @retval EFI_UNSUPPORTED Capsule image is not supported by the firmware. +**/ +EFI_STATUS +EFIAPI +ProcessCapsuleImage ( + IN EFI_CAPSULE_HEADER *CapsuleHeader + ); + +/** + + This routine is called to process capsules. + + Caution: This function may receive untrusted input. + + The capsules reported in EFI_HOB_UEFI_CAPSULE are processed. + If there is no EFI_HOB_UEFI_CAPSULE, this routine does nothing. + + This routine should be called twice in BDS. + 1) The first call must be before EndOfDxe. The system capsules is processed. + If device capsule FMP protocols are exposted at this time and device FMP + capsule has zero EmbeddedDriverCount, the device capsules are processed. + Each individual capsule result is recorded in capsule record variable. + System may reset in this function, if reset is required by capsule and + all capsules are processed. + If not all capsules are processed, reset will be defered to second call. + + 2) The second call must be after EndOfDxe and after ConnectAll, so that all + device capsule FMP protocols are exposed. + The system capsules are skipped. If the device capsules are NOT processed + in first call, they are processed here. + Each individual capsule result is recorded in capsule record variable. + System may reset in this function, if reset is required by capsule + processed in first call and second call. + + @retval EFI_SUCCESS There is no error when processing capsules. + @retval EFI_OUT_OF_RESOURCES No enough resource to process capsules. + +**/ +EFI_STATUS +EFIAPI +ProcessCapsules ( + VOID + ); + +/** + This routine is called to check if CapsuleOnDisk flag in OsIndications Variable + is enabled. + + @retval TRUE Flag is enabled + @retval FALSE Flag is not enabled + +**/ +BOOLEAN +EFIAPI +CoDCheckCapsuleOnDiskFlag ( + VOID + ); + +/** + This routine is called to clear CapsuleOnDisk flags including OsIndications and BootNext variable. + + @retval EFI_SUCCESS All Capsule On Disk flags are cleared + +**/ +EFI_STATUS +EFIAPI +CoDClearCapsuleOnDiskFlag ( + VOID + ); + +/** + Relocate Capsule on Disk from EFI system partition. + + Two solution to deliver Capsule On Disk: + Solution A: If PcdCapsuleInRamSupport is enabled, relocate Capsule On Disk to memory and call UpdateCapsule(). + Solution B: If PcdCapsuleInRamSupport is disabled, relocate Capsule On Disk to a platform-specific NV storage + device with BlockIo protocol. + + Device enumeration like USB costs time, user can input MaxRetry to tell function to retry. + Function will stall 100ms between each retry. + + Side Effects: + Capsule Delivery Supported Flag in OsIndication variable and BootNext variable will be cleared. + Solution B: Content corruption. Block IO write directly touches low level write. Orignal partitions, file + systems of the relocation device will be corrupted. + + @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure + devices like USB can get enumerated. Input 0 means no retry. + + @retval EFI_SUCCESS Capsule on Disk images are successfully relocated. + +**/ +EFI_STATUS +EFIAPI +CoDRelocateCapsule ( + UINTN MaxRetry + ); + +/** + Remove the temp file from the root of EFI System Partition. + Device enumeration like USB costs time, user can input MaxRetry to tell function to retry. + Function will stall 100ms between each retry. + + @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure + devices like USB can get enumerated. Input 0 means no retry. + + @retval EFI_SUCCESS Remove the temp file successfully. + +**/ +EFI_STATUS +EFIAPI +CoDRemoveTempFile ( + UINTN MaxRetry + ); + +#endif diff --git a/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h b/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h index 94e9b20ae1..e95fc9d424 100644 --- a/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h +++ b/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h @@ -1,102 +1,102 @@ -/** @file
- CPU Exception library provides the default CPU interrupt/exception handler.
- It also provides capability to register user interrupt/exception handler.
-
- Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CPU_EXCEPTION_HANDLER_LIB_H__
-#define __CPU_EXCEPTION_HANDLER_LIB_H__
-
-#include <Ppi/VectorHandoffInfo.h>
-#include <Protocol/Cpu.h>
-
-/**
- Initializes all CPU exceptions entries and provides the default exception handlers.
-
- Caller should try to get an array of interrupt and/or exception vectors that are in use and need to
- persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.
- If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.
-
- @param[in] VectorInfo Pointer to reserved vector list.
-
- @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized
- with default exception handlers.
- @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.
- @retval EFI_UNSUPPORTED This function is not supported.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeCpuExceptionHandlers (
- IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
- );
-
-/**
- Setup separate stacks for certain exception handlers.
- If the input Buffer and BufferSize are both NULL, use global variable if possible.
-
- @param[in] Buffer Point to buffer used to separate exception stack.
- @param[in, out] BufferSize On input, it indicates the byte size of Buffer.
- If the size is not enough, the return status will
- be EFI_BUFFER_TOO_SMALL, and output BufferSize
- will be the size it needs.
-
- @retval EFI_SUCCESS The stacks are assigned successfully.
- @retval EFI_UNSUPPORTED This function is not supported.
- @retval EFI_BUFFER_TOO_SMALL This BufferSize is too small.
-**/
-EFI_STATUS
-EFIAPI
-InitializeSeparateExceptionStacks (
- IN VOID *Buffer,
- IN OUT UINTN *BufferSize
- );
-
-/**
- Registers a function to be called from the processor interrupt handler.
-
- This function registers and enables the handler specified by InterruptHandler for a processor
- interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
- handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
- The installed handler is called once for each processor interrupt or exception.
- NOTE: This function should be invoked after InitializeCpuExceptionHandlers() is invoked,
- otherwise EFI_UNSUPPORTED returned.
-
- @param[in] InterruptType Defines which interrupt or exception to hook.
- @param[in] InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
- when a processor interrupt occurs. If this parameter is NULL, then the handler
- will be uninstalled.
-
- @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
- @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
- previously installed.
- @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
- previously installed.
- @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported,
- or this function is not supported.
-**/
-EFI_STATUS
-EFIAPI
-RegisterCpuInterruptHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
- );
-
-/**
- Display processor context.
-
- @param[in] ExceptionType Exception type.
- @param[in] SystemContext Processor context to be display.
-**/
-VOID
-EFIAPI
-DumpCpuContext (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EFI_SYSTEM_CONTEXT SystemContext
- );
-
-#endif
+/** @file + CPU Exception library provides the default CPU interrupt/exception handler. + It also provides capability to register user interrupt/exception handler. + + Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CPU_EXCEPTION_HANDLER_LIB_H__ +#define __CPU_EXCEPTION_HANDLER_LIB_H__ + +#include <Ppi/VectorHandoffInfo.h> +#include <Protocol/Cpu.h> + +/** + Initializes all CPU exceptions entries and provides the default exception handlers. + + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to + persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. + + @param[in] VectorInfo Pointer to reserved vector list. + + @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized + with default exception handlers. + @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. + @retval EFI_UNSUPPORTED This function is not supported. + +**/ +EFI_STATUS +EFIAPI +InitializeCpuExceptionHandlers ( + IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL + ); + +/** + Setup separate stacks for certain exception handlers. + If the input Buffer and BufferSize are both NULL, use global variable if possible. + + @param[in] Buffer Point to buffer used to separate exception stack. + @param[in, out] BufferSize On input, it indicates the byte size of Buffer. + If the size is not enough, the return status will + be EFI_BUFFER_TOO_SMALL, and output BufferSize + will be the size it needs. + + @retval EFI_SUCCESS The stacks are assigned successfully. + @retval EFI_UNSUPPORTED This function is not supported. + @retval EFI_BUFFER_TOO_SMALL This BufferSize is too small. +**/ +EFI_STATUS +EFIAPI +InitializeSeparateExceptionStacks ( + IN VOID *Buffer, + IN OUT UINTN *BufferSize + ); + +/** + Registers a function to be called from the processor interrupt handler. + + This function registers and enables the handler specified by InterruptHandler for a processor + interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the + handler for the processor interrupt or exception type specified by InterruptType is uninstalled. + The installed handler is called once for each processor interrupt or exception. + NOTE: This function should be invoked after InitializeCpuExceptionHandlers() is invoked, + otherwise EFI_UNSUPPORTED returned. + + @param[in] InterruptType Defines which interrupt or exception to hook. + @param[in] InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called + when a processor interrupt occurs. If this parameter is NULL, then the handler + will be uninstalled. + + @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled. + @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was + previously installed. + @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not + previously installed. + @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported, + or this function is not supported. +**/ +EFI_STATUS +EFIAPI +RegisterCpuInterruptHandler ( + IN EFI_EXCEPTION_TYPE InterruptType, + IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler + ); + +/** + Display processor context. + + @param[in] ExceptionType Exception type. + @param[in] SystemContext Processor context to be display. +**/ +VOID +EFIAPI +DumpCpuContext ( + IN EFI_EXCEPTION_TYPE ExceptionType, + IN EFI_SYSTEM_CONTEXT SystemContext + ); + +#endif diff --git a/MdeModulePkg/Include/Library/CustomizedDisplayLib.h b/MdeModulePkg/Include/Library/CustomizedDisplayLib.h index 0607dd1a61..8139ae25b2 100644 --- a/MdeModulePkg/Include/Library/CustomizedDisplayLib.h +++ b/MdeModulePkg/Include/Library/CustomizedDisplayLib.h @@ -1,351 +1,351 @@ -/** @file
- This library class defines a set of interfaces to customize Display module
-
-Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CUSTOMIZED_DISPLAY_LIB_H__
-#define __CUSTOMIZED_DISPLAY_LIB_H__
-
-#include <Protocol/DisplayProtocol.h>
-
-/**
-+------------------------------------------------------------------------------+
-| Setup Page |
-+------------------------------------------------------------------------------+
-
-Statement
-Statement
-Statement
-
-
-
-
-
-+------------------------------------------------------------------------------+
-| F9=Reset to Defaults F10=Save |
-| ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Exit |
-+------------------------------------------------------------------------------+
- StatusBar
-**/
-
-/**
- This funtion defines Page Frame and Backgroud.
-
- Based on the above layout, it will be responsible for HeaderHeight, FooterHeight,
- StatusBarHeight and Backgroud. And, it will reserve Screen for Statement.
-
- @param[in] FormData Form Data to be shown in Page.
- @param[out] ScreenForStatement Screen to be used for Statement. (Prompt, Value and Help)
-
- @return Status
-**/
-EFI_STATUS
-EFIAPI
-DisplayPageFrame (
- IN FORM_DISPLAY_ENGINE_FORM *FormData,
- OUT EFI_SCREEN_DESCRIPTOR *ScreenForStatement
- );
-
-/**
- Clear Screen to the initial state.
-**/
-VOID
-EFIAPI
-ClearDisplayPage (
- VOID
- );
-
-/**
- This function updates customized key panel's help information.
- The library will prepare those Strings for the basic key, ESC, Enter, Up/Down/Left/Right, +/-.
- and arrange them in Footer panel.
-
- @param[in] FormData Form Data to be shown in Page. FormData has the highlighted statement.
- @param[in] Statement The statement current selected.
- @param[in] Selected Whether or not a tag be selected. TRUE means Enter has hit this question.
-**/
-VOID
-EFIAPI
-RefreshKeyHelp (
- IN FORM_DISPLAY_ENGINE_FORM *FormData,
- IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
- IN BOOLEAN Selected
- );
-
-/**
- Update status bar.
-
- This function updates the status bar on the bottom of menu screen. It just shows StatusBar.
- Original logic in this function should be splitted out.
-
- @param[in] MessageType The type of message to be shown. InputError or Configuration Changed.
- @param[in] State Show or Clear Message.
-**/
-VOID
-EFIAPI
-UpdateStatusBar (
- IN UINTN MessageType,
- IN BOOLEAN State
- );
-
-/**
- Create popup window.
-
- This function draws OEM/Vendor specific pop up windows.
-
- @param[out] Key User Input Key
- @param ... String to be shown in Popup. The variable argument list is terminated by a NULL.
-
-**/
-VOID
-EFIAPI
-CreateDialog (
- OUT EFI_INPUT_KEY *Key OPTIONAL,
- ...
- );
-
-/**
- Confirm how to handle the changed data.
-
- @return Action BROWSER_ACTION_SUBMIT, BROWSER_ACTION_DISCARD or other values.
-**/
-UINTN
-EFIAPI
-ConfirmDataChange (
- VOID
- );
-
-/**
- OEM specifies whether Setup exits Page by ESC key.
-
- This function customized the behavior that whether Setup exits Page so that
- system able to boot when configuration is not changed.
-
- @retval TRUE Exits FrontPage
- @retval FALSE Don't exit FrontPage.
-**/
-BOOLEAN
-EFIAPI
-FormExitPolicy (
- VOID
- );
-
-/**
- Set Timeout value for a ceratain Form to get user response.
-
- This function allows to set timeout value on a ceratain form if necessary.
- If timeout is not zero, the form will exit if user has no response in timeout.
-
- @param[in] FormData Form Data to be shown in Page
-
- @return 0 No timeout for this form.
- @return > 0 Timeout value in 100 ns units.
-**/
-UINT64
-EFIAPI
-FormExitTimeout (
- IN FORM_DISPLAY_ENGINE_FORM *FormData
- );
-
-//
-// Print Functions
-//
-
-/**
- Prints a unicode string to the default console, at
- the supplied cursor position, using L"%s" format.
-
- @param Column The cursor position to print the string at. When it is -1, use current Position.
- @param Row The cursor position to print the string at. When it is -1, use current Position.
- @param String String pointer.
-
- @return Length of string printed to the console
-
-**/
-UINTN
-EFIAPI
-PrintStringAt (
- IN UINTN Column,
- IN UINTN Row,
- IN CHAR16 *String
- );
-
-/**
- Prints a unicode string with the specified width to the default console, at
- the supplied cursor position, using L"%s" format.
-
- @param Column The cursor position to print the string at. When it is -1, use current Position.
- @param Row The cursor position to print the string at. When it is -1, use current Position.
- @param String String pointer.
- @param Width Width for String to be printed. If the print length of String < Width,
- Space char (L' ') will be used to append String.
-
- @return Length of string printed to the console
-
-**/
-UINTN
-EFIAPI
-PrintStringAtWithWidth (
- IN UINTN Column,
- IN UINTN Row,
- IN CHAR16 *String,
- IN UINTN Width
- );
-
-/**
- Prints a character to the default console, at
- the supplied cursor position, using L"%c" format.
-
- @param Column The cursor position to print the string at. When it is -1, use current Position.
- @param Row The cursor position to print the string at. When it is -1, use current Position.
- @param Character Character to print.
-
- @return Length of string printed to the console.
-
-**/
-UINTN
-EFIAPI
-PrintCharAt (
- IN UINTN Column,
- IN UINTN Row,
- CHAR16 Character
- );
-
-/**
- Clear retangle with specified text attribute.
-
- @param LeftColumn Left column of retangle.
- @param RightColumn Right column of retangle.
- @param TopRow Start row of retangle.
- @param BottomRow End row of retangle.
- @param TextAttribute The character foreground and background.
-
-**/
-VOID
-EFIAPI
-ClearLines (
- IN UINTN LeftColumn,
- IN UINTN RightColumn,
- IN UINTN TopRow,
- IN UINTN BottomRow,
- IN UINTN TextAttribute
- );
-
-//
-// Color Setting Functions
-//
-
-/**
- Get OEM/Vendor specific popup attribute colors.
-
- @retval Byte code color setting for popup color.
-**/
-UINT8
-EFIAPI
-GetPopupColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific popup attribute colors.
-
- @retval Byte code color setting for popup inverse color.
-**/
-UINT8
-EFIAPI
-GetPopupInverseColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific PickList color attribute.
-
- @retval Byte code color setting for pick list color.
-**/
-UINT8
-EFIAPI
-GetPickListColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific arrow color attribute.
-
- @retval Byte code color setting for arrow color.
-**/
-UINT8
-EFIAPI
-GetArrowColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific info text color attribute.
-
- @retval Byte code color setting for info text color.
-**/
-UINT8
-EFIAPI
-GetInfoTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific help text color attribute.
-
- @retval Byte code color setting for help text color.
-**/
-UINT8
-EFIAPI
-GetHelpTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific grayed out text color attribute.
-
- @retval Byte code color setting for grayed out text color.
-**/
-UINT8
-EFIAPI
-GetGrayedTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific highlighted text color attribute.
-
- @retval Byte code color setting for highlight text color.
-**/
-UINT8
-EFIAPI
-GetHighlightTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific field text color attribute.
-
- @retval Byte code color setting for field text color.
-**/
-UINT8
-EFIAPI
-GetFieldTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific subtitle text color attribute.
-
- @retval Byte code color setting for subtitle text color.
-**/
-UINT8
-EFIAPI
-GetSubTitleTextColor (
- VOID
- );
-
-#endif
+/** @file + This library class defines a set of interfaces to customize Display module + +Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CUSTOMIZED_DISPLAY_LIB_H__ +#define __CUSTOMIZED_DISPLAY_LIB_H__ + +#include <Protocol/DisplayProtocol.h> + +/** ++------------------------------------------------------------------------------+ +| Setup Page | ++------------------------------------------------------------------------------+ + +Statement +Statement +Statement + + + + + ++------------------------------------------------------------------------------+ +| F9=Reset to Defaults F10=Save | +| ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Exit | ++------------------------------------------------------------------------------+ + StatusBar +**/ + +/** + This funtion defines Page Frame and Backgroud. + + Based on the above layout, it will be responsible for HeaderHeight, FooterHeight, + StatusBarHeight and Backgroud. And, it will reserve Screen for Statement. + + @param[in] FormData Form Data to be shown in Page. + @param[out] ScreenForStatement Screen to be used for Statement. (Prompt, Value and Help) + + @return Status +**/ +EFI_STATUS +EFIAPI +DisplayPageFrame ( + IN FORM_DISPLAY_ENGINE_FORM *FormData, + OUT EFI_SCREEN_DESCRIPTOR *ScreenForStatement + ); + +/** + Clear Screen to the initial state. +**/ +VOID +EFIAPI +ClearDisplayPage ( + VOID + ); + +/** + This function updates customized key panel's help information. + The library will prepare those Strings for the basic key, ESC, Enter, Up/Down/Left/Right, +/-. + and arrange them in Footer panel. + + @param[in] FormData Form Data to be shown in Page. FormData has the highlighted statement. + @param[in] Statement The statement current selected. + @param[in] Selected Whether or not a tag be selected. TRUE means Enter has hit this question. +**/ +VOID +EFIAPI +RefreshKeyHelp ( + IN FORM_DISPLAY_ENGINE_FORM *FormData, + IN FORM_DISPLAY_ENGINE_STATEMENT *Statement, + IN BOOLEAN Selected + ); + +/** + Update status bar. + + This function updates the status bar on the bottom of menu screen. It just shows StatusBar. + Original logic in this function should be splitted out. + + @param[in] MessageType The type of message to be shown. InputError or Configuration Changed. + @param[in] State Show or Clear Message. +**/ +VOID +EFIAPI +UpdateStatusBar ( + IN UINTN MessageType, + IN BOOLEAN State + ); + +/** + Create popup window. + + This function draws OEM/Vendor specific pop up windows. + + @param[out] Key User Input Key + @param ... String to be shown in Popup. The variable argument list is terminated by a NULL. + +**/ +VOID +EFIAPI +CreateDialog ( + OUT EFI_INPUT_KEY *Key OPTIONAL, + ... + ); + +/** + Confirm how to handle the changed data. + + @return Action BROWSER_ACTION_SUBMIT, BROWSER_ACTION_DISCARD or other values. +**/ +UINTN +EFIAPI +ConfirmDataChange ( + VOID + ); + +/** + OEM specifies whether Setup exits Page by ESC key. + + This function customized the behavior that whether Setup exits Page so that + system able to boot when configuration is not changed. + + @retval TRUE Exits FrontPage + @retval FALSE Don't exit FrontPage. +**/ +BOOLEAN +EFIAPI +FormExitPolicy ( + VOID + ); + +/** + Set Timeout value for a ceratain Form to get user response. + + This function allows to set timeout value on a ceratain form if necessary. + If timeout is not zero, the form will exit if user has no response in timeout. + + @param[in] FormData Form Data to be shown in Page + + @return 0 No timeout for this form. + @return > 0 Timeout value in 100 ns units. +**/ +UINT64 +EFIAPI +FormExitTimeout ( + IN FORM_DISPLAY_ENGINE_FORM *FormData + ); + +// +// Print Functions +// + +/** + Prints a unicode string to the default console, at + the supplied cursor position, using L"%s" format. + + @param Column The cursor position to print the string at. When it is -1, use current Position. + @param Row The cursor position to print the string at. When it is -1, use current Position. + @param String String pointer. + + @return Length of string printed to the console + +**/ +UINTN +EFIAPI +PrintStringAt ( + IN UINTN Column, + IN UINTN Row, + IN CHAR16 *String + ); + +/** + Prints a unicode string with the specified width to the default console, at + the supplied cursor position, using L"%s" format. + + @param Column The cursor position to print the string at. When it is -1, use current Position. + @param Row The cursor position to print the string at. When it is -1, use current Position. + @param String String pointer. + @param Width Width for String to be printed. If the print length of String < Width, + Space char (L' ') will be used to append String. + + @return Length of string printed to the console + +**/ +UINTN +EFIAPI +PrintStringAtWithWidth ( + IN UINTN Column, + IN UINTN Row, + IN CHAR16 *String, + IN UINTN Width + ); + +/** + Prints a character to the default console, at + the supplied cursor position, using L"%c" format. + + @param Column The cursor position to print the string at. When it is -1, use current Position. + @param Row The cursor position to print the string at. When it is -1, use current Position. + @param Character Character to print. + + @return Length of string printed to the console. + +**/ +UINTN +EFIAPI +PrintCharAt ( + IN UINTN Column, + IN UINTN Row, + CHAR16 Character + ); + +/** + Clear retangle with specified text attribute. + + @param LeftColumn Left column of retangle. + @param RightColumn Right column of retangle. + @param TopRow Start row of retangle. + @param BottomRow End row of retangle. + @param TextAttribute The character foreground and background. + +**/ +VOID +EFIAPI +ClearLines ( + IN UINTN LeftColumn, + IN UINTN RightColumn, + IN UINTN TopRow, + IN UINTN BottomRow, + IN UINTN TextAttribute + ); + +// +// Color Setting Functions +// + +/** + Get OEM/Vendor specific popup attribute colors. + + @retval Byte code color setting for popup color. +**/ +UINT8 +EFIAPI +GetPopupColor ( + VOID + ); + +/** + Get OEM/Vendor specific popup attribute colors. + + @retval Byte code color setting for popup inverse color. +**/ +UINT8 +EFIAPI +GetPopupInverseColor ( + VOID + ); + +/** + Get OEM/Vendor specific PickList color attribute. + + @retval Byte code color setting for pick list color. +**/ +UINT8 +EFIAPI +GetPickListColor ( + VOID + ); + +/** + Get OEM/Vendor specific arrow color attribute. + + @retval Byte code color setting for arrow color. +**/ +UINT8 +EFIAPI +GetArrowColor ( + VOID + ); + +/** + Get OEM/Vendor specific info text color attribute. + + @retval Byte code color setting for info text color. +**/ +UINT8 +EFIAPI +GetInfoTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific help text color attribute. + + @retval Byte code color setting for help text color. +**/ +UINT8 +EFIAPI +GetHelpTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific grayed out text color attribute. + + @retval Byte code color setting for grayed out text color. +**/ +UINT8 +EFIAPI +GetGrayedTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific highlighted text color attribute. + + @retval Byte code color setting for highlight text color. +**/ +UINT8 +EFIAPI +GetHighlightTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific field text color attribute. + + @retval Byte code color setting for field text color. +**/ +UINT8 +EFIAPI +GetFieldTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific subtitle text color attribute. + + @retval Byte code color setting for subtitle text color. +**/ +UINT8 +EFIAPI +GetSubTitleTextColor ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/DebugAgentLib.h b/MdeModulePkg/Include/Library/DebugAgentLib.h index f44bc5c563..b5fa079c9a 100644 --- a/MdeModulePkg/Include/Library/DebugAgentLib.h +++ b/MdeModulePkg/Include/Library/DebugAgentLib.h @@ -1,96 +1,96 @@ -/** @file
- Debug Agent Library provide source-level debug capability.
-
-Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DEBUG_AGENT_LIB_H__
-#define __DEBUG_AGENT_LIB_H__
-
-#define DEBUG_AGENT_INIT_PREMEM_SEC 1
-#define DEBUG_AGENT_INIT_POSTMEM_SEC 2
-#define DEBUG_AGENT_INIT_DXE_CORE 3
-#define DEBUG_AGENT_INIT_SMM 4
-#define DEBUG_AGENT_INIT_ENTER_SMI 5
-#define DEBUG_AGENT_INIT_EXIT_SMI 6
-#define DEBUG_AGENT_INIT_S3 7
-#define DEBUG_AGENT_INIT_DXE_AP 8
-#define DEBUG_AGENT_INIT_PEI 9
-#define DEBUG_AGENT_INIT_DXE_LOAD 10
-#define DEBUG_AGENT_INIT_DXE_UNLOAD 11
-#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12
-
-//
-// Context for DEBUG_AGENT_INIT_POSTMEM_SEC
-//
-typedef struct {
- UINTN HeapMigrateOffset;
- UINTN StackMigrateOffset;
-} DEBUG_AGENT_CONTEXT_POSTMEM_SEC;
-
-/**
- Caller provided function to be invoked at the end of InitializeDebugAgent().
-
- Refer to the description for InitializeDebugAgent() for more details.
-
- @param[in] Context The first input parameter of InitializeDebugAgent().
-
-**/
-typedef
-VOID
-(EFIAPI *DEBUG_AGENT_CONTINUE)(
- IN VOID *Context
- );
-
-/**
- Initialize debug agent.
-
- This function is used to set up debug environment to support source level debugging.
- If certain Debug Agent Library instance has to save some private data in the stack,
- this function must work on the mode that doesn't return to the caller, then
- the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one
- function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is
- responsible to invoke the passing-in function at the end of InitializeDebugAgent().
-
- If the parameter Function is not NULL, Debug Agent Library instance will invoke it by
- passing in the Context to be its parameter.
-
- If Function() is NULL, Debug Agent Library instance will return after setup debug
- environment.
-
- @param[in] InitFlag Init flag is used to decide the initialize process.
- @param[in] Context Context needed according to InitFlag; it was optional.
- @param[in] Function Continue function called by debug agent library; it was
- optional.
-
-**/
-VOID
-EFIAPI
-InitializeDebugAgent (
- IN UINT32 InitFlag,
- IN VOID *Context OPTIONAL,
- IN DEBUG_AGENT_CONTINUE Function OPTIONAL
- );
-
-/**
- Enable/Disable the interrupt of debug timer and return the interrupt state
- prior to the operation.
-
- If EnableStatus is TRUE, enable the interrupt of debug timer.
- If EnableStatus is FALSE, disable the interrupt of debug timer.
-
- @param[in] EnableStatus Enable/Disable.
-
- @retval TRUE Debug timer interrupt were enabled on entry to this call.
- @retval FALSE Debug timer interrupt were disabled on entry to this call.
-
-**/
-BOOLEAN
-EFIAPI
-SaveAndSetDebugTimerInterrupt (
- IN BOOLEAN EnableStatus
- );
-
-#endif
+/** @file + Debug Agent Library provide source-level debug capability. + +Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DEBUG_AGENT_LIB_H__ +#define __DEBUG_AGENT_LIB_H__ + +#define DEBUG_AGENT_INIT_PREMEM_SEC 1 +#define DEBUG_AGENT_INIT_POSTMEM_SEC 2 +#define DEBUG_AGENT_INIT_DXE_CORE 3 +#define DEBUG_AGENT_INIT_SMM 4 +#define DEBUG_AGENT_INIT_ENTER_SMI 5 +#define DEBUG_AGENT_INIT_EXIT_SMI 6 +#define DEBUG_AGENT_INIT_S3 7 +#define DEBUG_AGENT_INIT_DXE_AP 8 +#define DEBUG_AGENT_INIT_PEI 9 +#define DEBUG_AGENT_INIT_DXE_LOAD 10 +#define DEBUG_AGENT_INIT_DXE_UNLOAD 11 +#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12 + +// +// Context for DEBUG_AGENT_INIT_POSTMEM_SEC +// +typedef struct { + UINTN HeapMigrateOffset; + UINTN StackMigrateOffset; +} DEBUG_AGENT_CONTEXT_POSTMEM_SEC; + +/** + Caller provided function to be invoked at the end of InitializeDebugAgent(). + + Refer to the description for InitializeDebugAgent() for more details. + + @param[in] Context The first input parameter of InitializeDebugAgent(). + +**/ +typedef +VOID +(EFIAPI *DEBUG_AGENT_CONTINUE)( + IN VOID *Context + ); + +/** + Initialize debug agent. + + This function is used to set up debug environment to support source level debugging. + If certain Debug Agent Library instance has to save some private data in the stack, + this function must work on the mode that doesn't return to the caller, then + the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one + function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is + responsible to invoke the passing-in function at the end of InitializeDebugAgent(). + + If the parameter Function is not NULL, Debug Agent Library instance will invoke it by + passing in the Context to be its parameter. + + If Function() is NULL, Debug Agent Library instance will return after setup debug + environment. + + @param[in] InitFlag Init flag is used to decide the initialize process. + @param[in] Context Context needed according to InitFlag; it was optional. + @param[in] Function Continue function called by debug agent library; it was + optional. + +**/ +VOID +EFIAPI +InitializeDebugAgent ( + IN UINT32 InitFlag, + IN VOID *Context OPTIONAL, + IN DEBUG_AGENT_CONTINUE Function OPTIONAL + ); + +/** + Enable/Disable the interrupt of debug timer and return the interrupt state + prior to the operation. + + If EnableStatus is TRUE, enable the interrupt of debug timer. + If EnableStatus is FALSE, disable the interrupt of debug timer. + + @param[in] EnableStatus Enable/Disable. + + @retval TRUE Debug timer interrupt were enabled on entry to this call. + @retval FALSE Debug timer interrupt were disabled on entry to this call. + +**/ +BOOLEAN +EFIAPI +SaveAndSetDebugTimerInterrupt ( + IN BOOLEAN EnableStatus + ); + +#endif diff --git a/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h b/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h index bb26241380..3fcdc0b62c 100644 --- a/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h +++ b/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h @@ -1,48 +1,48 @@ -/** @file
- Provides services to display completion progress when processing a
- firmware update that updates the firmware image in a firmware device.
- A platform may provide its own instance of this library class to custoimize
- how a user is informed of completion progress.
-
- Copyright (c) 2016, Microsoft Corporation
- Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-
- All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DISPLAY_PROGRESS_LIB__
-#define __DISPLAY_PROGRESS_LIB__
-
-#include <Protocol/GraphicsOutput.h>
-
-/**
- Indicates the current completion progress of a firmware update.
-
- @param[in] Completion A value between 0 and 100 indicating the current
- completion progress of a firmware update. This
- value must the the same or higher than previous
- calls to this service. The first call of 0 or a
- value of 0 after reaching a value of 100 resets
- the progress indicator to 0.
- @param[in] Color Color of the progress indicator. Only used when
- Completion is 0 to set the color of the progress
- indicator. If Color is NULL, then the default color
- is used.
-
- @retval EFI_SUCCESS Progress displayed successfully.
- @retval EFI_INVALID_PARAMETER Completion is not in range 0..100.
- @retval EFI_INVALID_PARAMETER Completion is less than Completion value from
- a previous call to this service.
- @retval EFI_NOT_READY The device used to indicate progress is not
- available.
-**/
-EFI_STATUS
-EFIAPI
-DisplayUpdateProgress (
- IN UINTN Completion,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *Color OPTIONAL
- );
-
-#endif
+/** @file + Provides services to display completion progress when processing a + firmware update that updates the firmware image in a firmware device. + A platform may provide its own instance of this library class to custoimize + how a user is informed of completion progress. + + Copyright (c) 2016, Microsoft Corporation + Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> + + All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DISPLAY_PROGRESS_LIB__ +#define __DISPLAY_PROGRESS_LIB__ + +#include <Protocol/GraphicsOutput.h> + +/** + Indicates the current completion progress of a firmware update. + + @param[in] Completion A value between 0 and 100 indicating the current + completion progress of a firmware update. This + value must the the same or higher than previous + calls to this service. The first call of 0 or a + value of 0 after reaching a value of 100 resets + the progress indicator to 0. + @param[in] Color Color of the progress indicator. Only used when + Completion is 0 to set the color of the progress + indicator. If Color is NULL, then the default color + is used. + + @retval EFI_SUCCESS Progress displayed successfully. + @retval EFI_INVALID_PARAMETER Completion is not in range 0..100. + @retval EFI_INVALID_PARAMETER Completion is less than Completion value from + a previous call to this service. + @retval EFI_NOT_READY The device used to indicate progress is not + available. +**/ +EFI_STATUS +EFIAPI +DisplayUpdateProgress ( + IN UINTN Completion, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *Color OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/FileExplorerLib.h b/MdeModulePkg/Include/Library/FileExplorerLib.h index 528a3cabb6..5b6a5afab3 100644 --- a/MdeModulePkg/Include/Library/FileExplorerLib.h +++ b/MdeModulePkg/Include/Library/FileExplorerLib.h @@ -1,41 +1,41 @@ -/** @file
-
- This library class defines a set of interfaces for how to do file explorer.
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __FILE_EXPLORER_LIB_H__
-#define __FILE_EXPLORER_LIB_H__
-
-#include <Protocol/FileExplorer.h>
-
-/**
- Choose a file in the specified directory.
-
- If user input NULL for the RootDirectory, will choose file in the system.
-
- If user input *File != NULL, function will return the allocate device path
- info for the choosed file, caller has to free the memory after use it.
-
- @param RootDirectory Pointer to the root directory.
- @param FileType The file type need to choose.
- @param ChooseHandler Function pointer to the extra task need to do
- after choose one file.
- @param File Return the device path for the last time chosed file.
-
- @retval EFI_SUCESS Choose the file success.
- @retval Other errors Choose the file failed.
-**/
-EFI_STATUS
-EFIAPI
-ChooseFile (
- IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory,
- IN CHAR16 *FileType OPTIONAL,
- IN CHOOSE_HANDLER ChooseHandler OPTIONAL,
- OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL
- );
-
-#endif
+/** @file + + This library class defines a set of interfaces for how to do file explorer. + +Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __FILE_EXPLORER_LIB_H__ +#define __FILE_EXPLORER_LIB_H__ + +#include <Protocol/FileExplorer.h> + +/** + Choose a file in the specified directory. + + If user input NULL for the RootDirectory, will choose file in the system. + + If user input *File != NULL, function will return the allocate device path + info for the choosed file, caller has to free the memory after use it. + + @param RootDirectory Pointer to the root directory. + @param FileType The file type need to choose. + @param ChooseHandler Function pointer to the extra task need to do + after choose one file. + @param File Return the device path for the last time chosed file. + + @retval EFI_SUCESS Choose the file success. + @retval Other errors Choose the file failed. +**/ +EFI_STATUS +EFIAPI +ChooseFile ( + IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, + IN CHAR16 *FileType OPTIONAL, + IN CHOOSE_HANDLER ChooseHandler OPTIONAL, + OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/FmpAuthenticationLib.h b/MdeModulePkg/Include/Library/FmpAuthenticationLib.h index 7b07b13984..b4ff0f49f9 100644 --- a/MdeModulePkg/Include/Library/FmpAuthenticationLib.h +++ b/MdeModulePkg/Include/Library/FmpAuthenticationLib.h @@ -1,58 +1,58 @@ -/** @file
- FMP capsule authenitcation Library.
-
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __FMP_AUTHENTICATION_LIB_H__
-#define __FMP_AUTHENTICATION_LIB_H__
-
-#include <Protocol/FirmwareManagement.h>
-
-/**
- The function is used to do the authentication for FMP capsule based upon
- EFI_FIRMWARE_IMAGE_AUTHENTICATION.
-
- The FMP capsule image should start with EFI_FIRMWARE_IMAGE_AUTHENTICATION,
- followed by the payload.
-
- If the return status is RETURN_SUCCESS, the caller may continue the rest
- FMP update process.
- If the return status is NOT RETURN_SUCCESS, the caller should stop the FMP
- update process and convert the return status to LastAttemptStatus
- to indicate that FMP update fails.
- The LastAttemptStatus can be got from ESRT table or via
- EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo().
-
- Caution: This function may receive untrusted input.
-
- @param[in] Image Points to an FMP authentication image, started from EFI_FIRMWARE_IMAGE_AUTHENTICATION.
- @param[in] ImageSize Size of the authentication image in bytes.
- @param[in] PublicKeyData The public key data used to validate the signature.
- @param[in] PublicKeyDataLength The length of the public key data.
-
- @retval RETURN_SUCCESS Authentication pass.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_SUCCESS.
- @retval RETURN_SECURITY_VIOLATION Authentication fail.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR.
- @retval RETURN_INVALID_PARAMETER The image is in an invalid format.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.
- @retval RETURN_UNSUPPORTED No Authentication handler associated with CertType.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.
- @retval RETURN_UNSUPPORTED Image or ImageSize is invalid.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.
- @retval RETURN_OUT_OF_RESOURCES No Authentication handler associated with CertType.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES.
-**/
-RETURN_STATUS
-EFIAPI
-AuthenticateFmpImage (
- IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image,
- IN UINTN ImageSize,
- IN CONST UINT8 *PublicKeyData,
- IN UINTN PublicKeyDataLength
- );
-
-#endif
+/** @file + FMP capsule authenitcation Library. + +Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __FMP_AUTHENTICATION_LIB_H__ +#define __FMP_AUTHENTICATION_LIB_H__ + +#include <Protocol/FirmwareManagement.h> + +/** + The function is used to do the authentication for FMP capsule based upon + EFI_FIRMWARE_IMAGE_AUTHENTICATION. + + The FMP capsule image should start with EFI_FIRMWARE_IMAGE_AUTHENTICATION, + followed by the payload. + + If the return status is RETURN_SUCCESS, the caller may continue the rest + FMP update process. + If the return status is NOT RETURN_SUCCESS, the caller should stop the FMP + update process and convert the return status to LastAttemptStatus + to indicate that FMP update fails. + The LastAttemptStatus can be got from ESRT table or via + EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo(). + + Caution: This function may receive untrusted input. + + @param[in] Image Points to an FMP authentication image, started from EFI_FIRMWARE_IMAGE_AUTHENTICATION. + @param[in] ImageSize Size of the authentication image in bytes. + @param[in] PublicKeyData The public key data used to validate the signature. + @param[in] PublicKeyDataLength The length of the public key data. + + @retval RETURN_SUCCESS Authentication pass. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_SUCCESS. + @retval RETURN_SECURITY_VIOLATION Authentication fail. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR. + @retval RETURN_INVALID_PARAMETER The image is in an invalid format. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT. + @retval RETURN_UNSUPPORTED No Authentication handler associated with CertType. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT. + @retval RETURN_UNSUPPORTED Image or ImageSize is invalid. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT. + @retval RETURN_OUT_OF_RESOURCES No Authentication handler associated with CertType. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES. +**/ +RETURN_STATUS +EFIAPI +AuthenticateFmpImage ( + IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image, + IN UINTN ImageSize, + IN CONST UINT8 *PublicKeyData, + IN UINTN PublicKeyDataLength + ); + +#endif diff --git a/MdeModulePkg/Include/Library/FrameBufferBltLib.h b/MdeModulePkg/Include/Library/FrameBufferBltLib.h index 326cdf0473..b6940f89a9 100644 --- a/MdeModulePkg/Include/Library/FrameBufferBltLib.h +++ b/MdeModulePkg/Include/Library/FrameBufferBltLib.h @@ -1,87 +1,87 @@ -/** @file
- Library for performing UEFI GOP Blt operations on a framebuffer
-
- Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __FRAMEBUFFER_BLT_LIB__
-#define __FRAMEBUFFER_BLT_LIB__
-
-#include <Protocol/GraphicsOutput.h>
-
-//
-// Opaque structure for the frame buffer configure.
-//
-typedef struct FRAME_BUFFER_CONFIGURE FRAME_BUFFER_CONFIGURE;
-
-/**
- Create the configuration for a video frame buffer.
-
- The configuration is returned in the caller provided buffer.
-
- @param[in] FrameBuffer Pointer to the start of the frame buffer.
- @param[in] FrameBufferInfo Describes the frame buffer characteristics.
- @param[in,out] Configure The created configuration information.
- @param[in,out] ConfigureSize Size of the configuration information.
-
- @retval RETURN_SUCCESS The configuration was successful created.
- @retval RETURN_BUFFER_TOO_SMALL The Configure is to too small. The required
- size is returned in ConfigureSize.
- @retval RETURN_UNSUPPORTED The requested mode is not supported by
- this implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-FrameBufferBltConfigure (
- IN VOID *FrameBuffer,
- IN EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *FrameBufferInfo,
- IN OUT FRAME_BUFFER_CONFIGURE *Configure,
- IN OUT UINTN *ConfigureSize
- );
-
-/**
- Performs a UEFI Graphics Output Protocol Blt operation.
-
- @param[in] Configure Pointer to a configuration which was successfully
- created by FrameBufferBltConfigure ().
- @param[in,out] BltBuffer The data to transfer to screen.
- @param[in] BltOperation The operation to perform.
- @param[in] SourceX The X coordinate of the source for BltOperation.
- @param[in] SourceY The Y coordinate of the source for BltOperation.
- @param[in] DestinationX The X coordinate of the destination for
- BltOperation.
- @param[in] DestinationY The Y coordinate of the destination for
- BltOperation.
- @param[in] Width The width of a rectangle in the blt rectangle
- in pixels.
- @param[in] Height The height of a rectangle in the blt rectangle
- in pixels.
- @param[in] Delta Not used for EfiBltVideoFill and
- EfiBltVideoToVideo operation. If a Delta of 0
- is used, the entire BltBuffer will be operated
- on. If a subrectangle of the BltBuffer is
- used, then Delta represents the number of
- bytes in a row of the BltBuffer.
-
- @retval RETURN_INVALID_PARAMETER Invalid parameter were passed in.
- @retval RETURN_SUCCESS The Blt operation was performed successfully.
-**/
-RETURN_STATUS
-EFIAPI
-FrameBufferBlt (
- IN FRAME_BUFFER_CONFIGURE *Configure,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta
- );
-
-#endif
+/** @file + Library for performing UEFI GOP Blt operations on a framebuffer + + Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __FRAMEBUFFER_BLT_LIB__ +#define __FRAMEBUFFER_BLT_LIB__ + +#include <Protocol/GraphicsOutput.h> + +// +// Opaque structure for the frame buffer configure. +// +typedef struct FRAME_BUFFER_CONFIGURE FRAME_BUFFER_CONFIGURE; + +/** + Create the configuration for a video frame buffer. + + The configuration is returned in the caller provided buffer. + + @param[in] FrameBuffer Pointer to the start of the frame buffer. + @param[in] FrameBufferInfo Describes the frame buffer characteristics. + @param[in,out] Configure The created configuration information. + @param[in,out] ConfigureSize Size of the configuration information. + + @retval RETURN_SUCCESS The configuration was successful created. + @retval RETURN_BUFFER_TOO_SMALL The Configure is to too small. The required + size is returned in ConfigureSize. + @retval RETURN_UNSUPPORTED The requested mode is not supported by + this implementaion. +**/ +RETURN_STATUS +EFIAPI +FrameBufferBltConfigure ( + IN VOID *FrameBuffer, + IN EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *FrameBufferInfo, + IN OUT FRAME_BUFFER_CONFIGURE *Configure, + IN OUT UINTN *ConfigureSize + ); + +/** + Performs a UEFI Graphics Output Protocol Blt operation. + + @param[in] Configure Pointer to a configuration which was successfully + created by FrameBufferBltConfigure (). + @param[in,out] BltBuffer The data to transfer to screen. + @param[in] BltOperation The operation to perform. + @param[in] SourceX The X coordinate of the source for BltOperation. + @param[in] SourceY The Y coordinate of the source for BltOperation. + @param[in] DestinationX The X coordinate of the destination for + BltOperation. + @param[in] DestinationY The Y coordinate of the destination for + BltOperation. + @param[in] Width The width of a rectangle in the blt rectangle + in pixels. + @param[in] Height The height of a rectangle in the blt rectangle + in pixels. + @param[in] Delta Not used for EfiBltVideoFill and + EfiBltVideoToVideo operation. If a Delta of 0 + is used, the entire BltBuffer will be operated + on. If a subrectangle of the BltBuffer is + used, then Delta represents the number of + bytes in a row of the BltBuffer. + + @retval RETURN_INVALID_PARAMETER Invalid parameter were passed in. + @retval RETURN_SUCCESS The Blt operation was performed successfully. +**/ +RETURN_STATUS +EFIAPI +FrameBufferBlt ( + IN FRAME_BUFFER_CONFIGURE *Configure, + IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, + IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, + IN UINTN SourceX, + IN UINTN SourceY, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height, + IN UINTN Delta + ); + +#endif diff --git a/MdeModulePkg/Include/Library/HiiLib.h b/MdeModulePkg/Include/Library/HiiLib.h index 2439cd0472..f521a8c9eb 100644 --- a/MdeModulePkg/Include/Library/HiiLib.h +++ b/MdeModulePkg/Include/Library/HiiLib.h @@ -1,1147 +1,1147 @@ -/** @file
- Public include file for the HII Library
-
-Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
-(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __HII_LIB_H__
-#define __HII_LIB_H__
-
-////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////
-// HiiLib Functions
-////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////
-
-/**
- Registers a list of packages in the HII Database and returns the HII Handle
- associated with that registration. If an HII Handle has already been registered
- with the same PackageListGuid and DeviceHandle, then NULL is returned. If there
- are not enough resources to perform the registration, then NULL is returned.
- If an empty list of packages is passed in, then NULL is returned. If the size of
- the list of package is 0, then NULL is returned.
-
- The variable arguments are pointers that point to package headers defined
- by UEFI VFR compiler and StringGather tool.
-
- #pragma pack (push, 1)
- typedef struct {
- UINT32 BinaryLength;
- EFI_HII_PACKAGE_HEADER PackageHeader;
- } EDKII_AUTOGEN_PACKAGES_HEADER;
- #pragma pack (pop)
-
- @param[in] PackageListGuid The GUID of the package list.
- @param[in] DeviceHandle If not NULL, the Device Handle on which
- an instance of DEVICE_PATH_PROTOCOL is installed.
- This Device Handle uniquely defines the device that
- the added packages are associated with.
- @param[in] ... The variable argument list that contains pointers
- to packages terminated by a NULL.
-
- @retval NULL An HII Handle has already been registered in the HII Database with
- the same PackageListGuid and DeviceHandle.
- @retval NULL The HII Handle could not be created.
- @retval NULL An empty list of packages was passed in.
- @retval NULL All packages are empty.
- @retval Other The HII Handle associated with the newly registered package list.
-
-**/
-EFI_HII_HANDLE
-EFIAPI
-HiiAddPackages (
- IN CONST EFI_GUID *PackageListGuid,
- IN EFI_HANDLE DeviceHandle OPTIONAL,
- ...
- )
-;
-
-/**
- Removes a package list from the HII database.
-
- If HiiHandle is NULL, then ASSERT().
- If HiiHandle is not a valid EFI_HII_HANDLE in the HII database, then ASSERT().
-
- @param[in] HiiHandle The handle that was previously registered in the HII database
-
-**/
-VOID
-EFIAPI
-HiiRemovePackages (
- IN EFI_HII_HANDLE HiiHandle
- )
-;
-
-/**
- This function creates a new string in String Package or updates an existing
- string in a String Package. If StringId is 0, then a new string is added to
- a String Package. If StringId is not zero, then a string in String Package is
- updated. If SupportedLanguages is NULL, then the string is added or updated
- for all the languages that the String Package supports. If SupportedLanguages
- is not NULL, then the string is added or updated for the set of languages
- specified by SupportedLanguages.
-
- If HiiHandle is NULL, then ASSERT().
- If String is NULL, then ASSERT().
-
- @param[in] HiiHandle A handle that was previously registered in the
- HII Database.
- @param[in] StringId If zero, then a new string is created in the
- String Package associated with HiiHandle. If
- non-zero, then the string specified by StringId
- is updated in the String Package associated
- with HiiHandle.
- @param[in] String A pointer to the Null-terminated Unicode string
- to add or update in the String Package associated
- with HiiHandle.
- @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of
- language codes. If this parameter is NULL, then
- String is added or updated in the String Package
- associated with HiiHandle for all the languages
- that the String Package supports. If this
- parameter is not NULL, then String is added
- or updated in the String Package associated with
- HiiHandle for the set of languages specified by
- SupportedLanguages. The format of
- SupportedLanguages must follow the language
- format assumed in the HII Database.
-
- @retval 0 The string could not be added or updated in the String Package.
- @retval Other The EFI_STRING_ID of the newly added or updated string.
-
-**/
-EFI_STRING_ID
-EFIAPI
-HiiSetString (
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_STRING_ID StringId OPTIONAL,
- IN CONST EFI_STRING String,
- IN CONST CHAR8 *SupportedLanguages OPTIONAL
- )
-;
-
-/**
- Retrieves a string from a string package in a specific language specified in Language
- or in the best lanaguage. See HiiGetStringEx () for the details.
-
- @param[in] HiiHandle A handle that was previously registered in the HII Database.
- @param[in] StringId The identifier of the string to retrieved from the string
- package associated with HiiHandle.
- @param[in] Language The language of the string to retrieve. If this parameter
- is NULL, then the current platform language is used. The
- format of Language must follow the language format assumed in
- the HII Database.
-
- @retval NULL The string specified by StringId is not present in the string package.
- @retval Other The string was returned.
-
-**/
-EFI_STRING
-EFIAPI
-HiiGetString (
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_STRING_ID StringId,
- IN CONST CHAR8 *Language OPTIONAL
- );
-
-/**
- Retrieves a string from a string package in a specific language or in the best
- language at discretion of this function according to the priority of languages.
- TryBestLanguage is used to get the string in the best language or in the language
- specified in Language parameter. The behavior is,
- If TryBestLanguage is TRUE, this function looks for the best language for the string.
- - If the string can not be retrieved using the specified language or the current
- platform language, then the string is retrieved from the string package in the
- first language the string package supports.
- If TryBestLanguage is FALSE, Language must be specified for retrieving the string.
-
- The returned string is allocated using AllocatePool(). The caller is responsible
- for freeing the allocated buffer using FreePool().
-
- If HiiHandle is NULL, then ASSERT().
- If StringId is 0, then ASSET.
- If TryBestLanguage is FALE and Language is NULL, then ASSERT().
-
- @param[in] HiiHandle A handle that was previously registered in the HII Database.
- @param[in] StringId The identifier of the string to retrieved from the string
- package associated with HiiHandle.
- @param[in] Language The language of the string to retrieve. If this parameter
- is NULL, then the current platform language is used. The
- format of Language must follow the language format assumed
- the HII Database.
- @param[in] TryBestLanguage If TRUE, try to get the best matching language from all
- supported languages.If FALSE, the Language must be assigned
- for the StringID.
-
- @retval NULL The string specified by StringId is not present in the string package.
- @retval Other The string was returned.
-
-**/
-EFI_STRING
-EFIAPI
-HiiGetStringEx (
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_STRING_ID StringId,
- IN CONST CHAR8 *Language OPTIONAL,
- IN BOOLEAN TryBestLanguage
- );
-
-/**
- Retrieves a string from a string package named by GUID, in the specified language.
- If the language is not specified, then a string from a string package in the
- current platform language is retrieved. If the string cannot be retrieved
- using the specified language or the current platform language, then the string
- is retrieved from the string package in the first language the string package
- supports. The returned string is allocated using AllocatePool(). The caller
- is responsible for freeing the allocated buffer using FreePool().
-
- If PackageListGuid is NULL, then ASSERT().
- If StringId is 0, then ASSERT().
-
- @param[in] PackageListGuid The GUID of a package list that was previously
- registered in the HII Database.
- @param[in] StringId The identifier of the string to retrieved from the
- string package associated with PackageListGuid.
- @param[in] Language The language of the string to retrieve. If this
- parameter is NULL, then the current platform
- language is used. The format of Language must
- follow the language format assumed in the HII Database.
-
- @retval NULL The package list specified by PackageListGuid is not present in the
- HII Database.
- @retval NULL The string specified by StringId is not present in the string package.
- @retval Other The string was returned.
-
-**/
-EFI_STRING
-EFIAPI
-HiiGetPackageString (
- IN CONST EFI_GUID *PackageListGuid,
- IN EFI_STRING_ID StringId,
- IN CONST CHAR8 *Language OPTIONAL
- )
-;
-
-/**
- Retrieves the array of all the HII Handles or the HII handles of a specific
- package list GUID in the HII Database.
- This array is terminated with a NULL HII Handle.
- This function allocates the returned array using AllocatePool().
- The caller is responsible for freeing the array with FreePool().
-
- @param[in] PackageListGuid An optional parameter that is used to request
- HII Handles associated with a specific
- Package List GUID. If this parameter is NULL,
- then all the HII Handles in the HII Database
- are returned. If this parameter is not NULL,
- then zero or more HII Handles associated with
- PackageListGuid are returned.
-
- @retval NULL No HII handles were found in the HII database
- @retval NULL The array of HII Handles could not be retrieved
- @retval Other A pointer to the NULL terminated array of HII Handles
-
-**/
-EFI_HII_HANDLE *
-EFIAPI
-HiiGetHiiHandles (
- IN CONST EFI_GUID *PackageListGuid OPTIONAL
- )
-;
-
-/**
- This function allows a caller to extract the form set opcode form the Hii Handle.
- The returned buffer is allocated using AllocatePool().The caller is responsible
- for freeing the allocated buffer using FreePool().
-
- @param Handle The HII handle.
- @param Buffer On return, points to a pointer which point to the buffer that contain the formset opcode.
- @param BufferSize On return, points to the length of the buffer.
-
- @retval EFI_OUT_OF_RESOURCES No enough memory resource is allocated.
- @retval EFI_NOT_FOUND Can't find the package data for the input Handle.
- @retval EFI_INVALID_PARAMETER The input parameters are not correct.
- @retval EFI_SUCCESS Get the formset opcode from the hii handle successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetFormSetFromHiiHandle (
- IN EFI_HII_HANDLE Handle,
- OUT EFI_IFR_FORM_SET **Buffer,
- OUT UINTN *BufferSize
- );
-
-/**
- Retrieves a pointer to a Null-terminated ASCII string containing the list
- of languages that an HII handle in the HII Database supports. The returned
- string is allocated using AllocatePool(). The caller is responsible for freeing
- the returned string using FreePool(). The format of the returned string follows
- the language format assumed in the HII Database.
-
- If HiiHandle is NULL, then ASSERT().
-
- @param[in] HiiHandle A handle that was previously registered in the HII Database.
-
- @retval NULL HiiHandle is not registered in the HII database
- @retval NULL There are not enough resources available to retrieve the supported
- languages.
- @retval NULL The list of supported languages could not be retrieved.
- @retval Other A pointer to the Null-terminated ASCII string of supported languages.
-
-**/
-CHAR8 *
-EFIAPI
-HiiGetSupportedLanguages (
- IN EFI_HII_HANDLE HiiHandle
- )
-;
-
-/**
- Allocates and returns a Null-terminated Unicode <ConfigHdr> string using routing
- information that includes a GUID, an optional Unicode string name, and a device
- path. The string returned is allocated with AllocatePool(). The caller is
- responsible for freeing the allocated string with FreePool().
-
- The format of a <ConfigHdr> is as follows:
-
- GUID=<HexCh>32&NAME=<Char>NameLength&PATH=<HexChar>DevicePathSize<Null>
-
- @param[in] Guid The pointer to an EFI_GUID that is the routing information
- GUID. Each of the 16 bytes in Guid is converted to
- a 2 Unicode character hexadecimal string. This is
- an optional parameter that may be NULL.
- @param[in] Name The pointer to a Null-terminated Unicode string that is
- the routing information NAME. This is an optional
- parameter that may be NULL. Each 16-bit Unicode
- character in Name is converted to a 4 character Unicode
- hexadecimal string.
- @param[in] DriverHandle The driver handle that supports a Device Path Protocol
- that is the routing information PATH. Each byte of
- the Device Path associated with DriverHandle is converted
- to a two (Unicode) character hexadecimal string.
-
- @retval NULL DriverHandle does not support the Device Path Protocol.
- @retval NULL DriverHandle does not support the Device Path Protocol.
- @retval Other A pointer to the Null-terminate Unicode <ConfigHdr> string
-
-**/
-EFI_STRING
-EFIAPI
-HiiConstructConfigHdr (
- IN CONST EFI_GUID *Guid OPTIONAL,
- IN CONST CHAR16 *Name OPTIONAL,
- IN EFI_HANDLE DriverHandle
- );
-
-/**
- Reset the default value specified by DefaultId to the driver
- configuration specified by the Request string.
-
- NULL request string support depends on the ExportConfig interface of
- HiiConfigRouting protocol in UEFI specification.
-
- @param Request A null-terminated Unicode string in
- <MultiConfigRequest> format. It can be NULL.
- If it is NULL, all configurations for the
- entirety of the current HII database will be reset.
- @param DefaultId Specifies the type of defaults to retrieve.
-
- @retval TRUE The default value was set successfully.
- @retval FALSE The default value was not found.
-**/
-BOOLEAN
-EFIAPI
-HiiSetToDefaults (
- IN CONST EFI_STRING Request OPTIONAL,
- IN UINT16 DefaultId
- );
-
-/**
- Validate the current configuration by parsing the IFR opcode in HII form.
-
- NULL request string support depends on the ExportConfig interface of
- HiiConfigRouting protocol in the UEFI specification.
-
- @param Request A null-terminated Unicode string in
- <MultiConfigRequest> format. It can be NULL.
- If it is NULL, all current configurations for the
- entirety of the current HII database will be validated.
-
- @retval TRUE The current configuration is valid.
- @retval FALSE The current configuration is invalid.
-**/
-BOOLEAN
-EFIAPI
-HiiValidateSettings (
- IN CONST EFI_STRING Request OPTIONAL
- );
-
-/**
- Determines if the routing data specified by GUID and NAME match a <ConfigHdr>.
-
- If ConfigHdr is NULL, then ASSERT().
-
- @param[in] ConfigHdr Either <ConfigRequest> or <ConfigResp>.
- @param[in] Guid The GUID of the storage.
- @param[in] Name The NAME of the storage.
-
- @retval TRUE Routing information matches <ConfigHdr>.
- @retval FALSE Routing information does not match <ConfigHdr>.
-
-**/
-BOOLEAN
-EFIAPI
-HiiIsConfigHdrMatch (
- IN CONST EFI_STRING ConfigHdr,
- IN CONST EFI_GUID *Guid OPTIONAL,
- IN CONST CHAR16 *Name OPTIONAL
- );
-
-/**
- Retrieves uncommitted data from the Form Browser and converts it to a binary
- buffer.
-
- @param[in] VariableGuid The pointer to an EFI_GUID structure. This is an optional
- parameter that may be NULL.
- @param[in] VariableName The pointer to a Null-terminated Unicode string. This
- is an optional parameter that may be NULL.
- @param[in] BufferSize The length in bytes of buffer to hold retrieved data.
- @param[out] Buffer The buffer of data to be updated.
-
- @retval FALSE The uncommitted data could not be retrieved.
- @retval TRUE The uncommitted data was retrieved.
-
-**/
-BOOLEAN
-EFIAPI
-HiiGetBrowserData (
- IN CONST EFI_GUID *VariableGuid OPTIONAL,
- IN CONST CHAR16 *VariableName OPTIONAL,
- IN UINTN BufferSize,
- OUT UINT8 *Buffer
- );
-
-/**
- Updates uncommitted data in the Form Browser.
-
- If Buffer is NULL, then ASSERT().
-
- @param[in] VariableGuid The pointer to an EFI_GUID structure. This is an optional
- parameter that may be NULL.
- @param[in] VariableName The pointer to a Null-terminated Unicode string. This
- is an optional parameter that may be NULL.
- @param[in] BufferSize The length, in bytes, of Buffer.
- @param[in] Buffer The buffer of data to commit.
- @param[in] RequestElement An optional field to specify which part of the
- buffer data will be send back to Browser. If NULL,
- the whole buffer of data will be committed to
- Browser.
- <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>*
-
- @retval FALSE The uncommitted data could not be updated.
- @retval TRUE The uncommitted data was updated.
-
-**/
-BOOLEAN
-EFIAPI
-HiiSetBrowserData (
- IN CONST EFI_GUID *VariableGuid OPTIONAL,
- IN CONST CHAR16 *VariableName OPTIONAL,
- IN UINTN BufferSize,
- IN CONST UINT8 *Buffer,
- IN CONST CHAR16 *RequestElement OPTIONAL
- );
-
-/////////////////////////////////////////
-/////////////////////////////////////////
-/// IFR Functions
-/////////////////////////////////////////
-/////////////////////////////////////////
-
-/**
- Returns a UINT64 value that contains bitfields for Hour, Minute, and Second.
- The lower 8-bits of Hour are placed in bits 0..7. The lower 8-bits of Minute
- are placed in bits 8..15, and the lower 8-bits of Second are placed in bits
- 16..23. This format was selected because it can be easily translated to
- an EFI_HII_TIME structure in an EFI_IFR_TYPE_VALUE union.
-
- @param Hour The hour value to be encoded.
- @param Minute The minute value to be encoded.
- @param Second The second value to be encoded.
-
- @return A 64-bit containing Hour, Minute, and Second.
-**/
-#define EFI_HII_TIME_UINT64(Hour, Minute, Second) \
- (UINT64)((Hour & 0xff) | ((Minute & 0xff) << 8) | ((Second & 0xff) << 16))
-
-/**
- Returns a UINT64 value that contains bit fields for Year, Month, and Day.
- The lower 16-bits of Year are placed in bits 0..15. The lower 8-bits of Month
- are placed in bits 16..23, and the lower 8-bits of Day are placed in bits
- 24..31. This format was selected because it can be easily translated to
- an EFI_HII_DATE structure in an EFI_IFR_TYPE_VALUE union.
-
- @param Year The year value to be encoded.
- @param Month The month value to be encoded.
- @param Day The day value to be encoded.
-
- @return A 64-bit containing Year, Month, and Day.
-**/
-#define EFI_HII_DATE_UINT64(Year, Month, Day) \
- (UINT64)((Year & 0xffff) | ((Month & 0xff) << 16) | ((Day & 0xff) << 24))
-
-/**
- Allocates and returns a new OpCode Handle. OpCode Handles must be freed with
- HiiFreeOpCodeHandle().
-
- @retval NULL There are not enough resources to allocate a new OpCode Handle.
- @retval Other A new OpCode handle.
-
-**/
-VOID *
-EFIAPI
-HiiAllocateOpCodeHandle (
- VOID
- );
-
-/**
- Frees an OpCode Handle that was previously allocated with HiiAllocateOpCodeHandle().
- When an OpCode Handle is freed, all of the opcodes associated with the OpCode
- Handle are also freed.
-
- If OpCodeHandle is NULL, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
-
-**/
-VOID
-EFIAPI
-HiiFreeOpCodeHandle (
- VOID *OpCodeHandle
- );
-
-/**
- Append raw opcodes to an OpCodeHandle.
-
- If OpCodeHandle is NULL, then ASSERT().
- If RawBuffer is NULL, then ASSERT();
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] RawBuffer The buffer of opcodes to append.
- @param[in] RawBufferSize The size, in bytes, of Buffer.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the appended opcodes.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateRawOpCodes (
- IN VOID *OpCodeHandle,
- IN UINT8 *RawBuffer,
- IN UINTN RawBufferSize
- );
-
-/**
- Create EFI_IFR_END_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
-
- @param[in] OpCodeHandle Handle to the buffer of opcodes.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateEndOpCode (
- IN VOID *OpCodeHandle
- );
-
-/**
- Create EFI_IFR_ONE_OF_OPTION_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If Type is invalid, then ASSERT().
- If Flags is invalid, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] StringId StringId for the option.
- @param[in] Flags The flags for the option.
- @param[in] Type The type for the option.
- @param[in] Value The value for the option.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateOneOfOptionOpCode (
- IN VOID *OpCodeHandle,
- IN UINT16 StringId,
- IN UINT8 Flags,
- IN UINT8 Type,
- IN UINT64 Value
- );
-
-/**
- Create EFI_IFR_DEFAULT_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If Type is invalid, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] DefaultId The DefaultId for the default.
- @param[in] Type The type for the default.
- @param[in] Value The value for the default.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateDefaultOpCode (
- IN VOID *OpCodeHandle,
- IN UINT16 DefaultId,
- IN UINT8 Type,
- IN UINT64 Value
- );
-
-/**
- Create EFI_IFR_GUID opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If Guid is NULL, then ASSERT().
- If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] Guid The pointer to EFI_GUID of this guided opcode.
- @param[in] GuidOpCode The pointer to an EFI_IFR_GUID opcode. This is an
- optional parameter that may be NULL. If this
- parameter is NULL, then the GUID extension
- region of the created opcode is filled with zeros.
- If this parameter is not NULL, then the GUID
- extension region of GuidData will be copied to
- the GUID extension region of the created opcode.
- @param[in] OpCodeSize The size, in bytes, of created opcode. This value
- must be >= sizeof(EFI_IFR_GUID).
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateGuidOpCode (
- IN VOID *OpCodeHandle,
- IN CONST EFI_GUID *Guid,
- IN CONST VOID *GuidOpCode OPTIONAL,
- IN UINTN OpCodeSize
- );
-
-/**
- Create EFI_IFR_ACTION_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The Question ID.
- @param[in] Prompt The String ID for Prompt.
- @param[in] Help The String ID for Help.
- @param[in] QuestionFlags The flags in the Question Header.
- @param[in] QuestionConfig The String ID for the configuration.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateActionOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN EFI_STRING_ID QuestionConfig
- );
-
-/**
- Create EFI_IFR_SUBTITLE_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in Flags, then ASSERT().
- If Scope > 1, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] Flags The subtitle opcode flags.
- @param[in] Scope 1 if this opcode is the beginning of a new scope.
- 0 if this opcode is within the current scope.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateSubTitleOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 Flags,
- IN UINT8 Scope
- );
-
-/**
- Create EFI_IFR_REF_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] FormId The Destination Form ID.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header
- @param[in] QuestionId Question ID.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateGotoOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_FORM_ID FormId,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN EFI_QUESTION_ID QuestionId
- );
-
-/**
- Create EFI_IFR_REF_OP, EFI_IFR_REF2_OP, EFI_IFR_REF3_OP and EFI_IFR_REF4_OP opcode.
-
- When RefDevicePath is not zero, EFI_IFR_REF4 opcode will be created.
- When RefDevicePath is zero and RefFormSetId is not NULL, EFI_IFR_REF3 opcode will be created.
- When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is not zero, EFI_IFR_REF2 opcode will be created.
- When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is zero, EFI_IFR_REF opcode will be created.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] RefFormId The Destination Form ID.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header
- @param[in] QuestionId Question ID.
- @param[in] RefQuestionId The question on the form to which this link is referring.
- If its value is zero, then the link refers to the top of the form.
- @param[in] RefFormSetId The form set to which this link is referring. If its value is NULL, and RefDevicePath is
- zero, then the link is to the current form set.
- @param[in] RefDevicePath The string identifier that specifies the string containing the text representation of
- the device path to which the form set containing the form specified by FormId.
- If its value is zero, then the link refers to the current page.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateGotoExOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_FORM_ID RefFormId,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_QUESTION_ID RefQuestionId,
- IN EFI_GUID *RefFormSetId OPTIONAL,
- IN EFI_STRING_ID RefDevicePath
- );
-
-/**
- Create EFI_IFR_CHECKBOX_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in CheckBoxFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] CheckBoxFlags The flags for checkbox opcode.
- @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateCheckBoxOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 CheckBoxFlags,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_NUMERIC_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in NumericFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] NumericFlags The flags for a numeric opcode.
- @param[in] Minimum The numeric minimum value.
- @param[in] Maximum The numeric maximum value.
- @param[in] Step The numeric step for edit.
- @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateNumericOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 NumericFlags,
- IN UINT64 Minimum,
- IN UINT64 Maximum,
- IN UINT64 Step,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_STRING_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in StringFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] StringFlags The flags for a string opcode.
- @param[in] MinSize The string minimum length.
- @param[in] MaxSize The string maximum length.
- @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateStringOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 StringFlags,
- IN UINT8 MinSize,
- IN UINT8 MaxSize,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_ONE_OF_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in OneOfFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] OneOfFlags The flags for a oneof opcode.
- @param[in] OptionsOpCodeHandle The handle for a buffer of ONE_OF_OPTION opcodes.
- @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateOneOfOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 OneOfFlags,
- IN VOID *OptionsOpCodeHandle,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_ORDERED_LIST_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in OrderedListFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] OrderedListFlags The flags for an ordered list opcode.
- @param[in] DataType The type for option value.
- @param[in] MaxContainers Maximum count for options in this ordered list
- @param[in] OptionsOpCodeHandle The handle for a buffer of ONE_OF_OPTION opcodes.
- @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateOrderedListOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 OrderedListFlags,
- IN UINT8 DataType,
- IN UINT8 MaxContainers,
- IN VOID *OptionsOpCodeHandle,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_TEXT_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
-
- @param[in] OpCodeHandle Handle to the buffer of opcodes.
- @param[in] Prompt String ID for Prompt.
- @param[in] Help String ID for Help.
- @param[in] TextTwo String ID for TextTwo.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateTextOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN EFI_STRING_ID TextTwo
- );
-
-/**
- Create EFI_IFR_DATE_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in DateFlags, then ASSERT().
-
- @param[in] OpCodeHandle Handle to the buffer of opcodes.
- @param[in] QuestionId Question ID
- @param[in] VarStoreId Storage ID, optional. If DateFlags is not
- QF_DATE_STORAGE_NORMAL, this parameter is ignored.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair, optional. If DateFlags is not
- QF_DATE_STORAGE_NORMAL, this parameter is ignored.
- @param[in] Prompt String ID for Prompt
- @param[in] Help String ID for Help
- @param[in] QuestionFlags Flags in Question Header
- @param[in] DateFlags Flags for date opcode
- @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateDateOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId OPTIONAL,
- IN UINT16 VarOffset OPTIONAL,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 DateFlags,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_TIME_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in TimeFlags, then ASSERT().
-
- @param[in] OpCodeHandle Handle to the buffer of opcodes.
- @param[in] QuestionId Question ID
- @param[in] VarStoreId Storage ID, optional. If TimeFlags is not
- QF_TIME_STORAGE_NORMAL, this parameter is ignored.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair, optional. If TimeFlags is not
- QF_TIME_STORAGE_NORMAL, this parameter is ignored.
- @param[in] Prompt String ID for Prompt
- @param[in] Help String ID for Help
- @param[in] QuestionFlags Flags in Question Header
- @param[in] TimeFlags Flags for time opcode
- @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateTimeOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId OPTIONAL,
- IN UINT16 VarOffset OPTIONAL,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 TimeFlags,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- This function updates a form that has previously been registered with the HII
- Database. This function will perform at most one update operation.
-
- The form to update is specified by Handle, FormSetGuid, and FormId. Binary
- comparisons of IFR opcodes are performed from the beginning of the form being
- updated until an IFR opcode is found that exactly matches the first IFR opcode
- specified by StartOpCodeHandle. The following rules are used to determine if
- an insert, replace, or delete operation is performed:
-
- 1) If no matches are found, then NULL is returned.
- 2) If a match is found, and EndOpCodeHandle is NULL, then all of the IFR opcodes
- from StartOpCodeHandle except the first opcode are inserted immediately after
- the matching IFR opcode in the form to be updated.
- 3) If a match is found, and EndOpCodeHandle is not NULL, then a search is made
- from the matching IFR opcode until an IFR opcode exactly matches the first
- IFR opcode specified by EndOpCodeHandle. If no match is found for the first
- IFR opcode specified by EndOpCodeHandle, then NULL is returned. If a match
- is found, then all of the IFR opcodes between the start match and the end
- match are deleted from the form being updated and all of the IFR opcodes
- from StartOpCodeHandle except the first opcode are inserted immediately after
- the matching start IFR opcode. If StartOpCcodeHandle only contains one
- IFR instruction, then the result of this operation will delete all of the IFR
- opcodes between the start end matches.
-
- If HiiHandle is NULL, then ASSERT().
- If StartOpCodeHandle is NULL, then ASSERT().
-
- @param[in] HiiHandle The HII Handle of the form to update.
- @param[in] FormSetGuid The Formset GUID of the form to update. This
- is an optional parameter that may be NULL.
- If it is NULL, all FormSet will be updated.
- @param[in] FormId The ID of the form to update.
- @param[in] StartOpCodeHandle An OpCode Handle that contains the set of IFR
- opcodes to be inserted or replaced in the form.
- The first IFR instruction in StartOpCodeHandle
- is used to find matching IFR opcode in the
- form.
- @param[in] EndOpCodeHandle An OpCcode Handle that contains the IFR opcode
- that marks the end of a replace operation in
- the form. This is an optional parameter that
- may be NULL. If it is NULL, then the IFR
- opcodes specified by StartOpCodeHandle are
- inserted into the form.
-
- @retval EFI_OUT_OF_RESOURCES Not enough memory resources are allocated.
- @retval EFI_NOT_FOUND The following cases will return EFI_NOT_FOUND:
- 1) The form specified by HiiHandle, FormSetGuid,
- and FormId could not be found in the HII Database.
- 2) No IFR opcodes in the target form match the first
- IFR opcode in StartOpCodeHandle.
- 3) EndOpCOde is not NULL, and no IFR opcodes in the
- target form following a matching start opcode match
- the first IFR opcode in EndOpCodeHandle.
- @retval EFI_SUCCESS The matched form is updated by StartOpcode.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiUpdateForm (
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_GUID *FormSetGuid OPTIONAL,
- IN EFI_FORM_ID FormId,
- IN VOID *StartOpCodeHandle,
- IN VOID *EndOpCodeHandle OPTIONAL
- );
-
-#endif
+/** @file + Public include file for the HII Library + +Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __HII_LIB_H__ +#define __HII_LIB_H__ + +//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// +// HiiLib Functions +//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// + +/** + Registers a list of packages in the HII Database and returns the HII Handle + associated with that registration. If an HII Handle has already been registered + with the same PackageListGuid and DeviceHandle, then NULL is returned. If there + are not enough resources to perform the registration, then NULL is returned. + If an empty list of packages is passed in, then NULL is returned. If the size of + the list of package is 0, then NULL is returned. + + The variable arguments are pointers that point to package headers defined + by UEFI VFR compiler and StringGather tool. + + #pragma pack (push, 1) + typedef struct { + UINT32 BinaryLength; + EFI_HII_PACKAGE_HEADER PackageHeader; + } EDKII_AUTOGEN_PACKAGES_HEADER; + #pragma pack (pop) + + @param[in] PackageListGuid The GUID of the package list. + @param[in] DeviceHandle If not NULL, the Device Handle on which + an instance of DEVICE_PATH_PROTOCOL is installed. + This Device Handle uniquely defines the device that + the added packages are associated with. + @param[in] ... The variable argument list that contains pointers + to packages terminated by a NULL. + + @retval NULL An HII Handle has already been registered in the HII Database with + the same PackageListGuid and DeviceHandle. + @retval NULL The HII Handle could not be created. + @retval NULL An empty list of packages was passed in. + @retval NULL All packages are empty. + @retval Other The HII Handle associated with the newly registered package list. + +**/ +EFI_HII_HANDLE +EFIAPI +HiiAddPackages ( + IN CONST EFI_GUID *PackageListGuid, + IN EFI_HANDLE DeviceHandle OPTIONAL, + ... + ) +; + +/** + Removes a package list from the HII database. + + If HiiHandle is NULL, then ASSERT(). + If HiiHandle is not a valid EFI_HII_HANDLE in the HII database, then ASSERT(). + + @param[in] HiiHandle The handle that was previously registered in the HII database + +**/ +VOID +EFIAPI +HiiRemovePackages ( + IN EFI_HII_HANDLE HiiHandle + ) +; + +/** + This function creates a new string in String Package or updates an existing + string in a String Package. If StringId is 0, then a new string is added to + a String Package. If StringId is not zero, then a string in String Package is + updated. If SupportedLanguages is NULL, then the string is added or updated + for all the languages that the String Package supports. If SupportedLanguages + is not NULL, then the string is added or updated for the set of languages + specified by SupportedLanguages. + + If HiiHandle is NULL, then ASSERT(). + If String is NULL, then ASSERT(). + + @param[in] HiiHandle A handle that was previously registered in the + HII Database. + @param[in] StringId If zero, then a new string is created in the + String Package associated with HiiHandle. If + non-zero, then the string specified by StringId + is updated in the String Package associated + with HiiHandle. + @param[in] String A pointer to the Null-terminated Unicode string + to add or update in the String Package associated + with HiiHandle. + @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of + language codes. If this parameter is NULL, then + String is added or updated in the String Package + associated with HiiHandle for all the languages + that the String Package supports. If this + parameter is not NULL, then String is added + or updated in the String Package associated with + HiiHandle for the set of languages specified by + SupportedLanguages. The format of + SupportedLanguages must follow the language + format assumed in the HII Database. + + @retval 0 The string could not be added or updated in the String Package. + @retval Other The EFI_STRING_ID of the newly added or updated string. + +**/ +EFI_STRING_ID +EFIAPI +HiiSetString ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID StringId OPTIONAL, + IN CONST EFI_STRING String, + IN CONST CHAR8 *SupportedLanguages OPTIONAL + ) +; + +/** + Retrieves a string from a string package in a specific language specified in Language + or in the best lanaguage. See HiiGetStringEx () for the details. + + @param[in] HiiHandle A handle that was previously registered in the HII Database. + @param[in] StringId The identifier of the string to retrieved from the string + package associated with HiiHandle. + @param[in] Language The language of the string to retrieve. If this parameter + is NULL, then the current platform language is used. The + format of Language must follow the language format assumed in + the HII Database. + + @retval NULL The string specified by StringId is not present in the string package. + @retval Other The string was returned. + +**/ +EFI_STRING +EFIAPI +HiiGetString ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID StringId, + IN CONST CHAR8 *Language OPTIONAL + ); + +/** + Retrieves a string from a string package in a specific language or in the best + language at discretion of this function according to the priority of languages. + TryBestLanguage is used to get the string in the best language or in the language + specified in Language parameter. The behavior is, + If TryBestLanguage is TRUE, this function looks for the best language for the string. + - If the string can not be retrieved using the specified language or the current + platform language, then the string is retrieved from the string package in the + first language the string package supports. + If TryBestLanguage is FALSE, Language must be specified for retrieving the string. + + The returned string is allocated using AllocatePool(). The caller is responsible + for freeing the allocated buffer using FreePool(). + + If HiiHandle is NULL, then ASSERT(). + If StringId is 0, then ASSET. + If TryBestLanguage is FALE and Language is NULL, then ASSERT(). + + @param[in] HiiHandle A handle that was previously registered in the HII Database. + @param[in] StringId The identifier of the string to retrieved from the string + package associated with HiiHandle. + @param[in] Language The language of the string to retrieve. If this parameter + is NULL, then the current platform language is used. The + format of Language must follow the language format assumed + the HII Database. + @param[in] TryBestLanguage If TRUE, try to get the best matching language from all + supported languages.If FALSE, the Language must be assigned + for the StringID. + + @retval NULL The string specified by StringId is not present in the string package. + @retval Other The string was returned. + +**/ +EFI_STRING +EFIAPI +HiiGetStringEx ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID StringId, + IN CONST CHAR8 *Language OPTIONAL, + IN BOOLEAN TryBestLanguage + ); + +/** + Retrieves a string from a string package named by GUID, in the specified language. + If the language is not specified, then a string from a string package in the + current platform language is retrieved. If the string cannot be retrieved + using the specified language or the current platform language, then the string + is retrieved from the string package in the first language the string package + supports. The returned string is allocated using AllocatePool(). The caller + is responsible for freeing the allocated buffer using FreePool(). + + If PackageListGuid is NULL, then ASSERT(). + If StringId is 0, then ASSERT(). + + @param[in] PackageListGuid The GUID of a package list that was previously + registered in the HII Database. + @param[in] StringId The identifier of the string to retrieved from the + string package associated with PackageListGuid. + @param[in] Language The language of the string to retrieve. If this + parameter is NULL, then the current platform + language is used. The format of Language must + follow the language format assumed in the HII Database. + + @retval NULL The package list specified by PackageListGuid is not present in the + HII Database. + @retval NULL The string specified by StringId is not present in the string package. + @retval Other The string was returned. + +**/ +EFI_STRING +EFIAPI +HiiGetPackageString ( + IN CONST EFI_GUID *PackageListGuid, + IN EFI_STRING_ID StringId, + IN CONST CHAR8 *Language OPTIONAL + ) +; + +/** + Retrieves the array of all the HII Handles or the HII handles of a specific + package list GUID in the HII Database. + This array is terminated with a NULL HII Handle. + This function allocates the returned array using AllocatePool(). + The caller is responsible for freeing the array with FreePool(). + + @param[in] PackageListGuid An optional parameter that is used to request + HII Handles associated with a specific + Package List GUID. If this parameter is NULL, + then all the HII Handles in the HII Database + are returned. If this parameter is not NULL, + then zero or more HII Handles associated with + PackageListGuid are returned. + + @retval NULL No HII handles were found in the HII database + @retval NULL The array of HII Handles could not be retrieved + @retval Other A pointer to the NULL terminated array of HII Handles + +**/ +EFI_HII_HANDLE * +EFIAPI +HiiGetHiiHandles ( + IN CONST EFI_GUID *PackageListGuid OPTIONAL + ) +; + +/** + This function allows a caller to extract the form set opcode form the Hii Handle. + The returned buffer is allocated using AllocatePool().The caller is responsible + for freeing the allocated buffer using FreePool(). + + @param Handle The HII handle. + @param Buffer On return, points to a pointer which point to the buffer that contain the formset opcode. + @param BufferSize On return, points to the length of the buffer. + + @retval EFI_OUT_OF_RESOURCES No enough memory resource is allocated. + @retval EFI_NOT_FOUND Can't find the package data for the input Handle. + @retval EFI_INVALID_PARAMETER The input parameters are not correct. + @retval EFI_SUCCESS Get the formset opcode from the hii handle successfully. + +**/ +EFI_STATUS +EFIAPI +HiiGetFormSetFromHiiHandle ( + IN EFI_HII_HANDLE Handle, + OUT EFI_IFR_FORM_SET **Buffer, + OUT UINTN *BufferSize + ); + +/** + Retrieves a pointer to a Null-terminated ASCII string containing the list + of languages that an HII handle in the HII Database supports. The returned + string is allocated using AllocatePool(). The caller is responsible for freeing + the returned string using FreePool(). The format of the returned string follows + the language format assumed in the HII Database. + + If HiiHandle is NULL, then ASSERT(). + + @param[in] HiiHandle A handle that was previously registered in the HII Database. + + @retval NULL HiiHandle is not registered in the HII database + @retval NULL There are not enough resources available to retrieve the supported + languages. + @retval NULL The list of supported languages could not be retrieved. + @retval Other A pointer to the Null-terminated ASCII string of supported languages. + +**/ +CHAR8 * +EFIAPI +HiiGetSupportedLanguages ( + IN EFI_HII_HANDLE HiiHandle + ) +; + +/** + Allocates and returns a Null-terminated Unicode <ConfigHdr> string using routing + information that includes a GUID, an optional Unicode string name, and a device + path. The string returned is allocated with AllocatePool(). The caller is + responsible for freeing the allocated string with FreePool(). + + The format of a <ConfigHdr> is as follows: + + GUID=<HexCh>32&NAME=<Char>NameLength&PATH=<HexChar>DevicePathSize<Null> + + @param[in] Guid The pointer to an EFI_GUID that is the routing information + GUID. Each of the 16 bytes in Guid is converted to + a 2 Unicode character hexadecimal string. This is + an optional parameter that may be NULL. + @param[in] Name The pointer to a Null-terminated Unicode string that is + the routing information NAME. This is an optional + parameter that may be NULL. Each 16-bit Unicode + character in Name is converted to a 4 character Unicode + hexadecimal string. + @param[in] DriverHandle The driver handle that supports a Device Path Protocol + that is the routing information PATH. Each byte of + the Device Path associated with DriverHandle is converted + to a two (Unicode) character hexadecimal string. + + @retval NULL DriverHandle does not support the Device Path Protocol. + @retval NULL DriverHandle does not support the Device Path Protocol. + @retval Other A pointer to the Null-terminate Unicode <ConfigHdr> string + +**/ +EFI_STRING +EFIAPI +HiiConstructConfigHdr ( + IN CONST EFI_GUID *Guid OPTIONAL, + IN CONST CHAR16 *Name OPTIONAL, + IN EFI_HANDLE DriverHandle + ); + +/** + Reset the default value specified by DefaultId to the driver + configuration specified by the Request string. + + NULL request string support depends on the ExportConfig interface of + HiiConfigRouting protocol in UEFI specification. + + @param Request A null-terminated Unicode string in + <MultiConfigRequest> format. It can be NULL. + If it is NULL, all configurations for the + entirety of the current HII database will be reset. + @param DefaultId Specifies the type of defaults to retrieve. + + @retval TRUE The default value was set successfully. + @retval FALSE The default value was not found. +**/ +BOOLEAN +EFIAPI +HiiSetToDefaults ( + IN CONST EFI_STRING Request OPTIONAL, + IN UINT16 DefaultId + ); + +/** + Validate the current configuration by parsing the IFR opcode in HII form. + + NULL request string support depends on the ExportConfig interface of + HiiConfigRouting protocol in the UEFI specification. + + @param Request A null-terminated Unicode string in + <MultiConfigRequest> format. It can be NULL. + If it is NULL, all current configurations for the + entirety of the current HII database will be validated. + + @retval TRUE The current configuration is valid. + @retval FALSE The current configuration is invalid. +**/ +BOOLEAN +EFIAPI +HiiValidateSettings ( + IN CONST EFI_STRING Request OPTIONAL + ); + +/** + Determines if the routing data specified by GUID and NAME match a <ConfigHdr>. + + If ConfigHdr is NULL, then ASSERT(). + + @param[in] ConfigHdr Either <ConfigRequest> or <ConfigResp>. + @param[in] Guid The GUID of the storage. + @param[in] Name The NAME of the storage. + + @retval TRUE Routing information matches <ConfigHdr>. + @retval FALSE Routing information does not match <ConfigHdr>. + +**/ +BOOLEAN +EFIAPI +HiiIsConfigHdrMatch ( + IN CONST EFI_STRING ConfigHdr, + IN CONST EFI_GUID *Guid OPTIONAL, + IN CONST CHAR16 *Name OPTIONAL + ); + +/** + Retrieves uncommitted data from the Form Browser and converts it to a binary + buffer. + + @param[in] VariableGuid The pointer to an EFI_GUID structure. This is an optional + parameter that may be NULL. + @param[in] VariableName The pointer to a Null-terminated Unicode string. This + is an optional parameter that may be NULL. + @param[in] BufferSize The length in bytes of buffer to hold retrieved data. + @param[out] Buffer The buffer of data to be updated. + + @retval FALSE The uncommitted data could not be retrieved. + @retval TRUE The uncommitted data was retrieved. + +**/ +BOOLEAN +EFIAPI +HiiGetBrowserData ( + IN CONST EFI_GUID *VariableGuid OPTIONAL, + IN CONST CHAR16 *VariableName OPTIONAL, + IN UINTN BufferSize, + OUT UINT8 *Buffer + ); + +/** + Updates uncommitted data in the Form Browser. + + If Buffer is NULL, then ASSERT(). + + @param[in] VariableGuid The pointer to an EFI_GUID structure. This is an optional + parameter that may be NULL. + @param[in] VariableName The pointer to a Null-terminated Unicode string. This + is an optional parameter that may be NULL. + @param[in] BufferSize The length, in bytes, of Buffer. + @param[in] Buffer The buffer of data to commit. + @param[in] RequestElement An optional field to specify which part of the + buffer data will be send back to Browser. If NULL, + the whole buffer of data will be committed to + Browser. + <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>* + + @retval FALSE The uncommitted data could not be updated. + @retval TRUE The uncommitted data was updated. + +**/ +BOOLEAN +EFIAPI +HiiSetBrowserData ( + IN CONST EFI_GUID *VariableGuid OPTIONAL, + IN CONST CHAR16 *VariableName OPTIONAL, + IN UINTN BufferSize, + IN CONST UINT8 *Buffer, + IN CONST CHAR16 *RequestElement OPTIONAL + ); + +///////////////////////////////////////// +///////////////////////////////////////// +/// IFR Functions +///////////////////////////////////////// +///////////////////////////////////////// + +/** + Returns a UINT64 value that contains bitfields for Hour, Minute, and Second. + The lower 8-bits of Hour are placed in bits 0..7. The lower 8-bits of Minute + are placed in bits 8..15, and the lower 8-bits of Second are placed in bits + 16..23. This format was selected because it can be easily translated to + an EFI_HII_TIME structure in an EFI_IFR_TYPE_VALUE union. + + @param Hour The hour value to be encoded. + @param Minute The minute value to be encoded. + @param Second The second value to be encoded. + + @return A 64-bit containing Hour, Minute, and Second. +**/ +#define EFI_HII_TIME_UINT64(Hour, Minute, Second) \ + (UINT64)((Hour & 0xff) | ((Minute & 0xff) << 8) | ((Second & 0xff) << 16)) + +/** + Returns a UINT64 value that contains bit fields for Year, Month, and Day. + The lower 16-bits of Year are placed in bits 0..15. The lower 8-bits of Month + are placed in bits 16..23, and the lower 8-bits of Day are placed in bits + 24..31. This format was selected because it can be easily translated to + an EFI_HII_DATE structure in an EFI_IFR_TYPE_VALUE union. + + @param Year The year value to be encoded. + @param Month The month value to be encoded. + @param Day The day value to be encoded. + + @return A 64-bit containing Year, Month, and Day. +**/ +#define EFI_HII_DATE_UINT64(Year, Month, Day) \ + (UINT64)((Year & 0xffff) | ((Month & 0xff) << 16) | ((Day & 0xff) << 24)) + +/** + Allocates and returns a new OpCode Handle. OpCode Handles must be freed with + HiiFreeOpCodeHandle(). + + @retval NULL There are not enough resources to allocate a new OpCode Handle. + @retval Other A new OpCode handle. + +**/ +VOID * +EFIAPI +HiiAllocateOpCodeHandle ( + VOID + ); + +/** + Frees an OpCode Handle that was previously allocated with HiiAllocateOpCodeHandle(). + When an OpCode Handle is freed, all of the opcodes associated with the OpCode + Handle are also freed. + + If OpCodeHandle is NULL, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + +**/ +VOID +EFIAPI +HiiFreeOpCodeHandle ( + VOID *OpCodeHandle + ); + +/** + Append raw opcodes to an OpCodeHandle. + + If OpCodeHandle is NULL, then ASSERT(). + If RawBuffer is NULL, then ASSERT(); + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] RawBuffer The buffer of opcodes to append. + @param[in] RawBufferSize The size, in bytes, of Buffer. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the appended opcodes. + +**/ +UINT8 * +EFIAPI +HiiCreateRawOpCodes ( + IN VOID *OpCodeHandle, + IN UINT8 *RawBuffer, + IN UINTN RawBufferSize + ); + +/** + Create EFI_IFR_END_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + + @param[in] OpCodeHandle Handle to the buffer of opcodes. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateEndOpCode ( + IN VOID *OpCodeHandle + ); + +/** + Create EFI_IFR_ONE_OF_OPTION_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If Type is invalid, then ASSERT(). + If Flags is invalid, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] StringId StringId for the option. + @param[in] Flags The flags for the option. + @param[in] Type The type for the option. + @param[in] Value The value for the option. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateOneOfOptionOpCode ( + IN VOID *OpCodeHandle, + IN UINT16 StringId, + IN UINT8 Flags, + IN UINT8 Type, + IN UINT64 Value + ); + +/** + Create EFI_IFR_DEFAULT_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If Type is invalid, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] DefaultId The DefaultId for the default. + @param[in] Type The type for the default. + @param[in] Value The value for the default. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateDefaultOpCode ( + IN VOID *OpCodeHandle, + IN UINT16 DefaultId, + IN UINT8 Type, + IN UINT64 Value + ); + +/** + Create EFI_IFR_GUID opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] Guid The pointer to EFI_GUID of this guided opcode. + @param[in] GuidOpCode The pointer to an EFI_IFR_GUID opcode. This is an + optional parameter that may be NULL. If this + parameter is NULL, then the GUID extension + region of the created opcode is filled with zeros. + If this parameter is not NULL, then the GUID + extension region of GuidData will be copied to + the GUID extension region of the created opcode. + @param[in] OpCodeSize The size, in bytes, of created opcode. This value + must be >= sizeof(EFI_IFR_GUID). + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateGuidOpCode ( + IN VOID *OpCodeHandle, + IN CONST EFI_GUID *Guid, + IN CONST VOID *GuidOpCode OPTIONAL, + IN UINTN OpCodeSize + ); + +/** + Create EFI_IFR_ACTION_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The Question ID. + @param[in] Prompt The String ID for Prompt. + @param[in] Help The String ID for Help. + @param[in] QuestionFlags The flags in the Question Header. + @param[in] QuestionConfig The String ID for the configuration. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateActionOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN EFI_STRING_ID QuestionConfig + ); + +/** + Create EFI_IFR_SUBTITLE_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in Flags, then ASSERT(). + If Scope > 1, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] Flags The subtitle opcode flags. + @param[in] Scope 1 if this opcode is the beginning of a new scope. + 0 if this opcode is within the current scope. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateSubTitleOpCode ( + IN VOID *OpCodeHandle, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 Flags, + IN UINT8 Scope + ); + +/** + Create EFI_IFR_REF_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] FormId The Destination Form ID. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header + @param[in] QuestionId Question ID. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateGotoOpCode ( + IN VOID *OpCodeHandle, + IN EFI_FORM_ID FormId, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN EFI_QUESTION_ID QuestionId + ); + +/** + Create EFI_IFR_REF_OP, EFI_IFR_REF2_OP, EFI_IFR_REF3_OP and EFI_IFR_REF4_OP opcode. + + When RefDevicePath is not zero, EFI_IFR_REF4 opcode will be created. + When RefDevicePath is zero and RefFormSetId is not NULL, EFI_IFR_REF3 opcode will be created. + When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is not zero, EFI_IFR_REF2 opcode will be created. + When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is zero, EFI_IFR_REF opcode will be created. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] RefFormId The Destination Form ID. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header + @param[in] QuestionId Question ID. + @param[in] RefQuestionId The question on the form to which this link is referring. + If its value is zero, then the link refers to the top of the form. + @param[in] RefFormSetId The form set to which this link is referring. If its value is NULL, and RefDevicePath is + zero, then the link is to the current form set. + @param[in] RefDevicePath The string identifier that specifies the string containing the text representation of + the device path to which the form set containing the form specified by FormId. + If its value is zero, then the link refers to the current page. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateGotoExOpCode ( + IN VOID *OpCodeHandle, + IN EFI_FORM_ID RefFormId, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN EFI_QUESTION_ID QuestionId, + IN EFI_QUESTION_ID RefQuestionId, + IN EFI_GUID *RefFormSetId OPTIONAL, + IN EFI_STRING_ID RefDevicePath + ); + +/** + Create EFI_IFR_CHECKBOX_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in CheckBoxFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] CheckBoxFlags The flags for checkbox opcode. + @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateCheckBoxOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 CheckBoxFlags, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_NUMERIC_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in NumericFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] NumericFlags The flags for a numeric opcode. + @param[in] Minimum The numeric minimum value. + @param[in] Maximum The numeric maximum value. + @param[in] Step The numeric step for edit. + @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateNumericOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 NumericFlags, + IN UINT64 Minimum, + IN UINT64 Maximum, + IN UINT64 Step, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_STRING_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in StringFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] StringFlags The flags for a string opcode. + @param[in] MinSize The string minimum length. + @param[in] MaxSize The string maximum length. + @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateStringOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 StringFlags, + IN UINT8 MinSize, + IN UINT8 MaxSize, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_ONE_OF_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in OneOfFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] OneOfFlags The flags for a oneof opcode. + @param[in] OptionsOpCodeHandle The handle for a buffer of ONE_OF_OPTION opcodes. + @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateOneOfOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 OneOfFlags, + IN VOID *OptionsOpCodeHandle, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_ORDERED_LIST_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in OrderedListFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] OrderedListFlags The flags for an ordered list opcode. + @param[in] DataType The type for option value. + @param[in] MaxContainers Maximum count for options in this ordered list + @param[in] OptionsOpCodeHandle The handle for a buffer of ONE_OF_OPTION opcodes. + @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateOrderedListOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 OrderedListFlags, + IN UINT8 DataType, + IN UINT8 MaxContainers, + IN VOID *OptionsOpCodeHandle, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_TEXT_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + + @param[in] OpCodeHandle Handle to the buffer of opcodes. + @param[in] Prompt String ID for Prompt. + @param[in] Help String ID for Help. + @param[in] TextTwo String ID for TextTwo. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateTextOpCode ( + IN VOID *OpCodeHandle, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN EFI_STRING_ID TextTwo + ); + +/** + Create EFI_IFR_DATE_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in DateFlags, then ASSERT(). + + @param[in] OpCodeHandle Handle to the buffer of opcodes. + @param[in] QuestionId Question ID + @param[in] VarStoreId Storage ID, optional. If DateFlags is not + QF_DATE_STORAGE_NORMAL, this parameter is ignored. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair, optional. If DateFlags is not + QF_DATE_STORAGE_NORMAL, this parameter is ignored. + @param[in] Prompt String ID for Prompt + @param[in] Help String ID for Help + @param[in] QuestionFlags Flags in Question Header + @param[in] DateFlags Flags for date opcode + @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateDateOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId OPTIONAL, + IN UINT16 VarOffset OPTIONAL, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 DateFlags, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_TIME_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in TimeFlags, then ASSERT(). + + @param[in] OpCodeHandle Handle to the buffer of opcodes. + @param[in] QuestionId Question ID + @param[in] VarStoreId Storage ID, optional. If TimeFlags is not + QF_TIME_STORAGE_NORMAL, this parameter is ignored. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair, optional. If TimeFlags is not + QF_TIME_STORAGE_NORMAL, this parameter is ignored. + @param[in] Prompt String ID for Prompt + @param[in] Help String ID for Help + @param[in] QuestionFlags Flags in Question Header + @param[in] TimeFlags Flags for time opcode + @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateTimeOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId OPTIONAL, + IN UINT16 VarOffset OPTIONAL, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 TimeFlags, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + This function updates a form that has previously been registered with the HII + Database. This function will perform at most one update operation. + + The form to update is specified by Handle, FormSetGuid, and FormId. Binary + comparisons of IFR opcodes are performed from the beginning of the form being + updated until an IFR opcode is found that exactly matches the first IFR opcode + specified by StartOpCodeHandle. The following rules are used to determine if + an insert, replace, or delete operation is performed: + + 1) If no matches are found, then NULL is returned. + 2) If a match is found, and EndOpCodeHandle is NULL, then all of the IFR opcodes + from StartOpCodeHandle except the first opcode are inserted immediately after + the matching IFR opcode in the form to be updated. + 3) If a match is found, and EndOpCodeHandle is not NULL, then a search is made + from the matching IFR opcode until an IFR opcode exactly matches the first + IFR opcode specified by EndOpCodeHandle. If no match is found for the first + IFR opcode specified by EndOpCodeHandle, then NULL is returned. If a match + is found, then all of the IFR opcodes between the start match and the end + match are deleted from the form being updated and all of the IFR opcodes + from StartOpCodeHandle except the first opcode are inserted immediately after + the matching start IFR opcode. If StartOpCcodeHandle only contains one + IFR instruction, then the result of this operation will delete all of the IFR + opcodes between the start end matches. + + If HiiHandle is NULL, then ASSERT(). + If StartOpCodeHandle is NULL, then ASSERT(). + + @param[in] HiiHandle The HII Handle of the form to update. + @param[in] FormSetGuid The Formset GUID of the form to update. This + is an optional parameter that may be NULL. + If it is NULL, all FormSet will be updated. + @param[in] FormId The ID of the form to update. + @param[in] StartOpCodeHandle An OpCode Handle that contains the set of IFR + opcodes to be inserted or replaced in the form. + The first IFR instruction in StartOpCodeHandle + is used to find matching IFR opcode in the + form. + @param[in] EndOpCodeHandle An OpCcode Handle that contains the IFR opcode + that marks the end of a replace operation in + the form. This is an optional parameter that + may be NULL. If it is NULL, then the IFR + opcodes specified by StartOpCodeHandle are + inserted into the form. + + @retval EFI_OUT_OF_RESOURCES Not enough memory resources are allocated. + @retval EFI_NOT_FOUND The following cases will return EFI_NOT_FOUND: + 1) The form specified by HiiHandle, FormSetGuid, + and FormId could not be found in the HII Database. + 2) No IFR opcodes in the target form match the first + IFR opcode in StartOpCodeHandle. + 3) EndOpCOde is not NULL, and no IFR opcodes in the + target form following a matching start opcode match + the first IFR opcode in EndOpCodeHandle. + @retval EFI_SUCCESS The matched form is updated by StartOpcode. + +**/ +EFI_STATUS +EFIAPI +HiiUpdateForm ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_GUID *FormSetGuid OPTIONAL, + IN EFI_FORM_ID FormId, + IN VOID *StartOpCodeHandle, + IN VOID *EndOpCodeHandle OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h b/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h index 87c94c7237..fb0472116b 100644 --- a/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h +++ b/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h @@ -1,234 +1,234 @@ -/** @file
-
- Provides definitions and functionality for manipulating IMAGE_PROPERTIES_RECORD.
-
- Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
- Copyright (c) Microsoft Corporation.
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_
-#define IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_
-
-#define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C')
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- EFI_PHYSICAL_ADDRESS CodeSegmentBase;
- UINT64 CodeSegmentSize;
-} IMAGE_PROPERTIES_RECORD_CODE_SECTION;
-
-#define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D')
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- EFI_PHYSICAL_ADDRESS ImageBase;
- UINT64 ImageSize;
- UINTN CodeSegmentCount;
- LIST_ENTRY CodeSegmentList;
-} IMAGE_PROPERTIES_RECORD;
-
-/**
- Split the original memory map and add more entries to describe PE code
- and data sections for each image in the input ImageRecordList.
-
- NOTE: This function assumes PE code/data section are page aligned.
- NOTE: This function assumes there are enough entries for the new memory map.
-
- | | | | | | | |
- | 4K PAGE | DATA | CODE | DATA | CODE | DATA | 4K PAGE |
- | | | | | | | |
- Assume the above memory region is the result of one split memory map descriptor. It's unlikely
- that a linker will orient an image this way, but the caller must assume the worst case scenario.
- This image layout example contains code sections oriented in a way that maximizes the number of
- descriptors which would be required to describe each section. To ensure we have enough space
- for every descriptor of the broken up memory map, the caller must assume that every image will
- have the maximum number of code sections oriented in a way which maximizes the number of data
- sections with unrelated memory regions flanking each image within a single descriptor.
-
- Given an image record list, the caller should use the following formula when allocating extra descriptors:
- NumberOfAdditionalDescriptors = (MemoryMapSize / DescriptorSize) +
- ((2 * <Most Code Segments in a Single Image> + 3) * <Number of Images>)
-
- @param[in, out] MemoryMapSize IN: The size, in bytes, of the old memory map before the split.
- OUT: The size, in bytes, of the used descriptors of the split
- memory map
- @param[in, out] MemoryMap IN: A pointer to the buffer containing the current memory map.
- This buffer must have enough space to accomodate the "worst case"
- scenario where every image in ImageRecordList needs a new descriptor
- to describe its code and data sections.
- OUT: A pointer to the updated memory map with separated image section
- descriptors.
- @param[in] DescriptorSize The size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.
- @param[in] ImageRecordList A list of IMAGE_PROPERTIES_RECORD entries used when searching
- for an image record contained by the memory range described in
- EFI memory map descriptors.
- @param[in] NumberOfAdditionalDescriptors The number of unused descriptors at the end of the input MemoryMap.
- The formula in the description should be used to calculate this value.
-
- @retval EFI_SUCCESS The memory map was successfully split.
- @retval EFI_INVALID_PARAMETER MemoryMapSize, MemoryMap, or ImageRecordList was NULL.
-**/
-EFI_STATUS
-EFIAPI
-SplitTable (
- IN OUT UINTN *MemoryMapSize,
- IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
- IN UINTN DescriptorSize,
- IN LIST_ENTRY *ImageRecordList,
- IN UINTN NumberOfAdditionalDescriptors
- );
-
-/**
- Sort the code sections in the input ImageRecord based upon CodeSegmentBase from low to high.
-
- @param[in] ImageRecord IMAGE_PROPERTIES_RECORD to be sorted
-
- @retval EFI_SUCCESS The code sections in the input ImageRecord were sorted successfully
- @retval EFI_ABORTED An error occurred while sorting the code sections in the input ImageRecord
- @retval EFI_INVALID_PARAMETER ImageRecord is NULL
-**/
-EFI_STATUS
-EFIAPI
-SortImageRecordCodeSection (
- IN IMAGE_PROPERTIES_RECORD *ImageRecord
- );
-
-/**
- Check if the code sections in the input ImageRecord are valid.
- The code sections are valid if they don't overlap, are contained
- within the the ImageRecord's ImageBase and ImageSize, and are
- contained within the MAX_ADDRESS.
-
- @param[in] ImageRecord IMAGE_PROPERTIES_RECORD to be checked
-
- @retval TRUE The code sections in the input ImageRecord are valid
- @retval FALSE The code sections in the input ImageRecord are invalid
-**/
-BOOLEAN
-EFIAPI
-IsImageRecordCodeSectionValid (
- IN IMAGE_PROPERTIES_RECORD *ImageRecord
- );
-
-/**
- Sort the input ImageRecordList based upon the ImageBase from low to high.
-
- @param[in] ImageRecordList Image record list to be sorted
-
- @retval EFI_SUCCESS The image record list was sorted successfully
- @retval EFI_ABORTED An error occurred while sorting the image record list
- @retval EFI_INVALID_PARAMETER ImageRecordList is NULL
-**/
-EFI_STATUS
-EFIAPI
-SortImageRecord (
- IN LIST_ENTRY *ImageRecordList
- );
-
-/**
- Swap two image records.
-
- @param[in] FirstImageRecord The first image record.
- @param[in] SecondImageRecord The second image record.
-
- @retval EFI_SUCCESS The image records were swapped successfully
- @retval EFI_INVALID_PARAMETER FirstImageRecord or SecondImageRecord is NULL
-**/
-EFI_STATUS
-EFIAPI
-SwapImageRecord (
- IN IMAGE_PROPERTIES_RECORD *FirstImageRecord,
- IN IMAGE_PROPERTIES_RECORD *SecondImageRecord
- );
-
-/**
- Swap two code sections in a single IMAGE_PROPERTIES_RECORD.
-
- @param[in] FirstImageRecordCodeSection The first code section
- @param[in] SecondImageRecordCodeSection The second code section
-
- @retval EFI_SUCCESS The code sections were swapped successfully
- @retval EFI_INVALID_PARAMETER FirstImageRecordCodeSection or SecondImageRecordCodeSection is NULL
-**/
-EFI_STATUS
-EFIAPI
-SwapImageRecordCodeSection (
- IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *FirstImageRecordCodeSection,
- IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *SecondImageRecordCodeSection
- );
-
-/**
- Find image properties record according to image base and size in the
- input ImageRecordList.
-
- @param[in] ImageBase Base of PE image
- @param[in] ImageSize Size of PE image
- @param[in] ImageRecordList Image record list to be searched
-
- @retval NULL No IMAGE_PROPERTIES_RECORD matches ImageBase
- and ImageSize in the input ImageRecordList
- @retval Other The found IMAGE_PROPERTIES_RECORD
-**/
-IMAGE_PROPERTIES_RECORD *
-EFIAPI
-FindImageRecord (
- IN EFI_PHYSICAL_ADDRESS ImageBase,
- IN UINT64 ImageSize,
- IN LIST_ENTRY *ImageRecordList
- );
-
-/**
- Debug dumps the input list of IMAGE_PROPERTIES_RECORD structs.
-
- @param[in] ImageRecordList Head of the IMAGE_PROPERTIES_RECORD list
-**/
-VOID
-EFIAPI
-DumpImageRecords (
- IN LIST_ENTRY *ImageRecordList
- );
-
-/**
- Creates an IMAGE_PROPERTIES_RECORD from a loaded PE image. The PE/COFF header will be found
- and parsed to determine the number of code segments and their base addresses and sizes.
-
- @param[in] ImageBase Base of the PE image
- @param[in] ImageSize Size of the PE image
- @param[in] RequiredAlignment If non-NULL, the alignment specified in the PE/COFF header
- will be compared against this value.
- @param[out] ImageRecord On out, a populated image properties record
-
- @retval EFI_INVALID_PARAMETER This function ImageBase or ImageRecord was NULL, or the
- image located at ImageBase was not a valid PE/COFF image
- @retval EFI_OUT_OF_RESOURCES Failure to Allocate()
- @retval EFI_ABORTED The input Alignment was non-NULL and did not match the
- alignment specified in the PE/COFF header
- @retval EFI_SUCCESS The image properties record was successfully created
-**/
-EFI_STATUS
-EFIAPI
-CreateImagePropertiesRecord (
- IN CONST VOID *ImageBase,
- IN CONST UINT64 ImageSize,
- IN CONST UINT32 *Alignment OPTIONAL,
- OUT IMAGE_PROPERTIES_RECORD *ImageRecord
- );
-
-/**
- Deleted an image properties record. The function will also call
- RemoveEntryList() on each code segment and the input ImageRecord before
- freeing each pool.
-
- @param[in] ImageRecord The IMAGE_PROPERTIES_RECORD to delete
-**/
-VOID
-EFIAPI
-DeleteImagePropertiesRecord (
- IN IMAGE_PROPERTIES_RECORD *ImageRecord
- );
-
-#endif
+/** @file + + Provides definitions and functionality for manipulating IMAGE_PROPERTIES_RECORD. + + Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> + Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_ +#define IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_ + +#define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C') + +typedef struct { + UINT32 Signature; + LIST_ENTRY Link; + EFI_PHYSICAL_ADDRESS CodeSegmentBase; + UINT64 CodeSegmentSize; +} IMAGE_PROPERTIES_RECORD_CODE_SECTION; + +#define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D') + +typedef struct { + UINT32 Signature; + LIST_ENTRY Link; + EFI_PHYSICAL_ADDRESS ImageBase; + UINT64 ImageSize; + UINTN CodeSegmentCount; + LIST_ENTRY CodeSegmentList; +} IMAGE_PROPERTIES_RECORD; + +/** + Split the original memory map and add more entries to describe PE code + and data sections for each image in the input ImageRecordList. + + NOTE: This function assumes PE code/data section are page aligned. + NOTE: This function assumes there are enough entries for the new memory map. + + | | | | | | | | + | 4K PAGE | DATA | CODE | DATA | CODE | DATA | 4K PAGE | + | | | | | | | | + Assume the above memory region is the result of one split memory map descriptor. It's unlikely + that a linker will orient an image this way, but the caller must assume the worst case scenario. + This image layout example contains code sections oriented in a way that maximizes the number of + descriptors which would be required to describe each section. To ensure we have enough space + for every descriptor of the broken up memory map, the caller must assume that every image will + have the maximum number of code sections oriented in a way which maximizes the number of data + sections with unrelated memory regions flanking each image within a single descriptor. + + Given an image record list, the caller should use the following formula when allocating extra descriptors: + NumberOfAdditionalDescriptors = (MemoryMapSize / DescriptorSize) + + ((2 * <Most Code Segments in a Single Image> + 3) * <Number of Images>) + + @param[in, out] MemoryMapSize IN: The size, in bytes, of the old memory map before the split. + OUT: The size, in bytes, of the used descriptors of the split + memory map + @param[in, out] MemoryMap IN: A pointer to the buffer containing the current memory map. + This buffer must have enough space to accomodate the "worst case" + scenario where every image in ImageRecordList needs a new descriptor + to describe its code and data sections. + OUT: A pointer to the updated memory map with separated image section + descriptors. + @param[in] DescriptorSize The size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR. + @param[in] ImageRecordList A list of IMAGE_PROPERTIES_RECORD entries used when searching + for an image record contained by the memory range described in + EFI memory map descriptors. + @param[in] NumberOfAdditionalDescriptors The number of unused descriptors at the end of the input MemoryMap. + The formula in the description should be used to calculate this value. + + @retval EFI_SUCCESS The memory map was successfully split. + @retval EFI_INVALID_PARAMETER MemoryMapSize, MemoryMap, or ImageRecordList was NULL. +**/ +EFI_STATUS +EFIAPI +SplitTable ( + IN OUT UINTN *MemoryMapSize, + IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, + IN UINTN DescriptorSize, + IN LIST_ENTRY *ImageRecordList, + IN UINTN NumberOfAdditionalDescriptors + ); + +/** + Sort the code sections in the input ImageRecord based upon CodeSegmentBase from low to high. + + @param[in] ImageRecord IMAGE_PROPERTIES_RECORD to be sorted + + @retval EFI_SUCCESS The code sections in the input ImageRecord were sorted successfully + @retval EFI_ABORTED An error occurred while sorting the code sections in the input ImageRecord + @retval EFI_INVALID_PARAMETER ImageRecord is NULL +**/ +EFI_STATUS +EFIAPI +SortImageRecordCodeSection ( + IN IMAGE_PROPERTIES_RECORD *ImageRecord + ); + +/** + Check if the code sections in the input ImageRecord are valid. + The code sections are valid if they don't overlap, are contained + within the the ImageRecord's ImageBase and ImageSize, and are + contained within the MAX_ADDRESS. + + @param[in] ImageRecord IMAGE_PROPERTIES_RECORD to be checked + + @retval TRUE The code sections in the input ImageRecord are valid + @retval FALSE The code sections in the input ImageRecord are invalid +**/ +BOOLEAN +EFIAPI +IsImageRecordCodeSectionValid ( + IN IMAGE_PROPERTIES_RECORD *ImageRecord + ); + +/** + Sort the input ImageRecordList based upon the ImageBase from low to high. + + @param[in] ImageRecordList Image record list to be sorted + + @retval EFI_SUCCESS The image record list was sorted successfully + @retval EFI_ABORTED An error occurred while sorting the image record list + @retval EFI_INVALID_PARAMETER ImageRecordList is NULL +**/ +EFI_STATUS +EFIAPI +SortImageRecord ( + IN LIST_ENTRY *ImageRecordList + ); + +/** + Swap two image records. + + @param[in] FirstImageRecord The first image record. + @param[in] SecondImageRecord The second image record. + + @retval EFI_SUCCESS The image records were swapped successfully + @retval EFI_INVALID_PARAMETER FirstImageRecord or SecondImageRecord is NULL +**/ +EFI_STATUS +EFIAPI +SwapImageRecord ( + IN IMAGE_PROPERTIES_RECORD *FirstImageRecord, + IN IMAGE_PROPERTIES_RECORD *SecondImageRecord + ); + +/** + Swap two code sections in a single IMAGE_PROPERTIES_RECORD. + + @param[in] FirstImageRecordCodeSection The first code section + @param[in] SecondImageRecordCodeSection The second code section + + @retval EFI_SUCCESS The code sections were swapped successfully + @retval EFI_INVALID_PARAMETER FirstImageRecordCodeSection or SecondImageRecordCodeSection is NULL +**/ +EFI_STATUS +EFIAPI +SwapImageRecordCodeSection ( + IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *FirstImageRecordCodeSection, + IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *SecondImageRecordCodeSection + ); + +/** + Find image properties record according to image base and size in the + input ImageRecordList. + + @param[in] ImageBase Base of PE image + @param[in] ImageSize Size of PE image + @param[in] ImageRecordList Image record list to be searched + + @retval NULL No IMAGE_PROPERTIES_RECORD matches ImageBase + and ImageSize in the input ImageRecordList + @retval Other The found IMAGE_PROPERTIES_RECORD +**/ +IMAGE_PROPERTIES_RECORD * +EFIAPI +FindImageRecord ( + IN EFI_PHYSICAL_ADDRESS ImageBase, + IN UINT64 ImageSize, + IN LIST_ENTRY *ImageRecordList + ); + +/** + Debug dumps the input list of IMAGE_PROPERTIES_RECORD structs. + + @param[in] ImageRecordList Head of the IMAGE_PROPERTIES_RECORD list +**/ +VOID +EFIAPI +DumpImageRecords ( + IN LIST_ENTRY *ImageRecordList + ); + +/** + Creates an IMAGE_PROPERTIES_RECORD from a loaded PE image. The PE/COFF header will be found + and parsed to determine the number of code segments and their base addresses and sizes. + + @param[in] ImageBase Base of the PE image + @param[in] ImageSize Size of the PE image + @param[in] RequiredAlignment If non-NULL, the alignment specified in the PE/COFF header + will be compared against this value. + @param[out] ImageRecord On out, a populated image properties record + + @retval EFI_INVALID_PARAMETER This function ImageBase or ImageRecord was NULL, or the + image located at ImageBase was not a valid PE/COFF image + @retval EFI_OUT_OF_RESOURCES Failure to Allocate() + @retval EFI_ABORTED The input Alignment was non-NULL and did not match the + alignment specified in the PE/COFF header + @retval EFI_SUCCESS The image properties record was successfully created +**/ +EFI_STATUS +EFIAPI +CreateImagePropertiesRecord ( + IN CONST VOID *ImageBase, + IN CONST UINT64 ImageSize, + IN CONST UINT32 *Alignment OPTIONAL, + OUT IMAGE_PROPERTIES_RECORD *ImageRecord + ); + +/** + Deleted an image properties record. The function will also call + RemoveEntryList() on each code segment and the input ImageRecord before + freeing each pool. + + @param[in] ImageRecord The IMAGE_PROPERTIES_RECORD to delete +**/ +VOID +EFIAPI +DeleteImagePropertiesRecord ( + IN IMAGE_PROPERTIES_RECORD *ImageRecord + ); + +#endif diff --git a/MdeModulePkg/Include/Library/IpmiCommandLib.h b/MdeModulePkg/Include/Library/IpmiCommandLib.h index 06bea6131a..a872005a6a 100644 --- a/MdeModulePkg/Include/Library/IpmiCommandLib.h +++ b/MdeModulePkg/Include/Library/IpmiCommandLib.h @@ -1,700 +1,700 @@ -/** @file
- This library abstract how to send/receive IPMI command.
-
-Copyright (c) 2018-2021, Intel Corporation. All rights reserved.<BR>
-Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef IPMI_COMMAND_LIB_H_
-#define IPMI_COMMAND_LIB_H_
-
-#include <Uefi.h>
-#include <IndustryStandard/Ipmi.h>
-
-//
-// IPMI NetFnApp
-//
-
-/**
- This function gets the IPMI Device ID.
-
- @param[out] DeviceId Get device ID response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetDeviceId (
- OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
- );
-
-/**
- This function gets the self-test result.
-
- @param[out] SelfTestResult Self test command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSelfTestResult (
- OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
- );
-
-/**
- This function resets watchdog timer.
-
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiResetWatchdogTimer (
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function sets watchdog timer.
-
- @param[in] SetWatchdogTimer Set watchdog timer request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetWatchdogTimer (
- IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets watchdog timer.
-
- @param[out] GetWatchdogTimer Get watchdog timer response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetWatchdogTimer (
- OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
- );
-
-/**
- This function sets BMC global enables.
-
- @param[in] SetBmcGlobalEnables Set BMC global enables command request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetBmcGlobalEnables (
- IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets BMC global enables.
-
- @param[out] GetBmcGlobalEnables Get BMC global enables command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetBmcGlobalEnables (
- OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
- );
-
-/**
- This function clears message flag.
-
- @param[in] ClearMessageFlagsRequest Clear message flags command request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiClearMessageFlags (
- IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets message flag.
-
- @param[out] GetMessageFlagsResponse Get message flags response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetMessageFlags (
- OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
- );
-
-/**
- This function gets message.
-
- @param[out] GetMessageResponse Get message command response.
- @param[in,out] GetMessageResponseSize The size of get message response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetMessage (
- OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
- IN OUT UINT32 *GetMessageResponseSize
- );
-
-/**
- This function sends message.
-
- @param[in] SendMessageRequest The send message command request.
- @param[in] SendMessageRequestSize The size of the send message command request.
- @param[out] SendMessageResponse The send message command response.
- @param[in,out] SendMessageResponseSize The size of the send message command response.
- When input, the expected size of response.
- When output, the actual size of response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSendMessage (
- IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
- IN UINT32 SendMessageRequestSize,
- OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
- IN OUT UINT32 *SendMessageResponseSize
- );
-
-/**
- This function gets the system UUID.
-
- @param[out] SystemGuid The pointer to retrieve system UUID.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Others Other errors.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSystemUuid (
- OUT EFI_GUID *SystemGuid
- );
-
-/**
- This function gets the channel information.
-
- @param[in] GetChannelInfoRequest The get channel information request.
- @param[in] GetChannelInfoResponse The get channel information response.
- @param[in,out] GetChannelInfoResponseSize When input, the expected size of response.
- When output, the exact size of the returned
- response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetChannelInfo (
- IN IPMI_GET_CHANNEL_INFO_REQUEST *GetChannelInfoRequest,
- OUT IPMI_GET_CHANNEL_INFO_RESPONSE *GetChannelInfoResponse,
- OUT UINT32 *GetChannelInfoResponseSize
- );
-
-/**
- This function gets system interface capability
-
- @param[in] InterfaceCapabilityRequest Get system interface capability request.
- @param[out] InterfaceCapabilityResponse The response of system interface capability.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSystemInterfaceCapability (
- IN IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_REQUEST *InterfaceCapabilityRequest,
- OUT IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_RESPONSE *InterfaceCapabilityResponse
- );
-
-//
-// IPMI NetFnTransport
-//
-
-/**
- This function activates SOL
-
- @param[in] SolActivatingRequest SOL activating request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSolActivating (
- IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function sets SOL configuration parameters.
-
- @param[in] SetConfigurationParametersRequest Set SOL configuration parameters
- command request.
- @param[in] SetConfigurationParametersRequestSize Size of the set SOL configuration
- parameters command request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetSolConfigurationParameters (
- IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
- IN UINT32 SetConfigurationParametersRequestSize,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets SOL configuration parameters.
-
- @param[in] GetConfigurationParametersRequest Get SOL configuration parameters
- command request.
- @param[out] GetConfigurationParametersResponse Get SOL configuration parameters
- response.
- @param[in,out] GetConfigurationParametersResponseSize When input, the size of the expected
- response.
- When output, the exact size of
- expect response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSolConfigurationParameters (
- IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest,
- OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
- IN OUT UINT32 *GetConfigurationParametersResponseSize
- );
-
-/**
- This function gets the LAN configuration parameter.
-
- @param[in] GetLanConfigurationParametersRequest Get LAN configuration parameters command request.
- @param[in] GetLanConfigurationParametersResponse The response of the get LAN configuration parameters.
- @param[in,out] GetLanConfigurationParametersSize When input, the expected size of response data.
- When out, the exact size of response data.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-
-EFI_STATUS
-EFIAPI
-IpmiGetLanConfigurationParameters (
- IN IPMI_GET_LAN_CONFIGURATION_PARAMETERS_REQUEST *GetLanConfigurationParametersRequest,
- OUT IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE *GetLanConfigurationParametersResponse,
- IN OUT UINT32 *GetLanConfigurationParametersSize
- );
-
-//
-// IPMI NetFnChassis
-//
-
-/**
- This function gets chassis capability.
-
- @param[out] GetChassisCapabilitiesResponse Gets chassis capability command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetChassisCapabilities (
- OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse
- );
-
-/**
- This function gets chassis status.
-
- @param[out] GetChassisCapabilitiesResponse The get chassis status command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetChassisStatus (
- OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
- );
-
-/**
- This function sends chassis control request.
-
- @param[in] ChassisControlRequest The chassis control request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiChassisControl (
- IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function sets power restore policy.
-
- @param[in] SetPowerRestireRequest The set power restore policy control
- command request.
- @param[out] SetPowerRestireResponse The response of power restore policy.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetPowerRestorePolicy (
- IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *SetPowerRestireRequest,
- OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *SetPowerRestireResponse
- );
-
-//
-// IPMI NetFnStorage
-//
-
-/**
- This function sets system boot option.
-
- @param[in] BootOptionsRequest Set system boot option request.
- @param[out] BootOptionsResponse The response of set system boot
- option request.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetSystemBootOptions (
- IN IPMI_SET_BOOT_OPTIONS_REQUEST *BootOptionsRequest,
- OUT IPMI_SET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse
- );
-
-/**
- This function gets system boot option.
-
- @param[in] BootOptionsRequest Get system boot option request.
- @param[out] BootOptionsResponse The response of get system boot
- option request.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSystemBootOptions (
- IN IPMI_GET_BOOT_OPTIONS_REQUEST *BootOptionsRequest,
- OUT IPMI_GET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse
- );
-
-/**
- This function gets FRU inventory area info.
-
- @param[in] GetFruInventoryAreaInfoRequest Get FRU inventory area command request.
- @param[out] GetFruInventoryAreaInfoResponse get FRU inventory area command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetFruInventoryAreaInfo (
- IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
- OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse
- );
-
-/**
- This function reads FRU data.
-
- @param[in] ReadFruDataRequest Read FRU data command request.
- @param[out] ReadFruDataResponse Read FRU data command response.
- @param[in,out] ReadFruDataResponseSize Size of the read FRU data response.
- When input, the expected size of response data.
- When out, the exact size of response data.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiReadFruData (
- IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
- OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
- IN OUT UINT32 *ReadFruDataResponseSize
- );
-
-/**
- This function gets chassis capability.
-
- @param[in] WriteFruDataRequest Write FRU data command request.
- @param[in] WriteFruDataRequestSize Size of the write FRU data command request.
- @param[out] WriteFruDataResponse Write FRU data response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiWriteFruData (
- IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
- IN UINT32 WriteFruDataRequestSize,
- OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
- );
-
-/**
- This function gets SEL information.
-
- @param[out] GetSelInfoResponse Get SEL information command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSelInfo (
- OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
- );
-
-/**
- This function gets SEL entry.
-
- @param[in] GetSelEntryRequest Get SEL entry command request.
- @param[out] GetSelEntryResponse Get SEL entry command response.
- @param[in,out] GetSelEntryResponseSize Size of Get SEL entry request.
- When input, the expected size of response data.
- When out, the exact size of response data.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSelEntry (
- IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
- OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
- IN OUT UINT32 *GetSelEntryResponseSize
- );
-
-/**
- This function adds SEL entry.
-
- @param[in] AddSelEntryRequest Add SEL entry command request.
- @param[out] AddSelEntryResponse Add SEL entry command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiAddSelEntry (
- IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
- OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
- );
-
-/**
- This function partially adds SEL entry.
-
- @param[in] PartialAddSelEntryRequest Partial add SEL entry command request.
- @param[in] PartialAddSelEntryRequestSize Size of partial add SEL entry command request.
- @param[out] PartialAddSelEntryResponse Partial add SEL entry command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiPartialAddSelEntry (
- IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
- IN UINT32 PartialAddSelEntryRequestSize,
- OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
- );
-
-/**
- This function clears SEL entry.
-
- @param[in] ClearSelRequest Clear SEL command request.
- @param[out] ClearSelResponse Clear SEL command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiClearSel (
- IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
- OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
- );
-
-/**
- This function gets SEL time.
-
- @param[out] GetSelTimeResponse Get SEL time command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSelTime (
- OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
- );
-
-/**
- This function sets SEL time.
-
- @param[in] SetSelTimeRequest Set SEL time command request.
- @param[out] CompletionCode Command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetSelTime (
- IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets SDR repository information.
-
- @param[out] GetSdrRepositoryInfoResp Get SDR repository response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSdrRepositoryInfo (
- OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
- );
-
-/**
- This function gets SDR
-
- @param[in] GetSdrRequest Get SDR resquest.
- @param[out] GetSdrResponse Get SDR response.
- @param[in,out] GetSdrResponseSize The size of get SDR response.
- When input, the expected size of response data.
- When out, the exact size of response data.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSdr (
- IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
- OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
- IN OUT UINT32 *GetSdrResponseSize
- );
-
-#endif
+/** @file + This library abstract how to send/receive IPMI command. + +Copyright (c) 2018-2021, Intel Corporation. All rights reserved.<BR> +Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef IPMI_COMMAND_LIB_H_ +#define IPMI_COMMAND_LIB_H_ + +#include <Uefi.h> +#include <IndustryStandard/Ipmi.h> + +// +// IPMI NetFnApp +// + +/** + This function gets the IPMI Device ID. + + @param[out] DeviceId Get device ID response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetDeviceId ( + OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId + ); + +/** + This function gets the self-test result. + + @param[out] SelfTestResult Self test command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelfTestResult ( + OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult + ); + +/** + This function resets watchdog timer. + + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiResetWatchdogTimer ( + OUT UINT8 *CompletionCode + ); + +/** + This function sets watchdog timer. + + @param[in] SetWatchdogTimer Set watchdog timer request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + + +**/ +EFI_STATUS +EFIAPI +IpmiSetWatchdogTimer ( + IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer, + OUT UINT8 *CompletionCode + ); + +/** + This function gets watchdog timer. + + @param[out] GetWatchdogTimer Get watchdog timer response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetWatchdogTimer ( + OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer + ); + +/** + This function sets BMC global enables. + + @param[in] SetBmcGlobalEnables Set BMC global enables command request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetBmcGlobalEnables ( + IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables, + OUT UINT8 *CompletionCode + ); + +/** + This function gets BMC global enables. + + @param[out] GetBmcGlobalEnables Get BMC global enables command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetBmcGlobalEnables ( + OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables + ); + +/** + This function clears message flag. + + @param[in] ClearMessageFlagsRequest Clear message flags command request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiClearMessageFlags ( + IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function gets message flag. + + @param[out] GetMessageFlagsResponse Get message flags response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetMessageFlags ( + OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse + ); + +/** + This function gets message. + + @param[out] GetMessageResponse Get message command response. + @param[in,out] GetMessageResponseSize The size of get message response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetMessage ( + OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse, + IN OUT UINT32 *GetMessageResponseSize + ); + +/** + This function sends message. + + @param[in] SendMessageRequest The send message command request. + @param[in] SendMessageRequestSize The size of the send message command request. + @param[out] SendMessageResponse The send message command response. + @param[in,out] SendMessageResponseSize The size of the send message command response. + When input, the expected size of response. + When output, the actual size of response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSendMessage ( + IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest, + IN UINT32 SendMessageRequestSize, + OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse, + IN OUT UINT32 *SendMessageResponseSize + ); + +/** + This function gets the system UUID. + + @param[out] SystemGuid The pointer to retrieve system UUID. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Others Other errors. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemUuid ( + OUT EFI_GUID *SystemGuid + ); + +/** + This function gets the channel information. + + @param[in] GetChannelInfoRequest The get channel information request. + @param[in] GetChannelInfoResponse The get channel information response. + @param[in,out] GetChannelInfoResponseSize When input, the expected size of response. + When output, the exact size of the returned + response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChannelInfo ( + IN IPMI_GET_CHANNEL_INFO_REQUEST *GetChannelInfoRequest, + OUT IPMI_GET_CHANNEL_INFO_RESPONSE *GetChannelInfoResponse, + OUT UINT32 *GetChannelInfoResponseSize + ); + +/** + This function gets system interface capability + + @param[in] InterfaceCapabilityRequest Get system interface capability request. + @param[out] InterfaceCapabilityResponse The response of system interface capability. + + @retval EFI_SUCCESS Command is sent successfully. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemInterfaceCapability ( + IN IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_REQUEST *InterfaceCapabilityRequest, + OUT IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_RESPONSE *InterfaceCapabilityResponse + ); + +// +// IPMI NetFnTransport +// + +/** + This function activates SOL + + @param[in] SolActivatingRequest SOL activating request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSolActivating ( + IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function sets SOL configuration parameters. + + @param[in] SetConfigurationParametersRequest Set SOL configuration parameters + command request. + @param[in] SetConfigurationParametersRequestSize Size of the set SOL configuration + parameters command request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSolConfigurationParameters ( + IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest, + IN UINT32 SetConfigurationParametersRequestSize, + OUT UINT8 *CompletionCode + ); + +/** + This function gets SOL configuration parameters. + + @param[in] GetConfigurationParametersRequest Get SOL configuration parameters + command request. + @param[out] GetConfigurationParametersResponse Get SOL configuration parameters + response. + @param[in,out] GetConfigurationParametersResponseSize When input, the size of the expected + response. + When output, the exact size of + expect response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSolConfigurationParameters ( + IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest, + OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse, + IN OUT UINT32 *GetConfigurationParametersResponseSize + ); + +/** + This function gets the LAN configuration parameter. + + @param[in] GetLanConfigurationParametersRequest Get LAN configuration parameters command request. + @param[in] GetLanConfigurationParametersResponse The response of the get LAN configuration parameters. + @param[in,out] GetLanConfigurationParametersSize When input, the expected size of response data. + When out, the exact size of response data. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ + +EFI_STATUS +EFIAPI +IpmiGetLanConfigurationParameters ( + IN IPMI_GET_LAN_CONFIGURATION_PARAMETERS_REQUEST *GetLanConfigurationParametersRequest, + OUT IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE *GetLanConfigurationParametersResponse, + IN OUT UINT32 *GetLanConfigurationParametersSize + ); + +// +// IPMI NetFnChassis +// + +/** + This function gets chassis capability. + + @param[out] GetChassisCapabilitiesResponse Gets chassis capability command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChassisCapabilities ( + OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse + ); + +/** + This function gets chassis status. + + @param[out] GetChassisCapabilitiesResponse The get chassis status command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChassisStatus ( + OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse + ); + +/** + This function sends chassis control request. + + @param[in] ChassisControlRequest The chassis control request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiChassisControl ( + IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function sets power restore policy. + + @param[in] SetPowerRestireRequest The set power restore policy control + command request. + @param[out] SetPowerRestireResponse The response of power restore policy. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetPowerRestorePolicy ( + IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *SetPowerRestireRequest, + OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *SetPowerRestireResponse + ); + +// +// IPMI NetFnStorage +// + +/** + This function sets system boot option. + + @param[in] BootOptionsRequest Set system boot option request. + @param[out] BootOptionsResponse The response of set system boot + option request. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSystemBootOptions ( + IN IPMI_SET_BOOT_OPTIONS_REQUEST *BootOptionsRequest, + OUT IPMI_SET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse + ); + +/** + This function gets system boot option. + + @param[in] BootOptionsRequest Get system boot option request. + @param[out] BootOptionsResponse The response of get system boot + option request. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemBootOptions ( + IN IPMI_GET_BOOT_OPTIONS_REQUEST *BootOptionsRequest, + OUT IPMI_GET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse + ); + +/** + This function gets FRU inventory area info. + + @param[in] GetFruInventoryAreaInfoRequest Get FRU inventory area command request. + @param[out] GetFruInventoryAreaInfoResponse get FRU inventory area command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetFruInventoryAreaInfo ( + IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest, + OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse + ); + +/** + This function reads FRU data. + + @param[in] ReadFruDataRequest Read FRU data command request. + @param[out] ReadFruDataResponse Read FRU data command response. + @param[in,out] ReadFruDataResponseSize Size of the read FRU data response. + When input, the expected size of response data. + When out, the exact size of response data. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiReadFruData ( + IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest, + OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse, + IN OUT UINT32 *ReadFruDataResponseSize + ); + +/** + This function gets chassis capability. + + @param[in] WriteFruDataRequest Write FRU data command request. + @param[in] WriteFruDataRequestSize Size of the write FRU data command request. + @param[out] WriteFruDataResponse Write FRU data response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiWriteFruData ( + IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest, + IN UINT32 WriteFruDataRequestSize, + OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse + ); + +/** + This function gets SEL information. + + @param[out] GetSelInfoResponse Get SEL information command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelInfo ( + OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse + ); + +/** + This function gets SEL entry. + + @param[in] GetSelEntryRequest Get SEL entry command request. + @param[out] GetSelEntryResponse Get SEL entry command response. + @param[in,out] GetSelEntryResponseSize Size of Get SEL entry request. + When input, the expected size of response data. + When out, the exact size of response data. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelEntry ( + IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest, + OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse, + IN OUT UINT32 *GetSelEntryResponseSize + ); + +/** + This function adds SEL entry. + + @param[in] AddSelEntryRequest Add SEL entry command request. + @param[out] AddSelEntryResponse Add SEL entry command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiAddSelEntry ( + IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest, + OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse + ); + +/** + This function partially adds SEL entry. + + @param[in] PartialAddSelEntryRequest Partial add SEL entry command request. + @param[in] PartialAddSelEntryRequestSize Size of partial add SEL entry command request. + @param[out] PartialAddSelEntryResponse Partial add SEL entry command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiPartialAddSelEntry ( + IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest, + IN UINT32 PartialAddSelEntryRequestSize, + OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse + ); + +/** + This function clears SEL entry. + + @param[in] ClearSelRequest Clear SEL command request. + @param[out] ClearSelResponse Clear SEL command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiClearSel ( + IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest, + OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse + ); + +/** + This function gets SEL time. + + @param[out] GetSelTimeResponse Get SEL time command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelTime ( + OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse + ); + +/** + This function sets SEL time. + + @param[in] SetSelTimeRequest Set SEL time command request. + @param[out] CompletionCode Command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSelTime ( + IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function gets SDR repository information. + + @param[out] GetSdrRepositoryInfoResp Get SDR repository response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. +**/ +EFI_STATUS +EFIAPI +IpmiGetSdrRepositoryInfo ( + OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp + ); + +/** + This function gets SDR + + @param[in] GetSdrRequest Get SDR resquest. + @param[out] GetSdrResponse Get SDR response. + @param[in,out] GetSdrResponseSize The size of get SDR response. + When input, the expected size of response data. + When out, the exact size of response data. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSdr ( + IN IPMI_GET_SDR_REQUEST *GetSdrRequest, + OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse, + IN OUT UINT32 *GetSdrResponseSize + ); + +#endif diff --git a/MdeModulePkg/Include/Library/IpmiLib.h b/MdeModulePkg/Include/Library/IpmiLib.h index d3129d230b..776ba60bb0 100644 --- a/MdeModulePkg/Include/Library/IpmiLib.h +++ b/MdeModulePkg/Include/Library/IpmiLib.h @@ -1,44 +1,44 @@ -/** @file
- This library abstract how to access IPMI device via IPMI command.
-
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved. <BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _IPMI_LIB_H_
-#define _IPMI_LIB_H_
-
-#include <Uefi.h>
-#include <IndustryStandard/Ipmi.h>
-
-/**
- This service enables submitting commands via Ipmi.
-
- @param[in] NetFunction Net function of the command.
- @param[in] Command IPMI Command.
- @param[in] RequestData Command Request Data.
- @param[in] RequestDataSize Size of Command Request Data.
- @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
- @param[in, out] ResponseDataSize Size of Command Response Data.
-
- @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
- @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
- @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
- @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
- @retval EFI_TIMEOUT The command time out.
- @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
- @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error.
-**/
-EFI_STATUS
-EFIAPI
-IpmiSubmitCommand (
- IN UINT8 NetFunction,
- IN UINT8 Command,
- IN UINT8 *RequestData,
- IN UINT32 RequestDataSize,
- OUT UINT8 *ResponseData,
- IN OUT UINT32 *ResponseDataSize
- );
-
-#endif
+/** @file + This library abstract how to access IPMI device via IPMI command. + +Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved. <BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _IPMI_LIB_H_ +#define _IPMI_LIB_H_ + +#include <Uefi.h> +#include <IndustryStandard/Ipmi.h> + +/** + This service enables submitting commands via Ipmi. + + @param[in] NetFunction Net function of the command. + @param[in] Command IPMI Command. + @param[in] RequestData Command Request Data. + @param[in] RequestDataSize Size of Command Request Data. + @param[out] ResponseData Command Response Data. The completion code is the first byte of response data. + @param[in, out] ResponseDataSize Size of Command Response Data. + + @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received. + @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device. + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access. + @retval EFI_DEVICE_ERROR Ipmi Device hardware error. + @retval EFI_TIMEOUT The command time out. + @retval EFI_UNSUPPORTED The command was not successfully sent to the device. + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error. +**/ +EFI_STATUS +EFIAPI +IpmiSubmitCommand ( + IN UINT8 NetFunction, + IN UINT8 Command, + IN UINT8 *RequestData, + IN UINT32 RequestDataSize, + OUT UINT8 *ResponseData, + IN OUT UINT32 *ResponseDataSize + ); + +#endif diff --git a/MdeModulePkg/Include/Library/LockBoxLib.h b/MdeModulePkg/Include/Library/LockBoxLib.h index ab0eb942d3..87a44d8b5f 100644 --- a/MdeModulePkg/Include/Library/LockBoxLib.h +++ b/MdeModulePkg/Include/Library/LockBoxLib.h @@ -1,137 +1,137 @@ -/** @file
- This library is only intended to be used by DXE modules that need save
- confidential information to LockBox and get it by PEI modules in S3 phase.
-
-Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _LOCK_BOX_LIB_H_
-#define _LOCK_BOX_LIB_H_
-
-/**
- This function will save confidential information to lockbox.
-
- @param Guid the guid to identify the confidential information
- @param Buffer the address of the confidential information
- @param Length the length of the confidential information
-
- @retval RETURN_SUCCESS the information is saved successfully.
- @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0
- @retval RETURN_ALREADY_STARTED the requested GUID already exist.
- @retval RETURN_OUT_OF_RESOURCES no enough resource to save the information.
- @retval RETURN_ACCESS_DENIED it is too late to invoke this interface
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-SaveLockBox (
- IN GUID *Guid,
- IN VOID *Buffer,
- IN UINTN Length
- );
-
-/**
- This function will set lockbox attributes.
-
- @param Guid the guid to identify the confidential information
- @param Attributes the attributes of the lockbox
-
- @retval RETURN_SUCCESS the information is saved successfully.
- @retval RETURN_INVALID_PARAMETER attributes is invalid.
- @retval RETURN_NOT_FOUND the requested GUID not found.
- @retval RETURN_ACCESS_DENIED it is too late to invoke this interface
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-SetLockBoxAttributes (
- IN GUID *Guid,
- IN UINT64 Attributes
- );
-
-//
-// With this flag, this LockBox can be restored to this Buffer
-// with RestoreAllLockBoxInPlace()
-//
-#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE BIT0
-//
-// With this flag, this LockBox can be restored in S3 resume only.
-// This LockBox can not be restored after SmmReadyToLock in normal boot
-// and after EndOfS3Resume in S3 resume.
-// It can not be set together with LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE.
-//
-#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY BIT1
-
-/**
- This function will update confidential information to lockbox.
-
- @param Guid the guid to identify the original confidential information
- @param Offset the offset of the original confidential information
- @param Buffer the address of the updated confidential information
- @param Length the length of the updated confidential information
-
- @retval RETURN_SUCCESS the information is saved successfully.
- @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0.
- @retval RETURN_NOT_FOUND the requested GUID not found.
- @retval RETURN_BUFFER_TOO_SMALL for lockbox without attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY,
- the original buffer to too small to hold new information.
- @retval RETURN_OUT_OF_RESOURCES for lockbox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY,
- no enough resource to save the information.
- @retval RETURN_ACCESS_DENIED it is too late to invoke this interface
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-UpdateLockBox (
- IN GUID *Guid,
- IN UINTN Offset,
- IN VOID *Buffer,
- IN UINTN Length
- );
-
-/**
- This function will restore confidential information from lockbox.
-
- @param Guid the guid to identify the confidential information
- @param Buffer the address of the restored confidential information
- NULL means restored to original address, Length MUST be NULL at same time.
- @param Length the length of the restored confidential information
-
- @retval RETURN_SUCCESS the information is restored successfully.
- @retval RETURN_INVALID_PARAMETER the Guid is NULL, or one of Buffer and Length is NULL.
- @retval RETURN_WRITE_PROTECTED Buffer and Length are NULL, but the LockBox has no
- LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute.
- @retval RETURN_BUFFER_TOO_SMALL the Length is too small to hold the confidential information.
- @retval RETURN_NOT_FOUND the requested GUID not found.
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_ACCESS_DENIED not allow to restore to the address
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-RestoreLockBox (
- IN GUID *Guid,
- IN VOID *Buffer OPTIONAL,
- IN OUT UINTN *Length OPTIONAL
- );
-
-/**
- This function will restore confidential information from all lockbox which have RestoreInPlace attribute.
-
- @retval RETURN_SUCCESS the information is restored successfully.
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-RestoreAllLockBoxInPlace (
- VOID
- );
-
-#endif
+/** @file + This library is only intended to be used by DXE modules that need save + confidential information to LockBox and get it by PEI modules in S3 phase. + +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _LOCK_BOX_LIB_H_ +#define _LOCK_BOX_LIB_H_ + +/** + This function will save confidential information to lockbox. + + @param Guid the guid to identify the confidential information + @param Buffer the address of the confidential information + @param Length the length of the confidential information + + @retval RETURN_SUCCESS the information is saved successfully. + @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0 + @retval RETURN_ALREADY_STARTED the requested GUID already exist. + @retval RETURN_OUT_OF_RESOURCES no enough resource to save the information. + @retval RETURN_ACCESS_DENIED it is too late to invoke this interface + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +SaveLockBox ( + IN GUID *Guid, + IN VOID *Buffer, + IN UINTN Length + ); + +/** + This function will set lockbox attributes. + + @param Guid the guid to identify the confidential information + @param Attributes the attributes of the lockbox + + @retval RETURN_SUCCESS the information is saved successfully. + @retval RETURN_INVALID_PARAMETER attributes is invalid. + @retval RETURN_NOT_FOUND the requested GUID not found. + @retval RETURN_ACCESS_DENIED it is too late to invoke this interface + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +SetLockBoxAttributes ( + IN GUID *Guid, + IN UINT64 Attributes + ); + +// +// With this flag, this LockBox can be restored to this Buffer +// with RestoreAllLockBoxInPlace() +// +#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE BIT0 +// +// With this flag, this LockBox can be restored in S3 resume only. +// This LockBox can not be restored after SmmReadyToLock in normal boot +// and after EndOfS3Resume in S3 resume. +// It can not be set together with LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE. +// +#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY BIT1 + +/** + This function will update confidential information to lockbox. + + @param Guid the guid to identify the original confidential information + @param Offset the offset of the original confidential information + @param Buffer the address of the updated confidential information + @param Length the length of the updated confidential information + + @retval RETURN_SUCCESS the information is saved successfully. + @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0. + @retval RETURN_NOT_FOUND the requested GUID not found. + @retval RETURN_BUFFER_TOO_SMALL for lockbox without attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY, + the original buffer to too small to hold new information. + @retval RETURN_OUT_OF_RESOURCES for lockbox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY, + no enough resource to save the information. + @retval RETURN_ACCESS_DENIED it is too late to invoke this interface + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +UpdateLockBox ( + IN GUID *Guid, + IN UINTN Offset, + IN VOID *Buffer, + IN UINTN Length + ); + +/** + This function will restore confidential information from lockbox. + + @param Guid the guid to identify the confidential information + @param Buffer the address of the restored confidential information + NULL means restored to original address, Length MUST be NULL at same time. + @param Length the length of the restored confidential information + + @retval RETURN_SUCCESS the information is restored successfully. + @retval RETURN_INVALID_PARAMETER the Guid is NULL, or one of Buffer and Length is NULL. + @retval RETURN_WRITE_PROTECTED Buffer and Length are NULL, but the LockBox has no + LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute. + @retval RETURN_BUFFER_TOO_SMALL the Length is too small to hold the confidential information. + @retval RETURN_NOT_FOUND the requested GUID not found. + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_ACCESS_DENIED not allow to restore to the address + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +RestoreLockBox ( + IN GUID *Guid, + IN VOID *Buffer OPTIONAL, + IN OUT UINTN *Length OPTIONAL + ); + +/** + This function will restore confidential information from all lockbox which have RestoreInPlace attribute. + + @retval RETURN_SUCCESS the information is restored successfully. + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +RestoreAllLockBoxInPlace ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/MemoryProfileLib.h b/MdeModulePkg/Include/Library/MemoryProfileLib.h index f87f245158..4a2b59ff92 100644 --- a/MdeModulePkg/Include/Library/MemoryProfileLib.h +++ b/MdeModulePkg/Include/Library/MemoryProfileLib.h @@ -1,47 +1,47 @@ -/** @file
- Provides services to record memory profile of multilevel caller.
-
- Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _MEMORY_PROFILE_LIB_H_
-#define _MEMORY_PROFILE_LIB_H_
-
-#include <Guid/MemoryProfile.h>
-
-/**
- Record memory profile of multilevel caller.
-
- @param[in] CallerAddress Address of caller.
- @param[in] Action Memory profile action.
- @param[in] MemoryType Memory type.
- EfiMaxMemoryType means the MemoryType is unknown.
- @param[in] Buffer Buffer address.
- @param[in] Size Buffer size.
- @param[in] ActionString String for memory profile action.
- Only needed for user defined allocate action.
-
- @return EFI_SUCCESS Memory profile is updated.
- @return EFI_UNSUPPORTED Memory profile is unsupported,
- or memory profile for the image is not required,
- or memory profile for the memory type is not required.
- @return EFI_ACCESS_DENIED It is during memory profile data getting.
- @return EFI_ABORTED Memory profile recording is not enabled.
- @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
- @return EFI_NOT_FOUND No matched allocate info found for free action.
-
-**/
-EFI_STATUS
-EFIAPI
-MemoryProfileLibRecord (
- IN PHYSICAL_ADDRESS CallerAddress,
- IN MEMORY_PROFILE_ACTION Action,
- IN EFI_MEMORY_TYPE MemoryType,
- IN VOID *Buffer,
- IN UINTN Size,
- IN CHAR8 *ActionString OPTIONAL
- );
-
-#endif
+/** @file + Provides services to record memory profile of multilevel caller. + + Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _MEMORY_PROFILE_LIB_H_ +#define _MEMORY_PROFILE_LIB_H_ + +#include <Guid/MemoryProfile.h> + +/** + Record memory profile of multilevel caller. + + @param[in] CallerAddress Address of caller. + @param[in] Action Memory profile action. + @param[in] MemoryType Memory type. + EfiMaxMemoryType means the MemoryType is unknown. + @param[in] Buffer Buffer address. + @param[in] Size Buffer size. + @param[in] ActionString String for memory profile action. + Only needed for user defined allocate action. + + @return EFI_SUCCESS Memory profile is updated. + @return EFI_UNSUPPORTED Memory profile is unsupported, + or memory profile for the image is not required, + or memory profile for the memory type is not required. + @return EFI_ACCESS_DENIED It is during memory profile data getting. + @return EFI_ABORTED Memory profile recording is not enabled. + @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action. + @return EFI_NOT_FOUND No matched allocate info found for free action. + +**/ +EFI_STATUS +EFIAPI +MemoryProfileLibRecord ( + IN PHYSICAL_ADDRESS CallerAddress, + IN MEMORY_PROFILE_ACTION Action, + IN EFI_MEMORY_TYPE MemoryType, + IN VOID *Buffer, + IN UINTN Size, + IN CHAR8 *ActionString OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h b/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h index b2300c9647..8149fceafc 100644 --- a/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h +++ b/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h @@ -1,58 +1,58 @@ -/** @file
- Copyright (c) 2016, Linaro, Ltd. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__
-#define __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__
-
-#include <Protocol/NonDiscoverableDevice.h>
-
-typedef enum {
- NonDiscoverableDeviceTypeAhci,
- NonDiscoverableDeviceTypeAmba,
- NonDiscoverableDeviceTypeEhci,
- NonDiscoverableDeviceTypeNvme,
- NonDiscoverableDeviceTypeOhci,
- NonDiscoverableDeviceTypeSdhci,
- NonDiscoverableDeviceTypeUfs,
- NonDiscoverableDeviceTypeUhci,
- NonDiscoverableDeviceTypeXhci,
- NonDiscoverableDeviceTypeMax,
-} NON_DISCOVERABLE_DEVICE_TYPE;
-
-/**
- Register a non-discoverable MMIO device
-
- @param[in] Type The type of non-discoverable device
- @param[in] DmaType Whether the device is DMA coherent
- @param[in] InitFunc Initialization routine to be invoked when
- the device is enabled
- @param[in,out] Handle The handle onto which to install the
- non-discoverable device protocol.
- If Handle is NULL or *Handle is NULL, a
- new handle will be allocated.
- @param[in] NumMmioResources The number of UINTN base/size pairs that
- follow, each describing an MMIO region
- owned by the device
- @param[in] ... The variable argument list which contains the
- info about MmioResources.
-
- @retval EFI_SUCCESS The registration succeeded.
- @retval Other The registration failed.
-
-**/
-EFI_STATUS
-EFIAPI
-RegisterNonDiscoverableMmioDevice (
- IN NON_DISCOVERABLE_DEVICE_TYPE Type,
- IN NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType,
- IN NON_DISCOVERABLE_DEVICE_INIT InitFunc,
- IN OUT EFI_HANDLE *Handle OPTIONAL,
- IN UINTN NumMmioResources,
- ...
- );
-
-#endif
+/** @file + Copyright (c) 2016, Linaro, Ltd. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__ +#define __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__ + +#include <Protocol/NonDiscoverableDevice.h> + +typedef enum { + NonDiscoverableDeviceTypeAhci, + NonDiscoverableDeviceTypeAmba, + NonDiscoverableDeviceTypeEhci, + NonDiscoverableDeviceTypeNvme, + NonDiscoverableDeviceTypeOhci, + NonDiscoverableDeviceTypeSdhci, + NonDiscoverableDeviceTypeUfs, + NonDiscoverableDeviceTypeUhci, + NonDiscoverableDeviceTypeXhci, + NonDiscoverableDeviceTypeMax, +} NON_DISCOVERABLE_DEVICE_TYPE; + +/** + Register a non-discoverable MMIO device + + @param[in] Type The type of non-discoverable device + @param[in] DmaType Whether the device is DMA coherent + @param[in] InitFunc Initialization routine to be invoked when + the device is enabled + @param[in,out] Handle The handle onto which to install the + non-discoverable device protocol. + If Handle is NULL or *Handle is NULL, a + new handle will be allocated. + @param[in] NumMmioResources The number of UINTN base/size pairs that + follow, each describing an MMIO region + owned by the device + @param[in] ... The variable argument list which contains the + info about MmioResources. + + @retval EFI_SUCCESS The registration succeeded. + @retval Other The registration failed. + +**/ +EFI_STATUS +EFIAPI +RegisterNonDiscoverableMmioDevice ( + IN NON_DISCOVERABLE_DEVICE_TYPE Type, + IN NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType, + IN NON_DISCOVERABLE_DEVICE_INIT InitFunc, + IN OUT EFI_HANDLE *Handle OPTIONAL, + IN UINTN NumMmioResources, + ... + ); + +#endif diff --git a/MdeModulePkg/Include/Library/OemHookStatusCodeLib.h b/MdeModulePkg/Include/Library/OemHookStatusCodeLib.h index c12f61f4f9..154d10adb3 100644 --- a/MdeModulePkg/Include/Library/OemHookStatusCodeLib.h +++ b/MdeModulePkg/Include/Library/OemHookStatusCodeLib.h @@ -1,72 +1,72 @@ -/** @file
- OEM hook status code library. Platform can implement an instance to
- initialize the OEM devices to report status code information.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __OEM_HOOK_STATUSCODE_LIB__
-#define __OEM_HOOK_STATUSCODE_LIB__
-
-/**
-
- Initialize OEM status code device.
-
-
- @return Status of initialization of OEM status code device.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeInitialize (
- VOID
- );
-
-/**
- Report status code to OEM device.
-
- @param CodeType Indicates the type of status code being reported.
-
- @param Value Describes the current status of a hardware or software entity.
- This includes both an operation and classification information
- about the class and subclass.
- For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes,
- it is not defined at this time.
- Specific values are discussed in the Intel Platform Innovation
- Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass
- pairing.
- The instance differentiates between them. An instance of 0
- indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers
- start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply
- different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface()
- in the UEFI 2.0 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data.
-
- @return The function always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeReport (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-#endif // __OEM_HOOK_STATUSCODE_LIB__
+/** @file + OEM hook status code library. Platform can implement an instance to + initialize the OEM devices to report status code information. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __OEM_HOOK_STATUSCODE_LIB__ +#define __OEM_HOOK_STATUSCODE_LIB__ + +/** + + Initialize OEM status code device. + + + @return Status of initialization of OEM status code device. + +**/ +EFI_STATUS +EFIAPI +OemHookStatusCodeInitialize ( + VOID + ); + +/** + Report status code to OEM device. + + @param CodeType Indicates the type of status code being reported. + + @param Value Describes the current status of a hardware or software entity. + This includes both an operation and classification information + about the class and subclass. + For progress codes, the operation is the current activity. + For error codes, it is the exception. For debug codes, + it is not defined at this time. + Specific values are discussed in the Intel Platform Innovation + Framework for EFI Status Code Specification. + + @param Instance The enumeration of a hardware or software entity within the system. + A system may contain multiple entities that match a class/subclass + pairing. + The instance differentiates between them. An instance of 0 + indicates that instance information is unavailable, + not meaningful, or not relevant. Valid instance numbers + start with 1. + + + @param CallerId This optional parameter may be used to identify the caller. + This parameter allows the status code driver to apply + different rules to different callers. + Type EFI_GUID is defined in InstallProtocolInterface() + in the UEFI 2.0 Specification. + + + @param Data This optional parameter may be used to pass additional data. + + @return The function always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +OemHookStatusCodeReport ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID *CallerId OPTIONAL, + IN EFI_STATUS_CODE_DATA *Data OPTIONAL + ); + +#endif // __OEM_HOOK_STATUSCODE_LIB__ diff --git a/MdeModulePkg/Include/Library/PciHostBridgeLib.h b/MdeModulePkg/Include/Library/PciHostBridgeLib.h index 54b5a14243..46e421ad1e 100644 --- a/MdeModulePkg/Include/Library/PciHostBridgeLib.h +++ b/MdeModulePkg/Include/Library/PciHostBridgeLib.h @@ -1,116 +1,116 @@ -/** @file
- PCI Host Bridge Library consumed by PciHostBridgeDxe driver returning
- the platform specific information about the PCI Host Bridge.
-
- Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PCI_HOST_BRIDGE_LIB_H__
-#define __PCI_HOST_BRIDGE_LIB_H__
-
-//
-// (Base > Limit) indicates an aperture is not available.
-//
-typedef struct {
- //
- // Base and Limit are the device address instead of host address when
- // Translation is not zero
- //
- UINT64 Base;
- UINT64 Limit;
- //
- // According to UEFI 2.7, Device Address = Host Address + Translation,
- // so Translation = Device Address - Host Address.
- // On platforms where Translation is not zero, the subtraction is probably to
- // be performed with UINT64 wrap-around semantics, for we may translate an
- // above-4G host address into a below-4G device address for legacy PCIe device
- // compatibility.
- //
- // NOTE: The alignment of Translation is required to be larger than any BAR
- // alignment in the same root bridge, so that the same alignment can be
- // applied to both device address and host address, which simplifies the
- // situation and makes the current resource allocation code in generic PCI
- // host bridge driver still work.
- //
- UINT64 Translation;
-} PCI_ROOT_BRIDGE_APERTURE;
-
-typedef struct {
- UINT32 Segment; ///< Segment number.
- UINT64 Supports; ///< Supported attributes.
- ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()
- ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- UINT64 Attributes; ///< Initial attributes.
- ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()
- ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- BOOLEAN DmaAbove4G; ///< DMA above 4GB memory.
- ///< Set to TRUE when root bridge supports DMA above 4GB memory.
- BOOLEAN NoExtendedConfigSpace; ///< When FALSE, the root bridge supports
- ///< Extended (4096-byte) Configuration Space.
- ///< When TRUE, the root bridge supports
- ///< 256-byte Configuration Space only.
- BOOLEAN ResourceAssigned; ///< Resource assignment status of the root bridge.
- ///< Set to TRUE if Bus/IO/MMIO resources for root bridge have been assigned.
- UINT64 AllocationAttributes; ///< Allocation attributes.
- ///< Refer to EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM and
- ///< EFI_PCI_HOST_BRIDGE_MEM64_DECODE used by GetAllocAttributes()
- ///< in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
- PCI_ROOT_BRIDGE_APERTURE Bus; ///< Bus aperture which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE Io; ///< IO aperture which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE Mem; ///< MMIO aperture below 4GB which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE MemAbove4G; ///< MMIO aperture above 4GB which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE PMem; ///< Prefetchable MMIO aperture below 4GB which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE PMemAbove4G; ///< Prefetchable MMIO aperture above 4GB which can be used by the root bridge.
- EFI_DEVICE_PATH_PROTOCOL *DevicePath; ///< Device path.
-} PCI_ROOT_BRIDGE;
-
-/**
- Return all the root bridge instances in an array.
-
- @param Count Return the count of root bridge instances.
-
- @return All the root bridge instances in an array.
- The array should be passed into PciHostBridgeFreeRootBridges()
- when it's not used.
-**/
-PCI_ROOT_BRIDGE *
-EFIAPI
-PciHostBridgeGetRootBridges (
- UINTN *Count
- );
-
-/**
- Free the root bridge instances array returned from PciHostBridgeGetRootBridges().
-
- @param Bridges The root bridge instances array.
- @param Count The count of the array.
-**/
-VOID
-EFIAPI
-PciHostBridgeFreeRootBridges (
- PCI_ROOT_BRIDGE *Bridges,
- UINTN Count
- );
-
-/**
- Inform the platform that the resource conflict happens.
-
- @param HostBridgeHandle Handle of the Host Bridge.
- @param Configuration Pointer to PCI I/O and PCI memory resource descriptors.
- The Configuration contains the resources for all the
- root bridges. The resource for each root bridge is
- terminated with END descriptor and an additional END
- is appended indicating the end of the entire resources.
- The resource descriptor field values follow the description
- in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.SubmitResources().
-**/
-VOID
-EFIAPI
-PciHostBridgeResourceConflict (
- EFI_HANDLE HostBridgeHandle,
- VOID *Configuration
- );
-
-#endif
+/** @file + PCI Host Bridge Library consumed by PciHostBridgeDxe driver returning + the platform specific information about the PCI Host Bridge. + + Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PCI_HOST_BRIDGE_LIB_H__ +#define __PCI_HOST_BRIDGE_LIB_H__ + +// +// (Base > Limit) indicates an aperture is not available. +// +typedef struct { + // + // Base and Limit are the device address instead of host address when + // Translation is not zero + // + UINT64 Base; + UINT64 Limit; + // + // According to UEFI 2.7, Device Address = Host Address + Translation, + // so Translation = Device Address - Host Address. + // On platforms where Translation is not zero, the subtraction is probably to + // be performed with UINT64 wrap-around semantics, for we may translate an + // above-4G host address into a below-4G device address for legacy PCIe device + // compatibility. + // + // NOTE: The alignment of Translation is required to be larger than any BAR + // alignment in the same root bridge, so that the same alignment can be + // applied to both device address and host address, which simplifies the + // situation and makes the current resource allocation code in generic PCI + // host bridge driver still work. + // + UINT64 Translation; +} PCI_ROOT_BRIDGE_APERTURE; + +typedef struct { + UINT32 Segment; ///< Segment number. + UINT64 Supports; ///< Supported attributes. + ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes() + ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + UINT64 Attributes; ///< Initial attributes. + ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes() + ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + BOOLEAN DmaAbove4G; ///< DMA above 4GB memory. + ///< Set to TRUE when root bridge supports DMA above 4GB memory. + BOOLEAN NoExtendedConfigSpace; ///< When FALSE, the root bridge supports + ///< Extended (4096-byte) Configuration Space. + ///< When TRUE, the root bridge supports + ///< 256-byte Configuration Space only. + BOOLEAN ResourceAssigned; ///< Resource assignment status of the root bridge. + ///< Set to TRUE if Bus/IO/MMIO resources for root bridge have been assigned. + UINT64 AllocationAttributes; ///< Allocation attributes. + ///< Refer to EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM and + ///< EFI_PCI_HOST_BRIDGE_MEM64_DECODE used by GetAllocAttributes() + ///< in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL. + PCI_ROOT_BRIDGE_APERTURE Bus; ///< Bus aperture which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE Io; ///< IO aperture which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE Mem; ///< MMIO aperture below 4GB which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE MemAbove4G; ///< MMIO aperture above 4GB which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE PMem; ///< Prefetchable MMIO aperture below 4GB which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE PMemAbove4G; ///< Prefetchable MMIO aperture above 4GB which can be used by the root bridge. + EFI_DEVICE_PATH_PROTOCOL *DevicePath; ///< Device path. +} PCI_ROOT_BRIDGE; + +/** + Return all the root bridge instances in an array. + + @param Count Return the count of root bridge instances. + + @return All the root bridge instances in an array. + The array should be passed into PciHostBridgeFreeRootBridges() + when it's not used. +**/ +PCI_ROOT_BRIDGE * +EFIAPI +PciHostBridgeGetRootBridges ( + UINTN *Count + ); + +/** + Free the root bridge instances array returned from PciHostBridgeGetRootBridges(). + + @param Bridges The root bridge instances array. + @param Count The count of the array. +**/ +VOID +EFIAPI +PciHostBridgeFreeRootBridges ( + PCI_ROOT_BRIDGE *Bridges, + UINTN Count + ); + +/** + Inform the platform that the resource conflict happens. + + @param HostBridgeHandle Handle of the Host Bridge. + @param Configuration Pointer to PCI I/O and PCI memory resource descriptors. + The Configuration contains the resources for all the + root bridges. The resource for each root bridge is + terminated with END descriptor and an additional END + is appended indicating the end of the entire resources. + The resource descriptor field values follow the description + in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.SubmitResources(). +**/ +VOID +EFIAPI +PciHostBridgeResourceConflict ( + EFI_HANDLE HostBridgeHandle, + VOID *Configuration + ); + +#endif diff --git a/MdeModulePkg/Include/Library/PlatformBootManagerLib.h b/MdeModulePkg/Include/Library/PlatformBootManagerLib.h index 9dd590c9e0..3b8238d52e 100644 --- a/MdeModulePkg/Include/Library/PlatformBootManagerLib.h +++ b/MdeModulePkg/Include/Library/PlatformBootManagerLib.h @@ -1,68 +1,68 @@ -/** @file
- Platform Boot Manager library definition. A platform can implement
- instances to support platform-specific behavior.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PLATFORM_BOOT_MANAGER_LIB_H_
-#define __PLATFORM_BOOT_MANAGER_LIB_H_
-#include <Library/UefiBootManagerLib.h>
-
-/**
- Do the platform specific action before the console is connected.
-
- Such as:
- Update console variable;
- Register new Driver#### or Boot####;
- Signal ReadyToLock event.
-**/
-VOID
-EFIAPI
-PlatformBootManagerBeforeConsole (
- VOID
- );
-
-/**
- Do the platform specific action after the console is connected.
-
- Such as:
- Dynamically switch output mode;
- Signal console ready platform customized event;
- Run diagnostics like memory testing;
- Connect certain devices;
- Dispatch aditional option roms.
-**/
-VOID
-EFIAPI
-PlatformBootManagerAfterConsole (
- VOID
- );
-
-/**
- This function is called each second during the boot manager waits the timeout.
-
- @param TimeoutRemain The remaining timeout.
-**/
-VOID
-EFIAPI
-PlatformBootManagerWaitCallback (
- UINT16 TimeoutRemain
- );
-
-/**
- The function is called when no boot option could be launched,
- including platform recovery options and options pointing to applications
- built into firmware volumes.
-
- If this function returns, BDS attempts to enter an infinite loop.
-**/
-VOID
-EFIAPI
-PlatformBootManagerUnableToBoot (
- VOID
- );
-
-#endif
+/** @file + Platform Boot Manager library definition. A platform can implement + instances to support platform-specific behavior. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLATFORM_BOOT_MANAGER_LIB_H_ +#define __PLATFORM_BOOT_MANAGER_LIB_H_ +#include <Library/UefiBootManagerLib.h> + +/** + Do the platform specific action before the console is connected. + + Such as: + Update console variable; + Register new Driver#### or Boot####; + Signal ReadyToLock event. +**/ +VOID +EFIAPI +PlatformBootManagerBeforeConsole ( + VOID + ); + +/** + Do the platform specific action after the console is connected. + + Such as: + Dynamically switch output mode; + Signal console ready platform customized event; + Run diagnostics like memory testing; + Connect certain devices; + Dispatch aditional option roms. +**/ +VOID +EFIAPI +PlatformBootManagerAfterConsole ( + VOID + ); + +/** + This function is called each second during the boot manager waits the timeout. + + @param TimeoutRemain The remaining timeout. +**/ +VOID +EFIAPI +PlatformBootManagerWaitCallback ( + UINT16 TimeoutRemain + ); + +/** + The function is called when no boot option could be launched, + including platform recovery options and options pointing to applications + built into firmware volumes. + + If this function returns, BDS attempts to enter an infinite loop. +**/ +VOID +EFIAPI +PlatformBootManagerUnableToBoot ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/PlatformHookLib.h b/MdeModulePkg/Include/Library/PlatformHookLib.h index 04cccd9bba..e866df3256 100644 --- a/MdeModulePkg/Include/Library/PlatformHookLib.h +++ b/MdeModulePkg/Include/Library/PlatformHookLib.h @@ -1,31 +1,31 @@ -/** @file
- Platform hook library. Platform can provide an implementation of this
- library class to provide hooks that may be required for some type of
- platform initialization.
-
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PLATFORM_HOOK_LIB__
-#define __PLATFORM_HOOK_LIB__
-
-/**
- Performs platform specific initialization required for the CPU to access
- the hardware associated with a SerialPortLib instance. This function does
- not intiailzie the serial port hardware itself. Instead, it initializes
- hardware devices that are required for the CPU to access the serial port
- hardware. This function may be called more than once.
-
- @retval RETURN_SUCCESS The platform specific initialization succeeded.
- @retval RETURN_DEVICE_ERROR The platform specific initialization could not be completed.
-
-**/
-RETURN_STATUS
-EFIAPI
-PlatformHookSerialPortInitialize (
- VOID
- );
-
-#endif // __PLATFORM_HOOK_LIB__
+/** @file + Platform hook library. Platform can provide an implementation of this + library class to provide hooks that may be required for some type of + platform initialization. + +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLATFORM_HOOK_LIB__ +#define __PLATFORM_HOOK_LIB__ + +/** + Performs platform specific initialization required for the CPU to access + the hardware associated with a SerialPortLib instance. This function does + not intiailzie the serial port hardware itself. Instead, it initializes + hardware devices that are required for the CPU to access the serial port + hardware. This function may be called more than once. + + @retval RETURN_SUCCESS The platform specific initialization succeeded. + @retval RETURN_DEVICE_ERROR The platform specific initialization could not be completed. + +**/ +RETURN_STATUS +EFIAPI +PlatformHookSerialPortInitialize ( + VOID + ); + +#endif // __PLATFORM_HOOK_LIB__ diff --git a/MdeModulePkg/Include/Library/PlatformVarCleanupLib.h b/MdeModulePkg/Include/Library/PlatformVarCleanupLib.h index ac530ff867..24bf54b36f 100644 --- a/MdeModulePkg/Include/Library/PlatformVarCleanupLib.h +++ b/MdeModulePkg/Include/Library/PlatformVarCleanupLib.h @@ -1,55 +1,55 @@ -/** @file
- The library class provides platform variable cleanup services.
-
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PLATFORM_VARIABLE_CLEANUP_LIB_
-#define _PLATFORM_VARIABLE_CLEANUP_LIB_
-
-#include <Guid/VarErrorFlag.h>
-
-typedef enum {
- VarCleanupAll,
- VarCleanupManually,
- VarCleanupMax,
-} VAR_CLEANUP_TYPE;
-
-/**
- Get last boot variable error flag.
-
- @return Last boot variable error flag.
-
-**/
-VAR_ERROR_FLAG
-EFIAPI
-GetLastBootVarErrorFlag (
- VOID
- );
-
-/**
- Platform variable cleanup.
-
- @param[in] Flag Variable error flag.
- @param[in] Type Variable cleanup type.
- If it is VarCleanupManually, the interface must be called after console connected.
-
- @retval EFI_SUCCESS No error or error processed.
- @retval EFI_UNSUPPORTED The specified Flag or Type is not supported.
- For example, system error may be not supported to process and Platform should have mechanism to reset system to manufacture mode.
- Another, if system and user variables are wanted to be distinguished to process, the interface must be called after EndOfDxe.
- @retval EFI_OUT_OF_RESOURCES Not enough resource to process the error.
- @retval EFI_INVALID_PARAMETER The specified Flag or Type is an invalid value.
- @retval Others Other failure occurs.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformVarCleanup (
- IN VAR_ERROR_FLAG Flag,
- IN VAR_CLEANUP_TYPE Type
- );
-
-#endif
+/** @file + The library class provides platform variable cleanup services. + +Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLATFORM_VARIABLE_CLEANUP_LIB_ +#define _PLATFORM_VARIABLE_CLEANUP_LIB_ + +#include <Guid/VarErrorFlag.h> + +typedef enum { + VarCleanupAll, + VarCleanupManually, + VarCleanupMax, +} VAR_CLEANUP_TYPE; + +/** + Get last boot variable error flag. + + @return Last boot variable error flag. + +**/ +VAR_ERROR_FLAG +EFIAPI +GetLastBootVarErrorFlag ( + VOID + ); + +/** + Platform variable cleanup. + + @param[in] Flag Variable error flag. + @param[in] Type Variable cleanup type. + If it is VarCleanupManually, the interface must be called after console connected. + + @retval EFI_SUCCESS No error or error processed. + @retval EFI_UNSUPPORTED The specified Flag or Type is not supported. + For example, system error may be not supported to process and Platform should have mechanism to reset system to manufacture mode. + Another, if system and user variables are wanted to be distinguished to process, the interface must be called after EndOfDxe. + @retval EFI_OUT_OF_RESOURCES Not enough resource to process the error. + @retval EFI_INVALID_PARAMETER The specified Flag or Type is an invalid value. + @retval Others Other failure occurs. + +**/ +EFI_STATUS +EFIAPI +PlatformVarCleanup ( + IN VAR_ERROR_FLAG Flag, + IN VAR_CLEANUP_TYPE Type + ); + +#endif diff --git a/MdeModulePkg/Include/Library/ResetSystemLib.h b/MdeModulePkg/Include/Library/ResetSystemLib.h index 472a9355ea..5c340c9aaa 100644 --- a/MdeModulePkg/Include/Library/ResetSystemLib.h +++ b/MdeModulePkg/Include/Library/ResetSystemLib.h @@ -1,93 +1,93 @@ -/** @file
- System reset Library Services. This library class defines a set of
- methods that reset the whole system.
-
-Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __RESET_SYSTEM_LIB_H__
-#define __RESET_SYSTEM_LIB_H__
-
-#include <Uefi/UefiBaseType.h>
-#include <Uefi/UefiMultiPhase.h>
-
-/**
- This function causes a system-wide reset (cold reset), in which
- all circuitry within the system returns to its initial state. This type of reset
- is asynchronous to system operation and operates without regard to
- cycle boundaries.
-
- If this function returns, it means that the system does not support cold reset.
-**/
-VOID
-EFIAPI
-ResetCold (
- VOID
- );
-
-/**
- This function causes a system-wide initialization (warm reset), in which all processors
- are set to their initial state. Pending cycles are not corrupted.
-
- If this function returns, it means that the system does not support warm reset.
-**/
-VOID
-EFIAPI
-ResetWarm (
- VOID
- );
-
-/**
- This function causes the system to enter a power state equivalent
- to the ACPI G2/S5 or G3 states.
-
- If this function returns, it means that the system does not support shutdown reset.
-**/
-VOID
-EFIAPI
-ResetShutdown (
- VOID
- );
-
-/**
- This function causes a systemwide reset. The exact type of the reset is
- defined by the EFI_GUID that follows the Null-terminated Unicode string passed
- into ResetData. If the platform does not recognize the EFI_GUID in ResetData
- the platform must pick a supported reset type to perform.The platform may
- optionally log the parameters from any non-normal reset that occurs.
-
- @param[in] DataSize The size, in bytes, of ResetData.
- @param[in] ResetData The data buffer starts with a Null-terminated string,
- followed by the EFI_GUID.
-**/
-VOID
-EFIAPI
-ResetPlatformSpecific (
- IN UINTN DataSize,
- IN VOID *ResetData
- );
-
-/**
- The ResetSystem function resets the entire platform.
-
- @param[in] ResetType The type of reset to perform.
- @param[in] ResetStatus The status code for the reset.
- @param[in] DataSize The size, in bytes, of ResetData.
- @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
- the data buffer starts with a Null-terminated string, optionally
- followed by additional binary data. The string is a description
- that the caller may use to further indicate the reason for the
- system reset.
-**/
-VOID
-EFIAPI
-ResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN VOID *ResetData OPTIONAL
- );
-
-#endif
+/** @file + System reset Library Services. This library class defines a set of + methods that reset the whole system. + +Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __RESET_SYSTEM_LIB_H__ +#define __RESET_SYSTEM_LIB_H__ + +#include <Uefi/UefiBaseType.h> +#include <Uefi/UefiMultiPhase.h> + +/** + This function causes a system-wide reset (cold reset), in which + all circuitry within the system returns to its initial state. This type of reset + is asynchronous to system operation and operates without regard to + cycle boundaries. + + If this function returns, it means that the system does not support cold reset. +**/ +VOID +EFIAPI +ResetCold ( + VOID + ); + +/** + This function causes a system-wide initialization (warm reset), in which all processors + are set to their initial state. Pending cycles are not corrupted. + + If this function returns, it means that the system does not support warm reset. +**/ +VOID +EFIAPI +ResetWarm ( + VOID + ); + +/** + This function causes the system to enter a power state equivalent + to the ACPI G2/S5 or G3 states. + + If this function returns, it means that the system does not support shutdown reset. +**/ +VOID +EFIAPI +ResetShutdown ( + VOID + ); + +/** + This function causes a systemwide reset. The exact type of the reset is + defined by the EFI_GUID that follows the Null-terminated Unicode string passed + into ResetData. If the platform does not recognize the EFI_GUID in ResetData + the platform must pick a supported reset type to perform.The platform may + optionally log the parameters from any non-normal reset that occurs. + + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData The data buffer starts with a Null-terminated string, + followed by the EFI_GUID. +**/ +VOID +EFIAPI +ResetPlatformSpecific ( + IN UINTN DataSize, + IN VOID *ResetData + ); + +/** + The ResetSystem function resets the entire platform. + + @param[in] ResetType The type of reset to perform. + @param[in] ResetStatus The status code for the reset. + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown + the data buffer starts with a Null-terminated string, optionally + followed by additional binary data. The string is a description + that the caller may use to further indicate the reason for the + system reset. +**/ +VOID +EFIAPI +ResetSystem ( + IN EFI_RESET_TYPE ResetType, + IN EFI_STATUS ResetStatus, + IN UINTN DataSize, + IN VOID *ResetData OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/ResetUtilityLib.h b/MdeModulePkg/Include/Library/ResetUtilityLib.h index 27aca52490..dae5ecd81a 100644 --- a/MdeModulePkg/Include/Library/ResetUtilityLib.h +++ b/MdeModulePkg/Include/Library/ResetUtilityLib.h @@ -1,131 +1,131 @@ -/** @file
- This header describes various helper functions for resetting the system.
-
- Copyright (c) 2017 - 2019 Intel Corporation. All rights reserved.<BR>
- Copyright (c) 2016 Microsoft Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _RESET_UTILITY_LIB_H_
-#define _RESET_UTILITY_LIB_H_
-
-#include <Uefi/UefiMultiPhase.h>
-
-/**
- This is a shorthand helper function to reset with reset type and a subtype
- so that the caller doesn't have to bother with a function that has half
- a dozen parameters.
-
- This will generate a reset with status EFI_SUCCESS, a NULL string, and
- no custom data. The subtype will be formatted in such a way that it can be
- picked up by notification registrations and custom handlers.
-
- NOTE: This call will fail if the architectural ResetSystem underpinnings
- are not initialized. For DXE, you can add gEfiResetArchProtocolGuid
- to your DEPEX.
-
- @param[in] ResetType The default EFI_RESET_TYPE of the reset.
- @param[in] ResetSubtype GUID pointer for the reset subtype to be used.
-
-**/
-VOID
-EFIAPI
-ResetSystemWithSubtype (
- IN EFI_RESET_TYPE ResetType,
- IN CONST GUID *ResetSubtype
- );
-
-/**
- This is a shorthand helper function to reset with the reset type
- 'EfiResetPlatformSpecific' and a subtype so that the caller doesn't
- have to bother with a function that has half a dozen parameters.
-
- This will generate a reset with status EFI_SUCCESS, a NULL string, and
- no custom data. The subtype will be formatted in such a way that it can be
- picked up by notification registrations and custom handlers.
-
- NOTE: This call will fail if the architectural ResetSystem underpinnings
- are not initialized. For DXE, you can add gEfiResetArchProtocolGuid
- to your DEPEX.
-
- @param[in] ResetSubtype GUID pointer for the reset subtype to be used.
-
-**/
-VOID
-EFIAPI
-ResetPlatformSpecificGuid (
- IN CONST GUID *ResetSubtype
- );
-
-/**
- This function examines the DataSize and ResetData parameters passed to
- to ResetSystem() and detemrines if the ResetData contains a Null-terminated
- Unicode string followed by a GUID specific subtype. If the GUID specific
- subtype is present, then a pointer to the GUID value in ResetData is returned.
-
- @param[in] DataSize The size, in bytes, of ResetData.
- @param[in] ResetData Pointer to the data buffer passed into ResetSystem().
-
- @retval Pointer Pointer to the GUID value in ResetData.
- @retval NULL ResetData is NULL.
- @retval NULL ResetData does not start with a Null-terminated
- Unicode string.
- @retval NULL A Null-terminated Unicode string is present, but there
- are less than sizeof (GUID) bytes after the string.
- @retval NULL No subtype is found.
-
-**/
-GUID *
-EFIAPI
-GetResetPlatformSpecificGuid (
- IN UINTN DataSize,
- IN CONST VOID *ResetData
- );
-
-/**
- This is a helper function that creates the reset data buffer that can be
- passed into ResetSystem().
-
- The reset data buffer is returned in ResetData and contains ResetString
- followed by the ResetSubtype GUID followed by the ExtraData.
-
- NOTE: Strings are internally limited by MAX_UINT16.
-
- @param[in, out] ResetDataSize On input, the size of the ResetData buffer. On
- output, either the total number of bytes
- copied, or the required buffer size.
- @param[in, out] ResetData A pointer to the buffer in which to place the
- final structure.
- @param[in] ResetSubtype Pointer to the GUID specific subtype. This
- parameter is optional and may be NULL.
- @param[in] ResetString Pointer to a Null-terminated Unicode string
- that describes the reset. This parameter is
- optional and may be NULL.
- @param[in] ExtraDataSize The size, in bytes, of ExtraData buffer.
- @param[in] ExtraData Pointer to a buffer of extra data. This
- parameter is optional and may be NULL.
-
- @retval RETURN_SUCCESS ResetDataSize and ResetData are updated.
- @retval RETURN_INVALID_PARAMETER ResetDataSize is NULL.
- @retval RETURN_INVALID_PARAMETER ResetData is NULL.
- @retval RETURN_INVALID_PARAMETER ExtraData was provided without a
- ResetSubtype. This is not supported by the
- UEFI spec.
- @retval RETURN_BUFFER_TOO_SMALL An insufficient buffer was provided.
- ResetDataSize is updated with minimum size
- required.
-**/
-RETURN_STATUS
-EFIAPI
-BuildResetData (
- IN OUT UINTN *ResetDataSize,
- IN OUT VOID *ResetData,
- IN CONST GUID *ResetSubtype OPTIONAL,
- IN CONST CHAR16 *ResetString OPTIONAL,
- IN UINTN ExtraDataSize OPTIONAL,
- IN CONST VOID *ExtraData OPTIONAL
- );
-
-#endif // _RESET_UTILITY_LIB_H_
+/** @file + This header describes various helper functions for resetting the system. + + Copyright (c) 2017 - 2019 Intel Corporation. All rights reserved.<BR> + Copyright (c) 2016 Microsoft Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _RESET_UTILITY_LIB_H_ +#define _RESET_UTILITY_LIB_H_ + +#include <Uefi/UefiMultiPhase.h> + +/** + This is a shorthand helper function to reset with reset type and a subtype + so that the caller doesn't have to bother with a function that has half + a dozen parameters. + + This will generate a reset with status EFI_SUCCESS, a NULL string, and + no custom data. The subtype will be formatted in such a way that it can be + picked up by notification registrations and custom handlers. + + NOTE: This call will fail if the architectural ResetSystem underpinnings + are not initialized. For DXE, you can add gEfiResetArchProtocolGuid + to your DEPEX. + + @param[in] ResetType The default EFI_RESET_TYPE of the reset. + @param[in] ResetSubtype GUID pointer for the reset subtype to be used. + +**/ +VOID +EFIAPI +ResetSystemWithSubtype ( + IN EFI_RESET_TYPE ResetType, + IN CONST GUID *ResetSubtype + ); + +/** + This is a shorthand helper function to reset with the reset type + 'EfiResetPlatformSpecific' and a subtype so that the caller doesn't + have to bother with a function that has half a dozen parameters. + + This will generate a reset with status EFI_SUCCESS, a NULL string, and + no custom data. The subtype will be formatted in such a way that it can be + picked up by notification registrations and custom handlers. + + NOTE: This call will fail if the architectural ResetSystem underpinnings + are not initialized. For DXE, you can add gEfiResetArchProtocolGuid + to your DEPEX. + + @param[in] ResetSubtype GUID pointer for the reset subtype to be used. + +**/ +VOID +EFIAPI +ResetPlatformSpecificGuid ( + IN CONST GUID *ResetSubtype + ); + +/** + This function examines the DataSize and ResetData parameters passed to + to ResetSystem() and detemrines if the ResetData contains a Null-terminated + Unicode string followed by a GUID specific subtype. If the GUID specific + subtype is present, then a pointer to the GUID value in ResetData is returned. + + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData Pointer to the data buffer passed into ResetSystem(). + + @retval Pointer Pointer to the GUID value in ResetData. + @retval NULL ResetData is NULL. + @retval NULL ResetData does not start with a Null-terminated + Unicode string. + @retval NULL A Null-terminated Unicode string is present, but there + are less than sizeof (GUID) bytes after the string. + @retval NULL No subtype is found. + +**/ +GUID * +EFIAPI +GetResetPlatformSpecificGuid ( + IN UINTN DataSize, + IN CONST VOID *ResetData + ); + +/** + This is a helper function that creates the reset data buffer that can be + passed into ResetSystem(). + + The reset data buffer is returned in ResetData and contains ResetString + followed by the ResetSubtype GUID followed by the ExtraData. + + NOTE: Strings are internally limited by MAX_UINT16. + + @param[in, out] ResetDataSize On input, the size of the ResetData buffer. On + output, either the total number of bytes + copied, or the required buffer size. + @param[in, out] ResetData A pointer to the buffer in which to place the + final structure. + @param[in] ResetSubtype Pointer to the GUID specific subtype. This + parameter is optional and may be NULL. + @param[in] ResetString Pointer to a Null-terminated Unicode string + that describes the reset. This parameter is + optional and may be NULL. + @param[in] ExtraDataSize The size, in bytes, of ExtraData buffer. + @param[in] ExtraData Pointer to a buffer of extra data. This + parameter is optional and may be NULL. + + @retval RETURN_SUCCESS ResetDataSize and ResetData are updated. + @retval RETURN_INVALID_PARAMETER ResetDataSize is NULL. + @retval RETURN_INVALID_PARAMETER ResetData is NULL. + @retval RETURN_INVALID_PARAMETER ExtraData was provided without a + ResetSubtype. This is not supported by the + UEFI spec. + @retval RETURN_BUFFER_TOO_SMALL An insufficient buffer was provided. + ResetDataSize is updated with minimum size + required. +**/ +RETURN_STATUS +EFIAPI +BuildResetData ( + IN OUT UINTN *ResetDataSize, + IN OUT VOID *ResetData, + IN CONST GUID *ResetSubtype OPTIONAL, + IN CONST CHAR16 *ResetString OPTIONAL, + IN UINTN ExtraDataSize OPTIONAL, + IN CONST VOID *ExtraData OPTIONAL + ); + +#endif // _RESET_UTILITY_LIB_H_ diff --git a/MdeModulePkg/Include/Library/SecurityManagementLib.h b/MdeModulePkg/Include/Library/SecurityManagementLib.h index e10a4cdd02..a8dd707b98 100644 --- a/MdeModulePkg/Include/Library/SecurityManagementLib.h +++ b/MdeModulePkg/Include/Library/SecurityManagementLib.h @@ -1,270 +1,270 @@ -/** @file
- This library class defines a set of interfaces to abstract the policy of
- security measurement by managing the different security measurement services.
- The library instances can be implemented according to the different security policy.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SECURITY_MANAGEMENT_LIB_H__
-#define __SECURITY_MANAGEMENT_LIB_H__
-
-//
-// Authentication Operation defintions for User Identity (UID), Measured and Secure boot.
-//
-#define EFI_AUTH_OPERATION_NONE 0x00
-#define EFI_AUTH_OPERATION_VERIFY_IMAGE 0x01
-#define EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD 0x02
-#define EFI_AUTH_OPERATION_MEASURE_IMAGE 0x04
-#define EFI_AUTH_OPERATION_CONNECT_POLICY 0x08
-//
-// Authentication State Operation will check the authentication status of a file.
-//
-#define EFI_AUTH_OPERATION_AUTHENTICATION_STATE 0x10
-
-///
-/// Image buffer is required by the security handler.
-///
-#define EFI_AUTH_OPERATION_IMAGE_REQUIRED 0x80000000
-
-/**
- The security handler is used to abstract platform-specific policy
- from the DXE core response to an attempt to use a file that returns a
- given status for the authentication check from the section extraction protocol.
-
- The possible responses in a given SAP implementation may include locking
- flash upon failure to authenticate, attestation logging for all signed drivers,
- and other exception operations. The File parameter allows for possible logging
- within the SAP of the driver.
-
- If File is NULL, then EFI_INVALID_PARAMETER is returned.
-
- If the file specified by File with an authentication status specified by
- AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.
-
- If the file specified by File with an authentication status specified by
- AuthenticationStatus is not safe for the DXE Core to use under any circumstances,
- then EFI_ACCESS_DENIED is returned.
-
- If the file specified by File with an authentication status specified by
- AuthenticationStatus is not safe for the DXE Core to use at the time, but it
- might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is
- returned.
-
- FileBuffer will be NULL and FileSize will be 0 if the handler being called
- did not set EFI_AUTH_OPERATION_IMAGE_REQUIRED when it was registered.
-
- @param[in] AuthenticationStatus
- The authentication status returned from the security
- measurement services for the input file.
- @param[in] File The pointer to the device path of the file that is
- being dispatched. This will optionally be used for logging.
- @param[in] FileBuffer The file buffer matches the input file device path.
- @param[in] FileSize The size of File buffer matches the input file device path.
-
- @retval EFI_SUCCESS The file specified by File did authenticate, and the
- platform policy dictates that the DXE Core may use File.
- @retval EFI_INVALID_PARAMETER The file is NULL.
- @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and
- the platform policy dictates that File should be placed
- in the untrusted state. A file may be promoted from
- the untrusted to the trusted state at a future time
- with a call to the Trust() DXE Service.
- @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and
- the platform policy dictates that File should not be
- used for any purpose.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *SECURITY_FILE_AUTHENTICATION_STATE_HANDLER)(
- IN OUT UINT32 AuthenticationStatus,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *File,
- IN VOID *FileBuffer,
- IN UINTN FileSize
- );
-
-/**
- Register security measurement handler with its operation type. Different
- handlers with the same operation can all be registered.
-
- If SecurityHandler is NULL, then ASSERT().
- If no enough resources available to register new handler, then ASSERT().
- If AuthenticationOperation is not recongnized, then ASSERT().
- If the previous register handler can't be executed before the later register handler, then ASSERT().
-
- @param[in] SecurityHandler The security measurement service handler to be registered.
- @param[in] AuthenticationOperation Theoperation type is specified for the registered handler.
-
- @retval EFI_SUCCESS The handlers were registered successfully.
-**/
-EFI_STATUS
-EFIAPI
-RegisterSecurityHandler (
- IN SECURITY_FILE_AUTHENTICATION_STATE_HANDLER SecurityHandler,
- IN UINT32 AuthenticationOperation
- );
-
-/**
- Execute registered handlers until one returns an error and that error is returned.
- If none of the handlers return an error, then EFI_SUCCESS is returned.
-
- Before exectue handler, get the image buffer by file device path if a handler
- requires the image file. And return the image buffer to each handler when exectue handler.
-
- The handlers are executed in same order to their registered order.
-
- @param[in] AuthenticationStatus
- This is the authentication type returned from the Section
- Extraction protocol. See the Section Extraction Protocol
- Specification for details on this type.
- @param[in] FilePath This is a pointer to the device path of the file that is
- being dispatched. This will optionally be used for logging.
-
- @retval EFI_SUCCESS The file specified by File authenticated when more
- than one security handler services were registered,
- or the file did not authenticate when no security
- handler service was registered. And the platform policy
- dictates that the DXE Core may use File.
- @retval EFI_INVALID_PARAMETER File is NULL.
- @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and
- the platform policy dictates that File should be placed
- in the untrusted state. A file may be promoted from
- the untrusted to the trusted state at a future time
- with a call to the Trust() DXE Service.
- @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and
- the platform policy dictates that File should not be
- used for any purpose.
-**/
-EFI_STATUS
-EFIAPI
-ExecuteSecurityHandlers (
- IN UINT32 AuthenticationStatus,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath
- );
-
-/**
- The security handler is used to abstracts security-specific functions from the DXE
- Foundation of UEFI Image Verification, Trusted Computing Group (TCG) measured boot,
- User Identity policy for image loading and consoles, and for purposes of
- handling GUIDed section encapsulations.
-
- @param[in] AuthenticationStatus
- The authentication status for the input file.
- @param[in] File The pointer to the device path of the file that is
- being dispatched. This will optionally be used for logging.
- @param[in] FileBuffer A pointer to the buffer with the UEFI file image
- @param[in] FileSize The size of File buffer.
- @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service.
-
- @retval EFI_SUCCESS The file specified by DevicePath and non-NULL
- FileBuffer did authenticate, and the platform policy dictates
- that the DXE Foundation may use the file.
- @retval EFI_SUCCESS The device path specified by NULL device path DevicePath
- and non-NULL FileBuffer did authenticate, and the platform
- policy dictates that the DXE Foundation may execute the image in
- FileBuffer.
- @retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start
- UEFI device drivers on the device path specified by DevicePath.
- @retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not
- authenticate, and the platform policy dictates that the file should be
- placed in the untrusted state. The image has been added to the file
- execution table.
- @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not
- authenticate, and the platform policy dictates that the DXE
- Foundation may not use File.
- @retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no
- permission to start UEFI device drivers on the device path specified
- by DevicePath.
- @retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load
- drivers from the device path specified by DevicePath. The
- image has been added into the list of the deferred images.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *SECURITY2_FILE_AUTHENTICATION_HANDLER)(
- IN UINT32 AuthenticationStatus,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *File,
- IN VOID *FileBuffer,
- IN UINTN FileSize,
- IN BOOLEAN BootPolicy
- );
-
-/**
- Register security measurement handler with its operation type. Different
- handlers with the same operation can all be registered.
-
- If SecurityHandler is NULL, then ASSERT().
- If no enough resources available to register new handler, then ASSERT().
- If AuthenticationOperation is not recongnized, then ASSERT().
- If AuthenticationOperation is EFI_AUTH_OPERATION_NONE, then ASSERT().
- If the previous register handler can't be executed before the later register handler, then ASSERT().
-
- @param[in] Security2Handler The security measurement service handler to be registered.
- @param[in] AuthenticationOperation The operation type is specified for the registered handler.
-
- @retval EFI_SUCCESS The handlers were registered successfully.
-**/
-EFI_STATUS
-EFIAPI
-RegisterSecurity2Handler (
- IN SECURITY2_FILE_AUTHENTICATION_HANDLER Security2Handler,
- IN UINT32 AuthenticationOperation
- );
-
-/**
- Execute registered handlers based on input AuthenticationOperation until
- one returns an error and that error is returned.
-
- If none of the handlers return an error, then EFI_SUCCESS is returned.
- The handlers those satisfy AuthenticationOperation will only be executed.
- The handlers are executed in same order to their registered order.
-
- @param[in] AuthenticationOperation
- The operation type specifies which handlers will be executed.
- @param[in] AuthenticationStatus
- The authentication status for the input file.
- @param[in] File This is a pointer to the device path of the file that is
- being dispatched. This will optionally be used for logging.
- @param[in] FileBuffer A pointer to the buffer with the UEFI file image
- @param[in] FileSize The size of File buffer.
- @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service.
-
- @retval EFI_SUCCESS The file specified by DevicePath and non-NULL
- FileBuffer did authenticate, and the platform policy dictates
- that the DXE Foundation may use the file.
- @retval EFI_SUCCESS The device path specified by NULL device path DevicePath
- and non-NULL FileBuffer did authenticate, and the platform
- policy dictates that the DXE Foundation may execute the image in
- FileBuffer.
- @retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start
- UEFI device drivers on the device path specified by DevicePath.
- @retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not
- authenticate, and the platform policy dictates that the file should be
- placed in the untrusted state. The image has been added to the file
- execution table.
- @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not
- authenticate, and the platform policy dictates that the DXE
- Foundation may not use File.
- @retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no
- permission to start UEFI device drivers on the device path specified
- by DevicePath.
- @retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load
- drivers from the device path specified by DevicePath. The
- image has been added into the list of the deferred images.
- @retval EFI_INVALID_PARAMETER File and FileBuffer are both NULL.
-**/
-EFI_STATUS
-EFIAPI
-ExecuteSecurity2Handlers (
- IN UINT32 AuthenticationOperation,
- IN UINT32 AuthenticationStatus,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL,
- IN VOID *FileBuffer,
- IN UINTN FileSize,
- IN BOOLEAN BootPolicy
- );
-
-#endif
+/** @file + This library class defines a set of interfaces to abstract the policy of + security measurement by managing the different security measurement services. + The library instances can be implemented according to the different security policy. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SECURITY_MANAGEMENT_LIB_H__ +#define __SECURITY_MANAGEMENT_LIB_H__ + +// +// Authentication Operation defintions for User Identity (UID), Measured and Secure boot. +// +#define EFI_AUTH_OPERATION_NONE 0x00 +#define EFI_AUTH_OPERATION_VERIFY_IMAGE 0x01 +#define EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD 0x02 +#define EFI_AUTH_OPERATION_MEASURE_IMAGE 0x04 +#define EFI_AUTH_OPERATION_CONNECT_POLICY 0x08 +// +// Authentication State Operation will check the authentication status of a file. +// +#define EFI_AUTH_OPERATION_AUTHENTICATION_STATE 0x10 + +/// +/// Image buffer is required by the security handler. +/// +#define EFI_AUTH_OPERATION_IMAGE_REQUIRED 0x80000000 + +/** + The security handler is used to abstract platform-specific policy + from the DXE core response to an attempt to use a file that returns a + given status for the authentication check from the section extraction protocol. + + The possible responses in a given SAP implementation may include locking + flash upon failure to authenticate, attestation logging for all signed drivers, + and other exception operations. The File parameter allows for possible logging + within the SAP of the driver. + + If File is NULL, then EFI_INVALID_PARAMETER is returned. + + If the file specified by File with an authentication status specified by + AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned. + + If the file specified by File with an authentication status specified by + AuthenticationStatus is not safe for the DXE Core to use under any circumstances, + then EFI_ACCESS_DENIED is returned. + + If the file specified by File with an authentication status specified by + AuthenticationStatus is not safe for the DXE Core to use at the time, but it + might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is + returned. + + FileBuffer will be NULL and FileSize will be 0 if the handler being called + did not set EFI_AUTH_OPERATION_IMAGE_REQUIRED when it was registered. + + @param[in] AuthenticationStatus + The authentication status returned from the security + measurement services for the input file. + @param[in] File The pointer to the device path of the file that is + being dispatched. This will optionally be used for logging. + @param[in] FileBuffer The file buffer matches the input file device path. + @param[in] FileSize The size of File buffer matches the input file device path. + + @retval EFI_SUCCESS The file specified by File did authenticate, and the + platform policy dictates that the DXE Core may use File. + @retval EFI_INVALID_PARAMETER The file is NULL. + @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and + the platform policy dictates that File should be placed + in the untrusted state. A file may be promoted from + the untrusted to the trusted state at a future time + with a call to the Trust() DXE Service. + @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and + the platform policy dictates that File should not be + used for any purpose. + +**/ +typedef +EFI_STATUS +(EFIAPI *SECURITY_FILE_AUTHENTICATION_STATE_HANDLER)( + IN OUT UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *File, + IN VOID *FileBuffer, + IN UINTN FileSize + ); + +/** + Register security measurement handler with its operation type. Different + handlers with the same operation can all be registered. + + If SecurityHandler is NULL, then ASSERT(). + If no enough resources available to register new handler, then ASSERT(). + If AuthenticationOperation is not recongnized, then ASSERT(). + If the previous register handler can't be executed before the later register handler, then ASSERT(). + + @param[in] SecurityHandler The security measurement service handler to be registered. + @param[in] AuthenticationOperation Theoperation type is specified for the registered handler. + + @retval EFI_SUCCESS The handlers were registered successfully. +**/ +EFI_STATUS +EFIAPI +RegisterSecurityHandler ( + IN SECURITY_FILE_AUTHENTICATION_STATE_HANDLER SecurityHandler, + IN UINT32 AuthenticationOperation + ); + +/** + Execute registered handlers until one returns an error and that error is returned. + If none of the handlers return an error, then EFI_SUCCESS is returned. + + Before exectue handler, get the image buffer by file device path if a handler + requires the image file. And return the image buffer to each handler when exectue handler. + + The handlers are executed in same order to their registered order. + + @param[in] AuthenticationStatus + This is the authentication type returned from the Section + Extraction protocol. See the Section Extraction Protocol + Specification for details on this type. + @param[in] FilePath This is a pointer to the device path of the file that is + being dispatched. This will optionally be used for logging. + + @retval EFI_SUCCESS The file specified by File authenticated when more + than one security handler services were registered, + or the file did not authenticate when no security + handler service was registered. And the platform policy + dictates that the DXE Core may use File. + @retval EFI_INVALID_PARAMETER File is NULL. + @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and + the platform policy dictates that File should be placed + in the untrusted state. A file may be promoted from + the untrusted to the trusted state at a future time + with a call to the Trust() DXE Service. + @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and + the platform policy dictates that File should not be + used for any purpose. +**/ +EFI_STATUS +EFIAPI +ExecuteSecurityHandlers ( + IN UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath + ); + +/** + The security handler is used to abstracts security-specific functions from the DXE + Foundation of UEFI Image Verification, Trusted Computing Group (TCG) measured boot, + User Identity policy for image loading and consoles, and for purposes of + handling GUIDed section encapsulations. + + @param[in] AuthenticationStatus + The authentication status for the input file. + @param[in] File The pointer to the device path of the file that is + being dispatched. This will optionally be used for logging. + @param[in] FileBuffer A pointer to the buffer with the UEFI file image + @param[in] FileSize The size of File buffer. + @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service. + + @retval EFI_SUCCESS The file specified by DevicePath and non-NULL + FileBuffer did authenticate, and the platform policy dictates + that the DXE Foundation may use the file. + @retval EFI_SUCCESS The device path specified by NULL device path DevicePath + and non-NULL FileBuffer did authenticate, and the platform + policy dictates that the DXE Foundation may execute the image in + FileBuffer. + @retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start + UEFI device drivers on the device path specified by DevicePath. + @retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not + authenticate, and the platform policy dictates that the file should be + placed in the untrusted state. The image has been added to the file + execution table. + @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not + authenticate, and the platform policy dictates that the DXE + Foundation may not use File. + @retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no + permission to start UEFI device drivers on the device path specified + by DevicePath. + @retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load + drivers from the device path specified by DevicePath. The + image has been added into the list of the deferred images. +**/ +typedef +EFI_STATUS +(EFIAPI *SECURITY2_FILE_AUTHENTICATION_HANDLER)( + IN UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *File, + IN VOID *FileBuffer, + IN UINTN FileSize, + IN BOOLEAN BootPolicy + ); + +/** + Register security measurement handler with its operation type. Different + handlers with the same operation can all be registered. + + If SecurityHandler is NULL, then ASSERT(). + If no enough resources available to register new handler, then ASSERT(). + If AuthenticationOperation is not recongnized, then ASSERT(). + If AuthenticationOperation is EFI_AUTH_OPERATION_NONE, then ASSERT(). + If the previous register handler can't be executed before the later register handler, then ASSERT(). + + @param[in] Security2Handler The security measurement service handler to be registered. + @param[in] AuthenticationOperation The operation type is specified for the registered handler. + + @retval EFI_SUCCESS The handlers were registered successfully. +**/ +EFI_STATUS +EFIAPI +RegisterSecurity2Handler ( + IN SECURITY2_FILE_AUTHENTICATION_HANDLER Security2Handler, + IN UINT32 AuthenticationOperation + ); + +/** + Execute registered handlers based on input AuthenticationOperation until + one returns an error and that error is returned. + + If none of the handlers return an error, then EFI_SUCCESS is returned. + The handlers those satisfy AuthenticationOperation will only be executed. + The handlers are executed in same order to their registered order. + + @param[in] AuthenticationOperation + The operation type specifies which handlers will be executed. + @param[in] AuthenticationStatus + The authentication status for the input file. + @param[in] File This is a pointer to the device path of the file that is + being dispatched. This will optionally be used for logging. + @param[in] FileBuffer A pointer to the buffer with the UEFI file image + @param[in] FileSize The size of File buffer. + @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service. + + @retval EFI_SUCCESS The file specified by DevicePath and non-NULL + FileBuffer did authenticate, and the platform policy dictates + that the DXE Foundation may use the file. + @retval EFI_SUCCESS The device path specified by NULL device path DevicePath + and non-NULL FileBuffer did authenticate, and the platform + policy dictates that the DXE Foundation may execute the image in + FileBuffer. + @retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start + UEFI device drivers on the device path specified by DevicePath. + @retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not + authenticate, and the platform policy dictates that the file should be + placed in the untrusted state. The image has been added to the file + execution table. + @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not + authenticate, and the platform policy dictates that the DXE + Foundation may not use File. + @retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no + permission to start UEFI device drivers on the device path specified + by DevicePath. + @retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load + drivers from the device path specified by DevicePath. The + image has been added into the list of the deferred images. + @retval EFI_INVALID_PARAMETER File and FileBuffer are both NULL. +**/ +EFI_STATUS +EFIAPI +ExecuteSecurity2Handlers ( + IN UINT32 AuthenticationOperation, + IN UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL, + IN VOID *FileBuffer, + IN UINTN FileSize, + IN BOOLEAN BootPolicy + ); + +#endif diff --git a/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h b/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h index 6a76c1de39..369e2d3f10 100644 --- a/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h +++ b/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h @@ -1,43 +1,43 @@ -/** @file
- Smm Core Platform Hook Library. This library class defines a set of platform
- hooks called by the SMM Core.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SMM_CORE_PLATFORM_HOOK_LIB__
-#define __SMM_CORE_PLATFORM_HOOK_LIB__
-
-/**
- Performs platform specific tasks before invoking registered SMI handlers.
-
- This function performs platform specific tasks before invoking registered SMI handlers.
-
- @retval EFI_SUCCESS The platform hook completes successfully.
- @retval Other values The paltform hook cannot complete due to some error.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformHookBeforeSmmDispatch (
- VOID
- );
-
-/**
- Performs platform specific tasks after invoking registered SMI handlers.
-
- This function performs platform specific tasks after invoking registered SMI handlers.
-
- @retval EFI_SUCCESS The platform hook completes successfully.
- @retval Other values The paltform hook cannot complete due to some error.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformHookAfterSmmDispatch (
- VOID
- );
-
-#endif
+/** @file + Smm Core Platform Hook Library. This library class defines a set of platform + hooks called by the SMM Core. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SMM_CORE_PLATFORM_HOOK_LIB__ +#define __SMM_CORE_PLATFORM_HOOK_LIB__ + +/** + Performs platform specific tasks before invoking registered SMI handlers. + + This function performs platform specific tasks before invoking registered SMI handlers. + + @retval EFI_SUCCESS The platform hook completes successfully. + @retval Other values The paltform hook cannot complete due to some error. + +**/ +EFI_STATUS +EFIAPI +PlatformHookBeforeSmmDispatch ( + VOID + ); + +/** + Performs platform specific tasks after invoking registered SMI handlers. + + This function performs platform specific tasks after invoking registered SMI handlers. + + @retval EFI_SUCCESS The platform hook completes successfully. + @retval Other values The paltform hook cannot complete due to some error. + +**/ +EFI_STATUS +EFIAPI +PlatformHookAfterSmmDispatch ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/SortLib.h b/MdeModulePkg/Include/Library/SortLib.h index 8d5045fc7f..c5bb516b4e 100644 --- a/MdeModulePkg/Include/Library/SortLib.h +++ b/MdeModulePkg/Include/Library/SortLib.h @@ -1,107 +1,107 @@ -/** @file
- Library used for sorting and comparison routines.
-
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SORT_LIB_H__
-#define __SORT_LIB_H__
-
-/**
- Prototype for comparison function for any two element types.
-
- @param[in] Buffer1 The pointer to first buffer.
- @param[in] Buffer2 The pointer to second buffer.
-
- @retval 0 Buffer1 equal to Buffer2.
- @return <0 Buffer1 is less than Buffer2.
- @return >0 Buffer1 is greater than Buffer2.
-**/
-typedef
-INTN
-(EFIAPI *SORT_COMPARE)(
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
- );
-
-/**
- Function to perform a Quick Sort on a buffer of comparable elements.
-
- Each element must be equally sized.
-
- If BufferToSort is NULL, then ASSERT.
- If CompareFunction is NULL, then ASSERT.
-
- If Count is < 2 , then perform no action.
- If Size is < 1 , then perform no action.
-
- @param[in, out] BufferToSort On call, a Buffer of (possibly sorted) elements;
- on return, a buffer of sorted elements.
- @param[in] Count The number of elements in the buffer to sort.
- @param[in] ElementSize The size of an element in bytes.
- @param[in] CompareFunction The function to call to perform the comparison
- of any two elements.
-**/
-VOID
-EFIAPI
-PerformQuickSort (
- IN OUT VOID *BufferToSort,
- IN CONST UINTN Count,
- IN CONST UINTN ElementSize,
- IN SORT_COMPARE CompareFunction
- );
-
-/**
- Function to compare 2 device paths for use as CompareFunction.
-
- @param[in] Buffer1 The pointer to Device Path to compare.
- @param[in] Buffer2 The pointer to second DevicePath to compare.
-
- @retval 0 Buffer1 equal to Buffer2.
- @return < 0 Buffer1 is less than Buffer2.
- @return > 0 Buffer1 is greater than Buffer2.
-**/
-INTN
-EFIAPI
-DevicePathCompare (
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
- );
-
-/**
- Function to compare 2 strings without regard to case of the characters.
-
- @param[in] Buffer1 The pointer to String to compare (CHAR16**).
- @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
-
- @retval 0 Buffer1 equal to Buffer2.
- @return < 0 Buffer1 is less than Buffer2.
- @return > 0 Buffer1 is greater than Buffer2.
-**/
-INTN
-EFIAPI
-StringNoCaseCompare (
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
- );
-
-/**
- Function to compare 2 strings.
-
- @param[in] Buffer1 The pointer to String to compare (CHAR16**).
- @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
-
- @retval 0 Buffer1 equal to Buffer2.
- @return < 0 Buffer1 is less than Buffer2.
- @return > 0 Buffer1 is greater than Buffer2.
-**/
-INTN
-EFIAPI
-StringCompare (
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
- );
-
-#endif //__SORT_LIB_H__
+/** @file + Library used for sorting and comparison routines. + + Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SORT_LIB_H__ +#define __SORT_LIB_H__ + +/** + Prototype for comparison function for any two element types. + + @param[in] Buffer1 The pointer to first buffer. + @param[in] Buffer2 The pointer to second buffer. + + @retval 0 Buffer1 equal to Buffer2. + @return <0 Buffer1 is less than Buffer2. + @return >0 Buffer1 is greater than Buffer2. +**/ +typedef +INTN +(EFIAPI *SORT_COMPARE)( + IN CONST VOID *Buffer1, + IN CONST VOID *Buffer2 + ); + +/** + Function to perform a Quick Sort on a buffer of comparable elements. + + Each element must be equally sized. + + If BufferToSort is NULL, then ASSERT. + If CompareFunction is NULL, then ASSERT. + + If Count is < 2 , then perform no action. + If Size is < 1 , then perform no action. + + @param[in, out] BufferToSort On call, a Buffer of (possibly sorted) elements; + on return, a buffer of sorted elements. + @param[in] Count The number of elements in the buffer to sort. + @param[in] ElementSize The size of an element in bytes. + @param[in] CompareFunction The function to call to perform the comparison + of any two elements. +**/ +VOID +EFIAPI +PerformQuickSort ( + IN OUT VOID *BufferToSort, + IN CONST UINTN Count, + IN CONST UINTN ElementSize, + IN SORT_COMPARE CompareFunction + ); + +/** + Function to compare 2 device paths for use as CompareFunction. + + @param[in] Buffer1 The pointer to Device Path to compare. + @param[in] Buffer2 The pointer to second DevicePath to compare. + + @retval 0 Buffer1 equal to Buffer2. + @return < 0 Buffer1 is less than Buffer2. + @return > 0 Buffer1 is greater than Buffer2. +**/ +INTN +EFIAPI +DevicePathCompare ( + IN CONST VOID *Buffer1, + IN CONST VOID *Buffer2 + ); + +/** + Function to compare 2 strings without regard to case of the characters. + + @param[in] Buffer1 The pointer to String to compare (CHAR16**). + @param[in] Buffer2 The pointer to second String to compare (CHAR16**). + + @retval 0 Buffer1 equal to Buffer2. + @return < 0 Buffer1 is less than Buffer2. + @return > 0 Buffer1 is greater than Buffer2. +**/ +INTN +EFIAPI +StringNoCaseCompare ( + IN CONST VOID *Buffer1, + IN CONST VOID *Buffer2 + ); + +/** + Function to compare 2 strings. + + @param[in] Buffer1 The pointer to String to compare (CHAR16**). + @param[in] Buffer2 The pointer to second String to compare (CHAR16**). + + @retval 0 Buffer1 equal to Buffer2. + @return < 0 Buffer1 is less than Buffer2. + @return > 0 Buffer1 is greater than Buffer2. +**/ +INTN +EFIAPI +StringCompare ( + IN CONST VOID *Buffer1, + IN CONST VOID *Buffer2 + ); + +#endif //__SORT_LIB_H__ diff --git a/MdeModulePkg/Include/Library/SpiHcPlatformLib.h b/MdeModulePkg/Include/Library/SpiHcPlatformLib.h index c68f745537..33c9f26d40 100644 --- a/MdeModulePkg/Include/Library/SpiHcPlatformLib.h +++ b/MdeModulePkg/Include/Library/SpiHcPlatformLib.h @@ -1,148 +1,148 @@ -/** @file
-
- Function declarations for SpiHcPlatformLib
-
- Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef PLATFORM_SPI_HC_H_
-#define PLATFORM_SPI_HC_H_
-
-#include <Uefi/UefiBaseType.h>
-#include <Protocol/SpiHc.h>
-#include <Protocol/SpiConfiguration.h>
-#include <Protocol/DevicePath.h>
-#include <Library/DevicePathLib.h>
-
-/**
- This function reports the details of the SPI Host Controller to the SpiHc driver.
-
- @param[out] Attributes The suported attributes of the SPI host controller
- @param[out] FrameSizeSupportMask The suported FrameSizeSupportMask of the SPI host controller
- @param[out] MaximumTransferBytes The suported MaximumTransferBytes of the SPI host controller
-
- @retval EFI_SUCCESS SPI_HOST_CONTROLLER_INSTANCE was allocated properly
- @retval EFI_OUT_OF_RESOURCES The SPI_HOST_CONTROLLER_INSTANCE could not be allocated
-*/
-EFI_STATUS
-EFIAPI
-GetPlatformSpiHcDetails (
- OUT UINT32 *Attributes,
- OUT UINT32 *FrameSizeSupportMask,
- OUT UINT32 *MaximumTransferBytes
- );
-
-/**
- This function reports the device path of SPI host controller. This is needed in order for the SpiBus
- to match the correct SPI_BUS to the SPI host controller
-
- @param[out] DevicePath The device path for this SPI HC is returned in this variable
-
- @retval EFI_SUCCESS
-*/
-EFI_STATUS
-EFIAPI
-GetSpiHcDevicePath (
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- );
-
-/**
- This is the platform specific Spi Chip select function.
- Assert or deassert the SPI chip select.
-
- This routine is called at TPL_NOTIFY.
- Update the value of the chip select line for a SPI peripheral. The SPI bus
- layer calls this routine either in the board layer or in the SPI controller
- to manipulate the chip select pin at the start and end of a SPI transaction.
-
- @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure.
- @param[in] SpiPeripheral The address of an EFI_SPI_PERIPHERAL data structure
- describing the SPI peripheral whose chip select pin
- is to be manipulated. The routine may access the
- ChipSelectParameter field to gain sufficient
- context to complete the operati on.
- @param[in] PinValue The value to be applied to the chip select line of
- the SPI peripheral.
-
- @retval EFI_SUCCESS The chip select was set as requested
- @retval EFI_NOT_READY Support for the chip select is not properly
- initialized
- @retval EFI_INVALID_PARAMETER The ChipSeLect value or its contents are
- invalid
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformSpiHcChipSelect (
- IN CONST EFI_SPI_HC_PROTOCOL *This,
- IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral,
- IN BOOLEAN PinValue
- );
-
-/**
- This function is the platform specific SPI clock function.
- Set up the clock generator to produce the correct clock frequency, phase and
- polarity for a SPI chip.
-
- This routine is called at TPL_NOTIFY.
- This routine updates the clock generator to generate the correct frequency
- and polarity for the SPI clock.
-
- @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure.
- @param[in] SpiPeripheral Pointer to a EFI_SPI_PERIPHERAL data structure from
- which the routine can access the ClockParameter,
- ClockPhase and ClockPolarity fields. The routine
- also has access to the names for the SPI bus and
- chip which can be used during debugging.
- @param[in] ClockHz Pointer to the requested clock frequency. The SPI
- host controller will choose a supported clock
- frequency which is less then or equal to this
- value. Specify zero to turn the clock generator
- off. The actual clock frequency supported by the
- SPI host controller will be returned.
-
- @retval EFI_SUCCESS The clock was set up successfully
- @retval EFI_UNSUPPORTED The SPI controller was not able to support the
- frequency requested by ClockHz
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformSpiHcClock (
- IN CONST EFI_SPI_HC_PROTOCOL *This,
- IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral,
- IN UINT32 *ClockHz
- );
-
-/**
- This function is the platform specific SPI transaction function
- Perform the SPI transaction on the SPI peripheral using the SPI host
- controller.
-
- This routine is called at TPL_NOTIFY.
- This routine synchronously returns EFI_SUCCESS indicating that the
- asynchronous SPI transaction was started. The routine then waits for
- completion of the SPI transaction prior to returning the final transaction
- status.
-
- @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure.
- @param[in] BusTransaction Pointer to a EFI_SPI_BUS_ TRANSACTION containing
- the description of the SPI transaction to perform.
-
- @retval EFI_SUCCESS The transaction completed successfully
- @retval EFI_BAD_BUFFER_SIZE The BusTransaction->WriteBytes value is invalid,
- or the BusTransaction->ReadinBytes value is
- invalid
- @retval EFI_UNSUPPORTED The BusTransaction-> Transaction Type is
- unsupported
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformSpiHcTransaction (
- IN CONST EFI_SPI_HC_PROTOCOL *This,
- IN EFI_SPI_BUS_TRANSACTION *BusTransaction
- );
-
-#endif // PLATFORM_SPI_HC_SMM_PROTOCOL_H_
+/** @file + + Function declarations for SpiHcPlatformLib + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef PLATFORM_SPI_HC_H_ +#define PLATFORM_SPI_HC_H_ + +#include <Uefi/UefiBaseType.h> +#include <Protocol/SpiHc.h> +#include <Protocol/SpiConfiguration.h> +#include <Protocol/DevicePath.h> +#include <Library/DevicePathLib.h> + +/** + This function reports the details of the SPI Host Controller to the SpiHc driver. + + @param[out] Attributes The suported attributes of the SPI host controller + @param[out] FrameSizeSupportMask The suported FrameSizeSupportMask of the SPI host controller + @param[out] MaximumTransferBytes The suported MaximumTransferBytes of the SPI host controller + + @retval EFI_SUCCESS SPI_HOST_CONTROLLER_INSTANCE was allocated properly + @retval EFI_OUT_OF_RESOURCES The SPI_HOST_CONTROLLER_INSTANCE could not be allocated +*/ +EFI_STATUS +EFIAPI +GetPlatformSpiHcDetails ( + OUT UINT32 *Attributes, + OUT UINT32 *FrameSizeSupportMask, + OUT UINT32 *MaximumTransferBytes + ); + +/** + This function reports the device path of SPI host controller. This is needed in order for the SpiBus + to match the correct SPI_BUS to the SPI host controller + + @param[out] DevicePath The device path for this SPI HC is returned in this variable + + @retval EFI_SUCCESS +*/ +EFI_STATUS +EFIAPI +GetSpiHcDevicePath ( + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ); + +/** + This is the platform specific Spi Chip select function. + Assert or deassert the SPI chip select. + + This routine is called at TPL_NOTIFY. + Update the value of the chip select line for a SPI peripheral. The SPI bus + layer calls this routine either in the board layer or in the SPI controller + to manipulate the chip select pin at the start and end of a SPI transaction. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] SpiPeripheral The address of an EFI_SPI_PERIPHERAL data structure + describing the SPI peripheral whose chip select pin + is to be manipulated. The routine may access the + ChipSelectParameter field to gain sufficient + context to complete the operati on. + @param[in] PinValue The value to be applied to the chip select line of + the SPI peripheral. + + @retval EFI_SUCCESS The chip select was set as requested + @retval EFI_NOT_READY Support for the chip select is not properly + initialized + @retval EFI_INVALID_PARAMETER The ChipSeLect value or its contents are + invalid + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcChipSelect ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, + IN BOOLEAN PinValue + ); + +/** + This function is the platform specific SPI clock function. + Set up the clock generator to produce the correct clock frequency, phase and + polarity for a SPI chip. + + This routine is called at TPL_NOTIFY. + This routine updates the clock generator to generate the correct frequency + and polarity for the SPI clock. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] SpiPeripheral Pointer to a EFI_SPI_PERIPHERAL data structure from + which the routine can access the ClockParameter, + ClockPhase and ClockPolarity fields. The routine + also has access to the names for the SPI bus and + chip which can be used during debugging. + @param[in] ClockHz Pointer to the requested clock frequency. The SPI + host controller will choose a supported clock + frequency which is less then or equal to this + value. Specify zero to turn the clock generator + off. The actual clock frequency supported by the + SPI host controller will be returned. + + @retval EFI_SUCCESS The clock was set up successfully + @retval EFI_UNSUPPORTED The SPI controller was not able to support the + frequency requested by ClockHz + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcClock ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, + IN UINT32 *ClockHz + ); + +/** + This function is the platform specific SPI transaction function + Perform the SPI transaction on the SPI peripheral using the SPI host + controller. + + This routine is called at TPL_NOTIFY. + This routine synchronously returns EFI_SUCCESS indicating that the + asynchronous SPI transaction was started. The routine then waits for + completion of the SPI transaction prior to returning the final transaction + status. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] BusTransaction Pointer to a EFI_SPI_BUS_ TRANSACTION containing + the description of the SPI transaction to perform. + + @retval EFI_SUCCESS The transaction completed successfully + @retval EFI_BAD_BUFFER_SIZE The BusTransaction->WriteBytes value is invalid, + or the BusTransaction->ReadinBytes value is + invalid + @retval EFI_UNSUPPORTED The BusTransaction-> Transaction Type is + unsupported + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcTransaction ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN EFI_SPI_BUS_TRANSACTION *BusTransaction + ); + +#endif // PLATFORM_SPI_HC_SMM_PROTOCOL_H_ diff --git a/MdeModulePkg/Include/Library/TpmMeasurementLib.h b/MdeModulePkg/Include/Library/TpmMeasurementLib.h index a38072b5bd..eda86d01a2 100644 --- a/MdeModulePkg/Include/Library/TpmMeasurementLib.h +++ b/MdeModulePkg/Include/Library/TpmMeasurementLib.h @@ -1,38 +1,38 @@ -/** @file
- This library is used by other modules to measure data to TPM.
-
-Copyright (c) 2012, Intel Corporation. All rights reserved. <BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _TPM_MEASUREMENT_LIB_H_
-#define _TPM_MEASUREMENT_LIB_H_
-
-/**
- Tpm measure and log data, and extend the measurement result into a specific PCR.
-
- @param[in] PcrIndex PCR Index.
- @param[in] EventType Event type.
- @param[in] EventLog Measurement event log.
- @param[in] LogLen Event log length in bytes.
- @param[in] HashData The start of the data buffer to be hashed, extended.
- @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData
-
- @retval EFI_SUCCESS Operation completed successfully.
- @retval EFI_UNSUPPORTED TPM device not available.
- @retval EFI_OUT_OF_RESOURCES Out of memory.
- @retval EFI_DEVICE_ERROR The operation was unsuccessful.
-**/
-EFI_STATUS
-EFIAPI
-TpmMeasureAndLogData (
- IN UINT32 PcrIndex,
- IN UINT32 EventType,
- IN VOID *EventLog,
- IN UINT32 LogLen,
- IN VOID *HashData,
- IN UINT64 HashDataLen
- );
-
-#endif
+/** @file + This library is used by other modules to measure data to TPM. + +Copyright (c) 2012, Intel Corporation. All rights reserved. <BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _TPM_MEASUREMENT_LIB_H_ +#define _TPM_MEASUREMENT_LIB_H_ + +/** + Tpm measure and log data, and extend the measurement result into a specific PCR. + + @param[in] PcrIndex PCR Index. + @param[in] EventType Event type. + @param[in] EventLog Measurement event log. + @param[in] LogLen Event log length in bytes. + @param[in] HashData The start of the data buffer to be hashed, extended. + @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_UNSUPPORTED TPM device not available. + @retval EFI_OUT_OF_RESOURCES Out of memory. + @retval EFI_DEVICE_ERROR The operation was unsuccessful. +**/ +EFI_STATUS +EFIAPI +TpmMeasureAndLogData ( + IN UINT32 PcrIndex, + IN UINT32 EventType, + IN VOID *EventLog, + IN UINT32 LogLen, + IN VOID *HashData, + IN UINT64 HashDataLen + ); + +#endif diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h b/MdeModulePkg/Include/Library/UefiBootManagerLib.h index 34e217707e..61b9a83abe 100644 --- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h +++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h @@ -1,816 +1,816 @@ -/** @file
- Provide Boot Manager related library APIs.
-
-Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
-(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _UEFI_BOOT_MANAGER_LIB_H_
-#define _UEFI_BOOT_MANAGER_LIB_H_
-
-#include <Protocol/DriverHealth.h>
-#include <Library/SortLib.h>
-
-//
-// Boot Manager load option library functions.
-//
-
-//
-// Load Option Type
-//
-typedef enum {
- LoadOptionTypeDriver,
- LoadOptionTypeSysPrep,
- LoadOptionTypeBoot,
- LoadOptionTypePlatformRecovery,
- LoadOptionTypeMax
-} EFI_BOOT_MANAGER_LOAD_OPTION_TYPE;
-
-typedef enum {
- LoadOptionNumberMax = 0x10000,
- LoadOptionNumberUnassigned = LoadOptionNumberMax
-} EFI_BOOT_MANAGER_LOAD_OPTION_NUMBER;
-
-//
-// Common structure definition for DriverOption and BootOption
-//
-typedef struct {
- //
- // Data read from UEFI NV variables
- //
- UINTN OptionNumber; // #### numerical value, could be LoadOptionNumberUnassigned
- EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType; // LoadOptionTypeBoot or LoadOptionTypeDriver
- UINT32 Attributes; // Load Option Attributes
- CHAR16 *Description; // Load Option Description
- EFI_DEVICE_PATH_PROTOCOL *FilePath; // Load Option Device Path
- UINT8 *OptionalData; // Load Option optional data to pass into image
- UINT32 OptionalDataSize; // Load Option size of OptionalData
- EFI_GUID VendorGuid;
-
- //
- // Used at runtime
- //
- EFI_STATUS Status; // Status returned from boot attempt gBS->StartImage ()
- CHAR16 *ExitData; // Exit data returned from gBS->StartImage ()
- UINTN ExitDataSize; // Size of ExitData
-} EFI_BOOT_MANAGER_LOAD_OPTION;
-
-/**
- Returns an array of load options based on the EFI variable
- L"BootOrder"/L"DriverOrder" and the L"Boot####"/L"Driver####" variables impled by it.
- #### is the hex value of the UINT16 in each BootOrder/DriverOrder entry.
-
- @param LoadOptionCount Returns number of entries in the array.
- @param LoadOptionType The type of the load option.
-
- @retval NULL No load options exist.
- @retval !NULL Array of load option entries.
-
-**/
-EFI_BOOT_MANAGER_LOAD_OPTION *
-EFIAPI
-EfiBootManagerGetLoadOptions (
- OUT UINTN *LoadOptionCount,
- IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType
- );
-
-/**
- Free an array of load options returned from EfiBootManagerGetLoadOptions().
-
- @param LoadOptions Pointer to the array of load options to free.
- @param LoadOptionCount Number of array entries in LoadOptions.
-
- @return EFI_SUCCESS LoadOptions was freed.
- @return EFI_INVALID_PARAMETER LoadOptions is NULL.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerFreeLoadOptions (
- IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOptions,
- IN UINTN LoadOptionCount
- );
-
-/**
- Initialize a load option.
-
- @param Option Pointer to the load option to be initialized.
- @param OptionNumber Option number of the load option.
- @param OptionType Type of the load option.
- @param Attributes Attributes of the load option.
- @param Description Description of the load option.
- @param FilePath Device path of the load option.
- @param OptionalData Optional data of the load option.
- @param OptionalDataSize Size of the optional data of the load option.
-
- @retval EFI_SUCCESS The load option was initialized successfully.
- @retval EFI_INVALID_PARAMETER Option, Description or FilePath is NULL.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerInitializeLoadOption (
- IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option,
- IN UINTN OptionNumber,
- IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,
- IN UINT32 Attributes,
- IN CHAR16 *Description,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN UINT8 *OptionalData,
- IN UINT32 OptionalDataSize
- );
-
-/**
- Free a load option created by EfiBootManagerInitializeLoadOption()
- or EfiBootManagerVariableToLoadOption().
-
- @param LoadOption Pointer to the load option to free.
- CONCERN: Check Boot#### instead of BootOrder, optimize, spec clarify
- @return EFI_SUCCESS LoadOption was freed.
- @return EFI_INVALID_PARAMETER LoadOption is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerFreeLoadOption (
- IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption
- );
-
-/**
- Initialize the load option from the VariableName.
-
- @param VariableName EFI Variable name which could be Boot#### or
- Driver####
- @param LoadOption Pointer to the load option to be initialized
-
- @retval EFI_SUCCESS The option was created
- @retval EFI_INVALID_PARAMETER VariableName or LoadOption is NULL.
- @retval EFI_NOT_FOUND The variable specified by VariableName cannot be found.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerVariableToLoadOption (
- IN CHAR16 *VariableName,
- IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption
- );
-
-/**
- Create the Boot#### or Driver#### variable from the load option.
-
- @param LoadOption Pointer to the load option.
-
- @retval EFI_SUCCESS The variable was created.
- @retval Others Error status returned by RT->SetVariable.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerLoadOptionToVariable (
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption
- );
-
-/**
- This function will register the new Boot####, Driver#### or SysPrep#### option.
- After the *#### is updated, the *Order will also be updated.
-
- @param Option Pointer to load option to add. If on input
- Option->OptionNumber is LoadOptionNumberUnassigned,
- then on output Option->OptionNumber is updated to
- the number of the new Boot####,
- Driver#### or SysPrep#### option.
- @param Position Position of the new load option to put in the ****Order variable.
-
- @retval EFI_SUCCESS The *#### have been successfully registered.
- @retval EFI_INVALID_PARAMETER The option number exceeds 0xFFFF.
- @retval EFI_ALREADY_STARTED The option number of Option is being used already.
- Note: this API only adds new load option, no replacement support.
- @retval EFI_OUT_OF_RESOURCES There is no free option number that can be used when the
- option number specified in the Option is LoadOptionNumberUnassigned.
- @return Status codes of gRT->SetVariable ().
-
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerAddLoadOptionVariable (
- IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option,
- IN UINTN Position
- );
-
-/**
- Delete the load option according to the OptionNumber and OptionType.
-
- Only the BootOrder/DriverOrder is updated to remove the reference of the OptionNumber.
-
- @param OptionNumber Option number of the load option.
- @param OptionType Type of the load option.
-
- @retval EFI_NOT_FOUND The load option cannot be found.
- @retval EFI_SUCCESS The load option was deleted.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerDeleteLoadOptionVariable (
- IN UINTN OptionNumber,
- IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType
- );
-
-/**
- Sort the load options. The DriverOrder/BootOrder variables will be re-created to
- reflect the new order.
-
- @param OptionType The type of the load option.
- @param CompareFunction The comparator function pointer.
-**/
-VOID
-EFIAPI
-EfiBootManagerSortLoadOptionVariable (
- IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,
- IN SORT_COMPARE CompareFunction
- );
-
-/**
- Return the index of the load option in the load option array.
-
- The function consider two load options are equal when the
- OptionType, Attributes, Description, FilePath and OptionalData are equal.
-
- @param Key Pointer to the load option to be found.
- @param Array Pointer to the array of load options to be found.
- @param Count Number of entries in the Array.
-
- @retval -1 Key wasn't found in the Array.
- @retval 0 ~ Count-1 The index of the Key in the Array.
-**/
-INTN
-EFIAPI
-EfiBootManagerFindLoadOption (
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,
- IN UINTN Count
- );
-
-//
-// Boot Manager hot key library functions.
-//
-
-#pragma pack(1)
-///
-/// EFI Key Option.
-///
-typedef struct {
- ///
- /// Specifies options about how the key will be processed.
- ///
- EFI_BOOT_KEY_DATA KeyData;
- ///
- /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to
- /// which BootOption refers. If the CRC-32s do not match this value, then this key
- /// option is ignored.
- ///
- UINT32 BootOptionCrc;
- ///
- /// The Boot#### option which will be invoked if this key is pressed and the boot option
- /// is active (LOAD_OPTION_ACTIVE is set).
- ///
- UINT16 BootOption;
- ///
- /// The key codes to compare against those returned by the
- /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.
- /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.
- ///
- EFI_INPUT_KEY Keys[3];
- UINT16 OptionNumber;
-} EFI_BOOT_MANAGER_KEY_OPTION;
-#pragma pack()
-
-/**
- Start the hot key service so that the key press can trigger the boot option.
-
- @param HotkeyTriggered Return the waitable event and it will be signaled
- when a valid hot key is pressed.
-
- @retval EFI_SUCCESS The hot key service is started.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerStartHotkeyService (
- IN EFI_EVENT *HotkeyTriggered
- );
-
-//
-// Modifier for EfiBootManagerAddKeyOptionVariable and EfiBootManagerDeleteKeyOptionVariable
-//
-#define EFI_BOOT_MANAGER_SHIFT_PRESSED 0x00000001
-#define EFI_BOOT_MANAGER_CONTROL_PRESSED 0x00000002
-#define EFI_BOOT_MANAGER_ALT_PRESSED 0x00000004
-#define EFI_BOOT_MANAGER_LOGO_PRESSED 0x00000008
-#define EFI_BOOT_MANAGER_MENU_KEY_PRESSED 0x00000010
-#define EFI_BOOT_MANAGER_SYS_REQ_PRESSED 0x00000020
-
-/**
- Add the key option.
- It adds the key option variable and the key option takes affect immediately.
-
- @param AddedOption Return the added key option.
- @param BootOptionNumber The boot option number for the key option.
- @param Modifier Key shift state.
- @param ... Parameter list of pointer of EFI_INPUT_KEY.
-
- @retval EFI_SUCCESS The key option is added.
- @retval EFI_ALREADY_STARTED The hot key is already used by certain key option.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerAddKeyOptionVariable (
- OUT EFI_BOOT_MANAGER_KEY_OPTION *AddedOption OPTIONAL,
- IN UINT16 BootOptionNumber,
- IN UINT32 Modifier,
- ...
- );
-
-/**
- Delete the Key Option variable and unregister the hot key
-
- @param DeletedOption Return the deleted key options.
- @param Modifier Key shift state.
- @param ... Parameter list of pointer of EFI_INPUT_KEY.
-
- @retval EFI_SUCCESS The key option is deleted.
- @retval EFI_NOT_FOUND The key option cannot be found.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerDeleteKeyOptionVariable (
- IN EFI_BOOT_MANAGER_KEY_OPTION *DeletedOption OPTIONAL,
- IN UINT32 Modifier,
- ...
- );
-
-/**
- Register the key option to exit the waiting of the Boot Manager timeout.
- Platform should ensure that the continue key option isn't conflict with
- other boot key options.
-
- @param Modifier Key shift state.
- @param ... Parameter list of pointer of EFI_INPUT_KEY.
-
- @retval EFI_SUCCESS Successfully register the continue key option.
- @retval EFI_ALREADY_STARTED The continue key option is already registered.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerRegisterContinueKeyOption (
- IN UINT32 Modifier,
- ...
- );
-
-/**
- Try to boot the boot option triggered by hot key.
-**/
-VOID
-EFIAPI
-EfiBootManagerHotkeyBoot (
- VOID
- );
-
-//
-// Boot Manager boot library functions.
-//
-
-/**
- The function creates boot options for all possible bootable medias in the following order:
- 1. Removable BlockIo - The boot option only points to the removable media
- device, like USB key, DVD, Floppy etc.
- 2. Fixed BlockIo - The boot option only points to a Fixed blockIo device,
- like HardDisk.
- 3. Non-BlockIo SimpleFileSystem - The boot option points to a device supporting
- SimpleFileSystem Protocol, but not supporting BlockIo
- protocol.
- 4. LoadFile - The boot option points to the media supporting
- LoadFile protocol.
- Reference: UEFI Spec chapter 3.3 Boot Option Variables Default Boot Behavior
-
- The function won't delete the boot option not added by itself.
-**/
-VOID
-EFIAPI
-EfiBootManagerRefreshAllBootOption (
- VOID
- );
-
-/**
- Attempt to boot the EFI boot option. This routine sets L"BootCurent" and
- signals the EFI ready to boot event. If the device path for the option starts
- with a BBS device path a legacy boot is attempted. Short form device paths are
- also supported via this rountine. A device path starting with
- MEDIA_HARDDRIVE_DP, MSG_USB_WWID_DP, MSG_USB_CLASS_DP gets expaned out
- to find the first device that matches. If the BootOption Device Path
- fails the removable media boot algorithm is attempted (\EFI\BOOTIA32.EFI,
- \EFI\BOOTX64.EFI,... only one file type is tried per processor type)
-
- @param BootOption Boot Option to try and boot.
- On return, BootOption->Status contains the boot status:
- EFI_SUCCESS BootOption was booted
- EFI_UNSUPPORTED BootOption isn't supported.
- EFI_NOT_FOUND The BootOption was not found on the system
- Others BootOption failed with this error status
-
-**/
-VOID
-EFIAPI
-EfiBootManagerBoot (
- IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
- );
-
-/**
- Return the boot option corresponding to the Boot Manager Menu.
- It may automatically create one if the boot option hasn't been created yet.
-
- @param BootOption Return the Boot Manager Menu.
-
- @retval EFI_SUCCESS The Boot Manager Menu is successfully returned.
- @retval EFI_NOT_FOUND The Boot Manager Menu cannot be found.
- @retval others Return status of gRT->SetVariable (). BootOption still points
- to the Boot Manager Menu even the Status is not EFI_SUCCESS
- and EFI_NOT_FOUND.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerGetBootManagerMenu (
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
- );
-
-/**
- Get the next possible full path pointing to the load option.
- The routine doesn't guarantee the returned full path points to an existing
- file, and it also doesn't guarantee the existing file is a valid load option.
- BmGetNextLoadOptionBuffer() guarantees.
-
- @param FilePath The device path pointing to a load option.
- It could be a short-form device path.
- @param FullPath The full path returned by the routine in last call.
- Set to NULL in first call.
-
- @return The next possible full path pointing to the load option.
- Caller is responsible to free the memory.
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-EfiBootManagerGetNextLoadOptionDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN EFI_DEVICE_PATH_PROTOCOL *FullPath
- );
-
-/**
- Get the load option by its device path.
-
- @param FilePath The device path pointing to a load option.
- It could be a short-form device path.
- @param FullPath Return the full device path of the load option after
- short-form device path expanding.
- Caller is responsible to free it.
- @param FileSize Return the load option size.
-
- @return The load option buffer. Caller is responsible to free the memory.
-**/
-VOID *
-EFIAPI
-EfiBootManagerGetLoadOptionBuffer (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- OUT EFI_DEVICE_PATH_PROTOCOL **FullPath,
- OUT UINTN *FileSize
- );
-
-/**
- The function enumerates all the legacy boot options, creates them and
- registers them in the BootOrder variable.
-**/
-typedef
-VOID
-(EFIAPI *EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION)(
- VOID
- );
-
-/**
- The function boots a legacy boot option.
-**/
-typedef
-VOID
-(EFIAPI *EFI_BOOT_MANAGER_LEGACY_BOOT)(
- IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
- );
-
-/**
- The function registers the legacy boot support capabilities.
-
- @param RefreshLegacyBootOption The function pointer to create all the legacy boot options.
- @param LegacyBoot The function pointer to boot the legacy boot option.
-**/
-VOID
-EFIAPI
-EfiBootManagerRegisterLegacyBootSupport (
- EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION RefreshLegacyBootOption,
- EFI_BOOT_MANAGER_LEGACY_BOOT LegacyBoot
- );
-
-/**
- Return the platform provided boot option description for the controller.
-
- @param Handle Controller handle.
- @param DefaultDescription Default boot description provided by core.
-
- @return The callee allocated description string
- or NULL if the handler wants to use DefaultDescription.
-**/
-typedef
-CHAR16 *
-(EFIAPI *EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER)(
- IN EFI_HANDLE Handle,
- IN CONST CHAR16 *DefaultDescription
- );
-
-/**
- Register the platform provided boot description handler.
-
- @param Handler The platform provided boot description handler
-
- @retval EFI_SUCCESS The handler was registered successfully.
- @retval EFI_ALREADY_STARTED The handler was already registered.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource to perform the registration.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerRegisterBootDescriptionHandler (
- IN EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER Handler
- );
-
-//
-// Boot Manager connect and disconnect library functions
-//
-
-/**
- This function will connect all the system driver to controller
- first, and then special connect the default console, this make
- sure all the system controller available and the platform default
- console connected.
-**/
-VOID
-EFIAPI
-EfiBootManagerConnectAll (
- VOID
- );
-
-/**
- This function will create all handles associate with every device
- path node. If the handle associate with one device path node can not
- be created successfully, then still give chance to do the dispatch,
- which load the missing drivers if possible.
-
- @param DevicePathToConnect The device path which will be connected, it can be
- a multi-instance device path
- @param MatchingHandle Return the controller handle closest to the DevicePathToConnect
-
- @retval EFI_SUCCESS All handles associate with every device path node
- have been created.
- @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles.
- @retval EFI_NOT_FOUND Create the handle associate with one device path
- node failed.
- @retval EFI_SECURITY_VIOLATION The user has no permission to start UEFI device
- drivers on the DevicePath.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerConnectDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect,
- OUT EFI_HANDLE *MatchingHandle OPTIONAL
- );
-
-/**
- This function will disconnect all current system handles.
-
- gBS->DisconnectController() is invoked for each handle exists in system handle buffer.
- If handle is a bus type handle, all childrens also are disconnected recursively by
- gBS->DisconnectController().
-**/
-VOID
-EFIAPI
-EfiBootManagerDisconnectAll (
- VOID
- );
-
-//
-// Boot Manager console library functions
-//
-
-typedef enum {
- ConIn,
- ConOut,
- ErrOut,
- ConInDev,
- ConOutDev,
- ErrOutDev,
- ConsoleTypeMax
-} CONSOLE_TYPE;
-
-/**
- This function will connect all the console devices base on the console
- device variable ConIn, ConOut and ErrOut.
-
- @retval EFI_DEVICE_ERROR All the consoles were not connected due to an error.
- @retval EFI_SUCCESS Success connect any one instance of the console
- device path base on the variable ConVarName.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerConnectAllDefaultConsoles (
- VOID
- );
-
-/**
- This function updates the console variable based on ConVarName. It can
- add or remove one specific console device path from the variable
-
- @param ConsoleType ConIn, ConOut, ErrOut, ConInDev, ConOutDev or ErrOutDev.
- @param CustomizedConDevicePath The console device path to be added to
- the console variable. Cannot be multi-instance.
- @param ExclusiveDevicePath The console device path to be removed
- from the console variable. Cannot be multi-instance.
-
- @retval EFI_UNSUPPORTED The added device path is the same as a removed one.
- @retval EFI_SUCCESS Successfully added or removed the device path from the
- console variable.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerUpdateConsoleVariable (
- IN CONSOLE_TYPE ConsoleType,
- IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
- );
-
-/**
- Connect the console device base on the variable ConVarName, if
- device path of the ConVarName is multi-instance device path, if
- anyone of the instances is connected success, then this function
- will return success.
-
- @param ConsoleType ConIn, ConOut or ErrOut.
-
- @retval EFI_NOT_FOUND There is not any console devices connected
- success
- @retval EFI_SUCCESS Success connect any one instance of the console
- device path base on the variable ConVarName.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerConnectConsoleVariable (
- IN CONSOLE_TYPE ConsoleType
- );
-
-/**
- Query all the children of VideoController and return the device paths of all the
- children that support GraphicsOutput protocol.
-
- @param VideoController PCI handle of video controller.
-
- @return Device paths of all the children that support GraphicsOutput protocol.
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-EfiBootManagerGetGopDevicePath (
- IN EFI_HANDLE VideoController
- );
-
-/**
- Connect the platform active active video controller.
-
- @param VideoController PCI handle of video controller.
-
- @retval EFI_NOT_FOUND There is no active video controller.
- @retval EFI_SUCCESS The video controller is connected.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerConnectVideoController (
- EFI_HANDLE VideoController OPTIONAL
- );
-
-//
-// Boot Manager driver health library functions.
-//
-
-typedef struct {
- EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;
-
- ///
- /// Driver relative handles
- ///
- EFI_HANDLE DriverHealthHandle;
- EFI_HANDLE ControllerHandle;
- EFI_HANDLE ChildHandle;
-
- ///
- /// Driver health messages of the specify Driver
- ///
- EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList;
-
- ///
- /// HII relative handles
- ///
- EFI_HII_HANDLE HiiHandle;
-
- ///
- /// Driver Health status
- ///
- EFI_DRIVER_HEALTH_STATUS HealthStatus;
-} EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO;
-
-/**
- Return all the Driver Health information.
-
- When the cumulative health status of all the controllers managed by the
- driver who produces the EFI_DRIVER_HEALTH_PROTOCOL is healthy, only one
- EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry is created for such
- EFI_DRIVER_HEALTH_PROTOCOL instance.
- Otherwise, every controller creates one EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO
- entry. Additionally every child controller creates one
- EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry if the driver is a bus driver.
-
- @param Count Return the count of the Driver Health information.
-
- @retval NULL No Driver Health information is returned.
- @retval !NULL Pointer to the Driver Health information array.
-**/
-EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *
-EFIAPI
-EfiBootManagerGetDriverHealthInfo (
- UINTN *Count
- );
-
-/**
- Free the Driver Health information array.
-
- @param DriverHealthInfo Pointer to array of the Driver Health information.
- @param Count Count of the array.
-
- @retval EFI_SUCCESS The array is freed.
- @retval EFI_INVALID_PARAMETER The array is NULL.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerFreeDriverHealthInfo (
- EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo,
- UINTN Count
- );
-
-/**
- Process (load and execute) the load option.
-
- @param LoadOption Pointer to the load option.
-
- @retval EFI_INVALID_PARAMETER The load option type is invalid,
- or the load option file path doesn't point to a valid file.
- @retval EFI_UNSUPPORTED The load option type is of LoadOptionTypeBoot.
- @retval EFI_SUCCESS The load option is inactive, or successfully loaded and executed.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerProcessLoadOption (
- EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption
- );
-
-/**
- Check whether the VariableName is a valid load option variable name
- and return the load option type and option number.
-
- @param VariableName The name of the load option variable.
- @param OptionType Return the load option type.
- @param OptionNumber Return the load option number.
-
- @retval TRUE The variable name is valid; The load option type and
- load option number are returned.
- @retval FALSE The variable name is NOT valid.
-**/
-BOOLEAN
-EFIAPI
-EfiBootManagerIsValidLoadOptionVariableName (
- IN CHAR16 *VariableName,
- OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType OPTIONAL,
- OUT UINT16 *OptionNumber OPTIONAL
- );
-
-/**
- Dispatch the deferred images that are returned from all DeferredImageLoad instances.
-
- @retval EFI_SUCCESS At least one deferred image is loaded successfully and started.
- @retval EFI_NOT_FOUND There is no deferred image.
- @retval EFI_ACCESS_DENIED There are deferred images but all of them are failed to load.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerDispatchDeferredImages (
- VOID
- );
-
-#endif
+/** @file + Provide Boot Manager related library APIs. + +Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _UEFI_BOOT_MANAGER_LIB_H_ +#define _UEFI_BOOT_MANAGER_LIB_H_ + +#include <Protocol/DriverHealth.h> +#include <Library/SortLib.h> + +// +// Boot Manager load option library functions. +// + +// +// Load Option Type +// +typedef enum { + LoadOptionTypeDriver, + LoadOptionTypeSysPrep, + LoadOptionTypeBoot, + LoadOptionTypePlatformRecovery, + LoadOptionTypeMax +} EFI_BOOT_MANAGER_LOAD_OPTION_TYPE; + +typedef enum { + LoadOptionNumberMax = 0x10000, + LoadOptionNumberUnassigned = LoadOptionNumberMax +} EFI_BOOT_MANAGER_LOAD_OPTION_NUMBER; + +// +// Common structure definition for DriverOption and BootOption +// +typedef struct { + // + // Data read from UEFI NV variables + // + UINTN OptionNumber; // #### numerical value, could be LoadOptionNumberUnassigned + EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType; // LoadOptionTypeBoot or LoadOptionTypeDriver + UINT32 Attributes; // Load Option Attributes + CHAR16 *Description; // Load Option Description + EFI_DEVICE_PATH_PROTOCOL *FilePath; // Load Option Device Path + UINT8 *OptionalData; // Load Option optional data to pass into image + UINT32 OptionalDataSize; // Load Option size of OptionalData + EFI_GUID VendorGuid; + + // + // Used at runtime + // + EFI_STATUS Status; // Status returned from boot attempt gBS->StartImage () + CHAR16 *ExitData; // Exit data returned from gBS->StartImage () + UINTN ExitDataSize; // Size of ExitData +} EFI_BOOT_MANAGER_LOAD_OPTION; + +/** + Returns an array of load options based on the EFI variable + L"BootOrder"/L"DriverOrder" and the L"Boot####"/L"Driver####" variables impled by it. + #### is the hex value of the UINT16 in each BootOrder/DriverOrder entry. + + @param LoadOptionCount Returns number of entries in the array. + @param LoadOptionType The type of the load option. + + @retval NULL No load options exist. + @retval !NULL Array of load option entries. + +**/ +EFI_BOOT_MANAGER_LOAD_OPTION * +EFIAPI +EfiBootManagerGetLoadOptions ( + OUT UINTN *LoadOptionCount, + IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType + ); + +/** + Free an array of load options returned from EfiBootManagerGetLoadOptions(). + + @param LoadOptions Pointer to the array of load options to free. + @param LoadOptionCount Number of array entries in LoadOptions. + + @return EFI_SUCCESS LoadOptions was freed. + @return EFI_INVALID_PARAMETER LoadOptions is NULL. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerFreeLoadOptions ( + IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOptions, + IN UINTN LoadOptionCount + ); + +/** + Initialize a load option. + + @param Option Pointer to the load option to be initialized. + @param OptionNumber Option number of the load option. + @param OptionType Type of the load option. + @param Attributes Attributes of the load option. + @param Description Description of the load option. + @param FilePath Device path of the load option. + @param OptionalData Optional data of the load option. + @param OptionalDataSize Size of the optional data of the load option. + + @retval EFI_SUCCESS The load option was initialized successfully. + @retval EFI_INVALID_PARAMETER Option, Description or FilePath is NULL. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerInitializeLoadOption ( + IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option, + IN UINTN OptionNumber, + IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType, + IN UINT32 Attributes, + IN CHAR16 *Description, + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN UINT8 *OptionalData, + IN UINT32 OptionalDataSize + ); + +/** + Free a load option created by EfiBootManagerInitializeLoadOption() + or EfiBootManagerVariableToLoadOption(). + + @param LoadOption Pointer to the load option to free. + CONCERN: Check Boot#### instead of BootOrder, optimize, spec clarify + @return EFI_SUCCESS LoadOption was freed. + @return EFI_INVALID_PARAMETER LoadOption is NULL. + +**/ +EFI_STATUS +EFIAPI +EfiBootManagerFreeLoadOption ( + IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption + ); + +/** + Initialize the load option from the VariableName. + + @param VariableName EFI Variable name which could be Boot#### or + Driver#### + @param LoadOption Pointer to the load option to be initialized + + @retval EFI_SUCCESS The option was created + @retval EFI_INVALID_PARAMETER VariableName or LoadOption is NULL. + @retval EFI_NOT_FOUND The variable specified by VariableName cannot be found. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerVariableToLoadOption ( + IN CHAR16 *VariableName, + IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption + ); + +/** + Create the Boot#### or Driver#### variable from the load option. + + @param LoadOption Pointer to the load option. + + @retval EFI_SUCCESS The variable was created. + @retval Others Error status returned by RT->SetVariable. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerLoadOptionToVariable ( + IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption + ); + +/** + This function will register the new Boot####, Driver#### or SysPrep#### option. + After the *#### is updated, the *Order will also be updated. + + @param Option Pointer to load option to add. If on input + Option->OptionNumber is LoadOptionNumberUnassigned, + then on output Option->OptionNumber is updated to + the number of the new Boot####, + Driver#### or SysPrep#### option. + @param Position Position of the new load option to put in the ****Order variable. + + @retval EFI_SUCCESS The *#### have been successfully registered. + @retval EFI_INVALID_PARAMETER The option number exceeds 0xFFFF. + @retval EFI_ALREADY_STARTED The option number of Option is being used already. + Note: this API only adds new load option, no replacement support. + @retval EFI_OUT_OF_RESOURCES There is no free option number that can be used when the + option number specified in the Option is LoadOptionNumberUnassigned. + @return Status codes of gRT->SetVariable (). + +**/ +EFI_STATUS +EFIAPI +EfiBootManagerAddLoadOptionVariable ( + IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option, + IN UINTN Position + ); + +/** + Delete the load option according to the OptionNumber and OptionType. + + Only the BootOrder/DriverOrder is updated to remove the reference of the OptionNumber. + + @param OptionNumber Option number of the load option. + @param OptionType Type of the load option. + + @retval EFI_NOT_FOUND The load option cannot be found. + @retval EFI_SUCCESS The load option was deleted. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerDeleteLoadOptionVariable ( + IN UINTN OptionNumber, + IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType + ); + +/** + Sort the load options. The DriverOrder/BootOrder variables will be re-created to + reflect the new order. + + @param OptionType The type of the load option. + @param CompareFunction The comparator function pointer. +**/ +VOID +EFIAPI +EfiBootManagerSortLoadOptionVariable ( + IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType, + IN SORT_COMPARE CompareFunction + ); + +/** + Return the index of the load option in the load option array. + + The function consider two load options are equal when the + OptionType, Attributes, Description, FilePath and OptionalData are equal. + + @param Key Pointer to the load option to be found. + @param Array Pointer to the array of load options to be found. + @param Count Number of entries in the Array. + + @retval -1 Key wasn't found in the Array. + @retval 0 ~ Count-1 The index of the Key in the Array. +**/ +INTN +EFIAPI +EfiBootManagerFindLoadOption ( + IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key, + IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array, + IN UINTN Count + ); + +// +// Boot Manager hot key library functions. +// + +#pragma pack(1) +/// +/// EFI Key Option. +/// +typedef struct { + /// + /// Specifies options about how the key will be processed. + /// + EFI_BOOT_KEY_DATA KeyData; + /// + /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to + /// which BootOption refers. If the CRC-32s do not match this value, then this key + /// option is ignored. + /// + UINT32 BootOptionCrc; + /// + /// The Boot#### option which will be invoked if this key is pressed and the boot option + /// is active (LOAD_OPTION_ACTIVE is set). + /// + UINT16 BootOption; + /// + /// The key codes to compare against those returned by the + /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols. + /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions. + /// + EFI_INPUT_KEY Keys[3]; + UINT16 OptionNumber; +} EFI_BOOT_MANAGER_KEY_OPTION; +#pragma pack() + +/** + Start the hot key service so that the key press can trigger the boot option. + + @param HotkeyTriggered Return the waitable event and it will be signaled + when a valid hot key is pressed. + + @retval EFI_SUCCESS The hot key service is started. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerStartHotkeyService ( + IN EFI_EVENT *HotkeyTriggered + ); + +// +// Modifier for EfiBootManagerAddKeyOptionVariable and EfiBootManagerDeleteKeyOptionVariable +// +#define EFI_BOOT_MANAGER_SHIFT_PRESSED 0x00000001 +#define EFI_BOOT_MANAGER_CONTROL_PRESSED 0x00000002 +#define EFI_BOOT_MANAGER_ALT_PRESSED 0x00000004 +#define EFI_BOOT_MANAGER_LOGO_PRESSED 0x00000008 +#define EFI_BOOT_MANAGER_MENU_KEY_PRESSED 0x00000010 +#define EFI_BOOT_MANAGER_SYS_REQ_PRESSED 0x00000020 + +/** + Add the key option. + It adds the key option variable and the key option takes affect immediately. + + @param AddedOption Return the added key option. + @param BootOptionNumber The boot option number for the key option. + @param Modifier Key shift state. + @param ... Parameter list of pointer of EFI_INPUT_KEY. + + @retval EFI_SUCCESS The key option is added. + @retval EFI_ALREADY_STARTED The hot key is already used by certain key option. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerAddKeyOptionVariable ( + OUT EFI_BOOT_MANAGER_KEY_OPTION *AddedOption OPTIONAL, + IN UINT16 BootOptionNumber, + IN UINT32 Modifier, + ... + ); + +/** + Delete the Key Option variable and unregister the hot key + + @param DeletedOption Return the deleted key options. + @param Modifier Key shift state. + @param ... Parameter list of pointer of EFI_INPUT_KEY. + + @retval EFI_SUCCESS The key option is deleted. + @retval EFI_NOT_FOUND The key option cannot be found. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerDeleteKeyOptionVariable ( + IN EFI_BOOT_MANAGER_KEY_OPTION *DeletedOption OPTIONAL, + IN UINT32 Modifier, + ... + ); + +/** + Register the key option to exit the waiting of the Boot Manager timeout. + Platform should ensure that the continue key option isn't conflict with + other boot key options. + + @param Modifier Key shift state. + @param ... Parameter list of pointer of EFI_INPUT_KEY. + + @retval EFI_SUCCESS Successfully register the continue key option. + @retval EFI_ALREADY_STARTED The continue key option is already registered. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerRegisterContinueKeyOption ( + IN UINT32 Modifier, + ... + ); + +/** + Try to boot the boot option triggered by hot key. +**/ +VOID +EFIAPI +EfiBootManagerHotkeyBoot ( + VOID + ); + +// +// Boot Manager boot library functions. +// + +/** + The function creates boot options for all possible bootable medias in the following order: + 1. Removable BlockIo - The boot option only points to the removable media + device, like USB key, DVD, Floppy etc. + 2. Fixed BlockIo - The boot option only points to a Fixed blockIo device, + like HardDisk. + 3. Non-BlockIo SimpleFileSystem - The boot option points to a device supporting + SimpleFileSystem Protocol, but not supporting BlockIo + protocol. + 4. LoadFile - The boot option points to the media supporting + LoadFile protocol. + Reference: UEFI Spec chapter 3.3 Boot Option Variables Default Boot Behavior + + The function won't delete the boot option not added by itself. +**/ +VOID +EFIAPI +EfiBootManagerRefreshAllBootOption ( + VOID + ); + +/** + Attempt to boot the EFI boot option. This routine sets L"BootCurent" and + signals the EFI ready to boot event. If the device path for the option starts + with a BBS device path a legacy boot is attempted. Short form device paths are + also supported via this rountine. A device path starting with + MEDIA_HARDDRIVE_DP, MSG_USB_WWID_DP, MSG_USB_CLASS_DP gets expaned out + to find the first device that matches. If the BootOption Device Path + fails the removable media boot algorithm is attempted (\EFI\BOOTIA32.EFI, + \EFI\BOOTX64.EFI,... only one file type is tried per processor type) + + @param BootOption Boot Option to try and boot. + On return, BootOption->Status contains the boot status: + EFI_SUCCESS BootOption was booted + EFI_UNSUPPORTED BootOption isn't supported. + EFI_NOT_FOUND The BootOption was not found on the system + Others BootOption failed with this error status + +**/ +VOID +EFIAPI +EfiBootManagerBoot ( + IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ); + +/** + Return the boot option corresponding to the Boot Manager Menu. + It may automatically create one if the boot option hasn't been created yet. + + @param BootOption Return the Boot Manager Menu. + + @retval EFI_SUCCESS The Boot Manager Menu is successfully returned. + @retval EFI_NOT_FOUND The Boot Manager Menu cannot be found. + @retval others Return status of gRT->SetVariable (). BootOption still points + to the Boot Manager Menu even the Status is not EFI_SUCCESS + and EFI_NOT_FOUND. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerGetBootManagerMenu ( + EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ); + +/** + Get the next possible full path pointing to the load option. + The routine doesn't guarantee the returned full path points to an existing + file, and it also doesn't guarantee the existing file is a valid load option. + BmGetNextLoadOptionBuffer() guarantees. + + @param FilePath The device path pointing to a load option. + It could be a short-form device path. + @param FullPath The full path returned by the routine in last call. + Set to NULL in first call. + + @return The next possible full path pointing to the load option. + Caller is responsible to free the memory. +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +EfiBootManagerGetNextLoadOptionDevicePath ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN EFI_DEVICE_PATH_PROTOCOL *FullPath + ); + +/** + Get the load option by its device path. + + @param FilePath The device path pointing to a load option. + It could be a short-form device path. + @param FullPath Return the full device path of the load option after + short-form device path expanding. + Caller is responsible to free it. + @param FileSize Return the load option size. + + @return The load option buffer. Caller is responsible to free the memory. +**/ +VOID * +EFIAPI +EfiBootManagerGetLoadOptionBuffer ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + OUT EFI_DEVICE_PATH_PROTOCOL **FullPath, + OUT UINTN *FileSize + ); + +/** + The function enumerates all the legacy boot options, creates them and + registers them in the BootOrder variable. +**/ +typedef +VOID +(EFIAPI *EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION)( + VOID + ); + +/** + The function boots a legacy boot option. +**/ +typedef +VOID +(EFIAPI *EFI_BOOT_MANAGER_LEGACY_BOOT)( + IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ); + +/** + The function registers the legacy boot support capabilities. + + @param RefreshLegacyBootOption The function pointer to create all the legacy boot options. + @param LegacyBoot The function pointer to boot the legacy boot option. +**/ +VOID +EFIAPI +EfiBootManagerRegisterLegacyBootSupport ( + EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION RefreshLegacyBootOption, + EFI_BOOT_MANAGER_LEGACY_BOOT LegacyBoot + ); + +/** + Return the platform provided boot option description for the controller. + + @param Handle Controller handle. + @param DefaultDescription Default boot description provided by core. + + @return The callee allocated description string + or NULL if the handler wants to use DefaultDescription. +**/ +typedef +CHAR16 * +(EFIAPI *EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER)( + IN EFI_HANDLE Handle, + IN CONST CHAR16 *DefaultDescription + ); + +/** + Register the platform provided boot description handler. + + @param Handler The platform provided boot description handler + + @retval EFI_SUCCESS The handler was registered successfully. + @retval EFI_ALREADY_STARTED The handler was already registered. + @retval EFI_OUT_OF_RESOURCES There is not enough resource to perform the registration. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerRegisterBootDescriptionHandler ( + IN EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER Handler + ); + +// +// Boot Manager connect and disconnect library functions +// + +/** + This function will connect all the system driver to controller + first, and then special connect the default console, this make + sure all the system controller available and the platform default + console connected. +**/ +VOID +EFIAPI +EfiBootManagerConnectAll ( + VOID + ); + +/** + This function will create all handles associate with every device + path node. If the handle associate with one device path node can not + be created successfully, then still give chance to do the dispatch, + which load the missing drivers if possible. + + @param DevicePathToConnect The device path which will be connected, it can be + a multi-instance device path + @param MatchingHandle Return the controller handle closest to the DevicePathToConnect + + @retval EFI_SUCCESS All handles associate with every device path node + have been created. + @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles. + @retval EFI_NOT_FOUND Create the handle associate with one device path + node failed. + @retval EFI_SECURITY_VIOLATION The user has no permission to start UEFI device + drivers on the DevicePath. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerConnectDevicePath ( + IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect, + OUT EFI_HANDLE *MatchingHandle OPTIONAL + ); + +/** + This function will disconnect all current system handles. + + gBS->DisconnectController() is invoked for each handle exists in system handle buffer. + If handle is a bus type handle, all childrens also are disconnected recursively by + gBS->DisconnectController(). +**/ +VOID +EFIAPI +EfiBootManagerDisconnectAll ( + VOID + ); + +// +// Boot Manager console library functions +// + +typedef enum { + ConIn, + ConOut, + ErrOut, + ConInDev, + ConOutDev, + ErrOutDev, + ConsoleTypeMax +} CONSOLE_TYPE; + +/** + This function will connect all the console devices base on the console + device variable ConIn, ConOut and ErrOut. + + @retval EFI_DEVICE_ERROR All the consoles were not connected due to an error. + @retval EFI_SUCCESS Success connect any one instance of the console + device path base on the variable ConVarName. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerConnectAllDefaultConsoles ( + VOID + ); + +/** + This function updates the console variable based on ConVarName. It can + add or remove one specific console device path from the variable + + @param ConsoleType ConIn, ConOut, ErrOut, ConInDev, ConOutDev or ErrOutDev. + @param CustomizedConDevicePath The console device path to be added to + the console variable. Cannot be multi-instance. + @param ExclusiveDevicePath The console device path to be removed + from the console variable. Cannot be multi-instance. + + @retval EFI_UNSUPPORTED The added device path is the same as a removed one. + @retval EFI_SUCCESS Successfully added or removed the device path from the + console variable. + +**/ +EFI_STATUS +EFIAPI +EfiBootManagerUpdateConsoleVariable ( + IN CONSOLE_TYPE ConsoleType, + IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath, + IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath + ); + +/** + Connect the console device base on the variable ConVarName, if + device path of the ConVarName is multi-instance device path, if + anyone of the instances is connected success, then this function + will return success. + + @param ConsoleType ConIn, ConOut or ErrOut. + + @retval EFI_NOT_FOUND There is not any console devices connected + success + @retval EFI_SUCCESS Success connect any one instance of the console + device path base on the variable ConVarName. + +**/ +EFI_STATUS +EFIAPI +EfiBootManagerConnectConsoleVariable ( + IN CONSOLE_TYPE ConsoleType + ); + +/** + Query all the children of VideoController and return the device paths of all the + children that support GraphicsOutput protocol. + + @param VideoController PCI handle of video controller. + + @return Device paths of all the children that support GraphicsOutput protocol. +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +EfiBootManagerGetGopDevicePath ( + IN EFI_HANDLE VideoController + ); + +/** + Connect the platform active active video controller. + + @param VideoController PCI handle of video controller. + + @retval EFI_NOT_FOUND There is no active video controller. + @retval EFI_SUCCESS The video controller is connected. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerConnectVideoController ( + EFI_HANDLE VideoController OPTIONAL + ); + +// +// Boot Manager driver health library functions. +// + +typedef struct { + EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth; + + /// + /// Driver relative handles + /// + EFI_HANDLE DriverHealthHandle; + EFI_HANDLE ControllerHandle; + EFI_HANDLE ChildHandle; + + /// + /// Driver health messages of the specify Driver + /// + EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList; + + /// + /// HII relative handles + /// + EFI_HII_HANDLE HiiHandle; + + /// + /// Driver Health status + /// + EFI_DRIVER_HEALTH_STATUS HealthStatus; +} EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO; + +/** + Return all the Driver Health information. + + When the cumulative health status of all the controllers managed by the + driver who produces the EFI_DRIVER_HEALTH_PROTOCOL is healthy, only one + EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry is created for such + EFI_DRIVER_HEALTH_PROTOCOL instance. + Otherwise, every controller creates one EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO + entry. Additionally every child controller creates one + EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry if the driver is a bus driver. + + @param Count Return the count of the Driver Health information. + + @retval NULL No Driver Health information is returned. + @retval !NULL Pointer to the Driver Health information array. +**/ +EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO * +EFIAPI +EfiBootManagerGetDriverHealthInfo ( + UINTN *Count + ); + +/** + Free the Driver Health information array. + + @param DriverHealthInfo Pointer to array of the Driver Health information. + @param Count Count of the array. + + @retval EFI_SUCCESS The array is freed. + @retval EFI_INVALID_PARAMETER The array is NULL. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerFreeDriverHealthInfo ( + EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo, + UINTN Count + ); + +/** + Process (load and execute) the load option. + + @param LoadOption Pointer to the load option. + + @retval EFI_INVALID_PARAMETER The load option type is invalid, + or the load option file path doesn't point to a valid file. + @retval EFI_UNSUPPORTED The load option type is of LoadOptionTypeBoot. + @retval EFI_SUCCESS The load option is inactive, or successfully loaded and executed. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerProcessLoadOption ( + EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption + ); + +/** + Check whether the VariableName is a valid load option variable name + and return the load option type and option number. + + @param VariableName The name of the load option variable. + @param OptionType Return the load option type. + @param OptionNumber Return the load option number. + + @retval TRUE The variable name is valid; The load option type and + load option number are returned. + @retval FALSE The variable name is NOT valid. +**/ +BOOLEAN +EFIAPI +EfiBootManagerIsValidLoadOptionVariableName ( + IN CHAR16 *VariableName, + OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType OPTIONAL, + OUT UINT16 *OptionNumber OPTIONAL + ); + +/** + Dispatch the deferred images that are returned from all DeferredImageLoad instances. + + @retval EFI_SUCCESS At least one deferred image is loaded successfully and started. + @retval EFI_NOT_FOUND There is no deferred image. + @retval EFI_ACCESS_DENIED There are deferred images but all of them are failed to load. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerDispatchDeferredImages ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/UefiHiiServicesLib.h b/MdeModulePkg/Include/Library/UefiHiiServicesLib.h index 36bbd45bff..5addd34120 100644 --- a/MdeModulePkg/Include/Library/UefiHiiServicesLib.h +++ b/MdeModulePkg/Include/Library/UefiHiiServicesLib.h @@ -1,46 +1,46 @@ -/** @file
- Provides global variables that are pointers to the UEFI HII related protocols.
- All of the UEFI HII related protocols are optional, so the consumers of this
- library class must verify that the global variable pointers are not NULL before
- use.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __UEFI_HII_SERVICES_LIB_H__
-#define __UEFI_HII_SERVICES_LIB_H__
-
-#include <Protocol/HiiFont.h>
-#include <Protocol/HiiString.h>
-#include <Protocol/HiiImage.h>
-#include <Protocol/HiiDatabase.h>
-#include <Protocol/HiiConfigRouting.h>
-
-///
-/// The pointer to the UEFI HII Font Protocol.
-///
-extern EFI_HII_FONT_PROTOCOL *gHiiFont;
-
-///
-/// The pointer to the UEFI HII String Protocol.
-///
-extern EFI_HII_STRING_PROTOCOL *gHiiString;
-
-///
-/// The pointer to the UEFI HII Image Protocol.
-///
-extern EFI_HII_IMAGE_PROTOCOL *gHiiImage;
-
-///
-/// The pointer to the UEFI HII Database Protocol.
-///
-extern EFI_HII_DATABASE_PROTOCOL *gHiiDatabase;
-
-///
-/// The pointer to the UEFI HII Config Rounting Protocol.
-///
-extern EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting;
-
-#endif
+/** @file + Provides global variables that are pointers to the UEFI HII related protocols. + All of the UEFI HII related protocols are optional, so the consumers of this + library class must verify that the global variable pointers are not NULL before + use. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __UEFI_HII_SERVICES_LIB_H__ +#define __UEFI_HII_SERVICES_LIB_H__ + +#include <Protocol/HiiFont.h> +#include <Protocol/HiiString.h> +#include <Protocol/HiiImage.h> +#include <Protocol/HiiDatabase.h> +#include <Protocol/HiiConfigRouting.h> + +/// +/// The pointer to the UEFI HII Font Protocol. +/// +extern EFI_HII_FONT_PROTOCOL *gHiiFont; + +/// +/// The pointer to the UEFI HII String Protocol. +/// +extern EFI_HII_STRING_PROTOCOL *gHiiString; + +/// +/// The pointer to the UEFI HII Image Protocol. +/// +extern EFI_HII_IMAGE_PROTOCOL *gHiiImage; + +/// +/// The pointer to the UEFI HII Database Protocol. +/// +extern EFI_HII_DATABASE_PROTOCOL *gHiiDatabase; + +/// +/// The pointer to the UEFI HII Config Rounting Protocol. +/// +extern EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting; + +#endif diff --git a/MdeModulePkg/Include/Library/VarCheckLib.h b/MdeModulePkg/Include/Library/VarCheckLib.h index 155fcd0223..f49143b23d 100644 --- a/MdeModulePkg/Include/Library/VarCheckLib.h +++ b/MdeModulePkg/Include/Library/VarCheckLib.h @@ -1,174 +1,174 @@ -/** @file
- Provides variable check services and database management.
-
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _VARIABLE_CHECK_LIB_H_
-#define _VARIABLE_CHECK_LIB_H_
-
-#include <Protocol/VarCheck.h>
-
-typedef enum {
- VarCheckRequestReserved0 = 0,
- VarCheckRequestReserved1 = 1,
- VarCheckFromTrusted = 2,
- VarCheckFromUntrusted = 3,
-} VAR_CHECK_REQUEST_SOURCE;
-
-typedef
-VOID
-(EFIAPI *VAR_CHECK_END_OF_DXE_CALLBACK)(
- VOID
- );
-
-/**
- Register END_OF_DXE callback.
- The callback will be invoked by VarCheckLibInitializeAtEndOfDxe().
-
- @param[in] Callback END_OF_DXE callback.
-
- @retval EFI_SUCCESS The callback was registered successfully.
- @retval EFI_INVALID_PARAMETER Callback is NULL.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the callback register request.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibRegisterEndOfDxeCallback (
- IN VAR_CHECK_END_OF_DXE_CALLBACK Callback
- );
-
-/**
- Var check initialize at END_OF_DXE.
-
- This function needs to be called at END_OF_DXE.
- Address pointers may be returned,
- and caller needs to ConvertPointer() for the pointers.
-
- @param[in, out] AddressPointerCount Output pointer to address pointer count.
-
- @return Address pointer buffer, NULL if input AddressPointerCount is NULL.
-
-**/
-VOID ***
-EFIAPI
-VarCheckLibInitializeAtEndOfDxe (
- IN OUT UINTN *AddressPointerCount OPTIONAL
- );
-
-/**
- Register address pointer.
- The AddressPointer may be returned by VarCheckLibInitializeAtEndOfDxe().
-
- @param[in] AddressPointer Address pointer.
-
- @retval EFI_SUCCESS The address pointer was registered successfully.
- @retval EFI_INVALID_PARAMETER AddressPointer is NULL.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the address pointer register request.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibRegisterAddressPointer (
- IN VOID **AddressPointer
- );
-
-/**
- Register SetVariable check handler.
-
- @param[in] Handler Pointer to check handler.
-
- @retval EFI_SUCCESS The SetVariable check handler was registered successfully.
- @retval EFI_INVALID_PARAMETER Handler is NULL.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request.
- @retval EFI_UNSUPPORTED This interface is not implemented.
- For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibRegisterSetVariableCheckHandler (
- IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler
- );
-
-/**
- Variable property set.
-
- @param[in] Name Pointer to the variable name.
- @param[in] Guid Pointer to the vendor GUID.
- @param[in] VariableProperty Pointer to the input variable property.
-
- @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully.
- @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string,
- or the fields of VariableProperty are not valid.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibVariablePropertySet (
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
- );
-
-/**
- Variable property get.
-
- @param[in] Name Pointer to the variable name.
- @param[in] Guid Pointer to the vendor GUID.
- @param[out] VariableProperty Pointer to the output variable property.
-
- @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully.
- @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string.
- @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibVariablePropertyGet (
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
- );
-
-/**
- SetVariable check.
-
- @param[in] VariableName Name of Variable to set.
- @param[in] VendorGuid Variable vendor GUID.
- @param[in] Attributes Attribute value of the variable.
- @param[in] DataSize Size of Data to set.
- @param[in] Data Data pointer.
- @param[in] RequestSource Request source.
-
- @retval EFI_SUCCESS The SetVariable check result was success.
- @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, GUID,
- DataSize and Data value was supplied.
- @retval EFI_WRITE_PROTECTED The variable in question is read-only.
- @retval Others The other return status from check handler.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibSetVariableCheck (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data,
- IN VAR_CHECK_REQUEST_SOURCE RequestSource
- );
-
-#endif
+/** @file + Provides variable check services and database management. + +Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _VARIABLE_CHECK_LIB_H_ +#define _VARIABLE_CHECK_LIB_H_ + +#include <Protocol/VarCheck.h> + +typedef enum { + VarCheckRequestReserved0 = 0, + VarCheckRequestReserved1 = 1, + VarCheckFromTrusted = 2, + VarCheckFromUntrusted = 3, +} VAR_CHECK_REQUEST_SOURCE; + +typedef +VOID +(EFIAPI *VAR_CHECK_END_OF_DXE_CALLBACK)( + VOID + ); + +/** + Register END_OF_DXE callback. + The callback will be invoked by VarCheckLibInitializeAtEndOfDxe(). + + @param[in] Callback END_OF_DXE callback. + + @retval EFI_SUCCESS The callback was registered successfully. + @retval EFI_INVALID_PARAMETER Callback is NULL. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the callback register request. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibRegisterEndOfDxeCallback ( + IN VAR_CHECK_END_OF_DXE_CALLBACK Callback + ); + +/** + Var check initialize at END_OF_DXE. + + This function needs to be called at END_OF_DXE. + Address pointers may be returned, + and caller needs to ConvertPointer() for the pointers. + + @param[in, out] AddressPointerCount Output pointer to address pointer count. + + @return Address pointer buffer, NULL if input AddressPointerCount is NULL. + +**/ +VOID *** +EFIAPI +VarCheckLibInitializeAtEndOfDxe ( + IN OUT UINTN *AddressPointerCount OPTIONAL + ); + +/** + Register address pointer. + The AddressPointer may be returned by VarCheckLibInitializeAtEndOfDxe(). + + @param[in] AddressPointer Address pointer. + + @retval EFI_SUCCESS The address pointer was registered successfully. + @retval EFI_INVALID_PARAMETER AddressPointer is NULL. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the address pointer register request. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibRegisterAddressPointer ( + IN VOID **AddressPointer + ); + +/** + Register SetVariable check handler. + + @param[in] Handler Pointer to check handler. + + @retval EFI_SUCCESS The SetVariable check handler was registered successfully. + @retval EFI_INVALID_PARAMETER Handler is NULL. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request. + @retval EFI_UNSUPPORTED This interface is not implemented. + For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibRegisterSetVariableCheckHandler ( + IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler + ); + +/** + Variable property set. + + @param[in] Name Pointer to the variable name. + @param[in] Guid Pointer to the vendor GUID. + @param[in] VariableProperty Pointer to the input variable property. + + @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully. + @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string, + or the fields of VariableProperty are not valid. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibVariablePropertySet ( + IN CHAR16 *Name, + IN EFI_GUID *Guid, + IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty + ); + +/** + Variable property get. + + @param[in] Name Pointer to the variable name. + @param[in] Guid Pointer to the vendor GUID. + @param[out] VariableProperty Pointer to the output variable property. + + @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully. + @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string. + @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibVariablePropertyGet ( + IN CHAR16 *Name, + IN EFI_GUID *Guid, + OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty + ); + +/** + SetVariable check. + + @param[in] VariableName Name of Variable to set. + @param[in] VendorGuid Variable vendor GUID. + @param[in] Attributes Attribute value of the variable. + @param[in] DataSize Size of Data to set. + @param[in] Data Data pointer. + @param[in] RequestSource Request source. + + @retval EFI_SUCCESS The SetVariable check result was success. + @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, GUID, + DataSize and Data value was supplied. + @retval EFI_WRITE_PROTECTED The variable in question is read-only. + @retval Others The other return status from check handler. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibSetVariableCheck ( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + IN UINT32 Attributes, + IN UINTN DataSize, + IN VOID *Data, + IN VAR_CHECK_REQUEST_SOURCE RequestSource + ); + +#endif diff --git a/MdeModulePkg/Include/Library/VariableFlashInfoLib.h b/MdeModulePkg/Include/Library/VariableFlashInfoLib.h index 1367be9376..727368752f 100644 --- a/MdeModulePkg/Include/Library/VariableFlashInfoLib.h +++ b/MdeModulePkg/Include/Library/VariableFlashInfoLib.h @@ -1,68 +1,68 @@ -/** @file
- Variable Flash Information Library
-
-Copyright (c) Microsoft Corporation<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef VARIABLE_FLASH_INFO_LIB_H_
-#define VARIABLE_FLASH_INFO_LIB_H_
-
-/**
- Get the base address and size for the NV storage area used for UEFI variable storage.
-
- @param[out] BaseAddress The NV storage base address.
- @param[out] Length The NV storage length in bytes.
-
- @retval EFI_SUCCESS NV storage information was found successfully.
- @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
- @retval EFI_NOT_FOUND NV storage information could not be found.
-
-**/
-EFI_STATUS
-EFIAPI
-GetVariableFlashNvStorageInfo (
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- );
-
-/**
- Get the base address and size for the fault tolerant write (FTW) spare
- area used for UEFI variable storage.
-
- @param[out] BaseAddress The FTW spare base address.
- @param[out] Length The FTW spare length in bytes.
-
- @retval EFI_SUCCESS FTW spare information was found successfully.
- @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
- @retval EFI_NOT_FOUND FTW spare information could not be found.
-
-**/
-EFI_STATUS
-EFIAPI
-GetVariableFlashFtwSpareInfo (
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- );
-
-/**
- Get the base address and size for the fault tolerant write (FTW) working
- area used for UEFI variable storage.
-
- @param[out] BaseAddress The FTW working area base address.
- @param[out] Length The FTW working area length in bytes.
-
- @retval EFI_SUCCESS FTW working information was found successfully.
- @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
- @retval EFI_NOT_FOUND FTW working information could not be found.
-
-**/
-EFI_STATUS
-EFIAPI
-GetVariableFlashFtwWorkingInfo (
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- );
-
-#endif
+/** @file + Variable Flash Information Library + +Copyright (c) Microsoft Corporation<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef VARIABLE_FLASH_INFO_LIB_H_ +#define VARIABLE_FLASH_INFO_LIB_H_ + +/** + Get the base address and size for the NV storage area used for UEFI variable storage. + + @param[out] BaseAddress The NV storage base address. + @param[out] Length The NV storage length in bytes. + + @retval EFI_SUCCESS NV storage information was found successfully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND NV storage information could not be found. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashNvStorageInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ); + +/** + Get the base address and size for the fault tolerant write (FTW) spare + area used for UEFI variable storage. + + @param[out] BaseAddress The FTW spare base address. + @param[out] Length The FTW spare length in bytes. + + @retval EFI_SUCCESS FTW spare information was found successfully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND FTW spare information could not be found. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashFtwSpareInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ); + +/** + Get the base address and size for the fault tolerant write (FTW) working + area used for UEFI variable storage. + + @param[out] BaseAddress The FTW working area base address. + @param[out] Length The FTW working area length in bytes. + + @retval EFI_SUCCESS FTW working information was found successfully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND FTW working information could not be found. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashFtwWorkingInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ); + +#endif diff --git a/MdeModulePkg/Include/Library/VariablePolicyHelperLib.h b/MdeModulePkg/Include/Library/VariablePolicyHelperLib.h index e471ed78f3..ff47d5aefb 100644 --- a/MdeModulePkg/Include/Library/VariablePolicyHelperLib.h +++ b/MdeModulePkg/Include/Library/VariablePolicyHelperLib.h @@ -1,161 +1,161 @@ -/** @file -- VariablePolicyHelperLib.h
-This library contains helper functions for marshalling and registering
-new policies with the VariablePolicy infrastructure.
-
-Copyright (c) Microsoft Corporation.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EDKII_VARIABLE_POLICY_HELPER_LIB_H_
-#define _EDKII_VARIABLE_POLICY_HELPER_LIB_H_
-
-#include <Protocol/VariablePolicy.h>
-
-/**
- This helper function will allocate and populate a new VariablePolicy
- structure for a policy that does not contain any sub-structures (such as
- VARIABLE_LOCK_ON_VAR_STATE_POLICY).
-
- NOTE: Caller will need to free structure once finished.
-
- @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect.
- @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name.
- Otherwise, will create a policy that targets an entire namespace.
- @param[in] MinSize MinSize for the VariablePolicy.
- @param[in] MaxSize MaxSize for the VariablePolicy.
- @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy.
- @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy.
- @param[in] LockPolicyType LockPolicyType for the VariablePolicy.
- @param[out] NewEntry If successful, will be set to a pointer to the allocated buffer containing the
- new policy.
-
- @retval EFI_SUCCESS Operation completed successfully and structure is populated.
- @retval EFI_INVALID_PARAMETER Namespace is NULL.
- @retval EFI_INVALID_PARAMETER LockPolicyType is invalid for a basic structure.
- @retval EFI_BUFFER_TOO_SMALL Finished structure would not fit in UINT16 size.
- @retval EFI_OUT_OF_RESOURCES Could not allocate sufficient space for structure.
-
-**/
-EFI_STATUS
-EFIAPI
-CreateBasicVariablePolicy (
- IN CONST EFI_GUID *Namespace,
- IN CONST CHAR16 *Name OPTIONAL,
- IN UINT32 MinSize,
- IN UINT32 MaxSize,
- IN UINT32 AttributesMustHave,
- IN UINT32 AttributesCantHave,
- IN UINT8 LockPolicyType,
- OUT VARIABLE_POLICY_ENTRY **NewEntry
- );
-
-/**
- This helper function will allocate and populate a new VariablePolicy
- structure for a policy with a lock type of VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE.
-
- NOTE: Caller will need to free structure once finished.
-
- @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect.
- @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name.
- Otherwise, will create a policy that targets an entire namespace.
- @param[in] MinSize MinSize for the VariablePolicy.
- @param[in] MaxSize MaxSize for the VariablePolicy.
- @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy.
- @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy.
- @param[in] VarStateNamespace Pointer to the EFI_GUID for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Namespace.
- @param[in] VarStateValue Value for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Value.
- @param[in] VarStateName Pointer to the CHAR16 array for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Name.
- @param[out] NewEntry If successful, will be set to a pointer to the allocated buffer containing the
- new policy.
-
- @retval EFI_SUCCESS Operation completed successfully and structure is populated.
- @retval EFI_INVALID_PARAMETER Namespace, VarStateNamespace, VarStateName is NULL.
- @retval EFI_BUFFER_TOO_SMALL Finished structure would not fit in UINT16 size.
- @retval EFI_OUT_OF_RESOURCES Could not allocate sufficient space for structure.
-
-**/
-EFI_STATUS
-EFIAPI
-CreateVarStateVariablePolicy (
- IN CONST EFI_GUID *Namespace,
- IN CONST CHAR16 *Name OPTIONAL,
- IN UINT32 MinSize,
- IN UINT32 MaxSize,
- IN UINT32 AttributesMustHave,
- IN UINT32 AttributesCantHave,
- IN CONST EFI_GUID *VarStateNamespace,
- IN UINT8 VarStateValue,
- IN CONST CHAR16 *VarStateName,
- OUT VARIABLE_POLICY_ENTRY **NewEntry
- );
-
-/**
- This helper function does everything that CreateBasicVariablePolicy() does, but also
- uses the passed in protocol to register the policy with the infrastructure.
- Does not return a buffer, does not require the caller to free anything.
-
- @param[in] VariablePolicy Pointer to a valid instance of the VariablePolicy protocol.
- @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect.
- @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name.
- Otherwise, will create a policy that targets an entire namespace.
- @param[in] MinSize MinSize for the VariablePolicy.
- @param[in] MaxSize MaxSize for the VariablePolicy.
- @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy.
- @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy.
- @param[in] LockPolicyType LockPolicyType for the VariablePolicy.
-
- @retval EFI_INVALID_PARAMETER VariablePolicy pointer is NULL.
- @retval EFI_STATUS Status returned by CreateBasicVariablePolicy() or RegisterVariablePolicy().
-
-**/
-EFI_STATUS
-EFIAPI
-RegisterBasicVariablePolicy (
- IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy,
- IN CONST EFI_GUID *Namespace,
- IN CONST CHAR16 *Name OPTIONAL,
- IN UINT32 MinSize,
- IN UINT32 MaxSize,
- IN UINT32 AttributesMustHave,
- IN UINT32 AttributesCantHave,
- IN UINT8 LockPolicyType
- );
-
-/**
- This helper function does everything that CreateBasicVariablePolicy() does, but also
- uses the passed in protocol to register the policy with the infrastructure.
- Does not return a buffer, does not require the caller to free anything.
-
- @param[in] VariablePolicy Pointer to a valid instance of the VariablePolicy protocol.
- @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect.
- @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name.
- Otherwise, will create a policy that targets an entire namespace.
- @param[in] MinSize MinSize for the VariablePolicy.
- @param[in] MaxSize MaxSize for the VariablePolicy.
- @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy.
- @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy.
- @param[in] VarStateNamespace Pointer to the EFI_GUID for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Namespace.
- @param[in] VarStateName Pointer to the CHAR16 array for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Name.
- @param[in] VarStateValue Value for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Value.
-
- @retval EFI_INVALID_PARAMETER VariablePolicy pointer is NULL.
- @retval EFI_STATUS Status returned by CreateBasicVariablePolicy() or RegisterVariablePolicy().
-
-**/
-EFI_STATUS
-EFIAPI
-RegisterVarStateVariablePolicy (
- IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy,
- IN CONST EFI_GUID *Namespace,
- IN CONST CHAR16 *Name OPTIONAL,
- IN UINT32 MinSize,
- IN UINT32 MaxSize,
- IN UINT32 AttributesMustHave,
- IN UINT32 AttributesCantHave,
- IN CONST EFI_GUID *VarStateNamespace,
- IN CONST CHAR16 *VarStateName,
- IN UINT8 VarStateValue
- );
-
-#endif // _EDKII_VARIABLE_POLICY_HELPER_LIB_H_
+/** @file -- VariablePolicyHelperLib.h +This library contains helper functions for marshalling and registering +new policies with the VariablePolicy infrastructure. + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_VARIABLE_POLICY_HELPER_LIB_H_ +#define _EDKII_VARIABLE_POLICY_HELPER_LIB_H_ + +#include <Protocol/VariablePolicy.h> + +/** + This helper function will allocate and populate a new VariablePolicy + structure for a policy that does not contain any sub-structures (such as + VARIABLE_LOCK_ON_VAR_STATE_POLICY). + + NOTE: Caller will need to free structure once finished. + + @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect. + @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name. + Otherwise, will create a policy that targets an entire namespace. + @param[in] MinSize MinSize for the VariablePolicy. + @param[in] MaxSize MaxSize for the VariablePolicy. + @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy. + @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy. + @param[in] LockPolicyType LockPolicyType for the VariablePolicy. + @param[out] NewEntry If successful, will be set to a pointer to the allocated buffer containing the + new policy. + + @retval EFI_SUCCESS Operation completed successfully and structure is populated. + @retval EFI_INVALID_PARAMETER Namespace is NULL. + @retval EFI_INVALID_PARAMETER LockPolicyType is invalid for a basic structure. + @retval EFI_BUFFER_TOO_SMALL Finished structure would not fit in UINT16 size. + @retval EFI_OUT_OF_RESOURCES Could not allocate sufficient space for structure. + +**/ +EFI_STATUS +EFIAPI +CreateBasicVariablePolicy ( + IN CONST EFI_GUID *Namespace, + IN CONST CHAR16 *Name OPTIONAL, + IN UINT32 MinSize, + IN UINT32 MaxSize, + IN UINT32 AttributesMustHave, + IN UINT32 AttributesCantHave, + IN UINT8 LockPolicyType, + OUT VARIABLE_POLICY_ENTRY **NewEntry + ); + +/** + This helper function will allocate and populate a new VariablePolicy + structure for a policy with a lock type of VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE. + + NOTE: Caller will need to free structure once finished. + + @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect. + @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name. + Otherwise, will create a policy that targets an entire namespace. + @param[in] MinSize MinSize for the VariablePolicy. + @param[in] MaxSize MaxSize for the VariablePolicy. + @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy. + @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy. + @param[in] VarStateNamespace Pointer to the EFI_GUID for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Namespace. + @param[in] VarStateValue Value for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Value. + @param[in] VarStateName Pointer to the CHAR16 array for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Name. + @param[out] NewEntry If successful, will be set to a pointer to the allocated buffer containing the + new policy. + + @retval EFI_SUCCESS Operation completed successfully and structure is populated. + @retval EFI_INVALID_PARAMETER Namespace, VarStateNamespace, VarStateName is NULL. + @retval EFI_BUFFER_TOO_SMALL Finished structure would not fit in UINT16 size. + @retval EFI_OUT_OF_RESOURCES Could not allocate sufficient space for structure. + +**/ +EFI_STATUS +EFIAPI +CreateVarStateVariablePolicy ( + IN CONST EFI_GUID *Namespace, + IN CONST CHAR16 *Name OPTIONAL, + IN UINT32 MinSize, + IN UINT32 MaxSize, + IN UINT32 AttributesMustHave, + IN UINT32 AttributesCantHave, + IN CONST EFI_GUID *VarStateNamespace, + IN UINT8 VarStateValue, + IN CONST CHAR16 *VarStateName, + OUT VARIABLE_POLICY_ENTRY **NewEntry + ); + +/** + This helper function does everything that CreateBasicVariablePolicy() does, but also + uses the passed in protocol to register the policy with the infrastructure. + Does not return a buffer, does not require the caller to free anything. + + @param[in] VariablePolicy Pointer to a valid instance of the VariablePolicy protocol. + @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect. + @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name. + Otherwise, will create a policy that targets an entire namespace. + @param[in] MinSize MinSize for the VariablePolicy. + @param[in] MaxSize MaxSize for the VariablePolicy. + @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy. + @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy. + @param[in] LockPolicyType LockPolicyType for the VariablePolicy. + + @retval EFI_INVALID_PARAMETER VariablePolicy pointer is NULL. + @retval EFI_STATUS Status returned by CreateBasicVariablePolicy() or RegisterVariablePolicy(). + +**/ +EFI_STATUS +EFIAPI +RegisterBasicVariablePolicy ( + IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy, + IN CONST EFI_GUID *Namespace, + IN CONST CHAR16 *Name OPTIONAL, + IN UINT32 MinSize, + IN UINT32 MaxSize, + IN UINT32 AttributesMustHave, + IN UINT32 AttributesCantHave, + IN UINT8 LockPolicyType + ); + +/** + This helper function does everything that CreateBasicVariablePolicy() does, but also + uses the passed in protocol to register the policy with the infrastructure. + Does not return a buffer, does not require the caller to free anything. + + @param[in] VariablePolicy Pointer to a valid instance of the VariablePolicy protocol. + @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect. + @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name. + Otherwise, will create a policy that targets an entire namespace. + @param[in] MinSize MinSize for the VariablePolicy. + @param[in] MaxSize MaxSize for the VariablePolicy. + @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy. + @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy. + @param[in] VarStateNamespace Pointer to the EFI_GUID for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Namespace. + @param[in] VarStateName Pointer to the CHAR16 array for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Name. + @param[in] VarStateValue Value for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Value. + + @retval EFI_INVALID_PARAMETER VariablePolicy pointer is NULL. + @retval EFI_STATUS Status returned by CreateBasicVariablePolicy() or RegisterVariablePolicy(). + +**/ +EFI_STATUS +EFIAPI +RegisterVarStateVariablePolicy ( + IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy, + IN CONST EFI_GUID *Namespace, + IN CONST CHAR16 *Name OPTIONAL, + IN UINT32 MinSize, + IN UINT32 MaxSize, + IN UINT32 AttributesMustHave, + IN UINT32 AttributesCantHave, + IN CONST EFI_GUID *VarStateNamespace, + IN CONST CHAR16 *VarStateName, + IN UINT8 VarStateValue + ); + +#endif // _EDKII_VARIABLE_POLICY_HELPER_LIB_H_ diff --git a/MdeModulePkg/Include/Library/VariablePolicyLib.h b/MdeModulePkg/Include/Library/VariablePolicyLib.h index bc4e26b2d4..39cbda4084 100644 --- a/MdeModulePkg/Include/Library/VariablePolicyLib.h +++ b/MdeModulePkg/Include/Library/VariablePolicyLib.h @@ -1,304 +1,304 @@ -/** @file -- VariablePolicyLib.h
-Business logic for Variable Policy enforcement.
-
-Copyright (c) Microsoft Corporation.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _VARIABLE_POLICY_LIB_H_
-#define _VARIABLE_POLICY_LIB_H_
-
-#include <Protocol/VariablePolicy.h>
-
-/**
- This API function validates and registers a new policy with
- the policy enforcement engine.
-
- @param[in] NewPolicy Pointer to the incoming policy structure.
-
- @retval EFI_SUCCESS
- @retval EFI_INVALID_PARAMETER NewPolicy is NULL or is internally inconsistent.
- @retval EFI_ALREADY_STARTED An identical matching policy already exists.
- @retval EFI_WRITE_PROTECTED The interface has been locked until the next reboot.
- @retval EFI_UNSUPPORTED Policy enforcement has been disabled. No reason to add more policies.
- @retval EFI_ABORTED A calculation error has prevented this function from completing.
- @retval EFI_OUT_OF_RESOURCES Cannot grow the table to hold any more policies.
- @retval EFI_NOT_READY Library has not yet been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-RegisterVariablePolicy (
- IN CONST VARIABLE_POLICY_ENTRY *NewPolicy
- );
-
-/**
- This API function checks to see whether the parameters to SetVariable would
- be allowed according to the current variable policies.
-
- @param[in] VariableName Same as EFI_SET_VARIABLE.
- @param[in] VendorGuid Same as EFI_SET_VARIABLE.
- @param[in] Attributes Same as EFI_SET_VARIABLE.
- @param[in] DataSize Same as EFI_SET_VARIABLE.
- @param[in] Data Same as EFI_SET_VARIABLE.
-
- @retval EFI_SUCCESS A matching policy allows this update.
- @retval EFI_SUCCESS There are currently no policies that restrict this update.
- @retval EFI_SUCCESS The protections have been disable until the next reboot.
- @retval EFI_WRITE_PROTECTED Variable is currently locked.
- @retval EFI_INVALID_PARAMETER Attributes or size are invalid.
- @retval EFI_ABORTED A lock policy exists, but an error prevented evaluation.
- @retval EFI_NOT_READY Library has not been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-ValidateSetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- );
-
-/**
- This API function disables the variable policy enforcement. If it's
- already been called once, will return EFI_ALREADY_STARTED.
-
- @retval EFI_SUCCESS
- @retval EFI_ALREADY_STARTED Has already been called once this boot.
- @retval EFI_WRITE_PROTECTED Interface has been locked until reboot.
- @retval EFI_WRITE_PROTECTED Interface option is disabled by platform PCD.
- @retval EFI_NOT_READY Library has not yet been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-DisableVariablePolicy (
- VOID
- );
-
-/**
- This API function will dump the entire contents of the variable policy table.
-
- Similar to GetVariable, the first call can be made with a 0 size and it will return
- the size of the buffer required to hold the entire table.
-
- @param[out] Policy Pointer to the policy buffer. Can be NULL if Size is 0.
- @param[in,out] Size On input, the size of the output buffer. On output, the size
- of the data returned.
-
- @retval EFI_SUCCESS Policy data is in the output buffer and Size has been updated.
- @retval EFI_INVALID_PARAMETER Size is NULL, or Size is non-zero and Policy is NULL.
- @retval EFI_BUFFER_TOO_SMALL Size is insufficient to hold policy. Size updated with required size.
- @retval EFI_NOT_READY Library has not yet been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-DumpVariablePolicy (
- OUT UINT8 *Policy,
- IN OUT UINT32 *Size
- );
-
-/**
- This function will return variable policy information for a UEFI variable with a
- registered variable policy.
-
- @param[in] VariableName The name of the variable to use for the policy search.
- @param[in] VendorGuid The vendor GUID of the variable to use for the policy search.
- @param[in,out] VariablePolicyVariableNameBufferSize On input, the size, in bytes, of the VariablePolicyVariableName
- buffer.
-
- On output, the size, in bytes, needed to store the variable
- policy variable name.
-
- If testing for the VariablePolicyVariableName buffer size
- needed, set this value to zero so EFI_BUFFER_TOO_SMALL is
- guaranteed to be returned if the variable policy variable name
- is found.
- @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written
- if found.
- @param[out] VariablePolicyVariableName Pointer to a buffer where the variable name used for the
- variable policy will be written if a variable name is
- registered.
-
- If the variable policy is not associated with a variable name
- (e.g. applied to variable vendor namespace) and this parameter
- is given, this parameter will not be modified and
- VariablePolicyVariableNameBufferSize will be set to zero to
- indicate a name was not present.
-
- If the pointer given is not NULL,
- VariablePolicyVariableNameBufferSize must be non-NULL.
-
- @retval EFI_SUCCESS A variable policy entry was found and returned successfully.
- @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error.
- @retval EFI_BUFFER_TOO_SMALL The VariablePolicyVariableName buffer value is too small for the size needed.
- The buffer should now point to the size needed.
- @retval EFI_NOT_READY Variable policy has not yet been initialized.
- @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if
- VariablePolicyVariableName is non-NULL and VariablePolicyVariableNameBufferSize
- is NULL.
- @retval EFI_NOT_FOUND A variable policy was not found for the given UEFI variable name and vendor GUID.
-
-**/
-EFI_STATUS
-EFIAPI
-GetVariablePolicyInfo (
- IN CONST CHAR16 *VariableName,
- IN CONST EFI_GUID *VendorGuid,
- IN OUT UINTN *VariablePolicyVariableNameBufferSize OPTIONAL,
- OUT VARIABLE_POLICY_ENTRY *VariablePolicy,
- OUT CHAR16 *VariablePolicyVariableName OPTIONAL
- );
-
-/**
- This function will return the Lock on Variable State policy information for the policy
- associated with the given UEFI variable.
-
- @param[in] VariableName The name of the variable to use for the policy search.
- @param[in] VendorGuid The vendor GUID of the variable to use for the policy
- search.
- @param[in,out] VariableLockPolicyVariableNameBufferSize On input, the size, in bytes, of the
- VariableLockPolicyVariableName buffer.
-
- On output, the size, in bytes, needed to store the variable
- policy variable name.
-
- If testing for the VariableLockPolicyVariableName buffer
- size needed, set this value to zero so EFI_BUFFER_TOO_SMALL
- is guaranteed to be returned if the variable policy variable
- name is found.
- @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written
- if found.
- @param[out] VariableLockPolicyVariableName Pointer to a buffer where the variable name used for the
- variable lock on variable state policy will be written if
- a variable name is registered.
-
- If the lock on variable policy is not associated with a
- variable name (e.g. applied to variable vendor namespace)
- and this parameter is given, this parameter will not be
- modified and VariableLockPolicyVariableNameBufferSize will
- be set to zero to indicate a name was not present.
-
- If the pointer given is not NULL,
- VariableLockPolicyVariableNameBufferSize must be non-NULL.
-
- @retval EFI_SUCCESS A Lock on Variable State variable policy entry was found and returned
- successfully.
- @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error.
- @retval EFI_BUFFER_TOO_SMALL The VariableLockPolicyVariableName buffer is too small for the size needed.
- The buffer should now point to the size needed.
- @retval EFI_NOT_READY Variable policy has not yet been initialized.
- @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if
- VariableLockPolicyVariableName is non-NULL and
- VariableLockPolicyVariableNameBufferSize is NULL.
- @retval EFI_NOT_FOUND A Lock on Variable State variable policy was not found for the given UEFI
- variable name and vendor GUID.
-
-**/
-EFI_STATUS
-EFIAPI
-GetLockOnVariableStateVariablePolicyInfo (
- IN CONST CHAR16 *VariableName,
- IN CONST EFI_GUID *VendorGuid,
- IN OUT UINTN *VariableLockPolicyVariableNameBufferSize OPTIONAL,
- OUT VARIABLE_LOCK_ON_VAR_STATE_POLICY *VariablePolicy,
- OUT CHAR16 *VariableLockPolicyVariableName OPTIONAL
- );
-
-/**
- This API function returns whether or not the policy engine is
- currently being enforced.
-
- @retval TRUE
- @retval FALSE
- @retval FALSE Library has not yet been initialized.
-
-**/
-BOOLEAN
-EFIAPI
-IsVariablePolicyEnabled (
- VOID
- );
-
-/**
- This API function locks the interface so that no more policy updates
- can be performed or changes made to the enforcement until the next boot.
-
- @retval EFI_SUCCESS
- @retval EFI_NOT_READY Library has not yet been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-LockVariablePolicy (
- VOID
- );
-
-/**
- This API function returns whether or not the policy interface is locked
- for the remainder of the boot.
-
- @retval TRUE
- @retval FALSE
- @retval FALSE Library has not yet been initialized.
-
-**/
-BOOLEAN
-EFIAPI
-IsVariablePolicyInterfaceLocked (
- VOID
- );
-
-/**
- This helper function initializes the library and sets
- up any required internal structures or handlers.
-
- Also registers the internal pointer for the GetVariable helper.
-
- @param[in] GetVariableHelper A function pointer matching the EFI_GET_VARIABLE prototype that will be used to
- check policy criteria that involve the existence of other variables.
-
- @retval EFI_SUCCESS
- @retval EFI_ALREADY_STARTED The initialize function has been called more than once without a call to
- deinitialize.
-
-**/
-EFI_STATUS
-EFIAPI
-InitVariablePolicyLib (
- IN EFI_GET_VARIABLE GetVariableHelper
- );
-
-/**
- This helper function returns whether or not the library is currently initialized.
-
- @retval TRUE
- @retval FALSE
-
-**/
-BOOLEAN
-EFIAPI
-IsVariablePolicyLibInitialized (
- VOID
- );
-
-/**
- This helper function tears down the library.
-
- Should generally only be used for test harnesses.
-
- @retval EFI_SUCCESS
- @retval EFI_NOT_READY Deinitialize was called without first calling initialize.
-
-**/
-EFI_STATUS
-EFIAPI
-DeinitVariablePolicyLib (
- VOID
- );
-
-#endif // _VARIABLE_POLICY_LIB_H_
+/** @file -- VariablePolicyLib.h +Business logic for Variable Policy enforcement. + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _VARIABLE_POLICY_LIB_H_ +#define _VARIABLE_POLICY_LIB_H_ + +#include <Protocol/VariablePolicy.h> + +/** + This API function validates and registers a new policy with + the policy enforcement engine. + + @param[in] NewPolicy Pointer to the incoming policy structure. + + @retval EFI_SUCCESS + @retval EFI_INVALID_PARAMETER NewPolicy is NULL or is internally inconsistent. + @retval EFI_ALREADY_STARTED An identical matching policy already exists. + @retval EFI_WRITE_PROTECTED The interface has been locked until the next reboot. + @retval EFI_UNSUPPORTED Policy enforcement has been disabled. No reason to add more policies. + @retval EFI_ABORTED A calculation error has prevented this function from completing. + @retval EFI_OUT_OF_RESOURCES Cannot grow the table to hold any more policies. + @retval EFI_NOT_READY Library has not yet been initialized. + +**/ +EFI_STATUS +EFIAPI +RegisterVariablePolicy ( + IN CONST VARIABLE_POLICY_ENTRY *NewPolicy + ); + +/** + This API function checks to see whether the parameters to SetVariable would + be allowed according to the current variable policies. + + @param[in] VariableName Same as EFI_SET_VARIABLE. + @param[in] VendorGuid Same as EFI_SET_VARIABLE. + @param[in] Attributes Same as EFI_SET_VARIABLE. + @param[in] DataSize Same as EFI_SET_VARIABLE. + @param[in] Data Same as EFI_SET_VARIABLE. + + @retval EFI_SUCCESS A matching policy allows this update. + @retval EFI_SUCCESS There are currently no policies that restrict this update. + @retval EFI_SUCCESS The protections have been disable until the next reboot. + @retval EFI_WRITE_PROTECTED Variable is currently locked. + @retval EFI_INVALID_PARAMETER Attributes or size are invalid. + @retval EFI_ABORTED A lock policy exists, but an error prevented evaluation. + @retval EFI_NOT_READY Library has not been initialized. + +**/ +EFI_STATUS +EFIAPI +ValidateSetVariable ( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + IN UINT32 Attributes, + IN UINTN DataSize, + IN VOID *Data + ); + +/** + This API function disables the variable policy enforcement. If it's + already been called once, will return EFI_ALREADY_STARTED. + + @retval EFI_SUCCESS + @retval EFI_ALREADY_STARTED Has already been called once this boot. + @retval EFI_WRITE_PROTECTED Interface has been locked until reboot. + @retval EFI_WRITE_PROTECTED Interface option is disabled by platform PCD. + @retval EFI_NOT_READY Library has not yet been initialized. + +**/ +EFI_STATUS +EFIAPI +DisableVariablePolicy ( + VOID + ); + +/** + This API function will dump the entire contents of the variable policy table. + + Similar to GetVariable, the first call can be made with a 0 size and it will return + the size of the buffer required to hold the entire table. + + @param[out] Policy Pointer to the policy buffer. Can be NULL if Size is 0. + @param[in,out] Size On input, the size of the output buffer. On output, the size + of the data returned. + + @retval EFI_SUCCESS Policy data is in the output buffer and Size has been updated. + @retval EFI_INVALID_PARAMETER Size is NULL, or Size is non-zero and Policy is NULL. + @retval EFI_BUFFER_TOO_SMALL Size is insufficient to hold policy. Size updated with required size. + @retval EFI_NOT_READY Library has not yet been initialized. + +**/ +EFI_STATUS +EFIAPI +DumpVariablePolicy ( + OUT UINT8 *Policy, + IN OUT UINT32 *Size + ); + +/** + This function will return variable policy information for a UEFI variable with a + registered variable policy. + + @param[in] VariableName The name of the variable to use for the policy search. + @param[in] VendorGuid The vendor GUID of the variable to use for the policy search. + @param[in,out] VariablePolicyVariableNameBufferSize On input, the size, in bytes, of the VariablePolicyVariableName + buffer. + + On output, the size, in bytes, needed to store the variable + policy variable name. + + If testing for the VariablePolicyVariableName buffer size + needed, set this value to zero so EFI_BUFFER_TOO_SMALL is + guaranteed to be returned if the variable policy variable name + is found. + @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written + if found. + @param[out] VariablePolicyVariableName Pointer to a buffer where the variable name used for the + variable policy will be written if a variable name is + registered. + + If the variable policy is not associated with a variable name + (e.g. applied to variable vendor namespace) and this parameter + is given, this parameter will not be modified and + VariablePolicyVariableNameBufferSize will be set to zero to + indicate a name was not present. + + If the pointer given is not NULL, + VariablePolicyVariableNameBufferSize must be non-NULL. + + @retval EFI_SUCCESS A variable policy entry was found and returned successfully. + @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error. + @retval EFI_BUFFER_TOO_SMALL The VariablePolicyVariableName buffer value is too small for the size needed. + The buffer should now point to the size needed. + @retval EFI_NOT_READY Variable policy has not yet been initialized. + @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if + VariablePolicyVariableName is non-NULL and VariablePolicyVariableNameBufferSize + is NULL. + @retval EFI_NOT_FOUND A variable policy was not found for the given UEFI variable name and vendor GUID. + +**/ +EFI_STATUS +EFIAPI +GetVariablePolicyInfo ( + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VendorGuid, + IN OUT UINTN *VariablePolicyVariableNameBufferSize OPTIONAL, + OUT VARIABLE_POLICY_ENTRY *VariablePolicy, + OUT CHAR16 *VariablePolicyVariableName OPTIONAL + ); + +/** + This function will return the Lock on Variable State policy information for the policy + associated with the given UEFI variable. + + @param[in] VariableName The name of the variable to use for the policy search. + @param[in] VendorGuid The vendor GUID of the variable to use for the policy + search. + @param[in,out] VariableLockPolicyVariableNameBufferSize On input, the size, in bytes, of the + VariableLockPolicyVariableName buffer. + + On output, the size, in bytes, needed to store the variable + policy variable name. + + If testing for the VariableLockPolicyVariableName buffer + size needed, set this value to zero so EFI_BUFFER_TOO_SMALL + is guaranteed to be returned if the variable policy variable + name is found. + @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written + if found. + @param[out] VariableLockPolicyVariableName Pointer to a buffer where the variable name used for the + variable lock on variable state policy will be written if + a variable name is registered. + + If the lock on variable policy is not associated with a + variable name (e.g. applied to variable vendor namespace) + and this parameter is given, this parameter will not be + modified and VariableLockPolicyVariableNameBufferSize will + be set to zero to indicate a name was not present. + + If the pointer given is not NULL, + VariableLockPolicyVariableNameBufferSize must be non-NULL. + + @retval EFI_SUCCESS A Lock on Variable State variable policy entry was found and returned + successfully. + @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error. + @retval EFI_BUFFER_TOO_SMALL The VariableLockPolicyVariableName buffer is too small for the size needed. + The buffer should now point to the size needed. + @retval EFI_NOT_READY Variable policy has not yet been initialized. + @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if + VariableLockPolicyVariableName is non-NULL and + VariableLockPolicyVariableNameBufferSize is NULL. + @retval EFI_NOT_FOUND A Lock on Variable State variable policy was not found for the given UEFI + variable name and vendor GUID. + +**/ +EFI_STATUS +EFIAPI +GetLockOnVariableStateVariablePolicyInfo ( + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VendorGuid, + IN OUT UINTN *VariableLockPolicyVariableNameBufferSize OPTIONAL, + OUT VARIABLE_LOCK_ON_VAR_STATE_POLICY *VariablePolicy, + OUT CHAR16 *VariableLockPolicyVariableName OPTIONAL + ); + +/** + This API function returns whether or not the policy engine is + currently being enforced. + + @retval TRUE + @retval FALSE + @retval FALSE Library has not yet been initialized. + +**/ +BOOLEAN +EFIAPI +IsVariablePolicyEnabled ( + VOID + ); + +/** + This API function locks the interface so that no more policy updates + can be performed or changes made to the enforcement until the next boot. + + @retval EFI_SUCCESS + @retval EFI_NOT_READY Library has not yet been initialized. + +**/ +EFI_STATUS +EFIAPI +LockVariablePolicy ( + VOID + ); + +/** + This API function returns whether or not the policy interface is locked + for the remainder of the boot. + + @retval TRUE + @retval FALSE + @retval FALSE Library has not yet been initialized. + +**/ +BOOLEAN +EFIAPI +IsVariablePolicyInterfaceLocked ( + VOID + ); + +/** + This helper function initializes the library and sets + up any required internal structures or handlers. + + Also registers the internal pointer for the GetVariable helper. + + @param[in] GetVariableHelper A function pointer matching the EFI_GET_VARIABLE prototype that will be used to + check policy criteria that involve the existence of other variables. + + @retval EFI_SUCCESS + @retval EFI_ALREADY_STARTED The initialize function has been called more than once without a call to + deinitialize. + +**/ +EFI_STATUS +EFIAPI +InitVariablePolicyLib ( + IN EFI_GET_VARIABLE GetVariableHelper + ); + +/** + This helper function returns whether or not the library is currently initialized. + + @retval TRUE + @retval FALSE + +**/ +BOOLEAN +EFIAPI +IsVariablePolicyLibInitialized ( + VOID + ); + +/** + This helper function tears down the library. + + Should generally only be used for test harnesses. + + @retval EFI_SUCCESS + @retval EFI_NOT_READY Deinitialize was called without first calling initialize. + +**/ +EFI_STATUS +EFIAPI +DeinitVariablePolicyLib ( + VOID + ); + +#endif // _VARIABLE_POLICY_LIB_H_ diff --git a/MdeModulePkg/Include/Ppi/AtaAhciController.h b/MdeModulePkg/Include/Ppi/AtaAhciController.h index 896659027a..14fadea021 100644 --- a/MdeModulePkg/Include/Ppi/AtaAhciController.h +++ b/MdeModulePkg/Include/Ppi/AtaAhciController.h @@ -1,83 +1,83 @@ -/** @file
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EDKII_ATA_AHCI_HOST_CONTROLLER_PPI_H_
-#define _EDKII_ATA_AHCI_HOST_CONTROLLER_PPI_H_
-
-#include <Protocol/DevicePath.h>
-
-///
-/// Global ID for the EDKII_ATA_AHCI_HOST_CONTROLLER_PPI.
-///
-#define EDKII_ATA_AHCI_HOST_CONTROLLER_PPI_GUID \
- { \
- 0x61dd33ea, 0x421f, 0x4cc0, { 0x89, 0x29, 0xff, 0xee, 0xa9, 0xa1, 0xa2, 0x61 } \
- }
-
-//
-// Forward declaration for the EDKII_ATA_AHCI_HOST_CONTROLLER_PPI.
-//
-typedef struct _EDKII_ATA_AHCI_HOST_CONTROLLER_PPI EDKII_ATA_AHCI_HOST_CONTROLLER_PPI;
-
-/**
- Get the MMIO base address of ATA AHCI host controller.
-
- @param[in] This The PPI instance pointer.
- @param[in] ControllerId The ID of the ATA AHCI host controller.
- @param[out] MmioBar The MMIO base address of the controller.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
- @retval EFI_NOT_FOUND The specified ATA AHCI host controller not found.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_ATA_AHCI_HC_GET_MMIO_BAR)(
- IN EDKII_ATA_AHCI_HOST_CONTROLLER_PPI *This,
- IN UINT8 ControllerId,
- OUT UINTN *MmioBar
- );
-
-/**
- Get the device path of ATA AHCI host controller.
-
- @param[in] This The PPI instance pointer.
- @param[in] ControllerId The ID of the ATA AHCI host controller.
- @param[out] DevicePathLength The length of the device path in bytes specified
- by DevicePath.
- @param[out] DevicePath The device path of ATA AHCI host controller.
- This field re-uses EFI Device Path Protocol as
- defined by Section 10.2 EFI Device Path Protocol
- of UEFI 2.7 Specification.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
- @retval EFI_NOT_FOUND The specified ATA AHCI host controller not found.
- @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_ATA_AHCI_HC_GET_DEVICE_PATH)(
- IN EDKII_ATA_AHCI_HOST_CONTROLLER_PPI *This,
- IN UINT8 ControllerId,
- OUT UINTN *DevicePathLength,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- );
-
-//
-// This PPI contains a set of services to interact with the ATA AHCI host controller.
-//
-struct _EDKII_ATA_AHCI_HOST_CONTROLLER_PPI {
- EDKII_ATA_AHCI_HC_GET_MMIO_BAR GetAhciHcMmioBar;
- EDKII_ATA_AHCI_HC_GET_DEVICE_PATH GetAhciHcDevicePath;
-};
-
-extern EFI_GUID gEdkiiPeiAtaAhciHostControllerPpiGuid;
-
-#endif
+/** @file + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_ATA_AHCI_HOST_CONTROLLER_PPI_H_ +#define _EDKII_ATA_AHCI_HOST_CONTROLLER_PPI_H_ + +#include <Protocol/DevicePath.h> + +/// +/// Global ID for the EDKII_ATA_AHCI_HOST_CONTROLLER_PPI. +/// +#define EDKII_ATA_AHCI_HOST_CONTROLLER_PPI_GUID \ + { \ + 0x61dd33ea, 0x421f, 0x4cc0, { 0x89, 0x29, 0xff, 0xee, 0xa9, 0xa1, 0xa2, 0x61 } \ + } + +// +// Forward declaration for the EDKII_ATA_AHCI_HOST_CONTROLLER_PPI. +// +typedef struct _EDKII_ATA_AHCI_HOST_CONTROLLER_PPI EDKII_ATA_AHCI_HOST_CONTROLLER_PPI; + +/** + Get the MMIO base address of ATA AHCI host controller. + + @param[in] This The PPI instance pointer. + @param[in] ControllerId The ID of the ATA AHCI host controller. + @param[out] MmioBar The MMIO base address of the controller. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + @retval EFI_NOT_FOUND The specified ATA AHCI host controller not found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_ATA_AHCI_HC_GET_MMIO_BAR)( + IN EDKII_ATA_AHCI_HOST_CONTROLLER_PPI *This, + IN UINT8 ControllerId, + OUT UINTN *MmioBar + ); + +/** + Get the device path of ATA AHCI host controller. + + @param[in] This The PPI instance pointer. + @param[in] ControllerId The ID of the ATA AHCI host controller. + @param[out] DevicePathLength The length of the device path in bytes specified + by DevicePath. + @param[out] DevicePath The device path of ATA AHCI host controller. + This field re-uses EFI Device Path Protocol as + defined by Section 10.2 EFI Device Path Protocol + of UEFI 2.7 Specification. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + @retval EFI_NOT_FOUND The specified ATA AHCI host controller not found. + @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_ATA_AHCI_HC_GET_DEVICE_PATH)( + IN EDKII_ATA_AHCI_HOST_CONTROLLER_PPI *This, + IN UINT8 ControllerId, + OUT UINTN *DevicePathLength, + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ); + +// +// This PPI contains a set of services to interact with the ATA AHCI host controller. +// +struct _EDKII_ATA_AHCI_HOST_CONTROLLER_PPI { + EDKII_ATA_AHCI_HC_GET_MMIO_BAR GetAhciHcMmioBar; + EDKII_ATA_AHCI_HC_GET_DEVICE_PATH GetAhciHcDevicePath; +}; + +extern EFI_GUID gEdkiiPeiAtaAhciHostControllerPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/AtaController.h b/MdeModulePkg/Include/Ppi/AtaController.h index 0096f7bae0..cfc0d4ea0d 100644 --- a/MdeModulePkg/Include/Ppi/AtaController.h +++ b/MdeModulePkg/Include/Ppi/AtaController.h @@ -1,153 +1,153 @@ -/** @file
- Define the PPI to abstract the functions that enable IDE and SATA channels, and to retrieve
- the base I/O port address for each of the enabled IDE and SATA channels.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PEI_ATA_CONTROLLER_PPI_H_
-#define _PEI_ATA_CONTROLLER_PPI_H_
-
-///
-/// Global ID for the PEI_ATA_CONTROLLER_PPI.
-///
-#define PEI_ATA_CONTROLLER_PPI_GUID \
- { \
- 0xa45e60d1, 0xc719, 0x44aa, {0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d } \
- }
-
-///
-/// Forward declaration for the PEI_ATA_CONTROLLER_PPI.
-///
-typedef struct _PEI_ATA_CONTROLLER_PPI PEI_ATA_CONTROLLER_PPI;
-
-///
-/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to
-/// disable the IDE channels.
-/// This is designed for old generation chipset with PATA/SATA controllers.
-/// It may be ignored in PPI implementation for new generation chipset without PATA controller.
-///
-#define PEI_ICH_IDE_NONE 0x00
-
-///
-/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to
-/// enable the Primary IDE channel.
-/// This is designed for old generation chipset with PATA/SATA controllers.
-/// It may be ignored in PPI implementation for new generation chipset without PATA controller.
-///
-#define PEI_ICH_IDE_PRIMARY 0x01
-
-///
-/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to
-/// enable the Secondary IDE channel.
-/// This is designed for old generation chipset with PATA/SATA controllers.
-/// It may be ignored in PPI implementation for new generation chipset without PATA controller.
-///
-#define PEI_ICH_IDE_SECONDARY 0x02
-
-///
-/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to
-/// disable the SATA channel.
-/// This is designed for old generation chipset with PATA/SATA controllers.
-/// It may be ignored in PPI implementation for new generation chipset without PATA controller.
-///
-#define PEI_ICH_SATA_NONE 0x04
-
-///
-/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to
-/// enable the Primary SATA channel.
-/// This is designed for old generation chipset with PATA/SATA controllers.
-/// It may be ignored in PPI implementation for new generation chipset without PATA controller.
-///
-#define PEI_ICH_SATA_PRIMARY 0x08
-
-///
-/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to
-/// enable the Secondary SATA channel.
-/// This is designed for old generation chipset with PATA/SATA controllers.
-/// It may be ignored in PPI implementation for new generation chipset without PATA controller.
-///
-#define PEI_ICH_SATA_SECONDARY 0x010
-
-///
-/// Structure that contains the base addresses for the IDE registers
-///
-typedef struct {
- ///
- /// Base I/O port address of the IDE controller's command block
- ///
- UINT16 CommandBlockBaseAddr;
- ///
- /// Base I/O port address of the IDE controller's control block
- ///
- UINT16 ControlBlockBaseAddr;
-} IDE_REGS_BASE_ADDR;
-
-/**
- Sets IDE and SATA channels to an enabled or disabled state.
-
- This service enables or disables the IDE and SATA channels specified by ChannelMask.
- It may ignore ChannelMask setting to enable or disable IDE and SATA channels based on the platform policy.
- The number of the enabled channels will be returned by GET_IDE_REGS_BASE_ADDR() function.
-
- If the new state is set, then EFI_SUCCESS is returned. If the new state can
- not be set, then EFI_DEVICE_ERROR is returned.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the PEI_ATA_CONTROLLER_PPI.
- @param[in] ChannelMask The bitmask that identifies the IDE and SATA channels to
- enable or disable. This parameter is optional.
-
- @retval EFI_SUCCESS The IDE or SATA channels were enabled or disabled successfully.
- @retval EFI_DEVICE_ERROR The IDE or SATA channels could not be enabled or disabled.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_ENABLE_ATA)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_ATA_CONTROLLER_PPI *This,
- IN UINT8 ChannelMask
- );
-
-/**
- Retrieves the I/O port base addresses for command and control registers of the
- enabled IDE/SATA channels.
-
- This service fills in the structure poionted to by IdeRegsBaseAddr with the I/O
- port base addresses for the command and control registers of the IDE and SATA
- channels that were previously enabled in EnableAtaChannel(). The number of
- enabled IDE and SATA channels is returned.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the PEI_ATA_CONTROLLER_PPI.
- @param[out] IdeRegsBaseAddr The pointer to caller allocated space to return the
- I/O port base addresses of the IDE and SATA channels
- that were previosuly enabled with EnableAtaChannel().
-
- @return The number of enabled IDE and SATA channels in the platform.
-
-**/
-typedef
-UINT32
-(EFIAPI *GET_IDE_REGS_BASE_ADDR)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_ATA_CONTROLLER_PPI *This,
- OUT IDE_REGS_BASE_ADDR *IdeRegsBaseAddr
- );
-
-///
-/// This PPI contains services to enable and disable IDE and SATA channels and
-/// retrieves the base I/O port addresses to the enabled IDE and SATA channels.
-///
-struct _PEI_ATA_CONTROLLER_PPI {
- PEI_ENABLE_ATA EnableAtaChannel;
- GET_IDE_REGS_BASE_ADDR GetIdeRegsBaseAddr;
-};
-
-extern EFI_GUID gPeiAtaControllerPpiGuid;
-
-#endif
+/** @file + Define the PPI to abstract the functions that enable IDE and SATA channels, and to retrieve + the base I/O port address for each of the enabled IDE and SATA channels. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PEI_ATA_CONTROLLER_PPI_H_ +#define _PEI_ATA_CONTROLLER_PPI_H_ + +/// +/// Global ID for the PEI_ATA_CONTROLLER_PPI. +/// +#define PEI_ATA_CONTROLLER_PPI_GUID \ + { \ + 0xa45e60d1, 0xc719, 0x44aa, {0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d } \ + } + +/// +/// Forward declaration for the PEI_ATA_CONTROLLER_PPI. +/// +typedef struct _PEI_ATA_CONTROLLER_PPI PEI_ATA_CONTROLLER_PPI; + +/// +/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to +/// disable the IDE channels. +/// This is designed for old generation chipset with PATA/SATA controllers. +/// It may be ignored in PPI implementation for new generation chipset without PATA controller. +/// +#define PEI_ICH_IDE_NONE 0x00 + +/// +/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to +/// enable the Primary IDE channel. +/// This is designed for old generation chipset with PATA/SATA controllers. +/// It may be ignored in PPI implementation for new generation chipset without PATA controller. +/// +#define PEI_ICH_IDE_PRIMARY 0x01 + +/// +/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to +/// enable the Secondary IDE channel. +/// This is designed for old generation chipset with PATA/SATA controllers. +/// It may be ignored in PPI implementation for new generation chipset without PATA controller. +/// +#define PEI_ICH_IDE_SECONDARY 0x02 + +/// +/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to +/// disable the SATA channel. +/// This is designed for old generation chipset with PATA/SATA controllers. +/// It may be ignored in PPI implementation for new generation chipset without PATA controller. +/// +#define PEI_ICH_SATA_NONE 0x04 + +/// +/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to +/// enable the Primary SATA channel. +/// This is designed for old generation chipset with PATA/SATA controllers. +/// It may be ignored in PPI implementation for new generation chipset without PATA controller. +/// +#define PEI_ICH_SATA_PRIMARY 0x08 + +/// +/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to +/// enable the Secondary SATA channel. +/// This is designed for old generation chipset with PATA/SATA controllers. +/// It may be ignored in PPI implementation for new generation chipset without PATA controller. +/// +#define PEI_ICH_SATA_SECONDARY 0x010 + +/// +/// Structure that contains the base addresses for the IDE registers +/// +typedef struct { + /// + /// Base I/O port address of the IDE controller's command block + /// + UINT16 CommandBlockBaseAddr; + /// + /// Base I/O port address of the IDE controller's control block + /// + UINT16 ControlBlockBaseAddr; +} IDE_REGS_BASE_ADDR; + +/** + Sets IDE and SATA channels to an enabled or disabled state. + + This service enables or disables the IDE and SATA channels specified by ChannelMask. + It may ignore ChannelMask setting to enable or disable IDE and SATA channels based on the platform policy. + The number of the enabled channels will be returned by GET_IDE_REGS_BASE_ADDR() function. + + If the new state is set, then EFI_SUCCESS is returned. If the new state can + not be set, then EFI_DEVICE_ERROR is returned. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the PEI_ATA_CONTROLLER_PPI. + @param[in] ChannelMask The bitmask that identifies the IDE and SATA channels to + enable or disable. This parameter is optional. + + @retval EFI_SUCCESS The IDE or SATA channels were enabled or disabled successfully. + @retval EFI_DEVICE_ERROR The IDE or SATA channels could not be enabled or disabled. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_ENABLE_ATA)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_ATA_CONTROLLER_PPI *This, + IN UINT8 ChannelMask + ); + +/** + Retrieves the I/O port base addresses for command and control registers of the + enabled IDE/SATA channels. + + This service fills in the structure poionted to by IdeRegsBaseAddr with the I/O + port base addresses for the command and control registers of the IDE and SATA + channels that were previously enabled in EnableAtaChannel(). The number of + enabled IDE and SATA channels is returned. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the PEI_ATA_CONTROLLER_PPI. + @param[out] IdeRegsBaseAddr The pointer to caller allocated space to return the + I/O port base addresses of the IDE and SATA channels + that were previosuly enabled with EnableAtaChannel(). + + @return The number of enabled IDE and SATA channels in the platform. + +**/ +typedef +UINT32 +(EFIAPI *GET_IDE_REGS_BASE_ADDR)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_ATA_CONTROLLER_PPI *This, + OUT IDE_REGS_BASE_ADDR *IdeRegsBaseAddr + ); + +/// +/// This PPI contains services to enable and disable IDE and SATA channels and +/// retrieves the base I/O port addresses to the enabled IDE and SATA channels. +/// +struct _PEI_ATA_CONTROLLER_PPI { + PEI_ENABLE_ATA EnableAtaChannel; + GET_IDE_REGS_BASE_ADDR GetIdeRegsBaseAddr; +}; + +extern EFI_GUID gPeiAtaControllerPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/AtaPassThru.h b/MdeModulePkg/Include/Ppi/AtaPassThru.h index 73fb688c8a..322b287685 100644 --- a/MdeModulePkg/Include/Ppi/AtaPassThru.h +++ b/MdeModulePkg/Include/Ppi/AtaPassThru.h @@ -1,212 +1,212 @@ -/** @file
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EDKII_ATA_PASS_THRU_PPI_H_
-#define _EDKII_ATA_PASS_THRU_PPI_H_
-
-#include <Protocol/DevicePath.h>
-#include <Protocol/AtaPassThru.h>
-
-///
-/// Global ID for the EDKII_PEI_ATA_PASS_THRU_PPI.
-///
-#define EDKII_PEI_ATA_PASS_THRU_PPI_GUID \
- { \
- 0xa16473fd, 0xd474, 0x4c89, { 0xae, 0xc7, 0x90, 0xb8, 0x3c, 0x73, 0x86, 0x9 } \
- }
-
-//
-// Forward declaration for the EDKII_PEI_ATA_PASS_THRU_PPI.
-//
-typedef struct _EDKII_PEI_ATA_PASS_THRU_PPI EDKII_PEI_ATA_PASS_THRU_PPI;
-
-//
-// Revision The revision to which the ATA Pass Thru PPI interface adheres.
-// All future revisions must be backwards compatible.
-// If a future version is not back wards compatible it is not the same GUID.
-//
-#define EDKII_PEI_ATA_PASS_THRU_PPI_REVISION 0x00010000
-
-/**
- Sends an ATA command to an ATA device that is attached to the ATA controller.
-
- @param[in] This The PPI instance pointer.
- @param[in] Port The port number of the ATA device to send
- the command.
- @param[in] PortMultiplierPort The port multiplier port number of the ATA
- device to send the command.
- If there is no port multiplier, then specify
- 0xFFFF.
- @param[in,out] Packet A pointer to the ATA command to send to
- the ATA device specified by Port and
- PortMultiplierPort.
-
- @retval EFI_SUCCESS The ATA command was sent by the host. For
- bi-directional commands, InTransferLength bytes
- were transferred from InDataBuffer. For write
- and bi-directional commands, OutTransferLength
- bytes were transferred by OutDataBuffer.
- @retval EFI_NOT_FOUND The specified ATA device is not found.
- @retval EFI_INVALID_PARAMETER The contents of Acb are invalid. The ATA command
- was not sent, so no additional status information
- is available.
- @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number
- of bytes that could be transferred is returned
- in InTransferLength. For write and bi-directional
- commands, OutTransferLength bytes were transferred
- by OutDataBuffer.
- @retval EFI_NOT_READY The ATA command could not be sent because there
- are too many ATA commands already queued. The
- caller may retry again later.
- @retval EFI_DEVICE_ERROR A device error occurred while attempting to
- send the ATA command.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_ATA_PASS_THRU_PASSTHRU)(
- IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
- IN UINT16 Port,
- IN UINT16 PortMultiplierPort,
- IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet
- );
-
-/**
- Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.
- These can either be the list of ports where ATA devices are actually present or the
- list of legal port numbers for the ATA controller. Regardless, the caller of this
- function must probe the port number returned to see if an ATA device is actually
- present at that location on the ATA controller.
-
- The GetNextPort() function retrieves the port number on an ATA controller. If on
- input Port is 0xFFFF, then the port number of the first port on the ATA controller
- is returned in Port and EFI_SUCCESS is returned.
-
- If Port is a port number that was returned on a previous call to GetNextPort(),
- then the port number of the next port on the ATA controller is returned in Port,
- and EFI_SUCCESS is returned. If Port is not 0xFFFF and Port was not returned on
- a previous call to GetNextPort(), then EFI_INVALID_PARAMETER is returned.
-
- If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND
- is returned.
-
- @param[in] This The PPI instance pointer.
- @param[in,out] Port On input, a pointer to the port number on the ATA controller.
- On output, a pointer to the next port number on the ATA
- controller. An input value of 0xFFFF retrieves the first
- port number on the ATA controller.
-
- @retval EFI_SUCCESS The next port number on the ATA controller was
- returned in Port.
- @retval EFI_NOT_FOUND There are no more ports on this ATA controller.
- @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned
- on a previous call to GetNextPort().
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT)(
- IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
- IN OUT UINT16 *Port
- );
-
-/**
- Used to retrieve the list of legal port multiplier port numbers for ATA devices
- on a port of an ATA controller. These can either be the list of port multiplier
- ports where ATA devices are actually present on port or the list of legal port
- multiplier ports on that port. Regardless, the caller of this function must probe
- the port number and port multiplier port number returned to see if an ATA device
- is actually present.
-
- The GetNextDevice() function retrieves the port multiplier port number of an ATA
- device present on a port of an ATA controller.
-
- If PortMultiplierPort points to a port multiplier port number value that was
- returned on a previous call to GetNextDevice(), then the port multiplier port
- number of the next ATA device on the port of the ATA controller is returned in
- PortMultiplierPort, and EFI_SUCCESS is returned.
-
- If PortMultiplierPort points to 0xFFFF, then the port multiplier port number
- of the first ATA device on port of the ATA controller is returned in PortMultiplierPort
- and EFI_SUCCESS is returned.
-
- If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
- was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
- is returned.
-
- If PortMultiplierPort is the port multiplier port number of the last ATA device
- on the port of the ATA controller, then EFI_NOT_FOUND is returned.
-
- @param[in] This The PPI instance pointer.
- @param[in] Port The port number present on the ATA controller.
- @param[in,out] PortMultiplierPort On input, a pointer to the port multiplier
- port number of an ATA device present on the
- ATA controller. If on input a PortMultiplierPort
- of 0xFFFF is specified, then the port multiplier
- port number of the first ATA device is returned.
- On output, a pointer to the port multiplier port
- number of the next ATA device present on an ATA
- controller.
-
- @retval EFI_SUCCESS The port multiplier port number of the next ATA
- device on the port of the ATA controller was
- returned in PortMultiplierPort.
- @retval EFI_NOT_FOUND There are no more ATA devices on this port of
- the ATA controller.
- @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort
- was not returned on a previous call to GetNextDevice().
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE)(
- IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
- IN UINT16 Port,
- IN OUT UINT16 *PortMultiplierPort
- );
-
-/**
- Gets the device path information of the underlying ATA host controller.
-
- @param[in] This The PPI instance pointer.
- @param[out] DevicePathLength The length of the device path in bytes specified
- by DevicePath.
- @param[out] DevicePath The device path of the underlying ATA host controller.
- This field re-uses EFI Device Path Protocol as
- defined by Section 10.2 EFI Device Path Protocol
- of UEFI 2.7 Specification.
-
- @retval EFI_SUCCESS The device path of the ATA host controller has
- been successfully returned.
- @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.
- @retval EFI_OUT_OF_RESOURCES Not enough resource to return the device path.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH)(
- IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
- OUT UINTN *DevicePathLength,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- );
-
-//
-// EDKII_PEI_ATA_PASS_THRU_PPI provides the services that are required to send
-// ATA commands to an ATA device during PEI.
-//
-struct _EDKII_PEI_ATA_PASS_THRU_PPI {
- UINT64 Revision;
- EFI_ATA_PASS_THRU_MODE *Mode;
- EDKII_PEI_ATA_PASS_THRU_PASSTHRU PassThru;
- EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT GetNextPort;
- EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE GetNextDevice;
- EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH GetDevicePath;
-};
-
-extern EFI_GUID gEdkiiPeiAtaPassThruPpiGuid;
-
-#endif
+/** @file + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_ATA_PASS_THRU_PPI_H_ +#define _EDKII_ATA_PASS_THRU_PPI_H_ + +#include <Protocol/DevicePath.h> +#include <Protocol/AtaPassThru.h> + +/// +/// Global ID for the EDKII_PEI_ATA_PASS_THRU_PPI. +/// +#define EDKII_PEI_ATA_PASS_THRU_PPI_GUID \ + { \ + 0xa16473fd, 0xd474, 0x4c89, { 0xae, 0xc7, 0x90, 0xb8, 0x3c, 0x73, 0x86, 0x9 } \ + } + +// +// Forward declaration for the EDKII_PEI_ATA_PASS_THRU_PPI. +// +typedef struct _EDKII_PEI_ATA_PASS_THRU_PPI EDKII_PEI_ATA_PASS_THRU_PPI; + +// +// Revision The revision to which the ATA Pass Thru PPI interface adheres. +// All future revisions must be backwards compatible. +// If a future version is not back wards compatible it is not the same GUID. +// +#define EDKII_PEI_ATA_PASS_THRU_PPI_REVISION 0x00010000 + +/** + Sends an ATA command to an ATA device that is attached to the ATA controller. + + @param[in] This The PPI instance pointer. + @param[in] Port The port number of the ATA device to send + the command. + @param[in] PortMultiplierPort The port multiplier port number of the ATA + device to send the command. + If there is no port multiplier, then specify + 0xFFFF. + @param[in,out] Packet A pointer to the ATA command to send to + the ATA device specified by Port and + PortMultiplierPort. + + @retval EFI_SUCCESS The ATA command was sent by the host. For + bi-directional commands, InTransferLength bytes + were transferred from InDataBuffer. For write + and bi-directional commands, OutTransferLength + bytes were transferred by OutDataBuffer. + @retval EFI_NOT_FOUND The specified ATA device is not found. + @retval EFI_INVALID_PARAMETER The contents of Acb are invalid. The ATA command + was not sent, so no additional status information + is available. + @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number + of bytes that could be transferred is returned + in InTransferLength. For write and bi-directional + commands, OutTransferLength bytes were transferred + by OutDataBuffer. + @retval EFI_NOT_READY The ATA command could not be sent because there + are too many ATA commands already queued. The + caller may retry again later. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to + send the ATA command. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_ATA_PASS_THRU_PASSTHRU)( + IN EDKII_PEI_ATA_PASS_THRU_PPI *This, + IN UINT16 Port, + IN UINT16 PortMultiplierPort, + IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet + ); + +/** + Used to retrieve the list of legal port numbers for ATA devices on an ATA controller. + These can either be the list of ports where ATA devices are actually present or the + list of legal port numbers for the ATA controller. Regardless, the caller of this + function must probe the port number returned to see if an ATA device is actually + present at that location on the ATA controller. + + The GetNextPort() function retrieves the port number on an ATA controller. If on + input Port is 0xFFFF, then the port number of the first port on the ATA controller + is returned in Port and EFI_SUCCESS is returned. + + If Port is a port number that was returned on a previous call to GetNextPort(), + then the port number of the next port on the ATA controller is returned in Port, + and EFI_SUCCESS is returned. If Port is not 0xFFFF and Port was not returned on + a previous call to GetNextPort(), then EFI_INVALID_PARAMETER is returned. + + If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND + is returned. + + @param[in] This The PPI instance pointer. + @param[in,out] Port On input, a pointer to the port number on the ATA controller. + On output, a pointer to the next port number on the ATA + controller. An input value of 0xFFFF retrieves the first + port number on the ATA controller. + + @retval EFI_SUCCESS The next port number on the ATA controller was + returned in Port. + @retval EFI_NOT_FOUND There are no more ports on this ATA controller. + @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned + on a previous call to GetNextPort(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT)( + IN EDKII_PEI_ATA_PASS_THRU_PPI *This, + IN OUT UINT16 *Port + ); + +/** + Used to retrieve the list of legal port multiplier port numbers for ATA devices + on a port of an ATA controller. These can either be the list of port multiplier + ports where ATA devices are actually present on port or the list of legal port + multiplier ports on that port. Regardless, the caller of this function must probe + the port number and port multiplier port number returned to see if an ATA device + is actually present. + + The GetNextDevice() function retrieves the port multiplier port number of an ATA + device present on a port of an ATA controller. + + If PortMultiplierPort points to a port multiplier port number value that was + returned on a previous call to GetNextDevice(), then the port multiplier port + number of the next ATA device on the port of the ATA controller is returned in + PortMultiplierPort, and EFI_SUCCESS is returned. + + If PortMultiplierPort points to 0xFFFF, then the port multiplier port number + of the first ATA device on port of the ATA controller is returned in PortMultiplierPort + and EFI_SUCCESS is returned. + + If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort + was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER + is returned. + + If PortMultiplierPort is the port multiplier port number of the last ATA device + on the port of the ATA controller, then EFI_NOT_FOUND is returned. + + @param[in] This The PPI instance pointer. + @param[in] Port The port number present on the ATA controller. + @param[in,out] PortMultiplierPort On input, a pointer to the port multiplier + port number of an ATA device present on the + ATA controller. If on input a PortMultiplierPort + of 0xFFFF is specified, then the port multiplier + port number of the first ATA device is returned. + On output, a pointer to the port multiplier port + number of the next ATA device present on an ATA + controller. + + @retval EFI_SUCCESS The port multiplier port number of the next ATA + device on the port of the ATA controller was + returned in PortMultiplierPort. + @retval EFI_NOT_FOUND There are no more ATA devices on this port of + the ATA controller. + @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort + was not returned on a previous call to GetNextDevice(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE)( + IN EDKII_PEI_ATA_PASS_THRU_PPI *This, + IN UINT16 Port, + IN OUT UINT16 *PortMultiplierPort + ); + +/** + Gets the device path information of the underlying ATA host controller. + + @param[in] This The PPI instance pointer. + @param[out] DevicePathLength The length of the device path in bytes specified + by DevicePath. + @param[out] DevicePath The device path of the underlying ATA host controller. + This field re-uses EFI Device Path Protocol as + defined by Section 10.2 EFI Device Path Protocol + of UEFI 2.7 Specification. + + @retval EFI_SUCCESS The device path of the ATA host controller has + been successfully returned. + @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL. + @retval EFI_OUT_OF_RESOURCES Not enough resource to return the device path. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH)( + IN EDKII_PEI_ATA_PASS_THRU_PPI *This, + OUT UINTN *DevicePathLength, + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ); + +// +// EDKII_PEI_ATA_PASS_THRU_PPI provides the services that are required to send +// ATA commands to an ATA device during PEI. +// +struct _EDKII_PEI_ATA_PASS_THRU_PPI { + UINT64 Revision; + EFI_ATA_PASS_THRU_MODE *Mode; + EDKII_PEI_ATA_PASS_THRU_PASSTHRU PassThru; + EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT GetNextPort; + EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE GetNextDevice; + EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH GetDevicePath; +}; + +extern EFI_GUID gEdkiiPeiAtaPassThruPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/CapsuleOnDisk.h b/MdeModulePkg/Include/Ppi/CapsuleOnDisk.h index 8a7f4874f4..c56592c896 100644 --- a/MdeModulePkg/Include/Ppi/CapsuleOnDisk.h +++ b/MdeModulePkg/Include/Ppi/CapsuleOnDisk.h @@ -1,55 +1,55 @@ -/** @file
- This file declares Capsule On Disk PPI. This PPI is used to find and load the
- capsule on files that are relocated into a temp file under rootdir.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PEI_CAPSULE_ON_DISK_PPI_H__
-#define __PEI_CAPSULE_ON_DISK_PPI_H__
-
-#define EDKII_PEI_CAPSULE_ON_DISK_PPI_GUID \
- { \
- 0x71a9ea61, 0x5a35, 0x4a5d, {0xac, 0xef, 0x9c, 0xf8, 0x6d, 0x6d, 0x67, 0xe0 } \
- }
-
-typedef struct _EDKII_PEI_CAPSULE_ON_DISK_PPI EDKII_PEI_CAPSULE_ON_DISK_PPI;
-
-/**
- Loads a DXE capsule from some media into memory and updates the HOB table
- with the DXE firmware volume information.
-
- @param PeiServices General-purpose services that are available to every PEIM.
- @param This Indicates the EFI_PEI_RECOVERY_MODULE_PPI instance.
-
- @retval EFI_SUCCESS The capsule was loaded correctly.
- @retval EFI_DEVICE_ERROR A device error occurred.
- @retval EFI_NOT_FOUND A recovery DXE capsule cannot be found.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_LOAD_CAPSULE_ON_DISK)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN EDKII_PEI_CAPSULE_ON_DISK_PPI *This
- );
-
-///
-/// Finds and loads the recovery files.
-///
-struct _EDKII_PEI_CAPSULE_ON_DISK_PPI {
- EDKII_PEI_LOAD_CAPSULE_ON_DISK LoadCapsuleOnDisk; ///< Loads a DXE binary capsule into memory.
-};
-
-extern EFI_GUID gEdkiiPeiCapsuleOnDiskPpiGuid;
-
-#define EDKII_PEI_BOOT_IN_CAPSULE_ON_DISK_MODE_PPI \
- { \
- 0xb08a11e4, 0xe2b7, 0x4b75, { 0xb5, 0x15, 0xaf, 0x61, 0x6, 0x68, 0xbf, 0xd1 } \
- }
-
-extern EFI_GUID gEdkiiPeiBootInCapsuleOnDiskModePpiGuid;
-
-#endif
+/** @file + This file declares Capsule On Disk PPI. This PPI is used to find and load the + capsule on files that are relocated into a temp file under rootdir. + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PEI_CAPSULE_ON_DISK_PPI_H__ +#define __PEI_CAPSULE_ON_DISK_PPI_H__ + +#define EDKII_PEI_CAPSULE_ON_DISK_PPI_GUID \ + { \ + 0x71a9ea61, 0x5a35, 0x4a5d, {0xac, 0xef, 0x9c, 0xf8, 0x6d, 0x6d, 0x67, 0xe0 } \ + } + +typedef struct _EDKII_PEI_CAPSULE_ON_DISK_PPI EDKII_PEI_CAPSULE_ON_DISK_PPI; + +/** + Loads a DXE capsule from some media into memory and updates the HOB table + with the DXE firmware volume information. + + @param PeiServices General-purpose services that are available to every PEIM. + @param This Indicates the EFI_PEI_RECOVERY_MODULE_PPI instance. + + @retval EFI_SUCCESS The capsule was loaded correctly. + @retval EFI_DEVICE_ERROR A device error occurred. + @retval EFI_NOT_FOUND A recovery DXE capsule cannot be found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_LOAD_CAPSULE_ON_DISK)( + IN EFI_PEI_SERVICES **PeiServices, + IN EDKII_PEI_CAPSULE_ON_DISK_PPI *This + ); + +/// +/// Finds and loads the recovery files. +/// +struct _EDKII_PEI_CAPSULE_ON_DISK_PPI { + EDKII_PEI_LOAD_CAPSULE_ON_DISK LoadCapsuleOnDisk; ///< Loads a DXE binary capsule into memory. +}; + +extern EFI_GUID gEdkiiPeiCapsuleOnDiskPpiGuid; + +#define EDKII_PEI_BOOT_IN_CAPSULE_ON_DISK_MODE_PPI \ + { \ + 0xb08a11e4, 0xe2b7, 0x4b75, { 0xb5, 0x15, 0xaf, 0x61, 0x6, 0x68, 0xbf, 0xd1 } \ + } + +extern EFI_GUID gEdkiiPeiBootInCapsuleOnDiskModePpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/Debug.h b/MdeModulePkg/Include/Ppi/Debug.h index f1332ccaa6..61334dd424 100644 --- a/MdeModulePkg/Include/Ppi/Debug.h +++ b/MdeModulePkg/Include/Ppi/Debug.h @@ -1,74 +1,74 @@ -/** @file
- Define the EDKII_DEBUG_PPI that PEIMs can use to dump info to debug port.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EDKII_DEBUG_PPI_H__
-#define __EDKII_DEBUG_PPI_H__
-
-#include <Pi/PiPeiCis.h>
-
-//
-// Global ID for the EDKII_DEBUG_PPI
-//
-#define EDKII_DEBUG_PPI_GUID \
- { \
- 0x999e699c, 0xb013, 0x475e, {0xb1, 0x7b, 0xf3, 0xa8, 0xae, 0x5c, 0x48, 0x75} \
- }
-
-///
-/// Forward declaration for the PEI_DEBUG_LIB_DEBUG_PPI EDKII_DEBUG_PPI
-///
-typedef struct _EDKII_DEBUG_PPI EDKII_DEBUG_PPI;
-
-/**
- Print a debug message to debug output device if the specified error level
- is enabled.
-
- @param[in] ErrorLevel The error level of the debug message.
- @param[in] Format Format string for the debug message to print.
- @param[in] Marker BASE_LIST marker for the variable argument list.
-
-**/
-typedef
-VOID
-(EFIAPI *EDKII_DEBUG_BPRINT)(
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN BASE_LIST Marker
- );
-
-/**
- Print an assert message containing a filename, line number, and description.
- This may be followed by a breakpoint or a dead loop.
-
- @param[in] FileName The pointer to the name of the source file that
- generated the assert condition.
- @param[in] LineNumber The line number in the source file that generated
- the assert condition
- @param[in] Description The pointer to the description of the assert condition.
-
-**/
-typedef
-VOID
-(EFIAPI *EDKII_DEBUG_ASSERT)(
- IN CONST CHAR8 *FileName,
- IN UINTN LineNumber,
- IN CONST CHAR8 *Description
- );
-
-///
-/// This PPI contains a set of services to print message to debug output device
-///
-struct _EDKII_DEBUG_PPI {
- EDKII_DEBUG_BPRINT DebugBPrint;
- EDKII_DEBUG_ASSERT DebugAssert;
-};
-
-extern EFI_GUID gEdkiiDebugPpiGuid;
-
-#endif
+/** @file + Define the EDKII_DEBUG_PPI that PEIMs can use to dump info to debug port. + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EDKII_DEBUG_PPI_H__ +#define __EDKII_DEBUG_PPI_H__ + +#include <Pi/PiPeiCis.h> + +// +// Global ID for the EDKII_DEBUG_PPI +// +#define EDKII_DEBUG_PPI_GUID \ + { \ + 0x999e699c, 0xb013, 0x475e, {0xb1, 0x7b, 0xf3, 0xa8, 0xae, 0x5c, 0x48, 0x75} \ + } + +/// +/// Forward declaration for the PEI_DEBUG_LIB_DEBUG_PPI EDKII_DEBUG_PPI +/// +typedef struct _EDKII_DEBUG_PPI EDKII_DEBUG_PPI; + +/** + Print a debug message to debug output device if the specified error level + is enabled. + + @param[in] ErrorLevel The error level of the debug message. + @param[in] Format Format string for the debug message to print. + @param[in] Marker BASE_LIST marker for the variable argument list. + +**/ +typedef +VOID +(EFIAPI *EDKII_DEBUG_BPRINT)( + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + IN BASE_LIST Marker + ); + +/** + Print an assert message containing a filename, line number, and description. + This may be followed by a breakpoint or a dead loop. + + @param[in] FileName The pointer to the name of the source file that + generated the assert condition. + @param[in] LineNumber The line number in the source file that generated + the assert condition + @param[in] Description The pointer to the description of the assert condition. + +**/ +typedef +VOID +(EFIAPI *EDKII_DEBUG_ASSERT)( + IN CONST CHAR8 *FileName, + IN UINTN LineNumber, + IN CONST CHAR8 *Description + ); + +/// +/// This PPI contains a set of services to print message to debug output device +/// +struct _EDKII_DEBUG_PPI { + EDKII_DEBUG_BPRINT DebugBPrint; + EDKII_DEBUG_ASSERT DebugAssert; +}; + +extern EFI_GUID gEdkiiDebugPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h b/MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h index a2756cb0ab..ad6f3b218c 100644 --- a/MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h +++ b/MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h @@ -1,61 +1,61 @@ -/** @file
- Define PPI to shadow Firmware Volume from flash to Permanent Memory.
-
-Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef PEI_FIRMWARE_VOLUME_SHADOW_PPI_H_
-#define PEI_FIRMWARE_VOLUME_SHADOW_PPI_H_
-
-//
-// Firmware Volume Shadow PPI GUID value
-//
-#define EDKII_FIRMWARE_VOLUME_SHADOW_PPI_GUID \
- { \
- 0x7dfe756c, 0xed8d, 0x4d77, { 0x9e, 0xc4, 0x39, 0x9a, 0x8a, 0x81, 0x51, 0x16 } \
- }
-
-/**
- Copy FV to Destination. Length of copy is FV length from FV Header.
-
- @param[in] FirmwareVolumeBase Base address of FV to shadow. Length of FV
- is in FV Header.
- @param[in] Destination Pointer to the Buffer in system memory to
- shadow FV.
- @param[in] DestinationLength Size of Destination buffer in bytes.
-
- @retval EFI_SUCCESS Shadow complete
- @retval EFI_INVALID_PARAMETER Destination is NULL
- @retval EFI_INVALID_PARAMETER DestinationLength = 0.
- @retval EFI_INVALID_PARAMETER FV does not have valid FV Header.
- @retval EFI_INVALID_PARAMETER FV overlaps Destination.
- @retval EFI_INVALID_PARAMETER Destination + DestinationLength rolls over 4GB
- for 32-bit or 64-bit rollover.
- @retval EFI_BUFFER_TOO_SMALL DestinationLength less than FV length from FV
- Header.
- @retval EFI_UNSUPPORTED FirmwareVolumeBase to FVBase + FVLength does
- not support shadow. Caller should fallback to
- CopyMem().
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_FIRMWARE_VOLUME_SHADOW)(
- IN EFI_PHYSICAL_ADDRESS FirmwareVolumeBase,
- IN VOID *Destination,
- IN UINTN DestinationLength
- );
-
-///
-/// This PPI provides a service to shadow a FV from one location to another
-///
-typedef struct {
- EDKII_PEI_FIRMWARE_VOLUME_SHADOW FirmwareVolumeShadow;
-} EDKII_PEI_FIRMWARE_VOLUME_SHADOW_PPI;
-
-extern EFI_GUID gEdkiiPeiFirmwareVolumeShadowPpiGuid;
-
-#endif
+/** @file + Define PPI to shadow Firmware Volume from flash to Permanent Memory. + +Copyright (c) 2023, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PEI_FIRMWARE_VOLUME_SHADOW_PPI_H_ +#define PEI_FIRMWARE_VOLUME_SHADOW_PPI_H_ + +// +// Firmware Volume Shadow PPI GUID value +// +#define EDKII_FIRMWARE_VOLUME_SHADOW_PPI_GUID \ + { \ + 0x7dfe756c, 0xed8d, 0x4d77, { 0x9e, 0xc4, 0x39, 0x9a, 0x8a, 0x81, 0x51, 0x16 } \ + } + +/** + Copy FV to Destination. Length of copy is FV length from FV Header. + + @param[in] FirmwareVolumeBase Base address of FV to shadow. Length of FV + is in FV Header. + @param[in] Destination Pointer to the Buffer in system memory to + shadow FV. + @param[in] DestinationLength Size of Destination buffer in bytes. + + @retval EFI_SUCCESS Shadow complete + @retval EFI_INVALID_PARAMETER Destination is NULL + @retval EFI_INVALID_PARAMETER DestinationLength = 0. + @retval EFI_INVALID_PARAMETER FV does not have valid FV Header. + @retval EFI_INVALID_PARAMETER FV overlaps Destination. + @retval EFI_INVALID_PARAMETER Destination + DestinationLength rolls over 4GB + for 32-bit or 64-bit rollover. + @retval EFI_BUFFER_TOO_SMALL DestinationLength less than FV length from FV + Header. + @retval EFI_UNSUPPORTED FirmwareVolumeBase to FVBase + FVLength does + not support shadow. Caller should fallback to + CopyMem(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_FIRMWARE_VOLUME_SHADOW)( + IN EFI_PHYSICAL_ADDRESS FirmwareVolumeBase, + IN VOID *Destination, + IN UINTN DestinationLength + ); + +/// +/// This PPI provides a service to shadow a FV from one location to another +/// +typedef struct { + EDKII_PEI_FIRMWARE_VOLUME_SHADOW FirmwareVolumeShadow; +} EDKII_PEI_FIRMWARE_VOLUME_SHADOW_PPI; + +extern EFI_GUID gEdkiiPeiFirmwareVolumeShadowPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/IoMmu.h b/MdeModulePkg/Include/Ppi/IoMmu.h index 8439bb071b..6eb1081b70 100644 --- a/MdeModulePkg/Include/Ppi/IoMmu.h +++ b/MdeModulePkg/Include/Ppi/IoMmu.h @@ -1,200 +1,200 @@ -/** @file
- PEI IOMMU PPI.
-
-Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PEI_IOMMU_H__
-#define __PEI_IOMMU_H__
-
-//
-// for EFI_ALLOCATE_TYPE
-//
-#include <Uefi.h>
-
-//
-// Include protocol for common definition
-// EDKII_IOMMU_ACCESS_xxx
-// EDKII_IOMMU_OPERATION
-//
-#include <Protocol/IoMmu.h>
-
-//
-// IOMMU Ppi GUID value
-//
-#define EDKII_IOMMU_PPI_GUID \
- { \
- 0x70b0af26, 0xf847, 0x4bb6, { 0xaa, 0xb9, 0xcd, 0xe8, 0x4f, 0xc6, 0x14, 0x31 } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EDKII_IOMMU_PPI EDKII_IOMMU_PPI;
-
-//
-// Revision The revision to which the IOMMU interface adheres.
-// All future revisions must be backwards compatible.
-// If a future version is not back wards compatible it is not the same GUID.
-//
-#define EDKII_IOMMU_PPI_REVISION 0x00010000
-
-/**
- Set IOMMU attribute for a system memory.
-
- If the IOMMU PPI exists, the system memory cannot be used
- for DMA by default.
-
- When a device requests a DMA access for a system memory,
- the device driver need use SetAttribute() to update the IOMMU
- attribute to request DMA access (read and/or write).
-
- @param[in] This The PPI instance pointer.
- @param[in] Mapping The mapping value returned from Map().
- @param[in] IoMmuAccess The IOMMU access.
-
- @retval EFI_SUCCESS The IoMmuAccess is set for the memory range specified by DeviceAddress and Length.
- @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map().
- @retval EFI_INVALID_PARAMETER IoMmuAccess specified an illegal combination of access.
- @retval EFI_UNSUPPORTED The bit mask of IoMmuAccess is not supported by the IOMMU.
- @retval EFI_UNSUPPORTED The IOMMU does not support the memory range specified by Mapping.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources available to modify the IOMMU access.
- @retval EFI_DEVICE_ERROR The IOMMU device reported an error while attempting the operation.
- @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are
- not available to be allocated yet.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_IOMMU_SET_ATTRIBUTE)(
- IN EDKII_IOMMU_PPI *This,
- IN VOID *Mapping,
- IN UINT64 IoMmuAccess
- );
-
-/**
- Provides the controller-specific addresses required to access system memory from a
- DMA bus master.
-
- @param This The PPI instance pointer.
- @param Operation Indicates if the bus master is going to read or write to system memory.
- @param HostAddress The system memory address to map to the PCI controller.
- @param NumberOfBytes On input the number of bytes to map. On output the number of bytes
- that were mapped.
- @param DeviceAddress The resulting map address for the bus master PCI controller to use to
- access the hosts HostAddress.
- @param Mapping A resulting value to pass to Unmap().
-
- @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
- @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
- @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are
- not available to be allocated yet.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_IOMMU_MAP)(
- IN EDKII_IOMMU_PPI *This,
- IN EDKII_IOMMU_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- );
-
-/**
- Completes the Map() operation and releases any corresponding resources.
-
- @param This The PPI instance pointer.
- @param Mapping The mapping value returned from Map().
-
- @retval EFI_SUCCESS The range was unmapped.
- @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map().
- @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
- @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are
- not available to be allocated yet.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_IOMMU_UNMAP)(
- IN EDKII_IOMMU_PPI *This,
- IN VOID *Mapping
- );
-
-/**
- Allocates pages that are suitable for an OperationBusMasterCommonBuffer or
- OperationBusMasterCommonBuffer64 mapping.
-
- @param This The PPI instance pointer.
- @param MemoryType The type of memory to allocate, EfiBootServicesData or
- EfiRuntimeServicesData.
- @param Pages The number of pages to allocate.
- @param HostAddress A pointer to store the base system memory address of the
- allocated range.
- @param Attributes The requested bit mask of attributes for the allocated range.
-
- @retval EFI_SUCCESS The requested memory pages were allocated.
- @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
- MEMORY_WRITE_COMBINE, MEMORY_CACHED and DUAL_ADDRESS_CYCLE.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
- @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are
- not available to be allocated yet.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_IOMMU_ALLOCATE_BUFFER)(
- IN EDKII_IOMMU_PPI *This,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- IN OUT VOID **HostAddress,
- IN UINT64 Attributes
- );
-
-/**
- Frees memory that was allocated with AllocateBuffer().
-
- @param This The PPI instance pointer.
- @param Pages The number of pages to free.
- @param HostAddress The base system memory address of the allocated range.
-
- @retval EFI_SUCCESS The requested memory pages were freed.
- @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
- was not allocated with AllocateBuffer().
- @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are
- not available to be allocated yet.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_IOMMU_FREE_BUFFER)(
- IN EDKII_IOMMU_PPI *This,
- IN UINTN Pages,
- IN VOID *HostAddress
- );
-
-///
-/// IOMMU PPI structure.
-///
-struct _EDKII_IOMMU_PPI {
- UINT64 Revision;
- EDKII_PEI_IOMMU_SET_ATTRIBUTE SetAttribute;
- EDKII_PEI_IOMMU_MAP Map;
- EDKII_PEI_IOMMU_UNMAP Unmap;
- EDKII_PEI_IOMMU_ALLOCATE_BUFFER AllocateBuffer;
- EDKII_PEI_IOMMU_FREE_BUFFER FreeBuffer;
-};
-
-///
-/// IOMMU PPI GUID variable.
-///
-extern EFI_GUID gEdkiiIoMmuPpiGuid;
-
-#endif
+/** @file + PEI IOMMU PPI. + +Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PEI_IOMMU_H__ +#define __PEI_IOMMU_H__ + +// +// for EFI_ALLOCATE_TYPE +// +#include <Uefi.h> + +// +// Include protocol for common definition +// EDKII_IOMMU_ACCESS_xxx +// EDKII_IOMMU_OPERATION +// +#include <Protocol/IoMmu.h> + +// +// IOMMU Ppi GUID value +// +#define EDKII_IOMMU_PPI_GUID \ + { \ + 0x70b0af26, 0xf847, 0x4bb6, { 0xaa, 0xb9, 0xcd, 0xe8, 0x4f, 0xc6, 0x14, 0x31 } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EDKII_IOMMU_PPI EDKII_IOMMU_PPI; + +// +// Revision The revision to which the IOMMU interface adheres. +// All future revisions must be backwards compatible. +// If a future version is not back wards compatible it is not the same GUID. +// +#define EDKII_IOMMU_PPI_REVISION 0x00010000 + +/** + Set IOMMU attribute for a system memory. + + If the IOMMU PPI exists, the system memory cannot be used + for DMA by default. + + When a device requests a DMA access for a system memory, + the device driver need use SetAttribute() to update the IOMMU + attribute to request DMA access (read and/or write). + + @param[in] This The PPI instance pointer. + @param[in] Mapping The mapping value returned from Map(). + @param[in] IoMmuAccess The IOMMU access. + + @retval EFI_SUCCESS The IoMmuAccess is set for the memory range specified by DeviceAddress and Length. + @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map(). + @retval EFI_INVALID_PARAMETER IoMmuAccess specified an illegal combination of access. + @retval EFI_UNSUPPORTED The bit mask of IoMmuAccess is not supported by the IOMMU. + @retval EFI_UNSUPPORTED The IOMMU does not support the memory range specified by Mapping. + @retval EFI_OUT_OF_RESOURCES There are not enough resources available to modify the IOMMU access. + @retval EFI_DEVICE_ERROR The IOMMU device reported an error while attempting the operation. + @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are + not available to be allocated yet. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_IOMMU_SET_ATTRIBUTE)( + IN EDKII_IOMMU_PPI *This, + IN VOID *Mapping, + IN UINT64 IoMmuAccess + ); + +/** + Provides the controller-specific addresses required to access system memory from a + DMA bus master. + + @param This The PPI instance pointer. + @param Operation Indicates if the bus master is going to read or write to system memory. + @param HostAddress The system memory address to map to the PCI controller. + @param NumberOfBytes On input the number of bytes to map. On output the number of bytes + that were mapped. + @param DeviceAddress The resulting map address for the bus master PCI controller to use to + access the hosts HostAddress. + @param Mapping A resulting value to pass to Unmap(). + + @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_DEVICE_ERROR The system hardware could not map the requested address. + @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are + not available to be allocated yet. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_IOMMU_MAP)( + IN EDKII_IOMMU_PPI *This, + IN EDKII_IOMMU_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); + +/** + Completes the Map() operation and releases any corresponding resources. + + @param This The PPI instance pointer. + @param Mapping The mapping value returned from Map(). + + @retval EFI_SUCCESS The range was unmapped. + @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map(). + @retval EFI_DEVICE_ERROR The data was not committed to the target system memory. + @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are + not available to be allocated yet. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_IOMMU_UNMAP)( + IN EDKII_IOMMU_PPI *This, + IN VOID *Mapping + ); + +/** + Allocates pages that are suitable for an OperationBusMasterCommonBuffer or + OperationBusMasterCommonBuffer64 mapping. + + @param This The PPI instance pointer. + @param MemoryType The type of memory to allocate, EfiBootServicesData or + EfiRuntimeServicesData. + @param Pages The number of pages to allocate. + @param HostAddress A pointer to store the base system memory address of the + allocated range. + @param Attributes The requested bit mask of attributes for the allocated range. + + @retval EFI_SUCCESS The requested memory pages were allocated. + @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are + MEMORY_WRITE_COMBINE, MEMORY_CACHED and DUAL_ADDRESS_CYCLE. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. + @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are + not available to be allocated yet. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_IOMMU_ALLOCATE_BUFFER)( + IN EDKII_IOMMU_PPI *This, + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages, + IN OUT VOID **HostAddress, + IN UINT64 Attributes + ); + +/** + Frees memory that was allocated with AllocateBuffer(). + + @param This The PPI instance pointer. + @param Pages The number of pages to free. + @param HostAddress The base system memory address of the allocated range. + + @retval EFI_SUCCESS The requested memory pages were freed. + @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages + was not allocated with AllocateBuffer(). + @retval EFI_NOT_AVAILABLE_YET DMA protection has been enabled, but DMA buffer are + not available to be allocated yet. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_IOMMU_FREE_BUFFER)( + IN EDKII_IOMMU_PPI *This, + IN UINTN Pages, + IN VOID *HostAddress + ); + +/// +/// IOMMU PPI structure. +/// +struct _EDKII_IOMMU_PPI { + UINT64 Revision; + EDKII_PEI_IOMMU_SET_ATTRIBUTE SetAttribute; + EDKII_PEI_IOMMU_MAP Map; + EDKII_PEI_IOMMU_UNMAP Unmap; + EDKII_PEI_IOMMU_ALLOCATE_BUFFER AllocateBuffer; + EDKII_PEI_IOMMU_FREE_BUFFER FreeBuffer; +}; + +/// +/// IOMMU PPI GUID variable. +/// +extern EFI_GUID gEdkiiIoMmuPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/IpmiPpi.h b/MdeModulePkg/Include/Ppi/IpmiPpi.h index e88b4adfb8..4cf56f92a1 100644 --- a/MdeModulePkg/Include/Ppi/IpmiPpi.h +++ b/MdeModulePkg/Include/Ppi/IpmiPpi.h @@ -1,59 +1,59 @@ -/** @file
- Ppi for Ipmi of SMS.
-
- Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _IPMI_PPI_H_
-#define _IPMI_PPI_H_
-
-typedef struct _PEI_IPMI_PPI PEI_IPMI_PPI;
-
-#define PEI_IPMI_PPI_GUID \
- { \
- 0xa9731431, 0xd968, 0x4277, 0xb7, 0x52, 0xa3, 0xa9, 0xa6, 0xae, 0x18, 0x98 \
- }
-
-/**
- This service enables submitting commands via Ipmi.
-
- @param[in] This This point for PEI_IPMI_PPI structure.
- @param[in] NetFunction Net function of the command.
- @param[in] Command IPMI Command.
- @param[in] RequestData Command Request Data.
- @param[in] RequestDataSize Size of Command Request Data.
- @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
- @param[in, out] ResponseDataSize Size of Command Response Data.
-
- @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
- @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
- @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
- @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
- @retval EFI_TIMEOUT The command time out.
- @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
- @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_IPMI_SUBMIT_COMMAND)(
- IN PEI_IPMI_PPI *This,
- IN UINT8 NetFunction,
- IN UINT8 Command,
- IN UINT8 *RequestData,
- IN UINT32 RequestDataSize,
- OUT UINT8 *ResponseData,
- IN OUT UINT32 *ResponseDataSize
- );
-
-//
-// IPMI PPI
-//
-struct _PEI_IPMI_PPI {
- PEI_IPMI_SUBMIT_COMMAND IpmiSubmitCommand;
-};
-
-extern EFI_GUID gPeiIpmiPpiGuid;
-
-#endif
+/** @file + Ppi for Ipmi of SMS. + + Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _IPMI_PPI_H_ +#define _IPMI_PPI_H_ + +typedef struct _PEI_IPMI_PPI PEI_IPMI_PPI; + +#define PEI_IPMI_PPI_GUID \ + { \ + 0xa9731431, 0xd968, 0x4277, 0xb7, 0x52, 0xa3, 0xa9, 0xa6, 0xae, 0x18, 0x98 \ + } + +/** + This service enables submitting commands via Ipmi. + + @param[in] This This point for PEI_IPMI_PPI structure. + @param[in] NetFunction Net function of the command. + @param[in] Command IPMI Command. + @param[in] RequestData Command Request Data. + @param[in] RequestDataSize Size of Command Request Data. + @param[out] ResponseData Command Response Data. The completion code is the first byte of response data. + @param[in, out] ResponseDataSize Size of Command Response Data. + + @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received. + @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device. + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access. + @retval EFI_DEVICE_ERROR Ipmi Device hardware error. + @retval EFI_TIMEOUT The command time out. + @retval EFI_UNSUPPORTED The command was not successfully sent to the device. + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error. +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_IPMI_SUBMIT_COMMAND)( + IN PEI_IPMI_PPI *This, + IN UINT8 NetFunction, + IN UINT8 Command, + IN UINT8 *RequestData, + IN UINT32 RequestDataSize, + OUT UINT8 *ResponseData, + IN OUT UINT32 *ResponseDataSize + ); + +// +// IPMI PPI +// +struct _PEI_IPMI_PPI { + PEI_IPMI_SUBMIT_COMMAND IpmiSubmitCommand; +}; + +extern EFI_GUID gPeiIpmiPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/MemoryAttribute.h b/MdeModulePkg/Include/Ppi/MemoryAttribute.h index 83bcc33a76..6d1d61b4d5 100644 --- a/MdeModulePkg/Include/Ppi/MemoryAttribute.h +++ b/MdeModulePkg/Include/Ppi/MemoryAttribute.h @@ -1,83 +1,83 @@ -/** @file
-
-Copyright (c) 2023, Google LLC. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef EDKII_MEMORY_ATTRIBUTE_PPI_H_
-#define EDKII_MEMORY_ATTRIBUTE_PPI_H_
-
-#include <Uefi/UefiSpec.h>
-
-///
-/// Global ID for the EDKII_MEMORY_ATTRIBUTE_PPI.
-///
-#define EDKII_MEMORY_ATTRIBUTE_PPI_GUID \
- { \
- 0x1be840de, 0x2d92, 0x41ec, { 0xb6, 0xd3, 0x19, 0x64, 0x13, 0x50, 0x51, 0xfb } \
- }
-
-///
-/// Forward declaration for the EDKII_MEMORY_ATTRIBUTE_PPI.
-///
-typedef struct _EDKII_MEMORY_ATTRIBUTE_PPI EDKII_MEMORY_ATTRIBUTE_PPI;
-
-/**
- Set the requested memory permission attributes on a region of memory.
-
- BaseAddress and Length must be aligned to EFI_PAGE_SIZE.
-
- Attributes must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and
- EFI_MEMORY_XP, and specifies the attributes that must be set for the
- region in question. Attributes that are omitted will be cleared from the
- region only if they are set in AttributeMask.
-
- AttributeMask must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and
- EFI_MEMORY_XP, and specifies the attributes that the call will operate on.
- AttributeMask must not be 0x0, and must contain at least the bits set in
- Attributes.
-
- @param[in] This The protocol instance pointer.
- @param[in] BaseAddress The physical address that is the start address
- of a memory region.
- @param[in] Length The size in bytes of the memory region.
- @param[in] Attributes Memory attributes to set or clear.
- @param[in] AttributeMask Mask of memory attributes to operate on.
-
- @retval EFI_SUCCESS The attributes were set for the memory region.
- @retval EFI_INVALID_PARAMETER Length is zero.
- AttributeMask is zero.
- AttributeMask lacks bits set in Attributes.
- BaseAddress or Length is not suitably aligned.
- @retval EFI_UNSUPPORTED The processor does not support one or more
- bytes of the memory resource range specified
- by BaseAddress and Length.
- The bit mask of attributes is not supported for
- the memory resource range specified by
- BaseAddress and Length.
- @retval EFI_OUT_OF_RESOURCES Requested attributes cannot be applied due to
- lack of system resources.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_MEMORY_ATTRIBUTE_SET_PERMISSIONS)(
- IN EDKII_MEMORY_ATTRIBUTE_PPI *This,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Attributes,
- IN UINT64 AttributeMask
- );
-
-///
-/// This PPI contains a set of services to manage memory permission attributes.
-///
-struct _EDKII_MEMORY_ATTRIBUTE_PPI {
- EDKII_MEMORY_ATTRIBUTE_SET_PERMISSIONS SetPermissions;
-};
-
-extern EFI_GUID gEdkiiMemoryAttributePpiGuid;
-
-#endif
+/** @file + +Copyright (c) 2023, Google LLC. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EDKII_MEMORY_ATTRIBUTE_PPI_H_ +#define EDKII_MEMORY_ATTRIBUTE_PPI_H_ + +#include <Uefi/UefiSpec.h> + +/// +/// Global ID for the EDKII_MEMORY_ATTRIBUTE_PPI. +/// +#define EDKII_MEMORY_ATTRIBUTE_PPI_GUID \ + { \ + 0x1be840de, 0x2d92, 0x41ec, { 0xb6, 0xd3, 0x19, 0x64, 0x13, 0x50, 0x51, 0xfb } \ + } + +/// +/// Forward declaration for the EDKII_MEMORY_ATTRIBUTE_PPI. +/// +typedef struct _EDKII_MEMORY_ATTRIBUTE_PPI EDKII_MEMORY_ATTRIBUTE_PPI; + +/** + Set the requested memory permission attributes on a region of memory. + + BaseAddress and Length must be aligned to EFI_PAGE_SIZE. + + Attributes must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and + EFI_MEMORY_XP, and specifies the attributes that must be set for the + region in question. Attributes that are omitted will be cleared from the + region only if they are set in AttributeMask. + + AttributeMask must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and + EFI_MEMORY_XP, and specifies the attributes that the call will operate on. + AttributeMask must not be 0x0, and must contain at least the bits set in + Attributes. + + @param[in] This The protocol instance pointer. + @param[in] BaseAddress The physical address that is the start address + of a memory region. + @param[in] Length The size in bytes of the memory region. + @param[in] Attributes Memory attributes to set or clear. + @param[in] AttributeMask Mask of memory attributes to operate on. + + @retval EFI_SUCCESS The attributes were set for the memory region. + @retval EFI_INVALID_PARAMETER Length is zero. + AttributeMask is zero. + AttributeMask lacks bits set in Attributes. + BaseAddress or Length is not suitably aligned. + @retval EFI_UNSUPPORTED The processor does not support one or more + bytes of the memory resource range specified + by BaseAddress and Length. + The bit mask of attributes is not supported for + the memory resource range specified by + BaseAddress and Length. + @retval EFI_OUT_OF_RESOURCES Requested attributes cannot be applied due to + lack of system resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_MEMORY_ATTRIBUTE_SET_PERMISSIONS)( + IN EDKII_MEMORY_ATTRIBUTE_PPI *This, + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT64 Attributes, + IN UINT64 AttributeMask + ); + +/// +/// This PPI contains a set of services to manage memory permission attributes. +/// +struct _EDKII_MEMORY_ATTRIBUTE_PPI { + EDKII_MEMORY_ATTRIBUTE_SET_PERMISSIONS SetPermissions; +}; + +extern EFI_GUID gEdkiiMemoryAttributePpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/NvmExpressHostController.h b/MdeModulePkg/Include/Ppi/NvmExpressHostController.h index 6d98de6b18..0cb6a876d8 100644 --- a/MdeModulePkg/Include/Ppi/NvmExpressHostController.h +++ b/MdeModulePkg/Include/Ppi/NvmExpressHostController.h @@ -1,86 +1,86 @@ -/** @file
-
- Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI_H_
-#define _EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI_H_
-
-#include <Protocol/DevicePath.h>
-
-///
-/// Global ID for the EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI.
-///
-#define EDKII_NVME_EXPRESS_HOST_CONTROLLER_PPI_GUID \
- { \
- 0xcae3aa63, 0x676f, 0x4da3, { 0xbd, 0x50, 0x6c, 0xc5, 0xed, 0xde, 0x9a, 0xad } \
- }
-
-//
-// Forward declaration for the EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI.
-//
-typedef struct _EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI;
-
-/**
- Get the MMIO base address of NVM Express host controller.
-
- @param[in] This The PPI instance pointer.
- @param[in] ControllerId The ID of the NVM Express host controller.
- @param[out] MmioBar The MMIO base address of the controller.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
- @retval EFI_NOT_FOUND The specified NVM Express host controller not
- found.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_NVM_EXPRESS_HC_GET_MMIO_BAR)(
- IN EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI *This,
- IN UINT8 ControllerId,
- OUT UINTN *MmioBar
- );
-
-/**
- Get the device path of NVM Express host controller.
-
- @param[in] This The PPI instance pointer.
- @param[in] ControllerId The ID of the NVM Express host controller.
- @param[out] DevicePathLength The length of the device path in bytes specified
- by DevicePath.
- @param[out] DevicePath The device path of NVM Express host controller.
- This field re-uses EFI Device Path Protocol as
- defined by Section 10.2 EFI Device Path Protocol
- of UEFI 2.7 Specification.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
- @retval EFI_NOT_FOUND The specified NVM Express host controller not
- found.
- @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_NVM_EXPRESS_HC_GET_DEVICE_PATH)(
- IN EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI *This,
- IN UINT8 ControllerId,
- OUT UINTN *DevicePathLength,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- );
-
-//
-// This PPI contains a set of services to interact with the NVM Express host
-// controller.
-//
-struct _EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI {
- EDKII_NVM_EXPRESS_HC_GET_MMIO_BAR GetNvmeHcMmioBar;
- EDKII_NVM_EXPRESS_HC_GET_DEVICE_PATH GetNvmeHcDevicePath;
-};
-
-extern EFI_GUID gEdkiiPeiNvmExpressHostControllerPpiGuid;
-
-#endif
+/** @file + + Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI_H_ +#define _EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI_H_ + +#include <Protocol/DevicePath.h> + +/// +/// Global ID for the EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI. +/// +#define EDKII_NVME_EXPRESS_HOST_CONTROLLER_PPI_GUID \ + { \ + 0xcae3aa63, 0x676f, 0x4da3, { 0xbd, 0x50, 0x6c, 0xc5, 0xed, 0xde, 0x9a, 0xad } \ + } + +// +// Forward declaration for the EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI. +// +typedef struct _EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI; + +/** + Get the MMIO base address of NVM Express host controller. + + @param[in] This The PPI instance pointer. + @param[in] ControllerId The ID of the NVM Express host controller. + @param[out] MmioBar The MMIO base address of the controller. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + @retval EFI_NOT_FOUND The specified NVM Express host controller not + found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_NVM_EXPRESS_HC_GET_MMIO_BAR)( + IN EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI *This, + IN UINT8 ControllerId, + OUT UINTN *MmioBar + ); + +/** + Get the device path of NVM Express host controller. + + @param[in] This The PPI instance pointer. + @param[in] ControllerId The ID of the NVM Express host controller. + @param[out] DevicePathLength The length of the device path in bytes specified + by DevicePath. + @param[out] DevicePath The device path of NVM Express host controller. + This field re-uses EFI Device Path Protocol as + defined by Section 10.2 EFI Device Path Protocol + of UEFI 2.7 Specification. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + @retval EFI_NOT_FOUND The specified NVM Express host controller not + found. + @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_NVM_EXPRESS_HC_GET_DEVICE_PATH)( + IN EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI *This, + IN UINT8 ControllerId, + OUT UINTN *DevicePathLength, + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ); + +// +// This PPI contains a set of services to interact with the NVM Express host +// controller. +// +struct _EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI { + EDKII_NVM_EXPRESS_HC_GET_MMIO_BAR GetNvmeHcMmioBar; + EDKII_NVM_EXPRESS_HC_GET_DEVICE_PATH GetNvmeHcDevicePath; +}; + +extern EFI_GUID gEdkiiPeiNvmExpressHostControllerPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/NvmExpressPassThru.h b/MdeModulePkg/Include/Ppi/NvmExpressPassThru.h index c5ccf0e775..1aa1663cff 100644 --- a/MdeModulePkg/Include/Ppi/NvmExpressPassThru.h +++ b/MdeModulePkg/Include/Ppi/NvmExpressPassThru.h @@ -1,155 +1,155 @@ -/** @file
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EDKII_NVME_PASS_THRU_PPI_H_
-#define _EDKII_NVME_PASS_THRU_PPI_H_
-
-#include <Protocol/DevicePath.h>
-#include <Protocol/NvmExpressPassthru.h>
-
-///
-/// Global ID for the EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI.
-///
-#define EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI_GUID \
- { \
- 0x6af31b2c, 0x3be, 0x46c1, { 0xb1, 0x2d, 0xea, 0x4a, 0x36, 0xdf, 0xa7, 0x4c } \
- }
-
-//
-// Forward declaration for the EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI.
-//
-typedef struct _EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI;
-
-//
-// Revision The revision to which the Nvme Pass Thru PPI interface adheres.
-// All future revisions must be backwards compatible.
-// If a future version is not back wards compatible it is not the same GUID.
-//
-#define EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI_REVISION 0x00010000
-
-/**
- Gets the device path information of the underlying NVM Express host controller.
-
- @param[in] This The PPI instance pointer.
- @param[out] DevicePathLength The length of the device path in bytes specified
- by DevicePath.
- @param[out] DevicePath The device path of the underlying NVM Express
- host controller.
- This field re-uses EFI Device Path Protocol as
- defined by Section 10.2 EFI Device Path Protocol
- of UEFI 2.7 Specification.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.
- @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_NVME_PASS_THRU_GET_DEVICE_PATH)(
- IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This,
- OUT UINTN *DevicePathLength,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- );
-
-/**
- Used to retrieve the next namespace ID for this NVM Express controller.
-
- If on input the value pointed to by NamespaceId is 0xFFFFFFFF, then the first
- valid namespace ID defined on the NVM Express controller is returned in the
- location pointed to by NamespaceId and a status of EFI_SUCCESS is returned.
-
- If on input the value pointed to by NamespaceId is an invalid namespace ID
- other than 0xFFFFFFFF, then EFI_INVALID_PARAMETER is returned.
-
- If on input the value pointed to by NamespaceId is a valid namespace ID, then
- the next valid namespace ID on the NVM Express controller is returned in the
- location pointed to by NamespaceId, and EFI_SUCCESS is returned.
-
- If the value pointed to by NamespaceId is the namespace ID of the last
- namespace on the NVM Express controller, then EFI_NOT_FOUND is returned.
-
- @param[in] This The PPI instance pointer.
- @param[in,out] NamespaceId On input, a pointer to a legal NamespaceId
- for an NVM Express namespace present on the
- NVM Express controller. On output, a pointer
- to the next NamespaceId of an NVM Express
- namespace on an NVM Express controller. An
- input value of 0xFFFFFFFF retrieves the
- first NamespaceId for an NVM Express
- namespace present on an NVM Express
- controller.
-
- @retval EFI_SUCCESS The Namespace ID of the next Namespace was
- returned.
- @retval EFI_NOT_FOUND There are no more namespaces defined on this
- controller.
- @retval EFI_INVALID_PARAMETER NamespaceId is an invalid value other than
- 0xFFFFFFFF.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_NVME_PASS_THRU_GET_NEXT_NAMESPACE)(
- IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This,
- IN OUT UINT32 *NamespaceId
- );
-
-/**
- Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function only
- supports blocking execution of the command.
-
- @param[in] This The PPI instance pointer.
- @param[in] NamespaceId Is a 32 bit Namespace ID to which the Nvm Express command packet will
- be sent.
- A Value of 0 denotes the NVM Express controller, a Value of all 0FFh in
- the namespace ID specifies that the command packet should be sent to all
- valid namespaces.
- @param[in,out] Packet A pointer to the EDKII PEI NVM Express PassThru Command Packet to send
- to the NVMe namespace specified by NamespaceId.
-
- @retval EFI_SUCCESS The EDKII PEI NVM Express Command Packet was sent by the host.
- TransferLength bytes were transferred to, or from DataBuffer.
- @retval EFI_NOT_READY The EDKII PEI NVM Express Command Packet could not be sent because
- the controller is not ready. The caller may retry again later.
- @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the EDKII PEI NVM
- Express Command Packet.
- @retval EFI_INVALID_PARAMETER Namespace, or the contents of EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET
- are invalid.
- The EDKII PEI NVM Express Command Packet was not sent, so no
- additional status information is available.
- @retval EFI_UNSUPPORTED The command described by the EDKII PEI NVM Express Command Packet
- is not supported by the host adapter.
- The EDKII PEI NVM Express Command Packet was not sent, so no
- additional status information is available.
- @retval EFI_TIMEOUT A timeout occurred while waiting for the EDKII PEI NVM Express Command
- Packet to execute.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_NVME_PASS_THRU_PASSTHRU)(
- IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This,
- IN UINT32 NamespaceId,
- IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet
- );
-
-//
-// This PPI contains a set of services to send commands
-// to a mass storage device.
-//
-struct _EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI {
- UINT64 Revision;
- EFI_NVM_EXPRESS_PASS_THRU_MODE *Mode;
- EDKII_PEI_NVME_PASS_THRU_GET_DEVICE_PATH GetDevicePath;
- EDKII_PEI_NVME_PASS_THRU_GET_NEXT_NAMESPACE GetNextNameSpace;
- EDKII_PEI_NVME_PASS_THRU_PASSTHRU PassThru;
-};
-
-extern EFI_GUID gEdkiiPeiNvmExpressPassThruPpiGuid;
-
-#endif
+/** @file + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_NVME_PASS_THRU_PPI_H_ +#define _EDKII_NVME_PASS_THRU_PPI_H_ + +#include <Protocol/DevicePath.h> +#include <Protocol/NvmExpressPassthru.h> + +/// +/// Global ID for the EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI. +/// +#define EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI_GUID \ + { \ + 0x6af31b2c, 0x3be, 0x46c1, { 0xb1, 0x2d, 0xea, 0x4a, 0x36, 0xdf, 0xa7, 0x4c } \ + } + +// +// Forward declaration for the EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI. +// +typedef struct _EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI; + +// +// Revision The revision to which the Nvme Pass Thru PPI interface adheres. +// All future revisions must be backwards compatible. +// If a future version is not back wards compatible it is not the same GUID. +// +#define EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI_REVISION 0x00010000 + +/** + Gets the device path information of the underlying NVM Express host controller. + + @param[in] This The PPI instance pointer. + @param[out] DevicePathLength The length of the device path in bytes specified + by DevicePath. + @param[out] DevicePath The device path of the underlying NVM Express + host controller. + This field re-uses EFI Device Path Protocol as + defined by Section 10.2 EFI Device Path Protocol + of UEFI 2.7 Specification. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL. + @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_NVME_PASS_THRU_GET_DEVICE_PATH)( + IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This, + OUT UINTN *DevicePathLength, + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ); + +/** + Used to retrieve the next namespace ID for this NVM Express controller. + + If on input the value pointed to by NamespaceId is 0xFFFFFFFF, then the first + valid namespace ID defined on the NVM Express controller is returned in the + location pointed to by NamespaceId and a status of EFI_SUCCESS is returned. + + If on input the value pointed to by NamespaceId is an invalid namespace ID + other than 0xFFFFFFFF, then EFI_INVALID_PARAMETER is returned. + + If on input the value pointed to by NamespaceId is a valid namespace ID, then + the next valid namespace ID on the NVM Express controller is returned in the + location pointed to by NamespaceId, and EFI_SUCCESS is returned. + + If the value pointed to by NamespaceId is the namespace ID of the last + namespace on the NVM Express controller, then EFI_NOT_FOUND is returned. + + @param[in] This The PPI instance pointer. + @param[in,out] NamespaceId On input, a pointer to a legal NamespaceId + for an NVM Express namespace present on the + NVM Express controller. On output, a pointer + to the next NamespaceId of an NVM Express + namespace on an NVM Express controller. An + input value of 0xFFFFFFFF retrieves the + first NamespaceId for an NVM Express + namespace present on an NVM Express + controller. + + @retval EFI_SUCCESS The Namespace ID of the next Namespace was + returned. + @retval EFI_NOT_FOUND There are no more namespaces defined on this + controller. + @retval EFI_INVALID_PARAMETER NamespaceId is an invalid value other than + 0xFFFFFFFF. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_NVME_PASS_THRU_GET_NEXT_NAMESPACE)( + IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This, + IN OUT UINT32 *NamespaceId + ); + +/** + Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function only + supports blocking execution of the command. + + @param[in] This The PPI instance pointer. + @param[in] NamespaceId Is a 32 bit Namespace ID to which the Nvm Express command packet will + be sent. + A Value of 0 denotes the NVM Express controller, a Value of all 0FFh in + the namespace ID specifies that the command packet should be sent to all + valid namespaces. + @param[in,out] Packet A pointer to the EDKII PEI NVM Express PassThru Command Packet to send + to the NVMe namespace specified by NamespaceId. + + @retval EFI_SUCCESS The EDKII PEI NVM Express Command Packet was sent by the host. + TransferLength bytes were transferred to, or from DataBuffer. + @retval EFI_NOT_READY The EDKII PEI NVM Express Command Packet could not be sent because + the controller is not ready. The caller may retry again later. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the EDKII PEI NVM + Express Command Packet. + @retval EFI_INVALID_PARAMETER Namespace, or the contents of EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET + are invalid. + The EDKII PEI NVM Express Command Packet was not sent, so no + additional status information is available. + @retval EFI_UNSUPPORTED The command described by the EDKII PEI NVM Express Command Packet + is not supported by the host adapter. + The EDKII PEI NVM Express Command Packet was not sent, so no + additional status information is available. + @retval EFI_TIMEOUT A timeout occurred while waiting for the EDKII PEI NVM Express Command + Packet to execute. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_NVME_PASS_THRU_PASSTHRU)( + IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This, + IN UINT32 NamespaceId, + IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet + ); + +// +// This PPI contains a set of services to send commands +// to a mass storage device. +// +struct _EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI { + UINT64 Revision; + EFI_NVM_EXPRESS_PASS_THRU_MODE *Mode; + EDKII_PEI_NVME_PASS_THRU_GET_DEVICE_PATH GetDevicePath; + EDKII_PEI_NVME_PASS_THRU_GET_NEXT_NAMESPACE GetNextNameSpace; + EDKII_PEI_NVME_PASS_THRU_PASSTHRU PassThru; +}; + +extern EFI_GUID gEdkiiPeiNvmExpressPassThruPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/PciDevice.h b/MdeModulePkg/Include/Ppi/PciDevice.h index 6750ae6ce3..7e57008c2e 100644 --- a/MdeModulePkg/Include/Ppi/PciDevice.h +++ b/MdeModulePkg/Include/Ppi/PciDevice.h @@ -1,32 +1,32 @@ -/** @file
-
- Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef EDKII_PCI_DEVICE_PPI_H_
-#define EDKII_PCI_DEVICE_PPI_H_
-
-#include <Protocol/PciIo.h>
-#include <Protocol/DevicePath.h>
-
-///
-/// Global ID for the EDKII_PCI_DEVICE_PPI_GUID.
-///
-#define EDKII_PCI_DEVICE_PPI_GUID \
- { \
- 0x1597ab4f, 0xd542, 0x4efe, { 0x9a, 0xf7, 0xb2, 0x44, 0xec, 0x54, 0x4c, 0x0b } \
- }
-
-///
-/// PCI Device PPI structure.
-///
-typedef struct {
- EFI_PCI_IO_PROTOCOL PciIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} EDKII_PCI_DEVICE_PPI;
-
-extern EFI_GUID gEdkiiPeiPciDevicePpiGuid;
-
-#endif // EDKII_PCI_DEVICE_PPI_H_
+/** @file + + Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EDKII_PCI_DEVICE_PPI_H_ +#define EDKII_PCI_DEVICE_PPI_H_ + +#include <Protocol/PciIo.h> +#include <Protocol/DevicePath.h> + +/// +/// Global ID for the EDKII_PCI_DEVICE_PPI_GUID. +/// +#define EDKII_PCI_DEVICE_PPI_GUID \ + { \ + 0x1597ab4f, 0xd542, 0x4efe, { 0x9a, 0xf7, 0xb2, 0x44, 0xec, 0x54, 0x4c, 0x0b } \ + } + +/// +/// PCI Device PPI structure. +/// +typedef struct { + EFI_PCI_IO_PROTOCOL PciIo; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; +} EDKII_PCI_DEVICE_PPI; + +extern EFI_GUID gEdkiiPeiPciDevicePpiGuid; + +#endif // EDKII_PCI_DEVICE_PPI_H_ diff --git a/MdeModulePkg/Include/Ppi/PlatformSpecificResetFilter.h b/MdeModulePkg/Include/Ppi/PlatformSpecificResetFilter.h index 823600f8b7..02761d9167 100644 --- a/MdeModulePkg/Include/Ppi/PlatformSpecificResetFilter.h +++ b/MdeModulePkg/Include/Ppi/PlatformSpecificResetFilter.h @@ -1,25 +1,25 @@ -/** @file
- This PPI provides services to register a platform specific reset filter
- for ResetSystem(). A reset filter evaluates the parameters passed to
- ResetSystem() and converts a ResetType of EfiResetPlatformSpecific to a
- non-platform specific reset type. The registered filters are processed before
- EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI handlers.
-
- Copyright (c) 2017 - 2018 Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PLATFORM_SPECIFIC_RESET_FILTER_PPI_H_
-#define _PLATFORM_SPECIFIC_RESET_FILTER_PPI_H_
-
-#include <Protocol/ResetNotification.h>
-
-#define EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI_GUID \
- { 0x8c9f4de3, 0x7b90, 0x47ef, { 0x93, 0x8, 0x28, 0x7c, 0xec, 0xd6, 0x6d, 0xe8 } }
-
-typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI;
-
-extern EFI_GUID gEdkiiPlatformSpecificResetFilterPpiGuid;
-
-#endif
+/** @file + This PPI provides services to register a platform specific reset filter + for ResetSystem(). A reset filter evaluates the parameters passed to + ResetSystem() and converts a ResetType of EfiResetPlatformSpecific to a + non-platform specific reset type. The registered filters are processed before + EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI handlers. + + Copyright (c) 2017 - 2018 Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLATFORM_SPECIFIC_RESET_FILTER_PPI_H_ +#define _PLATFORM_SPECIFIC_RESET_FILTER_PPI_H_ + +#include <Protocol/ResetNotification.h> + +#define EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI_GUID \ + { 0x8c9f4de3, 0x7b90, 0x47ef, { 0x93, 0x8, 0x28, 0x7c, 0xec, 0xd6, 0x6d, 0xe8 } } + +typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI; + +extern EFI_GUID gEdkiiPlatformSpecificResetFilterPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/PlatformSpecificResetHandler.h b/MdeModulePkg/Include/Ppi/PlatformSpecificResetHandler.h index 50c68deb14..29f889a8ba 100644 --- a/MdeModulePkg/Include/Ppi/PlatformSpecificResetHandler.h +++ b/MdeModulePkg/Include/Ppi/PlatformSpecificResetHandler.h @@ -1,23 +1,23 @@ -/** @file
- This PPI provides services to register a platform specific handler for
- ResetSystem(). The registered handlers are processed after
- EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI notifications.
-
- Copyright (c) 2017 - 2018 Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PLATFORM_SPECIFIC_RESET_HANDLER_PPI_H_
-#define _PLATFORM_SPECIFIC_RESET_HANDLER_PPI_H_
-
-#include <Protocol/ResetNotification.h>
-
-#define EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PPI_GUID \
- { 0x75cf14ae, 0x3441, 0x49dc, { 0xaa, 0x10, 0xbb, 0x35, 0xa7, 0xba, 0x8b, 0xab } }
-
-typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PPI;
-
-extern EFI_GUID gEdkiiPlatformSpecificResetHandlerPpiGuid;
-
-#endif
+/** @file + This PPI provides services to register a platform specific handler for + ResetSystem(). The registered handlers are processed after + EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI notifications. + + Copyright (c) 2017 - 2018 Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLATFORM_SPECIFIC_RESET_HANDLER_PPI_H_ +#define _PLATFORM_SPECIFIC_RESET_HANDLER_PPI_H_ + +#include <Protocol/ResetNotification.h> + +#define EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PPI_GUID \ + { 0x75cf14ae, 0x3441, 0x49dc, { 0xaa, 0x10, 0xbb, 0x35, 0xa7, 0xba, 0x8b, 0xab } } + +typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PPI; + +extern EFI_GUID gEdkiiPlatformSpecificResetHandlerPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/PlatformSpecificResetNotification.h b/MdeModulePkg/Include/Ppi/PlatformSpecificResetNotification.h index d671ee07f1..001f1231f4 100644 --- a/MdeModulePkg/Include/Ppi/PlatformSpecificResetNotification.h +++ b/MdeModulePkg/Include/Ppi/PlatformSpecificResetNotification.h @@ -1,26 +1,26 @@ -/** @file
- This PPI provides services to register a platform specific notification callback for
- ResetSystem(). The registered handlers are processed after
- EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI notifications and before
- EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PPI notifications.
-
- Copyright (c) 2017 - 2018 Intel Corporation. All rights reserved.<BR>
- Copyright (c) 2017 Microsoft Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI_H_
-#define _PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI_H_
-
-#include <Protocol/ResetNotification.h>
-
-#define EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI_GUID \
- { 0xe09f355d, 0xdae8, 0x4910, { 0xb1, 0x4a, 0x92, 0x78, 0x0f, 0xdc, 0xf7, 0xcb } }
-
-typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI;
-
-extern EFI_GUID gEdkiiPlatformSpecificResetNotificationPpiGuid;
-
-#endif
+/** @file + This PPI provides services to register a platform specific notification callback for + ResetSystem(). The registered handlers are processed after + EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI notifications and before + EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PPI notifications. + + Copyright (c) 2017 - 2018 Intel Corporation. All rights reserved.<BR> + Copyright (c) 2017 Microsoft Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI_H_ +#define _PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI_H_ + +#include <Protocol/ResetNotification.h> + +#define EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI_GUID \ + { 0xe09f355d, 0xdae8, 0x4910, { 0xb1, 0x4a, 0x92, 0x78, 0x0f, 0xdc, 0xf7, 0xcb } } + +typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PPI; + +extern EFI_GUID gEdkiiPlatformSpecificResetNotificationPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/PostBootScriptTable.h b/MdeModulePkg/Include/Ppi/PostBootScriptTable.h index 923eb49ad7..8b1e719f14 100644 --- a/MdeModulePkg/Include/Ppi/PostBootScriptTable.h +++ b/MdeModulePkg/Include/Ppi/PostBootScriptTable.h @@ -1,20 +1,20 @@ -/** @file
- POST BootScript Table PPI definition.
-
- This PPI is used to be notification after boot script table execution.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved. <BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PEI_POST_BOOT_SCRIPT_TABLE_H_
-#define _PEI_POST_BOOT_SCRIPT_TABLE_H_
-
-#define PEI_POST_BOOT_SCRIPT_TABLE_PPI_GUID \
- {0x88c9d306, 0x900, 0x4eb5, 0x82, 0x60, 0x3e, 0x2d, 0xbe, 0xda, 0x1f, 0x89};
-
-extern EFI_GUID gPeiPostScriptTablePpiGuid;
-
-#endif
+/** @file + POST BootScript Table PPI definition. + + This PPI is used to be notification after boot script table execution. + + Copyright (c) 2010, Intel Corporation. All rights reserved. <BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PEI_POST_BOOT_SCRIPT_TABLE_H_ +#define _PEI_POST_BOOT_SCRIPT_TABLE_H_ + +#define PEI_POST_BOOT_SCRIPT_TABLE_PPI_GUID \ + {0x88c9d306, 0x900, 0x4eb5, 0x82, 0x60, 0x3e, 0x2d, 0xbe, 0xda, 0x1f, 0x89}; + +extern EFI_GUID gPeiPostScriptTablePpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/SdMmcHostController.h b/MdeModulePkg/Include/Ppi/SdMmcHostController.h index 253953cc81..e849baa5e0 100644 --- a/MdeModulePkg/Include/Ppi/SdMmcHostController.h +++ b/MdeModulePkg/Include/Ppi/SdMmcHostController.h @@ -1,57 +1,57 @@ -/** @file
-
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EDKII_PEI_SD_MMC_HOST_CONTROLLER_PPI_H_
-#define _EDKII_PEI_SD_MMC_HOST_CONTROLLER_PPI_H_
-
-///
-/// Global ID for the EDKII_SD_MMC_HOST_CONTROLLER_PPI.
-///
-#define EDKII_SD_MMC_HOST_CONTROLLER_PPI_GUID \
- { \
- 0xb30dfeed, 0x947f, 0x4396, { 0xb1, 0x5a, 0xdf, 0xbd, 0xb9, 0x16, 0xdc, 0x24 } \
- }
-
-///
-/// Forward declaration for the SD_MMC_HOST_CONTROLLER_PPI.
-///
-typedef struct _EDKII_SD_MMC_HOST_CONTROLLER_PPI EDKII_SD_MMC_HOST_CONTROLLER_PPI;
-
-/**
- Get the MMIO base address of SD/MMC host controller.
-
- @param[in] This The protocol instance pointer.
- @param[in] ControllerId The ID of the SD/MMC host controller.
- @param[in,out] MmioBar The pointer to store the array of available
- SD/MMC host controller slot MMIO base addresses.
- The entry number of the array is specified by BarNum.
- @param[out] BarNum The pointer to store the supported bar number.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_SD_MMC_HC_GET_MMIO_BAR)(
- IN EDKII_SD_MMC_HOST_CONTROLLER_PPI *This,
- IN UINT8 ControllerId,
- IN OUT UINTN **MmioBar,
- OUT UINT8 *BarNum
- );
-
-///
-/// This PPI contains a set of services to interact with the SD_MMC host controller.
-///
-struct _EDKII_SD_MMC_HOST_CONTROLLER_PPI {
- EDKII_SD_MMC_HC_GET_MMIO_BAR GetSdMmcHcMmioBar;
-};
-
-extern EFI_GUID gEdkiiPeiSdMmcHostControllerPpiGuid;
-
-#endif
+/** @file + +Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_PEI_SD_MMC_HOST_CONTROLLER_PPI_H_ +#define _EDKII_PEI_SD_MMC_HOST_CONTROLLER_PPI_H_ + +/// +/// Global ID for the EDKII_SD_MMC_HOST_CONTROLLER_PPI. +/// +#define EDKII_SD_MMC_HOST_CONTROLLER_PPI_GUID \ + { \ + 0xb30dfeed, 0x947f, 0x4396, { 0xb1, 0x5a, 0xdf, 0xbd, 0xb9, 0x16, 0xdc, 0x24 } \ + } + +/// +/// Forward declaration for the SD_MMC_HOST_CONTROLLER_PPI. +/// +typedef struct _EDKII_SD_MMC_HOST_CONTROLLER_PPI EDKII_SD_MMC_HOST_CONTROLLER_PPI; + +/** + Get the MMIO base address of SD/MMC host controller. + + @param[in] This The protocol instance pointer. + @param[in] ControllerId The ID of the SD/MMC host controller. + @param[in,out] MmioBar The pointer to store the array of available + SD/MMC host controller slot MMIO base addresses. + The entry number of the array is specified by BarNum. + @param[out] BarNum The pointer to store the supported bar number. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_SD_MMC_HC_GET_MMIO_BAR)( + IN EDKII_SD_MMC_HOST_CONTROLLER_PPI *This, + IN UINT8 ControllerId, + IN OUT UINTN **MmioBar, + OUT UINT8 *BarNum + ); + +/// +/// This PPI contains a set of services to interact with the SD_MMC host controller. +/// +struct _EDKII_SD_MMC_HOST_CONTROLLER_PPI { + EDKII_SD_MMC_HC_GET_MMIO_BAR GetSdMmcHcMmioBar; +}; + +extern EFI_GUID gEdkiiPeiSdMmcHostControllerPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/SecPerformance.h b/MdeModulePkg/Include/Ppi/SecPerformance.h index fdeb434f5d..69d61dfdff 100644 --- a/MdeModulePkg/Include/Ppi/SecPerformance.h +++ b/MdeModulePkg/Include/Ppi/SecPerformance.h @@ -1,60 +1,60 @@ -/** @file
- Defines the interface to convey performance information from SEC phase to PEI.
-
-Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PEI_SEC_PERFORMANCE_PPI_H_
-#define _PEI_SEC_PERFORMANCE_PPI_H_
-
-#define PEI_SEC_PERFORMANCE_PPI_GUID \
- { \
- 0x0ecc666b, 0x4662, 0x47f9, {0x9d, 0xd5, 0xd0, 0x96, 0xff, 0x7d, 0xa4, 0x9e } \
- }
-
-typedef struct _PEI_SEC_PERFORMANCE_PPI PEI_SEC_PERFORMANCE_PPI;
-
-///
-/// Performance data collected in SEC phase.
-///
-typedef struct {
- UINT64 ResetEnd; ///< Timer value logged at the beginning of firmware image execution, in unit of nanosecond.
-} FIRMWARE_SEC_PERFORMANCE;
-
-/**
- This interface conveys performance information out of the Security (SEC) phase into PEI.
-
- This service is published by the SEC phase. The SEC phase handoff has an optional
- EFI_PEI_PPI_DESCRIPTOR list as its final argument when control is passed from SEC into the
- PEI Foundation. As such, if the platform supports collecting performance data in SEC,
- this information is encapsulated into the data structure abstracted by this service.
- This information is collected for the boot-strap processor (BSP) on IA-32.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the PEI_SEC_PERFORMANCE_PPI.
- @param[out] Performance The pointer to performance data collected in SEC phase.
-
- @retval EFI_SUCCESS The performance data was successfully returned.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *GET_SEC_PERFORMANCE)(
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN PEI_SEC_PERFORMANCE_PPI *This,
- OUT FIRMWARE_SEC_PERFORMANCE *Performance
- );
-
-///
-/// This PPI provides function to get performance data collected in SEC phase.
-///
-struct _PEI_SEC_PERFORMANCE_PPI {
- GET_SEC_PERFORMANCE GetPerformance;
-};
-
-extern EFI_GUID gPeiSecPerformancePpiGuid;
-
-#endif
+/** @file + Defines the interface to convey performance information from SEC phase to PEI. + +Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PEI_SEC_PERFORMANCE_PPI_H_ +#define _PEI_SEC_PERFORMANCE_PPI_H_ + +#define PEI_SEC_PERFORMANCE_PPI_GUID \ + { \ + 0x0ecc666b, 0x4662, 0x47f9, {0x9d, 0xd5, 0xd0, 0x96, 0xff, 0x7d, 0xa4, 0x9e } \ + } + +typedef struct _PEI_SEC_PERFORMANCE_PPI PEI_SEC_PERFORMANCE_PPI; + +/// +/// Performance data collected in SEC phase. +/// +typedef struct { + UINT64 ResetEnd; ///< Timer value logged at the beginning of firmware image execution, in unit of nanosecond. +} FIRMWARE_SEC_PERFORMANCE; + +/** + This interface conveys performance information out of the Security (SEC) phase into PEI. + + This service is published by the SEC phase. The SEC phase handoff has an optional + EFI_PEI_PPI_DESCRIPTOR list as its final argument when control is passed from SEC into the + PEI Foundation. As such, if the platform supports collecting performance data in SEC, + this information is encapsulated into the data structure abstracted by this service. + This information is collected for the boot-strap processor (BSP) on IA-32. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the PEI_SEC_PERFORMANCE_PPI. + @param[out] Performance The pointer to performance data collected in SEC phase. + + @retval EFI_SUCCESS The performance data was successfully returned. + +**/ +typedef +EFI_STATUS +(EFIAPI *GET_SEC_PERFORMANCE)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN PEI_SEC_PERFORMANCE_PPI *This, + OUT FIRMWARE_SEC_PERFORMANCE *Performance + ); + +/// +/// This PPI provides function to get performance data collected in SEC phase. +/// +struct _PEI_SEC_PERFORMANCE_PPI { + GET_SEC_PERFORMANCE GetPerformance; +}; + +extern EFI_GUID gPeiSecPerformancePpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/SerialPortPei.h b/MdeModulePkg/Include/Ppi/SerialPortPei.h index 6d26e88dde..f8b4c33dae 100644 --- a/MdeModulePkg/Include/Ppi/SerialPortPei.h +++ b/MdeModulePkg/Include/Ppi/SerialPortPei.h @@ -1,20 +1,20 @@ -/** @file
- PPI that is installed after the initialization of a serial stream device
- is complete.
-
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PEI_SERIAL_PORT_PPI_H__
-#define __PEI_SERIAL_PORT_PPI_H__
-
-#define PEI_SERIAL_PORT_PPI \
- { \
- 0x490e9d85, 0x8aef, 0x4193, { 0x8e, 0x56, 0xf7, 0x34, 0xa9, 0xff, 0xac, 0x8b } \
- }
-
-extern EFI_GUID gPeiSerialPortPpiGuid;
-
-#endif
+/** @file + PPI that is installed after the initialization of a serial stream device + is complete. + + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PEI_SERIAL_PORT_PPI_H__ +#define __PEI_SERIAL_PORT_PPI_H__ + +#define PEI_SERIAL_PORT_PPI \ + { \ + 0x490e9d85, 0x8aef, 0x4193, { 0x8e, 0x56, 0xf7, 0x34, 0xa9, 0xff, 0xac, 0x8b } \ + } + +extern EFI_GUID gPeiSerialPortPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/SmmAccess.h b/MdeModulePkg/Include/Ppi/SmmAccess.h index 9bafbd9667..5b4e79a677 100644 --- a/MdeModulePkg/Include/Ppi/SmmAccess.h +++ b/MdeModulePkg/Include/Ppi/SmmAccess.h @@ -1,139 +1,139 @@ -/** @file
- EFI SMM Access PPI definition.
-
- This PPI is used to control the visibility of the SMRAM on the platform.
- It abstracts the location and characteristics of SMRAM. The expectation is
- that the north bridge or memory controller would publish this PPI.
-
- The principal functionality found in the memory controller includes the following:
- - Exposing the SMRAM to all non-SMM agents, or the "open" state
- - Shrouding the SMRAM to all but the SMM agents, or the "closed" state
- - Preserving the system integrity, or "locking" the SMRAM, such that the settings cannot be
- perturbed by either boot service or runtime agents
-
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMM_ACCESS_PPI_H_
-#define _SMM_ACCESS_PPI_H_
-
-#define PEI_SMM_ACCESS_PPI_GUID \
- { 0x268f33a9, 0xcccd, 0x48be, { 0x88, 0x17, 0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 }}
-
-typedef struct _PEI_SMM_ACCESS_PPI PEI_SMM_ACCESS_PPI;
-
-/**
- Opens the SMRAM area to be accessible by a PEIM driver.
-
- This function "opens" SMRAM so that it is visible while not inside of SMM. The function should
- return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function
- should return EFI_DEVICE_ERROR if the SMRAM configuration is locked.
-
- @param PeiServices General purpose services available to every PEIM.
- @param This The pointer to the SMM Access Interface.
- @param DescriptorIndex The region of SMRAM to Open.
-
- @retval EFI_SUCCESS The region was successfully opened.
- @retval EFI_DEVICE_ERROR The region could not be opened because locked by chipset.
- @retval EFI_INVALID_PARAMETER The descriptor index was out of bounds.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_SMM_OPEN)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_SMM_ACCESS_PPI *This,
- IN UINTN DescriptorIndex
- );
-
-/**
- Inhibits access to the SMRAM.
-
- This function "closes" SMRAM so that it is not visible while outside of SMM. The function should
- return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM.
-
- @param PeiServices General purpose services available to every PEIM.
- @param This The pointer to the SMM Access Interface.
- @param DescriptorIndex The region of SMRAM to Close.
-
- @retval EFI_SUCCESS The region was successfully closed.
- @retval EFI_DEVICE_ERROR The region could not be closed because locked by chipset.
- @retval EFI_INVALID_PARAMETER The descriptor index was out of bounds.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_SMM_CLOSE)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_SMM_ACCESS_PPI *This,
- IN UINTN DescriptorIndex
- );
-
-/**
- Inhibits access to the SMRAM.
-
- This function prohibits access to the SMRAM region. This function is usually implemented such
- that it is a write-once operation.
-
- @param PeiServices General purpose services available to every PEIM.
- @param This The pointer to the SMM Access Interface.
- @param DescriptorIndex The region of SMRAM to Close.
-
- @retval EFI_SUCCESS The region was successfully locked.
- @retval EFI_DEVICE_ERROR The region could not be locked because at least
- one range is still open.
- @retval EFI_INVALID_PARAMETER The descriptor index was out of bounds.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_SMM_LOCK)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_SMM_ACCESS_PPI *This,
- IN UINTN DescriptorIndex
- );
-
-/**
- Queries the memory controller for the possible regions that will support SMRAM.
-
- @param PeiServices General purpose services available to every PEIM.
- @param This The pointer to the SmmAccessPpi Interface.
- @param SmramMapSize The pointer to the variable containing size of the
- buffer to contain the description information.
- @param SmramMap The buffer containing the data describing the Smram
- region descriptors.
-
- @retval EFI_BUFFER_TOO_SMALL The user did not provide a sufficient buffer.
- @retval EFI_SUCCESS The user provided a sufficiently-sized buffer.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_SMM_CAPABILITIES)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_SMM_ACCESS_PPI *This,
- IN OUT UINTN *SmramMapSize,
- IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
- );
-
-///
-/// EFI SMM Access PPI is used to control the visibility of the SMRAM on the platform.
-/// It abstracts the location and characteristics of SMRAM. The platform should report
-/// all MMRAM via PEI_SMM_ACCESS_PPI. The expectation is that the north bridge or
-/// memory controller would publish this PPI.
-///
-struct _PEI_SMM_ACCESS_PPI {
- PEI_SMM_OPEN Open;
- PEI_SMM_CLOSE Close;
- PEI_SMM_LOCK Lock;
- PEI_SMM_CAPABILITIES GetCapabilities;
- BOOLEAN LockState;
- BOOLEAN OpenState;
-};
-
-extern EFI_GUID gPeiSmmAccessPpiGuid;
-
-#endif
+/** @file + EFI SMM Access PPI definition. + + This PPI is used to control the visibility of the SMRAM on the platform. + It abstracts the location and characteristics of SMRAM. The expectation is + that the north bridge or memory controller would publish this PPI. + + The principal functionality found in the memory controller includes the following: + - Exposing the SMRAM to all non-SMM agents, or the "open" state + - Shrouding the SMRAM to all but the SMM agents, or the "closed" state + - Preserving the system integrity, or "locking" the SMRAM, such that the settings cannot be + perturbed by either boot service or runtime agents + +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMM_ACCESS_PPI_H_ +#define _SMM_ACCESS_PPI_H_ + +#define PEI_SMM_ACCESS_PPI_GUID \ + { 0x268f33a9, 0xcccd, 0x48be, { 0x88, 0x17, 0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 }} + +typedef struct _PEI_SMM_ACCESS_PPI PEI_SMM_ACCESS_PPI; + +/** + Opens the SMRAM area to be accessible by a PEIM driver. + + This function "opens" SMRAM so that it is visible while not inside of SMM. The function should + return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function + should return EFI_DEVICE_ERROR if the SMRAM configuration is locked. + + @param PeiServices General purpose services available to every PEIM. + @param This The pointer to the SMM Access Interface. + @param DescriptorIndex The region of SMRAM to Open. + + @retval EFI_SUCCESS The region was successfully opened. + @retval EFI_DEVICE_ERROR The region could not be opened because locked by chipset. + @retval EFI_INVALID_PARAMETER The descriptor index was out of bounds. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_SMM_OPEN)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_SMM_ACCESS_PPI *This, + IN UINTN DescriptorIndex + ); + +/** + Inhibits access to the SMRAM. + + This function "closes" SMRAM so that it is not visible while outside of SMM. The function should + return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. + + @param PeiServices General purpose services available to every PEIM. + @param This The pointer to the SMM Access Interface. + @param DescriptorIndex The region of SMRAM to Close. + + @retval EFI_SUCCESS The region was successfully closed. + @retval EFI_DEVICE_ERROR The region could not be closed because locked by chipset. + @retval EFI_INVALID_PARAMETER The descriptor index was out of bounds. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_SMM_CLOSE)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_SMM_ACCESS_PPI *This, + IN UINTN DescriptorIndex + ); + +/** + Inhibits access to the SMRAM. + + This function prohibits access to the SMRAM region. This function is usually implemented such + that it is a write-once operation. + + @param PeiServices General purpose services available to every PEIM. + @param This The pointer to the SMM Access Interface. + @param DescriptorIndex The region of SMRAM to Close. + + @retval EFI_SUCCESS The region was successfully locked. + @retval EFI_DEVICE_ERROR The region could not be locked because at least + one range is still open. + @retval EFI_INVALID_PARAMETER The descriptor index was out of bounds. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_SMM_LOCK)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_SMM_ACCESS_PPI *This, + IN UINTN DescriptorIndex + ); + +/** + Queries the memory controller for the possible regions that will support SMRAM. + + @param PeiServices General purpose services available to every PEIM. + @param This The pointer to the SmmAccessPpi Interface. + @param SmramMapSize The pointer to the variable containing size of the + buffer to contain the description information. + @param SmramMap The buffer containing the data describing the Smram + region descriptors. + + @retval EFI_BUFFER_TOO_SMALL The user did not provide a sufficient buffer. + @retval EFI_SUCCESS The user provided a sufficiently-sized buffer. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_SMM_CAPABILITIES)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_SMM_ACCESS_PPI *This, + IN OUT UINTN *SmramMapSize, + IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap + ); + +/// +/// EFI SMM Access PPI is used to control the visibility of the SMRAM on the platform. +/// It abstracts the location and characteristics of SMRAM. The platform should report +/// all MMRAM via PEI_SMM_ACCESS_PPI. The expectation is that the north bridge or +/// memory controller would publish this PPI. +/// +struct _PEI_SMM_ACCESS_PPI { + PEI_SMM_OPEN Open; + PEI_SMM_CLOSE Close; + PEI_SMM_LOCK Lock; + PEI_SMM_CAPABILITIES GetCapabilities; + BOOLEAN LockState; + BOOLEAN OpenState; +}; + +extern EFI_GUID gPeiSmmAccessPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/SmmCommunication.h b/MdeModulePkg/Include/Ppi/SmmCommunication.h index d4e5568e5b..9d1bafb0d9 100644 --- a/MdeModulePkg/Include/Ppi/SmmCommunication.h +++ b/MdeModulePkg/Include/Ppi/SmmCommunication.h @@ -1,56 +1,56 @@ -/** @file
- EFI SMM Communication PPI definition.
-
- This Ppi provides a means of communicating between PEIM and SMI
- handlers inside of SMM.
- This Ppi is produced and consumed only in S3 resume boot path.
- It is NOT available in normal boot path.
-
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMM_COMMUNICATION_PPI_H_
-#define _SMM_COMMUNICATION_PPI_H_
-
-#define EFI_PEI_SMM_COMMUNICATION_PPI_GUID \
- { \
- 0xae933e1c, 0xcc47, 0x4e38, { 0x8f, 0xe, 0xe2, 0xf6, 0x1d, 0x26, 0x5, 0xdf } \
- }
-
-typedef struct _EFI_PEI_SMM_COMMUNICATION_PPI EFI_PEI_SMM_COMMUNICATION_PPI;
-
-/**
- Communicates with a registered handler.
-
- This function provides a service to send and receive messages from a registered UEFI service.
-
- @param[in] This The EFI_PEI_SMM_COMMUNICATION_PPI instance.
- @param[in] CommBuffer A pointer to the buffer to convey into SMRAM.
- @param[in] CommSize The size of the data buffer being passed in.On exit, the size of data
- being returned. Zero if the handler does not wish to reply with any data.
-
- @retval EFI_SUCCESS The message was successfully posted.
- @retval EFI_INVALID_PARAMETER The CommBuffer was NULL.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PEI_SMM_COMMUNICATE)(
- IN CONST EFI_PEI_SMM_COMMUNICATION_PPI *This,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommSize
- );
-
-///
-/// EFI SMM Communication Protocol provides runtime services for communicating
-/// between DXE drivers and a registered SMI handler.
-///
-struct _EFI_PEI_SMM_COMMUNICATION_PPI {
- EFI_PEI_SMM_COMMUNICATE Communicate;
-};
-
-extern EFI_GUID gEfiPeiSmmCommunicationPpiGuid;
-
-#endif
+/** @file + EFI SMM Communication PPI definition. + + This Ppi provides a means of communicating between PEIM and SMI + handlers inside of SMM. + This Ppi is produced and consumed only in S3 resume boot path. + It is NOT available in normal boot path. + +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMM_COMMUNICATION_PPI_H_ +#define _SMM_COMMUNICATION_PPI_H_ + +#define EFI_PEI_SMM_COMMUNICATION_PPI_GUID \ + { \ + 0xae933e1c, 0xcc47, 0x4e38, { 0x8f, 0xe, 0xe2, 0xf6, 0x1d, 0x26, 0x5, 0xdf } \ + } + +typedef struct _EFI_PEI_SMM_COMMUNICATION_PPI EFI_PEI_SMM_COMMUNICATION_PPI; + +/** + Communicates with a registered handler. + + This function provides a service to send and receive messages from a registered UEFI service. + + @param[in] This The EFI_PEI_SMM_COMMUNICATION_PPI instance. + @param[in] CommBuffer A pointer to the buffer to convey into SMRAM. + @param[in] CommSize The size of the data buffer being passed in.On exit, the size of data + being returned. Zero if the handler does not wish to reply with any data. + + @retval EFI_SUCCESS The message was successfully posted. + @retval EFI_INVALID_PARAMETER The CommBuffer was NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SMM_COMMUNICATE)( + IN CONST EFI_PEI_SMM_COMMUNICATION_PPI *This, + IN OUT VOID *CommBuffer, + IN OUT UINTN *CommSize + ); + +/// +/// EFI SMM Communication Protocol provides runtime services for communicating +/// between DXE drivers and a registered SMI handler. +/// +struct _EFI_PEI_SMM_COMMUNICATION_PPI { + EFI_PEI_SMM_COMMUNICATE Communicate; +}; + +extern EFI_GUID gEfiPeiSmmCommunicationPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/SmmControl.h b/MdeModulePkg/Include/Ppi/SmmControl.h index f88dbd5932..ac0131ddfc 100644 --- a/MdeModulePkg/Include/Ppi/SmmControl.h +++ b/MdeModulePkg/Include/Ppi/SmmControl.h @@ -1,88 +1,88 @@ -/** @file
- EFI SMM Control PPI definition.
-
- This PPI is used to initiate SMI/PMI activations. This protocol could be published by either:
- - A processor driver to abstract the SMI/PMI IPI
- - The driver that abstracts the ASIC that is supporting the APM port, such as the ICH in an
- Intel chipset
- Because of the possibility of performing SMI or PMI IPI transactions, the ability to generate this
- event from a platform chipset agent is an optional capability for both IA-32 and Itanium-based
- systems.
-
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMM_CONTROL_PPI_H_
-#define _SMM_CONTROL_PPI_H_
-
-#define PEI_SMM_CONTROL_PPI_GUID \
- { 0x61c68702, 0x4d7e, 0x4f43, 0x8d, 0xef, 0xa7, 0x43, 0x5, 0xce, 0x74, 0xc5 }
-
-typedef struct _PEI_SMM_CONTROL_PPI PEI_SMM_CONTROL_PPI;
-
-/**
- Invokes SMI activation from either the preboot or runtime environment.
-
- @param PeiServices General purpose services available to every PEIM.
- @param This The PEI_SMM_CONTROL_PPI instance.
- @param ArgumentBuffer The optional sized data to pass into the protocol activation.
- @param ArgumentBufferSize The optional size of the data.
- @param Periodic An optional mechanism to periodically repeat activation.
- @param ActivationInterval An optional parameter to repeat at this period one
- time or, if the Periodic Boolean is set, periodically.
-
- @retval EFI_SUCCESS The SMI/PMI has been engendered.
- @retval EFI_DEVICE_ERROR The timing is unsupported.
- @retval EFI_INVALID_PARAMETER The activation period is unsupported.
- @retval EFI_NOT_STARTED The SMM base service has not been initialized.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_SMM_ACTIVATE)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_SMM_CONTROL_PPI *This,
- IN OUT INT8 *ArgumentBuffer OPTIONAL,
- IN OUT UINTN *ArgumentBufferSize OPTIONAL,
- IN BOOLEAN Periodic OPTIONAL,
- IN UINTN ActivationInterval OPTIONAL
- );
-
-/**
- Clears any system state that was created in response to the Active call.
-
- @param PeiServices General purpose services available to every PEIM.
- @param This The PEI_SMM_CONTROL_PPI instance.
- @param Periodic Optional parameter to repeat at this period one
- time or, if the Periodic Boolean is set, periodically.
-
- @retval EFI_SUCCESS The SMI/PMI has been engendered.
- @retval EFI_DEVICE_ERROR The source could not be cleared.
- @retval EFI_INVALID_PARAMETER The service did not support the Periodic input argument.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_SMM_DEACTIVATE)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_SMM_CONTROL_PPI *This,
- IN BOOLEAN Periodic OPTIONAL
- );
-
-///
-/// PEI SMM Control PPI is used to initiate SMI/PMI activations. This protocol could be published by either:
-/// - A processor driver to abstract the SMI/PMI IPI
-/// - The driver that abstracts the ASIC that is supporting the APM port, such as the ICH in an
-/// Intel chipset
-///
-struct _PEI_SMM_CONTROL_PPI {
- PEI_SMM_ACTIVATE Trigger;
- PEI_SMM_DEACTIVATE Clear;
-};
-
-extern EFI_GUID gPeiSmmControlPpiGuid;
-
-#endif
+/** @file + EFI SMM Control PPI definition. + + This PPI is used to initiate SMI/PMI activations. This protocol could be published by either: + - A processor driver to abstract the SMI/PMI IPI + - The driver that abstracts the ASIC that is supporting the APM port, such as the ICH in an + Intel chipset + Because of the possibility of performing SMI or PMI IPI transactions, the ability to generate this + event from a platform chipset agent is an optional capability for both IA-32 and Itanium-based + systems. + + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMM_CONTROL_PPI_H_ +#define _SMM_CONTROL_PPI_H_ + +#define PEI_SMM_CONTROL_PPI_GUID \ + { 0x61c68702, 0x4d7e, 0x4f43, 0x8d, 0xef, 0xa7, 0x43, 0x5, 0xce, 0x74, 0xc5 } + +typedef struct _PEI_SMM_CONTROL_PPI PEI_SMM_CONTROL_PPI; + +/** + Invokes SMI activation from either the preboot or runtime environment. + + @param PeiServices General purpose services available to every PEIM. + @param This The PEI_SMM_CONTROL_PPI instance. + @param ArgumentBuffer The optional sized data to pass into the protocol activation. + @param ArgumentBufferSize The optional size of the data. + @param Periodic An optional mechanism to periodically repeat activation. + @param ActivationInterval An optional parameter to repeat at this period one + time or, if the Periodic Boolean is set, periodically. + + @retval EFI_SUCCESS The SMI/PMI has been engendered. + @retval EFI_DEVICE_ERROR The timing is unsupported. + @retval EFI_INVALID_PARAMETER The activation period is unsupported. + @retval EFI_NOT_STARTED The SMM base service has not been initialized. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_SMM_ACTIVATE)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_SMM_CONTROL_PPI *This, + IN OUT INT8 *ArgumentBuffer OPTIONAL, + IN OUT UINTN *ArgumentBufferSize OPTIONAL, + IN BOOLEAN Periodic OPTIONAL, + IN UINTN ActivationInterval OPTIONAL + ); + +/** + Clears any system state that was created in response to the Active call. + + @param PeiServices General purpose services available to every PEIM. + @param This The PEI_SMM_CONTROL_PPI instance. + @param Periodic Optional parameter to repeat at this period one + time or, if the Periodic Boolean is set, periodically. + + @retval EFI_SUCCESS The SMI/PMI has been engendered. + @retval EFI_DEVICE_ERROR The source could not be cleared. + @retval EFI_INVALID_PARAMETER The service did not support the Periodic input argument. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_SMM_DEACTIVATE)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_SMM_CONTROL_PPI *This, + IN BOOLEAN Periodic OPTIONAL + ); + +/// +/// PEI SMM Control PPI is used to initiate SMI/PMI activations. This protocol could be published by either: +/// - A processor driver to abstract the SMI/PMI IPI +/// - The driver that abstracts the ASIC that is supporting the APM port, such as the ICH in an +/// Intel chipset +/// +struct _PEI_SMM_CONTROL_PPI { + PEI_SMM_ACTIVATE Trigger; + PEI_SMM_DEACTIVATE Clear; +}; + +extern EFI_GUID gPeiSmmControlPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/StorageSecurityCommand.h b/MdeModulePkg/Include/Ppi/StorageSecurityCommand.h index 360628ad21..581c055cdc 100644 --- a/MdeModulePkg/Include/Ppi/StorageSecurityCommand.h +++ b/MdeModulePkg/Include/Ppi/StorageSecurityCommand.h @@ -1,276 +1,276 @@ -/** @file
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EDKII_STORAGE_SECURITY_COMMAND_PPI_H_
-#define _EDKII_STORAGE_SECURITY_COMMAND_PPI_H_
-
-#include <Protocol/DevicePath.h>
-
-///
-/// Global ID for the EDKII_PEI_STORAGE_SECURITY_CMD_PPI.
-///
-#define EDKII_PEI_STORAGE_SECURITY_CMD_PPI_GUID \
- { \
- 0x35de0b4e, 0x30fb, 0x46c3, { 0xbd, 0x84, 0x1f, 0xdb, 0xa1, 0x58, 0xbb, 0x56 } \
- }
-
-//
-// Forward declaration for the EDKII_PEI_STORAGE_SECURITY_CMD_PPI.
-//
-typedef struct _EDKII_PEI_STORAGE_SECURITY_CMD_PPI EDKII_PEI_STORAGE_SECURITY_CMD_PPI;
-
-//
-// Revision The revision to which the Storage Security Command interface adheres.
-// All future revisions must be backwards compatible.
-// If a future version is not back wards compatible it is not the same GUID.
-//
-#define EDKII_STORAGE_SECURITY_PPI_REVISION 0x00010000
-
-/**
- Gets the count of storage security devices that one specific driver detects.
-
- @param[in] This The PPI instance pointer.
- @param[out] NumberofDevices The number of storage security devices discovered.
-
- @retval EFI_SUCCESS The operation performed successfully.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_STORAGE_SECURITY_GET_NUMBER_DEVICES)(
- IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
- OUT UINTN *NumberofDevices
- );
-
-/**
- Gets the device path of a specific storage security device.
-
- @param[in] This The PPI instance pointer.
- @param[in] DeviceIndex Specifies the storage security device to which
- the function wants to talk. Because the driver
- that implements Storage Security Command PPIs
- will manage multiple storage devices, the PPIs
- that want to talk to a single device must specify
- the device index that was assigned during the
- enumeration process. This index is a number from
- one to NumberofDevices.
- @param[out] DevicePathLength The length of the device path in bytes specified
- by DevicePath.
- @param[out] DevicePath The device path of storage security device.
- This field re-uses EFI Device Path Protocol as
- defined by Section 10.2 EFI Device Path Protocol
- of UEFI 2.7 Specification.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.
- @retval EFI_NOT_FOUND The specified storage security device not found.
- @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_STORAGE_SECURITY_GET_DEVICE_PATH)(
- IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
- IN UINTN DeviceIndex,
- OUT UINTN *DevicePathLength,
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- );
-
-/**
- Send a security protocol command to a device that receives data and/or the result
- of one or more commands sent by SendData.
-
- The ReceiveData function sends a security protocol command to the given DeviceIndex.
- The security protocol command sent is defined by SecurityProtocolId and contains
- the security protocol specific data SecurityProtocolSpecificData. The function
- returns the data from the security protocol command in PayloadBuffer.
-
- For devices supporting the SCSI command set, the security protocol command is sent
- using the SECURITY PROTOCOL IN command defined in SPC-4.
-
- For devices supporting the ATA command set, the security protocol command is sent
- using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize
- is non-zero.
-
- If the PayloadBufferSize is zero, the security protocol command is sent using the
- Trusted Non-Data command defined in ATA8-ACS.
-
- If PayloadBufferSize is too small to store the available data from the security
- protocol command, the function shall copy PayloadBufferSize bytes into the
- PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.
-
- If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,
- the function shall return EFI_INVALID_PARAMETER.
-
- If the given DeviceIndex does not support security protocol commands, the function
- shall return EFI_UNSUPPORTED.
-
- If the security protocol fails to complete within the Timeout period, the function
- shall return EFI_TIMEOUT.
-
- If the security protocol command completes without an error, the function shall
- return EFI_SUCCESS. If the security protocol command completes with an error, the
- function shall return EFI_DEVICE_ERROR.
-
- @param[in] This The PPI instance pointer.
- @param[in] DeviceIndex Specifies the storage security device to which the
- function wants to talk. Because the driver that
- implements Storage Security Command PPIs will manage
- multiple storage devices, the PPIs that want to talk
- to a single device must specify the device index
- that was assigned during the enumeration process.
- This index is a number from one to NumberofDevices.
- @param[in] Timeout The timeout, in 100ns units, to use for the execution
- of the security protocol command. A Timeout value
- of 0 means that this function will wait indefinitely
- for the security protocol command to execute. If
- Timeout is greater than zero, then this function
- will return EFI_TIMEOUT if the time required to
- execute the receive data command is greater than
- Timeout.
- @param[in] SecurityProtocolId
- The value of the "Security Protocol" parameter of
- the security protocol command to be sent.
- @param[in] SecurityProtocolSpecificData
- The value of the "Security Protocol Specific"
- parameter of the security protocol command to be
- sent.
- @param[in] PayloadBufferSize
- Size in bytes of the payload data buffer.
- @param[out] PayloadBuffer A pointer to a destination buffer to store the
- security protocol command specific payload data
- for the security protocol command. The caller is
- responsible for having either implicit or explicit
- ownership of the buffer.
- @param[out] PayloadTransferSize
- A pointer to a buffer to store the size in bytes
- of the data written to the payload data buffer.
-
- @retval EFI_SUCCESS The security protocol command completed
- successfully.
- @retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to
- store the available data from the device.
- The PayloadBuffer contains the truncated
- data.
- @retval EFI_UNSUPPORTED The given DeviceIndex does not support
- security protocol commands.
- @retval EFI_DEVICE_ERROR The security protocol command completed
- with an error.
- @retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize
- is NULL and PayloadBufferSize is non-zero.
- @retval EFI_TIMEOUT A timeout occurred while waiting for the
- security protocol command to execute.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_STORAGE_SECURITY_RECEIVE_DATA)(
- IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
- IN UINTN DeviceIndex,
- IN UINT64 Timeout,
- IN UINT8 SecurityProtocolId,
- IN UINT16 SecurityProtocolSpecificData,
- IN UINTN PayloadBufferSize,
- OUT VOID *PayloadBuffer,
- OUT UINTN *PayloadTransferSize
- );
-
-/**
- Send a security protocol command to a device.
-
- The SendData function sends a security protocol command containing the payload
- PayloadBuffer to the given DeviceIndex. The security protocol command sent is
- defined by SecurityProtocolId and contains the security protocol specific data
- SecurityProtocolSpecificData. If the underlying protocol command requires a
- specific padding for the command payload, the SendData function shall add padding
- bytes to the command payload to satisfy the padding requirements.
-
- For devices supporting the SCSI command set, the security protocol command is
- sent using the SECURITY PROTOCOL OUT command defined in SPC-4.
-
- For devices supporting the ATA command set, the security protocol command is
- sent using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize
- is non-zero. If the PayloadBufferSize is zero, the security protocol command
- is sent using the Trusted Non-Data command defined in ATA8-ACS.
-
- If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall
- return EFI_INVALID_PARAMETER.
-
- If the given DeviceIndex does not support security protocol commands, the function
- shall return EFI_UNSUPPORTED.
-
- If the security protocol fails to complete within the Timeout period, the function
- shall return EFI_TIMEOUT.
-
- If the security protocol command completes without an error, the function shall
- return EFI_SUCCESS. If the security protocol command completes with an error,
- the functio shall return EFI_DEVICE_ERROR.
-
- @param[in] This The PPI instance pointer.
- @param[in] DeviceIndex The ID of the device.
- @param[in] Timeout The timeout, in 100ns units, to use for the execution
- of the security protocol command. A Timeout value
- of 0 means that this function will wait indefinitely
- for the security protocol command to execute. If
- Timeout is greater than zero, then this function
- will return EFI_TIMEOUT if the time required to
- execute the receive data command is greater than
- Timeout.
- @param[in] SecurityProtocolId
- The value of the "Security Protocol" parameter of
- the security protocol command to be sent.
- @param[in] SecurityProtocolSpecificData
- The value of the "Security Protocol Specific"
- parameter of the security protocol command to be
- sent.
- @param[in] PayloadBufferSize Size in bytes of the payload data buffer.
- @param[in] PayloadBuffer A pointer to a destination buffer to store the
- security protocol command specific payload data
- for the security protocol command.
-
- @retval EFI_SUCCESS The security protocol command completed successfully.
- @retval EFI_UNSUPPORTED The given DeviceIndex does not support security
- protocol commands.
- @retval EFI_DEVICE_ERROR The security protocol command completed with
- an error.
- @retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize
- is non-zero.
- @retval EFI_TIMEOUT A timeout occurred while waiting for the security
- protocol command to execute.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PEI_STORAGE_SECURITY_SEND_DATA)(
- IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,
- IN UINTN DeviceIndex,
- IN UINT64 Timeout,
- IN UINT8 SecurityProtocolId,
- IN UINT16 SecurityProtocolSpecificData,
- IN UINTN PayloadBufferSize,
- IN VOID *PayloadBuffer
- );
-
-//
-// EDKII_PEI_STORAGE_SECURITY_CMD_PPI contains a set of services to send security
-// protocol commands to a mass storage device. Two types of security protocol
-// commands are supported. SendData sends a command with data to a device.
-// ReceiveData sends a command that receives data and/or the result of one or
-// more commands sent by SendData.
-//
-struct _EDKII_PEI_STORAGE_SECURITY_CMD_PPI {
- UINT64 Revision;
- EDKII_PEI_STORAGE_SECURITY_GET_NUMBER_DEVICES GetNumberofDevices;
- EDKII_PEI_STORAGE_SECURITY_GET_DEVICE_PATH GetDevicePath;
- EDKII_PEI_STORAGE_SECURITY_RECEIVE_DATA ReceiveData;
- EDKII_PEI_STORAGE_SECURITY_SEND_DATA SendData;
-};
-
-extern EFI_GUID gEdkiiPeiStorageSecurityCommandPpiGuid;
-
-#endif
+/** @file + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_STORAGE_SECURITY_COMMAND_PPI_H_ +#define _EDKII_STORAGE_SECURITY_COMMAND_PPI_H_ + +#include <Protocol/DevicePath.h> + +/// +/// Global ID for the EDKII_PEI_STORAGE_SECURITY_CMD_PPI. +/// +#define EDKII_PEI_STORAGE_SECURITY_CMD_PPI_GUID \ + { \ + 0x35de0b4e, 0x30fb, 0x46c3, { 0xbd, 0x84, 0x1f, 0xdb, 0xa1, 0x58, 0xbb, 0x56 } \ + } + +// +// Forward declaration for the EDKII_PEI_STORAGE_SECURITY_CMD_PPI. +// +typedef struct _EDKII_PEI_STORAGE_SECURITY_CMD_PPI EDKII_PEI_STORAGE_SECURITY_CMD_PPI; + +// +// Revision The revision to which the Storage Security Command interface adheres. +// All future revisions must be backwards compatible. +// If a future version is not back wards compatible it is not the same GUID. +// +#define EDKII_STORAGE_SECURITY_PPI_REVISION 0x00010000 + +/** + Gets the count of storage security devices that one specific driver detects. + + @param[in] This The PPI instance pointer. + @param[out] NumberofDevices The number of storage security devices discovered. + + @retval EFI_SUCCESS The operation performed successfully. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_STORAGE_SECURITY_GET_NUMBER_DEVICES)( + IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, + OUT UINTN *NumberofDevices + ); + +/** + Gets the device path of a specific storage security device. + + @param[in] This The PPI instance pointer. + @param[in] DeviceIndex Specifies the storage security device to which + the function wants to talk. Because the driver + that implements Storage Security Command PPIs + will manage multiple storage devices, the PPIs + that want to talk to a single device must specify + the device index that was assigned during the + enumeration process. This index is a number from + one to NumberofDevices. + @param[out] DevicePathLength The length of the device path in bytes specified + by DevicePath. + @param[out] DevicePath The device path of storage security device. + This field re-uses EFI Device Path Protocol as + defined by Section 10.2 EFI Device Path Protocol + of UEFI 2.7 Specification. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL. + @retval EFI_NOT_FOUND The specified storage security device not found. + @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_STORAGE_SECURITY_GET_DEVICE_PATH)( + IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, + IN UINTN DeviceIndex, + OUT UINTN *DevicePathLength, + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ); + +/** + Send a security protocol command to a device that receives data and/or the result + of one or more commands sent by SendData. + + The ReceiveData function sends a security protocol command to the given DeviceIndex. + The security protocol command sent is defined by SecurityProtocolId and contains + the security protocol specific data SecurityProtocolSpecificData. The function + returns the data from the security protocol command in PayloadBuffer. + + For devices supporting the SCSI command set, the security protocol command is sent + using the SECURITY PROTOCOL IN command defined in SPC-4. + + For devices supporting the ATA command set, the security protocol command is sent + using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize + is non-zero. + + If the PayloadBufferSize is zero, the security protocol command is sent using the + Trusted Non-Data command defined in ATA8-ACS. + + If PayloadBufferSize is too small to store the available data from the security + protocol command, the function shall copy PayloadBufferSize bytes into the + PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL. + + If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero, + the function shall return EFI_INVALID_PARAMETER. + + If the given DeviceIndex does not support security protocol commands, the function + shall return EFI_UNSUPPORTED. + + If the security protocol fails to complete within the Timeout period, the function + shall return EFI_TIMEOUT. + + If the security protocol command completes without an error, the function shall + return EFI_SUCCESS. If the security protocol command completes with an error, the + function shall return EFI_DEVICE_ERROR. + + @param[in] This The PPI instance pointer. + @param[in] DeviceIndex Specifies the storage security device to which the + function wants to talk. Because the driver that + implements Storage Security Command PPIs will manage + multiple storage devices, the PPIs that want to talk + to a single device must specify the device index + that was assigned during the enumeration process. + This index is a number from one to NumberofDevices. + @param[in] Timeout The timeout, in 100ns units, to use for the execution + of the security protocol command. A Timeout value + of 0 means that this function will wait indefinitely + for the security protocol command to execute. If + Timeout is greater than zero, then this function + will return EFI_TIMEOUT if the time required to + execute the receive data command is greater than + Timeout. + @param[in] SecurityProtocolId + The value of the "Security Protocol" parameter of + the security protocol command to be sent. + @param[in] SecurityProtocolSpecificData + The value of the "Security Protocol Specific" + parameter of the security protocol command to be + sent. + @param[in] PayloadBufferSize + Size in bytes of the payload data buffer. + @param[out] PayloadBuffer A pointer to a destination buffer to store the + security protocol command specific payload data + for the security protocol command. The caller is + responsible for having either implicit or explicit + ownership of the buffer. + @param[out] PayloadTransferSize + A pointer to a buffer to store the size in bytes + of the data written to the payload data buffer. + + @retval EFI_SUCCESS The security protocol command completed + successfully. + @retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to + store the available data from the device. + The PayloadBuffer contains the truncated + data. + @retval EFI_UNSUPPORTED The given DeviceIndex does not support + security protocol commands. + @retval EFI_DEVICE_ERROR The security protocol command completed + with an error. + @retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize + is NULL and PayloadBufferSize is non-zero. + @retval EFI_TIMEOUT A timeout occurred while waiting for the + security protocol command to execute. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_STORAGE_SECURITY_RECEIVE_DATA)( + IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, + IN UINTN DeviceIndex, + IN UINT64 Timeout, + IN UINT8 SecurityProtocolId, + IN UINT16 SecurityProtocolSpecificData, + IN UINTN PayloadBufferSize, + OUT VOID *PayloadBuffer, + OUT UINTN *PayloadTransferSize + ); + +/** + Send a security protocol command to a device. + + The SendData function sends a security protocol command containing the payload + PayloadBuffer to the given DeviceIndex. The security protocol command sent is + defined by SecurityProtocolId and contains the security protocol specific data + SecurityProtocolSpecificData. If the underlying protocol command requires a + specific padding for the command payload, the SendData function shall add padding + bytes to the command payload to satisfy the padding requirements. + + For devices supporting the SCSI command set, the security protocol command is + sent using the SECURITY PROTOCOL OUT command defined in SPC-4. + + For devices supporting the ATA command set, the security protocol command is + sent using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize + is non-zero. If the PayloadBufferSize is zero, the security protocol command + is sent using the Trusted Non-Data command defined in ATA8-ACS. + + If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall + return EFI_INVALID_PARAMETER. + + If the given DeviceIndex does not support security protocol commands, the function + shall return EFI_UNSUPPORTED. + + If the security protocol fails to complete within the Timeout period, the function + shall return EFI_TIMEOUT. + + If the security protocol command completes without an error, the function shall + return EFI_SUCCESS. If the security protocol command completes with an error, + the functio shall return EFI_DEVICE_ERROR. + + @param[in] This The PPI instance pointer. + @param[in] DeviceIndex The ID of the device. + @param[in] Timeout The timeout, in 100ns units, to use for the execution + of the security protocol command. A Timeout value + of 0 means that this function will wait indefinitely + for the security protocol command to execute. If + Timeout is greater than zero, then this function + will return EFI_TIMEOUT if the time required to + execute the receive data command is greater than + Timeout. + @param[in] SecurityProtocolId + The value of the "Security Protocol" parameter of + the security protocol command to be sent. + @param[in] SecurityProtocolSpecificData + The value of the "Security Protocol Specific" + parameter of the security protocol command to be + sent. + @param[in] PayloadBufferSize Size in bytes of the payload data buffer. + @param[in] PayloadBuffer A pointer to a destination buffer to store the + security protocol command specific payload data + for the security protocol command. + + @retval EFI_SUCCESS The security protocol command completed successfully. + @retval EFI_UNSUPPORTED The given DeviceIndex does not support security + protocol commands. + @retval EFI_DEVICE_ERROR The security protocol command completed with + an error. + @retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize + is non-zero. + @retval EFI_TIMEOUT A timeout occurred while waiting for the security + protocol command to execute. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_STORAGE_SECURITY_SEND_DATA)( + IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, + IN UINTN DeviceIndex, + IN UINT64 Timeout, + IN UINT8 SecurityProtocolId, + IN UINT16 SecurityProtocolSpecificData, + IN UINTN PayloadBufferSize, + IN VOID *PayloadBuffer + ); + +// +// EDKII_PEI_STORAGE_SECURITY_CMD_PPI contains a set of services to send security +// protocol commands to a mass storage device. Two types of security protocol +// commands are supported. SendData sends a command with data to a device. +// ReceiveData sends a command that receives data and/or the result of one or +// more commands sent by SendData. +// +struct _EDKII_PEI_STORAGE_SECURITY_CMD_PPI { + UINT64 Revision; + EDKII_PEI_STORAGE_SECURITY_GET_NUMBER_DEVICES GetNumberofDevices; + EDKII_PEI_STORAGE_SECURITY_GET_DEVICE_PATH GetDevicePath; + EDKII_PEI_STORAGE_SECURITY_RECEIVE_DATA ReceiveData; + EDKII_PEI_STORAGE_SECURITY_SEND_DATA SendData; +}; + +extern EFI_GUID gEdkiiPeiStorageSecurityCommandPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/UfsHostController.h b/MdeModulePkg/Include/Ppi/UfsHostController.h index e43321cd32..e2363a48f1 100644 --- a/MdeModulePkg/Include/Ppi/UfsHostController.h +++ b/MdeModulePkg/Include/Ppi/UfsHostController.h @@ -1,53 +1,53 @@ -/** @file
-
-Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EDKII_PEI_UFS_HOST_CONTROLLER_PPI_H_
-#define _EDKII_PEI_UFS_HOST_CONTROLLER_PPI_H_
-
-///
-/// Global ID for the EDKII_UFS_HOST_CONTROLLER_PPI.
-///
-#define EDKII_UFS_HOST_CONTROLLER_PPI_GUID \
- { \
- 0xdc54b283, 0x1a77, 0x4cd6, { 0x83, 0xbb, 0xfd, 0xda, 0x46, 0x9a, 0x2e, 0xc6 } \
- }
-
-///
-/// Forward declaration for the UFS_HOST_CONTROLLER_PPI.
-///
-typedef struct _EDKII_UFS_HOST_CONTROLLER_PPI EDKII_UFS_HOST_CONTROLLER_PPI;
-
-/**
- Get the MMIO base address of UFS host controller.
-
- @param[in] This The protocol instance pointer.
- @param[in] ControllerId The ID of the UFS host controller.
- @param[out] MmioBar Pointer to the UFS host controller MMIO base address.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_GET_MMIO_BAR)(
- IN EDKII_UFS_HOST_CONTROLLER_PPI *This,
- IN UINT8 ControllerId,
- OUT UINTN *MmioBar
- );
-
-///
-/// This PPI contains a set of services to interact with the UFS host controller.
-///
-struct _EDKII_UFS_HOST_CONTROLLER_PPI {
- EDKII_UFS_HC_GET_MMIO_BAR GetUfsHcMmioBar;
-};
-
-extern EFI_GUID gEdkiiPeiUfsHostControllerPpiGuid;
-
-#endif
+/** @file + +Copyright (c) 2014, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_PEI_UFS_HOST_CONTROLLER_PPI_H_ +#define _EDKII_PEI_UFS_HOST_CONTROLLER_PPI_H_ + +/// +/// Global ID for the EDKII_UFS_HOST_CONTROLLER_PPI. +/// +#define EDKII_UFS_HOST_CONTROLLER_PPI_GUID \ + { \ + 0xdc54b283, 0x1a77, 0x4cd6, { 0x83, 0xbb, 0xfd, 0xda, 0x46, 0x9a, 0x2e, 0xc6 } \ + } + +/// +/// Forward declaration for the UFS_HOST_CONTROLLER_PPI. +/// +typedef struct _EDKII_UFS_HOST_CONTROLLER_PPI EDKII_UFS_HOST_CONTROLLER_PPI; + +/** + Get the MMIO base address of UFS host controller. + + @param[in] This The protocol instance pointer. + @param[in] ControllerId The ID of the UFS host controller. + @param[out] MmioBar Pointer to the UFS host controller MMIO base address. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_GET_MMIO_BAR)( + IN EDKII_UFS_HOST_CONTROLLER_PPI *This, + IN UINT8 ControllerId, + OUT UINTN *MmioBar + ); + +/// +/// This PPI contains a set of services to interact with the UFS host controller. +/// +struct _EDKII_UFS_HOST_CONTROLLER_PPI { + EDKII_UFS_HC_GET_MMIO_BAR GetUfsHcMmioBar; +}; + +extern EFI_GUID gEdkiiPeiUfsHostControllerPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/Usb2HostController.h b/MdeModulePkg/Include/Ppi/Usb2HostController.h index e979e9ebec..a336119e88 100644 --- a/MdeModulePkg/Include/Ppi/Usb2HostController.h +++ b/MdeModulePkg/Include/Ppi/Usb2HostController.h @@ -1,261 +1,261 @@ -/** @file
- Defines the USB Host Controller PPI that provides I/O services for a USB Host
- Controller that may be used to access recovery devices. These interfaces are
- modeled on the UEFI 2.3 specification EFI_USB2_HOST_CONTROLLER_PROTOCOL.
- Refer to section 16.1 of the UEFI 2.3 Specification for more information on
- these interfaces.
-
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PEI_USB2_HOST_CONTROLLER_PPI_H_
-#define _PEI_USB2_HOST_CONTROLLER_PPI_H_
-
-#include <Protocol/Usb2HostController.h>
-
-///
-/// Global ID for the PEI_USB2_HOST_CONTROLLER_PPI.
-///
-#define PEI_USB2_HOST_CONTROLLER_PPI_GUID \
- { \
- 0xa7d09fe1, 0x74d4, 0x4ba5, { 0x84, 0x7c, 0x12, 0xed, 0x5b, 0x19, 0xad, 0xe4 } \
- }
-
-///
-/// Forward declaration for the PEI_USB2_HOST_CONTROLLER_PPI.
-///
-typedef struct _PEI_USB2_HOST_CONTROLLER_PPI PEI_USB2_HOST_CONTROLLER_PPI;
-
-/**
- Initiate a USB control transfer using a specific USB Host controller on the USB bus.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB2_HOST_CONTROLLER_PPI.
- @param[in] DeviceAddress Represents the address of the target device
- on the USB.
- @param[in] DeviceSpeed Indicates device speed.
- @param[in] MaximumPacketLength Indicates the maximum packet size that the
- default control transfer
- endpoint is capable of sending or receiving.
- @param[in] Request A pointer to the USB device request that
- will be sent to the USB device.
- @param[in] TransferDirection Specifies the data direction for the transfer.
- There are three values available:
- EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
- @param[in,out] Data A pointer to the buffer of data that will
- be transmitted to USB device or
- received from USB device.
- @param[in,out] DataLength On input, indicates the size, in bytes, of
- the data buffer specified by Data.
- On output, indicates the amount of data
- actually transferred.
- @param[in] TimeOut Indicates the maximum time, in milliseconds,
- that the transfer is allowed to complete.
- If Timeout is 0, then the caller must wait for
- the function to be completed until EFI_SUCCESS
- or EFI_DEVICE_ERROR is returned.
- @param[in] Translator A pointer to the transaction translator data.
- @param[out] TransferResult A pointer to the detailed result information
- generated by this control transfer.
-
- @retval EFI_SUCCESS The control transfer was completed successfully.
- @retval EFI_DEVICE_ERROR The control transfer failed due to host controller
- or device error.
- @retval EFI_INVALID_PARAMETER Some parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources.
- @retval EFI_TIMEOUT The control transfer failed due to timeout.
-
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB2_HOST_CONTROLLER_CONTROL_TRANSFER)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB2_HOST_CONTROLLER_PPI *This,
- IN UINT8 DeviceAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data OPTIONAL,
- IN OUT UINTN *DataLength OPTIONAL,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-/**
- Initiate a USB bulk transfer using a specific USB Host controller on the USB bus.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB2_HOST_CONTROLLER_PPI.
- @param[in] DeviceAddress Represents the address of the target device
- on the USB.
- @param[in] EndPointAddress The combination of an endpoint number and
- an endpoint direction of the target USB device.
- @param[in] DeviceSpeed Indicates device speed.
- @param[in] MaximumPacketLength Indicates the maximum packet size the target
- endpoint is capable of sending or receiving.
- @param[in,out] Data Array of pointers to the buffers of data
- that will be transmitted to USB device or
- received from USB device.
- @param[in,out] DataLength When input, indicates the size, in bytes, of
- the data buffers specified by Data. When output,
- indicates the data size actually transferred.
- @param[in,out] DataToggle A pointer to the data toggle value.
- @param[in] TimeOut Indicates the maximum time, in milliseconds,
- in which the transfer is allowed to complete.
- If Timeout is 0, then the caller must wait for
- the function to be completed until EFI_SUCCESS
- or EFI_DEVICE_ERROR is returned.
- @param[in] Translator A pointer to the transaction translator data.
- @param[out] TransferResult A pointer to the detailed result information
- of the bulk transfer.
-
- @retval EFI_SUCCESS The bulk transfer was completed successfully.
- @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.
- Caller should check TransferResult for detailed error information.
- @retval EFI_INVALID_PARAMETER Some parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be submitted due to a lack of resources.
- @retval EFI_TIMEOUT The bulk transfer failed due to timeout.
-
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB2_HOST_CONTROLLER_BULK_TRANSFER)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB2_HOST_CONTROLLER_PPI *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-/**
- Retrieves the number of root hub ports.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB2_HOST_CONTROLLER_PPI.
- @param[out] PortNumber The pointer to the number of the root hub ports.
-
- @retval EFI_SUCCESS The port number was retrieved successfully.
- @retval EFI_INVALID_PARAMETER PortNumber is NULL.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB2_HOST_CONTROLLER_PPI *This,
- OUT UINT8 *PortNumber
- );
-
-/**
- Retrieves the current status of a USB root hub port.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB2_HOST_CONTROLLER_PPI.
- @param[in] PortNumber Specifies the root hub port from which the status is
- to be retrieved.
- This value is zero based.
- @param[out] PortStatus A pointer to the current port status bits and port
- status change bits.
-
- @retval EFI_SUCCESS The status of the USB root hub port specified by
- PortNumber was returned in PortStatus.
- @retval EFI_INVALID_PARAMETER PortNumber is invalid.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB2_HOST_CONTROLLER_PPI *This,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
- );
-
-/**
- Sets a feature for the specified root hub port.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB2_HOST_CONTROLLER_PPI.
- @param[in] PortNumber Specifies the root hub port whose feature is requested
- to be set. This value is zero based.
- @param[in] PortFeature Indicates the feature selector associated with the feature
- set request.
-
- @retval EFI_SUCCESS The feature specified by PortFeature was set for
- the USB root hub port specified by PortNumber.
- @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid
- for this function.
- @retval EFI_TIMEOUT The time out occurred
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB2_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB2_HOST_CONTROLLER_PPI *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-/**
- Clears a feature for the specified root hub port.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB2_HOST_CONTROLLER_PPI.
- @param[in] PortNumber Specifies the root hub port whose feature is
- requested to be cleared.
- @param[in] PortFeature Indicates the feature selector associated with the
- feature clear request.
-
- @return EFI_SUCCESS The feature specified by PortFeature was cleared
- for the USB root hub port specified by PortNumber.
- @return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB2_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB2_HOST_CONTROLLER_PPI *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-///
-/// This PPI contains a set of services to interact with the USB host controller.
-/// These interfaces are modeled on the UEFI 2.3 specification protocol
-/// EFI_USB2_HOST_CONTROLLER_PROTOCOL. Refer to section 16.1 of the UEFI 2.3
-/// Specification for more information on these interfaces.
-///
-struct _PEI_USB2_HOST_CONTROLLER_PPI {
- PEI_USB2_HOST_CONTROLLER_CONTROL_TRANSFER ControlTransfer;
- PEI_USB2_HOST_CONTROLLER_BULK_TRANSFER BulkTransfer;
- PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber;
- PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;
- PEI_USB2_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;
- PEI_USB2_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;
-};
-
-extern EFI_GUID gPeiUsb2HostControllerPpiGuid;
-
-#endif
+/** @file + Defines the USB Host Controller PPI that provides I/O services for a USB Host + Controller that may be used to access recovery devices. These interfaces are + modeled on the UEFI 2.3 specification EFI_USB2_HOST_CONTROLLER_PROTOCOL. + Refer to section 16.1 of the UEFI 2.3 Specification for more information on + these interfaces. + +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PEI_USB2_HOST_CONTROLLER_PPI_H_ +#define _PEI_USB2_HOST_CONTROLLER_PPI_H_ + +#include <Protocol/Usb2HostController.h> + +/// +/// Global ID for the PEI_USB2_HOST_CONTROLLER_PPI. +/// +#define PEI_USB2_HOST_CONTROLLER_PPI_GUID \ + { \ + 0xa7d09fe1, 0x74d4, 0x4ba5, { 0x84, 0x7c, 0x12, 0xed, 0x5b, 0x19, 0xad, 0xe4 } \ + } + +/// +/// Forward declaration for the PEI_USB2_HOST_CONTROLLER_PPI. +/// +typedef struct _PEI_USB2_HOST_CONTROLLER_PPI PEI_USB2_HOST_CONTROLLER_PPI; + +/** + Initiate a USB control transfer using a specific USB Host controller on the USB bus. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB2_HOST_CONTROLLER_PPI. + @param[in] DeviceAddress Represents the address of the target device + on the USB. + @param[in] DeviceSpeed Indicates device speed. + @param[in] MaximumPacketLength Indicates the maximum packet size that the + default control transfer + endpoint is capable of sending or receiving. + @param[in] Request A pointer to the USB device request that + will be sent to the USB device. + @param[in] TransferDirection Specifies the data direction for the transfer. + There are three values available: + EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData. + @param[in,out] Data A pointer to the buffer of data that will + be transmitted to USB device or + received from USB device. + @param[in,out] DataLength On input, indicates the size, in bytes, of + the data buffer specified by Data. + On output, indicates the amount of data + actually transferred. + @param[in] TimeOut Indicates the maximum time, in milliseconds, + that the transfer is allowed to complete. + If Timeout is 0, then the caller must wait for + the function to be completed until EFI_SUCCESS + or EFI_DEVICE_ERROR is returned. + @param[in] Translator A pointer to the transaction translator data. + @param[out] TransferResult A pointer to the detailed result information + generated by this control transfer. + + @retval EFI_SUCCESS The control transfer was completed successfully. + @retval EFI_DEVICE_ERROR The control transfer failed due to host controller + or device error. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources. + @retval EFI_TIMEOUT The control transfer failed due to timeout. + + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB2_HOST_CONTROLLER_CONTROL_TRANSFER)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB2_HOST_CONTROLLER_PPI *This, + IN UINT8 DeviceAddress, + IN UINT8 DeviceSpeed, + IN UINTN MaximumPacketLength, + IN USB_DEVICE_REQUEST *Request, + IN EFI_USB_DATA_DIRECTION TransferDirection, + IN OUT VOID *Data OPTIONAL, + IN OUT UINTN *DataLength OPTIONAL, + IN UINTN TimeOut, + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, + OUT UINT32 *TransferResult + ); + +/** + Initiate a USB bulk transfer using a specific USB Host controller on the USB bus. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB2_HOST_CONTROLLER_PPI. + @param[in] DeviceAddress Represents the address of the target device + on the USB. + @param[in] EndPointAddress The combination of an endpoint number and + an endpoint direction of the target USB device. + @param[in] DeviceSpeed Indicates device speed. + @param[in] MaximumPacketLength Indicates the maximum packet size the target + endpoint is capable of sending or receiving. + @param[in,out] Data Array of pointers to the buffers of data + that will be transmitted to USB device or + received from USB device. + @param[in,out] DataLength When input, indicates the size, in bytes, of + the data buffers specified by Data. When output, + indicates the data size actually transferred. + @param[in,out] DataToggle A pointer to the data toggle value. + @param[in] TimeOut Indicates the maximum time, in milliseconds, + in which the transfer is allowed to complete. + If Timeout is 0, then the caller must wait for + the function to be completed until EFI_SUCCESS + or EFI_DEVICE_ERROR is returned. + @param[in] Translator A pointer to the transaction translator data. + @param[out] TransferResult A pointer to the detailed result information + of the bulk transfer. + + @retval EFI_SUCCESS The bulk transfer was completed successfully. + @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error. + Caller should check TransferResult for detailed error information. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be submitted due to a lack of resources. + @retval EFI_TIMEOUT The bulk transfer failed due to timeout. + + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB2_HOST_CONTROLLER_BULK_TRANSFER)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB2_HOST_CONTROLLER_PPI *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 DeviceSpeed, + IN UINTN MaximumPacketLength, + IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM], + IN OUT UINTN *DataLength, + IN OUT UINT8 *DataToggle, + IN UINTN TimeOut, + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, + OUT UINT32 *TransferResult + ); + +/** + Retrieves the number of root hub ports. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB2_HOST_CONTROLLER_PPI. + @param[out] PortNumber The pointer to the number of the root hub ports. + + @retval EFI_SUCCESS The port number was retrieved successfully. + @retval EFI_INVALID_PARAMETER PortNumber is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB2_HOST_CONTROLLER_PPI *This, + OUT UINT8 *PortNumber + ); + +/** + Retrieves the current status of a USB root hub port. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB2_HOST_CONTROLLER_PPI. + @param[in] PortNumber Specifies the root hub port from which the status is + to be retrieved. + This value is zero based. + @param[out] PortStatus A pointer to the current port status bits and port + status change bits. + + @retval EFI_SUCCESS The status of the USB root hub port specified by + PortNumber was returned in PortStatus. + @retval EFI_INVALID_PARAMETER PortNumber is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB2_HOST_CONTROLLER_PPI *This, + IN UINT8 PortNumber, + OUT EFI_USB_PORT_STATUS *PortStatus + ); + +/** + Sets a feature for the specified root hub port. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB2_HOST_CONTROLLER_PPI. + @param[in] PortNumber Specifies the root hub port whose feature is requested + to be set. This value is zero based. + @param[in] PortFeature Indicates the feature selector associated with the feature + set request. + + @retval EFI_SUCCESS The feature specified by PortFeature was set for + the USB root hub port specified by PortNumber. + @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid + for this function. + @retval EFI_TIMEOUT The time out occurred + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB2_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB2_HOST_CONTROLLER_PPI *This, + IN UINT8 PortNumber, + IN EFI_USB_PORT_FEATURE PortFeature + ); + +/** + Clears a feature for the specified root hub port. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB2_HOST_CONTROLLER_PPI. + @param[in] PortNumber Specifies the root hub port whose feature is + requested to be cleared. + @param[in] PortFeature Indicates the feature selector associated with the + feature clear request. + + @return EFI_SUCCESS The feature specified by PortFeature was cleared + for the USB root hub port specified by PortNumber. + @return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB2_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB2_HOST_CONTROLLER_PPI *This, + IN UINT8 PortNumber, + IN EFI_USB_PORT_FEATURE PortFeature + ); + +/// +/// This PPI contains a set of services to interact with the USB host controller. +/// These interfaces are modeled on the UEFI 2.3 specification protocol +/// EFI_USB2_HOST_CONTROLLER_PROTOCOL. Refer to section 16.1 of the UEFI 2.3 +/// Specification for more information on these interfaces. +/// +struct _PEI_USB2_HOST_CONTROLLER_PPI { + PEI_USB2_HOST_CONTROLLER_CONTROL_TRANSFER ControlTransfer; + PEI_USB2_HOST_CONTROLLER_BULK_TRANSFER BulkTransfer; + PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber; + PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus; + PEI_USB2_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature; + PEI_USB2_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature; +}; + +extern EFI_GUID gPeiUsb2HostControllerPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/UsbController.h b/MdeModulePkg/Include/Ppi/UsbController.h index 5f2db2b62f..29fd5f8a89 100644 --- a/MdeModulePkg/Include/Ppi/UsbController.h +++ b/MdeModulePkg/Include/Ppi/UsbController.h @@ -1,87 +1,87 @@ -/** @file
- Define APIs to retrieve USB Host Controller Info such as controller type and
- I/O Port Base Address.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PEI_USB_CONTROLLER_PPI_H_
-#define _PEI_USB_CONTROLLER_PPI_H_
-
-///
-/// Global ID for the PEI_USB_CONTROLLER_PPI.
-///
-#define PEI_USB_CONTROLLER_PPI_GUID \
- { \
- 0x3bc1f6de, 0x693e, 0x4547,{ 0xa3, 0x0, 0x21, 0x82, 0x3c, 0xa4, 0x20, 0xb2} \
- }
-
-///
-/// Forward declaration for the PEI_USB_CONTROLLER_PPI.
-///
-typedef struct _PEI_USB_CONTROLLER_PPI PEI_USB_CONTROLLER_PPI;
-
-///
-/// This bit is used in the ControllerType return parameter of GetUsbController()
-/// to identify the USB Host Controller type as UHCI
-///
-#define PEI_UHCI_CONTROLLER 0x01
-
-///
-/// This bit is used in the ControllerType return parameter of GetUsbController()
-/// to identify the USB Host Controller type as OHCI
-///
-#define PEI_OHCI_CONTROLLER 0x02
-
-///
-/// This bit is used in the ControllerType return parameter of GetUsbController()
-/// to identify the USB Host Controller type as EHCI
-///
-#define PEI_EHCI_CONTROLLER 0x03
-
-///
-/// This bit is used in the ControllerType return parameter of GetUsbController()
-/// to identify the USB Host Controller type as XHCI
-///
-#define PEI_XHCI_CONTROLLER 0x04
-
-/**
- Retrieve USB Host Controller Info such as controller type and I/O Base Address.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the PEI_USB_CONTROLLER_PPI.
- @param[in] ControllerId The ID of the USB controller.
- @param[out] ControllerType On output, returns the type of the USB controller.
- @param[out] BaseAddress On output, returns the base address of UHCI's I/O ports
- if UHCI is enabled or the base address of EHCI's MMIO
- if EHCI is enabled.
-
- @retval EFI_SUCCESS USB controller attributes were returned successfully.
- @retval EFI_INVALID_PARAMETER ControllerId is greater than the maximum number
- of USB controller supported by this platform.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_GET_USB_CONTROLLER)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_CONTROLLER_PPI *This,
- IN UINT8 UsbControllerId,
- OUT UINTN *ControllerType,
- OUT UINTN *BaseAddress
- );
-
-///
-/// This PPI contains a single service to retrieve the USB Host Controller type
-/// and the base address of the I/O ports used to access the USB Host Controller.
-///
-struct _PEI_USB_CONTROLLER_PPI {
- PEI_GET_USB_CONTROLLER GetUsbController;
-};
-
-extern EFI_GUID gPeiUsbControllerPpiGuid;
-
-#endif
+/** @file + Define APIs to retrieve USB Host Controller Info such as controller type and + I/O Port Base Address. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PEI_USB_CONTROLLER_PPI_H_ +#define _PEI_USB_CONTROLLER_PPI_H_ + +/// +/// Global ID for the PEI_USB_CONTROLLER_PPI. +/// +#define PEI_USB_CONTROLLER_PPI_GUID \ + { \ + 0x3bc1f6de, 0x693e, 0x4547,{ 0xa3, 0x0, 0x21, 0x82, 0x3c, 0xa4, 0x20, 0xb2} \ + } + +/// +/// Forward declaration for the PEI_USB_CONTROLLER_PPI. +/// +typedef struct _PEI_USB_CONTROLLER_PPI PEI_USB_CONTROLLER_PPI; + +/// +/// This bit is used in the ControllerType return parameter of GetUsbController() +/// to identify the USB Host Controller type as UHCI +/// +#define PEI_UHCI_CONTROLLER 0x01 + +/// +/// This bit is used in the ControllerType return parameter of GetUsbController() +/// to identify the USB Host Controller type as OHCI +/// +#define PEI_OHCI_CONTROLLER 0x02 + +/// +/// This bit is used in the ControllerType return parameter of GetUsbController() +/// to identify the USB Host Controller type as EHCI +/// +#define PEI_EHCI_CONTROLLER 0x03 + +/// +/// This bit is used in the ControllerType return parameter of GetUsbController() +/// to identify the USB Host Controller type as XHCI +/// +#define PEI_XHCI_CONTROLLER 0x04 + +/** + Retrieve USB Host Controller Info such as controller type and I/O Base Address. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the PEI_USB_CONTROLLER_PPI. + @param[in] ControllerId The ID of the USB controller. + @param[out] ControllerType On output, returns the type of the USB controller. + @param[out] BaseAddress On output, returns the base address of UHCI's I/O ports + if UHCI is enabled or the base address of EHCI's MMIO + if EHCI is enabled. + + @retval EFI_SUCCESS USB controller attributes were returned successfully. + @retval EFI_INVALID_PARAMETER ControllerId is greater than the maximum number + of USB controller supported by this platform. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_GET_USB_CONTROLLER)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_CONTROLLER_PPI *This, + IN UINT8 UsbControllerId, + OUT UINTN *ControllerType, + OUT UINTN *BaseAddress + ); + +/// +/// This PPI contains a single service to retrieve the USB Host Controller type +/// and the base address of the I/O ports used to access the USB Host Controller. +/// +struct _PEI_USB_CONTROLLER_PPI { + PEI_GET_USB_CONTROLLER GetUsbController; +}; + +extern EFI_GUID gPeiUsbControllerPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/UsbHostController.h b/MdeModulePkg/Include/Ppi/UsbHostController.h index cf468f9478..7a1474e1b6 100644 --- a/MdeModulePkg/Include/Ppi/UsbHostController.h +++ b/MdeModulePkg/Include/Ppi/UsbHostController.h @@ -1,249 +1,249 @@ -/** @file
- Defines the USB Host Controller PPI that provides I/O services for a USB Host
- Controller that may be used to access recovery devices. These interfaces are
- modeled on the UEFI 2.3 specification EFI_USB2_HOST_CONTROLLER_PROTOCOL.
- Refer to section 16.1 of the UEFI 2.3 Specification for more information on
- these interfaces.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PEI_USB_HOST_CONTROLLER_PPI_H_
-#define _PEI_USB_HOST_CONTROLLER_PPI_H_
-
-#include <Protocol/Usb2HostController.h>
-
-///
-/// Global ID for the PEI_USB_HOST_CONTROLLER_PPI.
-///
-#define PEI_USB_HOST_CONTROLLER_PPI_GUID \
- { \
- 0x652b38a9, 0x77f4, 0x453f, { 0x89, 0xd5, 0xe7, 0xbd, 0xc3, 0x52, 0xfc, 0x53} \
- }
-
-///
-/// Forward declaration for the PEI_USB_HOST_CONTROLLER_PPI.
-///
-typedef struct _PEI_USB_HOST_CONTROLLER_PPI PEI_USB_HOST_CONTROLLER_PPI;
-
-/**
- Initiate a USB control transfer using a specific USB Host controller on the USB bus.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB_HOST_CONTROLLER_PPI.
- @param[in] DeviceAddress Represents the address of the target device
- on the USB.
- @param[in] DeviceSpeed Indicates device speed.
- @param[in] MaximumPacketLength Indicates the maximum packet size that the
- default control transfer
- endpoint is capable of sending or receiving.
- @param[in] Request A pointer to the USB device request that
- will be sent to the USB device.
- @param[in] TransferDirection Specifies the data direction for the transfer.
- There are three values available:
- EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
- @param[in,out] Data A pointer to the buffer of data that will
- be transmitted to USB device or
- received from USB device.
- @param[in,out] DataLength On input, indicates the size, in bytes, of
- the data buffer specified by Data.
- On output, indicates the amount of data
- actually transferred.
- @param[in] TimeOut Indicates the maximum time, in milliseconds,
- that the transfer is allowed to complete.
- If Timeout is 0, then the caller must wait for
- the function to be completed until EFI_SUCCESS
- or EFI_DEVICE_ERROR is returned.
- @param[out] TransferResult A pointer to the detailed result information
- generated by this control transfer.
-
- @retval EFI_DEVICE_ERROR The control transfer failed due to host controller
- or device error.
- @retval EFI_SUCCESS The control transfer was completed successfully.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *This,
- IN UINT8 DeviceAddress,
- IN UINT8 DeviceSpeed,
- IN UINT8 MaximumPacketLength,
- IN USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data OPTIONAL,
- IN OUT UINTN *DataLength OPTIONAL,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- );
-
-/**
- Initiate a USB bulk transfer using a specific USB Host controller on the USB bus.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB_HOST_CONTROLLER_PPI.
- @param[in] DeviceAddress Represents the address of the target device
- on the USB.
- @param[in] EndPointAddress The combination of an endpoint number and
- an endpoint direction of the target USB device.
- @param[in] MaximumPacketLength Indicates the maximum packet size the target
- endpoint is capable of sending or receiving.
- @param[in,out] Data Array of pointers to the buffers of data
- that will be transmitted to USB device or
- received from USB device.
- @param[in,out] DataLength When input, indicates the size, in bytes, of
- the data buffers specified by Data. When output,
- indicates the data size actually transferred.
- @param[in,out] DataToggle A pointer to the data toggle value.
- @param[in] TimeOut Indicates the maximum time, in milliseconds,
- in which the transfer is allowed to complete.
- If Timeout is 0, then the caller must wait for
- the function to be completed until EFI_SUCCESS
- or EFI_DEVICE_ERROR is returned.
- @param[out] TransferResult A pointer to the detailed result information
- of the bulk transfer.
-
- @retval EFI_SUCCESS The bulk transfer was completed successfully.
- @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.
- Caller should check TransferResult for detailed error information.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_HOST_CONTROLLER_BULK_TRANSFER)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- );
-
-/**
- Retrieves the number of root hub ports.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB_HOST_CONTROLLER_PPI.
- @param[out] PortNumber The pointer to the number of the root hub ports.
-
- @retval EFI_SUCCESS The port number was retrieved successfully.
- @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve
- the port number.
- @retval EFI_INVALID_PARAMETER PortNumber is NULL.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *This,
- OUT UINT8 *PortNumber
- );
-
-/**
- Retrieves the current status of a USB root hub port.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB_HOST_CONTROLLER_PPI.
- @param[in] PortNumber Specifies the root hub port from which the status is
- to be retrieved.
- This value is zero based.
- @param[out] PortStatus A pointer to the current port status bits and port
- status change bits.
-
- @retval EFI_SUCCESS The status of the USB root hub port specified by
- PortNumber was returned in PortStatus.
- @retval EFI_INVALID_PARAMETER PortNumber is invalid.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *This,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
- );
-
-/**
- Sets a feature for the specified root hub port.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB_HOST_CONTROLLER_PPI.
- @param[in] PortNumber Specifies the root hub port whose feature is requested
- to be set. This value is zero based.
- @param[in] PortFeature Indicates the feature selector associated with the feature
- set request.
-
- @retval EFI_SUCCESS The feature specified by PortFeature was set for
- the USB root hub port specified by PortNumber.
- @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid
- for this function.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-/**
- Clears a feature for the specified root hub port.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the
- PEI_USB_HOST_CONTROLLER_PPI.
- @param[in] PortNumber Specifies the root hub port whose feature is
- requested to be cleared.
- @param[in] PortFeature Indicates the feature selector associated with the
- feature clear request.
-
- @return EFI_SUCCESS The feature specified by PortFeature was cleared
- for the USB root hub port specified by PortNumber.
- @return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
- @return EFI_DEVICE_ERROR Can't read the register.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-///
-/// This PPI contains a set of services to interact with the USB host controller.
-/// These interfaces are modeled on the UEFI 2.3 specification protocol
-/// EFI_USB2_HOST_CONTROLLER_PROTOCOL. Refer to section 16.1 of the UEFI 2.3
-/// Specification for more information on these interfaces.
-///
-struct _PEI_USB_HOST_CONTROLLER_PPI {
- PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER ControlTransfer;
- PEI_USB_HOST_CONTROLLER_BULK_TRANSFER BulkTransfer;
- PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber;
- PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;
- PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;
- PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;
-};
-
-extern EFI_GUID gPeiUsbHostControllerPpiGuid;
-
-#endif
+/** @file + Defines the USB Host Controller PPI that provides I/O services for a USB Host + Controller that may be used to access recovery devices. These interfaces are + modeled on the UEFI 2.3 specification EFI_USB2_HOST_CONTROLLER_PROTOCOL. + Refer to section 16.1 of the UEFI 2.3 Specification for more information on + these interfaces. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PEI_USB_HOST_CONTROLLER_PPI_H_ +#define _PEI_USB_HOST_CONTROLLER_PPI_H_ + +#include <Protocol/Usb2HostController.h> + +/// +/// Global ID for the PEI_USB_HOST_CONTROLLER_PPI. +/// +#define PEI_USB_HOST_CONTROLLER_PPI_GUID \ + { \ + 0x652b38a9, 0x77f4, 0x453f, { 0x89, 0xd5, 0xe7, 0xbd, 0xc3, 0x52, 0xfc, 0x53} \ + } + +/// +/// Forward declaration for the PEI_USB_HOST_CONTROLLER_PPI. +/// +typedef struct _PEI_USB_HOST_CONTROLLER_PPI PEI_USB_HOST_CONTROLLER_PPI; + +/** + Initiate a USB control transfer using a specific USB Host controller on the USB bus. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB_HOST_CONTROLLER_PPI. + @param[in] DeviceAddress Represents the address of the target device + on the USB. + @param[in] DeviceSpeed Indicates device speed. + @param[in] MaximumPacketLength Indicates the maximum packet size that the + default control transfer + endpoint is capable of sending or receiving. + @param[in] Request A pointer to the USB device request that + will be sent to the USB device. + @param[in] TransferDirection Specifies the data direction for the transfer. + There are three values available: + EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData. + @param[in,out] Data A pointer to the buffer of data that will + be transmitted to USB device or + received from USB device. + @param[in,out] DataLength On input, indicates the size, in bytes, of + the data buffer specified by Data. + On output, indicates the amount of data + actually transferred. + @param[in] TimeOut Indicates the maximum time, in milliseconds, + that the transfer is allowed to complete. + If Timeout is 0, then the caller must wait for + the function to be completed until EFI_SUCCESS + or EFI_DEVICE_ERROR is returned. + @param[out] TransferResult A pointer to the detailed result information + generated by this control transfer. + + @retval EFI_DEVICE_ERROR The control transfer failed due to host controller + or device error. + @retval EFI_SUCCESS The control transfer was completed successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_HOST_CONTROLLER_PPI *This, + IN UINT8 DeviceAddress, + IN UINT8 DeviceSpeed, + IN UINT8 MaximumPacketLength, + IN USB_DEVICE_REQUEST *Request, + IN EFI_USB_DATA_DIRECTION TransferDirection, + IN OUT VOID *Data OPTIONAL, + IN OUT UINTN *DataLength OPTIONAL, + IN UINTN TimeOut, + OUT UINT32 *TransferResult + ); + +/** + Initiate a USB bulk transfer using a specific USB Host controller on the USB bus. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB_HOST_CONTROLLER_PPI. + @param[in] DeviceAddress Represents the address of the target device + on the USB. + @param[in] EndPointAddress The combination of an endpoint number and + an endpoint direction of the target USB device. + @param[in] MaximumPacketLength Indicates the maximum packet size the target + endpoint is capable of sending or receiving. + @param[in,out] Data Array of pointers to the buffers of data + that will be transmitted to USB device or + received from USB device. + @param[in,out] DataLength When input, indicates the size, in bytes, of + the data buffers specified by Data. When output, + indicates the data size actually transferred. + @param[in,out] DataToggle A pointer to the data toggle value. + @param[in] TimeOut Indicates the maximum time, in milliseconds, + in which the transfer is allowed to complete. + If Timeout is 0, then the caller must wait for + the function to be completed until EFI_SUCCESS + or EFI_DEVICE_ERROR is returned. + @param[out] TransferResult A pointer to the detailed result information + of the bulk transfer. + + @retval EFI_SUCCESS The bulk transfer was completed successfully. + @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error. + Caller should check TransferResult for detailed error information. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_HOST_CONTROLLER_BULK_TRANSFER)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_HOST_CONTROLLER_PPI *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 MaximumPacketLength, + IN OUT VOID *Data, + IN OUT UINTN *DataLength, + IN OUT UINT8 *DataToggle, + IN UINTN TimeOut, + OUT UINT32 *TransferResult + ); + +/** + Retrieves the number of root hub ports. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB_HOST_CONTROLLER_PPI. + @param[out] PortNumber The pointer to the number of the root hub ports. + + @retval EFI_SUCCESS The port number was retrieved successfully. + @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve + the port number. + @retval EFI_INVALID_PARAMETER PortNumber is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_HOST_CONTROLLER_PPI *This, + OUT UINT8 *PortNumber + ); + +/** + Retrieves the current status of a USB root hub port. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB_HOST_CONTROLLER_PPI. + @param[in] PortNumber Specifies the root hub port from which the status is + to be retrieved. + This value is zero based. + @param[out] PortStatus A pointer to the current port status bits and port + status change bits. + + @retval EFI_SUCCESS The status of the USB root hub port specified by + PortNumber was returned in PortStatus. + @retval EFI_INVALID_PARAMETER PortNumber is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_HOST_CONTROLLER_PPI *This, + IN UINT8 PortNumber, + OUT EFI_USB_PORT_STATUS *PortStatus + ); + +/** + Sets a feature for the specified root hub port. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB_HOST_CONTROLLER_PPI. + @param[in] PortNumber Specifies the root hub port whose feature is requested + to be set. This value is zero based. + @param[in] PortFeature Indicates the feature selector associated with the feature + set request. + + @retval EFI_SUCCESS The feature specified by PortFeature was set for + the USB root hub port specified by PortNumber. + @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid + for this function. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_HOST_CONTROLLER_PPI *This, + IN UINT8 PortNumber, + IN EFI_USB_PORT_FEATURE PortFeature + ); + +/** + Clears a feature for the specified root hub port. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the + PEI_USB_HOST_CONTROLLER_PPI. + @param[in] PortNumber Specifies the root hub port whose feature is + requested to be cleared. + @param[in] PortFeature Indicates the feature selector associated with the + feature clear request. + + @return EFI_SUCCESS The feature specified by PortFeature was cleared + for the USB root hub port specified by PortNumber. + @return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid. + @return EFI_DEVICE_ERROR Can't read the register. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_HOST_CONTROLLER_PPI *This, + IN UINT8 PortNumber, + IN EFI_USB_PORT_FEATURE PortFeature + ); + +/// +/// This PPI contains a set of services to interact with the USB host controller. +/// These interfaces are modeled on the UEFI 2.3 specification protocol +/// EFI_USB2_HOST_CONTROLLER_PROTOCOL. Refer to section 16.1 of the UEFI 2.3 +/// Specification for more information on these interfaces. +/// +struct _PEI_USB_HOST_CONTROLLER_PPI { + PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER ControlTransfer; + PEI_USB_HOST_CONTROLLER_BULK_TRANSFER BulkTransfer; + PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber; + PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus; + PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature; + PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature; +}; + +extern EFI_GUID gPeiUsbHostControllerPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Ppi/UsbIo.h b/MdeModulePkg/Include/Ppi/UsbIo.h index a7122f31ed..34aa67b5f7 100644 --- a/MdeModulePkg/Include/Ppi/UsbIo.h +++ b/MdeModulePkg/Include/Ppi/UsbIo.h @@ -1,189 +1,189 @@ -/** @file
- Defines the PEI_USB_IO_PPI that the USB-related PEIM can use for I/O operations
- on the USB BUS. This interface enables recovery from a
- USB-class storage device, such as USB CD/DVD, USB hard drive, or USB FLASH
- drive. These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL.
- Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on
- these interfaces.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PEI_USB_IO_PPI_H_
-#define _PEI_USB_IO_PPI_H_
-
-#include <Protocol/Usb2HostController.h>
-
-///
-/// Global ID for the PEI_USB_IO_PPI.
-///
-#define PEI_USB_IO_PPI_GUID \
- { \
- 0x7c29785c, 0x66b9, 0x49fc, { 0xb7, 0x97, 0x1c, 0xa5, 0x55, 0xe, 0xf2, 0x83} \
- }
-
-///
-/// Forward declaration for the PEI_USB_IO_PPI.
-///
-typedef struct _PEI_USB_IO_PPI PEI_USB_IO_PPI;
-
-/**
- Submits control transfer to a target USB device.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
- @param[in] Request A pointer to the USB device request that will be
- sent to the USB device.
- @param[in] Direction Specifies the data direction for the transfer. There
- are three values available:
- EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
- @param[in] Timeout Indicates the maximum time, in milliseconds, that
- the transfer is allowed to complete.
- If Timeout is 0, then the caller must wait for the
- function to be completed until EFI_SUCCESS or
- EFI_DEVICE_ERROR is returned.
- @param[in,out] Data A pointer to the buffer of data that will be
- transmitted to or received from the USB device.
- @param[in] DataLength On input, indicates the size, in bytes, of the data
- buffer specified by Data.
-
- @retval EFI_SUCCESS The control transfer was completed successfully.
- @retval EFI_INVALID_PARAMETER Some parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due
- to a lack of resources.
- @retval EFI_TIMEOUT The control transfer failed due to timeout.
- @retval EFI_DEVICE_ERROR The control transfer failed due to host controller
- or device error.
- Caller should check TransferResult for detailed
- error information.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_CONTROL_TRANSFER)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT32 Timeout,
- IN OUT VOID *Data OPTIONAL,
- IN UINTN DataLength OPTIONAL
- );
-
-/**
- Submits bulk transfer to a target USB device.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
- @param[in] DeviceEndpoint The endpoint address.
- @param[in] Data The data buffer to be transfered.
- @param[in] DataLength The length of data buffer.
- @param[in] Timeout The timeout for the transfer, in milliseconds.
- If Timeout is 0, then the caller must wait for the
- function to be completed until EFI_SUCCESS or
- EFI_DEVICE_ERROR is returned.
-
- @retval EFI_SUCCESS The bulk transfer completed successfully.
- @retval EFI_INVALID_PARAMETER Some parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be completed due to
- a lack of resources.
- @retval EFI_TIMEOUT The bulk transfer failed due to timeout.
- @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller
- or device error.
- Caller should check TransferResult for detailed
- error information.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_BULK_TRANSFER)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN Timeout
- );
-
-/**
- Get interface descriptor from a USB device.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
- @param[in] InterfaceDescriptor The interface descriptor.
-
- @retval EFI_SUCCESS The interface descriptor was returned.
- @retval EFI_INVALID_PARAMETER Some parameters are invalid.
- @retval EFI_DEVICE_ERROR A device error occurred, the function failed to
- get the interface descriptor.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_GET_INTERFACE_DESCRIPTOR)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor
- );
-
-/**
- Get endpoint descriptor from a USB device.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
- @param[in] EndPointIndex The index of the end point.
- @param[in] EndpointDescriptor The endpoint descriptor.
-
- @retval EFI_SUCCESS The endpoint descriptor was returned.
- @retval EFI_INVALID_PARAMETER Some parameters are invalid.
- @retval EFI_DEVICE_ERROR A device error occurred, the function failed to
- get the endpoint descriptor.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_GET_ENDPOINT_DESCRIPTOR)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN UINT8 EndpointIndex,
- IN EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor
- );
-
-/**
- Issue a port reset to the device.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
-
- @retval EFI_SUCCESS The port reset was issued successfully.
- @retval EFI_INVALID_PARAMETER Some parameters are invalid.
- @retval EFI_DEVICE_ERROR Device error occurred.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PEI_USB_PORT_RESET)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This
- );
-
-///
-/// This PPI contains a set of services to interact with the USB host controller.
-/// These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL.
-/// Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on
-/// these interfaces.
-///
-struct _PEI_USB_IO_PPI {
- PEI_USB_CONTROL_TRANSFER UsbControlTransfer;
- PEI_USB_BULK_TRANSFER UsbBulkTransfer;
- PEI_USB_GET_INTERFACE_DESCRIPTOR UsbGetInterfaceDescriptor;
- PEI_USB_GET_ENDPOINT_DESCRIPTOR UsbGetEndpointDescriptor;
- PEI_USB_PORT_RESET UsbPortReset;
-};
-
-extern EFI_GUID gPeiUsbIoPpiGuid;
-
-#endif
+/** @file + Defines the PEI_USB_IO_PPI that the USB-related PEIM can use for I/O operations + on the USB BUS. This interface enables recovery from a + USB-class storage device, such as USB CD/DVD, USB hard drive, or USB FLASH + drive. These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL. + Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on + these interfaces. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PEI_USB_IO_PPI_H_ +#define _PEI_USB_IO_PPI_H_ + +#include <Protocol/Usb2HostController.h> + +/// +/// Global ID for the PEI_USB_IO_PPI. +/// +#define PEI_USB_IO_PPI_GUID \ + { \ + 0x7c29785c, 0x66b9, 0x49fc, { 0xb7, 0x97, 0x1c, 0xa5, 0x55, 0xe, 0xf2, 0x83} \ + } + +/// +/// Forward declaration for the PEI_USB_IO_PPI. +/// +typedef struct _PEI_USB_IO_PPI PEI_USB_IO_PPI; + +/** + Submits control transfer to a target USB device. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the PEI_USB_IO_PPI. + @param[in] Request A pointer to the USB device request that will be + sent to the USB device. + @param[in] Direction Specifies the data direction for the transfer. There + are three values available: + EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData. + @param[in] Timeout Indicates the maximum time, in milliseconds, that + the transfer is allowed to complete. + If Timeout is 0, then the caller must wait for the + function to be completed until EFI_SUCCESS or + EFI_DEVICE_ERROR is returned. + @param[in,out] Data A pointer to the buffer of data that will be + transmitted to or received from the USB device. + @param[in] DataLength On input, indicates the size, in bytes, of the data + buffer specified by Data. + + @retval EFI_SUCCESS The control transfer was completed successfully. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due + to a lack of resources. + @retval EFI_TIMEOUT The control transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The control transfer failed due to host controller + or device error. + Caller should check TransferResult for detailed + error information. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_CONTROL_TRANSFER)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_IO_PPI *This, + IN EFI_USB_DEVICE_REQUEST *Request, + IN EFI_USB_DATA_DIRECTION Direction, + IN UINT32 Timeout, + IN OUT VOID *Data OPTIONAL, + IN UINTN DataLength OPTIONAL + ); + +/** + Submits bulk transfer to a target USB device. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the PEI_USB_IO_PPI. + @param[in] DeviceEndpoint The endpoint address. + @param[in] Data The data buffer to be transfered. + @param[in] DataLength The length of data buffer. + @param[in] Timeout The timeout for the transfer, in milliseconds. + If Timeout is 0, then the caller must wait for the + function to be completed until EFI_SUCCESS or + EFI_DEVICE_ERROR is returned. + + @retval EFI_SUCCESS The bulk transfer completed successfully. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be completed due to + a lack of resources. + @retval EFI_TIMEOUT The bulk transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller + or device error. + Caller should check TransferResult for detailed + error information. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_BULK_TRANSFER)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_IO_PPI *This, + IN UINT8 DeviceEndpoint, + IN OUT VOID *Data, + IN OUT UINTN *DataLength, + IN UINTN Timeout + ); + +/** + Get interface descriptor from a USB device. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the PEI_USB_IO_PPI. + @param[in] InterfaceDescriptor The interface descriptor. + + @retval EFI_SUCCESS The interface descriptor was returned. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_DEVICE_ERROR A device error occurred, the function failed to + get the interface descriptor. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_GET_INTERFACE_DESCRIPTOR)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_IO_PPI *This, + IN EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor + ); + +/** + Get endpoint descriptor from a USB device. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the PEI_USB_IO_PPI. + @param[in] EndPointIndex The index of the end point. + @param[in] EndpointDescriptor The endpoint descriptor. + + @retval EFI_SUCCESS The endpoint descriptor was returned. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_DEVICE_ERROR A device error occurred, the function failed to + get the endpoint descriptor. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_GET_ENDPOINT_DESCRIPTOR)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_IO_PPI *This, + IN UINT8 EndpointIndex, + IN EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor + ); + +/** + Issue a port reset to the device. + + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of the PEI_USB_IO_PPI. + + @retval EFI_SUCCESS The port reset was issued successfully. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_DEVICE_ERROR Device error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_USB_PORT_RESET)( + IN EFI_PEI_SERVICES **PeiServices, + IN PEI_USB_IO_PPI *This + ); + +/// +/// This PPI contains a set of services to interact with the USB host controller. +/// These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL. +/// Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on +/// these interfaces. +/// +struct _PEI_USB_IO_PPI { + PEI_USB_CONTROL_TRANSFER UsbControlTransfer; + PEI_USB_BULK_TRANSFER UsbBulkTransfer; + PEI_USB_GET_INTERFACE_DESCRIPTOR UsbGetInterfaceDescriptor; + PEI_USB_GET_ENDPOINT_DESCRIPTOR UsbGetEndpointDescriptor; + PEI_USB_PORT_RESET UsbPortReset; +}; + +extern EFI_GUID gPeiUsbIoPpiGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/AtaAtapiPolicy.h b/MdeModulePkg/Include/Protocol/AtaAtapiPolicy.h index 1b8a45344c..fd623d044e 100644 --- a/MdeModulePkg/Include/Protocol/AtaAtapiPolicy.h +++ b/MdeModulePkg/Include/Protocol/AtaAtapiPolicy.h @@ -1,52 +1,52 @@ -/** @file
- ATA ATAPI Policy protocol is produced by platform and consumed by AtaAtapiPassThruDxe
- driver.
-
- Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __ATA_ATAPI_POLICY_H__
-#define __ATA_ATAPI_POLICY_H__
-
-#define EDKII_ATA_ATAPI_POLICY_PROTOCOL_GUID \
- { \
- 0xe59cd769, 0x5083, 0x4f26,{ 0x90, 0x94, 0x6c, 0x91, 0x9f, 0x91, 0x6c, 0x4e } \
- }
-
-typedef struct {
- ///
- /// Protocol version.
- ///
- UINT32 Version;
-
- ///
- /// 0: Disable Power-up in Standby;
- /// 1: Enable Power-up in Standby;
- /// others: Since PUIS setting is non-volatile, platform can use other value than 0/1 to keep hardware PUIS setting.
- ///
- UINT8 PuisEnable;
-
- ///
- /// 0: Disable Device Sleep;
- /// 1: Enable Device Sleep;
- /// others: Ignored.
- ///
- UINT8 DeviceSleepEnable;
-
- ///
- /// 0: Disable Aggressive Device Sleep;
- /// 1: Enable Aggressive Device Sleep;
- /// others: Ignored.
- ///
- UINT8 AggressiveDeviceSleepEnable;
-
- UINT8 Reserved;
-} EDKII_ATA_ATAPI_POLICY_PROTOCOL;
-
-#define EDKII_ATA_ATAPI_POLICY_VERSION 0x00010000
-
-extern EFI_GUID gEdkiiAtaAtapiPolicyProtocolGuid;
-
-#endif
+/** @file + ATA ATAPI Policy protocol is produced by platform and consumed by AtaAtapiPassThruDxe + driver. + + Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __ATA_ATAPI_POLICY_H__ +#define __ATA_ATAPI_POLICY_H__ + +#define EDKII_ATA_ATAPI_POLICY_PROTOCOL_GUID \ + { \ + 0xe59cd769, 0x5083, 0x4f26,{ 0x90, 0x94, 0x6c, 0x91, 0x9f, 0x91, 0x6c, 0x4e } \ + } + +typedef struct { + /// + /// Protocol version. + /// + UINT32 Version; + + /// + /// 0: Disable Power-up in Standby; + /// 1: Enable Power-up in Standby; + /// others: Since PUIS setting is non-volatile, platform can use other value than 0/1 to keep hardware PUIS setting. + /// + UINT8 PuisEnable; + + /// + /// 0: Disable Device Sleep; + /// 1: Enable Device Sleep; + /// others: Ignored. + /// + UINT8 DeviceSleepEnable; + + /// + /// 0: Disable Aggressive Device Sleep; + /// 1: Enable Aggressive Device Sleep; + /// others: Ignored. + /// + UINT8 AggressiveDeviceSleepEnable; + + UINT8 Reserved; +} EDKII_ATA_ATAPI_POLICY_PROTOCOL; + +#define EDKII_ATA_ATAPI_POLICY_VERSION 0x00010000 + +extern EFI_GUID gEdkiiAtaAtapiPolicyProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/BootLogo.h b/MdeModulePkg/Include/Protocol/BootLogo.h index 94a9cd1282..37041e65c4 100644 --- a/MdeModulePkg/Include/Protocol/BootLogo.h +++ b/MdeModulePkg/Include/Protocol/BootLogo.h @@ -1,59 +1,59 @@ -/** @file
- Boot Logo protocol is used to convey information of Logo dispayed during boot.
-
-Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _BOOT_LOGO_H_
-#define _BOOT_LOGO_H_
-
-#include <Protocol/GraphicsOutput.h>
-
-#define EFI_BOOT_LOGO_PROTOCOL_GUID \
- { \
- 0xcdea2bd3, 0xfc25, 0x4c1c, { 0xb9, 0x7c, 0xb3, 0x11, 0x86, 0x6, 0x49, 0x90 } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_BOOT_LOGO_PROTOCOL EFI_BOOT_LOGO_PROTOCOL;
-
-/**
- Update information of logo image drawn on screen.
-
- @param This The pointer to the Boot Logo protocol instance.
- @param BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer
- is set to NULL, it indicates that logo image is no
- longer on the screen.
- @param DestinationX X coordinate of destination for the BltBuffer.
- @param DestinationY Y coordinate of destination for the BltBuffer.
- @param Width Width of rectangle in BltBuffer in pixels.
- @param Height Hight of rectangle in BltBuffer in pixels.
-
- @retval EFI_SUCCESS The boot logo information was updated.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_OUT_OF_RESOURCES The logo information was not updated due to
- insufficient memory resources.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SET_BOOT_LOGO)(
- IN EFI_BOOT_LOGO_PROTOCOL *This,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height
- );
-
-struct _EFI_BOOT_LOGO_PROTOCOL {
- EFI_SET_BOOT_LOGO SetBootLogo;
-};
-
-extern EFI_GUID gEfiBootLogoProtocolGuid;
-
-#endif
+/** @file + Boot Logo protocol is used to convey information of Logo dispayed during boot. + +Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _BOOT_LOGO_H_ +#define _BOOT_LOGO_H_ + +#include <Protocol/GraphicsOutput.h> + +#define EFI_BOOT_LOGO_PROTOCOL_GUID \ + { \ + 0xcdea2bd3, 0xfc25, 0x4c1c, { 0xb9, 0x7c, 0xb3, 0x11, 0x86, 0x6, 0x49, 0x90 } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_BOOT_LOGO_PROTOCOL EFI_BOOT_LOGO_PROTOCOL; + +/** + Update information of logo image drawn on screen. + + @param This The pointer to the Boot Logo protocol instance. + @param BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer + is set to NULL, it indicates that logo image is no + longer on the screen. + @param DestinationX X coordinate of destination for the BltBuffer. + @param DestinationY Y coordinate of destination for the BltBuffer. + @param Width Width of rectangle in BltBuffer in pixels. + @param Height Hight of rectangle in BltBuffer in pixels. + + @retval EFI_SUCCESS The boot logo information was updated. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_OUT_OF_RESOURCES The logo information was not updated due to + insufficient memory resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SET_BOOT_LOGO)( + IN EFI_BOOT_LOGO_PROTOCOL *This, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height + ); + +struct _EFI_BOOT_LOGO_PROTOCOL { + EFI_SET_BOOT_LOGO SetBootLogo; +}; + +extern EFI_GUID gEfiBootLogoProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/BootLogo2.h b/MdeModulePkg/Include/Protocol/BootLogo2.h index 8542d00e43..ec82a2e81a 100644 --- a/MdeModulePkg/Include/Protocol/BootLogo2.h +++ b/MdeModulePkg/Include/Protocol/BootLogo2.h @@ -1,101 +1,101 @@ -/** @file
-Boot Logo 2 Protocol is used to convey information of Logo dispayed during boot.
-
-The Boot Logo 2 Protocol is a replacement for the Boot Logo Protocol. If a
-platform produces both the Boot Logo 2 Protocol and the Boot Logo Protocol
-then the Boot Logo 2 Protocol must be used instead of the Boot Logo Protocol.
-
-Copyright (c) 2016, Microsoft Corporation
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-
-All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _BOOT_LOGO2_H_
-#define _BOOT_LOGO2_H_
-
-#include <Protocol/GraphicsOutput.h>
-
-#define EDKII_BOOT_LOGO2_PROTOCOL_GUID \
- { \
- 0x4b5dc1df, 0x1eaa, 0x48b2, { 0xa7, 0xe9, 0xea, 0xc4, 0x89, 0xa0, 0xb, 0x5c } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EDKII_BOOT_LOGO2_PROTOCOL EDKII_BOOT_LOGO2_PROTOCOL;
-
-/**
- Update information of logo image drawn on screen.
-
- @param[in] This The pointer to the Boot Logo protocol 2 instance.
- @param[in] BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer
- is set to NULL, it indicates that logo image is no
- longer on the screen.
- @param[in] DestinationX X coordinate of destination for the BltBuffer.
- @param[in] DestinationY Y coordinate of destination for the BltBuffer.
- @param[in] Width Width of rectangle in BltBuffer in pixels.
- @param[in] Height Hight of rectangle in BltBuffer in pixels.
-
- @retval EFI_SUCCESS The boot logo information was updated.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_OUT_OF_RESOURCES The logo information was not updated due to
- insufficient memory resources.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_SET_BOOT_LOGO2)(
- IN EDKII_BOOT_LOGO2_PROTOCOL *This,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height
- );
-
-/**
- Get the location of the boot logo on the screen.
-
- @param[in] This The pointer to the Boot Logo Protocol 2 instance
- @param[out] BltBuffer Returns pointer to the GOP BLT buffer that was
- previously registered with SetBootLogo2(). The
- buffer returned must not be modified or freed.
- @param[out] DestinationX Returns the X start position of the GOP BLT buffer
- that was previously registered with SetBootLogo2().
- @param[out] DestinationY Returns the Y start position of the GOP BLT buffer
- that was previously registered with SetBootLogo2().
- @param[out] Width Returns the width of the GOP BLT buffer
- that was previously registered with SetBootLogo2().
- @param[out] Height Returns the height of the GOP BLT buffer
- that was previously registered with SetBootLogo2().
-
- @retval EFI_SUCCESS The location of the boot logo was returned.
- @retval EFI_NOT_READY The boot logo has not been set.
- @retval EFI_INVALID_PARAMETER BltBuffer is NULL.
- @retval EFI_INVALID_PARAMETER DestinationX is NULL.
- @retval EFI_INVALID_PARAMETER DestinationY is NULL.
- @retval EFI_INVALID_PARAMETER Width is NULL.
- @retval EFI_INVALID_PARAMETER Height is NULL.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_GET_BOOT_LOGO2)(
- IN EDKII_BOOT_LOGO2_PROTOCOL *This,
- OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **BltBuffer,
- OUT UINTN *DestinationX,
- OUT UINTN *DestinationY,
- OUT UINTN *Width,
- OUT UINTN *Height
- );
-
-struct _EDKII_BOOT_LOGO2_PROTOCOL {
- EDKII_SET_BOOT_LOGO2 SetBootLogo;
- EDKII_GET_BOOT_LOGO2 GetBootLogo;
-};
-
-extern EFI_GUID gEdkiiBootLogo2ProtocolGuid;
-
-#endif
+/** @file +Boot Logo 2 Protocol is used to convey information of Logo dispayed during boot. + +The Boot Logo 2 Protocol is a replacement for the Boot Logo Protocol. If a +platform produces both the Boot Logo 2 Protocol and the Boot Logo Protocol +then the Boot Logo 2 Protocol must be used instead of the Boot Logo Protocol. + +Copyright (c) 2016, Microsoft Corporation +Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> + +All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _BOOT_LOGO2_H_ +#define _BOOT_LOGO2_H_ + +#include <Protocol/GraphicsOutput.h> + +#define EDKII_BOOT_LOGO2_PROTOCOL_GUID \ + { \ + 0x4b5dc1df, 0x1eaa, 0x48b2, { 0xa7, 0xe9, 0xea, 0xc4, 0x89, 0xa0, 0xb, 0x5c } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EDKII_BOOT_LOGO2_PROTOCOL EDKII_BOOT_LOGO2_PROTOCOL; + +/** + Update information of logo image drawn on screen. + + @param[in] This The pointer to the Boot Logo protocol 2 instance. + @param[in] BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer + is set to NULL, it indicates that logo image is no + longer on the screen. + @param[in] DestinationX X coordinate of destination for the BltBuffer. + @param[in] DestinationY Y coordinate of destination for the BltBuffer. + @param[in] Width Width of rectangle in BltBuffer in pixels. + @param[in] Height Hight of rectangle in BltBuffer in pixels. + + @retval EFI_SUCCESS The boot logo information was updated. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_OUT_OF_RESOURCES The logo information was not updated due to + insufficient memory resources. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_SET_BOOT_LOGO2)( + IN EDKII_BOOT_LOGO2_PROTOCOL *This, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height + ); + +/** + Get the location of the boot logo on the screen. + + @param[in] This The pointer to the Boot Logo Protocol 2 instance + @param[out] BltBuffer Returns pointer to the GOP BLT buffer that was + previously registered with SetBootLogo2(). The + buffer returned must not be modified or freed. + @param[out] DestinationX Returns the X start position of the GOP BLT buffer + that was previously registered with SetBootLogo2(). + @param[out] DestinationY Returns the Y start position of the GOP BLT buffer + that was previously registered with SetBootLogo2(). + @param[out] Width Returns the width of the GOP BLT buffer + that was previously registered with SetBootLogo2(). + @param[out] Height Returns the height of the GOP BLT buffer + that was previously registered with SetBootLogo2(). + + @retval EFI_SUCCESS The location of the boot logo was returned. + @retval EFI_NOT_READY The boot logo has not been set. + @retval EFI_INVALID_PARAMETER BltBuffer is NULL. + @retval EFI_INVALID_PARAMETER DestinationX is NULL. + @retval EFI_INVALID_PARAMETER DestinationY is NULL. + @retval EFI_INVALID_PARAMETER Width is NULL. + @retval EFI_INVALID_PARAMETER Height is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_GET_BOOT_LOGO2)( + IN EDKII_BOOT_LOGO2_PROTOCOL *This, + OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **BltBuffer, + OUT UINTN *DestinationX, + OUT UINTN *DestinationY, + OUT UINTN *Width, + OUT UINTN *Height + ); + +struct _EDKII_BOOT_LOGO2_PROTOCOL { + EDKII_SET_BOOT_LOGO2 SetBootLogo; + EDKII_GET_BOOT_LOGO2 GetBootLogo; +}; + +extern EFI_GUID gEdkiiBootLogo2ProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/DebuggerConfiguration.h b/MdeModulePkg/Include/Protocol/DebuggerConfiguration.h index 6db5b757ff..78342b33c1 100644 --- a/MdeModulePkg/Include/Protocol/DebuggerConfiguration.h +++ b/MdeModulePkg/Include/Protocol/DebuggerConfiguration.h @@ -1,25 +1,25 @@ -/** @file
- EBC Debugger configuration protocol.
-
- Copyright (c) 2007-2016, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EFI_DEBUGGER_CONFIGURATION_H__
-#define __EFI_DEBUGGER_CONFIGURATION_H__
-
-#define EFI_DEBUGGER_CONFIGURATION_PROTOCOL_GUID \
- { 0x577d959c, 0xe967, 0x4546, 0x86, 0x20, 0xc7, 0x78, 0xfa, 0xe5, 0xda, 0x5 }
-
-#define EFI_DEBUGGER_CONFIGURATION_VERSION 0x00000001
-
-typedef struct _EFI_DEBUGGER_CONFIGURATION_PROTOCOL {
- UINT32 DebuggerConfigurationRevision;
- VOID *DebuggerPrivateData;
-} EFI_DEBUGGER_CONFIGURATION_PROTOCOL;
-
-extern EFI_GUID gEfiDebuggerConfigurationProtocolGuid;
-
-#endif
+/** @file + EBC Debugger configuration protocol. + + Copyright (c) 2007-2016, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EFI_DEBUGGER_CONFIGURATION_H__ +#define __EFI_DEBUGGER_CONFIGURATION_H__ + +#define EFI_DEBUGGER_CONFIGURATION_PROTOCOL_GUID \ + { 0x577d959c, 0xe967, 0x4546, 0x86, 0x20, 0xc7, 0x78, 0xfa, 0xe5, 0xda, 0x5 } + +#define EFI_DEBUGGER_CONFIGURATION_VERSION 0x00000001 + +typedef struct _EFI_DEBUGGER_CONFIGURATION_PROTOCOL { + UINT32 DebuggerConfigurationRevision; + VOID *DebuggerPrivateData; +} EFI_DEBUGGER_CONFIGURATION_PROTOCOL; + +extern EFI_GUID gEfiDebuggerConfigurationProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/DeviceSecurity.h b/MdeModulePkg/Include/Protocol/DeviceSecurity.h index 7492d42e8f..e577398692 100644 --- a/MdeModulePkg/Include/Protocol/DeviceSecurity.h +++ b/MdeModulePkg/Include/Protocol/DeviceSecurity.h @@ -1,161 +1,161 @@ -/** @file
- Device Security Protocol definition.
-
- It is used to authenticate a device based upon the platform policy.
- It is similar to the EFI_SECURITY_ARCH_PROTOCOL, which is used to verify a image.
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DEVICE_SECURITY_H__
-#define __DEVICE_SECURITY_H__
-
-//
-// Device Security Protocol GUID value
-//
-#define EDKII_DEVICE_SECURITY_PROTOCOL_GUID \
- { \
- 0x5d6b38c8, 0x5510, 0x4458, { 0xb4, 0x8d, 0x95, 0x81, 0xcf, 0xa7, 0xb0, 0xd } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EDKII_DEVICE_SECURITY_PROTOCOL EDKII_DEVICE_SECURITY_PROTOCOL;
-
-//
-// Revision The revision to which the DEVICE_SECURITY interface adheres.
-// All future revisions must be backwards compatible.
-// If a future version is not back wards compatible it is not the same GUID.
-//
-#define EDKII_DEVICE_SECURITY_PROTOCOL_REVISION 0x00010000
-
-//
-// The device identifier.
-//
-typedef struct {
- ///
- /// Version of this data structure.
- ///
- UINT32 Version;
- ///
- /// Type of the device.
- /// This field is also served as a device Access protocol GUID.
- /// The device access protocol is installed on the DeviceHandle.
- /// The device access protocol is device specific.
- /// EDKII_DEVICE_IDENTIFIER_TYPE_PCI_GUID means the device access protocol is PciIo.
- /// EDKII_DEVICE_IDENTIFIER_TYPE_USB_GUID means the device access protocol is UsbIo.
- ///
- EFI_GUID DeviceType;
- ///
- /// The handle created for this device.
- /// NOTE: This might be a temporary handle.
- /// If the device is not authenticated, this handle shall be uninstalled.
- ///
- /// As minimal requirement, there should be 2 protocols installed on the device handle.
- /// 1) An EFI_DEVICE_PATH_PROTOCOL with EFI_DEVICE_PATH_PROTOCOL_GUID.
- /// 2) A device access protocol with EDKII_DEVICE_IDENTIFIER_TYPE_xxx_GUID.
- /// If the device is PCI device, the EFI_PCI_IO_PROTOCOL is installed with
- /// EDKII_DEVICE_IDENTIFIER_TYPE_PCI_GUID.
- /// If the device is USB device, the EFI_USB_IO_PROTOCOL is installed with
- /// EDKII_DEVICE_IDENTIFIER_TYPE_USB_GUID.
- ///
- /// The device access protocol is required, because the verifier need have a way
- /// to communciate with the device hardware to get the measurement or do the
- /// challenge/response for the device authentication.
- ///
- /// NOTE: We don't use EFI_PCI_IO_PROTOCOL_GUID or EFI_USB_IO_PROTOCOL_GUID here,
- /// because we don't want to expose a real protocol. A platform may have driver
- /// register a protocol notify function. Installing a real protocol may cause
- /// the callback function being executed before the device is authenticated.
- ///
- EFI_HANDLE DeviceHandle;
-} EDKII_DEVICE_IDENTIFIER;
-
-//
-// Revision The revision to which the DEVICE_IDENTIFIER interface adheres.
-// All future revisions must be backwards compatible.
-//
-#define EDKII_DEVICE_IDENTIFIER_REVISION 0x00010000
-
-//
-// Device Identifier GUID value
-//
-#define EDKII_DEVICE_IDENTIFIER_TYPE_PCI_GUID \
- { \
- 0x2509b2f1, 0xa022, 0x4cca, { 0xaf, 0x70, 0xf9, 0xd3, 0x21, 0xfb, 0x66, 0x49 } \
- }
-
-#define EDKII_DEVICE_IDENTIFIER_TYPE_USB_GUID \
- { \
- 0x7394f350, 0x394d, 0x488c, { 0xbb, 0x75, 0xc, 0xab, 0x7b, 0x12, 0xa, 0xc5 } \
- }
-
-/**
- The device driver uses this service to measure and/or verify a device.
-
- The flow in device driver is:
- 1) Device driver discovers a new device.
- 2) Device driver creates an EFI_DEVICE_PATH_PROTOCOL.
- 3) Device driver creates a device access protocol. e.g.
- EFI_PCI_IO_PROTOCOL for PCI device.
- EFI_USB_IO_PROTOCOL for USB device.
- EFI_EXT_SCSI_PASS_THRU_PROTOCOL for SCSI device.
- EFI_ATA_PASS_THRU_PROTOCOL for ATA device.
- EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL for NVMe device.
- EFI_SD_MMC_PASS_THRU_PROTOCOL for SD/MMC device.
- 4) Device driver installs the EFI_DEVICE_PATH_PROTOCOL with EFI_DEVICE_PATH_PROTOCOL_GUID,
- and the device access protocol with EDKII_DEVICE_IDENTIFIER_TYPE_xxx_GUID.
- Once it is done, a DeviceHandle is returned.
- 5) Device driver creates EDKII_DEVICE_IDENTIFIER with EDKII_DEVICE_IDENTIFIER_TYPE_xxx_GUID
- and the DeviceHandle.
- 6) Device driver calls DeviceAuthenticate().
- 7) If DeviceAuthenticate() returns EFI_SECURITY_VIOLATION, the device driver uninstalls
- all protocols on this handle.
- 8) If DeviceAuthenticate() returns EFI_SUCCESS, the device driver installs the device access
- protocol with a real protocol GUID. e.g.
- EFI_PCI_IO_PROTOCOL with EFI_PCI_IO_PROTOCOL_GUID.
- EFI_USB_IO_PROTOCOL with EFI_USB_IO_PROTOCOL_GUID.
-
- @param[in] This The protocol instance pointer.
- @param[in] DeviceId The Identifier for the device.
-
- @retval EFI_SUCCESS The device specified by the DeviceId passed the measurement
- and/or authentication based upon the platform policy.
- If TCG measurement is required, the measurement is extended to TPM PCR.
- @retval EFI_SECURITY_VIOLATION The device fails to return the measurement data.
- @retval EFI_SECURITY_VIOLATION The device fails to response the authentication request.
- @retval EFI_SECURITY_VIOLATION The system fails to verify the device based upon the authentication response.
- @retval EFI_SECURITY_VIOLATION The system fails to extend the measurement to TPM PCR.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_DEVICE_AUTHENTICATE)(
- IN EDKII_DEVICE_SECURITY_PROTOCOL *This,
- IN EDKII_DEVICE_IDENTIFIER *DeviceId
- );
-
-///
-/// Device Security Protocol structure.
-/// It is similar to the EFI_SECURITY_ARCH_PROTOCOL, which is used to verify a image.
-/// This protocol is used to authenticate a device based upon the platform policy.
-///
-struct _EDKII_DEVICE_SECURITY_PROTOCOL {
- UINT64 Revision;
- EDKII_DEVICE_AUTHENTICATE DeviceAuthenticate;
-};
-
-///
-/// Device Security Protocol GUID variable.
-///
-extern EFI_GUID gEdkiiDeviceSecurityProtocolGuid;
-
-///
-/// Device Identifier tpye GUID variable.
-///
-extern EFI_GUID gEdkiiDeviceIdentifierTypePciGuid;
-extern EFI_GUID gEdkiiDeviceIdentifierTypeUsbGuid;
-
-#endif
+/** @file + Device Security Protocol definition. + + It is used to authenticate a device based upon the platform policy. + It is similar to the EFI_SECURITY_ARCH_PROTOCOL, which is used to verify a image. + +Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DEVICE_SECURITY_H__ +#define __DEVICE_SECURITY_H__ + +// +// Device Security Protocol GUID value +// +#define EDKII_DEVICE_SECURITY_PROTOCOL_GUID \ + { \ + 0x5d6b38c8, 0x5510, 0x4458, { 0xb4, 0x8d, 0x95, 0x81, 0xcf, 0xa7, 0xb0, 0xd } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EDKII_DEVICE_SECURITY_PROTOCOL EDKII_DEVICE_SECURITY_PROTOCOL; + +// +// Revision The revision to which the DEVICE_SECURITY interface adheres. +// All future revisions must be backwards compatible. +// If a future version is not back wards compatible it is not the same GUID. +// +#define EDKII_DEVICE_SECURITY_PROTOCOL_REVISION 0x00010000 + +// +// The device identifier. +// +typedef struct { + /// + /// Version of this data structure. + /// + UINT32 Version; + /// + /// Type of the device. + /// This field is also served as a device Access protocol GUID. + /// The device access protocol is installed on the DeviceHandle. + /// The device access protocol is device specific. + /// EDKII_DEVICE_IDENTIFIER_TYPE_PCI_GUID means the device access protocol is PciIo. + /// EDKII_DEVICE_IDENTIFIER_TYPE_USB_GUID means the device access protocol is UsbIo. + /// + EFI_GUID DeviceType; + /// + /// The handle created for this device. + /// NOTE: This might be a temporary handle. + /// If the device is not authenticated, this handle shall be uninstalled. + /// + /// As minimal requirement, there should be 2 protocols installed on the device handle. + /// 1) An EFI_DEVICE_PATH_PROTOCOL with EFI_DEVICE_PATH_PROTOCOL_GUID. + /// 2) A device access protocol with EDKII_DEVICE_IDENTIFIER_TYPE_xxx_GUID. + /// If the device is PCI device, the EFI_PCI_IO_PROTOCOL is installed with + /// EDKII_DEVICE_IDENTIFIER_TYPE_PCI_GUID. + /// If the device is USB device, the EFI_USB_IO_PROTOCOL is installed with + /// EDKII_DEVICE_IDENTIFIER_TYPE_USB_GUID. + /// + /// The device access protocol is required, because the verifier need have a way + /// to communciate with the device hardware to get the measurement or do the + /// challenge/response for the device authentication. + /// + /// NOTE: We don't use EFI_PCI_IO_PROTOCOL_GUID or EFI_USB_IO_PROTOCOL_GUID here, + /// because we don't want to expose a real protocol. A platform may have driver + /// register a protocol notify function. Installing a real protocol may cause + /// the callback function being executed before the device is authenticated. + /// + EFI_HANDLE DeviceHandle; +} EDKII_DEVICE_IDENTIFIER; + +// +// Revision The revision to which the DEVICE_IDENTIFIER interface adheres. +// All future revisions must be backwards compatible. +// +#define EDKII_DEVICE_IDENTIFIER_REVISION 0x00010000 + +// +// Device Identifier GUID value +// +#define EDKII_DEVICE_IDENTIFIER_TYPE_PCI_GUID \ + { \ + 0x2509b2f1, 0xa022, 0x4cca, { 0xaf, 0x70, 0xf9, 0xd3, 0x21, 0xfb, 0x66, 0x49 } \ + } + +#define EDKII_DEVICE_IDENTIFIER_TYPE_USB_GUID \ + { \ + 0x7394f350, 0x394d, 0x488c, { 0xbb, 0x75, 0xc, 0xab, 0x7b, 0x12, 0xa, 0xc5 } \ + } + +/** + The device driver uses this service to measure and/or verify a device. + + The flow in device driver is: + 1) Device driver discovers a new device. + 2) Device driver creates an EFI_DEVICE_PATH_PROTOCOL. + 3) Device driver creates a device access protocol. e.g. + EFI_PCI_IO_PROTOCOL for PCI device. + EFI_USB_IO_PROTOCOL for USB device. + EFI_EXT_SCSI_PASS_THRU_PROTOCOL for SCSI device. + EFI_ATA_PASS_THRU_PROTOCOL for ATA device. + EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL for NVMe device. + EFI_SD_MMC_PASS_THRU_PROTOCOL for SD/MMC device. + 4) Device driver installs the EFI_DEVICE_PATH_PROTOCOL with EFI_DEVICE_PATH_PROTOCOL_GUID, + and the device access protocol with EDKII_DEVICE_IDENTIFIER_TYPE_xxx_GUID. + Once it is done, a DeviceHandle is returned. + 5) Device driver creates EDKII_DEVICE_IDENTIFIER with EDKII_DEVICE_IDENTIFIER_TYPE_xxx_GUID + and the DeviceHandle. + 6) Device driver calls DeviceAuthenticate(). + 7) If DeviceAuthenticate() returns EFI_SECURITY_VIOLATION, the device driver uninstalls + all protocols on this handle. + 8) If DeviceAuthenticate() returns EFI_SUCCESS, the device driver installs the device access + protocol with a real protocol GUID. e.g. + EFI_PCI_IO_PROTOCOL with EFI_PCI_IO_PROTOCOL_GUID. + EFI_USB_IO_PROTOCOL with EFI_USB_IO_PROTOCOL_GUID. + + @param[in] This The protocol instance pointer. + @param[in] DeviceId The Identifier for the device. + + @retval EFI_SUCCESS The device specified by the DeviceId passed the measurement + and/or authentication based upon the platform policy. + If TCG measurement is required, the measurement is extended to TPM PCR. + @retval EFI_SECURITY_VIOLATION The device fails to return the measurement data. + @retval EFI_SECURITY_VIOLATION The device fails to response the authentication request. + @retval EFI_SECURITY_VIOLATION The system fails to verify the device based upon the authentication response. + @retval EFI_SECURITY_VIOLATION The system fails to extend the measurement to TPM PCR. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_DEVICE_AUTHENTICATE)( + IN EDKII_DEVICE_SECURITY_PROTOCOL *This, + IN EDKII_DEVICE_IDENTIFIER *DeviceId + ); + +/// +/// Device Security Protocol structure. +/// It is similar to the EFI_SECURITY_ARCH_PROTOCOL, which is used to verify a image. +/// This protocol is used to authenticate a device based upon the platform policy. +/// +struct _EDKII_DEVICE_SECURITY_PROTOCOL { + UINT64 Revision; + EDKII_DEVICE_AUTHENTICATE DeviceAuthenticate; +}; + +/// +/// Device Security Protocol GUID variable. +/// +extern EFI_GUID gEdkiiDeviceSecurityProtocolGuid; + +/// +/// Device Identifier tpye GUID variable. +/// +extern EFI_GUID gEdkiiDeviceIdentifierTypePciGuid; +extern EFI_GUID gEdkiiDeviceIdentifierTypeUsbGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/DisplayProtocol.h b/MdeModulePkg/Include/Protocol/DisplayProtocol.h index be08b74b29..54f4565d77 100644 --- a/MdeModulePkg/Include/Protocol/DisplayProtocol.h +++ b/MdeModulePkg/Include/Protocol/DisplayProtocol.h @@ -1,352 +1,352 @@ -/** @file
- FormDiplay protocol to show Form
-
-Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DISPLAY_PROTOCOL_H__
-#define __DISPLAY_PROTOCOL_H__
-
-#include <Protocol/FormBrowser2.h>
-
-#define EDKII_FORM_DISPLAY_ENGINE_PROTOCOL_GUID \
- { 0x9bbe29e9, 0xfda1, 0x41ec, { 0xad, 0x52, 0x45, 0x22, 0x13, 0x74, 0x2d, 0x2e } }
-
-//
-// Do nothing.
-//
-#define BROWSER_ACTION_NONE BIT16
-//
-// ESC Exit
-//
-#define BROWSER_ACTION_FORM_EXIT BIT17
-
-#define BROWSER_SUCCESS 0x0
-#define BROWSER_ERROR BIT31
-#define BROWSER_SUBMIT_FAIL BROWSER_ERROR | 0x01
-#define BROWSER_NO_SUBMIT_IF BROWSER_ERROR | 0x02
-#define BROWSER_FORM_NOT_FOUND BROWSER_ERROR | 0x03
-#define BROWSER_FORM_SUPPRESS BROWSER_ERROR | 0x04
-#define BROWSER_PROTOCOL_NOT_FOUND BROWSER_ERROR | 0x05
-#define BROWSER_INCONSISTENT_IF BROWSER_ERROR | 0x06
-#define BROWSER_WARNING_IF BROWSER_ERROR | 0x07
-#define BROWSER_SUBMIT_FAIL_NO_SUBMIT_IF BROWSER_ERROR | 0x08
-#define BROWSER_RECONNECT_REQUIRED BROWSER_ERROR | 0x09
-#define BROWSER_RECONNECT_FAIL BROWSER_ERROR | 0x0A
-#define BROWSER_RECONNECT_SAVE_CHANGES BROWSER_ERROR | 0x0B
-
-#define FORM_DISPLAY_ENGINE_STATEMENT_VERSION_1 0x10000
-#define FORM_DISPLAY_ENGINE_VERSION_1 0x10000
-
-typedef struct {
- //
- // HII Data Type
- //
- UINT8 Type;
- //
- // Buffer Data and Length if Type is EFI_IFR_TYPE_BUFFER or EFI_IFR_TYPE_STRING
- //
- UINT8 *Buffer;
- UINT16 BufferLen;
- EFI_IFR_TYPE_VALUE Value;
-} EFI_HII_VALUE;
-
-#define DISPLAY_QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- //
- // OneOfOption Data
- //
- EFI_IFR_ONE_OF_OPTION *OptionOpCode;
- //
- // Option ImageId and AnimationId
- //
- EFI_IMAGE_ID ImageId;
- EFI_ANIMATION_ID AnimationId;
-} DISPLAY_QUESTION_OPTION;
-
-#define DISPLAY_QUESTION_OPTION_FROM_LINK(a) CR (a, DISPLAY_QUESTION_OPTION, Link, DISPLAY_QUESTION_OPTION_SIGNATURE)
-
-typedef struct _FORM_DISPLAY_ENGINE_STATEMENT FORM_DISPLAY_ENGINE_STATEMENT;
-typedef struct _FORM_DISPLAY_ENGINE_FORM FORM_DISPLAY_ENGINE_FORM;
-
-#define STATEMENT_VALID 0x0
-#define STATEMENT_INVALID BIT31
-
-#define INCOSISTENT_IF_TRUE STATEMENT_INVALID | 0x01
-#define WARNING_IF_TRUE STATEMENT_INVALID | 0x02
-#define STRING_TOO_LONG STATEMENT_INVALID | 0x03
-// ... to be extended.
-
-typedef struct {
- //
- // StringId for INCONSITENT_IF or WARNING_IF
- //
- EFI_STRING_ID StringId;
- //
- // TimeOut for WARNING_IF
- //
- UINT8 TimeOut;
-} STATEMENT_ERROR_INFO;
-
-/**
- Perform value check for a question.
-
- @param Form Form where Statement is in.
- @param Statement Value will check for it.
- @param Value New value will be checked.
-
- @retval Status Value Status
-
-**/
-typedef
-UINT32
-(EFIAPI *VALIDATE_QUESTION)(
- IN FORM_DISPLAY_ENGINE_FORM *Form,
- IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
- IN EFI_HII_VALUE *Value,
- OUT STATEMENT_ERROR_INFO *ErrorInfo
- );
-
-/**
- Perform Password check.
- Passwork may be encrypted by driver that requires the specific check.
-
- @param Form Form where Password Statement is in.
- @param Statement Password statement
- @param PasswordString Password string to be checked. It may be NULL.
- NULL means to restore password.
- "" string can be used to checked whether old password does exist.
-
- @return Status Status of Password check.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *PASSWORD_CHECK)(
- IN FORM_DISPLAY_ENGINE_FORM *Form,
- IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
- IN EFI_STRING PasswordString OPTIONAL
- );
-
-#define FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
-
-//
-// Attribute for Statement and Form
-//
-#define HII_DISPLAY_NONE 0
-#define HII_DISPLAY_GRAYOUT BIT0
-#define HII_DISPLAY_LOCK BIT1
-#define HII_DISPLAY_READONLY BIT2
-#define HII_DISPLAY_MODAL BIT3
-#define HII_DISPLAY_SUPPRESS BIT4
-
-struct _FORM_DISPLAY_ENGINE_STATEMENT {
- UINTN Signature;
- //
- // Version for future structure extension
- //
- UINTN Version;
- //
- // link to all the statement which will show in the display form.
- //
- LIST_ENTRY DisplayLink;
- //
- // Pointer to statement opcode.
- // for Guided Opcode. All buffers will be here if GUIDED opcode scope is set.
- //
- EFI_IFR_OP_HEADER *OpCode;
- //
- // Question CurrentValue
- //
- EFI_HII_VALUE CurrentValue;
- //
- // Flag to describe whether setting is changed or not.
- // Displayer may depend on it to show it with the different color.
- //
- BOOLEAN SettingChangedFlag;
- //
- // nested Statement list inside of EFI_IFR_SUBTITLE
- //
- LIST_ENTRY NestStatementList;
- //
- // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
- //
- LIST_ENTRY OptionListHead;
- //
- // Statement attributes: GRAYOUT, LOCK and READONLY
- //
- UINT32 Attribute;
-
- //
- // ValidateQuestion to do InconsistIf check
- // It may be NULL if any value is valid.
- //
- VALIDATE_QUESTION ValidateQuestion;
-
- //
- // Password additional check. It may be NULL when the additional check is not required.
- //
- PASSWORD_CHECK PasswordCheck;
-
- //
- // Statement ImageId and AnimationId
- //
- EFI_IMAGE_ID ImageId;
- EFI_ANIMATION_ID AnimationId;
-};
-
-#define FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK(a) CR (a, FORM_DISPLAY_ENGINE_STATEMENT, DisplayLink, FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE)
-
-#define BROWSER_HOT_KEY_SIGNATURE SIGNATURE_32 ('B', 'H', 'K', 'S')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- EFI_INPUT_KEY *KeyData;
- //
- // Action is Discard, Default, Submit, Reset and Exit.
- //
- UINT32 Action;
- UINT16 DefaultId;
- //
- // HotKey Help String
- //
- EFI_STRING HelpString;
-} BROWSER_HOT_KEY;
-
-#define BROWSER_HOT_KEY_FROM_LINK(a) CR (a, BROWSER_HOT_KEY, Link, BROWSER_HOT_KEY_SIGNATURE)
-
-#define FORM_DISPLAY_ENGINE_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
-
-struct _FORM_DISPLAY_ENGINE_FORM {
- UINTN Signature;
- //
- // Version for future structure extension
- //
- UINTN Version;
- //
- // Statement List inside of Form
- //
- LIST_ENTRY StatementListHead;
- //
- // Statement List outside of Form
- //
- LIST_ENTRY StatementListOSF;
- //
- // The input screen dimenstions info.
- //
- EFI_SCREEN_DESCRIPTOR *ScreenDimensions;
- //
- // FormSet information
- //
- EFI_GUID FormSetGuid;
- //
- // HiiHandle can be used to get String, Image or Animation
- //
- EFI_HII_HANDLE HiiHandle;
-
- //
- // Form ID and Title.
- //
- UINT16 FormId;
- EFI_STRING_ID FormTitle;
- //
- // Form Attributes: Lock, Modal.
- //
- UINT32 Attribute;
- //
- // Flag to describe whether setting is changed or not.
- // Displayer depends on it to show ChangedFlag.
- //
- BOOLEAN SettingChangedFlag;
-
- //
- // Statement to be HighLighted
- //
- FORM_DISPLAY_ENGINE_STATEMENT *HighLightedStatement;
- //
- // Event to notify Displayer that FormData is updated to be refreshed.
- //
- EFI_EVENT FormRefreshEvent;
- //
- // Additional Hotkey registered by BrowserEx protocol.
- //
- LIST_ENTRY HotKeyListHead;
-
- //
- // Form ImageId and AnimationId
- //
- EFI_IMAGE_ID ImageId;
- EFI_ANIMATION_ID AnimationId;
-
- //
- // If Status is error, display needs to handle it.
- //
- UINT32 BrowserStatus;
- //
- // String for error status. It may be NULL.
- //
- EFI_STRING ErrorString;
-};
-
-#define FORM_DISPLAY_ENGINE_FORM_FROM_LINK(a) CR (a, FORM_DISPLAY_ENGINE_FORM, Link, FORM_DISPLAY_ENGINE_FORM_SIGNATURE)
-
-typedef struct {
- FORM_DISPLAY_ENGINE_STATEMENT *SelectedStatement; // Selected Statement and InputValue
-
- EFI_HII_VALUE InputValue;
-
- UINT32 Action; // If SelectedStatement is NULL, Action will be used.
- // Trig Action (Discard, Default, Submit, Reset and Exit)
- UINT16 DefaultId;
-} USER_INPUT;
-
-/**
- Display one form, and return user input.
-
- @param FormData Form Data to be shown.
- @param UserInputData User input data.
-
- @retval EFI_SUCCESS Form Data is shown, and user input is got.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *FORM_DISPLAY)(
- IN FORM_DISPLAY_ENGINE_FORM *FormData,
- OUT USER_INPUT *UserInputData
- );
-
-/**
- Exit Display and Clear Screen to the original state.
-
-**/
-typedef
-VOID
-(EFIAPI *EXIT_DISPLAY)(
- VOID
- );
-
-/**
- Confirm how to handle the changed data.
-
- @return Action of Submit, Discard and None
-**/
-typedef
-UINTN
-(EFIAPI *CONFIRM_DATA_CHANGE)(
- VOID
- );
-
-typedef struct {
- FORM_DISPLAY FormDisplay;
- EXIT_DISPLAY ExitDisplay;
- CONFIRM_DATA_CHANGE ConfirmDataChange;
-} EDKII_FORM_DISPLAY_ENGINE_PROTOCOL;
-
-extern EFI_GUID gEdkiiFormDisplayEngineProtocolGuid;
-#endif
+/** @file + FormDiplay protocol to show Form + +Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DISPLAY_PROTOCOL_H__ +#define __DISPLAY_PROTOCOL_H__ + +#include <Protocol/FormBrowser2.h> + +#define EDKII_FORM_DISPLAY_ENGINE_PROTOCOL_GUID \ + { 0x9bbe29e9, 0xfda1, 0x41ec, { 0xad, 0x52, 0x45, 0x22, 0x13, 0x74, 0x2d, 0x2e } } + +// +// Do nothing. +// +#define BROWSER_ACTION_NONE BIT16 +// +// ESC Exit +// +#define BROWSER_ACTION_FORM_EXIT BIT17 + +#define BROWSER_SUCCESS 0x0 +#define BROWSER_ERROR BIT31 +#define BROWSER_SUBMIT_FAIL BROWSER_ERROR | 0x01 +#define BROWSER_NO_SUBMIT_IF BROWSER_ERROR | 0x02 +#define BROWSER_FORM_NOT_FOUND BROWSER_ERROR | 0x03 +#define BROWSER_FORM_SUPPRESS BROWSER_ERROR | 0x04 +#define BROWSER_PROTOCOL_NOT_FOUND BROWSER_ERROR | 0x05 +#define BROWSER_INCONSISTENT_IF BROWSER_ERROR | 0x06 +#define BROWSER_WARNING_IF BROWSER_ERROR | 0x07 +#define BROWSER_SUBMIT_FAIL_NO_SUBMIT_IF BROWSER_ERROR | 0x08 +#define BROWSER_RECONNECT_REQUIRED BROWSER_ERROR | 0x09 +#define BROWSER_RECONNECT_FAIL BROWSER_ERROR | 0x0A +#define BROWSER_RECONNECT_SAVE_CHANGES BROWSER_ERROR | 0x0B + +#define FORM_DISPLAY_ENGINE_STATEMENT_VERSION_1 0x10000 +#define FORM_DISPLAY_ENGINE_VERSION_1 0x10000 + +typedef struct { + // + // HII Data Type + // + UINT8 Type; + // + // Buffer Data and Length if Type is EFI_IFR_TYPE_BUFFER or EFI_IFR_TYPE_STRING + // + UINT8 *Buffer; + UINT16 BufferLen; + EFI_IFR_TYPE_VALUE Value; +} EFI_HII_VALUE; + +#define DISPLAY_QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T') + +typedef struct { + UINTN Signature; + LIST_ENTRY Link; + // + // OneOfOption Data + // + EFI_IFR_ONE_OF_OPTION *OptionOpCode; + // + // Option ImageId and AnimationId + // + EFI_IMAGE_ID ImageId; + EFI_ANIMATION_ID AnimationId; +} DISPLAY_QUESTION_OPTION; + +#define DISPLAY_QUESTION_OPTION_FROM_LINK(a) CR (a, DISPLAY_QUESTION_OPTION, Link, DISPLAY_QUESTION_OPTION_SIGNATURE) + +typedef struct _FORM_DISPLAY_ENGINE_STATEMENT FORM_DISPLAY_ENGINE_STATEMENT; +typedef struct _FORM_DISPLAY_ENGINE_FORM FORM_DISPLAY_ENGINE_FORM; + +#define STATEMENT_VALID 0x0 +#define STATEMENT_INVALID BIT31 + +#define INCOSISTENT_IF_TRUE STATEMENT_INVALID | 0x01 +#define WARNING_IF_TRUE STATEMENT_INVALID | 0x02 +#define STRING_TOO_LONG STATEMENT_INVALID | 0x03 +// ... to be extended. + +typedef struct { + // + // StringId for INCONSITENT_IF or WARNING_IF + // + EFI_STRING_ID StringId; + // + // TimeOut for WARNING_IF + // + UINT8 TimeOut; +} STATEMENT_ERROR_INFO; + +/** + Perform value check for a question. + + @param Form Form where Statement is in. + @param Statement Value will check for it. + @param Value New value will be checked. + + @retval Status Value Status + +**/ +typedef +UINT32 +(EFIAPI *VALIDATE_QUESTION)( + IN FORM_DISPLAY_ENGINE_FORM *Form, + IN FORM_DISPLAY_ENGINE_STATEMENT *Statement, + IN EFI_HII_VALUE *Value, + OUT STATEMENT_ERROR_INFO *ErrorInfo + ); + +/** + Perform Password check. + Passwork may be encrypted by driver that requires the specific check. + + @param Form Form where Password Statement is in. + @param Statement Password statement + @param PasswordString Password string to be checked. It may be NULL. + NULL means to restore password. + "" string can be used to checked whether old password does exist. + + @return Status Status of Password check. +**/ +typedef +EFI_STATUS +(EFIAPI *PASSWORD_CHECK)( + IN FORM_DISPLAY_ENGINE_FORM *Form, + IN FORM_DISPLAY_ENGINE_STATEMENT *Statement, + IN EFI_STRING PasswordString OPTIONAL + ); + +#define FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A') + +// +// Attribute for Statement and Form +// +#define HII_DISPLAY_NONE 0 +#define HII_DISPLAY_GRAYOUT BIT0 +#define HII_DISPLAY_LOCK BIT1 +#define HII_DISPLAY_READONLY BIT2 +#define HII_DISPLAY_MODAL BIT3 +#define HII_DISPLAY_SUPPRESS BIT4 + +struct _FORM_DISPLAY_ENGINE_STATEMENT { + UINTN Signature; + // + // Version for future structure extension + // + UINTN Version; + // + // link to all the statement which will show in the display form. + // + LIST_ENTRY DisplayLink; + // + // Pointer to statement opcode. + // for Guided Opcode. All buffers will be here if GUIDED opcode scope is set. + // + EFI_IFR_OP_HEADER *OpCode; + // + // Question CurrentValue + // + EFI_HII_VALUE CurrentValue; + // + // Flag to describe whether setting is changed or not. + // Displayer may depend on it to show it with the different color. + // + BOOLEAN SettingChangedFlag; + // + // nested Statement list inside of EFI_IFR_SUBTITLE + // + LIST_ENTRY NestStatementList; + // + // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION) + // + LIST_ENTRY OptionListHead; + // + // Statement attributes: GRAYOUT, LOCK and READONLY + // + UINT32 Attribute; + + // + // ValidateQuestion to do InconsistIf check + // It may be NULL if any value is valid. + // + VALIDATE_QUESTION ValidateQuestion; + + // + // Password additional check. It may be NULL when the additional check is not required. + // + PASSWORD_CHECK PasswordCheck; + + // + // Statement ImageId and AnimationId + // + EFI_IMAGE_ID ImageId; + EFI_ANIMATION_ID AnimationId; +}; + +#define FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK(a) CR (a, FORM_DISPLAY_ENGINE_STATEMENT, DisplayLink, FORM_DISPLAY_ENGINE_STATEMENT_SIGNATURE) + +#define BROWSER_HOT_KEY_SIGNATURE SIGNATURE_32 ('B', 'H', 'K', 'S') + +typedef struct { + UINTN Signature; + LIST_ENTRY Link; + + EFI_INPUT_KEY *KeyData; + // + // Action is Discard, Default, Submit, Reset and Exit. + // + UINT32 Action; + UINT16 DefaultId; + // + // HotKey Help String + // + EFI_STRING HelpString; +} BROWSER_HOT_KEY; + +#define BROWSER_HOT_KEY_FROM_LINK(a) CR (a, BROWSER_HOT_KEY, Link, BROWSER_HOT_KEY_SIGNATURE) + +#define FORM_DISPLAY_ENGINE_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M') + +struct _FORM_DISPLAY_ENGINE_FORM { + UINTN Signature; + // + // Version for future structure extension + // + UINTN Version; + // + // Statement List inside of Form + // + LIST_ENTRY StatementListHead; + // + // Statement List outside of Form + // + LIST_ENTRY StatementListOSF; + // + // The input screen dimenstions info. + // + EFI_SCREEN_DESCRIPTOR *ScreenDimensions; + // + // FormSet information + // + EFI_GUID FormSetGuid; + // + // HiiHandle can be used to get String, Image or Animation + // + EFI_HII_HANDLE HiiHandle; + + // + // Form ID and Title. + // + UINT16 FormId; + EFI_STRING_ID FormTitle; + // + // Form Attributes: Lock, Modal. + // + UINT32 Attribute; + // + // Flag to describe whether setting is changed or not. + // Displayer depends on it to show ChangedFlag. + // + BOOLEAN SettingChangedFlag; + + // + // Statement to be HighLighted + // + FORM_DISPLAY_ENGINE_STATEMENT *HighLightedStatement; + // + // Event to notify Displayer that FormData is updated to be refreshed. + // + EFI_EVENT FormRefreshEvent; + // + // Additional Hotkey registered by BrowserEx protocol. + // + LIST_ENTRY HotKeyListHead; + + // + // Form ImageId and AnimationId + // + EFI_IMAGE_ID ImageId; + EFI_ANIMATION_ID AnimationId; + + // + // If Status is error, display needs to handle it. + // + UINT32 BrowserStatus; + // + // String for error status. It may be NULL. + // + EFI_STRING ErrorString; +}; + +#define FORM_DISPLAY_ENGINE_FORM_FROM_LINK(a) CR (a, FORM_DISPLAY_ENGINE_FORM, Link, FORM_DISPLAY_ENGINE_FORM_SIGNATURE) + +typedef struct { + FORM_DISPLAY_ENGINE_STATEMENT *SelectedStatement; // Selected Statement and InputValue + + EFI_HII_VALUE InputValue; + + UINT32 Action; // If SelectedStatement is NULL, Action will be used. + // Trig Action (Discard, Default, Submit, Reset and Exit) + UINT16 DefaultId; +} USER_INPUT; + +/** + Display one form, and return user input. + + @param FormData Form Data to be shown. + @param UserInputData User input data. + + @retval EFI_SUCCESS Form Data is shown, and user input is got. +**/ +typedef +EFI_STATUS +(EFIAPI *FORM_DISPLAY)( + IN FORM_DISPLAY_ENGINE_FORM *FormData, + OUT USER_INPUT *UserInputData + ); + +/** + Exit Display and Clear Screen to the original state. + +**/ +typedef +VOID +(EFIAPI *EXIT_DISPLAY)( + VOID + ); + +/** + Confirm how to handle the changed data. + + @return Action of Submit, Discard and None +**/ +typedef +UINTN +(EFIAPI *CONFIRM_DATA_CHANGE)( + VOID + ); + +typedef struct { + FORM_DISPLAY FormDisplay; + EXIT_DISPLAY ExitDisplay; + CONFIRM_DATA_CHANGE ConfirmDataChange; +} EDKII_FORM_DISPLAY_ENGINE_PROTOCOL; + +extern EFI_GUID gEdkiiFormDisplayEngineProtocolGuid; +#endif diff --git a/MdeModulePkg/Include/Protocol/EbcSimpleDebugger.h b/MdeModulePkg/Include/Protocol/EbcSimpleDebugger.h index 503c4aed18..af866d13ec 100644 --- a/MdeModulePkg/Include/Protocol/EbcSimpleDebugger.h +++ b/MdeModulePkg/Include/Protocol/EbcSimpleDebugger.h @@ -1,117 +1,117 @@ -/** @file
- EBC Simple Debugger protocol for debug EBC code.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EBC_SIMPLE_DEBUGGER_PROTOCOL_H_
-#define _EBC_SIMPLE_DEBUGGER_PROTOCOL_H_
-
-#include <Protocol/DebugSupport.h>
-#include <Protocol/EbcVmTest.h>
-
-#define EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL_GUID \
- { \
- 0x2a72d11e, 0x7376, 0x40f6, { 0x9c, 0x68, 0x23, 0xfa, 0x2f, 0xe3, 0x63, 0xf1 } \
- }
-
-//
-// Defines for a simple EBC debugger interface
-//
-typedef struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL;
-
-/**
- Trig Exception on EBC VM.
-
- @param[in] This A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
- @param[in] VmPtr A pointer to a VM context.
- @param[in] ExceptionType Exception to be trigged.
-
- @retval EFI_UNSUPPORTED No support for it.
- @retval EFI_SUCCESS Exception is trigged.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EBC_DEBUGGER_SIGNAL_EXCEPTION)(
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
- IN VM_CONTEXT *VmPtr,
- IN EFI_EXCEPTION_TYPE ExceptionType
- );
-
-/**
- Given a pointer to a new VM context, debug one or more instructions.
-
- @param[in] This A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
- @param[in] VmPtr A pointer to a VM context.
-
- @retval EFI_UNSUPPORTED No support for it.
- @retval EFI_SUCCESS Debug one or more instructions.
-
-**/
-typedef
-VOID
-(EFIAPI *EBC_DEBUGGER_DEBUG)(
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
- IN VM_CONTEXT *VmPtr
- );
-
-/**
- Given a pointer to a new VM context, dump one or more instructions.
-
- @param[in] This A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
- @param[in] VmPtr A pointer to a VM context.
- @param[in] DasmString Dump string buffer.
- @param[in] DasmStringSize Dump string size.
-
- @retval EFI_UNSUPPORTED No support for it.
- @retval EFI_SUCCESS Dump one or more instructions.
-
-**/
-typedef
-UINT32
-(EFIAPI *EBC_DEBUGGER_DASM)(
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
- IN VM_CONTEXT *VmPtr,
- IN UINT16 *DasmString OPTIONAL,
- IN UINT32 DasmStringSize
- );
-
-/**
- This interface allows you to configure the EBC debug support
- driver. For example, turn on or off saving and printing of
- delta VM even if called. Or to even disable the entire interface,
- in which case all functions become no-ops.
-
- @param[in] This A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
- @param[in] ConfigId ID to be configured.
- @param[in] ConfigValue Value to be set.
-
- @retval EFI_UNSUPPORTED No support for it.
- @retval EFI_SUCCESS Configure EBC debug.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EBC_DEBUGGER_CONFIGURE)(
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This,
- IN UINT32 ConfigId,
- IN UINTN ConfigValue
- );
-
-//
-// Prototype for the actual EBC debug support protocol interface
-//
-struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL {
- EBC_DEBUGGER_DEBUG Debugger;
- EBC_DEBUGGER_SIGNAL_EXCEPTION SignalException;
- EBC_DEBUGGER_DASM Dasm;
- EBC_DEBUGGER_CONFIGURE Configure;
-};
-
-extern EFI_GUID gEfiEbcSimpleDebuggerProtocolGuid;
-
-#endif
+/** @file + EBC Simple Debugger protocol for debug EBC code. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EBC_SIMPLE_DEBUGGER_PROTOCOL_H_ +#define _EBC_SIMPLE_DEBUGGER_PROTOCOL_H_ + +#include <Protocol/DebugSupport.h> +#include <Protocol/EbcVmTest.h> + +#define EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL_GUID \ + { \ + 0x2a72d11e, 0x7376, 0x40f6, { 0x9c, 0x68, 0x23, 0xfa, 0x2f, 0xe3, 0x63, 0xf1 } \ + } + +// +// Defines for a simple EBC debugger interface +// +typedef struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL; + +/** + Trig Exception on EBC VM. + + @param[in] This A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure. + @param[in] VmPtr A pointer to a VM context. + @param[in] ExceptionType Exception to be trigged. + + @retval EFI_UNSUPPORTED No support for it. + @retval EFI_SUCCESS Exception is trigged. + +**/ +typedef +EFI_STATUS +(EFIAPI *EBC_DEBUGGER_SIGNAL_EXCEPTION)( + IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This, + IN VM_CONTEXT *VmPtr, + IN EFI_EXCEPTION_TYPE ExceptionType + ); + +/** + Given a pointer to a new VM context, debug one or more instructions. + + @param[in] This A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure. + @param[in] VmPtr A pointer to a VM context. + + @retval EFI_UNSUPPORTED No support for it. + @retval EFI_SUCCESS Debug one or more instructions. + +**/ +typedef +VOID +(EFIAPI *EBC_DEBUGGER_DEBUG)( + IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This, + IN VM_CONTEXT *VmPtr + ); + +/** + Given a pointer to a new VM context, dump one or more instructions. + + @param[in] This A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure. + @param[in] VmPtr A pointer to a VM context. + @param[in] DasmString Dump string buffer. + @param[in] DasmStringSize Dump string size. + + @retval EFI_UNSUPPORTED No support for it. + @retval EFI_SUCCESS Dump one or more instructions. + +**/ +typedef +UINT32 +(EFIAPI *EBC_DEBUGGER_DASM)( + IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This, + IN VM_CONTEXT *VmPtr, + IN UINT16 *DasmString OPTIONAL, + IN UINT32 DasmStringSize + ); + +/** + This interface allows you to configure the EBC debug support + driver. For example, turn on or off saving and printing of + delta VM even if called. Or to even disable the entire interface, + in which case all functions become no-ops. + + @param[in] This A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure. + @param[in] ConfigId ID to be configured. + @param[in] ConfigValue Value to be set. + + @retval EFI_UNSUPPORTED No support for it. + @retval EFI_SUCCESS Configure EBC debug. + +**/ +typedef +EFI_STATUS +(EFIAPI *EBC_DEBUGGER_CONFIGURE)( + IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *This, + IN UINT32 ConfigId, + IN UINTN ConfigValue + ); + +// +// Prototype for the actual EBC debug support protocol interface +// +struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL { + EBC_DEBUGGER_DEBUG Debugger; + EBC_DEBUGGER_SIGNAL_EXCEPTION SignalException; + EBC_DEBUGGER_DASM Dasm; + EBC_DEBUGGER_CONFIGURE Configure; +}; + +extern EFI_GUID gEfiEbcSimpleDebuggerProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/EbcVmTest.h b/MdeModulePkg/Include/Protocol/EbcVmTest.h index a4ed4894db..aa188566eb 100644 --- a/MdeModulePkg/Include/Protocol/EbcVmTest.h +++ b/MdeModulePkg/Include/Protocol/EbcVmTest.h @@ -1,184 +1,184 @@ -/** @file
- EBC VM Test protocol for test purposes.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EBC_VM_TEST_PROTOCOL_H_
-#define _EBC_VM_TEST_PROTOCOL_H_
-
-//
-// Define a protocol for an EBC VM test interface.
-//
-#define EFI_EBC_VM_TEST_PROTOCOL_GUID \
- { \
- 0xAAEACCFD, 0xF27B, 0x4C17, { 0xB6, 0x10, 0x75, 0xCA, 0x1F, 0x2D, 0xFB, 0x52 } \
- }
-
-//
-// Define for forward reference.
-//
-typedef struct _EFI_EBC_VM_TEST_PROTOCOL EFI_EBC_VM_TEST_PROTOCOL;
-
-//
-// VM major/minor version
-//
-#define VM_MAJOR_VERSION 1
-#define VM_MINOR_VERSION 0
-
-//
-// Bits in the VM->StopFlags field
-//
-#define STOPFLAG_APP_DONE 0x0001
-#define STOPFLAG_BREAKPOINT 0x0002
-#define STOPFLAG_INVALID_BREAK 0x0004
-#define STOPFLAG_BREAK_ON_CALLEX 0x0008
-
-//
-// Masks for working with the VM flags register
-//
-#define VMFLAGS_CC 0x0001 // condition flag
-#define VMFLAGS_STEP 0x0002 // step instruction mode
-#define VMFLAGS_ALL_VALID (VMFLAGS_CC | VMFLAGS_STEP)
-
-//
-// Macros for operating on the VM flags register
-//
-#define VMFLAG_SET(pVM, Flag) (pVM->Flags |= (Flag))
-#define VMFLAG_ISSET(pVM, Flag) ((pVM->Flags & (Flag)) ? 1 : 0)
-#define VMFLAG_CLEAR(pVM, Flag) (pVM->Flags &= ~(Flag))
-
-//
-// Define a macro to get the operand. Then we can change it to be either a
-// direct read or have it call a function to read memory.
-//
-#define GETOPERANDS(pVM) (UINT8) (*(UINT8 *) (pVM->Ip + 1))
-#define GETOPCODE(pVM) (UINT8) (*(UINT8 *) pVM->Ip)
-
-//
-// Macros for operating on the VM GP registers
-//
-#define OPERAND1_REGDATA(pVM, Op) pVM->Gpr[OPERAND1_REGNUM (Op)]
-#define OPERAND2_REGDATA(pVM, Op) pVM->Gpr[OPERAND2_REGNUM (Op)]
-
-//
-// Bits of exception flags field of VM context
-//
-#define EXCEPTION_FLAG_FATAL 0x80000000 // can't continue
-#define EXCEPTION_FLAG_ERROR 0x40000000 // bad, but try to continue
-#define EXCEPTION_FLAG_WARNING 0x20000000 // harmless problem
-#define EXCEPTION_FLAG_NONE 0x00000000 // for normal return
-
-///
-/// instruction pointer for the VM
-///
-typedef UINT8 *VMIP;
-
-typedef INT64 VM_REGISTER;
-typedef UINT32 EXCEPTION_FLAGS;
-
-typedef struct {
- VM_REGISTER Gpr[8]; ///< General purpose registers.
- ///< Flags register:
- ///< 0 Set to 1 if the result of the last compare was true
- ///< 1 Set to 1 if stepping
- UINT64 Flags; ///< 2..63 Reserved.
- VMIP Ip; ///< Instruction pointer.
- UINTN LastException;
- EXCEPTION_FLAGS ExceptionFlags; ///< to keep track of exceptions
- UINT32 StopFlags;
- UINT32 CompilerVersion; ///< via break(6)
- UINTN HighStackBottom; ///< bottom of the upper stack
- UINTN LowStackTop; ///< top of the lower stack
- UINT64 StackRetAddr; ///< location of final return address on stack
- UINTN *StackMagicPtr; ///< pointer to magic value on stack to detect corruption
- EFI_HANDLE ImageHandle; ///< for this EBC driver
- EFI_SYSTEM_TABLE *SystemTable; ///< for debugging only
- UINTN LastAddrConverted; ///< for debug
- UINTN LastAddrConvertedValue; ///< for debug
- VOID *FramePtr;
- VOID *EntryPoint; ///< entry point of EBC image
- UINTN ImageBase;
- VOID *StackPool;
- VOID *StackTop;
-} VM_CONTEXT;
-
-/**
- Given a pointer to a new VM context, execute one or more instructions. This
- function is only used for test purposes.
-
- @param[in] This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure.
- @param[in] VmPtr A pointer to a VM context.
- @param[in, out] InstructionCount A pointer to a UINTN value holding the number of
- instructions to execute. If it holds value of 0,
- then the instruction to be executed is 1.
-
- @retval EFI_UNSUPPORTED At least one of the opcodes is not supported.
- @retval EFI_SUCCESS All of the instructions are executed successfully.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EBC_VM_TEST_EXECUTE)(
- IN EFI_EBC_VM_TEST_PROTOCOL *This,
- IN VM_CONTEXT *VmPtr,
- IN OUT UINTN *InstructionCount
- );
-
-/**
- Convert AsmText to the instruction. This function is only used for test purposes.
-
- @param[in] This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure.
- @param[in] AsmText A pointer to EBC ASM text code.
- @param[out] Buffer Buffer to store the instruction.
- @param[out] BufferLen Size of buffer that is required to store data.
-
- @retval EFI_UNSUPPORTED This functionality is unsupported.
- @retval EFI_SUCCESS Successfully convert AsmText to the instruction.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EBC_VM_TEST_ASM)(
- IN EFI_EBC_VM_TEST_PROTOCOL *This,
- IN CHAR16 *AsmText,
- IN OUT INT8 *Buffer,
- IN OUT UINTN *BufferLen
- );
-
-/**
- Dump the executed instruction. This function is only used for test purposes.
-
- @param[in] This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure.
- @param[out] AsmText Contain the disasm text.
- @param[out] Buffer Buffer to store the instruction.
- @param[out] BufferLen Size of buffer that is required to store data.
-
- @retval EFI_UNSUPPORTED This functionality is unsupported.
- @retval EFI_SUCCESS Successfully dump the executed instruction.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EBC_VM_TEST_DASM)(
- IN EFI_EBC_VM_TEST_PROTOCOL *This,
- IN OUT CHAR16 *AsmText,
- IN OUT INT8 *Buffer,
- IN OUT UINTN *Len
- );
-
-//
-// Prototype for the actual EBC test protocol interface
-//
-struct _EFI_EBC_VM_TEST_PROTOCOL {
- EBC_VM_TEST_EXECUTE Execute;
- EBC_VM_TEST_ASM Assemble;
- EBC_VM_TEST_DASM Disassemble;
-};
-
-extern EFI_GUID gEfiEbcVmTestProtocolGuid;
-
-#endif
+/** @file + EBC VM Test protocol for test purposes. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EBC_VM_TEST_PROTOCOL_H_ +#define _EBC_VM_TEST_PROTOCOL_H_ + +// +// Define a protocol for an EBC VM test interface. +// +#define EFI_EBC_VM_TEST_PROTOCOL_GUID \ + { \ + 0xAAEACCFD, 0xF27B, 0x4C17, { 0xB6, 0x10, 0x75, 0xCA, 0x1F, 0x2D, 0xFB, 0x52 } \ + } + +// +// Define for forward reference. +// +typedef struct _EFI_EBC_VM_TEST_PROTOCOL EFI_EBC_VM_TEST_PROTOCOL; + +// +// VM major/minor version +// +#define VM_MAJOR_VERSION 1 +#define VM_MINOR_VERSION 0 + +// +// Bits in the VM->StopFlags field +// +#define STOPFLAG_APP_DONE 0x0001 +#define STOPFLAG_BREAKPOINT 0x0002 +#define STOPFLAG_INVALID_BREAK 0x0004 +#define STOPFLAG_BREAK_ON_CALLEX 0x0008 + +// +// Masks for working with the VM flags register +// +#define VMFLAGS_CC 0x0001 // condition flag +#define VMFLAGS_STEP 0x0002 // step instruction mode +#define VMFLAGS_ALL_VALID (VMFLAGS_CC | VMFLAGS_STEP) + +// +// Macros for operating on the VM flags register +// +#define VMFLAG_SET(pVM, Flag) (pVM->Flags |= (Flag)) +#define VMFLAG_ISSET(pVM, Flag) ((pVM->Flags & (Flag)) ? 1 : 0) +#define VMFLAG_CLEAR(pVM, Flag) (pVM->Flags &= ~(Flag)) + +// +// Define a macro to get the operand. Then we can change it to be either a +// direct read or have it call a function to read memory. +// +#define GETOPERANDS(pVM) (UINT8) (*(UINT8 *) (pVM->Ip + 1)) +#define GETOPCODE(pVM) (UINT8) (*(UINT8 *) pVM->Ip) + +// +// Macros for operating on the VM GP registers +// +#define OPERAND1_REGDATA(pVM, Op) pVM->Gpr[OPERAND1_REGNUM (Op)] +#define OPERAND2_REGDATA(pVM, Op) pVM->Gpr[OPERAND2_REGNUM (Op)] + +// +// Bits of exception flags field of VM context +// +#define EXCEPTION_FLAG_FATAL 0x80000000 // can't continue +#define EXCEPTION_FLAG_ERROR 0x40000000 // bad, but try to continue +#define EXCEPTION_FLAG_WARNING 0x20000000 // harmless problem +#define EXCEPTION_FLAG_NONE 0x00000000 // for normal return + +/// +/// instruction pointer for the VM +/// +typedef UINT8 *VMIP; + +typedef INT64 VM_REGISTER; +typedef UINT32 EXCEPTION_FLAGS; + +typedef struct { + VM_REGISTER Gpr[8]; ///< General purpose registers. + ///< Flags register: + ///< 0 Set to 1 if the result of the last compare was true + ///< 1 Set to 1 if stepping + UINT64 Flags; ///< 2..63 Reserved. + VMIP Ip; ///< Instruction pointer. + UINTN LastException; + EXCEPTION_FLAGS ExceptionFlags; ///< to keep track of exceptions + UINT32 StopFlags; + UINT32 CompilerVersion; ///< via break(6) + UINTN HighStackBottom; ///< bottom of the upper stack + UINTN LowStackTop; ///< top of the lower stack + UINT64 StackRetAddr; ///< location of final return address on stack + UINTN *StackMagicPtr; ///< pointer to magic value on stack to detect corruption + EFI_HANDLE ImageHandle; ///< for this EBC driver + EFI_SYSTEM_TABLE *SystemTable; ///< for debugging only + UINTN LastAddrConverted; ///< for debug + UINTN LastAddrConvertedValue; ///< for debug + VOID *FramePtr; + VOID *EntryPoint; ///< entry point of EBC image + UINTN ImageBase; + VOID *StackPool; + VOID *StackTop; +} VM_CONTEXT; + +/** + Given a pointer to a new VM context, execute one or more instructions. This + function is only used for test purposes. + + @param[in] This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure. + @param[in] VmPtr A pointer to a VM context. + @param[in, out] InstructionCount A pointer to a UINTN value holding the number of + instructions to execute. If it holds value of 0, + then the instruction to be executed is 1. + + @retval EFI_UNSUPPORTED At least one of the opcodes is not supported. + @retval EFI_SUCCESS All of the instructions are executed successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EBC_VM_TEST_EXECUTE)( + IN EFI_EBC_VM_TEST_PROTOCOL *This, + IN VM_CONTEXT *VmPtr, + IN OUT UINTN *InstructionCount + ); + +/** + Convert AsmText to the instruction. This function is only used for test purposes. + + @param[in] This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure. + @param[in] AsmText A pointer to EBC ASM text code. + @param[out] Buffer Buffer to store the instruction. + @param[out] BufferLen Size of buffer that is required to store data. + + @retval EFI_UNSUPPORTED This functionality is unsupported. + @retval EFI_SUCCESS Successfully convert AsmText to the instruction. + +**/ +typedef +EFI_STATUS +(EFIAPI *EBC_VM_TEST_ASM)( + IN EFI_EBC_VM_TEST_PROTOCOL *This, + IN CHAR16 *AsmText, + IN OUT INT8 *Buffer, + IN OUT UINTN *BufferLen + ); + +/** + Dump the executed instruction. This function is only used for test purposes. + + @param[in] This A pointer to the EFI_EBC_VM_TEST_PROTOCOL structure. + @param[out] AsmText Contain the disasm text. + @param[out] Buffer Buffer to store the instruction. + @param[out] BufferLen Size of buffer that is required to store data. + + @retval EFI_UNSUPPORTED This functionality is unsupported. + @retval EFI_SUCCESS Successfully dump the executed instruction. + +**/ +typedef +EFI_STATUS +(EFIAPI *EBC_VM_TEST_DASM)( + IN EFI_EBC_VM_TEST_PROTOCOL *This, + IN OUT CHAR16 *AsmText, + IN OUT INT8 *Buffer, + IN OUT UINTN *Len + ); + +// +// Prototype for the actual EBC test protocol interface +// +struct _EFI_EBC_VM_TEST_PROTOCOL { + EBC_VM_TEST_EXECUTE Execute; + EBC_VM_TEST_ASM Assemble; + EBC_VM_TEST_DASM Disassemble; +}; + +extern EFI_GUID gEfiEbcVmTestProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/EsrtManagement.h b/MdeModulePkg/Include/Protocol/EsrtManagement.h index f4dfefba3b..87dbfc72b3 100644 --- a/MdeModulePkg/Include/Protocol/EsrtManagement.h +++ b/MdeModulePkg/Include/Protocol/EsrtManagement.h @@ -1,131 +1,131 @@ -/** @file
- The Esrt Management Protocol used to register/set/update an updatable firmware resource .
-
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _ESRT_MANAGEMENT_H_
-#define _ESRT_MANAGEMENT_H_
-
-#include <Guid/SystemResourceTable.h>
-
-///
-/// Global ID for the ESRT_MANAGEMENT_PROTOCOL.
-///
-#define ESRT_MANAGEMENT_PROTOCOL_GUID \
- { \
- 0xa340c064, 0x723c, 0x4a9c, { 0xa4, 0xdd, 0xd5, 0xb4, 0x7a, 0x26, 0xfb, 0xb0 } \
- }
-
-///
-/// Forward declaration for the _ESRT_MANAGEMENT_PROTOCOL.
-///
-typedef struct _ESRT_MANAGEMENT_PROTOCOL ESRT_MANAGEMENT_PROTOCOL;
-
-/**
- Get Variable name and data by Esrt Entry FwClass
-
- @param[in] FwClass FwClass of Esrt entry to get
- @param[in out] Entry Esrt entry returned
-
- @retval EFI_SUCCESS The variable saving this Esrt Entry exists.
- @retval EF_NOT_FOUND No correct variable found.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *GET_ESRT_ENTRY)(
- IN EFI_GUID *FwClass,
- IN OUT EFI_SYSTEM_RESOURCE_ENTRY *Entry
- );
-
-/**
- Update one ESRT entry in ESRT Cache.
-
- @param[in] Entry Esrt entry to be updated
-
- @retval EFI_SUCCESS Successfully update an ESRT entry in cache.
- @retval EFI_INVALID_PARAMETER Entry does't exist in ESRT Cache
- @retval EFI_WRITE_PROTECTED ESRT Cache repositoy is locked
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *UPDATE_ESRT_ENTRY)(
- IN EFI_SYSTEM_RESOURCE_ENTRY *Entry
- );
-
-/**
- Non-FMP instance to unregister Esrt Entry from ESRT Cache.
-
- @param[in] FwClass FwClass of Esrt entry to Unregister
-
- @retval EFI_SUCCESS Insert all entries Successfully
- @retval EFI_NOT_FOUND FwClass does not exsit
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *UNREGISTER_ESRT_ENTRY)(
- IN EFI_GUID *FwClass
- );
-
-/**
- Non-FMP instance to register one ESRT entry into ESRT Cache.
-
- @param[in] Entry Esrt entry to be set
-
- @retval EFI_SUCCESS Successfully set a variable.
- @retval EFI_INVALID_PARAMETER ESRT Entry is already exist
- @retval EFI_OUT_OF_RESOURCES Non-FMP ESRT repository is full
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *REGISTER_ESRT_ENTRY)(
- IN EFI_SYSTEM_RESOURCE_ENTRY *Entry
- );
-
-/**
- This function syn up Cached ESRT with data from FMP instances
- Function should be called after Connect All in order to locate all FMP protocols
- installed
-
- @retval EFI_SUCCESS Successfully sync cache repository from FMP instances
- @retval EFI_NOT_FOUND No FMP Instance are found
- @retval EFI_OUT_OF_RESOURCES Resource allocaton fail
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *SYNC_ESRT_FMP)(
- VOID
- );
-
-/**
- This function locks up Esrt repository to be readonly. It should be called
- before gEfiEndOfDxeEventGroupGuid event signaled
-
- @retval EFI_SUCCESS Locks up FMP Non-FMP repository successfully
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *LOCK_ESRT_REPOSITORY)(
- VOID
- );
-
-struct _ESRT_MANAGEMENT_PROTOCOL {
- GET_ESRT_ENTRY GetEsrtEntry;
- UPDATE_ESRT_ENTRY UpdateEsrtEntry;
- REGISTER_ESRT_ENTRY RegisterEsrtEntry;
- UNREGISTER_ESRT_ENTRY UnRegisterEsrtEntry;
- SYNC_ESRT_FMP SyncEsrtFmp;
- LOCK_ESRT_REPOSITORY LockEsrtRepository;
-};
-
-extern EFI_GUID gEsrtManagementProtocolGuid;
-
-#endif // #ifndef _ESRT_MANAGEMENT_H_
+/** @file + The Esrt Management Protocol used to register/set/update an updatable firmware resource . + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _ESRT_MANAGEMENT_H_ +#define _ESRT_MANAGEMENT_H_ + +#include <Guid/SystemResourceTable.h> + +/// +/// Global ID for the ESRT_MANAGEMENT_PROTOCOL. +/// +#define ESRT_MANAGEMENT_PROTOCOL_GUID \ + { \ + 0xa340c064, 0x723c, 0x4a9c, { 0xa4, 0xdd, 0xd5, 0xb4, 0x7a, 0x26, 0xfb, 0xb0 } \ + } + +/// +/// Forward declaration for the _ESRT_MANAGEMENT_PROTOCOL. +/// +typedef struct _ESRT_MANAGEMENT_PROTOCOL ESRT_MANAGEMENT_PROTOCOL; + +/** + Get Variable name and data by Esrt Entry FwClass + + @param[in] FwClass FwClass of Esrt entry to get + @param[in out] Entry Esrt entry returned + + @retval EFI_SUCCESS The variable saving this Esrt Entry exists. + @retval EF_NOT_FOUND No correct variable found. + +**/ +typedef +EFI_STATUS +(EFIAPI *GET_ESRT_ENTRY)( + IN EFI_GUID *FwClass, + IN OUT EFI_SYSTEM_RESOURCE_ENTRY *Entry + ); + +/** + Update one ESRT entry in ESRT Cache. + + @param[in] Entry Esrt entry to be updated + + @retval EFI_SUCCESS Successfully update an ESRT entry in cache. + @retval EFI_INVALID_PARAMETER Entry does't exist in ESRT Cache + @retval EFI_WRITE_PROTECTED ESRT Cache repositoy is locked + +**/ +typedef +EFI_STATUS +(EFIAPI *UPDATE_ESRT_ENTRY)( + IN EFI_SYSTEM_RESOURCE_ENTRY *Entry + ); + +/** + Non-FMP instance to unregister Esrt Entry from ESRT Cache. + + @param[in] FwClass FwClass of Esrt entry to Unregister + + @retval EFI_SUCCESS Insert all entries Successfully + @retval EFI_NOT_FOUND FwClass does not exsit + +**/ +typedef +EFI_STATUS +(EFIAPI *UNREGISTER_ESRT_ENTRY)( + IN EFI_GUID *FwClass + ); + +/** + Non-FMP instance to register one ESRT entry into ESRT Cache. + + @param[in] Entry Esrt entry to be set + + @retval EFI_SUCCESS Successfully set a variable. + @retval EFI_INVALID_PARAMETER ESRT Entry is already exist + @retval EFI_OUT_OF_RESOURCES Non-FMP ESRT repository is full + +**/ +typedef +EFI_STATUS +(EFIAPI *REGISTER_ESRT_ENTRY)( + IN EFI_SYSTEM_RESOURCE_ENTRY *Entry + ); + +/** + This function syn up Cached ESRT with data from FMP instances + Function should be called after Connect All in order to locate all FMP protocols + installed + + @retval EFI_SUCCESS Successfully sync cache repository from FMP instances + @retval EFI_NOT_FOUND No FMP Instance are found + @retval EFI_OUT_OF_RESOURCES Resource allocaton fail + +**/ +typedef +EFI_STATUS +(EFIAPI *SYNC_ESRT_FMP)( + VOID + ); + +/** + This function locks up Esrt repository to be readonly. It should be called + before gEfiEndOfDxeEventGroupGuid event signaled + + @retval EFI_SUCCESS Locks up FMP Non-FMP repository successfully + +**/ +typedef +EFI_STATUS +(EFIAPI *LOCK_ESRT_REPOSITORY)( + VOID + ); + +struct _ESRT_MANAGEMENT_PROTOCOL { + GET_ESRT_ENTRY GetEsrtEntry; + UPDATE_ESRT_ENTRY UpdateEsrtEntry; + REGISTER_ESRT_ENTRY RegisterEsrtEntry; + UNREGISTER_ESRT_ENTRY UnRegisterEsrtEntry; + SYNC_ESRT_FMP SyncEsrtFmp; + LOCK_ESRT_REPOSITORY LockEsrtRepository; +}; + +extern EFI_GUID gEsrtManagementProtocolGuid; + +#endif // #ifndef _ESRT_MANAGEMENT_H_ diff --git a/MdeModulePkg/Include/Protocol/FaultTolerantWrite.h b/MdeModulePkg/Include/Protocol/FaultTolerantWrite.h index 8fbd8c665e..ead7f90af6 100644 --- a/MdeModulePkg/Include/Protocol/FaultTolerantWrite.h +++ b/MdeModulePkg/Include/Protocol/FaultTolerantWrite.h @@ -1,201 +1,201 @@ -/** @file
- Fault Tolerant Write protocol provides boot-time service for fault tolerant
- write capability for block devices. The protocol provides for non-volatile
- storage of the intermediate data and private information a caller would need to
- recover from a critical fault, such as a power failure.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_
-#define _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_
-
-#define EFI_FAULT_TOLERANT_WRITE_PROTOCOL_GUID \
- { \
- 0x3ebd9e82, 0x2c78, 0x4de6, {0x97, 0x86, 0x8d, 0x4b, 0xfc, 0xb7, 0xc8, 0x81 } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL EFI_FAULT_TOLERANT_WRITE_PROTOCOL;
-
-/**
- Get the size of the largest block that can be updated in a fault-tolerant manner.
-
- @param This Indicates a pointer to the calling context.
- @param BlockSize A pointer to a caller-allocated UINTN that is
- updated to indicate the size of the largest block
- that can be updated.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_ABORTED The function could not complete successfully.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE)(
- IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,
- OUT UINTN *BlockSize
- );
-
-/**
- Allocates space for the protocol to maintain information about writes.
- Since writes must be completed in a fault-tolerant manner and multiple
- writes require more resources to be successful, this function
- enables the protocol to ensure that enough space exists to track
- information about upcoming writes.
-
- @param This A pointer to the calling context.
- @param CallerId The GUID identifying the write.
- @param PrivateDataSize The size of the caller's private data that must be
- recorded for each write.
- @param NumberOfWrites The number of fault tolerant block writes that will
- need to occur.
-
- @retval EFI_SUCCESS The function completed successfully
- @retval EFI_ABORTED The function could not complete successfully.
- @retval EFI_ACCESS_DENIED Not all allocated writes have been completed. All
- writes must be completed or aborted before another
- fault tolerant write can occur.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_FAULT_TOLERANT_WRITE_ALLOCATE)(
- IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,
- IN EFI_GUID *CallerId,
- IN UINTN PrivateDataSize,
- IN UINTN NumberOfWrites
- );
-
-/**
- Starts a target block update. This records information about the write
- in fault tolerant storage, and will complete the write in a recoverable
- manner, ensuring at all times that either the original contents or
- the modified contents are available.
-
- @param This The calling context.
- @param Lba The logical block address of the target block.
- @param Offset The offset within the target block to place the
- data.
- @param Length The number of bytes to write to the target block.
- @param PrivateData A pointer to private data that the caller requires
- to complete any pending writes in the event of a
- fault.
- @param FvBlockHandle The handle of FVB protocol that provides services
- for reading, writing, and erasing the target block.
- @param Buffer The data to write.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_ABORTED The function could not complete successfully.
- @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not
- a valid action.
- @retval EFI_ACCESS_DENIED No writes have been allocated.
- @retval EFI_NOT_READY The last write has not been completed. Restart()
- must be called to complete it.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_FAULT_TOLERANT_WRITE_WRITE)(
- IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN UINTN Length,
- IN VOID *PrivateData,
- IN EFI_HANDLE FvbHandle,
- IN VOID *Buffer
- );
-
-/**
- Restarts a previously interrupted write. The caller must provide the
- block protocol needed to complete the interrupted write.
-
- @param This The calling context.
- @param FvBlockProtocol The handle of FVB protocol that provides services.
- for reading, writing, and erasing the target block.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_ABORTED The function could not complete successfully.
- @retval EFI_ACCESS_DENIED No pending writes exist.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_FAULT_TOLERANT_WRITE_RESTART)(
- IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,
- IN EFI_HANDLE FvbHandle
- );
-
-/**
- Aborts all previously allocated writes.
-
- @param This The calling context.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_ABORTED The function could not complete successfully.
- @retval EFI_NOT_FOUND No allocated writes exist.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_FAULT_TOLERANT_WRITE_ABORT)(
- IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This
- );
-
-/**
- Starts a target block update. This function records information about the write
- in fault-tolerant storage and completes the write in a recoverable
- manner, ensuring at all times that either the original contents or
- the modified contents are available.
-
- @param This Indicates a pointer to the calling context.
- @param CallerId The GUID identifying the last write.
- @param Lba The logical block address of the last write.
- @param Offset The offset within the block of the last write.
- @param Length The length of the last write.
- @param PrivateDataSize On input, the size of the PrivateData buffer. On
- output, the size of the private data stored for
- this write.
- @param PrivateData A pointer to a buffer. The function will copy
- PrivateDataSize bytes from the private data stored
- for this write.
- @param Complete A Boolean value with TRUE indicating that the write
- was completed.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_ABORTED The function could not complete successfully.
- @retval EFI_NOT_FOUND No allocated writes exist.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE)(
- IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,
- OUT EFI_GUID *CallerId,
- OUT EFI_LBA *Lba,
- OUT UINTN *Offset,
- OUT UINTN *Length,
- IN OUT UINTN *PrivateDataSize,
- OUT VOID *PrivateData,
- OUT BOOLEAN *Complete
- );
-
-//
-// Protocol declaration
-//
-struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL {
- EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE GetMaxBlockSize;
- EFI_FAULT_TOLERANT_WRITE_ALLOCATE Allocate;
- EFI_FAULT_TOLERANT_WRITE_WRITE Write;
- EFI_FAULT_TOLERANT_WRITE_RESTART Restart;
- EFI_FAULT_TOLERANT_WRITE_ABORT Abort;
- EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE GetLastWrite;
-};
-
-extern EFI_GUID gEfiFaultTolerantWriteProtocolGuid;
-
-#endif
+/** @file + Fault Tolerant Write protocol provides boot-time service for fault tolerant + write capability for block devices. The protocol provides for non-volatile + storage of the intermediate data and private information a caller would need to + recover from a critical fault, such as a power failure. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_ +#define _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_ + +#define EFI_FAULT_TOLERANT_WRITE_PROTOCOL_GUID \ + { \ + 0x3ebd9e82, 0x2c78, 0x4de6, {0x97, 0x86, 0x8d, 0x4b, 0xfc, 0xb7, 0xc8, 0x81 } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL EFI_FAULT_TOLERANT_WRITE_PROTOCOL; + +/** + Get the size of the largest block that can be updated in a fault-tolerant manner. + + @param This Indicates a pointer to the calling context. + @param BlockSize A pointer to a caller-allocated UINTN that is + updated to indicate the size of the largest block + that can be updated. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_ABORTED The function could not complete successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE)( + IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, + OUT UINTN *BlockSize + ); + +/** + Allocates space for the protocol to maintain information about writes. + Since writes must be completed in a fault-tolerant manner and multiple + writes require more resources to be successful, this function + enables the protocol to ensure that enough space exists to track + information about upcoming writes. + + @param This A pointer to the calling context. + @param CallerId The GUID identifying the write. + @param PrivateDataSize The size of the caller's private data that must be + recorded for each write. + @param NumberOfWrites The number of fault tolerant block writes that will + need to occur. + + @retval EFI_SUCCESS The function completed successfully + @retval EFI_ABORTED The function could not complete successfully. + @retval EFI_ACCESS_DENIED Not all allocated writes have been completed. All + writes must be completed or aborted before another + fault tolerant write can occur. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FAULT_TOLERANT_WRITE_ALLOCATE)( + IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, + IN EFI_GUID *CallerId, + IN UINTN PrivateDataSize, + IN UINTN NumberOfWrites + ); + +/** + Starts a target block update. This records information about the write + in fault tolerant storage, and will complete the write in a recoverable + manner, ensuring at all times that either the original contents or + the modified contents are available. + + @param This The calling context. + @param Lba The logical block address of the target block. + @param Offset The offset within the target block to place the + data. + @param Length The number of bytes to write to the target block. + @param PrivateData A pointer to private data that the caller requires + to complete any pending writes in the event of a + fault. + @param FvBlockHandle The handle of FVB protocol that provides services + for reading, writing, and erasing the target block. + @param Buffer The data to write. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_ABORTED The function could not complete successfully. + @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not + a valid action. + @retval EFI_ACCESS_DENIED No writes have been allocated. + @retval EFI_NOT_READY The last write has not been completed. Restart() + must be called to complete it. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FAULT_TOLERANT_WRITE_WRITE)( + IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, + IN EFI_LBA Lba, + IN UINTN Offset, + IN UINTN Length, + IN VOID *PrivateData, + IN EFI_HANDLE FvbHandle, + IN VOID *Buffer + ); + +/** + Restarts a previously interrupted write. The caller must provide the + block protocol needed to complete the interrupted write. + + @param This The calling context. + @param FvBlockProtocol The handle of FVB protocol that provides services. + for reading, writing, and erasing the target block. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_ABORTED The function could not complete successfully. + @retval EFI_ACCESS_DENIED No pending writes exist. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FAULT_TOLERANT_WRITE_RESTART)( + IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, + IN EFI_HANDLE FvbHandle + ); + +/** + Aborts all previously allocated writes. + + @param This The calling context. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_ABORTED The function could not complete successfully. + @retval EFI_NOT_FOUND No allocated writes exist. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FAULT_TOLERANT_WRITE_ABORT)( + IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This + ); + +/** + Starts a target block update. This function records information about the write + in fault-tolerant storage and completes the write in a recoverable + manner, ensuring at all times that either the original contents or + the modified contents are available. + + @param This Indicates a pointer to the calling context. + @param CallerId The GUID identifying the last write. + @param Lba The logical block address of the last write. + @param Offset The offset within the block of the last write. + @param Length The length of the last write. + @param PrivateDataSize On input, the size of the PrivateData buffer. On + output, the size of the private data stored for + this write. + @param PrivateData A pointer to a buffer. The function will copy + PrivateDataSize bytes from the private data stored + for this write. + @param Complete A Boolean value with TRUE indicating that the write + was completed. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_ABORTED The function could not complete successfully. + @retval EFI_NOT_FOUND No allocated writes exist. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE)( + IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, + OUT EFI_GUID *CallerId, + OUT EFI_LBA *Lba, + OUT UINTN *Offset, + OUT UINTN *Length, + IN OUT UINTN *PrivateDataSize, + OUT VOID *PrivateData, + OUT BOOLEAN *Complete + ); + +// +// Protocol declaration +// +struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL { + EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE GetMaxBlockSize; + EFI_FAULT_TOLERANT_WRITE_ALLOCATE Allocate; + EFI_FAULT_TOLERANT_WRITE_WRITE Write; + EFI_FAULT_TOLERANT_WRITE_RESTART Restart; + EFI_FAULT_TOLERANT_WRITE_ABORT Abort; + EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE GetLastWrite; +}; + +extern EFI_GUID gEfiFaultTolerantWriteProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/FileExplorer.h b/MdeModulePkg/Include/Protocol/FileExplorer.h index aa14d27793..ab83ecce3c 100644 --- a/MdeModulePkg/Include/Protocol/FileExplorer.h +++ b/MdeModulePkg/Include/Protocol/FileExplorer.h @@ -1,69 +1,69 @@ -/** @file
-
- This file explorer protocol defines defines a set of interfaces for
- how to do file explorer.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __FILE_EXPLORER_H__
-#define __FILE_EXPLORER_H__
-
-#define EFI_FILE_EXPLORER_PROTOCOL_GUID \
- { 0x2C03C536, 0x4594, 0x4515, { 0x9E, 0x7A, 0xD3, 0xD2, 0x04, 0xFE, 0x13, 0x63 } }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_FILE_EXPLORER_PROTOCOL EFI_FILE_EXPLORER_PROTOCOL;
-
-/**
- Prototype for the next process after user chosed one file.
-
- @param[in] FilePath The device path of the find file.
-
- @retval TRUE Need exit file explorer after do the extra task.
- @retval FALSE Not need to exit file explorer after do the extra task.
-
-**/
-typedef
-BOOLEAN
-(EFIAPI *CHOOSE_HANDLER)(
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath
- );
-
-/**
- Choose a file in the specified directory.
-
- If user input NULL for the RootDirectory, will choose file in the system.
-
- If user input *File != NULL, function will return the allocate device path
- info for the choosed file, caller has to free the memory after use it.
-
- @param RootDirectory Pointer to the root directory.
- @param FileType The file type need to choose.
- @param ChooseHandler Function pointer to the extra task need to do
- after choose one file.
- @param File Return the device path for the last time chosed file.
-
- @retval EFI_SUCESS Choose the file success.
- @retval Other errors Choose the file failed.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *CHOOSE_FILE)(
- IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory,
- IN CHAR16 *FileType OPTIONAL,
- IN CHOOSE_HANDLER ChooseHandler OPTIONAL,
- OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL
- );
-
-struct _EFI_FILE_EXPLORER_PROTOCOL {
- CHOOSE_FILE ChooseFile;
-};
-
-extern EFI_GUID gEfiFileExplorerProtocolGuid;
-
-#endif
+/** @file + + This file explorer protocol defines defines a set of interfaces for + how to do file explorer. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __FILE_EXPLORER_H__ +#define __FILE_EXPLORER_H__ + +#define EFI_FILE_EXPLORER_PROTOCOL_GUID \ + { 0x2C03C536, 0x4594, 0x4515, { 0x9E, 0x7A, 0xD3, 0xD2, 0x04, 0xFE, 0x13, 0x63 } } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_FILE_EXPLORER_PROTOCOL EFI_FILE_EXPLORER_PROTOCOL; + +/** + Prototype for the next process after user chosed one file. + + @param[in] FilePath The device path of the find file. + + @retval TRUE Need exit file explorer after do the extra task. + @retval FALSE Not need to exit file explorer after do the extra task. + +**/ +typedef +BOOLEAN +(EFIAPI *CHOOSE_HANDLER)( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath + ); + +/** + Choose a file in the specified directory. + + If user input NULL for the RootDirectory, will choose file in the system. + + If user input *File != NULL, function will return the allocate device path + info for the choosed file, caller has to free the memory after use it. + + @param RootDirectory Pointer to the root directory. + @param FileType The file type need to choose. + @param ChooseHandler Function pointer to the extra task need to do + after choose one file. + @param File Return the device path for the last time chosed file. + + @retval EFI_SUCESS Choose the file success. + @retval Other errors Choose the file failed. +**/ +typedef +EFI_STATUS +(EFIAPI *CHOOSE_FILE)( + IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, + IN CHAR16 *FileType OPTIONAL, + IN CHOOSE_HANDLER ChooseHandler OPTIONAL, + OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL + ); + +struct _EFI_FILE_EXPLORER_PROTOCOL { + CHOOSE_FILE ChooseFile; +}; + +extern EFI_GUID gEfiFileExplorerProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h b/MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h index 1f518e745d..45b9c243a3 100644 --- a/MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h +++ b/MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h @@ -1,49 +1,49 @@ -/** @file
- EDK II Firmware Management Progress Protocol.
-
- Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL_H__
-#define __EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL_H__
-
-#include <Protocol/GraphicsOutput.h>
-
-///
-/// EDK II Firmware Management Progress Protocol GUID value
-///
-#define EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL_GUID \
- { \
- 0x1849bda2, 0x6952, 0x4e86, { 0xa1, 0xdb, 0x55, 0x9a, 0x3c, 0x47, 0x9d, 0xf1 } \
- }
-
-///
-/// EDK II Firmware Management Progress Protocol structure
-///
-typedef struct {
- ///
- /// The version of this structure. Initial version value is 0x00000001.
- ///
- UINT32 Version;
- ///
- /// The foreground color of a progress bar that is used by the Progress()
- /// function that is passed into the Firmware Management Protocol SetImage()
- /// service is called.
- ///
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION ProgressBarForegroundColor;
- ///
- /// The time in seconds to arm the watchdog timer each time the Progress()
- /// function passed into the Firmware Management Protocol SetImage() service
- /// is called.
- ///
- UINTN WatchdogSeconds;
-} EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL;
-
-///
-/// EDK II Firmware Management Progress Protocol GUID variable.
-///
-extern EFI_GUID gEdkiiFirmwareManagementProgressProtocolGuid;
-
-#endif
+/** @file + EDK II Firmware Management Progress Protocol. + + Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL_H__ +#define __EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL_H__ + +#include <Protocol/GraphicsOutput.h> + +/// +/// EDK II Firmware Management Progress Protocol GUID value +/// +#define EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL_GUID \ + { \ + 0x1849bda2, 0x6952, 0x4e86, { 0xa1, 0xdb, 0x55, 0x9a, 0x3c, 0x47, 0x9d, 0xf1 } \ + } + +/// +/// EDK II Firmware Management Progress Protocol structure +/// +typedef struct { + /// + /// The version of this structure. Initial version value is 0x00000001. + /// + UINT32 Version; + /// + /// The foreground color of a progress bar that is used by the Progress() + /// function that is passed into the Firmware Management Protocol SetImage() + /// service is called. + /// + EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION ProgressBarForegroundColor; + /// + /// The time in seconds to arm the watchdog timer each time the Progress() + /// function passed into the Firmware Management Protocol SetImage() service + /// is called. + /// + UINTN WatchdogSeconds; +} EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL; + +/// +/// EDK II Firmware Management Progress Protocol GUID variable. +/// +extern EFI_GUID gEdkiiFirmwareManagementProgressProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/FormBrowserEx.h b/MdeModulePkg/Include/Protocol/FormBrowserEx.h index d03665b7ad..7b7ece5ecc 100644 --- a/MdeModulePkg/Include/Protocol/FormBrowserEx.h +++ b/MdeModulePkg/Include/Protocol/FormBrowserEx.h @@ -1,148 +1,148 @@ -/** @file
- Extension Form Browser Protocol provides the services that can be used to
- register the different hot keys for the standard Browser actions described in UEFI specification.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __FORM_BROWSER_EXTENSION_H__
-#define __FORM_BROWSER_EXTENSION_H__
-
-#define FORM_BROWSER_EXTENSION_PROTOCOL_GUID \
- { 0x1f73b18d, 0x4630, 0x43c1, { 0xa1, 0xde, 0x6f, 0x80, 0x85, 0x5d, 0x7d, 0xa4 } }
-
-typedef struct _EDKII_FORM_BROWSER_EXTENSION_PROTOCOL EDKII_FORM_BROWSER_EXTENSION_PROTOCOL;
-
-//
-// To be compatible, keep EFI_FORM_BROWSER_EXTENSION_PROTOCOL definition
-//
-typedef EDKII_FORM_BROWSER_EXTENSION_PROTOCOL EFI_FORM_BROWSER_EXTENSION_PROTOCOL;
-
-//
-// Return value of SAVE_REMINDER() that describes whether the changed data is saved or discarded.
-//
-#define BROWSER_NO_CHANGES 0
-#define BROWSER_SAVE_CHANGES 1
-#define BROWSER_DISCARD_CHANGES 2
-#define BROWSER_KEEP_CURRENT 3
-
-//
-// Browser actions. They can be cominbed together.
-// If more than one actions are specified, the action with low bit will be executed first.
-//
-#define BROWSER_ACTION_UNREGISTER 0
-#define BROWSER_ACTION_DISCARD BIT0
-#define BROWSER_ACTION_DEFAULT BIT1
-#define BROWSER_ACTION_SUBMIT BIT2
-#define BROWSER_ACTION_RESET BIT3
-#define BROWSER_ACTION_EXIT BIT4
-#define BROWSER_ACTION_GOTO BIT5
-
-//
-// Scope for Browser action. It may be Form, FormSet or System level.
-//
-typedef enum {
- FormLevel,
- FormSetLevel,
- SystemLevel,
- MaxLevel
-} BROWSER_SETTING_SCOPE;
-
-/**
- Configure what scope the hot key will impact.
- All hot keys have the same scope. The mixed hot keys with the different level are not supported.
- If no scope is set, the default scope will be FormSet level.
- After all registered hot keys are removed, previous Scope can reset to another level.
-
- @param[in] Scope Scope level to be set.
-
- @retval EFI_SUCCESS Scope is set correctly.
- @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
- @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *SET_SCOPE)(
- IN BROWSER_SETTING_SCOPE Scope
- );
-
-/**
- Register the hot key with its browser action, or unregistered the hot key.
- If the action value is zero, the hot key will be unregistered if it has been registered.
- If the same hot key has been registered, the new action and help string will override the previous ones.
-
- @param[in] KeyData A pointer to a buffer that describes the keystroke
- information for the hot key. Its type is EFI_INPUT_KEY to
- be supported by all ConsoleIn devices.
- @param[in] Action Action value that describes what action will be trigged when the hot key is pressed.
- @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.
- @param[in] HelpString Help string that describes the hot key information.
- Its value may be NULL for the unregistered hot key.
-
- @retval EFI_SUCCESS Hot key is registered or unregistered.
- @retval EFI_INVALID_PARAMETER KeyData is NULL.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *REGISTER_HOT_KEY)(
- IN EFI_INPUT_KEY *KeyData,
- IN UINT32 Action,
- IN UINT16 DefaultId,
- IN EFI_STRING HelpString OPTIONAL
- );
-
-/**
- This handler is responsbile for the left things on normal boot after all UI forms are closed.
- For example, it can continue to boot the first boot option.
-
- It will be used only when EXIT action is trigged as system level.
-**/
-typedef
-VOID
-(EFIAPI *EXIT_HANDLER)(
- VOID
- );
-
-/**
- Register Exit handler function.
- When more than one handler function is registered, the latter one will override the previous one.
- When NULL handler is specified, the previous Exit handler will be unregistered.
-
- @param[in] Handler Pointer to handler function.
-
-**/
-typedef
-VOID
-(EFIAPI *REGISTER_EXIT_HANDLER)(
- IN EXIT_HANDLER Handler
- );
-
-/**
- Create reminder to let user to choose save or discard the changed browser data.
- Caller can use it to actively check the changed browser data.
-
- @retval BROWSER_NO_CHANGES No browser data is changed.
- @retval BROWSER_SAVE_CHANGES The changed browser data is saved.
- @retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
- @retval BROWSER_KEEP_CURRENT Browser keep current changes.
-
-**/
-typedef
-UINT32
-(EFIAPI *SAVE_REMINDER)(
- VOID
- );
-
-struct _EDKII_FORM_BROWSER_EXTENSION_PROTOCOL {
- SET_SCOPE SetScope;
- REGISTER_HOT_KEY RegisterHotKey;
- REGISTER_EXIT_HANDLER RegiserExitHandler;
- SAVE_REMINDER SaveReminder;
-};
-
-extern EFI_GUID gEdkiiFormBrowserExProtocolGuid;
-
-#endif
+/** @file + Extension Form Browser Protocol provides the services that can be used to + register the different hot keys for the standard Browser actions described in UEFI specification. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __FORM_BROWSER_EXTENSION_H__ +#define __FORM_BROWSER_EXTENSION_H__ + +#define FORM_BROWSER_EXTENSION_PROTOCOL_GUID \ + { 0x1f73b18d, 0x4630, 0x43c1, { 0xa1, 0xde, 0x6f, 0x80, 0x85, 0x5d, 0x7d, 0xa4 } } + +typedef struct _EDKII_FORM_BROWSER_EXTENSION_PROTOCOL EDKII_FORM_BROWSER_EXTENSION_PROTOCOL; + +// +// To be compatible, keep EFI_FORM_BROWSER_EXTENSION_PROTOCOL definition +// +typedef EDKII_FORM_BROWSER_EXTENSION_PROTOCOL EFI_FORM_BROWSER_EXTENSION_PROTOCOL; + +// +// Return value of SAVE_REMINDER() that describes whether the changed data is saved or discarded. +// +#define BROWSER_NO_CHANGES 0 +#define BROWSER_SAVE_CHANGES 1 +#define BROWSER_DISCARD_CHANGES 2 +#define BROWSER_KEEP_CURRENT 3 + +// +// Browser actions. They can be cominbed together. +// If more than one actions are specified, the action with low bit will be executed first. +// +#define BROWSER_ACTION_UNREGISTER 0 +#define BROWSER_ACTION_DISCARD BIT0 +#define BROWSER_ACTION_DEFAULT BIT1 +#define BROWSER_ACTION_SUBMIT BIT2 +#define BROWSER_ACTION_RESET BIT3 +#define BROWSER_ACTION_EXIT BIT4 +#define BROWSER_ACTION_GOTO BIT5 + +// +// Scope for Browser action. It may be Form, FormSet or System level. +// +typedef enum { + FormLevel, + FormSetLevel, + SystemLevel, + MaxLevel +} BROWSER_SETTING_SCOPE; + +/** + Configure what scope the hot key will impact. + All hot keys have the same scope. The mixed hot keys with the different level are not supported. + If no scope is set, the default scope will be FormSet level. + After all registered hot keys are removed, previous Scope can reset to another level. + + @param[in] Scope Scope level to be set. + + @retval EFI_SUCCESS Scope is set correctly. + @retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE. + @retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have. + +**/ +typedef +EFI_STATUS +(EFIAPI *SET_SCOPE)( + IN BROWSER_SETTING_SCOPE Scope + ); + +/** + Register the hot key with its browser action, or unregistered the hot key. + If the action value is zero, the hot key will be unregistered if it has been registered. + If the same hot key has been registered, the new action and help string will override the previous ones. + + @param[in] KeyData A pointer to a buffer that describes the keystroke + information for the hot key. Its type is EFI_INPUT_KEY to + be supported by all ConsoleIn devices. + @param[in] Action Action value that describes what action will be trigged when the hot key is pressed. + @param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action. + @param[in] HelpString Help string that describes the hot key information. + Its value may be NULL for the unregistered hot key. + + @retval EFI_SUCCESS Hot key is registered or unregistered. + @retval EFI_INVALID_PARAMETER KeyData is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *REGISTER_HOT_KEY)( + IN EFI_INPUT_KEY *KeyData, + IN UINT32 Action, + IN UINT16 DefaultId, + IN EFI_STRING HelpString OPTIONAL + ); + +/** + This handler is responsbile for the left things on normal boot after all UI forms are closed. + For example, it can continue to boot the first boot option. + + It will be used only when EXIT action is trigged as system level. +**/ +typedef +VOID +(EFIAPI *EXIT_HANDLER)( + VOID + ); + +/** + Register Exit handler function. + When more than one handler function is registered, the latter one will override the previous one. + When NULL handler is specified, the previous Exit handler will be unregistered. + + @param[in] Handler Pointer to handler function. + +**/ +typedef +VOID +(EFIAPI *REGISTER_EXIT_HANDLER)( + IN EXIT_HANDLER Handler + ); + +/** + Create reminder to let user to choose save or discard the changed browser data. + Caller can use it to actively check the changed browser data. + + @retval BROWSER_NO_CHANGES No browser data is changed. + @retval BROWSER_SAVE_CHANGES The changed browser data is saved. + @retval BROWSER_DISCARD_CHANGES The changed browser data is discard. + @retval BROWSER_KEEP_CURRENT Browser keep current changes. + +**/ +typedef +UINT32 +(EFIAPI *SAVE_REMINDER)( + VOID + ); + +struct _EDKII_FORM_BROWSER_EXTENSION_PROTOCOL { + SET_SCOPE SetScope; + REGISTER_HOT_KEY RegisterHotKey; + REGISTER_EXIT_HANDLER RegiserExitHandler; + SAVE_REMINDER SaveReminder; +}; + +extern EFI_GUID gEdkiiFormBrowserExProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/FormBrowserEx2.h b/MdeModulePkg/Include/Protocol/FormBrowserEx2.h index 725f927856..be1d1b954e 100644 --- a/MdeModulePkg/Include/Protocol/FormBrowserEx2.h +++ b/MdeModulePkg/Include/Protocol/FormBrowserEx2.h @@ -1,118 +1,118 @@ -/** @file
- Extension Form Browser Protocol provides the services that can be used to
- register the different hot keys for the standard Browser actions described in UEFI specification.
-
-Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __FORM_BROWSER_EXTENSION2_H__
-#define __FORM_BROWSER_EXTENSION2_H__
-
-#include <Protocol/FormBrowserEx.h>
-
-#define EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL_GUID \
- { 0xa770c357, 0xb693, 0x4e6d, { 0xa6, 0xcf, 0xd2, 0x1c, 0x72, 0x8e, 0x55, 0xb }}
-
-typedef struct _EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL;
-
-#define BROWSER_EXTENSION2_VERSION_1 0x10000
-#define BROWSER_EXTENSION2_VERSION_1_1 0x10001
-
-/**
- Check whether the browser data has been modified.
-
- @retval TRUE Browser data is modified.
- @retval FALSE No browser data is modified.
-
-**/
-typedef
-BOOLEAN
-(EFIAPI *IS_BROWSER_DATA_MODIFIED)(
- VOID
- );
-
-/**
- Execute the action requested by the Action parameter.
-
- @param[in] Action Execute the request action.
- @param[in] DefaultId The default Id info when need to load default value.
-
- @retval EFI_SUCCESS Execute the request action succss.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EXECUTE_ACTION)(
- IN UINT32 Action,
- IN UINT16 DefaultId
- );
-
-/**
- Check whether required reset when exit the browser
-
- @retval TRUE Browser required to reset after exit.
- @retval FALSE Browser not need to reset after exit.
-
-**/
-typedef
-BOOLEAN
-(EFIAPI *IS_RESET_REQUIRED)(
- VOID
- );
-
-#define FORM_ENTRY_INFO_SIGNATURE SIGNATURE_32 ('f', 'e', 'i', 's')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- EFI_HII_HANDLE HiiHandle;
- EFI_GUID FormSetGuid;
- EFI_FORM_ID FormId;
- EFI_QUESTION_ID QuestionId;
-} FORM_ENTRY_INFO;
-
-#define FORM_ENTRY_INFO_FROM_LINK(a) CR (a, FORM_ENTRY_INFO, Link, FORM_ENTRY_INFO_SIGNATURE)
-
-#define FORM_QUESTION_ATTRIBUTE_OVERRIDE_SIGNATURE SIGNATURE_32 ('f', 'q', 'o', 's')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- EFI_QUESTION_ID QuestionId; // Find the question
- EFI_FORM_ID FormId; // Find the form
- EFI_GUID FormSetGuid; // Find the formset.
- EFI_HII_HANDLE HiiHandle; // Find the HII handle
- UINT32 Attribute; // Hide or grayout ...
-} QUESTION_ATTRIBUTE_OVERRIDE;
-
-#define FORM_QUESTION_ATTRIBUTE_OVERRIDE_FROM_LINK(a) CR (a, QUESTION_ATTRIBUTE_OVERRIDE, Link, FORM_QUESTION_ATTRIBUTE_OVERRIDE_SIGNATURE)
-
-struct _EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL {
- ///
- /// Version for protocol future extension.
- ///
- UINT32 Version;
- SET_SCOPE SetScope;
- REGISTER_HOT_KEY RegisterHotKey;
- REGISTER_EXIT_HANDLER RegiserExitHandler;
- IS_BROWSER_DATA_MODIFIED IsBrowserDataModified;
- EXECUTE_ACTION ExecuteAction;
- ///
- /// A list of type FORMID_INFO is Browser View Form History List.
- ///
- LIST_ENTRY FormViewHistoryHead;
- ///
- /// A list of type QUESTION_ATTRIBUTE_OVERRIDE.
- ///
- LIST_ENTRY OverrideQestListHead;
-
- IS_RESET_REQUIRED IsResetRequired;
-};
-
-extern EFI_GUID gEdkiiFormBrowserEx2ProtocolGuid;
-
-#endif
+/** @file + Extension Form Browser Protocol provides the services that can be used to + register the different hot keys for the standard Browser actions described in UEFI specification. + +Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __FORM_BROWSER_EXTENSION2_H__ +#define __FORM_BROWSER_EXTENSION2_H__ + +#include <Protocol/FormBrowserEx.h> + +#define EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL_GUID \ + { 0xa770c357, 0xb693, 0x4e6d, { 0xa6, 0xcf, 0xd2, 0x1c, 0x72, 0x8e, 0x55, 0xb }} + +typedef struct _EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL; + +#define BROWSER_EXTENSION2_VERSION_1 0x10000 +#define BROWSER_EXTENSION2_VERSION_1_1 0x10001 + +/** + Check whether the browser data has been modified. + + @retval TRUE Browser data is modified. + @retval FALSE No browser data is modified. + +**/ +typedef +BOOLEAN +(EFIAPI *IS_BROWSER_DATA_MODIFIED)( + VOID + ); + +/** + Execute the action requested by the Action parameter. + + @param[in] Action Execute the request action. + @param[in] DefaultId The default Id info when need to load default value. + + @retval EFI_SUCCESS Execute the request action succss. + +**/ +typedef +EFI_STATUS +(EFIAPI *EXECUTE_ACTION)( + IN UINT32 Action, + IN UINT16 DefaultId + ); + +/** + Check whether required reset when exit the browser + + @retval TRUE Browser required to reset after exit. + @retval FALSE Browser not need to reset after exit. + +**/ +typedef +BOOLEAN +(EFIAPI *IS_RESET_REQUIRED)( + VOID + ); + +#define FORM_ENTRY_INFO_SIGNATURE SIGNATURE_32 ('f', 'e', 'i', 's') + +typedef struct { + UINTN Signature; + LIST_ENTRY Link; + + EFI_HII_HANDLE HiiHandle; + EFI_GUID FormSetGuid; + EFI_FORM_ID FormId; + EFI_QUESTION_ID QuestionId; +} FORM_ENTRY_INFO; + +#define FORM_ENTRY_INFO_FROM_LINK(a) CR (a, FORM_ENTRY_INFO, Link, FORM_ENTRY_INFO_SIGNATURE) + +#define FORM_QUESTION_ATTRIBUTE_OVERRIDE_SIGNATURE SIGNATURE_32 ('f', 'q', 'o', 's') + +typedef struct { + UINTN Signature; + LIST_ENTRY Link; + + EFI_QUESTION_ID QuestionId; // Find the question + EFI_FORM_ID FormId; // Find the form + EFI_GUID FormSetGuid; // Find the formset. + EFI_HII_HANDLE HiiHandle; // Find the HII handle + UINT32 Attribute; // Hide or grayout ... +} QUESTION_ATTRIBUTE_OVERRIDE; + +#define FORM_QUESTION_ATTRIBUTE_OVERRIDE_FROM_LINK(a) CR (a, QUESTION_ATTRIBUTE_OVERRIDE, Link, FORM_QUESTION_ATTRIBUTE_OVERRIDE_SIGNATURE) + +struct _EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL { + /// + /// Version for protocol future extension. + /// + UINT32 Version; + SET_SCOPE SetScope; + REGISTER_HOT_KEY RegisterHotKey; + REGISTER_EXIT_HANDLER RegiserExitHandler; + IS_BROWSER_DATA_MODIFIED IsBrowserDataModified; + EXECUTE_ACTION ExecuteAction; + /// + /// A list of type FORMID_INFO is Browser View Form History List. + /// + LIST_ENTRY FormViewHistoryHead; + /// + /// A list of type QUESTION_ATTRIBUTE_OVERRIDE. + /// + LIST_ENTRY OverrideQestListHead; + + IS_RESET_REQUIRED IsResetRequired; +}; + +extern EFI_GUID gEdkiiFormBrowserEx2ProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/GenericMemoryTest.h b/MdeModulePkg/Include/Protocol/GenericMemoryTest.h index 00cf6016be..4107373768 100644 --- a/MdeModulePkg/Include/Protocol/GenericMemoryTest.h +++ b/MdeModulePkg/Include/Protocol/GenericMemoryTest.h @@ -1,116 +1,116 @@ -/** @file
- This protocol defines the generic memory test interfaces in Dxe phase.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __GENERIC_MEMORY_TEST_H__
-#define __GENERIC_MEMORY_TEST_H__
-
-#define EFI_GENERIC_MEMORY_TEST_PROTOCOL_GUID \
- { 0x309de7f1, 0x7f5e, 0x4ace, {0xb4, 0x9c, 0x53, 0x1b, 0xe5, 0xaa, 0x95, 0xef} }
-
-typedef struct _EFI_GENERIC_MEMORY_TEST_PROTOCOL EFI_GENERIC_MEMORY_TEST_PROTOCOL;
-
-///
-/// Memory test coverage level.
-/// Ignore chooses not to test memory. Quick and Sparse test some memory, and Extensive performs a detailed memory test.
-///
-typedef enum {
- IGNORE,
- QUICK,
- SPARSE,
- EXTENSIVE,
- MAXLEVEL
-} EXTENDMEM_COVERAGE_LEVEL;
-
-/**
- Initialize the generic memory test.
-
- @param This The protocol instance pointer.
- @param Level The coverage level of the memory test.
- @param RequireSoftECCInit Indicate if the memory need software ECC init.
-
- @retval EFI_SUCCESS The generic memory test is initialized correctly.
- @retval EFI_NO_MEDIA The system had no memory to be tested.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_MEMORY_TEST_INIT)(
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN EXTENDMEM_COVERAGE_LEVEL Level,
- OUT BOOLEAN *RequireSoftECCInit
- );
-
-/**
- Perform the memory test.
-
- @param This The protocol instance pointer.
- @param TestedMemorySize Return the tested extended memory size.
- @param TotalMemorySize Return the whole system physical memory size.
- The total memory size does not include memory in a slot with a disabled DIMM.
- @param ErrorOut TRUE if the memory error occurred.
- @param IfTestAbort Indicates that the user pressed "ESC" to skip the memory test.
-
- @retval EFI_SUCCESS One block of memory passed the test.
- @retval EFI_NOT_FOUND All memory blocks have already been tested.
- @retval EFI_DEVICE_ERROR Memory device error occurred, and no agent can handle it.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PERFORM_MEMORY_TEST)(
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- OUT UINT64 *TestedMemorySize,
- OUT UINT64 *TotalMemorySize,
- OUT BOOLEAN *ErrorOut,
- IN BOOLEAN IfTestAbort
- );
-
-/**
- Finish the memory test.
-
- @param This The protocol instance pointer.
-
- @retval EFI_SUCCESS Success. All resources used in the memory test are freed.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_MEMORY_TEST_FINISHED)(
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This
- );
-
-/**
- Provides the capability to test the compatible range used by some special drivers.
-
- @param This The protocol instance pointer.
- @param StartAddress The start address of the compatible memory range that
- must be below 16M.
- @param Length The compatible memory range's length.
-
- @retval EFI_SUCCESS The compatible memory range pass the memory test.
- @retval EFI_INVALID_PARAMETER The compatible memory range are not below Low 16M.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_MEMORY_TEST_COMPATIBLE_RANGE)(
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS StartAddress,
- IN UINT64 Length
- );
-
-struct _EFI_GENERIC_MEMORY_TEST_PROTOCOL {
- EFI_MEMORY_TEST_INIT MemoryTestInit;
- EFI_PERFORM_MEMORY_TEST PerformMemoryTest;
- EFI_MEMORY_TEST_FINISHED Finished;
- EFI_MEMORY_TEST_COMPATIBLE_RANGE CompatibleRangeTest;
-};
-
-extern EFI_GUID gEfiGenericMemTestProtocolGuid;
-
-#endif
+/** @file + This protocol defines the generic memory test interfaces in Dxe phase. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __GENERIC_MEMORY_TEST_H__ +#define __GENERIC_MEMORY_TEST_H__ + +#define EFI_GENERIC_MEMORY_TEST_PROTOCOL_GUID \ + { 0x309de7f1, 0x7f5e, 0x4ace, {0xb4, 0x9c, 0x53, 0x1b, 0xe5, 0xaa, 0x95, 0xef} } + +typedef struct _EFI_GENERIC_MEMORY_TEST_PROTOCOL EFI_GENERIC_MEMORY_TEST_PROTOCOL; + +/// +/// Memory test coverage level. +/// Ignore chooses not to test memory. Quick and Sparse test some memory, and Extensive performs a detailed memory test. +/// +typedef enum { + IGNORE, + QUICK, + SPARSE, + EXTENSIVE, + MAXLEVEL +} EXTENDMEM_COVERAGE_LEVEL; + +/** + Initialize the generic memory test. + + @param This The protocol instance pointer. + @param Level The coverage level of the memory test. + @param RequireSoftECCInit Indicate if the memory need software ECC init. + + @retval EFI_SUCCESS The generic memory test is initialized correctly. + @retval EFI_NO_MEDIA The system had no memory to be tested. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MEMORY_TEST_INIT)( + IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, + IN EXTENDMEM_COVERAGE_LEVEL Level, + OUT BOOLEAN *RequireSoftECCInit + ); + +/** + Perform the memory test. + + @param This The protocol instance pointer. + @param TestedMemorySize Return the tested extended memory size. + @param TotalMemorySize Return the whole system physical memory size. + The total memory size does not include memory in a slot with a disabled DIMM. + @param ErrorOut TRUE if the memory error occurred. + @param IfTestAbort Indicates that the user pressed "ESC" to skip the memory test. + + @retval EFI_SUCCESS One block of memory passed the test. + @retval EFI_NOT_FOUND All memory blocks have already been tested. + @retval EFI_DEVICE_ERROR Memory device error occurred, and no agent can handle it. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PERFORM_MEMORY_TEST)( + IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, + OUT UINT64 *TestedMemorySize, + OUT UINT64 *TotalMemorySize, + OUT BOOLEAN *ErrorOut, + IN BOOLEAN IfTestAbort + ); + +/** + Finish the memory test. + + @param This The protocol instance pointer. + + @retval EFI_SUCCESS Success. All resources used in the memory test are freed. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MEMORY_TEST_FINISHED)( + IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This + ); + +/** + Provides the capability to test the compatible range used by some special drivers. + + @param This The protocol instance pointer. + @param StartAddress The start address of the compatible memory range that + must be below 16M. + @param Length The compatible memory range's length. + + @retval EFI_SUCCESS The compatible memory range pass the memory test. + @retval EFI_INVALID_PARAMETER The compatible memory range are not below Low 16M. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MEMORY_TEST_COMPATIBLE_RANGE)( + IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, + IN EFI_PHYSICAL_ADDRESS StartAddress, + IN UINT64 Length + ); + +struct _EFI_GENERIC_MEMORY_TEST_PROTOCOL { + EFI_MEMORY_TEST_INIT MemoryTestInit; + EFI_PERFORM_MEMORY_TEST PerformMemoryTest; + EFI_MEMORY_TEST_FINISHED Finished; + EFI_MEMORY_TEST_COMPATIBLE_RANGE CompatibleRangeTest; +}; + +extern EFI_GUID gEfiGenericMemTestProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/IoMmu.h b/MdeModulePkg/Include/Protocol/IoMmu.h index f14ed96516..28920c7f6c 100644 --- a/MdeModulePkg/Include/Protocol/IoMmu.h +++ b/MdeModulePkg/Include/Protocol/IoMmu.h @@ -1,252 +1,252 @@ -/** @file
- EFI IOMMU Protocol.
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __IOMMU_H__
-#define __IOMMU_H__
-
-//
-// IOMMU Protocol GUID value
-//
-#define EDKII_IOMMU_PROTOCOL_GUID \
- { \
- 0x4e939de9, 0xd948, 0x4b0f, { 0x88, 0xed, 0xe6, 0xe1, 0xce, 0x51, 0x7c, 0x1e } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EDKII_IOMMU_PROTOCOL EDKII_IOMMU_PROTOCOL;
-
-//
-// Revision The revision to which the IOMMU interface adheres.
-// All future revisions must be backwards compatible.
-// If a future version is not back wards compatible it is not the same GUID.
-//
-#define EDKII_IOMMU_PROTOCOL_REVISION 0x00010000
-
-//
-// IOMMU Access for SetAttribute
-//
-// These types can be "ORed" together as needed.
-// Any undefined bits are reserved and must be zero.
-//
-#define EDKII_IOMMU_ACCESS_READ 0x1
-#define EDKII_IOMMU_ACCESS_WRITE 0x2
-
-//
-// IOMMU Operation for Map
-//
-typedef enum {
- ///
- /// A read operation from system memory by a bus master that is not capable of producing
- /// PCI dual address cycles.
- ///
- EdkiiIoMmuOperationBusMasterRead,
- ///
- /// A write operation from system memory by a bus master that is not capable of producing
- /// PCI dual address cycles.
- ///
- EdkiiIoMmuOperationBusMasterWrite,
- ///
- /// Provides both read and write access to system memory by both the processor and a bus
- /// master that is not capable of producing PCI dual address cycles.
- ///
- EdkiiIoMmuOperationBusMasterCommonBuffer,
- ///
- /// A read operation from system memory by a bus master that is capable of producing PCI
- /// dual address cycles.
- ///
- EdkiiIoMmuOperationBusMasterRead64,
- ///
- /// A write operation to system memory by a bus master that is capable of producing PCI
- /// dual address cycles.
- ///
- EdkiiIoMmuOperationBusMasterWrite64,
- ///
- /// Provides both read and write access to system memory by both the processor and a bus
- /// master that is capable of producing PCI dual address cycles.
- ///
- EdkiiIoMmuOperationBusMasterCommonBuffer64,
- EdkiiIoMmuOperationMaximum
-} EDKII_IOMMU_OPERATION;
-
-//
-// IOMMU attribute for AllocateBuffer
-// Any undefined bits are reserved and must be zero.
-//
-#define EDKII_IOMMU_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
-#define EDKII_IOMMU_ATTRIBUTE_MEMORY_CACHED 0x0800
-#define EDKII_IOMMU_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
-
-#define EDKII_IOMMU_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER (EDKII_IOMMU_ATTRIBUTE_MEMORY_WRITE_COMBINE | EDKII_IOMMU_ATTRIBUTE_MEMORY_CACHED | EDKII_IOMMU_ATTRIBUTE_DUAL_ADDRESS_CYCLE)
-
-#define EDKII_IOMMU_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER (~EDKII_IOMMU_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER)
-
-/**
- Set IOMMU attribute for a system memory.
-
- If the IOMMU protocol exists, the system memory cannot be used
- for DMA by default.
-
- When a device requests a DMA access for a system memory,
- the device driver need use SetAttribute() to update the IOMMU
- attribute to request DMA access (read and/or write).
-
- The DeviceHandle is used to identify which device submits the request.
- The IOMMU implementation need translate the device path to an IOMMU device ID,
- and set IOMMU hardware register accordingly.
- 1) DeviceHandle can be a standard PCI device.
- The memory for BusMasterRead need set EDKII_IOMMU_ACCESS_READ.
- The memory for BusMasterWrite need set EDKII_IOMMU_ACCESS_WRITE.
- The memory for BusMasterCommonBuffer need set EDKII_IOMMU_ACCESS_READ|EDKII_IOMMU_ACCESS_WRITE.
- After the memory is used, the memory need set 0 to keep it being protected.
- 2) DeviceHandle can be an ACPI device (ISA, I2C, SPI, etc).
- The memory for DMA access need set EDKII_IOMMU_ACCESS_READ and/or EDKII_IOMMU_ACCESS_WRITE.
-
- @param[in] This The protocol instance pointer.
- @param[in] DeviceHandle The device who initiates the DMA access request.
- @param[in] Mapping The mapping value returned from Map().
- @param[in] IoMmuAccess The IOMMU access.
-
- @retval EFI_SUCCESS The IoMmuAccess is set for the memory range specified by DeviceAddress and Length.
- @retval EFI_INVALID_PARAMETER DeviceHandle is an invalid handle.
- @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map().
- @retval EFI_INVALID_PARAMETER IoMmuAccess specified an illegal combination of access.
- @retval EFI_UNSUPPORTED DeviceHandle is unknown by the IOMMU.
- @retval EFI_UNSUPPORTED The bit mask of IoMmuAccess is not supported by the IOMMU.
- @retval EFI_UNSUPPORTED The IOMMU does not support the memory range specified by Mapping.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources available to modify the IOMMU access.
- @retval EFI_DEVICE_ERROR The IOMMU device reported an error while attempting the operation.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_IOMMU_SET_ATTRIBUTE)(
- IN EDKII_IOMMU_PROTOCOL *This,
- IN EFI_HANDLE DeviceHandle,
- IN VOID *Mapping,
- IN UINT64 IoMmuAccess
- );
-
-/**
- Provides the controller-specific addresses required to access system memory from a
- DMA bus master.
-
- @param This The protocol instance pointer.
- @param Operation Indicates if the bus master is going to read or write to system memory.
- @param HostAddress The system memory address to map to the PCI controller.
- @param NumberOfBytes On input the number of bytes to map. On output the number of bytes
- that were mapped.
- @param DeviceAddress The resulting map address for the bus master PCI controller to use to
- access the hosts HostAddress.
- @param Mapping A resulting value to pass to Unmap().
-
- @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
- @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_IOMMU_MAP)(
- IN EDKII_IOMMU_PROTOCOL *This,
- IN EDKII_IOMMU_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- );
-
-/**
- Completes the Map() operation and releases any corresponding resources.
-
- @param This The protocol instance pointer.
- @param Mapping The mapping value returned from Map().
-
- @retval EFI_SUCCESS The range was unmapped.
- @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map().
- @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_IOMMU_UNMAP)(
- IN EDKII_IOMMU_PROTOCOL *This,
- IN VOID *Mapping
- );
-
-/**
- Allocates pages that are suitable for an OperationBusMasterCommonBuffer or
- OperationBusMasterCommonBuffer64 mapping.
-
- @param This The protocol instance pointer.
- @param Type This parameter is not used and must be ignored.
- @param MemoryType The type of memory to allocate, EfiBootServicesData or
- EfiRuntimeServicesData.
- @param Pages The number of pages to allocate.
- @param HostAddress A pointer to store the base system memory address of the
- allocated range.
- @param Attributes The requested bit mask of attributes for the allocated range.
-
- @retval EFI_SUCCESS The requested memory pages were allocated.
- @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
- MEMORY_WRITE_COMBINE, MEMORY_CACHED and DUAL_ADDRESS_CYCLE.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_IOMMU_ALLOCATE_BUFFER)(
- IN EDKII_IOMMU_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- IN OUT VOID **HostAddress,
- IN UINT64 Attributes
- );
-
-/**
- Frees memory that was allocated with AllocateBuffer().
-
- @param This The protocol instance pointer.
- @param Pages The number of pages to free.
- @param HostAddress The base system memory address of the allocated range.
-
- @retval EFI_SUCCESS The requested memory pages were freed.
- @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
- was not allocated with AllocateBuffer().
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_IOMMU_FREE_BUFFER)(
- IN EDKII_IOMMU_PROTOCOL *This,
- IN UINTN Pages,
- IN VOID *HostAddress
- );
-
-///
-/// IOMMU Protocol structure.
-///
-struct _EDKII_IOMMU_PROTOCOL {
- UINT64 Revision;
- EDKII_IOMMU_SET_ATTRIBUTE SetAttribute;
- EDKII_IOMMU_MAP Map;
- EDKII_IOMMU_UNMAP Unmap;
- EDKII_IOMMU_ALLOCATE_BUFFER AllocateBuffer;
- EDKII_IOMMU_FREE_BUFFER FreeBuffer;
-};
-
-///
-/// IOMMU Protocol GUID variable.
-///
-extern EFI_GUID gEdkiiIoMmuProtocolGuid;
-
-#endif
+/** @file + EFI IOMMU Protocol. + +Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __IOMMU_H__ +#define __IOMMU_H__ + +// +// IOMMU Protocol GUID value +// +#define EDKII_IOMMU_PROTOCOL_GUID \ + { \ + 0x4e939de9, 0xd948, 0x4b0f, { 0x88, 0xed, 0xe6, 0xe1, 0xce, 0x51, 0x7c, 0x1e } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EDKII_IOMMU_PROTOCOL EDKII_IOMMU_PROTOCOL; + +// +// Revision The revision to which the IOMMU interface adheres. +// All future revisions must be backwards compatible. +// If a future version is not back wards compatible it is not the same GUID. +// +#define EDKII_IOMMU_PROTOCOL_REVISION 0x00010000 + +// +// IOMMU Access for SetAttribute +// +// These types can be "ORed" together as needed. +// Any undefined bits are reserved and must be zero. +// +#define EDKII_IOMMU_ACCESS_READ 0x1 +#define EDKII_IOMMU_ACCESS_WRITE 0x2 + +// +// IOMMU Operation for Map +// +typedef enum { + /// + /// A read operation from system memory by a bus master that is not capable of producing + /// PCI dual address cycles. + /// + EdkiiIoMmuOperationBusMasterRead, + /// + /// A write operation from system memory by a bus master that is not capable of producing + /// PCI dual address cycles. + /// + EdkiiIoMmuOperationBusMasterWrite, + /// + /// Provides both read and write access to system memory by both the processor and a bus + /// master that is not capable of producing PCI dual address cycles. + /// + EdkiiIoMmuOperationBusMasterCommonBuffer, + /// + /// A read operation from system memory by a bus master that is capable of producing PCI + /// dual address cycles. + /// + EdkiiIoMmuOperationBusMasterRead64, + /// + /// A write operation to system memory by a bus master that is capable of producing PCI + /// dual address cycles. + /// + EdkiiIoMmuOperationBusMasterWrite64, + /// + /// Provides both read and write access to system memory by both the processor and a bus + /// master that is capable of producing PCI dual address cycles. + /// + EdkiiIoMmuOperationBusMasterCommonBuffer64, + EdkiiIoMmuOperationMaximum +} EDKII_IOMMU_OPERATION; + +// +// IOMMU attribute for AllocateBuffer +// Any undefined bits are reserved and must be zero. +// +#define EDKII_IOMMU_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 +#define EDKII_IOMMU_ATTRIBUTE_MEMORY_CACHED 0x0800 +#define EDKII_IOMMU_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 + +#define EDKII_IOMMU_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER (EDKII_IOMMU_ATTRIBUTE_MEMORY_WRITE_COMBINE | EDKII_IOMMU_ATTRIBUTE_MEMORY_CACHED | EDKII_IOMMU_ATTRIBUTE_DUAL_ADDRESS_CYCLE) + +#define EDKII_IOMMU_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER (~EDKII_IOMMU_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER) + +/** + Set IOMMU attribute for a system memory. + + If the IOMMU protocol exists, the system memory cannot be used + for DMA by default. + + When a device requests a DMA access for a system memory, + the device driver need use SetAttribute() to update the IOMMU + attribute to request DMA access (read and/or write). + + The DeviceHandle is used to identify which device submits the request. + The IOMMU implementation need translate the device path to an IOMMU device ID, + and set IOMMU hardware register accordingly. + 1) DeviceHandle can be a standard PCI device. + The memory for BusMasterRead need set EDKII_IOMMU_ACCESS_READ. + The memory for BusMasterWrite need set EDKII_IOMMU_ACCESS_WRITE. + The memory for BusMasterCommonBuffer need set EDKII_IOMMU_ACCESS_READ|EDKII_IOMMU_ACCESS_WRITE. + After the memory is used, the memory need set 0 to keep it being protected. + 2) DeviceHandle can be an ACPI device (ISA, I2C, SPI, etc). + The memory for DMA access need set EDKII_IOMMU_ACCESS_READ and/or EDKII_IOMMU_ACCESS_WRITE. + + @param[in] This The protocol instance pointer. + @param[in] DeviceHandle The device who initiates the DMA access request. + @param[in] Mapping The mapping value returned from Map(). + @param[in] IoMmuAccess The IOMMU access. + + @retval EFI_SUCCESS The IoMmuAccess is set for the memory range specified by DeviceAddress and Length. + @retval EFI_INVALID_PARAMETER DeviceHandle is an invalid handle. + @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map(). + @retval EFI_INVALID_PARAMETER IoMmuAccess specified an illegal combination of access. + @retval EFI_UNSUPPORTED DeviceHandle is unknown by the IOMMU. + @retval EFI_UNSUPPORTED The bit mask of IoMmuAccess is not supported by the IOMMU. + @retval EFI_UNSUPPORTED The IOMMU does not support the memory range specified by Mapping. + @retval EFI_OUT_OF_RESOURCES There are not enough resources available to modify the IOMMU access. + @retval EFI_DEVICE_ERROR The IOMMU device reported an error while attempting the operation. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_IOMMU_SET_ATTRIBUTE)( + IN EDKII_IOMMU_PROTOCOL *This, + IN EFI_HANDLE DeviceHandle, + IN VOID *Mapping, + IN UINT64 IoMmuAccess + ); + +/** + Provides the controller-specific addresses required to access system memory from a + DMA bus master. + + @param This The protocol instance pointer. + @param Operation Indicates if the bus master is going to read or write to system memory. + @param HostAddress The system memory address to map to the PCI controller. + @param NumberOfBytes On input the number of bytes to map. On output the number of bytes + that were mapped. + @param DeviceAddress The resulting map address for the bus master PCI controller to use to + access the hosts HostAddress. + @param Mapping A resulting value to pass to Unmap(). + + @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_DEVICE_ERROR The system hardware could not map the requested address. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_IOMMU_MAP)( + IN EDKII_IOMMU_PROTOCOL *This, + IN EDKII_IOMMU_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); + +/** + Completes the Map() operation and releases any corresponding resources. + + @param This The protocol instance pointer. + @param Mapping The mapping value returned from Map(). + + @retval EFI_SUCCESS The range was unmapped. + @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map(). + @retval EFI_DEVICE_ERROR The data was not committed to the target system memory. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_IOMMU_UNMAP)( + IN EDKII_IOMMU_PROTOCOL *This, + IN VOID *Mapping + ); + +/** + Allocates pages that are suitable for an OperationBusMasterCommonBuffer or + OperationBusMasterCommonBuffer64 mapping. + + @param This The protocol instance pointer. + @param Type This parameter is not used and must be ignored. + @param MemoryType The type of memory to allocate, EfiBootServicesData or + EfiRuntimeServicesData. + @param Pages The number of pages to allocate. + @param HostAddress A pointer to store the base system memory address of the + allocated range. + @param Attributes The requested bit mask of attributes for the allocated range. + + @retval EFI_SUCCESS The requested memory pages were allocated. + @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are + MEMORY_WRITE_COMBINE, MEMORY_CACHED and DUAL_ADDRESS_CYCLE. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_IOMMU_ALLOCATE_BUFFER)( + IN EDKII_IOMMU_PROTOCOL *This, + IN EFI_ALLOCATE_TYPE Type, + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages, + IN OUT VOID **HostAddress, + IN UINT64 Attributes + ); + +/** + Frees memory that was allocated with AllocateBuffer(). + + @param This The protocol instance pointer. + @param Pages The number of pages to free. + @param HostAddress The base system memory address of the allocated range. + + @retval EFI_SUCCESS The requested memory pages were freed. + @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages + was not allocated with AllocateBuffer(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_IOMMU_FREE_BUFFER)( + IN EDKII_IOMMU_PROTOCOL *This, + IN UINTN Pages, + IN VOID *HostAddress + ); + +/// +/// IOMMU Protocol structure. +/// +struct _EDKII_IOMMU_PROTOCOL { + UINT64 Revision; + EDKII_IOMMU_SET_ATTRIBUTE SetAttribute; + EDKII_IOMMU_MAP Map; + EDKII_IOMMU_UNMAP Unmap; + EDKII_IOMMU_ALLOCATE_BUFFER AllocateBuffer; + EDKII_IOMMU_FREE_BUFFER FreeBuffer; +}; + +/// +/// IOMMU Protocol GUID variable. +/// +extern EFI_GUID gEdkiiIoMmuProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/IpmiProtocol.h b/MdeModulePkg/Include/Protocol/IpmiProtocol.h index 61083b0352..c4f36ab853 100644 --- a/MdeModulePkg/Include/Protocol/IpmiProtocol.h +++ b/MdeModulePkg/Include/Protocol/IpmiProtocol.h @@ -1,65 +1,65 @@ -/** @file
- Protocol of Ipmi for both SMS and SMM.
-
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _IPMI_PROTOCOL_H_
-#define _IPMI_PROTOCOL_H_
-
-typedef struct _IPMI_PROTOCOL IPMI_PROTOCOL;
-
-#define IPMI_PROTOCOL_GUID \
- { \
- 0xdbc6381f, 0x5554, 0x4d14, 0x8f, 0xfd, 0x76, 0xd7, 0x87, 0xb8, 0xac, 0xbf \
- }
-
-#define SMM_IPMI_PROTOCOL_GUID \
- { \
- 0x5169af60, 0x8c5a, 0x4243, 0xb3, 0xe9, 0x56, 0xc5, 0x6d, 0x18, 0xee, 0x26 \
- }
-
-/**
- This service enables submitting commands via Ipmi.
-
- @param[in] This This point for IPMI_PROTOCOL structure.
- @param[in] NetFunction Net function of the command.
- @param[in] Command IPMI Command.
- @param[in] RequestData Command Request Data.
- @param[in] RequestDataSize Size of Command Request Data.
- @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
- @param[in, out] ResponseDataSize Size of Command Response Data.
-
- @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
- @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
- @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
- @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
- @retval EFI_TIMEOUT The command time out.
- @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
- @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *IPMI_SUBMIT_COMMAND)(
- IN IPMI_PROTOCOL *This,
- IN UINT8 NetFunction,
- IN UINT8 Command,
- IN UINT8 *RequestData,
- IN UINT32 RequestDataSize,
- OUT UINT8 *ResponseData,
- IN OUT UINT32 *ResponseDataSize
- );
-
-//
-// IPMI COMMAND PROTOCOL
-//
-struct _IPMI_PROTOCOL {
- IPMI_SUBMIT_COMMAND IpmiSubmitCommand;
-};
-
-extern EFI_GUID gIpmiProtocolGuid;
-extern EFI_GUID gSmmIpmiProtocolGuid;
-
-#endif
+/** @file + Protocol of Ipmi for both SMS and SMM. + + Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _IPMI_PROTOCOL_H_ +#define _IPMI_PROTOCOL_H_ + +typedef struct _IPMI_PROTOCOL IPMI_PROTOCOL; + +#define IPMI_PROTOCOL_GUID \ + { \ + 0xdbc6381f, 0x5554, 0x4d14, 0x8f, 0xfd, 0x76, 0xd7, 0x87, 0xb8, 0xac, 0xbf \ + } + +#define SMM_IPMI_PROTOCOL_GUID \ + { \ + 0x5169af60, 0x8c5a, 0x4243, 0xb3, 0xe9, 0x56, 0xc5, 0x6d, 0x18, 0xee, 0x26 \ + } + +/** + This service enables submitting commands via Ipmi. + + @param[in] This This point for IPMI_PROTOCOL structure. + @param[in] NetFunction Net function of the command. + @param[in] Command IPMI Command. + @param[in] RequestData Command Request Data. + @param[in] RequestDataSize Size of Command Request Data. + @param[out] ResponseData Command Response Data. The completion code is the first byte of response data. + @param[in, out] ResponseDataSize Size of Command Response Data. + + @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received. + @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device. + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access. + @retval EFI_DEVICE_ERROR Ipmi Device hardware error. + @retval EFI_TIMEOUT The command time out. + @retval EFI_UNSUPPORTED The command was not successfully sent to the device. + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error. +**/ +typedef +EFI_STATUS +(EFIAPI *IPMI_SUBMIT_COMMAND)( + IN IPMI_PROTOCOL *This, + IN UINT8 NetFunction, + IN UINT8 Command, + IN UINT8 *RequestData, + IN UINT32 RequestDataSize, + OUT UINT8 *ResponseData, + IN OUT UINT32 *ResponseDataSize + ); + +// +// IPMI COMMAND PROTOCOL +// +struct _IPMI_PROTOCOL { + IPMI_SUBMIT_COMMAND IpmiSubmitCommand; +}; + +extern EFI_GUID gIpmiProtocolGuid; +extern EFI_GUID gSmmIpmiProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/LoadPe32Image.h b/MdeModulePkg/Include/Protocol/LoadPe32Image.h index 514942890e..8c8cff1525 100644 --- a/MdeModulePkg/Include/Protocol/LoadPe32Image.h +++ b/MdeModulePkg/Include/Protocol/LoadPe32Image.h @@ -1,96 +1,96 @@ -/** @file
-
- Load Pe32 Image protocol enables loading and unloading EFI images into memory and executing those images.
- This protocol uses File Device Path to get an EFI image.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __LOAD_PE32_IMAGE_H__
-#define __LOAD_PE32_IMAGE_H__
-
-#define PE32_IMAGE_PROTOCOL_GUID \
- {0x5cb5c776,0x60d5,0x45ee,{0x88,0x3c,0x45,0x27,0x8,0xcd,0x74,0x3f }}
-
-#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE 0x00
-#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION 0x01
-#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION 0x02
-
-typedef struct _EFI_PE32_IMAGE_PROTOCOL EFI_PE32_IMAGE_PROTOCOL;
-
-/**
-
- Loads an EFI image into memory and returns a handle to the image with extended parameters.
-
- @param This The pointer to the LoadPe32Image protocol instance
- @param ParentImageHandle The caller's image handle.
- @param FilePath The specific file path from which the image is loaded.
- @param SourceBuffer If not NULL, a pointer to the memory location containing a copy of
- the image to be loaded.
- @param SourceSize The size in bytes of SourceBuffer.
- @param DstBuffer The buffer to store the image.
- @param NumberOfPages For input, specifies the space size of the image by caller if not NULL.
- For output, specifies the actual space size needed.
- @param ImageHandle The image handle for output.
- @param EntryPoint The image entry point for output.
- @param Attribute The bit mask of attributes to set for the load PE image.
-
- @retval EFI_SUCCESS The image was loaded into memory.
- @retval EFI_NOT_FOUND The FilePath was not found.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED The image type is not supported, or the device path cannot be
- parsed to locate the proper protocol for loading the file.
- @retval EFI_OUT_OF_RESOURCES The image was not loaded due to insufficient memory resources.
- @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
- understood.
- @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
- @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
- image from being loaded. NULL is returned in *ImageHandle.
- @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
- valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
- platform policy specifies that the image should not be started.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *LOAD_PE_IMAGE)(
- IN EFI_PE32_IMAGE_PROTOCOL *This,
- IN EFI_HANDLE ParentImageHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN VOID *SourceBuffer OPTIONAL,
- IN UINTN SourceSize,
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
- IN OUT UINTN *NumberOfPages OPTIONAL,
- OUT EFI_HANDLE *ImageHandle,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
- IN UINT32 Attribute
- );
-
-/**
-
- Unload the specified image.
-
- @param This The pointer to the LoadPe32Image protocol instance
- @param ImageHandle The specified image handle to be unloaded.
-
- @retval EFI_INVALID_PARAMETER Image handle is NULL.
- @retval EFI_UNSUPPORTED Attempted to unload an unsupported image.
- @retval EFI_SUCCESS The image successfully unloaded.
-
---*/
-typedef
-EFI_STATUS
-(EFIAPI *UNLOAD_PE_IMAGE)(
- IN EFI_PE32_IMAGE_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle
- );
-
-struct _EFI_PE32_IMAGE_PROTOCOL {
- LOAD_PE_IMAGE LoadPeImage;
- UNLOAD_PE_IMAGE UnLoadPeImage;
-};
-
-extern EFI_GUID gEfiLoadPeImageProtocolGuid;
-
-#endif
+/** @file + + Load Pe32 Image protocol enables loading and unloading EFI images into memory and executing those images. + This protocol uses File Device Path to get an EFI image. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __LOAD_PE32_IMAGE_H__ +#define __LOAD_PE32_IMAGE_H__ + +#define PE32_IMAGE_PROTOCOL_GUID \ + {0x5cb5c776,0x60d5,0x45ee,{0x88,0x3c,0x45,0x27,0x8,0xcd,0x74,0x3f }} + +#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE 0x00 +#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION 0x01 +#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION 0x02 + +typedef struct _EFI_PE32_IMAGE_PROTOCOL EFI_PE32_IMAGE_PROTOCOL; + +/** + + Loads an EFI image into memory and returns a handle to the image with extended parameters. + + @param This The pointer to the LoadPe32Image protocol instance + @param ParentImageHandle The caller's image handle. + @param FilePath The specific file path from which the image is loaded. + @param SourceBuffer If not NULL, a pointer to the memory location containing a copy of + the image to be loaded. + @param SourceSize The size in bytes of SourceBuffer. + @param DstBuffer The buffer to store the image. + @param NumberOfPages For input, specifies the space size of the image by caller if not NULL. + For output, specifies the actual space size needed. + @param ImageHandle The image handle for output. + @param EntryPoint The image entry point for output. + @param Attribute The bit mask of attributes to set for the load PE image. + + @retval EFI_SUCCESS The image was loaded into memory. + @retval EFI_NOT_FOUND The FilePath was not found. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED The image type is not supported, or the device path cannot be + parsed to locate the proper protocol for loading the file. + @retval EFI_OUT_OF_RESOURCES The image was not loaded due to insufficient memory resources. + @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not + understood. + @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error. + @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the + image from being loaded. NULL is returned in *ImageHandle. + @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a + valid EFI_LOADED_IMAGE_PROTOCOL. However, the current + platform policy specifies that the image should not be started. +**/ +typedef +EFI_STATUS +(EFIAPI *LOAD_PE_IMAGE)( + IN EFI_PE32_IMAGE_PROTOCOL *This, + IN EFI_HANDLE ParentImageHandle, + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN VOID *SourceBuffer OPTIONAL, + IN UINTN SourceSize, + IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL, + IN OUT UINTN *NumberOfPages OPTIONAL, + OUT EFI_HANDLE *ImageHandle, + OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL, + IN UINT32 Attribute + ); + +/** + + Unload the specified image. + + @param This The pointer to the LoadPe32Image protocol instance + @param ImageHandle The specified image handle to be unloaded. + + @retval EFI_INVALID_PARAMETER Image handle is NULL. + @retval EFI_UNSUPPORTED Attempted to unload an unsupported image. + @retval EFI_SUCCESS The image successfully unloaded. + +--*/ +typedef +EFI_STATUS +(EFIAPI *UNLOAD_PE_IMAGE)( + IN EFI_PE32_IMAGE_PROTOCOL *This, + IN EFI_HANDLE ImageHandle + ); + +struct _EFI_PE32_IMAGE_PROTOCOL { + LOAD_PE_IMAGE LoadPeImage; + UNLOAD_PE_IMAGE UnLoadPeImage; +}; + +extern EFI_GUID gEfiLoadPeImageProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/LockBox.h b/MdeModulePkg/Include/Protocol/LockBox.h index 4c6e28c0ec..cb743c464a 100644 --- a/MdeModulePkg/Include/Protocol/LockBox.h +++ b/MdeModulePkg/Include/Protocol/LockBox.h @@ -1,24 +1,24 @@ -/** @file
- LockBox protocol header file.
- This is used to resolve dependency problem. The LockBox implementation
- install this to broadcast that LockBox API is ready. The driver who will
- use LockBox at its ENTRYPOINT should add this dependency.
-
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _LOCK_BOX_PROTOCOL_H_
-#define _LOCK_BOX_PROTOCOL_H_
-
-///
-/// Global ID for the EFI LOCK BOX Protocol.
-///
-#define EFI_LOCK_BOX_PROTOCOL_GUID \
- { 0xbd445d79, 0xb7ad, 0x4f04, { 0x9a, 0xd8, 0x29, 0xbd, 0x20, 0x40, 0xeb, 0x3c }}
-
-extern EFI_GUID gEfiLockBoxProtocolGuid;
-
-#endif
+/** @file + LockBox protocol header file. + This is used to resolve dependency problem. The LockBox implementation + install this to broadcast that LockBox API is ready. The driver who will + use LockBox at its ENTRYPOINT should add this dependency. + +Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _LOCK_BOX_PROTOCOL_H_ +#define _LOCK_BOX_PROTOCOL_H_ + +/// +/// Global ID for the EFI LOCK BOX Protocol. +/// +#define EFI_LOCK_BOX_PROTOCOL_GUID \ + { 0xbd445d79, 0xb7ad, 0x4f04, { 0x9a, 0xd8, 0x29, 0xbd, 0x20, 0x40, 0xeb, 0x3c }} + +extern EFI_GUID gEfiLockBoxProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h b/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h index 2399e6fdc1..f3f1b56a29 100644 --- a/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h +++ b/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h @@ -1,71 +1,71 @@ -/** @file
- Protocol to describe devices that are not on a discoverable bus
-
- Copyright (c) 2016, Linaro, Ltd. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __NON_DISCOVERABLE_DEVICE_H__
-#define __NON_DISCOVERABLE_DEVICE_H__
-
-#include <IndustryStandard/Acpi.h>
-
-#define EDKII_NON_DISCOVERABLE_DEVICE_PROTOCOL_GUID \
- { 0x0d51905b, 0xb77e, 0x452a, {0xa2, 0xc0, 0xec, 0xa0, 0xcc, 0x8d, 0x51, 0x4a } }
-
-//
-// Protocol interface structure
-//
-typedef struct _NON_DISCOVERABLE_DEVICE NON_DISCOVERABLE_DEVICE;
-
-//
-// Data Types
-//
-typedef enum {
- NonDiscoverableDeviceDmaTypeCoherent,
- NonDiscoverableDeviceDmaTypeNonCoherent,
- NonDiscoverableDeviceDmaTypeMax,
-} NON_DISCOVERABLE_DEVICE_DMA_TYPE;
-
-//
-// Function Prototypes
-//
-
-/**
- Perform device specific initialization before the device is started
-
- @param This The non-discoverable device protocol pointer
-
- @retval EFI_SUCCESS Initialization successful, the device may be used
- @retval Other Initialization failed, device should not be started
-**/
-typedef
-EFI_STATUS
-(EFIAPI *NON_DISCOVERABLE_DEVICE_INIT)(
- IN NON_DISCOVERABLE_DEVICE *This
- );
-
-struct _NON_DISCOVERABLE_DEVICE {
- //
- // The type of device
- //
- CONST EFI_GUID *Type;
- //
- // Whether this device is DMA coherent
- //
- NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType;
- //
- // Initialization function for the device
- //
- NON_DISCOVERABLE_DEVICE_INIT Initialize;
- //
- // The MMIO and I/O regions owned by the device
- //
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Resources;
-};
-
-extern EFI_GUID gEdkiiNonDiscoverableDeviceProtocolGuid;
-
-#endif
+/** @file + Protocol to describe devices that are not on a discoverable bus + + Copyright (c) 2016, Linaro, Ltd. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __NON_DISCOVERABLE_DEVICE_H__ +#define __NON_DISCOVERABLE_DEVICE_H__ + +#include <IndustryStandard/Acpi.h> + +#define EDKII_NON_DISCOVERABLE_DEVICE_PROTOCOL_GUID \ + { 0x0d51905b, 0xb77e, 0x452a, {0xa2, 0xc0, 0xec, 0xa0, 0xcc, 0x8d, 0x51, 0x4a } } + +// +// Protocol interface structure +// +typedef struct _NON_DISCOVERABLE_DEVICE NON_DISCOVERABLE_DEVICE; + +// +// Data Types +// +typedef enum { + NonDiscoverableDeviceDmaTypeCoherent, + NonDiscoverableDeviceDmaTypeNonCoherent, + NonDiscoverableDeviceDmaTypeMax, +} NON_DISCOVERABLE_DEVICE_DMA_TYPE; + +// +// Function Prototypes +// + +/** + Perform device specific initialization before the device is started + + @param This The non-discoverable device protocol pointer + + @retval EFI_SUCCESS Initialization successful, the device may be used + @retval Other Initialization failed, device should not be started +**/ +typedef +EFI_STATUS +(EFIAPI *NON_DISCOVERABLE_DEVICE_INIT)( + IN NON_DISCOVERABLE_DEVICE *This + ); + +struct _NON_DISCOVERABLE_DEVICE { + // + // The type of device + // + CONST EFI_GUID *Type; + // + // Whether this device is DMA coherent + // + NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType; + // + // Initialization function for the device + // + NON_DISCOVERABLE_DEVICE_INIT Initialize; + // + // The MMIO and I/O regions owned by the device + // + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Resources; +}; + +extern EFI_GUID gEdkiiNonDiscoverableDeviceProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h b/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h index ca6c94b26c..75df617e29 100644 --- a/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h +++ b/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h @@ -1,100 +1,100 @@ -/** @file
- Copyright (c) 2019, Linaro, Ltd. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_
-#define _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_
-
-#define EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID \
- { 0x96F46153, 0x97A7, 0x4793, { 0xAC, 0xC1, 0xFA, 0x19, 0xBF, 0x78, 0xEA, 0x97 } }
-
-typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;
-
-/**
- Check whether the emulator supports executing a certain PE/COFF image
-
- @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
- structure
- @param[in] ImageType Whether the image is an application, a boot time
- driver or a runtime driver.
- @param[in] DevicePath Path to device where the image originated
- (e.g., a PCI option ROM)
-
- @retval TRUE The image is supported by the emulator
- @retval FALSE The image is not supported by the emulator.
-**/
-typedef
-BOOLEAN
-(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED)(
- IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,
- IN UINT16 ImageType,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL
- );
-
-/**
- Register a supported PE/COFF image with the emulator. After this call
- completes successfully, the PE/COFF image may be started as usual, and
- it is the responsibility of the emulator implementation that any branch
- into the code section of the image (including returns from functions called
- from the foreign code) is executed as if it were running on the machine
- type it was built for.
-
- @param[in] This This pointer for
- EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure
- @param[in] ImageBase The base address in memory of the PE/COFF image
- @param[in] ImageSize The size in memory of the PE/COFF image
- @param[in,out] EntryPoint The entry point of the PE/COFF image. Passed by
- reference so that the emulator may modify it.
-
- @retval EFI_SUCCESS The image was registered with the emulator and
- can be started as usual.
- @retval other The image could not be registered.
-
- If the PE/COFF machine type or image type are not supported by the emulator,
- then ASSERT().
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE)(
- IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS ImageBase,
- IN UINT64 ImageSize,
- IN OUT EFI_IMAGE_ENTRY_POINT *EntryPoint
- );
-
-/**
- Unregister a PE/COFF image that has been registered with the emulator.
- This should be done before the image is unloaded from memory.
-
- @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
- structure
- @param[in] ImageBase The base address in memory of the PE/COFF image
-
- @retval EFI_SUCCESS The image was unregistered with the emulator.
- @retval other Image could not be unloaded.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE)(
- IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS ImageBase
- );
-
-#define EDKII_PECOFF_IMAGE_EMULATOR_VERSION 0x1
-
-typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL {
- EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED IsImageSupported;
- EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE RegisterImage;
- EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE UnregisterImage;
-
- // Protocol version implemented by the emulator
- UINT32 Version;
- // The machine type implemented by the emulator
- UINT16 MachineType;
-} EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;
-
-extern EFI_GUID gEdkiiPeCoffImageEmulatorProtocolGuid;
-
-#endif
+/** @file + Copyright (c) 2019, Linaro, Ltd. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_ +#define _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_ + +#define EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID \ + { 0x96F46153, 0x97A7, 0x4793, { 0xAC, 0xC1, 0xFA, 0x19, 0xBF, 0x78, 0xEA, 0x97 } } + +typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL; + +/** + Check whether the emulator supports executing a certain PE/COFF image + + @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL + structure + @param[in] ImageType Whether the image is an application, a boot time + driver or a runtime driver. + @param[in] DevicePath Path to device where the image originated + (e.g., a PCI option ROM) + + @retval TRUE The image is supported by the emulator + @retval FALSE The image is not supported by the emulator. +**/ +typedef +BOOLEAN +(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED)( + IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This, + IN UINT16 ImageType, + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL + ); + +/** + Register a supported PE/COFF image with the emulator. After this call + completes successfully, the PE/COFF image may be started as usual, and + it is the responsibility of the emulator implementation that any branch + into the code section of the image (including returns from functions called + from the foreign code) is executed as if it were running on the machine + type it was built for. + + @param[in] This This pointer for + EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure + @param[in] ImageBase The base address in memory of the PE/COFF image + @param[in] ImageSize The size in memory of the PE/COFF image + @param[in,out] EntryPoint The entry point of the PE/COFF image. Passed by + reference so that the emulator may modify it. + + @retval EFI_SUCCESS The image was registered with the emulator and + can be started as usual. + @retval other The image could not be registered. + + If the PE/COFF machine type or image type are not supported by the emulator, + then ASSERT(). +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE)( + IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This, + IN EFI_PHYSICAL_ADDRESS ImageBase, + IN UINT64 ImageSize, + IN OUT EFI_IMAGE_ENTRY_POINT *EntryPoint + ); + +/** + Unregister a PE/COFF image that has been registered with the emulator. + This should be done before the image is unloaded from memory. + + @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL + structure + @param[in] ImageBase The base address in memory of the PE/COFF image + + @retval EFI_SUCCESS The image was unregistered with the emulator. + @retval other Image could not be unloaded. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE)( + IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This, + IN EFI_PHYSICAL_ADDRESS ImageBase + ); + +#define EDKII_PECOFF_IMAGE_EMULATOR_VERSION 0x1 + +typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL { + EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED IsImageSupported; + EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE RegisterImage; + EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE UnregisterImage; + + // Protocol version implemented by the emulator + UINT32 Version; + // The machine type implemented by the emulator + UINT16 MachineType; +} EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL; + +extern EFI_GUID gEdkiiPeCoffImageEmulatorProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h b/MdeModulePkg/Include/Protocol/PlatformBootManager.h index e527b0ee0e..3f1b21e071 100644 --- a/MdeModulePkg/Include/Protocol/PlatformBootManager.h +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h @@ -1,82 +1,82 @@ -/** @file
-
- Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
-#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
-
-#include <Library/UefiBootManagerLib.h>
-
-//
-// Platform Boot Manager Protocol GUID value
-//
-#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \
- { \
- 0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } \
- }
-
-//
-// Protocol interface structure
-//
-typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL;
-
-//
-// Revision The revision to which the protocol interface adheres.
-// All future revisions must be backwards compatible.
-// If a future version is not back wards compatible it is not the same GUID.
-//
-#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION 0x00000001
-
-//
-// Function Prototypes
-//
-
-/*
- This function allows platform to refresh all boot options specific to the platform. Within
- this function, platform can make modifications to the auto enumerated platform boot options
- as well as NV boot options.
-
- @param[in const] BootOptions An array of auto enumerated platform boot options.
- This array will be freed by caller upon successful
- exit of this function and output array would be used.
-
- @param[in const] BootOptionsCount The number of elements in BootOptions.
-
- @param[out] UpdatedBootOptions An array of boot options that have been customized
- for the platform on top of input boot options. This
- array would be allocated by REFRESH_ALL_BOOT_OPTIONS
- and would be freed by caller after consuming it.
-
- @param[out] UpdatedBootOptionsCount The number of elements in UpdatedBootOptions.
-
-
- @retval EFI_SUCCESS Platform refresh to input BootOptions and
- BootCount have been done.
-
- @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
-
- @retval EFI_INVALID_PARAMETER Input is not correct.
-
- @retval EFI_UNSUPPORTED Platform specific overrides are not supported.
-*/
-typedef
-EFI_STATUS
-(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS)(
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
- IN CONST UINTN BootOptionsCount,
- OUT EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions,
- OUT UINTN *UpdatedBootOptionsCount
- );
-
-struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
- UINT64 Revision;
- PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS RefreshAllBootOptions;
-};
-
-extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid;
-
-#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
+/** @file + + Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ +#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ + +#include <Library/UefiBootManagerLib.h> + +// +// Platform Boot Manager Protocol GUID value +// +#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \ + { \ + 0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } \ + } + +// +// Protocol interface structure +// +typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL; + +// +// Revision The revision to which the protocol interface adheres. +// All future revisions must be backwards compatible. +// If a future version is not back wards compatible it is not the same GUID. +// +#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION 0x00000001 + +// +// Function Prototypes +// + +/* + This function allows platform to refresh all boot options specific to the platform. Within + this function, platform can make modifications to the auto enumerated platform boot options + as well as NV boot options. + + @param[in const] BootOptions An array of auto enumerated platform boot options. + This array will be freed by caller upon successful + exit of this function and output array would be used. + + @param[in const] BootOptionsCount The number of elements in BootOptions. + + @param[out] UpdatedBootOptions An array of boot options that have been customized + for the platform on top of input boot options. This + array would be allocated by REFRESH_ALL_BOOT_OPTIONS + and would be freed by caller after consuming it. + + @param[out] UpdatedBootOptionsCount The number of elements in UpdatedBootOptions. + + + @retval EFI_SUCCESS Platform refresh to input BootOptions and + BootCount have been done. + + @retval EFI_OUT_OF_RESOURCES Memory allocation failed. + + @retval EFI_INVALID_PARAMETER Input is not correct. + + @retval EFI_UNSUPPORTED Platform specific overrides are not supported. +*/ +typedef +EFI_STATUS +(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS)( + IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions, + IN CONST UINTN BootOptionsCount, + OUT EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions, + OUT UINTN *UpdatedBootOptionsCount + ); + +struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL { + UINT64 Revision; + PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS RefreshAllBootOptions; +}; + +extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid; + +#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */ diff --git a/MdeModulePkg/Include/Protocol/PlatformLogo.h b/MdeModulePkg/Include/Protocol/PlatformLogo.h index 08e1dc35a4..0c4938cbef 100644 --- a/MdeModulePkg/Include/Protocol/PlatformLogo.h +++ b/MdeModulePkg/Include/Protocol/PlatformLogo.h @@ -1,65 +1,65 @@ -/** @file
- The Platform Logo Protocol defines the interface to get the Platform logo
- image with the display attribute.
-
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PLATFORM_LOGO_H__
-#define __PLATFORM_LOGO_H__
-
-#include <Protocol/HiiImage.h>
-
-//
-// GUID for EDKII Platform Logo Protocol
-//
-#define EDKII_PLATFORM_LOGO_PROTOCOL_GUID \
- { 0x53cd299f, 0x2bc1, 0x40c0, { 0x8c, 0x07, 0x23, 0xf6, 0x4f, 0xdb, 0x30, 0xe0 } }
-
-typedef struct _EDKII_PLATFORM_LOGO_PROTOCOL EDKII_PLATFORM_LOGO_PROTOCOL;
-
-typedef enum {
- EdkiiPlatformLogoDisplayAttributeLeftTop,
- EdkiiPlatformLogoDisplayAttributeCenterTop,
- EdkiiPlatformLogoDisplayAttributeRightTop,
- EdkiiPlatformLogoDisplayAttributeCenterRight,
- EdkiiPlatformLogoDisplayAttributeRightBottom,
- EdkiiPlatformLogoDisplayAttributeCenterBottom,
- EdkiiPlatformLogoDisplayAttributeLeftBottom,
- EdkiiPlatformLogoDisplayAttributeCenterLeft,
- EdkiiPlatformLogoDisplayAttributeCenter
-} EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE;
-
-/**
- Load a platform logo image and return its data and attributes.
-
- @param This The pointer to this protocol instance.
- @param Instance The visible image instance is found.
- @param Image Points to the image.
- @param Attribute The display attributes of the image returned.
- @param OffsetX The X offset of the image regarding the Attribute.
- @param OffsetY The Y offset of the image regarding the Attribute.
-
- @retval EFI_SUCCESS The image was fetched successfully.
- @retval EFI_NOT_FOUND The specified image could not be found.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_PLATFORM_LOGO_GET_IMAGE)(
- IN EDKII_PLATFORM_LOGO_PROTOCOL *This,
- IN OUT UINT32 *Instance,
- OUT EFI_IMAGE_INPUT *Image,
- OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute,
- OUT INTN *OffsetX,
- OUT INTN *OffsetY
- );
-
-struct _EDKII_PLATFORM_LOGO_PROTOCOL {
- EDKII_PLATFORM_LOGO_GET_IMAGE GetImage;
-};
-
-extern EFI_GUID gEdkiiPlatformLogoProtocolGuid;
-
-#endif
+/** @file + The Platform Logo Protocol defines the interface to get the Platform logo + image with the display attribute. + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLATFORM_LOGO_H__ +#define __PLATFORM_LOGO_H__ + +#include <Protocol/HiiImage.h> + +// +// GUID for EDKII Platform Logo Protocol +// +#define EDKII_PLATFORM_LOGO_PROTOCOL_GUID \ + { 0x53cd299f, 0x2bc1, 0x40c0, { 0x8c, 0x07, 0x23, 0xf6, 0x4f, 0xdb, 0x30, 0xe0 } } + +typedef struct _EDKII_PLATFORM_LOGO_PROTOCOL EDKII_PLATFORM_LOGO_PROTOCOL; + +typedef enum { + EdkiiPlatformLogoDisplayAttributeLeftTop, + EdkiiPlatformLogoDisplayAttributeCenterTop, + EdkiiPlatformLogoDisplayAttributeRightTop, + EdkiiPlatformLogoDisplayAttributeCenterRight, + EdkiiPlatformLogoDisplayAttributeRightBottom, + EdkiiPlatformLogoDisplayAttributeCenterBottom, + EdkiiPlatformLogoDisplayAttributeLeftBottom, + EdkiiPlatformLogoDisplayAttributeCenterLeft, + EdkiiPlatformLogoDisplayAttributeCenter +} EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE; + +/** + Load a platform logo image and return its data and attributes. + + @param This The pointer to this protocol instance. + @param Instance The visible image instance is found. + @param Image Points to the image. + @param Attribute The display attributes of the image returned. + @param OffsetX The X offset of the image regarding the Attribute. + @param OffsetY The Y offset of the image regarding the Attribute. + + @retval EFI_SUCCESS The image was fetched successfully. + @retval EFI_NOT_FOUND The specified image could not be found. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PLATFORM_LOGO_GET_IMAGE)( + IN EDKII_PLATFORM_LOGO_PROTOCOL *This, + IN OUT UINT32 *Instance, + OUT EFI_IMAGE_INPUT *Image, + OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute, + OUT INTN *OffsetX, + OUT INTN *OffsetY + ); + +struct _EDKII_PLATFORM_LOGO_PROTOCOL { + EDKII_PLATFORM_LOGO_GET_IMAGE GetImage; +}; + +extern EFI_GUID gEdkiiPlatformLogoProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/PlatformSpecificResetFilter.h b/MdeModulePkg/Include/Protocol/PlatformSpecificResetFilter.h index 482be1eb98..9effe5b529 100644 --- a/MdeModulePkg/Include/Protocol/PlatformSpecificResetFilter.h +++ b/MdeModulePkg/Include/Protocol/PlatformSpecificResetFilter.h @@ -1,25 +1,25 @@ -/** @file
- This Protocol provides services to register a platform specific reset filter
- for ResetSystem(). A reset filter evaluates the parameters passed to
- ResetSystem() and converts a ResetType of EfiResetPlatformSpecific to a
- non-platform specific reset type. The registered filters are processed before
- the UEFI 2.7 Reset Notifications.
-
- Copyright (c) 2017 Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL_H_
-#define _PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL_H_
-
-#include <Protocol/ResetNotification.h>
-
-#define EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL_GUID \
- { 0x695d7835, 0x8d47, 0x4c11, { 0xab, 0x22, 0xfa, 0x8a, 0xcc, 0xe7, 0xae, 0x7a } }
-
-typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL;
-
-extern EFI_GUID gEdkiiPlatformSpecificResetFilterProtocolGuid;
-
-#endif
+/** @file + This Protocol provides services to register a platform specific reset filter + for ResetSystem(). A reset filter evaluates the parameters passed to + ResetSystem() and converts a ResetType of EfiResetPlatformSpecific to a + non-platform specific reset type. The registered filters are processed before + the UEFI 2.7 Reset Notifications. + + Copyright (c) 2017 Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL_H_ +#define _PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL_H_ + +#include <Protocol/ResetNotification.h> + +#define EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL_GUID \ + { 0x695d7835, 0x8d47, 0x4c11, { 0xab, 0x22, 0xfa, 0x8a, 0xcc, 0xe7, 0xae, 0x7a } } + +typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL; + +extern EFI_GUID gEdkiiPlatformSpecificResetFilterProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/PlatformSpecificResetHandler.h b/MdeModulePkg/Include/Protocol/PlatformSpecificResetHandler.h index 11dede469c..d45c45303e 100644 --- a/MdeModulePkg/Include/Protocol/PlatformSpecificResetHandler.h +++ b/MdeModulePkg/Include/Protocol/PlatformSpecificResetHandler.h @@ -1,23 +1,23 @@ -/** @file
- This protocol provides services to register a platform specific handler for
- ResetSystem(). The registered handlers are called after the UEFI 2.7 Reset
- Notifications are processed
-
- Copyright (c) 2017 Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL_H_
-#define _PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL_H_
-
-#include <Protocol/ResetNotification.h>
-
-#define EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL_GUID \
- { 0x2df6ba0b, 0x7092, 0x440d, { 0xbd, 0x4, 0xfb, 0x9, 0x1e, 0xc3, 0xf3, 0xc1 } }
-
-typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL;
-
-extern EFI_GUID gEdkiiPlatformSpecificResetHandlerProtocolGuid;
-
-#endif
+/** @file + This protocol provides services to register a platform specific handler for + ResetSystem(). The registered handlers are called after the UEFI 2.7 Reset + Notifications are processed + + Copyright (c) 2017 Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL_H_ +#define _PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL_H_ + +#include <Protocol/ResetNotification.h> + +#define EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL_GUID \ + { 0x2df6ba0b, 0x7092, 0x440d, { 0xbd, 0x4, 0xfb, 0x9, 0x1e, 0xc3, 0xf3, 0xc1 } } + +typedef EFI_RESET_NOTIFICATION_PROTOCOL EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL; + +extern EFI_GUID gEdkiiPlatformSpecificResetHandlerProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/Print2.h b/MdeModulePkg/Include/Protocol/Print2.h index 1e10a04be2..4d32f6881e 100644 --- a/MdeModulePkg/Include/Protocol/Print2.h +++ b/MdeModulePkg/Include/Protocol/Print2.h @@ -1,656 +1,656 @@ -/** @file
-
- Produces EFI_PRINT2_PROTOCOL and EFI_PRINT2S_PROTOCOL.
- These protocols define basic print functions to print the format unicode and
- ascii string.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PPRINT2_H__
-#define __PPRINT2_H__
-
-#define EFI_PRINT2_PROTOCOL_GUID \
- { 0xf05976ef, 0x83f1, 0x4f3d, { 0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38 } }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL;
-
-/**
- Produces a Null-terminated Unicode string in an output buffer based on
- a Null-terminated Unicode format string and a BASE_LIST argument list.
-
- Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on the
- contents of the format string.
- The number of Unicode characters in the produced output buffer is returned not including
- the Null-terminator.
-
- If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
- If FormatString is not aligned on a 16-bit boundary, then ASSERT().
-
- If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
- (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
- buffer is unmodified and 0 is returned.
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
- ASSERT(). Also, the output buffer is unmodified and 0 is returned.
-
- If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString A Null-terminated Unicode format string.
- @param Marker BASE_LIST marker for the variable argument list.
-
- @return The number of Unicode characters in the produced output buffer not including the
- Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *UNICODE_BS_PRINT)(
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- IN BASE_LIST Marker
- );
-
-/**
- Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
- Unicode format string and variable argument list.
-
- This function is similar as snprintf_s defined in C11.
-
- Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the format string.
- The number of Unicode characters in the produced output buffer is returned not including
- the Null-terminator.
-
- If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
- If FormatString is not aligned on a 16-bit boundary, then ASSERT().
-
- If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
- (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
- buffer is unmodified and 0 is returned.
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
- ASSERT(). Also, the output buffer is unmodified and 0 is returned.
-
- If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString A Null-terminated Unicode format string.
- @param ... Variable argument list whose contents are accessed based on the
- format string specified by FormatString.
-
- @return The number of Unicode characters in the produced output buffer not including the
- Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *UNICODE_S_PRINT)(
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- ...
- );
-
-/**
- Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
- ASCII format string and a BASE_LIST argument list.
-
- Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on the
- contents of the format string.
- The number of Unicode characters in the produced output buffer is returned not including
- the Null-terminator.
-
- If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
-
- If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
- (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
- buffer is unmodified and 0 is returned.
- If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
- PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
- ASSERT(). Also, the output buffer is unmodified and 0 is returned.
-
- If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString A Null-terminated ASCII format string.
- @param Marker BASE_LIST marker for the variable argument list.
-
- @return The number of Unicode characters in the produced output buffer not including the
- Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *UNICODE_BS_PRINT_ASCII_FORMAT)(
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- IN BASE_LIST Marker
- );
-
-/**
- Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
- ASCII format string and variable argument list.
-
- This function is similar as snprintf_s defined in C11.
-
- Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the
- format string.
- The number of Unicode characters in the produced output buffer is returned not including
- the Null-terminator.
-
- If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
-
- If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
- (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
- buffer is unmodified and 0 is returned.
- If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
- PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
- ASSERT(). Also, the output buffer is unmodified and 0 is returned.
-
- If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString A Null-terminated ASCII format string.
- @param ... Variable argument list whose contents are accessed based on the
- format string specified by FormatString.
-
- @return The number of Unicode characters in the produced output buffer not including the
- Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *UNICODE_S_PRINT_ASCII_FORMAT)(
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- ...
- );
-
-/**
- Converts a decimal value to a Null-terminated Unicode string.
-
- Converts the decimal number specified by Value to a Null-terminated Unicode
- string specified by Buffer containing at most Width characters. No padding of spaces
- is ever performed. If Width is 0, then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
- This function returns the number of Unicode characters in Buffer, not including
- the Null-terminator.
- If the conversion contains more than Width characters, this function returns
- the first Width characters in the conversion, along with the total number of characters in the conversion.
- Additional conversion parameters are specified in Flags.
-
- The Flags bit LEFT_JUSTIFY is always ignored.
- All conversions are left justified in Buffer.
- If Width is 0, PREFIX_ZERO is ignored in Flags.
- If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
- are inserted every 3rd digit starting from the right.
- If RADIX_HEX is set in Flags, then the output buffer will be
- formatted in hexadecimal format.
- If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
- If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
- then Buffer is padded with '0' characters so the combination of the optional '-'
- sign character, '0' characters, digit characters for Value, and the Null-terminator
- add up to Width characters.
- If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
- If Buffer is NULL, then ASSERT().
- If Buffer is not aligned on a 16-bit boundary, then ASSERT().
- If unsupported bits are set in Flags, then ASSERT().
- If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
- If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
-
- @param Buffer The pointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
- @param Value The 64-bit signed value to convert to a string.
- @param Width The maximum number of Unicode characters to place in Buffer, not including
- the Null-terminator.
-
- @return The number of Unicode characters in Buffer not including the Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *UNICODE_VALUE_TO_STRING)(
- IN OUT CHAR16 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- );
-
-/**
- Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- ASCII format string and a BASE_LIST argument list.
-
- Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on
- the contents of the format string.
- The number of ASCII characters in the produced output buffer is returned not including
- the Null-terminator.
-
- If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If PcdMaximumAsciiStringLength is not zero, and BufferSize >
- (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
- is unmodified and 0 is returned.
- If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
- PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
- ASSERT(). Also, the output buffer is unmodified and 0 is returned.
-
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString A Null-terminated ASCII format string.
- @param Marker BASE_LIST marker for the variable argument list.
-
- @return The number of ASCII characters in the produced output buffer not including the
- Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *ASCII_BS_PRINT)(
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- IN BASE_LIST Marker
- );
-
-/**
- Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- ASCII format string and variable argument list.
-
- This function is similar as snprintf_s defined in C11.
-
- Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the
- format string.
- The number of ASCII characters in the produced output buffer is returned not including
- the Null-terminator.
-
- If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If PcdMaximumAsciiStringLength is not zero, and BufferSize >
- (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
- is unmodified and 0 is returned.
- If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
- PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
- ASSERT(). Also, the output buffer is unmodified and 0 is returned.
-
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString A Null-terminated ASCII format string.
- @param ... Variable argument list whose contents are accessed based on the
- format string specified by FormatString.
-
- @return The number of ASCII characters in the produced output buffer not including the
- Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *ASCII_S_PRINT)(
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- ...
- );
-
-/**
- Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- Unicode format string and a BASE_LIST argument list.
-
- Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on
- the contents of the format string.
- The number of ASCII characters in the produced output buffer is returned not including
- the Null-terminator.
-
- If FormatString is not aligned on a 16-bit boundary, then ASSERT().
-
- If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If PcdMaximumAsciiStringLength is not zero, and BufferSize >
- (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
- is unmodified and 0 is returned.
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
- ASSERT(). Also, the output buffer is unmodified and 0 is returned.
-
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString A Null-terminated Unicode format string.
- @param Marker BASE_LIST marker for the variable argument list.
-
- @return The number of ASCII characters in the produced output buffer not including the
- Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *ASCII_BS_PRINT_UNICODE_FORMAT)(
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- IN BASE_LIST Marker
- );
-
-/**
- Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- Unicode format string and variable argument list.
-
- This function is similar as snprintf_s defined in C11.
-
- Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the
- format string.
- The number of ASCII characters in the produced output buffer is returned not including
- the Null-terminator.
-
- If FormatString is not aligned on a 16-bit boundary, then ASSERT().
-
- If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
- unmodified and 0 is returned.
- If PcdMaximumAsciiStringLength is not zero, and BufferSize >
- (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
- is unmodified and 0 is returned.
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
- ASSERT(). Also, the output buffer is unmodified and 0 is returned.
-
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString A Null-terminated Unicode format string.
- @param ... Variable argument list whose contents are accessed based on the
- format string specified by FormatString.
-
- @return The number of ASCII characters in the produced output buffer not including the
- Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *ASCII_S_PRINT_UNICODE_FORMAT)(
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- ...
- );
-
-/**
- Converts a decimal value to a Null-terminated ASCII string.
-
- Converts the decimal number specified by Value to a Null-terminated ASCII string
- specified by Buffer containing at most Width characters. No padding of spaces is ever performed.
- If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
- The number of ASCII characters in Buffer is returned not including the Null-terminator.
- If the conversion contains more than Width characters, then only the first Width
- characters are returned, and the total number of characters required to perform
- the conversion is returned.
- Additional conversion parameters are specified in Flags.
- The Flags bit LEFT_JUSTIFY is always ignored.
- All conversions are left justified in Buffer.
- If Width is 0, PREFIX_ZERO is ignored in Flags.
- If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
- are inserted every 3rd digit starting from the right.
- If RADIX_HEX is set in Flags, then the output buffer will be
- formatted in hexadecimal format.
- If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
- If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
- then Buffer is padded with '0' characters so the combination of the optional '-'
- sign character, '0' characters, digit characters for Value, and the Null-terminator
- add up to Width characters.
-
- If Buffer is NULL, then ASSERT().
- If unsupported bits are set in Flags, then ASSERT().
- If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
- If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
-
- @param Buffer The pointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
- @param Value The 64-bit signed value to convert to a string.
- @param Width The maximum number of ASCII characters to place in Buffer, not including
- the Null-terminator.
-
- @return The number of ASCII characters in Buffer not including the Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *ASCII_VALUE_TO_STRING)(
- OUT CHAR8 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- );
-
-struct _EFI_PRINT2_PROTOCOL {
- UNICODE_BS_PRINT UnicodeBSPrint;
- UNICODE_S_PRINT UnicodeSPrint;
- UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat;
- UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat;
- UNICODE_VALUE_TO_STRING UnicodeValueToString;
- ASCII_BS_PRINT AsciiBSPrint;
- ASCII_S_PRINT AsciiSPrint;
- ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat;
- ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat;
- ASCII_VALUE_TO_STRING AsciiValueToString;
-};
-
-extern EFI_GUID gEfiPrint2ProtocolGuid;
-
-#define EFI_PRINT2S_PROTOCOL_GUID \
- { 0xcc252d2, 0xc106, 0x4661, { 0xb5, 0xbd, 0x31, 0x47, 0xa4, 0xf8, 0x1f, 0x92 } }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_PRINT2S_PROTOCOL EFI_PRINT2S_PROTOCOL;
-
-/**
- Converts a decimal value to a Null-terminated Unicode string.
-
- Converts the decimal number specified by Value to a Null-terminated Unicode
- string specified by Buffer containing at most Width characters. No padding of
- spaces is ever performed. If Width is 0 then a width of
- MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than
- Width characters, then only the first Width characters are placed in Buffer.
- Additional conversion parameters are specified in Flags.
-
- The Flags bit LEFT_JUSTIFY is always ignored.
- All conversions are left justified in Buffer.
- If Width is 0, PREFIX_ZERO is ignored in Flags.
- If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and
- commas are inserted every 3rd digit starting from the right.
- If RADIX_HEX is set in Flags, then the output buffer will be formatted in
- hexadecimal format.
- If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in
- Buffer is a '-'.
- If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then
- Buffer is padded with '0' characters so the combination of the optional '-'
- sign character, '0' characters, digit characters for Value, and the
- Null-terminator add up to Width characters.
-
- If Buffer is not aligned on a 16-bit boundary, then ASSERT().
- If an error would be returned, then the function will also ASSERT().
-
- @param Buffer The pointer to the output buffer for the produced
- Null-terminated Unicode string.
- @param BufferSize The size of Buffer in bytes, including the
- Null-terminator.
- @param Flags The bitmask of flags that specify left justification,
- zero pad, and commas.
- @param Value The 64-bit signed value to convert to a string.
- @param Width The maximum number of Unicode characters to place in
- Buffer, not including the Null-terminator.
-
- @retval RETURN_SUCCESS The decimal value is converted.
- @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted
- value.
- @retval RETURN_INVALID_PARAMETER If Buffer is NULL.
- If PcdMaximumUnicodeStringLength is not
- zero, and BufferSize is greater than
- (PcdMaximumUnicodeStringLength *
- sizeof (CHAR16) + 1).
- If unsupported bits are set in Flags.
- If both COMMA_TYPE and RADIX_HEX are set in
- Flags.
- If Width >= MAXIMUM_VALUE_CHARACTERS.
-
-**/
-typedef
-RETURN_STATUS
-(EFIAPI *UNICODE_VALUE_TO_STRING_S)(
- IN OUT CHAR16 *Buffer,
- IN UINTN BufferSize,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- );
-
-/**
- Converts a decimal value to a Null-terminated Ascii string.
-
- Converts the decimal number specified by Value to a Null-terminated Ascii
- string specified by Buffer containing at most Width characters. No padding of
- spaces is ever performed. If Width is 0 then a width of
- MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than
- Width characters, then only the first Width characters are placed in Buffer.
- Additional conversion parameters are specified in Flags.
-
- The Flags bit LEFT_JUSTIFY is always ignored.
- All conversions are left justified in Buffer.
- If Width is 0, PREFIX_ZERO is ignored in Flags.
- If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and
- commas are inserted every 3rd digit starting from the right.
- If RADIX_HEX is set in Flags, then the output buffer will be formatted in
- hexadecimal format.
- If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in
- Buffer is a '-'.
- If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then
- Buffer is padded with '0' characters so the combination of the optional '-'
- sign character, '0' characters, digit characters for Value, and the
- Null-terminator add up to Width characters.
-
- If an error would be returned, then the function will ASSERT().
-
- @param Buffer The pointer to the output buffer for the produced
- Null-terminated Ascii string.
- @param BufferSize The size of Buffer in bytes, including the
- Null-terminator.
- @param Flags The bitmask of flags that specify left justification,
- zero pad, and commas.
- @param Value The 64-bit signed value to convert to a string.
- @param Width The maximum number of Ascii characters to place in
- Buffer, not including the Null-terminator.
-
- @retval RETURN_SUCCESS The decimal value is converted.
- @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted
- value.
- @retval RETURN_INVALID_PARAMETER If Buffer is NULL.
- If PcdMaximumAsciiStringLength is not
- zero, and BufferSize is greater than
- PcdMaximumAsciiStringLength.
- If unsupported bits are set in Flags.
- If both COMMA_TYPE and RADIX_HEX are set in
- Flags.
- If Width >= MAXIMUM_VALUE_CHARACTERS.
-
-**/
-typedef
-RETURN_STATUS
-(EFIAPI *ASCII_VALUE_TO_STRING_S)(
- IN OUT CHAR8 *Buffer,
- IN UINTN BufferSize,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- );
-
-struct _EFI_PRINT2S_PROTOCOL {
- UNICODE_BS_PRINT UnicodeBSPrint;
- UNICODE_S_PRINT UnicodeSPrint;
- UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat;
- UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat;
- UNICODE_VALUE_TO_STRING_S UnicodeValueToStringS;
- ASCII_BS_PRINT AsciiBSPrint;
- ASCII_S_PRINT AsciiSPrint;
- ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat;
- ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat;
- ASCII_VALUE_TO_STRING_S AsciiValueToStringS;
-};
-
-extern EFI_GUID gEfiPrint2SProtocolGuid;
-
-#endif
+/** @file + + Produces EFI_PRINT2_PROTOCOL and EFI_PRINT2S_PROTOCOL. + These protocols define basic print functions to print the format unicode and + ascii string. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PPRINT2_H__ +#define __PPRINT2_H__ + +#define EFI_PRINT2_PROTOCOL_GUID \ + { 0xf05976ef, 0x83f1, 0x4f3d, { 0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38 } } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL; + +/** + Produces a Null-terminated Unicode string in an output buffer based on + a Null-terminated Unicode format string and a BASE_LIST argument list. + + Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer + and BufferSize. + The Unicode string is produced by parsing the format string specified by FormatString. + Arguments are pulled from the variable argument list specified by Marker based on the + contents of the format string. + The number of Unicode characters in the produced output buffer is returned not including + the Null-terminator. + + If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). + If FormatString is not aligned on a 16-bit boundary, then ASSERT(). + + If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If PcdMaximumUnicodeStringLength is not zero, and BufferSize > + (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output + buffer is unmodified and 0 is returned. + If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than + PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then + ASSERT(). Also, the output buffer is unmodified and 0 is returned. + + If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. + + @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated + Unicode string. + @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. + @param FormatString A Null-terminated Unicode format string. + @param Marker BASE_LIST marker for the variable argument list. + + @return The number of Unicode characters in the produced output buffer not including the + Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *UNICODE_BS_PRINT)( + OUT CHAR16 *StartOfBuffer, + IN UINTN BufferSize, + IN CONST CHAR16 *FormatString, + IN BASE_LIST Marker + ); + +/** + Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated + Unicode format string and variable argument list. + + This function is similar as snprintf_s defined in C11. + + Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer + and BufferSize. + The Unicode string is produced by parsing the format string specified by FormatString. + Arguments are pulled from the variable argument list based on the contents of the format string. + The number of Unicode characters in the produced output buffer is returned not including + the Null-terminator. + + If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). + If FormatString is not aligned on a 16-bit boundary, then ASSERT(). + + If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If PcdMaximumUnicodeStringLength is not zero, and BufferSize > + (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output + buffer is unmodified and 0 is returned. + If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than + PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then + ASSERT(). Also, the output buffer is unmodified and 0 is returned. + + If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. + + @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated + Unicode string. + @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. + @param FormatString A Null-terminated Unicode format string. + @param ... Variable argument list whose contents are accessed based on the + format string specified by FormatString. + + @return The number of Unicode characters in the produced output buffer not including the + Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *UNICODE_S_PRINT)( + OUT CHAR16 *StartOfBuffer, + IN UINTN BufferSize, + IN CONST CHAR16 *FormatString, + ... + ); + +/** + Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated + ASCII format string and a BASE_LIST argument list. + + Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer + and BufferSize. + The Unicode string is produced by parsing the format string specified by FormatString. + Arguments are pulled from the variable argument list specified by Marker based on the + contents of the format string. + The number of Unicode characters in the produced output buffer is returned not including + the Null-terminator. + + If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). + + If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If PcdMaximumUnicodeStringLength is not zero, and BufferSize > + (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output + buffer is unmodified and 0 is returned. + If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than + PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then + ASSERT(). Also, the output buffer is unmodified and 0 is returned. + + If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. + + @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated + Unicode string. + @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. + @param FormatString A Null-terminated ASCII format string. + @param Marker BASE_LIST marker for the variable argument list. + + @return The number of Unicode characters in the produced output buffer not including the + Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *UNICODE_BS_PRINT_ASCII_FORMAT)( + OUT CHAR16 *StartOfBuffer, + IN UINTN BufferSize, + IN CONST CHAR8 *FormatString, + IN BASE_LIST Marker + ); + +/** + Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated + ASCII format string and variable argument list. + + This function is similar as snprintf_s defined in C11. + + Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer + and BufferSize. + The Unicode string is produced by parsing the format string specified by FormatString. + Arguments are pulled from the variable argument list based on the contents of the + format string. + The number of Unicode characters in the produced output buffer is returned not including + the Null-terminator. + + If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). + + If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If PcdMaximumUnicodeStringLength is not zero, and BufferSize > + (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output + buffer is unmodified and 0 is returned. + If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than + PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then + ASSERT(). Also, the output buffer is unmodified and 0 is returned. + + If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. + + @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated + Unicode string. + @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. + @param FormatString A Null-terminated ASCII format string. + @param ... Variable argument list whose contents are accessed based on the + format string specified by FormatString. + + @return The number of Unicode characters in the produced output buffer not including the + Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *UNICODE_S_PRINT_ASCII_FORMAT)( + OUT CHAR16 *StartOfBuffer, + IN UINTN BufferSize, + IN CONST CHAR8 *FormatString, + ... + ); + +/** + Converts a decimal value to a Null-terminated Unicode string. + + Converts the decimal number specified by Value to a Null-terminated Unicode + string specified by Buffer containing at most Width characters. No padding of spaces + is ever performed. If Width is 0, then a width of MAXIMUM_VALUE_CHARACTERS is assumed. + This function returns the number of Unicode characters in Buffer, not including + the Null-terminator. + If the conversion contains more than Width characters, this function returns + the first Width characters in the conversion, along with the total number of characters in the conversion. + Additional conversion parameters are specified in Flags. + + The Flags bit LEFT_JUSTIFY is always ignored. + All conversions are left justified in Buffer. + If Width is 0, PREFIX_ZERO is ignored in Flags. + If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas + are inserted every 3rd digit starting from the right. + If RADIX_HEX is set in Flags, then the output buffer will be + formatted in hexadecimal format. + If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'. + If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, + then Buffer is padded with '0' characters so the combination of the optional '-' + sign character, '0' characters, digit characters for Value, and the Null-terminator + add up to Width characters. + If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT(). + If Buffer is NULL, then ASSERT(). + If Buffer is not aligned on a 16-bit boundary, then ASSERT(). + If unsupported bits are set in Flags, then ASSERT(). + If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT(). + If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() + + @param Buffer The pointer to the output buffer for the produced Null-terminated + Unicode string. + @param Flags The bitmask of flags that specify left justification, zero pad, and commas. + @param Value The 64-bit signed value to convert to a string. + @param Width The maximum number of Unicode characters to place in Buffer, not including + the Null-terminator. + + @return The number of Unicode characters in Buffer not including the Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *UNICODE_VALUE_TO_STRING)( + IN OUT CHAR16 *Buffer, + IN UINTN Flags, + IN INT64 Value, + IN UINTN Width + ); + +/** + Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated + ASCII format string and a BASE_LIST argument list. + + Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer + and BufferSize. + The ASCII string is produced by parsing the format string specified by FormatString. + Arguments are pulled from the variable argument list specified by Marker based on + the contents of the format string. + The number of ASCII characters in the produced output buffer is returned not including + the Null-terminator. + + If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If PcdMaximumAsciiStringLength is not zero, and BufferSize > + (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer + is unmodified and 0 is returned. + If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than + PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then + ASSERT(). Also, the output buffer is unmodified and 0 is returned. + + If BufferSize is 0, then no output buffer is produced and 0 is returned. + + @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated + ASCII string. + @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. + @param FormatString A Null-terminated ASCII format string. + @param Marker BASE_LIST marker for the variable argument list. + + @return The number of ASCII characters in the produced output buffer not including the + Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *ASCII_BS_PRINT)( + OUT CHAR8 *StartOfBuffer, + IN UINTN BufferSize, + IN CONST CHAR8 *FormatString, + IN BASE_LIST Marker + ); + +/** + Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated + ASCII format string and variable argument list. + + This function is similar as snprintf_s defined in C11. + + Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer + and BufferSize. + The ASCII string is produced by parsing the format string specified by FormatString. + Arguments are pulled from the variable argument list based on the contents of the + format string. + The number of ASCII characters in the produced output buffer is returned not including + the Null-terminator. + + If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If PcdMaximumAsciiStringLength is not zero, and BufferSize > + (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer + is unmodified and 0 is returned. + If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than + PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then + ASSERT(). Also, the output buffer is unmodified and 0 is returned. + + If BufferSize is 0, then no output buffer is produced and 0 is returned. + + @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated + ASCII string. + @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. + @param FormatString A Null-terminated ASCII format string. + @param ... Variable argument list whose contents are accessed based on the + format string specified by FormatString. + + @return The number of ASCII characters in the produced output buffer not including the + Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *ASCII_S_PRINT)( + OUT CHAR8 *StartOfBuffer, + IN UINTN BufferSize, + IN CONST CHAR8 *FormatString, + ... + ); + +/** + Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated + Unicode format string and a BASE_LIST argument list. + + Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer + and BufferSize. + The ASCII string is produced by parsing the format string specified by FormatString. + Arguments are pulled from the variable argument list specified by Marker based on + the contents of the format string. + The number of ASCII characters in the produced output buffer is returned not including + the Null-terminator. + + If FormatString is not aligned on a 16-bit boundary, then ASSERT(). + + If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If PcdMaximumAsciiStringLength is not zero, and BufferSize > + (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer + is unmodified and 0 is returned. + If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than + PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then + ASSERT(). Also, the output buffer is unmodified and 0 is returned. + + If BufferSize is 0, then no output buffer is produced and 0 is returned. + + @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated + ASCII string. + @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. + @param FormatString A Null-terminated Unicode format string. + @param Marker BASE_LIST marker for the variable argument list. + + @return The number of ASCII characters in the produced output buffer not including the + Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *ASCII_BS_PRINT_UNICODE_FORMAT)( + OUT CHAR8 *StartOfBuffer, + IN UINTN BufferSize, + IN CONST CHAR16 *FormatString, + IN BASE_LIST Marker + ); + +/** + Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated + Unicode format string and variable argument list. + + This function is similar as snprintf_s defined in C11. + + Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer + and BufferSize. + The ASCII string is produced by parsing the format string specified by FormatString. + Arguments are pulled from the variable argument list based on the contents of the + format string. + The number of ASCII characters in the produced output buffer is returned not including + the Null-terminator. + + If FormatString is not aligned on a 16-bit boundary, then ASSERT(). + + If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is + unmodified and 0 is returned. + If PcdMaximumAsciiStringLength is not zero, and BufferSize > + (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer + is unmodified and 0 is returned. + If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than + PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then + ASSERT(). Also, the output buffer is unmodified and 0 is returned. + + If BufferSize is 0, then no output buffer is produced and 0 is returned. + + @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated + ASCII string. + @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. + @param FormatString A Null-terminated Unicode format string. + @param ... Variable argument list whose contents are accessed based on the + format string specified by FormatString. + + @return The number of ASCII characters in the produced output buffer not including the + Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *ASCII_S_PRINT_UNICODE_FORMAT)( + OUT CHAR8 *StartOfBuffer, + IN UINTN BufferSize, + IN CONST CHAR16 *FormatString, + ... + ); + +/** + Converts a decimal value to a Null-terminated ASCII string. + + Converts the decimal number specified by Value to a Null-terminated ASCII string + specified by Buffer containing at most Width characters. No padding of spaces is ever performed. + If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. + The number of ASCII characters in Buffer is returned not including the Null-terminator. + If the conversion contains more than Width characters, then only the first Width + characters are returned, and the total number of characters required to perform + the conversion is returned. + Additional conversion parameters are specified in Flags. + The Flags bit LEFT_JUSTIFY is always ignored. + All conversions are left justified in Buffer. + If Width is 0, PREFIX_ZERO is ignored in Flags. + If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas + are inserted every 3rd digit starting from the right. + If RADIX_HEX is set in Flags, then the output buffer will be + formatted in hexadecimal format. + If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'. + If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, + then Buffer is padded with '0' characters so the combination of the optional '-' + sign character, '0' characters, digit characters for Value, and the Null-terminator + add up to Width characters. + + If Buffer is NULL, then ASSERT(). + If unsupported bits are set in Flags, then ASSERT(). + If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT(). + If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() + + @param Buffer The pointer to the output buffer for the produced Null-terminated + ASCII string. + @param Flags The bitmask of flags that specify left justification, zero pad, and commas. + @param Value The 64-bit signed value to convert to a string. + @param Width The maximum number of ASCII characters to place in Buffer, not including + the Null-terminator. + + @return The number of ASCII characters in Buffer not including the Null-terminator. + +**/ +typedef +UINTN +(EFIAPI *ASCII_VALUE_TO_STRING)( + OUT CHAR8 *Buffer, + IN UINTN Flags, + IN INT64 Value, + IN UINTN Width + ); + +struct _EFI_PRINT2_PROTOCOL { + UNICODE_BS_PRINT UnicodeBSPrint; + UNICODE_S_PRINT UnicodeSPrint; + UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat; + UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat; + UNICODE_VALUE_TO_STRING UnicodeValueToString; + ASCII_BS_PRINT AsciiBSPrint; + ASCII_S_PRINT AsciiSPrint; + ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat; + ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat; + ASCII_VALUE_TO_STRING AsciiValueToString; +}; + +extern EFI_GUID gEfiPrint2ProtocolGuid; + +#define EFI_PRINT2S_PROTOCOL_GUID \ + { 0xcc252d2, 0xc106, 0x4661, { 0xb5, 0xbd, 0x31, 0x47, 0xa4, 0xf8, 0x1f, 0x92 } } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_PRINT2S_PROTOCOL EFI_PRINT2S_PROTOCOL; + +/** + Converts a decimal value to a Null-terminated Unicode string. + + Converts the decimal number specified by Value to a Null-terminated Unicode + string specified by Buffer containing at most Width characters. No padding of + spaces is ever performed. If Width is 0 then a width of + MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than + Width characters, then only the first Width characters are placed in Buffer. + Additional conversion parameters are specified in Flags. + + The Flags bit LEFT_JUSTIFY is always ignored. + All conversions are left justified in Buffer. + If Width is 0, PREFIX_ZERO is ignored in Flags. + If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and + commas are inserted every 3rd digit starting from the right. + If RADIX_HEX is set in Flags, then the output buffer will be formatted in + hexadecimal format. + If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in + Buffer is a '-'. + If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then + Buffer is padded with '0' characters so the combination of the optional '-' + sign character, '0' characters, digit characters for Value, and the + Null-terminator add up to Width characters. + + If Buffer is not aligned on a 16-bit boundary, then ASSERT(). + If an error would be returned, then the function will also ASSERT(). + + @param Buffer The pointer to the output buffer for the produced + Null-terminated Unicode string. + @param BufferSize The size of Buffer in bytes, including the + Null-terminator. + @param Flags The bitmask of flags that specify left justification, + zero pad, and commas. + @param Value The 64-bit signed value to convert to a string. + @param Width The maximum number of Unicode characters to place in + Buffer, not including the Null-terminator. + + @retval RETURN_SUCCESS The decimal value is converted. + @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted + value. + @retval RETURN_INVALID_PARAMETER If Buffer is NULL. + If PcdMaximumUnicodeStringLength is not + zero, and BufferSize is greater than + (PcdMaximumUnicodeStringLength * + sizeof (CHAR16) + 1). + If unsupported bits are set in Flags. + If both COMMA_TYPE and RADIX_HEX are set in + Flags. + If Width >= MAXIMUM_VALUE_CHARACTERS. + +**/ +typedef +RETURN_STATUS +(EFIAPI *UNICODE_VALUE_TO_STRING_S)( + IN OUT CHAR16 *Buffer, + IN UINTN BufferSize, + IN UINTN Flags, + IN INT64 Value, + IN UINTN Width + ); + +/** + Converts a decimal value to a Null-terminated Ascii string. + + Converts the decimal number specified by Value to a Null-terminated Ascii + string specified by Buffer containing at most Width characters. No padding of + spaces is ever performed. If Width is 0 then a width of + MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than + Width characters, then only the first Width characters are placed in Buffer. + Additional conversion parameters are specified in Flags. + + The Flags bit LEFT_JUSTIFY is always ignored. + All conversions are left justified in Buffer. + If Width is 0, PREFIX_ZERO is ignored in Flags. + If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and + commas are inserted every 3rd digit starting from the right. + If RADIX_HEX is set in Flags, then the output buffer will be formatted in + hexadecimal format. + If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in + Buffer is a '-'. + If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then + Buffer is padded with '0' characters so the combination of the optional '-' + sign character, '0' characters, digit characters for Value, and the + Null-terminator add up to Width characters. + + If an error would be returned, then the function will ASSERT(). + + @param Buffer The pointer to the output buffer for the produced + Null-terminated Ascii string. + @param BufferSize The size of Buffer in bytes, including the + Null-terminator. + @param Flags The bitmask of flags that specify left justification, + zero pad, and commas. + @param Value The 64-bit signed value to convert to a string. + @param Width The maximum number of Ascii characters to place in + Buffer, not including the Null-terminator. + + @retval RETURN_SUCCESS The decimal value is converted. + @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted + value. + @retval RETURN_INVALID_PARAMETER If Buffer is NULL. + If PcdMaximumAsciiStringLength is not + zero, and BufferSize is greater than + PcdMaximumAsciiStringLength. + If unsupported bits are set in Flags. + If both COMMA_TYPE and RADIX_HEX are set in + Flags. + If Width >= MAXIMUM_VALUE_CHARACTERS. + +**/ +typedef +RETURN_STATUS +(EFIAPI *ASCII_VALUE_TO_STRING_S)( + IN OUT CHAR8 *Buffer, + IN UINTN BufferSize, + IN UINTN Flags, + IN INT64 Value, + IN UINTN Width + ); + +struct _EFI_PRINT2S_PROTOCOL { + UNICODE_BS_PRINT UnicodeBSPrint; + UNICODE_S_PRINT UnicodeSPrint; + UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat; + UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat; + UNICODE_VALUE_TO_STRING_S UnicodeValueToStringS; + ASCII_BS_PRINT AsciiBSPrint; + ASCII_S_PRINT AsciiSPrint; + ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat; + ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat; + ASCII_VALUE_TO_STRING_S AsciiValueToStringS; +}; + +extern EFI_GUID gEfiPrint2SProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/Ps2Policy.h b/MdeModulePkg/Include/Protocol/Ps2Policy.h index 2f73b3d559..499e2d9b2a 100644 --- a/MdeModulePkg/Include/Protocol/Ps2Policy.h +++ b/MdeModulePkg/Include/Protocol/Ps2Policy.h @@ -1,34 +1,34 @@ -/** @file
- PS/2 policy protocol abstracts the specific platform initialization and settings.
-
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PS2_POLICY_PROTOCOL_H_
-#define _PS2_POLICY_PROTOCOL_H_
-
-#define EFI_PS2_POLICY_PROTOCOL_GUID \
- { \
- 0x4df19259, 0xdc71, 0x4d46, {0xbe, 0xf1, 0x35, 0x7b, 0xb5, 0x78, 0xc4, 0x18 } \
- }
-
-#define EFI_KEYBOARD_CAPSLOCK 0x0004
-#define EFI_KEYBOARD_NUMLOCK 0x0002
-#define EFI_KEYBOARD_SCROLLLOCK 0x0001
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PS2_INIT_HARDWARE)(
- IN EFI_HANDLE Handle
- );
-
-typedef struct {
- UINT8 KeyboardLight;
- EFI_PS2_INIT_HARDWARE Ps2InitHardware;
-} EFI_PS2_POLICY_PROTOCOL;
-
-extern EFI_GUID gEfiPs2PolicyProtocolGuid;
-
-#endif
+/** @file + PS/2 policy protocol abstracts the specific platform initialization and settings. + +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PS2_POLICY_PROTOCOL_H_ +#define _PS2_POLICY_PROTOCOL_H_ + +#define EFI_PS2_POLICY_PROTOCOL_GUID \ + { \ + 0x4df19259, 0xdc71, 0x4d46, {0xbe, 0xf1, 0x35, 0x7b, 0xb5, 0x78, 0xc4, 0x18 } \ + } + +#define EFI_KEYBOARD_CAPSLOCK 0x0004 +#define EFI_KEYBOARD_NUMLOCK 0x0002 +#define EFI_KEYBOARD_SCROLLLOCK 0x0001 + +typedef +EFI_STATUS +(EFIAPI *EFI_PS2_INIT_HARDWARE)( + IN EFI_HANDLE Handle + ); + +typedef struct { + UINT8 KeyboardLight; + EFI_PS2_INIT_HARDWARE Ps2InitHardware; +} EFI_PS2_POLICY_PROTOCOL; + +extern EFI_GUID gEfiPs2PolicyProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModulePkg/Include/Protocol/SdMmcOverride.h index 4fd12b9ad4..40bd604815 100644 --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h @@ -1,160 +1,160 @@ -/** @file
- Protocol to describe overrides required to support non-standard SDHCI
- implementations
-
- Copyright (c) 2017 - 2018, Linaro, Ltd. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SD_MMC_OVERRIDE_H__
-#define __SD_MMC_OVERRIDE_H__
-
-#include <Protocol/SdMmcPassThru.h>
-
-#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_GUID \
- { 0xeaf9e3c1, 0xc9cd, 0x46db, { 0xa5, 0xe5, 0x5a, 0x12, 0x4c, 0x83, 0x23, 0x23 } }
-
-#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION 0x3
-
-typedef struct _EDKII_SD_MMC_OVERRIDE EDKII_SD_MMC_OVERRIDE;
-
-#define EDKII_SD_MMC_BUS_WIDTH_IGNORE MAX_UINT8
-#define EDKII_SD_MMC_CLOCK_FREQ_IGNORE MAX_UINT32
-#define EDKII_SD_MMC_DRIVER_STRENGTH_IGNORE MAX_UINT8
-
-typedef enum {
- SdDriverStrengthTypeB = 0,
- SdDriverStrengthTypeA,
- SdDriverStrengthTypeC,
- SdDriverStrengthTypeD,
- SdDriverStrengthIgnore = EDKII_SD_MMC_DRIVER_STRENGTH_IGNORE
-} SD_DRIVER_STRENGTH_TYPE;
-
-typedef enum {
- EmmcDriverStrengthType0 = 0,
- EmmcDriverStrengthType1,
- EmmcDriverStrengthType2,
- EmmcDriverStrengthType3,
- EmmcDriverStrengthType4,
- EmmcDriverStrengthIgnore = EDKII_SD_MMC_DRIVER_STRENGTH_IGNORE
-} EMMC_DRIVER_STRENGTH_TYPE;
-
-typedef union {
- SD_DRIVER_STRENGTH_TYPE Sd;
- EMMC_DRIVER_STRENGTH_TYPE Emmc;
-} EDKII_SD_MMC_DRIVER_STRENGTH;
-
-typedef struct {
- //
- // The target width of the bus. If user tells driver to ignore it
- // or specifies unsupported width driver will choose highest supported
- // bus width for a given mode.
- //
- UINT8 BusWidth;
- //
- // The target clock frequency of the bus in MHz. If user tells driver to ignore
- // it or specifies unsupported frequency driver will choose highest supported
- // clock frequency for a given mode.
- //
- UINT32 ClockFreq;
- //
- // The target driver strength of the bus. If user tells driver to
- // ignore it or specifies unsupported driver strength, driver will
- // default to Type0 for eMMC cards and TypeB for SD cards. Driver strength
- // setting is only considered if chosen bus timing supports them.
- //
- EDKII_SD_MMC_DRIVER_STRENGTH DriverStrength;
-} EDKII_SD_MMC_OPERATING_PARAMETERS;
-
-typedef enum {
- SdMmcSdDs,
- SdMmcSdHs,
- SdMmcUhsSdr12,
- SdMmcUhsSdr25,
- SdMmcUhsSdr50,
- SdMmcUhsDdr50,
- SdMmcUhsSdr104,
- SdMmcMmcLegacy,
- SdMmcMmcHsSdr,
- SdMmcMmcHsDdr,
- SdMmcMmcHs200,
- SdMmcMmcHs400,
-} SD_MMC_BUS_MODE;
-
-typedef enum {
- EdkiiSdMmcResetPre,
- EdkiiSdMmcResetPost,
- EdkiiSdMmcInitHostPre,
- EdkiiSdMmcInitHostPost,
- EdkiiSdMmcUhsSignaling,
- EdkiiSdMmcSwitchClockFreqPost,
- EdkiiSdMmcGetOperatingParam
-} EDKII_SD_MMC_PHASE_TYPE;
-
-/**
- Override function for SDHCI capability bits
-
- @param[in] ControllerHandle The EFI_HANDLE of the controller.
- @param[in] Slot The 0 based slot index.
- @param[in,out] SdMmcHcSlotCapability The SDHCI capability structure.
- @param[in,out] BaseClkFreq The base clock frequency value that
- optionally can be updated.
-
- @retval EFI_SUCCESS The override function completed successfully.
- @retval EFI_NOT_FOUND The specified controller or slot does not exist.
- @retval EFI_INVALID_PARAMETER SdMmcHcSlotCapability is NULL
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_SD_MMC_CAPABILITY)(
- IN EFI_HANDLE ControllerHandle,
- IN UINT8 Slot,
- IN OUT VOID *SdMmcHcSlotCapability,
- IN OUT UINT32 *BaseClkFreq
- );
-
-/**
- Override function for SDHCI controller operations
-
- @param[in] ControllerHandle The EFI_HANDLE of the controller.
- @param[in] Slot The 0 based slot index.
- @param[in] PhaseType The type of operation and whether the
- hook is invoked right before (pre) or
- right after (post)
- @param[in,out] PhaseData The pointer to a phase-specific data.
-
- @retval EFI_SUCCESS The override function completed successfully.
- @retval EFI_NOT_FOUND The specified controller or slot does not exist.
- @retval EFI_INVALID_PARAMETER PhaseType is invalid
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_SD_MMC_NOTIFY_PHASE)(
- IN EFI_HANDLE ControllerHandle,
- IN UINT8 Slot,
- IN EDKII_SD_MMC_PHASE_TYPE PhaseType,
- IN OUT VOID *PhaseData
- );
-
-struct _EDKII_SD_MMC_OVERRIDE {
- //
- // Protocol version of this implementation
- //
- UINTN Version;
- //
- // Callback to override SD/MMC host controller capability bits
- //
- EDKII_SD_MMC_CAPABILITY Capability;
- //
- // Callback to invoke SD/MMC override hooks
- //
- EDKII_SD_MMC_NOTIFY_PHASE NotifyPhase;
-};
-
-extern EFI_GUID gEdkiiSdMmcOverrideProtocolGuid;
-
-#endif
+/** @file + Protocol to describe overrides required to support non-standard SDHCI + implementations + + Copyright (c) 2017 - 2018, Linaro, Ltd. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SD_MMC_OVERRIDE_H__ +#define __SD_MMC_OVERRIDE_H__ + +#include <Protocol/SdMmcPassThru.h> + +#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_GUID \ + { 0xeaf9e3c1, 0xc9cd, 0x46db, { 0xa5, 0xe5, 0x5a, 0x12, 0x4c, 0x83, 0x23, 0x23 } } + +#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION 0x3 + +typedef struct _EDKII_SD_MMC_OVERRIDE EDKII_SD_MMC_OVERRIDE; + +#define EDKII_SD_MMC_BUS_WIDTH_IGNORE MAX_UINT8 +#define EDKII_SD_MMC_CLOCK_FREQ_IGNORE MAX_UINT32 +#define EDKII_SD_MMC_DRIVER_STRENGTH_IGNORE MAX_UINT8 + +typedef enum { + SdDriverStrengthTypeB = 0, + SdDriverStrengthTypeA, + SdDriverStrengthTypeC, + SdDriverStrengthTypeD, + SdDriverStrengthIgnore = EDKII_SD_MMC_DRIVER_STRENGTH_IGNORE +} SD_DRIVER_STRENGTH_TYPE; + +typedef enum { + EmmcDriverStrengthType0 = 0, + EmmcDriverStrengthType1, + EmmcDriverStrengthType2, + EmmcDriverStrengthType3, + EmmcDriverStrengthType4, + EmmcDriverStrengthIgnore = EDKII_SD_MMC_DRIVER_STRENGTH_IGNORE +} EMMC_DRIVER_STRENGTH_TYPE; + +typedef union { + SD_DRIVER_STRENGTH_TYPE Sd; + EMMC_DRIVER_STRENGTH_TYPE Emmc; +} EDKII_SD_MMC_DRIVER_STRENGTH; + +typedef struct { + // + // The target width of the bus. If user tells driver to ignore it + // or specifies unsupported width driver will choose highest supported + // bus width for a given mode. + // + UINT8 BusWidth; + // + // The target clock frequency of the bus in MHz. If user tells driver to ignore + // it or specifies unsupported frequency driver will choose highest supported + // clock frequency for a given mode. + // + UINT32 ClockFreq; + // + // The target driver strength of the bus. If user tells driver to + // ignore it or specifies unsupported driver strength, driver will + // default to Type0 for eMMC cards and TypeB for SD cards. Driver strength + // setting is only considered if chosen bus timing supports them. + // + EDKII_SD_MMC_DRIVER_STRENGTH DriverStrength; +} EDKII_SD_MMC_OPERATING_PARAMETERS; + +typedef enum { + SdMmcSdDs, + SdMmcSdHs, + SdMmcUhsSdr12, + SdMmcUhsSdr25, + SdMmcUhsSdr50, + SdMmcUhsDdr50, + SdMmcUhsSdr104, + SdMmcMmcLegacy, + SdMmcMmcHsSdr, + SdMmcMmcHsDdr, + SdMmcMmcHs200, + SdMmcMmcHs400, +} SD_MMC_BUS_MODE; + +typedef enum { + EdkiiSdMmcResetPre, + EdkiiSdMmcResetPost, + EdkiiSdMmcInitHostPre, + EdkiiSdMmcInitHostPost, + EdkiiSdMmcUhsSignaling, + EdkiiSdMmcSwitchClockFreqPost, + EdkiiSdMmcGetOperatingParam +} EDKII_SD_MMC_PHASE_TYPE; + +/** + Override function for SDHCI capability bits + + @param[in] ControllerHandle The EFI_HANDLE of the controller. + @param[in] Slot The 0 based slot index. + @param[in,out] SdMmcHcSlotCapability The SDHCI capability structure. + @param[in,out] BaseClkFreq The base clock frequency value that + optionally can be updated. + + @retval EFI_SUCCESS The override function completed successfully. + @retval EFI_NOT_FOUND The specified controller or slot does not exist. + @retval EFI_INVALID_PARAMETER SdMmcHcSlotCapability is NULL + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_SD_MMC_CAPABILITY)( + IN EFI_HANDLE ControllerHandle, + IN UINT8 Slot, + IN OUT VOID *SdMmcHcSlotCapability, + IN OUT UINT32 *BaseClkFreq + ); + +/** + Override function for SDHCI controller operations + + @param[in] ControllerHandle The EFI_HANDLE of the controller. + @param[in] Slot The 0 based slot index. + @param[in] PhaseType The type of operation and whether the + hook is invoked right before (pre) or + right after (post) + @param[in,out] PhaseData The pointer to a phase-specific data. + + @retval EFI_SUCCESS The override function completed successfully. + @retval EFI_NOT_FOUND The specified controller or slot does not exist. + @retval EFI_INVALID_PARAMETER PhaseType is invalid + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_SD_MMC_NOTIFY_PHASE)( + IN EFI_HANDLE ControllerHandle, + IN UINT8 Slot, + IN EDKII_SD_MMC_PHASE_TYPE PhaseType, + IN OUT VOID *PhaseData + ); + +struct _EDKII_SD_MMC_OVERRIDE { + // + // Protocol version of this implementation + // + UINTN Version; + // + // Callback to override SD/MMC host controller capability bits + // + EDKII_SD_MMC_CAPABILITY Capability; + // + // Callback to invoke SD/MMC override hooks + // + EDKII_SD_MMC_NOTIFY_PHASE NotifyPhase; +}; + +extern EFI_GUID gEdkiiSdMmcOverrideProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SmmExitBootServices.h b/MdeModulePkg/Include/Protocol/SmmExitBootServices.h index ec8e754946..d077c47ccf 100644 --- a/MdeModulePkg/Include/Protocol/SmmExitBootServices.h +++ b/MdeModulePkg/Include/Protocol/SmmExitBootServices.h @@ -1,23 +1,23 @@ -/** @file
- EDKII SMM Exit Boot Services protocol.
-
- This SMM protocol is to be published by the SMM Foundation code to associate
- with EFI_EVENT_GROUP_EXIT_BOOT_SERVICES to notify SMM driver that system enter
- exit boot services.
-
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMM_EXIT_BOOT_SERVICES_H_
-#define _SMM_EXIT_BOOT_SERVICES_H_
-
-#define EDKII_SMM_EXIT_BOOT_SERVICES_PROTOCOL_GUID \
- { \
- 0x296eb418, 0xc4c8, 0x4e05, { 0xab, 0x59, 0x39, 0xe8, 0xaf, 0x56, 0xf0, 0xa } \
- }
-
-extern EFI_GUID gEdkiiSmmExitBootServicesProtocolGuid;
-
-#endif
+/** @file + EDKII SMM Exit Boot Services protocol. + + This SMM protocol is to be published by the SMM Foundation code to associate + with EFI_EVENT_GROUP_EXIT_BOOT_SERVICES to notify SMM driver that system enter + exit boot services. + + Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMM_EXIT_BOOT_SERVICES_H_ +#define _SMM_EXIT_BOOT_SERVICES_H_ + +#define EDKII_SMM_EXIT_BOOT_SERVICES_PROTOCOL_GUID \ + { \ + 0x296eb418, 0xc4c8, 0x4e05, { 0xab, 0x59, 0x39, 0xe8, 0xaf, 0x56, 0xf0, 0xa } \ + } + +extern EFI_GUID gEdkiiSmmExitBootServicesProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SmmFaultTolerantWrite.h b/MdeModulePkg/Include/Protocol/SmmFaultTolerantWrite.h index 39fc0cbb4e..3747cb39de 100644 --- a/MdeModulePkg/Include/Protocol/SmmFaultTolerantWrite.h +++ b/MdeModulePkg/Include/Protocol/SmmFaultTolerantWrite.h @@ -1,32 +1,32 @@ -/** @file
- SMM Fault Tolerant Write protocol is related to EDK II-specific implementation of FTW,
- provides boot-time service for fault tolerant write capability for block devices in
- EFI SMM environment. The protocol provides for non-volatile storage of the intermediate
- data and private information a caller would need to recover from a critical fault,
- such as a power failure.
-
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SMM_FAULT_TOLERANT_WRITE_H__
-#define __SMM_FAULT_TOLERANT_WRITE_H__
-
-#include <Protocol/FaultTolerantWrite.h>
-
-#define EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL_GUID \
- { \
- 0x3868fc3b, 0x7e45, 0x43a7, { 0x90, 0x6c, 0x4b, 0xa4, 0x7d, 0xe1, 0x75, 0x4d } \
- }
-
-//
-// SMM Fault Tolerant Write protocol structure is the same as Fault Tolerant Write protocol.
-// The SMM one is intend to run in SMM environment, which means it can be used by
-// SMM drivers after ExitPmAuth.
-//
-typedef EFI_FAULT_TOLERANT_WRITE_PROTOCOL EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL;
-
-extern EFI_GUID gEfiSmmFaultTolerantWriteProtocolGuid;
-
-#endif
+/** @file + SMM Fault Tolerant Write protocol is related to EDK II-specific implementation of FTW, + provides boot-time service for fault tolerant write capability for block devices in + EFI SMM environment. The protocol provides for non-volatile storage of the intermediate + data and private information a caller would need to recover from a critical fault, + such as a power failure. + +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SMM_FAULT_TOLERANT_WRITE_H__ +#define __SMM_FAULT_TOLERANT_WRITE_H__ + +#include <Protocol/FaultTolerantWrite.h> + +#define EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL_GUID \ + { \ + 0x3868fc3b, 0x7e45, 0x43a7, { 0x90, 0x6c, 0x4b, 0xa4, 0x7d, 0xe1, 0x75, 0x4d } \ + } + +// +// SMM Fault Tolerant Write protocol structure is the same as Fault Tolerant Write protocol. +// The SMM one is intend to run in SMM environment, which means it can be used by +// SMM drivers after ExitPmAuth. +// +typedef EFI_FAULT_TOLERANT_WRITE_PROTOCOL EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL; + +extern EFI_GUID gEfiSmmFaultTolerantWriteProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SmmFirmwareVolumeBlock.h b/MdeModulePkg/Include/Protocol/SmmFirmwareVolumeBlock.h index 032b5cba41..ea9e31af0b 100644 --- a/MdeModulePkg/Include/Protocol/SmmFirmwareVolumeBlock.h +++ b/MdeModulePkg/Include/Protocol/SmmFirmwareVolumeBlock.h @@ -1,30 +1,30 @@ -/** @file
- SMM Firmware Volume Block protocol is related to EDK II-specific implementation of
- FVB driver, provides control over block-oriented firmware devices and is intended
- to use in the EFI SMM environment.
-
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SMM_FIRMWARE_VOLUME_BLOCK_H__
-#define __SMM_FIRMWARE_VOLUME_BLOCK_H__
-
-#include <Protocol/FirmwareVolumeBlock.h>
-
-#define EFI_SMM_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \
- { \
- 0xd326d041, 0xbd31, 0x4c01, { 0xb5, 0xa8, 0x62, 0x8b, 0xe8, 0x7f, 0x6, 0x53 } \
- }
-
-//
-// SMM Firmware Volume Block protocol structure is the same as Firmware Volume Block
-// protocol. The SMM one is intend to run in SMM environment, which means it can be
-// used by SMM drivers after ExitPmAuth.
-//
-typedef EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL EFI_SMM_FIRMWARE_VOLUME_BLOCK_PROTOCOL;
-
-extern EFI_GUID gEfiSmmFirmwareVolumeBlockProtocolGuid;
-
-#endif
+/** @file + SMM Firmware Volume Block protocol is related to EDK II-specific implementation of + FVB driver, provides control over block-oriented firmware devices and is intended + to use in the EFI SMM environment. + +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SMM_FIRMWARE_VOLUME_BLOCK_H__ +#define __SMM_FIRMWARE_VOLUME_BLOCK_H__ + +#include <Protocol/FirmwareVolumeBlock.h> + +#define EFI_SMM_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \ + { \ + 0xd326d041, 0xbd31, 0x4c01, { 0xb5, 0xa8, 0x62, 0x8b, 0xe8, 0x7f, 0x6, 0x53 } \ + } + +// +// SMM Firmware Volume Block protocol structure is the same as Firmware Volume Block +// protocol. The SMM one is intend to run in SMM environment, which means it can be +// used by SMM drivers after ExitPmAuth. +// +typedef EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL EFI_SMM_FIRMWARE_VOLUME_BLOCK_PROTOCOL; + +extern EFI_GUID gEfiSmmFirmwareVolumeBlockProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SmmLegacyBoot.h b/MdeModulePkg/Include/Protocol/SmmLegacyBoot.h index 4f415cccf8..c6c4f156fe 100644 --- a/MdeModulePkg/Include/Protocol/SmmLegacyBoot.h +++ b/MdeModulePkg/Include/Protocol/SmmLegacyBoot.h @@ -1,22 +1,22 @@ -/** @file
- EDKII SMM Legacy Boot protocol.
-
- This SMM protocol is to be published by the SMM Foundation code to associate
- with EFI_EVENT_LEGACY_BOOT_GUID to notify SMM driver that system enter legacy boot.
-
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMM_LEGACY_BOOT_H_
-#define _SMM_LEGACY_BOOT_H_
-
-#define EDKII_SMM_LEGACY_BOOT_PROTOCOL_GUID \
- { \
- 0x85a8ab57, 0x644, 0x4110, { 0x85, 0xf, 0x98, 0x13, 0x22, 0x4, 0x70, 0x70 } \
- }
-
-extern EFI_GUID gEdkiiSmmLegacyBootProtocolGuid;
-
-#endif
+/** @file + EDKII SMM Legacy Boot protocol. + + This SMM protocol is to be published by the SMM Foundation code to associate + with EFI_EVENT_LEGACY_BOOT_GUID to notify SMM driver that system enter legacy boot. + + Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMM_LEGACY_BOOT_H_ +#define _SMM_LEGACY_BOOT_H_ + +#define EDKII_SMM_LEGACY_BOOT_PROTOCOL_GUID \ + { \ + 0x85a8ab57, 0x644, 0x4110, { 0x85, 0xf, 0x98, 0x13, 0x22, 0x4, 0x70, 0x70 } \ + } + +extern EFI_GUID gEdkiiSmmLegacyBootProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h b/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h index 0a8b251dd4..fd15cb8dfa 100644 --- a/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h +++ b/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h @@ -1,127 +1,127 @@ -/** @file
- SMM Memory Attribute Protocol provides retrieval and update service
- for memory attributes in EFI SMM environment.
-
- Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SMM_MEMORYATTRIBUTE_H__
-#define __SMM_MEMORYATTRIBUTE_H__
-
-// {69B792EA-39CE-402D-A2A6-F721DE351DFE}
-#define EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL_GUID \
- { \
- 0x69b792ea, 0x39ce, 0x402d, { 0xa2, 0xa6, 0xf7, 0x21, 0xde, 0x35, 0x1d, 0xfe } \
- }
-
-typedef struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL;
-
-/**
- This function set given attributes of the memory region specified by
- BaseAddress and Length.
-
- @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
- @param BaseAddress The physical address that is the start address of
- a memory region.
- @param Length The size in bytes of the memory region.
- @param Attributes The bit mask of attributes to set for the memory
- region.
-
- @retval EFI_SUCCESS The attributes were set for the memory region.
- @retval EFI_INVALID_PARAMETER Length is zero.
- Attributes specified an illegal combination of
- attributes that cannot be set together.
- @retval EFI_UNSUPPORTED The processor does not support one or more
- bytes of the memory resource range specified
- by BaseAddress and Length.
- The bit mask of attributes is not supported for
- the memory resource range specified by
- BaseAddress and Length.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_SMM_SET_MEMORY_ATTRIBUTES)(
- IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Attributes
- );
-
-/**
- This function clears given attributes of the memory region specified by
- BaseAddress and Length.
-
- @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
- @param BaseAddress The physical address that is the start address of
- a memory region.
- @param Length The size in bytes of the memory region.
- @param Attributes The bit mask of attributes to clear for the memory
- region.
-
- @retval EFI_SUCCESS The attributes were cleared for the memory region.
- @retval EFI_INVALID_PARAMETER Length is zero.
- Attributes specified an illegal combination of
- attributes that cannot be cleared together.
- @retval EFI_UNSUPPORTED The processor does not support one or more
- bytes of the memory resource range specified
- by BaseAddress and Length.
- The bit mask of attributes is not supported for
- the memory resource range specified by
- BaseAddress and Length.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES)(
- IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Attributes
- );
-
-/**
- This function retrieves the attributes of the memory region specified by
- BaseAddress and Length. If different attributes are got from different part
- of the memory region, EFI_NO_MAPPING will be returned.
-
- @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
- @param BaseAddress The physical address that is the start address of
- a memory region.
- @param Length The size in bytes of the memory region.
- @param Attributes Pointer to attributes returned.
-
- @retval EFI_SUCCESS The attributes got for the memory region.
- @retval EFI_INVALID_PARAMETER Length is zero.
- Attributes is NULL.
- @retval EFI_NO_MAPPING Attributes are not consistent cross the memory
- region.
- @retval EFI_UNSUPPORTED The processor does not support one or more
- bytes of the memory resource range specified
- by BaseAddress and Length.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_SMM_GET_MEMORY_ATTRIBUTES)(
- IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- OUT UINT64 *Attributes
- );
-
-///
-/// SMM Memory Attribute Protocol provides services to retrieve or update
-/// attribute of memory in the EFI SMM environment.
-///
-struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL {
- EDKII_SMM_GET_MEMORY_ATTRIBUTES GetMemoryAttributes;
- EDKII_SMM_SET_MEMORY_ATTRIBUTES SetMemoryAttributes;
- EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES ClearMemoryAttributes;
-};
-
-extern EFI_GUID gEdkiiSmmMemoryAttributeProtocolGuid;
-
-#endif
+/** @file + SMM Memory Attribute Protocol provides retrieval and update service + for memory attributes in EFI SMM environment. + + Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SMM_MEMORYATTRIBUTE_H__ +#define __SMM_MEMORYATTRIBUTE_H__ + +// {69B792EA-39CE-402D-A2A6-F721DE351DFE} +#define EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL_GUID \ + { \ + 0x69b792ea, 0x39ce, 0x402d, { 0xa2, 0xa6, 0xf7, 0x21, 0xde, 0x35, 0x1d, 0xfe } \ + } + +typedef struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL; + +/** + This function set given attributes of the memory region specified by + BaseAddress and Length. + + @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance. + @param BaseAddress The physical address that is the start address of + a memory region. + @param Length The size in bytes of the memory region. + @param Attributes The bit mask of attributes to set for the memory + region. + + @retval EFI_SUCCESS The attributes were set for the memory region. + @retval EFI_INVALID_PARAMETER Length is zero. + Attributes specified an illegal combination of + attributes that cannot be set together. + @retval EFI_UNSUPPORTED The processor does not support one or more + bytes of the memory resource range specified + by BaseAddress and Length. + The bit mask of attributes is not supported for + the memory resource range specified by + BaseAddress and Length. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_SMM_SET_MEMORY_ATTRIBUTES)( + IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This, + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT64 Attributes + ); + +/** + This function clears given attributes of the memory region specified by + BaseAddress and Length. + + @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance. + @param BaseAddress The physical address that is the start address of + a memory region. + @param Length The size in bytes of the memory region. + @param Attributes The bit mask of attributes to clear for the memory + region. + + @retval EFI_SUCCESS The attributes were cleared for the memory region. + @retval EFI_INVALID_PARAMETER Length is zero. + Attributes specified an illegal combination of + attributes that cannot be cleared together. + @retval EFI_UNSUPPORTED The processor does not support one or more + bytes of the memory resource range specified + by BaseAddress and Length. + The bit mask of attributes is not supported for + the memory resource range specified by + BaseAddress and Length. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES)( + IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This, + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT64 Attributes + ); + +/** + This function retrieves the attributes of the memory region specified by + BaseAddress and Length. If different attributes are got from different part + of the memory region, EFI_NO_MAPPING will be returned. + + @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance. + @param BaseAddress The physical address that is the start address of + a memory region. + @param Length The size in bytes of the memory region. + @param Attributes Pointer to attributes returned. + + @retval EFI_SUCCESS The attributes got for the memory region. + @retval EFI_INVALID_PARAMETER Length is zero. + Attributes is NULL. + @retval EFI_NO_MAPPING Attributes are not consistent cross the memory + region. + @retval EFI_UNSUPPORTED The processor does not support one or more + bytes of the memory resource range specified + by BaseAddress and Length. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_SMM_GET_MEMORY_ATTRIBUTES)( + IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This, + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + OUT UINT64 *Attributes + ); + +/// +/// SMM Memory Attribute Protocol provides services to retrieve or update +/// attribute of memory in the EFI SMM environment. +/// +struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL { + EDKII_SMM_GET_MEMORY_ATTRIBUTES GetMemoryAttributes; + EDKII_SMM_SET_MEMORY_ATTRIBUTES SetMemoryAttributes; + EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES ClearMemoryAttributes; +}; + +extern EFI_GUID gEdkiiSmmMemoryAttributeProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SmmReadyToBoot.h b/MdeModulePkg/Include/Protocol/SmmReadyToBoot.h index 5603050977..155c66a145 100644 --- a/MdeModulePkg/Include/Protocol/SmmReadyToBoot.h +++ b/MdeModulePkg/Include/Protocol/SmmReadyToBoot.h @@ -1,23 +1,23 @@ -/** @file
- EDKII SMM Ready To Boot protocol.
-
- This SMM protocol is to be published by the SMM Foundation code to associate
- with EFI_EVENT_GROUP_READY_TO_BOOT to notify SMM driver that system enter
- ready to boot.
-
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMM_READY_TO_BOOT_H_
-#define _SMM_READY_TO_BOOT_H_
-
-#define EDKII_SMM_READY_TO_BOOT_PROTOCOL_GUID \
- { \
- 0x6e057ecf, 0xfa99, 0x4f39, { 0x95, 0xbc, 0x59, 0xf9, 0x92, 0x1d, 0x17, 0xe4 } \
- }
-
-extern EFI_GUID gEdkiiSmmReadyToBootProtocolGuid;
-
-#endif
+/** @file + EDKII SMM Ready To Boot protocol. + + This SMM protocol is to be published by the SMM Foundation code to associate + with EFI_EVENT_GROUP_READY_TO_BOOT to notify SMM driver that system enter + ready to boot. + + Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMM_READY_TO_BOOT_H_ +#define _SMM_READY_TO_BOOT_H_ + +#define EDKII_SMM_READY_TO_BOOT_PROTOCOL_GUID \ + { \ + 0x6e057ecf, 0xfa99, 0x4f39, { 0x95, 0xbc, 0x59, 0xf9, 0x92, 0x1d, 0x17, 0xe4 } \ + } + +extern EFI_GUID gEdkiiSmmReadyToBootProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SmmSwapAddressRange.h b/MdeModulePkg/Include/Protocol/SmmSwapAddressRange.h index 80697e171f..c477d57f8d 100644 --- a/MdeModulePkg/Include/Protocol/SmmSwapAddressRange.h +++ b/MdeModulePkg/Include/Protocol/SmmSwapAddressRange.h @@ -1,34 +1,34 @@ -/** @file
- The EFI_SMM_SWAP_ADDRESS_RANGE_PROTOCOL is related to EDK II-specific implementation
- and used to abstract the swap operation of boot block and backup block of FV in EFI
- SMM environment. This swap is especially needed when updating the boot block of FV.
- If a power failure happens during the boot block update, the swapped backup block
- (now the boot block) can boot the machine with the old boot block backed up in it.
- The swap operation is platform dependent, so other protocols such as SMM FTW (Fault
- Tolerant Write) should use this protocol instead of handling hardware directly.
-
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SMM_SWAP_ADDRESS_RANGE_H__
-#define __SMM_SWAP_ADDRESS_RANGE_H__
-
-#include <Protocol/SwapAddressRange.h>
-
-#define EFI_SMM_SWAP_ADDRESS_RANGE_PROTOCOL_GUID \
- { \
- 0x67c4f112, 0x3385, 0x4e55, { 0x9c, 0x5b, 0xc0, 0x5b, 0x71, 0x7c, 0x42, 0x28 } \
- }
-
-//
-// SMM Swap Address Range protocol structure is the same as Swap Address Range protocol.
-// The SMM one is intend to run in SMM environment, which means it can be used by
-// SMM drivers after ExitPmAuth.
-//
-typedef EFI_SWAP_ADDRESS_RANGE_PROTOCOL EFI_SMM_SWAP_ADDRESS_RANGE_PROTOCOL;
-
-extern EFI_GUID gEfiSmmSwapAddressRangeProtocolGuid;
-
-#endif
+/** @file + The EFI_SMM_SWAP_ADDRESS_RANGE_PROTOCOL is related to EDK II-specific implementation + and used to abstract the swap operation of boot block and backup block of FV in EFI + SMM environment. This swap is especially needed when updating the boot block of FV. + If a power failure happens during the boot block update, the swapped backup block + (now the boot block) can boot the machine with the old boot block backed up in it. + The swap operation is platform dependent, so other protocols such as SMM FTW (Fault + Tolerant Write) should use this protocol instead of handling hardware directly. + +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SMM_SWAP_ADDRESS_RANGE_H__ +#define __SMM_SWAP_ADDRESS_RANGE_H__ + +#include <Protocol/SwapAddressRange.h> + +#define EFI_SMM_SWAP_ADDRESS_RANGE_PROTOCOL_GUID \ + { \ + 0x67c4f112, 0x3385, 0x4e55, { 0x9c, 0x5b, 0xc0, 0x5b, 0x71, 0x7c, 0x42, 0x28 } \ + } + +// +// SMM Swap Address Range protocol structure is the same as Swap Address Range protocol. +// The SMM one is intend to run in SMM environment, which means it can be used by +// SMM drivers after ExitPmAuth. +// +typedef EFI_SWAP_ADDRESS_RANGE_PROTOCOL EFI_SMM_SWAP_ADDRESS_RANGE_PROTOCOL; + +extern EFI_GUID gEfiSmmSwapAddressRangeProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SmmVarCheck.h b/MdeModulePkg/Include/Protocol/SmmVarCheck.h index 4b601f2cad..4b391d42d2 100644 --- a/MdeModulePkg/Include/Protocol/SmmVarCheck.h +++ b/MdeModulePkg/Include/Protocol/SmmVarCheck.h @@ -1,29 +1,29 @@ -/** @file
- SMM variable check definitions, it reuses the interface definitions of variable check.
-
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SMM_VAR_CHECK_H__
-#define __SMM_VAR_CHECK_H__
-
-#include <Protocol/VarCheck.h>
-
-#define EDKII_SMM_VAR_CHECK_PROTOCOL_GUID \
- { \
- 0xb0d8f3c1, 0xb7de, 0x4c11, { 0xbc, 0x89, 0x2f, 0xb5, 0x62, 0xc8, 0xc4, 0x11 } \
- };
-
-typedef struct _EDKII_SMM_VAR_CHECK_PROTOCOL EDKII_SMM_VAR_CHECK_PROTOCOL;
-
-struct _EDKII_SMM_VAR_CHECK_PROTOCOL {
- EDKII_VAR_CHECK_REGISTER_SET_VARIABLE_CHECK_HANDLER SmmRegisterSetVariableCheckHandler;
- EDKII_VAR_CHECK_VARIABLE_PROPERTY_SET SmmVariablePropertySet;
- EDKII_VAR_CHECK_VARIABLE_PROPERTY_GET SmmVariablePropertyGet;
-};
-
-extern EFI_GUID gEdkiiSmmVarCheckProtocolGuid;
-
-#endif
+/** @file + SMM variable check definitions, it reuses the interface definitions of variable check. + + Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SMM_VAR_CHECK_H__ +#define __SMM_VAR_CHECK_H__ + +#include <Protocol/VarCheck.h> + +#define EDKII_SMM_VAR_CHECK_PROTOCOL_GUID \ + { \ + 0xb0d8f3c1, 0xb7de, 0x4c11, { 0xbc, 0x89, 0x2f, 0xb5, 0x62, 0xc8, 0xc4, 0x11 } \ + }; + +typedef struct _EDKII_SMM_VAR_CHECK_PROTOCOL EDKII_SMM_VAR_CHECK_PROTOCOL; + +struct _EDKII_SMM_VAR_CHECK_PROTOCOL { + EDKII_VAR_CHECK_REGISTER_SET_VARIABLE_CHECK_HANDLER SmmRegisterSetVariableCheckHandler; + EDKII_VAR_CHECK_VARIABLE_PROPERTY_SET SmmVariablePropertySet; + EDKII_VAR_CHECK_VARIABLE_PROPERTY_GET SmmVariablePropertyGet; +}; + +extern EFI_GUID gEdkiiSmmVarCheckProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SmmVariable.h b/MdeModulePkg/Include/Protocol/SmmVariable.h index 7f657082ce..e97f77e24c 100644 --- a/MdeModulePkg/Include/Protocol/SmmVariable.h +++ b/MdeModulePkg/Include/Protocol/SmmVariable.h @@ -1,33 +1,33 @@ -/** @file
- EFI SMM Variable Protocol is related to EDK II-specific implementation of variables
- and intended for use as a means to store data in the EFI SMM environment.
-
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SMM_VARIABLE_H__
-#define __SMM_VARIABLE_H__
-
-#define EFI_SMM_VARIABLE_PROTOCOL_GUID \
- { \
- 0xed32d533, 0x99e6, 0x4209, { 0x9c, 0xc0, 0x2d, 0x72, 0xcd, 0xd9, 0x98, 0xa7 } \
- }
-
-typedef struct _EFI_SMM_VARIABLE_PROTOCOL EFI_SMM_VARIABLE_PROTOCOL;
-
-///
-/// EFI SMM Variable Protocol is intended for use as a means
-/// to store data in the EFI SMM environment.
-///
-struct _EFI_SMM_VARIABLE_PROTOCOL {
- EFI_GET_VARIABLE SmmGetVariable;
- EFI_GET_NEXT_VARIABLE_NAME SmmGetNextVariableName;
- EFI_SET_VARIABLE SmmSetVariable;
- EFI_QUERY_VARIABLE_INFO SmmQueryVariableInfo;
-};
-
-extern EFI_GUID gEfiSmmVariableProtocolGuid;
-
-#endif
+/** @file + EFI SMM Variable Protocol is related to EDK II-specific implementation of variables + and intended for use as a means to store data in the EFI SMM environment. + + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SMM_VARIABLE_H__ +#define __SMM_VARIABLE_H__ + +#define EFI_SMM_VARIABLE_PROTOCOL_GUID \ + { \ + 0xed32d533, 0x99e6, 0x4209, { 0x9c, 0xc0, 0x2d, 0x72, 0xcd, 0xd9, 0x98, 0xa7 } \ + } + +typedef struct _EFI_SMM_VARIABLE_PROTOCOL EFI_SMM_VARIABLE_PROTOCOL; + +/// +/// EFI SMM Variable Protocol is intended for use as a means +/// to store data in the EFI SMM environment. +/// +struct _EFI_SMM_VARIABLE_PROTOCOL { + EFI_GET_VARIABLE SmmGetVariable; + EFI_GET_NEXT_VARIABLE_NAME SmmGetNextVariableName; + EFI_SET_VARIABLE SmmSetVariable; + EFI_QUERY_VARIABLE_INFO SmmQueryVariableInfo; +}; + +extern EFI_GUID gEfiSmmVariableProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/SwapAddressRange.h b/MdeModulePkg/Include/Protocol/SwapAddressRange.h index 053987767a..88f4d2a0da 100644 --- a/MdeModulePkg/Include/Protocol/SwapAddressRange.h +++ b/MdeModulePkg/Include/Protocol/SwapAddressRange.h @@ -1,164 +1,164 @@ -/** @file
-The EFI_SWAP_ADDRESS_RANGE_PROTOCOL is used to abstract the swap operation of boot block
-and backup block of FV. This swap is especially needed when updating the boot block of FV. If a
-power failure happens during the boot block update, the swapped backup block (now the boot block)
-can boot the machine with the old boot block backed up in it. The swap operation is platform dependent, so
-other protocols such as FTW (Fault Tolerant Write) should use this protocol instead of handling hardware directly.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EFI_SWAP_ADDRESS_RANGE_PROTOCOL_H_
-#define _EFI_SWAP_ADDRESS_RANGE_PROTOCOL_H_
-
-#define EFI_SWAP_ADDRESS_RANGE_PROTOCOL_GUID \
- { \
- 0x1259f60d, 0xb754, 0x468e, {0xa7, 0x89, 0x4d, 0xb8, 0x5d, 0x55, 0xe8, 0x7e } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL EFI_SWAP_ADDRESS_RANGE_PROTOCOL;
-
-#define EFI_UNSUPPORT_LOCK 0
-#define EFI_SOFTWARE_LOCK 1
-#define EFI_HARDWARE_LOCK 2
-
-typedef UINT8 EFI_SWAP_LOCK_CAPABILITY;
-
-//
-// Protocol APIs
-//
-
-/**
- This function gets the address range location of
- boot block and backup block.
-
- @param This Indicates the calling context.
- @param BootBlockBase The base address of current boot block.
- @param BootBlockSize The size (in bytes) of current boot block.
- @param BackupBlockBase The base address of current backup block.
- @param BackupBlockSize The size (in bytes) of current backup block.
-
- @retval EFI_SUCCESS The call was successful.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_GET_RANGE_LOCATION)(
- IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
- OUT EFI_PHYSICAL_ADDRESS *BootBlockBase,
- OUT UINTN *BootBlockSize,
- OUT EFI_PHYSICAL_ADDRESS *BackupBlockBase,
- OUT UINTN *BackupBlockSize
- );
-
-/**
- This service checks if the boot block and backup block has been swapped.
-
- @param This Indicates the calling context.
- @param SwapState True if the boot block and backup block has been swapped.
- False if the boot block and backup block has not been swapped.
-
- @retval EFI_SUCCESS The call was successful.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_GET_SWAP_STATE)(
- IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
- OUT BOOLEAN *SwapState
- );
-
-/**
- This service swaps the boot block and backup block, or swaps them back.
-
- It also acquires and releases software swap lock during operation. The setting of the new swap state
- is not affected by the old swap state.
-
- @param This Indicates the calling context.
- @param NewSwapState True to swap real boot block and backup block, False to swap them back.
-
- @retval EFI_SUCCESS The call was successful.
- @retval EFI_ABORTED Set swap state error.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SET_SWAP_STATE)(
- IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
- IN BOOLEAN NewSwapState
- );
-
-/**
- This service checks if a Real Time Clock (RTC) power failure happened.
-
- If parameter RtcPowerFailed is true after the function returns, RTC power supply failed or was removed.
- It is recommended to check RTC power status before calling GetSwapState().
-
- @param This Indicates the calling context.
- @param RtcPowerFailed True if the RTC (Real Time Clock) power failed or was removed.
-
- @retval EFI_SUCCESS The call was successful.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_GET_RTC_POWER_STATUS)(
- IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
- OUT BOOLEAN *RtcPowerFailed
- );
-
-/**
- This service returns all lock methods for swap operations that the current platform
- supports. Could be software lock, hardware lock, or unsupport lock.
- Note that software and hardware lock methods can be used simultaneously.
-
- @param This Indicates the calling context.
- @param LockCapability The current lock method for swap operations.
-
- @retval EFI_SUCCESS The call was successful.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_GET_SWAP_LOCK_CAPABILITY)(
- IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
- OUT EFI_SWAP_LOCK_CAPABILITY *LockCapability
- );
-
-/**
- This service is used to acquire or release appointed kind of lock for Swap Address Range operations.
-
- Note that software and hardware lock mothod can be used simultaneously.
-
- @param This Indicates the calling context.
- @param LockCapability Indicates which lock to acquire or release.
- @param NewLockState True to acquire lock; False to release lock.
-
- @retval EFI_SUCCESS The call was successful.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SET_SWAP_LOCK)(
- IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This,
- IN EFI_SWAP_LOCK_CAPABILITY LockCapability,
- IN BOOLEAN NewLockState
- );
-
-struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL {
- EFI_GET_RANGE_LOCATION GetRangeLocation; // has output parameters for base and length
- EFI_GET_SWAP_STATE GetSwapState; // are ranges swapped or not
- EFI_SET_SWAP_STATE SetSwapState; // swap or unswap ranges
- EFI_GET_RTC_POWER_STATUS GetRtcPowerStatus; // checks RTC battery, or whatever...
- EFI_GET_SWAP_LOCK_CAPABILITY GetSwapLockCapability; // Get TOP_SWAP lock capability,
- EFI_SET_SWAP_LOCK SetSwapLock; // Set TOP_SWAP lock state
-};
-
-extern EFI_GUID gEfiSwapAddressRangeProtocolGuid;
-
-#endif
+/** @file +The EFI_SWAP_ADDRESS_RANGE_PROTOCOL is used to abstract the swap operation of boot block +and backup block of FV. This swap is especially needed when updating the boot block of FV. If a +power failure happens during the boot block update, the swapped backup block (now the boot block) +can boot the machine with the old boot block backed up in it. The swap operation is platform dependent, so +other protocols such as FTW (Fault Tolerant Write) should use this protocol instead of handling hardware directly. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EFI_SWAP_ADDRESS_RANGE_PROTOCOL_H_ +#define _EFI_SWAP_ADDRESS_RANGE_PROTOCOL_H_ + +#define EFI_SWAP_ADDRESS_RANGE_PROTOCOL_GUID \ + { \ + 0x1259f60d, 0xb754, 0x468e, {0xa7, 0x89, 0x4d, 0xb8, 0x5d, 0x55, 0xe8, 0x7e } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL EFI_SWAP_ADDRESS_RANGE_PROTOCOL; + +#define EFI_UNSUPPORT_LOCK 0 +#define EFI_SOFTWARE_LOCK 1 +#define EFI_HARDWARE_LOCK 2 + +typedef UINT8 EFI_SWAP_LOCK_CAPABILITY; + +// +// Protocol APIs +// + +/** + This function gets the address range location of + boot block and backup block. + + @param This Indicates the calling context. + @param BootBlockBase The base address of current boot block. + @param BootBlockSize The size (in bytes) of current boot block. + @param BackupBlockBase The base address of current backup block. + @param BackupBlockSize The size (in bytes) of current backup block. + + @retval EFI_SUCCESS The call was successful. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GET_RANGE_LOCATION)( + IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, + OUT EFI_PHYSICAL_ADDRESS *BootBlockBase, + OUT UINTN *BootBlockSize, + OUT EFI_PHYSICAL_ADDRESS *BackupBlockBase, + OUT UINTN *BackupBlockSize + ); + +/** + This service checks if the boot block and backup block has been swapped. + + @param This Indicates the calling context. + @param SwapState True if the boot block and backup block has been swapped. + False if the boot block and backup block has not been swapped. + + @retval EFI_SUCCESS The call was successful. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GET_SWAP_STATE)( + IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, + OUT BOOLEAN *SwapState + ); + +/** + This service swaps the boot block and backup block, or swaps them back. + + It also acquires and releases software swap lock during operation. The setting of the new swap state + is not affected by the old swap state. + + @param This Indicates the calling context. + @param NewSwapState True to swap real boot block and backup block, False to swap them back. + + @retval EFI_SUCCESS The call was successful. + @retval EFI_ABORTED Set swap state error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SET_SWAP_STATE)( + IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, + IN BOOLEAN NewSwapState + ); + +/** + This service checks if a Real Time Clock (RTC) power failure happened. + + If parameter RtcPowerFailed is true after the function returns, RTC power supply failed or was removed. + It is recommended to check RTC power status before calling GetSwapState(). + + @param This Indicates the calling context. + @param RtcPowerFailed True if the RTC (Real Time Clock) power failed or was removed. + + @retval EFI_SUCCESS The call was successful. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GET_RTC_POWER_STATUS)( + IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, + OUT BOOLEAN *RtcPowerFailed + ); + +/** + This service returns all lock methods for swap operations that the current platform + supports. Could be software lock, hardware lock, or unsupport lock. + Note that software and hardware lock methods can be used simultaneously. + + @param This Indicates the calling context. + @param LockCapability The current lock method for swap operations. + + @retval EFI_SUCCESS The call was successful. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GET_SWAP_LOCK_CAPABILITY)( + IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, + OUT EFI_SWAP_LOCK_CAPABILITY *LockCapability + ); + +/** + This service is used to acquire or release appointed kind of lock for Swap Address Range operations. + + Note that software and hardware lock mothod can be used simultaneously. + + @param This Indicates the calling context. + @param LockCapability Indicates which lock to acquire or release. + @param NewLockState True to acquire lock; False to release lock. + + @retval EFI_SUCCESS The call was successful. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SET_SWAP_LOCK)( + IN EFI_SWAP_ADDRESS_RANGE_PROTOCOL *This, + IN EFI_SWAP_LOCK_CAPABILITY LockCapability, + IN BOOLEAN NewLockState + ); + +struct _EFI_SWAP_ADDRESS_RANGE_PROTOCOL { + EFI_GET_RANGE_LOCATION GetRangeLocation; // has output parameters for base and length + EFI_GET_SWAP_STATE GetSwapState; // are ranges swapped or not + EFI_SET_SWAP_STATE SetSwapState; // swap or unswap ranges + EFI_GET_RTC_POWER_STATUS GetRtcPowerStatus; // checks RTC battery, or whatever... + EFI_GET_SWAP_LOCK_CAPABILITY GetSwapLockCapability; // Get TOP_SWAP lock capability, + EFI_SET_SWAP_LOCK SetSwapLock; // Set TOP_SWAP lock state +}; + +extern EFI_GUID gEfiSwapAddressRangeProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/UfsHostController.h b/MdeModulePkg/Include/Protocol/UfsHostController.h index e0e00f08fb..fbd71f8357 100644 --- a/MdeModulePkg/Include/Protocol/UfsHostController.h +++ b/MdeModulePkg/Include/Protocol/UfsHostController.h @@ -1,235 +1,235 @@ -/** @file
-
- EDKII Universal Flash Storage Host Controller Protocol.
-
-Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EDKII_UFS_HC_PROTOCOL_H__
-#define __EDKII_UFS_HC_PROTOCOL_H__
-
-//
-// UFS Host Controller Protocol GUID value
-//
-#define EDKII_UFS_HOST_CONTROLLER_PROTOCOL_GUID \
- { \
- 0xebc01af5, 0x7a9, 0x489e, { 0xb7, 0xce, 0xdc, 0x8, 0x9e, 0x45, 0x9b, 0x2f } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EDKII_UFS_HOST_CONTROLLER_PROTOCOL EDKII_UFS_HOST_CONTROLLER_PROTOCOL;
-
-/**
- Get the MMIO base address of UFS host controller.
-
- @param This The protocol instance pointer.
- @param MmioBar Pointer to the UFS host controller MMIO base address.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_GET_MMIO_BAR)(
- IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,
- OUT UINTN *MmioBar
- );
-
-///
-/// *******************************************************
-/// EFI_UFS_HOST_CONTROLLER_OPERATION
-/// *******************************************************
-///
-typedef enum {
- ///
- /// A read operation from system memory by a bus master.
- ///
- EdkiiUfsHcOperationBusMasterRead,
- ///
- /// A write operation from system memory by a bus master.
- ///
- EdkiiUfsHcOperationBusMasterWrite,
- ///
- /// Provides both read and write access to system memory by both the processor and a
- /// bus master. The buffer is coherent from both the processor's and the bus master's point of view.
- ///
- EdkiiUfsHcOperationBusMasterCommonBuffer,
- EdkiiUfsHcOperationMaximum
-} EDKII_UFS_HOST_CONTROLLER_OPERATION;
-
-/**
- Provides the UFS controller-specific addresses needed to access system memory.
-
- @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.
- @param Operation Indicates if the bus master is going to read or write to system memory.
- @param HostAddress The system memory address to map to the UFS controller.
- @param NumberOfBytes On input the number of bytes to map. On output the number of bytes
- that were mapped.
- @param DeviceAddress The resulting map address for the bus master UFS controller to use to
- access the hosts HostAddress.
- @param Mapping A resulting value to pass to Unmap().
-
- @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
- @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_MAP)(
- IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,
- IN EDKII_UFS_HOST_CONTROLLER_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- );
-
-/**
- Completes the Map() operation and releases any corresponding resources.
-
- @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.
- @param Mapping The mapping value returned from Map().
-
- @retval EFI_SUCCESS The range was unmapped.
- @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_UNMAP)(
- IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,
- IN VOID *Mapping
- );
-
-/**
- Allocates pages that are suitable for an EfiUfsHcOperationBusMasterCommonBuffer
- mapping.
-
- @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.
- @param Type This parameter is not used and must be ignored.
- @param MemoryType The type of memory to allocate, EfiBootServicesData or
- EfiRuntimeServicesData.
- @param Pages The number of pages to allocate.
- @param HostAddress A pointer to store the base system memory address of the
- allocated range.
- @param Attributes The requested bit mask of attributes for the allocated range.
-
- @retval EFI_SUCCESS The requested memory pages were allocated.
- @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
- MEMORY_WRITE_COMBINE and MEMORY_CACHED.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_ALLOCATE_BUFFER)(
- IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT VOID **HostAddress,
- IN UINT64 Attributes
- );
-
-/**
- Frees memory that was allocated with AllocateBuffer().
-
- @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.
- @param Pages The number of pages to free.
- @param HostAddress The base system memory address of the allocated range.
-
- @retval EFI_SUCCESS The requested memory pages were freed.
- @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
- was not allocated with AllocateBuffer().
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_FREE_BUFFER)(
- IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,
- IN UINTN Pages,
- IN VOID *HostAddress
- );
-
-/**
- Flushes all posted write transactions from the UFS bus to attached UFS device.
-
- @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.
-
- @retval EFI_SUCCESS The posted write transactions were flushed from the UFS bus
- to attached UFS device.
- @retval EFI_DEVICE_ERROR The posted write transactions were not flushed from the UFS
- bus to attached UFS device due to a hardware error.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_FLUSH)(
- IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This
- );
-
-typedef enum {
- EfiUfsHcWidthUint8 = 0,
- EfiUfsHcWidthUint16,
- EfiUfsHcWidthUint32,
- EfiUfsHcWidthUint64,
- EfiUfsHcWidthMaximum
-} EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH;
-
-/**
- Enable a UFS bus driver to access UFS MMIO registers in the UFS Host Controller memory space.
-
- @param This A pointer to the EDKII_UFS_HOST_CONTROLLER_PROTOCOL instance.
- @param Width Signifies the width of the memory operations.
- @param Offset The offset within the UFS Host Controller MMIO space to start the
- memory operation.
- @param Count The number of memory operations to perform.
- @param Buffer For read operations, the destination buffer to store the results.
- For write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the UFS host controller.
- @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
- valid for the UFS Host Controller memory space.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_MMIO_READ_WRITE)(
- IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,
- IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH Width,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-///
-/// UFS Host Controller Protocol structure.
-///
-struct _EDKII_UFS_HOST_CONTROLLER_PROTOCOL {
- EDKII_UFS_HC_GET_MMIO_BAR GetUfsHcMmioBar;
- EDKII_UFS_HC_ALLOCATE_BUFFER AllocateBuffer;
- EDKII_UFS_HC_FREE_BUFFER FreeBuffer;
- EDKII_UFS_HC_MAP Map;
- EDKII_UFS_HC_UNMAP Unmap;
- EDKII_UFS_HC_FLUSH Flush;
- EDKII_UFS_HC_MMIO_READ_WRITE Read;
- EDKII_UFS_HC_MMIO_READ_WRITE Write;
-};
-
-///
-/// UFS Host Controller Protocol GUID variable.
-///
-extern EFI_GUID gEdkiiUfsHostControllerProtocolGuid;
-
-#endif
+/** @file + + EDKII Universal Flash Storage Host Controller Protocol. + +Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EDKII_UFS_HC_PROTOCOL_H__ +#define __EDKII_UFS_HC_PROTOCOL_H__ + +// +// UFS Host Controller Protocol GUID value +// +#define EDKII_UFS_HOST_CONTROLLER_PROTOCOL_GUID \ + { \ + 0xebc01af5, 0x7a9, 0x489e, { 0xb7, 0xce, 0xdc, 0x8, 0x9e, 0x45, 0x9b, 0x2f } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EDKII_UFS_HOST_CONTROLLER_PROTOCOL EDKII_UFS_HOST_CONTROLLER_PROTOCOL; + +/** + Get the MMIO base address of UFS host controller. + + @param This The protocol instance pointer. + @param MmioBar Pointer to the UFS host controller MMIO base address. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_GET_MMIO_BAR)( + IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, + OUT UINTN *MmioBar + ); + +/// +/// ******************************************************* +/// EFI_UFS_HOST_CONTROLLER_OPERATION +/// ******************************************************* +/// +typedef enum { + /// + /// A read operation from system memory by a bus master. + /// + EdkiiUfsHcOperationBusMasterRead, + /// + /// A write operation from system memory by a bus master. + /// + EdkiiUfsHcOperationBusMasterWrite, + /// + /// Provides both read and write access to system memory by both the processor and a + /// bus master. The buffer is coherent from both the processor's and the bus master's point of view. + /// + EdkiiUfsHcOperationBusMasterCommonBuffer, + EdkiiUfsHcOperationMaximum +} EDKII_UFS_HOST_CONTROLLER_OPERATION; + +/** + Provides the UFS controller-specific addresses needed to access system memory. + + @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance. + @param Operation Indicates if the bus master is going to read or write to system memory. + @param HostAddress The system memory address to map to the UFS controller. + @param NumberOfBytes On input the number of bytes to map. On output the number of bytes + that were mapped. + @param DeviceAddress The resulting map address for the bus master UFS controller to use to + access the hosts HostAddress. + @param Mapping A resulting value to pass to Unmap(). + + @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_DEVICE_ERROR The system hardware could not map the requested address. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_MAP)( + IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, + IN EDKII_UFS_HOST_CONTROLLER_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); + +/** + Completes the Map() operation and releases any corresponding resources. + + @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance. + @param Mapping The mapping value returned from Map(). + + @retval EFI_SUCCESS The range was unmapped. + @retval EFI_DEVICE_ERROR The data was not committed to the target system memory. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_UNMAP)( + IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, + IN VOID *Mapping + ); + +/** + Allocates pages that are suitable for an EfiUfsHcOperationBusMasterCommonBuffer + mapping. + + @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance. + @param Type This parameter is not used and must be ignored. + @param MemoryType The type of memory to allocate, EfiBootServicesData or + EfiRuntimeServicesData. + @param Pages The number of pages to allocate. + @param HostAddress A pointer to store the base system memory address of the + allocated range. + @param Attributes The requested bit mask of attributes for the allocated range. + + @retval EFI_SUCCESS The requested memory pages were allocated. + @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are + MEMORY_WRITE_COMBINE and MEMORY_CACHED. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_ALLOCATE_BUFFER)( + IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, + IN EFI_ALLOCATE_TYPE Type, + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages, + OUT VOID **HostAddress, + IN UINT64 Attributes + ); + +/** + Frees memory that was allocated with AllocateBuffer(). + + @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance. + @param Pages The number of pages to free. + @param HostAddress The base system memory address of the allocated range. + + @retval EFI_SUCCESS The requested memory pages were freed. + @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages + was not allocated with AllocateBuffer(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_FREE_BUFFER)( + IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, + IN UINTN Pages, + IN VOID *HostAddress + ); + +/** + Flushes all posted write transactions from the UFS bus to attached UFS device. + + @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance. + + @retval EFI_SUCCESS The posted write transactions were flushed from the UFS bus + to attached UFS device. + @retval EFI_DEVICE_ERROR The posted write transactions were not flushed from the UFS + bus to attached UFS device due to a hardware error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_FLUSH)( + IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This + ); + +typedef enum { + EfiUfsHcWidthUint8 = 0, + EfiUfsHcWidthUint16, + EfiUfsHcWidthUint32, + EfiUfsHcWidthUint64, + EfiUfsHcWidthMaximum +} EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH; + +/** + Enable a UFS bus driver to access UFS MMIO registers in the UFS Host Controller memory space. + + @param This A pointer to the EDKII_UFS_HOST_CONTROLLER_PROTOCOL instance. + @param Width Signifies the width of the memory operations. + @param Offset The offset within the UFS Host Controller MMIO space to start the + memory operation. + @param Count The number of memory operations to perform. + @param Buffer For read operations, the destination buffer to store the results. + For write operations, the source buffer to write data from. + + @retval EFI_SUCCESS The data was read from or written to the UFS host controller. + @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not + valid for the UFS Host Controller memory space. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_MMIO_READ_WRITE)( + IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, + IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH Width, + IN UINT64 Offset, + IN UINTN Count, + IN OUT VOID *Buffer + ); + +/// +/// UFS Host Controller Protocol structure. +/// +struct _EDKII_UFS_HOST_CONTROLLER_PROTOCOL { + EDKII_UFS_HC_GET_MMIO_BAR GetUfsHcMmioBar; + EDKII_UFS_HC_ALLOCATE_BUFFER AllocateBuffer; + EDKII_UFS_HC_FREE_BUFFER FreeBuffer; + EDKII_UFS_HC_MAP Map; + EDKII_UFS_HC_UNMAP Unmap; + EDKII_UFS_HC_FLUSH Flush; + EDKII_UFS_HC_MMIO_READ_WRITE Read; + EDKII_UFS_HC_MMIO_READ_WRITE Write; +}; + +/// +/// UFS Host Controller Protocol GUID variable. +/// +extern EFI_GUID gEdkiiUfsHostControllerProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h b/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h index 32e9f6488c..6220435509 100644 --- a/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h +++ b/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h @@ -1,134 +1,134 @@ -/** @file
- EDKII_UFS_HC_PLATFORM_PROTOCOL definition.
-
-Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __EDKII_UFS_HC_PLATFORM_PROTOCOL_H__
-#define __EDKII_UFS_HC_PLATFORM_PROTOCOL_H__
-
-#include <Protocol/UfsHostController.h>
-
-#define EDKII_UFS_HC_PLATFORM_PROTOCOL_VERSION 2
-
-extern EFI_GUID gEdkiiUfsHcPlatformProtocolGuid;
-
-typedef struct _EDKII_UFS_HC_PLATFORM_PROTOCOL EDKII_UFS_HC_PLATFORM_PROTOCOL;
-
-typedef struct _EDKII_UFS_HC_DRIVER_INTERFACE EDKII_UFS_HC_DRIVER_INTERFACE;
-
-typedef struct {
- UINT32 Opcode;
- UINT32 Arg1;
- UINT32 Arg2;
- UINT32 Arg3;
-} EDKII_UIC_COMMAND;
-
-/**
- Execute UIC command
-
- @param[in] This Pointer to driver interface produced by the UFS controller.
- @param[in, out] UicCommand Descriptor of the command that will be executed.
-
- @retval EFI_SUCCESS Command executed successfully.
- @retval EFI_INVALID_PARAMETER This or UicCommand is NULL.
- @retval Others Command failed to execute.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_EXEC_UIC_COMMAND)(
- IN EDKII_UFS_HC_DRIVER_INTERFACE *This,
- IN OUT EDKII_UIC_COMMAND *UicCommand
- );
-
-struct _EDKII_UFS_HC_DRIVER_INTERFACE {
- ///
- /// Protocol to accesss host controller MMIO and PCI registers.
- ///
- EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHcProtocol;
- ///
- /// Function implementing UIC command execution.
- ///
- EDKII_UFS_EXEC_UIC_COMMAND UfsExecUicCommand;
-};
-
-typedef struct {
- UINT32 Capabilities;
- UINT32 Version;
-} EDKII_UFS_HC_INFO;
-
-/**
- Allows platform protocol to override host controller information
-
- @param[in] ControllerHandle Handle of the UFS controller.
- @param[in, out] HcInfo Pointer EDKII_UFS_HC_INFO associated with host controller.
-
- @retval EFI_SUCCESS Function completed successfully.
- @retval EFI_INVALID_PARAMETER HcInfo is NULL.
- @retval Others Function failed to complete.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_PLATFORM_OVERRIDE_HC_INFO)(
- IN EFI_HANDLE ControllerHandle,
- IN OUT EDKII_UFS_HC_INFO *HcInfo
- );
-
-typedef enum {
- EdkiiUfsHcPreHce,
- EdkiiUfsHcPostHce,
- EdkiiUfsHcPreLinkStartup,
- EdkiiUfsHcPostLinkStartup
-} EDKII_UFS_HC_PLATFORM_CALLBACK_PHASE;
-
-typedef enum {
- EdkiiUfsCardRefClkFreq19p2Mhz,
- EdkiiUfsCardRefClkFreq26Mhz,
- EdkiiUfsCardRefClkFreq38p4Mhz,
- EdkiiUfsCardRefClkFreqObsolete
-} EDKII_UFS_CARD_REF_CLK_FREQ_ATTRIBUTE;
-
-/**
- Callback function for platform driver.
-
- @param[in] ControllerHandle Handle of the UFS controller.
- @param[in] CallbackPhase Specifies when the platform protocol is called
- @param[in, out] CallbackData Data specific to the callback phase.
- For PreHce and PostHce - EDKII_UFS_HC_DRIVER_INTERFACE.
- For PreLinkStartup and PostLinkStartup - EDKII_UFS_HC_DRIVER_INTERFACE.
-
- @retval EFI_SUCCESS Override function completed successfully.
- @retval EFI_INVALID_PARAMETER CallbackPhase is invalid or CallbackData is NULL when phase expects valid data.
- @retval Others Function failed to complete.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_UFS_HC_PLATFORM_CALLBACK)(
- IN EFI_HANDLE ControllerHandle,
- IN EDKII_UFS_HC_PLATFORM_CALLBACK_PHASE CallbackPhase,
- IN OUT VOID *CallbackData
- );
-
-struct _EDKII_UFS_HC_PLATFORM_PROTOCOL {
- ///
- /// Version of the protocol.
- ///
- UINT32 Version;
- ///
- /// Allows platform driver to override host controller information.
- ///
- EDKII_UFS_HC_PLATFORM_OVERRIDE_HC_INFO OverrideHcInfo;
- ///
- /// Allows platform driver to implement platform specific flows
- /// for host controller.
- ///
- EDKII_UFS_HC_PLATFORM_CALLBACK Callback;
- ///
- /// Reference Clock Frequency Ufs Card Attribute that need to be set in this Ufs Host Environment.
- ///
- EDKII_UFS_CARD_REF_CLK_FREQ_ATTRIBUTE RefClkFreq;
-};
-
-#endif
+/** @file + EDKII_UFS_HC_PLATFORM_PROTOCOL definition. + +Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EDKII_UFS_HC_PLATFORM_PROTOCOL_H__ +#define __EDKII_UFS_HC_PLATFORM_PROTOCOL_H__ + +#include <Protocol/UfsHostController.h> + +#define EDKII_UFS_HC_PLATFORM_PROTOCOL_VERSION 2 + +extern EFI_GUID gEdkiiUfsHcPlatformProtocolGuid; + +typedef struct _EDKII_UFS_HC_PLATFORM_PROTOCOL EDKII_UFS_HC_PLATFORM_PROTOCOL; + +typedef struct _EDKII_UFS_HC_DRIVER_INTERFACE EDKII_UFS_HC_DRIVER_INTERFACE; + +typedef struct { + UINT32 Opcode; + UINT32 Arg1; + UINT32 Arg2; + UINT32 Arg3; +} EDKII_UIC_COMMAND; + +/** + Execute UIC command + + @param[in] This Pointer to driver interface produced by the UFS controller. + @param[in, out] UicCommand Descriptor of the command that will be executed. + + @retval EFI_SUCCESS Command executed successfully. + @retval EFI_INVALID_PARAMETER This or UicCommand is NULL. + @retval Others Command failed to execute. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_EXEC_UIC_COMMAND)( + IN EDKII_UFS_HC_DRIVER_INTERFACE *This, + IN OUT EDKII_UIC_COMMAND *UicCommand + ); + +struct _EDKII_UFS_HC_DRIVER_INTERFACE { + /// + /// Protocol to accesss host controller MMIO and PCI registers. + /// + EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHcProtocol; + /// + /// Function implementing UIC command execution. + /// + EDKII_UFS_EXEC_UIC_COMMAND UfsExecUicCommand; +}; + +typedef struct { + UINT32 Capabilities; + UINT32 Version; +} EDKII_UFS_HC_INFO; + +/** + Allows platform protocol to override host controller information + + @param[in] ControllerHandle Handle of the UFS controller. + @param[in, out] HcInfo Pointer EDKII_UFS_HC_INFO associated with host controller. + + @retval EFI_SUCCESS Function completed successfully. + @retval EFI_INVALID_PARAMETER HcInfo is NULL. + @retval Others Function failed to complete. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_PLATFORM_OVERRIDE_HC_INFO)( + IN EFI_HANDLE ControllerHandle, + IN OUT EDKII_UFS_HC_INFO *HcInfo + ); + +typedef enum { + EdkiiUfsHcPreHce, + EdkiiUfsHcPostHce, + EdkiiUfsHcPreLinkStartup, + EdkiiUfsHcPostLinkStartup +} EDKII_UFS_HC_PLATFORM_CALLBACK_PHASE; + +typedef enum { + EdkiiUfsCardRefClkFreq19p2Mhz, + EdkiiUfsCardRefClkFreq26Mhz, + EdkiiUfsCardRefClkFreq38p4Mhz, + EdkiiUfsCardRefClkFreqObsolete +} EDKII_UFS_CARD_REF_CLK_FREQ_ATTRIBUTE; + +/** + Callback function for platform driver. + + @param[in] ControllerHandle Handle of the UFS controller. + @param[in] CallbackPhase Specifies when the platform protocol is called + @param[in, out] CallbackData Data specific to the callback phase. + For PreHce and PostHce - EDKII_UFS_HC_DRIVER_INTERFACE. + For PreLinkStartup and PostLinkStartup - EDKII_UFS_HC_DRIVER_INTERFACE. + + @retval EFI_SUCCESS Override function completed successfully. + @retval EFI_INVALID_PARAMETER CallbackPhase is invalid or CallbackData is NULL when phase expects valid data. + @retval Others Function failed to complete. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_UFS_HC_PLATFORM_CALLBACK)( + IN EFI_HANDLE ControllerHandle, + IN EDKII_UFS_HC_PLATFORM_CALLBACK_PHASE CallbackPhase, + IN OUT VOID *CallbackData + ); + +struct _EDKII_UFS_HC_PLATFORM_PROTOCOL { + /// + /// Version of the protocol. + /// + UINT32 Version; + /// + /// Allows platform driver to override host controller information. + /// + EDKII_UFS_HC_PLATFORM_OVERRIDE_HC_INFO OverrideHcInfo; + /// + /// Allows platform driver to implement platform specific flows + /// for host controller. + /// + EDKII_UFS_HC_PLATFORM_CALLBACK Callback; + /// + /// Reference Clock Frequency Ufs Card Attribute that need to be set in this Ufs Host Environment. + /// + EDKII_UFS_CARD_REF_CLK_FREQ_ATTRIBUTE RefClkFreq; +}; + +#endif diff --git a/MdeModulePkg/Include/Protocol/UsbEthernetProtocol.h b/MdeModulePkg/Include/Protocol/UsbEthernetProtocol.h index 250de0b591..f07f50e3c4 100644 --- a/MdeModulePkg/Include/Protocol/UsbEthernetProtocol.h +++ b/MdeModulePkg/Include/Protocol/UsbEthernetProtocol.h @@ -1,884 +1,884 @@ -/** @file
- Header file contains code for USB Ethernet Protocol
- definitions
-
- Copyright (c) 2023, American Megatrends International LLC. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef USB_ETHERNET_PROTOCOL_H_
-#define USB_ETHERNET_PROTOCOL_H_
-
-#define EDKII_USB_ETHERNET_PROTOCOL_GUID \
- {0x8d8969cc, 0xfeb0, 0x4303, {0xb2, 0x1a, 0x1f, 0x11, 0x6f, 0x38, 0x56, 0x43}}
-
-typedef struct _EDKII_USB_ETHERNET_PROTOCOL EDKII_USB_ETHERNET_PROTOCOL;
-
-#define USB_CDC_CLASS 0x02
-#define USB_CDC_ACM_SUBCLASS 0x02
-#define USB_CDC_ECM_SUBCLASS 0x06
-#define USB_CDC_NCM_SUBCLASS 0x0D
-#define USB_CDC_DATA_CLASS 0x0A
-#define USB_CDC_DATA_SUBCLASS 0x00
-#define USB_NO_CLASS_PROTOCOL 0x00
-#define USB_NCM_NTB_PROTOCOL 0x01
-#define USB_VENDOR_PROTOCOL 0xFF
-
-#define USB_MISC_CLASS 0xEF
-#define USB_RNDIS_SUBCLASS 0x04
-#define USB_RNDIS_ETHERNET_PROTOCOL 0x01
-
-// Type Values for the DescriptorType Field
-#define CS_INTERFACE 0x24
-#define CS_ENDPOINT 0x25
-
-// Descriptor SubType in Functional Descriptors
-#define HEADER_FUN_DESCRIPTOR 0x00
-#define UNION_FUN_DESCRIPTOR 0x06
-#define ETHERNET_FUN_DESCRIPTOR 0x0F
-
-#define MAX_LAN_INTERFACE 0x10
-
-// Table 20: Class-Specific Notification Codes
-#define USB_CDC_NETWORK_CONNECTION 0x00
-
-// 6.3.1 NetworkConnection
-#define NETWORK_CONNECTED 0x01
-#define NETWORK_DISCONNECT 0x00
-
-#define MAC_FILTERS_MASK 0x7FFF
-
-// USB Header functional Descriptor
-typedef struct {
- UINT8 FunctionLength;
- UINT8 DescriptorType;
- UINT8 DescriptorSubtype;
- UINT16 BcdCdc;
-} USB_HEADER_FUN_DESCRIPTOR;
-
-// USB Union Functional Descriptor
-typedef struct {
- UINT8 FunctionLength;
- UINT8 DescriptorType;
- UINT8 DescriptorSubtype;
- UINT8 MasterInterface;
- UINT8 SlaveInterface;
-} USB_UNION_FUN_DESCRIPTOR;
-
-// USB Ethernet Functional Descriptor
-typedef struct {
- UINT8 FunctionLength;
- UINT8 DescriptorType;
- UINT8 DescriptorSubtype;
- UINT8 MacAddress;
- UINT32 EthernetStatistics;
- UINT16 MaxSegmentSize;
- UINT16 NumberMcFilters;
- UINT8 NumberPowerFilters;
-} USB_ETHERNET_FUN_DESCRIPTOR;
-
-typedef struct {
- UINT32 UsBitRate;
- UINT32 DsBitRate;
-} USB_CONNECT_SPEED_CHANGE;
-
-// Request Type Codes for USB Ethernet
-#define USB_ETHERNET_GET_REQ_TYPE 0xA1
-#define USB_ETHERNET_SET_REQ_TYPE 0x21
-
-// Class-Specific Request Codes for Ethernet subclass
-// USB ECM 1.2 specification, Section 6.2
-#define SET_ETH_MULTICAST_FILTERS_REQ 0x40
-#define SET_ETH_POWER_MANAGEMENT_PATTERN_FILTER_REQ 0x41
-#define GET_ETH_POWER_MANAGEMENT_PATTERN_FILTER_REQ 0x42
-#define SET_ETH_PACKET_FILTER_REQ 0x43
-#define GET_ETH_STATISTIC_REQ 0x44
-
-// USB ECM command request length
-#define USB_ETH_POWER_FILTER_LENGTH 2 // Section 6.2.3
-#define USB_ETH_PACKET_FILTER_LENGTH 0 // Section 6.2.4
-#define USB_ETH_STATISTIC 4 // Section 6.2.5
-
-// USB Ethernet Packet Filter Bitmap
-// USB ECM 1.2 specification, Section 6.2.4
-#define USB_ETH_PACKET_TYPE_PROMISCUOUS BIT0
-#define USB_ETH_PACKET_TYPE_ALL_MULTICAST BIT1
-#define USB_ETH_PACKET_TYPE_DIRECTED BIT2
-#define USB_ETH_PACKET_TYPE_BROADCAST BIT3
-#define USB_ETH_PACKET_TYPE_MULTICAST BIT4
-
-// USB Ethernet Statistics Feature Selector Codes
-// USB ECM 1.2 specification, Section 6.2.5
-#define USB_ETH_XMIT_OK 0x01
-#define USB_ETH_RCV_OK 0x02
-#define USB_ETH_XMIT_ERROR 0x03
-#define USB_ETH_RCV_ERROR 0x04
-#define USB_ETH_RCV_NO_BUFFER 0x05
-#define USB_ETH_DIRECTED_BYTES_XMIT 0x06
-#define USB_ETH_DIRECTED_FRAMES_XMIT 0x07
-#define USB_ETH_MULTICAST_BYTES_XMIT 0x08
-#define USB_ETH_MULTICAST_FRAMES_XMIT 0x09
-#define USB_ETH_BROADCAST_BYTES_XMIT 0x0A
-#define USB_ETH_BROADCAST_FRAMES_XMIT 0x0B
-#define USB_ETH_DIRECTED_BYTES_RCV 0x0C
-#define USB_ETH_DIRECTED_FRAMES_RCV 0x0D
-#define USB_ETH_MULTICAST_BYTES_RCV 0x0E
-#define USB_ETH_MULTICAST_FRAMES_RCV 0x0F
-#define USB_ETH_BROADCAST_BYTES_RCV 0x10
-#define USB_ETH_BROADCAST_FRAMES_RCV 0x11
-#define USB_ETH_RCV_CRC_ERROR 0x12
-#define USB_ETH_TRANSMIT_QUEUE_LENGTH 0x13
-#define USB_ETH_RCV_ERROR_ALIGNMENT 0x14
-#define USB_ETH_XMIT_ONE_COLLISION 0x15
-#define USB_ETH_XMIT_MORE_COLLISIONS 0x16
-#define USB_ETH_XMIT_DEFERRED 0x17
-#define USB_ETH_XMIT_MAX_COLLISIONS 0x18
-#define USB_ETH_RCV_OVERRUN 0x19
-#define USB_ETH_XMIT_UNDERRUN 0x1A
-#define USB_ETH_XMIT_HEARTBEAT_FAILURE 0x1B
-#define USB_ETH_XMIT_TIMES_CRS_LOST 0x1C
-#define USB_ETH_XMIT_LATE_COLLISIONS 0x1D
-
-// NIC Information
-typedef struct {
- UINT32 Signature;
- EDKII_USB_ETHERNET_PROTOCOL *UsbEth;
- UINT16 InterrupOpFlag;
- UINT64 MappedAddr;
- PXE_MAC_ADDR McastList[MAX_MCAST_ADDRESS_CNT];
- UINT8 McastCount;
- UINT64 MediaHeader[MAX_XMIT_BUFFERS];
- UINT8 TxBufferCount;
- UINT16 State;
- BOOLEAN CanTransmit;
- UINT16 ReceiveStatus;
- UINT8 RxFilter;
- UINT32 RxFrame;
- UINT32 TxFrame;
- UINT16 NetworkConnect;
- UINT8 CableDetect;
- UINT16 MaxSegmentSize;
- EFI_MAC_ADDRESS MacAddr;
- PXE_CPB_START_31 PxeStart;
- PXE_CPB_INITIALIZE PxeInit;
- UINT8 PermNodeAddress[PXE_MAC_LENGTH];
- UINT8 CurrentNodeAddress[PXE_MAC_LENGTH];
- UINT8 BroadcastNodeAddress[PXE_MAC_LENGTH];
- EFI_USB_DEVICE_REQUEST Request;
- EFI_EVENT RateLimiter;
- UINT32 RateLimitingCredit;
- UINT32 RateLimitingCreditCount;
- UINT32 RateLimitingPollTimer;
- BOOLEAN RateLimitingEnable;
-} NIC_DATA;
-
-#define NIC_DATA_SIGNATURE SIGNATURE_32('n', 'i', 'c', 'd')
-#define NIC_DATA_FROM_EDKII_USB_ETHERNET_PROTOCOL(a) CR (a, NIC_DATA, UsbEth, NIC_DATA_SIGNATURE)
-
-/**
- This command is used to determine the operational state of the UNDI.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_GET_STATE)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command is used to change the UNDI operational state from stopped to started.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_START)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command is used to change the UNDI operational state from started to stopped.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_STOP)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command is used to retrieve initialization information that is
- needed by drivers and applications to initialized UNDI.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_GET_INIT_INFO)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command is used to retrieve configuration information about
- the NIC being controlled by the UNDI.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_GET_CONFIG_INFO)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command resets the network adapter and initializes UNDI using
- the parameters supplied in the CPB.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_INITIALIZE)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command resets the network adapter and reinitializes the UNDI
- with the same parameters provided in the Initialize command.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_RESET)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- The Shutdown command resets the network adapter and leaves it in a
- safe state for another driver to initialize.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_SHUTDOWN)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- The Interrupt Enables command can be used to read and/or change
- the current external interrupt enable settings.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_INTERRUPT_ENABLE)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command is used to read and change receive filters and,
- if supported, read and change the multicast MAC address filter list.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_RECEIVE_FILTER)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command is used to get current station and broadcast MAC addresses
- and, if supported, to change the current station MAC address.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_STATION_ADDRESS)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command is used to read and clear the NIC traffic statistics.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_STATISTICS)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- Translate a multicast IPv4 or IPv6 address to a multicast MAC address.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_MCAST_IPTOMAC)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command is used to read and write (if supported by NIC H/W)
- nonvolatile storage on the NIC.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_NV_DATA)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command returns the current interrupt status and/or the
- transmitted buffer addresses and the current media status.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_GET_STATUS)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command is used to fill the media header(s) in transmit packet(s).
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_FILL_HEADER)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- The Transmit command is used to place a packet into the transmit queue.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_TRANSMIT)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- When the network adapter has received a frame, this command is used
- to copy the frame into driver/application storage.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_UNDI_RECEIVE)(
- IN PXE_CDB *Cdb,
- IN NIC_DATA *Nic
- );
-
-/**
- This command resets the network adapter and initializes UNDI using
- the parameters supplied in the CPB.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in, out] Nic A pointer to the Network interface controller data.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_INITIALIZE)(
- IN PXE_CDB *Cdb,
- IN OUT NIC_DATA *Nic
- );
-
-/**
- This command is used to read and clear the NIC traffic statistics.
-
- @param[in] Nic A pointer to the Network interface controller data.
- @param[in] DbAddr Data Block Address.
- @param[in] DbSize Data Block Size.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_STATISTICS)(
- IN NIC_DATA *Nic,
- IN UINT64 DbAddr,
- IN UINT16 DbSize
- );
-
-/**
- This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk in.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[in, out] Packet A pointer to the buffer of data that will be transmitted to USB
- device or received from USB device.
- @param[in, out] PacketLength A pointer to the PacketLength.
-
- @retval EFI_SUCCESS The bulk transfer has been successfully executed.
- @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in status.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.
- @retval EFI_TIMEOUT The control transfer fails due to timeout.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_RECEIVE)(
- IN PXE_CDB *Cdb,
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- IN OUT VOID *Packet,
- IN OUT UINTN *PacketLength
- );
-
-/**
- This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk out.
-
- @param[in] Cdb A pointer to the command descriptor block.
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[in, out] Packet A pointer to the buffer of data that will be transmitted to USB
- device or received from USB device.
- @param[in, out] PacketLength A pointer to the PacketLength.
-
- @retval EFI_SUCCESS The bulk transfer has been successfully executed.
- @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in status.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.
- @retval EFI_TIMEOUT The control transfer fails due to timeout.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_TRANSMIT)(
- IN PXE_CDB *Cdb,
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- IN OUT VOID *Packet,
- IN OUT UINTN *PacketLength
- );
-
-/**
- This function is used to manage a USB device with an interrupt transfer pipe.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[in] IsNewTransfer If TRUE, a new transfer will be submitted to USB controller. If
- FALSE, the interrupt transfer is deleted from the device's interrupt
- transfer queue.
- @param[in] PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be
- executed.This parameter is required when IsNewTransfer is TRUE. The
- value must be between 1 to 255, otherwise EFI_INVALID_PARAMETER is returned.
- The units are in milliseconds.
- @param[in] Request A pointer to the EFI_USB_DEVICE_REQUEST data.
-
- @retval EFI_SUCCESS The asynchronous USB transfer request transfer has been successfully executed.
- @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_INTERRUPT)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- IN BOOLEAN IsNewTransfer,
- IN UINTN PollingInterval,
- IN EFI_USB_DEVICE_REQUEST *Request
- );
-
-/**
- Retrieves the USB Ethernet Mac Address.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[out] MacAddress A pointer to the caller allocated USB Ethernet Mac Address.
-
- @retval EFI_SUCCESS The USB Header Functional descriptor was retrieved successfully.
- @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.
- @retval EFI_NOT_FOUND The USB Header Functional descriptor was not found.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_GET_ETH_MAC_ADDRESS)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- OUT EFI_MAC_ADDRESS *MacAddress
- );
-
-/**
- Retrieves the USB Ethernet Bulk transfer data size.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[out] BulkSize A pointer to the Bulk transfer data size.
-
- @retval EFI_SUCCESS The USB Header Functional descriptor was retrieved successfully.
- @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.
- @retval EFI_NOT_FOUND The USB Header Functional descriptor was not found.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETH_MAX_BULK_SIZE)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- OUT UINTN *BulkSize
- );
-
-/**
- Retrieves the USB Header functional Descriptor.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[out] UsbHeaderFunDescriptor A pointer to the caller allocated USB Header Functional Descriptor.
-
- @retval EFI_SUCCESS The USB Header Functional descriptor was retrieved successfully.
- @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.
- @retval EFI_NOT_FOUND The USB Header Functional descriptor was not found.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_HEADER_FUNCTIONAL_DESCRIPTOR)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- OUT USB_HEADER_FUN_DESCRIPTOR *UsbHeaderFunDescriptor
- );
-
-/**
- Retrieves the USB Union functional Descriptor.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[out] UsbUnionFunDescriptor A pointer to the caller allocated USB Union Functional Descriptor.
-
- @retval EFI_SUCCESS The USB Union Functional descriptor was retrieved successfully.
- @retval EFI_INVALID_PARAMETER UsbUnionFunDescriptor is NULL.
- @retval EFI_NOT_FOUND The USB Union Functional descriptor was not found.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_UNION_FUNCTIONAL_DESCRIPTOR)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- OUT USB_UNION_FUN_DESCRIPTOR *UsbUnionFunDescriptor
- );
-
-/**
- Retrieves the USB Ethernet functional Descriptor.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[out] UsbEthFunDescriptor A pointer to the caller allocated USB Ethernet Functional Descriptor.
-
- @retval EFI_SUCCESS The USB Ethernet Functional descriptor was retrieved successfully.
- @retval EFI_INVALID_PARAMETER UsbEthFunDescriptor is NULL.
- @retval EFI_NOT_FOUND The USB Ethernet Functional descriptor was not found.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_FUNCTIONAL_DESCRIPTOR)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- OUT USB_ETHERNET_FUN_DESCRIPTOR *UsbEthFunDescriptor
- );
-
-/**
- This request sets the Ethernet device multicast filters as specified in the
- sequential list of 48 bit Ethernet multicast addresses.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[in] Value Number of filters.
- @param[in] McastAddr A pointer to the value of the multicast addresses.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_SET_ETH_MULTICAST_FILTERS)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- IN UINT16 Value,
- IN VOID *McastAddr
- );
-
-/**
- This request sets up the specified Ethernet power management pattern filter as
- described in the data structure.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[in] Value Number of filters.
- @param[in] Length Size of the power management pattern filter data.
- @param[in] PatternFilter A pointer to the power management pattern filter structure.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_SET_ETH_POWER_MANAGE_PATTERN_FILTER)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- IN UINT16 Value,
- IN UINT16 Length,
- IN VOID *PatternFilter
- );
-
-/**
- This request retrieves the status of the specified Ethernet power management
- pattern filter from the device.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[in] Value The filter number.
- @param[out] PatternActive A pointer to the pattern active boolean.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_GET_ETH_POWER_MANAGE_PATTERN_FILTER)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- IN UINT16 Value,
- OUT BOOLEAN *PatternActive
- );
-
-/**
- This request is used to configure device Ethernet packet filter settings.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[in] Value Packet Filter Bitmap.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_SET_ETH_PACKET_FILTER)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- IN UINT16 Value
- );
-
-/**
- This request is used to retrieve a statistic based on the feature selector.
-
- @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance.
- @param[in] FeatureSelector Value of the feature selector.
- @param[out] Statistic A pointer to the 32 bit unsigned integer.
-
- @retval EFI_SUCCESS The request executed successfully.
- @retval EFI_TIMEOUT A timeout occurred executing the request.
- @retval EFI_DEVICE_ERROR The request failed due to a device error.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Not supported.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_USB_ETHERNET_GET_ETH_STATISTIC)(
- IN EDKII_USB_ETHERNET_PROTOCOL *This,
- IN UINT16 FeatureSelector,
- OUT VOID *Statistic
- );
-
-typedef struct {
- EDKII_USB_ETHERNET_UNDI_GET_STATE UsbEthUndiGetState;
- EDKII_USB_ETHERNET_UNDI_START UsbEthUndiStart;
- EDKII_USB_ETHERNET_UNDI_STOP UsbEthUndiStop;
- EDKII_USB_ETHERNET_UNDI_GET_INIT_INFO UsbEthUndiGetInitInfo;
- EDKII_USB_ETHERNET_UNDI_GET_CONFIG_INFO UsbEthUndiGetConfigInfo;
- EDKII_USB_ETHERNET_UNDI_INITIALIZE UsbEthUndiInitialize;
- EDKII_USB_ETHERNET_UNDI_RESET UsbEthUndiReset;
- EDKII_USB_ETHERNET_UNDI_SHUTDOWN UsbEthUndiShutdown;
- EDKII_USB_ETHERNET_UNDI_INTERRUPT_ENABLE UsbEthUndiInterruptEnable;
- EDKII_USB_ETHERNET_UNDI_RECEIVE_FILTER UsbEthUndiReceiveFilter;
- EDKII_USB_ETHERNET_UNDI_STATION_ADDRESS UsbEthUndiStationAddress;
- EDKII_USB_ETHERNET_UNDI_STATISTICS UsbEthUndiStatistics;
- EDKII_USB_ETHERNET_UNDI_MCAST_IPTOMAC UsbEthUndiMcastIp2Mac;
- EDKII_USB_ETHERNET_UNDI_NV_DATA UsbEthUndiNvData;
- EDKII_USB_ETHERNET_UNDI_GET_STATUS UsbEthUndiGetStatus;
- EDKII_USB_ETHERNET_UNDI_FILL_HEADER UsbEthUndiFillHeader;
- EDKII_USB_ETHERNET_UNDI_TRANSMIT UsbEthUndiTransmit;
- EDKII_USB_ETHERNET_UNDI_RECEIVE UsbEthUndiReceive;
-} EDKII_USB_ETHERNET_UNDI;
-
-// The EDKII_USB_ETHERNET_PROTOCOL provides some basic USB Ethernet device relevant
-// descriptor and specific requests.
-struct _EDKII_USB_ETHERNET_PROTOCOL {
- EDKII_USB_ETHERNET_UNDI UsbEthUndi;
- // for calling the UNDI child functions
- EDKII_USB_ETHERNET_INITIALIZE UsbEthInitialize;
- EDKII_USB_ETHERNET_STATISTICS UsbEthStatistics;
- EDKII_USB_ETHERNET_RECEIVE UsbEthReceive;
- EDKII_USB_ETHERNET_TRANSMIT UsbEthTransmit;
- EDKII_USB_ETHERNET_INTERRUPT UsbEthInterrupt;
- EDKII_USB_GET_ETH_MAC_ADDRESS UsbEthMacAddress;
- EDKII_USB_ETH_MAX_BULK_SIZE UsbEthMaxBulkSize;
- EDKII_USB_HEADER_FUNCTIONAL_DESCRIPTOR UsbHeaderFunDescriptor;
- EDKII_USB_UNION_FUNCTIONAL_DESCRIPTOR UsbUnionFunDescriptor;
- EDKII_USB_ETHERNET_FUNCTIONAL_DESCRIPTOR UsbEthFunDescriptor;
- EDKII_USB_ETHERNET_SET_ETH_MULTICAST_FILTERS SetUsbEthMcastFilter;
- EDKII_USB_ETHERNET_SET_ETH_POWER_MANAGE_PATTERN_FILTER SetUsbEthPowerPatternFilter;
- EDKII_USB_ETHERNET_GET_ETH_POWER_MANAGE_PATTERN_FILTER GetUsbEthPowerPatternFilter;
- EDKII_USB_ETHERNET_SET_ETH_PACKET_FILTER SetUsbEthPacketFilter;
- EDKII_USB_ETHERNET_GET_ETH_STATISTIC GetUsbEthStatistic;
-};
-
-extern EFI_GUID gEdkIIUsbEthProtocolGuid;
-
-#endif
+/** @file + Header file contains code for USB Ethernet Protocol + definitions + + Copyright (c) 2023, American Megatrends International LLC. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef USB_ETHERNET_PROTOCOL_H_ +#define USB_ETHERNET_PROTOCOL_H_ + +#define EDKII_USB_ETHERNET_PROTOCOL_GUID \ + {0x8d8969cc, 0xfeb0, 0x4303, {0xb2, 0x1a, 0x1f, 0x11, 0x6f, 0x38, 0x56, 0x43}} + +typedef struct _EDKII_USB_ETHERNET_PROTOCOL EDKII_USB_ETHERNET_PROTOCOL; + +#define USB_CDC_CLASS 0x02 +#define USB_CDC_ACM_SUBCLASS 0x02 +#define USB_CDC_ECM_SUBCLASS 0x06 +#define USB_CDC_NCM_SUBCLASS 0x0D +#define USB_CDC_DATA_CLASS 0x0A +#define USB_CDC_DATA_SUBCLASS 0x00 +#define USB_NO_CLASS_PROTOCOL 0x00 +#define USB_NCM_NTB_PROTOCOL 0x01 +#define USB_VENDOR_PROTOCOL 0xFF + +#define USB_MISC_CLASS 0xEF +#define USB_RNDIS_SUBCLASS 0x04 +#define USB_RNDIS_ETHERNET_PROTOCOL 0x01 + +// Type Values for the DescriptorType Field +#define CS_INTERFACE 0x24 +#define CS_ENDPOINT 0x25 + +// Descriptor SubType in Functional Descriptors +#define HEADER_FUN_DESCRIPTOR 0x00 +#define UNION_FUN_DESCRIPTOR 0x06 +#define ETHERNET_FUN_DESCRIPTOR 0x0F + +#define MAX_LAN_INTERFACE 0x10 + +// Table 20: Class-Specific Notification Codes +#define USB_CDC_NETWORK_CONNECTION 0x00 + +// 6.3.1 NetworkConnection +#define NETWORK_CONNECTED 0x01 +#define NETWORK_DISCONNECT 0x00 + +#define MAC_FILTERS_MASK 0x7FFF + +// USB Header functional Descriptor +typedef struct { + UINT8 FunctionLength; + UINT8 DescriptorType; + UINT8 DescriptorSubtype; + UINT16 BcdCdc; +} USB_HEADER_FUN_DESCRIPTOR; + +// USB Union Functional Descriptor +typedef struct { + UINT8 FunctionLength; + UINT8 DescriptorType; + UINT8 DescriptorSubtype; + UINT8 MasterInterface; + UINT8 SlaveInterface; +} USB_UNION_FUN_DESCRIPTOR; + +// USB Ethernet Functional Descriptor +typedef struct { + UINT8 FunctionLength; + UINT8 DescriptorType; + UINT8 DescriptorSubtype; + UINT8 MacAddress; + UINT32 EthernetStatistics; + UINT16 MaxSegmentSize; + UINT16 NumberMcFilters; + UINT8 NumberPowerFilters; +} USB_ETHERNET_FUN_DESCRIPTOR; + +typedef struct { + UINT32 UsBitRate; + UINT32 DsBitRate; +} USB_CONNECT_SPEED_CHANGE; + +// Request Type Codes for USB Ethernet +#define USB_ETHERNET_GET_REQ_TYPE 0xA1 +#define USB_ETHERNET_SET_REQ_TYPE 0x21 + +// Class-Specific Request Codes for Ethernet subclass +// USB ECM 1.2 specification, Section 6.2 +#define SET_ETH_MULTICAST_FILTERS_REQ 0x40 +#define SET_ETH_POWER_MANAGEMENT_PATTERN_FILTER_REQ 0x41 +#define GET_ETH_POWER_MANAGEMENT_PATTERN_FILTER_REQ 0x42 +#define SET_ETH_PACKET_FILTER_REQ 0x43 +#define GET_ETH_STATISTIC_REQ 0x44 + +// USB ECM command request length +#define USB_ETH_POWER_FILTER_LENGTH 2 // Section 6.2.3 +#define USB_ETH_PACKET_FILTER_LENGTH 0 // Section 6.2.4 +#define USB_ETH_STATISTIC 4 // Section 6.2.5 + +// USB Ethernet Packet Filter Bitmap +// USB ECM 1.2 specification, Section 6.2.4 +#define USB_ETH_PACKET_TYPE_PROMISCUOUS BIT0 +#define USB_ETH_PACKET_TYPE_ALL_MULTICAST BIT1 +#define USB_ETH_PACKET_TYPE_DIRECTED BIT2 +#define USB_ETH_PACKET_TYPE_BROADCAST BIT3 +#define USB_ETH_PACKET_TYPE_MULTICAST BIT4 + +// USB Ethernet Statistics Feature Selector Codes +// USB ECM 1.2 specification, Section 6.2.5 +#define USB_ETH_XMIT_OK 0x01 +#define USB_ETH_RCV_OK 0x02 +#define USB_ETH_XMIT_ERROR 0x03 +#define USB_ETH_RCV_ERROR 0x04 +#define USB_ETH_RCV_NO_BUFFER 0x05 +#define USB_ETH_DIRECTED_BYTES_XMIT 0x06 +#define USB_ETH_DIRECTED_FRAMES_XMIT 0x07 +#define USB_ETH_MULTICAST_BYTES_XMIT 0x08 +#define USB_ETH_MULTICAST_FRAMES_XMIT 0x09 +#define USB_ETH_BROADCAST_BYTES_XMIT 0x0A +#define USB_ETH_BROADCAST_FRAMES_XMIT 0x0B +#define USB_ETH_DIRECTED_BYTES_RCV 0x0C +#define USB_ETH_DIRECTED_FRAMES_RCV 0x0D +#define USB_ETH_MULTICAST_BYTES_RCV 0x0E +#define USB_ETH_MULTICAST_FRAMES_RCV 0x0F +#define USB_ETH_BROADCAST_BYTES_RCV 0x10 +#define USB_ETH_BROADCAST_FRAMES_RCV 0x11 +#define USB_ETH_RCV_CRC_ERROR 0x12 +#define USB_ETH_TRANSMIT_QUEUE_LENGTH 0x13 +#define USB_ETH_RCV_ERROR_ALIGNMENT 0x14 +#define USB_ETH_XMIT_ONE_COLLISION 0x15 +#define USB_ETH_XMIT_MORE_COLLISIONS 0x16 +#define USB_ETH_XMIT_DEFERRED 0x17 +#define USB_ETH_XMIT_MAX_COLLISIONS 0x18 +#define USB_ETH_RCV_OVERRUN 0x19 +#define USB_ETH_XMIT_UNDERRUN 0x1A +#define USB_ETH_XMIT_HEARTBEAT_FAILURE 0x1B +#define USB_ETH_XMIT_TIMES_CRS_LOST 0x1C +#define USB_ETH_XMIT_LATE_COLLISIONS 0x1D + +// NIC Information +typedef struct { + UINT32 Signature; + EDKII_USB_ETHERNET_PROTOCOL *UsbEth; + UINT16 InterrupOpFlag; + UINT64 MappedAddr; + PXE_MAC_ADDR McastList[MAX_MCAST_ADDRESS_CNT]; + UINT8 McastCount; + UINT64 MediaHeader[MAX_XMIT_BUFFERS]; + UINT8 TxBufferCount; + UINT16 State; + BOOLEAN CanTransmit; + UINT16 ReceiveStatus; + UINT8 RxFilter; + UINT32 RxFrame; + UINT32 TxFrame; + UINT16 NetworkConnect; + UINT8 CableDetect; + UINT16 MaxSegmentSize; + EFI_MAC_ADDRESS MacAddr; + PXE_CPB_START_31 PxeStart; + PXE_CPB_INITIALIZE PxeInit; + UINT8 PermNodeAddress[PXE_MAC_LENGTH]; + UINT8 CurrentNodeAddress[PXE_MAC_LENGTH]; + UINT8 BroadcastNodeAddress[PXE_MAC_LENGTH]; + EFI_USB_DEVICE_REQUEST Request; + EFI_EVENT RateLimiter; + UINT32 RateLimitingCredit; + UINT32 RateLimitingCreditCount; + UINT32 RateLimitingPollTimer; + BOOLEAN RateLimitingEnable; +} NIC_DATA; + +#define NIC_DATA_SIGNATURE SIGNATURE_32('n', 'i', 'c', 'd') +#define NIC_DATA_FROM_EDKII_USB_ETHERNET_PROTOCOL(a) CR (a, NIC_DATA, UsbEth, NIC_DATA_SIGNATURE) + +/** + This command is used to determine the operational state of the UNDI. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_GET_STATE)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command is used to change the UNDI operational state from stopped to started. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_START)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command is used to change the UNDI operational state from started to stopped. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_STOP)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command is used to retrieve initialization information that is + needed by drivers and applications to initialized UNDI. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_GET_INIT_INFO)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command is used to retrieve configuration information about + the NIC being controlled by the UNDI. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_GET_CONFIG_INFO)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command resets the network adapter and initializes UNDI using + the parameters supplied in the CPB. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_INITIALIZE)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command resets the network adapter and reinitializes the UNDI + with the same parameters provided in the Initialize command. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_RESET)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + The Shutdown command resets the network adapter and leaves it in a + safe state for another driver to initialize. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_SHUTDOWN)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + The Interrupt Enables command can be used to read and/or change + the current external interrupt enable settings. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_INTERRUPT_ENABLE)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command is used to read and change receive filters and, + if supported, read and change the multicast MAC address filter list. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_RECEIVE_FILTER)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command is used to get current station and broadcast MAC addresses + and, if supported, to change the current station MAC address. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_STATION_ADDRESS)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command is used to read and clear the NIC traffic statistics. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_STATISTICS)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + Translate a multicast IPv4 or IPv6 address to a multicast MAC address. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_MCAST_IPTOMAC)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command is used to read and write (if supported by NIC H/W) + nonvolatile storage on the NIC. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_NV_DATA)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command returns the current interrupt status and/or the + transmitted buffer addresses and the current media status. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_GET_STATUS)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command is used to fill the media header(s) in transmit packet(s). + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_FILL_HEADER)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + The Transmit command is used to place a packet into the transmit queue. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_TRANSMIT)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + When the network adapter has received a frame, this command is used + to copy the frame into driver/application storage. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_UNDI_RECEIVE)( + IN PXE_CDB *Cdb, + IN NIC_DATA *Nic + ); + +/** + This command resets the network adapter and initializes UNDI using + the parameters supplied in the CPB. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in, out] Nic A pointer to the Network interface controller data. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_INITIALIZE)( + IN PXE_CDB *Cdb, + IN OUT NIC_DATA *Nic + ); + +/** + This command is used to read and clear the NIC traffic statistics. + + @param[in] Nic A pointer to the Network interface controller data. + @param[in] DbAddr Data Block Address. + @param[in] DbSize Data Block Size. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_STATISTICS)( + IN NIC_DATA *Nic, + IN UINT64 DbAddr, + IN UINT16 DbSize + ); + +/** + This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk in. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[in, out] Packet A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. + @param[in, out] PacketLength A pointer to the PacketLength. + + @retval EFI_SUCCESS The bulk transfer has been successfully executed. + @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in status. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources. + @retval EFI_TIMEOUT The control transfer fails due to timeout. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_RECEIVE)( + IN PXE_CDB *Cdb, + IN EDKII_USB_ETHERNET_PROTOCOL *This, + IN OUT VOID *Packet, + IN OUT UINTN *PacketLength + ); + +/** + This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk out. + + @param[in] Cdb A pointer to the command descriptor block. + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[in, out] Packet A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. + @param[in, out] PacketLength A pointer to the PacketLength. + + @retval EFI_SUCCESS The bulk transfer has been successfully executed. + @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in status. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources. + @retval EFI_TIMEOUT The control transfer fails due to timeout. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_TRANSMIT)( + IN PXE_CDB *Cdb, + IN EDKII_USB_ETHERNET_PROTOCOL *This, + IN OUT VOID *Packet, + IN OUT UINTN *PacketLength + ); + +/** + This function is used to manage a USB device with an interrupt transfer pipe. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[in] IsNewTransfer If TRUE, a new transfer will be submitted to USB controller. If + FALSE, the interrupt transfer is deleted from the device's interrupt + transfer queue. + @param[in] PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be + executed.This parameter is required when IsNewTransfer is TRUE. The + value must be between 1 to 255, otherwise EFI_INVALID_PARAMETER is returned. + The units are in milliseconds. + @param[in] Request A pointer to the EFI_USB_DEVICE_REQUEST data. + + @retval EFI_SUCCESS The asynchronous USB transfer request transfer has been successfully executed. + @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_INTERRUPT)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + IN BOOLEAN IsNewTransfer, + IN UINTN PollingInterval, + IN EFI_USB_DEVICE_REQUEST *Request + ); + +/** + Retrieves the USB Ethernet Mac Address. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[out] MacAddress A pointer to the caller allocated USB Ethernet Mac Address. + + @retval EFI_SUCCESS The USB Header Functional descriptor was retrieved successfully. + @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL. + @retval EFI_NOT_FOUND The USB Header Functional descriptor was not found. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_GET_ETH_MAC_ADDRESS)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + OUT EFI_MAC_ADDRESS *MacAddress + ); + +/** + Retrieves the USB Ethernet Bulk transfer data size. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[out] BulkSize A pointer to the Bulk transfer data size. + + @retval EFI_SUCCESS The USB Header Functional descriptor was retrieved successfully. + @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL. + @retval EFI_NOT_FOUND The USB Header Functional descriptor was not found. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETH_MAX_BULK_SIZE)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + OUT UINTN *BulkSize + ); + +/** + Retrieves the USB Header functional Descriptor. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[out] UsbHeaderFunDescriptor A pointer to the caller allocated USB Header Functional Descriptor. + + @retval EFI_SUCCESS The USB Header Functional descriptor was retrieved successfully. + @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL. + @retval EFI_NOT_FOUND The USB Header Functional descriptor was not found. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_HEADER_FUNCTIONAL_DESCRIPTOR)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + OUT USB_HEADER_FUN_DESCRIPTOR *UsbHeaderFunDescriptor + ); + +/** + Retrieves the USB Union functional Descriptor. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[out] UsbUnionFunDescriptor A pointer to the caller allocated USB Union Functional Descriptor. + + @retval EFI_SUCCESS The USB Union Functional descriptor was retrieved successfully. + @retval EFI_INVALID_PARAMETER UsbUnionFunDescriptor is NULL. + @retval EFI_NOT_FOUND The USB Union Functional descriptor was not found. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_UNION_FUNCTIONAL_DESCRIPTOR)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + OUT USB_UNION_FUN_DESCRIPTOR *UsbUnionFunDescriptor + ); + +/** + Retrieves the USB Ethernet functional Descriptor. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[out] UsbEthFunDescriptor A pointer to the caller allocated USB Ethernet Functional Descriptor. + + @retval EFI_SUCCESS The USB Ethernet Functional descriptor was retrieved successfully. + @retval EFI_INVALID_PARAMETER UsbEthFunDescriptor is NULL. + @retval EFI_NOT_FOUND The USB Ethernet Functional descriptor was not found. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_FUNCTIONAL_DESCRIPTOR)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + OUT USB_ETHERNET_FUN_DESCRIPTOR *UsbEthFunDescriptor + ); + +/** + This request sets the Ethernet device multicast filters as specified in the + sequential list of 48 bit Ethernet multicast addresses. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[in] Value Number of filters. + @param[in] McastAddr A pointer to the value of the multicast addresses. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_SET_ETH_MULTICAST_FILTERS)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + IN UINT16 Value, + IN VOID *McastAddr + ); + +/** + This request sets up the specified Ethernet power management pattern filter as + described in the data structure. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[in] Value Number of filters. + @param[in] Length Size of the power management pattern filter data. + @param[in] PatternFilter A pointer to the power management pattern filter structure. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_SET_ETH_POWER_MANAGE_PATTERN_FILTER)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + IN UINT16 Value, + IN UINT16 Length, + IN VOID *PatternFilter + ); + +/** + This request retrieves the status of the specified Ethernet power management + pattern filter from the device. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[in] Value The filter number. + @param[out] PatternActive A pointer to the pattern active boolean. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_GET_ETH_POWER_MANAGE_PATTERN_FILTER)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + IN UINT16 Value, + OUT BOOLEAN *PatternActive + ); + +/** + This request is used to configure device Ethernet packet filter settings. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[in] Value Packet Filter Bitmap. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_SET_ETH_PACKET_FILTER)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + IN UINT16 Value + ); + +/** + This request is used to retrieve a statistic based on the feature selector. + + @param[in] This A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. + @param[in] FeatureSelector Value of the feature selector. + @param[out] Statistic A pointer to the 32 bit unsigned integer. + + @retval EFI_SUCCESS The request executed successfully. + @retval EFI_TIMEOUT A timeout occurred executing the request. + @retval EFI_DEVICE_ERROR The request failed due to a device error. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_UNSUPPORTED Not supported. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_USB_ETHERNET_GET_ETH_STATISTIC)( + IN EDKII_USB_ETHERNET_PROTOCOL *This, + IN UINT16 FeatureSelector, + OUT VOID *Statistic + ); + +typedef struct { + EDKII_USB_ETHERNET_UNDI_GET_STATE UsbEthUndiGetState; + EDKII_USB_ETHERNET_UNDI_START UsbEthUndiStart; + EDKII_USB_ETHERNET_UNDI_STOP UsbEthUndiStop; + EDKII_USB_ETHERNET_UNDI_GET_INIT_INFO UsbEthUndiGetInitInfo; + EDKII_USB_ETHERNET_UNDI_GET_CONFIG_INFO UsbEthUndiGetConfigInfo; + EDKII_USB_ETHERNET_UNDI_INITIALIZE UsbEthUndiInitialize; + EDKII_USB_ETHERNET_UNDI_RESET UsbEthUndiReset; + EDKII_USB_ETHERNET_UNDI_SHUTDOWN UsbEthUndiShutdown; + EDKII_USB_ETHERNET_UNDI_INTERRUPT_ENABLE UsbEthUndiInterruptEnable; + EDKII_USB_ETHERNET_UNDI_RECEIVE_FILTER UsbEthUndiReceiveFilter; + EDKII_USB_ETHERNET_UNDI_STATION_ADDRESS UsbEthUndiStationAddress; + EDKII_USB_ETHERNET_UNDI_STATISTICS UsbEthUndiStatistics; + EDKII_USB_ETHERNET_UNDI_MCAST_IPTOMAC UsbEthUndiMcastIp2Mac; + EDKII_USB_ETHERNET_UNDI_NV_DATA UsbEthUndiNvData; + EDKII_USB_ETHERNET_UNDI_GET_STATUS UsbEthUndiGetStatus; + EDKII_USB_ETHERNET_UNDI_FILL_HEADER UsbEthUndiFillHeader; + EDKII_USB_ETHERNET_UNDI_TRANSMIT UsbEthUndiTransmit; + EDKII_USB_ETHERNET_UNDI_RECEIVE UsbEthUndiReceive; +} EDKII_USB_ETHERNET_UNDI; + +// The EDKII_USB_ETHERNET_PROTOCOL provides some basic USB Ethernet device relevant +// descriptor and specific requests. +struct _EDKII_USB_ETHERNET_PROTOCOL { + EDKII_USB_ETHERNET_UNDI UsbEthUndi; + // for calling the UNDI child functions + EDKII_USB_ETHERNET_INITIALIZE UsbEthInitialize; + EDKII_USB_ETHERNET_STATISTICS UsbEthStatistics; + EDKII_USB_ETHERNET_RECEIVE UsbEthReceive; + EDKII_USB_ETHERNET_TRANSMIT UsbEthTransmit; + EDKII_USB_ETHERNET_INTERRUPT UsbEthInterrupt; + EDKII_USB_GET_ETH_MAC_ADDRESS UsbEthMacAddress; + EDKII_USB_ETH_MAX_BULK_SIZE UsbEthMaxBulkSize; + EDKII_USB_HEADER_FUNCTIONAL_DESCRIPTOR UsbHeaderFunDescriptor; + EDKII_USB_UNION_FUNCTIONAL_DESCRIPTOR UsbUnionFunDescriptor; + EDKII_USB_ETHERNET_FUNCTIONAL_DESCRIPTOR UsbEthFunDescriptor; + EDKII_USB_ETHERNET_SET_ETH_MULTICAST_FILTERS SetUsbEthMcastFilter; + EDKII_USB_ETHERNET_SET_ETH_POWER_MANAGE_PATTERN_FILTER SetUsbEthPowerPatternFilter; + EDKII_USB_ETHERNET_GET_ETH_POWER_MANAGE_PATTERN_FILTER GetUsbEthPowerPatternFilter; + EDKII_USB_ETHERNET_SET_ETH_PACKET_FILTER SetUsbEthPacketFilter; + EDKII_USB_ETHERNET_GET_ETH_STATISTIC GetUsbEthStatistic; +}; + +extern EFI_GUID gEdkIIUsbEthProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/VarCheck.h b/MdeModulePkg/Include/Protocol/VarCheck.h index bb3db5b2bc..5e027bb514 100644 --- a/MdeModulePkg/Include/Protocol/VarCheck.h +++ b/MdeModulePkg/Include/Protocol/VarCheck.h @@ -1,119 +1,119 @@ -/** @file
- Variable check definitions.
-
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _VARIABLE_CHECK_H_
-#define _VARIABLE_CHECK_H_
-
-#include <Uefi/UefiSpec.h>
-
-typedef struct _EDKII_VAR_CHECK_PROTOCOL EDKII_VAR_CHECK_PROTOCOL;
-
-#define EDKII_VAR_CHECK_PROTOCOL_GUID {\
- 0xaf23b340, 0x97b4, 0x4685, { 0x8d, 0x4f, 0xa3, 0xf2, 0x81, 0x69, 0xb2, 0x1d } \
-};
-
-typedef EFI_SET_VARIABLE VAR_CHECK_SET_VARIABLE_CHECK_HANDLER;
-
-/**
- Register SetVariable check handler.
- Variable driver will call the handler to do check before
- really setting the variable into variable storage.
-
- @param[in] Handler Pointer to the check handler.
-
- @retval EFI_SUCCESS The SetVariable check handler was registered successfully.
- @retval EFI_INVALID_PARAMETER Handler is NULL.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request.
- @retval EFI_UNSUPPORTED This interface is not implemented.
- For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_VAR_CHECK_REGISTER_SET_VARIABLE_CHECK_HANDLER)(
- IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler
- );
-
-#define VAR_CHECK_VARIABLE_PROPERTY_REVISION 0x0001
-//
-// 1. Set by VariableLock PROTOCOL
-// 2. Set by VarCheck PROTOCOL
-//
-// If set, other fields for check will be ignored.
-//
-#define VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY BIT0
-
-typedef struct {
- UINT16 Revision;
- UINT16 Property;
- UINT32 Attributes;
- UINTN MinSize;
- UINTN MaxSize;
-} VAR_CHECK_VARIABLE_PROPERTY;
-
-typedef struct {
- EFI_GUID *Guid;
- CHAR16 *Name;
- VAR_CHECK_VARIABLE_PROPERTY VariableProperty;
-} VARIABLE_ENTRY_PROPERTY;
-
-/**
- Variable property set.
- Variable driver will do check according to the VariableProperty before
- really setting the variable into variable storage.
-
- @param[in] Name Pointer to the variable name.
- @param[in] Guid Pointer to the vendor GUID.
- @param[in] VariableProperty Pointer to the input variable property.
-
- @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully.
- @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string,
- or the fields of VariableProperty are not valid.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_VAR_CHECK_VARIABLE_PROPERTY_SET)(
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
- );
-
-/**
- Variable property get.
-
- @param[in] Name Pointer to the variable name.
- @param[in] Guid Pointer to the vendor GUID.
- @param[out] VariableProperty Pointer to the output variable property.
-
- @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully.
- @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string.
- @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_VAR_CHECK_VARIABLE_PROPERTY_GET)(
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
- );
-
-struct _EDKII_VAR_CHECK_PROTOCOL {
- EDKII_VAR_CHECK_REGISTER_SET_VARIABLE_CHECK_HANDLER RegisterSetVariableCheckHandler;
- EDKII_VAR_CHECK_VARIABLE_PROPERTY_SET VariablePropertySet;
- EDKII_VAR_CHECK_VARIABLE_PROPERTY_GET VariablePropertyGet;
-};
-
-extern EFI_GUID gEdkiiVarCheckProtocolGuid;
-
-#endif
+/** @file + Variable check definitions. + + Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _VARIABLE_CHECK_H_ +#define _VARIABLE_CHECK_H_ + +#include <Uefi/UefiSpec.h> + +typedef struct _EDKII_VAR_CHECK_PROTOCOL EDKII_VAR_CHECK_PROTOCOL; + +#define EDKII_VAR_CHECK_PROTOCOL_GUID {\ + 0xaf23b340, 0x97b4, 0x4685, { 0x8d, 0x4f, 0xa3, 0xf2, 0x81, 0x69, 0xb2, 0x1d } \ +}; + +typedef EFI_SET_VARIABLE VAR_CHECK_SET_VARIABLE_CHECK_HANDLER; + +/** + Register SetVariable check handler. + Variable driver will call the handler to do check before + really setting the variable into variable storage. + + @param[in] Handler Pointer to the check handler. + + @retval EFI_SUCCESS The SetVariable check handler was registered successfully. + @retval EFI_INVALID_PARAMETER Handler is NULL. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request. + @retval EFI_UNSUPPORTED This interface is not implemented. + For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_VAR_CHECK_REGISTER_SET_VARIABLE_CHECK_HANDLER)( + IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler + ); + +#define VAR_CHECK_VARIABLE_PROPERTY_REVISION 0x0001 +// +// 1. Set by VariableLock PROTOCOL +// 2. Set by VarCheck PROTOCOL +// +// If set, other fields for check will be ignored. +// +#define VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY BIT0 + +typedef struct { + UINT16 Revision; + UINT16 Property; + UINT32 Attributes; + UINTN MinSize; + UINTN MaxSize; +} VAR_CHECK_VARIABLE_PROPERTY; + +typedef struct { + EFI_GUID *Guid; + CHAR16 *Name; + VAR_CHECK_VARIABLE_PROPERTY VariableProperty; +} VARIABLE_ENTRY_PROPERTY; + +/** + Variable property set. + Variable driver will do check according to the VariableProperty before + really setting the variable into variable storage. + + @param[in] Name Pointer to the variable name. + @param[in] Guid Pointer to the vendor GUID. + @param[in] VariableProperty Pointer to the input variable property. + + @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully. + @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string, + or the fields of VariableProperty are not valid. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_VAR_CHECK_VARIABLE_PROPERTY_SET)( + IN CHAR16 *Name, + IN EFI_GUID *Guid, + IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty + ); + +/** + Variable property get. + + @param[in] Name Pointer to the variable name. + @param[in] Guid Pointer to the vendor GUID. + @param[out] VariableProperty Pointer to the output variable property. + + @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully. + @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string. + @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_VAR_CHECK_VARIABLE_PROPERTY_GET)( + IN CHAR16 *Name, + IN EFI_GUID *Guid, + OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty + ); + +struct _EDKII_VAR_CHECK_PROTOCOL { + EDKII_VAR_CHECK_REGISTER_SET_VARIABLE_CHECK_HANDLER RegisterSetVariableCheckHandler; + EDKII_VAR_CHECK_VARIABLE_PROPERTY_SET VariablePropertySet; + EDKII_VAR_CHECK_VARIABLE_PROPERTY_GET VariablePropertyGet; +}; + +extern EFI_GUID gEdkiiVarCheckProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/VariableLock.h b/MdeModulePkg/Include/Protocol/VariableLock.h index 2d15cc1ca4..548d49f84b 100644 --- a/MdeModulePkg/Include/Protocol/VariableLock.h +++ b/MdeModulePkg/Include/Protocol/VariableLock.h @@ -1,56 +1,56 @@ -/** @file
- Variable Lock Protocol is related to EDK II-specific implementation of variables
- and intended for use as a means to mark a variable read-only after the event
- EFI_END_OF_DXE_EVENT_GUID is signaled.
-
- Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __VARIABLE_LOCK_H__
-#define __VARIABLE_LOCK_H__
-
-#define EDKII_VARIABLE_LOCK_PROTOCOL_GUID \
- { \
- 0xcd3d0a05, 0x9e24, 0x437c, { 0xa8, 0x91, 0x1e, 0xe0, 0x53, 0xdb, 0x76, 0x38 } \
- }
-
-typedef struct _EDKII_VARIABLE_LOCK_PROTOCOL EDKII_VARIABLE_LOCK_PROTOCOL;
-
-/**
- Mark a variable that will become read-only after leaving the DXE phase of execution.
- Write request coming from SMM environment through EFI_SMM_VARIABLE_PROTOCOL is allowed.
-
- @param[in] This The EDKII_VARIABLE_LOCK_PROTOCOL instance.
- @param[in] VariableName A pointer to the variable name that will be made read-only subsequently.
- @param[in] VendorGuid A pointer to the vendor GUID that will be made read-only subsequently.
-
- @retval EFI_SUCCESS The variable specified by the VariableName and the VendorGuid was marked
- as pending to be read-only.
- @retval EFI_INVALID_PARAMETER VariableName or VendorGuid is NULL.
- Or VariableName is an empty string.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource to hold the lock request.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EDKII_VARIABLE_LOCK_PROTOCOL_REQUEST_TO_LOCK)(
- IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This,
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid
- );
-
-///
-/// Variable Lock Protocol is related to EDK II-specific implementation of variables
-/// and intended for use as a means to mark a variable read-only after the event
-/// EFI_END_OF_DXE_EVENT_GUID is signaled.
-///
-struct _EDKII_VARIABLE_LOCK_PROTOCOL {
- EDKII_VARIABLE_LOCK_PROTOCOL_REQUEST_TO_LOCK RequestToLock;
-};
-
-extern EFI_GUID gEdkiiVariableLockProtocolGuid;
-
-#endif
+/** @file + Variable Lock Protocol is related to EDK II-specific implementation of variables + and intended for use as a means to mark a variable read-only after the event + EFI_END_OF_DXE_EVENT_GUID is signaled. + + Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __VARIABLE_LOCK_H__ +#define __VARIABLE_LOCK_H__ + +#define EDKII_VARIABLE_LOCK_PROTOCOL_GUID \ + { \ + 0xcd3d0a05, 0x9e24, 0x437c, { 0xa8, 0x91, 0x1e, 0xe0, 0x53, 0xdb, 0x76, 0x38 } \ + } + +typedef struct _EDKII_VARIABLE_LOCK_PROTOCOL EDKII_VARIABLE_LOCK_PROTOCOL; + +/** + Mark a variable that will become read-only after leaving the DXE phase of execution. + Write request coming from SMM environment through EFI_SMM_VARIABLE_PROTOCOL is allowed. + + @param[in] This The EDKII_VARIABLE_LOCK_PROTOCOL instance. + @param[in] VariableName A pointer to the variable name that will be made read-only subsequently. + @param[in] VendorGuid A pointer to the vendor GUID that will be made read-only subsequently. + + @retval EFI_SUCCESS The variable specified by the VariableName and the VendorGuid was marked + as pending to be read-only. + @retval EFI_INVALID_PARAMETER VariableName or VendorGuid is NULL. + Or VariableName is an empty string. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource to hold the lock request. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_VARIABLE_LOCK_PROTOCOL_REQUEST_TO_LOCK)( + IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This, + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid + ); + +/// +/// Variable Lock Protocol is related to EDK II-specific implementation of variables +/// and intended for use as a means to mark a variable read-only after the event +/// EFI_END_OF_DXE_EVENT_GUID is signaled. +/// +struct _EDKII_VARIABLE_LOCK_PROTOCOL { + EDKII_VARIABLE_LOCK_PROTOCOL_REQUEST_TO_LOCK RequestToLock; +}; + +extern EFI_GUID gEdkiiVariableLockProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/Protocol/VariablePolicy.h b/MdeModulePkg/Include/Protocol/VariablePolicy.h index 4b57f70a9d..327db314bc 100644 --- a/MdeModulePkg/Include/Protocol/VariablePolicy.h +++ b/MdeModulePkg/Include/Protocol/VariablePolicy.h @@ -1,276 +1,276 @@ -/** @file -- VariablePolicy.h
-
-This protocol allows communication with Variable Policy Engine.
-
-Copyright (c) Microsoft Corporation.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef __EDKII_VARIABLE_POLICY_PROTOCOL__
-#define __EDKII_VARIABLE_POLICY_PROTOCOL__
-
-#define EDKII_VARIABLE_POLICY_PROTOCOL_REVISION 0x0000000000020000
-
-/*
- Rev 0x0000000000010000:
- - Initial protocol definition
-
- Rev 0x0000000000020000:
- - Add GetVariablePolicyInfo() API
- - Add GetLockOnVariableStateVariablePolicyInfo() API
-
-*/
-
-#define EDKII_VARIABLE_POLICY_PROTOCOL_GUID \
- { \
- 0x81D1675C, 0x86F6, 0x48DF, { 0xBD, 0x95, 0x9A, 0x6E, 0x4F, 0x09, 0x25, 0xC3 } \
- }
-
-#define VARIABLE_POLICY_ENTRY_REVISION 0x00010000
-
-#pragma pack(push, 1)
-typedef struct {
- UINT32 Version;
- UINT16 Size;
- UINT16 OffsetToName;
- EFI_GUID Namespace;
- UINT32 MinSize;
- UINT32 MaxSize;
- UINT32 AttributesMustHave;
- UINT32 AttributesCantHave;
- UINT8 LockPolicyType;
- UINT8 Padding[3];
- // UINT8 LockPolicy[]; // Variable Length Field
- // CHAR16 Name[] // Variable Length Field
-} VARIABLE_POLICY_ENTRY;
-
-#define VARIABLE_POLICY_NO_MIN_SIZE 0
-#define VARIABLE_POLICY_NO_MAX_SIZE MAX_UINT32
-#define VARIABLE_POLICY_NO_MUST_ATTR 0
-#define VARIABLE_POLICY_NO_CANT_ATTR 0
-
-#define VARIABLE_POLICY_TYPE_NO_LOCK 0
-#define VARIABLE_POLICY_TYPE_LOCK_NOW 1
-#define VARIABLE_POLICY_TYPE_LOCK_ON_CREATE 2
-#define VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE 3
-
-typedef struct {
- EFI_GUID Namespace;
- UINT8 Value;
- UINT8 Padding;
- // CHAR16 Name[]; // Variable Length Field
-} VARIABLE_LOCK_ON_VAR_STATE_POLICY;
-#pragma pack(pop)
-
-/**
- This API function disables the variable policy enforcement. If it's
- already been called once, will return EFI_ALREADY_STARTED.
-
- @retval EFI_SUCCESS
- @retval EFI_ALREADY_STARTED Has already been called once this boot.
- @retval EFI_WRITE_PROTECTED Interface has been locked until reboot.
- @retval EFI_WRITE_PROTECTED Interface option is disabled by platform PCD.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *DISABLE_VARIABLE_POLICY)(
- VOID
- );
-
-/**
- This API function returns whether or not the policy engine is
- currently being enforced.
-
- @param[out] State Pointer to a return value for whether the policy enforcement
- is currently enabled.
-
- @retval EFI_SUCCESS
- @retval Others An error has prevented this command from completing.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *IS_VARIABLE_POLICY_ENABLED)(
- OUT BOOLEAN *State
- );
-
-/**
- This API function validates and registers a new policy with
- the policy enforcement engine.
-
- @param[in] NewPolicy Pointer to the incoming policy structure.
-
- @retval EFI_SUCCESS
- @retval EFI_INVALID_PARAMETER NewPolicy is NULL or is internally inconsistent.
- @retval EFI_ALREADY_STARTED An identical matching policy already exists.
- @retval EFI_WRITE_PROTECTED The interface has been locked until the next reboot.
- @retval EFI_ABORTED A calculation error has prevented this function from completing.
- @retval EFI_OUT_OF_RESOURCES Cannot grow the table to hold any more policies.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *REGISTER_VARIABLE_POLICY)(
- IN CONST VARIABLE_POLICY_ENTRY *PolicyEntry
- );
-
-/**
- This API function will dump the entire contents of the variable policy table.
-
- Similar to GetVariable, the first call can be made with a 0 size and it will return
- the size of the buffer required to hold the entire table.
-
- @param[out] Policy Pointer to the policy buffer. Can be NULL if Size is 0.
- @param[in,out] Size On input, the size of the output buffer. On output, the size
- of the data returned.
-
- @retval EFI_SUCCESS Policy data is in the output buffer and Size has been updated.
- @retval EFI_INVALID_PARAMETER Size is NULL, or Size is non-zero and Policy is NULL.
- @retval EFI_BUFFER_TOO_SMALL Size is insufficient to hold policy. Size updated with required size.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *DUMP_VARIABLE_POLICY)(
- IN OUT UINT8 *Policy,
- IN OUT UINT32 *Size
- );
-
-/**
- This API function locks the interface so that no more policy updates
- can be performed or changes made to the enforcement until the next boot.
-
- @retval EFI_SUCCESS
- @retval Others An error has prevented this command from completing.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *LOCK_VARIABLE_POLICY)(
- VOID
- );
-
-/**
- This function will return variable policy information for a UEFI variable with a
- registered variable policy.
-
- @param[in] VariableName The name of the variable to use for the policy search.
- @param[in] VendorGuid The vendor GUID of the variable to use for the policy search.
- @param[in,out] VariablePolicyVariableNameBufferSize On input, the size, in bytes, of the VariablePolicyVariableName
- buffer.
-
- On output, the size, in bytes, needed to store the variable
- policy variable name.
-
- If testing for the VariablePolicyVariableName buffer size
- needed, set this value to zero so EFI_BUFFER_TOO_SMALL is
- guaranteed to be returned if the variable policy variable name
- is found.
- @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written
- if found.
- @param[out] VariablePolicyVariableName Pointer to a buffer where the variable name used for the
- variable policy will be written if a variable name is
- registered.
-
- If the variable policy is not associated with a variable name
- (e.g. applied to variable vendor namespace) and this parameter
- is given, this parameter will not be modified and
- VariablePolicyVariableNameBufferSize will be set to zero to
- indicate a name was not present.
-
- If the pointer given is not NULL,
- VariablePolicyVariableNameBufferSize must be non-NULL.
-
- @retval EFI_SUCCESS A variable policy entry was found and returned successfully.
- @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error.
- @retval EFI_BUFFER_TOO_SMALL The VariablePolicyVariableName buffer value is too small for the size needed.
- The buffer should now point to the size needed.
- @retval EFI_NOT_READY Variable policy has not yet been initialized.
- @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if
- VariablePolicyVariableName is non-NULL and VariablePolicyVariableNameBufferSize
- is NULL.
- @retval EFI_NOT_FOUND A variable policy was not found for the given UEFI variable name and vendor GUID.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *GET_VARIABLE_POLICY_INFO)(
- IN CONST CHAR16 *VariableName,
- IN CONST EFI_GUID *VendorGuid,
- IN OUT UINTN *VariablePolicyVariableNameBufferSize OPTIONAL,
- OUT VARIABLE_POLICY_ENTRY *VariablePolicy,
- OUT CHAR16 *VariablePolicyVariableName OPTIONAL
- );
-
-/**
- This function will return the Lock on Variable State policy information for the policy
- associated with the given UEFI variable.
-
- @param[in] VariableName The name of the variable to use for the policy search.
- @param[in] VendorGuid The vendor GUID of the variable to use for the policy
- search.
- @param[in,out] VariableLockPolicyVariableNameBufferSize On input, the size, in bytes, of the
- VariableLockPolicyVariableName buffer.
-
- On output, the size, in bytes, needed to store the variable
- policy variable name.
-
- If testing for the VariableLockPolicyVariableName buffer
- size needed, set this value to zero so EFI_BUFFER_TOO_SMALL
- is guaranteed to be returned if the variable policy variable
- name is found.
- @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written
- if found.
- @param[out] VariableLockPolicyVariableName Pointer to a buffer where the variable name used for the
- variable lock on variable state policy will be written if
- a variable name is registered.
-
- If the lock on variable policy is not associated with a
- variable name (e.g. applied to variable vendor namespace)
- and this parameter is given, this parameter will not be
- modified and VariableLockPolicyVariableNameBufferSize will
- be set to zero to indicate a name was not present.
-
- If the pointer given is not NULL,
- VariableLockPolicyVariableNameBufferSize must be non-NULL.
-
- @retval EFI_SUCCESS A Lock on Variable State variable policy entry was found and returned
- successfully.
- @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error.
- @retval EFI_BUFFER_TOO_SMALL The VariableLockPolicyVariableName buffer is too small for the size needed.
- The buffer should now point to the size needed.
- @retval EFI_NOT_READY Variable policy has not yet been initialized.
- @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if
- VariableLockPolicyVariableName is non-NULL and
- VariableLockPolicyVariableNameBufferSize is NULL.
- @retval EFI_NOT_FOUND A Lock on Variable State variable policy was not found for the given UEFI
- variable name and vendor GUID.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *GET_LOCK_ON_VARIABLE_STATE_VARIABLE_POLICY_INFO)(
- IN CONST CHAR16 *VariableName,
- IN CONST EFI_GUID *VendorGuid,
- IN OUT UINTN *VariableLockPolicyVariableNameBufferSize OPTIONAL,
- OUT VARIABLE_LOCK_ON_VAR_STATE_POLICY *VariablePolicy,
- OUT CHAR16 *VariableLockPolicyVariableName OPTIONAL
- );
-
-typedef struct {
- UINT64 Revision;
- DISABLE_VARIABLE_POLICY DisableVariablePolicy;
- IS_VARIABLE_POLICY_ENABLED IsVariablePolicyEnabled;
- REGISTER_VARIABLE_POLICY RegisterVariablePolicy;
- DUMP_VARIABLE_POLICY DumpVariablePolicy;
- LOCK_VARIABLE_POLICY LockVariablePolicy;
- GET_VARIABLE_POLICY_INFO GetVariablePolicyInfo;
- GET_LOCK_ON_VARIABLE_STATE_VARIABLE_POLICY_INFO GetLockOnVariableStateVariablePolicyInfo;
-} _EDKII_VARIABLE_POLICY_PROTOCOL;
-
-typedef _EDKII_VARIABLE_POLICY_PROTOCOL EDKII_VARIABLE_POLICY_PROTOCOL;
-
-extern EFI_GUID gEdkiiVariablePolicyProtocolGuid;
-
-#endif
+/** @file -- VariablePolicy.h + +This protocol allows communication with Variable Policy Engine. + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef __EDKII_VARIABLE_POLICY_PROTOCOL__ +#define __EDKII_VARIABLE_POLICY_PROTOCOL__ + +#define EDKII_VARIABLE_POLICY_PROTOCOL_REVISION 0x0000000000020000 + +/* + Rev 0x0000000000010000: + - Initial protocol definition + + Rev 0x0000000000020000: + - Add GetVariablePolicyInfo() API + - Add GetLockOnVariableStateVariablePolicyInfo() API + +*/ + +#define EDKII_VARIABLE_POLICY_PROTOCOL_GUID \ + { \ + 0x81D1675C, 0x86F6, 0x48DF, { 0xBD, 0x95, 0x9A, 0x6E, 0x4F, 0x09, 0x25, 0xC3 } \ + } + +#define VARIABLE_POLICY_ENTRY_REVISION 0x00010000 + +#pragma pack(push, 1) +typedef struct { + UINT32 Version; + UINT16 Size; + UINT16 OffsetToName; + EFI_GUID Namespace; + UINT32 MinSize; + UINT32 MaxSize; + UINT32 AttributesMustHave; + UINT32 AttributesCantHave; + UINT8 LockPolicyType; + UINT8 Padding[3]; + // UINT8 LockPolicy[]; // Variable Length Field + // CHAR16 Name[] // Variable Length Field +} VARIABLE_POLICY_ENTRY; + +#define VARIABLE_POLICY_NO_MIN_SIZE 0 +#define VARIABLE_POLICY_NO_MAX_SIZE MAX_UINT32 +#define VARIABLE_POLICY_NO_MUST_ATTR 0 +#define VARIABLE_POLICY_NO_CANT_ATTR 0 + +#define VARIABLE_POLICY_TYPE_NO_LOCK 0 +#define VARIABLE_POLICY_TYPE_LOCK_NOW 1 +#define VARIABLE_POLICY_TYPE_LOCK_ON_CREATE 2 +#define VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE 3 + +typedef struct { + EFI_GUID Namespace; + UINT8 Value; + UINT8 Padding; + // CHAR16 Name[]; // Variable Length Field +} VARIABLE_LOCK_ON_VAR_STATE_POLICY; +#pragma pack(pop) + +/** + This API function disables the variable policy enforcement. If it's + already been called once, will return EFI_ALREADY_STARTED. + + @retval EFI_SUCCESS + @retval EFI_ALREADY_STARTED Has already been called once this boot. + @retval EFI_WRITE_PROTECTED Interface has been locked until reboot. + @retval EFI_WRITE_PROTECTED Interface option is disabled by platform PCD. + +**/ +typedef +EFI_STATUS +(EFIAPI *DISABLE_VARIABLE_POLICY)( + VOID + ); + +/** + This API function returns whether or not the policy engine is + currently being enforced. + + @param[out] State Pointer to a return value for whether the policy enforcement + is currently enabled. + + @retval EFI_SUCCESS + @retval Others An error has prevented this command from completing. + +**/ +typedef +EFI_STATUS +(EFIAPI *IS_VARIABLE_POLICY_ENABLED)( + OUT BOOLEAN *State + ); + +/** + This API function validates and registers a new policy with + the policy enforcement engine. + + @param[in] NewPolicy Pointer to the incoming policy structure. + + @retval EFI_SUCCESS + @retval EFI_INVALID_PARAMETER NewPolicy is NULL or is internally inconsistent. + @retval EFI_ALREADY_STARTED An identical matching policy already exists. + @retval EFI_WRITE_PROTECTED The interface has been locked until the next reboot. + @retval EFI_ABORTED A calculation error has prevented this function from completing. + @retval EFI_OUT_OF_RESOURCES Cannot grow the table to hold any more policies. + +**/ +typedef +EFI_STATUS +(EFIAPI *REGISTER_VARIABLE_POLICY)( + IN CONST VARIABLE_POLICY_ENTRY *PolicyEntry + ); + +/** + This API function will dump the entire contents of the variable policy table. + + Similar to GetVariable, the first call can be made with a 0 size and it will return + the size of the buffer required to hold the entire table. + + @param[out] Policy Pointer to the policy buffer. Can be NULL if Size is 0. + @param[in,out] Size On input, the size of the output buffer. On output, the size + of the data returned. + + @retval EFI_SUCCESS Policy data is in the output buffer and Size has been updated. + @retval EFI_INVALID_PARAMETER Size is NULL, or Size is non-zero and Policy is NULL. + @retval EFI_BUFFER_TOO_SMALL Size is insufficient to hold policy. Size updated with required size. + +**/ +typedef +EFI_STATUS +(EFIAPI *DUMP_VARIABLE_POLICY)( + IN OUT UINT8 *Policy, + IN OUT UINT32 *Size + ); + +/** + This API function locks the interface so that no more policy updates + can be performed or changes made to the enforcement until the next boot. + + @retval EFI_SUCCESS + @retval Others An error has prevented this command from completing. + +**/ +typedef +EFI_STATUS +(EFIAPI *LOCK_VARIABLE_POLICY)( + VOID + ); + +/** + This function will return variable policy information for a UEFI variable with a + registered variable policy. + + @param[in] VariableName The name of the variable to use for the policy search. + @param[in] VendorGuid The vendor GUID of the variable to use for the policy search. + @param[in,out] VariablePolicyVariableNameBufferSize On input, the size, in bytes, of the VariablePolicyVariableName + buffer. + + On output, the size, in bytes, needed to store the variable + policy variable name. + + If testing for the VariablePolicyVariableName buffer size + needed, set this value to zero so EFI_BUFFER_TOO_SMALL is + guaranteed to be returned if the variable policy variable name + is found. + @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written + if found. + @param[out] VariablePolicyVariableName Pointer to a buffer where the variable name used for the + variable policy will be written if a variable name is + registered. + + If the variable policy is not associated with a variable name + (e.g. applied to variable vendor namespace) and this parameter + is given, this parameter will not be modified and + VariablePolicyVariableNameBufferSize will be set to zero to + indicate a name was not present. + + If the pointer given is not NULL, + VariablePolicyVariableNameBufferSize must be non-NULL. + + @retval EFI_SUCCESS A variable policy entry was found and returned successfully. + @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error. + @retval EFI_BUFFER_TOO_SMALL The VariablePolicyVariableName buffer value is too small for the size needed. + The buffer should now point to the size needed. + @retval EFI_NOT_READY Variable policy has not yet been initialized. + @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if + VariablePolicyVariableName is non-NULL and VariablePolicyVariableNameBufferSize + is NULL. + @retval EFI_NOT_FOUND A variable policy was not found for the given UEFI variable name and vendor GUID. + +**/ +typedef +EFI_STATUS +(EFIAPI *GET_VARIABLE_POLICY_INFO)( + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VendorGuid, + IN OUT UINTN *VariablePolicyVariableNameBufferSize OPTIONAL, + OUT VARIABLE_POLICY_ENTRY *VariablePolicy, + OUT CHAR16 *VariablePolicyVariableName OPTIONAL + ); + +/** + This function will return the Lock on Variable State policy information for the policy + associated with the given UEFI variable. + + @param[in] VariableName The name of the variable to use for the policy search. + @param[in] VendorGuid The vendor GUID of the variable to use for the policy + search. + @param[in,out] VariableLockPolicyVariableNameBufferSize On input, the size, in bytes, of the + VariableLockPolicyVariableName buffer. + + On output, the size, in bytes, needed to store the variable + policy variable name. + + If testing for the VariableLockPolicyVariableName buffer + size needed, set this value to zero so EFI_BUFFER_TOO_SMALL + is guaranteed to be returned if the variable policy variable + name is found. + @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written + if found. + @param[out] VariableLockPolicyVariableName Pointer to a buffer where the variable name used for the + variable lock on variable state policy will be written if + a variable name is registered. + + If the lock on variable policy is not associated with a + variable name (e.g. applied to variable vendor namespace) + and this parameter is given, this parameter will not be + modified and VariableLockPolicyVariableNameBufferSize will + be set to zero to indicate a name was not present. + + If the pointer given is not NULL, + VariableLockPolicyVariableNameBufferSize must be non-NULL. + + @retval EFI_SUCCESS A Lock on Variable State variable policy entry was found and returned + successfully. + @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error. + @retval EFI_BUFFER_TOO_SMALL The VariableLockPolicyVariableName buffer is too small for the size needed. + The buffer should now point to the size needed. + @retval EFI_NOT_READY Variable policy has not yet been initialized. + @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if + VariableLockPolicyVariableName is non-NULL and + VariableLockPolicyVariableNameBufferSize is NULL. + @retval EFI_NOT_FOUND A Lock on Variable State variable policy was not found for the given UEFI + variable name and vendor GUID. + +**/ +typedef +EFI_STATUS +(EFIAPI *GET_LOCK_ON_VARIABLE_STATE_VARIABLE_POLICY_INFO)( + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VendorGuid, + IN OUT UINTN *VariableLockPolicyVariableNameBufferSize OPTIONAL, + OUT VARIABLE_LOCK_ON_VAR_STATE_POLICY *VariablePolicy, + OUT CHAR16 *VariableLockPolicyVariableName OPTIONAL + ); + +typedef struct { + UINT64 Revision; + DISABLE_VARIABLE_POLICY DisableVariablePolicy; + IS_VARIABLE_POLICY_ENABLED IsVariablePolicyEnabled; + REGISTER_VARIABLE_POLICY RegisterVariablePolicy; + DUMP_VARIABLE_POLICY DumpVariablePolicy; + LOCK_VARIABLE_POLICY LockVariablePolicy; + GET_VARIABLE_POLICY_INFO GetVariablePolicyInfo; + GET_LOCK_ON_VARIABLE_STATE_VARIABLE_POLICY_INFO GetLockOnVariableStateVariablePolicyInfo; +} _EDKII_VARIABLE_POLICY_PROTOCOL; + +typedef _EDKII_VARIABLE_POLICY_PROTOCOL EDKII_VARIABLE_POLICY_PROTOCOL; + +extern EFI_GUID gEdkiiVariablePolicyProtocolGuid; + +#endif diff --git a/MdeModulePkg/Include/UniversalPayload/AcpiTable.h b/MdeModulePkg/Include/UniversalPayload/AcpiTable.h index 6b590b3932..8c9803a1c0 100644 --- a/MdeModulePkg/Include/UniversalPayload/AcpiTable.h +++ b/MdeModulePkg/Include/UniversalPayload/AcpiTable.h @@ -1,30 +1,30 @@ -/** @file
- Define the structure for the Universal Payload APCI table.
-
-Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
- @par Revision Reference:
- - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/)
-**/
-
-#ifndef UNIVERSAL_PAYLOAD_ACPI_TABLE_H_
-#define UNIVERSAL_PAYLOAD_ACPI_TABLE_H_
-
-#include <Uefi.h>
-#include <UniversalPayload/UniversalPayload.h>
-
-#pragma pack(1)
-
-typedef struct {
- UNIVERSAL_PAYLOAD_GENERIC_HEADER Header;
- EFI_PHYSICAL_ADDRESS Rsdp;
-} UNIVERSAL_PAYLOAD_ACPI_TABLE;
-
-#pragma pack()
-
-#define UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION 1
-
-extern GUID gUniversalPayloadAcpiTableGuid;
-
-#endif // UNIVERSAL_PAYLOAD_ACPI_TABLE_H_
+/** @file + Define the structure for the Universal Payload APCI table. + +Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/) +**/ + +#ifndef UNIVERSAL_PAYLOAD_ACPI_TABLE_H_ +#define UNIVERSAL_PAYLOAD_ACPI_TABLE_H_ + +#include <Uefi.h> +#include <UniversalPayload/UniversalPayload.h> + +#pragma pack(1) + +typedef struct { + UNIVERSAL_PAYLOAD_GENERIC_HEADER Header; + EFI_PHYSICAL_ADDRESS Rsdp; +} UNIVERSAL_PAYLOAD_ACPI_TABLE; + +#pragma pack() + +#define UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION 1 + +extern GUID gUniversalPayloadAcpiTableGuid; + +#endif // UNIVERSAL_PAYLOAD_ACPI_TABLE_H_ diff --git a/MdeModulePkg/Include/UniversalPayload/ExtraData.h b/MdeModulePkg/Include/UniversalPayload/ExtraData.h index 334dfd2b9e..c79e985f41 100644 --- a/MdeModulePkg/Include/UniversalPayload/ExtraData.h +++ b/MdeModulePkg/Include/UniversalPayload/ExtraData.h @@ -1,31 +1,31 @@ -/** @file
-
- Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef EXTRA_DATA_H_
-#define EXTRA_DATA_H_
-
-extern GUID gUniversalPayloadExtraDataGuid;
-
-#pragma pack(1)
-
-typedef struct {
- CHAR8 Identifier[16];
- EFI_PHYSICAL_ADDRESS Base;
- UINT64 Size;
-} UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY;
-
-typedef struct {
- UNIVERSAL_PAYLOAD_GENERIC_HEADER Header;
- UINT32 Count;
- UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY Entry[0];
-} UNIVERSAL_PAYLOAD_EXTRA_DATA;
-
-#pragma pack()
-
-#define UNIVERSAL_PAYLOAD_EXTRA_DATA_REVISION 1
-
-#endif
+/** @file + + Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EXTRA_DATA_H_ +#define EXTRA_DATA_H_ + +extern GUID gUniversalPayloadExtraDataGuid; + +#pragma pack(1) + +typedef struct { + CHAR8 Identifier[16]; + EFI_PHYSICAL_ADDRESS Base; + UINT64 Size; +} UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY; + +typedef struct { + UNIVERSAL_PAYLOAD_GENERIC_HEADER Header; + UINT32 Count; + UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY Entry[0]; +} UNIVERSAL_PAYLOAD_EXTRA_DATA; + +#pragma pack() + +#define UNIVERSAL_PAYLOAD_EXTRA_DATA_REVISION 1 + +#endif diff --git a/MdeModulePkg/Include/UniversalPayload/PciRootBridges.h b/MdeModulePkg/Include/UniversalPayload/PciRootBridges.h index 37260da3b1..98372b5243 100644 --- a/MdeModulePkg/Include/UniversalPayload/PciRootBridges.h +++ b/MdeModulePkg/Include/UniversalPayload/PciRootBridges.h @@ -1,91 +1,91 @@ -/** @file
- This file defines the structure for the PCI Root Bridges.
-
- Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
- @par Revision Reference:
- - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/)
-**/
-
-#ifndef UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES_H_
-#define UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES_H_
-
-#include <UniversalPayload/UniversalPayload.h>
-
-#pragma pack(1)
-
-//
-// (Base > Limit) indicates an aperture is not available.
-//
-typedef struct {
- //
- // Base and Limit are the device address instead of host address when
- // Translation is not zero
- //
- UINT64 Base;
- UINT64 Limit;
- //
- // According to UEFI 2.7, Device Address = Host Address + Translation,
- // so Translation = Device Address - Host Address.
- // On platforms where Translation is not zero, the subtraction is probably to
- // be performed with UINT64 wrap-around semantics, for we may translate an
- // above-4G host address into a below-4G device address for legacy PCIe device
- // compatibility.
- //
- // NOTE: The alignment of Translation is required to be larger than any BAR
- // alignment in the same root bridge, so that the same alignment can be
- // applied to both device address and host address, which simplifies the
- // situation and makes the current resource allocation code in generic PCI
- // host bridge driver still work.
- //
- UINT64 Translation;
-} UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE;
-
-///
-/// Payload PCI Root Bridge Information HOB
-///
-typedef struct {
- UINT32 Segment; ///< Segment number.
- UINT64 Supports; ///< Supported attributes.
- ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()
- ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- UINT64 Attributes; ///< Initial attributes.
- ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()
- ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- BOOLEAN DmaAbove4G; ///< DMA above 4GB memory.
- ///< Set to TRUE when root bridge supports DMA above 4GB memory.
- BOOLEAN NoExtendedConfigSpace; ///< When FALSE, the root bridge supports
- ///< Extended (4096-byte) Configuration Space.
- ///< When TRUE, the root bridge supports
- ///< 256-byte Configuration Space only.
- UINT64 AllocationAttributes; ///< Allocation attributes.
- ///< Refer to EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM and
- ///< EFI_PCI_HOST_BRIDGE_MEM64_DECODE used by GetAllocAttributes()
- ///< in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
- UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE Bus; ///< Bus aperture which can be used by the root bridge.
- UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE Io; ///< IO aperture which can be used by the root bridge.
- UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE Mem; ///< MMIO aperture below 4GB which can be used by the root bridge.
- UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE MemAbove4G; ///< MMIO aperture above 4GB which can be used by the root bridge.
- UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE PMem; ///< Prefetchable MMIO aperture below 4GB which can be used by the root bridge.
- UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE PMemAbove4G; ///< Prefetchable MMIO aperture above 4GB which can be used by the root bridge.
- UINT32 HID; ///< PnP hardware ID of the root bridge. This value must match the corresponding
- ///< _HID in the ACPI name space.
- UINT32 UID; ///< Unique ID that is required by ACPI if two devices have the same _HID.
- ///< This value must also match the corresponding _UID/_HID pair in the ACPI name space.
-} UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE;
-
-typedef struct {
- UNIVERSAL_PAYLOAD_GENERIC_HEADER Header;
- BOOLEAN ResourceAssigned;
- UINT8 Count;
- UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE RootBridge[0];
-} UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES;
-
-#pragma pack()
-
-#define UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES_REVISION 1
-
-extern GUID gUniversalPayloadPciRootBridgeInfoGuid;
-
-#endif // UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES_H_
+/** @file + This file defines the structure for the PCI Root Bridges. + + Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/) +**/ + +#ifndef UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES_H_ +#define UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES_H_ + +#include <UniversalPayload/UniversalPayload.h> + +#pragma pack(1) + +// +// (Base > Limit) indicates an aperture is not available. +// +typedef struct { + // + // Base and Limit are the device address instead of host address when + // Translation is not zero + // + UINT64 Base; + UINT64 Limit; + // + // According to UEFI 2.7, Device Address = Host Address + Translation, + // so Translation = Device Address - Host Address. + // On platforms where Translation is not zero, the subtraction is probably to + // be performed with UINT64 wrap-around semantics, for we may translate an + // above-4G host address into a below-4G device address for legacy PCIe device + // compatibility. + // + // NOTE: The alignment of Translation is required to be larger than any BAR + // alignment in the same root bridge, so that the same alignment can be + // applied to both device address and host address, which simplifies the + // situation and makes the current resource allocation code in generic PCI + // host bridge driver still work. + // + UINT64 Translation; +} UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE; + +/// +/// Payload PCI Root Bridge Information HOB +/// +typedef struct { + UINT32 Segment; ///< Segment number. + UINT64 Supports; ///< Supported attributes. + ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes() + ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + UINT64 Attributes; ///< Initial attributes. + ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes() + ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + BOOLEAN DmaAbove4G; ///< DMA above 4GB memory. + ///< Set to TRUE when root bridge supports DMA above 4GB memory. + BOOLEAN NoExtendedConfigSpace; ///< When FALSE, the root bridge supports + ///< Extended (4096-byte) Configuration Space. + ///< When TRUE, the root bridge supports + ///< 256-byte Configuration Space only. + UINT64 AllocationAttributes; ///< Allocation attributes. + ///< Refer to EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM and + ///< EFI_PCI_HOST_BRIDGE_MEM64_DECODE used by GetAllocAttributes() + ///< in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL. + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE Bus; ///< Bus aperture which can be used by the root bridge. + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE Io; ///< IO aperture which can be used by the root bridge. + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE Mem; ///< MMIO aperture below 4GB which can be used by the root bridge. + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE MemAbove4G; ///< MMIO aperture above 4GB which can be used by the root bridge. + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE PMem; ///< Prefetchable MMIO aperture below 4GB which can be used by the root bridge. + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE_APERTURE PMemAbove4G; ///< Prefetchable MMIO aperture above 4GB which can be used by the root bridge. + UINT32 HID; ///< PnP hardware ID of the root bridge. This value must match the corresponding + ///< _HID in the ACPI name space. + UINT32 UID; ///< Unique ID that is required by ACPI if two devices have the same _HID. + ///< This value must also match the corresponding _UID/_HID pair in the ACPI name space. +} UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE; + +typedef struct { + UNIVERSAL_PAYLOAD_GENERIC_HEADER Header; + BOOLEAN ResourceAssigned; + UINT8 Count; + UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE RootBridge[0]; +} UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES; + +#pragma pack() + +#define UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES_REVISION 1 + +extern GUID gUniversalPayloadPciRootBridgeInfoGuid; + +#endif // UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES_H_ diff --git a/MdeModulePkg/Include/UniversalPayload/SerialPortInfo.h b/MdeModulePkg/Include/UniversalPayload/SerialPortInfo.h index 3c4459e2c0..9adb0df107 100644 --- a/MdeModulePkg/Include/UniversalPayload/SerialPortInfo.h +++ b/MdeModulePkg/Include/UniversalPayload/SerialPortInfo.h @@ -1,30 +1,30 @@ -/** @file
- This file defines the structure for serial port info.
-
- Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
- @par Revision Reference:
- - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/)
-**/
-
-#ifndef UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_H_
-#define UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_H_
-
-#include <UniversalPayload/UniversalPayload.h>
-
-#pragma pack(1)
-typedef struct {
- UNIVERSAL_PAYLOAD_GENERIC_HEADER Header;
- BOOLEAN UseMmio;
- UINT8 RegisterStride;
- UINT32 BaudRate;
- EFI_PHYSICAL_ADDRESS RegisterBase;
-} UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO;
-#pragma pack()
-
-#define UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_REVISION 1
-
-extern GUID gUniversalPayloadSerialPortInfoGuid;
-
-#endif // UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_H_
+/** @file + This file defines the structure for serial port info. + + Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/) +**/ + +#ifndef UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_H_ +#define UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_H_ + +#include <UniversalPayload/UniversalPayload.h> + +#pragma pack(1) +typedef struct { + UNIVERSAL_PAYLOAD_GENERIC_HEADER Header; + BOOLEAN UseMmio; + UINT8 RegisterStride; + UINT32 BaudRate; + EFI_PHYSICAL_ADDRESS RegisterBase; +} UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO; +#pragma pack() + +#define UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_REVISION 1 + +extern GUID gUniversalPayloadSerialPortInfoGuid; + +#endif // UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_H_ diff --git a/MdeModulePkg/Include/UniversalPayload/SmbiosTable.h b/MdeModulePkg/Include/UniversalPayload/SmbiosTable.h index ba5a8696e2..df609f8c61 100644 --- a/MdeModulePkg/Include/UniversalPayload/SmbiosTable.h +++ b/MdeModulePkg/Include/UniversalPayload/SmbiosTable.h @@ -1,30 +1,30 @@ -/** @file
- Define the structure for the Universal Payload SmBios.
-
-Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
- @par Revision Reference:
- - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/)
-**/
-
-#ifndef UNIVERSAL_PAYLOAD_SMBIOS_TABLE_H_
-#define UNIVERSAL_PAYLOAD_SMBIOS_TABLE_H_
-
-#include <Uefi.h>
-#include <UniversalPayload/UniversalPayload.h>
-
-#pragma pack (1)
-
-typedef struct {
- UNIVERSAL_PAYLOAD_GENERIC_HEADER Header;
- EFI_PHYSICAL_ADDRESS SmBiosEntryPoint;
-} UNIVERSAL_PAYLOAD_SMBIOS_TABLE;
-
-#pragma pack()
-
-#define UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION 1
-
-extern GUID gUniversalPayloadSmbios3TableGuid;
-extern GUID gUniversalPayloadSmbiosTableGuid;
-#endif // UNIVERSAL_PAYLOAD_SMBIOS_TABLE_H_
+/** @file + Define the structure for the Universal Payload SmBios. + +Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/) +**/ + +#ifndef UNIVERSAL_PAYLOAD_SMBIOS_TABLE_H_ +#define UNIVERSAL_PAYLOAD_SMBIOS_TABLE_H_ + +#include <Uefi.h> +#include <UniversalPayload/UniversalPayload.h> + +#pragma pack (1) + +typedef struct { + UNIVERSAL_PAYLOAD_GENERIC_HEADER Header; + EFI_PHYSICAL_ADDRESS SmBiosEntryPoint; +} UNIVERSAL_PAYLOAD_SMBIOS_TABLE; + +#pragma pack() + +#define UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION 1 + +extern GUID gUniversalPayloadSmbios3TableGuid; +extern GUID gUniversalPayloadSmbiosTableGuid; +#endif // UNIVERSAL_PAYLOAD_SMBIOS_TABLE_H_ diff --git a/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h b/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h index bb40f240f6..a5c7718172 100644 --- a/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h +++ b/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h @@ -1,59 +1,59 @@ -/** @file
- Universal Payload general definitions.
-
-Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
- @par Revision Reference:
- - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/)
-**/
-
-#ifndef UNIVERSAL_PAYLOAD_H_
-#define UNIVERSAL_PAYLOAD_H_
-
-/**
- Main entry point to Universal Payload.
-
- @param HobList Pointer to the beginning of the HOB List from boot loader.
-**/
-typedef VOID (EFIAPI *UNIVERSAL_PAYLOAD_ENTRY)(VOID *HobList);
-
-#define UNIVERSAL_PAYLOAD_IDENTIFIER SIGNATURE_32('P', 'L', 'D', 'H')
-#define UNIVERSAL_PAYLOAD_INFO_SEC_NAME ".upld_info"
-#define UNIVERSAL_PAYLOAD_EXTRA_SEC_NAME_PREFIX ".upld."
-#define UNIVERSAL_PAYLOAD_EXTRA_SEC_NAME_PREFIX_LENGTH (sizeof (UNIVERSAL_PAYLOAD_EXTRA_SEC_NAME_PREFIX) - 1)
-
-#pragma pack(1)
-
-typedef struct {
- UINT32 Identifier;
- UINT32 HeaderLength;
- UINT16 SpecRevision;
- UINT8 Reserved[2];
- UINT32 Revision;
- UINT32 Attribute;
- UINT32 Capability;
- CHAR8 ProducerId[16];
- CHAR8 ImageId[16];
-} UNIVERSAL_PAYLOAD_INFO_HEADER;
-
-typedef struct {
- UINT8 Revision;
- UINT8 Reserved;
- UINT16 Length;
-} UNIVERSAL_PAYLOAD_GENERIC_HEADER;
-
-#pragma pack()
-
-/**
- Returns the size of a structure of known type, up through and including a specified field.
-
- @param TYPE The name of the data structure that contains the field specified by Field.
- @param Field The name of the field in the data structure.
-
- @return size, in bytes.
-
-**/
-#define UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD(TYPE, Field) (OFFSET_OF(TYPE, Field) + sizeof (((TYPE *) 0)->Field))
-
-#endif // UNIVERSAL_PAYLOAD_H_
+/** @file + Universal Payload general definitions. + +Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + - Universal Payload Specification 0.75 (https://universalpayload.github.io/documentation/) +**/ + +#ifndef UNIVERSAL_PAYLOAD_H_ +#define UNIVERSAL_PAYLOAD_H_ + +/** + Main entry point to Universal Payload. + + @param HobList Pointer to the beginning of the HOB List from boot loader. +**/ +typedef VOID (EFIAPI *UNIVERSAL_PAYLOAD_ENTRY)(VOID *HobList); + +#define UNIVERSAL_PAYLOAD_IDENTIFIER SIGNATURE_32('P', 'L', 'D', 'H') +#define UNIVERSAL_PAYLOAD_INFO_SEC_NAME ".upld_info" +#define UNIVERSAL_PAYLOAD_EXTRA_SEC_NAME_PREFIX ".upld." +#define UNIVERSAL_PAYLOAD_EXTRA_SEC_NAME_PREFIX_LENGTH (sizeof (UNIVERSAL_PAYLOAD_EXTRA_SEC_NAME_PREFIX) - 1) + +#pragma pack(1) + +typedef struct { + UINT32 Identifier; + UINT32 HeaderLength; + UINT16 SpecRevision; + UINT8 Reserved[2]; + UINT32 Revision; + UINT32 Attribute; + UINT32 Capability; + CHAR8 ProducerId[16]; + CHAR8 ImageId[16]; +} UNIVERSAL_PAYLOAD_INFO_HEADER; + +typedef struct { + UINT8 Revision; + UINT8 Reserved; + UINT16 Length; +} UNIVERSAL_PAYLOAD_GENERIC_HEADER; + +#pragma pack() + +/** + Returns the size of a structure of known type, up through and including a specified field. + + @param TYPE The name of the data structure that contains the field specified by Field. + @param Field The name of the field in the data structure. + + @return size, in bytes. + +**/ +#define UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD(TYPE, Field) (OFFSET_OF(TYPE, Field) + sizeof (((TYPE *) 0)->Field)) + +#endif // UNIVERSAL_PAYLOAD_H_ |
