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 <ipxe/acpi.h>
46 #include <ipxe/scsi.h>
49 /** iSCSI Boot Firmware Table signature */
50 #define IBFT_SIG ACPI_SIGNATURE ( 'i', 'B', 'F', 'T' )
52 /** An offset from the start of the iBFT */
53 typedef uint16_t ibft_off_t;
55 /** Length of a string within the iBFT (excluding terminating NUL) */
56 typedef uint16_t ibft_size_t;
58 /** A string within the iBFT */
60 /** Length of string */
62 /** Offset to string */
64 } __attribute__ (( packed ));
66 /** An IP address within the iBFT */
68 /** Reserved; must be zero */
70 /** Must be 0xffff if IPv4 address is present, otherwise zero */
72 /** The IPv4 address, or zero if not present */
74 } __attribute__ (( packed ));
77 * iBFT structure header
79 * This structure is common to several sections within the iBFT.
84 * This is an IBFT_STRUCTURE_ID_XXX constant
87 /** Version (always 1) */
89 /** Length, including this header */
93 * This is the number of the NIC or Target, when applicable.
98 } __attribute__ (( packed ));
101 * iBFT Control structure
104 struct ibft_control {
106 struct ibft_header header;
109 /** Offset to Initiator structure */
110 ibft_off_t initiator;
111 /** Offset to NIC structure for NIC 0 */
113 /** Offset to Target structure for target 0 */
115 /** Offset to NIC structure for NIC 1 */
117 /** Offset to Target structure for target 1 */
119 } __attribute__ (( packed ));
121 /** Structure ID for Control section */
122 #define IBFT_STRUCTURE_ID_CONTROL 0x01
124 /** Attempt login only to specified target
126 * If this flag is not set, all targets will be logged in to.
128 #define IBFT_FL_CONTROL_SINGLE_LOGIN_ONLY 0x01
131 * iBFT Initiator structure
134 struct ibft_initiator {
136 struct ibft_header header;
138 struct ibft_ipaddr isns_server;
140 struct ibft_ipaddr slp_server;
141 /** Primary and secondary Radius servers */
142 struct ibft_ipaddr radius[2];
143 /** Initiator name */
144 struct ibft_string initiator_name;
145 } __attribute__ (( packed ));
147 /** Structure ID for Initiator section */
148 #define IBFT_STRUCTURE_ID_INITIATOR 0x02
150 /** Initiator block valid */
151 #define IBFT_FL_INITIATOR_BLOCK_VALID 0x01
153 /** Initiator firmware boot selected */
154 #define IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED 0x02
162 struct ibft_header header;
164 struct ibft_ipaddr ip_address;
167 * This is the length of the subnet mask in bits (e.g. /24).
169 uint8_t subnet_mask_prefix;
172 /** Default gateway */
173 struct ibft_ipaddr gateway;
174 /** Primary and secondary DNS servers */
175 struct ibft_ipaddr dns[2];
177 struct ibft_ipaddr dhcp;
181 uint8_t mac_address[6];
182 /** PCI bus:dev:fn */
183 uint16_t pci_bus_dev_func;
185 struct ibft_string hostname;
186 } __attribute__ (( packed ));
188 /** Structure ID for NIC section */
189 #define IBFT_STRUCTURE_ID_NIC 0x03
191 /** NIC block valid */
192 #define IBFT_FL_NIC_BLOCK_VALID 0x01
194 /** NIC firmware boot selected */
195 #define IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED 0x02
197 /** NIC global / link local */
198 #define IBFT_FL_NIC_GLOBAL 0x04
200 /** NIC IP address origin */
201 #define IBFT_NIC_ORIGIN_OTHER 0x00
202 #define IBFT_NIC_ORIGIN_MANUAL 0x01
203 #define IBFT_NIC_ORIGIN_WELLKNOWN 0x02
204 #define IBFT_NIC_ORIGIN_DHCP 0x03
205 #define IBFT_NIC_ORIGIN_RA 0x04
206 #define IBFT_NIC_ORIGIN_UNCHANGED 0x0f
209 * iBFT Target structure
214 struct ibft_header header;
216 struct ibft_ipaddr ip_address;
220 struct scsi_lun boot_lun;
223 * This is an IBFT_CHAP_XXX constant.
226 /** NIC association */
227 uint8_t nic_association;
229 struct ibft_string target_name;
231 struct ibft_string chap_name;
233 struct ibft_string chap_secret;
234 /** Reverse CHAP name */
235 struct ibft_string reverse_chap_name;
236 /** Reverse CHAP secret */
237 struct ibft_string reverse_chap_secret;
238 } __attribute__ (( packed ));
240 /** Structure ID for Target section */
241 #define IBFT_STRUCTURE_ID_TARGET 0x04
243 /** Target block valid */
244 #define IBFT_FL_TARGET_BLOCK_VALID 0x01
246 /** Target firmware boot selected */
247 #define IBFT_FL_TARGET_FIRMWARE_BOOT_SELECTED 0x02
249 /** Target use Radius CHAP */
250 #define IBFT_FL_TARGET_USE_CHAP 0x04
252 /** Target use Radius rCHAP */
253 #define IBFT_FL_TARGET_USE_RCHAP 0x08
255 /* Values for chap_type */
256 #define IBFT_CHAP_NONE 0 /**< No CHAP authentication */
257 #define IBFT_CHAP_ONE_WAY 1 /**< One-way CHAP */
258 #define IBFT_CHAP_MUTUAL 2 /**< Mutual CHAP */
261 * iSCSI Boot Firmware Table (iBFT)
265 struct acpi_description_header acpi;
267 uint8_t reserved[12];
268 /** Control structure */
269 struct ibft_control control;
270 } __attribute__ (( packed ));
272 struct iscsi_session;
275 extern int ibft_describe ( struct iscsi_session *iscsi,
276 struct acpi_description_header *acpi,
279 #endif /* _IPXE_IBFT_H */