summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/IScsiDxe
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/Network/IScsiDxe')
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c50
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h3
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c35
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c39
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h10
5 files changed, 60 insertions, 77 deletions
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
index 25d89f54e3..35214f2ce9 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
@@ -67,7 +67,7 @@ IScsiIpToStr (
/**
Update the list of iSCSI devices the iSCSI driver is controlling.
-
+
@retval EFI_SUCCESS The callback successfully handled the action.
@retval Others Other errors as indicated.
**/
@@ -84,19 +84,20 @@ IScsiUpdateDeviceList (
UINTN HandleIndex;
UINTN Index;
UINTN LastDeviceIndex;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- EFI_SIMPLE_NETWORK_MODE *Mode;
+ EFI_MAC_ADDRESS MacAddress;
+ UINTN HwAddressSize;
+ UINT16 VlanId;
ISCSI_MAC_INFO *CurMacInfo;
ISCSI_MAC_INFO TempMacInfo;
- CHAR16 MacString[65];
+ CHAR16 MacString[70];
UINTN DeviceListSize;
//
- // Dump all the handles the Simple Network Protocol is installed on.
+ // Dump all the handles the Managed Network Service Binding Protocol is installed on.
//
Status = gBS->LocateHandleBuffer (
ByProtocol,
- &gEfiSimpleNetworkProtocolGuid,
+ &gEfiManagedNetworkServiceBindingProtocolGuid,
NULL,
&NumHandles,
&Handles
@@ -127,14 +128,15 @@ IScsiUpdateDeviceList (
LastDeviceIndex = 0;
for (HandleIndex = 0; HandleIndex < NumHandles; HandleIndex++) {
- gBS->HandleProtocol (Handles[HandleIndex], &gEfiSimpleNetworkProtocolGuid, (VOID **)&Snp);
-
- Mode = Snp->Mode;
+ Status = NetLibGetMacAddress (Handles[HandleIndex], &MacAddress, &HwAddressSize);
+ ASSERT (Status == EFI_SUCCESS);
+ VlanId = NetLibGetVlanId (Handles[HandleIndex]);
for (Index = LastDeviceIndex; Index < DeviceList->NumDevice; Index++) {
CurMacInfo = &DeviceList->MacInfo[Index];
- if ((CurMacInfo->Len == Mode->HwAddressSize) &&
- (NET_MAC_EQUAL (&CurMacInfo->Mac, &Mode->PermanentAddress, Mode->HwAddressSize))
+ if ((CurMacInfo->Len == HwAddressSize) &&
+ (CurMacInfo->VlanId == VlanId) &&
+ (NET_MAC_EQUAL (&CurMacInfo->Mac, MacAddress.Addr, HwAddressSize))
) {
//
// The previous configured NIC is still here.
@@ -163,7 +165,7 @@ IScsiUpdateDeviceList (
// delete the variables
//
CurMacInfo = &DeviceList->MacInfo[Index];
- IScsiMacAddrToStr (&CurMacInfo->Mac, CurMacInfo->Len, MacString);
+ IScsiMacAddrToStr (&CurMacInfo->Mac, CurMacInfo->Len, CurMacInfo->VlanId, MacString);
gRT->SetVariable (MacString, &gEfiIScsiInitiatorNameProtocolGuid, 0, 0, NULL);
gRT->SetVariable (MacString, &mIScsiCHAPAuthInfoGuid, 0, 0, NULL);
}
@@ -181,12 +183,12 @@ IScsiUpdateDeviceList (
DeviceList->NumDevice = (UINT8) NumHandles;
for (Index = 0; Index < NumHandles; Index++) {
- gBS->HandleProtocol (Handles[Index], &gEfiSimpleNetworkProtocolGuid, (VOID **)&Snp);
- Mode = Snp->Mode;
+ NetLibGetMacAddress (Handles[Index], &MacAddress, &HwAddressSize);
CurMacInfo = &DeviceList->MacInfo[Index];
- CopyMem (&CurMacInfo->Mac, &Mode->PermanentAddress, Mode->HwAddressSize);
- CurMacInfo->Len = (UINT8) Mode->HwAddressSize;
+ CopyMem (&CurMacInfo->Mac, MacAddress.Addr, HwAddressSize);
+ CurMacInfo->Len = (UINT8) HwAddressSize;
+ CurMacInfo->VlanId = NetLibGetVlanId (Handles[Index]);
}
gRT->SetVariable (
@@ -776,7 +778,9 @@ IScsiConfigUpdateForm (
ISCSI_CONFIG_FORM_ENTRY *ConfigFormEntry;
BOOLEAN EntryExisted;
EFI_STATUS Status;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
+ EFI_MAC_ADDRESS MacAddress;
+ UINTN HwAddressSize;
+ UINT16 VlanId;
CHAR16 PortString[128];
UINT16 FormIndex;
UINTN BufferSize;
@@ -813,17 +817,13 @@ IScsiConfigUpdateForm (
ConfigFormEntry->Controller = Controller;
//
- // Get the simple network protocol and convert the MAC address into
- // the formatted string.
+ // Get the MAC address and convert it into the formatted string.
//
- Status = gBS->HandleProtocol (
- Controller,
- &gEfiSimpleNetworkProtocolGuid,
- (VOID **)&Snp
- );
+ Status = NetLibGetMacAddress (Controller, &MacAddress, &HwAddressSize);
ASSERT (Status == EFI_SUCCESS);
+ VlanId = NetLibGetVlanId (Controller);
- IScsiMacAddrToStr (&Snp->Mode->PermanentAddress, Snp->Mode->HwAddressSize, ConfigFormEntry->MacString);
+ IScsiMacAddrToStr (&MacAddress, (UINT32) HwAddressSize, VlanId, ConfigFormEntry->MacString);
//
// Get the normal session configuration data.
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h
index b0a748ae9c..5b2bc6a73b 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.h
@@ -1,7 +1,7 @@
/** @file
The header file of IScsiConfig.c.
-Copyright (c) 2004 - 2008, Intel Corporation.<BR>
+Copyright (c) 2004 - 2009, Intel Corporation.<BR>
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
@@ -70,6 +70,7 @@ extern UINT8 IScsiDxeStrings[];
typedef struct _ISCSI_MAC_INFO {
EFI_MAC_ADDRESS Mac;
UINT8 Len;
+ UINT16 VlanId;
} ISCSI_MAC_INFO;
typedef struct _ISCSI_DEVICE_LIST {
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c
index ca08da7fa4..6ca8a217f5 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c
@@ -247,31 +247,6 @@ IScsiGetNICPciLocation (
}
/**
- Get the MAC address of the controller.
-
- @param[in] Controller The handle of the controller.
-
- @return EFI_MAC_ADDRESS * The mac address.
-**/
-EFI_MAC_ADDRESS *
-IScsiGetMacAddress (
- IN EFI_HANDLE Controller
- )
-{
- EFI_STATUS Status;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
-
- Status = gBS->HandleProtocol (
- Controller,
- &gEfiSimpleNetworkProtocolGuid,
- (VOID **) &Snp
- );
- ASSERT_EFI_ERROR (Status);
-
- return &Snp->Mode->PermanentAddress;
-}
-
-/**
Fill the NIC and target sections in iSCSI Boot Firmware Table.
@param[in] Table The buffer of the ACPI table.
@@ -296,7 +271,8 @@ IScsiFillNICAndTargetSections (
UINT16 *SectionOffset;
UINTN Index;
UINT16 Length;
- EFI_MAC_ADDRESS *Mac;
+ EFI_MAC_ADDRESS MacAddress;
+ UINTN HwAddressSize;
ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier;
EFI_STATUS Status;
@@ -354,8 +330,11 @@ IScsiFillNICAndTargetSections (
IScsiMapV4ToV6Addr (&SessionConfigData->SecondaryDns, &Nic->SecondaryDns);
IScsiMapV4ToV6Addr (&SessionConfigData->DhcpServer, &Nic->DhcpServer);
- Mac = IScsiGetMacAddress (DriverData->Controller);
- CopyMem (Nic->Mac, Mac, sizeof (Nic->Mac));
+ Nic->VLanTag = NetLibGetVlanId (DriverData->Controller);
+
+ Status = NetLibGetMacAddress (DriverData->Controller, &MacAddress, &HwAddressSize);
+ ASSERT (Status == EFI_SUCCESS);
+ CopyMem (Nic->Mac, MacAddress.Addr, sizeof (Nic->Mac));
//
// Get the PCI location of the Nic.
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
index 2d951747ee..865acb090e 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
@@ -353,18 +353,21 @@ IScsiAsciiStrToIp (
/**
Convert the mac address into a hexadecimal encoded "-" seperated string.
- @param[in] Mac The mac address.
- @param[in] Len Length in bytes of the mac address.
- @param[out] Str The storage to return the mac string.
+ @param[in] Mac The mac address.
+ @param[in] Len Length in bytes of the mac address.
+ @param[in] VlanId VLAN ID of the network device.
+ @param[out] Str The storage to return the mac string.
**/
VOID
IScsiMacAddrToStr (
IN EFI_MAC_ADDRESS *Mac,
IN UINT32 Len,
+ IN UINT16 VlanId,
OUT CHAR16 *Str
)
{
UINT32 Index;
+ CHAR16 *String;
for (Index = 0; Index < Len; Index++) {
Str[3 * Index] = (CHAR16) IScsiHexString[(Mac->Addr[Index] >> 4) & 0x0F];
@@ -372,7 +375,12 @@ IScsiMacAddrToStr (
Str[3 * Index + 2] = L'-';
}
- Str[3 * Index - 1] = L'\0';
+ String = &Str[3 * Index - 1] ;
+ if (VlanId != 0) {
+ String += UnicodeSPrint (String, 6 * sizeof (CHAR16), L"\\%04x", (UINTN) VlanId);
+ }
+
+ *String = L'\0';
}
/**
@@ -625,9 +633,10 @@ IScsiGetConfigData (
EFI_STATUS Status;
ISCSI_SESSION *Session;
UINTN BufferSize;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- EFI_SIMPLE_NETWORK_MODE *Mode;
- CHAR16 MacString[65];
+ EFI_MAC_ADDRESS MacAddress;
+ UINTN HwAddressSize;
+ UINT16 VlanId;
+ CHAR16 MacString[70];
//
// get the iSCSI Initiator Name
@@ -643,21 +652,13 @@ IScsiGetConfigData (
return Status;
}
- Status = gBS->HandleProtocol (
- Private->Controller,
- &gEfiSimpleNetworkProtocolGuid,
- (VOID **)&Snp
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Mode = Snp->Mode;
-
//
// Get the mac string, it's the name of various variable
//
- IScsiMacAddrToStr (&Mode->PermanentAddress, Mode->HwAddressSize, MacString);
+ Status = NetLibGetMacAddress (Private->Controller, &MacAddress, &HwAddressSize);
+ ASSERT (Status == EFI_SUCCESS);
+ VlanId = NetLibGetVlanId (Private->Controller);
+ IScsiMacAddrToStr (&MacAddress, (UINT32) HwAddressSize, VlanId, MacString);
//
// Get the normal configuration.
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h
index 27e87942be..61a772f0cb 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h
@@ -1,7 +1,7 @@
/** @file
Miscellaneous definitions for iSCSI driver.
-Copyright (c) 2004 - 2008, Intel Corporation.<BR>
+Copyright (c) 2004 - 2009, Intel Corporation.<BR>
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
@@ -115,14 +115,16 @@ IScsiUnicodeStrToAsciiStr (
/**
Convert the mac address into a hexadecimal encoded "-" seperated string.
- @param[in] Mac The mac address.
- @param[in] Len Length in bytes of the mac address.
- @param[out] Str The storage to return the mac string.
+ @param[in] Mac The mac address.
+ @param[in] Len Length in bytes of the mac address.
+ @param[in] VlanId VLAN ID of the network device.
+ @param[out] Str The storage to return the mac string.
**/
VOID
IScsiMacAddrToStr (
IN EFI_MAC_ADDRESS *Mac,
IN UINT32 Len,
+ IN UINT16 VlanId,
OUT CHAR16 *Str
);