]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsApi.h
ArmPlatformPkg/BootMonFs: Fix error codes returned by Open() and Read()
[mirror_edk2.git] / ArmPlatformPkg / FileSystem / BootMonFs / BootMonFsApi.h
1 /** @file
2 *
3 * Copyright (c) 2012-2014, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15 #ifndef __BOOTMON_FS_API_H
16 #define __BOOTMON_FS_API_H
17
18 #include <Protocol/SimpleFileSystem.h>
19
20 EFI_STATUS
21 BootMonFsInitialize (
22 IN BOOTMON_FS_INSTANCE *Instance
23 );
24
25 UINT32
26 BootMonFsChecksum (
27 IN VOID *Data,
28 IN UINT32 Size
29 );
30
31 EFI_STATUS
32 BootMonFsComputeFooterChecksum (
33 IN OUT HW_IMAGE_DESCRIPTION *Footer
34 );
35
36 EFIAPI
37 EFI_STATUS
38 OpenBootMonFsOpenVolume (
39 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
40 OUT EFI_FILE_PROTOCOL **Root
41 );
42
43 UINT32
44 BootMonFsGetImageLength (
45 IN BOOTMON_FS_FILE *File
46 );
47
48 UINTN
49 BootMonFsGetPhysicalSize (
50 IN BOOTMON_FS_FILE* File
51 );
52
53 EFI_STATUS
54 BootMonFsCreateFile (
55 IN BOOTMON_FS_INSTANCE *Instance,
56 OUT BOOTMON_FS_FILE **File
57 );
58
59 EFIAPI
60 EFI_STATUS
61 BootMonFsGetInfo (
62 IN EFI_FILE_PROTOCOL *This,
63 IN EFI_GUID *InformationType,
64 IN OUT UINTN *BufferSize,
65 OUT VOID *Buffer
66 );
67
68 EFIAPI
69 EFI_STATUS
70 BootMonFsReadDirectory (
71 IN EFI_FILE_PROTOCOL *This,
72 IN OUT UINTN *BufferSize,
73 OUT VOID *Buffer
74 );
75
76 EFIAPI
77 EFI_STATUS
78 BootMonFsFlushDirectory (
79 IN EFI_FILE_PROTOCOL *This
80 );
81
82 EFIAPI
83 EFI_STATUS
84 BootMonFsFlushFile (
85 IN EFI_FILE_PROTOCOL *This
86 );
87
88 EFIAPI
89 EFI_STATUS
90 BootMonFsCloseFile (
91 IN EFI_FILE_PROTOCOL *This
92 );
93
94 /**
95 Open a file on the boot monitor file system.
96
97 @param[in] This The EFI_FILE_PROTOCOL parent handle.
98 @param[out] NewHandle A pointer to the location to return the opened
99 handle for the new file.
100 @param[in] FileName The Null-terminated string of the name of the file
101 to be opened.
102 @param[in] OpenMode The mode to open the file : Read or Read/Write or
103 Read/Write/Create
104 @param[in] Attributes Attributes of the file in case of a file creation
105
106 @retval EFI_SUCCESS The file was open.
107 @retval EFI_NOT_FOUND The specified file could not be found or the specified
108 directory in which to create a file could not be found.
109 @retval EFI_DEVICE_ERROR The device reported an error.
110 @retval EFI_WRITE_PROTECTED Attempt to create a directory. This is not possible
111 with the BootMon file system.
112 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
113 @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
114
115 **/
116 EFIAPI
117 EFI_STATUS
118 BootMonFsOpenFile (
119 IN EFI_FILE_PROTOCOL *This,
120 OUT EFI_FILE_PROTOCOL **NewHandle,
121 IN CHAR16 *FileName,
122 IN UINT64 OpenMode,
123 IN UINT64 Attributes
124 );
125
126 /**
127 Read data from an open file.
128
129 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
130 is the file handle to read data from.
131 @param[in out] BufferSize On input, the size of the Buffer. On output, the
132 amount of data returned in Buffer. In both cases,
133 the size is measured in bytes.
134 @param[out] Buffer The buffer into which the data is read.
135
136 @retval EFI_SUCCESS The data was read.
137 @retval EFI_DEVICE_ERROR On entry, the current file position is
138 beyond the end of the file, or the device
139 reported an error while performing the read
140 operation.
141 @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
142 **/
143 EFIAPI
144 EFI_STATUS
145 BootMonFsReadFile (
146 IN EFI_FILE_PROTOCOL *This,
147 IN OUT UINTN *BufferSize,
148 OUT VOID *Buffer
149 );
150
151 EFIAPI
152 EFI_STATUS
153 BootMonFsSetDirPosition (
154 IN EFI_FILE_PROTOCOL *This,
155 IN UINT64 Position
156 );
157
158 EFIAPI
159 EFI_STATUS
160 BootMonFsGetPosition (
161 IN EFI_FILE_PROTOCOL *This,
162 OUT UINT64 *Position
163 );
164
165 EFIAPI
166 EFI_STATUS
167 BootMonFsWriteFile (
168 IN EFI_FILE_PROTOCOL *This,
169 IN OUT UINTN *BufferSize,
170 IN VOID *Buffer
171 );
172
173 EFIAPI
174 EFI_STATUS
175 BootMonFsDeleteFail (
176 IN EFI_FILE_PROTOCOL *This
177 );
178
179 EFIAPI
180 EFI_STATUS
181 BootMonFsDelete (
182 IN EFI_FILE_PROTOCOL *This
183 );
184
185 EFIAPI
186 EFI_STATUS
187 BootMonFsSetPosition (
188 IN EFI_FILE_PROTOCOL *This,
189 IN UINT64 Position
190 );
191
192 EFIAPI
193 EFI_STATUS
194 BootMonFsGetPosition(
195 IN EFI_FILE_PROTOCOL *This,
196 OUT UINT64 *Position
197 );
198
199 //
200 // UNSUPPORTED OPERATIONS
201 //
202
203 EFIAPI
204 EFI_STATUS
205 BootMonFsGetPositionUnsupported (
206 IN EFI_FILE_PROTOCOL *This,
207 OUT UINT64 *Position
208 );
209
210 EFIAPI
211 EFI_STATUS
212 BootMonFsSetInfo (
213 IN EFI_FILE_PROTOCOL *This,
214 IN EFI_GUID *InformationType,
215 IN UINTN BufferSize,
216 IN VOID *Buffer
217 );
218
219 //
220 // Directory API
221 //
222
223 EFI_STATUS
224 BootMonFsOpenDirectory (
225 OUT EFI_FILE_PROTOCOL **NewHandle,
226 IN CHAR16 *FileName,
227 IN BOOTMON_FS_INSTANCE *Volume
228 );
229
230 //
231 // Internal API
232 //
233 EFI_STATUS
234 BootMonGetFileFromAsciiFileName (
235 IN BOOTMON_FS_INSTANCE *Instance,
236 IN CHAR8* AsciiFileName,
237 OUT BOOTMON_FS_FILE **File
238 );
239
240 EFI_STATUS
241 BootMonGetFileFromPosition (
242 IN BOOTMON_FS_INSTANCE *Instance,
243 IN UINTN Position,
244 OUT BOOTMON_FS_FILE **File
245 );
246
247 #endif