ArmPkg: only attempt buildin MmCommunicationDxe for AArch64
[mirror_edk2.git] / EmbeddedPkg / Include / Protocol / AndroidFastbootPlatform.h
CommitLineData
ddd14366
OM
1/** @file\r
2\r
3 Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>\r
4\r
878b807a 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
ddd14366
OM
6\r
7**/\r
8\r
9#ifndef __ANDROID_FASTBOOT_PLATFORM_H__\r
10#define __ANDROID_FASTBOOT_PLATFORM_H__\r
11\r
12extern EFI_GUID gAndroidFastbootPlatformProtocolGuid;\r
13\r
14/*\r
15 Protocol for platform-specific operations initiated by Android Fastboot.\r
16\r
17 Based on Fastboot Protocol version 0.4. See\r
18 system/core/fastboot/fastboot_protocol.txt in the AOSP source tree for more\r
19 info.\r
20\r
21 Doesn't support image verification.\r
22*/\r
23\r
24/*\r
25 Do any initialisation that needs to be done in order to be able to respond to\r
26 commands.\r
27\r
28 @retval EFI_SUCCESS Initialised successfully.\r
29 @retval !EFI_SUCCESS Error in initialisation.\r
30*/\r
31typedef\r
32EFI_STATUS\r
33(*FASTBOOT_PLATFORM_INIT) (\r
34 VOID\r
35 );\r
36\r
37/*\r
38 To be called when Fastboot is finished and we aren't rebooting or booting an\r
c6a72cd7 39 image. Undo initialisation, free resources.\r
ddd14366
OM
40*/\r
41typedef\r
42VOID\r
43(*FASTBOOT_PLATFORM_UN_INIT) (\r
44 VOID\r
45 );\r
46\r
47/*\r
48 Flash the partition named (according to a platform-specific scheme)\r
49 PartitionName, with the image pointed to by Buffer, whose size is BufferSize.\r
50\r
51 @param[in] PartitionName Null-terminated name of partition to write.\r
c6a72cd7 52 @param[in] BufferSize Size of Buffer in bytes.\r
ddd14366
OM
53 @param[in] Buffer Data to write to partition.\r
54\r
55 @retval EFI_NOT_FOUND No such partition.\r
56 @retval EFI_DEVICE_ERROR Flashing failed.\r
57*/\r
58typedef\r
59EFI_STATUS\r
60(*FASTBOOT_PLATFORM_FLASH) (\r
61 IN CHAR8 *PartitionName,\r
62 IN UINTN BufferSize,\r
63 IN VOID *Buffer\r
64 );\r
65\r
66/*\r
67 Erase the partition named PartitionName.\r
68\r
69 @param[in] PartitionName Null-terminated name of partition to erase.\r
70\r
71 @retval EFI_NOT_FOUND No such partition.\r
72 @retval EFI_DEVICE_ERROR Erasing failed.\r
73*/\r
74typedef\r
75EFI_STATUS\r
76(*FASTBOOT_PLATFORM_ERASE) (\r
77 IN CHAR8 *PartitionName\r
78 );\r
79\r
80/*\r
81 If the variable referred to by Name exists, copy it (as a null-terminated\r
82 string) into Value. If it doesn't exist, put the Empty string in Value.\r
83\r
84 Variable names and values may not be larger than 60 bytes, excluding the\r
85 terminal null character. This is a limitation of the Fastboot protocol.\r
86\r
87 The Fastboot application will handle platform-nonspecific variables\r
88 (Currently "version" is the only one of these.)\r
89\r
90 @param[in] Name Null-terminated name of Fastboot variable to retrieve.\r
91 @param[out] Value Caller-allocated buffer for null-terminated value of\r
92 variable.\r
93\r
94 @retval EFI_SUCCESS The variable was retrieved, or it doesn't exist.\r
95 @retval EFI_DEVICE_ERROR There was an error looking up the variable. This\r
96 does _not_ include the variable not existing.\r
97*/\r
98typedef\r
99EFI_STATUS\r
100(*FASTBOOT_PLATFORM_GETVAR) (\r
101 IN CHAR8 *Name,\r
102 OUT CHAR8 *Value\r
103 );\r
104\r
105/*\r
106 React to an OEM-specific command.\r
107\r
108 Future versions of this function might want to allow the platform to do some\r
109 extra communication with the host. A way to do this would be to add a function\r
110 to the FASTBOOT_TRANSPORT_PROTOCOL that allows the implementation of\r
111 DoOemCommand to replace the ReceiveEvent with its own, and to restore the old\r
112 one when it's finished.\r
113\r
114 However at the moment although the specification allows it, the AOSP fastboot\r
115 host application doesn't handle receiving any data from the client, and it\r
116 doesn't support a data phase for OEM commands.\r
117\r
118 @param[in] Command Null-terminated command string.\r
119\r
120 @retval EFI_SUCCESS The command executed successfully.\r
121 @retval EFI_NOT_FOUND The command wasn't recognised.\r
122 @retval EFI_DEVICE_ERROR There was an error executing the command.\r
123*/\r
124typedef\r
125EFI_STATUS\r
126(*FASTBOOT_PLATFORM_OEM_COMMAND) (\r
127 IN CHAR8 *Command\r
128 );\r
129\r
130typedef struct _FASTBOOT_PLATFORM_PROTOCOL {\r
131 FASTBOOT_PLATFORM_INIT Init;\r
132 FASTBOOT_PLATFORM_UN_INIT UnInit;\r
133 FASTBOOT_PLATFORM_FLASH FlashPartition;\r
134 FASTBOOT_PLATFORM_ERASE ErasePartition;\r
135 FASTBOOT_PLATFORM_GETVAR GetVar;\r
136 FASTBOOT_PLATFORM_OEM_COMMAND DoOemCommand;\r
137} FASTBOOT_PLATFORM_PROTOCOL;\r
138\r
139#endif\r