summaryrefslogtreecommitdiffstats
path: root/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
commitf215e02bf85f68d3a6106c2a1f4f7f063f819064 (patch)
tree6bb5b92c046312c4e95ac2620b10ddf482d3fa8b /src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol
parentInitial commit. (diff)
downloadvirtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.tar.xz
virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.zip
Adding upstream version 7.0.14-dfsg.upstream/7.0.14-dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol')
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidBootImg.h41
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidFastbootPlatform.h139
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidFastbootTransport.h125
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedDevice.h52
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedExternalDevice.h88
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedGpio.h178
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/HardwareInterrupt.h164
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h176
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/MmcHost.h184
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PeCoffLoader.h235
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PlatformBootManager.h80
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h59
-rw-r--r--src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/UsbDevice.h112
13 files changed, 1633 insertions, 0 deletions
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidBootImg.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidBootImg.h
new file mode 100644
index 00000000..af873fe1
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidBootImg.h
@@ -0,0 +1,41 @@
+/** @file
+
+ Copyright (c) 2017, Linaro. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __ANDROID_BOOTIMG_PROTOCOL_H__
+#define __ANDROID_BOOTIMG_PROTOCOL_H__
+
+//
+// Protocol interface structure
+//
+typedef struct _ANDROID_BOOTIMG_PROTOCOL ANDROID_BOOTIMG_PROTOCOL;
+
+//
+// Function Prototypes
+//
+typedef
+EFI_STATUS
+(EFIAPI *ANDROID_BOOTIMG_APPEND_KERNEL_ARGS) (
+ IN CHAR16 *Args,
+ IN UINTN Size
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *ANDROID_BOOTIMG_UPDATE_DTB) (
+ IN EFI_PHYSICAL_ADDRESS OrigDtbBase,
+ OUT EFI_PHYSICAL_ADDRESS *NewDtbBase
+ );
+
+struct _ANDROID_BOOTIMG_PROTOCOL {
+ ANDROID_BOOTIMG_APPEND_KERNEL_ARGS AppendArgs;
+ ANDROID_BOOTIMG_UPDATE_DTB UpdateDtb;
+};
+
+extern EFI_GUID gAndroidBootImgProtocolGuid;
+
+#endif /* __ANDROID_BOOTIMG_PROTOCOL_H__ */
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidFastbootPlatform.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidFastbootPlatform.h
new file mode 100644
index 00000000..d3a5c0b4
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidFastbootPlatform.h
@@ -0,0 +1,139 @@
+/** @file
+
+ Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __ANDROID_FASTBOOT_PLATFORM_H__
+#define __ANDROID_FASTBOOT_PLATFORM_H__
+
+extern EFI_GUID gAndroidFastbootPlatformProtocolGuid;
+
+/*
+ Protocol for platform-specific operations initiated by Android Fastboot.
+
+ Based on Fastboot Protocol version 0.4. See
+ system/core/fastboot/fastboot_protocol.txt in the AOSP source tree for more
+ info.
+
+ Doesn't support image verification.
+*/
+
+/*
+ Do any initialisation that needs to be done in order to be able to respond to
+ commands.
+
+ @retval EFI_SUCCESS Initialised successfully.
+ @retval !EFI_SUCCESS Error in initialisation.
+*/
+typedef
+EFI_STATUS
+(*FASTBOOT_PLATFORM_INIT) (
+ VOID
+ );
+
+/*
+ To be called when Fastboot is finished and we aren't rebooting or booting an
+ image. Undo initialisation, free resources.
+*/
+typedef
+VOID
+(*FASTBOOT_PLATFORM_UN_INIT) (
+ VOID
+ );
+
+/*
+ Flash the partition named (according to a platform-specific scheme)
+ PartitionName, with the image pointed to by Buffer, whose size is BufferSize.
+
+ @param[in] PartitionName Null-terminated name of partition to write.
+ @param[in] BufferSize Size of Buffer in bytes.
+ @param[in] Buffer Data to write to partition.
+
+ @retval EFI_NOT_FOUND No such partition.
+ @retval EFI_DEVICE_ERROR Flashing failed.
+*/
+typedef
+EFI_STATUS
+(*FASTBOOT_PLATFORM_FLASH) (
+ IN CHAR8 *PartitionName,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
+ );
+
+/*
+ Erase the partition named PartitionName.
+
+ @param[in] PartitionName Null-terminated name of partition to erase.
+
+ @retval EFI_NOT_FOUND No such partition.
+ @retval EFI_DEVICE_ERROR Erasing failed.
+*/
+typedef
+EFI_STATUS
+(*FASTBOOT_PLATFORM_ERASE) (
+ IN CHAR8 *PartitionName
+ );
+
+/*
+ If the variable referred to by Name exists, copy it (as a null-terminated
+ string) into Value. If it doesn't exist, put the Empty string in Value.
+
+ Variable names and values may not be larger than 60 bytes, excluding the
+ terminal null character. This is a limitation of the Fastboot protocol.
+
+ The Fastboot application will handle platform-nonspecific variables
+ (Currently "version" is the only one of these.)
+
+ @param[in] Name Null-terminated name of Fastboot variable to retrieve.
+ @param[out] Value Caller-allocated buffer for null-terminated value of
+ variable.
+
+ @retval EFI_SUCCESS The variable was retrieved, or it doesn't exist.
+ @retval EFI_DEVICE_ERROR There was an error looking up the variable. This
+ does _not_ include the variable not existing.
+*/
+typedef
+EFI_STATUS
+(*FASTBOOT_PLATFORM_GETVAR) (
+ IN CHAR8 *Name,
+ OUT CHAR8 *Value
+ );
+
+/*
+ React to an OEM-specific command.
+
+ Future versions of this function might want to allow the platform to do some
+ extra communication with the host. A way to do this would be to add a function
+ to the FASTBOOT_TRANSPORT_PROTOCOL that allows the implementation of
+ DoOemCommand to replace the ReceiveEvent with its own, and to restore the old
+ one when it's finished.
+
+ However at the moment although the specification allows it, the AOSP fastboot
+ host application doesn't handle receiving any data from the client, and it
+ doesn't support a data phase for OEM commands.
+
+ @param[in] Command Null-terminated command string.
+
+ @retval EFI_SUCCESS The command executed successfully.
+ @retval EFI_NOT_FOUND The command wasn't recognised.
+ @retval EFI_DEVICE_ERROR There was an error executing the command.
+*/
+typedef
+EFI_STATUS
+(*FASTBOOT_PLATFORM_OEM_COMMAND) (
+ IN CHAR8 *Command
+ );
+
+typedef struct _FASTBOOT_PLATFORM_PROTOCOL {
+ FASTBOOT_PLATFORM_INIT Init;
+ FASTBOOT_PLATFORM_UN_INIT UnInit;
+ FASTBOOT_PLATFORM_FLASH FlashPartition;
+ FASTBOOT_PLATFORM_ERASE ErasePartition;
+ FASTBOOT_PLATFORM_GETVAR GetVar;
+ FASTBOOT_PLATFORM_OEM_COMMAND DoOemCommand;
+} FASTBOOT_PLATFORM_PROTOCOL;
+
+#endif
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidFastbootTransport.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidFastbootTransport.h
new file mode 100644
index 00000000..3b4fe1af
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/AndroidFastbootTransport.h
@@ -0,0 +1,125 @@
+/** @file
+
+ Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+/*
+ Transport protocol over which Android Fastboot transactions can be made.
+ Fastboot is designed for USB, but this protocol is intended as an abstraction
+ so that it can be implemented over any transport mechanism.
+*/
+
+#ifndef __ANDROID_FASTBOOT_TRANSPORT_H__
+#define __ANDROID_FASTBOOT_TRANSPORT_H__
+
+extern EFI_GUID gAndroidFastbootTransportProtocolGuid;
+
+/*
+ Set up the transport system for use by Fastboot.
+ e.g. For USB this probably means making the device enumerable. For TCP,
+ preparing to accept incoming connections.
+
+ It is _not_ the responsibility of this protocol's implementer to unite the
+ data phase into a single buffer - that is handled by the Fastboot UEFI
+ application. As the Fastboot protocol spec says: "Short packets are always
+ acceptable and zero-length packets are ignored."
+ However the commands and responses must be in a single packet, and the order
+ of the packets must of course be maintained.
+
+ If there is a fatal error in the receive channel, ReceiveEvent will be
+ signalled, and a subsequent call to Receive() will return an error. This
+ allows data transported prior to the error to be received.
+
+ @param[in] ReceiveEvent Event to be Signalled when a packet has been received
+ and is ready to be retrieved via Receive().
+
+ @retval EFI_SUCCESS Initialised successfully.
+ @retval EFI_DEVICE_ERROR Error in initialising hardware
+ @retval (other) Error return from LocateProtocol functions.
+*/
+typedef
+EFI_STATUS
+(*FASTBOOT_TRANSPORT_START) (
+ IN EFI_EVENT ReceiveEvent
+ );
+
+/*
+ Function to be called when all Fastboot transactions are finished, to
+ de-initialise the transport system.
+ e.g. A USB OTG system might want to get out of peripheral mode so it can be
+ a USB host.
+
+ Note that this function will be called after an error is reported by Send or
+ Receive
+
+ @retval EFI_SUCCESS De-initialised successfully.
+ @retval EFI_DEVICE_ERROR Error de-initialising hardware.
+*/
+typedef
+EFI_STATUS
+(* FASTBOOT_TRANSPORT_STOP) (
+ VOID
+ );
+
+/*
+ Send data. This function can be used both for command responses like "OKAY"
+ and for the data phase (the protocol doesn't describe any situation when the
+ latter might be necessary, but does allow it)
+
+ Transmission need not finish before the function returns.
+ If there is an error in transmission from which the transport system cannot
+ recover, FatalErrorEvent will be signalled. Otherwise, it is assumed that all
+ data was delivered successfully.
+
+ @param[in] BufferSize Size in bytes of data to send.
+ @param[in] Buffer Data to send.
+ @param[in] FatalErrorEvent Event to signal if there was an error in
+ transmission from which the transport system
+ cannot recover.
+
+ @retval EFI_SUCCESS The data was sent or queued for send.
+ @retval EFI_DEVICE_ERROR There was an error preparing to send the data.
+ */
+typedef
+EFI_STATUS
+(*FASTBOOT_TRANSPORT_SEND) (
+ IN UINTN BufferSize,
+ IN CONST VOID *Buffer,
+ IN EFI_EVENT *FatalErrorEvent
+ );
+
+/*
+ When the event has been Signalled to say data is available from the host,
+ this function is used to get data. In order to handle the case where several
+ packets are received before ReceiveEvent's notify function is called, packets
+ received are queued, and each call to this function returns the next packet in
+ the queue. It should therefore be called in a loop, the exit condition being a
+ return of EFI_NOT_READY.
+
+ @param[out] Buffer Pointer to received data. Callee allocated - the
+ caller must free it with FreePool.
+ @param[out] BufferSize The size of received data in bytes
+
+ @retval EFI_NOT_READY There is no data available
+ @retval EFI_DEVICE_ERROR There was a fatal error in the receive channel.
+ e.g. for USB the cable was unplugged or for TCP the
+ connection was closed by the remote host..
+*/
+typedef
+EFI_STATUS
+(*FASTBOOT_TRANSPORT_RECEIVE) (
+ OUT UINTN *BufferSize,
+ OUT VOID **Buffer
+ );
+
+typedef struct _FASTBOOT_TRANSPORT_PROTOCOL {
+ FASTBOOT_TRANSPORT_START Start;
+ FASTBOOT_TRANSPORT_STOP Stop;
+ FASTBOOT_TRANSPORT_SEND Send;
+ FASTBOOT_TRANSPORT_RECEIVE Receive;
+} FASTBOOT_TRANSPORT_PROTOCOL;
+
+#endif
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedDevice.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedDevice.h
new file mode 100644
index 00000000..5084accb
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedDevice.h
@@ -0,0 +1,52 @@
+/** @file
+ Deal with devices that just exist in memory space.
+
+ To follow the EFI driver model you need a root handle to start with. An
+ EFI driver will have a driver binding protocol (Supported, Start, Stop)
+ that is used to layer on top of a handle via a gBS->ConnectController.
+ The first handle has to just be in the system to make that work. For
+ PCI it is a PCI Root Bridge IO protocol that provides the root.
+
+ On an embedded system with MMIO device we need a handle to just
+ show up. That handle will have this protocol and a device path
+ protocol on it.
+
+ For an ethernet device the device path must contain a MAC address device path
+ node.
+
+ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __EMBEDDED_DEVICE_PROTOCOL_H__
+#define __EMBEDDED_DEVICE_PROTOCOL_H__
+
+
+//
+// Protocol GUID
+//
+// BF4B9D10-13EC-43dd-8880-E90B718F27DE
+
+#define EMBEDDED_DEVICE_PROTOCOL_GUID \
+ { 0xbf4b9d10, 0x13ec, 0x43dd, { 0x88, 0x80, 0xe9, 0xb, 0x71, 0x8f, 0x27, 0xde } }
+
+
+
+typedef struct {
+ UINT16 VendorId;
+ UINT16 DeviceId;
+ UINT16 RevisionId;
+ UINT16 SubsystemId;
+ UINT16 SubsystemVendorId;
+ UINT8 ClassCode[3];
+ UINT8 HeaderSize;
+ UINTN BaseAddress;
+} EMBEDDED_DEVICE_PROTOCOL;
+
+extern EFI_GUID gEmbeddedDeviceGuid;
+
+#endif
+
+
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedExternalDevice.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedExternalDevice.h
new file mode 100644
index 00000000..946c1ec2
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedExternalDevice.h
@@ -0,0 +1,88 @@
+/** @file
+
+ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __EMBEDDED_EXTERNAL_DEVICE_H__
+#define __EMBEDDED_EXTERNAL_DEVICE_H__
+
+//
+// Protocol GUID
+//
+#define EMBEDDED_EXTERNAL_DEVICE_PROTOCOL_GUID { 0x735F8C64, 0xD696, 0x44D0, { 0xBD, 0xF2, 0x44, 0x7F, 0xD0, 0x5A, 0x54, 0x06 }}
+
+//
+// Protocol interface structure
+//
+typedef struct _EMBEDDED_EXTERNAL_DEVICE EMBEDDED_EXTERNAL_DEVICE;
+
+//
+// Function Prototypes
+//
+typedef
+EFI_STATUS
+(EFIAPI *EMBEDDED_EXTERNAL_DEVICE_READ) (
+ IN EMBEDDED_EXTERNAL_DEVICE *This,
+ IN UINTN Register,
+ IN UINTN Length,
+ OUT VOID *Buffer
+ )
+/*++
+
+Routine Description:
+
+ Read a set of contiguous external device registers.
+
+Arguments:
+
+ This - pointer to protocol
+ Offset - starting register number
+ Length - number of bytes to read
+ Buffer - destination buffer
+
+Returns:
+
+ EFI_SUCCESS - registers read successfully
+
+--*/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *EMBEDDED_EXTERNAL_DEVICE_WRITE) (
+ IN EMBEDDED_EXTERNAL_DEVICE *This,
+ IN UINTN Register,
+ IN UINTN Length,
+ IN VOID *Buffer
+ )
+/*++
+
+Routine Description:
+
+ Write to a set of contiguous external device registers.
+
+Arguments:
+
+ This - pointer to protocol
+ Offset - starting register number
+ Length - number of bytes to write
+ Buffer - source buffer
+
+Returns:
+
+ EFI_SUCCESS - registers written successfully
+
+--*/
+;
+
+struct _EMBEDDED_EXTERNAL_DEVICE {
+ EMBEDDED_EXTERNAL_DEVICE_READ Read;
+ EMBEDDED_EXTERNAL_DEVICE_WRITE Write;
+};
+
+extern EFI_GUID gEmbeddedExternalDeviceProtocolGuid;
+
+#endif // __EMBEDDED_EXTERNAL_DEVICE_H__
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedGpio.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedGpio.h
new file mode 100644
index 00000000..1421a9bb
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/EmbeddedGpio.h
@@ -0,0 +1,178 @@
+/** @file
+
+ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __EMBEDDED_GPIO_H__
+#define __EMBEDDED_GPIO_H__
+
+//
+// Protocol interface structure
+//
+typedef struct _EMBEDDED_GPIO EMBEDDED_GPIO;
+
+//
+// Data Types
+//
+typedef UINTN EMBEDDED_GPIO_PIN;
+
+#define GPIO(Port, Pin) ((EMBEDDED_GPIO_PIN)(((Port) << (16)) | (Pin)))
+#define GPIO_PIN(x) ((EMBEDDED_GPIO_PIN)(x) & (0xFFFF))
+#define GPIO_PORT(x) ((EMBEDDED_GPIO_PIN)(x) >> (16))
+
+typedef enum {
+ GPIO_MODE_INPUT = 0x00,
+ GPIO_MODE_OUTPUT_0 = 0x0E,
+ GPIO_MODE_OUTPUT_1 = 0x0F,
+ GPIO_MODE_SPECIAL_FUNCTION_2 = 0x02,
+ GPIO_MODE_SPECIAL_FUNCTION_3 = 0x03,
+ GPIO_MODE_SPECIAL_FUNCTION_4 = 0x04,
+ GPIO_MODE_SPECIAL_FUNCTION_5 = 0x05,
+ GPIO_MODE_SPECIAL_FUNCTION_6 = 0x06,
+ GPIO_MODE_SPECIAL_FUNCTION_7 = 0x07
+} EMBEDDED_GPIO_MODE;
+
+typedef enum {
+ GPIO_PULL_NONE,
+ GPIO_PULL_UP,
+ GPIO_PULL_DOWN
+} EMBEDDED_GPIO_PULL;
+
+//
+// Function Prototypes
+//
+typedef
+EFI_STATUS
+(EFIAPI *EMBEDDED_GPIO_GET) (
+ IN EMBEDDED_GPIO *This,
+ IN EMBEDDED_GPIO_PIN Gpio,
+ OUT UINTN *Value
+ );
+/*++
+
+Routine Description:
+
+ Gets the state of a GPIO pin
+
+Arguments:
+
+ This - pointer to protocol
+ Gpio - which pin to read
+ Value - state of the pin
+
+Returns:
+
+ EFI_SUCCESS - GPIO state returned in Value
+
+--*/
+
+
+typedef
+EFI_STATUS
+(EFIAPI *EMBEDDED_GPIO_SET) (
+ IN EMBEDDED_GPIO *This,
+ IN EMBEDDED_GPIO_PIN Gpio,
+ IN EMBEDDED_GPIO_MODE Mode
+ );
+/*++
+
+Routine Description:
+
+ Sets the state of a GPIO pin
+
+Arguments:
+
+ This - pointer to protocol
+ Gpio - which pin to modify
+ Mode - mode to set
+
+Returns:
+
+ EFI_SUCCESS - GPIO set as requested
+
+--*/
+
+
+typedef
+EFI_STATUS
+(EFIAPI *EMBEDDED_GPIO_GET_MODE) (
+ IN EMBEDDED_GPIO *This,
+ IN EMBEDDED_GPIO_PIN Gpio,
+ OUT EMBEDDED_GPIO_MODE *Mode
+ );
+/*++
+
+Routine Description:
+
+ Gets the mode (function) of a GPIO pin
+
+Arguments:
+
+ This - pointer to protocol
+ Gpio - which pin
+ Mode - pointer to output mode value
+
+Returns:
+
+ EFI_SUCCESS - mode value retrieved
+
+--*/
+
+
+typedef
+EFI_STATUS
+(EFIAPI *EMBEDDED_GPIO_SET_PULL) (
+ IN EMBEDDED_GPIO *This,
+ IN EMBEDDED_GPIO_PIN Gpio,
+ IN EMBEDDED_GPIO_PULL Direction
+ );
+/*++
+
+Routine Description:
+
+ Sets the pull-up / pull-down resistor of a GPIO pin
+
+Arguments:
+
+ This - pointer to protocol
+ Gpio - which pin
+ Direction - pull-up, pull-down, or none
+
+Returns:
+
+ EFI_SUCCESS - pin was set
+
+--*/
+
+
+
+struct _EMBEDDED_GPIO {
+ EMBEDDED_GPIO_GET Get;
+ EMBEDDED_GPIO_SET Set;
+ EMBEDDED_GPIO_GET_MODE GetMode;
+ EMBEDDED_GPIO_SET_PULL SetPull;
+};
+
+extern EFI_GUID gEmbeddedGpioProtocolGuid;
+
+typedef struct _GPIO_CONTROLLER GPIO_CONTROLLER;
+typedef struct _PLATFORM_GPIO_CONTROLLER PLATFORM_GPIO_CONTROLLER;
+
+struct _GPIO_CONTROLLER {
+ UINTN RegisterBase;
+ UINTN GpioIndex;
+ UINTN InternalGpioCount;
+};
+
+struct _PLATFORM_GPIO_CONTROLLER {
+ UINTN GpioCount;
+ UINTN GpioControllerCount;
+ GPIO_CONTROLLER *GpioController;
+};
+
+extern EFI_GUID gPlatformGpioProtocolGuid;
+
+#endif
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/HardwareInterrupt.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/HardwareInterrupt.h
new file mode 100644
index 00000000..ff7dc572
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/HardwareInterrupt.h
@@ -0,0 +1,164 @@
+/** @file
+ Abstraction for hardware based interrupt routine
+
+ On non IA-32 systems it is common to have a single hardware interrupt vector
+ and a 2nd layer of software that routes the interrupt handlers based on the
+ interrupt source. This protocol enables this routing. The driver implementing
+ this protocol is responsible for clearing the pending interrupt in the
+ interrupt routing hardware. The HARDWARE_INTERRUPT_HANDLER is responsible
+ for clearing interrupt sources from individual devices.
+
+
+ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __HARDWARE_INTERRUPT_H__
+#define __HARDWARE_INTERRUPT_H__
+
+#include <Protocol/DebugSupport.h>
+
+
+//
+// Protocol GUID
+//
+// EAB39028-3D05-4316-AD0C-D64808DA3FF1
+
+#define EFI_HARDWARE_INTERRUPT_PROTOCOL_GGUID \
+ { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } }
+
+
+typedef struct _EFI_HARDWARE_INTERRUPT_PROTOCOL EFI_HARDWARE_INTERRUPT_PROTOCOL;
+
+
+typedef UINTN HARDWARE_INTERRUPT_SOURCE;
+
+
+/**
+ C Interrupt Handler calledin the interrupt context when Source interrupt is active.
+
+ @param Source Source of the interrupt. Hardware routing off a specific platform defines
+ what source means.
+ @param SystemContext Pointer to system register context. Mostly used by debuggers and will
+ update the system context after the return from the interrupt if
+ modified. Don't change these values unless you know what you are doing
+
+**/
+typedef
+VOID
+(EFIAPI *HARDWARE_INTERRUPT_HANDLER) (
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ );
+
+
+/**
+ Register Handler for the specified interrupt source.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+ @param Handler Callback for interrupt. NULL to unregister
+
+ @retval EFI_SUCCESS Source was updated to support Handler.
+ @retval EFI_DEVICE_ERROR Hardware could not be programmed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT_REGISTER) (
+ IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ IN HARDWARE_INTERRUPT_HANDLER Handler
+ );
+
+
+/**
+ Enable interrupt source Source.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+
+ @retval EFI_SUCCESS Source interrupt enabled.
+ @retval EFI_DEVICE_ERROR Hardware could not be programmed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT_ENABLE) (
+ IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source
+ );
+
+
+
+/**
+ Disable interrupt source Source.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+
+ @retval EFI_SUCCESS Source interrupt disabled.
+ @retval EFI_DEVICE_ERROR Hardware could not be programmed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT_DISABLE) (
+ IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source
+ );
+
+
+/**
+ Return current state of interrupt source Source.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+ @param InterruptState TRUE: source enabled, FALSE: source disabled.
+
+ @retval EFI_SUCCESS InterruptState is valid
+ @retval EFI_DEVICE_ERROR InterruptState is not valid
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT_INTERRUPT_STATE) (
+ IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ IN BOOLEAN *InterruptState
+ );
+
+/**
+ Signal to the hardware that the End Of Interrupt state
+ has been reached.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+
+ @retval EFI_SUCCESS Source interrupt EOI'ed.
+ @retval EFI_DEVICE_ERROR Hardware could not be programmed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT_END_OF_INTERRUPT) (
+ IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source
+ );
+
+
+struct _EFI_HARDWARE_INTERRUPT_PROTOCOL {
+ HARDWARE_INTERRUPT_REGISTER RegisterInterruptSource;
+ HARDWARE_INTERRUPT_ENABLE EnableInterruptSource;
+ HARDWARE_INTERRUPT_DISABLE DisableInterruptSource;
+ HARDWARE_INTERRUPT_INTERRUPT_STATE GetInterruptSourceState;
+ HARDWARE_INTERRUPT_END_OF_INTERRUPT EndOfInterrupt;
+};
+
+extern EFI_GUID gHardwareInterruptProtocolGuid;
+
+#endif
+
+
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h
new file mode 100644
index 00000000..b4dbc10d
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h
@@ -0,0 +1,176 @@
+/** @file
+
+ Copyright (c) 2016-2017, Linaro Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __HARDWARE_INTERRUPT2_H__
+#define __HARDWARE_INTERRUPT2_H__
+
+#include <Protocol/HardwareInterrupt.h>
+
+// 22838932-1a2d-4a47-aaba-f3f7cf569470
+
+#define EFI_HARDWARE_INTERRUPT2_PROTOCOL_GUID \
+ { 0x32898322, 0x2d1a, 0x474a, \
+ { 0xba, 0xaa, 0xf3, 0xf7, 0xcf, 0x56, 0x94, 0x70 } }
+
+typedef enum {
+ EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_LOW,
+ EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH,
+ EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_FALLING,
+ EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING,
+} EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE;
+
+typedef struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL \
+ EFI_HARDWARE_INTERRUPT2_PROTOCOL;
+
+/**
+ Register Handler for the specified interrupt source.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+ @param Handler Callback for interrupt. NULL to unregister
+
+ @retval EFI_SUCCESS Source was updated to support Handler.
+ @retval EFI_DEVICE_ERROR Hardware could not be programmed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT2_REGISTER) (
+ IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ IN HARDWARE_INTERRUPT_HANDLER Handler
+ );
+
+
+/**
+ Enable interrupt source Source.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+
+ @retval EFI_SUCCESS Source interrupt enabled.
+ @retval EFI_DEVICE_ERROR Hardware could not be programmed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT2_ENABLE) (
+ IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source
+ );
+
+
+/**
+ Disable interrupt source Source.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+
+ @retval EFI_SUCCESS Source interrupt disabled.
+ @retval EFI_DEVICE_ERROR Hardware could not be programmed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT2_DISABLE) (
+ IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source
+ );
+
+
+/**
+ Return current state of interrupt source Source.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+ @param InterruptState TRUE: source enabled, FALSE: source disabled.
+
+ @retval EFI_SUCCESS InterruptState is valid
+ @retval EFI_DEVICE_ERROR InterruptState is not valid
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT2_INTERRUPT_STATE) (
+ IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ IN BOOLEAN *InterruptState
+ );
+
+/**
+ Signal to the hardware that the End Of Interrupt state
+ has been reached.
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+
+ @retval EFI_SUCCESS Source interrupt EOI'ed.
+ @retval EFI_DEVICE_ERROR Hardware could not be programmed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT2_END_OF_INTERRUPT) (
+ IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source
+ );
+
+/**
+ Return the configured trigger type for an interrupt source
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+ @param TriggerType The configured trigger type
+
+ @retval EFI_SUCCESS Operation successful
+ @retval EFI_DEVICE_ERROR Information could not be returned
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE) (
+ IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ OUT EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE *TriggerType
+ );
+
+
+/**
+ Configure the trigger type for an interrupt source
+
+ @param This Instance pointer for this protocol
+ @param Source Hardware source of the interrupt
+ @param TriggerType The trigger type to configure
+
+ @retval EFI_SUCCESS Operation successful
+ @retval EFI_DEVICE_ERROR Hardware could not be programmed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE) (
+ IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ IN EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE TriggerType
+ );
+
+struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL {
+ HARDWARE_INTERRUPT2_REGISTER RegisterInterruptSource;
+ HARDWARE_INTERRUPT2_ENABLE EnableInterruptSource;
+ HARDWARE_INTERRUPT2_DISABLE DisableInterruptSource;
+ HARDWARE_INTERRUPT2_INTERRUPT_STATE GetInterruptSourceState;
+ HARDWARE_INTERRUPT2_END_OF_INTERRUPT EndOfInterrupt;
+
+ // v2 members
+ HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE GetTriggerType;
+ HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE SetTriggerType;
+};
+
+extern EFI_GUID gHardwareInterrupt2ProtocolGuid;
+
+#endif
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/MmcHost.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/MmcHost.h
new file mode 100644
index 00000000..03f4e7d0
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/MmcHost.h
@@ -0,0 +1,184 @@
+/** @file
+ Definition of the MMC Host Protocol
+
+ Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __MMC_HOST_H__
+#define __MMC_HOST_H__
+
+///
+/// Global ID for the MMC Host Protocol
+///
+#define EMBEDDED_MMC_HOST_PROTOCOL_GUID \
+ { 0x3e591c00, 0x9e4a, 0x11df, {0x92, 0x44, 0x00, 0x02, 0xA5, 0xD5, 0xC5, 0x1B } }
+
+#define MMC_RESPONSE_TYPE_R1 0
+#define MMC_RESPONSE_TYPE_R1b 0
+#define MMC_RESPONSE_TYPE_R2 1
+#define MMC_RESPONSE_TYPE_R3 0
+#define MMC_RESPONSE_TYPE_R6 0
+#define MMC_RESPONSE_TYPE_R7 0
+#define MMC_RESPONSE_TYPE_OCR 0
+#define MMC_RESPONSE_TYPE_CID 1
+#define MMC_RESPONSE_TYPE_CSD 1
+#define MMC_RESPONSE_TYPE_RCA 0
+
+typedef UINT32 MMC_RESPONSE_TYPE;
+
+typedef UINT32 MMC_CMD;
+
+#define MMC_CMD_WAIT_RESPONSE (1 << 16)
+#define MMC_CMD_LONG_RESPONSE (1 << 17)
+#define MMC_CMD_NO_CRC_RESPONSE (1 << 18)
+
+#define MMC_INDX(Index) ((Index) & 0xFFFF)
+#define MMC_GET_INDX(MmcCmd) ((MmcCmd) & 0xFFFF)
+
+#define MMC_CMD0 (MMC_INDX(0) | MMC_CMD_NO_CRC_RESPONSE)
+#define MMC_CMD1 (MMC_INDX(1) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_NO_CRC_RESPONSE)
+#define MMC_CMD2 (MMC_INDX(2) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_LONG_RESPONSE)
+#define MMC_CMD3 (MMC_INDX(3) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD5 (MMC_INDX(5) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_NO_CRC_RESPONSE)
+#define MMC_CMD6 (MMC_INDX(6) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD7 (MMC_INDX(7) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD8 (MMC_INDX(8) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD9 (MMC_INDX(9) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_LONG_RESPONSE)
+#define MMC_CMD11 (MMC_INDX(11) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD12 (MMC_INDX(12) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD13 (MMC_INDX(13) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD16 (MMC_INDX(16) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD17 (MMC_INDX(17) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD18 (MMC_INDX(18) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD20 (MMC_INDX(20) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD23 (MMC_INDX(23) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD24 (MMC_INDX(24) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD25 (MMC_INDX(25) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_CMD55 (MMC_INDX(55) | MMC_CMD_WAIT_RESPONSE)
+#define MMC_ACMD41 (MMC_INDX(41) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_NO_CRC_RESPONSE)
+#define MMC_ACMD51 (MMC_INDX(51) | MMC_CMD_WAIT_RESPONSE)
+
+// Valid responses for CMD1 in eMMC
+#define EMMC_CMD1_CAPACITY_LESS_THAN_2GB 0x00FF8080 // Capacity <= 2GB, byte addressing used
+#define EMMC_CMD1_CAPACITY_GREATER_THAN_2GB 0x40FF8080 // Capacity > 2GB, 512-byte sector addressing used
+
+#define MMC_STATUS_APP_CMD (1 << 5)
+
+typedef enum _MMC_STATE {
+ MmcInvalidState = 0,
+ MmcHwInitializationState,
+ MmcIdleState,
+ MmcReadyState,
+ MmcIdentificationState,
+ MmcStandByState,
+ MmcTransferState,
+ MmcSendingDataState,
+ MmcReceiveDataState,
+ MmcProgrammingState,
+ MmcDisconnectState,
+} MMC_STATE;
+
+#define EMMCBACKWARD (0)
+#define EMMCHS26 (1 << 0) // High-Speed @26MHz at rated device voltages
+#define EMMCHS52 (1 << 1) // High-Speed @52MHz at rated device voltages
+#define EMMCHS52DDR1V8 (1 << 2) // High-Speed Dual Data Rate @52MHz 1.8V or 3V I/O
+#define EMMCHS52DDR1V2 (1 << 3) // High-Speed Dual Data Rate @52MHz 1.2V I/O
+#define EMMCHS200SDR1V8 (1 << 4) // HS200 Single Data Rate @200MHz 1.8V I/O
+#define EMMCHS200SDR1V2 (1 << 5) // HS200 Single Data Rate @200MHz 1.2V I/O
+#define EMMCHS400DDR1V8 (1 << 6) // HS400 Dual Data Rate @400MHz 1.8V I/O
+#define EMMCHS400DDR1V2 (1 << 7) // HS400 Dual Data Rate @400MHz 1.2V I/O
+
+///
+/// Forward declaration for EFI_MMC_HOST_PROTOCOL
+///
+typedef struct _EFI_MMC_HOST_PROTOCOL EFI_MMC_HOST_PROTOCOL;
+
+typedef BOOLEAN (EFIAPI *MMC_ISCARDPRESENT) (
+ IN EFI_MMC_HOST_PROTOCOL *This
+ );
+
+typedef BOOLEAN (EFIAPI *MMC_ISREADONLY) (
+ IN EFI_MMC_HOST_PROTOCOL *This
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_BUILDDEVICEPATH) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_NOTIFYSTATE) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN MMC_STATE State
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_SENDCOMMAND) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN MMC_CMD Cmd,
+ IN UINT32 Argument
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_RECEIVERESPONSE) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN MMC_RESPONSE_TYPE Type,
+ IN UINT32 *Buffer
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_READBLOCKDATA) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Length,
+ OUT UINT32 *Buffer
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_WRITEBLOCKDATA) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Length,
+ IN UINT32 *Buffer
+ );
+
+typedef EFI_STATUS (EFIAPI *MMC_SETIOS) (
+ IN EFI_MMC_HOST_PROTOCOL *This,
+ IN UINT32 BusClockFreq,
+ IN UINT32 BusWidth,
+ IN UINT32 TimingMode
+ );
+
+typedef BOOLEAN (EFIAPI *MMC_ISMULTIBLOCK) (
+ IN EFI_MMC_HOST_PROTOCOL *This
+ );
+
+struct _EFI_MMC_HOST_PROTOCOL {
+
+ UINT32 Revision;
+ MMC_ISCARDPRESENT IsCardPresent;
+ MMC_ISREADONLY IsReadOnly;
+ MMC_BUILDDEVICEPATH BuildDevicePath;
+
+ MMC_NOTIFYSTATE NotifyState;
+
+ MMC_SENDCOMMAND SendCommand;
+ MMC_RECEIVERESPONSE ReceiveResponse;
+
+ MMC_READBLOCKDATA ReadBlockData;
+ MMC_WRITEBLOCKDATA WriteBlockData;
+
+ MMC_SETIOS SetIos;
+ MMC_ISMULTIBLOCK IsMultiBlock;
+
+};
+
+#define MMC_HOST_PROTOCOL_REVISION 0x00010002 // 1.2
+
+#define MMC_HOST_HAS_SETIOS(Host) (Host->Revision >= MMC_HOST_PROTOCOL_REVISION && \
+ Host->SetIos != NULL)
+#define MMC_HOST_HAS_ISMULTIBLOCK(Host) (Host->Revision >= MMC_HOST_PROTOCOL_REVISION && \
+ Host->IsMultiBlock != NULL)
+
+extern EFI_GUID gEmbeddedMmcHostProtocolGuid;
+
+#endif
+
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PeCoffLoader.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PeCoffLoader.h
new file mode 100644
index 00000000..a66d8f55
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PeCoffLoader.h
@@ -0,0 +1,235 @@
+/** @file
+
+ Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+ Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PE_COFF_LOADER_H__
+#define __PE_COFF_LOADER_H__
+
+// Needed for PE_COFF_LOADER_IMAGE_CONTEXT
+#include <Library/PeCoffLib.h>
+
+// B323179B-97FB-477E-B0FE-D88591FA11AB
+#define PE_COFF_LOADER_PROTOCOL_GUID \
+ { 0xB323179B, 0x97FB, 0x477E, { 0xB0, 0xFE, 0xD8, 0x85, 0x91, 0xFA, 0x11, 0xAB } }
+
+
+typedef struct _PE_COFF_LOADER_PROTOCOL PE_COFF_LOADER_PROTOCOL;
+
+
+
+/**
+ Retrieves information about a PE/COFF image.
+
+ Computes the PeCoffHeaderOffset, IsTeImage, ImageType, ImageAddress, ImageSize,
+ DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and
+ DebugDirectoryEntryRva fields of the ImageContext structure.
+ If ImageContext is NULL, then return RETURN_INVALID_PARAMETER.
+ If the PE/COFF image accessed through the ImageRead service in the ImageContext
+ structure is not a supported PE/COFF image type, then return RETURN_UNSUPPORTED.
+ If any errors occur while computing the fields of ImageContext,
+ then the error status is returned in the ImageError field of ImageContext.
+ If the image is a TE image, then SectionAlignment is set to 0.
+ The ImageRead and Handle fields of ImageContext structure must be valid prior
+ to invoking this service.
+
+ @param ImageContext Pointer to the image context structure that describes the PE/COFF
+ image that needs to be examined by this function.
+
+ @retval RETURN_SUCCESS The information on the PE/COFF image was collected.
+ @retval RETURN_INVALID_PARAMETER ImageContext is NULL.
+ @retval RETURN_UNSUPPORTED The PE/COFF image is not supported.
+
+**/
+typedef
+RETURN_STATUS
+(EFIAPI *PE_COFF_LOADER_GET_IMAGE_INFO) (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ );
+
+
+/**
+ Applies relocation fixups to a PE/COFF image that was loaded with PeCoffLoaderLoadImage().
+
+ If the DestinationAddress field of ImageContext is 0, then use the ImageAddress field of
+ ImageContext as the relocation base address. Otherwise, use the DestinationAddress field
+ of ImageContext as the relocation base address. The caller must allocate the relocation
+ fixup log buffer and fill in the FixupData field of ImageContext prior to calling this function.
+
+ The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress,
+ ImageSize, DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders,
+ DebugDirectoryEntryRva, EntryPoint, FixupDataSize, CodeView, PdbPointer, and FixupData of
+ the ImageContext structure must be valid prior to invoking this service.
+
+ If ImageContext is NULL, then ASSERT().
+
+ Note that if the platform does not maintain coherency between the instruction cache(s) and the data
+ cache(s) in hardware, then the caller is responsible for performing cache maintenance operations
+ prior to transferring control to a PE/COFF image that is loaded using this library.
+
+ @param ImageContext Pointer to the image context structure that describes the PE/COFF
+ image that is being relocated.
+
+ @retval RETURN_SUCCESS The PE/COFF image was relocated.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_LOAD_ERROR The image in not a valid PE/COFF image.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_UNSUPPORTED A relocation record type is not supported.
+ Extended status information is in the ImageError field of ImageContext.
+
+**/
+typedef
+RETURN_STATUS
+(EFIAPI *PE_COFF_LOADER_RELOCATE_IMAGE) (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ );
+
+
+/**
+ Loads a PE/COFF image into memory.
+
+ Loads the PE/COFF image accessed through the ImageRead service of ImageContext into the buffer
+ specified by the ImageAddress and ImageSize fields of ImageContext. The caller must allocate
+ the load buffer and fill in the ImageAddress and ImageSize fields prior to calling this function.
+ The EntryPoint, FixupDataSize, CodeView, PdbPointer and HiiResourceData fields of ImageContext are computed.
+ The ImageRead, Handle, PeCoffHeaderOffset, IsTeImage, Machine, ImageType, ImageAddress, ImageSize,
+ DestinationAddress, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva
+ fields of the ImageContext structure must be valid prior to invoking this service.
+
+ If ImageContext is NULL, then ASSERT().
+
+ Note that if the platform does not maintain coherency between the instruction cache(s) and the data
+ cache(s) in hardware, then the caller is responsible for performing cache maintenance operations
+ prior to transferring control to a PE/COFF image that is loaded using this library.
+
+ @param ImageContext Pointer to the image context structure that describes the PE/COFF
+ image that is being loaded.
+
+ @retval RETURN_SUCCESS The PE/COFF image was loaded into the buffer specified by
+ the ImageAddress and ImageSize fields of ImageContext.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_BUFFER_TOO_SMALL The caller did not provide a large enough buffer.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_LOAD_ERROR The PE/COFF image is an EFI Runtime image with no relocations.
+ Extended status information is in the ImageError field of ImageContext.
+ @retval RETURN_INVALID_PARAMETER The image address is invalid.
+ Extended status information is in the ImageError field of ImageContext.
+
+**/
+typedef
+RETURN_STATUS
+(EFIAPI *PE_COFF_LOADER_LOAD_IMAGE) (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ );
+
+
+
+/**
+ Reads contents of a PE/COFF image from a buffer in system memory.
+
+ This is the default implementation of a PE_COFF_LOADER_READ_FILE function
+ that assumes FileHandle pointer to the beginning of a PE/COFF image.
+ This function reads contents of the PE/COFF image that starts at the system memory
+ address specified by FileHandle. The read operation copies ReadSize bytes from the
+ PE/COFF image starting at byte offset FileOffset into the buffer specified by Buffer.
+ The size of the buffer actually read is returned in ReadSize.
+
+ If FileHandle is NULL, then ASSERT().
+ If ReadSize is NULL, then ASSERT().
+ If Buffer is NULL, then ASSERT().
+
+ @param FileHandle Pointer to base of the input stream
+ @param FileOffset Offset into the PE/COFF image to begin the read operation.
+ @param ReadSize On input, the size in bytes of the requested read operation.
+ On output, the number of bytes actually read.
+ @param Buffer Output buffer that contains the data read from the PE/COFF image.
+
+ @retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
+ the buffer.
+**/
+typedef
+RETURN_STATUS
+(EFIAPI *PE_COFF_LOADER_READ_FROM_MEMORY) (
+ IN VOID *FileHandle,
+ IN UINTN FileOffset,
+ IN OUT UINTN *ReadSize,
+ OUT VOID *Buffer
+ );
+
+
+
+/**
+ Reapply fixups on a fixed up PE32/PE32+ image to allow virtual calling at EFI
+ runtime.
+
+ This function reapplies relocation fixups to the PE/COFF image specified by ImageBase
+ and ImageSize so the image will execute correctly when the PE/COFF image is mapped
+ to the address specified by VirtualImageBase. RelocationData must be identical
+ to the FixupData buffer from the PE_COFF_LOADER_IMAGE_CONTEXT structure
+ after this PE/COFF image was relocated with PeCoffLoaderRelocateImage().
+
+ Note that if the platform does not maintain coherency between the instruction cache(s) and the data
+ cache(s) in hardware, then the caller is responsible for performing cache maintenance operations
+ prior to transferring control to a PE/COFF image that is loaded using this library.
+
+ @param ImageBase Base address of a PE/COFF image that has been loaded
+ and relocated into system memory.
+ @param VirtImageBase The request virtual address that the PE/COFF image is to
+ be fixed up for.
+ @param ImageSize The size, in bytes, of the PE/COFF image.
+ @param RelocationData A pointer to the relocation data that was collected when the PE/COFF
+ image was relocated using PeCoffLoaderRelocateImage().
+
+**/
+typedef
+VOID
+(EFIAPI *PE_COFF_LOADER_RELOCATE_IMAGE_FOR_RUNTIME) (
+ IN PHYSICAL_ADDRESS ImageBase,
+ IN PHYSICAL_ADDRESS VirtImageBase,
+ IN UINTN ImageSize,
+ IN VOID *RelocationData
+ );
+
+
+
+/**
+ Unloads a loaded PE/COFF image from memory and releases its taken resource.
+ Releases any environment specific resources that were allocated when the image
+ specified by ImageContext was loaded using PeCoffLoaderLoadImage().
+
+ For NT32 emulator, the PE/COFF image loaded by system needs to release.
+ For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded,
+ this function can simply return RETURN_SUCCESS.
+
+ If ImageContext is NULL, then ASSERT().
+
+ @param ImageContext Pointer to the image context structure that describes the PE/COFF
+ image to be unloaded.
+
+ @retval RETURN_SUCCESS The PE/COFF image was unloaded successfully.
+**/
+typedef
+RETURN_STATUS
+(EFIAPI *PE_COFF_LOADER_UNLOAD_IMAGE) (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ );
+
+
+struct _PE_COFF_LOADER_PROTOCOL {
+ PE_COFF_LOADER_GET_IMAGE_INFO GetImageInfo;
+ PE_COFF_LOADER_LOAD_IMAGE LoadImage;
+ PE_COFF_LOADER_RELOCATE_IMAGE RelocateImage;
+ PE_COFF_LOADER_READ_FROM_MEMORY ReadFromMemory;
+ PE_COFF_LOADER_RELOCATE_IMAGE_FOR_RUNTIME RelocateImageForRuntime;
+ PE_COFF_LOADER_UNLOAD_IMAGE UnloadImage;
+};
+
+
+extern EFI_GUID gPeCoffLoaderProtocolGuid;
+
+
+#endif
+
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PlatformBootManager.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PlatformBootManager.h
new file mode 100644
index 00000000..2361dcca
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PlatformBootManager.h
@@ -0,0 +1,80 @@
+/** @file
+
+ Copyright (c) 2018, Linaro. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
+#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
+
+//
+// Protocol interface structure
+//
+typedef struct _PLATFORM_BOOT_MANAGER_PROTOCOL PLATFORM_BOOT_MANAGER_PROTOCOL;
+
+//
+// Function Prototypes
+//
+
+/*
+ Get predefined boot options for platform.
+
+ @param[out] Count The number of elements in each of
+ BootOptions and BootKeys. On successful
+ return, Count is at least one.
+
+ @param[out] BootOptions An array of platform boot options.
+ BootOptions is pool-allocated by
+ GET_PLATFORM_BOOT_OPTIONS_AND_KEYS, and
+ GET_PLATFORM_BOOT_OPTIONS_AND_KEYS populates
+ every element in BootOptions with
+ EfiBootManagerInitializeLoadOption().
+ BootOptions shall not contain duplicate
+ entries. The caller is responsible for
+ releasing BootOptions after use with
+ EfiBootManagerFreeLoadOptions().
+
+ @param[out] BootKeys A pool-allocated array of platform boot
+ hotkeys. For every 0 <= Index < Count, if
+ BootOptions[Index] is not to be associated
+ with a hotkey, then BootKeys[Index] is
+ zero-filled. Otherwise, BootKeys[Index]
+ specifies the boot hotkey for
+ BootOptions[Index]. BootKeys shall not
+ contain duplicate entries (other than
+ zero-filled entries). The caller is
+ responsible for releasing BootKeys with
+ FreePool() after use.
+
+ @retval EFI_SUCCESS Count, BootOptions and BootKeys have
+ been set.
+
+ @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
+
+ @retval EFI_UNSUPPORTED The platform doesn't provide boot options
+ as a feature.
+
+ @retval EFI_NOT_FOUND The platform could provide boot options
+ as a feature, but none have been
+ configured.
+
+ @return Error codes propagated from underlying
+ functions.
+*/
+typedef
+EFI_STATUS
+(EFIAPI *GET_PLATFORM_BOOT_OPTIONS_AND_KEYS) (
+ OUT UINTN *Count,
+ OUT EFI_BOOT_MANAGER_LOAD_OPTION **BootOptions,
+ OUT EFI_INPUT_KEY **BootKeys
+ );
+
+struct _PLATFORM_BOOT_MANAGER_PROTOCOL {
+ GET_PLATFORM_BOOT_OPTIONS_AND_KEYS GetPlatformBootOptionsAndKeys;
+};
+
+extern EFI_GUID gPlatformBootManagerProtocolGuid;
+
+#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h
new file mode 100644
index 00000000..250cf361
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h
@@ -0,0 +1,59 @@
+/** @file
+
+ Copyright (c) 2018, Linaro. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PLATFORM_VIRTUAL_KEYBOARD_H__
+#define __PLATFORM_VIRTUAL_KEYBOARD_H__
+
+//
+// Protocol interface structure
+//
+typedef struct _PLATFORM_VIRTUAL_KBD_PROTOCOL PLATFORM_VIRTUAL_KBD_PROTOCOL;
+
+typedef struct _VIRTUAL_KBD_KEY VIRTUAL_KBD_KEY;
+
+#define VIRTUAL_KEYBOARD_KEY_SIGNATURE SIGNATURE_32 ('v', 'k', 'b', 'd')
+
+struct _VIRTUAL_KBD_KEY {
+ UINTN Signature;
+ EFI_INPUT_KEY Key;
+};
+
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_VIRTUAL_KBD_REGISTER) (
+ IN VOID
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_VIRTUAL_KBD_RESET) (
+ IN VOID
+ );
+
+typedef
+BOOLEAN
+(EFIAPI *PLATFORM_VIRTUAL_KBD_QUERY) (
+ IN VIRTUAL_KBD_KEY *VirtualKey
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_VIRTUAL_KBD_CLEAR) (
+ IN VIRTUAL_KBD_KEY *VirtualKey
+ );
+
+struct _PLATFORM_VIRTUAL_KBD_PROTOCOL {
+ PLATFORM_VIRTUAL_KBD_REGISTER Register;
+ PLATFORM_VIRTUAL_KBD_RESET Reset;
+ PLATFORM_VIRTUAL_KBD_QUERY Query;
+ PLATFORM_VIRTUAL_KBD_CLEAR Clear;
+};
+
+extern EFI_GUID gPlatformVirtualKeyboardProtocolGuid;
+
+#endif /* __PLATFORM_VIRTUAL_KEYBOARD_H__ */
diff --git a/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/UsbDevice.h b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/UsbDevice.h
new file mode 100644
index 00000000..794ac0af
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Protocol/UsbDevice.h
@@ -0,0 +1,112 @@
+/** @file
+
+ Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USB_DEVICE_PROTOCOL_H__
+#define __USB_DEVICE_PROTOCOL_H__
+
+#include <IndustryStandard/Usb.h>
+
+extern EFI_GUID gUsbDeviceProtocolGuid;
+
+/*
+ * Note: This Protocol is just the bare minimum for Android Fastboot. It
+ * only makes sense for devices that only do Bulk Transfers and only have one
+ * endpoint.
+ */
+
+/*
+ Callback to be called when data is received.
+ Buffer is callee-allocated and it's the caller's responsibility to free it with
+ FreePool.
+
+ @param[in] Size Size in bytes of data.
+ @param[in] Buffer Pointer to data.
+*/
+typedef
+VOID
+(*USB_DEVICE_RX_CALLBACK) (
+ IN UINTN Size,
+ IN VOID *Buffer
+ );
+
+/*
+ Callback to be called when the host asks for data by sending an IN token
+ (excluding during the data stage of a control transfer).
+ When this function is called, data previously buffered by calling Send() has
+ been sent.
+
+ @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of
+ the endpoint the IN token was sent to.
+*/
+typedef
+VOID
+(*USB_DEVICE_TX_CALLBACK) (
+ IN UINT8 EndpointIndex
+ );
+
+/*
+ Put data in the Tx buffer to be sent on the next IN token.
+ Don't call this function again until the TxCallback has been called.
+
+ @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of
+ the endpoint to send the data from.
+ @param[in]Size Size in bytes of data.
+ @param[in]Buffer Pointer to data.
+
+ @retval EFI_SUCCESS The data was queued successfully.
+ @retval EFI_INVALID_PARAMETER There was an error sending the data.
+*/
+typedef
+EFI_STATUS
+(*USB_DEVICE_SEND) (
+ IN UINT8 EndpointIndex,
+ IN UINTN Size,
+ IN CONST VOID *Buffer
+ );
+
+/*
+ Restart the USB peripheral controller and respond to enumeration.
+
+ @param[in] DeviceDescriptor pointer to device descriptor
+ @param[in] Descriptors Array of pointers to buffers, where
+ Descriptors[n] contains the response to a
+ GET_DESCRIPTOR request for configuration n. From
+ USB Spec section 9.4.3:
+ "The first interface descriptor follows the
+ configuration descriptor. The endpoint
+ descriptors for the first interface follow the
+ first interface descriptor. If there are
+ additional interfaces, their interface
+ descriptor and endpoint descriptors follow the
+ first interface’s endpoint descriptors".
+
+ The size of each buffer is the TotalLength
+ member of the Configuration Descriptor.
+
+ The size of the array is
+ DeviceDescriptor->NumConfigurations.
+ @param[in]RxCallback See USB_DEVICE_RX_CALLBACK
+ @param[in]TxCallback See USB_DEVICE_TX_CALLBACK
+*/
+typedef
+EFI_STATUS
+(*USB_DEVICE_START) (
+ IN USB_DEVICE_DESCRIPTOR *DeviceDescriptor,
+ IN VOID **Descriptors,
+ IN USB_DEVICE_RX_CALLBACK RxCallback,
+ IN USB_DEVICE_TX_CALLBACK TxCallback
+ );
+
+struct _USB_DEVICE_PROTOCOL {
+ USB_DEVICE_START Start;
+ USB_DEVICE_SEND Send;
+};
+
+typedef struct _USB_DEVICE_PROTOCOL USB_DEVICE_PROTOCOL;
+
+#endif //ifndef __USB_DEVICE_PROTOCOL_H__