]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/IScsiDxe/IScsiConfig.h
df0c7539e4ad4416a8edc485a23f3d7d60650ba1
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiConfig.h
1 /** @file
2 The header file of functions for configuring or getting the parameters
3 relating to iSCSI.
4
5 Copyright (c) 2004 - 2011, 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_CONFIG_H_
17 #define _ISCSI_CONFIG_H_
18
19 #include "IScsiConfigNVDataStruc.h"
20
21 typedef struct _ISCSI_FORM_CALLBACK_INFO ISCSI_FORM_CALLBACK_INFO;
22
23 extern UINT8 IScsiConfigVfrBin[];
24 extern UINT8 IScsiDxeStrings[];
25 extern ISCSI_FORM_CALLBACK_INFO *mCallbackInfo;
26 extern EFI_GUID mVendorGuid;
27
28
29 #define VAR_OFFSET(Field) \
30 ((UINT16) ((UINTN) &(((ISCSI_CONFIG_IFR_NVDATA *) 0)->Field)))
31
32 #define QUESTION_ID(Field) \
33 ((UINT16) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET))
34
35
36 #define DYNAMIC_ONE_OF_VAR_OFFSET VAR_OFFSET (Enabled)
37 #define DYNAMIC_ORDERED_LIST_QUESTION_ID QUESTION_ID (DynamicOrderedList)
38 #define DYNAMIC_ORDERED_LIST_VAR_OFFSET VAR_OFFSET (DynamicOrderedList)
39 #define ATTEMPT_DEL_QUESTION_ID QUESTION_ID (DeleteAttemptList)
40 #define ATTEMPT_DEL_VAR_OFFSET VAR_OFFSET (DeleteAttemptList)
41
42 //
43 // sizeof (EFI_MAC_ADDRESS) * 3
44 //
45 #define ISCSI_MAX_MAC_STRING_LEN 96
46
47 #define ISCSI_INITATOR_NAME_VAR_NAME L"I_NAME"
48
49 #define ISCSI_CONFIG_VAR_ATTR (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE)
50
51 #define ISCSI_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'f', 'c', 'i')
52
53 #define ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK(Callback) \
54 CR ( \
55 Callback, \
56 ISCSI_FORM_CALLBACK_INFO, \
57 ConfigAccess, \
58 ISCSI_FORM_CALLBACK_INFO_SIGNATURE \
59 )
60
61 #pragma pack(1)
62 struct _ISCSI_ATTEMPT_CONFIG_NVDATA {
63 LIST_ENTRY Link;
64 UINT8 NicIndex;
65 UINT8 AttemptConfigIndex;
66 BOOLEAN DhcpSuccess;
67 BOOLEAN ValidiBFTPath;
68 BOOLEAN ValidPath;
69 UINT8 AutoConfigureMode;
70 EFI_STRING_ID AttemptTitleToken;
71 EFI_STRING_ID AttemptTitleHelpToken;
72 CHAR8 AttemptName[ATTEMPT_NAME_MAX_SIZE];
73 CHAR8 MacString[ISCSI_MAX_MAC_STRING_LEN];
74 EFI_IP_ADDRESS PrimaryDns;
75 EFI_IP_ADDRESS SecondaryDns;
76 EFI_IP_ADDRESS DhcpServer;
77 ISCSI_SESSION_CONFIG_NVDATA SessionConfigData;
78 UINT8 AuthenticationType;
79 union {
80 ISCSI_CHAP_AUTH_CONFIG_NVDATA CHAP;
81 } AuthConfigData;
82
83 };
84
85 ///
86 /// HII specific Vendor Device Path definition.
87 ///
88 typedef struct {
89 VENDOR_DEVICE_PATH VendorDevicePath;
90 EFI_DEVICE_PATH_PROTOCOL End;
91 } HII_VENDOR_DEVICE_PATH;
92
93 #pragma pack()
94
95 struct _ISCSI_FORM_CALLBACK_INFO {
96 UINT32 Signature;
97 EFI_HANDLE DriverHandle;
98 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
99 UINT16 *KeyList;
100 VOID *FormBuffer;
101 EFI_HII_HANDLE RegisteredHandle;
102 ISCSI_ATTEMPT_CONFIG_NVDATA *Current;
103 };
104
105 /**
106 Initialize the iSCSI configuration form.
107
108 @param[in] DriverBindingHandle The iSCSI driverbinding handle.
109
110 @retval EFI_SUCCESS The iSCSI configuration form is initialized.
111 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
112
113 **/
114 EFI_STATUS
115 IScsiConfigFormInit (
116 IN EFI_HANDLE DriverBindingHandle
117 );
118
119 /**
120 Unload the iSCSI configuration form, this includes: delete all the iSCSI
121 configuration entries, uninstall the form callback protocol, and
122 free the resources used.
123
124 @param[in] DriverBindingHandle The iSCSI driverbinding handle.
125
126 @retval EFI_SUCCESS The iSCSI configuration form is unloaded.
127 @retval Others Failed to unload the form.
128
129 **/
130 EFI_STATUS
131 IScsiConfigFormUnload (
132 IN EFI_HANDLE DriverBindingHandle
133 );
134
135 /**
136 Update the MAIN form to display the configured attempts.
137
138 **/
139 VOID
140 IScsiConfigUpdateAttempt (
141 VOID
142 );
143
144 /**
145 Get the attempt config data from global structure by the ConfigIndex.
146
147 @param[in] AttemptConfigIndex The unique index indicates the attempt.
148
149 @return Pointer to the attempt config data.
150 @retval NULL The attempt configuration data can not be found.
151
152 **/
153 ISCSI_ATTEMPT_CONFIG_NVDATA *
154 IScsiConfigGetAttemptByConfigIndex (
155 IN UINT8 AttemptConfigIndex
156 );
157
158 #endif