mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 15:44:04 +02:00
Verified ChildHandle, and correct the name for a child.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16740 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d92e4e9dc7
commit
2709d2fb90
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
UEFI Component Name(2) protocol implementation for iSCSI.
|
UEFI Component Name(2) protocol implementation for iSCSI.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -102,9 +102,9 @@ IScsiComponentNameGetDriverName (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update the component name for the iSCSI NIC handle.
|
Update the component name for the iSCSI instance.
|
||||||
|
|
||||||
@param[in] Controller The handle of the NIC controller.
|
@param[in] IScsiExtScsiPassThru A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
|
||||||
@param[in] Ipv6Flag TRUE if IP6 network stack is used.
|
@param[in] Ipv6Flag TRUE if IP6 network stack is used.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully.
|
@retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully.
|
||||||
@ -114,58 +114,28 @@ IScsiComponentNameGetDriverName (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
UpdateName (
|
UpdateName (
|
||||||
IN EFI_HANDLE Controller,
|
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *IScsiExtScsiPassThru,
|
||||||
IN BOOLEAN Ipv6Flag
|
IN BOOLEAN Ipv6Flag
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_MAC_ADDRESS MacAddr;
|
|
||||||
UINTN HwAddressSize;
|
|
||||||
UINT16 VlanId;
|
|
||||||
ISCSI_NIC_INFO *ThisNic;
|
|
||||||
ISCSI_NIC_INFO *NicInfo;
|
|
||||||
LIST_ENTRY *Entry;
|
|
||||||
CHAR16 HandleName[80];
|
CHAR16 HandleName[80];
|
||||||
|
ISCSI_DRIVER_DATA *Private;
|
||||||
|
UINT8 NicIndex;
|
||||||
|
|
||||||
//
|
if (IScsiExtScsiPassThru == NULL) {
|
||||||
// Get MAC address of this network device.
|
return EFI_INVALID_PARAMETER;
|
||||||
//
|
|
||||||
Status = NetLibGetMacAddress (Controller, &MacAddr, &HwAddressSize);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (IScsiExtScsiPassThru);
|
||||||
// Get VLAN ID of this network device.
|
NicIndex = Private->Session->ConfigData->NicIndex;
|
||||||
//
|
|
||||||
VlanId = NetLibGetVlanId (Controller);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check whether the NIC information exists.
|
|
||||||
//
|
|
||||||
ThisNic = NULL;
|
|
||||||
|
|
||||||
NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
|
|
||||||
NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
|
|
||||||
if (NicInfo->HwAddressSize == HwAddressSize &&
|
|
||||||
CompareMem (&NicInfo->PermanentAddress, MacAddr.Addr, HwAddressSize) == 0 &&
|
|
||||||
NicInfo->VlanId == VlanId) {
|
|
||||||
|
|
||||||
ThisNic = NicInfo;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ThisNic == NULL) {
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
HandleName,
|
HandleName,
|
||||||
sizeof (HandleName),
|
sizeof (HandleName),
|
||||||
L"iSCSI (%s, NicIndex=%d)",
|
L"iSCSI (%s, NicIndex=%d)",
|
||||||
Ipv6Flag ? L"IPv6" : L"IPv4",
|
Ipv6Flag ? L"IPv6" : L"IPv4",
|
||||||
ThisNic->NicIndex
|
NicIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
if (gIScsiControllerNameTable != NULL) {
|
if (gIScsiControllerNameTable != NULL) {
|
||||||
@ -193,7 +163,6 @@ UpdateName (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@ -272,12 +241,19 @@ IScsiComponentNameGetControllerName (
|
|||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
EFI_HANDLE IScsiController;
|
EFI_HANDLE IScsiController;
|
||||||
BOOLEAN Ipv6Flag;
|
BOOLEAN Ipv6Flag;
|
||||||
EFI_STATUS Status;
|
|
||||||
EFI_GUID *IScsiPrivateGuid;
|
EFI_GUID *IScsiPrivateGuid;
|
||||||
ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier;
|
ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier;
|
||||||
|
|
||||||
|
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *IScsiExtScsiPassThru;
|
||||||
|
|
||||||
|
if (ControllerHandle == NULL) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the handle of the controller we are controling.
|
// Get the handle of the controller we are controling.
|
||||||
//
|
//
|
||||||
@ -295,9 +271,6 @@ IScsiComponentNameGetControllerName (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Retrieve an instance of a produced protocol from IScsiController
|
|
||||||
//
|
|
||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
IScsiController,
|
IScsiController,
|
||||||
IScsiPrivateGuid,
|
IScsiPrivateGuid,
|
||||||
@ -310,10 +283,56 @@ IScsiComponentNameGetControllerName (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = UpdateName(IScsiController, Ipv6Flag);
|
if(ChildHandle != NULL) {
|
||||||
|
if(!Ipv6Flag) {
|
||||||
|
//
|
||||||
|
// Make sure this driver produced ChildHandle
|
||||||
|
//
|
||||||
|
Status = EfiTestChildHandle (
|
||||||
|
ControllerHandle,
|
||||||
|
ChildHandle,
|
||||||
|
&gEfiTcp4ProtocolGuid
|
||||||
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Make sure this driver produced ChildHandle
|
||||||
|
//
|
||||||
|
Status = EfiTestChildHandle (
|
||||||
|
ControllerHandle,
|
||||||
|
ChildHandle,
|
||||||
|
&gEfiTcp6ProtocolGuid
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve an instance of a produced protocol from ChildHandle
|
||||||
|
//
|
||||||
|
Status = gBS->OpenProtocol (
|
||||||
|
ChildHandle,
|
||||||
|
&gEfiExtScsiPassThruProtocolGuid,
|
||||||
|
(VOID **)&IScsiExtScsiPassThru,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update the component name for this child handle.
|
||||||
|
//
|
||||||
|
Status = UpdateName (IScsiExtScsiPassThru, Ipv6Flag);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return LookupUnicodeString2 (
|
return LookupUnicodeString2 (
|
||||||
Language,
|
Language,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user