summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-10 08:31:45 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-10 08:31:45 +0000
commit0428a6cb12ecc3eecdfab67171d9145663a15187 (patch)
tree5e0c2540bec607c9f0a3d583bea65ada3817b5ff /MdeModulePkg/Universal
parentf05b1c14ecc255df0cf7b22ac6b53fc1c704b343 (diff)
downloadedk2-0428a6cb12ecc3eecdfab67171d9145663a15187.zip
edk2-0428a6cb12ecc3eecdfab67171d9145663a15187.tar.gz
edk2-0428a6cb12ecc3eecdfab67171d9145663a15187.tar.bz2
fixed DMA not be stopped issue when gBS->ExitBootServices called.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8058 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/Snp.c46
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/Snp.h6
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf6
3 files changed, 55 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
index 0006c44..dde0d60 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
+++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
@@ -1,7 +1,7 @@
/** @file
Implementation of driver entry point and driver binding protocol.
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials are licensed
and made available under the terms and conditions of the BSD License which
accompanies this distribution. The full text of the license may be found at
@@ -22,6 +22,30 @@ V2P *mV2p = NULL; // undi3.0 map_list head
// End Global variables
//
+/**
+ One notified function to stop UNDI device when gBS->ExitBootServices() called.
+
+ @param Event Pointer to this event
+ @param Context Event hanlder private data
+
+**/
+VOID
+EFIAPI
+SnpNotifyExitBootServices (
+ EFI_EVENT Event,
+ VOID *Context
+ )
+{
+ SNP_DRIVER *Snp;
+
+ Snp = (SNP_DRIVER *)Context;
+
+ //
+ // Shutdown and stop UNDI driver
+ //
+ PxeShutdown (Snp);
+ PxeStop (Snp);
+}
/**
Send command to UNDI. It does nothing currently.
@@ -635,6 +659,21 @@ SimpleNetworkDriverStart (
PxeStop (Snp);
//
+ // Create EXIT_BOOT_SERIVES Event
+ //
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ SnpNotifyExitBootServices,
+ Snp,
+ &gEfiEventExitBootServicesGuid,
+ &Snp->ExitBootServicesEvent
+ );
+ if (EFI_ERROR (Status)) {
+ goto Error_DeleteSNP;
+ }
+
+ //
// add SNP to the undi handle
//
Status = gBS->InstallProtocolInterface (
@@ -738,6 +777,11 @@ SimpleNetworkDriverStop (
return Status;
}
+ //
+ // Close EXIT_BOOT_SERIVES Event
+ //
+ gBS->CloseEvent (Snp->ExitBootServicesEvent);
+
Status = gBS->CloseProtocol (
Controller,
&gEfiNetworkInterfaceIdentifierProtocolGuid_31,
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.h b/MdeModulePkg/Universal/Network/SnpDxe/Snp.h
index ff7ad7b..389cbee 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.h
+++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.h
@@ -1,7 +1,7 @@
/** @file
Declaration of strctures and functions for SnpDxe driver.
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials are licensed
and made available under the terms and conditions of the BSD License which
accompanies this distribution. The full text of the license may be found at
@@ -22,6 +22,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/NetworkInterfaceIdentifier.h>
#include <Protocol/DevicePath.h>
+#include <Guid/EventGroup.h>
+
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiDriverEntryPoint.h>
@@ -118,6 +120,8 @@ typedef struct {
EFI_PHYSICAL_ADDRESS VirtualAddress;
VOID *MapCookie;
} MapList[MAX_MAP_LENGTH];
+
+ EFI_EVENT ExitBootServicesEvent;
} SNP_DRIVER;
#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, Snp, SNP_DRIVER_SIGNATURE)
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf b/MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
index c876605..0d53e33 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
+++ b/MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
@@ -1,7 +1,7 @@
#/** @file
# Component description file for SNP module.
#
-# Copyright (c) 2006, Intel Corporation. <BR>
+# Copyright (c) 2006 - 2009, Intel Corporation. <BR>
# All rights reserved. This program and the accompanying materials are licensed
# and made available under the terms and conditions of the BSD License which
# accompanies this distribution. The full text of the license may be found at
@@ -65,6 +65,10 @@
DebugLib
+[Guids]
+ gEfiEventExitBootServicesGuid ## CONSUMES
+
+
[Protocols]
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED