3 Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __ANDROID_FASTBOOT_PLATFORM_H__
10 #define __ANDROID_FASTBOOT_PLATFORM_H__
12 extern EFI_GUID gAndroidFastbootPlatformProtocolGuid
;
15 Protocol for platform-specific operations initiated by Android Fastboot.
17 Based on Fastboot Protocol version 0.4. See
18 system/core/fastboot/fastboot_protocol.txt in the AOSP source tree for more
21 Doesn't support image verification.
25 Do any initialisation that needs to be done in order to be able to respond to
28 @retval EFI_SUCCESS Initialised successfully.
29 @retval !EFI_SUCCESS Error in initialisation.
33 (*FASTBOOT_PLATFORM_INIT
) (
38 To be called when Fastboot is finished and we aren't rebooting or booting an
39 image. Undo initialisation, free resources.
43 (*FASTBOOT_PLATFORM_UN_INIT
) (
48 Flash the partition named (according to a platform-specific scheme)
49 PartitionName, with the image pointed to by Buffer, whose size is BufferSize.
51 @param[in] PartitionName Null-terminated name of partition to write.
52 @param[in] BufferSize Size of Buffer in bytes.
53 @param[in] Buffer Data to write to partition.
55 @retval EFI_NOT_FOUND No such partition.
56 @retval EFI_DEVICE_ERROR Flashing failed.
60 (*FASTBOOT_PLATFORM_FLASH
) (
61 IN CHAR8
*PartitionName
,
67 Erase the partition named PartitionName.
69 @param[in] PartitionName Null-terminated name of partition to erase.
71 @retval EFI_NOT_FOUND No such partition.
72 @retval EFI_DEVICE_ERROR Erasing failed.
76 (*FASTBOOT_PLATFORM_ERASE
) (
77 IN CHAR8
*PartitionName
81 If the variable referred to by Name exists, copy it (as a null-terminated
82 string) into Value. If it doesn't exist, put the Empty string in Value.
84 Variable names and values may not be larger than 60 bytes, excluding the
85 terminal null character. This is a limitation of the Fastboot protocol.
87 The Fastboot application will handle platform-nonspecific variables
88 (Currently "version" is the only one of these.)
90 @param[in] Name Null-terminated name of Fastboot variable to retrieve.
91 @param[out] Value Caller-allocated buffer for null-terminated value of
94 @retval EFI_SUCCESS The variable was retrieved, or it doesn't exist.
95 @retval EFI_DEVICE_ERROR There was an error looking up the variable. This
96 does _not_ include the variable not existing.
100 (*FASTBOOT_PLATFORM_GETVAR
) (
106 React to an OEM-specific command.
108 Future versions of this function might want to allow the platform to do some
109 extra communication with the host. A way to do this would be to add a function
110 to the FASTBOOT_TRANSPORT_PROTOCOL that allows the implementation of
111 DoOemCommand to replace the ReceiveEvent with its own, and to restore the old
112 one when it's finished.
114 However at the moment although the specification allows it, the AOSP fastboot
115 host application doesn't handle receiving any data from the client, and it
116 doesn't support a data phase for OEM commands.
118 @param[in] Command Null-terminated command string.
120 @retval EFI_SUCCESS The command executed successfully.
121 @retval EFI_NOT_FOUND The command wasn't recognised.
122 @retval EFI_DEVICE_ERROR There was an error executing the command.
126 (*FASTBOOT_PLATFORM_OEM_COMMAND
) (
130 typedef struct _FASTBOOT_PLATFORM_PROTOCOL
{
131 FASTBOOT_PLATFORM_INIT Init
;
132 FASTBOOT_PLATFORM_UN_INIT UnInit
;
133 FASTBOOT_PLATFORM_FLASH FlashPartition
;
134 FASTBOOT_PLATFORM_ERASE ErasePartition
;
135 FASTBOOT_PLATFORM_GETVAR GetVar
;
136 FASTBOOT_PLATFORM_OEM_COMMAND DoOemCommand
;
137 } FASTBOOT_PLATFORM_PROTOCOL
;