IScsiConfig.h revision 6c7a807a54b14827a6510baa5edfdbe8b5f1f085
1/** @file
2  The header file of IScsiConfig.c
3
4Copyright (c) 2004 - 2008, Intel Corporation
5All rights reserved. This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution.  The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13Module Name:
14
15  IScsiConfig.h
16
17Abstract:
18
19  The header file of IScsiConfig.c
20
21**/
22
23#ifndef _ISCSI_CONFIG_H_
24#define _ISCSI_CONFIG_H_
25
26#include <Library/HiiLib.h>
27#include <Library/ExtendedHiiLib.h>
28#include <Library/IfrSupportLib.h>
29#include <Library/ExtendedIfrSupportLib.h>
30#include <Library/DebugLib.h>
31#include <Library/BaseLib.h>
32#include <Library/NetLib.h>
33#include "IScsiConfigNVDataStruc.h"
34
35extern UINT8  IScsiConfigDxeBin[];
36extern UINT8  IScsiDxeStrings[];
37
38#define ISCSI_INITATOR_NAME_VAR_NAME        L"I_NAME"
39
40#define ISCSI_CONFIG_VAR_ATTR               (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE)
41
42#define ISCSI_FORM_CALLBACK_INFO_SIGNATURE  EFI_SIGNATURE_32 ('I', 'f', 'c', 'i')
43
44#define ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK(Callback) \
45  CR ( \
46  Callback, \
47  ISCSI_FORM_CALLBACK_INFO, \
48  ConfigAccess, \
49  ISCSI_FORM_CALLBACK_INFO_SIGNATURE \
50  )
51
52#pragma pack(1)
53
54typedef struct _ISCSI_MAC_INFO {
55  EFI_MAC_ADDRESS Mac;
56  UINT8           Len;
57} ISCSI_MAC_INFO;
58
59typedef struct _ISCSI_DEVICE_LIST {
60  UINT8           NumDevice;
61  ISCSI_MAC_INFO  MacInfo[1];
62} ISCSI_DEVICE_LIST;
63
64#pragma pack()
65
66typedef struct _ISCSI_CONFIG_FORM_ENTRY {
67  LIST_ENTRY                    Link;
68  EFI_HANDLE                    Controller;
69  CHAR16                        MacString[95];
70  EFI_STRING_ID                 PortTitleToken;
71  EFI_STRING_ID                 PortTitleHelpToken;
72
73  ISCSI_SESSION_CONFIG_NVDATA   SessionConfigData;
74  ISCSI_CHAP_AUTH_CONFIG_NVDATA AuthConfigData;
75} ISCSI_CONFIG_FORM_ENTRY;
76
77typedef struct _ISCSI_FORM_CALLBACK_INFO {
78  UINTN                            Signature;
79  EFI_HANDLE                       DriverHandle;
80  EFI_HII_CONFIG_ACCESS_PROTOCOL   ConfigAccess;
81  EFI_HII_DATABASE_PROTOCOL        *HiiDatabase;
82  EFI_HII_CONFIG_ROUTING_PROTOCOL  *ConfigRouting;
83  UINT16                           *KeyList;
84  VOID                             *FormBuffer;
85  EFI_HII_HANDLE                   RegisteredHandle;
86  ISCSI_CONFIG_FORM_ENTRY          *Current;
87} ISCSI_FORM_CALLBACK_INFO;
88
89/**
90  Updates the iSCSI configuration form to add/delete an entry for the iSCSI
91  device specified by the Controller.
92
93  @param  DriverBindingHandle[in] The driverbinding handle.
94
95  @param  Controller[in]          The controller handle of the iSCSI device.
96
97  @param  AddForm[in]             Whether to add or delete a form entry.
98
99  @retval EFI_SUCCESS             The iSCSI configuration form is updated.
100
101  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.
102
103**/
104EFI_STATUS
105IScsiConfigUpdateForm (
106  IN EFI_HANDLE  DriverBindingHandle,
107  IN EFI_HANDLE  Controller,
108  IN BOOLEAN     AddForm
109  );
110
111/**
112  Initialize the iSCSI configuration form.
113
114  @param  DriverBindingHandle[in] The iSCSI driverbinding handle.
115
116  @retval EFI_SUCCESS             The iSCSI configuration form is initialized.
117
118  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.
119
120**/
121EFI_STATUS
122IScsiConfigFormInit (
123  IN EFI_HANDLE  DriverBindingHandle
124  );
125
126/**
127  Unload the iSCSI configuration form, this includes: delete all the iSCSI
128  device configuration entries, uninstall the form callback protocol and
129  free the resources used.
130
131  @param  DriverBindingHandle[in] The iSCSI driverbinding handle.
132
133  @retval EFI_SUCCESS             The iSCSI configuration form is unloaded.
134
135  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.
136
137**/
138EFI_STATUS
139IScsiConfigFormUnload (
140  IN EFI_HANDLE  DriverBindingHandle
141  );
142
143#endif
144