diff options
Diffstat (limited to 'src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi')
47 files changed, 6066 insertions, 0 deletions
diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BlockIo.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BlockIo.h new file mode 100644 index 00000000..220c5ba1 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BlockIo.h @@ -0,0 +1,232 @@ +/** @file + Provides the services required to access a block I/O device during PEI recovery + boot mode. + + The Recovery Module PPI and the Device Recovery Module PPI are device neutral. + This PPI is device specific and addresses the most common form of recovery + media-block I/O devices such as legacy floppy, CD-ROM, or IDE devices. + + The Recovery Block I/O PPI is used to access block devices. Because the Recovery + Block I/O PPIs that are provided by the PEI ATAPI driver and PEI legacy floppy + driver are the same, here we define a set of general PPIs for both drivers to use. + +Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is defined in UEFI Platform Initialization Specification 1.2 Volume 1: + Pre-EFI Initialization Core Interface. + +**/ + +#ifndef _PEI_BLOCK_IO_H_ +#define _PEI_BLOCK_IO_H_ + +/// +/// Global ID for EFI_PEI_RECOVERY_BLOCK_IO_PPI +/// +#define EFI_PEI_RECOVERY_BLOCK_IO_PPI_GUID \ + { \ + 0x695d8aa1, 0x42ee, 0x4c46, { 0x80, 0x5c, 0x6e, 0xa6, 0xbc, 0xe7, 0x99, 0xe3 } \ + } + +/// +/// The forward declaration for EFI_PEI_RECOVERY_BLOCK_IO_PPI. +/// +typedef struct _EFI_PEI_RECOVERY_BLOCK_IO_PPI EFI_PEI_RECOVERY_BLOCK_IO_PPI; + +/// +/// All blocks on the recovery device are addressed with a 64-bit Logical Block Address (LBA). +/// +typedef UINT64 EFI_PEI_LBA; + +/// +/// EFI_PEI_BLOCK_DEVICE_TYPE +/// +typedef enum { + LegacyFloppy = 0, ///< The recovery device is a floppy. + IdeCDROM = 1, ///< The recovery device is an IDE CD-ROM + IdeLS120 = 2, ///< The recovery device is an IDE LS-120 + UsbMassStorage= 3, ///< The recovery device is a USB Mass Storage device + SD = 4, ///< The recovery device is a Secure Digital device + EMMC = 5, ///< The recovery device is a eMMC device + UfsDevice = 6, ///< The recovery device is a Universal Flash Storage device + MaxDeviceType +} EFI_PEI_BLOCK_DEVICE_TYPE; + +/// +/// Specification inconsistency here: +/// PEI_BLOCK_IO_MEDIA has been changed to EFI_PEI_BLOCK_IO_MEDIA. +/// Inconsistency exists in UEFI Platform Initialization Specification 1.2 +/// Volume 1: Pre-EFI Initialization Core Interface, where all references to +/// this structure name are with the "EFI_" prefix, except for the definition +/// which is without "EFI_". So the name of PEI_BLOCK_IO_MEDIA is taken as the +/// exception, and EFI_PEI_BLOCK_IO_MEDIA is used to comply with most of +/// the specification. +/// +typedef struct { + /// + /// The type of media device being referenced by DeviceIndex. + /// + EFI_PEI_BLOCK_DEVICE_TYPE DeviceType; + /// + /// A flag that indicates if media is present. This flag is always set for + /// nonremovable media devices. + /// + BOOLEAN MediaPresent; + /// + /// The last logical block that the device supports. + /// + UINTN LastBlock; + /// + /// The size of a logical block in bytes. + /// + UINTN BlockSize; +} EFI_PEI_BLOCK_IO_MEDIA; + +/** + Gets the count of block I/O devices that one specific block driver detects. + + This function is used for getting the count of block I/O devices that one + specific block driver detects. To the PEI ATAPI driver, it returns the number + of all the detected ATAPI devices it detects during the enumeration process. + To the PEI legacy floppy driver, it returns the number of all the legacy + devices it finds during its enumeration process. If no device is detected, + then the function will return zero. + + @param[in] PeiServices General-purpose services that are available + to every PEIM. + @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI + instance. + @param[out] NumberBlockDevices The number of block I/O devices discovered. + + @retval EFI_SUCCESS The operation performed successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_GET_NUMBER_BLOCK_DEVICES)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, + OUT UINTN *NumberBlockDevices + ); + +/** + Gets a block device's media information. + + This function will provide the caller with the specified block device's media + information. If the media changes, calling this function will update the media + information accordingly. + + @param[in] PeiServices General-purpose services that are available to every + PEIM + @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance. + @param[in] DeviceIndex Specifies the block device to which the function wants + to talk. Because the driver that implements Block I/O + PPIs will manage multiple block devices, the PPIs that + want to talk to a single device must specify the + device index that was assigned during the enumeration + process. This index is a number from one to + NumberBlockDevices. + @param[out] MediaInfo The media information of the specified block media. + The caller is responsible for the ownership of this + data structure. + + @par Note: + The MediaInfo structure describes an enumeration of possible block device + types. This enumeration exists because no device paths are actually passed + across interfaces that describe the type or class of hardware that is publishing + the block I/O interface. This enumeration will allow for policy decisions + in the Recovery PEIM, such as "Try to recover from legacy floppy first, + LS-120 second, CD-ROM third." If there are multiple partitions abstracted + by a given device type, they should be reported in ascending order; this + order also applies to nested partitions, such as legacy MBR, where the + outermost partitions would have precedence in the reporting order. The + same logic applies to systems such as IDE that have precedence relationships + like "Master/Slave" or "Primary/Secondary". The master device should be + reported first, the slave second. + + @retval EFI_SUCCESS Media information about the specified block device + was obtained successfully. + @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware + error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_GET_DEVICE_MEDIA_INFORMATION)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, + IN UINTN DeviceIndex, + OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo + ); + +/** + Reads the requested number of blocks from the specified block device. + + The function reads the requested number of blocks from the device. All the + blocks are read, or an error is returned. If there is no media in the device, + the function returns EFI_NO_MEDIA. + + @param[in] PeiServices General-purpose services that are available to + every PEIM. + @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance. + @param[in] DeviceIndex Specifies the block device to which the function wants + to talk. Because the driver that implements Block I/O + PPIs will manage multiple block devices, PPIs that + want to talk to a single device must specify the device + index that was assigned during the enumeration process. + This index is a number from one to NumberBlockDevices. + @param[in] StartLBA The starting logical block address (LBA) to read from + on the device + @param[in] BufferSize The size of the Buffer in bytes. This number must be + a multiple of the intrinsic block size of the device. + @param[out] Buffer A pointer to the destination buffer for the data. + The caller is responsible for the ownership of the + buffer. + + @retval EFI_SUCCESS The data was read correctly from the device. + @retval EFI_DEVICE_ERROR The device reported an error while attempting + to perform the read operation. + @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not + valid, or the buffer is not properly aligned. + @retval EFI_NO_MEDIA There is no media in the device. + @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of + the intrinsic block size of the device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_READ_BLOCKS)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, + IN UINTN DeviceIndex, + IN EFI_PEI_LBA StartLBA, + IN UINTN BufferSize, + OUT VOID *Buffer + ); + +/// +/// EFI_PEI_RECOVERY_BLOCK_IO_PPI provides the services that are required +/// to access a block I/O device during PEI recovery boot mode. +/// +struct _EFI_PEI_RECOVERY_BLOCK_IO_PPI { + /// + /// Gets the number of block I/O devices that the specific block driver manages. + /// + EFI_PEI_GET_NUMBER_BLOCK_DEVICES GetNumberOfBlockDevices; + + /// + /// Gets the specified media information. + /// + EFI_PEI_GET_DEVICE_MEDIA_INFORMATION GetBlockDeviceMediaInfo; + + /// + /// Reads the requested number of blocks from the specified block device. + /// + EFI_PEI_READ_BLOCKS ReadBlocks; +}; + +extern EFI_GUID gEfiPeiVirtualBlockIoPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BlockIo2.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BlockIo2.h new file mode 100644 index 00000000..99242948 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BlockIo2.h @@ -0,0 +1,217 @@ +/** @file + Provides the services required to access a block I/O 2 device during PEI recovery + boot mode. + +Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is defined in UEFI Platform Initialization Specification 1.4 Volume 1: + Pre-EFI Initialization Core Interface. + +**/ + +#ifndef _PEI_BLOCK_IO2_H_ +#define _PEI_BLOCK_IO2_H_ + +#include <Ppi/BlockIo.h> +#include <Protocol/DevicePath.h> + +/// +/// Global ID for EFI_PEI_RECOVERY_BLOCK_IO2_PPI +/// +#define EFI_PEI_RECOVERY_BLOCK_IO2_PPI_GUID \ + { \ + 0x26cc0fad, 0xbeb3, 0x478a, { 0x91, 0xb2, 0xc, 0x18, 0x8f, 0x72, 0x61, 0x98 } \ + } + +/// +/// The forward declaration for EFI_PEI_RECOVERY_BLOCK_IO_PPI. +/// +typedef struct _EFI_PEI_RECOVERY_BLOCK_IO2_PPI EFI_PEI_RECOVERY_BLOCK_IO2_PPI; + +#define EFI_PEI_RECOVERY_BLOCK_IO2_PPI_REVISION 0x00010000 + +typedef struct { + /// + /// A type of interface that the device being referenced by DeviceIndex is + /// attached to. This field re-uses Messaging Device Path Node sub-type values + /// as defined by Section 9.3.5 Messaging Device Path of UEFI Specification. + /// When more than one sub-type is associated with the interface, sub-type with + /// the smallest number must be used. + /// + UINT8 InterfaceType; + /// + /// A flag that indicates if media is removable. + /// + BOOLEAN RemovableMedia; + /// + /// A flag that indicates if media is present. This flag is always set for + /// non-removable media devices. + /// + BOOLEAN MediaPresent; + /// + /// A flag that indicates if media is read-only. + /// + BOOLEAN ReadOnly; + /// + /// The size of a logical block in bytes. + /// + UINT32 BlockSize; + /// + /// The last logical block that the device supports. + /// + EFI_PEI_LBA LastBlock; +} EFI_PEI_BLOCK_IO2_MEDIA; + +/** + Gets the count of block I/O devices that one specific block driver detects. + + This function is used for getting the count of block I/O devices that one + specific block driver detects. To the PEI ATAPI driver, it returns the number + of all the detected ATAPI devices it detects during the enumeration process. + To the PEI legacy floppy driver, it returns the number of all the legacy + devices it finds during its enumeration process. If no device is detected, + then the function will return zero. + + @param[in] PeiServices General-purpose services that are available + to every PEIM. + @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI + instance. + @param[out] NumberBlockDevices The number of block I/O devices discovered. + + @retval EFI_SUCCESS The operation performed successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_GET_NUMBER_BLOCK_DEVICES2)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, + OUT UINTN *NumberBlockDevices + ); + +/** + Gets a block device's media information. + + This function will provide the caller with the specified block device's media + information. If the media changes, calling this function will update the media + information accordingly. + + @param[in] PeiServices General-purpose services that are available to every + PEIM + @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance. + @param[in] DeviceIndex Specifies the block device to which the function wants + to talk. Because the driver that implements Block I/O + PPIs will manage multiple block devices, the PPIs that + want to talk to a single device must specify the + device index that was assigned during the enumeration + process. This index is a number from one to + NumberBlockDevices. + @param[out] MediaInfo The media information of the specified block media. + The caller is responsible for the ownership of this + data structure. + + @par Note: + The MediaInfo structure describes an enumeration of possible block device + types. This enumeration exists because no device paths are actually passed + across interfaces that describe the type or class of hardware that is publishing + the block I/O interface. This enumeration will allow for policy decisions + in the Recovery PEIM, such as "Try to recover from legacy floppy first, + LS-120 second, CD-ROM third." If there are multiple partitions abstracted + by a given device type, they should be reported in ascending order; this + order also applies to nested partitions, such as legacy MBR, where the + outermost partitions would have precedence in the reporting order. The + same logic applies to systems such as IDE that have precedence relationships + like "Master/Slave" or "Primary/Secondary". The master device should be + reported first, the slave second. + + @retval EFI_SUCCESS Media information about the specified block device + was obtained successfully. + @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware + error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_GET_DEVICE_MEDIA_INFORMATION2)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, + IN UINTN DeviceIndex, + OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo + ); + +/** + Reads the requested number of blocks from the specified block device. + + The function reads the requested number of blocks from the device. All the + blocks are read, or an error is returned. If there is no media in the device, + the function returns EFI_NO_MEDIA. + + @param[in] PeiServices General-purpose services that are available to + every PEIM. + @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance. + @param[in] DeviceIndex Specifies the block device to which the function wants + to talk. Because the driver that implements Block I/O + PPIs will manage multiple block devices, PPIs that + want to talk to a single device must specify the device + index that was assigned during the enumeration process. + This index is a number from one to NumberBlockDevices. + @param[in] StartLBA The starting logical block address (LBA) to read from + on the device + @param[in] BufferSize The size of the Buffer in bytes. This number must be + a multiple of the intrinsic block size of the device. + @param[out] Buffer A pointer to the destination buffer for the data. + The caller is responsible for the ownership of the + buffer. + + @retval EFI_SUCCESS The data was read correctly from the device. + @retval EFI_DEVICE_ERROR The device reported an error while attempting + to perform the read operation. + @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not + valid, or the buffer is not properly aligned. + @retval EFI_NO_MEDIA There is no media in the device. + @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of + the intrinsic block size of the device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_READ_BLOCKS2)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, + IN UINTN DeviceIndex, + IN EFI_PEI_LBA StartLBA, + IN UINTN BufferSize, + OUT VOID *Buffer + ); + +/// +/// EFI_PEI_RECOVERY_BLOCK_IO_PPI provides the services that are required +/// to access a block I/O device during PEI recovery boot mode. +/// +struct _EFI_PEI_RECOVERY_BLOCK_IO2_PPI { + /// + /// The revision to which the interface adheres. + /// All future revisions must be backwards compatible. + /// + UINT64 Revision; + /// + /// Gets the number of block I/O devices that the specific block driver manages. + /// + EFI_PEI_GET_NUMBER_BLOCK_DEVICES2 GetNumberOfBlockDevices; + + /// + /// Gets the specified media information. + /// + EFI_PEI_GET_DEVICE_MEDIA_INFORMATION2 GetBlockDeviceMediaInfo; + + /// + /// Reads the requested number of blocks from the specified block device. + /// + EFI_PEI_READ_BLOCKS2 ReadBlocks; +}; + +extern EFI_GUID gEfiPeiVirtualBlockIo2PpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BootInRecoveryMode.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BootInRecoveryMode.h new file mode 100644 index 00000000..11b463e8 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BootInRecoveryMode.h @@ -0,0 +1,24 @@ +/** @file + This PPI is installed by the platform PEIM to designate that a recovery boot + is in progress. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __BOOT_IN_RECOVERY_MODE_PPI_H__ +#define __BOOT_IN_RECOVERY_MODE_PPI_H__ + +#define EFI_PEI_BOOT_IN_RECOVERY_MODE_PPI \ + { \ + 0x17ee496a, 0xd8e4, 0x4b9a, {0x94, 0xd1, 0xce, 0x82, 0x72, 0x30, 0x8, 0x50 } \ + } + + +extern EFI_GUID gEfiPeiBootInRecoveryModePpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Capsule.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Capsule.h new file mode 100644 index 00000000..34b3e9bb --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Capsule.h @@ -0,0 +1,130 @@ +/** @file + Defines the APIs that enable PEI services to work with + the underlying capsule capabilities of the platform. + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.4. + +**/ + +#ifndef _PEI_CAPSULE_PPI_H_ +#define _PEI_CAPSULE_PPI_H_ + +/// +/// Global ID for the EFI_PEI_CAPSULE_PPI. +/// +#define EFI_PEI_CAPSULE_PPI_GUID \ + { \ + 0x3acf33ee, 0xd892, 0x40f4, {0xa2, 0xfc, 0x38, 0x54, 0xd2, 0xe1, 0x32, 0x3d } \ + } + +/// +/// Forward declaration for the EFI_PEI_CAPSULE_PPI. +/// +typedef struct _EFI_PEI_CAPSULE_PPI EFI_PEI_CAPSULE_PPI; + +/// +/// Keep name backwards compatible before PI Version 1.4 +/// +typedef struct _EFI_PEI_CAPSULE_PPI PEI_CAPSULE_PPI; + +/** + Upon determining that there is a capsule to operate on, this service + will use a series of EFI_CAPSULE_BLOCK_DESCRIPTOR entries to determine + the current location of the various capsule fragments and coalesce them + into a contiguous region of system memory. + + @param[in] PeiServices Pointer to the PEI Services Table. + @param[out] MemoryBase Pointer to the base of a block of memory into which the buffers will be coalesced. + On output, this variable will hold the base address + of a coalesced capsule. + @param[out] MemorySize Size of the memory region pointed to by MemoryBase. + On output, this variable will contain the size of the + coalesced capsule. + + @retval EFI_NOT_FOUND If: boot mode could not be determined, or the + boot mode is not flash-update, or the capsule descriptors were not found. + @retval EFI_BUFFER_TOO_SMALL The capsule could not be coalesced in the provided memory region. + @retval EFI_SUCCESS There was no capsule, or the capsule was processed successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_CAPSULE_COALESCE)( + IN EFI_PEI_SERVICES **PeiServices, + IN OUT VOID **MemoryBase, + IN OUT UINTN *MemSize + ); + +/** + Determine if a capsule needs to be processed. + The means by which the presence of a capsule is determined is platform + specific. For example, an implementation could be driven by the presence + of a Capsule EFI Variable containing a list of EFI_CAPSULE_BLOCK_DESCRIPTOR + entries. If present, return EFI_SUCCESS, otherwise return EFI_NOT_FOUND. + + @param[in] PeiServices Pointer to the PEI Services Table. + + @retval EFI_SUCCESS If a capsule is available. + @retval EFI_NOT_FOUND No capsule detected. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_CAPSULE_CHECK_CAPSULE_UPDATE)( + IN EFI_PEI_SERVICES **PeiServices + ); + +/** + The Capsule PPI service that gets called after memory is available. The + capsule coalesce function, which must be called first, returns a base + address and size. Once the memory init PEIM has discovered memory, + it should call this function and pass in the base address and size + returned by the Coalesce() function. Then this function can create a + capsule HOB and return. + + @par Notes: + This function assumes it will not be called until the + actual capsule update. + + @param[in] PeiServices Pointer to the PEI Services Table. + @param[in] CapsuleBase Address returned by the capsule coalesce function. + @param[in] CapsuleSize Value returned by the capsule coalesce function. + + @retval EFI_VOLUME_CORRUPTED CapsuleBase does not appear to point to a + coalesced capsule. + @retval EFI_SUCCESS Capsule HOB was created successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_CAPSULE_CREATE_STATE)( + IN EFI_PEI_SERVICES **PeiServices, + IN VOID *CapsuleBase, + IN UINTN CapsuleSize + ); + +/// +/// This PPI provides several services in PEI to work with the underlying +/// capsule capabilities of the platform. These services include the ability +/// for PEI to coalesce a capsule from a scattered set of memory locations +/// into a contiguous space in memory, detect if a capsule is present for +/// processing, and once memory is available, create a HOB for the capsule. +/// +struct _EFI_PEI_CAPSULE_PPI { + EFI_PEI_CAPSULE_COALESCE Coalesce; + EFI_PEI_CAPSULE_CHECK_CAPSULE_UPDATE CheckCapsuleUpdate; + EFI_PEI_CAPSULE_CREATE_STATE CreateState; +}; + +/// +/// Keep name backwards compatible before PI Version 1.4 +/// +extern EFI_GUID gPeiCapsulePpiGuid; + +extern EFI_GUID gEfiPeiCapsulePpiGuid; + +#endif // #ifndef _PEI_CAPSULE_PPI_H_ diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/CpuIo.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/CpuIo.h new file mode 100644 index 00000000..fe700d38 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/CpuIo.h @@ -0,0 +1,422 @@ +/** @file + This PPI provides a set of memory and I/O-based services. + The perspective of the services is that of the processor, not the bus or system. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __PEI_CPUIO_PPI_H__ +#define __PEI_CPUIO_PPI_H__ + +#define EFI_PEI_CPU_IO_PPI_INSTALLED_GUID \ + { 0xe6af1f7b, 0xfc3f, 0x46da, {0xa8, 0x28, 0xa3, 0xb4, 0x57, 0xa4, 0x42, 0x82 } } + +typedef struct _EFI_PEI_CPU_IO_PPI EFI_PEI_CPU_IO_PPI; + +/// +/// EFI_PEI_CPU_IO_PPI_WIDTH. +/// +typedef enum { + EfiPeiCpuIoWidthUint8, + EfiPeiCpuIoWidthUint16, + EfiPeiCpuIoWidthUint32, + EfiPeiCpuIoWidthUint64, + EfiPeiCpuIoWidthFifoUint8, + EfiPeiCpuIoWidthFifoUint16, + EfiPeiCpuIoWidthFifoUint32, + EfiPeiCpuIoWidthFifoUint64, + EfiPeiCpuIoWidthFillUint8, + EfiPeiCpuIoWidthFillUint16, + EfiPeiCpuIoWidthFillUint32, + EfiPeiCpuIoWidthFillUint64, + EfiPeiCpuIoWidthMaximum +} EFI_PEI_CPU_IO_PPI_WIDTH; + +/** + Memory-based access services and I/O-based access services. + + @param[in] PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Width The width of the access. Enumerated in bytes. + @param[in] Address The physical address of the access. + @param[in] Count The number of accesses to perform. + @param[in, out] Buffer A pointer to the buffer of data. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NOT_YET_AVAILABLE The service has not been installed. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_MEM)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN EFI_PEI_CPU_IO_PPI_WIDTH Width, + IN UINT64 Address, + IN UINTN Count, + IN OUT VOID *Buffer + ); + +/// +/// EFI_PEI_CPU_IO_PPI_ACCESS +/// +typedef struct { + /// + /// This service provides the various modalities of memory and I/O read. + /// + EFI_PEI_CPU_IO_PPI_IO_MEM Read; + /// + /// This service provides the various modalities of memory and I/O write. + /// + EFI_PEI_CPU_IO_PPI_IO_MEM Write; +} EFI_PEI_CPU_IO_PPI_ACCESS; + +/** + 8-bit I/O read operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + + @return An 8-bit value returned from the I/O space. + +**/ +typedef +UINT8 +(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ8)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address + ); + +/** + 16-bit I/O read operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + + @return A 16-bit value returned from the I/O space. + +**/ +typedef +UINT16 +(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ16)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address + ); + +/** + 32-bit I/O read operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + + @return A 32-bit value returned from the I/O space. + +**/ +typedef +UINT32 +(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ32)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address + ); + +/** + 64-bit I/O read operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + + @return A 64-bit value returned from the I/O space. + +**/ +typedef +UINT64 +(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ64)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address + ); + +/** + 8-bit I/O write operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + @param[in] Data The data to write. + +**/ +typedef +VOID +(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE8)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address, + IN UINT8 Data + ); + +/** + 16-bit I/O write operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + @param[in] Data The data to write. + +**/ +typedef +VOID +(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE16)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address, + IN UINT16 Data + ); + +/** + 32-bit I/O write operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + @param[in] Data The data to write. + +**/ +typedef +VOID +(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE32)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address, + IN UINT32 Data + ); + +/** + 64-bit I/O write operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + @param[in] Data The data to write. + +**/ +typedef +VOID +(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE64)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address, + IN UINT64 Data + ); + +/** + 8-bit memory read operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + + @return An 8-bit value returned from the memory space. + +**/ +typedef +UINT8 +(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ8)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address + ); + +/** + 16-bit memory read operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + + @return A 16-bit value returned from the memory space. + +**/ +typedef +UINT16 +(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ16)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address + ); + +/** + 32-bit memory read operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + + @return A 32-bit value returned from the memory space. + +**/ +typedef +UINT32 +(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ32)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address + ); + +/** + 64-bit memory read operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + + @return A 64-bit value returned from the memory space. + +**/ +typedef +UINT64 +(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ64)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address + ); + +/** + 8-bit memory write operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + @param[in] Data The data to write. + +**/ +typedef +VOID +(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE8)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address, + IN UINT8 Data + ); + +/** + 16-bit memory write operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + @param[in] Data The data to write. + +**/ +typedef +VOID +(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE16)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address, + IN UINT16 Data + ); + +/** + 32-bit memory write operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + @param[in] Data The data to write. + +**/ +typedef +VOID +(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE32)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address, + IN UINT32 Data + ); + +/** + 64-bit memory write operations. + + @param[in] PeiServices An indirect pointer to the PEI Services Table published + by the PEI Foundation. + @param[in] This The pointer to local data for the interface. + @param[in] Address The physical address of the access. + @param[in] Data The data to write. + +**/ +typedef +VOID +(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE64)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_CPU_IO_PPI *This, + IN UINT64 Address, + IN UINT64 Data + ); + +/// +/// EFI_PEI_CPU_IO_PPI provides a set of memory and I/O-based services. +/// The perspective of the services is that of the processor, not that of the +/// bus or system. +/// +struct _EFI_PEI_CPU_IO_PPI { + /// + /// Collection of memory-access services. + /// + EFI_PEI_CPU_IO_PPI_ACCESS Mem; + /// + /// Collection of I/O-access services. + /// + EFI_PEI_CPU_IO_PPI_ACCESS Io; + + EFI_PEI_CPU_IO_PPI_IO_READ8 IoRead8; + EFI_PEI_CPU_IO_PPI_IO_READ16 IoRead16; + EFI_PEI_CPU_IO_PPI_IO_READ32 IoRead32; + EFI_PEI_CPU_IO_PPI_IO_READ64 IoRead64; + + EFI_PEI_CPU_IO_PPI_IO_WRITE8 IoWrite8; + EFI_PEI_CPU_IO_PPI_IO_WRITE16 IoWrite16; + EFI_PEI_CPU_IO_PPI_IO_WRITE32 IoWrite32; + EFI_PEI_CPU_IO_PPI_IO_WRITE64 IoWrite64; + + EFI_PEI_CPU_IO_PPI_MEM_READ8 MemRead8; + EFI_PEI_CPU_IO_PPI_MEM_READ16 MemRead16; + EFI_PEI_CPU_IO_PPI_MEM_READ32 MemRead32; + EFI_PEI_CPU_IO_PPI_MEM_READ64 MemRead64; + + EFI_PEI_CPU_IO_PPI_MEM_WRITE8 MemWrite8; + EFI_PEI_CPU_IO_PPI_MEM_WRITE16 MemWrite16; + EFI_PEI_CPU_IO_PPI_MEM_WRITE32 MemWrite32; + EFI_PEI_CPU_IO_PPI_MEM_WRITE64 MemWrite64; +}; + +extern EFI_GUID gEfiPeiCpuIoPpiInstalledGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Decompress.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Decompress.h new file mode 100644 index 00000000..adbe11f5 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Decompress.h @@ -0,0 +1,68 @@ +/** @file + Provides decompression services to the PEI Foundation. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __DECOMPRESS_PPI_H__ +#define __DECOMPRESS_PPI_H__ + +#define EFI_PEI_DECOMPRESS_PPI_GUID \ + { 0x1a36e4e7, 0xfab6, 0x476a, { 0x8e, 0x75, 0x69, 0x5a, 0x5, 0x76, 0xfd, 0xd7 } } + +typedef struct _EFI_PEI_DECOMPRESS_PPI EFI_PEI_DECOMPRESS_PPI; + +/** + Decompress a single compression section in a firmware file. + + Decompresses the data in a compressed section and returns it + as a series of standard PI Firmware File Sections. The + required memory is allocated from permanent memory. + + @param This Points to this instance of the + EFI_PEI_DECOMPRESS_PEI PPI. + @param InputSection Points to the compressed section. + @param OutputBuffer Holds the returned pointer to the + decompressed sections. + @param OutputSize Holds the returned size of the decompress + section streams. + + @retval EFI_SUCCESS The section was decompressed + successfully. OutputBuffer contains the + resulting data and OutputSize contains + the resulting size. + @retval EFI_OUT_OF_RESOURCES Unable to allocate sufficient + memory to hold the decompressed data. + @retval EFI_UNSUPPORTED The compression type specified + in the compression header is unsupported. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_DECOMPRESS_DECOMPRESS)( + IN CONST EFI_PEI_DECOMPRESS_PPI *This, + IN CONST EFI_COMPRESSION_SECTION *InputSection, + OUT VOID **OutputBuffer, + OUT UINTN *OutputSize +); + + +/// +/// This PPI's single member function decompresses a compression +/// encapsulated section. It is used by the PEI Foundation to +/// process sectioned files. Prior to the installation of this PPI, +/// compression sections will be ignored. +/// +struct _EFI_PEI_DECOMPRESS_PPI { + EFI_PEI_DECOMPRESS_DECOMPRESS Decompress; +}; + + +extern EFI_GUID gEfiPeiDecompressPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/DelayedDispatch.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/DelayedDispatch.h new file mode 100644 index 00000000..a51da027 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/DelayedDispatch.h @@ -0,0 +1,85 @@ +/** @file + EFI Delayed Dispatch PPI as defined in the PI 1.7 Specification + + Provide timed event service in PEI + + Copyright (c) 2020, American Megatrends International LLC. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef __DELAYED_DISPATCH_PPI_H__ +#define __DELAYED_DISPATCH_PPI_H__ + +/// +/// Global ID for EFI_DELAYED_DISPATCH_PPI_GUID +/// +#define EFI_DELAYED_DISPATCH_PPI_GUID \ + { \ + 0x869c711d, 0x649c, 0x44fe, { 0x8b, 0x9e, 0x2c, 0xbb, 0x29, 0x11, 0xc3, 0xe6} } \ + } + + +/** + Delayed Dispatch function. This routine is called sometime after the required + delay. Upon return, if NewDelay is 0, the function is unregistered. If NewDelay + is not zero, this routine will be called again after the new delay period. + + @param[in,out] Context Pointer to Context. Can be updated by routine. + @param[out] NewDelay The new delay in us. Leave at 0 to unregister callback. + +**/ + +typedef +VOID +(EFIAPI *EFI_DELAYED_DISPATCH_FUNCTION) ( + IN OUT UINT64 *Context, + OUT UINT32 *NewDelay + ); + + +/// +/// The forward declaration for EFI_DELAYED_DISPATCH_PPI +/// + +typedef struct _EFI_DELAYED_DISPATCH_PPI EFI_DELAYED_DISPATCH_PPI; + + +/** +Register a callback to be called after a minimum delay has occurred. + +This service is the single member function of the EFI_DELAYED_DISPATCH_PPI + + @param This Pointer to the EFI_DELAYED_DISPATCH_PPI instance + @param Function Function to call back + @param Context Context data + @param Delay Delay interval + + @retval EFI_SUCCESS Function successfully loaded + @retval EFI_INVALID_PARAMETER One of the Arguments is not supported + @retval EFI_OUT_OF_RESOURCES No more entries + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DELAYED_DISPATCH_REGISTER)( + IN EFI_DELAYED_DISPATCH_PPI *This, + IN EFI_DELAYED_DISPATCH_FUNCTION Function, + IN UINT64 Context, + OUT UINT32 Delay + ); + + +/// +/// This PPI is a pointer to the Delayed Dispatch Service. +/// This service will be published by the Pei Foundation. The PEI Foundation +/// will use this service to relaunch a known function that requests a delayed +/// execution. +/// +struct _EFI_DELAYED_DISPATCH_PPI { + EFI_DELAYED_DISPATCH_REGISTER Register; +}; + + +extern EFI_GUID gEfiPeiDelayedDispatchPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/DeviceRecoveryModule.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/DeviceRecoveryModule.h new file mode 100644 index 00000000..24fcc20d --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/DeviceRecoveryModule.h @@ -0,0 +1,138 @@ +/** @file + This file declares the Device Recovery Module PPI. + + The interface of this PPI does the following: + - Reports the number of recovery DXE capsules that exist on the associated device(s) + - Finds the requested firmware binary capsule + - Loads that capsule into memory + + A device can be either a group of devices, such as a block device, or an individual device. + The module determines the internal search order, with capsule number 1 as the highest load + priority and number N as the lowest priority. + + Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is defined in UEFI Platform Initialization Specification 1.2 Volume 1: + Pre-EFI Initialization Core Interface + +**/ + +#ifndef _PEI_DEVICE_RECOVERY_MODULE_PPI_H_ +#define _PEI_DEVICE_RECOVERY_MODULE_PPI_H_ + +#define EFI_PEI_DEVICE_RECOVERY_MODULE_PPI_GUID \ + { \ + 0x0DE2CE25, 0x446A, 0x45a7, {0xBF, 0xC9, 0x37, 0xDA, 0x26, 0x34, 0x4B, 0x37 } \ + } + +typedef struct _EFI_PEI_DEVICE_RECOVERY_MODULE_PPI EFI_PEI_DEVICE_RECOVERY_MODULE_PPI; + +/** + Returns the number of DXE capsules residing on the device. + + This function searches for DXE capsules from the associated device and returns + the number and maximum size in bytes of the capsules discovered. Entry 1 is + assumed to be the highest load priority and entry N is assumed to be the lowest + priority. + + @param[in] PeiServices General-purpose services that are available + to every PEIM + @param[in] This Indicates the EFI_PEI_DEVICE_RECOVERY_MODULE_PPI + instance. + @param[out] NumberRecoveryCapsules Pointer to a caller-allocated UINTN. On + output, *NumberRecoveryCapsules contains + the number of recovery capsule images + available for retrieval from this PEIM + instance. + + @retval EFI_SUCCESS One or more capsules were discovered. + @retval EFI_DEVICE_ERROR A device error occurred. + @retval EFI_NOT_FOUND A recovery DXE capsule cannot be found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_DEVICE_GET_NUMBER_RECOVERY_CAPSULE)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This, + OUT UINTN *NumberRecoveryCapsules + ); + +/** + Returns the size and type of the requested recovery capsule. + + This function gets the size and type of the capsule specified by CapsuleInstance. + + @param[in] PeiServices General-purpose services that are available to every PEIM + @param[in] This Indicates the EFI_PEI_DEVICE_RECOVERY_MODULE_PPI + instance. + @param[in] CapsuleInstance Specifies for which capsule instance to retrieve + the information. This parameter must be between + one and the value returned by GetNumberRecoveryCapsules() + in NumberRecoveryCapsules. + @param[out] Size A pointer to a caller-allocated UINTN in which + the size of the requested recovery module is + returned. + @param[out] CapsuleType A pointer to a caller-allocated EFI_GUID in which + the type of the requested recovery capsule is + returned. The semantic meaning of the value + returned is defined by the implementation. + + @retval EFI_SUCCESS One or more capsules were discovered. + @retval EFI_DEVICE_ERROR A device error occurred. + @retval EFI_NOT_FOUND A recovery DXE capsule cannot be found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_DEVICE_GET_RECOVERY_CAPSULE_INFO)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This, + IN UINTN CapsuleInstance, + OUT UINTN *Size, + OUT EFI_GUID *CapsuleType + ); + +/** + Loads a DXE capsule from some media into memory. + + This function, by whatever mechanism, retrieves a DXE capsule from some device + and loads it into memory. Note that the published interface is device neutral. + + @param[in] PeiServices General-purpose services that are available + to every PEIM + @param[in] This Indicates the EFI_PEI_DEVICE_RECOVERY_MODULE_PPI + instance. + @param[in] CapsuleInstance Specifies which capsule instance to retrieve. + @param[out] Buffer Specifies a caller-allocated buffer in which + the requested recovery capsule will be returned. + + @retval EFI_SUCCESS The capsule was loaded correctly. + @retval EFI_DEVICE_ERROR A device error occurred. + @retval EFI_NOT_FOUND A requested recovery DXE capsule cannot be found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_DEVICE_LOAD_RECOVERY_CAPSULE)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This, + IN UINTN CapsuleInstance, + OUT VOID *Buffer + ); + +/// +/// Presents a standard interface to EFI_PEI_DEVICE_RECOVERY_MODULE_PPI, +/// regardless of the underlying device(s). +/// +struct _EFI_PEI_DEVICE_RECOVERY_MODULE_PPI { + EFI_PEI_DEVICE_GET_NUMBER_RECOVERY_CAPSULE GetNumberRecoveryCapsules; ///< Returns the number of DXE capsules residing on the device. + EFI_PEI_DEVICE_GET_RECOVERY_CAPSULE_INFO GetRecoveryCapsuleInfo; ///< Returns the size and type of the requested recovery capsule. + EFI_PEI_DEVICE_LOAD_RECOVERY_CAPSULE LoadRecoveryCapsule; ///< Loads a DXE capsule from some media into memory. +}; + +extern EFI_GUID gEfiPeiDeviceRecoveryModulePpiGuid; + +#endif /* _PEI_DEVICE_RECOVERY_MODULE_PPI_H_ */ diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/DxeIpl.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/DxeIpl.h new file mode 100644 index 00000000..512a0f63 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/DxeIpl.h @@ -0,0 +1,66 @@ +/** @file + This file declares DXE Initial Program Load PPI. + When the PEI core is done it calls the DXE IPL PPI to load the DXE Foundation. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __DXE_IPL_H__ +#define __DXE_IPL_H__ + +#define EFI_DXE_IPL_PPI_GUID \ + { \ + 0xae8ce5d, 0xe448, 0x4437, {0xa8, 0xd7, 0xeb, 0xf5, 0xf1, 0x94, 0xf7, 0x31 } \ + } + +typedef struct _EFI_DXE_IPL_PPI EFI_DXE_IPL_PPI; + +/** + The architectural PPI that the PEI Foundation invokes when + there are no additional PEIMs to invoke. + + This function is invoked by the PEI Foundation. + The PEI Foundation will invoke this service when there are + no additional PEIMs to invoke in the system. + If this PPI does not exist, it is an error condition and + an ill-formed firmware set. The DXE IPL PPI should never + return after having been invoked by the PEI Foundation. + The DXE IPL PPI can do many things internally, including the following: + - Invoke the DXE entry point from a firmware volume + - Invoke the recovery processing modules + - Invoke the S3 resume modules + + @param This Pointer to the DXE IPL PPI instance + @param PeiServices Pointer to the PEI Services Table. + @param HobList Pointer to the list of Hand-Off Block (HOB) entries. + + @retval EFI_SUCCESS Upon this return code, the PEI Foundation should enter + some exception handling.Under normal circumstances, + the DXE IPL PPI should not return. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DXE_IPL_ENTRY)( + IN CONST EFI_DXE_IPL_PPI *This, + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_HOB_POINTERS HobList + ); + +/// +/// Final service to be invoked by the PEI Foundation. +/// The DXE IPL PPI is responsible for locating and loading the DXE Foundation. +/// The DXE IPL PPI may use PEI services to locate and load the DXE Foundation. +/// +struct _EFI_DXE_IPL_PPI { + EFI_DXE_IPL_ENTRY Entry; +}; + +extern EFI_GUID gEfiDxeIplPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/EndOfPeiPhase.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/EndOfPeiPhase.h new file mode 100644 index 00000000..99b4cbee --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/EndOfPeiPhase.h @@ -0,0 +1,25 @@ +/** @file + This PPI will be installed at the end of PEI for all boot paths, including + normal, recovery, and S3. It allows for PEIMs to possibly quiesce hardware, + build handoff information for the next phase of execution, + or provide some terminal processing behavior. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __END_OF_PEI_PHASE_PPI_H__ +#define __END_OF_PEI_PHASE_PPI_H__ + +#define EFI_PEI_END_OF_PEI_PHASE_PPI_GUID \ + { \ + 0x605EA650, 0xC65C, 0x42e1, {0xBA, 0x80, 0x91, 0xA5, 0x2A, 0xB6, 0x18, 0xC6 } \ + } + +extern EFI_GUID gEfiEndOfPeiSignalPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolume.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolume.h new file mode 100644 index 00000000..29668658 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolume.h @@ -0,0 +1,288 @@ +/** @file + This file provides functions for accessing a memory-mapped firmware volume of a specific format. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is from PI Version 1.0 errata. + +**/ + +#ifndef __FIRMWARE_VOLUME_PPI_H__ +#define __FIRMWARE_VOLUME_PPI_H__ + +/// +/// The GUID for this PPI is the same as the firmware volume format GUID. +/// The FV format can be EFI_FIRMWARE_FILE_SYSTEM2_GUID or the GUID for a user-defined +/// format. The EFI_FIRMWARE_FILE_SYSTEM2_GUID is the PI Firmware Volume format. +/// +typedef struct _EFI_PEI_FIRMWARE_VOLUME_PPI EFI_PEI_FIRMWARE_VOLUME_PPI; + + +/** + Process a firmware volume and create a volume handle. + + Create a volume handle from the information in the buffer. For + memory-mapped firmware volumes, Buffer and BufferSize refer to + the start of the firmware volume and the firmware volume size. + For non memory-mapped firmware volumes, this points to a + buffer which contains the necessary information for creating + the firmware volume handle. Normally, these values are derived + from the EFI_FIRMWARE_VOLUME_INFO_PPI. + + + @param This Points to this instance of the + EFI_PEI_FIRMWARE_VOLUME_PPI. + @param Buffer Points to the start of the buffer. + @param BufferSize Size of the buffer. + @param FvHandle Points to the returned firmware volume + handle. The firmware volume handle must + be unique within the system. + + @retval EFI_SUCCESS Firmware volume handle created. + @retval EFI_VOLUME_CORRUPTED Volume was corrupt. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_FV_PROCESS_FV)( + IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, + IN VOID *Buffer, + IN UINTN BufferSize, + OUT EFI_PEI_FV_HANDLE *FvHandle +); + +/** + Finds the next file of the specified type. + + This service enables PEI modules to discover additional firmware files. + The FileHandle must be unique within the system. + + @param This Points to this instance of the + EFI_PEI_FIRMWARE_VOLUME_PPI. + @param SearchType A filter to find only files of this type. Type + EFI_FV_FILETYPE_ALL causes no filtering to be + done. + @param FvHandle Handle of firmware volume in which to + search. + @param FileHandle Points to the current handle from which to + begin searching or NULL to start at the + beginning of the firmware volume. Updated + upon return to reflect the file found. + + @retval EFI_SUCCESS The file was found. + @retval EFI_NOT_FOUND The file was not found. FileHandle contains NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_FV_FIND_FILE_TYPE)( + IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, + IN EFI_FV_FILETYPE SearchType, + IN EFI_PEI_FV_HANDLE FvHandle, + IN OUT EFI_PEI_FILE_HANDLE *FileHandle +); + + +/** + Find a file within a volume by its name. + + This service searches for files with a specific name, within + either the specified firmware volume or all firmware volumes. + + @param This Points to this instance of the + EFI_PEI_FIRMWARE_VOLUME_PPI. + @param FileName A pointer to the name of the file to find + within the firmware volume. + @param FvHandle Upon entry, the pointer to the firmware + volume to search or NULL if all firmware + volumes should be searched. Upon exit, the + actual firmware volume in which the file was + found. + @param FileHandle Upon exit, points to the found file's + handle or NULL if it could not be found. + + @retval EFI_SUCCESS File was found. + @retval EFI_NOT_FOUND File was not found. + @retval EFI_INVALID_PARAMETER FvHandle or FileHandle or + FileName was NULL. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_FV_FIND_FILE_NAME)( + IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, + IN CONST EFI_GUID *FileName, + IN EFI_PEI_FV_HANDLE *FvHandle, + OUT EFI_PEI_FILE_HANDLE *FileHandle +); + + +/** + Returns information about a specific file. + + This function returns information about a specific + file, including its file name, type, attributes, starting + address and size. + + @param This Points to this instance of the + EFI_PEI_FIRMWARE_VOLUME_PPI. + @param FileHandle Handle of the file. + @param FileInfo Upon exit, points to the file's + information. + + @retval EFI_SUCCESS File information returned. + @retval EFI_INVALID_PARAMETER If FileHandle does not + represent a valid file. + @retval EFI_INVALID_PARAMETER If FileInfo is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_FV_GET_FILE_INFO)( + IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, + IN EFI_PEI_FILE_HANDLE FileHandle, + OUT EFI_FV_FILE_INFO *FileInfo +); + +/** + Returns information about a specific file. + + This function returns information about a specific + file, including its file name, type, attributes, starting + address, size and authentication status. + + @param This Points to this instance of the + EFI_PEI_FIRMWARE_VOLUME_PPI. + @param FileHandle Handle of the file. + @param FileInfo Upon exit, points to the file's + information. + + @retval EFI_SUCCESS File information returned. + @retval EFI_INVALID_PARAMETER If FileHandle does not + represent a valid file. + @retval EFI_INVALID_PARAMETER If FileInfo is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_FV_GET_FILE_INFO2)( + IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, + IN EFI_PEI_FILE_HANDLE FileHandle, + OUT EFI_FV_FILE_INFO2 *FileInfo +); + +/** + This function returns information about the firmware volume. + + @param This Points to this instance of the + EFI_PEI_FIRMWARE_VOLUME_PPI. + @param FvHandle Handle to the firmware handle. + @param VolumeInfo Points to the returned firmware volume + information. + + @retval EFI_SUCCESS Information returned successfully. + @retval EFI_INVALID_PARAMETER FvHandle does not indicate a valid + firmware volume or VolumeInfo is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_FV_GET_INFO)( + IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, + IN EFI_PEI_FV_HANDLE FvHandle, + OUT EFI_FV_INFO *VolumeInfo +); + +/** + Find the next matching section in the firmware file. + + This service enables PEI modules to discover sections + of a given type within a valid file. + + @param This Points to this instance of the + EFI_PEI_FIRMWARE_VOLUME_PPI. + @param SearchType A filter to find only sections of this + type. + @param FileHandle Handle of firmware file in which to + search. + @param SectionData Updated upon return to point to the + section found. + + @retval EFI_SUCCESS Section was found. + @retval EFI_NOT_FOUND Section of the specified type was not + found. SectionData contains NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_FV_FIND_SECTION)( + IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, + IN EFI_SECTION_TYPE SearchType, + IN EFI_PEI_FILE_HANDLE FileHandle, + OUT VOID **SectionData +); + +/** + Find the next matching section in the firmware file. + + This service enables PEI modules to discover sections + of a given instance and type within a valid file. + + @param This Points to this instance of the + EFI_PEI_FIRMWARE_VOLUME_PPI. + @param SearchType A filter to find only sections of this + type. + @param SearchInstance A filter to find the specific instance + of sections. + @param FileHandle Handle of firmware file in which to + search. + @param SectionData Updated upon return to point to the + section found. + @param AuthenticationStatus Updated upon return to point to the + authentication status for this section. + + @retval EFI_SUCCESS Section was found. + @retval EFI_NOT_FOUND Section of the specified type was not + found. SectionData contains NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_FV_FIND_SECTION2)( + IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, + IN EFI_SECTION_TYPE SearchType, + IN UINTN SearchInstance, + IN EFI_PEI_FILE_HANDLE FileHandle, + OUT VOID **SectionData, + OUT UINT32 *AuthenticationStatus +); + +#define EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE SIGNATURE_32 ('P', 'F', 'V', 'P') +#define EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION 0x00010030 + +/// +/// This PPI provides functions for accessing a memory-mapped firmware volume of a specific format. +/// +struct _EFI_PEI_FIRMWARE_VOLUME_PPI { + EFI_PEI_FV_PROCESS_FV ProcessVolume; + EFI_PEI_FV_FIND_FILE_TYPE FindFileByType; + EFI_PEI_FV_FIND_FILE_NAME FindFileByName; + EFI_PEI_FV_GET_FILE_INFO GetFileInfo; + EFI_PEI_FV_GET_INFO GetVolumeInfo; + EFI_PEI_FV_FIND_SECTION FindSectionByType; + EFI_PEI_FV_GET_FILE_INFO2 GetFileInfo2; + EFI_PEI_FV_FIND_SECTION2 FindSectionByType2; + /// + /// Signature is used to keep backward-compatibility, set to {'P','F','V','P'}. + /// + UINT32 Signature; + /// + /// Revision for further extension. + /// + UINT32 Revision; +}; + +extern EFI_GUID gEfiPeiFirmwareVolumePpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolumeInfo.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolumeInfo.h new file mode 100644 index 00000000..e10b9c4a --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolumeInfo.h @@ -0,0 +1,62 @@ +/** @file + This file provides location and format of a firmware volume. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __EFI_PEI_FIRMWARE_VOLUME_INFO_H__ +#define __EFI_PEI_FIRMWARE_VOLUME_INFO_H__ + + + +#define EFI_PEI_FIRMWARE_VOLUME_INFO_PPI_GUID \ +{ 0x49edb1c1, 0xbf21, 0x4761, { 0xbb, 0x12, 0xeb, 0x0, 0x31, 0xaa, 0xbb, 0x39 } } + +typedef struct _EFI_PEI_FIRMWARE_VOLUME_INFO_PPI EFI_PEI_FIRMWARE_VOLUME_INFO_PPI; + +/// +/// This PPI describes the location and format of a firmware volume. +/// The FvFormat can be EFI_FIRMWARE_FILE_SYSTEM2_GUID or the GUID for +/// a user-defined format. The EFI_FIRMWARE_FILE_SYSTEM2_GUID is +/// the PI Firmware Volume format. +/// +struct _EFI_PEI_FIRMWARE_VOLUME_INFO_PPI { + /// + /// Unique identifier of the format of the memory-mapped firmware volume. + /// + EFI_GUID FvFormat; + /// + /// Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to process + /// the volume. The format of this buffer is specific to the FvFormat. + /// For memory-mapped firmware volumes, this typically points to the first byte + /// of the firmware volume. + /// + VOID *FvInfo; + /// + /// Size of the data provided by FvInfo. For memory-mapped firmware volumes, + /// this is typically the size of the firmware volume. + /// + UINT32 FvInfoSize; + /// + /// If the firmware volume originally came from a firmware file, then these + /// point to the parent firmware volume name and firmware volume file. + /// If it did not originally come from a firmware file, these should be NULL. + /// + EFI_GUID *ParentFvName; + /// + /// If the firmware volume originally came from a firmware file, then these + /// point to the parent firmware volume name and firmware volume file. + /// If it did not originally come from a firmware file, these should be NULL. + /// + EFI_GUID *ParentFileName; +}; + +extern EFI_GUID gEfiPeiFirmwareVolumeInfoPpiGuid; + +#endif + diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolumeInfo2.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolumeInfo2.h new file mode 100644 index 00000000..f7b9cde9 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolumeInfo2.h @@ -0,0 +1,66 @@ +/** @file + This file provides location, format and authentication status of a firmware volume. + + Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.3 errata. + +**/ + +#ifndef __EFI_PEI_FIRMWARE_VOLUME_INFO2_H__ +#define __EFI_PEI_FIRMWARE_VOLUME_INFO2_H__ + + + +#define EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI_GUID \ +{ 0xea7ca24b, 0xded5, 0x4dad, { 0xa3, 0x89, 0xbf, 0x82, 0x7e, 0x8f, 0x9b, 0x38 } } + +typedef struct _EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI; + +/// +/// This PPI describes the location and format of a firmware volume. +/// The FvFormat can be EFI_FIRMWARE_FILE_SYSTEM2_GUID or the GUID for +/// a user-defined format. The EFI_FIRMWARE_FILE_SYSTEM2_GUID is +/// the PI Firmware Volume format. +/// +struct _EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI { + /// + /// Unique identifier of the format of the memory-mapped firmware volume. + /// + EFI_GUID FvFormat; + /// + /// Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to process + /// the volume. The format of this buffer is specific to the FvFormat. + /// For memory-mapped firmware volumes, this typically points to the first byte + /// of the firmware volume. + /// + VOID *FvInfo; + /// + /// Size of the data provided by FvInfo. For memory-mapped firmware volumes, + /// this is typically the size of the firmware volume. + /// + UINT32 FvInfoSize; + /// + /// If the firmware volume originally came from a firmware file, then these + /// point to the parent firmware volume name and firmware volume file. + /// If it did not originally come from a firmware file, these should be NULL. + /// + EFI_GUID *ParentFvName; + /// + /// If the firmware volume originally came from a firmware file, then these + /// point to the parent firmware volume name and firmware volume file. + /// If it did not originally come from a firmware file, these should be NULL. + /// + EFI_GUID *ParentFileName; + /// + /// Authentication Status. + /// + UINT32 AuthenticationStatus; +}; + +extern EFI_GUID gEfiPeiFirmwareVolumeInfo2PpiGuid; + +#endif + diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Graphics.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Graphics.h new file mode 100644 index 00000000..d1fca789 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Graphics.h @@ -0,0 +1,79 @@ +/** @file + This file declares Graphics PPI. + This PPI is the main interface exposed by the Graphics PEIM to be used by the + other firmware modules. + + Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.4. + +**/ + +#ifndef __PEI_GRAPHICS_PPI_H__ +#define __PEI_GRAPHICS_PPI_H__ + +#include <Protocol/GraphicsOutput.h> + +#define EFI_PEI_GRAPHICS_PPI_GUID \ + { \ + 0x6ecd1463, 0x4a4a, 0x461b, { 0xaf, 0x5f, 0x5a, 0x33, 0xe3, 0xb2, 0x16, 0x2b } \ + } + +typedef struct _EFI_PEI_GRAPHICS_PPI EFI_PEI_GRAPHICS_PPI; + +/** + The GraphicsPpiInit initializes the graphics subsystem in phases. + + @param[in] GraphicsPolicyPtr GraphicsPolicyPtr points to a configuration data + block of policy settings required by Graphics PEIM. + + @retval EFI_SUCCESS The invocation was successful. + @retval EFI_INVALID_PARAMETER The phase parameter is not valid. + @retval EFI_NOT_ABORTED The stages was not called in the proper order. + @retval EFI_NOT_FOUND The PeiGraphicsPlatformPolicyPpi is not located. + @retval EFI_DEVICE_ERROR The initialization failed due to device error. + @retval EFI_NOT_READY The previous init stage is still in progress and not + ready for the current initialization phase yet. The + platform code should call this again sometime later. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_GRAPHICS_INIT) ( + IN VOID *GraphicsPolicyPtr + ); + +/** + The GraphicsPpiGetMode returns the mode information supported by the Graphics PEI + Module. + + @param[in, out] Mode Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data. + + @retval EFI_SUCCESS Valid mode information was returned. + @retval EFI_INVALID_PARAMETER The Mode parameter is not valid. + @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video + mode. + @retval EFI_NOT_READY The Graphics Initialization is not competed and Mode + information is not yet available.The platform code + should call this again after the Graphics + initialization is done. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_GRAPHICS_GET_MODE) ( + IN OUT EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode + ); + +/// +/// This PPI is the main interface exposed by the Graphics PEIM to be used by the other +/// firmware modules. +/// +struct _EFI_PEI_GRAPHICS_PPI { + EFI_PEI_GRAPHICS_INIT GraphicsPpiInit; + EFI_PEI_GRAPHICS_GET_MODE GraphicsPpiGetMode; +}; + +extern EFI_GUID gEfiPeiGraphicsPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/GuidedSectionExtraction.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/GuidedSectionExtraction.h new file mode 100644 index 00000000..3ac65038 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/GuidedSectionExtraction.h @@ -0,0 +1,98 @@ +/** @file + If a GUID-defined section is encountered when doing section extraction, + the PEI Foundation or the EFI_PEI_FILE_LOADER_PPI instance + calls the appropriate instance of the GUIDed Section Extraction PPI + to extract the section stream contained therein. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __EFI_GUIDED_SECTION_EXTRACTION_PPI_H__ +#define __EFI_GUIDED_SECTION_EXTRACTION_PPI_H__ + +// +// Typically, protocol interface structures are identified +// by associating them with a GUID. Each instance of +// a protocol with a given GUID must have +// the same interface structure. While all instances of +// the GUIDed Section Extraction PPI must have +// the same interface structure, they do not all have +// te same GUID. The GUID that is associated with +// an instance of the GUIDed Section Extraction Protocol +// is used to correlate it with the GUIDed section type +// that it is intended to process. +// + + +typedef struct _EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI; + + +/** + Processes the input section and returns the data contained therein + along with the authentication status. + + The ExtractSection() function processes the input section and + returns a pointer to the section contents. If the section being + extracted does not require processing (if the section + GuidedSectionHeader.Attributes has the + EFI_GUIDED_SECTION_PROCESSING_REQUIRED field cleared), then + OutputBuffer is just updated to point to the start of the + section's contents. Otherwise, *Buffer must be allocated + from PEI permanent memory. + + @param This Indicates the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI + instance. + @param InputSection Buffer containing the input GUIDed section to be + processed. + @param OutputBuffer *OutputBuffer is allocated from PEI permanent memory + and contains the new section stream. + @param OutputSize A pointer to a caller-allocated UINTN in which + the size of *OutputBuffer allocation is stored. + If the function returns anything other than + EFI_SUCCESS, the value of *OutputSize is undefined. + @param AuthenticationStatus A pointer to a caller-allocated UINT32 that indicates + the authentication status of the output buffer. + If the input section's + GuidedSectionHeader.Attributes field has the + EFI_GUIDED_SECTION_AUTH_STATUS_VALID bit as clear, + *AuthenticationStatus must return zero. These bits + reflect the status of the extraction operation. + If the function returns anything other than EFI_SUCCESS, + the value of *AuthenticationStatus is undefined. + + @retval EFI_SUCCESS The InputSection was successfully processed and the + section contents were returned. + @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process the request. + @retval EFI_INVALID_PARAMETER The GUID in InputSection does not match this instance of the + GUIDed Section Extraction PPI. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_EXTRACT_GUIDED_SECTION)( + IN CONST EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI *This, + IN CONST VOID *InputSection, + OUT VOID **OutputBuffer, + OUT UINTN *OutputSize, + OUT UINT32 *AuthenticationStatus +); + +/// +/// If a GUID-defined section is encountered when doing section extraction, +/// the PEI Foundation or the EFI_PEI_FILE_LOADER_PPI instance +/// calls the appropriate instance of the GUIDed Section +/// Extraction PPI to extract the section stream contained +/// therein. +/// +struct _EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI { + EFI_PEI_EXTRACT_GUIDED_SECTION ExtractSection; +}; + + + +#endif + diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/I2cMaster.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/I2cMaster.h new file mode 100644 index 00000000..e6d14503 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/I2cMaster.h @@ -0,0 +1,102 @@ +/** @file + This PPI manipulates the I2C host controller to perform transactions as a master + on the I2C bus using the current state of any switches or multiplexers in the I2C bus. + + Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.3. + +**/ + +#ifndef __I2C_MASTER_PPI_H__ +#define __I2C_MASTER_PPI_H__ + +#include <Pi/PiI2c.h> + +#define EFI_PEI_I2C_MASTER_PPI_GUID \ + { 0xb3bfab9b, 0x9f9c, 0x4e8b, { 0xad, 0x37, 0x7f, 0x8c, 0x51, 0xfc, 0x62, 0x80 }} + +typedef struct _EFI_PEI_I2C_MASTER_PPI EFI_PEI_I2C_MASTER_PPI; + +/** + Set the frequency for the I2C clock line. + + @param This Pointer to an EFI_PEI_I2C_MASTER_PPI structure. + @param BusClockHertz Pointer to the requested I2C bus clock frequency in Hertz. + Upon return this value contains the actual frequency + in use by the I2C controller. + + @retval EFI_SUCCESS The bus frequency was set successfully. + @retval EFI_INVALID_PARAMETER BusClockHertz is NULL + @retval EFI_UNSUPPORTED The controller does not support this frequency. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_I2C_MASTER_PPI_SET_BUS_FREQUENCY) ( + IN EFI_PEI_I2C_MASTER_PPI *This, + IN UINTN *BusClockHertz + ); + +/** + Reset the I2C controller and configure it for use. + + @param This Pointer to an EFI_PEI_I2C_MASTER_PPI structure. + + @retval EFI_SUCCESS The reset completed successfully. + @retval EFI_DEVICE_ERROR The reset operation failed. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_I2C_MASTER_PPI_RESET) ( + IN CONST EFI_PEI_I2C_MASTER_PPI *This + ); + +/** + Start an I2C transaction on the host controller. + + @param This Pointer to an EFI_PEI_I2C_MASTER_PPI structure. + @param SlaveAddress Address of the device on the I2C bus. + Set the I2C_ADDRESSING_10_BIT when using 10-bit addresses, + clear this bit for 7-bit addressing. + Bits 0-6 are used for 7-bit I2C slave addresses and + bits 0-9 are used for 10-bit I2C slave addresses. + @param RequestPacket Pointer to an EFI_I2C_REQUEST_PACKET structure describing the I2C transaction. + + @retval EFI_SUCCESS The transaction completed successfully. + @retval EFI_BAD_BUFFER_SIZE The RequestPacket->LengthInBytes value is too large. + @retval EFI_DEVICE_ERROR There was an I2C error (NACK) during the transaction. + @retval EFI_INVALID_PARAMETER RequestPacket is NULL + @retval EFI_NO_RESPONSE The I2C device is not responding to the slave address. + EFI_DEVICE_ERROR will be returned if the controller cannot distinguish when the NACK occurred. + @retval EFI_NOT_FOUND Reserved bit set in the SlaveAddress parameter + @retval EFI_OUT_OF_RESOURCES Insufficient memory for I2C transaction + @retval EFI_UNSUPPORTED The controller does not support the requested transaction. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_I2C_MASTER_PPI_START_REQUEST) ( + IN CONST EFI_PEI_I2C_MASTER_PPI *This, + IN UINTN SlaveAddress, + IN EFI_I2C_REQUEST_PACKET *RequestPacket + ); + +/// +/// This PPI manipulates the I2C host controller to perform transactions as a master on the I2C bus +/// using the current state of any switches or multiplexers in the I2C bus. +/// +struct _EFI_PEI_I2C_MASTER_PPI { + EFI_PEI_I2C_MASTER_PPI_SET_BUS_FREQUENCY SetBusFrequency; + EFI_PEI_I2C_MASTER_PPI_RESET Reset; + EFI_PEI_I2C_MASTER_PPI_START_REQUEST StartRequest; + CONST EFI_I2C_CONTROLLER_CAPABILITIES *I2cControllerCapabilities; + EFI_GUID Identifier; +}; + +extern EFI_GUID gEfiPeiI2cMasterPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/IsaHc.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/IsaHc.h new file mode 100644 index 00000000..2cbcce28 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/IsaHc.h @@ -0,0 +1,113 @@ +/** @file + This PPI opens or closes an I/O aperture in a ISA HOST controller. + + Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is from PI Version 1.2.1. + +**/ + +#ifndef __ISA_HC_PPI_H__ +#define __ISA_HC_PPI_H__ + +#define EFI_ISA_HC_PPI_GUID \ + { \ + 0x8d48bd70, 0xc8a3, 0x4c06, {0x90, 0x1b, 0x74, 0x79, 0x46, 0xaa, 0xc3, 0x58} \ + } + +typedef struct _EFI_ISA_HC_PPI EFI_ISA_HC_PPI; +typedef struct _EFI_ISA_HC_PPI *PEFI_ISA_HC_PPI; + +/** + Open I/O aperture. + + This function opens an I/O aperture in a ISA Host Controller for the I/O + addresses specified by IoAddress to IoAddress + IoLength - 1. It is possible + that more than one caller may be assigned to the same aperture. + It may be possible that a single hardware aperture may be used for more than + one device. This function tracks the number of times that each aperture is + referenced, and does not close the hardware aperture (via CloseIoAperture()) + until there are no more references to it. + + @param This A pointer to this instance of the EFI_ISA_HC_PPI. + @param IoAddress An unsigned integer that specifies the first byte of + the I/O space required. + @param IoLength An unsigned integer that specifies the number of + bytes of the I/O space required. + @param IoApertureHandle A pointer to the returned I/O aperture handle. + This value can be used on subsequent calls to CloseIoAperture(). + + @retval EFI_SUCCESS The I/O aperture was opened successfully. + @retval EFI_UNSUPPORTED The ISA Host Controller is a subtractive-decode controller. + @retval EFI_OUT_OF_RESOURCES There is no available I/O aperture. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_ISA_HC_OPEN_IO) ( + IN CONST EFI_ISA_HC_PPI *This, + IN UINT16 IoAddress, + IN UINT16 IoLength, + OUT UINT64 *IoApertureHandle + ); + +/** + Close I/O aperture. + + This function closes a previously opened I/O aperture handle. If there are no + more I/O aperture handles that refer to the hardware I/O aperture resource, + then the hardware I/O aperture is closed. + It may be possible that a single hardware aperture may be used for more than + one device. This function tracks the number of times that each aperture is + referenced, and does not close the hardware aperture (via CloseIoAperture()) + until there are no more references to it. + + @param This A pointer to this instance of the EFI_ISA_HC_PPI. + @param IoApertureHandle The I/O aperture handle previously returned from a + call to OpenIoAperture(). + + @retval EFI_SUCCESS The I/O aperture was closed successfully. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_ISA_HC_CLOSE_IO) ( + IN CONST EFI_ISA_HC_PPI *This, + IN UINT64 IoApertureHandle + ); + +/// +/// This PPI provides functions for opening or closing an I/O aperture. +/// +struct _EFI_ISA_HC_PPI { + /// + /// An unsigned integer that specifies the version of the PPI structure. + /// + UINT32 Version; + /// + /// The address of the ISA/LPC Bridge device. + /// For PCI, this is the segment, bus, device and function of the a ISA/LPC + /// Bridge device. + /// + /// If bits 24-31 are 0, then the definition is: + /// Bits 0:2 - Function + /// Bits 3-7 - Device + /// Bits 8:15 - Bus + /// Bits 16-23 - Segment + /// Bits 24-31 - Bus Type + /// If bits 24-31 are 0xff, then the definition is platform-specific. + /// + UINT32 Address; + /// + /// Opens an aperture on a positive-decode ISA Host Controller. + /// + EFI_PEI_ISA_HC_OPEN_IO OpenIoAperture; + /// + /// Closes an aperture on a positive-decode ISA Host Controller. + /// + EFI_PEI_ISA_HC_CLOSE_IO CloseIoAperture; +}; + +extern EFI_GUID gEfiIsaHcPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/LoadFile.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/LoadFile.h new file mode 100644 index 00000000..3bedf9ab --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/LoadFile.h @@ -0,0 +1,71 @@ +/** @file + Load image file from fv to memory. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __LOAD_FILE_PPI_H__ +#define __LOAD_FILE_PPI_H__ + +#define EFI_PEI_LOAD_FILE_PPI_GUID \ + { 0xb9e0abfe, 0x5979, 0x4914, { 0x97, 0x7f, 0x6d, 0xee, 0x78, 0xc2, 0x78, 0xa6 } } + + +typedef struct _EFI_PEI_LOAD_FILE_PPI EFI_PEI_LOAD_FILE_PPI; + +/** + Loads a PEIM into memory for subsequent execution. + + This service is the single member function of EFI_LOAD_FILE_PPI. + This service separates image loading and relocating from the PEI Foundation. + + @param This Interface pointer that implements + the Load File PPI instance. + @param FileHandle File handle of the file to load. + @param ImageAddress Pointer to the address of the loaded image. + @param ImageSize Pointer to the size of the loaded image. + @param EntryPoint Pointer to the entry point of the image. + @param AuthenticationState On exit, points to the attestation + authentication state of the image + or 0 if no attestation was performed. + + @retval EFI_SUCCESS The image was loaded successfully. + @retval EFI_OUT_OF_RESOURCES There was not enough memory. + @retval EFI_LOAD_ERROR There was no supported image in the file. + @retval EFI_INVALID_PARAMETER FileHandle was not a valid firmware file handle. + @retval EFI_INVALID_PARAMETER EntryPoint was NULL. + @retval EFI_UNSUPPORTED An image requires relocations or is not + memory mapped. + @retval EFI_WARN_BUFFER_TOO_SMALL + There is not enough heap to allocate the requested size. + This will not prevent the XIP image from being invoked. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_LOAD_FILE)( + IN CONST EFI_PEI_LOAD_FILE_PPI *This, + IN EFI_PEI_FILE_HANDLE FileHandle, + OUT EFI_PHYSICAL_ADDRESS *ImageAddress, + OUT UINT64 *ImageSize, + OUT EFI_PHYSICAL_ADDRESS *EntryPoint, + OUT UINT32 *AuthenticationState +); + +/// +/// This PPI is a pointer to the Load File service. +/// This service will be published by a PEIM. The PEI Foundation +/// will use this service to launch the known PEI module images. +/// +struct _EFI_PEI_LOAD_FILE_PPI { + EFI_PEI_LOAD_FILE LoadFile; +}; + +extern EFI_GUID gEfiPeiLoadFilePpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/LoadImage.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/LoadImage.h new file mode 100644 index 00000000..4077eb42 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/LoadImage.h @@ -0,0 +1,46 @@ +/** @file + The file describes the PPI which notifies other drivers + of the PEIM being initialized by the PEI Dispatcher. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __LOADED_IMAGE_PPI_H__ +#define __LOADED_IMAGE_PPI_H__ + +#define EFI_PEI_LOADED_IMAGE_PPI_GUID \ + { 0xc1fcd448, 0x6300, 0x4458, { 0xb8, 0x64, 0x28, 0xdf, 0x1, 0x53, 0x64, 0xbc } } + + +typedef struct _EFI_PEI_LOADED_IMAGE_PPI EFI_PEI_LOADED_IMAGE_PPI; + +/// +/// This interface is installed by the PEI Dispatcher after the image has been +/// loaded and after all security checks have been performed, +/// to notify other PEIMs of the files which are being loaded. +/// +struct _EFI_PEI_LOADED_IMAGE_PPI { + /// + /// Address of the image at the address where it will be executed. + /// + EFI_PHYSICAL_ADDRESS ImageAddress; + /// + /// Size of the image as it will be executed. + /// + UINT64 ImageSize; + /// + /// File handle from which the image was loaded. + /// Can be NULL, indicating the image was not loaded from a handle. + /// + EFI_PEI_FILE_HANDLE FileHandle; +}; + + +extern EFI_GUID gEfiPeiLoadedImagePpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MasterBootMode.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MasterBootMode.h new file mode 100644 index 00000000..d3d4b7e7 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MasterBootMode.h @@ -0,0 +1,26 @@ +/** @file + This file declares Boot Mode PPI. + + The Master Boot Mode PPI is installed by a PEIM to signal that a final + boot has been determined and set. This signal is useful in that PEIMs + with boot-mode-specific behavior can put this PPI in their dependency expression. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __MASTER_BOOT_MODE_PPI_H__ +#define __MASTER_BOOT_MODE_PPI_H__ + +#define EFI_PEI_MASTER_BOOT_MODE_PEIM_PPI \ + { \ + 0x7408d748, 0xfc8c, 0x4ee6, {0x92, 0x88, 0xc4, 0xbe, 0xc0, 0x92, 0xa4, 0x10 } \ + } + +extern EFI_GUID gEfiPeiMasterBootModePpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MemoryDiscovered.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MemoryDiscovered.h new file mode 100644 index 00000000..0109a215 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MemoryDiscovered.h @@ -0,0 +1,26 @@ +/** @file + This file declares Memory Discovered PPI. + + This PPI is published by the PEI Foundation when the main memory is installed. + It is essentially a PPI with no associated interface. Its purpose is to be used + as a signal for other PEIMs who can register for a notification on its installation. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __PEI_MEMORY_DISCOVERED_PPI_H__ +#define __PEI_MEMORY_DISCOVERED_PPI_H__ + +#define EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID \ + { \ + 0xf894643d, 0xc449, 0x42d1, {0x8e, 0xa8, 0x85, 0xbd, 0xd8, 0xc6, 0x5b, 0xde } \ + } + +extern EFI_GUID gEfiPeiMemoryDiscoveredPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MmAccess.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MmAccess.h new file mode 100644 index 00000000..6335872e --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MmAccess.h @@ -0,0 +1,155 @@ +/** @file + EFI MM Access PPI definition. + + This PPI is used to control the visibility of the MMRAM on the platform. + The EFI_PEI_MM_ACCESS_PPI abstracts the location and characteristics of MMRAM. The + principal functionality found in the memory controller includes the following: + - Exposing the MMRAM to all non-MM agents, or the "open" state + - Shrouding the MMRAM to all but the MM agents, or the "closed" state + - Preserving the system integrity, or "locking" the MMRAM, such that the settings cannot be + perturbed by either boot service or runtime agents + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.5. + +**/ + +#ifndef _MM_ACCESS_PPI_H_ +#define _MM_ACCESS_PPI_H_ + +#define EFI_PEI_MM_ACCESS_PPI_GUID \ + { 0x268f33a9, 0xcccd, 0x48be, { 0x88, 0x17, 0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 }} + +typedef struct _EFI_PEI_MM_ACCESS_PPI EFI_PEI_MM_ACCESS_PPI; + +/** + Opens the MMRAM area to be accessible by a PEIM. + + This function "opens" MMRAM so that it is visible while not inside of MM. The function should + return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM. The function + should return EFI_DEVICE_ERROR if the MMRAM configuration is locked. + + @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation. + @param This The EFI_PEI_MM_ACCESS_PPI instance. + @param DescriptorIndex The region of MMRAM to Open. + + @retval EFI_SUCCESS The operation was successful. + @retval EFI_UNSUPPORTED The system does not support opening and closing of MMRAM. + @retval EFI_DEVICE_ERROR MMRAM cannot be opened, perhaps because it is locked. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MM_OPEN)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MM_ACCESS_PPI *This, + IN UINTN DescriptorIndex + ); + +/** + Inhibits access to the MMRAM. + + This function "closes" MMRAM so that it is not visible while outside of MM. The function should + return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM. + + @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation. + @param This The EFI_PEI_MM_ACCESS_PPI instance. + @param DescriptorIndex The region of MMRAM to Close. + + @retval EFI_SUCCESS The operation was successful. + @retval EFI_UNSUPPORTED The system does not support opening and closing of MMRAM. + @retval EFI_DEVICE_ERROR MMRAM cannot be closed. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MM_CLOSE)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MM_ACCESS_PPI *This, + IN UINTN DescriptorIndex + ); + +/** + This function prohibits access to the MMRAM region. This function is usually implemented such + that it is a write-once operation. + + @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation. + @param This The EFI_PEI_MM_ACCESS_PPI instance. + @param DescriptorIndex The region of MMRAM to Lock. + + @retval EFI_SUCCESS The operation was successful. + @retval EFI_UNSUPPORTED The system does not support opening and closing of MMRAM. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MM_LOCK)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MM_ACCESS_PPI *This, + IN UINTN DescriptorIndex + ); + +/** + Queries the memory controller for the possible regions that will support MMRAM. + + This function describes the MMRAM regions. + This data structure forms the contract between the MM_ACCESS and MM_IPL drivers. There is an + ambiguity when any MMRAM region is remapped. For example, on some chipsets, some MMRAM + regions can be initialized at one physical address but is later accessed at another processor address. + There is currently no way for the MM IPL driver to know that it must use two different addresses + depending on what it is trying to do. As a result, initial configuration and loading can use the + physical address PhysicalStart while MMRAM is open. However, once the region has been + closed and needs to be accessed by agents in MM, the CpuStart address must be used. + This PPI publishes the available memory that the chipset can shroud for the use of installing code. + These regions serve the dual purpose of describing which regions have been open, closed, or locked. + In addition, these regions may include overlapping memory ranges, depending on the chipset + implementation. The latter might include a chipset that supports T-SEG, where memory near the top + of the physical DRAM can be allocated for MMRAM too. + The key thing to note is that the regions that are described by the PPI are a subset of the capabilities + of the hardware. + + @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation. + @param This The EFI_PEI_MM_ACCESS_PPI instance. + @param MmramMapSize A pointer to the size, in bytes, of the MmramMemoryMap buffer. On input, this value is + the size of the buffer that is allocated by the caller. On output, it is the size of the + buffer that was returned by the firmware if the buffer was large enough, or, if the + buffer was too small, the size of the buffer that is needed to contain the map. + @param MmramMap A pointer to the buffer in which firmware places the current memory map. The map is + an array of EFI_MMRAM_DESCRIPTORs + + @retval EFI_SUCCESS The chipset supported the given resource. + @retval EFI_BUFFER_TOO_SMALL The MmramMap parameter was too small. The current + buffer size needed to hold the memory map is returned in + MmramMapSize. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MM_CAPABILITIES)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MM_ACCESS_PPI *This, + IN OUT UINTN *MmramMapSize, + IN OUT EFI_MMRAM_DESCRIPTOR *MmramMap + ); + +/// +/// EFI MM Access PPI is used to control the visibility of the MMRAM on the platform. +/// It abstracts the location and characteristics of MMRAM. The platform should report +/// all MMRAM via EFI_PEI_MM_ACCESS_PPI. The expectation is that the north bridge or +/// memory controller would publish this PPI. +/// +struct _EFI_PEI_MM_ACCESS_PPI { + EFI_PEI_MM_OPEN Open; + EFI_PEI_MM_CLOSE Close; + EFI_PEI_MM_LOCK Lock; + EFI_PEI_MM_CAPABILITIES GetCapabilities; + BOOLEAN LockState; + BOOLEAN OpenState; +}; + +extern EFI_GUID gEfiPeiMmAccessPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MmControl.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MmControl.h new file mode 100644 index 00000000..ecf720d7 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MmControl.h @@ -0,0 +1,90 @@ +/** @file + EFI MM Control PPI definition. + + This PPI is used initiate synchronous MMI activations. This PPI could be published by a processor + driver to abstract the MMI IPI or a driver which abstracts the ASIC that is supporting the APM port. + Because of the possibility of performing MMI IPI transactions, the ability to generate this event + from a platform chipset agent is an optional capability for both IA-32 and x64-based systems. + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.5. + +**/ + + +#ifndef _MM_CONTROL_PPI_H_ +#define _MM_CONTROL_PPI_H_ + +#define EFI_PEI_MM_CONTROL_PPI_GUID \ + { 0x61c68702, 0x4d7e, 0x4f43, 0x8d, 0xef, 0xa7, 0x43, 0x5, 0xce, 0x74, 0xc5 } + +typedef struct _EFI_PEI_MM_CONTROL_PPI EFI_PEI_MM_CONTROL_PPI; + +/** + Invokes PPI activation from the PI PEI environment. + + @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation. + @param This The PEI_MM_CONTROL_PPI instance. + @param ArgumentBuffer The value passed to the MMI handler. This value corresponds to the + SwMmiInputValue in the RegisterContext parameter for the Register() + function in the EFI_MM_SW_DISPATCH_PROTOCOL and in the Context parameter + in the call to the DispatchFunction + @param ArgumentBufferSize The size of the data passed in ArgumentBuffer or NULL if ArgumentBuffer is NULL. + @param Periodic An optional mechanism to periodically repeat activation. + @param ActivationInterval An optional parameter to repeat at this period one + time or, if the Periodic Boolean is set, periodically. + + @retval EFI_SUCCESS The MMI has been engendered. + @retval EFI_DEVICE_ERROR The timing is unsupported. + @retval EFI_INVALID_PARAMETER The activation period is unsupported. + @retval EFI_NOT_STARTED The MM base service has not been initialized. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MM_ACTIVATE) ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MM_CONTROL_PPI * This, + IN OUT INT8 *ArgumentBuffer OPTIONAL, + IN OUT UINTN *ArgumentBufferSize OPTIONAL, + IN BOOLEAN Periodic OPTIONAL, + IN UINTN ActivationInterval OPTIONAL + ); + +/** + Clears any system state that was created in response to the Trigger() call. + + @param PeiServices General purpose services available to every PEIM. + @param This The PEI_MM_CONTROL_PPI instance. + @param Periodic Optional parameter to repeat at this period one + time or, if the Periodic Boolean is set, periodically. + + @retval EFI_SUCCESS The MMI has been engendered. + @retval EFI_DEVICE_ERROR The source could not be cleared. + @retval EFI_INVALID_PARAMETER The service did not support the Periodic input argument. + +**/ +typedef +EFI_STATUS +(EFIAPI *PEI_MM_DEACTIVATE) ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MM_CONTROL_PPI * This, + IN BOOLEAN Periodic OPTIONAL + ); + +/// +/// The EFI_PEI_MM_CONTROL_PPI is produced by a PEIM. It provides an abstraction of the +/// platform hardware that generates an MMI. There are often I/O ports that, when accessed, will +/// generate the MMI. Also, the hardware optionally supports the periodic generation of these signals. +/// +struct _PEI_MM_CONTROL_PPI { + PEI_MM_ACTIVATE Trigger; + PEI_MM_DEACTIVATE Clear; +}; + +extern EFI_GUID gEfiPeiMmControlPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MpServices.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MpServices.h new file mode 100644 index 00000000..b7dfb3bc --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/MpServices.h @@ -0,0 +1,277 @@ +/** @file + This file declares UEFI PI Multi-processor PPI. + This PPI is installed by some platform or chipset-specific PEIM that abstracts + handling multiprocessor support. + + Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.4. + +**/ + +#ifndef __PEI_MP_SERVICES_PPI_H__ +#define __PEI_MP_SERVICES_PPI_H__ + +#include <Protocol/MpService.h> + +#define EFI_PEI_MP_SERVICES_PPI_GUID \ + { \ + 0xee16160a, 0xe8be, 0x47a6, { 0x82, 0xa, 0xc6, 0x90, 0xd, 0xb0, 0x25, 0xa } \ + } + +typedef struct _EFI_PEI_MP_SERVICES_PPI EFI_PEI_MP_SERVICES_PPI ; + +/** + Get the number of CPU's. + + @param[in] PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param[in] This Pointer to this instance of the PPI. + @param[out] NumberOfProcessors Pointer to the total number of logical processors in + the system, including the BSP and disabled APs. + @param[out] NumberOfEnabledProcessors + Number of processors in the system that are enabled. + + @retval EFI_SUCCESS The number of logical processors and enabled + logical processors was retrieved. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL. + NumberOfEnabledProcessors is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MP_SERVICES_PPI *This, + OUT UINTN *NumberOfProcessors, + OUT UINTN *NumberOfEnabledProcessors + ); + +/** + Get information on a specific CPU. + + @param[in] PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param[in] This Pointer to this instance of the PPI. + @param[in] ProcessorNumber Pointer to the total number of logical processors in + the system, including the BSP and disabled APs. + @param[out] ProcessorInfoBuffer Number of processors in the system that are enabled. + + @retval EFI_SUCCESS Processor information was returned. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL. + @retval EFI_NOT_FOUND The processor with the handle specified by + ProcessorNumber does not exist in the platform. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MP_SERVICES_GET_PROCESSOR_INFO) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MP_SERVICES_PPI *This, + IN UINTN ProcessorNumber, + OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer + ); + +/** + Activate all of the application processors. + + @param[in] PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[in] Procedure A pointer to the function to be run on enabled APs of + the system. + @param[in] SingleThread If TRUE, then all the enabled APs execute the function + specified by Procedure one by one, in ascending order + of processor handle number. If FALSE, then all the + enabled APs execute the function specified by Procedure + simultaneously. + @param[in] TimeoutInMicroSeconds + Indicates the time limit in microseconds for APs to + return from Procedure, for blocking mode only. Zero + means infinity. If the timeout expires before all APs + return from Procedure, then Procedure on the failed APs + is terminated. All enabled APs are available for next + function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs() + or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the + timeout expires in blocking mode, BSP returns + EFI_TIMEOUT. + @param[in] ProcedureArgument The parameter passed into Procedure for all APs. + + @retval EFI_SUCCESS In blocking mode, all APs have finished before the + timeout expired. + @retval EFI_DEVICE_ERROR Caller processor is AP. + @retval EFI_NOT_STARTED No enabled APs exist in the system. + @retval EFI_NOT_READY Any enabled APs are busy. + @retval EFI_TIMEOUT In blocking mode, the timeout expired before all + enabled APs have finished. + @retval EFI_INVALID_PARAMETER Procedure is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MP_SERVICES_STARTUP_ALL_APS) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MP_SERVICES_PPI *This, + IN EFI_AP_PROCEDURE Procedure, + IN BOOLEAN SingleThread, + IN UINTN TimeoutInMicroSeconds, + IN VOID *ProcedureArgument OPTIONAL + ); + +/** + Activate a specific application processor. + + @param[in] PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[in] Procedure A pointer to the function to be run on enabled APs of + the system. + @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the + total number of logical processors minus 1. The total + number of logical processors can be retrieved by + EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). + @param[in] TimeoutInMicroSeconds + Indicates the time limit in microseconds for APs to + return from Procedure, for blocking mode only. Zero + means infinity. If the timeout expires before all APs + return from Procedure, then Procedure on the failed APs + is terminated. All enabled APs are available for next + function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs() + or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the + timeout expires in blocking mode, BSP returns + EFI_TIMEOUT. + @param[in] ProcedureArgument The parameter passed into Procedure for all APs. + + @retval EFI_SUCCESS In blocking mode, specified AP finished before the + timeout expires. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_TIMEOUT In blocking mode, the timeout expired before the + specified AP has finished. + @retval EFI_NOT_FOUND The processor with the handle specified by + ProcessorNumber does not exist. + @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP. + @retval EFI_INVALID_PARAMETER Procedure is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MP_SERVICES_STARTUP_THIS_AP) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MP_SERVICES_PPI *This, + IN EFI_AP_PROCEDURE Procedure, + IN UINTN ProcessorNumber, + IN UINTN TimeoutInMicroseconds, + IN VOID *ProcedureArgument OPTIONAL + ); + +/** + Switch the boot strap processor. + + @param[in] PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the + total number of logical processors minus 1. The total + number of logical processors can be retrieved by + EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). + @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an enabled + AP. Otherwise, it will be disabled. + + @retval EFI_SUCCESS BSP successfully switched. + @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to this + service returning. + @retval EFI_UNSUPPORTED Switching the BSP is not supported. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_NOT_FOUND The processor with the handle specified by + ProcessorNumber does not exist. + @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or a disabled + AP. + @retval EFI_NOT_READY The specified AP is busy. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MP_SERVICES_SWITCH_BSP) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MP_SERVICES_PPI *This, + IN UINTN ProcessorNumber, + IN BOOLEAN EnableOldBSP + ); + +/** + Enable or disable an application processor. + + @param[in] PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the + total number of logical processors minus 1. The total + number of logical processors can be retrieved by + EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). + @param[in] EnableAP Specifies the new state for the processor for enabled, + FALSE for disabled. + @param[in] HealthFlag If not NULL, a pointer to a value that specifies the + new health status of the AP. This flag corresponds to + StatusFlag defined in EFI_PEI_MP_SERVICES_PPI.GetProcessorInfo(). + Only the PROCESSOR_HEALTH_STATUS_BIT is used. All other + bits are ignored. If it is NULL, this parameter is + ignored. + + @retval EFI_SUCCESS The specified AP was enabled or disabled successfully. + @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed prior + to this service returning. + @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported. + @retval EFI_DEVICE_ERROR The calling processor is an AP. + @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber + does not exist. + @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MP_SERVICES_ENABLEDISABLEAP) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MP_SERVICES_PPI *This, + IN UINTN ProcessorNumber, + IN BOOLEAN EnableAP, + IN UINT32 *HealthFlag OPTIONAL + ); + +/** + Identify the currently executing processor. + + @param[in] PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance. + @param[out] ProcessorNumber The handle number of the AP. The range is from 0 to the + total number of logical processors minus 1. The total + number of logical processors can be retrieved by + EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). + + @retval EFI_SUCCESS The current processor handle number was returned in + ProcessorNumber. + @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MP_SERVICES_WHOAMI) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_MP_SERVICES_PPI *This, + OUT UINTN *ProcessorNumber + ); + +/// +/// This PPI is installed by some platform or chipset-specific PEIM that abstracts +/// handling multiprocessor support. +/// +struct _EFI_PEI_MP_SERVICES_PPI { + EFI_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors; + EFI_PEI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo; + EFI_PEI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs; + EFI_PEI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP; + EFI_PEI_MP_SERVICES_SWITCH_BSP SwitchBSP; + EFI_PEI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP; + EFI_PEI_MP_SERVICES_WHOAMI WhoAmI; +}; + +extern EFI_GUID gEfiPeiMpServicesPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Pcd.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Pcd.h new file mode 100644 index 00000000..efd102e7 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Pcd.h @@ -0,0 +1,854 @@ +/** @file + Native Platform Configuration Database (PCD) PPI + + Different with the EFI_PCD_PPI defined in PI 1.2 specification, the native + PCD PPI provide interfaces for dynamic and dynamic-ex type PCD. + The interfaces for dynamic type PCD do not require the token space guid as parameter, + but interfaces for dynamic-ex type PCD require token space guid as parameter. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PCD_PPI_H__ +#define __PCD_PPI_H__ + +#define PCD_PPI_GUID \ + { 0x6e81c58, 0x4ad7, 0x44bc, { 0x83, 0x90, 0xf1, 0x2, 0x65, 0xf7, 0x24, 0x80 } } + +#define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0) + + +/** + Sets the SKU value for subsequent calls to set or get PCD token values. + + SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. + SetSku() is normally called only once by the system. + + For each item (token), the database can hold a single value that applies to all SKUs, + or multiple values, where each value is associated with a specific SKU Id. Items with multiple, + SKU-specific values are called SKU enabled. + + The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. + For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the + single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the + last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token, + the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been + set for that Id, the results are unpredictable. + + @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and + set values associated with a PCD token. + + @retval VOID + +**/ +typedef +VOID +(EFIAPI *PCD_PPI_SET_SKU)( + IN UINTN SkuId + ); + + + +/** + Retrieves an 8-bit value for a given PCD token. + + Retrieves the current byte-sized value for a PCD token number. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The UINT8 value. + +**/ +typedef +UINT8 +(EFIAPI *PCD_PPI_GET8)( + IN UINTN TokenNumber + ); + + + +/** + Retrieves a 16-bit value for a given PCD token. + + Retrieves the current 16-bit value for a PCD token number. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The UINT16 value. + +**/ +typedef +UINT16 +(EFIAPI *PCD_PPI_GET16)( + IN UINTN TokenNumber + ); + + + +/** + Retrieves a 32-bit value for a given PCD token. + + Retrieves the current 32-bit value for a PCD token number. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The UINT32 value. + +**/ +typedef +UINT32 +(EFIAPI *PCD_PPI_GET32)( + IN UINTN TokenNumber + ); + + + +/** + Retrieves a 64-bit value for a given PCD token. + + Retrieves the current 64-bit value for a PCD token number. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The UINT64 value. + +**/ +typedef +UINT64 +(EFIAPI *PCD_PPI_GET64)( + IN UINTN TokenNumber + ); + + + +/** + Retrieves a pointer to a value for a given PCD token. + + Retrieves the current pointer to the buffer for a PCD token number. + Do not make any assumptions about the alignment of the pointer that + is returned by this function call. If the TokenNumber is invalid, + the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The pointer to the buffer to be retrieved. + +**/ +typedef +VOID * +(EFIAPI *PCD_PPI_GET_POINTER)( + IN UINTN TokenNumber + ); + + + +/** + Retrieves a Boolean value for a given PCD token. + + Retrieves the current boolean value for a PCD token number. + Do not make any assumptions about the alignment of the pointer that + is returned by this function call. If the TokenNumber is invalid, + the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The Boolean value. + +**/ +typedef +BOOLEAN +(EFIAPI *PCD_PPI_GET_BOOLEAN)( + IN UINTN TokenNumber + ); + + + +/** + Retrieves the size of the value for a given PCD token. + + Retrieves the current size of a particular PCD token. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The size of the value for the PCD token. + +**/ +typedef +UINTN +(EFIAPI *PCD_PPI_GET_SIZE)( + IN UINTN TokenNumber + ); + + + +/** + Retrieves an 8-bit value for a given PCD token and token space. + + Retrieves the 8-bit value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size 8-bit value for the PCD token. + +**/ +typedef +UINT8 +(EFIAPI *PCD_PPI_GET_EX_8)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves a 16-bit value for a given PCD token and token space. + + Retrieves the 16-bit value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size 16-bit value for the PCD token. + +**/ +typedef +UINT16 +(EFIAPI *PCD_PPI_GET_EX_16)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves a 32-bit value for a given PCD token and token space. + + Retrieves the 32-bit value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size 32-bit value for the PCD token. + +**/ +typedef +UINT32 +(EFIAPI *PCD_PPI_GET_EX_32)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves a 64-bit value for a given PCD token and token space. + + Retrieves the 64-bit value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size 64-bit value for the PCD token. + +**/ +typedef +UINT64 +(EFIAPI *PCD_PPI_GET_EX_64)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves a pointer to a value for a given PCD token and token space. + + Retrieves the current pointer to the buffer for a PCD token number. + Do not make any assumptions about the alignment of the pointer that + is returned by this function call. If the TokenNumber is invalid, + the results are unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The pointer to the buffer to be retrieved. + +**/ +typedef +VOID * +(EFIAPI *PCD_PPI_GET_EX_POINTER)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves an Boolean value for a given PCD token and token space. + + Retrieves the Boolean value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size Boolean value for the PCD token. + +**/ +typedef +BOOLEAN +(EFIAPI *PCD_PPI_GET_EX_BOOLEAN)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves the size of the value for a given PCD token and token space. + + Retrieves the current size of a particular PCD token. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size of the value for the PCD token. + +**/ +typedef +UINTN +(EFIAPI *PCD_PPI_GET_EX_SIZE)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Sets an 8-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET8)( + IN UINTN TokenNumber, + IN UINT8 Value + ); + + + +/** + Sets a 16-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET16)( + IN UINTN TokenNumber, + IN UINT16 Value + ); + + + +/** + Sets a 32-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET32)( + IN UINTN TokenNumber, + IN UINT32 Value + ); + + + +/** + Sets a 64-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET64)( + IN UINTN TokenNumber, + IN UINT64 Value + ); + +/** + Sets a value of a specified size for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in, out] SizeOfValue A pointer to the length of the value being set for the PCD token. + On input, if the SizeOfValue is greater than the maximum size supported + for this TokenNumber then the output value of SizeOfValue will reflect + the maximum size supported for this TokenNumber. + @param[in] Buffer The buffer to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET_POINTER)( + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfValue, + IN VOID *Buffer + ); + +/** + Sets an Boolean value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET_BOOLEAN)( + IN UINTN TokenNumber, + IN BOOLEAN Value + ); + + + +/** + Sets an 8-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET_EX_8)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT8 Value + ); + + + +/** + Sets a 16-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET_EX_16)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT16 Value + ); + + + +/** + Sets a 32-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET_EX_32)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT32 Value + ); + + + +/** + Sets a 64-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET_EX_64)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT64 Value + ); + + + +/** + Sets a value of a specified size for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in, out] SizeOfValue A pointer to the length of the value being set for the PCD token. + On input, if the SizeOfValue is greater than the maximum size supported + for this TokenNumber then the output value of SizeOfValue will reflect + the maximum size supported for this TokenNumber. + @param[in] Buffer The buffer to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET_EX_POINTER)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfValue, + IN VOID *Buffer + ); + +/** + Sets an Boolean value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_SET_EX_BOOLEAN)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN BOOLEAN Value + ); + + + +/** + Callback on SET function prototype definition. + + This notification function serves two purposes. Firstly, it notifies the module + which did the registration that the value of this PCD token has been set. Secondly, + it provides a mechanism for the module which did the registration to intercept the set + operation and override the value been set if necessary. After the invocation of the + callback function, TokenData will be used by PCD service PEIM to modify the internal data + in PCD database. + + @param[in] CallBackGuid The PCD token GUID being set. + @param[in] CallBackToken The PCD token number being set. + @param[in, out] TokenData A pointer to the token data being set. + @param[in] TokenDataSize The size, in bytes, of the data being set. + + @retval VOID + +**/ +typedef +VOID +(EFIAPI *PCD_PPI_CALLBACK)( + IN CONST EFI_GUID *CallBackGuid, OPTIONAL + IN UINTN CallBackToken, + IN OUT VOID *TokenData, + IN UINTN TokenDataSize + ); + + + +/** + Specifies a function to be called anytime the value of a designated token is changed. + + @param[in] TokenNumber The PCD token number. + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. + + @retval EFI_SUCCESS The PCD service has successfully established a call event + for the CallBackToken requested. + @retval EFI_NOT_FOUND The PCD service could not find the referenced token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_CALLBACK_ONSET)( + IN CONST EFI_GUID *Guid, OPTIONAL + IN UINTN TokenNumber, + IN PCD_PPI_CALLBACK CallBackFunction + ); + + + +/** + Cancels a previously set callback function for a particular PCD token number. + + @param[in] TokenNumber The PCD token number. + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. + + @retval EFI_SUCCESS The PCD service has successfully established a call event + for the CallBackToken requested. + @retval EFI_NOT_FOUND The PCD service could not find the referenced token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_CANCEL_CALLBACK)( + IN CONST EFI_GUID *Guid, OPTIONAL + IN UINTN TokenNumber, + IN PCD_PPI_CALLBACK CallBackFunction + ); + + + +/** + Retrieves the next valid token number in a given namespace. + + This is useful since the PCD infrastructure contains a sparse list of token numbers, + and one cannot a priori know what token numbers are valid in the database. + + If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned. + If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned. + If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned. + If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned. + The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid. + If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned. + If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned. + If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned. + + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + This is an optional parameter that may be NULL. If this parameter is NULL, then a request + is being made to retrieve tokens from the default token space. + @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. + + @retval EFI_SUCCESS The PCD service has retrieved the next valid token number. + @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_GET_NEXT_TOKEN)( + IN CONST EFI_GUID *Guid, OPTIONAL + IN OUT UINTN *TokenNumber + ); + + + +/** + Retrieves the next valid PCD token namespace for a given namespace. + + Gets the next valid token namespace for a given namespace. This is useful to traverse the valid + token namespaces on a platform. + + @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token + namespace from which the search will start. On output, it designates the next valid + token namespace on the platform. If *Guid is NULL, then the GUID of the first token + space of the current platform is returned. If the search cannot locate the next valid + token namespace, an error is returned and the value of *Guid is undefined. + + @retval EFI_SUCCESS The PCD service retrieved the value requested. + @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PPI_GET_NEXT_TOKENSPACE)( + IN OUT CONST EFI_GUID **Guid + ); + + + +/// +/// This service abstracts the ability to set/get Platform Configuration Database (PCD). +/// +typedef struct { + PCD_PPI_SET_SKU SetSku; + + PCD_PPI_GET8 Get8; + PCD_PPI_GET16 Get16; + PCD_PPI_GET32 Get32; + PCD_PPI_GET64 Get64; + PCD_PPI_GET_POINTER GetPtr; + PCD_PPI_GET_BOOLEAN GetBool; + PCD_PPI_GET_SIZE GetSize; + + PCD_PPI_GET_EX_8 Get8Ex; + PCD_PPI_GET_EX_16 Get16Ex; + PCD_PPI_GET_EX_32 Get32Ex; + PCD_PPI_GET_EX_64 Get64Ex; + PCD_PPI_GET_EX_POINTER GetPtrEx; + PCD_PPI_GET_EX_BOOLEAN GetBoolEx; + PCD_PPI_GET_EX_SIZE GetSizeEx; + + PCD_PPI_SET8 Set8; + PCD_PPI_SET16 Set16; + PCD_PPI_SET32 Set32; + PCD_PPI_SET64 Set64; + PCD_PPI_SET_POINTER SetPtr; + PCD_PPI_SET_BOOLEAN SetBool; + + PCD_PPI_SET_EX_8 Set8Ex; + PCD_PPI_SET_EX_16 Set16Ex; + PCD_PPI_SET_EX_32 Set32Ex; + PCD_PPI_SET_EX_64 Set64Ex; + PCD_PPI_SET_EX_POINTER SetPtrEx; + PCD_PPI_SET_EX_BOOLEAN SetBoolEx; + + PCD_PPI_CALLBACK_ONSET CallbackOnSet; + PCD_PPI_CANCEL_CALLBACK CancelCallback; + PCD_PPI_GET_NEXT_TOKEN GetNextToken; + PCD_PPI_GET_NEXT_TOKENSPACE GetNextTokenSpace; +} PCD_PPI; + + +extern EFI_GUID gPcdPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PcdInfo.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PcdInfo.h new file mode 100644 index 00000000..c199c006 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PcdInfo.h @@ -0,0 +1,99 @@ +/** @file + Native Platform Configuration Database (PCD) INFO PPI + + The PPI that provides additional information about items that reside in the PCD database. + + Different with the EFI_GET_PCD_INFO_PPI defined in PI 1.2.1 specification, + the native PCD INFO PPI provide interfaces for dynamic and dynamic-ex type PCD. + The interfaces for dynamic type PCD do not require the token space guid as parameter, + but interfaces for dynamic-ex type PCD require token space guid as parameter. + + Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PCD_INFO_PPI_H__ +#define __PCD_INFO_PPI_H__ + +extern EFI_GUID gGetPcdInfoPpiGuid; + +#define GET_PCD_INFO_PPI_GUID \ + { 0x4d8b155b, 0xc059, 0x4c8f, { 0x89, 0x26, 0x6, 0xfd, 0x43, 0x31, 0xdb, 0x8a } } + +/// +/// The forward declaration for GET_PCD_INFO_PPI. +/// +typedef struct _GET_PCD_INFO_PPI GET_PCD_INFO_PPI; + +/** + Retrieve additional information associated with a PCD token in the default token space. + + This includes information such as the type of value the TokenNumber is associated with as well as possible + human readable name that is associated with the token. + + @param[in] TokenNumber The PCD token number. + @param[out] PcdInfo The returned information associated with the requested TokenNumber. + + @retval EFI_SUCCESS The PCD information was returned successfully + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *GET_PCD_INFO_PPI_GET_INFO) ( + IN UINTN TokenNumber, + OUT EFI_PCD_INFO *PcdInfo +); + +/** + Retrieve additional information associated with a PCD token. + + This includes information such as the type of value the TokenNumber is associated with as well as possible + human readable name that is associated with the token. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[out] PcdInfo The returned information associated with the requested TokenNumber. + + @retval EFI_SUCCESS The PCD information was returned successfully + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *GET_PCD_INFO_PPI_GET_INFO_EX) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + OUT EFI_PCD_INFO *PcdInfo +); + +/** + Retrieve the currently set SKU Id. + + @return The currently set SKU Id. If the platform has not set at a SKU Id, then the + default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU + Id is returned. +**/ +typedef +UINTN +(EFIAPI *GET_PCD_INFO_PPI_GET_SKU) ( + VOID +); + +/// +/// This is the PCD service to use when querying for some additional data that can be contained in the +/// PCD database. +/// +struct _GET_PCD_INFO_PPI { + /// + /// Retrieve additional information associated with a PCD. + /// + GET_PCD_INFO_PPI_GET_INFO GetInfo; + GET_PCD_INFO_PPI_GET_INFO_EX GetInfoEx; + /// + /// Retrieve the currently set SKU Id. + /// + GET_PCD_INFO_PPI_GET_SKU GetSku; +}; + +#endif + diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PciCfg2.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PciCfg2.h new file mode 100644 index 00000000..17b67a72 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PciCfg2.h @@ -0,0 +1,178 @@ +/** @file + This file declares PciCfg2 PPI. + + This ppi Provides platform or chipset-specific access to + the PCI configuration space for a specific PCI segment. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __PEI_PCI_CFG2_H__ +#define __PEI_PCI_CFG2_H__ + +#include <Library/BaseLib.h> + +#define EFI_PEI_PCI_CFG2_PPI_GUID \ + { 0x57a449a, 0x1fdc, 0x4c06, { 0xbf, 0xc9, 0xf5, 0x3f, 0x6a, 0x99, 0xbb, 0x92 } } + +typedef struct _EFI_PEI_PCI_CFG2_PPI EFI_PEI_PCI_CFG2_PPI; + +#define EFI_PEI_PCI_CFG_ADDRESS(bus,dev,func,reg) \ + (UINT64) ( \ + (((UINTN) bus) << 24) | \ + (((UINTN) dev) << 16) | \ + (((UINTN) func) << 8) | \ + (((UINTN) (reg)) < 256 ? ((UINTN) (reg)) : (UINT64) (LShiftU64 ((UINT64) (reg), 32)))) + +/// +/// EFI_PEI_PCI_CFG_PPI_WIDTH +/// +typedef enum { + /// + /// 8-bit access + /// + EfiPeiPciCfgWidthUint8 = 0, + /// + /// 16-bit access + /// + EfiPeiPciCfgWidthUint16 = 1, + /// + /// 32-bit access + /// + EfiPeiPciCfgWidthUint32 = 2, + /// + /// 64-bit access + /// + EfiPeiPciCfgWidthUint64 = 3, + EfiPeiPciCfgWidthMaximum +} EFI_PEI_PCI_CFG_PPI_WIDTH; + +/// +/// EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS +/// +typedef struct { + /// + /// 8-bit register offset within the PCI configuration space for a given device's function + /// space. + /// + UINT8 Register; + /// + /// Only the 3 least-significant bits are used to encode one of 8 possible functions within a + /// given device. + /// + UINT8 Function; + /// + /// Only the 5 least-significant bits are used to encode one of 32 possible devices. + /// + UINT8 Device; + /// + /// 8-bit value to encode between 0 and 255 buses. + /// + UINT8 Bus; + /// + /// Register number in PCI configuration space. If this field is zero, then Register is used + /// for the register number. If this field is non-zero, then Register is ignored and this field + /// is used for the register number. + /// + UINT32 ExtendedRegister; +} EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS; + +/** + Reads from or write to a given location in the PCI configuration space. + + @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation. + + @param This Pointer to local data for the interface. + + @param Width The width of the access. Enumerated in bytes. + See EFI_PEI_PCI_CFG_PPI_WIDTH above. + + @param Address The physical address of the access. The format of + the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS. + + @param Buffer A pointer to the buffer of data.. + + + @retval EFI_SUCCESS The function completed successfully. + + @retval EFI_DEVICE_ERROR There was a problem with the transaction. + + @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this + time. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCI_CFG2_PPI_IO)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PCI_CFG2_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN OUT VOID *Buffer +); + + +/** + Performs a read-modify-write operation on the contents + from a given location in the PCI configuration space. + + @param PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + + @param This Pointer to local data for the interface. + + @param Width The width of the access. Enumerated in bytes. Type + EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read(). + + @param Address The physical address of the access. + + @param SetBits Points to value to bitwise-OR with the read configuration value. + + The size of the value is determined by Width. + + @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value. + The size of the value is determined by Width. + + + @retval EFI_SUCCESS The function completed successfully. + + @retval EFI_DEVICE_ERROR There was a problem with the transaction. + + @retval EFI_DEVICE_NOT_READY The device is not capable of supporting + the operation at this time. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCI_CFG2_PPI_RW)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PCI_CFG2_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN VOID *SetBits, + IN VOID *ClearBits +); + +/// +/// The EFI_PEI_PCI_CFG_PPI interfaces are used to abstract accesses to PCI +/// controllers behind a PCI root bridge controller. +/// +struct _EFI_PEI_PCI_CFG2_PPI { + EFI_PEI_PCI_CFG2_PPI_IO Read; + EFI_PEI_PCI_CFG2_PPI_IO Write; + EFI_PEI_PCI_CFG2_PPI_RW Modify; + /// + /// The PCI bus segment which the specified functions will access. + /// + UINT16 Segment; +}; + + +extern EFI_GUID gEfiPciCfg2PpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PeiCoreFvLocation.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PeiCoreFvLocation.h new file mode 100644 index 00000000..72a308ea --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PeiCoreFvLocation.h @@ -0,0 +1,42 @@ +/** @file + Header file for Pei Core FV Location PPI. + + This PPI contains a pointer to the firmware volume which contains the PEI Foundation. + If the PEI Foundation does not reside in the BFV, then SEC must pass this PPI as a part + of the PPI list provided to the PEI Foundation Entry Point, otherwise the PEI Foundation + shall assume that it resides within the BFV. + + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is defined in UEFI Platform Initialization Specification 1.7 Volume 1: + Standards + +**/ + + +#ifndef _EFI_PEI_CORE_FV_LOCATION_H_ +#define _EFI_PEI_CORE_FV_LOCATION_H_ + +/// +/// Global ID for EFI_PEI_CORE_FV_LOCATION_PPI +/// +#define EFI_PEI_CORE_FV_LOCATION_GUID \ + { \ + 0x52888eae, 0x5b10, 0x47d0, {0xa8, 0x7f, 0xb8, 0x22, 0xab, 0xa0, 0xca, 0xf4 } \ + } + +/// +/// This PPI provides location of EFI PeiCoreFv. +/// +typedef struct { + /// + /// Pointer to the first byte of the firmware volume which contains the PEI Foundation. + /// + VOID *PeiCoreFvLocation; +} EFI_PEI_CORE_FV_LOCATION_PPI; + +extern EFI_GUID gEfiPeiCoreFvLocationPpiGuid; + +#endif // _EFI_PEI_CORE_FV_LOCATION_H_ diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PiPcd.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PiPcd.h new file mode 100644 index 00000000..58c3be8f --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PiPcd.h @@ -0,0 +1,426 @@ +/** @file + Platform Configuration Database (PCD) PPI defined in PI 1.2 Vol3 + + A platform database that contains a variety of current platform settings or + directives that can be accessed by a driver or application. + PI PCD ppi only provide the accessing interfaces for Dynamic-Ex type PCD. + + This is the base PCD service API that provides an abstraction for accessing configuration content in + the platform. It a seamless mechanism for extracting information regardless of where the + information is stored (such as in Read-only data, or an EFI Variable). + This protocol allows access to data through size-granular APIs and provides a mechanism for a + firmware component to monitor specific settings and be alerted when a setting is changed. + + Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + PI Version 1.2 Vol 3. +**/ + +#ifndef __PI_PCD_PPI_H__ +#define __PI_PCD_PPI_H__ + +extern EFI_GUID gEfiPeiPcdPpiGuid; + +#define EFI_PEI_PCD_PPI_GUID \ + { 0x1f34d25, 0x4de2, 0x23ad, { 0x3f, 0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } } + +#define EFI_PCD_INVALID_TOKEN_NUMBER ((UINTN) 0) + +/** + SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is + normally called only once by the system. + For each item (token), the database can hold a single value that applies to all SKUs, or multiple + values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific + values are called SKU enabled. + The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. For tokens that are + not SKU enabled, the system ignores any set SKU Id and works with the single value for that token. + For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no + SKU Id is set or the currently set SKU Id isn't valid for the specified token, the system uses the + default SKU Id. If the system attempts to use the default SKU Id and no value has been set for that + Id, the results are unpredictable. + + @param[in] SkuId The SKU value to set. +**/ +typedef +VOID +(EFIAPI *EFI_PEI_PCD_PPI_SET_SKU)( + IN UINTN SkuId +); + +/** + Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid, + the results are unpredictable. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + + @return 8-bit value for a given PCD token. +**/ +typedef +UINT8 +(EFIAPI *EFI_PEI_PCD_PPI_GET_8)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber +); + +/** + Retrieves the current word-sized value for a PCD token number. If the TokenNumber is invalid, + the results are unpredictable. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + + @return 16-bit value for a given PCD token. +**/ +typedef +UINT16 +(EFIAPI *EFI_PEI_PCD_PPI_GET_16)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber +); + +/** + Retrieves the current 32-bit value for a PCD token number. If the TokenNumber is invalid, the + results are unpredictable. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + + @return 32-bit value for a given PCD token. +**/ +typedef +UINT32 +(EFIAPI *EFI_PEI_PCD_PPI_GET_32)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber +); + +/** + Retrieves the current 64-bit value for a PCD token number. If the TokenNumber is invalid, the + results are unpredictable. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + + @return 64-bit value for a given PCD token. +**/ +typedef +UINT64 +(EFIAPI *EFI_PEI_PCD_PPI_GET_64)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber +); + +/** + Retrieves the current pointer to the value for a PCD token number. There should not be any + alignment assumptions about the pointer that is returned by this function call. If the TokenNumber + is invalid, the results are unpredictable. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. +**/ +typedef +VOID * +(EFIAPI *EFI_PEI_PCD_PPI_GET_POINTER)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber +); + +/** + Retrieves the current Boolean-sized value for a PCD token number. If the TokenNumber is + invalid, the results are unpredictable. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + + @return Boolean value for a given PCD token. +**/ +typedef +BOOLEAN +(EFIAPI *EFI_PEI_PCD_PPI_GET_BOOLEAN)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber +); + +/** + Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are + unpredictable. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + + @return the size of the value for a given PCD token. +**/ +typedef +UINTN +(EFIAPI *EFI_PEI_PCD_PPI_GET_SIZE)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber +); + +/** + Sets an 8-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the size of the value being set is + compatible with the Token's existing definition. If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The PCD service has set the value requested + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was + incompatible with a call to this function. Use GetSizeEx() to + retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_SET_8)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT8 Value +); + +/** + Sets an 16-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the size of the value being set is + compatible with the Token's existing definition. If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The PCD service has set the value requested + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was + incompatible with a call to this function. Use GetSizeEx() to + retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_SET_16)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT16 Value +); + +/** + Sets an 32-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the size of the value being set is + compatible with the Token's existing definition. If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The PCD service has set the value requested + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was + incompatible with a call to this function. Use GetSizeEx() to + retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_SET_32)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT32 Value +); + +/** + Sets an 64-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the size of the value being set is + compatible with the Token's existing definition. If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The PCD service has set the value requested + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was + incompatible with a call to this function. Use GetSizeEx() to + retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_SET_64)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT64 Value +); + +/** + Sets a value of the specified size for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the size of the value being set is + compatible with the Token's existing definition. If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + @param[in] SizeOfValue The length of the value being set for the PCD token. If too large of a length is + specified, upon return from this function the value of SizeOfValue will reflect the + maximum size for the PCD token. + @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token. + + @retval EFI_SUCCESS The PCD service has set the value requested + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was + incompatible with a call to this function. Use GetSizeEx() to + retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_SET_POINTER)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfValue, + IN VOID *Buffer +); + +/** + Sets a Boolean value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the size of the value being set is + compatible with the Token's existing definition. If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS The PCD service has set the value requested + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was + incompatible with a call to this function. Use GetSizeEx() to + retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_SET_BOOLEAN)( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN BOOLEAN Value +); + +typedef +VOID +(EFIAPI *EFI_PEI_PCD_PPI_CALLBACK)( + IN EFI_GUID *Guid OPTIONAL, + IN UINTN CallBackToken, + IN OUT VOID *TokenData, + IN UINTN TokenDatSize +); + +/** + Specifies a function to be called anytime the value of a designated token is changed. + + @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use + the standard platform namespace. + @param[in] CallBackToken The PCD token number to monitor. + @param[in] CallBackFunction The function prototype that will be called when the value associated with the + CallBackToken is set. + + @retval EFI_SUCCESS The PCD service has successfully established a call event for the + CallBackToken requested. + @retval EFI_NOT_FOUND The PCD service could not find the referenced token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_CALLBACK_ON_SET)( + IN CONST EFI_GUID *Guid OPTIONAL, + IN UINTN CallBackToken, + IN EFI_PEI_PCD_PPI_CALLBACK CallBackFunction +); + +/** + Cancels a previously set callback function for a particular PCD token number. + + @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use + the standard platform namespace. + @param[in] CallBackToken The PCD token number to cancel monitoring. + @param[in] CallBackFunction The function prototype that was originally passed to the CallBackOnSet function. + + @retval EFI_SUCCESS The PCD service has cancelled the call event associated with the + CallBackToken. + @retval EFI_INVALID_PARAMETER The PCD service did not match the CallBackFunction to one + that is currently being monitored. + @retval EFI_NOT_FOUND The PCD service could not find data the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_CANCEL_CALLBACK)( + IN CONST EFI_GUID *Guid OPTIONAL, + IN UINTN CallBackToken, + IN EFI_PEI_PCD_PPI_CALLBACK CallBackFunction +); + +/** + Retrieves the next valid PCD token for a given namespace. + + This provides a means by which to get the next valid token number in a given namespace. This is + useful since the PCD infrastructure has a sparse list of token numbers in it, and one cannot a priori + know what token numbers are valid in the database. + + @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from. + @param[in] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. To + retrieve the "first" token, have the pointer reference a TokenNumber value of 0. + + @retval EFI_SUCCESS The PCD service has retrieved the value requested. + @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN)( + IN CONST EFI_GUID *Guid OPTIONAL, + IN UINTN *TokenNumber +); + +/** + Retrieves the next valid PCD token namespace for a given namespace. + + Gets the next valid token namespace for a given namespace. This is useful to traverse the valid + token namespaces on a platform. + + @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token + namespace from which the search will start. On output, it designates the next valid + token namespace on the platform. If *Guid is NULL, then the GUID of the first token + space of the current platform is returned. If the search cannot locate the next valid + token namespace, an error is returned and the value of *Guid is undefined. + + @retval EFI_SUCCESS The PCD service retrieved the value requested. + @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE)( + IN OUT CONST EFI_GUID **Guid +); + +typedef struct { + EFI_PEI_PCD_PPI_SET_SKU SetSku; + EFI_PEI_PCD_PPI_GET_8 Get8; + EFI_PEI_PCD_PPI_GET_16 Get16; + EFI_PEI_PCD_PPI_GET_32 Get32; + EFI_PEI_PCD_PPI_GET_64 Get64; + EFI_PEI_PCD_PPI_GET_POINTER GetPtr; + EFI_PEI_PCD_PPI_GET_BOOLEAN GetBool; + EFI_PEI_PCD_PPI_GET_SIZE GetSize; + EFI_PEI_PCD_PPI_SET_8 Set8; + EFI_PEI_PCD_PPI_SET_16 Set16; + EFI_PEI_PCD_PPI_SET_32 Set32; + EFI_PEI_PCD_PPI_SET_64 Set64; + EFI_PEI_PCD_PPI_SET_POINTER SetPtr; + EFI_PEI_PCD_PPI_SET_BOOLEAN SetBool; + EFI_PEI_PCD_PPI_CALLBACK_ON_SET CallbackOnSet; + EFI_PEI_PCD_PPI_CANCEL_CALLBACK CancelCallback; + EFI_PEI_PCD_PPI_GET_NEXT_TOKEN GetNextToken; + EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE GetNextTokenSpace; +} EFI_PEI_PCD_PPI; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PiPcdInfo.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PiPcdInfo.h new file mode 100644 index 00000000..0248b460 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PiPcdInfo.h @@ -0,0 +1,76 @@ +/** @file + Platform Configuration Database (PCD) Info Ppi defined in PI 1.2.1 Vol3. + + The PPI that provides additional information about items that reside in the PCD database. + + Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + PI Version 1.2.1 Vol 3. +**/ + +#ifndef __PI_PCD_INFO_PPI_H__ +#define __PI_PCD_INFO_PPI_H__ + +extern EFI_GUID gEfiGetPcdInfoPpiGuid; + +#define EFI_GET_PCD_INFO_PPI_GUID \ + { 0xa60c6b59, 0xe459, 0x425d, { 0x9c, 0x69, 0xb, 0xcc, 0x9c, 0xb2, 0x7d, 0x81 } } + +/// +/// The forward declaration for EFI_GET_PCD_INFO_PPI. +/// +typedef struct _EFI_GET_PCD_INFO_PPI EFI_GET_PCD_INFO_PPI; + +/** + Retrieve additional information associated with a PCD token. + + This includes information such as the type of value the TokenNumber is associated with as well as possible + human readable name that is associated with the token. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[out] PcdInfo The returned information associated with the requested TokenNumber. + + @retval EFI_SUCCESS The PCD information was returned successfully + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GET_PCD_INFO_PPI_GET_INFO) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + OUT EFI_PCD_INFO *PcdInfo +); + +/** + Retrieve the currently set SKU Id. + + @return The currently set SKU Id. If the platform has not set at a SKU Id, then the + default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU + Id is returned. +**/ +typedef +UINTN +(EFIAPI *EFI_GET_PCD_INFO_PPI_GET_SKU) ( + VOID +); + +/// +/// This is the PCD service to use when querying for some additional data that can be contained in the +/// PCD database. +/// +struct _EFI_GET_PCD_INFO_PPI { + /// + /// Retrieve additional information associated with a PCD. + /// + EFI_GET_PCD_INFO_PPI_GET_INFO GetInfo; + /// + /// Retrieve the currently set SKU Id. + /// + EFI_GET_PCD_INFO_PPI_GET_SKU GetSku; +}; + +#endif + diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/ReadOnlyVariable2.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/ReadOnlyVariable2.h new file mode 100644 index 00000000..95e21a96 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/ReadOnlyVariable2.h @@ -0,0 +1,111 @@ +/** @file + This file declares Read-only Variable Service2 PPI. + This ppi permits read-only access to the UEFI variable store during the PEI phase. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __PEI_READ_ONLY_VARIABLE2_PPI_H__ +#define __PEI_READ_ONLY_VARIABLE2_PPI_H__ + +#define EFI_PEI_READ_ONLY_VARIABLE2_PPI_GUID \ + { 0x2ab86ef5, 0xecb5, 0x4134, { 0xb5, 0x56, 0x38, 0x54, 0xca, 0x1f, 0xe1, 0xb4 } } + + +typedef struct _EFI_PEI_READ_ONLY_VARIABLE2_PPI EFI_PEI_READ_ONLY_VARIABLE2_PPI; + +/** + This service retrieves a variable's value using its name and GUID. + + Read the specified variable from the UEFI variable store. If the Data + buffer is too small to hold the contents of the variable, + the error EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the + required buffer size to obtain the data. + + @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI. + @param VariableName A pointer to a null-terminated string that is the variable's name. + @param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of + VariableGuid and VariableName must be unique. + @param Attributes If non-NULL, on return, points to the variable's attributes. + @param DataSize On entry, points to the size in bytes of the Data buffer. + On return, points to the size of the data returned in Data. + @param Data Points to the buffer which will hold the returned variable value. + May be NULL with a zero DataSize in order to determine the size of the buffer needed. + + @retval EFI_SUCCESS The variable was read successfully. + @retval EFI_NOT_FOUND The variable was not found. + @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data. + DataSize is updated with the size required for + the specified variable. + @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL. + @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_GET_VARIABLE2)( + IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This, + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VariableGuid, + OUT UINT32 *Attributes, + IN OUT UINTN *DataSize, + OUT VOID *Data OPTIONAL + ); + + +/** + Return the next variable name and GUID. + + This function is called multiple times to retrieve the VariableName + and VariableGuid of all variables currently available in the system. + On each call, the previous results are passed into the interface, + and, on return, the interface returns the data for the next + interface. When the entire variable list has been returned, + EFI_NOT_FOUND is returned. + + @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI. + + @param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName. + On return, the size of the variable name buffer. + @param VariableName On entry, a pointer to a null-terminated string that is the variable's name. + On return, points to the next variable's null-terminated name string. + + @param VariableGuid On entry, a pointer to an EFI_GUID that is the variable's GUID. + On return, a pointer to the next variable's GUID. + + @retval EFI_SUCCESS The variable was read successfully. + @retval EFI_NOT_FOUND The variable could not be found. + @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the resulting + data. VariableNameSize is updated with the size + required for the specified variable. + @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or + VariableNameSize is NULL. + @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_GET_NEXT_VARIABLE_NAME2)( + IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This, + IN OUT UINTN *VariableNameSize, + IN OUT CHAR16 *VariableName, + IN OUT EFI_GUID *VariableGuid + ); + +/// +/// This PPI provides a lightweight, read-only variant of the full EFI +/// variable services. +/// +struct _EFI_PEI_READ_ONLY_VARIABLE2_PPI { + EFI_PEI_GET_VARIABLE2 GetVariable; + EFI_PEI_GET_NEXT_VARIABLE_NAME2 NextVariableName; +}; + +extern EFI_GUID gEfiPeiReadOnlyVariable2PpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/RecoveryModule.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/RecoveryModule.h new file mode 100644 index 00000000..5b7dde32 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/RecoveryModule.h @@ -0,0 +1,81 @@ +/** @file + This file declares Recovery Module PPI. This PPI is used to find and load the + recovery files. + + A module that produces this PPI has many roles and is responsible for the following: + -# Calling the driver recovery PPI EFI_PEI_DEVICE_RECOVERY_MODULE_PPI. + GetNumberRecoveryCapsules() to determine if one or more DXE recovery + entities exist. + -# If no capsules exist, then performing appropriate error handling. + -# Allocating a buffer of MaxRecoveryCapsuleSize as determined by + EFI_PEI_DEVICE_RECOVERY_MODULE_PPI.GetRecoveryCapsuleInfo() or + larger. + -# Determining the policy in which DXE recovery capsules are loaded. + -# Calling the driver recovery PPI EFI_PEI_DEVICE_RECOVERY_MODULE_PPI. + LoadRecoveryCapsule() for capsule number x. + -# If the load failed, performing appropriate error handling. + -# Performing security checks for a loaded DXE recovery capsule. + -# If the security checks failed, then logging the failure in a data HOB. + -# If the security checks failed, then determining the next + EFI_PEI_DEVICE_RECOVERY_MODULE_PPI.LoadRecoveryCapsule()capsule number; + otherwise, go to step 11. + -# If more DXE recovery capsules exist, then go to step 5; otherwise, perform + error handling. + -# Decomposing the capsule loaded by EFI_PEI_DEVICE_RECOVERY_MODULE_PPI. + LoadRecoveryCapsule() into its components. It is assumed that the path + parameters are redundant for recovery and Setup parameters are either + redundant or canned. + -# Invalidating all HOB entries for updateable firmware volume entries. + This invalidation prevents possible errant drivers from being executed. + -# Updating the HOB table with the recovery DXE firmware volume information + generated from the capsule decomposition. + -# Returning to the PEI Dispatcher. + + Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is defined in UEFI Platform Initialization Specification 1.2 Errata B Volume 1: + Pre-EFI Initialization Core Interface + +**/ + +#ifndef __PEI_RECOVERY_MODULE_PPI_H__ +#define __PEI_RECOVERY_MODULE_PPI_H__ + +#define EFI_PEI_RECOVERY_MODULE_PPI_GUID \ + { \ + 0xFB6D9542, 0x612D, 0x4f45, {0x87, 0x2F, 0x5C, 0xFF, 0x52, 0xE9, 0x3D, 0xCF } \ + } + +typedef struct _EFI_PEI_RECOVERY_MODULE_PPI EFI_PEI_RECOVERY_MODULE_PPI; + +/** + Loads a DXE capsule from some media into memory and updates the HOB table + with the DXE firmware volume information. + + @param PeiServices General-purpose services that are available to every PEIM. + @param This Indicates the EFI_PEI_RECOVERY_MODULE_PPI instance. + + @retval EFI_SUCCESS The capsule was loaded correctly. + @retval EFI_DEVICE_ERROR A device error occurred. + @retval EFI_NOT_FOUND A recovery DXE capsule cannot be found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_LOAD_RECOVERY_CAPSULE)( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_RECOVERY_MODULE_PPI *This + ); + +/// +/// Finds and loads the recovery files. +/// +struct _EFI_PEI_RECOVERY_MODULE_PPI { + EFI_PEI_LOAD_RECOVERY_CAPSULE LoadRecoveryCapsule; ///< Loads a DXE binary capsule into memory. +}; + +extern EFI_GUID gEfiPeiRecoveryModulePpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/ReportStatusCodeHandler.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/ReportStatusCodeHandler.h new file mode 100644 index 00000000..89767a09 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/ReportStatusCodeHandler.h @@ -0,0 +1,76 @@ +/** @file + This PPI provides registering and unregistering services to status code consumers. + + Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __REPORT_STATUS_CODE_HANDLER_PPI_H__ +#define __REPORT_STATUS_CODE_HANDLER_PPI_H__ + +#define EFI_PEI_RSC_HANDLER_PPI_GUID \ + { \ + 0x65d394, 0x9951, 0x4144, {0x82, 0xa3, 0xa, 0xfc, 0x85, 0x79, 0xc2, 0x51} \ + } + +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_RSC_HANDLER_CALLBACK)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE Type, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN CONST EFI_GUID *CallerId, + IN CONST EFI_STATUS_CODE_DATA *Data +); + +/** + Register the callback function for ReportStatusCode() notification. + + When this function is called the function pointer is added to an internal list and any future calls to + ReportStatusCode() will be forwarded to the Callback function. + + @param[in] Callback A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is called + when a call to ReportStatusCode() occurs. + + @retval EFI_SUCCESS Function was successfully registered. + @retval EFI_INVALID_PARAMETER The callback function was NULL. + @retval EFI_OUT_OF_RESOURCES The internal buffer ran out of space. No more functions can be + registered. + @retval EFI_ALREADY_STARTED The function was already registered. It can't be registered again. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_RSC_HANDLER_REGISTER)( + IN EFI_PEI_RSC_HANDLER_CALLBACK Callback +); + +/** + Remove a previously registered callback function from the notification list. + + ReportStatusCode() messages will no longer be forwarded to the Callback function. + + @param[in] Callback A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is to be + unregistered. + + @retval EFI_SUCCESS The function was successfully unregistered. + @retval EFI_INVALID_PARAMETER The callback function was NULL. + @retval EFI_NOT_FOUND The callback function was not found to be unregistered. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_RSC_HANDLER_UNREGISTER)( + IN EFI_PEI_RSC_HANDLER_CALLBACK Callback +); + +typedef struct _EFI_PEI_RSC_HANDLER_PPI { + EFI_PEI_RSC_HANDLER_REGISTER Register; + EFI_PEI_RSC_HANDLER_UNREGISTER Unregister; +} EFI_PEI_RSC_HANDLER_PPI; + +extern EFI_GUID gEfiPeiRscHandlerPpiGuid; + +#endif // __REPORT_STATUS_CODE_HANDLER_PPI_H__ diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Reset.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Reset.h new file mode 100644 index 00000000..db27cc32 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Reset.h @@ -0,0 +1,38 @@ +/** @file + This file declares Reset PPI used to reset the platform. + + This PPI is installed by some platform- or chipset-specific PEIM that + abstracts the Reset Service to other agents. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __RESET_PPI_H__ +#define __RESET_PPI_H__ + +#define EFI_PEI_RESET_PPI_GUID \ + { \ + 0xef398d58, 0x9dfd, 0x4103, {0xbf, 0x94, 0x78, 0xc6, 0xf4, 0xfe, 0x71, 0x2f } \ + } + +// +// EFI_PEI_RESET_PPI.ResetSystem() is equivalent to the +// PEI Service ResetSystem(). +// It is introduced in PIPeiCis.h. +// + +/// +/// This PPI provides provide a simple reset service. +/// +typedef struct { + EFI_PEI_RESET_SYSTEM ResetSystem; +} EFI_PEI_RESET_PPI; + +extern EFI_GUID gEfiPeiResetPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Reset2.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Reset2.h new file mode 100644 index 00000000..ae49d33a --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Reset2.h @@ -0,0 +1,32 @@ +/** @file + This file declares Reset2 PPI used to reset the platform. + + This PPI is installed by some platform- or chipset-specific PEIM that + abstracts the Reset Service to other agents. + + Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.4. + +**/ + +#ifndef __RESET2_PPI_H__ +#define __RESET2_PPI_H__ + +#define EFI_PEI_RESET2_PPI_GUID \ + { \ + 0x6cc45765, 0xcce4, 0x42fd, {0xbc, 0x56, 0x1, 0x1a, 0xaa, 0xc6, 0xc9, 0xa8 } \ + } + +/// +/// This PPI provides provide a simple reset service. +/// +typedef struct _EFI_PEI_RESET2_PPI { + EFI_PEI_RESET2_SYSTEM ResetSystem; +} EFI_PEI_RESET2_PPI; + +extern EFI_GUID gEfiPeiReset2PpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/S3Resume2.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/S3Resume2.h new file mode 100644 index 00000000..eb051ae8 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/S3Resume2.h @@ -0,0 +1,86 @@ +/** @file + This PPI produces functions to interpret and execute the PI boot script table. + + This PPI is published by a PEIM and provides for the restoration of the platform's + configuration when resuming from the ACPI S3 power state. The ability to execute + the boot script may depend on the availability of other PPIs. For example, if + the boot script includes an SMBus command, this PEIM looks for the relevant PPI + that is able to execute that command. + + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is defined in UEFI Platform Initialization Specification 1.2 Volume 5: + Standards + +**/ + +#ifndef __PEI_S3_RESUME_PPI_H__ +#define __PEI_S3_RESUME_PPI_H__ + +/// +/// Global ID for EFI_PEI_S3_RESUME2_PPI +/// +#define EFI_PEI_S3_RESUME2_PPI_GUID \ + { \ + 0x6D582DBC, 0xDB85, 0x4514, {0x8F, 0xCC, 0x5A, 0xDF, 0x62, 0x27, 0xB1, 0x47 } \ + } + +/// +/// Forward declaration for EFI_PEI_S3_RESUME_PPI +/// +typedef struct _EFI_PEI_S3_RESUME2_PPI EFI_PEI_S3_RESUME2_PPI; + +/** + Restores the platform to its preboot configuration for an S3 resume and + jumps to the OS waking vector. + + This function will restore the platform to its pre-boot configuration that was + pre-stored in the boot script table and transfer control to OS waking vector. + Upon invocation, this function is responsible for locating the following + information before jumping to OS waking vector: + - ACPI tables + - boot script table + - any other information that it needs + + The S3RestoreConfig() function then executes the pre-stored boot script table + and transitions the platform to the pre-boot state. The boot script is recorded + during regular boot using the EFI_S3_SAVE_STATE_PROTOCOL.Write() and + EFI_S3_SMM_SAVE_STATE_PROTOCOL.Write() functions. Finally, this function + transfers control to the OS waking vector. If the OS supports only a real-mode + waking vector, this function will switch from flat mode to real mode before + jumping to the waking vector. If all platform pre-boot configurations are + successfully restored and all other necessary information is ready, this + function will never return and instead will directly jump to the OS waking + vector. If this function returns, it indicates that the attempt to resume + from the ACPI S3 sleep state failed. + + @param[in] This Pointer to this instance of the PEI_S3_RESUME_PPI + + @retval EFI_ABORTED Execution of the S3 resume boot script table failed. + @retval EFI_NOT_FOUND Some necessary information that is used for the S3 + resume boot path could not be located. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_S3_RESUME_PPI_RESTORE_CONFIG2)( + IN EFI_PEI_S3_RESUME2_PPI *This + ); + +/** + EFI_PEI_S3_RESUME2_PPI accomplishes the firmware S3 resume boot + path and transfers control to OS. +**/ +struct _EFI_PEI_S3_RESUME2_PPI { + /// + /// Restores the platform to its preboot configuration for an S3 resume and + /// jumps to the OS waking vector. + /// + EFI_PEI_S3_RESUME_PPI_RESTORE_CONFIG2 S3RestoreConfig2; +}; + +extern EFI_GUID gEfiPeiS3Resume2PpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SecHobData.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SecHobData.h new file mode 100644 index 00000000..85d96683 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SecHobData.h @@ -0,0 +1,59 @@ +/** @file + This file declares Sec Hob Data PPI. + + This PPI provides a way for the SEC code to pass zero or more HOBs in a HOB list. + +Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.5. + +**/ + +#ifndef __SEC_HOB_DATA_PPI_H__ +#define __SEC_HOB_DATA_PPI_H__ + +#include <Pi/PiHob.h> + +#define EFI_SEC_HOB_DATA_PPI_GUID \ + { \ + 0x3ebdaf20, 0x6667, 0x40d8, {0xb4, 0xee, 0xf5, 0x99, 0x9a, 0xc1, 0xb7, 0x1f } \ + } + +typedef struct _EFI_SEC_HOB_DATA_PPI EFI_SEC_HOB_DATA_PPI; + +/** + Return a pointer to a buffer containing zero or more HOBs that + will be installed into the PEI HOB List. + + This function returns a pointer to a pointer to zero or more HOBs, + terminated with a HOB of type EFI_HOB_TYPE_END_OF_HOB_LIST. + Note: The HobList must not contain a EFI_HOB_HANDOFF_INFO_TABLE HOB (PHIT) HOB. + + @param[in] This Pointer to this PPI structure. + @param[out] HobList A pointer to a returned pointer to zero or more HOBs. + If no HOBs are to be returned, then the returned pointer + is a pointer to a HOB of type EFI_HOB_TYPE_END_OF_HOB_LIST. + + @retval EFI_SUCCESS This function completed successfully. + @retval EFI_NOT_FOUND No HOBS are available. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SEC_HOB_DATA_GET) ( + IN CONST EFI_SEC_HOB_DATA_PPI *This, + OUT EFI_HOB_GENERIC_HEADER **HobList +); + +/// +/// This PPI provides a way for the SEC code to pass zero or more HOBs in a HOB list. +/// +struct _EFI_SEC_HOB_DATA_PPI { + EFI_SEC_HOB_DATA_GET GetHobs; +}; + +extern EFI_GUID gEfiSecHobDataPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SecPlatformInformation.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SecPlatformInformation.h new file mode 100644 index 00000000..5246d2ac --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SecPlatformInformation.h @@ -0,0 +1,182 @@ +/** @file + This file declares Sec Platform Information PPI. + + This service is the primary handoff state into the PEI Foundation. + The Security (SEC) component creates the early, transitory memory + environment and also encapsulates knowledge of at least the + location of the Boot Firmware Volume (BFV). + +Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __SEC_PLATFORM_INFORMATION_PPI_H__ +#define __SEC_PLATFORM_INFORMATION_PPI_H__ + +#include <Pi/PiPeiCis.h> + +#define EFI_SEC_PLATFORM_INFORMATION_GUID \ + { \ + 0x6f8c2b35, 0xfef4, 0x448d, {0x82, 0x56, 0xe1, 0x1b, 0x19, 0xd6, 0x10, 0x77 } \ + } + +typedef struct _EFI_SEC_PLATFORM_INFORMATION_PPI EFI_SEC_PLATFORM_INFORMATION_PPI; + + +/// +/// EFI_HEALTH_FLAGS +/// Contains information generated by microcode, hardware, and/or the Itanium +/// processor PAL code about the state of the processor upon reset. +/// +typedef union { + struct { + /// + /// A 2-bit field indicating self-test state after reset. + /// + UINT32 Status : 2; + /// + /// A 1-bit field indicating whether testing has occurred. + /// If this field is zero, the processor has not been tested, + /// and no further fields in the self-test State parameter are valid. + /// + UINT32 Tested : 1; + /// + /// Reserved 13 bits. + /// + UINT32 Reserved1 :13; + /// + /// A 1-bit field. If set to 1, this indicates that virtual + /// memory features are not available. + /// + UINT32 VirtualMemoryUnavailable : 1; + /// + /// A 1-bit field. If set to 1, this indicates that IA-32 execution + /// is not available. + /// + UINT32 Ia32ExecutionUnavailable : 1; + /// + /// A 1-bit field. If set to 1, this indicates that the floating + /// point unit is not available. + /// + UINT32 FloatingPointUnavailable : 1; + /// + /// A 1-bit field. If set to 1, this indicates miscellaneous + /// functional failure other than vm, ia, or fp. + /// The test status field provides additional information on + /// test failures when the State field returns a value of + /// performance restricted or functionally restricted. + /// The value returned is implementation dependent. + /// + UINT32 MiscFeaturesUnavailable : 1; + /// + /// Reserved 12 bits. + /// + UINT32 Reserved2 :12; + } Bits; + UINT32 Uint32; +} EFI_HEALTH_FLAGS; + +#define NORMAL_BOOT_CALL 0x0 +#define RECOVERY_CHECK_CALL 0x3 + +typedef EFI_HEALTH_FLAGS X64_HANDOFF_STATUS; +typedef EFI_HEALTH_FLAGS IA32_HANDOFF_STATUS; +/// +/// The hand-off status structure for Itanium architecture. +/// +typedef struct { + /// + /// SALE_ENTRY state : 3 = Recovery_Check + /// and 0 = RESET or Normal_Boot phase. + /// + UINT8 BootPhase; + /// + /// Firmware status on entry to SALE. + /// + UINT8 FWStatus; + UINT16 Reserved1; + UINT32 Reserved2; + /// + /// Geographically significant unique processor ID assigned by PAL. + /// + UINT16 ProcId; + UINT16 Reserved3; + UINT8 IdMask; + UINT8 EidMask; + UINT16 Reserved4; + /// + /// Address to make PAL calls. + /// + UINT64 PalCallAddress; + /// + /// If the entry state is RECOVERY_CHECK, this contains the PAL_RESET + /// return address, and if entry state is RESET, this contains + /// address for PAL_authentication call. + /// + UINT64 PalSpecialAddress; + /// + /// GR35 from PALE_EXIT state. + /// + UINT64 SelfTestStatus; + /// + /// GR37 from PALE_EXIT state. + /// + UINT64 SelfTestControl; + UINT64 MemoryBufferRequired; +} ITANIUM_HANDOFF_STATUS; + +/// +/// EFI_SEC_PLATFORM_INFORMATION_RECORD. +/// +typedef union { + IA32_HANDOFF_STATUS IA32HealthFlags; + X64_HANDOFF_STATUS x64HealthFlags; + ITANIUM_HANDOFF_STATUS ItaniumHealthFlags; +} EFI_SEC_PLATFORM_INFORMATION_RECORD; + +/** + This interface conveys state information out of the Security (SEC) phase into PEI. + + This service is published by the SEC phase. The SEC phase handoff has an optional + EFI_PEI_PPI_DESCRIPTOR list as its final argument when control is passed from SEC into the + PEI Foundation. As such, if the platform supports the built-in self test (BIST) on IA-32 Intel + architecture or the PAL-A handoff state for Itanium architecture, this information is encapsulated + into the data structure abstracted by this service. This information is collected for the boot-strap + processor (BSP) on IA-32. For Itanium architecture, it is available on all processors that execute + the PEI Foundation. + + @param PeiServices The pointer to the PEI Services Table. + @param StructureSize The pointer to the variable describing size of the input buffer. + @param PlatformInformationRecord The pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD. + + @retval EFI_SUCCESS The data was successfully returned. + @retval EFI_BUFFER_TOO_SMALL The buffer was too small. The current buffer size needed to + hold the record is returned in StructureSize. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SEC_PLATFORM_INFORMATION)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN OUT UINT64 *StructureSize, + OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord +); + + +/// +/// This service abstracts platform-specific information. It is necessary +/// to convey this information to the PEI Foundation so that it can +/// discover where to begin dispatching PEIMs. +/// +struct _EFI_SEC_PLATFORM_INFORMATION_PPI { + EFI_SEC_PLATFORM_INFORMATION PlatformInformation; +}; + + +extern EFI_GUID gEfiSecPlatformInformationPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SecPlatformInformation2.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SecPlatformInformation2.h new file mode 100644 index 00000000..a61ece79 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SecPlatformInformation2.h @@ -0,0 +1,79 @@ +/** @file + This file declares Sec Platform Information2 PPI. + + This service is the primary handoff state into the PEI Foundation. + This service abstracts platform-specific information for many CPU's. + +Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced from PI Version 1.4. + +**/ + +#ifndef __SEC_PLATFORM_INFORMATION2_PPI_H__ +#define __SEC_PLATFORM_INFORMATION2_PPI_H__ + +#include <Ppi/SecPlatformInformation.h> + +#define EFI_SEC_PLATFORM_INFORMATION2_GUID \ + { \ + 0x9e9f374b, 0x8f16, 0x4230, {0x98, 0x24, 0x58, 0x46, 0xee, 0x76, 0x6a, 0x97 } \ + } + +typedef struct _EFI_SEC_PLATFORM_INFORMATION2_PPI EFI_SEC_PLATFORM_INFORMATION2_PPI; + +/// +/// EFI_SEC_PLATFORM_INFORMATION_CPU. +/// +typedef struct { + UINT32 CpuLocation; + EFI_SEC_PLATFORM_INFORMATION_RECORD InfoRecord; +} EFI_SEC_PLATFORM_INFORMATION_CPU; + +/// +/// EFI_SEC_PLATFORM_INFORMATION_RECORD2. +/// +typedef struct { + /// + /// The CPU location would be the local APIC ID + /// + UINT32 NumberOfCpus; + EFI_SEC_PLATFORM_INFORMATION_CPU CpuInstance[1]; +} EFI_SEC_PLATFORM_INFORMATION_RECORD2; + +/** + This interface conveys state information out of the Security (SEC) phase into PEI. + + This service is published by the SEC phase. + + @param PeiServices The pointer to the PEI Services Table. + @param StructureSize The pointer to the variable describing size of the input buffer. + @param PlatformInformationRecord2 The pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD2. + + @retval EFI_SUCCESS The data was successfully returned. + @retval EFI_BUFFER_TOO_SMALL The buffer was too small. The current buffer size needed to + hold the record is returned in StructureSize. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SEC_PLATFORM_INFORMATION2)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN OUT UINT64 *StructureSize, + OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2 +); + +/// +/// This service abstracts platform-specific information for many CPU's. +/// It is the multi-processor equivalent of PlatformInformation for +/// implementations that synchronize some, if not all CPU's in the SEC phase. +/// +struct _EFI_SEC_PLATFORM_INFORMATION2_PPI { + EFI_SEC_PLATFORM_INFORMATION2 PlatformInformation2; +}; + +extern EFI_GUID gEfiSecPlatformInformation2PpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Security2.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Security2.h new file mode 100644 index 00000000..887f6ef5 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Security2.h @@ -0,0 +1,95 @@ +/** @file + This file declares Pei Security2 PPI. + + This PPI is installed by some platform PEIM that abstracts the security + policy to the PEI Foundation, namely the case of a PEIM's authentication + state being returned during the PEI section extraction process. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __SECURITY2_PPI_H__ +#define __SECURITY2_PPI_H__ + +#define EFI_PEI_SECURITY2_PPI_GUID \ + { 0xdcd0be23, 0x9586, 0x40f4, { 0xb6, 0x43, 0x6, 0x52, 0x2c, 0xed, 0x4e, 0xde } } + + +typedef struct _EFI_PEI_SECURITY2_PPI EFI_PEI_SECURITY2_PPI; + +/** + Allows the platform builder to implement a security policy + in response to varying file authentication states. + + This service is published by some platform PEIM. The purpose of + this service is to expose a given platform's policy-based + response to the PEI Foundation. For example, if there is a PEIM + in a GUIDed encapsulation section and the extraction of the PEI + file section yields an authentication failure, there is no a + priori policy in the PEI Foundation. Specifically, this + situation leads to the question whether PEIMs that are either + not in GUIDed sections or are in sections whose authentication + fails should still be executed. + + @param PeiServices An indirect pointer to the PEI Services + Table published by the PEI Foundation. + @param This Interface pointer that implements the + particular EFI_PEI_SECURITY2_PPI instance. + @param AuthenticationStatus Authentication status of the file. + xx00 Image was not signed. + xxx1 Platform security policy override. + Assumes same meaning as 0010 (the image was signed, the + signature was tested, and the signature passed authentication test). + 0010 Image was signed, the signature was tested, + and the signature passed authentication test. + 0110 Image was signed and the signature was not tested. + 1010 Image was signed, the signature was tested, + and the signature failed the authentication test. + @param FvHandle Handle of the volume in which the file + resides. This allows different policies + depending on different firmware volumes. + @param FileHandle Handle of the file under review. + @param DeferExecution Pointer to a variable that alerts the + PEI Foundation to defer execution of a + PEIM. + + @retval EFI_SUCCESS The service performed its action successfully. + @retval EFI_SECURITY_VIOLATION The object cannot be trusted. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SECURITY_AUTHENTICATION_STATE)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_SECURITY2_PPI *This, + IN UINT32 AuthenticationStatus, + IN EFI_PEI_FV_HANDLE FvHandle, + IN EFI_PEI_FILE_HANDLE FileHandle, + IN OUT BOOLEAN *DeferExecution +); + +/// +/// This PPI is a means by which the platform builder can indicate +/// a response to a PEIM's authentication state. This can be in +/// the form of a requirement for the PEI Foundation to skip a +/// module using the DeferExecution Boolean output in the +/// AuthenticationState() member function. Alternately, the +/// Security PPI can invoke something like a cryptographic PPI +/// that hashes the PEIM contents to log attestations, for which +/// the FileHandle parameter in AuthenticationState() will be +/// useful. If this PPI does not exist, PEIMs will be considered +/// trusted. +/// +struct _EFI_PEI_SECURITY2_PPI { + EFI_PEI_SECURITY_AUTHENTICATION_STATE AuthenticationState; +}; + + +extern EFI_GUID gEfiPeiSecurity2PpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Smbus2.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Smbus2.h new file mode 100644 index 00000000..69f9fa18 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Smbus2.h @@ -0,0 +1,197 @@ +/** @file + This file declares Smbus2 PPI. + This PPI provides the basic I/O interfaces that a PEIM uses to access its + SMBus controller and the slave devices attached to it. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __PEI_SMBUS2_PPI_H__ +#define __PEI_SMBUS2_PPI_H__ + +#include <IndustryStandard/SmBus.h> + +#define EFI_PEI_SMBUS2_PPI_GUID \ + { 0x9ca93627, 0xb65b, 0x4324, { 0xa2, 0x2, 0xc0, 0xb4, 0x61, 0x76, 0x45, 0x43 } } + + +typedef struct _EFI_PEI_SMBUS2_PPI EFI_PEI_SMBUS2_PPI; + +/** + Executes an SMBus operation to an SMBus controller. Returns when either + the command has been executed or an error is encountered in doing the operation. + + @param This A pointer to the EFI_PEI_SMBUS2_PPI instance. + @param SlaveAddress The SMBUS hardware address to which the SMBUS device is preassigned or + allocated. + @param Command This command is transmitted by the SMBus host controller to the SMBus slave + device and the interpretation is SMBus slave device specific. + It can mean the offset to a list of functions inside + an SMBus slave device. Not all operations or slave devices support + this command's registers. + @param Operation Signifies which particular SMBus hardware protocol instance that it + will use to execute the SMBus transactions. + This SMBus hardware protocol is defined by the System Management Bus (SMBus) + Specification and is not related to UEFI. + @param PecCheck Defines if Packet Error Code (PEC) checking is required for this operation. + @param Length Signifies the number of bytes that this operation will do. + The maximum number of bytes can be revision specific and operation specific. + This parameter will contain the actual number of bytes that are executed + for this operation. Not all operations require this argument. + @param Buffer Contains the value of data to execute to the SMBus slave device. + Not all operations require this argument. + The length of this buffer is identified by Length. + + + @retval EFI_SUCCESS The last data that was returned from the access + matched the poll exit criteria. + @retval EFI_CRC_ERROR The checksum is not correct (PEC is incorrect) + @retval EFI_TIMEOUT Timeout expired before the operation was completed. + Timeout is determined by the SMBus host controller device. + @retval EFI_OUT_OF_RESOURCES The request could not be completed + due to a lack of resources. + @retval EFI_DEVICE_ERROR The request was not completed because + a failure reflected in the Host Status Register bit. + @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION. + Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and + EfiSmbusQuickWrite. Or Length is outside the range of valid values. + @retval EFI_UNSUPPORTED The SMBus operation or PEC is not supported. + @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for this operation. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION)( + IN CONST EFI_PEI_SMBUS2_PPI *This, + IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress, + IN EFI_SMBUS_DEVICE_COMMAND Command, + IN EFI_SMBUS_OPERATION Operation, + IN BOOLEAN PecCheck, + IN OUT UINTN *Length, + IN OUT VOID *Buffer +); + +/** + The ArpDevice() function enumerates the entire bus or enumerates a specific + device that is identified by SmbusUdid. + + @param This A pointer to the EFI_PEI_SMBUS2_PPI instance. + @param ArpAll A Boolean expression that indicates if the host drivers need + to enumerate all the devices or enumerate only the device that is identified + by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional. + If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address + will be at SlaveAddress. + @param SmbusUdid The targeted SMBus Unique Device Identifier (UDID). + The UDID may not exist for SMBus devices with fixed addresses. + @param SlaveAddress The new SMBus address for the slave device for + which the operation is targeted. + + @retval EFI_SUCCESS The SMBus slave device address was set. + @retval EFI_INVALID_PARAMETER SlaveAddress is NULL. + @retval EFI_OUT_OF_RESOURCES The request could not be completed + due to a lack of resources. + @retval EFI_TIMEOUT The SMBus slave device did not respond. + @retval EFI_DEVICE_ERROR The request was not completed because the transaction failed. + @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SMBUS2_PPI_ARP_DEVICE)( + IN CONST EFI_PEI_SMBUS2_PPI *This, + IN BOOLEAN ArpAll, + IN EFI_SMBUS_UDID *SmbusUdid, OPTIONAL + IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL +); + +/** + The GetArpMap() function returns the mapping of all the SMBus devices + that are enumerated by the SMBus host driver. + + @param This A pointer to the EFI_PEI_SMBUS2_PPI instance. + @param Length Size of the buffer that contains the SMBus device map. + @param SmbusDeviceMap The pointer to the device map as enumerated + by the SMBus controller driver. + + @retval EFI_SUCCESS The device map was returned correctly in the buffer. + @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not implemented by this PEIM. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SMBUS2_PPI_GET_ARP_MAP)( + IN CONST EFI_PEI_SMBUS2_PPI *This, + IN OUT UINTN *Length, + IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap +); + +/** + CallBack function can be registered in EFI_PEI_SMBUS2_PPI_NOTIFY. + + @param This A pointer to the EFI_PEI_SMBUS2_PPI instance. + @param SlaveAddress The SMBUS hardware address to which the SMBUS + device is preassigned or allocated. + @param Data Data of the SMBus host notify command that + the caller wants to be called. + + @retval EFI_SUCCESS NotifyFunction has been registered. + @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not + implemented by this PEIM. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SMBUS_NOTIFY2_FUNCTION)( + IN CONST EFI_PEI_SMBUS2_PPI *SmbusPpi, + IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress, + IN UINTN Data +); + +/** + The Notify() function registers all the callback functions to allow the + bus driver to call these functions when the SlaveAddress/Data pair happens. + + @param This A pointer to the EFI_PEI_SMBUS2_PPI instance. + @param SlaveAddress Address that the host controller detects as + sending a message and calls all the registered functions. + @param Data Data that the host controller detects as sending a message + and calls all the registered functions. + @param NotifyFunction The function to call when the bus driver + detects the SlaveAddress and Data pair. + + @retval EFI_SUCCESS NotifyFunction has been registered. + @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are not + implemented by this PEIM. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SMBUS2_PPI_NOTIFY)( + IN CONST EFI_PEI_SMBUS2_PPI *This, + IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress, + IN UINTN Data, + IN EFI_PEI_SMBUS_NOTIFY2_FUNCTION NotifyFunction +); + +/// +/// Provides the basic I/O interfaces that a PEIM uses to access +/// its SMBus controller and the slave devices attached to it. +/// +struct _EFI_PEI_SMBUS2_PPI { + EFI_PEI_SMBUS2_PPI_EXECUTE_OPERATION Execute; + EFI_PEI_SMBUS2_PPI_ARP_DEVICE ArpDevice; + EFI_PEI_SMBUS2_PPI_GET_ARP_MAP GetArpMap; + EFI_PEI_SMBUS2_PPI_NOTIFY Notify; + /// + /// Identifier which uniquely identifies this SMBus controller in a system. + /// + EFI_GUID Identifier; +}; + +extern EFI_GUID gEfiPeiSmbus2PpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Stall.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Stall.h new file mode 100644 index 00000000..f0dc62a2 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Stall.h @@ -0,0 +1,56 @@ +/** @file + This file declares Stall PPI. + + This ppi abstracts the blocking stall service to other agents. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __STALL_PPI_H__ +#define __STALL_PPI_H__ + +#define EFI_PEI_STALL_PPI_GUID \ + { 0x1f4c6f90, 0xb06b, 0x48d8, {0xa2, 0x01, 0xba, 0xe5, 0xf1, 0xcd, 0x7d, 0x56 } } + +typedef struct _EFI_PEI_STALL_PPI EFI_PEI_STALL_PPI; + +/** + The Stall() function provides a blocking stall for at least the number + of microseconds stipulated in the final argument of the API. + + @param PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param This Pointer to the local data for the interface. + @param Microseconds Number of microseconds for which to stall. + + @retval EFI_SUCCESS The service provided at least the required delay. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_STALL)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_STALL_PPI *This, + IN UINTN Microseconds + ); + +/// +/// This service provides a simple, blocking stall with platform-specific resolution. +/// +struct _EFI_PEI_STALL_PPI { + /// + /// The resolution in microseconds of the stall services. + /// + UINTN Resolution; + + EFI_PEI_STALL Stall; +}; + +extern EFI_GUID gEfiPeiStallPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/StatusCode.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/StatusCode.h new file mode 100644 index 00000000..29de3fc4 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/StatusCode.h @@ -0,0 +1,35 @@ +/** @file + This file declares Status Code PPI. + This ppi provides a service that allows PEIMs to report status codes. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __STATUS_CODE_PPI_H__ +#define __STATUS_CODE_PPI_H__ + +#define EFI_PEI_REPORT_PROGRESS_CODE_PPI_GUID \ + { 0x229832d3, 0x7a30, 0x4b36, {0xb8, 0x27, 0xf4, 0xc, 0xb7, 0xd4, 0x54, 0x36 } } + +// +// EFI_PEI_PROGRESS_CODE_PPI.ReportStatusCode() is equivalent to the +// PEI Service ReportStatusCode(). +// It is introduced in PIPeiCis.h. +// + +/// +/// This PPI provides the service to report status code. +/// There can be only one instance of this service in the system. +/// +typedef struct { + EFI_PEI_REPORT_STATUS_CODE ReportStatusCode; +} EFI_PEI_PROGRESS_CODE_PPI; + +extern EFI_GUID gEfiPeiStatusCodePpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SuperIo.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SuperIo.h new file mode 100644 index 00000000..319155f5 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/SuperIo.h @@ -0,0 +1,183 @@ +/** @file + This PPI provides the super I/O register access functionality. + + Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is from PI Version 1.2.1. + +**/ + +#ifndef __EFI_SUPER_IO_PPI_H__ +#define __EFI_SUPER_IO_PPI_H__ + +#include <Protocol/SuperIo.h> + +#define EFI_SIO_PPI_GUID \ + { \ + 0x23a464ad, 0xcb83, 0x48b8, {0x94, 0xab, 0x1a, 0x6f, 0xef, 0xcf, 0xe5, 0x22} \ + } + +typedef struct _EFI_SIO_PPI EFI_SIO_PPI; +typedef struct _EFI_SIO_PPI *PEFI_SIO_PPI; + +typedef UINT16 EFI_SIO_REGISTER; +#define EFI_SIO_REG(ldn,reg) (EFI_SIO_REGISTER) (((ldn) << 8) | reg) +#define EFI_SIO_LDN_GLOBAL 0xFF + +/** + Read a Super I/O register. + + The register is specified as an 8-bit logical device number and an 8-bit + register value. The logical device numbers for specific SIO devices can be + determined using the Info member of the PPI structure. + + @param PeiServices A pointer to a pointer to the PEI Services. + @param This A pointer to this instance of the EFI_SIO_PPI. + @param ExitCfgMode A boolean specifying whether the driver should turn on + configuration mode (FALSE) or turn off configuration mode + (TRUE) after completing the read operation. The driver must + track the current state of the configuration mode (if any) + and turn on configuration mode (if necessary) prior to + register access. + @param Register A value specifying the logical device number (bits 15:8) + and the register to read (bits 7:0). The logical device + number of EFI_SIO_LDN_GLOBAL indicates that global + registers will be used. + @param IoData A pointer to the returned register value. + + @retval EFI_SUCCESS Success. + @retval EFI_TIMEOUT The register could not be read in the a reasonable + amount of time. The exact time is device-specific. + @retval EFI_INVALID_PARAMETERS Register was out of range for this device. + @retval EFI_INVALID_PARAMETERS IoData was NULL + @retval EFI_DEVICE_ERROR There was a device fault or the device was not present. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SIO_REGISTER_READ)( + IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_SIO_PPI *This, + IN BOOLEAN ExitCfgMode, + IN EFI_SIO_REGISTER Register, + OUT UINT8 *IoData + ); + +/** + Write a Super I/O register. + + The register is specified as an 8-bit logical device number and an 8-bit register + value. The logical device numbers for specific SIO devices can be determined + using the Info member of the PPI structure. + + @param PeiServices A pointer to a pointer to the PEI Services. + @param This A pointer to this instance of the EFI_SIO_PPI. + @param ExitCfgMode A boolean specifying whether the driver should turn on + configuration mode (FALSE) or turn off configuration mode + (TRUE) after completing the read operation. The driver must + track the current state of the configuration mode (if any) + and turn on configuration mode (if necessary) prior to + register access. + @param Register A value specifying the logical device number (bits 15:8) + and the register to read (bits 7:0). The logical device + number of EFI_SIO_LDN_GLOBAL indicates that global + registers will be used. + @param IoData A pointer to the returned register value. + + @retval EFI_SUCCESS Success. + @retval EFI_TIMEOUT The register could not be read in the a reasonable + amount of time. The exact time is device-specific. + @retval EFI_INVALID_PARAMETERS Register was out of range for this device. + @retval EFI_INVALID_PARAMETERS IoData was NULL + @retval EFI_DEVICE_ERROR There was a device fault or the device was not present. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SIO_REGISTER_WRITE)( + IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_SIO_PPI *This, + IN BOOLEAN ExitCfgMode, + IN EFI_SIO_REGISTER Register, + IN UINT8 IoData + ); + +/** + Provides an interface for a table based programming of the Super I/O registers. + + The Modify() function provides an interface for table based programming of the + Super I/O registers. This function can be used to perform programming of + multiple Super I/O registers with a single function call. For each table entry, + the Register is read, its content is bitwise ANDed with AndMask, and then ORed + with OrMask before being written back to the Register. The Super I/O driver + must track the current state of the Super I/O and enable the configuration mode + of Super I/O if necessary prior to table processing. Once the table is processed, + the Super I/O device must be returned to the original state. + + @param PeiServices A pointer to a pointer to the PEI Services. + @param This A pointer to this instance of the EFI_SIO_PPI. + @param Command A pointer to an array of NumberOfCommands EFI_SIO_REGISTER_MODIFY + structures. Each structure specifies a single Super I/O register + modify operation. + @param NumberOfCommands The number of elements in the Command array. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETERS Command is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_SIO_REGISTER_MODIFY)( + IN EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_SIO_PPI *This, + IN CONST EFI_SIO_REGISTER_MODIFY *Command, + IN UINTN NumberOfCommands + ); + +/// +/// Specifies the end of the information list. +/// +#define EFI_ACPI_PNP_HID_END EFI_PNP_ID (0x0000) + +typedef UINT32 EFI_ACPI_HID; +typedef UINT32 EFI_ACPI_UID; +#pragma pack(1) +typedef struct _EFI_SIO_INFO { + EFI_ACPI_HID Hid; + EFI_ACPI_UID Uid; + UINT8 Ldn; +} EFI_SIO_INFO, *PEFI_SIO_INFO; +#pragma pack() + +/// +/// This PPI provides low-level access to Super I/O registers using Read() and +/// Write(). It also uniquely identifies this Super I/O controller using a GUID +/// and provides mappings between ACPI style PNP IDs and the logical device numbers. +/// There is one instance of this PPI per Super I/O device. +/// +struct _EFI_SIO_PPI { + /// + /// This function reads a register's value from the Super I/O controller. + /// + EFI_PEI_SIO_REGISTER_READ Read; + /// + /// This function writes a value to a register in the Super I/O controller. + /// + EFI_PEI_SIO_REGISTER_WRITE Write; + /// + /// This function modifies zero or more registers in the Super I/O controller + /// using a table. + /// + EFI_PEI_SIO_REGISTER_MODIFY Modify; + /// + /// This GUID uniquely identifies the Super I/O controller. + /// + EFI_GUID SioGuid; + /// + /// This pointer is to an array which maps EISA identifiers to logical devices numbers. + /// + PEFI_SIO_INFO Info; +}; + +extern EFI_GUID gEfiSioPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/TemporaryRamDone.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/TemporaryRamDone.h new file mode 100644 index 00000000..7af15586 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/TemporaryRamDone.h @@ -0,0 +1,46 @@ +/** @file + This file declares Temporary RAM Done PPI. + The PPI that provides a service to disable the use of Temporary RAM. + + Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.2.1. + +**/ + +#ifndef __TEMPORARY_RAM_DONE_H__ +#define __TEMPORARY_RAM_DONE_H__ + +#define EFI_PEI_TEMPORARY_RAM_DONE_PPI_GUID \ + { 0xceab683c, 0xec56, 0x4a2d, { 0xa9, 0x6, 0x40, 0x53, 0xfa, 0x4e, 0x9c, 0x16 } } + +/** + TemporaryRamDone() disables the use of Temporary RAM. If present, this service is invoked + by the PEI Foundation after the EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI is installed. + + @retval EFI_SUCCESS Use of Temporary RAM was disabled. + @retval EFI_INVALID_PARAMETER Temporary RAM could not be disabled. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_PEI_TEMPORARY_RAM_DONE) ( + VOID + ); + +/// +/// This is an optional PPI that may be produced by SEC or a PEIM. If present, it provide a service to +/// disable the use of Temporary RAM. This service may only be called by the PEI Foundation after the +/// transition from Temporary RAM to Permanent RAM is complete. This PPI provides an alternative +/// to the Temporary RAM Migration PPI for system architectures that allow Temporary RAM and +/// Permanent RAM to be enabled and accessed at the same time with no side effects. +/// +typedef struct _EFI_PEI_TEMPORARY_RAM_DONE_PPI { + EFI_PEI_TEMPORARY_RAM_DONE TemporaryRamDone; +} EFI_PEI_TEMPORARY_RAM_DONE_PPI; + +extern EFI_GUID gEfiTemporaryRamDonePpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/TemporaryRamSupport.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/TemporaryRamSupport.h new file mode 100644 index 00000000..e904d656 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/TemporaryRamSupport.h @@ -0,0 +1,60 @@ +/** @file + This file declares Temporary RAM Support PPI. + This Ppi provides the service that migrates temporary RAM into permanent memory. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.0. + +**/ + +#ifndef __TEMPORARY_RAM_SUPPORT_H__ +#define __TEMPORARY_RAM_SUPPORT_H__ + +/// +/// Note: The GUID name EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI_GUID is different from the current +/// PI 1.2 spec. +/// +#define EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI_GUID \ + { 0xdbe23aa9, 0xa345, 0x4b97, {0x85, 0xb6, 0xb2, 0x26, 0xf1, 0x61, 0x73, 0x89} } + + +/** + This service of the EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into + permanent memory. + + @param PeiServices Pointer to the PEI Services Table. + @param TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the + Temporary RAM contents. + @param PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the + Temporary RAM contents. + @param CopySize Amount of memory to migrate from temporary to permanent memory. + + @retval EFI_SUCCESS The data was successfully returned. + @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when + TemporaryMemoryBase > PermanentMemoryBase. + +**/ +typedef +EFI_STATUS +(EFIAPI * TEMPORARY_RAM_MIGRATION)( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, + IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, + IN UINTN CopySize +); + +/// +/// This service abstracts the ability to migrate contents of the platform early memory store. +/// Note: The name EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI is different from the current PI 1.2 spec. +/// This PPI was optional. +/// +typedef struct { + TEMPORARY_RAM_MIGRATION TemporaryRamMigration; +} EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI; + +extern EFI_GUID gEfiTemporaryRamSupportPpiGuid; + +#endif diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/VectorHandoffInfo.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/VectorHandoffInfo.h new file mode 100644 index 00000000..52c904a4 --- /dev/null +++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/VectorHandoffInfo.h @@ -0,0 +1,69 @@ +/** @file + This file declares Vector Handoff Info PPI that describes an array of + interrupt and/or exception vectors that are in use and need to persist. + + This is an optional PPI that may be produced by SEC. If present, it provides + a description of the interrupt and/or exception vectors that were established + in the SEC Phase and need to persist into PEI and DXE. + + Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + This PPI is introduced in PI Version 1.2.1. + +**/ + +#ifndef __VECTOR_HANDOFF_INFO_H__ +#define __VECTOR_HANDOFF_INFO_H__ + +/// +/// NOTE: EFI_PEI_VECTOR_HANDOFF_INFO_PPI_GUID can also be used in the PEI Phase +/// to build a GUIDed HOB that contains an array of EFI_VECTOR_HANDOFF_INFO. +/// +#define EFI_PEI_VECTOR_HANDOFF_INFO_PPI_GUID \ + { 0x3cd652b4, 0x6d33, 0x4dce, { 0x89, 0xdb, 0x83, 0xdf, 0x97, 0x66, 0xfc, 0xca }} + +/// +/// Vector Handoff Info Attributes +///@{ +#define EFI_VECTOR_HANDOFF_DO_NOT_HOOK 0x00000000 +#define EFI_VECTOR_HANDOFF_HOOK_BEFORE 0x00000001 +#define EFI_VECTOR_HANDOFF_HOOK_AFTER 0x00000002 +#define EFI_VECTOR_HANDOFF_LAST_ENTRY 0x80000000 +///@} + +/// +/// EFI_VECTOR_HANDOFF_INFO entries that describes the interrupt and/or +/// exception vectors in use in the PEI Phase. +/// +typedef struct { + // + // The interrupt or exception vector that is in use and must be preserved. + // + UINT32 VectorNumber; + // + // A bitmask that describes the attributes of the interrupt or exception vector. + // + UINT32 Attribute; + // + // The GUID identifies the party who created the entry. For the + // EFI_VECTOR_HANDOFF_DO_NOT_HOOK case, this establishes the single owner. + // + EFI_GUID Owner; +} EFI_VECTOR_HANDOFF_INFO; + +/// +/// Provides a description of the interrupt and/or exception vectors that +/// were established in the SEC Phase and need to persist into PEI and DXE. +/// +typedef struct _EFI_PEI_VECTOR_HANDOFF_INFO_PPI { + // + // Pointer to an array of interrupt and /or exception vectors. + // + EFI_VECTOR_HANDOFF_INFO *Info; +} EFI_PEI_VECTOR_HANDOFF_INFO_PPI; + +extern EFI_GUID gEfiVectorHandoffInfoPpiGuid; + +#endif |