xref: /freebsd/sys/contrib/edk2/Include/Protocol/LoadFile.h (revision f439973d6726c3be929c8fb3b1545b8b1744abc3)
1*f439973dSWarner Losh /** @file
2*f439973dSWarner Losh   Load File protocol as defined in the UEFI 2.0 specification.
3*f439973dSWarner Losh 
4*f439973dSWarner Losh   The load file protocol exists to supports the addition of new boot devices,
5*f439973dSWarner Losh   and to support booting from devices that do not map well to file system.
6*f439973dSWarner Losh   Network boot is done via a LoadFile protocol.
7*f439973dSWarner Losh 
8*f439973dSWarner Losh   UEFI 2.0 can boot from any device that produces a LoadFile protocol.
9*f439973dSWarner Losh 
10*f439973dSWarner Losh Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
11*f439973dSWarner Losh SPDX-License-Identifier: BSD-2-Clause-Patent
12*f439973dSWarner Losh 
13*f439973dSWarner Losh **/
14*f439973dSWarner Losh 
15*f439973dSWarner Losh #ifndef __EFI_LOAD_FILE_PROTOCOL_H__
16*f439973dSWarner Losh #define __EFI_LOAD_FILE_PROTOCOL_H__
17*f439973dSWarner Losh 
18*f439973dSWarner Losh #define EFI_LOAD_FILE_PROTOCOL_GUID \
19*f439973dSWarner Losh   { \
20*f439973dSWarner Losh     0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \
21*f439973dSWarner Losh   }
22*f439973dSWarner Losh 
23*f439973dSWarner Losh ///
24*f439973dSWarner Losh /// Protocol Guid defined by EFI1.1.
25*f439973dSWarner Losh ///
26*f439973dSWarner Losh #define LOAD_FILE_PROTOCOL  EFI_LOAD_FILE_PROTOCOL_GUID
27*f439973dSWarner Losh 
28*f439973dSWarner Losh typedef struct _EFI_LOAD_FILE_PROTOCOL EFI_LOAD_FILE_PROTOCOL;
29*f439973dSWarner Losh 
30*f439973dSWarner Losh ///
31*f439973dSWarner Losh /// Backward-compatible with EFI1.1
32*f439973dSWarner Losh ///
33*f439973dSWarner Losh typedef EFI_LOAD_FILE_PROTOCOL EFI_LOAD_FILE_INTERFACE;
34*f439973dSWarner Losh 
35*f439973dSWarner Losh /**
36*f439973dSWarner Losh   Causes the driver to load a specified file.
37*f439973dSWarner Losh 
38*f439973dSWarner Losh   @param  This       Protocol instance pointer.
39*f439973dSWarner Losh   @param  FilePath   The device specific path of the file to load.
40*f439973dSWarner Losh   @param  BootPolicy If TRUE, indicates that the request originates from the
41*f439973dSWarner Losh                      boot manager is attempting to load FilePath as a boot
42*f439973dSWarner Losh                      selection. If FALSE, then FilePath must match as exact file
43*f439973dSWarner Losh                      to be loaded.
44*f439973dSWarner Losh   @param  BufferSize On input the size of Buffer in bytes. On output with a return
45*f439973dSWarner Losh                      code of EFI_SUCCESS, the amount of data transferred to
46*f439973dSWarner Losh                      Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,
47*f439973dSWarner Losh                      the size of Buffer required to retrieve the requested file.
48*f439973dSWarner Losh   @param  Buffer     The memory buffer to transfer the file to. IF Buffer is NULL,
49*f439973dSWarner Losh                      then the size of the requested file is returned in
50*f439973dSWarner Losh                      BufferSize.
51*f439973dSWarner Losh 
52*f439973dSWarner Losh   @retval EFI_SUCCESS           The file was loaded.
53*f439973dSWarner Losh   @retval EFI_UNSUPPORTED       The device does not support the provided BootPolicy
54*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
55*f439973dSWarner Losh                                 BufferSize is NULL.
56*f439973dSWarner Losh   @retval EFI_NO_MEDIA          No medium was present to load the file.
57*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR      The file was not loaded due to a device error.
58*f439973dSWarner Losh   @retval EFI_NO_RESPONSE       The remote system did not respond.
59*f439973dSWarner Losh   @retval EFI_NOT_FOUND         The file was not found.
60*f439973dSWarner Losh   @retval EFI_ABORTED           The file load process was manually cancelled.
61*f439973dSWarner Losh   @retval EFI_WARN_FILE_SYSTEM  The resulting Buffer contains UEFI-compliant file system.
62*f439973dSWarner Losh **/
63*f439973dSWarner Losh typedef
64*f439973dSWarner Losh EFI_STATUS
65*f439973dSWarner Losh (EFIAPI *EFI_LOAD_FILE)(
66*f439973dSWarner Losh   IN EFI_LOAD_FILE_PROTOCOL           *This,
67*f439973dSWarner Losh   IN EFI_DEVICE_PATH_PROTOCOL         *FilePath,
68*f439973dSWarner Losh   IN BOOLEAN                          BootPolicy,
69*f439973dSWarner Losh   IN OUT UINTN                        *BufferSize,
70*f439973dSWarner Losh   IN VOID                             *Buffer OPTIONAL
71*f439973dSWarner Losh   );
72*f439973dSWarner Losh 
73*f439973dSWarner Losh ///
74*f439973dSWarner Losh /// The EFI_LOAD_FILE_PROTOCOL is a simple protocol used to obtain files from arbitrary devices.
75*f439973dSWarner Losh ///
76*f439973dSWarner Losh struct _EFI_LOAD_FILE_PROTOCOL {
77*f439973dSWarner Losh   EFI_LOAD_FILE    LoadFile;
78*f439973dSWarner Losh };
79*f439973dSWarner Losh 
80*f439973dSWarner Losh extern EFI_GUID  gEfiLoadFileProtocolGuid;
81*f439973dSWarner Losh 
82*f439973dSWarner Losh #endif
83