diff options
Diffstat (limited to 'MdeModulePkg/Include/Protocol')
44 files changed, 5757 insertions, 5757 deletions
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 |
