]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IScsiDxe/IScsiDriver.c
CryptoPkg ARM: add ArmSoftFloatLib resolution to CryptoPkg.dsc
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiDriver.c
index 42ac8f0fe778e8b80c8d3335a10c6de0061d5ea3..363daadc8f70db50da558924ad0268342a595f61 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The entry point of IScsi driver.\r
 \r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2015, 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
@@ -290,7 +290,7 @@ IScsiStart (
   }\r
 \r
   Status = gBS->OpenProtocol (\r
-                  Private->ChildHandle,\r
+                  Private->ChildHandle, /// Default Tcp child\r
                   ProtocolGuid,\r
                   &Interface,\r
                   Image,\r
@@ -477,7 +477,7 @@ IScsiStart (
     // Don't process the autoconfigure path if it is already established.\r
     //\r
     if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&\r
-        AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_SUCCESS) {\r
+        AttemptConfigData->AutoConfigureSuccess) {\r
       continue;\r
     }\r
 \r
@@ -576,7 +576,7 @@ IScsiStart (
       // IScsi session success. Update the attempt state to NVR.\r
       //\r
       if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) {\r
-        AttemptConfigData->AutoConfigureMode = IP_MODE_AUTOCONFIG_SUCCESS;\r
+        AttemptConfigData->AutoConfigureSuccess = TRUE;\r
       }\r
 \r
       gRT->SetVariable (\r
@@ -651,7 +651,9 @@ IScsiStart (
                            &gIScsiConfigGuid,\r
                            &AttemptConfigOrderSize\r
                            );\r
-    ASSERT (AttemptConfigOrder != NULL);\r
+    if (AttemptConfigOrder == NULL) {\r
+      goto ON_ERROR;\r
+    }\r
     for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {\r
       if (AttemptConfigOrder[Index] == mPrivate->BootSelectedIndex ||\r
           AttemptConfigOrder[Index] == BootSelected) {\r
@@ -689,7 +691,9 @@ IScsiStart (
 \r
         goto ON_EXIT;\r
       } else {\r
-        ASSERT (AttemptConfigOrder[Index] == BootSelected);\r
+        if (AttemptConfigOrder[Index] != BootSelected) {\r
+          goto ON_ERROR;\r
+        }\r
         mPrivate->BootSelectedIndex = BootSelected;\r
         //\r
         // Clear the resource in ExistPrivate.\r
@@ -746,6 +750,30 @@ IScsiStart (
     goto ON_ERROR;\r
   }\r
 \r
+  //\r
+  // ISCSI children should share the default Tcp child, just open the default Tcp child via BY_CHILD_CONTROLLER.\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                  Private->ChildHandle, /// Default Tcp child\r
+                  ProtocolGuid,\r
+                  &Interface,\r
+                  Image,\r
+                  Private->ExtScsiPassThruHandle,\r
+                  EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
+                  );              \r
+  if (EFI_ERROR (Status)) {\r
+    gBS->UninstallMultipleProtocolInterfaces (\r
+           Private->ExtScsiPassThruHandle,\r
+           &gEfiExtScsiPassThruProtocolGuid,\r
+           &Private->IScsiExtScsiPassThru,\r
+           &gEfiDevicePathProtocolGuid,\r
+           Private->DevicePath,\r
+           NULL\r
+           );\r
+    \r
+    goto ON_ERROR;\r
+  }\r
+\r
 ON_EXIT:\r
 \r
   //\r
@@ -834,6 +862,13 @@ IScsiStop (
       ProtocolGuid = &gEfiTcp6ProtocolGuid;\r
     }\r
 \r
+    gBS->CloseProtocol (\r
+           Private->ChildHandle,\r
+           ProtocolGuid,\r
+           Private->Image,\r
+           Private->ExtScsiPassThruHandle\r
+           );\r
+    \r
     gBS->CloseProtocol (\r
            Conn->TcpIo.Handle,\r
            ProtocolGuid,\r
@@ -843,6 +878,7 @@ IScsiStop (
 \r
     return EFI_SUCCESS;\r
   }\r
+  \r
   //\r
   // Get the handle of the controller we are controling.\r
   //\r