]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h
e89d2d4914b30e9266401acaa270f3850991ea4e
[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 <Protocol/HiiConfigRouting.h>
19 #include <Library/HiiLib.h>
20 #include <Library/ExtendedHiiLib.h>
21 #include <Library/IfrSupportLib.h>
22 #include <Library/ExtendedIfrSupportLib.h>
23 #include <Library/DebugLib.h>
24 #include <Library/BaseLib.h>
25 #include <Library/NetLib.h>
26
27 extern UINT8 IScsiConfigDxeBin[];
28 extern UINT8 IScsiDxeStrings[];
29
30 #define ISCSI_INITATOR_NAME_VAR_NAME L"I_NAME"
31
32 #define ISCSI_CONFIG_VAR_ATTR (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE)
33
34 #define ISCSI_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'f', 'c', 'i')
35
36
37
38 /**
39 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear,
40 then this macro return a pointer to a data structure ISCSI_FORM_CALLBACK_INFO.
41
42 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
43 The Signature field of the data structure ISCSI_FORM_CALLBACK_INFO
44 is compared to TestSignature. If the signatures match, then a pointer
45 to the pointer to a data structure ISCSI_FORM_CALLBACK_INFO is returned.
46 If the signatures do not match, then DebugAssert() is called with a description
47 of "CR has a bad signature" and Callback is returned.
48
49 If the data type ISCSI_FORM_CALLBACK_INFO_SIGNATURE does not contain the field
50 specified by Callback, then the module will not compile.
51
52 If ISCSI_FORM_CALLBACK_INFO_SIGNATURE does not contain a field called Signature,
53 then the module will not compile.
54
55 @param Callback Pointer to the specified field within the data
56 structure ISCSI_FORM_CALLBACK_INFO.
57 @return A pointer to the pointer to a data structure ISCSI_FORM_CALLBACK_INFO.
58 @retval Others Some unexpected error happened.
59 **/
60
61 #define ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK(Callback) \
62 CR ( \
63 Callback, \
64 ISCSI_FORM_CALLBACK_INFO, \
65 ConfigAccess, \
66 ISCSI_FORM_CALLBACK_INFO_SIGNATURE \
67 )
68
69 #pragma pack(1)
70
71 typedef struct _ISCSI_MAC_INFO {
72 EFI_MAC_ADDRESS Mac;
73 UINT8 Len;
74 } ISCSI_MAC_INFO;
75
76 typedef struct _ISCSI_DEVICE_LIST {
77 UINT8 NumDevice;
78 ISCSI_MAC_INFO MacInfo[1];
79 } ISCSI_DEVICE_LIST;
80
81 #pragma pack()
82
83 typedef struct _ISCSI_CONFIG_FORM_ENTRY {
84 LIST_ENTRY Link;
85 EFI_HANDLE Controller;
86 CHAR16 MacString[95];
87 EFI_STRING_ID PortTitleToken;
88 EFI_STRING_ID PortTitleHelpToken;
89
90 ISCSI_SESSION_CONFIG_NVDATA SessionConfigData;
91 ISCSI_CHAP_AUTH_CONFIG_NVDATA AuthConfigData;
92 } ISCSI_CONFIG_FORM_ENTRY;
93
94 typedef struct _ISCSI_FORM_CALLBACK_INFO {
95 UINTN Signature;
96 EFI_HANDLE DriverHandle;
97 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
98 EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
99 EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
100 UINT16 *KeyList;
101 VOID *FormBuffer;
102 EFI_HII_HANDLE RegisteredHandle;
103 ISCSI_CONFIG_FORM_ENTRY *Current;
104 } ISCSI_FORM_CALLBACK_INFO;
105
106 /**
107 Updates the iSCSI configuration form to add/delete an entry for the iSCSI
108 device specified by the Controller.
109
110 @param[in] DriverBindingHandle The driverbinding handle.
111 @param[in] Controller The controller handle of the iSCSI device.
112 @param[in] AddForm Whether to add or delete a form entry.
113
114 @retval EFI_SUCCESS The iSCSI configuration form is updated.
115 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
116 @retval Others Other errors as indicated.
117 **/
118 EFI_STATUS
119 IScsiConfigUpdateForm (
120 IN EFI_HANDLE DriverBindingHandle,
121 IN EFI_HANDLE Controller,
122 IN BOOLEAN AddForm
123 );
124
125 /**
126 Initialize the iSCSI configuration form.
127
128 @param[in] DriverBindingHandle The iSCSI driverbinding handle.
129
130 @retval EFI_SUCCESS The iSCSI configuration form is initialized.
131 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
132 @retval Others Other errors as indicated.
133 **/
134 EFI_STATUS
135 IScsiConfigFormInit (
136 VOID
137 );
138
139 /**
140 Unload the iSCSI configuration form, this includes: delete all the iSCSI
141 device configuration entries, uninstall the form callback protocol and
142 free the resources used.
143
144 @param[in] DriverBindingHandle The iSCSI driverbinding handle.
145
146 @retval EFI_SUCCESS The iSCSI configuration form is unloaded.
147 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
148 **/
149 EFI_STATUS
150 IScsiConfigFormUnload (
151 IN EFI_HANDLE DriverBindingHandle
152 );
153
154 #endif