TianoCore EDK2 master
Loading...
Searching...
No Matches
Uhci.h
Go to the documentation of this file.
1
10#ifndef _EFI_UHCI_H_
11#define _EFI_UHCI_H_
12
13#include <Uefi.h>
14
16#include <Protocol/PciIo.h>
17
18#include <Guid/EventGroup.h>
19
20#include <Library/DebugLib.h>
24#include <Library/UefiLib.h>
25#include <Library/BaseLib.h>
27#include <Library/PcdLib.h>
29
31
32typedef struct _USB_HC_DEV USB_HC_DEV;
33
34#include "UsbHcMem.h"
35#include "UhciQueue.h"
36#include "UhciReg.h"
37#include "UhciSched.h"
38#include "UhciDebug.h"
39#include "ComponentName.h"
40
41//
42// UHC timeout experience values
43//
44
45#define UHC_1_MICROSECOND 1
46#define UHC_1_MILLISECOND (1000 * UHC_1_MICROSECOND)
47#define UHC_1_SECOND (1000 * UHC_1_MILLISECOND)
48
49//
50// UHCI register operation timeout, set by experience
51//
52#define UHC_GENERIC_TIMEOUT UHC_1_SECOND
53
54//
55// Wait for force global resume(FGR) complete, refers to
56// specification[UHCI11-2.1.1]
57//
58#define UHC_FORCE_GLOBAL_RESUME_STALL (20 * UHC_1_MILLISECOND)
59
60//
61// Wait for roothub port reset and recovery, reset stall
62// is set by experience, and recovery stall refers to
63// specification[UHCI11-2.1.1]
64//
65#define UHC_ROOT_PORT_RESET_STALL (50 * UHC_1_MILLISECOND)
66#define UHC_ROOT_PORT_RECOVERY_STALL (10 * UHC_1_MILLISECOND)
67
68//
69// Sync and Async transfer polling interval, set by experience,
70// and the unit of Async is 100us.
71//
72#define UHC_SYNC_POLL_INTERVAL (1 * UHC_1_MILLISECOND)
73#define UHC_ASYNC_POLL_INTERVAL EFI_TIMER_PERIOD_MILLISECONDS(1)
74
75//
76// UHC raises TPL to TPL_NOTIFY to serialize all its operations
77// to protect shared data structures.
78//
79#define UHCI_TPL TPL_NOTIFY
80
81#define USB_HC_DEV_SIGNATURE SIGNATURE_32 ('u', 'h', 'c', 'i')
82
83#pragma pack(1)
84typedef struct {
85 UINT8 ProgInterface;
86 UINT8 SubClassCode;
87 UINT8 BaseCode;
89#pragma pack()
90
91#define UHC_FROM_USB2_HC_PROTO(This) CR(This, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE)
92
93//
94// USB_HC_DEV support the UHCI hardware controller. It schedules
95// the asynchronous interrupt transfer with the same method as
96// EHCI: a reversed tree structure. For synchronous interrupt,
97// control and bulk transfer, it uses three static queue head to
98// schedule them. SyncIntQh is for interrupt transfer. LsCtrlQh is
99// for LOW speed control transfer, and FsCtrlBulkQh is for FULL
100// speed control or bulk transfer. This is because FULL speed contrl
101// or bulk transfer can reclaim the unused bandwidth. Some USB
102// device requires this bandwidth reclamation capability.
103//
105 UINT32 Signature;
107 EFI_PCI_IO_PROTOCOL *PciIo;
108 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
109 UINT64 OriginalPciAttributes;
110
111 //
112 // Schedule data structures
113 //
114 UINT32 *FrameBase; // the buffer pointed by this pointer is used to store pci bus address of the QH descriptor.
115 UINT32 *FrameBaseHostAddr; // the buffer pointed by this pointer is used to store host memory address of the QH descriptor.
116 UHCI_QH_SW *SyncIntQh;
117 UHCI_QH_SW *CtrlQh;
118 UHCI_QH_SW *BulkQh;
119
120 //
121 // Structures to maintain asynchronus interrupt transfers.
122 // When asynchronous interrutp transfer is unlinked from
123 // the frame list, the hardware may still hold a pointer
124 // to it. To synchronize with hardware, its resoureces are
125 // released in two steps using Recycle and RecycleWait.
126 // Check the asynchronous interrupt management routines.
127 //
128 LIST_ENTRY AsyncIntList;
129 EFI_EVENT AsyncIntMonitor;
130 UHCI_ASYNC_REQUEST *Recycle;
131 UHCI_ASYNC_REQUEST *RecycleWait;
132
133 UINTN RootPorts;
134 USBHC_MEM_POOL *MemPool;
135 EFI_UNICODE_STRING_TABLE *CtrlNameTable;
136 VOID *FrameMapping;
137
138 //
139 // ExitBootServicesEvent is used to stop the EHC DMA operation
140 // after exit boot service.
141 //
142 EFI_EVENT ExitBootServiceEvent;
143};
144
145extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;
146extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName;
147extern EFI_COMPONENT_NAME2_PROTOCOL gUhciComponentName2;
148
161EFIAPI
164 IN EFI_HANDLE Controller,
165 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
166 );
167
182EFIAPI
185 IN EFI_HANDLE Controller,
186 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
187 );
188
203EFIAPI
206 IN EFI_HANDLE Controller,
207 IN UINTN NumberOfChildren,
208 IN EFI_HANDLE *ChildHandleBuffer
209 );
210
211#endif
UINT64 UINTN
#define VOID
Definition: Base.h:269
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_STATUS EFIAPI UhciDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Uhci.c:1608
EFI_STATUS EFIAPI UhciDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: Uhci.c:1829
EFI_STATUS EFIAPI UhciDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Uhci.c:1345