]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h
b0a748ae9ca62f505475a0ff7dd235df62de80af
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiConfig.h
1 /** @file
2 The header file of IScsiConfig.c.
3
4 Copyright (c) 2004 - 2008, Intel Corporation.<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _ISCSI_CONFIG_H_
16 #define _ISCSI_CONFIG_H_
17
18 #include <Guid/MdeModuleHii.h>
19 #include <Protocol/HiiConfigRouting.h>
20 #include <Library/HiiLib.h>
21 #include <Library/DevicePathLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/BaseLib.h>
24 #include <Library/NetLib.h>
25
26 extern UINT8 IScsiConfigDxeBin[];
27 extern UINT8 IScsiDxeStrings[];
28
29 #define ISCSI_INITATOR_NAME_VAR_NAME L"I_NAME"
30
31 #define ISCSI_CONFIG_VAR_ATTR (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE)
32
33 #define ISCSI_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'f', 'c', 'i')
34
35
36
37 /**
38 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear,
39 then this macro return a pointer to a data structure ISCSI_FORM_CALLBACK_INFO.
40
41 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
42 The Signature field of the data structure ISCSI_FORM_CALLBACK_INFO
43 is compared to TestSignature. If the signatures match, then a pointer
44 to the pointer to a data structure ISCSI_FORM_CALLBACK_INFO is returned.
45 If the signatures do not match, then DebugAssert() is called with a description
46 of "CR has a bad signature" and Callback is returned.
47
48 If the data type ISCSI_FORM_CALLBACK_INFO_SIGNATURE does not contain the field
49 specified by Callback, then the module will not compile.
50
51 If ISCSI_FORM_CALLBACK_INFO_SIGNATURE does not contain a field called Signature,
52 then the module will not compile.
53
54 @param Callback Pointer to the specified field within the data
55 structure ISCSI_FORM_CALLBACK_INFO.
56 @return A pointer to the pointer to a data structure ISCSI_FORM_CALLBACK_INFO.
57 @retval Others Some unexpected error happened.
58 **/
59
60 #define ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK(Callback) \
61 CR ( \
62 Callback, \
63 ISCSI_FORM_CALLBACK_INFO, \
64 ConfigAccess, \
65 ISCSI_FORM_CALLBACK_INFO_SIGNATURE \
66 )
67
68 #pragma pack(1)
69
70 typedef struct _ISCSI_MAC_INFO {
71 EFI_MAC_ADDRESS Mac;
72 UINT8 Len;
73 } ISCSI_MAC_INFO;
74
75 typedef struct _ISCSI_DEVICE_LIST {
76 UINT8 NumDevice;
77 ISCSI_MAC_INFO MacInfo[1];
78 } ISCSI_DEVICE_LIST;
79
80 #pragma pack()
81
82 typedef struct _ISCSI_CONFIG_FORM_ENTRY {
83 LIST_ENTRY Link;
84 EFI_HANDLE Controller;
85 CHAR16 MacString[95];
86 EFI_STRING_ID PortTitleToken;
87 EFI_STRING_ID PortTitleHelpToken;
88
89 ISCSI_SESSION_CONFIG_NVDATA SessionConfigData;
90 ISCSI_CHAP_AUTH_CONFIG_NVDATA AuthConfigData;
91 } ISCSI_CONFIG_FORM_ENTRY;
92
93 typedef struct _ISCSI_FORM_CALLBACK_INFO {
94 UINTN Signature;
95 EFI_HANDLE DriverHandle;
96 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
97 EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
98 EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
99 UINT16 *KeyList;
100 VOID *FormBuffer;
101 EFI_HII_HANDLE RegisteredHandle;
102 ISCSI_CONFIG_FORM_ENTRY *Current;
103 } ISCSI_FORM_CALLBACK_INFO;
104
105 #pragma pack(1)
106
107 ///
108 /// HII specific Vendor Device Path definition.
109 ///
110 typedef struct {
111 VENDOR_DEVICE_PATH VendorDevicePath;
112 EFI_DEVICE_PATH_PROTOCOL End;
113 } HII_VENDOR_DEVICE_PATH;
114
115 #pragma pack()
116
117 /**
118 Updates the iSCSI configuration form to add/delete an entry for the iSCSI
119 device specified by the Controller.
120
121 @param[in] DriverBindingHandle The driverbinding handle.
122 @param[in] Controller The controller handle of the iSCSI device.
123 @param[in] AddForm Whether to add or delete a form entry.
124
125 @retval EFI_SUCCESS The iSCSI configuration form is updated.
126 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
127 @retval Others Other errors as indicated.
128 **/
129 EFI_STATUS
130 IScsiConfigUpdateForm (
131 IN EFI_HANDLE DriverBindingHandle,
132 IN EFI_HANDLE Controller,
133 IN BOOLEAN AddForm
134 );
135
136 /**
137 Initialize the iSCSI configuration form.
138
139 @param[in] DriverBindingHandle The iSCSI driverbinding handle.
140
141 @retval EFI_SUCCESS The iSCSI configuration form is initialized.
142 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
143 @retval Others Other errors as indicated.
144 **/
145 EFI_STATUS
146 IScsiConfigFormInit (
147 VOID
148 );
149
150 /**
151 Unload the iSCSI configuration form, this includes: delete all the iSCSI
152 device configuration entries, uninstall the form callback protocol and
153 free the resources used.
154
155 @param[in] DriverBindingHandle The iSCSI driverbinding handle.
156
157 @retval EFI_SUCCESS The iSCSI configuration form is unloaded.
158 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
159 **/
160 EFI_STATUS
161 IScsiConfigFormUnload (
162 IN EFI_HANDLE DriverBindingHandle
163 );
164
165 #endif