TianoCore EDK2 master
Loading...
Searching...
No Matches
Ehci.h
Go to the documentation of this file.
1
11#ifndef _EFI_EHCI_H_
12#define _EFI_EHCI_H_
13
14#include <Uefi.h>
15
17#include <Protocol/PciIo.h>
18
19#include <Guid/EventGroup.h>
20
21#include <Library/DebugLib.h>
25#include <Library/UefiLib.h>
26#include <Library/BaseLib.h>
28#include <Library/PcdLib.h>
30
32
33typedef struct _USB2_HC_DEV USB2_HC_DEV;
34
35#include "UsbHcMem.h"
36#include "EhciReg.h"
37#include "EhciUrb.h"
38#include "EhciSched.h"
39#include "EhciDebug.h"
40#include "ComponentName.h"
41
42//
43// EHC timeout experience values
44//
45
46#define EHC_1_MICROSECOND 1
47#define EHC_1_MILLISECOND (1000 * EHC_1_MICROSECOND)
48#define EHC_1_SECOND (1000 * EHC_1_MILLISECOND)
49
50//
51// EHCI register operation timeout, set by experience
52//
53#define EHC_RESET_TIMEOUT (1 * EHC_1_SECOND)
54#define EHC_GENERIC_TIMEOUT (10 * EHC_1_MILLISECOND)
55
56//
57// Wait for roothub port power stable, refers to Spec[EHCI1.0-2.3.9]
58//
59#define EHC_ROOT_PORT_RECOVERY_STALL (20 * EHC_1_MILLISECOND)
60
61//
62// Sync and Async transfer polling interval, set by experience,
63// and the unit of Async is 100us, means 1ms as interval.
64//
65#define EHC_SYNC_POLL_INTERVAL (1 * EHC_1_MILLISECOND)
66#define EHC_ASYNC_POLL_INTERVAL EFI_TIMER_PERIOD_MILLISECONDS(1)
67
68//
69// EHCI debug port control status register bit definition
70//
71#define USB_DEBUG_PORT_IN_USE BIT10
72#define USB_DEBUG_PORT_ENABLE BIT28
73#define USB_DEBUG_PORT_OWNER BIT30
74#define USB_DEBUG_PORT_IN_USE_MASK (USB_DEBUG_PORT_IN_USE | \
75 USB_DEBUG_PORT_OWNER)
76
77//
78// EHC raises TPL to TPL_NOTIFY to serialize all its operations
79// to protect shared data structures.
80//
81#define EHC_TPL TPL_NOTIFY
82
83#define EFI_LIST_CONTAINER(Entry, Type, Field) BASE_CR(Entry, Type, Field)
84
85#define EHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0XFFFFFFFF))
86#define EHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINTN)(Addr64), 32) & 0XFFFFFFFF))
87#define EHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
88
89#define EHC_REG_BIT_IS_SET(Ehc, Offset, Bit) \
90 (EHC_BIT_IS_SET(EhcReadOpReg ((Ehc), (Offset)), (Bit)))
91
92#define USB2_HC_DEV_SIGNATURE SIGNATURE_32 ('e', 'h', 'c', 'i')
93#define EHC_FROM_THIS(a) CR(a, USB2_HC_DEV, Usb2Hc, USB2_HC_DEV_SIGNATURE)
94
96 UINTN Signature;
98
100 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
101 UINT64 OriginalPciAttributes;
102 USBHC_MEM_POOL *MemPool;
103
104 //
105 // Schedule data shared between asynchronous and periodic
106 // transfers:
107 // ShortReadStop, as its name indicates, is used to terminate
108 // the short read except the control transfer. EHCI follows
109 // the alternative next QTD point when a short read happens.
110 // For control transfer, even the short read happens, try the
111 // status stage.
112 //
113 EHC_QTD *ShortReadStop;
114 EFI_EVENT PollTimer;
115
116 //
117 // ExitBootServicesEvent is used to stop the EHC DMA operation
118 // after exit boot service.
119 //
120 EFI_EVENT ExitBootServiceEvent;
121
122 //
123 // Asynchronous(bulk and control) transfer schedule data:
124 // ReclaimHead is used as the head of the asynchronous transfer
125 // list. It acts as the reclamation header.
126 //
127 EHC_QH *ReclaimHead;
128
129 //
130 // Periodic (interrupt) transfer schedule data:
131 //
132 VOID *PeriodFrame; // the buffer pointed by this pointer is used to store pci bus address of the QH descriptor.
133 VOID *PeriodFrameHost; // the buffer pointed by this pointer is used to store host memory address of the QH descriptor.
134 VOID *PeriodFrameMap;
135
136 EHC_QH *PeriodOne;
137 LIST_ENTRY AsyncIntTransfers;
138
139 //
140 // EHCI configuration data
141 //
142 UINT32 HcStructParams; // Cache of HC structure parameter, EHC_HCSPARAMS_OFFSET
143 UINT32 HcCapParams; // Cache of HC capability parameter, HCCPARAMS
144 UINT32 CapLen; // Capability length
145
146 //
147 // Misc
148 //
149 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
150
151 //
152 // EHCI debug port info
153 //
154 UINT16 DebugPortOffset; // The offset of debug port mmio register
155 UINT8 DebugPortBarNum; // The bar number of debug port mmio register
156 UINT8 DebugPortNum; // The port number of usb debug port
157
158 BOOLEAN Support64BitDma; // Whether 64 bit DMA may be used with this device
159};
160
161extern EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding;
162extern EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName;
163extern EFI_COMPONENT_NAME2_PROTOCOL gEhciComponentName2;
164
179EFIAPI
182 IN EFI_HANDLE Controller,
183 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
184 );
185
200EFIAPI
203 IN EFI_HANDLE Controller,
204 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
205 );
206
221EFIAPI
224 IN EFI_HANDLE Controller,
225 IN UINTN NumberOfChildren,
226 IN EFI_HANDLE *ChildHandleBuffer
227 );
228
229#endif
UINT64 UINTN
EFI_STATUS EFIAPI EhcDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Ehci.c:1326
EFI_STATUS EFIAPI EhcDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: Ehci.c:2003
EFI_STATUS EFIAPI EhcDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Ehci.c:1637
#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