TianoCore EDK2 master
Loading...
Searching...
No Matches
UhciQueue.h
Go to the documentation of this file.
1
10#ifndef _EFI_UHCI_QUEUE_H_
11#define _EFI_UHCI_QUEUE_H_
12
13//
14// Macroes used to set various links in UHCI's driver.
15// In this UHCI driver, QH's horizontal link always pointers to other QH,
16// and its vertical link always pointers to TD. TD's next pointer always
17// pointers to other sibling TD. Frame link always pointers to QH because
18// ISO transfer isn't supported.
19//
20// We should use UINT32 to access these pointers to void race conditions
21// with hardware.
22//
23#define QH_HLINK(Pointer, Terminate) \
24 (((UINT32) ((UINTN) (Pointer)) & 0xFFFFFFF0) | 0x02 | ((Terminate) ? 0x01 : 0))
25
26#define QH_VLINK(Pointer, Terminate) \
27 (((UINT32) ((UINTN) (Pointer)) & 0xFFFFFFF0) | ((Terminate) ? 0x01 : 0))
28
29#define TD_LINK(Pointer, VertFirst, Terminate) \
30 (((UINT32) ((UINTN) (Pointer)) & 0xFFFFFFF0) | \
31 ((VertFirst) ? 0x04 : 0) | ((Terminate) ? 0x01 : 0))
32
33#define LINK_TERMINATED(Link) (((Link) & 0x01) != 0)
34
35#define UHCI_ADDR(QhOrTd) ((VOID *) (UINTN) ((QhOrTd) & 0xFFFFFFF0))
36
37#pragma pack(1)
38//
39// Both links in QH has this internal structure:
40// Next pointer: 28, Reserved: 2, NextIsQh: 1, Terminate: 1
41// This is the same as frame list entry.
42//
43typedef struct {
44 UINT32 HorizonLink;
45 UINT32 VerticalLink;
47
48//
49// Next link in TD has this internal structure:
50// Next pointer: 28, Reserved: 1, Vertical First: 1, NextIsQh: 1, Terminate: 1
51//
52typedef struct {
53 UINT32 NextLink;
54 UINT32 ActualLen : 11;
55 UINT32 Reserved1 : 5;
56 UINT32 Status : 8;
57 UINT32 IntOnCpl : 1;
58 UINT32 IsIsoch : 1;
59 UINT32 LowSpeed : 1;
60 UINT32 ErrorCount : 2;
61 UINT32 ShortPacket : 1;
62 UINT32 Reserved2 : 2;
63 UINT32 PidCode : 8;
64 UINT32 DeviceAddr : 7;
65 UINT32 EndPoint : 4;
66 UINT32 DataToggle : 1;
67 UINT32 Reserved3 : 1;
68 UINT32 MaxPacketLen : 11;
69 UINT32 DataBuffer;
71#pragma pack()
72
73typedef struct _UHCI_TD_SW UHCI_TD_SW;
74typedef struct _UHCI_QH_SW UHCI_QH_SW;
75
77 UHCI_QH_HW QhHw;
78 UHCI_QH_SW *NextQh;
79 UHCI_TD_SW *TDs;
80 UINTN Interval;
81};
82
84 UHCI_TD_HW TdHw;
85 UHCI_TD_SW *NextTd;
86 UINT8 *Data;
87 UINT16 DataLen;
88};
89
98VOID
100 IN USB_HC_DEV *Uhc,
101 IN UHCI_QH_SW *Qh,
102 IN UHCI_TD_SW *Td
103 );
104
114VOID
116 IN UHCI_QH_SW *Qh,
117 IN UHCI_TD_SW *Td
118 );
119
134 IN USB_HC_DEV *Uhc,
135 IN OUT VOID *Request,
136 OUT UINT8 **MappedAddr,
137 OUT VOID **Map
138 );
139
157 IN USB_HC_DEV *Uhc,
158 IN EFI_USB_DATA_DIRECTION Direction,
159 IN VOID *Data,
160 IN OUT UINTN *Len,
161 OUT UINT8 *PktId,
162 OUT UINT8 **MappedAddr,
163 OUT VOID **Map
164 );
165
175VOID
177 IN USB_HC_DEV *Uhc,
178 IN UHCI_TD_SW *FirstTd
179 );
180
192 IN USB_HC_DEV *Uhc,
193 IN UINTN Interval
194 );
195
215 IN USB_HC_DEV *Uhc,
216 IN UINT8 DeviceAddr,
217 IN UINT8 DataPktId,
218 IN UINT8 *Request,
219 IN UINT8 *RequestPhy,
220 IN UINT8 *Data,
221 IN UINT8 *DataPhy,
222 IN UINTN DataLen,
223 IN UINT8 MaxPacket,
224 IN BOOLEAN IsLow
225 );
226
246 IN USB_HC_DEV *Uhc,
247 IN UINT8 DevAddr,
248 IN UINT8 EndPoint,
249 IN UINT8 PktId,
250 IN UINT8 *Data,
251 IN UINT8 *DataPhy,
252 IN UINTN DataLen,
253 IN OUT UINT8 *DataToggle,
254 IN UINT8 MaxPacket,
255 IN BOOLEAN IsLow
256 );
257
258#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_USB_DATA_DIRECTION
Definition: UsbIo.h:44
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID UhciDestoryTds(IN USB_HC_DEV *Uhc, IN UHCI_TD_SW *FirstTd)
Definition: UhciQueue.c:222
EFI_STATUS UhciMapUserRequest(IN USB_HC_DEV *Uhc, IN OUT VOID *Request, OUT UINT8 **MappedAddr, OUT VOID **Map)
Definition: UhciQueue.c:25
VOID UhciLinkTdToQh(IN USB_HC_DEV *Uhc, IN UHCI_QH_SW *Qh, IN UHCI_TD_SW *Td)
Definition: UhciQueue.c:152
UHCI_QH_SW * UhciCreateQh(IN USB_HC_DEV *Uhc, IN UINTN Interval)
Definition: UhciQueue.c:249
EFI_STATUS UhciMapUserData(IN USB_HC_DEV *Uhc, IN EFI_USB_DATA_DIRECTION Direction, IN VOID *Data, IN OUT UINTN *Len, OUT UINT8 *PktId, OUT UINT8 **MappedAddr, OUT VOID **Map)
Definition: UhciQueue.c:69
UHCI_TD_SW * UhciCreateBulkOrIntTds(IN USB_HC_DEV *Uhc, IN UINT8 DevAddr, IN UINT8 EndPoint, IN UINT8 PktId, IN UINT8 *Data, IN UINT8 *DataPhy, IN UINTN DataLen, IN OUT UINT8 *DataToggle, IN UINT8 MaxPacket, IN BOOLEAN IsLow)
Definition: UhciQueue.c:610
UHCI_TD_SW * UhciCreateCtrlTds(IN USB_HC_DEV *Uhc, IN UINT8 DeviceAddr, IN UINT8 DataPktId, IN UINT8 *Request, IN UINT8 *RequestPhy, IN UINT8 *Data, IN UINT8 *DataPhy, IN UINTN DataLen, IN UINT8 MaxPacket, IN BOOLEAN IsLow)
Definition: UhciQueue.c:475
VOID UhciUnlinkTdFromQh(IN UHCI_QH_SW *Qh, IN UHCI_TD_SW *Td)
Definition: UhciQueue.c:176