NetworkPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the NetworkPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:07 -08:00
committed by mergify[bot]
parent 2f88bd3a12
commit d1050b9dff
294 changed files with 29888 additions and 30440 deletions

View File

@@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "IScsiImpl.h"
EFI_DRIVER_BINDING_PROTOCOL gIScsiIp4DriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gIScsiIp4DriverBinding = {
IScsiIp4DriverBindingSupported,
IScsiIp4DriverBindingStart,
IScsiIp4DriverBindingStop,
@@ -20,7 +20,7 @@ EFI_DRIVER_BINDING_PROTOCOL gIScsiIp4DriverBinding = {
NULL
};
EFI_DRIVER_BINDING_PROTOCOL gIScsiIp6DriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gIScsiIp6DriverBinding = {
IScsiIp6DriverBindingSupported,
IScsiIp6DriverBindingStart,
IScsiIp6DriverBindingStop,
@@ -29,9 +29,9 @@ EFI_DRIVER_BINDING_PROTOCOL gIScsiIp6DriverBinding = {
NULL
};
EFI_GUID gIScsiV4PrivateGuid = ISCSI_V4_PRIVATE_GUID;
EFI_GUID gIScsiV6PrivateGuid = ISCSI_V6_PRIVATE_GUID;
ISCSI_PRIVATE_DATA *mPrivate = NULL;
EFI_GUID gIScsiV4PrivateGuid = ISCSI_V4_PRIVATE_GUID;
EFI_GUID gIScsiV6PrivateGuid = ISCSI_V6_PRIVATE_GUID;
ISCSI_PRIVATE_DATA *mPrivate = NULL;
/**
Tests to see if this driver supports the RemainingDevicePath.
@@ -50,7 +50,7 @@ ISCSI_PRIVATE_DATA *mPrivate = NULL;
**/
EFI_STATUS
IScsiIsDevicePathSupported (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath;
@@ -85,34 +85,34 @@ IScsiCheckAip (
VOID
)
{
UINTN AipHandleCount;
EFI_HANDLE *AipHandleBuffer;
UINTN AipIndex;
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtScsiPassThru;
EFI_GUID *InfoTypesBuffer;
UINTN InfoTypeBufferCount;
UINTN TypeIndex;
VOID *InfoBlock;
UINTN InfoBlockSize;
BOOLEAN Supported;
EFI_ADAPTER_INFO_NETWORK_BOOT *NetworkBoot;
EFI_STATUS Status;
UINT8 NetworkBootPolicy;
UINTN AipHandleCount;
EFI_HANDLE *AipHandleBuffer;
UINTN AipIndex;
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtScsiPassThru;
EFI_GUID *InfoTypesBuffer;
UINTN InfoTypeBufferCount;
UINTN TypeIndex;
VOID *InfoBlock;
UINTN InfoBlockSize;
BOOLEAN Supported;
EFI_ADAPTER_INFO_NETWORK_BOOT *NetworkBoot;
EFI_STATUS Status;
UINT8 NetworkBootPolicy;
//
// Check any AIP instances exist in system.
//
AipHandleCount = 0;
AipHandleBuffer = NULL;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiAdapterInformationProtocolGuid,
NULL,
&AipHandleCount,
&AipHandleBuffer
);
if (EFI_ERROR (Status) || AipHandleCount == 0) {
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiAdapterInformationProtocolGuid,
NULL,
&AipHandleCount,
&AipHandleBuffer
);
if (EFI_ERROR (Status) || (AipHandleCount == 0)) {
return EFI_NOT_FOUND;
}
@@ -124,7 +124,7 @@ IScsiCheckAip (
Status = gBS->HandleProtocol (
AipHandleBuffer[AipIndex],
&gEfiAdapterInformationProtocolGuid,
(VOID *) &Aip
(VOID *)&Aip
);
ASSERT_EFI_ERROR (Status);
ASSERT (Aip != NULL);
@@ -132,18 +132,19 @@ IScsiCheckAip (
Status = gBS->HandleProtocol (
AipHandleBuffer[AipIndex],
&gEfiExtScsiPassThruProtocolGuid,
(VOID *) &ExtScsiPassThru
(VOID *)&ExtScsiPassThru
);
if (EFI_ERROR (Status) || ExtScsiPassThru == NULL) {
if (EFI_ERROR (Status) || (ExtScsiPassThru == NULL)) {
continue;
}
InfoTypesBuffer = NULL;
InfoTypeBufferCount = 0;
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
if (EFI_ERROR (Status) || InfoTypesBuffer == NULL) {
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
if (EFI_ERROR (Status) || (InfoTypesBuffer == NULL)) {
continue;
}
//
// Check whether the AIP instance has Network boot information block.
//
@@ -165,33 +166,35 @@ IScsiCheckAip (
//
InfoBlock = NULL;
InfoBlockSize = 0;
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoNetworkBootGuid, &InfoBlock, &InfoBlockSize);
if (EFI_ERROR (Status) || InfoBlock == NULL) {
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoNetworkBootGuid, &InfoBlock, &InfoBlockSize);
if (EFI_ERROR (Status) || (InfoBlock == NULL)) {
continue;
}
//
// Check whether the network boot policy matches.
//
NetworkBoot = (EFI_ADAPTER_INFO_NETWORK_BOOT *) InfoBlock;
NetworkBoot = (EFI_ADAPTER_INFO_NETWORK_BOOT *)InfoBlock;
NetworkBootPolicy = PcdGet8 (PcdIScsiAIPNetworkBootPolicy);
if (NetworkBootPolicy == STOP_UEFI_ISCSI_IF_HBA_INSTALL_AIP) {
Status = EFI_SUCCESS;
goto Exit;
}
if (((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP4) != 0 &&
if ((((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP4) != 0) &&
!NetworkBoot->iScsiIpv4BootCapablity) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP6) != 0 &&
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP6) != 0) &&
!NetworkBoot->iScsiIpv6BootCapablity) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_OFFLOAD) != 0 &&
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_OFFLOAD) != 0) &&
!NetworkBoot->OffloadCapability) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_MPIO) != 0 &&
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_MPIO) != 0) &&
!NetworkBoot->iScsiMpioCapability) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP4) != 0 &&
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP4) != 0) &&
!NetworkBoot->iScsiIpv4Boot) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP6) != 0 &&
!NetworkBoot->iScsiIpv6Boot)) {
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP6) != 0) &&
!NetworkBoot->iScsiIpv6Boot))
{
FreePool (InfoBlock);
continue;
}
@@ -206,9 +209,11 @@ Exit:
if (InfoBlock != NULL) {
FreePool (InfoBlock);
}
if (AipHandleBuffer != NULL) {
FreePool (AipHandleBuffer);
}
return Status;
}
@@ -246,23 +251,22 @@ IScsiSupported (
IN UINT8 IpVersion
)
{
EFI_STATUS Status;
EFI_GUID *IScsiServiceBindingGuid;
EFI_GUID *TcpServiceBindingGuid;
EFI_GUID *DhcpServiceBindingGuid;
EFI_GUID *DnsServiceBindingGuid;
EFI_STATUS Status;
EFI_GUID *IScsiServiceBindingGuid;
EFI_GUID *TcpServiceBindingGuid;
EFI_GUID *DhcpServiceBindingGuid;
EFI_GUID *DnsServiceBindingGuid;
if (IpVersion == IP_VERSION_4) {
IScsiServiceBindingGuid = &gIScsiV4PrivateGuid;
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid;
DnsServiceBindingGuid = &gEfiDns4ServiceBindingProtocolGuid;
IScsiServiceBindingGuid = &gIScsiV4PrivateGuid;
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid;
DnsServiceBindingGuid = &gEfiDns4ServiceBindingProtocolGuid;
} else {
IScsiServiceBindingGuid = &gIScsiV6PrivateGuid;
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
DhcpServiceBindingGuid = &gEfiDhcp6ServiceBindingProtocolGuid;
DnsServiceBindingGuid = &gEfiDns6ServiceBindingProtocolGuid;
IScsiServiceBindingGuid = &gIScsiV6PrivateGuid;
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
DhcpServiceBindingGuid = &gEfiDhcp6ServiceBindingProtocolGuid;
DnsServiceBindingGuid = &gEfiDns6ServiceBindingProtocolGuid;
}
Status = gBS->OpenProtocol (
@@ -325,7 +329,6 @@ IScsiSupported (
return EFI_SUCCESS;
}
/**
Start to manage the controller. This is the worker function for
IScsiIp4(6)DriverBindingStart.
@@ -347,33 +350,33 @@ IScsiSupported (
**/
EFI_STATUS
IScsiStart (
IN EFI_HANDLE Image,
IN EFI_HANDLE ControllerHandle,
IN UINT8 IpVersion
IN EFI_HANDLE Image,
IN EFI_HANDLE ControllerHandle,
IN UINT8 IpVersion
)
{
EFI_STATUS Status;
ISCSI_DRIVER_DATA *Private;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
ISCSI_ATTEMPT_CONFIG_NVDATA *AttemptConfigData;
ISCSI_SESSION *Session;
UINT8 Index;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExistIScsiExtScsiPassThru;
ISCSI_DRIVER_DATA *ExistPrivate;
UINT8 *AttemptConfigOrder;
UINTN AttemptConfigOrderSize;
UINT8 BootSelected;
EFI_HANDLE *HandleBuffer;
UINTN NumberOfHandles;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_GUID *IScsiPrivateGuid;
EFI_GUID *TcpServiceBindingGuid;
BOOLEAN NeedUpdate;
VOID *Interface;
EFI_GUID *ProtocolGuid;
UINT8 NetworkBootPolicy;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
EFI_STATUS Status;
ISCSI_DRIVER_DATA *Private;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
ISCSI_ATTEMPT_CONFIG_NVDATA *AttemptConfigData;
ISCSI_SESSION *Session;
UINT8 Index;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExistIScsiExtScsiPassThru;
ISCSI_DRIVER_DATA *ExistPrivate;
UINT8 *AttemptConfigOrder;
UINTN AttemptConfigOrderSize;
UINT8 BootSelected;
EFI_HANDLE *HandleBuffer;
UINTN NumberOfHandles;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_GUID *IScsiPrivateGuid;
EFI_GUID *TcpServiceBindingGuid;
BOOLEAN NeedUpdate;
VOID *Interface;
EFI_GUID *ProtocolGuid;
UINT8 NetworkBootPolicy;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
//
// Test to see if iSCSI driver supports the given controller.
@@ -518,7 +521,7 @@ IScsiStart (
if (mPrivate->OneSessionEstablished && mPrivate->EnableMpio) {
AttemptConfigData = NULL;
NET_LIST_FOR_EACH (Entry, &mPrivate->AttemptConfigs) {
AttemptConfigData = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
AttemptConfigData = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
if (AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO) {
break;
}
@@ -558,7 +561,7 @@ IScsiStart (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath
(VOID **)&DevicePath
);
if (EFI_ERROR (Status)) {
continue;
@@ -572,7 +575,7 @@ IScsiStart (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiExtScsiPassThruProtocolGuid,
(VOID **) &ExistIScsiExtScsiPassThru
(VOID **)&ExistIScsiExtScsiPassThru
);
ASSERT_EFI_ERROR (Status);
break;
@@ -622,9 +625,10 @@ IScsiStart (
// Don't process the attempt that does not associate with the current NIC or
// this attempt is disabled or established.
//
if (AttemptConfigData->NicIndex != mPrivate->CurrentNic ||
AttemptConfigData->SessionConfigData.Enabled == ISCSI_DISABLED ||
AttemptConfigData->ValidPath) {
if ((AttemptConfigData->NicIndex != mPrivate->CurrentNic) ||
(AttemptConfigData->SessionConfigData.Enabled == ISCSI_DISABLED) ||
AttemptConfigData->ValidPath)
{
continue;
}
@@ -633,9 +637,10 @@ IScsiStart (
// In default single path mode, don't process attempts configured for multipath.
//
if ((mPrivate->EnableMpio &&
AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO) ||
(AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO)) ||
(!mPrivate->EnableMpio &&
AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED)) {
(AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED)))
{
continue;
}
@@ -643,18 +648,21 @@ IScsiStart (
// Don't process the attempt that fails to get the init/target information from DHCP.
//
if (AttemptConfigData->SessionConfigData.InitiatorInfoFromDhcp &&
!AttemptConfigData->DhcpSuccess) {
if (!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount > 0) {
!AttemptConfigData->DhcpSuccess)
{
if (!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount > 0)) {
mPrivate->ValidSinglePathCount--;
}
continue;
}
//
// Don't process the autoconfigure path if it is already established.
//
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
AttemptConfigData->AutoConfigureSuccess) {
if ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
AttemptConfigData->AutoConfigureSuccess)
{
continue;
}
@@ -665,16 +673,20 @@ IScsiStart (
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP6) {
continue;
}
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6) {
if ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
(AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6))
{
continue;
}
} else {
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP4) {
continue;
}
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4) {
if ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
(AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4))
{
continue;
}
}
@@ -682,7 +694,7 @@ IScsiStart (
//
// Fill in the Session and init it.
//
Session = (ISCSI_SESSION *) AllocateZeroPool (sizeof (ISCSI_SESSION));
Session = (ISCSI_SESSION *)AllocateZeroPool (sizeof (ISCSI_SESSION));
if (Session == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_ERROR;
@@ -694,9 +706,9 @@ IScsiStart (
UnicodeSPrint (
mPrivate->PortString,
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
(UINTN)ISCSI_NAME_IFR_MAX_SIZE,
L"Attempt %d",
(UINTN) AttemptConfigData->AttemptConfigIndex
(UINTN)AttemptConfigData->AttemptConfigIndex
);
if (Session->AuthType == ISCSI_AUTH_TYPE_CHAP) {
@@ -742,12 +754,11 @@ IScsiStart (
// In Single path mode, only the successful attempt will be recorded in iBFT;
// in multi-path mode, all the attempt entries in MPIO will be recorded in iBFT.
//
if (!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount > 0) {
if (!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount > 0)) {
mPrivate->ValidSinglePathCount--;
}
FreePool (Session);
} else {
AttemptConfigData->ValidPath = TRUE;
@@ -756,7 +767,7 @@ IScsiStart (
// TODO: record KRB5 attempt information in the iSCSI device path.
//
if (Session->AuthType == ISCSI_AUTH_TYPE_KRB) {
if (!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount > 0) {
if (!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount > 0)) {
mPrivate->ValidSinglePathCount--;
}
@@ -814,7 +825,7 @@ IScsiStart (
//
// Reinstall the original ExtScsiPassThru back.
//
if (mPrivate->OneSessionEstablished && ExistPrivate != NULL) {
if (mPrivate->OneSessionEstablished && (ExistPrivate != NULL)) {
Status = gBS->InstallProtocolInterface (
&ExistPrivate->ExtScsiPassThruHandle,
&gEfiExtScsiPassThruProtocolGuid,
@@ -837,8 +848,7 @@ IScsiStart (
//
// More than one attempt successes.
//
if (Private->Session != NULL && mPrivate->OneSessionEstablished) {
if ((Private->Session != NULL) && mPrivate->OneSessionEstablished) {
AttemptConfigOrder = IScsiGetVariableAndSize (
L"AttemptOrder",
&gIScsiConfigGuid,
@@ -847,9 +857,11 @@ IScsiStart (
if (AttemptConfigOrder == NULL) {
goto ON_ERROR;
}
for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {
if (AttemptConfigOrder[Index] == mPrivate->BootSelectedIndex ||
AttemptConfigOrder[Index] == BootSelected) {
if ((AttemptConfigOrder[Index] == mPrivate->BootSelectedIndex) ||
(AttemptConfigOrder[Index] == BootSelected))
{
break;
}
}
@@ -887,6 +899,7 @@ IScsiStart (
if (AttemptConfigOrder[Index] != BootSelected) {
goto ON_ERROR;
}
mPrivate->BootSelectedIndex = BootSelected;
//
// Clear the resource in ExistPrivate.
@@ -917,7 +930,6 @@ IScsiStart (
gBS->CloseEvent (ExistPrivate->ExitBootServiceEvent);
FreePool (ExistPrivate);
}
} else {
//
@@ -927,7 +939,6 @@ IScsiStart (
NeedUpdate = FALSE;
}
}
}
if (NeedUpdate) {
@@ -945,6 +956,7 @@ IScsiStart (
Status = EFI_DEVICE_ERROR;
goto ON_ERROR;
}
//
// Install the updated device path onto the ExtScsiPassThruHandle.
//
@@ -1032,16 +1044,15 @@ IScsiStop (
IN UINT8 IpVersion
)
{
EFI_HANDLE IScsiController;
EFI_STATUS Status;
ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier;
ISCSI_DRIVER_DATA *Private;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;
ISCSI_CONNECTION *Conn;
EFI_GUID *ProtocolGuid;
EFI_GUID *TcpServiceBindingGuid;
EFI_GUID *TcpProtocolGuid;
EFI_HANDLE IScsiController;
EFI_STATUS Status;
ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier;
ISCSI_DRIVER_DATA *Private;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;
ISCSI_CONNECTION *Conn;
EFI_GUID *ProtocolGuid;
EFI_GUID *TcpServiceBindingGuid;
EFI_GUID *TcpProtocolGuid;
if (NumberOfChildren != 0) {
//
@@ -1050,7 +1061,7 @@ IScsiStop (
Status = gBS->OpenProtocol (
ChildHandleBuffer[0],
&gEfiExtScsiPassThruProtocolGuid,
(VOID **) &PassThru,
(VOID **)&PassThru,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1094,14 +1105,15 @@ IScsiStop (
// Get the handle of the controller we are controlling.
//
if (IpVersion == IP_VERSION_4) {
ProtocolGuid = &gIScsiV4PrivateGuid;
TcpProtocolGuid = &gEfiTcp4ProtocolGuid;
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
ProtocolGuid = &gIScsiV4PrivateGuid;
TcpProtocolGuid = &gEfiTcp4ProtocolGuid;
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
} else {
ProtocolGuid = &gIScsiV6PrivateGuid;
TcpProtocolGuid = &gEfiTcp6ProtocolGuid;
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
ProtocolGuid = &gIScsiV6PrivateGuid;
TcpProtocolGuid = &gEfiTcp6ProtocolGuid;
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
}
IScsiController = NetLibGetNicHandle (ControllerHandle, TcpProtocolGuid);
if (IScsiController == NULL) {
return EFI_SUCCESS;
@@ -1110,7 +1122,7 @@ IScsiStop (
Status = gBS->OpenProtocol (
IScsiController,
ProtocolGuid,
(VOID **) &IScsiIdentifier,
(VOID **)&IScsiIdentifier,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1272,7 +1284,7 @@ IScsiIp4DriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = IScsiStart (This->DriverBindingHandle, ControllerHandle, IP_VERSION_4);
if (Status == EFI_ALREADY_STARTED) {
@@ -1427,7 +1439,7 @@ IScsiIp6DriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = IScsiStart (This->DriverBindingHandle, ControllerHandle, IP_VERSION_6);
if (Status == EFI_ALREADY_STARTED) {
@@ -1496,12 +1508,12 @@ IScsiUnload (
IN EFI_HANDLE ImageHandle
)
{
EFI_STATUS Status;
UINTN DeviceHandleCount;
EFI_HANDLE *DeviceHandleBuffer;
UINTN Index;
EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
EFI_STATUS Status;
UINTN DeviceHandleCount;
EFI_HANDLE *DeviceHandleBuffer;
UINTN Index;
EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
//
// Try to disconnect the driver from the devices it's controlling.
@@ -1524,11 +1536,13 @@ IScsiUnload (
Status = IScsiTestManagedDevice (
DeviceHandleBuffer[Index],
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiTcp4ProtocolGuid)
;
&gEfiTcp4ProtocolGuid
)
;
if (EFI_ERROR (Status)) {
continue;
}
Status = gBS->DisconnectController (
DeviceHandleBuffer[Index],
gIScsiIp4DriverBinding.DriverBindingHandle,
@@ -1551,6 +1565,7 @@ IScsiUnload (
if (EFI_ERROR (Status)) {
continue;
}
Status = gBS->DisconnectController (
DeviceHandleBuffer[Index],
gIScsiIp6DriverBinding.DriverBindingHandle,
@@ -1582,11 +1597,12 @@ IScsiUnload (
goto ON_EXIT;
}
if (gIScsiControllerNameTable!= NULL) {
if (gIScsiControllerNameTable != NULL) {
Status = FreeUnicodeStringTable (gIScsiControllerNameTable);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
gIScsiControllerNameTable = NULL;
}
@@ -1597,15 +1613,15 @@ IScsiUnload (
Status = gBS->HandleProtocol (
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
(VOID **) &ComponentName
(VOID **)&ComponentName
);
if (!EFI_ERROR (Status)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
ComponentName,
NULL
);
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
ComponentName,
NULL
);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
@@ -1614,7 +1630,7 @@ IScsiUnload (
Status = gBS->HandleProtocol (
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiComponentName2ProtocolGuid,
(VOID **) &ComponentName2
(VOID **)&ComponentName2
);
if (!EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
@@ -1635,15 +1651,15 @@ IScsiUnload (
Status = gBS->HandleProtocol (
gIScsiIp6DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
(VOID **) &ComponentName
(VOID **)&ComponentName
);
if (!EFI_ERROR (Status)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
gIScsiIp6DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
ComponentName,
NULL
);
gIScsiIp6DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
ComponentName,
NULL
);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
@@ -1652,7 +1668,7 @@ IScsiUnload (
Status = gBS->HandleProtocol (
gIScsiIp6DriverBinding.DriverBindingHandle,
&gEfiComponentName2ProtocolGuid,
(VOID **) &ComponentName2
(VOID **)&ComponentName2
);
if (!EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
@@ -1716,8 +1732,8 @@ ON_EXIT:
EFI_STATUS
EFIAPI
IScsiDriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -1730,7 +1746,7 @@ IScsiDriverEntryPoint (
Status = gBS->LocateProtocol (
&gEfiIScsiInitiatorNameProtocolGuid,
NULL,
(VOID **) &IScsiInitiatorName
(VOID **)&IScsiInitiatorName
);
if (!EFI_ERROR (Status)) {
return EFI_ACCESS_DENIED;
@@ -1821,7 +1837,7 @@ IScsiDriverEntryPoint (
Status = gBS->LocateProtocol (
&gEfiAuthenticationInfoProtocolGuid,
NULL,
(VOID **) &AuthenticationInfo
(VOID **)&AuthenticationInfo
);
if (Status == EFI_NOT_FOUND) {
Status = gBS->InstallProtocolInterface (
@@ -1873,4 +1889,3 @@ Error1:
return Status;
}