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:
@ -1449,6 +1449,33 @@ EhcCreateUsb2Hc (
|
|||||||
return Ehc;
|
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.
|
Starting the Usb EHCI Driver.
|
||||||
@ -1584,6 +1611,21 @@ EhcDriverBindingStart (
|
|||||||
goto UNINSTALL_USBHC;
|
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
|
// Install the component name protocol, don't fail the start
|
||||||
// because of something for display.
|
// because of something for display.
|
||||||
@ -1712,6 +1754,10 @@ EhcDriverBindingStop (
|
|||||||
gBS->CloseEvent (Ehc->PollTimer);
|
gBS->CloseEvent (Ehc->PollTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Ehc->ExitBootServiceEvent != NULL) {
|
||||||
|
gBS->CloseEvent (Ehc->ExitBootServiceEvent);
|
||||||
|
}
|
||||||
|
|
||||||
EhcFreeSched (Ehc);
|
EhcFreeSched (Ehc);
|
||||||
|
|
||||||
if (Ehc->ControllerNameTable != NULL) {
|
if (Ehc->ControllerNameTable != NULL) {
|
||||||
|
@ -22,6 +22,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <Protocol/Usb2HostController.h>
|
#include <Protocol/Usb2HostController.h>
|
||||||
#include <Protocol/PciIo.h>
|
#include <Protocol/PciIo.h>
|
||||||
|
|
||||||
|
#include <Guid/EventGroup.h>
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
@ -120,6 +122,12 @@ struct _USB2_HC_DEV {
|
|||||||
EHC_QTD *ShortReadStop;
|
EHC_QTD *ShortReadStop;
|
||||||
EFI_EVENT PollTimer;
|
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:
|
// Asynchronous(bulk and control) transfer schedule data:
|
||||||
// ReclaimHead is used as the head of the asynchronous transfer
|
// ReclaimHead is used as the head of the asynchronous transfer
|
||||||
|
@ -71,6 +71,9 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gEfiEventExitBootServicesGuid ## PRODUCES ## Event
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiPciIoProtocolGuid ## TO_START
|
gEfiPciIoProtocolGuid ## TO_START
|
||||||
gEfiUsb2HcProtocolGuid ## BY_START
|
gEfiUsb2HcProtocolGuid ## BY_START
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
The UHCI driver model and HC protocol routines.
|
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
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -1517,6 +1517,10 @@ UhciFreeDev (
|
|||||||
gBS->CloseEvent (Uhc->AsyncIntMonitor);
|
gBS->CloseEvent (Uhc->AsyncIntMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Uhc->ExitBootServiceEvent != NULL) {
|
||||||
|
gBS->CloseEvent (Uhc->ExitBootServiceEvent);
|
||||||
|
}
|
||||||
|
|
||||||
if (Uhc->MemPool != NULL) {
|
if (Uhc->MemPool != NULL) {
|
||||||
UsbHcFreeMemPool (Uhc->MemPool);
|
UsbHcFreeMemPool (Uhc->MemPool);
|
||||||
}
|
}
|
||||||
@ -1572,6 +1576,31 @@ UhciCleanDevUp (
|
|||||||
UhciFreeDev (Uhc);
|
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.
|
Starting the Usb UHCI Driver.
|
||||||
@ -1703,6 +1732,21 @@ UhciDriverBindingStart (
|
|||||||
goto FREE_UHC;
|
goto FREE_UHC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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
|
// Install the component name protocol
|
||||||
//
|
//
|
||||||
@ -1730,6 +1774,14 @@ UhciDriverBindingStart (
|
|||||||
UhciWriteReg (Uhc->PciIo, USBCMD_OFFSET, USBCMD_RS | USBCMD_MAXP);
|
UhciWriteReg (Uhc->PciIo, USBCMD_OFFSET, USBCMD_RS | USBCMD_MAXP);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
|
UNINSTALL_USBHC:
|
||||||
|
gBS->UninstallMultipleProtocolInterfaces (
|
||||||
|
Controller,
|
||||||
|
&gEfiUsb2HcProtocolGuid,
|
||||||
|
&Uhc->Usb2Hc,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
FREE_UHC:
|
FREE_UHC:
|
||||||
UhciFreeDev (Uhc);
|
UhciFreeDev (Uhc);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
The definition for UHCI driver model and HC protocol routines.
|
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
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
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/UsbHostController.h>
|
||||||
#include <Protocol/PciIo.h>
|
#include <Protocol/PciIo.h>
|
||||||
|
|
||||||
|
#include <Guid/EventGroup.h>
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
@ -137,6 +139,12 @@ struct _USB_HC_DEV {
|
|||||||
USBHC_MEM_POOL *MemPool;
|
USBHC_MEM_POOL *MemPool;
|
||||||
EFI_UNICODE_STRING_TABLE *CtrlNameTable;
|
EFI_UNICODE_STRING_TABLE *CtrlNameTable;
|
||||||
VOID *FrameMapping;
|
VOID *FrameMapping;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ExitBootServicesEvent is used to stop the EHC DMA operation
|
||||||
|
// after exit boot service.
|
||||||
|
//
|
||||||
|
EFI_EVENT ExitBootServiceEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;
|
extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;
|
||||||
|
@ -72,6 +72,8 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gEfiEventExitBootServicesGuid ## PRODUCES ## Event
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiPciIoProtocolGuid ## TO_START
|
gEfiPciIoProtocolGuid ## TO_START
|
||||||
|
@ -630,16 +630,16 @@ CoreExitBootServices (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Notify other drivers that we are exiting boot services.
|
|
||||||
//
|
|
||||||
CoreNotifySignalList (&gEfiEventExitBootServicesGuid);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Disable Timer
|
// Disable Timer
|
||||||
//
|
//
|
||||||
gTimer->SetTimerPeriod (gTimer, 0);
|
gTimer->SetTimerPeriod (gTimer, 0);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Notify other drivers that we are exiting boot services.
|
||||||
|
//
|
||||||
|
CoreNotifySignalList (&gEfiEventExitBootServicesGuid);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Disable CPU Interrupts
|
// Disable CPU Interrupts
|
||||||
//
|
//
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implementation of driver entry point and driver binding protocol.
|
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
|
All rights reserved. This program and the accompanying materials are licensed
|
||||||
and made available under the terms and conditions of the BSD License which
|
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
|
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
|
// 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.
|
Send command to UNDI. It does nothing currently.
|
||||||
@ -634,6 +658,21 @@ SimpleNetworkDriverStart (
|
|||||||
PxeShutdown (Snp);
|
PxeShutdown (Snp);
|
||||||
PxeStop (Snp);
|
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
|
// add SNP to the undi handle
|
||||||
//
|
//
|
||||||
@ -738,6 +777,11 @@ SimpleNetworkDriverStop (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Close EXIT_BOOT_SERIVES Event
|
||||||
|
//
|
||||||
|
gBS->CloseEvent (Snp->ExitBootServicesEvent);
|
||||||
|
|
||||||
Status = gBS->CloseProtocol (
|
Status = gBS->CloseProtocol (
|
||||||
Controller,
|
Controller,
|
||||||
&gEfiNetworkInterfaceIdentifierProtocolGuid_31,
|
&gEfiNetworkInterfaceIdentifierProtocolGuid_31,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Declaration of strctures and functions for SnpDxe driver.
|
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
|
All rights reserved. This program and the accompanying materials are licensed
|
||||||
and made available under the terms and conditions of the BSD License which
|
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
|
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/NetworkInterfaceIdentifier.h>
|
||||||
#include <Protocol/DevicePath.h>
|
#include <Protocol/DevicePath.h>
|
||||||
|
|
||||||
|
#include <Guid/EventGroup.h>
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
@ -118,6 +120,8 @@ typedef struct {
|
|||||||
EFI_PHYSICAL_ADDRESS VirtualAddress;
|
EFI_PHYSICAL_ADDRESS VirtualAddress;
|
||||||
VOID *MapCookie;
|
VOID *MapCookie;
|
||||||
} MapList[MAX_MAP_LENGTH];
|
} MapList[MAX_MAP_LENGTH];
|
||||||
|
|
||||||
|
EFI_EVENT ExitBootServicesEvent;
|
||||||
} SNP_DRIVER;
|
} SNP_DRIVER;
|
||||||
|
|
||||||
#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, Snp, SNP_DRIVER_SIGNATURE)
|
#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, Snp, SNP_DRIVER_SIGNATURE)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
# Component description file for SNP module.
|
# 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
|
# All rights reserved. This program and the accompanying materials are licensed
|
||||||
# and made available under the terms and conditions of the BSD License which
|
# 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
|
# accompanies this distribution. The full text of the license may be found at
|
||||||
@ -65,6 +65,10 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
|
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gEfiEventExitBootServicesGuid ## CONSUMES
|
||||||
|
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
Reference in New Issue
Block a user