[Description]
change the old code style to comply with Doxgen format [Impaction] add comments for every function [Reference Info] add comments to achieve the highest standard of code quality matrix git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5079 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d16fc3dbb3
commit
12618416ec
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
UEFI Component Name(2) protocol implementation.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -17,7 +18,7 @@ Abstract:
|
||||
|
||||
ComponentName protocol for iSCSI.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
|
||||
@ -40,10 +41,48 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentNam
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIScsiDriverNameTable[] = {
|
||||
{"eng;en", L"iSCSI Driver"},
|
||||
{NULL, NULL}
|
||||
{"eng;en", L"iSCSI Driver"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL
|
||||
instance.
|
||||
|
||||
@param Language[in] A pointer to a three character ISO 639-2 language
|
||||
identifier.
|
||||
This is the language of the driver name that that
|
||||
the caller is requesting, and it must match one of
|
||||
the languages specified in SupportedLanguages.
|
||||
The number of languages supported by a driver is up
|
||||
to the driver writer.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiComponentNameGetDriverName (
|
||||
@ -51,32 +90,6 @@ IScsiComponentNameGetDriverName (
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
DriverName - A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
@ -87,6 +100,55 @@ IScsiComponentNameGetDriverName (
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
|
||||
@param Language[in] A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language
|
||||
specified by Language from the point of view of the
|
||||
driver specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently managing
|
||||
the controller specified by ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiComponentNameGetControllerName (
|
||||
@ -96,51 +158,6 @@ IScsiComponentNameGetControllerName (
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
ControllerName - A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language
|
||||
specified by Language from the point of view of the
|
||||
driver specified by This.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
Challenge-Handshake Authentication Protocol (CHAP) Configuration
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -15,7 +16,9 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
This file is for CHAP configuration
|
||||
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
#include "Md5.h"
|
||||
@ -92,30 +95,26 @@ IScsiCHAPAuthTarget (
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
This function checks the received iSCSI Login Response during the security
|
||||
negotiation stage.
|
||||
|
||||
@param Conn[in] The iSCSI connection.
|
||||
|
||||
@param Transit[in] The transit flag of the latest iSCSI Login Response.
|
||||
|
||||
@retval EFI_SUCCESS The Login Response passed the CHAP validation.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiCHAPOnRspReceived (
|
||||
IN ISCSI_CONNECTION *Conn,
|
||||
IN BOOLEAN Transit
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function checks the received iSCSI Login Response during the security
|
||||
negotiation stage.
|
||||
|
||||
Arguments:
|
||||
|
||||
Conn - The iSCSI connection.
|
||||
Transit - The transit flag of the latest iSCSI Login Response.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The Login Response passed the CHAP validation.
|
||||
EFI_OUT_OF_RESOURCES - Failed to allocate memory.
|
||||
EFI_PROTOCOL_ERROR - Some kind of protocol error happend.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ISCSI_SESSION *Session;
|
||||
@ -288,31 +287,27 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
This function fills the CHAP authentication information into the login PDU
|
||||
during the security negotiation stage in the iSCSI connection login.
|
||||
|
||||
@param Conn[in] The iSCSI connection.
|
||||
|
||||
@param Pdu[in] The PDU to send out.
|
||||
|
||||
@retval EFI_SUCCESS All check passed and the phase-related CHAP
|
||||
authentication info is filled into the iSCSI PDU.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiCHAPToSendReq (
|
||||
IN ISCSI_CONNECTION *Conn,
|
||||
IN NET_BUF *Pdu
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function fills the CHAP authentication information into the login PDU
|
||||
during the security negotiation stage in the iSCSI connection login.
|
||||
|
||||
Arguments:
|
||||
|
||||
Conn - The iSCSI connection.
|
||||
Pdu - The PDU to send out.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - All check passed and the phase-related CHAP authentication
|
||||
info is filled into the iSCSI PDU.
|
||||
EFI_OUT_OF_RESOURCES - Failed to allocate memory.
|
||||
EFI_PROTOCOL_ERROR - Some kind of protocol error happend.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ISCSI_SESSION *Session;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
The header file of CHAP configuration
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -14,8 +15,8 @@ Module Name:
|
||||
IScsiCHAP.h
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
the header file for CHAP
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_CHAP_H_
|
||||
#define _ISCSI_CHAP_H_
|
||||
@ -80,12 +81,43 @@ typedef struct _ISCSI_CHAP_AUTH_DATA {
|
||||
UINT32 OutChallengeLength;
|
||||
} ISCSI_CHAP_AUTH_DATA;
|
||||
|
||||
/**
|
||||
This function checks the received iSCSI Login Response during the security
|
||||
negotiation stage.
|
||||
|
||||
@param Conn[in] The iSCSI connection.
|
||||
|
||||
@param Transit[in] The transit flag of the latest iSCSI Login Response.
|
||||
|
||||
@retval EFI_SUCCESS The Login Response passed the CHAP validation.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiCHAPOnRspReceived (
|
||||
IN ISCSI_CONNECTION *Conn,
|
||||
IN BOOLEAN Transit
|
||||
);
|
||||
|
||||
/**
|
||||
This function fills the CHAP authentication information into the login PDU
|
||||
during the security negotiation stage in the iSCSI connection login.
|
||||
|
||||
@param Conn[in] The iSCSI connection.
|
||||
|
||||
@param Pdu[in] The PDU to send out.
|
||||
|
||||
@retval EFI_SUCCESS All check passed and the phase-related CHAP
|
||||
authentication info is filled into the iSCSI PDU.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of protocol error happend.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiCHAPToSendReq (
|
||||
IN ISCSI_CONNECTION *Conn,
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
The common header file of Iscsi
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -15,7 +16,9 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
The common header file of Iscsi
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_COMMON_H_
|
||||
#define _ISCSI_COMMON_H_
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
Helper functions for configuring or getting the parameters relating to ISCSI
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -15,7 +16,9 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
Helper functions for configuring or getting the parameters relating to ISCSI
|
||||
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
|
||||
@ -29,76 +32,56 @@ LIST_ENTRY mIScsiConfigFormList = {
|
||||
&mIScsiConfigFormList
|
||||
};
|
||||
|
||||
/**
|
||||
Convert the IPv4 address into a dotted string.
|
||||
|
||||
@param Ip[in] The IPv4 address.
|
||||
|
||||
@param Str[out] The dotted IP string.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
IScsiIpToStr (
|
||||
IN EFI_IPv4_ADDRESS *Ip,
|
||||
OUT CHAR16 *Str
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the IPv4 address into a dotted string.
|
||||
|
||||
Arguments:
|
||||
|
||||
Ip - The IPv4 address.
|
||||
Str - The dotted IP string.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UnicodeSPrint ( Str, 2 * IP4_STR_MAX_SIZE, L"%d.%d.%d.%d", Ip->Addr[0], Ip->Addr[1], Ip->Addr[2], Ip->Addr[3]);
|
||||
}
|
||||
|
||||
/**
|
||||
Pop up an invalid notify which displays the message in Warning.
|
||||
|
||||
@param Warning[in] The warning message.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
PopUpInvalidNotify (
|
||||
IN CHAR16 *Warning
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Pop up an invalid notify which displays the message in Warning.
|
||||
|
||||
Arguments:
|
||||
|
||||
Warning - The warning message.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_INPUT_KEY Key;
|
||||
|
||||
IfrLibCreatePopUp (1, &Key, Warning);
|
||||
}
|
||||
|
||||
/**
|
||||
Update the list of iSCSI devices the iSCSI driver is controlling.
|
||||
|
||||
@param None.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiUpdateDeviceList (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Update the list of iSCSI devices the iSCSI driver is controlling.
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ISCSI_DEVICE_LIST *DeviceList;
|
||||
@ -226,26 +209,19 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the iSCSI configuration form entry by the index of the goto opcode actived.
|
||||
|
||||
@param Index[in] The 0-based index of the goto opcode actived.
|
||||
|
||||
@retval The iSCSI configuration form entry found.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
ISCSI_CONFIG_FORM_ENTRY *
|
||||
IScsiGetConfigFormEntryByIndex (
|
||||
IN UINT32 Index
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get the iSCSI configuration form entry by the index of the goto opcode actived.
|
||||
|
||||
Arguments:
|
||||
|
||||
Index - The 0-based index of the goto opcode actived.
|
||||
|
||||
Returns:
|
||||
|
||||
The iSCSI configuration form entry found.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT32 CurrentIndex;
|
||||
LIST_ENTRY *Entry;
|
||||
@ -266,28 +242,22 @@ Returns:
|
||||
return ConfigFormEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the iSCSI configuration data into the IFR data.
|
||||
|
||||
@param ConfigFormEntry[in] The iSCSI configuration form entry.
|
||||
|
||||
@param IfrNvData[in] The IFR nv data.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
IScsiConvertDeviceConfigDataToIfrNvData (
|
||||
IN ISCSI_CONFIG_FORM_ENTRY *ConfigFormEntry,
|
||||
IN ISCSI_CONFIG_IFR_NVDATA *IfrNvData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the iSCSI configuration data into the IFR data.
|
||||
|
||||
Arguments:
|
||||
|
||||
ConfigFormEntry - The iSCSI configuration form entry.
|
||||
IfrNvData - The IFR nv data.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
ISCSI_SESSION_CONFIG_NVDATA *SessionConfigData;
|
||||
ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfigData;
|
||||
@ -324,7 +294,33 @@ Returns:
|
||||
IScsiAsciiStrToUnicodeStr (AuthConfigData->ReverseCHAPSecret, IfrNvData->ReverseCHAPSecret);
|
||||
}
|
||||
|
||||
/**
|
||||
This function allows a caller to extract the current configuration for one
|
||||
or more named elements from the target driver.
|
||||
|
||||
@param This[in] Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
|
||||
@param Request[in] A null-terminated Unicode string in <ConfigRequest> format.
|
||||
|
||||
@param Progress[out] On return, points to a character in the Request string.
|
||||
Points to the string's null terminator if request was successful.
|
||||
Points to the most recent '&' before the first failing name/value
|
||||
pair (or the beginning of the string if the failure is in the
|
||||
first name/value pair) if the request was not successful.
|
||||
|
||||
@param Results[out] A null-terminated Unicode string in <ConfigAltResp> format which
|
||||
has all values filled in for the names in the Request string.
|
||||
String to be allocated by the called function.
|
||||
|
||||
@retval EFI_SUCCESS The Results is filled with the requested values.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
|
||||
|
||||
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiFormExtractConfig (
|
||||
@ -333,31 +329,6 @@ IScsiFormExtractConfig (
|
||||
OUT EFI_STRING *Progress,
|
||||
OUT EFI_STRING *Results
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function allows a caller to extract the current configuration for one
|
||||
or more named elements from the target driver.
|
||||
|
||||
Arguments:
|
||||
This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
Request - A null-terminated Unicode string in <ConfigRequest> format.
|
||||
Progress - On return, points to a character in the Request string.
|
||||
Points to the string's null terminator if request was successful.
|
||||
Points to the most recent '&' before the first failing name/value
|
||||
pair (or the beginning of the string if the failure is in the
|
||||
first name/value pair) if the request was not successful.
|
||||
Results - A null-terminated Unicode string in <ConfigAltResp> format which
|
||||
has all values filled in for the names in the Request string.
|
||||
String to be allocated by the called function.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Results is filled with the requested values.
|
||||
EFI_OUT_OF_RESOURCES - Not enough memory to store the results.
|
||||
EFI_INVALID_PARAMETER - Request is NULL, illegal syntax, or unknown name.
|
||||
EFI_NOT_FOUND - Routing data doesn't match any storage in this driver.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR8 InitiatorName[ISCSI_NAME_IFR_MAX_SIZE];
|
||||
@ -406,6 +377,25 @@ IScsiFormExtractConfig (
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
This function processes the results of changes in configuration.
|
||||
|
||||
@param This[in] Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
|
||||
@param Configuration[in] A null-terminated Unicode string in <ConfigResp> format.
|
||||
|
||||
@param Progress[out] A pointer to a string filled in with the offset of the most
|
||||
recent '&' before the first failing name/value pair (or the
|
||||
beginning of the string if the failure is in the first
|
||||
name/value pair) or the terminating NULL if all was successful.
|
||||
|
||||
@retval EFI_SUCCESS The Results is processed successfully.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Configuration is NULL.
|
||||
|
||||
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiFormRouteConfig (
|
||||
@ -413,29 +403,35 @@ IScsiFormRouteConfig (
|
||||
IN CONST EFI_STRING Configuration,
|
||||
OUT EFI_STRING *Progress
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function processes the results of changes in configuration.
|
||||
|
||||
Arguments:
|
||||
This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
Configuration - A null-terminated Unicode string in <ConfigResp> format.
|
||||
Progress - A pointer to a string filled in with the offset of the most
|
||||
recent '&' before the first failing name/value pair (or the
|
||||
beginning of the string if the failure is in the first
|
||||
name/value pair) or the terminating NULL if all was successful.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Results is processed successfully.
|
||||
EFI_INVALID_PARAMETER - Configuration is NULL.
|
||||
EFI_NOT_FOUND - Routing data doesn't match any storage in this driver.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
This function processes the results of changes in configuration.
|
||||
|
||||
@param This[in] Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
|
||||
@param Action[in] Specifies the type of action taken by the browser.
|
||||
|
||||
@param QuestionId[in] A unique value which is sent to the original exporting driver
|
||||
so that it can identify the type of data to expect.
|
||||
|
||||
@param Type[in] The type of value for the question.
|
||||
|
||||
@param Value[in] A pointer to the data being sent to the original exporting driver.
|
||||
|
||||
@param ActionRequest[out] On return, points to the action requested by the callback function.
|
||||
|
||||
@retval EFI_SUCCESS The callback successfully handled the action.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
|
||||
|
||||
@retval EFI_DEVICE_ERROR The variable could not be saved.
|
||||
|
||||
@retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiFormCallback (
|
||||
@ -446,27 +442,6 @@ IScsiFormCallback (
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function processes the results of changes in configuration.
|
||||
|
||||
Arguments:
|
||||
This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
||||
Action - Specifies the type of action taken by the browser.
|
||||
QuestionId - A unique value which is sent to the original exporting driver
|
||||
so that it can identify the type of data to expect.
|
||||
Type - The type of value for the question.
|
||||
Value - A pointer to the data being sent to the original exporting driver.
|
||||
ActionRequest - On return, points to the action requested by the callback function.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The callback successfully handled the action.
|
||||
EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.
|
||||
EFI_DEVICE_ERROR - The variable could not be saved.
|
||||
EFI_UNSUPPORTED - The specified Action is not supported by the callback.
|
||||
|
||||
--*/
|
||||
{
|
||||
ISCSI_FORM_CALLBACK_INFO *Private;
|
||||
UINTN BufferSize;
|
||||
@ -722,32 +697,27 @@ IScsiFormCallback (
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Updates the iSCSI configuration form to add/delete an entry for the iSCSI
|
||||
device specified by the Controller.
|
||||
|
||||
@param DriverBindingHandle[in] The driverbinding handle.
|
||||
|
||||
@param Controller[in] The controller handle of the iSCSI device.
|
||||
|
||||
@param AddForm[in] Whether to add or delete a form entry.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI configuration form is updated.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiConfigUpdateForm (
|
||||
IN EFI_HANDLE DriverBindingHandle,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN BOOLEAN AddForm
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Updates the iSCSI configuration form to add/delete an entry for the iSCSI
|
||||
device specified by the Controller.
|
||||
|
||||
Arguments:
|
||||
|
||||
DriverBindingHandle - The driverbinding handle.
|
||||
Controller - The controller handle of the iSCSI device.
|
||||
AddForm - Whether to add or delete a form entry.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The iSCSI configuration form is updated.
|
||||
EFI_OUT_OF_RESOURCES - Failed to allocate memory.
|
||||
|
||||
--*/
|
||||
{
|
||||
LIST_ENTRY *Entry;
|
||||
ISCSI_CONFIG_FORM_ENTRY *ConfigFormEntry;
|
||||
@ -887,26 +857,20 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the iSCSI configuration form.
|
||||
|
||||
@param DriverBindingHandle[in] The iSCSI driverbinding handle.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI configuration form is initialized.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiConfigFormInit (
|
||||
IN EFI_HANDLE DriverBindingHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the iSCSI configuration form.
|
||||
|
||||
Arguments:
|
||||
|
||||
DriverBindingHandle - The iSCSI driverbinding handle.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The iSCSI configuration form is initialized.
|
||||
EFI_OUT_OF_RESOURCES - Failed to allocate memory.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||
@ -980,28 +944,22 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
IScsiConfigFormUnload (
|
||||
IN EFI_HANDLE DriverBindingHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
/**
|
||||
Unload the iSCSI configuration form, this includes: delete all the iSCSI
|
||||
device configuration entries, uninstall the form callback protocol and
|
||||
free the resources used.
|
||||
|
||||
Arguments:
|
||||
@param DriverBindingHandle[in] The iSCSI driverbinding handle.
|
||||
|
||||
DriverBindingHandle - The iSCSI driverbinding handle.
|
||||
@retval EFI_SUCCESS The iSCSI configuration form is unloaded.
|
||||
|
||||
Returns:
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
EFI_SUCCESS - The iSCSI configuration form is unloaded.
|
||||
EFI_OUT_OF_RESOURCES - Failed to allocate memory.
|
||||
|
||||
--*/
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiConfigFormUnload (
|
||||
IN EFI_HANDLE DriverBindingHandle
|
||||
)
|
||||
{
|
||||
ISCSI_CONFIG_FORM_ENTRY *ConfigFormEntry;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
The header file of IScsiConfig.c
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -15,8 +16,9 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
The header file of IScsiConfig.c
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_CONFIG_H_
|
||||
#define _ISCSI_CONFIG_H_
|
||||
@ -84,6 +86,21 @@ typedef struct _ISCSI_FORM_CALLBACK_INFO {
|
||||
ISCSI_CONFIG_FORM_ENTRY *Current;
|
||||
} ISCSI_FORM_CALLBACK_INFO;
|
||||
|
||||
/**
|
||||
Updates the iSCSI configuration form to add/delete an entry for the iSCSI
|
||||
device specified by the Controller.
|
||||
|
||||
@param DriverBindingHandle[in] The driverbinding handle.
|
||||
|
||||
@param Controller[in] The controller handle of the iSCSI device.
|
||||
|
||||
@param AddForm[in] Whether to add or delete a form entry.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI configuration form is updated.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiConfigUpdateForm (
|
||||
IN EFI_HANDLE DriverBindingHandle,
|
||||
@ -91,11 +108,33 @@ IScsiConfigUpdateForm (
|
||||
IN BOOLEAN AddForm
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the iSCSI configuration form.
|
||||
|
||||
@param DriverBindingHandle[in] The iSCSI driverbinding handle.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI configuration form is initialized.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiConfigFormInit (
|
||||
IN EFI_HANDLE DriverBindingHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Unload the iSCSI configuration form, this includes: delete all the iSCSI
|
||||
device configuration entries, uninstall the form callback protocol and
|
||||
free the resources used.
|
||||
|
||||
@param DriverBindingHandle[in] The iSCSI driverbinding handle.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI configuration form is unloaded.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiConfigFormUnload (
|
||||
IN EFI_HANDLE DriverBindingHandle
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
Define NVData structures used by the iSCSI configuration component
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -17,7 +18,7 @@ Abstract:
|
||||
|
||||
NVData structure used by the iSCSI configuration component.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_NVDATASTRUC_H_
|
||||
#define _ISCSI_NVDATASTRUC_H_
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/**
|
||||
ISci DHCP related configuration routines.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -15,12 +16,30 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
iSCSI DHCP related configuration routines.
|
||||
IScsi DHCP related configuration routines.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
|
||||
/**
|
||||
Extract the Root Path option and get the required target information.
|
||||
|
||||
@param RootPath[in] The RootPath.
|
||||
|
||||
@param Length[in] Length of the RootPath option payload.
|
||||
|
||||
@param ConfigNvData[in] The iSCSI session configuration data read from nonvolatile device.
|
||||
|
||||
@retval EFI_SUCCESS All required information is extracted from the RootPath option.
|
||||
|
||||
@retval EFI_NOT_FOUND The RootPath is not an iSCSI RootPath.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The RootPath is mal-formatted.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
IScsiDhcpExtractRootPath (
|
||||
@ -28,26 +47,6 @@ IScsiDhcpExtractRootPath (
|
||||
IN UINT8 Length,
|
||||
IN ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Extract the Root Path option and get the required target information.
|
||||
|
||||
Arguments:
|
||||
|
||||
RootPath - The RootPath.
|
||||
Length - Length of the RootPath option payload.
|
||||
ConfigNvData - The iSCSI session configuration data read from nonvolatile device.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - All required information is extracted from the RootPath option.
|
||||
EFI_NOT_FOUND - The RootPath is not an iSCSI RootPath.
|
||||
EFI_OUT_OF_RESOURCES - Failed to allocate memory.
|
||||
EFI_INVALID_PARAMETER - The RootPath is mal-formatted.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 IScsiRootPathIdLen;
|
||||
@ -183,6 +182,28 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
The callback function registerd to the DHCP4 instance which is used to select
|
||||
the qualified DHCP OFFER.
|
||||
|
||||
@param This[in] The DHCP4 protocol.
|
||||
|
||||
@param Context[in] The context set when configuring the DHCP4 protocol.
|
||||
|
||||
@param CurrentState[in] The current state of the DHCP4 protocol.
|
||||
|
||||
@param Dhcp4Event[in] The event occurs in the current state.
|
||||
|
||||
@param Packet[in] The DHCP packet that is to be sent or already received.
|
||||
|
||||
@param NewPackt[out] The packet used to replace the above Packet.
|
||||
|
||||
@retval EFI_NOT_READY The DHCP OFFER packet doesn't match our requirements.
|
||||
|
||||
@retval EFI_SUCCESS Either the DHCP OFFER is qualified or we're not intereseted
|
||||
in the Dhcp4Event.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
IScsiDhcpSelectOffer (
|
||||
@ -193,29 +214,6 @@ IScsiDhcpSelectOffer (
|
||||
IN EFI_DHCP4_PACKET * Packet, OPTIONAL
|
||||
OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
The callback function registerd to the DHCP4 instance which is used to select
|
||||
the qualified DHCP OFFER.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - The DHCP4 protocol.
|
||||
Context - The context set when configuring the DHCP4 protocol.
|
||||
CurrentState - The current state of the DHCP4 protocol.
|
||||
Dhcp4Event - The event occurs in the current state.
|
||||
Packet - The DHCP packet that is to be sent or already received.
|
||||
NewPackt - The packet used to replace the above Packet.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_NOT_READY - The DHCP OFFER packet doesn't match our requirements.
|
||||
EFI_SUCCESS - Either the DHCP OFFER is qualified or we're not intereseted
|
||||
in the Dhcp4Event.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 OptionCount;
|
||||
@ -267,30 +265,27 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Parse the DHCP ACK to get the address configuration and DNS information.
|
||||
|
||||
@param Dhcp4[in] The DHCP4 protocol.
|
||||
|
||||
@param ConfigData[in] The session configuration data.
|
||||
|
||||
@retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
|
||||
|
||||
@retval EFI_NO_MAPPING DHCP failed to acquire address and other information.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The DHCP ACK's DNS option is mal-formatted.
|
||||
|
||||
@retval EFI_DEVICE_ERROR Some unexpected error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiParseDhcpAck (
|
||||
IN EFI_DHCP4_PROTOCOL *Dhcp4,
|
||||
IN ISCSI_SESSION_CONFIG_DATA *ConfigData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Parse the DHCP ACK to get the address configuration and DNS information.
|
||||
|
||||
Arguments:
|
||||
|
||||
Dhcp4 - The DHCP4 protocol.
|
||||
ConfigData - The session configuration data.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The DNS information is got from the DHCP ACK.
|
||||
EFI_NO_MAPPING - DHCP failed to acquire address and other information.
|
||||
EFI_INVALID_PARAMETER - The DHCP ACK's DNS option is mal-formatted.
|
||||
EFI_DEVICE_ERROR - Some unexpected error happened.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DHCP4_MODE_DATA Dhcp4ModeData;
|
||||
@ -366,32 +361,30 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Parse the DHCP ACK to get the address configuration and DNS information.
|
||||
|
||||
@param Image[in] The handle of the driver image.
|
||||
|
||||
@param Controller[in] The handle of the controller;
|
||||
|
||||
@param ConfigData[in] The session configuration data.
|
||||
|
||||
@retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
|
||||
|
||||
@retval EFI_NO_MAPPING DHCP failed to acquire address and other information.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The DHCP ACK's DNS option is mal-formatted.
|
||||
|
||||
@retval EFI_DEVICE_ERROR Some unexpected error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiDoDhcp (
|
||||
IN EFI_HANDLE Image,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN ISCSI_SESSION_CONFIG_DATA *ConfigData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Parse the DHCP ACK to get the address configuration and DNS information.
|
||||
|
||||
Arguments:
|
||||
|
||||
Image - The handle of the driver image.
|
||||
Controller - The handle of the controller;
|
||||
ConfigData - The session configuration data.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The DNS information is got from the DHCP ACK.
|
||||
EFI_NO_MAPPING - DHCP failed to acquire address and other information.
|
||||
EFI_INVALID_PARAMETER - The DHCP ACK's DNS option is mal-formatted.
|
||||
EFI_DEVICE_ERROR - Some unexpected error happened.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HANDLE Dhcp4Handle;
|
||||
EFI_DHCP4_PROTOCOL *Dhcp4;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
Data structure for DHCP support
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -14,8 +15,9 @@ Module Name:
|
||||
IScsiDhcp.h
|
||||
|
||||
Abstract:
|
||||
The header file of IScsiDhcp.c
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_DHCP_H_
|
||||
#define _ISCSI_DHCP_H_
|
||||
@ -45,6 +47,24 @@ typedef struct _ISCSI_ROOT_PATH_FIELD {
|
||||
UINT8 Len;
|
||||
} ISCSI_ROOT_PATH_FIELD;
|
||||
|
||||
/**
|
||||
Parse the DHCP ACK to get the address configuration and DNS information.
|
||||
|
||||
@param Image[in] The handle of the driver image.
|
||||
|
||||
@param Controller[in] The handle of the controller;
|
||||
|
||||
@param ConfigData[in] The session configuration data.
|
||||
|
||||
@retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
|
||||
|
||||
@retval EFI_NO_MAPPING DHCP failed to acquire address and other information.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The DHCP ACK's DNS option is mal-formatted.
|
||||
|
||||
@retval EFI_DEVICE_ERROR Some unexpected error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiDoDhcp (
|
||||
IN EFI_HANDLE Image,
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
The entry point of IScsi driver
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -14,8 +15,9 @@ Module Name:
|
||||
IScsiDriver.c
|
||||
|
||||
Abstract:
|
||||
The entry point of IScsi driver
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
|
||||
@ -30,6 +32,22 @@ EFI_DRIVER_BINDING_PROTOCOL gIScsiDriverBinding = {
|
||||
|
||||
EFI_GUID mIScsiPrivateGuid = ISCSI_PRIVATE_GUID;
|
||||
|
||||
/**
|
||||
Test to see if IScsi driver supports the given controller.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param ControllerHandle[in] Handle of controller to test.
|
||||
|
||||
@param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
|
||||
|
||||
@retval EFI_SUCCES This driver supports the controller.
|
||||
|
||||
@retval EFI_ALREADY_STARTED This driver is already running on this device.
|
||||
|
||||
@retval EFI_UNSUPPORTED This driver doesn't support the controller.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiDriverBindingSupported (
|
||||
@ -37,25 +55,6 @@ IScsiDriverBindingSupported (
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Test to see if iSCSI driver supports the given controller.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Protocol instance pointer.
|
||||
ControllerHandle - Handle of controller to test.
|
||||
RemainingDevicePath - Optional parameter use to pick a specific child device to start.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCES - This driver supports the controller.
|
||||
EFI_ALREADY_STARTED - This driver is already running on this device.
|
||||
EFI_UNSUPPORTED - This driver doesn't support the controller.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath;
|
||||
@ -100,6 +99,20 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Start to manage the controller.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param ControllerHandle[in] Handle of the controller.
|
||||
|
||||
@param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
|
||||
|
||||
@retval EFI_SUCCES This driver supports this device.
|
||||
|
||||
@retval EFI_ALREADY_STARTED This driver is already running on this device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiDriverBindingStart (
|
||||
@ -107,24 +120,6 @@ IScsiDriverBindingStart (
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Start to manage the controller.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Protocol instance pointer.
|
||||
ControllerHandle - Handle of the controller.
|
||||
RemainingDevicePath - Optional parameter use to pick a specific child device to start.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCES - This driver supports this device.
|
||||
EFI_ALREADY_STARTED - This driver is already running on this device.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ISCSI_DRIVER_DATA *Private;
|
||||
@ -209,6 +204,20 @@ ON_ERROR:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Release the control of this controller and remove the IScsi functions.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param ControllerHandle[in] Handle of controller to stop.
|
||||
|
||||
@param NumberOfChildren[in] Not used.
|
||||
|
||||
@param ChildHandleBuffer[in] Not used.
|
||||
|
||||
@retval EFI_SUCCES This driver supports this device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiDriverBindingStop (
|
||||
@ -217,24 +226,6 @@ IScsiDriverBindingStop (
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Release the control of this controller and remove the iSCSI functions.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Protocol instance pointer.
|
||||
ControllerHandle - Handle of controller to stop.
|
||||
NumberOfChildren - Not used.
|
||||
ChildHandleBuffer - Not used.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCES - This driver supports this device.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HANDLE IScsiController;
|
||||
EFI_STATUS Status;
|
||||
@ -315,27 +306,21 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Unload the iSCSI driver.
|
||||
|
||||
@param ImageHandle[in] The handle of the driver image.
|
||||
|
||||
@retval EFI_SUCCESS The driver is unloaded.
|
||||
|
||||
@retval EFI_DEVICE_ERROR Some unexpected error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiIScsiUnload (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Unload the iSCSI driver.
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - The handle of the driver image.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The driver is unloaded.
|
||||
EFI_DEVICE_ERROR - Some unexpected error happened.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN DeviceHandleCount;
|
||||
@ -389,29 +374,24 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the global variables publish the driver binding protocol.
|
||||
|
||||
@param ImageHandle[in] The handle of the driver image.
|
||||
|
||||
@param SystemTable[in] The EFI system table.
|
||||
|
||||
@retval EFI_SUCCESS The protocols are installed.
|
||||
|
||||
@retval EFI_DEVICE_ERROR Some unexpected error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiDriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the global variables publish the driver binding protocol.
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - The handle of the driver image.
|
||||
SystemTable - The EFI system table.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The protocols are installed.
|
||||
EFI_DEVICE_ERROR - Some unexpected error happened.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_ISCSI_INITIATOR_NAME_PROTOCOL *IScsiInitiatorName;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
The header file of IScsiDriver.c
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -14,8 +15,9 @@ Module Name:
|
||||
IScsiDriver.h
|
||||
|
||||
Abstract:
|
||||
The header file of IScsiDriver.c
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_DRIVER_H_
|
||||
#define _ISCSI_DRIVER_H_
|
||||
@ -55,6 +57,22 @@ typedef struct _ISCSI_PRIVATE_PROTOCOL {
|
||||
//
|
||||
// EFI Driver Binding Protocol for iSCSI driver.
|
||||
//
|
||||
/**
|
||||
Test to see if IScsi driver supports the given controller.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param ControllerHandle[in] Handle of controller to test.
|
||||
|
||||
@param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
|
||||
|
||||
@retval EFI_SUCCES This driver supports the controller.
|
||||
|
||||
@retval EFI_ALREADY_STARTED This driver is already running on this device.
|
||||
|
||||
@retval EFI_UNSUPPORTED This driver doesn't support the controller.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiDriverBindingSupported (
|
||||
@ -63,6 +81,20 @@ IScsiDriverBindingSupported (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Start to manage the controller.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param ControllerHandle[in] Handle of the controller.
|
||||
|
||||
@param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
|
||||
|
||||
@retval EFI_SUCCES This driver supports this device.
|
||||
|
||||
@retval EFI_ALREADY_STARTED This driver is already running on this device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiDriverBindingStart (
|
||||
@ -71,6 +103,20 @@ IScsiDriverBindingStart (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Release the control of this controller and remove the IScsi functions.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param ControllerHandle[in] Handle of controller to stop.
|
||||
|
||||
@param NumberOfChildren[in] Not used.
|
||||
|
||||
@param ChildHandleBuffer[in] Not used.
|
||||
|
||||
@retval EFI_SUCCES This driver supports this device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiDriverBindingStop (
|
||||
@ -81,8 +127,46 @@ IScsiDriverBindingStop (
|
||||
);
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol for iSCSI driver.
|
||||
// EFI Component Name Protocol for IScsi driver.
|
||||
//
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL
|
||||
instance.
|
||||
|
||||
@param Language[in] A pointer to a three character ISO 639-2 language
|
||||
identifier.
|
||||
This is the language of the driver name that that
|
||||
the caller is requesting, and it must match one of
|
||||
the languages specified in SupportedLanguages.
|
||||
The number of languages supported by a driver is up
|
||||
to the driver writer.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiComponentNameGetDriverName (
|
||||
@ -91,6 +175,55 @@ IScsiComponentNameGetDriverName (
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
|
||||
@param Language[in] A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language
|
||||
specified by Language from the point of view of the
|
||||
driver specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently managing
|
||||
the controller specified by ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiComponentNameGetControllerName (
|
||||
@ -102,8 +235,35 @@ IScsiComponentNameGetControllerName (
|
||||
);
|
||||
|
||||
//
|
||||
// EFI iSCSI Initiator Name Protocol for iSCSI driver.
|
||||
// EFI IScsi Initiator Name Protocol for IScsi driver.
|
||||
//
|
||||
/**
|
||||
Retrieves the current set value of iSCSI Initiator Name.
|
||||
|
||||
@param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
|
||||
|
||||
@param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer / Actual
|
||||
size of the variable data buffer.
|
||||
|
||||
@param Buffer[out] Pointer to the buffer for data to be read.
|
||||
|
||||
@retval EFI_SUCCESS Data was successfully retrieved into the provided
|
||||
buffer and the BufferSize was sufficient to handle the
|
||||
iSCSI initiator name.
|
||||
@retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize will
|
||||
be updated with the size required to complete the request.
|
||||
Buffer will not be affected.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not be
|
||||
affected.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
|
||||
affected.
|
||||
|
||||
@retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved due to
|
||||
a hardware error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiGetInitiatorName (
|
||||
@ -112,6 +272,35 @@ IScsiGetInitiatorName (
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Sets the iSCSI Initiator Name.
|
||||
|
||||
@param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
|
||||
|
||||
@param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer.
|
||||
|
||||
@param Buffer[out] Pointer to the buffer for data to be written.
|
||||
|
||||
@retval EFI_SUCCESS Data was successfully stored by the protocol.
|
||||
|
||||
@retval EFI_UNSUPPORTED Platform policies do not allow for data to be written.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.
|
||||
BufferSize will be updated with the maximum size
|
||||
required to complete the request.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not be
|
||||
affected.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be affected.
|
||||
|
||||
@retval EFI_DEVICE_ERROR The data could not be stored due to a hardware error.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC 3720.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiSetInitiatorName (
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
The IScsi's EFI_EXT_SCSI_PASS_THRU_PROTOCOL driver
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -14,11 +15,29 @@ Module Name:
|
||||
IScsiExtScsiPassThru.c
|
||||
|
||||
Abstract:
|
||||
The IScsi's EFI_EXT_SCSI_PASS_THRU_PROTOCOL driver
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
|
||||
/**
|
||||
This function sends out the SCSI command via iSCSI transport layer and returned
|
||||
back the data received from the iSCSI target.
|
||||
|
||||
@param This[in] The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||
|
||||
@param Target[in] The Target ID of device to send the SCSI Request Packet.
|
||||
|
||||
@param Lun[in] The LUN of the device to send the SCSI Request Packet.
|
||||
|
||||
@param Packet[in][out] The SCSI Request Packet to send to the device.
|
||||
|
||||
@param Event[in] The event used in non-blocking mode, it should be always NULL.
|
||||
|
||||
@retval EFI_STATUS
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiExtScsiPassThruFunction (
|
||||
@ -28,26 +47,6 @@ IScsiExtScsiPassThruFunction (
|
||||
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
|
||||
IN EFI_EVENT Event OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function sends out the SCSI command via iSCSI transport layer and returned
|
||||
back the data received from the iSCSI target.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||
Target - The Target ID of device to send the SCSI Request Packet.
|
||||
Lun - The LUN of the device to send the SCSI Request Packet.
|
||||
Packet - The SCSI Request Packet to send to the device.
|
||||
Event - The event used in non-blocking mode, it should be always NULL.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_STATUS
|
||||
|
||||
--*/
|
||||
{
|
||||
if (Target[0] != 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@ -60,6 +59,29 @@ Returns:
|
||||
return IScsiExecuteScsiCommand (This, Target, Lun, Packet);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel.
|
||||
|
||||
@param This[in] The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||
|
||||
@param Target[in][out] On input, a pointer to the Target ID of a SCSI device present on the
|
||||
SCSI channel. On output, a pointer to the Target ID of the next SCSI
|
||||
device present on a SCSI channel. An input value of 0xFFFFFFFF retrieves
|
||||
the Target ID of the first SCSI device present on a SCSI channel.
|
||||
|
||||
@param Lun[in][out] On input, a pointer to the LUN of a SCSI device present on the SCSI
|
||||
channel. On output, a pointer to the LUN of the next SCSI device
|
||||
present on a SCSI channel.
|
||||
|
||||
@retval EFI_SUCCESS The Target ID and Lun of the next SCSI device
|
||||
on the SCSI channel was returned in Target and Lun.
|
||||
|
||||
@retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF,and Target and Lun were not
|
||||
returned on a previous call to GetNextDevice().
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiExtScsiPassThruGetNextTargetLun (
|
||||
@ -67,32 +89,6 @@ IScsiExtScsiPassThruGetNextTargetLun (
|
||||
IN OUT UINT8 **Target,
|
||||
IN OUT UINT64 *Lun
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance..
|
||||
Target - On input, a pointer to the Target ID of a SCSI device present on the
|
||||
SCSI channel. On output, a pointer to the Target ID of the next SCSI
|
||||
device present on a SCSI channel. An input value of 0xFFFFFFFF
|
||||
retrieves the Target ID of the first SCSI device present on a SCSI channel.
|
||||
Lun - On input, a pointer to the LUN of a SCSI device present on the SCSI
|
||||
channel. On output, a pointer to the LUN of the next SCSI device present on
|
||||
a SCSI channel.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The Target ID and Lun of the next SCSI device
|
||||
on the SCSI channel was returned in Target and Lun.
|
||||
EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.
|
||||
EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not
|
||||
returned on a previous call to GetNextDevice().
|
||||
|
||||
--*/
|
||||
{
|
||||
ISCSI_DRIVER_DATA *Private;
|
||||
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
|
||||
@ -119,6 +115,38 @@ Returns:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/**
|
||||
Allocate and build a device path node for a SCSI device on a SCSI channel.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param Target[in] The Target ID of the SCSI device for which
|
||||
a device path node is to be allocated and built.
|
||||
|
||||
@param Lun[in] The LUN of the SCSI device for which a device
|
||||
path node is to be allocated and built.
|
||||
|
||||
@param DevicePath[in][out] A pointer to a single device path node that
|
||||
describes the SCSI device specified by
|
||||
Target and Lun. This function is responsible
|
||||
for allocating the buffer DevicePath with the boot
|
||||
service AllocatePool(). It is the caller's
|
||||
responsibility to free DevicePath when the caller
|
||||
is finished with DevicePath.
|
||||
|
||||
@retval EFI_SUCCESS The device path node that describes the SCSI device
|
||||
specified by Target and Lun was allocated and
|
||||
returned in DevicePath.
|
||||
|
||||
@retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does
|
||||
not exist on the SCSI channel.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DevicePath is NULL.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate
|
||||
DevicePath.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiExtScsiPassThruBuildDevicePath (
|
||||
@ -127,39 +155,6 @@ IScsiExtScsiPassThruBuildDevicePath (
|
||||
IN UINT64 Lun,
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Allocate and build a device path node for a SCSI device on a SCSI channel.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Protocol instance pointer.
|
||||
Target - The Target ID of the SCSI device for which
|
||||
a device path node is to be allocated and built.
|
||||
Lun - The LUN of the SCSI device for which a device
|
||||
path node is to be allocated and built.
|
||||
DevicePath - A pointer to a single device path node that
|
||||
describes the SCSI device specified by
|
||||
Target and Lun. This function is responsible
|
||||
for allocating the buffer DevicePath with the boot
|
||||
service AllocatePool(). It is the caller's
|
||||
responsibility to free DevicePath when the caller
|
||||
is finished with DevicePath.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The device path node that describes the SCSI device
|
||||
specified by Target and Lun was allocated and
|
||||
returned in DevicePath.
|
||||
EFI_NOT_FOUND - The SCSI devices specified by Target and Lun does
|
||||
not exist on the SCSI channel.
|
||||
EFI_INVALID_PARAMETER - DevicePath is NULL.
|
||||
EFI_OUT_OF_RESOURCES - There are not enough resources to allocate
|
||||
DevicePath.
|
||||
|
||||
--*/
|
||||
{
|
||||
ISCSI_DRIVER_DATA *Private;
|
||||
ISCSI_SESSION *Session;
|
||||
@ -223,6 +218,33 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Translate a device path node to a Target ID and LUN.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param DevicePath[in] A pointer to the device path node that
|
||||
describes a SCSI device on the SCSI channel.
|
||||
|
||||
@param Target[out] A pointer to the Target ID of a SCSI device
|
||||
on the SCSI channel.
|
||||
|
||||
@param Lun[out] A pointer to the LUN of a SCSI device on
|
||||
the SCSI channel.
|
||||
|
||||
@retval EFI_SUCCESS DevicePath was successfully translated to a
|
||||
Target ID and LUN, and they were returned
|
||||
in Target and Lun.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DevicePath/Target/Lun is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED This driver does not support the device path
|
||||
node type in DevicePath.
|
||||
|
||||
@retval EFI_NOT_FOUND A valid translation from DevicePath to a
|
||||
Target ID and LUN does not exist.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiExtScsiPassThruGetTargetLun (
|
||||
@ -231,33 +253,6 @@ IScsiExtScsiPassThruGetTargetLun (
|
||||
OUT UINT8 **Target,
|
||||
OUT UINT64 *Lun
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Translate a device path node to a Target ID and LUN.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Protocol instance pointer.
|
||||
DevicePath - A pointer to the device path node that
|
||||
describes a SCSI device on the SCSI channel.
|
||||
Target - A pointer to the Target ID of a SCSI device
|
||||
on the SCSI channel.
|
||||
Lun - A pointer to the LUN of a SCSI device on
|
||||
the SCSI channel.
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - DevicePath was successfully translated to a
|
||||
Target ID and LUN, and they were returned
|
||||
in Target and Lun.
|
||||
EFI_INVALID_PARAMETER - DevicePath/Target/Lun is NULL.
|
||||
EFI_UNSUPPORTED - This driver does not support the device path
|
||||
node type in DevicePath.
|
||||
EFI_NOT_FOUND - A valid translation from DevicePath to a
|
||||
Target ID and LUN does not exist.
|
||||
|
||||
--*/
|
||||
{
|
||||
ISCSI_DRIVER_DATA *Private;
|
||||
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
|
||||
@ -287,31 +282,36 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Resets a SCSI channel.This operation resets all the SCSI devices connected to
|
||||
the SCSI channel.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@retval EFI_UNSUPPORTED It's not supported.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiExtScsiPassThruResetChannel (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Resets a SCSI channel.This operation resets all the SCSI devices connected to
|
||||
the SCSI channel.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Protocol instance pointer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_UNSUPPORTED - It's not supported.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Resets a SCSI device that is connected to a SCSI channel.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param Target[in] The Target ID of the SCSI device to reset.
|
||||
|
||||
@param Lun[in] The LUN of the SCSI device to reset.
|
||||
|
||||
@retval EFI_UNSUPPORTED It's not supported.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiExtScsiPassThruResetTargetLun (
|
||||
@ -319,61 +319,37 @@ IScsiExtScsiPassThruResetTargetLun (
|
||||
IN UINT8 *Target,
|
||||
IN UINT64 Lun
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Resets a SCSI device that is connected to a SCSI channel.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Protocol instance pointer.
|
||||
Target - The Target ID of the SCSI device to reset.
|
||||
Lun - The LUN of the SCSI device to reset.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_UNSUPPORTED - It's not supported.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel.
|
||||
|
||||
@param This[in] Protocol instance pointer.
|
||||
|
||||
@param Target[in] On input, a pointer to the Target ID of a SCSI
|
||||
device present on the SCSI channel. On output,
|
||||
a pointer to the Target ID of the next SCSI device
|
||||
present on a SCSI channel. An input value of
|
||||
0xFFFFFFFF retrieves the Target ID of the first
|
||||
SCSI device present on a SCSI channel.
|
||||
|
||||
@retval EFI_SUCCESS The Target ID and Lun of the next SCSI device
|
||||
on the SCSI channel was returned in Target and Lun.
|
||||
|
||||
@retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF,and Target and Lun were not
|
||||
returned on a previous call to GetNextDevice().
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiExtScsiPassThruGetNextTarget (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN OUT UINT8 **Target
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
Target - On input, a pointer to the Target ID of a SCSI
|
||||
device present on the SCSI channel. On output,
|
||||
a pointer to the Target ID of the next SCSI device
|
||||
present on a SCSI channel. An input value of
|
||||
0xFFFFFFFF retrieves the Target ID of the first
|
||||
SCSI device present on a SCSI channel.
|
||||
Lun - On input, a pointer to the LUN of a SCSI device
|
||||
present on the SCSI channel. On output, a pointer
|
||||
to the LUN of the next SCSI device present on
|
||||
a SCSI channel.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The Target ID and Lun of the next SCSI device
|
||||
on the SCSI channel was returned in Target and Lun.
|
||||
EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.
|
||||
EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not
|
||||
returned on a previous call to GetNextDevice().
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 TargetId[TARGET_MAX_BYTES];
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
The header file of IScsiExtScsiPassThru.c
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -14,8 +15,9 @@ Module Name:
|
||||
IScsiExtScsiPassThru.h
|
||||
|
||||
Abstract:
|
||||
The header file of IScsiExtScsiPassThru.c
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_EXT_SCSI_PASS_THRU_H_
|
||||
#define _ISCSI_EXT_SCSI_PASS_THRU_H_
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
Implementation for iSCSI Boot Firmware Table publication.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -17,30 +18,23 @@ Abstract:
|
||||
|
||||
Implementation for iSCSI Boot Firmware Table publication.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
|
||||
/**
|
||||
Initialize the header of the iSCSI Boot Firmware Table.
|
||||
|
||||
@param Header[in] The header of the iSCSI Boot Firmware Table.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
IScsiInitIbfTableHeader (
|
||||
IN EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER *Header
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the header of the iSCSI Boot Firmware Table.
|
||||
|
||||
Arguments:
|
||||
|
||||
Header - The header of the iSCSI Boot Firmware Table.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
ZeroMem (Header, sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER));
|
||||
|
||||
@ -56,29 +50,23 @@ Returns:
|
||||
Header->OemId[4] = 'L';
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the control section of the iSCSI Boot Firmware Table.
|
||||
|
||||
@param Table[in] The ACPI table.
|
||||
|
||||
@param HandleCount[in] The number of the handles associated with iSCSI sessions, it's
|
||||
equal to the number of iSCSI sessions.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
IScsiInitControlSection (
|
||||
IN EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER *Table,
|
||||
IN UINTN HandleCount
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the control section of the iSCSI Boot Firmware Table.
|
||||
|
||||
Arguments:
|
||||
|
||||
Table - The ACPI table.
|
||||
HandleCount - The number of the handles associated with iSCSI sessions, it's
|
||||
equal to the number of iSCSI sessions.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *Control;
|
||||
UINTN NumOffset;
|
||||
@ -105,6 +93,19 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Add one item into the heap.
|
||||
|
||||
@param Heap[in][out] On input, the current address of the heap; On output, the address of
|
||||
the heap after the item is added.
|
||||
|
||||
@param Data[in] The data to add into the heap.
|
||||
|
||||
@param Len[in] Length of the Data in byte.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
IScsiAddHeapItem (
|
||||
@ -112,24 +113,6 @@ IScsiAddHeapItem (
|
||||
IN VOID *Data,
|
||||
IN UINTN Len
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Add one item into the heap.
|
||||
|
||||
Arguments:
|
||||
|
||||
Heap - On input, the current address of the heap; On output, the address of
|
||||
the heap after the item is added.
|
||||
Data - The data to add into the heap.
|
||||
Len - Length of the Data in byte.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
//
|
||||
// Add one byte for the NULL delimiter.
|
||||
@ -140,6 +123,18 @@ Returns:
|
||||
*(*Heap + Len) = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Fill the Initiator section of the iSCSI Boot Firmware Table.
|
||||
|
||||
@param Table[in] The ACPI table.
|
||||
|
||||
@param Heap[in][out] The heap.
|
||||
|
||||
@param Handle[in] The handle associated with the iSCSI session.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
IScsiFillInitiatorSection (
|
||||
@ -147,23 +142,6 @@ IScsiFillInitiatorSection (
|
||||
IN OUT UINT8 **Heap,
|
||||
IN EFI_HANDLE Handle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Fill the Initiator section of the iSCSI Boot Firmware Table.
|
||||
|
||||
Arguments:
|
||||
|
||||
Table - The ACPI table.
|
||||
Heap - The heap.
|
||||
Handle - The handle associated with the iSCSI session.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *Control;
|
||||
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE *Initiator;
|
||||
@ -209,28 +187,22 @@ Returns:
|
||||
Initiator->IScsiNameOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table);
|
||||
}
|
||||
|
||||
/**
|
||||
Map the v4 IP address into v6 IP address.
|
||||
|
||||
@param V4 The v4 IP address.
|
||||
|
||||
@param V6 The v6 IP address.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
IScsiMapV4ToV6Addr (
|
||||
IN EFI_IPv4_ADDRESS *V4,
|
||||
OUT EFI_IPv6_ADDRESS *V6
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Map the v4 IP address into v6 IP address.
|
||||
|
||||
Arguments:
|
||||
|
||||
V4 - The v4 IP address.
|
||||
V6 - The v6 IP address.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
@ -244,27 +216,20 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get the NIC's PCI location and return it accroding to the composited
|
||||
format defined in iSCSI Boot Firmware Table.
|
||||
|
||||
@param Controller[in] The handle of the controller.
|
||||
|
||||
@retval UINT16 The composited representation of the NIC PCI location.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
UINT16
|
||||
IScsiGetNICPciLocation (
|
||||
IN EFI_HANDLE Controller
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get the NIC's PCI location and return it accroding to the composited
|
||||
format defined in iSCSI Boot Firmware Table.
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - The handle of the controller.
|
||||
|
||||
Returns:
|
||||
|
||||
UINT16 - The composited representation of the NIC PCI location.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
@ -306,26 +271,19 @@ Returns:
|
||||
return (UINT16) ((Bus << 8) | (Device << 3) | Function);
|
||||
}
|
||||
|
||||
/**
|
||||
Get the MAC address of the controller.
|
||||
|
||||
@param Controller[in] The handle of the controller.
|
||||
|
||||
@retval EFI_MAC_ADDRESS * The mac address.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_MAC_ADDRESS *
|
||||
IScsiGetMacAddress (
|
||||
IN EFI_HANDLE Controller
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get the MAC address of the controller.
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - The handle of the controller.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_MAC_ADDRESS * - The mac address.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
|
||||
@ -340,6 +298,20 @@ Returns:
|
||||
return &Snp->Mode->PermanentAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
Fill the NIC and target sections in iSCSI Boot Firmware Table.
|
||||
|
||||
@param Table[in] The buffer of the ACPI table.
|
||||
|
||||
@param Heap[in][out] The heap buffer used to store the variable length parameters such as iSCSI name.
|
||||
|
||||
@param HandleCount[in] The number of handles having iSCSI private protocol installed.
|
||||
|
||||
@param Handles[in] The handle buffer.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
IScsiFillNICAndTargetSections (
|
||||
@ -348,24 +320,6 @@ IScsiFillNICAndTargetSections (
|
||||
IN UINTN HandleCount,
|
||||
IN EFI_HANDLE *Handles
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Fill the NIC and target sections in iSCSI Boot Firmware Table.
|
||||
|
||||
Arguments:
|
||||
|
||||
Table - The buffer of the ACPI table.
|
||||
Heap - The heap buffer used to store the variable length parameters such as iSCSI name.
|
||||
HandleCount - The number of handles having iSCSI private protocol installed.
|
||||
Handles - The handle buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *Control;
|
||||
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE *Nic;
|
||||
@ -520,26 +474,19 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Publish and remove the iSCSI Boot Firmware Table according to the iSCSI
|
||||
session status.
|
||||
|
||||
@param None.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiPublishIbft (
|
||||
IN VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Publish and remove the iSCSI Boot Firmware Table according to the iSCSI
|
||||
session status.
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN TableHandle;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
Some extra definitions for iBFT
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -17,7 +18,7 @@ Abstract:
|
||||
|
||||
Some extra definitions for iBFT.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_IBFT_H_
|
||||
#define _ISCSI_IBFT_H_
|
||||
@ -32,6 +33,15 @@ Abstract:
|
||||
|
||||
#define IBFT_ROUNDUP(size) NET_ROUNDUP ((size), EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_ALIGNMENT)
|
||||
|
||||
/**
|
||||
Publish and remove the iSCSI Boot Firmware Table according to the iSCSI
|
||||
session status.
|
||||
|
||||
@param None.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiPublishIbft (
|
||||
IN VOID
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
The header file of IScsiImpl.c
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -14,8 +15,9 @@ Module Name:
|
||||
IScsiImpl.h
|
||||
|
||||
Abstract:
|
||||
The header file of IScsiImpl.c
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_IMPL_H_
|
||||
#define _ISCSI_IMPL_H_
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
Implementation for EFI iSCSI Initiator Name Protocol.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -17,7 +18,7 @@ Abstract:
|
||||
|
||||
Implementation for EFI iSCSI Initiator Name Protocol.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
|
||||
@ -26,6 +27,33 @@ EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName = {
|
||||
IScsiSetInitiatorName
|
||||
};
|
||||
|
||||
/**
|
||||
Retrieves the current set value of iSCSI Initiator Name.
|
||||
|
||||
@param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
|
||||
|
||||
@param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer / Actual
|
||||
size of the variable data buffer.
|
||||
|
||||
@param Buffer[out] Pointer to the buffer for data to be read.
|
||||
|
||||
@retval EFI_SUCCESS Data was successfully retrieved into the provided
|
||||
buffer and the BufferSize was sufficient to handle the
|
||||
iSCSI initiator name.
|
||||
@retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize will
|
||||
be updated with the size required to complete the request.
|
||||
Buffer will not be affected.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not be
|
||||
affected.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
|
||||
affected.
|
||||
|
||||
@retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved due to
|
||||
a hardware error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiGetInitiatorName (
|
||||
@ -33,35 +61,6 @@ IScsiGetInitiatorName (
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Retrieves the current set value of iSCSI Initiator Name.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
|
||||
BufferSize - Size of the buffer in bytes pointed to by Buffer / Actual size of
|
||||
the variable data buffer.
|
||||
Buffer - Pointer to the buffer for data to be read.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Data was successfully retrieved into the provided
|
||||
buffer and the BufferSize was sufficient to handle the
|
||||
iSCSI initiator name.
|
||||
EFI_BUFFER_TOO_SMALL - BufferSize is too small for the result. BufferSize will
|
||||
be updated with the size required to complete the request.
|
||||
Buffer will not be affected.
|
||||
EFI_INVALID_PARAMETER - BufferSize is NULL. BufferSize and Buffer will not be
|
||||
affected.
|
||||
EFI_INVALID_PARAMETER - Buffer is NULL. BufferSize and Buffer will not be
|
||||
affected.
|
||||
EFI_DEVICE_ERROR - The iSCSI initiator name could not be retrieved due to
|
||||
a hardware error.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
@ -80,6 +79,35 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the iSCSI Initiator Name.
|
||||
|
||||
@param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
|
||||
|
||||
@param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer.
|
||||
|
||||
@param Buffer[out] Pointer to the buffer for data to be written.
|
||||
|
||||
@retval EFI_SUCCESS Data was successfully stored by the protocol.
|
||||
|
||||
@retval EFI_UNSUPPORTED Platform policies do not allow for data to be written.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.
|
||||
BufferSize will be updated with the maximum size
|
||||
required to complete the request.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not be
|
||||
affected.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be affected.
|
||||
|
||||
@retval EFI_DEVICE_ERROR The data could not be stored due to a hardware error.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC 3720.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IScsiSetInitiatorName (
|
||||
@ -87,33 +115,6 @@ IScsiSetInitiatorName (
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Sets the iSSI Initiator Name.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
|
||||
BufferSize - Size of the buffer in bytes pointed to by Buffer.
|
||||
Buffer - Pointer to the buffer for data to be written.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Data was successfully stored by the protocol.
|
||||
EFI_UNSUPPORTED - Platform policies do not allow for data to be written.
|
||||
EFI_INVALID_PARAMETER - BufferSize exceeds the maximum allowed limit.
|
||||
BufferSize will be updated with the maximum size
|
||||
required to complete the request.
|
||||
EFI_INVALID_PARAMETER - Buffersize is NULL. BufferSize and Buffer will not be
|
||||
affected.
|
||||
EFI_INVALID_PARAMETER - Buffer is NULL. BufferSize and Buffer will not be affected.
|
||||
EFI_DEVICE_ERROR - The data could not be stored due to a hardware error.
|
||||
EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the data
|
||||
EFI_PROTOCOL_ERROR - Input iSCSI initiator name does not adhere to RFC 3720
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
Miscellaneous routines for IScsi driver.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -15,35 +16,33 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
Miscellaneous routines for iSCSI driver.
|
||||
Miscellaneous routines for IScsi driver.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
|
||||
STATIC CONST CHAR8 IScsiHexString[] = "0123456789ABCDEFabcdef";
|
||||
|
||||
/**
|
||||
Determines if a Unicode character is a hexadecimal digit.
|
||||
The test is case insensitive.
|
||||
|
||||
@param Digit[out] Pointer to byte that receives the value of the hex character.
|
||||
|
||||
@param Char[in] Unicode character to test.
|
||||
|
||||
@retval TRUE If the character is a hexadecimal digit.
|
||||
|
||||
@retval FALSE Otherwise.
|
||||
|
||||
**/
|
||||
static
|
||||
BOOLEAN
|
||||
IsHexDigit (
|
||||
OUT UINT8 *Digit,
|
||||
IN CHAR16 Char
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Determines if a Unicode character is a hexadecimal digit.
|
||||
The test is case insensitive.
|
||||
|
||||
Arguments:
|
||||
Digit - Pointer to byte that receives the value of the hex character.
|
||||
Char - Unicode character to test.
|
||||
|
||||
Returns:
|
||||
TRUE - If the character is a hexadecimal digit.
|
||||
FALSE - Otherwise.
|
||||
|
||||
--*/
|
||||
{
|
||||
if ((Char >= L'0') && (Char <= L'9')) {
|
||||
*Digit = (UINT8) (Char - L'0');
|
||||
@ -63,27 +62,23 @@ IsHexDigit (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Removes (trims) specified leading and trailing characters from a string.
|
||||
|
||||
@param str[in][out] Pointer to the null-terminated string to be trimmed. On return,
|
||||
str will hold the trimmed string.
|
||||
|
||||
@param CharC[in] Character will be trimmed from str.
|
||||
|
||||
@retval NONE.
|
||||
|
||||
**/
|
||||
static
|
||||
VOID
|
||||
StrTrim (
|
||||
IN OUT CHAR16 *str,
|
||||
IN CHAR16 CharC
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Removes (trims) specified leading and trailing characters from a string.
|
||||
|
||||
Arguments:
|
||||
|
||||
str - Pointer to the null-terminated string to be trimmed. On return,
|
||||
str will hold the trimmed string.
|
||||
CharC - Character will be trimmed from str.
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
CHAR16 *p1;
|
||||
CHAR16 *p2;
|
||||
@ -123,25 +118,18 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Calculate the prefix length of the IPv4 subnet mask.
|
||||
|
||||
@param SubnetMask[in] The IPv4 subnet mask.
|
||||
|
||||
@retval The prefix length of the subnet mask.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
IScsiGetSubnetMaskPrefixLength (
|
||||
IN EFI_IPv4_ADDRESS *SubnetMask
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Calculate the prefix length of the IPv4 subnet mask.
|
||||
|
||||
Arguments:
|
||||
|
||||
SubnetMask - The IPv4 subnet mask.
|
||||
|
||||
Returns:
|
||||
|
||||
The prefix length of the subnet mask.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 Len;
|
||||
UINT32 ReverseMask;
|
||||
@ -170,28 +158,23 @@ Returns:
|
||||
return (UINT8) (32 - Len);
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the hexadecimal encoded LUN string into the 64-bit LUN.
|
||||
|
||||
@param Str[in] The hexadecimal encoded LUN string.
|
||||
|
||||
@param Lun[out] Storage to return the 64-bit LUN.
|
||||
|
||||
@retval EFI_SUCCESS The 64-bit LUN is stored in Lun.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The string is malformatted.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiAsciiStrToLun (
|
||||
IN CHAR8 *Str,
|
||||
OUT UINT8 *Lun
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the hexadecimal encoded LUN string into the 64-bit LUN.
|
||||
|
||||
Arguments:
|
||||
|
||||
Str - The hexadecimal encoded LUN string.
|
||||
Lun - Storage to return the 64-bit LUN.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The 64-bit LUN is stored in Lun.
|
||||
EFI_INVALID_PARAMETER - The string is malformatted.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT32 Index;
|
||||
CHAR8 *LunUnitStr[4];
|
||||
@ -245,27 +228,21 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the 64-bit LUN into the hexadecimal encoded LUN string.
|
||||
|
||||
@param Lun[in] The 64-bit LUN.
|
||||
|
||||
@param Str[out] The storage to return the hexadecimal encoded LUN string.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiLunToUnicodeStr (
|
||||
IN UINT8 *Lun,
|
||||
OUT CHAR16 *Str
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the 64-bit LUN into the hexadecimal encoded LUN string.
|
||||
|
||||
Arguments:
|
||||
|
||||
Lun - The 64-bit LUN.
|
||||
Str - The storage to return the hexadecimal encoded LUN string.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
CHAR16 *TempStr;
|
||||
@ -301,27 +278,21 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the ASCII string into a UNICODE string.
|
||||
|
||||
@param Source[out] The ASCII string.
|
||||
|
||||
@param Destination[out] The storage to return the UNICODE string.
|
||||
|
||||
@retval CHAR16 * Pointer to the UNICODE string.
|
||||
|
||||
**/
|
||||
CHAR16 *
|
||||
IScsiAsciiStrToUnicodeStr (
|
||||
IN CHAR8 *Source,
|
||||
OUT CHAR16 *Destination
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the ASCII string into a UNICODE string.
|
||||
|
||||
Arguments:
|
||||
|
||||
Source - The ASCII string.
|
||||
Destination - The storage to return the UNICODE string.
|
||||
|
||||
Returns:
|
||||
|
||||
Pointer to the UNICODE string.
|
||||
|
||||
--*/
|
||||
{
|
||||
ASSERT (Destination != NULL);
|
||||
ASSERT (Source != NULL);
|
||||
@ -335,27 +306,21 @@ Returns:
|
||||
return Destination;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the UNICODE string into an ASCII string.
|
||||
|
||||
@param Source[in] The UNICODE string.
|
||||
|
||||
@param Destination[out] The storage to return the ASCII string.
|
||||
|
||||
@retval CHAR8 * Pointer to the ASCII string.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
IScsiUnicodeStrToAsciiStr (
|
||||
IN CHAR16 *Source,
|
||||
OUT CHAR8 *Destination
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the UNICODE string into an ASCII string.
|
||||
|
||||
Arguments:
|
||||
|
||||
Source - The UNICODE string.
|
||||
Destination - The storage to return the ASCII string.
|
||||
|
||||
Returns:
|
||||
|
||||
Pointer to the ASCII string.
|
||||
|
||||
--*/
|
||||
{
|
||||
ASSERT (Destination != NULL);
|
||||
ASSERT (Source != NULL);
|
||||
@ -374,28 +339,23 @@ Returns:
|
||||
return Destination;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the decimal dotted IPv4 address into the binary IPv4 address.
|
||||
|
||||
@param Str[in] The UNICODE string.
|
||||
|
||||
@param Ip[out] The storage to return the ASCII string.
|
||||
|
||||
@retval EFI_SUCCESS The binary IP address is returned in Ip.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The IP string is malformatted.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiAsciiStrToIp (
|
||||
IN CHAR8 *Str,
|
||||
OUT EFI_IPv4_ADDRESS *Ip
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the decimal dotted IPv4 address into the binary IPv4 address.
|
||||
|
||||
Arguments:
|
||||
|
||||
Str - The UNICODE string.
|
||||
Ip - The storage to return the ASCII string.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The binary IP address is returned in Ip.
|
||||
EFI_INVALID_PARAMETER - The IP string is malformatted.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Number;
|
||||
@ -445,29 +405,24 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the mac address into a hexadecimal encoded "-" seperated string.
|
||||
|
||||
@param Mac[in] The mac address.
|
||||
|
||||
@param Len[in] Length in bytes of the mac address.
|
||||
|
||||
@param Str[out] The storage to return the mac string.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiMacAddrToStr (
|
||||
IN EFI_MAC_ADDRESS *Mac,
|
||||
IN UINT32 Len,
|
||||
OUT CHAR16 *Str
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the mac address into a hexadecimal encoded "-" seperated string.
|
||||
|
||||
Arguments:
|
||||
|
||||
Mac - The mac address.
|
||||
Len - Length in bytes of the mac address.
|
||||
Str - The storage to return the mac string.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT32 Index;
|
||||
|
||||
@ -480,6 +435,23 @@ Returns:
|
||||
Str[3 * Index - 1] = L'\0';
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the binary encoded buffer into a hexadecimal encoded string.
|
||||
|
||||
@param BinBuffer[in] The buffer containing the binary data.
|
||||
|
||||
@param BinLength[in] Length of the binary buffer.
|
||||
|
||||
@param HexStr[in][out] Pointer to the string.
|
||||
|
||||
@param HexLength[in][out] The length of the string.
|
||||
|
||||
@retval EFI_SUCCESS The binary data is converted to the hexadecimal string
|
||||
and the length of the string is updated.
|
||||
|
||||
@retval EFI_BUFFER_TOO_SMALL The string is too small.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiBinToHex (
|
||||
IN UINT8 *BinBuffer,
|
||||
@ -487,26 +459,6 @@ IScsiBinToHex (
|
||||
IN OUT CHAR8 *HexStr,
|
||||
IN OUT UINT32 *HexLength
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the binary encoded buffer into a hexadecimal encoded string.
|
||||
|
||||
Arguments:
|
||||
|
||||
BinBuffer - The buffer containing the binary data.
|
||||
BinLength - Length of the binary buffer.
|
||||
HexStr - Pointer to the string.
|
||||
HexLength - The length of the string.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The binary data is converted to the hexadecimal string
|
||||
and the length of the string is updated.
|
||||
EFI_BUFFER_TOO_SMALL - The string is too small.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
@ -536,31 +488,27 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the hexadecimal string into a binary encoded buffer.
|
||||
|
||||
@param BinBuffer[in][out] The binary buffer.
|
||||
|
||||
@param BinLength[in][out] Length of the binary buffer.
|
||||
|
||||
@param HexStr[in] The hexadecimal string.
|
||||
|
||||
@retval EFI_SUCCESS The hexadecimal string is converted into a binary
|
||||
encoded buffer.
|
||||
|
||||
@retval EFI_BUFFER_TOO_SMALL The binary buffer is too small to hold the converted data.s
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiHexToBin (
|
||||
IN OUT UINT8 *BinBuffer,
|
||||
IN OUT UINT32 *BinLength,
|
||||
IN CHAR8 *HexStr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert the hexadecimal string into a binary encoded buffer.
|
||||
|
||||
Arguments:
|
||||
|
||||
BinBuffer - The binary buffer.
|
||||
BinLength - Length of the binary buffer.
|
||||
HexStr - The hexadecimal string.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The hexadecimal string is converted into a binary
|
||||
encoded buffer.
|
||||
EFI_BUFFER_TOO_SMALL - The binary buffer is too small to hold the converted data.s
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
UINT32 HexCount;
|
||||
@ -613,27 +561,21 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Generate random numbers.
|
||||
|
||||
@param Rand[in][out] The buffer to contain random numbers.
|
||||
|
||||
@param RandLength[in] The length of the Rand buffer.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiGenRandom (
|
||||
IN OUT UINT8 *Rand,
|
||||
IN UINTN RandLength
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Generate random numbers.
|
||||
|
||||
Arguments:
|
||||
|
||||
Rand - The buffer to contain random numbers.
|
||||
RandLength - The length of the Rand buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT32 Random;
|
||||
|
||||
@ -644,27 +586,21 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Create the iSCSI driver data..
|
||||
|
||||
@param Image[in] The handle of the driver image.
|
||||
|
||||
@param Controller[in] The handle of the controller.
|
||||
|
||||
@retval The iSCSI driver data created.
|
||||
|
||||
**/
|
||||
ISCSI_DRIVER_DATA *
|
||||
IScsiCreateDriverData (
|
||||
IN EFI_HANDLE Image,
|
||||
IN EFI_HANDLE Controller
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Create the iSCSI driver data..
|
||||
|
||||
Arguments:
|
||||
|
||||
Image - The handle of the driver image.
|
||||
Controller - The handle of the controller.
|
||||
|
||||
Returns:
|
||||
|
||||
The iSCSI driver data created.
|
||||
|
||||
--*/
|
||||
{
|
||||
ISCSI_DRIVER_DATA *Private;
|
||||
EFI_STATUS Status;
|
||||
@ -725,25 +661,18 @@ Returns:
|
||||
return Private;
|
||||
}
|
||||
|
||||
/**
|
||||
Clean the iSCSI driver data.
|
||||
|
||||
@param Private[in] The iSCSI driver data.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiCleanDriverData (
|
||||
IN ISCSI_DRIVER_DATA *Private
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Clean the iSCSI driver data.
|
||||
|
||||
Arguments:
|
||||
|
||||
Private - The iSCSI driver data.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
if (Private->DevicePath != NULL) {
|
||||
gBS->UninstallProtocolInterface (
|
||||
@ -768,26 +697,21 @@ Returns:
|
||||
gBS->FreePool (Private);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Get the various configuration data of this iSCSI instance.
|
||||
|
||||
@param Private[in] The iSCSI driver data.
|
||||
|
||||
@retval EFI_SUCCESS The configuration of this instance is got.
|
||||
|
||||
@retval EFI_NOT_FOUND This iSCSI instance is not configured yet.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiGetConfigData (
|
||||
IN ISCSI_DRIVER_DATA *Private
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get the various configuration data of this iSCSI instance.
|
||||
|
||||
Arguments:
|
||||
|
||||
Private - The iSCSI driver data.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The configuration of this instance is got.
|
||||
EFI_NOT_FOUND - This iSCSI instance is not configured yet.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ISCSI_SESSION *Session;
|
||||
@ -866,25 +790,18 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the device path of the iSCSI tcp connection and update it.
|
||||
|
||||
@param Private[in] The iSCSI driver data.
|
||||
|
||||
@retval The updated device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
IScsiGetTcpConnDevicePath (
|
||||
IN ISCSI_DRIVER_DATA *Private
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get the device path of the iSCSI tcp connection and update it.
|
||||
|
||||
Arguments:
|
||||
|
||||
Private - The iSCSI driver data.
|
||||
|
||||
Returns:
|
||||
|
||||
The updated device path.
|
||||
|
||||
--*/
|
||||
{
|
||||
ISCSI_SESSION *Session;
|
||||
ISCSI_CONNECTION *Conn;
|
||||
@ -937,28 +854,22 @@ Returns:
|
||||
return DevicePath;
|
||||
}
|
||||
|
||||
/**
|
||||
Abort the session when the transition from BS to RT is initiated.
|
||||
|
||||
@param Event[in] The event signaled.
|
||||
|
||||
@param Context[in] The iSCSI driver data.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
IScsiOnExitBootService (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Abort the session when the transition from BS to RT is initiated.
|
||||
|
||||
Arguments:
|
||||
|
||||
Event - The event signaled.
|
||||
Context - The iSCSI driver data.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
ISCSI_DRIVER_DATA *Private;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
Miscellaneous definitions for IScsi driver.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -15,9 +16,9 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
Miscellaneous definitions for iSCSI driver.
|
||||
Miscellaneous definitions for IScsi driver.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_MISC_H_
|
||||
#define _ISCSI_MISC_H_
|
||||
@ -47,35 +48,97 @@ struct _ISCSI_SESSION_CONFIG_DATA {
|
||||
EFI_IPv4_ADDRESS DhcpServer;
|
||||
};
|
||||
|
||||
/**
|
||||
Calculate the prefix length of the IPv4 subnet mask.
|
||||
|
||||
@param SubnetMask[in] The IPv4 subnet mask.
|
||||
|
||||
@retval UINT8 The prefix length of the subnet mask.
|
||||
|
||||
**/
|
||||
UINT8
|
||||
IScsiGetSubnetMaskPrefixLength (
|
||||
IN EFI_IPv4_ADDRESS *SubnetMask
|
||||
);
|
||||
|
||||
/**
|
||||
Convert the hexadecimal encoded LUN string into the 64-bit LUN.
|
||||
|
||||
@param Str[in] The hexadecimal encoded LUN string.
|
||||
|
||||
@param Lun[out] Storage to return the 64-bit LUN.
|
||||
|
||||
@retval EFI_SUCCESS The 64-bit LUN is stored in Lun.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The string is malformatted.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiAsciiStrToLun (
|
||||
IN CHAR8 *Str,
|
||||
OUT UINT8 *Lun
|
||||
);
|
||||
|
||||
/**
|
||||
Convert the 64-bit LUN into the hexadecimal encoded LUN string.
|
||||
|
||||
@param Lun[in] The 64-bit LUN.
|
||||
|
||||
@param Str[out] The storage to return the hexadecimal encoded LUN string.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiLunToUnicodeStr (
|
||||
IN UINT8 *Lun,
|
||||
OUT CHAR16 *String
|
||||
);
|
||||
|
||||
CHAR16 *
|
||||
/**
|
||||
Convert the ASCII string into a UNICODE string.
|
||||
|
||||
@param Source[out] The ASCII string.
|
||||
|
||||
@param Destination[out] The storage to return the UNICODE string.
|
||||
|
||||
@retval CHAR16 * Pointer to the UNICODE string.
|
||||
|
||||
**/
|
||||
CHAR16 *
|
||||
IScsiAsciiStrToUnicodeStr (
|
||||
IN CHAR8 *Source,
|
||||
OUT CHAR16 *Destination
|
||||
);
|
||||
|
||||
CHAR8 *
|
||||
/**
|
||||
Convert the UNICODE string into an ASCII string.
|
||||
|
||||
@param Source[in] The UNICODE string.
|
||||
|
||||
@param Destination[out] The storage to return the ASCII string.
|
||||
|
||||
@retval CHAR8 * Pointer to the ASCII string.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
IScsiUnicodeStrToAsciiStr (
|
||||
IN CHAR16 *Source,
|
||||
OUT CHAR8 *Destination
|
||||
);
|
||||
|
||||
/**
|
||||
Convert the mac address into a hexadecimal encoded "-" seperated string.
|
||||
|
||||
@param Mac[in] The mac address.
|
||||
|
||||
@param Len[in] Length in bytes of the mac address.
|
||||
|
||||
@param Str[out] The storage to return the mac string.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiMacAddrToStr (
|
||||
IN EFI_MAC_ADDRESS *Mac,
|
||||
@ -83,12 +146,41 @@ IScsiMacAddrToStr (
|
||||
OUT CHAR16 *Str
|
||||
);
|
||||
|
||||
/**
|
||||
Convert the decimal dotted IPv4 address into the binary IPv4 address.
|
||||
|
||||
@param Str[in] The UNICODE string.
|
||||
|
||||
@param Ip[out] The storage to return the ASCII string.
|
||||
|
||||
@retval EFI_SUCCESS The binary IP address is returned in Ip.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The IP string is malformatted.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiAsciiStrToIp (
|
||||
IN CHAR8 *Str,
|
||||
OUT EFI_IPv4_ADDRESS *Ip
|
||||
);
|
||||
|
||||
/**
|
||||
Convert the binary encoded buffer into a hexadecimal encoded string.
|
||||
|
||||
@param BinBuffer[in] The buffer containing the binary data.
|
||||
|
||||
@param BinLength[in] Length of the binary buffer.
|
||||
|
||||
@param HexStr[in][out] Pointer to the string.
|
||||
|
||||
@param HexLength[in][out] The length of the string.
|
||||
|
||||
@retval EFI_SUCCESS The binary data is converted to the hexadecimal string
|
||||
and the length of the string is updated.
|
||||
|
||||
@retval EFI_BUFFER_TOO_SMALL The string is too small.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiBinToHex (
|
||||
IN UINT8 *BinBuffer,
|
||||
@ -97,6 +189,21 @@ IScsiBinToHex (
|
||||
IN OUT UINT32 *HexLength
|
||||
);
|
||||
|
||||
/**
|
||||
Convert the hexadecimal string into a binary encoded buffer.
|
||||
|
||||
@param BinBuffer[in][out] The binary buffer.
|
||||
|
||||
@param BinLength[in][out] Length of the binary buffer.
|
||||
|
||||
@param HexStr[in] The hexadecimal string.
|
||||
|
||||
@retval EFI_SUCCESS The hexadecimal string is converted into a binary
|
||||
encoded buffer.
|
||||
|
||||
@retval EFI_BUFFER_TOO_SMALL The binary buffer is too small to hold the converted data.s
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiHexToBin (
|
||||
IN OUT UINT8 *BinBuffer,
|
||||
@ -104,33 +211,90 @@ IScsiHexToBin (
|
||||
IN CHAR8 *HexStr
|
||||
);
|
||||
|
||||
/**
|
||||
Generate random numbers.
|
||||
|
||||
@param Rand[in][out] The buffer to contain random numbers.
|
||||
|
||||
@param RandLength[in] The length of the Rand buffer.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiGenRandom (
|
||||
IN OUT UINT8 *Rand,
|
||||
IN UINTN RandLength
|
||||
);
|
||||
|
||||
ISCSI_DRIVER_DATA *
|
||||
/**
|
||||
Create the iSCSI driver data..
|
||||
|
||||
@param Image[in] The handle of the driver image.
|
||||
|
||||
@param Controller[in] The handle of the controller.
|
||||
|
||||
@retval The iSCSI driver data created.
|
||||
|
||||
**/
|
||||
ISCSI_DRIVER_DATA *
|
||||
IScsiCreateDriverData (
|
||||
IN EFI_HANDLE Image,
|
||||
IN EFI_HANDLE Controller
|
||||
);
|
||||
|
||||
/**
|
||||
Clean the iSCSI driver data.
|
||||
|
||||
@param Private[in] The iSCSI driver data.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiCleanDriverData (
|
||||
IN ISCSI_DRIVER_DATA *Private
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Get the various configuration data of this iSCSI instance.
|
||||
|
||||
@param Private[in] The iSCSI driver data.
|
||||
|
||||
@retval EFI_SUCCESS The configuration of this instance is got.
|
||||
|
||||
@retval EFI_NOT_FOUND This iSCSI instance is not configured yet.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiGetConfigData (
|
||||
IN ISCSI_DRIVER_DATA *Private
|
||||
);
|
||||
|
||||
/**
|
||||
Get the device path of the iSCSI tcp connection and update it.
|
||||
|
||||
@param Private[in] The iSCSI driver data.
|
||||
|
||||
@retval The updated device path.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
IScsiGetTcpConnDevicePath (
|
||||
IN ISCSI_DRIVER_DATA *Private
|
||||
);
|
||||
|
||||
/**
|
||||
Abort the session when the transition from BS to RT is initiated.
|
||||
|
||||
@param Event[in] The event signaled.
|
||||
|
||||
@param Context[in] The iSCSI driver data.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
IScsiOnExitBootService (
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
The header file of IScsi Protocol that defines many specific data structures.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -15,9 +16,9 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
Protocol definitions for iSCSI driver, mainly from RFC3720.
|
||||
Protocol definitions for IScsi driver, mainly from RFC3720.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_PROTO_H_
|
||||
#define _ISCSI_PROTO_H_
|
||||
@ -636,48 +637,153 @@ typedef struct _ISCSI_KEY_VALUE_PAIR {
|
||||
//
|
||||
// function prototypes.
|
||||
//
|
||||
/**
|
||||
Attach the iSCSI connection to the iSCSI session.
|
||||
|
||||
@param Session[in] The iSCSI session.
|
||||
|
||||
@param Conn[in] The iSCSI connection.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiAttatchConnection (
|
||||
IN ISCSI_SESSION *Session,
|
||||
IN ISCSI_CONNECTION *Conn
|
||||
);
|
||||
|
||||
/**
|
||||
Detach the iSCSI connection from the session it belongs to.
|
||||
|
||||
@param Conn[in] The iSCSI connection.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiDetatchConnection (
|
||||
IN ISCSI_CONNECTION *Conn
|
||||
);
|
||||
|
||||
/**
|
||||
This function does the iSCSI connection login.
|
||||
|
||||
@param Conn[in] The iSCSI connection to login.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI connection is logged into the iSCSI target.
|
||||
|
||||
@retval EFI_TIMEOUT Timeout happened during the login procedure.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiConnLogin (
|
||||
IN ISCSI_CONNECTION *Conn
|
||||
);
|
||||
|
||||
/**
|
||||
Create a TCP connection for the iSCSI session.
|
||||
|
||||
@param Private[in] The iSCSI driver data.
|
||||
|
||||
@param Session[in] Maximum CmdSN from the target.
|
||||
|
||||
@retval The newly created iSCSI connection.
|
||||
|
||||
**/
|
||||
ISCSI_CONNECTION *
|
||||
IScsiCreateConnection (
|
||||
IN ISCSI_DRIVER_DATA *Private,
|
||||
IN ISCSI_SESSION *Session
|
||||
);
|
||||
|
||||
/**
|
||||
Destroy an iSCSI connection.
|
||||
|
||||
@param Conn[in] The connection to destroy.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiDestroyConnection (
|
||||
IN ISCSI_CONNECTION *Conn
|
||||
);
|
||||
|
||||
/**
|
||||
Login the iSCSI session.
|
||||
|
||||
@param Private[in] The iSCSI driver data.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI session login procedure finished.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiSessionLogin (
|
||||
IN ISCSI_DRIVER_DATA *Private
|
||||
);
|
||||
|
||||
/**
|
||||
Build and send the iSCSI login request to the iSCSI target according to
|
||||
the current login stage.
|
||||
|
||||
@param Conn[in] The connection in the iSCSI login phase.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI login request PDU is built and sent on this
|
||||
connection.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiSendLoginReq (
|
||||
IN ISCSI_CONNECTION *Conn
|
||||
);
|
||||
|
||||
/**
|
||||
Receive and process the iSCSI login response.
|
||||
|
||||
@param Conn[in] The connection in the iSCSI login phase.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI login response PDU is received and processed.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiReceiveLoginRsp (
|
||||
IN ISCSI_CONNECTION *Conn
|
||||
);
|
||||
|
||||
/**
|
||||
Add an iSCSI key-value pair as a string into the data segment of the Login Request PDU.
|
||||
The DataSegmentLength and the actual size of the net buffer containing this PDU will be
|
||||
updated.
|
||||
|
||||
@param Pdu[in] The iSCSI PDU whose data segment the key-value pair will
|
||||
be added to.
|
||||
|
||||
@param Key[in] The key name string.
|
||||
|
||||
@param Value[in] The value string.
|
||||
|
||||
@retval EFI_SUCCESS The key-valu pair is added to the PDU's datasegment and
|
||||
the correspondence length fields are updated.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough space in the PDU to add the key-value
|
||||
pair.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiAddKeyValuePair (
|
||||
IN NET_BUF *Pdu,
|
||||
@ -685,17 +791,55 @@ IScsiAddKeyValuePair (
|
||||
IN CHAR8 *Value
|
||||
);
|
||||
|
||||
NET_BUF *
|
||||
/**
|
||||
Prepare the iSCSI login request to be sent according to the current login status.
|
||||
|
||||
@param Conn[in] The connection in the iSCSI login phase.
|
||||
|
||||
@retval The pointer to the net buffer containing the iSCSI login request built.
|
||||
|
||||
**/
|
||||
NET_BUF *
|
||||
IScsiPrepareLoginReq (
|
||||
IN ISCSI_CONNECTION *Conn
|
||||
);
|
||||
|
||||
/**
|
||||
Process the iSCSI Login Response.
|
||||
|
||||
@param Conn[in] The connection on which the iSCSI login response is received.
|
||||
|
||||
@param Pdu[in] The iSCSI login response PDU.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI login response PDU is processed and all check are passed.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiProcessLoginRsp (
|
||||
IN ISCSI_CONNECTION *Conn,
|
||||
IN NET_BUF *Pdu
|
||||
);
|
||||
|
||||
/**
|
||||
Updated the target information according the data received in the iSCSI
|
||||
login response with an target redirection status.
|
||||
|
||||
@param Session[in] The iSCSI session.
|
||||
|
||||
@param Data[in] The data segment which should contain the
|
||||
TargetAddress key-value list.
|
||||
|
||||
@param Len[in] Length of the data.
|
||||
|
||||
@retval EFI_SUCCESS The target address is updated.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
@retval EFI_NOT_FOUND The TargetAddress key is not found.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiUpdateTargetAddress (
|
||||
IN ISCSI_SESSION *Session,
|
||||
@ -703,11 +847,43 @@ IScsiUpdateTargetAddress (
|
||||
IN UINT32 Len
|
||||
);
|
||||
|
||||
/**
|
||||
The callback function to free the net buffer list.
|
||||
|
||||
@param Arg[in] The opaque parameter.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiFreeNbufList (
|
||||
VOID *Arg
|
||||
);
|
||||
|
||||
/**
|
||||
Receive an iSCSI response PDU. An iSCSI response PDU contains an iSCSI PDU header and
|
||||
an optional data segment. The two parts will be put into two blocks of buffers in the
|
||||
net buffer. The digest check will be conducted in this function if needed and the digests
|
||||
will be trimmed from the PDU buffer.
|
||||
|
||||
@param Conn[in] The iSCSI connection to receive data from.
|
||||
|
||||
@param Pdu[out] The received iSCSI pdu.
|
||||
|
||||
@param Context[in] The context used to describe information on the caller provided
|
||||
buffer to receive data segment of the iSCSI pdu, it's optional.
|
||||
|
||||
@param HeaderDigest[in] Whether there will be header digest received.
|
||||
|
||||
@param DataDigest[in] Whether there will be data digest.
|
||||
|
||||
@param TimeoutEvent[in] The timeout event, it's optional.
|
||||
|
||||
@retval EFI_SUCCESS An iSCSI pdu is received.
|
||||
|
||||
@retval EFI_TIMEOUT Timeout happenend.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiReceivePdu (
|
||||
IN ISCSI_CONNECTION *Conn,
|
||||
@ -718,47 +894,143 @@ IScsiReceivePdu (
|
||||
IN EFI_EVENT TimeoutEvent OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Check and get the result of the prameter negotiation.
|
||||
|
||||
@param Conn[in] The connection in iSCSI login.
|
||||
|
||||
@param Pdu[in] The iSCSI response PDU containing the parameter list.
|
||||
|
||||
@retval EFI_SUCCESS The parmeter check is passed and negotiation is finished.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR Some kind of iSCSI protocol error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiCheckOpParams (
|
||||
IN ISCSI_CONNECTION *Conn,
|
||||
IN BOOLEAN Transit
|
||||
);
|
||||
|
||||
/**
|
||||
Fill the oprational prameters.
|
||||
|
||||
@param Conn[in] The connection in iSCSI login.
|
||||
|
||||
@param Pdu[in] The iSCSI login request PDU to fill the parameters.
|
||||
|
||||
@retval EFI_SUCCESS The parmeters are filled into the iSCSI login request PDU.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough space in the PDU to hold the parameters.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiFillOpParams (
|
||||
IN ISCSI_CONNECTION *Conn,
|
||||
IN NET_BUF *Pdu
|
||||
);
|
||||
|
||||
/**
|
||||
Pad the iSCSI AHS or data segment to an integer number of 4 byte words.
|
||||
|
||||
@param Pdu[in] The iSCSI pdu which contains segments to pad.
|
||||
|
||||
@param Len[in] The length of the last semgnet in the PDU.
|
||||
|
||||
@retval EFI_SUCCESS The segment is padded or no need to pad it.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough remaining free space to add the
|
||||
padding bytes.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiPadSegment (
|
||||
IN NET_BUF *Pdu,
|
||||
IN UINT32 Len
|
||||
);
|
||||
|
||||
LIST_ENTRY *
|
||||
/**
|
||||
Build a key-value list from the data segment.
|
||||
|
||||
@param Data[in] The data segment containing the key-value pairs.
|
||||
|
||||
@param Len[in] Length of the data segment.
|
||||
|
||||
@retval The key-value list.
|
||||
|
||||
**/
|
||||
LIST_ENTRY *
|
||||
IScsiBuildKeyValueList (
|
||||
IN CHAR8 *Data,
|
||||
IN UINT32 Len
|
||||
);
|
||||
|
||||
CHAR8 *
|
||||
/**
|
||||
Get the value string by the key name from the key-value list. If found,
|
||||
the key-value entry will be removed from the list.
|
||||
|
||||
@param KeyValueList[in] The key-value list.
|
||||
|
||||
@param Key[in] The key name to find.
|
||||
|
||||
@retval The value string.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
IScsiGetValueByKeyFromList (
|
||||
IN LIST_ENTRY *KeyValueList,
|
||||
IN CHAR8 *Key
|
||||
);
|
||||
|
||||
/**
|
||||
Free the key-value list.
|
||||
|
||||
@param KeyValueList[in] The key-value list.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiFreeKeyValueList (
|
||||
IN LIST_ENTRY *KeyValueList
|
||||
);
|
||||
|
||||
/**
|
||||
Normalize the iSCSI name according to RFC.
|
||||
|
||||
@param Name[in] The iSCSI name.
|
||||
|
||||
@param Len[in] length of the iSCSI name.
|
||||
|
||||
@retval EFI_SUCCESS The iSCSI name is valid and normalized.
|
||||
|
||||
@retval EFI_PROTOCOL_ERROR The iSCSI name is mal-formatted or not in the IQN format.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiNormalizeName (
|
||||
IN CHAR8 *Name,
|
||||
IN UINTN Len
|
||||
);
|
||||
|
||||
/**
|
||||
Execute the SCSI command issued through the EXT SCSI PASS THRU protocol.
|
||||
|
||||
@param PassThru[in] The EXT SCSI PASS THRU protocol.
|
||||
|
||||
@param Target[in] The target ID.
|
||||
|
||||
@param Lun[in] The LUN.
|
||||
|
||||
@param Packet[in][out] The request packet containing IO request, SCSI command
|
||||
buffer and buffers to read/write.
|
||||
|
||||
@retval EFI_SUCCES The SCSI command is executed and the result is updated to
|
||||
the Packet.
|
||||
|
||||
@retval EFI_DEVICE_ERROR Some unexpected error happened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiExecuteScsiCommand (
|
||||
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru,
|
||||
@ -767,17 +1039,46 @@ IScsiExecuteScsiCommand (
|
||||
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
|
||||
);
|
||||
|
||||
/**
|
||||
Reinstate the session on some error.
|
||||
|
||||
@param Private[in] The iSCSI driver data.
|
||||
|
||||
@retval EFI_SUCCES The session is reinstated from some error.
|
||||
|
||||
@retval other Reinstatement failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiSessionReinstatement (
|
||||
IN ISCSI_DRIVER_DATA *Private
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize some session parameters before login.
|
||||
|
||||
@param Session[in] The iSCSI session.
|
||||
|
||||
@param Recovery[in] Whether the request is from a fresh new start or recovery.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
IScsiSessionInit (
|
||||
IN ISCSI_SESSION *Session,
|
||||
IN BOOLEAN Recovery
|
||||
);
|
||||
|
||||
/**
|
||||
Abort the iSCSI session, that is, reset all the connection and free the
|
||||
resources.
|
||||
|
||||
@param Session[in] The iSCSI session.
|
||||
|
||||
@retval EFI_SUCCES The session is aborted.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IScsiSessionAbort (
|
||||
IN ISCSI_SESSION *Session
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
The wrap of TCP/IP Socket interface
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -14,37 +15,48 @@ Module Name:
|
||||
IScsiTcp4Io.c
|
||||
|
||||
Abstract:
|
||||
The wrap of TCP/IP Socket interface
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#include "IScsiImpl.h"
|
||||
|
||||
/**
|
||||
The common notify function associated with various Tcp4Io events.
|
||||
|
||||
@param Event[in] The event signaled.
|
||||
|
||||
@param Contect[in] The context.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
Tcp4IoCommonNotify (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
The common notify function associated with various Tcp4Io events.
|
||||
|
||||
Arguments:
|
||||
|
||||
Event - The event signaled.
|
||||
Contect - The context.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
*((BOOLEAN *) Context) = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
Create a TCP socket with the specified configuration data.
|
||||
|
||||
@param Image[in] The handle of the driver image.
|
||||
|
||||
@param Controller[in] The handle of the controller.
|
||||
|
||||
@param ConfigData[in] The Tcp4 configuration data.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io.
|
||||
|
||||
@retval EFI_SUCCESS The TCP socket is created and configured.
|
||||
|
||||
@retval Other Failed to create the TCP socket or configure it.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp4IoCreateSocket (
|
||||
IN EFI_HANDLE Image,
|
||||
@ -52,25 +64,6 @@ Tcp4IoCreateSocket (
|
||||
IN TCP4_IO_CONFIG_DATA *ConfigData,
|
||||
IN TCP4_IO *Tcp4Io
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Create a TCP socket with the specified configuration data.
|
||||
|
||||
Arguments:
|
||||
|
||||
Image - The handle of the driver image.
|
||||
Controller - The handle of the controller.
|
||||
ConfigData - The Tcp4 configuration data.
|
||||
Tcp4Io - The Tcp4Io.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The TCP socket is created and configured.
|
||||
other - Failed to create the TCP socket or configure it.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_TCP4_PROTOCOL *Tcp4;
|
||||
@ -252,25 +245,18 @@ ON_ERROR:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Destroy the socket.
|
||||
|
||||
@param[in] Tcp4Io The Tcp4Io which wraps the socket to be destroyeds.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Tcp4IoDestroySocket (
|
||||
IN TCP4_IO *Tcp4Io
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Destroy the socket.
|
||||
|
||||
Arguments:
|
||||
|
||||
Tcp4Io - The Tcp4Io which wraps the socket to be destroyeds.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_TCP4_PROTOCOL *Tcp4;
|
||||
|
||||
@ -297,27 +283,21 @@ Returns:
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Connect to the other endpoint of the TCP socket.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io wrapping the TCP socket.
|
||||
|
||||
@param Timeout[in] The time to wait for connection done.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp4IoConnect (
|
||||
IN TCP4_IO *Tcp4Io,
|
||||
IN EFI_EVENT Timeout
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Connect to the other endpoint of the TCP socket.
|
||||
|
||||
Arguments:
|
||||
|
||||
Tcp4Io - The Tcp4Io wrapping the TCP socket.
|
||||
Timeout - The time to wait for connection done.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_TCP4_PROTOCOL *Tcp4;
|
||||
EFI_STATUS Status;
|
||||
@ -342,25 +322,18 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Reset the socket.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io wrapping the TCP socket.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Tcp4IoReset (
|
||||
IN TCP4_IO *Tcp4Io
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Reset the socket.
|
||||
|
||||
Arguments:
|
||||
|
||||
Tcp4Io - The Tcp4Io wrapping the TCP socket.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_TCP4_PROTOCOL *Tcp4;
|
||||
@ -379,28 +352,23 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Transmit the Packet to the other endpoint of the socket.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io wrapping the TCP socket.
|
||||
|
||||
@param Packet[in] The packet to transmit
|
||||
|
||||
@retval EFI_SUCCESS The packet is trasmitted.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp4IoTransmit (
|
||||
IN TCP4_IO *Tcp4Io,
|
||||
IN NET_BUF *Packet
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Transmit the Packet to the other endpoint of the socket.
|
||||
|
||||
Arguments:
|
||||
|
||||
Tcp4Io - The Tcp4Io wrapping the TCP socket.
|
||||
Packet - The packet to transmit
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The packet is trasmitted.
|
||||
EFI_OUT_OF_RESOURCES - Failed to allocate memory.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_TCP4_TRANSMIT_DATA *TxData;
|
||||
EFI_TCP4_PROTOCOL *Tcp4;
|
||||
@ -447,6 +415,26 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Receive data from the socket.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io which wraps the socket to be destroyeds.
|
||||
|
||||
@param Packet[in] The buffer to hold the data copy from the soket rx buffer.
|
||||
|
||||
@param AsyncMode[in] Is this receive asyncronous or not.
|
||||
|
||||
@param Timeout[in] The time to wait for receiving the amount of data the Packet
|
||||
can hold.
|
||||
|
||||
@retval EFI_SUCCESS The required amount of data is received from the socket.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate momery.
|
||||
|
||||
@retval EFI_TIMEOUT Failed to receive the required amount of data in the
|
||||
specified time period.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp4IoReceive (
|
||||
IN TCP4_IO *Tcp4Io,
|
||||
@ -454,28 +442,6 @@ Tcp4IoReceive (
|
||||
IN BOOLEAN AsyncMode,
|
||||
IN EFI_EVENT Timeout
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Receive data from the socket.
|
||||
|
||||
Arguments:
|
||||
|
||||
Tcp4Io - The Tcp4Io which wraps the socket to be destroyeds.
|
||||
Packet - The buffer to hold the data copy from the soket rx buffer.
|
||||
AsyncMode - Is this receive asyncronous or not.
|
||||
Timeout - The time to wait for receiving the amount of data the Packet
|
||||
can hold.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The required amount of data is received from the socket.
|
||||
EFI_OUT_OF_RESOURCES - Failed to allocate momery.
|
||||
EFI_TIMEOUT - Failed to receive the required amount of data in the
|
||||
specified time period.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_TCP4_PROTOCOL *Tcp4;
|
||||
EFI_TCP4_RECEIVE_DATA RxData;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/**
|
||||
IScsi Tcp4 IO related definitions.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -15,9 +16,9 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
iSCSI Tcp4 IO related definitions.
|
||||
IScsi Tcp4 IO related definitions.
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _ISCSI_TCP4_IO_H_
|
||||
#define _ISCSI_TCP4_IO_H_
|
||||
@ -52,6 +53,22 @@ typedef struct _TCP4_IO {
|
||||
BOOLEAN IsCloseDone;
|
||||
} TCP4_IO;
|
||||
|
||||
/**
|
||||
Create a TCP socket with the specified configuration data.
|
||||
|
||||
@param Image[in] The handle of the driver image.
|
||||
|
||||
@param Controller[in] The handle of the controller.
|
||||
|
||||
@param ConfigData[in] The Tcp4 configuration data.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io.
|
||||
|
||||
@retval EFI_SUCCESS The TCP socket is created and configured.
|
||||
|
||||
@retval Other Failed to create the TCP socket or configure it.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp4IoCreateSocket (
|
||||
IN EFI_HANDLE Image,
|
||||
@ -60,28 +77,86 @@ Tcp4IoCreateSocket (
|
||||
IN TCP4_IO *Tcp4Io
|
||||
);
|
||||
|
||||
/**
|
||||
Destroy the socket.
|
||||
|
||||
@param[in] Tcp4Io The Tcp4Io which wraps the socket to be destroyeds.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Tcp4IoDestroySocket (
|
||||
IN TCP4_IO *Tcp4Io
|
||||
);
|
||||
|
||||
/**
|
||||
Connect to the other endpoint of the TCP socket.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io wrapping the TCP socket.
|
||||
|
||||
@param Timeout[in] The time to wait for connection done.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp4IoConnect (
|
||||
IN TCP4_IO *Tcp4Io,
|
||||
IN EFI_EVENT Timeout
|
||||
);
|
||||
|
||||
/**
|
||||
Reset the socket.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io wrapping the TCP socket.
|
||||
|
||||
@retval None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
Tcp4IoReset (
|
||||
IN TCP4_IO *Tcp4Io
|
||||
);
|
||||
|
||||
/**
|
||||
Transmit the Packet to the other endpoint of the socket.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io wrapping the TCP socket.
|
||||
|
||||
@param Packet[in] The packet to transmit
|
||||
|
||||
@retval EFI_SUCCESS The packet is trasmitted.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp4IoTransmit (
|
||||
IN TCP4_IO *Tcp4Io,
|
||||
IN NET_BUF *Packet
|
||||
);
|
||||
|
||||
/**
|
||||
Receive data from the socket.
|
||||
|
||||
@param Tcp4Io[in] The Tcp4Io which wraps the socket to be destroyeds.
|
||||
|
||||
@param Packet[in] The buffer to hold the data copy from the soket rx buffer.
|
||||
|
||||
@param AsyncMode[in] Is this receive asyncronous or not.
|
||||
|
||||
@param Timeout[in] The time to wait for receiving the amount of data the Packet
|
||||
can hold.
|
||||
|
||||
@retval EFI_SUCCESS The required amount of data is received from the socket.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate momery.
|
||||
|
||||
@retval EFI_TIMEOUT Failed to receive the required amount of data in the
|
||||
specified time period.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp4IoReceive (
|
||||
IN TCP4_IO *Tcp4Io,
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*++
|
||||
/** @file
|
||||
Implementation of MD5 algorithm
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -17,7 +18,7 @@ Abstract:
|
||||
|
||||
Implementation of MD5 algorithm
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#include "Md5.h"
|
||||
|
||||
@ -122,26 +123,19 @@ STATIC CONST MD5_TRANSFORM_FUNC MD5_F[] = {
|
||||
TF4
|
||||
};
|
||||
|
||||
/**
|
||||
Perform the MD5 transform on 64 bytes data segment
|
||||
|
||||
@param Md5Ctx[in] it includes the data segment for Md5 transform
|
||||
|
||||
@retval NONE.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
MD5Transform (
|
||||
IN MD5_CTX *Md5Ctx
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
GC_TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Md5Ctx - GC_TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
GC_TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
@ -177,6 +171,23 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Copy data segment into the M field of MD5_CTX structure for later transform.
|
||||
If the length of data segment is larger than 64 bytes, then does the transform
|
||||
immediately and the generated Md5 code is stored in the States field of MD5_CTX
|
||||
data struct for later accumulation.
|
||||
All of Md5 code generated for the sequential 64-bytes data segaments are be
|
||||
accumulated in MD5Final() function.
|
||||
|
||||
@param Md5Ctx[in] the data structure of storing the original data
|
||||
segment and the final result.
|
||||
|
||||
@param Data[in] the data wanted to be transformed
|
||||
|
||||
@param DataLen[in] the length of data
|
||||
|
||||
@retval NONE.
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
MD5UpdateBlock (
|
||||
@ -184,23 +195,6 @@ MD5UpdateBlock (
|
||||
IN CONST UINT8 *Data,
|
||||
IN UINTN DataLen
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
GC_TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Md5Ctx - GC_TODO: add argument description
|
||||
Data - GC_TODO: add argument description
|
||||
DataLen - GC_TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
GC_TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Limit;
|
||||
|
||||
@ -217,25 +211,18 @@ Returns:
|
||||
Md5Ctx->Count += DataLen;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize four 32-bits chaining variables and use them to do the Md5 transform.
|
||||
|
||||
@param Md5Ctx[in] the data structure of Md5
|
||||
|
||||
@retval EFI_SUCCESS initialization is ok
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
MD5Init (
|
||||
IN MD5_CTX *Md5Ctx
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
GC_TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Md5Ctx - GC_TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GC_TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
{
|
||||
ZeroMem (Md5Ctx, sizeof (*Md5Ctx));
|
||||
|
||||
@ -250,29 +237,25 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
the external interface of Md5 algorithm
|
||||
|
||||
@param Md5Ctx[in] the data structure of storing the original data
|
||||
segment and the final result.
|
||||
|
||||
@param Data[in] the data wanted to be transformed.
|
||||
|
||||
@param DataLen[in] the length of data.
|
||||
|
||||
@retval EFI_SUCCESS the transform is ok.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
MD5Update (
|
||||
IN MD5_CTX *Md5Ctx,
|
||||
IN VOID *Data,
|
||||
IN UINTN DataLen
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
GC_TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Md5Ctx - GC_TODO: add argument description
|
||||
Data - GC_TODO: add argument description
|
||||
DataLen - GC_TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GC_TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
{
|
||||
if (EFI_ERROR (Md5Ctx->Status)) {
|
||||
return Md5Ctx->Status;
|
||||
@ -283,27 +266,23 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
accumulate the MD5 value of every data segment and generate the finial
|
||||
result according to MD5 algorithm
|
||||
|
||||
@param Md5Ctx[in] the data structure of storing the original data
|
||||
segment and the final result.
|
||||
|
||||
@param HashVal[out] the final 128-bits output.
|
||||
|
||||
@retval EFI_SUCCESS the transform is ok.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
MD5Final (
|
||||
IN MD5_CTX *Md5Ctx,
|
||||
OUT UINT8 *HashVal
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
GC_TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Md5Ctx - GC_TODO: add argument description
|
||||
HashVal - GC_TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GC_TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN PadLength;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*++
|
||||
/** @file
|
||||
Header file for Md5
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@ -17,7 +18,7 @@ Abstract:
|
||||
|
||||
Header file for Md5
|
||||
|
||||
--*/
|
||||
**/
|
||||
|
||||
#ifndef _MD5_H_
|
||||
#define _MD5_H_
|
||||
@ -36,73 +37,58 @@ typedef struct _MD5_CTX {
|
||||
UINTN Count;
|
||||
} MD5_CTX;
|
||||
|
||||
/**
|
||||
Initialize four 32-bits chaining variables and use them to do the Md5 transform.
|
||||
|
||||
@param Md5Ctx[in] the data structure of Md5
|
||||
|
||||
@retval EFI_SUCCESS initialization is ok
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
MD5Init (
|
||||
IN MD5_CTX *Md5Ctx
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
GC_TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Md5Ctx - GC_TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GC_TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
/**
|
||||
the external interface of Md5 algorithm
|
||||
|
||||
@param Md5Ctx[in] the data structure of storing the original data
|
||||
segment and the final result.
|
||||
|
||||
@param Data[in] the data wanted to be transformed.
|
||||
|
||||
@param DataLen[in] the length of data.
|
||||
|
||||
@retval EFI_SUCCESS the transform is ok.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
MD5Update (
|
||||
IN MD5_CTX *Md5Ctx,
|
||||
IN VOID *Data,
|
||||
IN UINTN DataLen
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
GC_TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Md5Ctx - GC_TODO: add argument description
|
||||
Data - GC_TODO: add argument description
|
||||
DataLen - GC_TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GC_TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
/**
|
||||
accumulate the MD5 value of every data segment and generate the finial
|
||||
result according to MD5 algorithm
|
||||
|
||||
@param Md5Ctx[in] the data structure of storing the original data
|
||||
segment and the final result.
|
||||
|
||||
@param HashVal[out] the final 128-bits output.
|
||||
|
||||
@retval EFI_SUCCESS the transform is ok.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
MD5Final (
|
||||
IN MD5_CTX *Md5Ctx,
|
||||
OUT UINT8 *HashVal
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
GC_TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Md5Ctx - GC_TODO: add argument description
|
||||
HashVal - GC_TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - GC_TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif // _MD5_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user