iPXE
Data Structures | Functions | Variables
ibft.c File Reference

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...
 

Detailed Description

iSCSI boot firmware table

The information in this file is 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

Definition in file ibft.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( BSD2  )

◆ ibft_align()

static size_t ibft_align ( size_t  len)
inlinestatic

Align structure within iBFT.

Parameters
lenUnaligned length (or offset)
Return values
lenAligned length (or offset)

Definition at line 79 of file ibft.c.

79  {
80 
81  return ( ( len + IBFT_ALIGN - 1 ) & ~( IBFT_ALIGN - 1 ) );
82 }
#define IBFT_ALIGN
Alignment of structures within iBFT.
Definition: ibft.h:53
uint32_t len
Length.
Definition: ena.h:14

References IBFT_ALIGN, and len.

Referenced by ibft_install().

◆ ibft_set_ipaddr()

static void ibft_set_ipaddr ( struct ibft_ipaddr ipaddr,
struct in_addr  in 
)
static

Fill in an IP address field within iBFT.

Parameters
ipaddrIP address field
inIPv4 address

Definition at line 90 of file ibft.c.

90  {
91  memset ( ipaddr, 0, sizeof ( *ipaddr ) );
92  if ( in.s_addr ) {
93  ipaddr->in = in;
94  ipaddr->ones = 0xffff;
95  }
96 }
__be32 in[4]
Definition: CIB_PRM.h:35
struct in_addr in
The IPv4 address, or zero if not present.
Definition: ibft.h:76
uint16_t ones
Must be 0xffff if IPv4 address is present, otherwise zero.
Definition: ibft.h:74
void * memset(void *dest, int character, size_t len) __nonnull

References in, ibft_ipaddr::in, memset(), and ibft_ipaddr::ones.

Referenced by ibft_fill_target(), and ibft_set_ipaddr_setting().

◆ ibft_set_ipaddr_setting()

static void ibft_set_ipaddr_setting ( struct settings settings,
struct ibft_ipaddr ipaddr,
const struct setting setting,
unsigned int  count 
)
static

Fill in an IP address within iBFT from configuration setting.

Parameters
settingsParent settings block, or NULL
ipaddrIP address field
settingConfiguration setting
countMaximum number of IP addresses

Definition at line 106 of file ibft.c.

109  {
110  struct in_addr in[count];
111  unsigned int i;
112 
114  for ( i = 0 ; i < count ; i++ ) {
115  ibft_set_ipaddr ( &ipaddr[i], in[i] );
116  }
117 }
__be32 in[4]
Definition: CIB_PRM.h:35
IP address structure.
Definition: in.h:39
A settings block.
Definition: settings.h:132
A setting.
Definition: settings.h:23
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.
Definition: settings.c:894
uint16_t count
Number of entries.
Definition: ena.h:22
static void ibft_set_ipaddr(struct ibft_ipaddr *ipaddr, struct in_addr in)
Fill in an IP address field within iBFT.
Definition: ibft.c:90

References count, fetch_ipv4_array_setting(), ibft_set_ipaddr(), and in.

Referenced by ibft_fill_nic().

◆ ibft_ipaddr()

static const char* ibft_ipaddr ( struct ibft_ipaddr ipaddr)
static

Read IP address from iBFT (for debugging)

Parameters
stringsiBFT string block descriptor
stringString field
Return values
ipaddrIP address string

Definition at line 126 of file ibft.c.

126  {
127  return inet_ntoa ( ipaddr->in );
128 }
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
Definition: ipv4.c:658
struct in_addr in
The IPv4 address, or zero if not present.
Definition: ibft.h:76

References ibft_ipaddr::in, and inet_ntoa().

◆ ibft_alloc_string()

static char* ibft_alloc_string ( struct ibft_strings strings,
struct ibft_string string,
size_t  len 
)
static

Allocate a string within iBFT.

Parameters
stringsiBFT string block descriptor
stringString field to fill in
lenLength of string to allocate (excluding NUL)
Return values
destString destination, or NULL

Definition at line 138 of file ibft.c.

139  {
140  size_t new_len;
141  char *new_data;
142  char *dest;
143 
144  /* Extend string data buffer */
145  new_len = ( strings->len + len + 1 /* NUL */ );
146  new_data = realloc ( strings->data, new_len );
147  if ( ! new_data )
148  return NULL;
149  strings->data = new_data;
150 
151  /* Fill in string field */
152  string->offset = cpu_to_le16 ( strings->start + strings->len );
153  string->len = cpu_to_le16 ( len );
154 
155  /* Zero string */
156  dest = ( strings->data + strings->len );
157  memset ( dest, 0, ( len + 1 /* NUL */ ) );
158 
159  /* Update allocated length */
160  strings->len = new_len;
161 
162  return dest;
163 }
size_t len
Total length.
Definition: ibft.c:70
static void * dest
Definition: strings.h:176
uint32_t len
Length.
Definition: ena.h:14
#define cpu_to_le16(value)
Definition: byteswap.h:106
size_t start
Starting offset of strings.
Definition: ibft.c:68
void * realloc(void *old_ptr, size_t new_size)
Reallocate memory.
Definition: malloc.c:521
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
char * data
Strings data.
Definition: ibft.c:66
void * memset(void *dest, int character, size_t len) __nonnull

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().

◆ ibft_set_string()

static int ibft_set_string ( struct ibft_strings strings,
struct ibft_string string,
const char *  data 
)
static

Fill in a string field within iBFT.

Parameters
stringsiBFT string block descriptor
stringString field
dataString to fill in, or NULL
Return values
rcReturn status code

Definition at line 173 of file ibft.c.

174  {
175  char *dest;
176 
177  if ( ! data )
178  return 0;
179 
180  dest = ibft_alloc_string ( strings, string, strlen ( data ) );
181  if ( ! dest )
182  return -ENOBUFS;
183  strcpy ( dest, data );
184 
185  return 0;
186 }
char * strcpy(char *dest, const char *src)
Copy string.
Definition: string.c:296
static void * dest
Definition: strings.h:176
size_t strlen(const char *src)
Get length of string.
Definition: string.c:213
#define ENOBUFS
No buffer space available.
Definition: errno.h:498
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
static char * ibft_alloc_string(struct ibft_strings *strings, struct ibft_string *string, size_t len)
Allocate a string within iBFT.
Definition: ibft.c:138

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().

◆ ibft_set_string_setting()

static int ibft_set_string_setting ( struct settings settings,
struct ibft_strings strings,
struct ibft_string string,
const struct setting setting 
)
static

Fill in a string field within iBFT from configuration setting.

Parameters
settingsParent settings block, or NULL
stringsiBFT string block descriptor
stringString field
settingConfiguration setting
Return values
rcReturn status code

Definition at line 197 of file ibft.c.

200  {
201  struct settings *origin;
202  struct setting fetched;
203  int len;
204  char *dest;
205 
206  len = fetch_setting ( settings, setting, &origin, &fetched, NULL, 0 );
207  if ( len < 0 ) {
208  string->offset = 0;
209  string->len = 0;
210  return 0;
211  }
212 
213  dest = ibft_alloc_string ( strings, string, len );
214  if ( ! dest )
215  return -ENOBUFS;
216  fetch_string_setting ( origin, &fetched, dest, ( len + 1 ));
217 
218  return 0;
219 }
uint64_t origin
Origin.
Definition: hyperv.h:20
int fetch_string_setting(struct settings *settings, const struct setting *setting, char *data, size_t len)
Fetch value of string setting.
Definition: settings.c:845
static void * dest
Definition: strings.h:176
int fetch_setting(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, void *data, size_t len)
Fetch setting.
Definition: settings.c:670
A settings block.
Definition: settings.h:132
A setting.
Definition: settings.h:23
uint32_t len
Length.
Definition: ena.h:14
#define ENOBUFS
No buffer space available.
Definition: errno.h:498
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static char * ibft_alloc_string(struct ibft_strings *strings, struct ibft_string *string, size_t len)
Allocate a string within iBFT.
Definition: ibft.c:138

References dest, ENOBUFS, fetch_setting(), fetch_string_setting(), ibft_alloc_string(), len, NULL, and origin.

Referenced by ibft_fill_nic().

◆ ibft_string()

static const char* ibft_string ( struct ibft_strings strings,
struct ibft_string string 
)
static

Read string from iBFT (for debugging)

Parameters
stringsiBFT string block descriptor
stringString field
Return values
dataString content (or "<empty>")

Definition at line 228 of file ibft.c.

229  {
230  size_t offset = le16_to_cpu ( string->offset );
231 
232  return ( offset ? ( strings->data + offset - strings->start ) : NULL );
233 }
uint32_t string
Definition: multiboot.h:14
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
#define le16_to_cpu(value)
Definition: byteswap.h:112
size_t start
Starting offset of strings.
Definition: ibft.c:68
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
char * data
Strings data.
Definition: ibft.c:66

References ibft_strings::data, le16_to_cpu, NULL, offset, ibft_strings::start, and string.

◆ ibft_netdev_is_required()

static int ibft_netdev_is_required ( struct net_device netdev)
static

Check if network device is required for the iBFT.

Parameters
netdevNetwork device
Return values
is_requiredNetwork device is required

Definition at line 241 of file ibft.c.

241  {
242  struct iscsi_session *iscsi;
243  struct sockaddr_tcpip *st_target;
244 
245  list_for_each_entry ( iscsi, &ibft_model.descs, desc.list ) {
246  st_target = ( struct sockaddr_tcpip * ) &iscsi->target_sockaddr;
247  if ( tcpip_netdev ( st_target ) == netdev )
248  return 1;
249  }
250 
251  return 0;
252 }
TCP/IP socket address.
Definition: tcpip.h:75
struct net_device * tcpip_netdev(struct sockaddr_tcpip *st_dest)
Determine transmitting network device.
Definition: tcpip.c:114
An iSCSI session.
Definition: iscsi.h:535
struct sockaddr target_sockaddr
Target socket address (for boot firmware table)
Definition: iscsi.h:649
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:420
static struct net_device * netdev
Definition: gdbudp.c:52
if(natsemi->flags &NATSEMI_64BIT) return 1

References if(), list_for_each_entry, netdev, iscsi_session::target_sockaddr, and tcpip_netdev().

Referenced by ibft_fill_target_nic_association(), and ibft_install().

◆ ibft_fill_nic()

static int ibft_fill_nic ( struct ibft_nic nic,
struct ibft_strings strings,
struct net_device netdev 
)
static

Fill in NIC portion of iBFT.

Parameters
nicNIC portion of iBFT
stringsiBFT string block descriptor
netdevNetwork device
Return values
rcReturn status code

Definition at line 262 of file ibft.c.

264  {
266  struct in_addr netmask_addr = { 0 };
267  unsigned int netmask_count = 0;
268  struct settings *parent = netdev_settings ( netdev );
269  struct settings *origin;
270  int rc;
271 
272  /* Fill in common header */
273  nic->header.structure_id = IBFT_STRUCTURE_ID_NIC;
274  nic->header.version = 1;
275  nic->header.length = cpu_to_le16 ( sizeof ( *nic ) );
276  nic->header.flags = ( IBFT_FL_NIC_BLOCK_VALID |
278  DBG ( "iBFT NIC %d is %s\n", nic->header.index, netdev->name );
279 
280  /* Determine origin of IP address */
281  fetch_setting ( parent, &ip_setting, &origin, NULL, NULL, 0 );
282  nic->origin = ( ( origin == parent ) ?
284  DBG ( "iBFT NIC %d origin = %d\n", nic->header.index, nic->origin );
285 
286  /* Extract values from configuration settings */
287  ibft_set_ipaddr_setting ( parent, &nic->ip_address, &ip_setting, 1 );
288  DBG ( "iBFT NIC %d IP = %s\n",
289  nic->header.index, ibft_ipaddr ( &nic->ip_address ) );
290  ibft_set_ipaddr_setting ( parent, &nic->gateway, &gateway_setting, 1 );
291  DBG ( "iBFT NIC %d gateway = %s\n",
292  nic->header.index, ibft_ipaddr ( &nic->gateway ) );
293  ibft_set_ipaddr_setting ( NULL, &nic->dns[0], &dns_setting,
294  ( sizeof ( nic->dns ) /
295  sizeof ( nic->dns[0] ) ) );
296  ibft_set_ipaddr_setting ( parent, &nic->dhcp, &dhcp_server_setting, 1 );
297  DBG ( "iBFT NIC %d DNS = %s",
298  nic->header.index, ibft_ipaddr ( &nic->dns[0] ) );
299  DBG ( ", %s\n", ibft_ipaddr ( &nic->dns[1] ) );
300  if ( ( rc = ibft_set_string_setting ( NULL, strings, &nic->hostname,
301  &hostname_setting ) ) != 0 )
302  return rc;
303  DBG ( "iBFT NIC %d hostname = %s\n",
304  nic->header.index, ibft_string ( strings, &nic->hostname ) );
305 
306  /* Derive subnet mask prefix from subnet mask */
307  fetch_ipv4_setting ( parent, &netmask_setting, &netmask_addr );
308  while ( netmask_addr.s_addr ) {
309  if ( netmask_addr.s_addr & 0x1 )
310  netmask_count++;
311  netmask_addr.s_addr >>= 1;
312  }
313  nic->subnet_mask_prefix = netmask_count;
314  DBG ( "iBFT NIC %d subnet = /%d\n",
315  nic->header.index, nic->subnet_mask_prefix );
316 
317  /* Extract values from net-device configuration */
318  nic->vlan = cpu_to_le16 ( vlan_tag ( netdev ) );
319  DBG ( "iBFT NIC %d VLAN = %02x\n",
320  nic->header.index, le16_to_cpu ( nic->vlan ) );
321  if ( ( rc = ll_protocol->eth_addr ( netdev->ll_addr,
322  nic->mac_address ) ) != 0 ) {
323  DBG ( "Could not determine %s MAC: %s\n",
324  netdev->name, strerror ( rc ) );
325  return rc;
326  }
327  DBG ( "iBFT NIC %d MAC = %s\n",
328  nic->header.index, eth_ntoa ( nic->mac_address ) );
329  nic->pci_bus_dev_func = cpu_to_le16 ( netdev->dev->desc.location );
330  DBG ( "iBFT NIC %d PCI = %04x\n",
331  nic->header.index, le16_to_cpu ( nic->pci_bus_dev_func ) );
332 
333  return 0;
334 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
uint64_t origin
Origin.
Definition: hyperv.h:20
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.
Definition: ibft.c:106
int flags
Definition: nic.h:51
struct settings * parent
Parent settings block.
Definition: settings.h:138
int fetch_ipv4_setting(struct settings *settings, const struct setting *setting, struct in_addr *inp)
Fetch value of IPv4 address setting.
Definition: settings.c:916
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
Definition: netdevice.h:577
A link-layer protocol.
Definition: netdevice.h:114
An IP address within the iBFT.
Definition: ibft.h:70
#define IBFT_FL_NIC_BLOCK_VALID
NIC block valid.
Definition: ibft.h:203
static struct net_device * netdev
Definition: gdbudp.c:52
unsigned int location
Location.
Definition: device.h:29
#define IBFT_NIC_ORIGIN_DHCP
Definition: ibft.h:215
int fetch_setting(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, void *data, size_t len)
Fetch setting.
Definition: settings.c:670
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
IP address structure.
Definition: in.h:39
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
A settings block.
Definition: settings.h:132
#define le16_to_cpu(value)
Definition: byteswap.h:112
Definition: nic.h:49
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.
Definition: ibft.c:197
struct device * dev
Underlying hardware device.
Definition: netdevice.h:360
uint32_t s_addr
Definition: in.h:40
#define IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED
NIC firmware boot selected.
Definition: ibft.h:206
__weak unsigned int vlan_tag(struct net_device *netdev __unused)
Get the VLAN tag (when VLAN support is not present)
Definition: netdevice.c:1124
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
#define IBFT_NIC_ORIGIN_MANUAL
Definition: ibft.h:213
#define cpu_to_le16(value)
Definition: byteswap.h:106
struct device_description desc
Device description.
Definition: device.h:79
A string within the iBFT.
Definition: ibft.h:62
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:381
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
#define IBFT_STRUCTURE_ID_NIC
Structure ID for NIC section.
Definition: ibft.h:200
struct ll_protocol * ll_protocol
Link-layer protocol.
Definition: netdevice.h:366
int(* eth_addr)(const void *ll_addr, void *eth_addr)
Generate Ethernet-compatible compressed link-layer address.
Definition: netdevice.h:181

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().

◆ ibft_fill_initiator()

static int ibft_fill_initiator ( struct ibft_initiator initiator,
struct ibft_strings strings,
const char *  initiator_iqn 
)
static

Fill in Initiator portion of iBFT.

Parameters
initiatorInitiator portion of iBFT
stringsiBFT string block descriptor
initiator_iqnInitiator IQN
Return values
rcReturn status code

Definition at line 344 of file ibft.c.

346  {
347  int rc;
348 
349  /* Fill in common header */
351  initiator->header.version = 1;
352  initiator->header.length = cpu_to_le16 ( sizeof ( *initiator ) );
355 
356  /* Fill in initiator name */
357  if ( ( rc = ibft_set_string ( strings, &initiator->initiator_name,
358  initiator_iqn ) ) != 0 )
359  return rc;
360  DBG ( "iBFT initiator name = %s\n",
361  ibft_string ( strings, &initiator->initiator_name ) );
362 
363  return 0;
364 }
struct ibft_string initiator_name
Initiator name.
Definition: ibft.h:155
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
uint8_t version
Version (always 1)
Definition: ibft.h:91
#define IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED
Initiator firmware boot selected.
Definition: ibft.h:165
uint16_t length
Length, including this header.
Definition: ibft.h:93
uint8_t flags
Flags.
Definition: ibft.h:100
struct ibft_header header
Common header.
Definition: ibft.h:147
#define IBFT_FL_INITIATOR_BLOCK_VALID
Initiator block valid.
Definition: ibft.h:162
static int ibft_set_string(struct ibft_strings *strings, struct ibft_string *string, const char *data)
Fill in a string field within iBFT.
Definition: ibft.c:173
#define cpu_to_le16(value)
Definition: byteswap.h:106
A string within the iBFT.
Definition: ibft.h:62
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
uint8_t structure_id
Structure ID.
Definition: ibft.h:89
#define IBFT_STRUCTURE_ID_INITIATOR
Structure ID for Initiator section.
Definition: ibft.h:159

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().

◆ ibft_fill_target_nic_association()

static int ibft_fill_target_nic_association ( struct ibft_target target,
struct iscsi_session iscsi 
)
static

Fill in Target NIC association.

Parameters
targetTarget portion of iBFT
iscsiiSCSI session
Return values
rcReturn status code

Definition at line 373 of file ibft.c.

374  {
375  struct sockaddr_tcpip *st_target =
376  ( struct sockaddr_tcpip * ) &iscsi->target_sockaddr;
377  struct net_device *associated;
378  struct net_device *netdev;
379 
380  /* Find network device used to reach target */
381  associated = tcpip_netdev ( st_target );
382  if ( ! associated ) {
383  DBG ( "iBFT target %d has no net device\n",
384  target->header.index );
385  return -EHOSTUNREACH;
386  }
387 
388  /* Calculate association */
389  for_each_netdev ( netdev ) {
390  if ( netdev == associated ) {
391  DBG ( "iBFT target %d uses NIC %d (%s)\n",
392  target->header.index, target->nic_association,
393  netdev->name );
394  return 0;
395  }
396  if ( ! ibft_netdev_is_required ( netdev ) )
397  continue;
398  target->nic_association++;
399  }
400 
401  DBG ( "iBFT target %d has impossible NIC %s\n",
402  target->header.index, netdev->name );
403  return -EINVAL;
404 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
TCP/IP socket address.
Definition: tcpip.h:75
struct net_device * tcpip_netdev(struct sockaddr_tcpip *st_dest)
Determine transmitting network device.
Definition: tcpip.c:114
struct sockaddr target_sockaddr
Target socket address (for boot firmware table)
Definition: iscsi.h:649
static int ibft_netdev_is_required(struct net_device *netdev)
Check if network device is required for the iBFT.
Definition: ibft.c:241
static struct net_device * netdev
Definition: gdbudp.c:52
#define for_each_netdev(netdev)
Iterate over all network devices.
Definition: netdevice.h:526
A network device.
Definition: netdevice.h:348
uint8_t index
Index.
Definition: ibft.h:98
uint8_t nic_association
NIC association.
Definition: ibft.h:238
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:358
struct ibft_header header
Common header.
Definition: ibft.h:225
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define EHOSTUNREACH
Host is unreachable.
Definition: errno.h:403

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().

◆ ibft_fill_target_chap()

static int ibft_fill_target_chap ( struct ibft_target target,
struct ibft_strings strings,
struct iscsi_session iscsi 
)
static

Fill in Target CHAP portion of iBFT.

Parameters
targetTarget portion of iBFT
stringsiBFT string block descriptor
iscsiiSCSI session
Return values
rcReturn status code

Definition at line 414 of file ibft.c.

416  {
417  int rc;
418 
419  if ( ! ( iscsi->status & ISCSI_STATUS_AUTH_FORWARD_REQUIRED ) )
420  return 0;
421 
422  assert ( iscsi->initiator_username );
423  assert ( iscsi->initiator_password );
424 
425  target->chap_type = IBFT_CHAP_ONE_WAY;
426  if ( ( rc = ibft_set_string ( strings, &target->chap_name,
427  iscsi->initiator_username ) ) != 0 )
428  return rc;
429  DBG ( "iBFT target %d username = %s\n", target->header.index,
430  ibft_string ( strings, &target->chap_name ) );
431  if ( ( rc = ibft_set_string ( strings, &target->chap_secret,
432  iscsi->initiator_password ) ) != 0 )
433  return rc;
434  DBG ( "iBFT target %d password = <redacted>\n", target->header.index );
435 
436  return 0;
437 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
char * initiator_username
Initiator username (if any)
Definition: iscsi.h:563
uint8_t chap_type
CHAP type.
Definition: ibft.h:236
struct ibft_string chap_name
CHAP name.
Definition: ibft.h:242
struct ibft_string chap_secret
CHAP secret.
Definition: ibft.h:244
char * initiator_password
Initiator password (if any)
Definition: iscsi.h:565
#define IBFT_CHAP_ONE_WAY
One-way CHAP.
Definition: ibft.h:268
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
int status
Session status.
Definition: iscsi.h:560
static int ibft_set_string(struct ibft_strings *strings, struct ibft_string *string, const char *data)
Fill in a string field within iBFT.
Definition: ibft.c:173
uint8_t index
Index.
Definition: ibft.h:98
struct ibft_header header
Common header.
Definition: ibft.h:225
A string within the iBFT.
Definition: ibft.h:62
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define ISCSI_STATUS_AUTH_FORWARD_REQUIRED
Target has requested forward (initiator) authentication.
Definition: iscsi.h:693

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().

◆ ibft_fill_target_reverse_chap()

static int ibft_fill_target_reverse_chap ( struct ibft_target target,
struct ibft_strings strings,
struct iscsi_session iscsi 
)
static

Fill in Target Reverse CHAP portion of iBFT.

Parameters
targetTarget portion of iBFT
stringsiBFT string block descriptor
iscsiiSCSI session
Return values
rcReturn status code

Definition at line 447 of file ibft.c.

449  {
450  int rc;
451 
452  if ( ! ( iscsi->status & ISCSI_STATUS_AUTH_REVERSE_REQUIRED ) )
453  return 0;
454 
455  assert ( iscsi->initiator_username );
456  assert ( iscsi->initiator_password );
457  assert ( iscsi->target_username );
458  assert ( iscsi->target_password );
459 
460  target->chap_type = IBFT_CHAP_MUTUAL;
461  if ( ( rc = ibft_set_string ( strings, &target->reverse_chap_name,
462  iscsi->target_username ) ) != 0 )
463  return rc;
464  DBG ( "iBFT target %d reverse username = %s\n", target->header.index,
465  ibft_string ( strings, &target->chap_name ) );
466  if ( ( rc = ibft_set_string ( strings, &target->reverse_chap_secret,
467  iscsi->target_password ) ) != 0 )
468  return rc;
469  DBG ( "iBFT target %d reverse password = <redacted>\n",
470  target->header.index );
471 
472  return 0;
473 }
#define ISCSI_STATUS_AUTH_REVERSE_REQUIRED
Initiator requires target (reverse) authentication.
Definition: iscsi.h:696
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
char * initiator_username
Initiator username (if any)
Definition: iscsi.h:563
struct ibft_string reverse_chap_secret
Reverse CHAP secret.
Definition: ibft.h:248
#define IBFT_CHAP_MUTUAL
Mutual CHAP.
Definition: ibft.h:269
uint8_t chap_type
CHAP type.
Definition: ibft.h:236
struct ibft_string chap_name
CHAP name.
Definition: ibft.h:242
char * initiator_password
Initiator password (if any)
Definition: iscsi.h:565
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
int status
Session status.
Definition: iscsi.h:560
static int ibft_set_string(struct ibft_strings *strings, struct ibft_string *string, const char *data)
Fill in a string field within iBFT.
Definition: ibft.c:173
uint8_t index
Index.
Definition: ibft.h:98
struct ibft_header header
Common header.
Definition: ibft.h:225
A string within the iBFT.
Definition: ibft.h:62
struct ibft_string reverse_chap_name
Reverse CHAP name.
Definition: ibft.h:246
char * target_password
Target password (if any)
Definition: iscsi.h:569
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
char * target_username
Target username (if any)
Definition: iscsi.h:567

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().

◆ ibft_fill_target()

static int ibft_fill_target ( struct ibft_target target,
struct ibft_strings strings,
struct iscsi_session iscsi 
)
static

Fill in Target portion of iBFT.

Parameters
targetTarget portion of iBFT
stringsiBFT string block descriptor
iscsiiSCSI session
Return values
rcReturn status code

Definition at line 483 of file ibft.c.

485  {
486  struct sockaddr_tcpip *st_target =
487  ( struct sockaddr_tcpip * ) &iscsi->target_sockaddr;
488  struct sockaddr_in *sin_target =
489  ( struct sockaddr_in * ) &iscsi->target_sockaddr;
490  int rc;
491 
492  /* Fill in common header */
494  target->header.version = 1;
495  target->header.length = cpu_to_le16 ( sizeof ( *target ) );
498 
499  /* Fill in Target values */
500  ibft_set_ipaddr ( &target->ip_address, sin_target->sin_addr );
501  DBG ( "iBFT target %d IP = %s\n",
502  target->header.index, ibft_ipaddr ( &target->ip_address ) );
503  target->socket = cpu_to_le16 ( ntohs ( st_target->st_port ) );
504  DBG ( "iBFT target %d port = %d\n",
505  target->header.index, target->socket );
506  memcpy ( &target->boot_lun, &iscsi->lun, sizeof ( target->boot_lun ) );
507  DBG ( "iBFT target %d boot LUN = " SCSI_LUN_FORMAT "\n",
508  target->header.index, SCSI_LUN_DATA ( target->boot_lun ) );
509  if ( ( rc = ibft_set_string ( strings, &target->target_name,
510  iscsi->target_iqn ) ) != 0 )
511  return rc;
512  DBG ( "iBFT target %d name = %s\n", target->header.index,
513  ibft_string ( strings, &target->target_name ) );
514  if ( ( rc = ibft_fill_target_nic_association ( target, iscsi ) ) != 0 )
515  return rc;
516  if ( ( rc = ibft_fill_target_chap ( target, strings, iscsi ) ) != 0 )
517  return rc;
518  if ( ( rc = ibft_fill_target_reverse_chap ( target, strings,
519  iscsi ) ) != 0 )
520  return rc;
521 
522  return 0;
523 }
TCP/IP socket address.
Definition: tcpip.h:75
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define IBFT_FL_TARGET_FIRMWARE_BOOT_SELECTED
Target firmware boot selected.
Definition: ibft.h:258
uint8_t version
Version (always 1)
Definition: ibft.h:91
struct sockaddr target_sockaddr
Target socket address (for boot firmware table)
Definition: iscsi.h:649
struct scsi_lun boot_lun
Boot LUN.
Definition: ibft.h:231
IPv4 socket address.
Definition: in.h:82
#define ntohs(value)
Definition: byteswap.h:136
struct ibft_string target_name
Target name.
Definition: ibft.h:240
uint16_t length
Length, including this header.
Definition: ibft.h:93
An IP address within the iBFT.
Definition: ibft.h:70
uint8_t flags
Flags.
Definition: ibft.h:100
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int ibft_fill_target_nic_association(struct ibft_target *target, struct iscsi_session *iscsi)
Fill in Target NIC association.
Definition: ibft.c:373
struct ibft_ipaddr ip_address
IP address.
Definition: ibft.h:227
uint16_t st_port
TCP/IP port.
Definition: tcpip.h:81
#define IBFT_FL_TARGET_BLOCK_VALID
Target block valid.
Definition: ibft.h:255
struct scsi_lun lun
SCSI LUN (for boot firmware table)
Definition: iscsi.h:651
static int ibft_set_string(struct ibft_strings *strings, struct ibft_string *string, const char *data)
Fill in a string field within iBFT.
Definition: ibft.c:173
uint8_t index
Index.
Definition: ibft.h:98
#define SCSI_LUN_FORMAT
printf() format for dumping a scsi_lun
Definition: scsi.h:241
#define SCSI_LUN_DATA(lun)
printf() parameters for dumping a scsi_lun
Definition: scsi.h:244
char * target_iqn
Target IQN.
Definition: iscsi.h:553
struct ibft_header header
Common header.
Definition: ibft.h:225
#define cpu_to_le16(value)
Definition: byteswap.h:106
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.
Definition: ibft.c:414
uint16_t socket
TCP port.
Definition: ibft.h:229
A string within the iBFT.
Definition: ibft.h:62
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
uint8_t structure_id
Structure ID.
Definition: ibft.h:89
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.
Definition: ibft.c:447
static void ibft_set_ipaddr(struct ibft_ipaddr *ipaddr, struct in_addr in)
Fill in an IP address field within iBFT.
Definition: ibft.c:90
#define IBFT_STRUCTURE_ID_TARGET
Structure ID for Target section.
Definition: ibft.h:252

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().

◆ ibft_complete()

static int ibft_complete ( struct acpi_descriptor desc)
static

Check if iBFT descriptor is complete.

Parameters
descACPI descriptor
Return values
rcReturn status code

Definition at line 531 of file ibft.c.

531  {
532  struct iscsi_session *iscsi =
533  container_of ( desc, struct iscsi_session, desc );
534 
535  /* Fail if we do not yet have the target address */
536  if ( ! iscsi->target_sockaddr.sa_family )
537  return -EAGAIN;
538 
539  return 0;
540 }
An iSCSI session.
Definition: iscsi.h:535
struct sockaddr target_sockaddr
Target socket address (for boot firmware table)
Definition: iscsi.h:649
sa_family_t sa_family
Socket address family.
Definition: socket.h:101
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
struct acpi_descriptor desc
ACPI descriptor.
Definition: iscsi.h:653
#define EAGAIN
Resource temporarily unavailable.
Definition: errno.h:318

References container_of, iscsi_session::desc, EAGAIN, sockaddr::sa_family, and iscsi_session::target_sockaddr.

◆ ibft_install()

static int ibft_install ( int(*)(struct acpi_header *acpi install)
static

Install iBFT.

Parameters
installInstallation method
Return values
rcReturn status code

Definition at line 548 of file ibft.c.

548  {
549  struct net_device *netdev;
550  struct iscsi_session *iscsi;
551  struct ibft_table *table;
552  struct ibft_initiator *initiator;
553  struct ibft_nic *nic;
554  struct ibft_target *target;
555  struct ibft_strings strings;
556  struct acpi_header *acpi;
557  void *data;
558  unsigned int targets = 0;
559  unsigned int pairs = 0;
560  size_t offset = 0;
561  size_t table_len;
562  size_t control_len;
563  size_t initiator_offset;
564  size_t nic_offset;
565  size_t target_offset;
566  size_t strings_offset;
567  size_t len;
568  unsigned int i;
569  int rc;
570 
571  /* Calculate table sizes and offsets */
572  list_for_each_entry ( iscsi, &ibft_model.descs, desc.list )
573  targets++;
574  pairs = ( sizeof ( table->control.pair ) /
575  sizeof ( table->control.pair[0] ) );
576  if ( pairs < targets )
577  pairs = targets;
578  offset = offsetof ( typeof ( *table ), control.pair );
579  offset += ( pairs * sizeof ( table->control.pair[0] ) );
580  table_len = offset;
581  control_len = ( table_len - offsetof ( typeof ( *table ), control ) );
582  offset = ibft_align ( offset );
583  initiator_offset = offset;
584  offset += ibft_align ( sizeof ( *initiator ) );
585  nic_offset = offset;
586  offset += ( pairs * ibft_align ( sizeof ( *nic ) ) );
587  target_offset = offset;
588  offset += ( pairs * ibft_align ( sizeof ( *target ) ) );
589  strings_offset = offset;
590  strings.data = NULL;
591  strings.start = strings_offset;
592  strings.len = 0;
593  len = offset;
594 
595  /* Do nothing if no targets exist */
596  if ( ! targets ) {
597  rc = 0;
598  goto no_targets;
599  }
600 
601  /* Allocate table */
602  data = zalloc ( len );
603  if ( ! data ) {
604  rc = -ENOMEM;
605  goto err_alloc;
606  }
607 
608  /* Fill in Control block */
609  table = data;
611  table->control.header.version = 1;
612  table->control.header.length = cpu_to_le16 ( control_len );
613 
614  /* Fill in Initiator block */
615  initiator = ( data + initiator_offset );
616  table->control.initiator = cpu_to_le16 ( initiator_offset );
617  iscsi = list_first_entry ( &ibft_model.descs, struct iscsi_session,
618  desc.list );
619  if ( ( rc = ibft_fill_initiator ( initiator, &strings,
620  iscsi->initiator_iqn ) ) != 0 )
621  goto err_initiator;
622 
623  /* Fill in NIC blocks */
624  i = 0;
625  for_each_netdev ( netdev ) {
626  if ( ! ibft_netdev_is_required ( netdev ) )
627  continue;
628  assert ( i < pairs );
629  table->control.pair[i].nic = nic_offset;
630  nic = ( data + nic_offset );
631  nic->header.index = i;
632  if ( ( rc = ibft_fill_nic ( nic, &strings, netdev ) ) != 0 )
633  goto err_nic;
634  i++;
635  nic_offset += ibft_align ( sizeof ( *nic ) );
636  }
637 
638  /* Fill in Target blocks */
639  i = 0;
640  list_for_each_entry ( iscsi, &ibft_model.descs, desc.list ) {
641  assert ( i < pairs );
642  table->control.pair[i].target = target_offset;
643  target = ( data + target_offset );
644  target->header.index = i;
645  if ( ( rc = ibft_fill_target ( target, &strings, iscsi ) ) != 0)
646  goto err_target;
647  i++;
648  target_offset += ibft_align ( sizeof ( *target ) );
649  }
650 
651  /* Reallocate table to include space for strings */
652  len += strings.len;
653  acpi = realloc ( data, len );
654  if ( ! acpi )
655  goto err_realloc;
656  data = NULL;
657 
658  /* Fill in ACPI header */
659  acpi->signature = cpu_to_le32 ( IBFT_SIG );
660  acpi->length = cpu_to_le32 ( len );
661  acpi->revision = 1;
662 
663  /* Append strings */
664  memcpy ( ( ( ( void * ) acpi ) + strings_offset ), strings.data,
665  strings.len );
666 
667  /* Install ACPI table */
668  if ( ( rc = install ( acpi ) ) != 0 ) {
669  DBG ( "iBFT could not install: %s\n", strerror ( rc ) );
670  goto err_install;
671  }
672 
673  err_install:
674  free ( acpi );
675  err_realloc:
676  err_target:
677  err_nic:
678  err_initiator:
679  free ( data );
680  err_alloc:
681  no_targets:
682  free ( strings.data );
683  return rc;
684 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
ibft_off_t nic
Offset to NIC structure.
Definition: ibft.h:112
uint8_t version
Version (always 1)
Definition: ibft.h:91
An iSCSI session.
Definition: iscsi.h:535
ibft_off_t initiator
Offset to Initiator structure.
Definition: ibft.h:127
iBFT NIC structure
Definition: ibft.h:171
struct ibft_control control
Control structure.
Definition: ibft.h:280
#define offsetof(type, field)
Get offset of a field within a structure.
Definition: stddef.h:24
#define IBFT_STRUCTURE_ID_CONTROL
Structure ID for Control section.
Definition: ibft.h:133
static int ibft_netdev_is_required(struct net_device *netdev)
Check if network device is required for the iBFT.
Definition: ibft.c:241
uint16_t length
Length, including this header.
Definition: ibft.h:93
iBFT Target structure
Definition: ibft.h:223
uint32_t start
Starting offset.
Definition: netvsc.h:12
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
Definition: list.h:333
iSCSI Boot Firmware Table (iBFT)
Definition: ibft.h:274
#define ENOMEM
Not enough space.
Definition: errno.h:534
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int ibft_fill_nic(struct ibft_nic *nic, struct ibft_strings *strings, struct net_device *netdev)
Fill in NIC portion of iBFT.
Definition: ibft.c:262
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:420
static EFI_ACPI_TABLE_PROTOCOL * acpi
ACPI table protocol protocol.
Definition: efi_block.c:61
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
static struct net_device * netdev
Definition: gdbudp.c:52
#define cpu_to_le32(value)
Definition: byteswap.h:107
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static size_t ibft_align(size_t len)
Align structure within iBFT.
Definition: ibft.c:79
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
#define for_each_netdev(netdev)
Iterate over all network devices.
Definition: netdevice.h:526
static int ibft_fill_initiator(struct ibft_initiator *initiator, struct ibft_strings *strings, const char *initiator_iqn)
Fill in Initiator portion of iBFT.
Definition: ibft.c:344
uint32_t control
Control.
Definition: myson.h:14
A network device.
Definition: netdevice.h:348
iSCSI string buffer
Definition: ibft.c:64
uint8_t index
Index.
Definition: ibft.h:98
An ACPI description header.
Definition: acpi.h:28
Definition: nic.h:49
struct ibft_header header
Common header.
Definition: ibft.h:123
uint32_t len
Length.
Definition: ena.h:14
struct ibft_header header
Common header.
Definition: ibft.h:225
struct ibft_offset_pair pair[2]
Offsets to NIC and Target structures.
Definition: ibft.h:129
#define cpu_to_le16(value)
Definition: byteswap.h:106
iBFT Initiator structure
Definition: ibft.h:145
void * realloc(void *old_ptr, size_t new_size)
Reallocate memory.
Definition: malloc.c:521
ibft_off_t target
Offset to Target structure.
Definition: ibft.h:114
char * initiator_iqn
Initiator IQN.
Definition: iscsi.h:547
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
static int ibft_fill_target(struct ibft_target *target, struct ibft_strings *strings, struct iscsi_session *iscsi)
Fill in Target portion of iBFT.
Definition: ibft.c:483
struct nic nic
Definition: legacy.c:22
uint8_t structure_id
Structure ID.
Definition: ibft.h:89
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
if(natsemi->flags &NATSEMI_64BIT) return 1
#define IBFT_SIG
iSCSI Boot Firmware Table signature
Definition: ibft.h:50

References acpi, assert(), control, ibft_table::control, cpu_to_le16, cpu_to_le32, data, ibft_strings::data, DBG, 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, ibft_header::version, and zalloc().

Variable Documentation

◆ __acpi_model

struct acpi_model ibft_model __acpi_model
Initial value:
= {
.descs = LIST_HEAD_INIT ( ibft_model.descs ),
.complete = ibft_complete,
.install = ibft_install,
}
static int ibft_complete(struct acpi_descriptor *desc)
Check if iBFT descriptor is complete.
Definition: ibft.c:531
static int ibft_install(int(*install)(struct acpi_header *acpi))
Install iBFT.
Definition: ibft.c:548
#define LIST_HEAD_INIT(list)
Initialise a static list head.
Definition: list.h:30

iBFT model

aBFT model

Definition at line 687 of file ibft.c.