1 /** @file
2   The definition for iSCSI Boot Firmware Table, it's defined in Microsoft's
3   iSCSI Boot Firmware Table(iBFT) as Defined in ACPI 3.0b Specification.
4 
5   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
6   This program and the accompanying materials
7   are licensed and made available under the terms and conditions of the BSD License
8   which accompanies this distribution.  The full text of the license may be found at
9   http://opensource.org/licenses/bsd-license.php
10 
11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #ifndef _ISCSI_BOOT_FIRMWARE_TABLE_H_
17 #define _ISCSI_BOOT_FIRMWARE_TABLE_H_
18 
19 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_REVISION            0x01
20 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_ALIGNMENT 8
21 
22 ///
23 /// Structure Type/ID
24 ///
25 #define  EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_RESERVED_STRUCTURE_ID         0
26 #define  EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_ID          1
27 #define  EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_ID        2
28 #define  EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_ID              3
29 #define  EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_ID           4
30 #define  EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_EXTERNSIONS_STRUCTURE_ID      5
31 
32 ///
33 /// from the definition of IP_PREFIX_ORIGIN Enumeration in MSDN,
34 /// not defined in Microsoft iBFT document.
35 ///
36 typedef enum {
37   IpPrefixOriginOther = 0,
38   IpPrefixOriginManual,
39   IpPrefixOriginWellKnown,
40   IpPrefixOriginDhcp,
41   IpPrefixOriginRouterAdvertisement,
42   IpPrefixOriginUnchanged = 16
43 } IP_PREFIX_VALUE;
44 
45 #pragma pack(1)
46 
47 ///
48 /// iBF Table Header
49 ///
50 typedef struct {
51   UINT32  Signature;
52   UINT32  Length;
53   UINT8   Revision;
54   UINT8   Checksum;
55   UINT8   OemId[6];
56   UINT64  OemTableId;
57   UINT8   Reserved[24];
58 } EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER;
59 
60 ///
61 /// Common Header of Boot Firmware Table Structure
62 ///
63 typedef struct {
64   UINT8   StructureId;
65   UINT8   Version;
66   UINT16  Length;
67   UINT8   Index;
68   UINT8   Flags;
69 } EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER;
70 
71 ///
72 /// Control Structure
73 ///
74 typedef struct {
75   EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER  Header;
76   UINT16                                               Extensions;
77   UINT16                                               InitiatorOffset;
78   UINT16                                               NIC0Offset;
79   UINT16                                               Target0Offset;
80   UINT16                                               NIC1Offset;
81   UINT16                                               Target1Offset;
82 } EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE;
83 
84 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_VERSION              0x1
85 
86 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_FLAG_BOOT_FAILOVER   BIT0
87 
88 ///
89 /// Initiator Structure
90 ///
91 typedef struct {
92   EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER  Header;
93   EFI_IPv6_ADDRESS                                     ISnsServer;
94   EFI_IPv6_ADDRESS                                     SlpServer;
95   EFI_IPv6_ADDRESS                                     PrimaryRadiusServer;
96   EFI_IPv6_ADDRESS                                     SecondaryRadiusServer;
97   UINT16                                               IScsiNameLength;
98   UINT16                                               IScsiNameOffset;
99 } EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE;
100 
101 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_VERSION             0x1
102 
103 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_FLAG_BLOCK_VALID    BIT0
104 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_FLAG_BOOT_SELECTED  BIT1
105 
106 ///
107 /// NIC Structure
108 ///
109 typedef struct {
110   EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER  Header;
111   EFI_IPv6_ADDRESS                                     Ip;
112   UINT8                                                SubnetMaskPrefixLength;
113   UINT8                                                Origin;
114   EFI_IPv6_ADDRESS                                     Gateway;
115   EFI_IPv6_ADDRESS                                     PrimaryDns;
116   EFI_IPv6_ADDRESS                                     SecondaryDns;
117   EFI_IPv6_ADDRESS                                     DhcpServer;
118   UINT16                                               VLanTag;
119   UINT8                                                Mac[6];
120   UINT16                                               PciLocation;
121   UINT16                                               HostNameLength;
122   UINT16                                               HostNameOffset;
123 } EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE;
124 
125 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_VERSION                 0x1
126 
127 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_BLOCK_VALID        BIT0
128 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_BOOT_SELECTED      BIT1
129 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_GLOBAL             BIT2
130 
131 ///
132 /// Target Structure
133 ///
134 typedef struct {
135   EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER  Header;
136   EFI_IPv6_ADDRESS                                     Ip;
137   UINT16                                               Port;
138   UINT8                                                BootLun[8];
139   UINT8                                                CHAPType;
140   UINT8                                                NicIndex;
141   UINT16                                               IScsiNameLength;
142   UINT16                                               IScsiNameOffset;
143   UINT16                                               CHAPNameLength;
144   UINT16                                               CHAPNameOffset;
145   UINT16                                               CHAPSecretLength;
146   UINT16                                               CHAPSecretOffset;
147   UINT16                                               ReverseCHAPNameLength;
148   UINT16                                               ReverseCHAPNameOffset;
149   UINT16                                               ReverseCHAPSecretLength;
150   UINT16                                               ReverseCHAPSecretOffset;
151 } EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE;
152 
153 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_VERSION               0x1
154 
155 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BLOCK_VALID      BIT0
156 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BOOT_SELECTED    BIT1
157 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_RADIUS_CHAP      BIT2
158 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_RADIUS_RCHAP     BIT3
159 
160 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_NO_CHAP        0
161 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_CHAP           1
162 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_MUTUAL_CHAP    2
163 
164 #pragma pack()
165 
166 #endif
167 
168