]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c
1. Update the maximum length to 224 in ISCSI_CONFIG_IFR_NVDATA() to store 223 byte...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiIbft.c
index d712331189743d8b55aacf3b275630de8e90926e..cbf699f0d2bca647586edb7de111a2cfd0c0cef2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for iSCSI Boot Firmware Table publication.\r
 \r
-Copyright (c) 2004 - 2009, Intel Corporation.<BR>\r
+Copyright (c) 2004 - 2010, Intel Corporation.<BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -20,7 +20,9 @@ UINTN   mTableKey;
 /**\r
   Initialize the header of the iSCSI Boot Firmware Table.\r
   \r
-  @param[out]  Header The header of the iSCSI Boot Firmware Table.\r
+  @param[out]  Header     The header of the iSCSI Boot Firmware Table.\r
+  @param[in]   OemId      The OEM ID.\r
+  @param[in]   OemTableId The OEM table ID for the iBFT.\r
 **/\r
 VOID\r
 IScsiInitIbfTableHeader (\r
@@ -43,7 +45,7 @@ IScsiInitIbfTableHeader (
   Header->OemId[4]  = 'L';\r
   \r
   CopyMem (Header->OemId, OemId, sizeof (Header->OemId));\r
-  Header->OemTableId = *OemTableId;\r
+  CopyMem (&Header->OemTableId, OemTableId, sizeof (UINT64));\r
 }\r
 \r
 /**\r
@@ -244,31 +246,6 @@ IScsiGetNICPciLocation (
   return (UINT16) ((Bus << 8) | (Device << 3) | Function);\r
 }\r
 \r
-/**\r
-  Get the MAC address of the controller.\r
-  \r
-  @param[in]  Controller    The handle of the controller.\r
-\r
-  @return EFI_MAC_ADDRESS * The mac address.\r
-**/\r
-EFI_MAC_ADDRESS *\r
-IScsiGetMacAddress (\r
-  IN EFI_HANDLE  Controller\r
-  )\r
-{\r
-  EFI_STATUS                  Status;\r
-  EFI_SIMPLE_NETWORK_PROTOCOL *Snp;\r
-\r
-  Status = gBS->HandleProtocol (\r
-                  Controller,\r
-                  &gEfiSimpleNetworkProtocolGuid,\r
-                  (VOID **) &Snp\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return &Snp->Mode->PermanentAddress;\r
-}\r
-\r
 /**\r
   Fill the NIC and target sections in iSCSI Boot Firmware Table.\r
 \r
@@ -294,7 +271,8 @@ IScsiFillNICAndTargetSections (
   UINT16                                                *SectionOffset;\r
   UINTN                                                 Index;\r
   UINT16                                                Length;\r
-  EFI_MAC_ADDRESS                                       *Mac;\r
+  EFI_MAC_ADDRESS                                       MacAddress;\r
+  UINTN                                                 HwAddressSize;\r
   ISCSI_PRIVATE_PROTOCOL                                *IScsiIdentifier;\r
   EFI_STATUS                                            Status;\r
 \r
@@ -352,8 +330,11 @@ IScsiFillNICAndTargetSections (
     IScsiMapV4ToV6Addr (&SessionConfigData->SecondaryDns, &Nic->SecondaryDns);\r
     IScsiMapV4ToV6Addr (&SessionConfigData->DhcpServer, &Nic->DhcpServer);\r
 \r
-    Mac = IScsiGetMacAddress (DriverData->Controller);\r
-    CopyMem (Nic->Mac, Mac, sizeof (Nic->Mac));\r
+    Nic->VLanTag = NetLibGetVlanId (DriverData->Controller);\r
+\r
+    Status = NetLibGetMacAddress (DriverData->Controller, &MacAddress, &HwAddressSize);\r
+    ASSERT (Status == EFI_SUCCESS);\r
+    CopyMem (Nic->Mac, MacAddress.Addr, sizeof (Nic->Mac));\r
 \r
     //\r
     // Get the PCI location of the Nic.\r