ArmPkg: only attempt buildin MmCommunicationDxe for AArch64
[mirror_edk2.git] / EmbeddedPkg / Include / Protocol / AndroidFastbootPlatform.h
1 /** @file
2
3 Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef __ANDROID_FASTBOOT_PLATFORM_H__
10 #define __ANDROID_FASTBOOT_PLATFORM_H__
11
12 extern EFI_GUID gAndroidFastbootPlatformProtocolGuid;
13
14 /*
15 Protocol for platform-specific operations initiated by Android Fastboot.
16
17 Based on Fastboot Protocol version 0.4. See
18 system/core/fastboot/fastboot_protocol.txt in the AOSP source tree for more
19 info.
20
21 Doesn't support image verification.
22 */
23
24 /*
25 Do any initialisation that needs to be done in order to be able to respond to
26 commands.
27
28 @retval EFI_SUCCESS Initialised successfully.
29 @retval !EFI_SUCCESS Error in initialisation.
30 */
31 typedef
32 EFI_STATUS
33 (*FASTBOOT_PLATFORM_INIT) (
34 VOID
35 );
36
37 /*
38 To be called when Fastboot is finished and we aren't rebooting or booting an
39 image. Undo initialisation, free resources.
40 */
41 typedef
42 VOID
43 (*FASTBOOT_PLATFORM_UN_INIT) (
44 VOID
45 );
46
47 /*
48 Flash the partition named (according to a platform-specific scheme)
49 PartitionName, with the image pointed to by Buffer, whose size is BufferSize.
50
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.
54
55 @retval EFI_NOT_FOUND No such partition.
56 @retval EFI_DEVICE_ERROR Flashing failed.
57 */
58 typedef
59 EFI_STATUS
60 (*FASTBOOT_PLATFORM_FLASH) (
61 IN CHAR8 *PartitionName,
62 IN UINTN BufferSize,
63 IN VOID *Buffer
64 );
65
66 /*
67 Erase the partition named PartitionName.
68
69 @param[in] PartitionName Null-terminated name of partition to erase.
70
71 @retval EFI_NOT_FOUND No such partition.
72 @retval EFI_DEVICE_ERROR Erasing failed.
73 */
74 typedef
75 EFI_STATUS
76 (*FASTBOOT_PLATFORM_ERASE) (
77 IN CHAR8 *PartitionName
78 );
79
80 /*
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.
83
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.
86
87 The Fastboot application will handle platform-nonspecific variables
88 (Currently "version" is the only one of these.)
89
90 @param[in] Name Null-terminated name of Fastboot variable to retrieve.
91 @param[out] Value Caller-allocated buffer for null-terminated value of
92 variable.
93
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.
97 */
98 typedef
99 EFI_STATUS
100 (*FASTBOOT_PLATFORM_GETVAR) (
101 IN CHAR8 *Name,
102 OUT CHAR8 *Value
103 );
104
105 /*
106 React to an OEM-specific command.
107
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.
113
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.
117
118 @param[in] Command Null-terminated command string.
119
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.
123 */
124 typedef
125 EFI_STATUS
126 (*FASTBOOT_PLATFORM_OEM_COMMAND) (
127 IN CHAR8 *Command
128 );
129
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;
138
139 #endif