@@ -2,9 +2,60 @@ use crate::protocol::device_path::DevicePathProtocol;
2
2
use crate :: { guid, Guid , Status } ;
3
3
use core:: ffi:: c_void;
4
4
5
+ /// Load File Protocol.
6
+ ///
7
+ /// Used to obtain files, that are primarily boot options, from arbitrary
8
+ /// devices.
9
+ ///
10
+ /// # UEFI Spec Description
11
+ /// The EFI_LOAD_FILE_PROTOCOL is a simple protocol used to obtain files from
12
+ /// arbitrary devices.
13
+ ///
14
+ /// When the firmware is attempting to load a file, it first attempts to use the
15
+ /// device’s Simple File System protocol to read the file. If the file system
16
+ /// protocol is found, the firmware implements the policy of interpreting the
17
+ /// File Path value of the file being loaded. If the device does not support the
18
+ /// file system protocol, the firmware then attempts to read the file via the
19
+ /// EFI_LOAD_FILE_PROTOCOL and the LoadFile() function. In this case the
20
+ /// LoadFile() function implements the policy of interpreting the File Path
21
+ /// value.
5
22
#[ derive( Debug ) ]
6
23
#[ repr( C ) ]
7
24
pub struct LoadFileProtocol {
25
+ /// Causes the driver to load a specified file.
26
+ ///
27
+ /// # Parameters
28
+ /// - `this` pointer to self
29
+ /// - `file_path` The device specific path of the file to load.
30
+ /// - `boot_policy` If TRUE, indicates that the request originates from the
31
+ /// boot manager, and that the boot manager is attempting to load FilePath
32
+ /// as a boot selection. If FALSE, then FilePath must match an exact file
33
+ /// to be loaded.
34
+ /// - `buffer_size` On input the size of Buffer in bytes. On output with a
35
+ /// return code of EFI_SUCCESS, the amount of data transferred to Buffer.
36
+ /// On output with a return code of EFI_BUFFER_TOO_SMALL, the size of
37
+ /// Buffer required to retrieve the requested file.
38
+ /// - `buffer` The memory buffer to transfer the file to. If Buffer is NULL,
39
+ /// then the size of the requested file is returned in BufferSize.
40
+ ///
41
+ /// # Errors
42
+ /// - `uefi::status::EFI_SUCCESS` The file was loaded.
43
+ /// - `uefi::status::EFI_UNSUPPORTED` The device does not support the
44
+ /// provided BootPolicy.
45
+ /// - `uefi::status::EFI_INVALID_PARAMETER` FilePath is not a valid device
46
+ /// path, or BufferSize is NULL.
47
+ /// - `uefi::status::EFI_NO_MEDIA` No medium was present to load the file.
48
+ /// - `uefi::status::EFI_DEVICE_ERROR` The file was not loaded due to a
49
+ /// device error.
50
+ /// - `uefi::status::EFI_NO_RESPONSE` The remote system did not respond.
51
+ /// - `uefi::status::EFI_NOT_FOUND` The file was not found.
52
+ /// - `uefi::status::EFI_ABORTED` The file load process was manually
53
+ /// cancelled.
54
+ /// - `uefi::status::EFI_BUFFER_TOO_SMALL` The BufferSize is too small to
55
+ /// read the current directory entry. BufferSize has been updated with the
56
+ /// size needed to complete the request.
57
+ /// - `uefi::status::EFI_WARN_FILE_SYSTEM` The resulting Buffer contains
58
+ /// UEFI-compliant file system.
8
59
pub load_file : unsafe extern "efiapi" fn (
9
60
this : * mut LoadFileProtocol ,
10
61
file_path : * const DevicePathProtocol ,
@@ -18,9 +69,48 @@ impl LoadFileProtocol {
18
69
pub const GUID : Guid = guid ! ( "56ec3091-954c-11d2-8e3f-00a0c969723b" ) ;
19
70
}
20
71
72
+ /// Load File2 Protocol.
73
+ ///
74
+ /// The Load File2 protocol is used to obtain files from arbitrary devices that
75
+ /// are not boot options.
76
+ ///
77
+ /// # UEFI Spec Description
78
+ ///
79
+ /// The EFI_LOAD_FILE2_PROTOCOL is a simple protocol used to obtain files from
80
+ /// arbitrary devices that are not boot options. It is used by LoadImage() when
81
+ /// its BootOption parameter is FALSE and the FilePath does not have an instance
82
+ /// of the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.
21
83
#[ derive( Debug ) ]
22
84
#[ repr( C ) ]
23
85
pub struct LoadFile2Protocol {
86
+ /// Causes the driver to load a specified file.
87
+ ///
88
+ /// # Parameters
89
+ /// - `this` pointer to self
90
+ /// - `file_path` The device specific path of the file to load.
91
+ /// - `boot_policy` Should always be FALSE.
92
+ /// - `buffer_size` On input the size of Buffer in bytes. On output with a
93
+ /// return code of EFI_SUCCESS, the amount of data transferred to Buffer.
94
+ /// On output with a return code of EFI_BUFFER_TOO_SMALL, the size of
95
+ /// Buffer required to retrieve the requested file.
96
+ /// - `buffer` The memory buffer to transfer the file to. If Buffer is NULL,
97
+ /// then the size of the requested file is returned in BufferSize.
98
+ ///
99
+ /// # Errors
100
+ /// - `uefi::status::EFI_SUCCESS` The file was loaded.
101
+ /// - `uefi::status::EFI_UNSUPPORTED` BootPolicy is TRUE.
102
+ /// - `uefi::status::EFI_INVALID_PARAMETER` FilePath is not a valid device
103
+ /// path, or BufferSize is NULL.
104
+ /// - `uefi::status::EFI_NO_MEDIA` No medium was present to load the file.
105
+ /// - `uefi::status::EFI_DEVICE_ERROR` The file was not loaded due to a
106
+ /// device error.
107
+ /// - `uefi::status::EFI_NO_RESPONSE` The remote system did not respond.
108
+ /// - `uefi::status::EFI_NOT_FOUND` The file was not found.
109
+ /// - `uefi::status::EFI_ABORTED` The file load process was manually
110
+ /// cancelled.
111
+ /// - `uefi::status::EFI_BUFFER_TOO_SMALL` The BufferSize is too small to
112
+ /// read the current directory entry. BufferSize has been updated with the
113
+ /// size needed to complete the request.
24
114
pub load_file : unsafe extern "efiapi" fn (
25
115
this : * mut LoadFile2Protocol ,
26
116
file_path : * const DevicePathProtocol ,
0 commit comments