X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FBus%2FPci%2FEhciDxe%2FEhci.h;h=4327f2368a3f4054ef50684b24bec7a469b848d5;hb=37623a5c029e5415fe24b86bf4f6481f8fdfad94;hp=ec2e913dc0e4fce1962056d8985173647d7006df;hpb=78c2ffb5a7172b9c5fbef15b5edc7aae3de5d4f2;p=mirror_edk2.git diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h index ec2e913dc0..4327f2368a 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h +++ b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h @@ -2,8 +2,8 @@ Provides some data struct used by EHCI controller driver. -Copyright (c) 2006 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2012, 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 http://opensource.org/licenses/bsd-license.php @@ -17,11 +17,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define _EFI_EHCI_H_ -#include +#include #include #include +#include + #include #include #include @@ -30,8 +32,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include -#include +#include typedef struct _USB2_HC_DEV USB2_HC_DEV; @@ -40,39 +43,46 @@ typedef struct _USB2_HC_DEV USB2_HC_DEV; #include "EhciUrb.h" #include "EhciSched.h" #include "EhciDebug.h" +#include "ComponentName.h" -typedef enum { - EHC_1_MICROSECOND = 1, - EHC_1_MILLISECOND = 1000 * EHC_1_MICROSECOND, - EHC_1_SECOND = 1000 * EHC_1_MILLISECOND, +// +// EHC timeout experience values +// - // - // EHCI register operation timeout, set by experience - // - EHC_RESET_TIMEOUT = 1 * EHC_1_SECOND, - EHC_GENERIC_TIMEOUT = 10 * EHC_1_MILLISECOND, +#define EHC_1_MICROSECOND 1 +#define EHC_1_MILLISECOND (1000 * EHC_1_MICROSECOND) +#define EHC_1_SECOND (1000 * EHC_1_MILLISECOND) - // - // Wait for roothub port power stable, refers to Spec[EHCI1.0-2.3.9] - // - EHC_ROOT_PORT_RECOVERY_STALL = 20 * EHC_1_MILLISECOND, +// +// EHCI register operation timeout, set by experience +// +#define EHC_RESET_TIMEOUT (1 * EHC_1_SECOND) +#define EHC_GENERIC_TIMEOUT (10 * EHC_1_MILLISECOND) - // - // Sync and Async transfer polling interval, set by experience, - // and the unit of Async is 100us, means 50ms as interval. - // - EHC_SYNC_POLL_INTERVAL = 20 * EHC_1_MICROSECOND, - EHC_ASYNC_POLL_INTERVAL = 50 * 10000U -} EHC_TIMEOUT_EXPERIENCE_VALUE; +// +// Wait for roothub port power stable, refers to Spec[EHCI1.0-2.3.9] +// +#define EHC_ROOT_PORT_RECOVERY_STALL (20 * EHC_1_MILLISECOND) +// +// Sync and Async transfer polling interval, set by experience, +// and the unit of Async is 100us, means 50ms as interval. +// +#define EHC_SYNC_POLL_INTERVAL (1 * EHC_1_MILLISECOND) +#define EHC_ASYNC_POLL_INTERVAL (50 * 10000U) - // - // EHC raises TPL to TPL_NOTIFY to serialize all its operations - // to protect shared data structures. - // -#define EHC_TPL TPL_NOTIFY +// +// EHCI debug port control status register bit definition +// +#define USB_DEBUG_PORT_IN_USE BIT10 +#define USB_DEBUG_PORT_ENABLE BIT28 +#define USB_DEBUG_PORT_OWNER BIT30 -#define USB2_HC_DEV_SIGNATURE EFI_SIGNATURE_32 ('e', 'h', 'c', 'i') +// +// EHC raises TPL to TPL_NOTIFY to serialize all its operations +// to protect shared data structures. +// +#define EHC_TPL TPL_NOTIFY // //Iterate through the doule linked list. NOT delete safe @@ -88,7 +98,7 @@ typedef enum { for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink;\ Entry != (ListHead); Entry = NextEntry, NextEntry = Entry->ForwardLink) -#define EFI_LIST_CONTAINER(Entry, Type, Field) _CR(Entry, Type, Field) +#define EFI_LIST_CONTAINER(Entry, Type, Field) BASE_CR(Entry, Type, Field) #define EHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0XFFFFFFFF)) @@ -98,13 +108,15 @@ typedef enum { #define EHC_REG_BIT_IS_SET(Ehc, Offset, Bit) \ (EHC_BIT_IS_SET(EhcReadOpReg ((Ehc), (Offset)), (Bit))) -#define EHC_FROM_THIS(a) CR(a, USB2_HC_DEV, Usb2Hc, USB2_HC_DEV_SIGNATURE) +#define USB2_HC_DEV_SIGNATURE SIGNATURE_32 ('e', 'h', 'c', 'i') +#define EHC_FROM_THIS(a) CR(a, USB2_HC_DEV, Usb2Hc, USB2_HC_DEV_SIGNATURE) struct _USB2_HC_DEV { UINTN Signature; EFI_USB2_HC_PROTOCOL Usb2Hc; EFI_PCI_IO_PROTOCOL *PciIo; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; UINT64 OriginalPciAttributes; USBHC_MEM_POOL *MemPool; @@ -120,6 +132,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 @@ -130,8 +148,8 @@ struct _USB2_HC_DEV { // // Peroidic (interrupt) transfer schedule data: // - VOID *PeriodFrame; // Mapped as common buffer - VOID *PeriodFrameHost; + VOID *PeriodFrame; // the buffer pointed by this pointer is used to store pci bus address of the QH descriptor. + VOID *PeriodFrameHost; // the buffer pointed by this pointer is used to store host memory address of the QH descriptor. VOID *PeriodFrameMap; EHC_QH *PeriodOne; @@ -143,12 +161,18 @@ struct _USB2_HC_DEV { UINT32 HcStructParams; // Cache of HC structure parameter, EHC_HCSPARAMS_OFFSET UINT32 HcCapParams; // Cache of HC capability parameter, HCCPARAMS UINT32 CapLen; // Capability length - UINT32 High32bitAddr; // // Misc // EFI_UNICODE_STRING_TABLE *ControllerNameTable; + + // + // EHCI debug port info + // + UINT16 DebugPortOffset; // The offset of debug port mmio register + UINT8 DebugPortBarNum; // The bar number of debug port mmio register + UINT8 DebugPortNum; // The port number of usb debug port }; @@ -156,4 +180,69 @@ extern EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding; extern EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName; extern EFI_COMPONENT_NAME2_PROTOCOL gEhciComponentName2; +/** + Test to see if this driver supports ControllerHandle. Any + ControllerHandle that has Usb2HcProtocol installed will + be supported. + + @param This Protocol instance pointer. + @param Controller Handle of device to test. + @param RemainingDevicePath Not used. + + @return EFI_SUCCESS This driver supports this device. + @return EFI_UNSUPPORTED This driver does not support this device. + +**/ +EFI_STATUS +EFIAPI +EhcDriverBindingSupported ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +/** + Starting the Usb EHCI Driver. + + @param This Protocol instance pointer. + @param Controller Handle of device to test. + @param RemainingDevicePath Not used. + + @return EFI_SUCCESS supports this device. + @return EFI_UNSUPPORTED do not support this device. + @return EFI_DEVICE_ERROR cannot be started due to device Error. + @return EFI_OUT_OF_RESOURCES cannot allocate resources. + +**/ +EFI_STATUS +EFIAPI +EhcDriverBindingStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +/** + Stop this driver on ControllerHandle. Support stoping any child handles + created by this driver. + + @param This Protocol instance pointer. + @param Controller Handle of device to stop driver on. + @param NumberOfChildren Number of Children in the ChildHandleBuffer. + @param ChildHandleBuffer List of handles for the children we need to stop. + + @return EFI_SUCCESS Success. + @return EFI_DEVICE_ERROR Fail. + +**/ +EFI_STATUS +EFIAPI +EhcDriverBindingStop ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer + ); + #endif +