]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c
1. Add ISCSI iBFT CHAP types to IScsiBootFirmwareTable.h.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiIbft.c
index f90fff82f2f3e9841de4e1b30544aa31b0384082..372efdc15ef96ac3a56ee480241cfe9e6ec4501e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for iSCSI Boot Firmware Table publication.\r
 \r
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -37,12 +37,6 @@ IScsiInitIbfTableHeader (
   Header->Length    = IBFT_HEAP_OFFSET;\r
   Header->Revision  = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_REVISION;\r
   Header->Checksum  = 0;\r
-\r
-  Header->OemId[0]  = 'I';\r
-  Header->OemId[1]  = 'N';\r
-  Header->OemId[2]  = 'T';\r
-  Header->OemId[3]  = 'E';\r
-  Header->OemId[4]  = 'L';\r
   \r
   CopyMem (Header->OemId, OemId, sizeof (Header->OemId));\r
   CopyMem (&Header->OemTableId, OemTableId, sizeof (UINT64));\r
@@ -150,7 +144,7 @@ IScsiFillInitiatorSection (
   //\r
   // Get the identifier from the handle.\r
   //\r
-  Status = gBS->HandleProtocol (Handle, &gIScsiPrivateGuid, (VOID **) &IScsiIdentifier);\r
+  Status = gBS->HandleProtocol (Handle, &gEfiCallerIdGuid, (VOID **) &IScsiIdentifier);\r
   if (EFI_ERROR (Status)) {\r
     ASSERT (FALSE);\r
     return ;\r
@@ -288,7 +282,7 @@ IScsiFillNICAndTargetSections (
   SectionOffset = &Control->NIC0Offset;\r
 \r
   for (Index = 0; Index < HandleCount; Index++) {\r
-    Status = gBS->HandleProtocol (Handles[Index], &gIScsiPrivateGuid, (VOID **)&IScsiIdentifier);\r
+    Status = gBS->HandleProtocol (Handles[Index], &gEfiCallerIdGuid, (VOID **)&IScsiIdentifier);\r
     if (EFI_ERROR (Status)) {\r
       ASSERT (FALSE);\r
       return ;\r
@@ -355,9 +349,16 @@ IScsiFillNICAndTargetSections (
     Target->Header.Index        = (UINT8) Index;\r
     Target->Header.Flags        = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BLOCK_VALID | EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BOOT_SELECTED;\r
     Target->Port                = SessionConfigData->NvData.TargetPort;\r
-    Target->CHAPType            = AuthConfig->CHAPType;\r
     Target->NicIndex            = (UINT8) Index;\r
 \r
+    if (AuthConfig->CHAPType == ISCSI_CHAP_NONE) {\r
+      Target->CHAPType = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_NO_CHAP;\r
+    } if (AuthConfig->CHAPType == ISCSI_CHAP_UNI) {\r
+      Target->CHAPType = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_CHAP;\r
+    } else if (AuthConfig->CHAPType == ISCSI_CHAP_MUTUAL) {\r
+      Target->CHAPType = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_MUTUAL_CHAP;\r
+    }\r
+\r
     IScsiMapV4ToV6Addr (&SessionConfigData->NvData.TargetIp, &Target->Ip);\r
     CopyMem (Target->BootLun, SessionConfigData->NvData.BootLun, sizeof (Target->BootLun));\r
 \r
@@ -370,7 +371,7 @@ IScsiFillNICAndTargetSections (
     Target->IScsiNameLength = Length;\r
     Target->IScsiNameOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table);\r
 \r
-    if (Target->CHAPType != ISCSI_CHAP_NONE) {\r
+    if (Target->CHAPType != EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_NO_CHAP) {\r
       //\r
       // CHAP Name\r
       //\r
@@ -387,7 +388,7 @@ IScsiFillNICAndTargetSections (
       Target->CHAPSecretLength  = Length;\r
       Target->CHAPSecretOffset  = (UINT16) ((UINTN) *Heap - (UINTN) Table);\r
 \r
-      if (Target->CHAPType == ISCSI_CHAP_MUTUAL) {\r
+      if (Target->CHAPType == EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_MUTUAL_CHAP) {\r
         //\r
         // Reverse CHAP Name\r
         //\r
@@ -484,7 +485,7 @@ IScsiPublishIbft (
   //\r
   Status = gBS->LocateHandleBuffer (\r
                   ByProtocol,\r
-                  &gIScsiPrivateGuid,\r
+                  &gEfiCallerIdGuid,\r
                   NULL,\r
                   &HandleCount,\r
                   &HandleBuffer\r