]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OptionRomPkg/UndiRuntimeDxe/Decode.c
Update UNDI driver to expose dynamic media detect capability.
[mirror_edk2.git] / OptionRomPkg / UndiRuntimeDxe / Decode.c
index d2d4aba888ea924c6bc7dab695ec609563898ea5..65ff692f7f78125e84659de6151162f8abe32ef2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provides the basic UNID functions.\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation\r
+Copyright (c) 2006 - 2010, Intel Corporation\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
@@ -264,7 +264,8 @@ UNDI_GetInitInfo (
   DbPtr->SupportedLoopBackModes = PXE_LOOPBACK_INTERNAL_SUPPORTED |\r
                     PXE_LOOPBACK_EXTERNAL_SUPPORTED;\r
 \r
-  CdbPtr->StatFlags |= PXE_STATFLAGS_CABLE_DETECT_SUPPORTED;\r
+  CdbPtr->StatFlags |= (PXE_STATFLAGS_CABLE_DETECT_SUPPORTED |\r
+                        PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED);\r
   return ;\r
 }\r
 \r
@@ -1086,6 +1087,18 @@ UNDI_Status (
     }\r
   }\r
 \r
+  //\r
+  // Return current media status\r
+  //\r
+  if ((CdbPtr->OpFlags & PXE_OPFLAGS_GET_MEDIA_STATUS) != 0) {\r
+    AdapterInfo->PhyAddress = 0xFF;\r
+    AdapterInfo->CableDetect = 1;\r
+\r
+    if (!PhyDetect (AdapterInfo)) {\r
+      CdbPtr->StatFlags |= PXE_STATFLAGS_GET_STATUS_NO_MEDIA;\r
+    }\r
+  }\r
+\r
   return ;\r
 }\r
 \r