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