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 
31 FILE_LICENCE ( BSD2 );
32 
33 /** @file
34  *
35  * iSCSI boot firmware table
36  *
37  * The information in this file is derived from the document "iSCSI
38  * Boot Firmware Table (iBFT)" as published by IBM at
39  *
40  * ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf
41  *
42  */
43 
44 #include <stdint.h>
45 #include <ipxe/acpi.h>
46 #include <ipxe/scsi.h>
47 #include <ipxe/in.h>
48 
49 /** iSCSI Boot Firmware Table signature */
50 #define IBFT_SIG ACPI_SIGNATURE ( 'i', 'B', 'F', 'T' )
51 
52 /** Alignment of structures within iBFT */
53 #define IBFT_ALIGN 16
54 
55 /** An offset from the start of the iBFT */
57 
58 /** Length of a string within the iBFT (excluding terminating NUL) */
60 
61 /** A string within the iBFT */
62 struct ibft_string {
63  /** Length of string */
65  /** Offset to string */
67 } __attribute__ (( packed ));
68 
69 /** An IP address within the iBFT */
70 struct ibft_ipaddr {
71  /** Reserved; must be zero */
73  /** Must be 0xffff if IPv4 address is present, otherwise zero */
75  /** The IPv4 address, or zero if not present */
76  struct in_addr in;
77 } __attribute__ (( packed ));
78 
79 /**
80  * iBFT structure header
81  *
82  * This structure is common to several sections within the iBFT.
83  */
84 struct ibft_header {
85  /** Structure ID
86  *
87  * This is an IBFT_STRUCTURE_ID_XXX constant
88  */
90  /** Version (always 1) */
92  /** Length, including this header */
94  /** Index
95  *
96  * This is the number of the NIC or Target, when applicable.
97  */
99  /** Flags */
101 } __attribute__ (( packed ));
102 
103 /**
104  * iBFT NIC and Target offset pair
105  *
106  * There is no implicit relation between the NIC and the Target, but
107  * using this structure simplifies the table construction code while
108  * matching the expected table layout.
109  */
111  /** Offset to NIC structure */
113  /** Offset to Target structure */
115 } __attribute__ (( packed ));
116 
117 /**
118  * iBFT Control structure
119  *
120  */
121 struct ibft_control {
122  /** Common header */
124  /** Extensions */
126  /** Offset to Initiator structure */
128  /** Offsets to NIC and Target structures */
130 } __attribute__ (( packed ));
131 
132 /** Structure ID for Control section */
133 #define IBFT_STRUCTURE_ID_CONTROL 0x01
134 
135 /** Attempt login only to specified target
136  *
137  * If this flag is not set, all targets will be logged in to.
138  */
139 #define IBFT_FL_CONTROL_SINGLE_LOGIN_ONLY 0x01
140 
141 /**
142  * iBFT Initiator structure
143  *
144  */
146  /** Common header */
148  /** iSNS server */
150  /** SLP server */
152  /** Primary and secondary Radius servers */
153  struct ibft_ipaddr radius[2];
154  /** Initiator name */
156 } __attribute__ (( packed ));
157 
158 /** Structure ID for Initiator section */
159 #define IBFT_STRUCTURE_ID_INITIATOR 0x02
160 
161 /** Initiator block valid */
162 #define IBFT_FL_INITIATOR_BLOCK_VALID 0x01
163 
164 /** Initiator firmware boot selected */
165 #define IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED 0x02
166 
167 /**
168  * iBFT NIC structure
169  *
170  */
171 struct ibft_nic {
172  /** Common header */
174  /** IP address */
176  /** Subnet mask
177  *
178  * This is the length of the subnet mask in bits (e.g. /24).
179  */
181  /** Origin */
183  /** Default gateway */
185  /** Primary and secondary DNS servers */
186  struct ibft_ipaddr dns[2];
187  /** DHCP server */
189  /** VLAN tag */
191  /** MAC address */
193  /** PCI bus:dev:fn */
195  /** Hostname */
197 } __attribute__ (( packed ));
198 
199 /** Structure ID for NIC section */
200 #define IBFT_STRUCTURE_ID_NIC 0x03
201 
202 /** NIC block valid */
203 #define IBFT_FL_NIC_BLOCK_VALID 0x01
204 
205 /** NIC firmware boot selected */
206 #define IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED 0x02
207 
208 /** NIC global / link local */
209 #define IBFT_FL_NIC_GLOBAL 0x04
210 
211 /** NIC IP address origin */
212 #define IBFT_NIC_ORIGIN_OTHER 0x00
213 #define IBFT_NIC_ORIGIN_MANUAL 0x01
214 #define IBFT_NIC_ORIGIN_WELLKNOWN 0x02
215 #define IBFT_NIC_ORIGIN_DHCP 0x03
216 #define IBFT_NIC_ORIGIN_RA 0x04
217 #define IBFT_NIC_ORIGIN_UNCHANGED 0x0f
218 
219 /**
220  * iBFT Target structure
221  *
222  */
223 struct ibft_target {
224  /** Common header */
226  /** IP address */
228  /** TCP port */
230  /** Boot LUN */
232  /** CHAP type
233  *
234  * This is an IBFT_CHAP_XXX constant.
235  */
237  /** NIC association */
239  /** Target name */
241  /** CHAP name */
243  /** CHAP secret */
245  /** Reverse CHAP name */
247  /** Reverse CHAP secret */
249 } __attribute__ (( packed ));
250 
251 /** Structure ID for Target section */
252 #define IBFT_STRUCTURE_ID_TARGET 0x04
253 
254 /** Target block valid */
255 #define IBFT_FL_TARGET_BLOCK_VALID 0x01
256 
257 /** Target firmware boot selected */
258 #define IBFT_FL_TARGET_FIRMWARE_BOOT_SELECTED 0x02
259 
260 /** Target use Radius CHAP */
261 #define IBFT_FL_TARGET_USE_CHAP 0x04
262 
263 /** Target use Radius rCHAP */
264 #define IBFT_FL_TARGET_USE_RCHAP 0x08
265 
266 /* Values for chap_type */
267 #define IBFT_CHAP_NONE 0 /**< No CHAP authentication */
268 #define IBFT_CHAP_ONE_WAY 1 /**< One-way CHAP */
269 #define IBFT_CHAP_MUTUAL 2 /**< Mutual CHAP */
270 
271 /**
272  * iSCSI Boot Firmware Table (iBFT)
273  */
274 struct ibft_table {
275  /** ACPI header */
277  /** Reserved */
279  /** Control structure */
281 } __attribute__ (( packed ));
282 
283 extern struct acpi_model ibft_model __acpi_model;
284 
285 #endif /* _IPXE_IBFT_H */
uint16_t ibft_size_t
Length of a string within the iBFT (excluding terminating NUL)
Definition: ibft.h:59
struct ibft_string initiator_name
Initiator name.
Definition: ibft.h:155
#define __attribute__(x)
Definition: compiler.h:10
iBFT structure header
Definition: ibft.h:84
unsigned short uint16_t
Definition: stdint.h:11
ibft_off_t nic
Offset to NIC structure.
Definition: ibft.h:112
struct ibft_header header
Common header.
Definition: ibft.h:173
uint8_t version
Version (always 1)
Definition: ibft.h:91
struct ibft_string reverse_chap_secret
Reverse CHAP secret.
Definition: ibft.h:248
ibft_off_t initiator
Offset to Initiator structure.
Definition: ibft.h:127
struct ibft_ipaddr dhcp
DHCP server.
Definition: ibft.h:188
struct ibft_ipaddr radius[2]
Primary and secondary Radius servers.
Definition: ibft.h:153
struct scsi_lun boot_lun
Boot LUN.
Definition: ibft.h:231
iBFT NIC structure
Definition: ibft.h:171
ibft_size_t len
Length of string.
Definition: ibft.h:64
uint8_t chap_type
CHAP type.
Definition: ibft.h:236
struct ibft_string chap_name
CHAP name.
Definition: ibft.h:242
struct ibft_control control
Control structure.
Definition: ibft.h:280
uint16_t ibft_off_t
An offset from the start of the iBFT.
Definition: ibft.h:56
struct ibft_string chap_secret
CHAP secret.
Definition: ibft.h:244
FILE_LICENCE(BSD2)
struct ibft_ipaddr ip_address
IP address.
Definition: ibft.h:175
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
iBFT Target structure
Definition: ibft.h:223
iSCSI Boot Firmware Table (iBFT)
Definition: ibft.h:274
uint8_t flags
Flags.
Definition: ibft.h:100
struct ibft_header header
Common header.
Definition: ibft.h:147
An ACPI table model.
Definition: acpi.h:304
struct ibft_ipaddr ip_address
IP address.
Definition: ibft.h:227
uint16_t pci_bus_dev_func
PCI bus:dev:fn.
Definition: ibft.h:194
ACPI data structures.
IP address structure.
Definition: in.h:39
struct ibft_ipaddr gateway
Default gateway.
Definition: ibft.h:184
struct ibft_ipaddr isns_server
iSNS server
Definition: ibft.h:149
unsigned char uint8_t
Definition: stdint.h:10
uint8_t index
Index.
Definition: ibft.h:98
uint8_t nic_association
NIC association.
Definition: ibft.h:238
struct ibft_string hostname
Hostname.
Definition: ibft.h:196
An ACPI description header.
Definition: acpi.h:163
SCSI devices.
struct acpi_header acpi
ACPI header.
Definition: ibft.h:276
struct ibft_header header
Common header.
Definition: ibft.h:123
uint8_t subnet_mask_prefix
Subnet mask.
Definition: ibft.h:180
struct ibft_header header
Common header.
Definition: ibft.h:225
iBFT NIC and Target offset pair
Definition: ibft.h:110
struct in_addr in
The IPv4 address, or zero if not present.
Definition: ibft.h:76
struct acpi_model ibft_model __acpi_model
aBFT model
Definition: aoe.c:57
iBFT Control structure
Definition: ibft.h:121
uint8_t reserved[12]
Reserved.
Definition: ibft.h:278
struct ibft_offset_pair pair[2]
Offsets to NIC and Target structures.
Definition: ibft.h:129
uint8_t origin
Origin.
Definition: ibft.h:182
struct ibft_ipaddr slp_server
SLP server.
Definition: ibft.h:151
iBFT Initiator structure
Definition: ibft.h:145
ibft_off_t target
Offset to Target structure.
Definition: ibft.h:114
A SCSI LUN.
Definition: scsi.h:236
uint16_t socket
TCP port.
Definition: ibft.h:229
A string within the iBFT.
Definition: ibft.h:62
struct ibft_string reverse_chap_name
Reverse CHAP name.
Definition: ibft.h:246
uint16_t vlan
VLAN tag.
Definition: ibft.h:190
uint8_t mac_address[6]
MAC address.
Definition: ibft.h:192
uint8_t structure_id
Structure ID.
Definition: ibft.h:89
uint16_t extensions
Extensions.
Definition: ibft.h:125
uint16_t ones
Must be 0xffff if IPv4 address is present, otherwise zero.
Definition: ibft.h:74
struct ibft_ipaddr dns[2]
Primary and secondary DNS servers.
Definition: ibft.h:186
ibft_off_t offset
Offset to string.
Definition: ibft.h:66
uint16_t zeroes[5]
Reserved; must be zero.
Definition: ibft.h:72