|
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_strings.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... | |
| int | efi_path_check (EFI_DEVICE_PATH_PROTOCOL *path, size_t max) |
| Check that device path is well-formed. 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... | |
| static EFI_DEVICE_PATH_PROTOCOL * | efi_parent_path (struct device *dev) |
| Construct EFI parent device path. 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_load_path (EFI_LOAD_OPTION *load, size_t len) |
| Get EFI device path from load option. More... | |
| EFI_DEVICE_PATH_PROTOCOL * | efi_boot_path (unsigned int number) |
| Get EFI device path for numbered boot option. More... | |
| EFI_DEVICE_PATH_PROTOCOL * | efi_current_boot_path (void) |
| Get EFI device path for current boot option. 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 | |
| struct { | |
| BBS_BBS_DEVICE_PATH bbs | |
| CHAR8 tring [4] | |
| EFI_DEVICE_PATH_PROTOCOL end | |
| } | efi_dummy_parent_path |
| Dummy parent device path. More... | |
| 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 118 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_check(), 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 144 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 162 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 173 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().
| int efi_path_check | ( | EFI_DEVICE_PATH_PROTOCOL * | path, |
| size_t | max | ||
| ) |
Check that device path is well-formed.
| path | Device path, or NULL |
| max | Maximum device path length |
| rc | Return status code |
Definition at line 186 of file efi_path.c.
References efi_path_next(), EINVAL, len, max, and next.
Referenced by efi_load_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 212 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 236 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 260 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 300 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 343 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().
|
static |
Construct EFI parent device path.
| dev | Generic device |
| path | Parent (or dummy) device path |
Definition at line 389 of file efi_path.c.
References efi_device::dev, efi_dummy_parent_path, efidev_parent(), and efi_device::path.
Referenced by efi_ib_srp_path(), efi_netdev_path(), and efi_usb_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 410 of file efi_path.c.
References assert(), net_device::dev, efi_parent_path(), efi_path_len(), efi_path_terminate(), 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 468 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 505 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 571 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 615 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 643 of file efi_path.c.
References container_of, ib_device::dev, INFINIBAND_DEVICE_PATH::DeviceId, sbft_ib_subtable::dgid, efi_parent_path(), efi_path_len(), efi_path_terminate(), 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, 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 696 of file efi_path.c.
References assert(), count, usb_function_descriptor::count, usb_function::desc, usb_function::dev, efi_parent_path(), efi_path_len(), efi_path_terminate(), 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, 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_load_path | ( | EFI_LOAD_OPTION * | load, |
| size_t | len | ||
| ) |
Get EFI device path from load option.
| load | EFI load option |
| len | Length of EFI load option |
| path | EFI device path, or NULL on error |
The caller is responsible for eventually calling free() on the allocated device path.
Definition at line 749 of file efi_path.c.
References DBGC, DBGC_HDA, efi_path_check(), _EFI_LOAD_OPTION::FilePathListLength, len, malloc(), memcpy(), NULL, and wcsnlen().
Referenced by efi_boot_path().
| EFI_DEVICE_PATH_PROTOCOL* efi_boot_path | ( | unsigned int | number | ) |
Get EFI device path for numbered boot option.
| number | Boot option number |
| path | EFI device path, or NULL on error |
The caller is responsible for eventually calling free() on the allocated device path.
Definition at line 813 of file efi_path.c.
References DBGC, DBGC2, DBGC2_HDA, EEFI, EFI_BUFFER_TOO_SMALL, efi_global_variable, efi_load_path(), efi_snprintf(), efi_systab, EINVAL, ENOMEM, free, EFI_RUNTIME_SERVICES::GetVariable, guid, malloc(), NULL, rc, EFI_SYSTEM_TABLE::RuntimeServices, size, and strerror().
Referenced by efi_current_boot_path().
| EFI_DEVICE_PATH_PROTOCOL* efi_current_boot_path | ( | void | ) |
Get EFI device path for current boot option.
| path | EFI device path, or NULL on error |
The caller is responsible for eventually calling free() on the allocated device path.
Definition at line 886 of file efi_path.c.
References DBGC, EEFI, efi_boot_path(), efi_global_variable, efi_systab, EFI_RUNTIME_SERVICES::GetVariable, guid, NULL, rc, EFI_SYSTEM_TABLE::RuntimeServices, size, and strerror().
Referenced by efi_init_application().
| 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 919 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 945 of file efi_path.c.
References data, efi_path_setting::len, 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 966 of file efi_path.c.
References container_of, count, data, DNS_DEVICE_PATH::DnsServerIp, ENOENT, Header, DNS_DEVICE_PATH::IsIPv6, efi_path_setting::len, 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 1033 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 1089 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().
Definition at line 56 of file efi_path.c.
| CHAR8 tring[4] |
Definition at line 57 of file efi_path.c.
Definition at line 58 of file efi_path.c.
Referenced by efi_aoe_path(), efi_fcp_path(), efi_ib_srp_path(), efi_iscsi_path(), efi_netdev_path(), efi_path_len(), efi_paths(), efi_uri_path(), and efi_usb_path().
| struct { ... } efi_dummy_parent_path |
Dummy parent device path.
This is used as the parent device path when we need to construct a path for a device that has no EFI parent device.
Referenced by efi_parent_path().
|
static |
EFI device path settings.
Definition at line 997 of file efi_path.c.
Referenced by efi_path_fetch().
|
static |
EFI device path settings operations.
Definition at line 1078 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 1135 of file efi_path.c.
1.8.15