95 memset ( ipaddr, 0,
sizeof ( *ipaddr ) );
98 ipaddr->
ones = 0xffff;
113 unsigned int count ) {
118 for ( i = 0 ; i <
count ; i++ ) {
149 new_len = ( strings->
len +
len + 1 );
153 strings->
data = new_data;
164 strings->
len = new_len;
270 struct in_addr netmask_addr = { 0 };
271 unsigned int netmask_count = 0;
278 nic->header.version = 1;
288 DBG (
"iBFT NIC %d origin = %d\n",
nic->header.index,
nic->origin );
292 DBG (
"iBFT NIC %d IP = %s\n",
295 DBG (
"iBFT NIC %d gateway = %s\n",
298 ( sizeof (
nic->dns ) /
299 sizeof (
nic->dns[0] ) ) );
301 DBG (
"iBFT NIC %d DNS = %s",
305 &hostname_setting ) ) != 0 )
307 DBG (
"iBFT NIC %d hostname = %s\n",
312 while ( netmask_addr.
s_addr ) {
313 if ( netmask_addr.
s_addr & 0x1 )
315 netmask_addr.
s_addr >>= 1;
317 nic->subnet_mask_prefix = netmask_count;
318 DBG (
"iBFT NIC %d subnet = /%d\n",
319 nic->header.index,
nic->subnet_mask_prefix );
323 DBG (
"iBFT NIC %d VLAN = %02x\n",
326 nic->mac_address ) ) != 0 ) {
327 DBG (
"Could not determine %s MAC: %s\n",
331 DBG (
"iBFT NIC %d MAC = %s\n",
334 DBG (
"iBFT NIC %d PCI = %04x\n",
350 const char *initiator_iqn ) {
362 initiator_iqn ) ) != 0 )
364 DBG (
"iBFT initiator name = %s\n",
386 if ( ! associated ) {
387 DBG (
"iBFT target %d has no net device\n",
394 if (
netdev == associated ) {
395 DBG (
"iBFT target %d uses NIC %d (%s)\n",
405 DBG (
"iBFT target %d has impossible NIC %s\n",
438 DBG (
"iBFT target %d password = <redacted>\n", target->
header.
index );
468 DBG (
"iBFT target %d reverse username = %s\n", target->
header.
index,
473 DBG (
"iBFT target %d reverse password = <redacted>\n",
505 DBG (
"iBFT target %d IP = %s\n",
508 DBG (
"iBFT target %d port = %d\n",
562 unsigned int targets = 0;
563 unsigned int pairs = 0;
567 size_t initiator_offset;
569 size_t target_offset;
570 size_t strings_offset;
580 if ( pairs < targets )
587 initiator_offset =
offset;
595 strings.
start = strings_offset;
619 initiator = (
data + initiator_offset );
635 nic->header.index = i;
647 target = (
data + target_offset );
652 target_offset +=
ibft_align (
sizeof ( *target ) );
672 if ( (
rc = install (
acpi ) ) != 0 ) {
#define ISCSI_STATUS_AUTH_REVERSE_REQUIRED
Initiator requires target (reverse) authentication.
struct ibft_string initiator_name
Initiator name.
#define EINVAL
Invalid argument.
static int ibft_complete(struct acpi_descriptor *desc)
Check if iBFT descriptor is complete.
struct arbelprm_rc_send_wqe rc
#define IBFT_FL_TARGET_FIRMWARE_BOOT_SELECTED
Target firmware boot selected.
Dynamic Host Configuration Protocol.
ibft_off_t nic
Offset to NIC structure.
struct net_device * tcpip_netdev(struct sockaddr_tcpip *st_dest)
Determine transmitting network device.
char * initiator_username
Initiator username (if any)
struct sockaddr target_sockaddr
Target socket address (for boot firmware table)
struct ibft_string reverse_chap_secret
Reverse CHAP secret.
ibft_off_t initiator
Offset to Initiator structure.
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.
struct list_head descs
List of descriptors.
struct settings * parent
Parent settings block.
int fetch_ipv4_setting(struct settings *settings, const struct setting *setting, struct in_addr *inp)
Fetch value of IPv4 address setting.
static const char * ibft_ipaddr(struct ibft_ipaddr *ipaddr)
Read IP address from iBFT (for debugging)
struct scsi_lun boot_lun
Boot LUN.
#define IBFT_CHAP_MUTUAL
Mutual CHAP.
uint64_t desc
Microcode descriptor list physical address.
sa_family_t sa_family
Socket address family.
uint8_t chap_type
CHAP type.
struct ibft_string chap_name
CHAP name.
#define IBFT_ALIGN
Alignment of structures within iBFT.
static int ibft_install(int(*install)(struct acpi_header *acpi))
Install iBFT.
struct ibft_control control
Control structure.
struct ibft_string chap_secret
CHAP secret.
#define offsetof(type, field)
Get offset of a field within a structure.
#define IBFT_STRUCTURE_ID_CONTROL
Structure ID for Control section.
static int ibft_netdev_is_required(struct net_device *netdev)
Check if network device is required for the iBFT.
struct ibft_string target_name
Target name.
#define IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED
Initiator firmware boot selected.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
char * initiator_password
Initiator password (if any)
An IP address within the iBFT.
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
iSCSI Boot Firmware Table (iBFT)
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define IBFT_CHAP_ONE_WAY
One-way CHAP.
struct ibft_header header
Common header.
static int ibft_fill_nic(struct ibft_nic *nic, struct ibft_strings *strings, struct net_device *netdev)
Fill in NIC portion of iBFT.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
static int ibft_fill_target_nic_association(struct ibft_target *target, struct iscsi_session *iscsi)
Fill in Target NIC association.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
static EFI_ACPI_TABLE_PROTOCOL * acpi
ACPI table protocol protocol.
struct ibft_ipaddr ip_address
IP address.
int status
Session status.
#define IBFT_FL_NIC_BLOCK_VALID
NIC block valid.
static struct net_device * netdev
Transport-network layer interface.
uint16_t count
Number of entries.
#define IBFT_FL_INITIATOR_BLOCK_VALID
Initiator block valid.
int fetch_string_setting(struct settings *settings, const struct setting *setting, char *data, size_t len)
Fetch value of string setting.
char * strcpy(char *dest, const char *src)
Copy string.
unsigned int location
Location.
#define cpu_to_le32(value)
uint16_t st_port
TCP/IP port.
#define IBFT_NIC_ORIGIN_DHCP
int fetch_setting(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, void *data, size_t len)
Fetch setting.
#define IBFT_FL_TARGET_BLOCK_VALID
Target block valid.
char * strerror(int errno)
Retrieve string representation of error number.
static size_t ibft_align(size_t len)
Align structure within iBFT.
static void(* free)(struct refcnt *refcnt))
struct scsi_lun lun
SCSI LUN (for boot firmware table)
void * zalloc(size_t size)
Allocate cleared memory.
#define for_each_netdev(netdev)
Iterate over all network devices.
static int ibft_fill_initiator(struct ibft_initiator *initiator, struct ibft_strings *strings, const char *initiator_iqn)
Fill in Initiator portion of iBFT.
static int ibft_set_string(struct ibft_strings *strings, struct ibft_string *string, const char *data)
Fill in a string field within iBFT.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
size_t strlen(const char *src)
Get length of string.
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
uint8_t nic_association
NIC association.
#define SCSI_LUN_FORMAT
printf() format for dumping a scsi_lun
#define le16_to_cpu(value)
#define EAGAIN
Resource temporarily unavailable.
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.
static const char * ibft_string(struct ibft_strings *strings, struct ibft_string *string)
Read string from iBFT (for debugging)
struct device * dev
Underlying hardware device.
Network device management.
#define IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED
NIC firmware boot selected.
#define SCSI_LUN_DATA(lun)
printf() parameters for dumping a scsi_lun
An ACPI descriptor (used to construct ACPI tables)
char * target_iqn
Target IQN.
struct ibft_header header
Common header.
iSCSI boot firmware table
char name[NETDEV_NAME_LEN]
Name of this network device.
int fetch_ipv4_array_setting(struct settings *settings, const struct setting *setting, struct in_addr *inp, unsigned int count)
Fetch value of IPv4 address setting.
#define ENOBUFS
No buffer space available.
struct ibft_header header
Common header.
#define IBFT_NIC_ORIGIN_MANUAL
struct in_addr in
The IPv4 address, or zero if not present.
struct ibft_offset_pair pair[2]
Offsets to NIC and Target structures.
#define cpu_to_le16(value)
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
uint8_t data[48]
Additional event data.
struct device_description desc
Device description.
size_t start
Starting offset of strings.
void * realloc(void *old_ptr, size_t new_size)
Reallocate memory.
ibft_off_t target
Offset to Target structure.
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.
uint16_t offset
Offset to command line.
char * initiator_iqn
Initiator IQN.
A string within the iBFT.
typeof(acpi_finder=acpi_find)
ACPI table finder.
struct ibft_string reverse_chap_name
Reverse CHAP name.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
char * target_password
Target password (if any)
static unsigned int vlan_tag(struct net_device *netdev)
Get the VLAN tag.
#define DBG(...)
Print a debugging message.
#define LIST_HEAD_INIT(list)
Initialise a static list head.
static int ibft_fill_target(struct ibft_target *target, struct ibft_strings *strings, struct iscsi_session *iscsi)
Fill in Target portion of iBFT.
char * target_username
Target username (if any)
#define EHOSTUNREACH
Host is unreachable.
struct acpi_model ibft_model __acpi_model
iBFT model
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.
#define ISCSI_STATUS_AUTH_FORWARD_REQUIRED
Target has requested forward (initiator) authentication.
#define NULL
NULL pointer (VOID *)
uint16_t ones
Must be 0xffff if IPv4 address is present, otherwise zero.
#define IBFT_STRUCTURE_ID_NIC
Structure ID for NIC section.
struct ll_protocol * ll_protocol
Link-layer protocol.
static void ibft_set_ipaddr(struct ibft_ipaddr *ipaddr, struct in_addr in)
Fill in an IP address field within iBFT.
#define IBFT_STRUCTURE_ID_INITIATOR
Structure ID for Initiator section.
#define IBFT_STRUCTURE_ID_TARGET
Structure ID for Target section.
if(natsemi->flags &NATSEMI_64BIT) return 1
int(* eth_addr)(const void *ll_addr, void *eth_addr)
Generate Ethernet-compatible compressed link-layer address.
void * memset(void *dest, int character, size_t len) __nonnull
static char * ibft_alloc_string(struct ibft_strings *strings, struct ibft_string *string, size_t len)
Allocate a string within iBFT.
#define IBFT_SIG
iSCSI Boot Firmware Table signature