53 #define EINFO_EEFI_OPEN \ 54 __einfo_uniqify ( EINFO_EPLATFORM, 0x01, "Could not open" ) 55 #define EINFO_EEFI_OPEN_NOT_FOUND \ 56 __einfo_platformify ( EINFO_EEFI_OPEN, EFI_NOT_FOUND, \ 58 #define EEFI_OPEN_NOT_FOUND \ 59 __einfo_error ( EINFO_EEFI_OPEN_NOT_FOUND ) 60 #define EEFI_OPEN( efirc ) EPLATFORM ( EINFO_EEFI_OPEN, efirc, \ 64 #define EFI_LOCAL_BLKSIZE 4096 169 DBGC ( local,
"LOCAL %p could not get file system info on %s: " 174 DBGC2 ( local,
"LOCAL %p found %s with label \"%ls\"\n",
180 goto err_alloc_label;
226 DBGC ( local,
"LOCAL %p could not open filesystem on %s: %s\n",
232 if ( ( efirc =
u.fs->OpenVolume (
u.fs,
root ) ) != 0 ) {
234 DBGC ( local,
"LOCAL %p could not open volume on %s: %s\n",
275 &handles ) ) != 0 ) {
277 DBGC ( local,
"LOCAL %p could not enumerate handles: " 288 DBGC ( local,
"LOCAL %p could not locate file system " 289 "on %s: %s\n", local,
300 for ( i = 0 ; i < num_handles ; i++ ) {
310 if ( ( check ==
NULL ) ||
312 DBGC ( local,
"LOCAL %p using %s",
316 DBGC ( local,
"\n" );
330 if ( ! local->
root ) {
331 DBGC ( local,
"LOCAL %p found no matching handle\n", local );
346 const char *resolved ) {
347 size_t name_len =
strlen ( resolved );
360 DBGC ( local,
"LOCAL %p could not open \"%s\": %s\n",
380 size_t remaining =
sizeof (
base );
396 DBGC2 ( local,
"LOCAL %p base path \"%s\"\n",
417 DBGC ( local,
"LOCAL %p using \"%s\"\n",
458 DBGC ( local,
"LOCAL %p could not get file info: %s\n",
493 if ( ( ! local->
root ) &&
498 if ( ( ! local->
file ) &&
503 if ( ( ! local->
len ) &&
508 remaining = local->
len;
513 while ( remaining ) {
516 frag_len = remaining;
530 iobuf->
data ) ) != 0 ) {
532 DBGC ( local,
"LOCAL %p could not read from file: %s\n",
542 DBGC ( local,
"LOCAL %p could not deliver data: %s\n",
548 remaining -= frag_len;
586 local =
zalloc (
sizeof ( *local ) );
struct errortab efi_local_errors [] __errortab
Human-readable error messages.
struct uri_opener efi_local_uri_opener __uri_opener
EFI local file URI opener.
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
An object interface operation.
EFI_LOADED_IMAGE_PROTOCOL * efi_loaded_image
Loaded image protocol for this image.
struct arbelprm_rc_send_wqe rc
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
void intf_close(struct interface *intf, int rc)
Close an object interface.
#define iob_put(iobuf, len)
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
static void uri_put(struct uri *uri)
Decrement URI reference count.
int xfer_deliver_iob(struct interface *intf, struct io_buffer *iobuf)
Deliver datagram as I/O buffer without metadata.
static struct uri * uri_get(struct uri *uri)
Increment URI reference count.
struct stp_switch root
Root switch.
struct process process
Download process.
uint32_t next
Next descriptor address.
EFI_GUID efi_file_system_info_id
File system information GUID.
128 bit buffer containing a unique identifier value.
#define ref_init(refcnt, free)
Initialise a reference counter.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
#define __einfo_errortab(einfo)
uint8_t size
Entry size (in 32-bit words)
EFI_DEVICE_PATH_PROTOCOL * FilePath
A pointer to the file path portion specific to DeviceHandle that the EFI Image was loaded from.
EFI_FILE_GET_INFO GetInfo
#define ENOENT
No such file or directory.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
int strcasecmp(const char *first, const char *second)
Compare case-insensitive strings.
size_t efi_path_len(EFI_DEVICE_PATH_PROTOCOL *path)
Find length of device path (excluding terminator)
struct io_buffer * xfer_alloc_iob(struct interface *intf, size_t len)
Allocate I/O buffer.
#define PROC_DESC_ONCE(object_type, process, _step)
Define a process descriptor for a process that runs only once.
This protocol can be used on any device handle to obtain generic path/location information concerning...
CHAR16 PathName[1]
A NULL-terminated Path string including directory and file names.
uint16_t device
Device ID.
Uniform Resource Identifiers.
EFI_CLOSE_PROTOCOL CloseProtocol
void process_del(struct process *process)
Remove process from process list.
static void efi_local_step(struct efi_local *local)
Local file process.
static void efi_local_free(struct refcnt *refcnt)
Free local file.
size_t xfer_window(struct interface *intf)
Check flow control window.
struct refcnt refcnt
Reference count.
struct uri * uri
Download URI.
Dynamic memory allocation.
Data transfer interfaces.
#define ENOMEM
Not enough space.
#define iob_disown(iobuf)
Disown an I/O buffer.
EFI_DEVICE_PATH_PROTOCOL * efi_loaded_image_path
Device path for the loaded image's device handle.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
SimpleFileSystem protocol as defined in the UEFI 2.0 specification.
EFI_GUID efi_simple_file_system_protocol_guid
Simple file system protocol GUID.
const char * path
Path (after URI decoding)
const char * scheme
URI protocol name.
int efi_snprintf(wchar_t *wbuf, size_t wsize, const char *fmt,...)
Write a formatted string to a buffer.
EFI_FILE_PROTOCOL * file
EFI file.
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
size_t len
Length of file.
static int efi_local_check_volume_name(struct efi_local *local, EFI_HANDLE device, EFI_FILE_PROTOCOL *root, const char *volume)
Check for matching volume name.
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
char * resolve_path(const char *base_path, const char *relative_path)
Resolve base+relative path.
const char * volume
Volume name, or NULL to use loaded image's device.
static int efi_local_len(struct efi_local *local)
Get file length.
int xfer_seek(struct interface *intf, off_t offset)
Seek to position.
void process_add(struct process *process)
Add process to process list.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
An object interface descriptor.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
static int efi_local_open_volume(struct efi_local *local)
Open root filesystem of specified volume.
void * zalloc(size_t size)
Allocate cleared memory.
const char * path
File path.
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
static int efi_local_open_root(struct efi_local *local, EFI_HANDLE device, EFI_FILE_PROTOCOL **root)
Open root filesystem.
int asprintf(char **strp, const char *fmt,...)
Write a formatted string to newly allocated memory.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
static struct interface_descriptor efi_local_xfer_desc
Data transfer interface descriptor.
size_t strlen(const char *src)
Get length of string.
static struct interface_operation efi_local_operations[]
Data transfer interface operations.
Data transfer interface opening.
UINT64 UINTN
Unsigned value of native width.
static struct process_descriptor efi_local_process_desc
Process descriptor.
static void process_init_stopped(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process without adding to process list.
void * malloc(size_t size)
Allocate memory.
EFI_DEVICE_PATH_PROTOCOL * efi_path_next(EFI_DEVICE_PATH_PROTOCOL *path)
Find next element in device path.
const char * host
Host name.
Provides a GUID and a data structure that can be used with EFI_FILE_PROTOCOL.SetInfo() and EFI_FILE_P...
static int efi_local_open(struct interface *xfer, struct uri *uri)
Open local file.
static void efi_local_close(struct efi_local *local, int rc)
Close local file.
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static int efi_local_open_path(struct efi_local *local)
Open specified path.
EFI_FILE_PROTOCOL * root
EFI root directory.
const char * opaque
Opaque part.
static int efi_local_open_resolved(struct efi_local *local, const char *resolved)
Open fully-resolved path.
EFI_GUID efi_file_info_id
File information GUID.
#define EFI_FILE_MODE_READ
void * data
Start of data.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Retrieve the set of handles from the handle database that support a specified protocol.
A Uniform Resource Identifier.
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
uint16_t protocol
Protocol ID.
struct interface xfer
Data transfer interface.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define EINFO_EEFI_OPEN_NOT_FOUND
#define NULL
NULL pointer (VOID *)
Provides a GUID and a data structure that can be used with EFI_FILE_PROTOCOL.GetInfo() or EFI_FILE_PR...
#define EFI_LOCAL_BLKSIZE
Download blocksize.
The EFI_FILE_PROTOCOL provides file IO access to supported file systems.
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
EFI_LOCATE_DEVICE_PATH LocateDevicePath
#define ref_put(refcnt)
Drop reference to object.
void * memset(void *dest, int character, size_t len) __nonnull
PACKED union @532::@546 Header