return Ehc;\r
}\r
\r
+/**\r
+ One notified function to stop the Host Controller when gBS->ExitBootServices() called.\r
+\r
+ @param Event Pointer to this event\r
+ @param Context Event hanlder private data\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+EhcExitBootService (\r
+ EFI_EVENT Event,\r
+ VOID *Context\r
+ )\r
+\r
+{\r
+ USB2_HC_DEV *Ehc;\r
+\r
+ Ehc = (USB2_HC_DEV *) Context;\r
+\r
+ //\r
+ // Stop the Host Controller\r
+ //\r
+ EhcHaltHC (Ehc, EHC_GENERIC_TIMEOUT);\r
+\r
+ return;\r
+}\r
+\r
\r
/**\r
Starting the Usb EHCI Driver.\r
goto UNINSTALL_USBHC;\r
}\r
\r
+ //\r
+ // Create event to stop the HC when exit boot service.\r
+ //\r
+ Status = gBS->CreateEventEx (\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_NOTIFY,\r
+ EhcExitBootService,\r
+ Ehc,\r
+ &gEfiEventExitBootServicesGuid,\r
+ &Ehc->ExitBootServiceEvent\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto UNINSTALL_USBHC;\r
+ }\r
+\r
//\r
// Install the component name protocol, don't fail the start\r
// because of something for display.\r
gBS->CloseEvent (Ehc->PollTimer);\r
}\r
\r
+ if (Ehc->ExitBootServiceEvent != NULL) {\r
+ gBS->CloseEvent (Ehc->ExitBootServiceEvent);\r
+ }\r
+\r
EhcFreeSched (Ehc);\r
\r
if (Ehc->ControllerNameTable != NULL) {\r
#include <Protocol/Usb2HostController.h>\r
#include <Protocol/PciIo.h>\r
\r
+#include <Guid/EventGroup.h>\r
+\r
#include <Library/DebugLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/UefiDriverEntryPoint.h>\r
EHC_QTD *ShortReadStop;\r
EFI_EVENT PollTimer;\r
\r
+ //\r
+ // ExitBootServicesEvent is used to stop the EHC DMA operation \r
+ // after exit boot service.\r
+ //\r
+ EFI_EVENT ExitBootServiceEvent;\r
+\r
//\r
// Asynchronous(bulk and control) transfer schedule data:\r
// ReclaimHead is used as the head of the asynchronous transfer\r
DebugLib\r
PcdLib\r
\r
+[Guids]\r
+ gEfiEventExitBootServicesGuid ## PRODUCES ## Event\r
+\r
[Protocols]\r
gEfiPciIoProtocolGuid ## TO_START\r
gEfiUsb2HcProtocolGuid ## BY_START\r
\r
The UHCI driver model and HC protocol routines.\r
\r
-Copyright (c) 2004 - 2008, Intel Corporation\r
+Copyright (c) 2004 - 2009, 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
gBS->CloseEvent (Uhc->AsyncIntMonitor);\r
}\r
\r
+ if (Uhc->ExitBootServiceEvent != NULL) {\r
+ gBS->CloseEvent (Uhc->ExitBootServiceEvent);\r
+ }\r
+ \r
if (Uhc->MemPool != NULL) {\r
UsbHcFreeMemPool (Uhc->MemPool);\r
}\r
UhciFreeDev (Uhc);\r
}\r
\r
+/**\r
+ One notified function to stop the Host Controller when gBS->ExitBootServices() called.\r
+\r
+ @param Event Pointer to this event\r
+ @param Context Event hanlder private data\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+UhcExitBootService (\r
+ EFI_EVENT Event,\r
+ VOID *Context\r
+ )\r
+{\r
+ USB_HC_DEV *Uhc;\r
+\r
+ Uhc = (USB_HC_DEV *) Context;\r
+\r
+ //\r
+ // Stop the Host Controller\r
+ //\r
+ UhciStopHc (Uhc, UHC_GENERIC_TIMEOUT);\r
+\r
+ return;\r
+}\r
\r
/**\r
Starting the Usb UHCI Driver.\r
goto FREE_UHC;\r
}\r
\r
+ //\r
+ // Create event to stop the HC when exit boot service.\r
+ //\r
+ Status = gBS->CreateEventEx (\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_NOTIFY,\r
+ UhcExitBootService,\r
+ Uhc,\r
+ &gEfiEventExitBootServicesGuid,\r
+ &Uhc->ExitBootServiceEvent\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto UNINSTALL_USBHC;\r
+ }\r
+\r
//\r
// Install the component name protocol\r
//\r
UhciWriteReg (Uhc->PciIo, USBCMD_OFFSET, USBCMD_RS | USBCMD_MAXP);\r
\r
return EFI_SUCCESS;\r
+ \r
+UNINSTALL_USBHC:\r
+ gBS->UninstallMultipleProtocolInterfaces (\r
+ Controller,\r
+ &gEfiUsb2HcProtocolGuid,\r
+ &Uhc->Usb2Hc,\r
+ NULL\r
+ );\r
\r
FREE_UHC:\r
UhciFreeDev (Uhc);\r
\r
The definition for UHCI driver model and HC protocol routines.\r
\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
+Copyright (c) 2004 - 2009, 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
#include <Protocol/UsbHostController.h>\r
#include <Protocol/PciIo.h>\r
\r
+#include <Guid/EventGroup.h>\r
+\r
#include <Library/DebugLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/UefiDriverEntryPoint.h>\r
USBHC_MEM_POOL *MemPool;\r
EFI_UNICODE_STRING_TABLE *CtrlNameTable;\r
VOID *FrameMapping;\r
+\r
+ //\r
+ // ExitBootServicesEvent is used to stop the EHC DMA operation \r
+ // after exit boot service.\r
+ //\r
+ EFI_EVENT ExitBootServiceEvent;\r
};\r
\r
extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;\r
DebugLib\r
PcdLib\r
\r
+[Guids]\r
+ gEfiEventExitBootServicesGuid ## PRODUCES ## Event\r
\r
[Protocols]\r
gEfiPciIoProtocolGuid ## TO_START\r
}\r
\r
//\r
- // Notify other drivers that we are exiting boot services.\r
+ // Disable Timer\r
//\r
- CoreNotifySignalList (&gEfiEventExitBootServicesGuid);\r
+ gTimer->SetTimerPeriod (gTimer, 0);\r
\r
//\r
- // Disable Timer\r
+ // Notify other drivers that we are exiting boot services.\r
//\r
- gTimer->SetTimerPeriod (gTimer, 0);\r
+ CoreNotifySignalList (&gEfiEventExitBootServicesGuid);\r
\r
//\r
// Disable CPU Interrupts\r
/** @file\r
Implementation of driver entry point and driver binding protocol.\r
\r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR> \r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR> \r
All rights reserved. This program and the accompanying materials are licensed \r
and made available under the terms and conditions of the BSD License which \r
accompanies this distribution. The full text of the license may be found at \r
// End Global variables\r
//\r
\r
+/**\r
+ One notified function to stop UNDI device when gBS->ExitBootServices() called.\r
+\r
+ @param Event Pointer to this event\r
+ @param Context Event hanlder private data\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+SnpNotifyExitBootServices (\r
+ EFI_EVENT Event,\r
+ VOID *Context\r
+ )\r
+{\r
+ SNP_DRIVER *Snp;\r
+\r
+ Snp = (SNP_DRIVER *)Context;\r
+\r
+ //\r
+ // Shutdown and stop UNDI driver\r
+ //\r
+ PxeShutdown (Snp);\r
+ PxeStop (Snp);\r
+}\r
\r
/**\r
Send command to UNDI. It does nothing currently.\r
PxeShutdown (Snp);\r
PxeStop (Snp);\r
\r
+ //\r
+ // Create EXIT_BOOT_SERIVES Event\r
+ //\r
+ Status = gBS->CreateEventEx (\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_NOTIFY,\r
+ SnpNotifyExitBootServices,\r
+ Snp,\r
+ &gEfiEventExitBootServicesGuid,\r
+ &Snp->ExitBootServicesEvent\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Error_DeleteSNP;\r
+ }\r
+\r
//\r
// add SNP to the undi handle\r
//\r
return Status;\r
}\r
\r
+ //\r
+ // Close EXIT_BOOT_SERIVES Event\r
+ //\r
+ gBS->CloseEvent (Snp->ExitBootServicesEvent);\r
+\r
Status = gBS->CloseProtocol (\r
Controller,\r
&gEfiNetworkInterfaceIdentifierProtocolGuid_31,\r
/** @file\r
Declaration of strctures and functions for SnpDxe driver.\r
\r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR> \r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR> \r
All rights reserved. This program and the accompanying materials are licensed \r
and made available under the terms and conditions of the BSD License which \r
accompanies this distribution. The full text of the license may be found at \r
#include <Protocol/NetworkInterfaceIdentifier.h>\r
#include <Protocol/DevicePath.h>\r
\r
+#include <Guid/EventGroup.h>\r
+\r
#include <Library/DebugLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/UefiDriverEntryPoint.h>\r
EFI_PHYSICAL_ADDRESS VirtualAddress;\r
VOID *MapCookie;\r
} MapList[MAX_MAP_LENGTH];\r
+\r
+ EFI_EVENT ExitBootServicesEvent;\r
} SNP_DRIVER;\r
\r
#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, Snp, SNP_DRIVER_SIGNATURE)\r
#/** @file\r
# Component description file for SNP module.\r
#\r
-# Copyright (c) 2006, Intel Corporation. <BR> \r
+# Copyright (c) 2006 - 2009, Intel Corporation. <BR> \r
# All rights reserved. This program and the accompanying materials are licensed \r
# and made available under the terms and conditions of the BSD License which \r
# accompanies this distribution. The full text of the license may be found at \r
DebugLib\r
\r
\r
+[Guids]\r
+ gEfiEventExitBootServicesGuid ## CONSUMES\r
+\r
+\r
[Protocols]\r
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r