summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Bus
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/Bus
parentf05b1c14ecc255df0cf7b22ac6b53fc1c704b343 (diff)
downloadedk2-0428a6cb12ecc3eecdfab67171d9145663a15187.tar.gz
edk2-0428a6cb12ecc3eecdfab67171d9145663a15187.tar.bz2
edk2-0428a6cb12ecc3eecdfab67171d9145663a15187.zip
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/Bus')
-rw-r--r--MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c46
-rw-r--r--MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h8
-rw-r--r--MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf3
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c54
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h10
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf2
6 files changed, 121 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
index c8de7052bb..d45bdf630c 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
@@ -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.
@@ -1585,6 +1612,21 @@ EhcDriverBindingStart (
}
//
+ // 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) {
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
index 85772fb30d..2137d1cfba 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
@@ -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>
@@ -121,6 +123,12 @@ struct _USB2_HC_DEV {
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
// list. It acts as the reclamation header.
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
index deb540524f..fd98e4200f 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
@@ -71,6 +71,9 @@
DebugLib
PcdLib
+[Guids]
+ gEfiEventExitBootServicesGuid ## PRODUCES ## Event
+
[Protocols]
gEfiPciIoProtocolGuid ## TO_START
gEfiUsb2HcProtocolGuid ## BY_START
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c
index a4110b75a2..abc5c27817 100644
--- a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c
+++ b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c
@@ -2,7 +2,7 @@
The UHCI driver model and HC protocol routines.
-Copyright (c) 2004 - 2008, Intel Corporation
+Copyright (c) 2004 - 2009, Intel Corporation
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
@@ -1517,6 +1517,10 @@ UhciFreeDev (
gBS->CloseEvent (Uhc->AsyncIntMonitor);
}
+ if (Uhc->ExitBootServiceEvent != NULL) {
+ gBS->CloseEvent (Uhc->ExitBootServiceEvent);
+ }
+
if (Uhc->MemPool != NULL) {
UsbHcFreeMemPool (Uhc->MemPool);
}
@@ -1572,6 +1576,31 @@ UhciCleanDevUp (
UhciFreeDev (Uhc);
}
+/**
+ 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
+UhcExitBootService (
+ EFI_EVENT Event,
+ VOID *Context
+ )
+{
+ USB_HC_DEV *Uhc;
+
+ Uhc = (USB_HC_DEV *) Context;
+
+ //
+ // Stop the Host Controller
+ //
+ UhciStopHc (Uhc, UHC_GENERIC_TIMEOUT);
+
+ return;
+}
/**
Starting the Usb UHCI Driver.
@@ -1704,6 +1733,21 @@ UhciDriverBindingStart (
}
//
+ // Create event to stop the HC when exit boot service.
+ //
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ UhcExitBootService,
+ Uhc,
+ &gEfiEventExitBootServicesGuid,
+ &Uhc->ExitBootServiceEvent
+ );
+ if (EFI_ERROR (Status)) {
+ goto UNINSTALL_USBHC;
+ }
+
+ //
// Install the component name protocol
//
Uhc->CtrlNameTable = NULL;
@@ -1730,6 +1774,14 @@ UhciDriverBindingStart (
UhciWriteReg (Uhc->PciIo, USBCMD_OFFSET, USBCMD_RS | USBCMD_MAXP);
return EFI_SUCCESS;
+
+UNINSTALL_USBHC:
+ gBS->UninstallMultipleProtocolInterfaces (
+ Controller,
+ &gEfiUsb2HcProtocolGuid,
+ &Uhc->Usb2Hc,
+ NULL
+ );
FREE_UHC:
UhciFreeDev (Uhc);
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h
index 3f6d42f370..58be29e444 100644
--- a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h
+++ b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h
@@ -2,7 +2,7 @@
The definition for UHCI driver model and HC protocol routines.
-Copyright (c) 2004 - 2007, Intel Corporation
+Copyright (c) 2004 - 2009, Intel Corporation
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
@@ -23,6 +23,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/UsbHostController.h>
#include <Protocol/PciIo.h>
+#include <Guid/EventGroup.h>
+
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiDriverEntryPoint.h>
@@ -137,6 +139,12 @@ struct _USB_HC_DEV {
USBHC_MEM_POOL *MemPool;
EFI_UNICODE_STRING_TABLE *CtrlNameTable;
VOID *FrameMapping;
+
+ //
+ // ExitBootServicesEvent is used to stop the EHC DMA operation
+ // after exit boot service.
+ //
+ EFI_EVENT ExitBootServiceEvent;
};
extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf b/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
index cf91655244..2b7953cd35 100644
--- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
+++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
@@ -72,6 +72,8 @@
DebugLib
PcdLib
+[Guids]
+ gEfiEventExitBootServicesGuid ## PRODUCES ## Event
[Protocols]
gEfiPciIoProtocolGuid ## TO_START