Enhance SNP to be compatible with UNDI driver which doesn’t report correct network...
authorxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 1 Apr 2010 07:44:36 +0000 (07:44 +0000)
committerxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 1 Apr 2010 07:44:36 +0000 (07:44 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk@10327 6f19259b-4bc3-4df7-8a09-765794883524

edk2/MdeModulePkg/Universal/Network/SnpDxe/Receive.c

index a37156a..9d03499 100644 (file)
@@ -132,6 +132,16 @@ PxeReceive (
     *Protocol = (UINT16) PXE_SWAP_UINT16 (Db->Protocol);\r
   }\r
 \r
+  //\r
+  // We have received a packet from network interface, which implies that the\r
+  // network cable should be present. While, some UNDI driver may not report\r
+  // correct media status during Snp->Initialize(). So, we need ensure\r
+  // MediaPresent in SNP mode data is set to correct value.\r
+  //\r
+  if (Snp->Mode.MediaPresentSupported && !Snp->Mode.MediaPresent) {\r
+    Snp->Mode.MediaPresent = TRUE;\r
+  }\r
+\r
   return (*BufferSize <= BuffSize) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL;\r
 }\r
 \r