2 Support a Semi Host file system over a debuggers JTAG
4 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __SEMIHOST_FS_H__
17 #define __SEMIHOST_FS_H__
21 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*This
,
26 Open a file on the host system by means of the semihosting interface.
28 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
29 the file handle to source location.
30 @param[out] NewHandle A pointer to the location to return the opened
31 handle for the new file.
32 @param[in] FileName The Null-terminated string of the name of the file
34 @param[in] OpenMode The mode to open the file : Read or Read/Write or
36 @param[in] Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these
37 are the attribute bits for the newly created file. The
38 mnemonics of the attribute bits are : EFI_FILE_READ_ONLY,
39 EFI_FILE_HIDDEN, EFI_FILE_SYSTEM, EFI_FILE_RESERVED,
40 EFI_FILE_DIRECTORY and EFI_FILE_ARCHIVE.
42 @retval EFI_SUCCESS The file was open.
43 @retval EFI_NOT_FOUND The specified file could not be found.
44 @retval EFI_DEVICE_ERROR The last issued semi-hosting operation failed.
45 @retval EFI_WRITE_PROTECTED Attempt to create a directory. This is not possible
46 with the semi-hosting interface.
47 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
48 @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
54 OUT EFI_FILE
**NewHandle
,
61 Close a specified file handle.
63 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
66 @retval EFI_SUCCESS The file was closed.
67 @retval EFI_INVALID_PARAMETER The parameter "This" is NULL.
76 Close and delete a file.
78 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is the file
81 @retval EFI_SUCCESS The file was closed and deleted.
82 @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not deleted.
83 @retval EFI_INVALID_PARAMETER The parameter "This" is NULL.
92 Read data from an open file.
94 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
95 is the file handle to read data from.
96 @param[in out] BufferSize On input, the size of the Buffer. On output, the
97 amount of data returned in Buffer. In both cases,
98 the size is measured in bytes.
99 @param[out] Buffer The buffer into which the data is read.
101 @retval EFI_SUCCESS The data was read.
102 @retval EFI_DEVICE_ERROR On entry, the current file position is
103 beyond the end of the file, or the semi-hosting
104 interface reported an error while performing the
106 @retval EFI_INVALID_PARAMETER The parameter "This" or the parameter "Buffer"
112 IN OUT UINTN
*BufferSize
,
117 Write data to an open file.
119 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
120 is the file handle to write data to.
121 @param[in out] BufferSize On input, the size of the Buffer. On output, the
122 size of the data actually written. In both cases,
123 the size is measured in bytes.
124 @param[in] Buffer The buffer of data to write.
126 @retval EFI_SUCCESS The data was written.
127 @retval EFI_ACCESS_DENIED Attempt to write into a read only file or
128 in a file opened in read only mode.
129 @retval EFI_DEVICE_ERROR The last issued semi-hosting operation failed.
130 @retval EFI_INVALID_PARAMETER The parameter "This" or the parameter "Buffer"
137 IN OUT UINTN
*BufferSize
,
142 Return a file's current position.
144 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
145 the file handle to get the current position on.
146 @param[out] Position The address to return the file's current position value.
148 @retval EFI_SUCCESS The position was returned.
149 @retval EFI_INVALID_PARAMETER Position is a NULL pointer.
159 Set a file's current position.
161 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
162 the file handle to set the requested position on.
163 @param[in] Position The byte position from the start of the file to set.
165 @retval EFI_SUCCESS The position was set.
166 @retval EFI_DEVICE_ERROR The semi-hosting positionning operation failed.
167 @retval EFI_UNSUPPORTED The seek request for nonzero is not valid on open
178 Return information about a file or a file system.
180 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
181 is the file handle the requested information is for.
182 @param[in] InformationType The type identifier for the information being requested :
183 EFI_FILE_INFO_ID or EFI_FILE_SYSTEM_INFO_ID or
184 EFI_FILE_SYSTEM_VOLUME_LABEL_ID
185 @param[in out] BufferSize The size, in bytes, of Buffer.
186 @param[out] Buffer A pointer to the data buffer to return. The type of the
187 data inside the buffer is indicated by InformationType.
189 @retval EFI_SUCCESS The information was returned.
190 @retval EFI_UNSUPPORTED The InformationType is not known.
191 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to return the information.
192 BufferSize has been updated with the size needed to
193 complete the request.
194 @retval EFI_INVALID_PARAMETER The parameter "This" or the parameter "Buffer"
201 IN EFI_GUID
*InformationType
,
202 IN OUT UINTN
*BufferSize
,
207 Set information about a file or a file system.
209 @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that
210 is the file handle the information is for.
211 @param[in] InformationType The type identifier for the information being set :
212 EFI_FILE_INFO_ID or EFI_FILE_SYSTEM_INFO_ID or
213 EFI_FILE_SYSTEM_VOLUME_LABEL_ID
214 @param[in] BufferSize The size, in bytes, of Buffer.
215 @param[in] Buffer A pointer to the data buffer to write. The type of the
216 data inside the buffer is indicated by InformationType.
218 @retval EFI_SUCCESS The information was set.
219 @retval EFI_UNSUPPORTED The InformationType is not known.
220 @retval EFI_DEVICE_ERROR The last issued semi-hosting operation failed.
221 @retval EFI_ACCESS_DENIED An attempt is being made to change the
222 EFI_FILE_DIRECTORY Attribute.
223 @retval EFI_ACCESS_DENIED InformationType is EFI_FILE_INFO_ID and
224 the file is a read-only file or has been
225 opened in read-only mode and an attempt is
226 being made to modify a field other than
228 @retval EFI_ACCESS_DENIED An attempt is made to change the name of a file
229 to a file that is already present.
230 @retval EFI_WRITE_PROTECTED An attempt is being made to modify a
232 @retval EFI_BAD_BUFFER_SIZE The size of the buffer is lower than that indicated by
233 the data inside the buffer.
234 @retval EFI_OUT_OF_RESOURCES An allocation needed to process the request failed.
235 @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
241 IN EFI_GUID
*InformationType
,
251 #endif // __SEMIHOST_FS_H__