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
This commit is contained in:
vanjeff
2009-04-10 08:31:45 +00:00
parent f05b1c14ec
commit 0428a6cb12
10 changed files with 181 additions and 10 deletions

View File

@@ -1449,6 +1449,33 @@ EhcCreateUsb2Hc (
return Ehc;
}
/**
One notified function to stop the Host Controller when gBS->ExitBootServices() called.
@param Event Pointer to this event
@param Context Event hanlder private data
**/
VOID
EFIAPI
EhcExitBootService (
EFI_EVENT Event,
VOID *Context
)
{
USB2_HC_DEV *Ehc;
Ehc = (USB2_HC_DEV *) Context;
//
// Stop the Host Controller
//
EhcHaltHC (Ehc, EHC_GENERIC_TIMEOUT);
return;
}
/**
Starting the Usb EHCI Driver.
@@ -1584,6 +1611,21 @@ EhcDriverBindingStart (
goto UNINSTALL_USBHC;
}
//
// Create event to stop the HC when exit boot service.
//
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
EhcExitBootService,
Ehc,
&gEfiEventExitBootServicesGuid,
&Ehc->ExitBootServiceEvent
);
if (EFI_ERROR (Status)) {
goto UNINSTALL_USBHC;
}
//
// Install the component name protocol, don't fail the start
// because of something for display.
@@ -1712,6 +1754,10 @@ EhcDriverBindingStop (
gBS->CloseEvent (Ehc->PollTimer);
}
if (Ehc->ExitBootServiceEvent != NULL) {
gBS->CloseEvent (Ehc->ExitBootServiceEvent);
}
EhcFreeSched (Ehc);
if (Ehc->ControllerNameTable != NULL) {

View File

@@ -22,6 +22,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/Usb2HostController.h>
#include <Protocol/PciIo.h>
#include <Guid/EventGroup.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiDriverEntryPoint.h>
@@ -120,6 +122,12 @@ struct _USB2_HC_DEV {
EHC_QTD *ShortReadStop;
EFI_EVENT PollTimer;
//
// ExitBootServicesEvent is used to stop the EHC DMA operation
// after exit boot service.
//
EFI_EVENT ExitBootServiceEvent;
//
// Asynchronous(bulk and control) transfer schedule data:
// ReclaimHead is used as the head of the asynchronous transfer

View File

@@ -71,6 +71,9 @@
DebugLib
PcdLib
[Guids]
gEfiEventExitBootServicesGuid ## PRODUCES ## Event
[Protocols]
gEfiPciIoProtocolGuid ## TO_START
gEfiUsb2HcProtocolGuid ## BY_START