--- /dev/null
+/** @file\r
+\r
+ Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>\r
+\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __ANDROID_FASTBOOT_PLATFORM_H__\r
+#define __ANDROID_FASTBOOT_PLATFORM_H__\r
+\r
+extern EFI_GUID gAndroidFastbootPlatformProtocolGuid;\r
+\r
+/*\r
+ Protocol for platform-specific operations initiated by Android Fastboot.\r
+\r
+ Based on Fastboot Protocol version 0.4. See\r
+ system/core/fastboot/fastboot_protocol.txt in the AOSP source tree for more\r
+ info.\r
+\r
+ Doesn't support image verification.\r
+*/\r
+\r
+/*\r
+ Do any initialisation that needs to be done in order to be able to respond to\r
+ commands.\r
+\r
+ @retval EFI_SUCCESS Initialised successfully.\r
+ @retval !EFI_SUCCESS Error in initialisation.\r
+*/\r
+typedef\r
+EFI_STATUS\r
+(*FASTBOOT_PLATFORM_INIT) (\r
+ VOID\r
+ );\r
+\r
+/*\r
+ To be called when Fastboot is finished and we aren't rebooting or booting an\r
+ image. Undo initialisation, free resrouces.\r
+*/\r
+typedef\r
+VOID\r
+(*FASTBOOT_PLATFORM_UN_INIT) (\r
+ VOID\r
+ );\r
+\r
+/*\r
+ Flash the partition named (according to a platform-specific scheme)\r
+ PartitionName, with the image pointed to by Buffer, whose size is BufferSize.\r
+\r
+ @param[in] PartitionName Null-terminated name of partition to write.\r
+ @param[in] BufferSize Size of Buffer in byets.\r
+ @param[in] Buffer Data to write to partition.\r
+\r
+ @retval EFI_NOT_FOUND No such partition.\r
+ @retval EFI_DEVICE_ERROR Flashing failed.\r
+*/\r
+typedef\r
+EFI_STATUS\r
+(*FASTBOOT_PLATFORM_FLASH) (\r
+ IN CHAR8 *PartitionName,\r
+ IN UINTN BufferSize,\r
+ IN VOID *Buffer\r
+ );\r
+\r
+/*\r
+ Erase the partition named PartitionName.\r
+\r
+ @param[in] PartitionName Null-terminated name of partition to erase.\r
+\r
+ @retval EFI_NOT_FOUND No such partition.\r
+ @retval EFI_DEVICE_ERROR Erasing failed.\r
+*/\r
+typedef\r
+EFI_STATUS\r
+(*FASTBOOT_PLATFORM_ERASE) (\r
+ IN CHAR8 *PartitionName\r
+ );\r
+\r
+/*\r
+ If the variable referred to by Name exists, copy it (as a null-terminated\r
+ string) into Value. If it doesn't exist, put the Empty string in Value.\r
+\r
+ Variable names and values may not be larger than 60 bytes, excluding the\r
+ terminal null character. This is a limitation of the Fastboot protocol.\r
+\r
+ The Fastboot application will handle platform-nonspecific variables\r
+ (Currently "version" is the only one of these.)\r
+\r
+ @param[in] Name Null-terminated name of Fastboot variable to retrieve.\r
+ @param[out] Value Caller-allocated buffer for null-terminated value of\r
+ variable.\r
+\r
+ @retval EFI_SUCCESS The variable was retrieved, or it doesn't exist.\r
+ @retval EFI_DEVICE_ERROR There was an error looking up the variable. This\r
+ does _not_ include the variable not existing.\r
+*/\r
+typedef\r
+EFI_STATUS\r
+(*FASTBOOT_PLATFORM_GETVAR) (\r
+ IN CHAR8 *Name,\r
+ OUT CHAR8 *Value\r
+ );\r
+\r
+/*\r
+ React to an OEM-specific command.\r
+\r
+ Future versions of this function might want to allow the platform to do some\r
+ extra communication with the host. A way to do this would be to add a function\r
+ to the FASTBOOT_TRANSPORT_PROTOCOL that allows the implementation of\r
+ DoOemCommand to replace the ReceiveEvent with its own, and to restore the old\r
+ one when it's finished.\r
+\r
+ However at the moment although the specification allows it, the AOSP fastboot\r
+ host application doesn't handle receiving any data from the client, and it\r
+ doesn't support a data phase for OEM commands.\r
+\r
+ @param[in] Command Null-terminated command string.\r
+\r
+ @retval EFI_SUCCESS The command executed successfully.\r
+ @retval EFI_NOT_FOUND The command wasn't recognised.\r
+ @retval EFI_DEVICE_ERROR There was an error executing the command.\r
+*/\r
+typedef\r
+EFI_STATUS\r
+(*FASTBOOT_PLATFORM_OEM_COMMAND) (\r
+ IN CHAR8 *Command\r
+ );\r
+\r
+typedef struct _FASTBOOT_PLATFORM_PROTOCOL {\r
+ FASTBOOT_PLATFORM_INIT Init;\r
+ FASTBOOT_PLATFORM_UN_INIT UnInit;\r
+ FASTBOOT_PLATFORM_FLASH FlashPartition;\r
+ FASTBOOT_PLATFORM_ERASE ErasePartition;\r
+ FASTBOOT_PLATFORM_GETVAR GetVar;\r
+ FASTBOOT_PLATFORM_OEM_COMMAND DoOemCommand;\r
+} FASTBOOT_PLATFORM_PROTOCOL;\r
+\r
+#endif\r