]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add ISCSI iBFT CHAP types to IScsiBootFirmwareTable.h.
authorFu Siyuan <siyuan.fu@intel.com>
Tue, 10 Dec 2013 09:14:39 +0000 (09:14 +0000)
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 10 Dec 2013 09:14:39 +0000 (09:14 +0000)
2. Fix ISCSI iBFT's CHAP type mismatch bug caused by 14918.

Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Dong, Guo <guo.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14953 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c
MdePkg/Include/IndustryStandard/IScsiBootFirmwareTable.h
NetworkPkg/IScsiDxe/IScsiIbft.c

index 04f5df34ad8567da0c694f53f5ae782046edd616..372efdc15ef96ac3a56ee480241cfe9e6ec4501e 100644 (file)
@@ -349,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->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
     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
     IScsiMapV4ToV6Addr (&SessionConfigData->NvData.TargetIp, &Target->Ip);\r
     CopyMem (Target->BootLun, SessionConfigData->NvData.BootLun, sizeof (Target->BootLun));\r
 \r
@@ -364,7 +371,7 @@ IScsiFillNICAndTargetSections (
     Target->IScsiNameLength = Length;\r
     Target->IScsiNameOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table);\r
 \r
     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
       //\r
       // CHAP Name\r
       //\r
@@ -381,7 +388,7 @@ IScsiFillNICAndTargetSections (
       Target->CHAPSecretLength  = Length;\r
       Target->CHAPSecretOffset  = (UINT16) ((UINTN) *Heap - (UINTN) Table);\r
 \r
       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
         //\r
         // Reverse CHAP Name\r
         //\r
index 0d519d0a65da820d90d59795565618cc613ed1cb..1e1a5ac97e7ee863eac0f79cbdd7ec5e1a4ebd25 100644 (file)
@@ -2,7 +2,7 @@
   The definition for iSCSI Boot Firmware Table, it's defined in Microsoft's\r
   iSCSI Boot Firmware Table(iBFT) as Defined in ACPI 3.0b Specification. \r
   \r
   The definition for iSCSI Boot Firmware Table, it's defined in Microsoft's\r
   iSCSI Boot Firmware Table(iBFT) as Defined in ACPI 3.0b Specification. \r
   \r
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 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
   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
@@ -157,6 +157,10 @@ typedef struct {
 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_RADIUS_CHAP      BIT2\r
 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_RADIUS_RCHAP     BIT3\r
 \r
 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_RADIUS_CHAP      BIT2\r
 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_RADIUS_RCHAP     BIT3\r
 \r
+#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_NO_CHAP        0\r
+#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_CHAP           1\r
+#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_MUTUAL_CHAP    2\r
+\r
 #pragma pack()\r
 \r
 #endif\r
 #pragma pack()\r
 \r
 #endif\r
index 9dba4e6f365ca2bad35fce5a38599663422dcc25..3c179bfc5140bfe587a550ad75c86807594bd442 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for iSCSI Boot Firmware Table publication.\r
 \r
 /** @file\r
   Implementation for iSCSI Boot Firmware Table publication.\r
 \r
-Copyright (c) 2004 - 2012, 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
 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
@@ -359,9 +359,13 @@ IScsiFillNICAndTargetSections (
     Target->Port                = NvData->TargetPort;\r
 \r
     if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {\r
     Target->Port                = NvData->TargetPort;\r
 \r
     if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {\r
-      Target->CHAPType          = AuthConfig->CHAPType;\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
     } else if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_NONE) {\r
     } else if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_NONE) {\r
-      Target->CHAPType          = ISCSI_AUTH_TYPE_NONE;\r
+      Target->CHAPType = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_NO_CHAP;\r
     }\r
 \r
     Target->NicIndex            = (UINT8) Index;\r
     }\r
 \r
     Target->NicIndex            = (UINT8) Index;\r
@@ -402,7 +406,7 @@ IScsiFillNICAndTargetSections (
       Target->CHAPSecretLength  = Length;\r
       Target->CHAPSecretOffset  = (UINT16) ((UINTN) *Heap - (UINTN) Table);\r
 \r
       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
         //\r
         // Reverse CHAP Name.\r
         //\r