3 Copyright (c) 2004 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 The definition for UHCI driver model and HC protocol routines.
29 // The package level header files this module uses
33 // The protocols, PPI and GUID defintions for this module
35 #include <Protocol/Usb2HostController.h>
36 #include <Protocol/UsbHostController.h>
37 #include <Protocol/PciIo.h>
39 // The Library classes this module consumes
41 #include <Library/DebugLib.h>
42 #include <Library/BaseMemoryLib.h>
43 #include <Library/UefiDriverEntryPoint.h>
44 #include <Library/UefiBootServicesTableLib.h>
45 #include <Library/UefiLib.h>
46 #include <Library/BaseLib.h>
47 #include <Library/MemoryAllocationLib.h>
49 #include <IndustryStandard/Pci22.h>
51 typedef struct _USB_HC_DEV USB_HC_DEV
;
54 #include "UhciQueue.h"
56 #include "UhciSched.h"
57 #include "UhciDebug.h"
64 STALL_1_SECOND
= 1000 *STALL_1_MS
,
67 FORCE_GLOBAL_RESUME_TIME
= 20 *STALL_1_MS
,
68 ROOT_PORT_REST_TIME
= 50 *STALL_1_MS
,
69 PORT_RESET_RECOVERY_TIME
= 10 *STALL_1_MS
,
70 INTERRUPT_POLLING_TIME
= 50 * 10000UL,
73 // UHC raises TPL to TPL_NOTIFY to serialize all its operations
74 // to protect shared data structures.
76 UHCI_TPL
= TPL_NOTIFY
,
78 USB_HC_DEV_SIGNATURE
= EFI_SIGNATURE_32 ('u', 'h', 'c', 'i')
89 #define UHC_FROM_USB_HC_PROTO(This) CR(This, USB_HC_DEV, UsbHc, USB_HC_DEV_SIGNATURE)
90 #define UHC_FROM_USB2_HC_PROTO(This) CR(This, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE)
93 // USB_HC_DEV support the UHCI hardware controller. It schedules
94 // the asynchronous interrupt transfer with the same method as
95 // EHCI: a reversed tree structure. For synchronous interrupt,
96 // control and bulk transfer, it uses three static queue head to
97 // schedule them. SyncIntQh is for interrupt transfer. LsCtrlQh is
98 // for LOW speed control transfer, and FsCtrlBulkQh is for FULL
99 // speed control or bulk transfer. This is because FULL speed contrl
100 // or bulk transfer can reclaim the unused bandwidth. Some USB
101 // device requires this bandwidth reclamation capability.
105 EFI_USB_HC_PROTOCOL UsbHc
;
106 EFI_USB2_HC_PROTOCOL Usb2Hc
;
107 EFI_PCI_IO_PROTOCOL
*PciIo
;
110 // Schedule data structures
113 UHCI_QH_SW
*SyncIntQh
;
118 // Structures to maintain asynchronus interrupt transfers.
119 // When asynchronous interrutp transfer is unlinked from
120 // the frame list, the hardware may still hold a pointer
121 // to it. To synchronize with hardware, its resoureces are
122 // released in two steps using Recycle and RecycleWait.
123 // Check the asynchronous interrupt management routines.
125 LIST_ENTRY AsyncIntList
;
126 EFI_EVENT AsyncIntMonitor
;
127 UHCI_ASYNC_REQUEST
*Recycle
;
128 UHCI_ASYNC_REQUEST
*RecycleWait
;
132 USBHC_MEM_POOL
*MemPool
;
133 EFI_UNICODE_STRING_TABLE
*CtrlNameTable
;
137 extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding
;
138 extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName
;