2 Support a Semi Host file system over a debuggers JTAG
4 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef SEMIHOST_FS_H_
11 #define SEMIHOST_FS_H_
15 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*This
,
20 Open a file on the host system by means of the semihosting interface.
22 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
23 the file handle to source location.
24 @param[out] NewHandle A pointer to the location to return the opened
25 handle for the new file.
26 @param[in] FileName The Null-terminated string of the name of the file
28 @param[in] OpenMode The mode to open the file : Read or Read/Write or
30 @param[in] Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these
31 are the attribute bits for the newly created file. The
32 mnemonics of the attribute bits are : EFI_FILE_READ_ONLY,
33 EFI_FILE_HIDDEN, EFI_FILE_SYSTEM, EFI_FILE_RESERVED,
34 EFI_FILE_DIRECTORY and EFI_FILE_ARCHIVE.
36 @retval EFI_SUCCESS The file was open.
37 @retval EFI_NOT_FOUND The specified file could not be found.
38 @retval EFI_DEVICE_ERROR The last issued semi-hosting operation failed.
39 @retval EFI_WRITE_PROTECTED Attempt to create a directory. This is not possible
40 with the semi-hosting interface.
41 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
42 @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
48 OUT EFI_FILE
**NewHandle
,
55 Close a specified file handle.
57 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
60 @retval EFI_SUCCESS The file was closed.
61 @retval EFI_INVALID_PARAMETER The parameter "This" is NULL.
70 Close and delete a file.
72 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
75 @retval EFI_SUCCESS The file was closed and deleted.
76 @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not deleted.
77 @retval EFI_INVALID_PARAMETER The parameter "This" is NULL.
86 Read data from an open file.
88 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
89 is the file handle to read data from.
90 @param[in out] BufferSize On input, the size of the Buffer. On output, the
91 amount of data returned in Buffer. In both cases,
92 the size is measured in bytes.
93 @param[out] Buffer The buffer into which the data is read.
95 @retval EFI_SUCCESS The data was read.
96 @retval EFI_DEVICE_ERROR On entry, the current file position is
97 beyond the end of the file, or the semi-hosting
98 interface reported an error while performing the
100 @retval EFI_INVALID_PARAMETER The parameter "This" or the parameter "Buffer"
106 IN OUT UINTN
*BufferSize
,
111 Write data to an open file.
113 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
114 is the file handle to write data to.
115 @param[in out] BufferSize On input, the size of the Buffer. On output, the
116 size of the data actually written. In both cases,
117 the size is measured in bytes.
118 @param[in] Buffer The buffer of data to write.
120 @retval EFI_SUCCESS The data was written.
121 @retval EFI_ACCESS_DENIED Attempt to write into a read only file or
122 in a file opened in read only mode.
123 @retval EFI_DEVICE_ERROR The last issued semi-hosting operation failed.
124 @retval EFI_INVALID_PARAMETER The parameter "This" or the parameter "Buffer"
131 IN OUT UINTN
*BufferSize
,
136 Return a file's current position.
138 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
139 the file handle to get the current position on.
140 @param[out] Position The address to return the file's current position value.
142 @retval EFI_SUCCESS The position was returned.
143 @retval EFI_INVALID_PARAMETER Position is a NULL pointer.
153 Set a file's current position.
155 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
156 the file handle to set the requested position on.
157 @param[in] Position The byte position from the start of the file to set.
159 @retval EFI_SUCCESS The position was set.
160 @retval EFI_DEVICE_ERROR The semi-hosting positioning operation failed.
161 @retval EFI_UNSUPPORTED The seek request for nonzero is not valid on open
172 Return information about a file or a file system.
174 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
175 is the file handle the requested information is for.
176 @param[in] InformationType The type identifier for the information being requested :
177 EFI_FILE_INFO_ID or EFI_FILE_SYSTEM_INFO_ID or
178 EFI_FILE_SYSTEM_VOLUME_LABEL_ID
179 @param[in out] BufferSize The size, in bytes, of Buffer.
180 @param[out] Buffer A pointer to the data buffer to return. The type of the
181 data inside the buffer is indicated by InformationType.
183 @retval EFI_SUCCESS The information was returned.
184 @retval EFI_UNSUPPORTED The InformationType is not known.
185 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to return the information.
186 BufferSize has been updated with the size needed to
187 complete the request.
188 @retval EFI_INVALID_PARAMETER The parameter "This" or the parameter "Buffer"
195 IN EFI_GUID
*InformationType
,
196 IN OUT UINTN
*BufferSize
,
201 Set information about a file or a file system.
203 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
204 is the file handle the information is for.
205 @param[in] InformationType The type identifier for the information being set :
206 EFI_FILE_INFO_ID or EFI_FILE_SYSTEM_INFO_ID or
207 EFI_FILE_SYSTEM_VOLUME_LABEL_ID
208 @param[in] BufferSize The size, in bytes, of Buffer.
209 @param[in] Buffer A pointer to the data buffer to write. The type of the
210 data inside the buffer is indicated by InformationType.
212 @retval EFI_SUCCESS The information was set.
213 @retval EFI_UNSUPPORTED The InformationType is not known.
214 @retval EFI_DEVICE_ERROR The last issued semi-hosting operation failed.
215 @retval EFI_ACCESS_DENIED An attempt is being made to change the
216 EFI_FILE_DIRECTORY Attribute.
217 @retval EFI_ACCESS_DENIED InformationType is EFI_FILE_INFO_ID and
218 the file is a read-only file or has been
219 opened in read-only mode and an attempt is
220 being made to modify a field other than
222 @retval EFI_ACCESS_DENIED An attempt is made to change the name of a file
223 to a file that is already present.
224 @retval EFI_WRITE_PROTECTED An attempt is being made to modify a
226 @retval EFI_BAD_BUFFER_SIZE The size of the buffer is lower than that indicated by
227 the data inside the buffer.
228 @retval EFI_OUT_OF_RESOURCES An allocation needed to process the request failed.
229 @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
235 IN EFI_GUID
*InformationType
,
245 #endif // SEMIHOST_FS_H_