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

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 83 of file ibft.c.

83  {
84 
85  return ( ( len + IBFT_ALIGN - 1 ) & ~( IBFT_ALIGN - 1 ) );
86 }
#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 94 of file ibft.c.

94  {
95  memset ( ipaddr, 0, sizeof ( *ipaddr ) );
96  if ( in.s_addr ) {
97  ipaddr->in = in;
98  ipaddr->ones = 0xffff;
99  }
100 }
__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 110 of file ibft.c.

113  {
114  struct in_addr in[count];
115  unsigned int i;
116 
118  for ( i = 0 ; i < count ; i++ ) {
119  ibft_set_ipaddr ( &ipaddr[i], in[i] );
120  }
121 }
__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:890
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:94

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 130 of file ibft.c.

130  {
131  return inet_ntoa ( ipaddr->in );
132 }
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 142 of file ibft.c.

143  {
144  size_t new_len;
145  char *new_data;
146  char *dest;
147 
148  /* Extend string data buffer */
149  new_len = ( strings->len + len + 1 /* NUL */ );
150  new_data = realloc ( strings->data, new_len );
151  if ( ! new_data )
152  return NULL;
153  strings->data = new_data;
154 
155  /* Fill in string field */
156  string->offset = cpu_to_le16 ( strings->start + strings->len );
157  string->len = cpu_to_le16 ( len );
158 
159  /* Zero string */
160  dest = ( strings->data + strings->len );
161  memset ( dest, 0, ( len + 1 /* NUL */ ) );
162 
163  /* Update allocated length */
164  strings->len = new_len;
165 
166  return dest;
167 }
size_t len
Total length.
Definition: ibft.c:74
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:72
void * realloc(void *old_ptr, size_t new_size)
Reallocate memory.
Definition: malloc.c:521
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
char * data
Strings data.
Definition: ibft.c:70
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 177 of file ibft.c.

178  {
179  char *dest;
180 
181  if ( ! data )
182  return 0;
183 
184  dest = ibft_alloc_string ( strings, string, strlen ( data ) );
185  if ( ! dest )
186  return -ENOBUFS;
187  strcpy ( dest, data );
188 
189  return 0;
190 }
char * strcpy(char *dest, const char *src)
Copy string.
Definition: string.c:326
static void * dest
Definition: strings.h:176
size_t strlen(const char *src)
Get length of string.
Definition: string.c:243
#define ENOBUFS
No buffer space available.
Definition: errno.h:498
uint8_t data[48]
Additional event data.
Definition: ena.h:22
static char * ibft_alloc_string(struct ibft_strings *strings, struct ibft_string *string, size_t len)
Allocate a string within iBFT.
Definition: ibft.c:142

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 201 of file ibft.c.

204  {
205  struct settings *origin;
206  struct setting fetched;
207  int len;
208  char *dest;
209 
210  len = fetch_setting ( settings, setting, &origin, &fetched, NULL, 0 );
211  if ( len < 0 ) {
212  string->offset = 0;
213  string->len = 0;
214  return 0;
215  }
216 
217  dest = ibft_alloc_string ( strings, string, len );
218  if ( ! dest )
219  return -ENOBUFS;
220  fetch_string_setting ( origin, &fetched, dest, ( len + 1 ));
221 
222  return 0;
223 }
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:841
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:666
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:321
static char * ibft_alloc_string(struct ibft_strings *strings, struct ibft_string *string, size_t len)
Allocate a string within iBFT.
Definition: ibft.c:142

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 232 of file ibft.c.

233  {
234  size_t offset = le16_to_cpu ( string->offset );
235 
236  return ( offset ? ( strings->data + offset - strings->start ) : NULL );
237 }
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:72
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
char * data
Strings data.
Definition: ibft.c:70

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 245 of file ibft.c.

245  {
246  struct iscsi_session *iscsi;
247  struct sockaddr_tcpip *st_target;
248 
249  list_for_each_entry ( iscsi, &ibft_model.descs, desc.list ) {
250  st_target = ( struct sockaddr_tcpip * ) &iscsi->target_sockaddr;
251  if ( tcpip_netdev ( st_target ) == netdev )
252  return 1;
253  }
254 
255  return 0;
256 }
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:544
struct sockaddr target_sockaddr
Target socket address (for boot firmware table)
Definition: iscsi.h:661
uint64_t desc
Microcode descriptor list physical address.
Definition: ucode.h:12
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:431
static struct net_device * netdev
Definition: gdbudp.c:52
if(natsemi->flags &NATSEMI_64BIT) return 1

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

◆ 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 266 of file ibft.c.

268  {
270  struct in_addr netmask_addr = { 0 };
271  unsigned int netmask_count = 0;
272  struct settings *parent = netdev_settings ( netdev );
273  struct settings *origin;
274  int rc;
275 
276  /* Fill in common header */
277  nic->header.structure_id = IBFT_STRUCTURE_ID_NIC;
278  nic->header.version = 1;
279  nic->header.length = cpu_to_le16 ( sizeof ( *nic ) );
280  nic->header.flags = ( IBFT_FL_NIC_BLOCK_VALID |
282  DBG ( "iBFT NIC %d is %s\n", nic->header.index, netdev->name );
283 
284  /* Determine origin of IP address */
285  fetch_setting ( parent, &ip_setting, &origin, NULL, NULL, 0 );
286  nic->origin = ( ( origin == parent ) ?
288  DBG ( "iBFT NIC %d origin = %d\n", nic->header.index, nic->origin );
289 
290  /* Extract values from configuration settings */
291  ibft_set_ipaddr_setting ( parent, &nic->ip_address, &ip_setting, 1 );
292  DBG ( "iBFT NIC %d IP = %s\n",
293  nic->header.index, ibft_ipaddr ( &nic->ip_address ) );
294  ibft_set_ipaddr_setting ( parent, &nic->gateway, &gateway_setting, 1 );
295  DBG ( "iBFT NIC %d gateway = %s\n",
296  nic->header.index, ibft_ipaddr ( &nic->gateway ) );
297  ibft_set_ipaddr_setting ( NULL, &nic->dns[0], &dns_setting,
298  ( sizeof ( nic->dns ) /
299  sizeof ( nic->dns[0] ) ) );
300  ibft_set_ipaddr_setting ( parent, &nic->dhcp, &dhcp_server_setting, 1 );
301  DBG ( "iBFT NIC %d DNS = %s",
302  nic->header.index, ibft_ipaddr ( &nic->dns[0] ) );
303  DBG ( ", %s\n", ibft_ipaddr ( &nic->dns[1] ) );
304  if ( ( rc = ibft_set_string_setting ( NULL, strings, &nic->hostname,
305  &hostname_setting ) ) != 0 )
306  return rc;
307  DBG ( "iBFT NIC %d hostname = %s\n",
308  nic->header.index, ibft_string ( strings, &nic->hostname ) );
309 
310  /* Derive subnet mask prefix from subnet mask */
311  fetch_ipv4_setting ( parent, &netmask_setting, &netmask_addr );
312  while ( netmask_addr.s_addr ) {
313  if ( netmask_addr.s_addr & 0x1 )
314  netmask_count++;
315  netmask_addr.s_addr >>= 1;
316  }
317  nic->subnet_mask_prefix = netmask_count;
318  DBG ( "iBFT NIC %d subnet = /%d\n",
319  nic->header.index, nic->subnet_mask_prefix );
320 
321  /* Extract values from net-device configuration */
322  nic->vlan = cpu_to_le16 ( vlan_tag ( netdev ) );
323  DBG ( "iBFT NIC %d VLAN = %02x\n",
324  nic->header.index, le16_to_cpu ( nic->vlan ) );
325  if ( ( rc = ll_protocol->eth_addr ( netdev->ll_addr,
326  nic->mac_address ) ) != 0 ) {
327  DBG ( "Could not determine %s MAC: %s\n",
328  netdev->name, strerror ( rc ) );
329  return rc;
330  }
331  DBG ( "iBFT NIC %d MAC = %s\n",
332  nic->header.index, eth_ntoa ( nic->mac_address ) );
333  nic->pci_bus_dev_func = cpu_to_le16 ( netdev->dev->desc.location );
334  DBG ( "iBFT NIC %d PCI = %04x\n",
335  nic->header.index, le16_to_cpu ( nic->pci_bus_dev_func ) );
336 
337  return 0;
338 }
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:110
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:912
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
Definition: netdevice.h:583
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:666
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:201
struct device * dev
Underlying hardware device.
Definition: netdevice.h:364
uint32_t s_addr
Definition: in.h:40
#define IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED
NIC firmware boot selected.
Definition: ibft.h:206
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
#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:387
static unsigned int vlan_tag(struct net_device *netdev)
Get the VLAN tag.
Definition: vlan.h:73
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#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:372
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 348 of file ibft.c.

350  {
351  int rc;
352 
353  /* Fill in common header */
355  initiator->header.version = 1;
356  initiator->header.length = cpu_to_le16 ( sizeof ( *initiator ) );
359 
360  /* Fill in initiator name */
361  if ( ( rc = ibft_set_string ( strings, &initiator->initiator_name,
362  initiator_iqn ) ) != 0 )
363  return rc;
364  DBG ( "iBFT initiator name = %s\n",
365  ibft_string ( strings, &initiator->initiator_name ) );
366 
367  return 0;
368 }
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:177
#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 377 of file ibft.c.

378  {
379  struct sockaddr_tcpip *st_target =
380  ( struct sockaddr_tcpip * ) &iscsi->target_sockaddr;
381  struct net_device *associated;
382  struct net_device *netdev;
383 
384  /* Find network device used to reach target */
385  associated = tcpip_netdev ( st_target );
386  if ( ! associated ) {
387  DBG ( "iBFT target %d has no net device\n",
388  target->header.index );
389  return -EHOSTUNREACH;
390  }
391 
392  /* Calculate association */
393  for_each_netdev ( netdev ) {
394  if ( netdev == associated ) {
395  DBG ( "iBFT target %d uses NIC %d (%s)\n",
396  target->header.index, target->nic_association,
397  netdev->name );
398  return 0;
399  }
400  if ( ! ibft_netdev_is_required ( netdev ) )
401  continue;
402  target->nic_association++;
403  }
404 
405  DBG ( "iBFT target %d has impossible NIC %s\n",
406  target->header.index, netdev->name );
407  return -EINVAL;
408 }
#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:661
static int ibft_netdev_is_required(struct net_device *netdev)
Check if network device is required for the iBFT.
Definition: ibft.c:245
static struct net_device * netdev
Definition: gdbudp.c:52
#define for_each_netdev(netdev)
Iterate over all network devices.
Definition: netdevice.h:543
A network device.
Definition: netdevice.h:352
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:362
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 418 of file ibft.c.

420  {
421  int rc;
422 
423  if ( ! ( iscsi->status & ISCSI_STATUS_AUTH_FORWARD_REQUIRED ) )
424  return 0;
425 
426  assert ( iscsi->initiator_username );
427  assert ( iscsi->initiator_password );
428 
429  target->chap_type = IBFT_CHAP_ONE_WAY;
430  if ( ( rc = ibft_set_string ( strings, &target->chap_name,
431  iscsi->initiator_username ) ) != 0 )
432  return rc;
433  DBG ( "iBFT target %d username = %s\n", target->header.index,
434  ibft_string ( strings, &target->chap_name ) );
435  if ( ( rc = ibft_set_string ( strings, &target->chap_secret,
436  iscsi->initiator_password ) ) != 0 )
437  return rc;
438  DBG ( "iBFT target %d password = <redacted>\n", target->header.index );
439 
440  return 0;
441 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
char * initiator_username
Initiator username (if any)
Definition: iscsi.h:572
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:574
#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:569
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:177
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:705

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 451 of file ibft.c.

453  {
454  int rc;
455 
456  if ( ! ( iscsi->status & ISCSI_STATUS_AUTH_REVERSE_REQUIRED ) )
457  return 0;
458 
459  assert ( iscsi->initiator_username );
460  assert ( iscsi->initiator_password );
461  assert ( iscsi->target_username );
462  assert ( iscsi->target_password );
463 
464  target->chap_type = IBFT_CHAP_MUTUAL;
465  if ( ( rc = ibft_set_string ( strings, &target->reverse_chap_name,
466  iscsi->target_username ) ) != 0 )
467  return rc;
468  DBG ( "iBFT target %d reverse username = %s\n", target->header.index,
469  ibft_string ( strings, &target->chap_name ) );
470  if ( ( rc = ibft_set_string ( strings, &target->reverse_chap_secret,
471  iscsi->target_password ) ) != 0 )
472  return rc;
473  DBG ( "iBFT target %d reverse password = <redacted>\n",
474  target->header.index );
475 
476  return 0;
477 }
#define ISCSI_STATUS_AUTH_REVERSE_REQUIRED
Initiator requires target (reverse) authentication.
Definition: iscsi.h:708
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
char * initiator_username
Initiator username (if any)
Definition: iscsi.h:572
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:574
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
int status
Session status.
Definition: iscsi.h:569
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:177
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:578
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
char * target_username
Target username (if any)
Definition: iscsi.h:576

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 487 of file ibft.c.

489  {
490  struct sockaddr_tcpip *st_target =
491  ( struct sockaddr_tcpip * ) &iscsi->target_sockaddr;
492  struct sockaddr_in *sin_target =
493  ( struct sockaddr_in * ) &iscsi->target_sockaddr;
494  int rc;
495 
496  /* Fill in common header */
498  target->header.version = 1;
499  target->header.length = cpu_to_le16 ( sizeof ( *target ) );
502 
503  /* Fill in Target values */
504  ibft_set_ipaddr ( &target->ip_address, sin_target->sin_addr );
505  DBG ( "iBFT target %d IP = %s\n",
506  target->header.index, ibft_ipaddr ( &target->ip_address ) );
507  target->socket = cpu_to_le16 ( ntohs ( st_target->st_port ) );
508  DBG ( "iBFT target %d port = %d\n",
509  target->header.index, target->socket );
510  memcpy ( &target->boot_lun, &iscsi->lun, sizeof ( target->boot_lun ) );
511  DBG ( "iBFT target %d boot LUN = " SCSI_LUN_FORMAT "\n",
512  target->header.index, SCSI_LUN_DATA ( target->boot_lun ) );
513  if ( ( rc = ibft_set_string ( strings, &target->target_name,
514  iscsi->target_iqn ) ) != 0 )
515  return rc;
516  DBG ( "iBFT target %d name = %s\n", target->header.index,
517  ibft_string ( strings, &target->target_name ) );
518  if ( ( rc = ibft_fill_target_nic_association ( target, iscsi ) ) != 0 )
519  return rc;
520  if ( ( rc = ibft_fill_target_chap ( target, strings, iscsi ) ) != 0 )
521  return rc;
522  if ( ( rc = ibft_fill_target_reverse_chap ( target, strings,
523  iscsi ) ) != 0 )
524  return rc;
525 
526  return 0;
527 }
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:661
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:377
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:663
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:177
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:562
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:418
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:451
static void ibft_set_ipaddr(struct ibft_ipaddr *ipaddr, struct in_addr in)
Fill in an IP address field within iBFT.
Definition: ibft.c:94
#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 535 of file ibft.c.

535  {
536  struct iscsi_session *iscsi =
537  container_of ( desc, struct iscsi_session, desc );
538 
539  /* Fail if we do not yet have the target address */
540  if ( ! iscsi->target_sockaddr.sa_family )
541  return -EAGAIN;
542 
543  return 0;
544 }
An iSCSI session.
Definition: iscsi.h:544
struct sockaddr target_sockaddr
Target socket address (for boot firmware table)
Definition: iscsi.h:661
uint64_t desc
Microcode descriptor list physical address.
Definition: ucode.h:12
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
#define EAGAIN
Resource temporarily unavailable.
Definition: errno.h:318

References container_of, 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 552 of file ibft.c.

552  {
553  struct net_device *netdev;
554  struct iscsi_session *iscsi;
555  struct ibft_table *table;
556  struct ibft_initiator *initiator;
557  struct ibft_nic *nic;
558  struct ibft_target *target;
559  struct ibft_strings strings;
560  struct acpi_header *acpi;
561  void *data;
562  unsigned int targets = 0;
563  unsigned int pairs = 0;
564  size_t offset = 0;
565  size_t table_len;
566  size_t control_len;
567  size_t initiator_offset;
568  size_t nic_offset;
569  size_t target_offset;
570  size_t strings_offset;
571  size_t len;
572  unsigned int i;
573  int rc;
574 
575  /* Calculate table sizes and offsets */
576  list_for_each_entry ( iscsi, &ibft_model.descs, desc.list )
577  targets++;
578  pairs = ( sizeof ( table->control.pair ) /
579  sizeof ( table->control.pair[0] ) );
580  if ( pairs < targets )
581  pairs = targets;
582  offset = offsetof ( typeof ( *table ), control.pair );
583  offset += ( pairs * sizeof ( table->control.pair[0] ) );
584  table_len = offset;
585  control_len = ( table_len - offsetof ( typeof ( *table ), control ) );
586  offset = ibft_align ( offset );
587  initiator_offset = offset;
588  offset += ibft_align ( sizeof ( *initiator ) );
589  nic_offset = offset;
590  offset += ( pairs * ibft_align ( sizeof ( *nic ) ) );
591  target_offset = offset;
592  offset += ( pairs * ibft_align ( sizeof ( *target ) ) );
593  strings_offset = offset;
594  strings.data = NULL;
595  strings.start = strings_offset;
596  strings.len = 0;
597  len = offset;
598 
599  /* Do nothing if no targets exist */
600  if ( ! targets ) {
601  rc = 0;
602  goto no_targets;
603  }
604 
605  /* Allocate table */
606  data = zalloc ( len );
607  if ( ! data ) {
608  rc = -ENOMEM;
609  goto err_alloc;
610  }
611 
612  /* Fill in Control block */
613  table = data;
615  table->control.header.version = 1;
616  table->control.header.length = cpu_to_le16 ( control_len );
617 
618  /* Fill in Initiator block */
619  initiator = ( data + initiator_offset );
620  table->control.initiator = cpu_to_le16 ( initiator_offset );
621  iscsi = list_first_entry ( &ibft_model.descs, struct iscsi_session,
622  desc.list );
623  if ( ( rc = ibft_fill_initiator ( initiator, &strings,
624  iscsi->initiator_iqn ) ) != 0 )
625  goto err_initiator;
626 
627  /* Fill in NIC blocks */
628  i = 0;
629  for_each_netdev ( netdev ) {
630  if ( ! ibft_netdev_is_required ( netdev ) )
631  continue;
632  assert ( i < pairs );
633  table->control.pair[i].nic = nic_offset;
634  nic = ( data + nic_offset );
635  nic->header.index = i;
636  if ( ( rc = ibft_fill_nic ( nic, &strings, netdev ) ) != 0 )
637  goto err_nic;
638  i++;
639  nic_offset += ibft_align ( sizeof ( *nic ) );
640  }
641 
642  /* Fill in Target blocks */
643  i = 0;
644  list_for_each_entry ( iscsi, &ibft_model.descs, desc.list ) {
645  assert ( i < pairs );
646  table->control.pair[i].target = target_offset;
647  target = ( data + target_offset );
648  target->header.index = i;
649  if ( ( rc = ibft_fill_target ( target, &strings, iscsi ) ) != 0)
650  goto err_target;
651  i++;
652  target_offset += ibft_align ( sizeof ( *target ) );
653  }
654 
655  /* Reallocate table to include space for strings */
656  len += strings.len;
657  acpi = realloc ( data, len );
658  if ( ! acpi )
659  goto err_realloc;
660  data = NULL;
661 
662  /* Fill in ACPI header */
663  acpi->signature = cpu_to_le32 ( IBFT_SIG );
664  acpi->length = cpu_to_le32 ( len );
665  acpi->revision = 1;
666 
667  /* Append strings */
668  memcpy ( ( ( ( void * ) acpi ) + strings_offset ), strings.data,
669  strings.len );
670 
671  /* Install ACPI table */
672  if ( ( rc = install ( acpi ) ) != 0 ) {
673  DBG ( "iBFT could not install: %s\n", strerror ( rc ) );
674  goto err_install;
675  }
676 
677  err_install:
678  free ( acpi );
679  err_realloc:
680  err_target:
681  err_nic:
682  err_initiator:
683  free ( data );
684  err_alloc:
685  no_targets:
686  free ( strings.data );
687  return rc;
688 }
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:544
ibft_off_t initiator
Offset to Initiator structure.
Definition: ibft.h:127
iBFT NIC structure
Definition: ibft.h:171
uint64_t desc
Microcode descriptor list physical address.
Definition: ucode.h:12
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:245
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:266
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:431
static EFI_ACPI_TABLE_PROTOCOL * acpi
ACPI table protocol protocol.
Definition: efi_block.c:65
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:83
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:543
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:348
uint32_t control
Control.
Definition: myson.h:14
A network device.
Definition: netdevice.h:352
iSCSI string buffer
Definition: ibft.c:68
uint8_t index
Index.
Definition: ibft.h:98
An ACPI description header.
Definition: acpi.h:163
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
uint8_t data[48]
Additional event data.
Definition: ena.h:22
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:556
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:45
#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:487
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:321
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, 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().

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:535
static int ibft_install(int(*install)(struct acpi_header *acpi))
Install iBFT.
Definition: ibft.c:552
#define LIST_HEAD_INIT(list)
Initialise a static list head.
Definition: list.h:30

iBFT model

aBFT model

Definition at line 691 of file ibft.c.