/** @file\r
Implementation of Managed Network Protocol I/O functions.\r
\r
-Copyright (c) 2005 - 2009, Intel Corporation.<BR>\r
+Copyright (c) 2005 - 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\r
of the BSD License which accompanies this distribution. The full\r
\r
HeaderSize = Snp->Mode->MediaHeaderSize - TxData->HeaderLength;\r
\r
+ //\r
+ // Check media status before transmit packet.\r
+ // Note: media status will be updated by periodic timer MediaDetectTimer.\r
+ //\r
+ if (!Snp->Mode->MediaPresent) {\r
+ //\r
+ // Media not present, skip packet transmit and report EFI_NO_MEDIA\r
+ //\r
+ Status = EFI_NO_MEDIA;\r
+ goto SIGNAL_TOKEN;\r
+ }\r
+\r
//\r
// Start the timeout event.\r
//\r
/**\r
Remove the received packets if timeout occurs.\r
\r
- @param[in] Event The event this notify function registered to.\r
- @param[in] Context Pointer to the context data registered to the\r
- event.\r
+ @param[in] Event The event this notify function registered to.\r
+ @param[in] Context Pointer to the context data registered to the event.\r
\r
**/\r
VOID\r
}\r
}\r
\r
+/**\r
+ Poll to update MediaPresent field in SNP ModeData by Snp->GetStatus().\r
+\r
+ @param[in] Event The event this notify function registered to.\r
+ @param[in] Context Pointer to the context data registered to the event.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+MnpCheckMediaStatus (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ MNP_DEVICE_DATA *MnpDeviceData;\r
+ EFI_SIMPLE_NETWORK_PROTOCOL *Snp;\r
+ UINT32 InterruptStatus;\r
+\r
+ MnpDeviceData = (MNP_DEVICE_DATA *) Context;\r
+ NET_CHECK_SIGNATURE (MnpDeviceData, MNP_DEVICE_DATA_SIGNATURE);\r
+\r
+ Snp = MnpDeviceData->Snp;\r
+ if (Snp->Mode->MediaPresentSupported) {\r
+ //\r
+ // Upon successful return of GetStatus(), the MediaPresent field of\r
+ // EFI_SIMPLE_NETWORK_MODE will be updated to reflect any change of media status\r
+ //\r
+ Snp->GetStatus (Snp, &InterruptStatus, NULL);\r
+ }\r
+}\r
+\r
/**\r
Poll to receive the packets from Snp. This function is either called by upperlayer\r
protocols/applications or the system poll timer notify mechanism.\r
\r
- @param[in] Event The event this notify function registered to.\r
- @param[in, out] Context Pointer to the context data registered to the event.\r
+ @param[in] Event The event this notify function registered to.\r
+ @param[in] Context Pointer to the context data registered to the event.\r
\r
**/\r
VOID\r
EFIAPI\r
MnpSystemPoll (\r
- IN EFI_EVENT Event,\r
- IN OUT VOID *Context\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
)\r
{\r
MNP_DEVICE_DATA *MnpDeviceData;\r