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.
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:
17 * The above copyright notice and this permission notice shall be
18 * included in all copies or substantial portions of the Software.
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
31 FILE_LICENCE ( BSD2
);
35 * iSCSI boot firmware table
37 * The information in this file is derived from the document "iSCSI
38 * Boot Firmware Table (iBFT)" as published by IBM at
40 * ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf
45 #include <gpxe/acpi.h>
48 /** iSCSI Boot Firmware Table signature */
49 #define IBFT_SIG "iBFT"
51 /** An offset from the start of the iBFT */
52 typedef uint16_t ibft_off_t
;
54 /** Length of a string within the iBFT (excluding terminating NUL) */
55 typedef uint16_t ibft_size_t
;
57 /** A string within the iBFT */
59 /** Length of string */
61 /** Offset to string */
63 } __attribute__ (( packed
));
65 /** An IP address within the iBFT */
67 /** Reserved; must be zero */
69 /** Must be 0xffff if IPv4 address is present, otherwise zero */
71 /** The IPv4 address, or zero if not present */
73 } __attribute__ (( packed
));
76 * iBFT structure header
78 * This structure is common to several sections within the iBFT.
83 * This is an IBFT_STRUCTURE_ID_XXX constant
86 /** Version (always 1) */
88 /** Length, including this header */
92 * This is the number of the NIC or Target, when applicable.
97 } __attribute__ (( packed
));
100 * iBFT Control structure
103 struct ibft_control
{
105 struct ibft_header header
;
108 /** Offset to Initiator structure */
109 ibft_off_t initiator
;
110 /** Offset to NIC structure for NIC 0 */
112 /** Offset to Target structure for target 0 */
114 /** Offset to NIC structure for NIC 1 */
116 /** Offset to Target structure for target 1 */
118 } __attribute__ (( packed
));
120 /** Structure ID for Control section */
121 #define IBFT_STRUCTURE_ID_CONTROL 0x01
123 /** Attempt login only to specified target
125 * If this flag is not set, all targets will be logged in to.
127 #define IBFT_FL_CONTROL_SINGLE_LOGIN_ONLY 0x01
130 * iBFT Initiator structure
133 struct ibft_initiator
{
135 struct ibft_header header
;
137 struct ibft_ipaddr isns_server
;
139 struct ibft_ipaddr slp_server
;
140 /** Primary and secondary Radius servers */
141 struct ibft_ipaddr radius
[2];
142 /** Initiator name */
143 struct ibft_string initiator_name
;
144 } __attribute__ (( packed
));
146 /** Structure ID for Initiator section */
147 #define IBFT_STRUCTURE_ID_INITIATOR 0x02
149 /** Initiator block valid */
150 #define IBFT_FL_INITIATOR_BLOCK_VALID 0x01
152 /** Initiator firmware boot selected */
153 #define IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED 0x02
161 struct ibft_header header
;
163 struct ibft_ipaddr ip_address
;
166 * This is the length of the subnet mask in bits (e.g. /24).
168 uint8_t subnet_mask_prefix
;
171 /** Default gateway */
172 struct ibft_ipaddr gateway
;
173 /** Primary and secondary DNS servers */
174 struct ibft_ipaddr dns
[2];
176 struct ibft_ipaddr dhcp
;
180 uint8_t mac_address
[6];
181 /** PCI bus:dev:fn */
182 uint16_t pci_bus_dev_func
;
184 struct ibft_string hostname
;
185 } __attribute__ (( packed
));
187 /** Structure ID for NIC section */
188 #define IBFT_STRUCTURE_ID_NIC 0x03
190 /** NIC block valid */
191 #define IBFT_FL_NIC_BLOCK_VALID 0x01
193 /** NIC firmware boot selected */
194 #define IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED 0x02
196 /** NIC global / link local */
197 #define IBFT_FL_NIC_GLOBAL 0x04
200 * iBFT Target structure
205 struct ibft_header header
;
207 struct ibft_ipaddr ip_address
;
214 * This is an IBFT_CHAP_XXX constant.
217 /** NIC association */
218 uint8_t nic_association
;
220 struct ibft_string target_name
;
222 struct ibft_string chap_name
;
224 struct ibft_string chap_secret
;
225 /** Reverse CHAP name */
226 struct ibft_string reverse_chap_name
;
227 /** Reverse CHAP secret */
228 struct ibft_string reverse_chap_secret
;
229 } __attribute__ (( packed
));
231 /** Structure ID for Target section */
232 #define IBFT_STRUCTURE_ID_TARGET 0x04
234 /** Target block valid */
235 #define IBFT_FL_TARGET_BLOCK_VALID 0x01
237 /** Target firmware boot selected */
238 #define IBFT_FL_TARGET_FIRMWARE_BOOT_SELECTED 0x02
240 /** Target use Radius CHAP */
241 #define IBFT_FL_TARGET_USE_CHAP 0x04
243 /** Target use Radius rCHAP */
244 #define IBFT_FL_TARGET_USE_RCHAP 0x08
246 /* Values for chap_type */
247 #define IBFT_CHAP_NONE 0 /**< No CHAP authentication */
248 #define IBFT_CHAP_ONE_WAY 1 /**< One-way CHAP */
249 #define IBFT_CHAP_MUTUAL 2 /**< Mutual CHAP */
252 * iSCSI Boot Firmware Table (iBFT)
256 struct acpi_description_header acpi
;
258 uint8_t reserved
[12];
259 /** Control structure */
260 struct ibft_control control
;
261 } __attribute__ (( packed
));
264 * iSCSI string block descriptor
266 * This is an internal structure that we use to keep track of the
267 * allocation of string data.
269 struct ibft_string_block
{
270 /** The iBFT containing these strings */
271 struct ibft_table
*table
;
272 /** Offset of first free byte within iBFT */
276 /** Amount of space reserved for strings in a gPXE iBFT */
277 #define IBFT_STRINGS_SIZE 384
280 * An iBFT created by gPXE
284 /** The fixed section */
285 struct ibft_table table
;
286 /** The Initiator section */
287 struct ibft_initiator initiator
__attribute__ (( aligned ( 16 ) ));
288 /** The NIC section */
289 struct ibft_nic nic
__attribute__ (( aligned ( 16 ) ));
290 /** The Target section */
291 struct ibft_target target
__attribute__ (( aligned ( 16 ) ));
293 char strings
[IBFT_STRINGS_SIZE
];
294 } __attribute__ (( packed
, aligned ( 16 ) ));
297 struct iscsi_session
;
299 extern int ibft_fill_data ( struct net_device
*netdev
,
300 struct iscsi_session
*iscsi
);
302 #endif /* _GPXE_IBFT_H */