X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FBus%2FPci%2FUhciDxe%2FUhci.h;h=882f5e55ea1c46d8dbf1ccff220e79df6662bb9a;hb=9d510e61fceee7b92955ef9a3c20343752d8ce3f;hp=27d7497b879288c275a4a30e90bf6eb109c13d74;hpb=ed7748fe4a5575adea8055c6da5948fbee65fd7a;p=mirror_edk2.git diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h index 27d7497b87..882f5e55ea 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h +++ b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h @@ -1,37 +1,24 @@ /** @file -Copyright (c) 2004 - 2007, 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 - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - Uhci.h - -Abstract: - The definition for UHCI driver model and HC protocol routines. -Revision History - +Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef _UHCI_H -#define _UHCI_H +#ifndef _EFI_UHCI_H_ +#define _EFI_UHCI_H_ -#include +#include #include #include #include +#include + #include #include #include @@ -39,8 +26,10 @@ Revision History #include #include #include +#include +#include -#include +#include typedef struct _USB_HC_DEV USB_HC_DEV; @@ -49,38 +38,58 @@ typedef struct _USB_HC_DEV USB_HC_DEV; #include "UhciReg.h" #include "UhciSched.h" #include "UhciDebug.h" +#include "ComponentName.h" -enum { - // - // Stall times - // - STALL_1_MS = 1000, - STALL_1_SECOND = 1000 *STALL_1_MS, +// +// UHC timeout experience values +// - UHC_SYN_POLL = 50, - FORCE_GLOBAL_RESUME_TIME = 20 *STALL_1_MS, - ROOT_PORT_REST_TIME = 50 *STALL_1_MS, - PORT_RESET_RECOVERY_TIME = 10 *STALL_1_MS, - INTERRUPT_POLLING_TIME = 50 * 10000UL, +#define UHC_1_MICROSECOND 1 +#define UHC_1_MILLISECOND (1000 * UHC_1_MICROSECOND) +#define UHC_1_SECOND (1000 * UHC_1_MILLISECOND) - // - // UHC raises TPL to TPL_NOTIFY to serialize all its operations - // to protect shared data structures. - // - UHCI_TPL = TPL_NOTIFY, +// +// UHCI register operation timeout, set by experience +// +#define UHC_GENERIC_TIMEOUT UHC_1_SECOND - USB_HC_DEV_SIGNATURE = EFI_SIGNATURE_32 ('u', 'h', 'c', 'i') -}; +// +// Wait for force global resume(FGR) complete, refers to +// specification[UHCI11-2.1.1] +// +#define UHC_FORCE_GLOBAL_RESUME_STALL (20 * UHC_1_MILLISECOND) + +// +// Wait for roothub port reset and recovery, reset stall +// is set by experience, and recovery stall refers to +// specification[UHCI11-2.1.1] +// +#define UHC_ROOT_PORT_RESET_STALL (50 * UHC_1_MILLISECOND) +#define UHC_ROOT_PORT_RECOVERY_STALL (10 * UHC_1_MILLISECOND) + +// +// Sync and Async transfer polling interval, set by experience, +// and the unit of Async is 100us. +// +#define UHC_SYNC_POLL_INTERVAL (1 * UHC_1_MILLISECOND) +#define UHC_ASYNC_POLL_INTERVAL EFI_TIMER_PERIOD_MILLISECONDS(1) + +// +// UHC raises TPL to TPL_NOTIFY to serialize all its operations +// to protect shared data structures. +// +#define UHCI_TPL TPL_NOTIFY + +#define USB_HC_DEV_SIGNATURE SIGNATURE_32 ('u', 'h', 'c', 'i') #pragma pack(1) typedef struct { - UINT8 PI; + UINT8 ProgInterface; UINT8 SubClassCode; UINT8 BaseCode; } USB_CLASSC; #pragma pack() -#define UHC_FROM_USB_HC_PROTO(This) CR(This, USB_HC_DEV, UsbHc, USB_HC_DEV_SIGNATURE) #define UHC_FROM_USB2_HC_PROTO(This) CR(This, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE) // @@ -96,14 +105,16 @@ typedef struct { // struct _USB_HC_DEV { UINT32 Signature; - EFI_USB_HC_PROTOCOL UsbHc; EFI_USB2_HC_PROTOCOL Usb2Hc; EFI_PCI_IO_PROTOCOL *PciIo; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + UINT64 OriginalPciAttributes; // // Schedule data structures // - UINT32 *FrameBase; + UINT32 *FrameBase; // the buffer pointed by this pointer is used to store pci bus address of the QH descriptor. + UINT32 *FrameBaseHostAddr; // the buffer pointed by this pointer is used to store host memory address of the QH descriptor. UHCI_QH_SW *SyncIntQh; UHCI_QH_SW *CtrlQh; UHCI_QH_SW *BulkQh; @@ -126,9 +137,79 @@ 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; -extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName; +extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding; +extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gUhciComponentName2; + +/** + Test to see if this driver supports ControllerHandle. Any + ControllerHandle that has UsbHcProtocol 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 +UhciDriverBindingSupported ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +/** + Starting the Usb UHCI Driver. + + @param This Protocol instance pointer. + @param Controller Handle of device to test. + @param RemainingDevicePath Not used. + + @retval EFI_SUCCESS This driver supports this device. + @retval EFI_UNSUPPORTED This driver does not support this device. + @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error. + EFI_OUT_OF_RESOURCES- Failed due to resource shortage. + +**/ +EFI_STATUS +EFIAPI +UhciDriverBindingStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +/** + Stop this driver on ControllerHandle. Support stopping 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 + @return others + +**/ +EFI_STATUS +EFIAPI +UhciDriverBindingStop ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer + ); #endif