iPXE
|
EFI device paths. More...
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/netdevice.h>
#include <ipxe/vlan.h>
#include <ipxe/uuid.h>
#include <ipxe/tcpip.h>
#include <ipxe/uri.h>
#include <ipxe/iscsi.h>
#include <ipxe/aoe.h>
#include <ipxe/fcp.h>
#include <ipxe/ib_srp.h>
#include <ipxe/usb.h>
#include <ipxe/settings.h>
#include <ipxe/dhcp.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_driver.h>
#include <ipxe/efi/efi_path.h>
Go to the source code of this file.
Data Structures | |
struct | efi_path_settings |
An EFI device path settings block. More... | |
struct | efi_path_setting |
An EFI device path setting. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER) | |
EFI_DEVICE_PATH_PROTOCOL * | efi_path_next (EFI_DEVICE_PATH_PROTOCOL *path) |
Find next element in device path. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_path_prev (EFI_DEVICE_PATH_PROTOCOL *path, EFI_DEVICE_PATH_PROTOCOL *curr) |
Find previous element of device path. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_path_end (EFI_DEVICE_PATH_PROTOCOL *path) |
Find end of device path. More... | |
size_t | efi_path_len (EFI_DEVICE_PATH_PROTOCOL *path) |
Find length of device path (excluding terminator) More... | |
void * | efi_path_mac (EFI_DEVICE_PATH_PROTOCOL *path) |
Get MAC address from device path. More... | |
unsigned int | efi_path_vlan (EFI_DEVICE_PATH_PROTOCOL *path) |
Get VLAN tag from device path. More... | |
int | efi_path_guid (EFI_DEVICE_PATH_PROTOCOL *path, union uuid *guid) |
Get partition GUID from device path. More... | |
struct uri * | efi_path_uri (EFI_DEVICE_PATH_PROTOCOL *path) |
Parse URI from device path. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_paths (EFI_DEVICE_PATH_PROTOCOL *first,...) |
Concatenate EFI device paths. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_netdev_path (struct net_device *netdev) |
Construct EFI device path for network device. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_uri_path (struct uri *uri) |
Construct EFI device path for URI. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_iscsi_path (struct iscsi_session *iscsi) |
Construct EFI device path for iSCSI device. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_aoe_path (struct aoe_device *aoedev) |
Construct EFI device path for AoE device. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_fcp_path (struct fcp_description *desc) |
Construct EFI device path for Fibre Channel device. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_ib_srp_path (struct ib_srp_device *ib_srp) |
Construct EFI device path for Infiniband SRP device. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_usb_path (struct usb_function *func) |
Construct EFI device path for USB function. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_describe (struct interface *intf) |
Describe object as an EFI device path. More... | |
static int | efi_path_fetch_fixed (struct efi_path_setting *pathset, EFI_DEVICE_PATH_PROTOCOL *path, void *data, size_t len) |
Fetch an EFI device path fixed-size setting. More... | |
static int | efi_path_fetch_dns (struct efi_path_setting *pathset, EFI_DEVICE_PATH_PROTOCOL *path, void *data, size_t len) |
Fetch an EFI device path DNS setting. More... | |
static int | efi_path_fetch (struct settings *settings, struct setting *setting, void *data, size_t len) |
Fetch value of EFI device path setting. More... | |
static int | efi_path_net_probe (struct net_device *netdev, void *priv) |
Create per-netdevice EFI path settings. More... | |
Variables | |
static struct efi_path_setting | efi_path_settings [] |
EFI device path settings. More... | |
static struct settings_operations | efi_path_settings_operations |
EFI device path settings operations. More... | |
struct net_driver efi_path_net_driver | __net_driver |
EFI path settings per-netdevice driver. More... | |
EFI device paths.
Definition in file efi_path.c.
FILE_LICENCE | ( | GPL2_OR_LATER | ) |
EFI_DEVICE_PATH_PROTOCOL* efi_path_next | ( | EFI_DEVICE_PATH_PROTOCOL * | path | ) |
Find next element in device path.
path | Device path, or NULL |
next | Next element in device path, or NULL if at end |
Definition at line 89 of file efi_path.c.
References END_DEVICE_PATH_TYPE, EFI_DEVICE_PATH_PROTOCOL::Length, NULL, and EFI_DEVICE_PATH_PROTOCOL::Type.
Referenced by efi_local_open_path(), efi_path_fetch(), efi_path_guid(), efi_path_mac(), efi_path_prev(), efi_path_uri(), and efi_path_vlan().
EFI_DEVICE_PATH_PROTOCOL* efi_path_prev | ( | EFI_DEVICE_PATH_PROTOCOL * | path, |
EFI_DEVICE_PATH_PROTOCOL * | curr | ||
) |
Find previous element of device path.
path | Device path, or NULL for no path |
curr | Current element in device path, or NULL for end of path |
prev | Previous element in device path, or NULL |
Definition at line 115 of file efi_path.c.
References efi_path_next(), and tmp.
Referenced by efi_locate_device(), and efi_path_end().
EFI_DEVICE_PATH_PROTOCOL* efi_path_end | ( | EFI_DEVICE_PATH_PROTOCOL * | path | ) |
Find end of device path.
path | Device path, or NULL |
path_end | End of device path, or NULL |
Definition at line 133 of file efi_path.c.
References efi_path_prev(), and NULL.
Referenced by efi_block_exec(), efi_path_len(), and usbio_open().
size_t efi_path_len | ( | EFI_DEVICE_PATH_PROTOCOL * | path | ) |
Find length of device path (excluding terminator)
path | Device path, or NULL |
path_len | Length of device path |
Definition at line 144 of file efi_path.c.
References efi_path_end(), and end.
Referenced by efi_block_match(), efi_devpath_text(), efi_ib_srp_path(), efi_image_path(), efi_init(), efi_iscsi_path(), efi_local_open_path(), efi_locate_device(), efi_netdev_path(), efi_paths(), efi_snp_hii_install(), efi_usb_path(), efidev_alloc(), and usbio_path().
void* efi_path_mac | ( | EFI_DEVICE_PATH_PROTOCOL * | path | ) |
Get MAC address from device path.
path | Device path |
mac | MAC address, or NULL if not found |
Definition at line 156 of file efi_path.c.
References container_of, efi_path_next(), Header, mac, MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, next, NULL, EFI_DEVICE_PATH_PROTOCOL::SubType, and EFI_DEVICE_PATH_PROTOCOL::Type.
Referenced by efi_path_net_probe().
unsigned int efi_path_vlan | ( | EFI_DEVICE_PATH_PROTOCOL * | path | ) |
Get VLAN tag from device path.
path | Device path |
tag | VLAN tag, or 0 if not a VLAN |
Definition at line 180 of file efi_path.c.
References container_of, efi_path_next(), Header, MESSAGING_DEVICE_PATH, MSG_VLAN_DP, next, EFI_DEVICE_PATH_PROTOCOL::SubType, EFI_DEVICE_PATH_PROTOCOL::Type, and VLAN_DEVICE_PATH::VlanId.
Referenced by efi_cachedhcp_record(), efi_path_net_probe(), and efi_set_autoboot_ll_addr().
int efi_path_guid | ( | EFI_DEVICE_PATH_PROTOCOL * | path, |
union uuid * | guid | ||
) |
Get partition GUID from device path.
path | Device path |
guid | Partition GUID to fill in |
rc | Return status code |
Definition at line 204 of file efi_path.c.
References container_of, efi_path_next(), ENOENT, guid, Header, MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, memcpy(), next, rc, HARDDRIVE_DEVICE_PATH::Signature, SIGNATURE_TYPE_GUID, HARDDRIVE_DEVICE_PATH::SignatureType, EFI_DEVICE_PATH_PROTOCOL::SubType, EFI_DEVICE_PATH_PROTOCOL::Type, and uuid_mangle().
Referenced by efi_block_match().
struct uri* efi_path_uri | ( | EFI_DEVICE_PATH_PROTOCOL * | path | ) |
Parse URI from device path.
path | Device path |
uri | URI, or NULL if not a URI |
Definition at line 244 of file efi_path.c.
References container_of, efi_path_next(), free, Header, len, memcpy(), MESSAGING_DEVICE_PATH, MSG_URI_DP, next, NULL, offsetof, parse_uri(), uri::path, typeof(), URI_DEVICE_PATH::Uri, and zalloc().
Referenced by efi_init_application().
EFI_DEVICE_PATH_PROTOCOL* efi_paths | ( | EFI_DEVICE_PATH_PROTOCOL * | first, |
... | |||
) |
Concatenate EFI device paths.
... | List of device paths (NULL terminated) |
path | Concatenated device path, or NULL on error |
The caller is responsible for eventually calling free() on the allocated device path.
Definition at line 287 of file efi_path.c.
References efi_path_len(), efi_path_terminate(), end, first, len, memcpy(), NULL, uri::path, src, va_arg, va_end, va_start, and zalloc().
Referenced by efi_aoe_path().
EFI_DEVICE_PATH_PROTOCOL* efi_netdev_path | ( | struct net_device * | netdev | ) |
Construct EFI device path for network device.
netdev | Network device |
path | EFI device path, or NULL on error |
The caller is responsible for eventually calling free() on the allocated device path.
Definition at line 336 of file efi_path.c.
References assert(), net_device::dev, efi_path_len(), efi_path_terminate(), efidev_parent(), end, MAC_ADDR_DEVICE_PATH::Header, VLAN_DEVICE_PATH::Header, MAC_ADDR_DEVICE_PATH::IfType, len, EFI_DEVICE_PATH_PROTOCOL::Length, net_device::ll_addr, ll_protocol::ll_addr_len, ll_protocol::ll_proto, net_device::ll_protocol, MAC_ADDR_DEVICE_PATH::MacAddress, memcpy(), MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, MSG_VLAN_DP, netdev, ntohs, NULL, efi_device::path, EFI_DEVICE_PATH_PROTOCOL::SubType, tag, EFI_DEVICE_PATH_PROTOCOL::Type, vlan_tag(), VLAN_DEVICE_PATH::VlanId, and zalloc().
Referenced by efi_aoe_path(), efi_iscsi_path(), and efi_snp_probe().
EFI_DEVICE_PATH_PROTOCOL* efi_uri_path | ( | struct uri * | uri | ) |
Construct EFI device path for URI.
uri | URI |
path | EFI device path, or NULL on error |
The caller is responsible for eventually calling free() on the allocated device path.
Definition at line 396 of file efi_path.c.
References efi_path_terminate(), end, format_uri(), URI_DEVICE_PATH::Header, len, EFI_DEVICE_PATH_PROTOCOL::Length, MESSAGING_DEVICE_PATH, MSG_URI_DP, NULL, efi_device::path, EFI_DEVICE_PATH_PROTOCOL::SubType, EFI_DEVICE_PATH_PROTOCOL::Type, URI_DEVICE_PATH::Uri, and zalloc().
Referenced by http_efi_describe().
EFI_DEVICE_PATH_PROTOCOL* efi_iscsi_path | ( | struct iscsi_session * | iscsi | ) |
Construct EFI device path for iSCSI device.
iscsi | iSCSI session |
path | EFI device path, or NULL on error |
Definition at line 433 of file efi_path.c.
References efi_netdev_path(), efi_path_len(), efi_path_terminate(), end, free, ISCSI_DEVICE_PATH::Header, ISCSI_LOGIN_OPTION_AUTHMETHOD_NON, len, EFI_DEVICE_PATH_PROTOCOL::Length, ISCSI_DEVICE_PATH::LoginOption, iscsi_session::lun, ISCSI_DEVICE_PATH::Lun, memcpy(), MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, name, netdev, NULL, strlen(), EFI_DEVICE_PATH_PROTOCOL::SubType, iscsi_session::target_iqn, iscsi_session::target_sockaddr, tcpip_netdev(), EFI_DEVICE_PATH_PROTOCOL::Type, and zalloc().
EFI_DEVICE_PATH_PROTOCOL* efi_aoe_path | ( | struct aoe_device * | aoedev | ) |
Construct EFI device path for AoE device.
aoedev | AoE device |
path | EFI device path, or NULL on error |
Definition at line 499 of file efi_path.c.
References efi_netdev_path(), efi_path_terminate(), efi_paths(), end, free, aoe_device::major, memset(), MESSAGING_DEVICE_PATH, aoe_device::minor, MSG_SATA_DP, aoe_device::netdev, and NULL.
EFI_DEVICE_PATH_PROTOCOL* efi_fcp_path | ( | struct fcp_description * | desc | ) |
Construct EFI device path for Fibre Channel device.
desc | FCP device description |
path | EFI device path, or NULL on error |
Definition at line 543 of file efi_path.c.
References __attribute__, desc, efi_path_terminate(), end, fc, memcpy(), MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, NULL, and zalloc().
Referenced by fcpdev_efi_describe().
EFI_DEVICE_PATH_PROTOCOL* efi_ib_srp_path | ( | struct ib_srp_device * | ib_srp | ) |
Construct EFI device path for Infiniband SRP device.
ib_srp | Infiniband SRP device |
path | EFI device path, or NULL on error |
Definition at line 571 of file efi_path.c.
References container_of, ib_device::dev, INFINIBAND_DEVICE_PATH::DeviceId, sbft_ib_subtable::dgid, efi_path_len(), efi_path_terminate(), efidev_parent(), end, INFINIBAND_DEVICE_PATH::Header, ipxe_ib_sbft::ib, ib_srp_device::ibdev, id, INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL, len, EFI_DEVICE_PATH_PROTOCOL::Length, memcpy(), MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, NULL, efi_device::path, INFINIBAND_DEVICE_PATH::PortGid, INFINIBAND_DEVICE_PATH::ResourceFlags, ib_srp_device::sbft, sbft_ib_subtable::service_id, INFINIBAND_DEVICE_PATH::ServiceId, ib_srp_target_port_id::srp, ipxe_ib_sbft::srp, EFI_DEVICE_PATH_PROTOCOL::SubType, sbft_srp_subtable::target, INFINIBAND_DEVICE_PATH::TargetPortId, EFI_DEVICE_PATH_PROTOCOL::Type, and zalloc().
EFI_DEVICE_PATH_PROTOCOL* efi_usb_path | ( | struct usb_function * | func | ) |
Construct EFI device path for USB function.
func | USB function |
path | EFI device path, or NULL on error |
The caller is responsible for eventually calling free() on the allocated device path.
Definition at line 626 of file efi_path.c.
References assert(), count, usb_function_descriptor::count, usb_function::desc, usb_function::dev, efi_path_len(), efi_path_terminate(), efidev_parent(), end, USB_DEVICE_PATH::Header, usb_port::hub, usb_function::interface, USB_DEVICE_PATH::InterfaceNumber, len, EFI_DEVICE_PATH_PROTOCOL::Length, memcpy(), MESSAGING_DEVICE_PATH, MSG_USB_DP, NULL, USB_DEVICE_PATH::ParentPortNumber, efi_device::path, usb_device::port, EFI_DEVICE_PATH_PROTOCOL::SubType, EFI_DEVICE_PATH_PROTOCOL::Type, usb_function::usb, usb_hub::usb, usb_depth(), and zalloc().
Referenced by efi_usb_install(), and usbblk_efi_describe().
EFI_DEVICE_PATH_PROTOCOL* efi_describe | ( | struct interface * | intf | ) |
Describe object as an EFI device path.
intf | Interface |
path | EFI device path, or NULL |
The caller is responsible for eventually calling free() on the allocated device path.
Definition at line 680 of file efi_path.c.
References dest, efi_describe(), efi_describe_TYPE, interface::intf, intf_get_dest_op, intf_object(), intf_put(), NULL, and op.
Referenced by efi_block_hook(), and efi_describe().
|
static |
Fetch an EFI device path fixed-size setting.
pathset | Path setting |
path | Device path |
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 706 of file efi_path.c.
References data, len, efi_path_setting::len, memcpy(), and efi_path_setting::offset.
|
static |
Fetch an EFI device path DNS setting.
pathset | Path setting |
path | Device path |
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 727 of file efi_path.c.
References container_of, count, data, DNS_DEVICE_PATH::DnsServerIp, ENOENT, Header, DNS_DEVICE_PATH::IsIPv6, len, efi_path_setting::len, EFI_DEVICE_PATH_PROTOCOL::Length, memcpy(), efi_path_setting::offset, efi_path_setting::setting, and setting::type.
|
static |
Fetch value of EFI device path setting.
settings | Settings block |
setting | Setting to fetch |
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 794 of file efi_path.c.
References container_of, data, efi_path_next(), efi_path_settings, ENOENT, efi_path_setting::fetch, len, next, efi_path_settings::path, efi_path_setting::setting, setting_cmp(), EFI_DEVICE_PATH_PROTOCOL::SubType, efi_path_setting::subtype, setting::type, EFI_DEVICE_PATH_PROTOCOL::Type, and efi_path_setting::type.
|
static |
Create per-netdevice EFI path settings.
netdev | Network device |
priv | Private data |
rc | Return status code |
Definition at line 850 of file efi_path.c.
References DBGC, DHCP_SETTINGS_NAME, efi_devpath_text(), efi_loaded_image_path, efi_path_mac(), efi_path_settings_operations, efi_path_vlan(), find_child_settings(), net_device::ll_addr, ll_protocol::ll_addr_len, net_device::ll_protocol, mac, memcmp(), net_device::name, netdev, netdev_settings(), NULL, efi_path_settings::path, priv, rc, net_device::refcnt, register_settings(), efi_path_settings::settings, settings_init(), strerror(), and vlan_tag().
|
static |
EFI device path settings.
Definition at line 758 of file efi_path.c.
Referenced by efi_path_fetch().
|
static |
EFI device path settings operations.
Definition at line 839 of file efi_path.c.
Referenced by efi_path_net_probe().
struct net_driver efi_path_net_driver __net_driver |
EFI path settings per-netdevice driver.
Definition at line 896 of file efi_path.c.