iPXE
ibft.h
Go to the documentation of this file.
1#ifndef _IPXE_IBFT_H
2#define _IPXE_IBFT_H
3
4/*
5 * Copyright Fen Systems Ltd. 2007. Portions of this code are derived
6 * from IBM Corporation Sample Programs. Copyright IBM Corporation
7 * 2004, 2007. All rights reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use, copy,
13 * modify, merge, publish, distribute, sublicense, and/or sell copies
14 * of the Software, and to permit persons to whom the Software is
15 * furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be
18 * included in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
24 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28 *
29 */
30
31FILE_LICENCE ( BSD2 );
32FILE_SECBOOT ( PERMITTED );
33
34/** @file
35 *
36 * iSCSI boot firmware table
37 *
38 * The information in this file is derived from the document "iSCSI
39 * Boot Firmware Table (iBFT)" as published by IBM at
40 *
41 * ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf
42 *
43 */
44
45#include <stdint.h>
46#include <ipxe/acpi.h>
47#include <ipxe/scsi.h>
48#include <ipxe/in.h>
49
50/** iSCSI Boot Firmware Table signature */
51#define IBFT_SIG ACPI_SIGNATURE ( 'i', 'B', 'F', 'T' )
52
53/** Alignment of structures within iBFT */
54#define IBFT_ALIGN 16
55
56/** An offset from the start of the iBFT */
58
59/** Length of a string within the iBFT (excluding terminating NUL) */
61
62/** A string within the iBFT */
64 /** Length of string */
66 /** Offset to string */
68} __attribute__ (( packed ));
69
70/** An IP address within the iBFT */
72 /** Reserved; must be zero */
74 /** Must be 0xffff if IPv4 address is present, otherwise zero */
76 /** The IPv4 address, or zero if not present */
77 struct in_addr in;
78} __attribute__ (( packed ));
79
80/**
81 * iBFT structure header
82 *
83 * This structure is common to several sections within the iBFT.
84 */
86 /** Structure ID
87 *
88 * This is an IBFT_STRUCTURE_ID_XXX constant
89 */
91 /** Version (always 1) */
93 /** Length, including this header */
95 /** Index
96 *
97 * This is the number of the NIC or Target, when applicable.
98 */
100 /** Flags */
102} __attribute__ (( packed ));
103
104/**
105 * iBFT NIC and Target offset pair
106 *
107 * There is no implicit relation between the NIC and the Target, but
108 * using this structure simplifies the table construction code while
109 * matching the expected table layout.
110 */
112 /** Offset to NIC structure */
114 /** Offset to Target structure */
116} __attribute__ (( packed ));
117
118/**
119 * iBFT Control structure
120 *
121 */
123 /** Common header */
125 /** Extensions */
127 /** Offset to Initiator structure */
129 /** Offsets to NIC and Target structures */
131} __attribute__ (( packed ));
132
133/** Structure ID for Control section */
134#define IBFT_STRUCTURE_ID_CONTROL 0x01
135
136/** Attempt login only to specified target
137 *
138 * If this flag is not set, all targets will be logged in to.
139 */
140#define IBFT_FL_CONTROL_SINGLE_LOGIN_ONLY 0x01
141
142/**
143 * iBFT Initiator structure
144 *
145 */
147 /** Common header */
149 /** iSNS server */
151 /** SLP server */
153 /** Primary and secondary Radius servers */
155 /** Initiator name */
157} __attribute__ (( packed ));
158
159/** Structure ID for Initiator section */
160#define IBFT_STRUCTURE_ID_INITIATOR 0x02
161
162/** Initiator block valid */
163#define IBFT_FL_INITIATOR_BLOCK_VALID 0x01
164
165/** Initiator firmware boot selected */
166#define IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED 0x02
167
168/**
169 * iBFT NIC structure
170 *
171 */
172struct ibft_nic {
173 /** Common header */
175 /** IP address */
177 /** Subnet mask
178 *
179 * This is the length of the subnet mask in bits (e.g. /24).
180 */
182 /** Origin */
184 /** Default gateway */
186 /** Primary and secondary DNS servers */
187 struct ibft_ipaddr dns[2];
188 /** DHCP server */
190 /** VLAN tag */
192 /** MAC address */
194 /** PCI bus:dev:fn */
196 /** Hostname */
198} __attribute__ (( packed ));
199
200/** Structure ID for NIC section */
201#define IBFT_STRUCTURE_ID_NIC 0x03
202
203/** NIC block valid */
204#define IBFT_FL_NIC_BLOCK_VALID 0x01
205
206/** NIC firmware boot selected */
207#define IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED 0x02
208
209/** NIC global / link local */
210#define IBFT_FL_NIC_GLOBAL 0x04
211
212/** NIC IP address origin */
213#define IBFT_NIC_ORIGIN_OTHER 0x00
214#define IBFT_NIC_ORIGIN_MANUAL 0x01
215#define IBFT_NIC_ORIGIN_WELLKNOWN 0x02
216#define IBFT_NIC_ORIGIN_DHCP 0x03
217#define IBFT_NIC_ORIGIN_RA 0x04
218#define IBFT_NIC_ORIGIN_UNCHANGED 0x0f
219
220/**
221 * iBFT Target structure
222 *
223 */
225 /** Common header */
227 /** IP address */
229 /** TCP port */
231 /** Boot LUN */
233 /** CHAP type
234 *
235 * This is an IBFT_CHAP_XXX constant.
236 */
238 /** NIC association */
240 /** Target name */
242 /** CHAP name */
244 /** CHAP secret */
246 /** Reverse CHAP name */
248 /** Reverse CHAP secret */
250} __attribute__ (( packed ));
251
252/** Structure ID for Target section */
253#define IBFT_STRUCTURE_ID_TARGET 0x04
254
255/** Target block valid */
256#define IBFT_FL_TARGET_BLOCK_VALID 0x01
257
258/** Target firmware boot selected */
259#define IBFT_FL_TARGET_FIRMWARE_BOOT_SELECTED 0x02
260
261/** Target use Radius CHAP */
262#define IBFT_FL_TARGET_USE_CHAP 0x04
263
264/** Target use Radius rCHAP */
265#define IBFT_FL_TARGET_USE_RCHAP 0x08
266
267/* Values for chap_type */
268#define IBFT_CHAP_NONE 0 /**< No CHAP authentication */
269#define IBFT_CHAP_ONE_WAY 1 /**< One-way CHAP */
270#define IBFT_CHAP_MUTUAL 2 /**< Mutual CHAP */
271
272/**
273 * iSCSI Boot Firmware Table (iBFT)
274 */
276 /** ACPI header */
278 /** Reserved */
280 /** Control structure */
282} __attribute__ (( packed ));
283
284extern struct acpi_model ibft_model __acpi_model;
285
286#endif /* _IPXE_IBFT_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned char uint8_t
Definition stdint.h:10
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
uint16_t ibft_size_t
Length of a string within the iBFT (excluding terminating NUL)
Definition ibft.h:60
uint16_t ibft_off_t
An offset from the start of the iBFT.
Definition ibft.h:57
#define __attribute__(x)
Definition compiler.h:10
ACPI data structures.
#define __acpi_model
Declare an ACPI model.
Definition acpi.h:344
SCSI devices.
An ACPI description header.
Definition acpi.h:180
An ACPI table model.
Definition acpi.h:321
iBFT Control structure
Definition ibft.h:122
uint16_t extensions
Extensions.
Definition ibft.h:126
struct ibft_header header
Common header.
Definition ibft.h:124
struct ibft_offset_pair pair[2]
Offsets to NIC and Target structures.
Definition ibft.h:130
ibft_off_t initiator
Offset to Initiator structure.
Definition ibft.h:128
iBFT structure header
Definition ibft.h:85
uint16_t length
Length, including this header.
Definition ibft.h:94
uint8_t flags
Flags.
Definition ibft.h:101
uint8_t version
Version (always 1)
Definition ibft.h:92
uint8_t index
Index.
Definition ibft.h:99
uint8_t structure_id
Structure ID.
Definition ibft.h:90
iBFT Initiator structure
Definition ibft.h:146
struct ibft_header header
Common header.
Definition ibft.h:148
struct ibft_string initiator_name
Initiator name.
Definition ibft.h:156
struct ibft_ipaddr slp_server
SLP server.
Definition ibft.h:152
struct ibft_ipaddr radius[2]
Primary and secondary Radius servers.
Definition ibft.h:154
struct ibft_ipaddr isns_server
iSNS server
Definition ibft.h:150
An IP address within the iBFT.
Definition ibft.h:71
struct in_addr in
The IPv4 address, or zero if not present.
Definition ibft.h:77
uint16_t zeroes[5]
Reserved; must be zero.
Definition ibft.h:73
uint16_t ones
Must be 0xffff if IPv4 address is present, otherwise zero.
Definition ibft.h:75
iBFT NIC structure
Definition ibft.h:172
struct ibft_ipaddr ip_address
IP address.
Definition ibft.h:176
uint16_t vlan
VLAN tag.
Definition ibft.h:191
struct ibft_header header
Common header.
Definition ibft.h:174
uint8_t subnet_mask_prefix
Subnet mask.
Definition ibft.h:181
struct ibft_string hostname
Hostname.
Definition ibft.h:197
uint16_t pci_bus_dev_func
PCI bus:dev:fn.
Definition ibft.h:195
struct ibft_ipaddr gateway
Default gateway.
Definition ibft.h:185
uint8_t mac_address[6]
MAC address.
Definition ibft.h:193
struct ibft_ipaddr dhcp
DHCP server.
Definition ibft.h:189
uint8_t origin
Origin.
Definition ibft.h:183
struct ibft_ipaddr dns[2]
Primary and secondary DNS servers.
Definition ibft.h:187
iBFT NIC and Target offset pair
Definition ibft.h:111
ibft_off_t nic
Offset to NIC structure.
Definition ibft.h:113
ibft_off_t target
Offset to Target structure.
Definition ibft.h:115
A string within the iBFT.
Definition ibft.h:63
ibft_off_t offset
Offset to string.
Definition ibft.h:67
ibft_size_t len
Length of string.
Definition ibft.h:65
iSCSI Boot Firmware Table (iBFT)
Definition ibft.h:275
struct ibft_control control
Control structure.
Definition ibft.h:281
struct acpi_header acpi
ACPI header.
Definition ibft.h:277
uint8_t reserved[12]
Reserved.
Definition ibft.h:279
iBFT Target structure
Definition ibft.h:224
struct ibft_header header
Common header.
Definition ibft.h:226
struct ibft_string reverse_chap_name
Reverse CHAP name.
Definition ibft.h:247
struct ibft_ipaddr ip_address
IP address.
Definition ibft.h:228
uint8_t chap_type
CHAP type.
Definition ibft.h:237
struct ibft_string chap_secret
CHAP secret.
Definition ibft.h:245
struct ibft_string chap_name
CHAP name.
Definition ibft.h:243
struct ibft_string target_name
Target name.
Definition ibft.h:241
uint8_t nic_association
NIC association.
Definition ibft.h:239
struct scsi_lun boot_lun
Boot LUN.
Definition ibft.h:232
uint16_t socket
TCP port.
Definition ibft.h:230
struct ibft_string reverse_chap_secret
Reverse CHAP secret.
Definition ibft.h:249
IP address structure.
Definition in.h:42
A SCSI LUN.
Definition scsi.h:236