iPXE
|
iSCSI boot firmware table More...
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/pci.h>
#include <ipxe/acpi.h>
#include <ipxe/in.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include <ipxe/vlan.h>
#include <ipxe/tcpip.h>
#include <ipxe/dhcp.h>
#include <ipxe/iscsi.h>
#include <ipxe/ibft.h>
Go to the source code of this file.
Data Structures | |
struct | ibft_strings |
iSCSI string buffer More... | |
Functions | |
FILE_LICENCE (BSD2) | |
static size_t | ibft_align (size_t len) |
Align structure within iBFT. More... | |
static void | ibft_set_ipaddr (struct ibft_ipaddr *ipaddr, struct in_addr in) |
Fill in an IP address field within iBFT. More... | |
static void | ibft_set_ipaddr_setting (struct settings *settings, struct ibft_ipaddr *ipaddr, const struct setting *setting, unsigned int count) |
Fill in an IP address within iBFT from configuration setting. More... | |
static const char * | ibft_ipaddr (struct ibft_ipaddr *ipaddr) |
Read IP address from iBFT (for debugging) More... | |
static char * | ibft_alloc_string (struct ibft_strings *strings, struct ibft_string *string, size_t len) |
Allocate a string within iBFT. More... | |
static int | ibft_set_string (struct ibft_strings *strings, struct ibft_string *string, const char *data) |
Fill in a string field within iBFT. More... | |
static int | ibft_set_string_setting (struct settings *settings, struct ibft_strings *strings, struct ibft_string *string, const struct setting *setting) |
Fill in a string field within iBFT from configuration setting. More... | |
static const char * | ibft_string (struct ibft_strings *strings, struct ibft_string *string) |
Read string from iBFT (for debugging) More... | |
static int | ibft_netdev_is_required (struct net_device *netdev) |
Check if network device is required for the iBFT. More... | |
static int | ibft_fill_nic (struct ibft_nic *nic, struct ibft_strings *strings, struct net_device *netdev) |
Fill in NIC portion of iBFT. More... | |
static int | ibft_fill_initiator (struct ibft_initiator *initiator, struct ibft_strings *strings, const char *initiator_iqn) |
Fill in Initiator portion of iBFT. More... | |
static int | ibft_fill_target_nic_association (struct ibft_target *target, struct iscsi_session *iscsi) |
Fill in Target NIC association. More... | |
static int | ibft_fill_target_chap (struct ibft_target *target, struct ibft_strings *strings, struct iscsi_session *iscsi) |
Fill in Target CHAP portion of iBFT. More... | |
static int | ibft_fill_target_reverse_chap (struct ibft_target *target, struct ibft_strings *strings, struct iscsi_session *iscsi) |
Fill in Target Reverse CHAP portion of iBFT. More... | |
static int | ibft_fill_target (struct ibft_target *target, struct ibft_strings *strings, struct iscsi_session *iscsi) |
Fill in Target portion of iBFT. More... | |
static int | ibft_complete (struct acpi_descriptor *desc) |
Check if iBFT descriptor is complete. More... | |
static int | ibft_install (int(*install)(struct acpi_header *acpi)) |
Install iBFT. More... | |
Variables | |
struct acpi_model ibft_model | __acpi_model |
iBFT model More... | |
iSCSI boot firmware table
The information in this file is originally derived from the document "iSCSI Boot Firmware Table (iBFT)" as published by IBM at:
ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf
That file is no longer available, but a more recent version is available:
ftp://ftp.software.ibm.com/systems/support/bladecenter/iscsi_boot_firmware_table_v1.03.pdf
Definition in file ibft.c.
FILE_LICENCE | ( | BSD2 | ) |
Align structure within iBFT.
len | Unaligned length (or offset) |
len | Aligned length (or offset) |
Definition at line 83 of file ibft.c.
References IBFT_ALIGN, and len.
Referenced by ibft_install().
|
static |
Fill in an IP address field within iBFT.
ipaddr | IP address field |
in | IPv4 address |
Definition at line 94 of file ibft.c.
References in, ibft_ipaddr::in, memset(), and ibft_ipaddr::ones.
Referenced by ibft_fill_target(), and ibft_set_ipaddr_setting().
|
static |
Fill in an IP address within iBFT from configuration setting.
settings | Parent settings block, or NULL |
ipaddr | IP address field |
setting | Configuration setting |
count | Maximum number of IP addresses |
Definition at line 110 of file ibft.c.
References count, fetch_ipv4_array_setting(), ibft_set_ipaddr(), and in.
Referenced by ibft_fill_nic().
|
static |
Read IP address from iBFT (for debugging)
strings | iBFT string block descriptor |
string | String field |
ipaddr | IP address string |
Definition at line 130 of file ibft.c.
References ibft_ipaddr::in, and inet_ntoa().
|
static |
Allocate a string within iBFT.
strings | iBFT string block descriptor |
string | String field to fill in |
len | Length of string to allocate (excluding NUL) |
dest | String destination, or NULL |
Definition at line 142 of file ibft.c.
References cpu_to_le16, ibft_strings::data, dest, len, ibft_strings::len, memset(), NULL, realloc(), and ibft_strings::start.
Referenced by ibft_set_string(), and ibft_set_string_setting().
|
static |
Fill in a string field within iBFT.
strings | iBFT string block descriptor |
string | String field |
data | String to fill in, or NULL |
rc | Return status code |
Definition at line 177 of file ibft.c.
References data, dest, ENOBUFS, ibft_alloc_string(), strcpy(), and strlen().
Referenced by ibft_fill_initiator(), ibft_fill_target(), ibft_fill_target_chap(), and ibft_fill_target_reverse_chap().
|
static |
Fill in a string field within iBFT from configuration setting.
settings | Parent settings block, or NULL |
strings | iBFT string block descriptor |
string | String field |
setting | Configuration setting |
rc | Return status code |
Definition at line 201 of file ibft.c.
References dest, ENOBUFS, fetch_setting(), fetch_string_setting(), ibft_alloc_string(), len, NULL, and origin.
Referenced by ibft_fill_nic().
|
static |
Read string from iBFT (for debugging)
strings | iBFT string block descriptor |
string | String field |
data | String content (or "<empty>") |
Definition at line 232 of file ibft.c.
References ibft_strings::data, le16_to_cpu, NULL, offset, ibft_strings::start, and string.
|
static |
Check if network device is required for the iBFT.
netdev | Network device |
is_required | Network device is required |
Definition at line 245 of file ibft.c.
References desc, if(), list_for_each_entry, netdev, iscsi_session::target_sockaddr, and tcpip_netdev().
Referenced by ibft_fill_target_nic_association(), and ibft_install().
|
static |
Fill in NIC portion of iBFT.
nic | NIC portion of iBFT |
strings | iBFT string block descriptor |
netdev | Network device |
rc | Return status code |
Definition at line 266 of file ibft.c.
References cpu_to_le16, DBG, device::desc, net_device::dev, ll_protocol::eth_addr, eth_ntoa(), fetch_ipv4_setting(), fetch_setting(), nic::flags, IBFT_FL_NIC_BLOCK_VALID, IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED, IBFT_NIC_ORIGIN_DHCP, IBFT_NIC_ORIGIN_MANUAL, ibft_set_ipaddr_setting(), ibft_set_string_setting(), IBFT_STRUCTURE_ID_NIC, le16_to_cpu, net_device::ll_addr, net_device::ll_protocol, device_description::location, net_device::name, netdev, netdev_settings(), NULL, origin, settings::parent, rc, in_addr::s_addr, strerror(), and vlan_tag().
Referenced by ibft_install().
|
static |
Fill in Initiator portion of iBFT.
initiator | Initiator portion of iBFT |
strings | iBFT string block descriptor |
initiator_iqn | Initiator IQN |
rc | Return status code |
Definition at line 348 of file ibft.c.
References cpu_to_le16, DBG, ibft_header::flags, ibft_initiator::header, IBFT_FL_INITIATOR_BLOCK_VALID, IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED, ibft_set_string(), IBFT_STRUCTURE_ID_INITIATOR, ibft_initiator::initiator_name, ibft_header::length, rc, ibft_header::structure_id, and ibft_header::version.
Referenced by ibft_install().
|
static |
Fill in Target NIC association.
target | Target portion of iBFT |
iscsi | iSCSI session |
rc | Return status code |
Definition at line 377 of file ibft.c.
References DBG, EHOSTUNREACH, EINVAL, for_each_netdev, ibft_target::header, ibft_netdev_is_required(), ibft_header::index, net_device::name, netdev, ibft_target::nic_association, iscsi_session::target_sockaddr, and tcpip_netdev().
Referenced by ibft_fill_target().
|
static |
Fill in Target CHAP portion of iBFT.
target | Target portion of iBFT |
strings | iBFT string block descriptor |
iscsi | iSCSI session |
rc | Return status code |
Definition at line 418 of file ibft.c.
References assert(), ibft_target::chap_name, ibft_target::chap_secret, ibft_target::chap_type, DBG, ibft_target::header, IBFT_CHAP_ONE_WAY, ibft_set_string(), ibft_header::index, iscsi_session::initiator_password, iscsi_session::initiator_username, ISCSI_STATUS_AUTH_FORWARD_REQUIRED, rc, and iscsi_session::status.
Referenced by ibft_fill_target().
|
static |
Fill in Target Reverse CHAP portion of iBFT.
target | Target portion of iBFT |
strings | iBFT string block descriptor |
iscsi | iSCSI session |
rc | Return status code |
Definition at line 451 of file ibft.c.
References assert(), ibft_target::chap_name, ibft_target::chap_type, DBG, ibft_target::header, IBFT_CHAP_MUTUAL, ibft_set_string(), ibft_header::index, iscsi_session::initiator_password, iscsi_session::initiator_username, ISCSI_STATUS_AUTH_REVERSE_REQUIRED, rc, ibft_target::reverse_chap_name, ibft_target::reverse_chap_secret, iscsi_session::status, iscsi_session::target_password, and iscsi_session::target_username.
Referenced by ibft_fill_target().
|
static |
Fill in Target portion of iBFT.
target | Target portion of iBFT |
strings | iBFT string block descriptor |
iscsi | iSCSI session |
rc | Return status code |
Definition at line 487 of file ibft.c.
References ibft_target::boot_lun, cpu_to_le16, DBG, ibft_header::flags, ibft_target::header, ibft_fill_target_chap(), ibft_fill_target_nic_association(), ibft_fill_target_reverse_chap(), IBFT_FL_TARGET_BLOCK_VALID, IBFT_FL_TARGET_FIRMWARE_BOOT_SELECTED, ibft_set_ipaddr(), ibft_set_string(), IBFT_STRUCTURE_ID_TARGET, ibft_header::index, ibft_target::ip_address, ibft_header::length, iscsi_session::lun, memcpy(), ntohs, rc, SCSI_LUN_DATA, SCSI_LUN_FORMAT, ibft_target::socket, sockaddr_tcpip::st_port, ibft_header::structure_id, iscsi_session::target_iqn, ibft_target::target_name, iscsi_session::target_sockaddr, and ibft_header::version.
Referenced by ibft_install().
|
static |
Check if iBFT descriptor is complete.
desc | ACPI descriptor |
rc | Return status code |
Definition at line 535 of file ibft.c.
References container_of, desc, EAGAIN, sockaddr::sa_family, and iscsi_session::target_sockaddr.
|
static |
Install iBFT.
install | Installation method |
rc | Return status code |
Definition at line 552 of file ibft.c.
References acpi, assert(), control, ibft_table::control, cpu_to_le16, cpu_to_le32, data, ibft_strings::data, DBG, desc, ENOMEM, for_each_netdev, free, ibft_control::header, ibft_target::header, ibft_align(), ibft_fill_initiator(), ibft_fill_nic(), ibft_fill_target(), ibft_netdev_is_required(), IBFT_SIG, IBFT_STRUCTURE_ID_CONTROL, ibft_header::index, ibft_control::initiator, iscsi_session::initiator_iqn, len, ibft_strings::len, ibft_header::length, list_first_entry, list_for_each_entry, memcpy(), netdev, nic, ibft_offset_pair::nic, NULL, offset, offsetof, ibft_control::pair, rc, realloc(), ibft_strings::start, strerror(), ibft_header::structure_id, ibft_offset_pair::target, typeof(), ibft_header::version, and zalloc().
struct acpi_model ibft_model __acpi_model |
iBFT model
aBFT model