]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
For network dynamic media support:
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiProto.c
index ac0d8d821f5d15521d415a0adedb41e7966f823f..2261bc17f0216cd3e018846d00c82b60c965cb00 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation of iSCSI protocol based on RFC3720.\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
@@ -276,7 +276,9 @@ IScsiDestroyConnection (
 \r
   @retval EFI_SUCCESS          The iSCSI session login procedure finished.\r
   @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+  @retval EFI_NO_MEDIA         There was a media error.\r
   @retval Others               Other errors as indicated.\r
+\r
 **/\r
 EFI_STATUS\r
 IScsiSessionLogin (\r
@@ -287,9 +289,19 @@ IScsiSessionLogin (
   ISCSI_SESSION     *Session;\r
   ISCSI_CONNECTION  *Conn;\r
   EFI_TCP4_PROTOCOL *Tcp4;\r
+  BOOLEAN           MediaPresent;\r
 \r
   Session = &Private->Session;\r
 \r
+  //\r
+  // Check media status before session login\r
+  //\r
+  MediaPresent = TRUE;\r
+  NetLibDetectMedia (Private->Controller, &MediaPresent);\r
+  if (!MediaPresent) {\r
+    return EFI_NO_MEDIA;\r
+  }\r
+\r
   //\r
   // Create a connection for the session.\r
   //\r