iPXE
|
EFI block device protocols. More...
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ipxe/refcnt.h>
#include <ipxe/list.h>
#include <ipxe/uri.h>
#include <ipxe/interface.h>
#include <ipxe/blockdev.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>
#include <ipxe/retry.h>
#include <ipxe/timer.h>
#include <ipxe/process.h>
#include <ipxe/sanboot.h>
#include <ipxe/iso9660.h>
#include <ipxe/acpi.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/BlockIo.h>
#include <ipxe/efi/Protocol/SimpleFileSystem.h>
#include <ipxe/efi/Protocol/AcpiTable.h>
#include <ipxe/efi/efi_driver.h>
#include <ipxe/efi/efi_strings.h>
#include <ipxe/efi/efi_snp.h>
#include <ipxe/efi/efi_path.h>
#include <ipxe/efi/efi_null.h>
#include <ipxe/efi/efi_block.h>
Go to the source code of this file.
Data Structures | |
struct | efi_block_data |
EFI SAN device private data. More... | |
struct | efi_acpi_table |
An installed ACPI table. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
EFI_REQUEST_PROTOCOL (EFI_ACPI_TABLE_PROTOCOL, &acpi) | |
static int | efi_block_rw (struct san_device *sandev, uint64_t lba, void *data, size_t len, int(*sandev_rw)(struct san_device *sandev, uint64_t lba, unsigned int count, userptr_t buffer)) |
Read from or write to EFI block device. More... | |
static EFI_STATUS EFIAPI | efi_block_io_reset (EFI_BLOCK_IO_PROTOCOL *block_io, BOOLEAN verify __unused) |
Reset EFI block device. More... | |
static EFI_STATUS EFIAPI | efi_block_io_read (EFI_BLOCK_IO_PROTOCOL *block_io, UINT32 media __unused, EFI_LBA lba, UINTN len, VOID *data) |
Read from EFI block device. More... | |
static EFI_STATUS EFIAPI | efi_block_io_write (EFI_BLOCK_IO_PROTOCOL *block_io, UINT32 media __unused, EFI_LBA lba, UINTN len, VOID *data) |
Write to EFI block device. More... | |
static EFI_STATUS EFIAPI | efi_block_io_flush (EFI_BLOCK_IO_PROTOCOL *block_io) |
Flush data to EFI block device. More... | |
static void | efi_block_connect (struct san_device *sandev) |
Connect all possible drivers to EFI block device. More... | |
static int | efi_block_hook (unsigned int drive, struct uri **uris, unsigned int count, unsigned int flags) |
Hook EFI block device. More... | |
static void | efi_block_unhook (unsigned int drive) |
Unhook EFI block device. More... | |
static | LIST_HEAD (efi_acpi_tables) |
List of installed ACPI tables. More... | |
static int | efi_block_install (struct acpi_header *hdr) |
Install ACPI table. More... | |
static int | efi_block_describe (void) |
Describe EFI block devices. More... | |
static int | efi_block_boot_image (struct san_device *sandev, EFI_HANDLE handle, const char *filename, EFI_HANDLE *image) |
Try booting from child device of EFI block device. More... | |
static int | efi_block_boot (unsigned int drive, const char *filename) |
Boot from EFI block device. More... | |
PROVIDE_SANBOOT (efi, san_hook, efi_block_hook) | |
PROVIDE_SANBOOT (efi, san_unhook, efi_block_unhook) | |
PROVIDE_SANBOOT (efi, san_describe, efi_block_describe) | |
PROVIDE_SANBOOT (efi, san_boot, efi_block_boot) | |
Variables | |
static EFI_ACPI_TABLE_PROTOCOL * | acpi |
ACPI table protocol protocol. More... | |
static wchar_t | efi_block_boot_filename [] = EFI_REMOVABLE_MEDIA_FILE_NAME |
Boot filename. More... | |
EFI block device protocols.
Definition in file efi_block.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
EFI_REQUEST_PROTOCOL | ( | EFI_ACPI_TABLE_PROTOCOL | , |
& | acpi | ||
) |
|
static |
Read from or write to EFI block device.
sandev | SAN device |
lba | Starting LBA |
data | Data buffer |
len | Size of buffer |
sandev_rw | SAN device read/write method |
rc | Return status code |
Definition at line 92 of file efi_block.c.
References block, count, data, DBGC, san_device::drive, EINVAL, lba, len, san_device::priv, rc, efi_block_data::sandev, sandev_rw(), strerror(), and virt_to_user().
Referenced by efi_block_io_read(), and efi_block_io_write().
|
static |
Reset EFI block device.
block_io | Block I/O protocol |
verify | Perform extended verification |
efirc | EFI status code |
Definition at line 127 of file efi_block.c.
References block, efi_block_data::block_io, container_of, DBGC2, san_device::drive, efi_snp_claim(), efi_snp_release(), EFIRC, rc, and sandev_reset().
Referenced by efi_block_hook().
|
static |
Read from EFI block device.
block_io | Block I/O protocol |
media | Media identifier |
lba | Starting LBA |
len | Size of buffer |
data | Data buffer |
efirc | EFI status code |
Definition at line 152 of file efi_block.c.
References block, efi_block_data::block_io, container_of, data, DBGC2, san_device::drive, efi_block_rw(), efi_snp_claim(), efi_snp_release(), EFIRC, lba, len, rc, and sandev_read().
Referenced by efi_block_hook().
|
static |
Write to EFI block device.
block_io | Block I/O protocol |
media | Media identifier |
lba | Starting LBA |
len | Size of buffer |
data | Data buffer |
efirc | EFI status code |
Definition at line 178 of file efi_block.c.
References block, efi_block_data::block_io, container_of, data, DBGC2, san_device::drive, efi_block_rw(), efi_snp_claim(), efi_snp_release(), EFIRC, lba, len, rc, and sandev_write().
Referenced by efi_block_hook().
|
static |
Flush data to EFI block device.
block_io | Block I/O protocol |
efirc | EFI status code |
Definition at line 200 of file efi_block.c.
References block, efi_block_data::block_io, container_of, DBGC2, and san_device::drive.
Referenced by efi_block_hook().
|
static |
Connect all possible drivers to EFI block device.
sandev | SAN device |
Definition at line 216 of file efi_block.c.
References block, EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::ConnectController, DBGC, DBGC2, DBGC2_EFI_PROTOCOLS, san_device::drive, EEFI, efi_systab, NULL, san_device::priv, rc, efi_block_data::sandev, strerror(), and TRUE.
Referenced by efi_block_boot(), and efi_block_hook().
|
static |
Hook EFI block device.
drive | Drive number |
uris | List of URIs |
count | Number of URIs |
flags | Flags |
drive | Drive number, or negative error |
Definition at line 243 of file efi_block.c.
References san_device::active, alloc_sandev(), block_device_capacity::blksize, san_device::blksize_shift, block, san_path::block, block_device_capacity::blocks, EFI_SYSTEM_TABLE::BootServices, san_device::capacity, count, DBG, DBGC, drive, san_device::drive, EEFI, efi_block_connect(), efi_block_io_flush(), efi_block_io_protocol_guid, EFI_BLOCK_IO_PROTOCOL_REVISION3, efi_block_io_read(), efi_block_io_reset(), efi_block_io_write(), efi_describe(), efi_device_path_protocol_guid, efi_devpath_text(), efi_nullify_block(), efi_systab, ENODEV, ENOMEM, ENOTTY, flags, free, EFI_BOOT_SERVICES::InstallMultipleProtocolInterfaces, NULL, san_device::priv, rc, register_sandev(), efi_block_data::sandev, sandev_put(), strerror(), EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces, and unregister_sandev().
|
static |
Unhook EFI block device.
drive | Drive number |
Definition at line 357 of file efi_block.c.
References block, EFI_SYSTEM_TABLE::BootServices, DBG, DBGC, drive, san_device::drive, EEFI, efi_block_io_protocol_guid, efi_device_path_protocol_guid, efi_nullify_block(), efi_shutdown_in_progress, efi_systab, free, NULL, san_device::priv, efi_block_data::sandev, sandev_find(), sandev_put(), strerror(), EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces, and unregister_sandev().
|
static |
List of installed ACPI tables.
|
static |
Install ACPI table.
hdr | ACPI description header |
rc | Return status code |
Definition at line 422 of file efi_block.c.
References acpi, acpi_fix_checksum(), acpi_name(), DBGC, DBGC2_HDA, EEFI, ENOMEM, free, hdr, _EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable, efi_acpi_table::key, le32_to_cpu, len, efi_acpi_table::list, list_add_tail, list_del, rc, strerror(), strncpy(), and zalloc().
Referenced by efi_block_describe().
|
static |
Describe EFI block devices.
rc | Return status code |
Definition at line 473 of file efi_block.c.
References acpi, acpi_install(), DBG, DBGC, EEFI, efi_block_install(), ENOTSUP, free, key, efi_acpi_table::key, efi_acpi_table::list, list_del, list_for_each_entry_safe, rc, strerror(), tmp, and _EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable.
|
static |
Try booting from child device of EFI block device.
sandev | SAN device |
handle | EFI handle |
filename | Filename (or NULL to use default) |
image | Image handle to fill in |
rc | Return status code |
Definition at line 519 of file efi_block.c.
References block, EFI_SYSTEM_TABLE::BootServices, DBGC, san_device::drive, EEFI, efi_block_boot_filename, efi_device_path_protocol_guid, efi_devpath_text(), efi_image_handle, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_path_end(), efi_path_len(), EFI_SECURITY_VIOLATION, efi_sprintf, efi_systab, end, END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, ENOMEM, ENOTTY, FALSE, free, handle, FILEPATH_DEVICE_PATH::Header, EFI_DEVICE_PATH_PROTOCOL::Length, EFI_BOOT_SERVICES::LoadImage, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, memcmp(), memcpy(), NULL, EFI_BOOT_SERVICES::OpenProtocol, efi_block_data::path, FILEPATH_DEVICE_PATH::PathName, san_device::priv, rc, efi_block_data::sandev, SIZE_OF_FILEPATH_DEVICE_PATH, strerror(), strlen(), EFI_DEVICE_PATH_PROTOCOL::SubType, EFI_DEVICE_PATH_PROTOCOL::Type, EFI_BOOT_SERVICES::UnloadImage, and zalloc().
Referenced by efi_block_boot().
|
static |
Boot from EFI block device.
drive | Drive number |
filename | Filename (or NULL to use default) |
rc | Return status code |
Definition at line 621 of file efi_block.c.
References EFI_SYSTEM_TABLE::BootServices, ByProtocol, count, DBG, DBGC, drive, san_device::drive, EEFI, efi_block_boot_image(), efi_block_connect(), efi_simple_file_system_protocol_guid, efi_snp_claim(), efi_snp_release(), efi_systab, ENODEV, ENOENT, EFI_BOOT_SERVICES::FreePool, EFI_BOOT_SERVICES::LocateHandleBuffer, NULL, rc, sandev_find(), EFI_BOOT_SERVICES::StartImage, strerror(), and EFI_BOOT_SERVICES::UnloadImage.
PROVIDE_SANBOOT | ( | efi | , |
san_hook | , | ||
efi_block_hook | |||
) |
PROVIDE_SANBOOT | ( | efi | , |
san_unhook | , | ||
efi_block_unhook | |||
) |
PROVIDE_SANBOOT | ( | efi | , |
san_describe | , | ||
efi_block_describe | |||
) |
PROVIDE_SANBOOT | ( | efi | , |
san_boot | , | ||
efi_block_boot | |||
) |
|
static |
ACPI table protocol protocol.
Definition at line 62 of file efi_block.c.
Referenced by acpi_find_via_rsdt(), acpi_fix_checksum(), acpi_settings_fetch(), acpi_zsdt(), dummy_install(), efi_block_describe(), efi_block_install(), ibft_install(), int13_install(), nii_pci_open(), and typeof().
|
static |