TianoCore EDK2 master
Loading...
Searching...
No Matches
UhcPeim.h
Go to the documentation of this file.
1
10#ifndef _RECOVERY_UHC_H_
11#define _RECOVERY_UHC_H_
12
13#include <PiPei.h>
14
15#include <Ppi/UsbController.h>
17#include <Ppi/IoMmu.h>
18#include <Ppi/EndOfPeiPhase.h>
19
20#include <Library/DebugLib.h>
24#include <Library/TimerLib.h>
25#include <Library/IoLib.h>
27
28#define USB_SLOW_SPEED_DEVICE 0x01
29#define USB_FULL_SPEED_DEVICE 0x02
30
31//
32// One memory block uses 16 page
33//
34#define NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES 16
35
36#define USBCMD 0 /* Command Register Offset 00-01h */
37#define USBCMD_RS BIT0 /* Run/Stop */
38#define USBCMD_HCRESET BIT1 /* Host reset */
39#define USBCMD_GRESET BIT2 /* Global reset */
40#define USBCMD_EGSM BIT3 /* Global Suspend Mode */
41#define USBCMD_FGR BIT4 /* Force Global Resume */
42#define USBCMD_SWDBG BIT5 /* SW Debug mode */
43#define USBCMD_CF BIT6 /* Config Flag (sw only) */
44#define USBCMD_MAXP BIT7 /* Max Packet (0 = 32, 1 = 64) */
45
46/* Status register */
47#define USBSTS 2 /* Status Register Offset 02-03h */
48#define USBSTS_USBINT BIT0 /* Interrupt due to IOC */
49#define USBSTS_ERROR BIT1 /* Interrupt due to error */
50#define USBSTS_RD BIT2 /* Resume Detect */
51#define USBSTS_HSE BIT3 /* Host System Error - basically PCI problems */
52#define USBSTS_HCPE BIT4 /* Host Controller Process Error - the scripts were buggy */
53#define USBSTS_HCH BIT5 /* HC Halted */
54
55/* Interrupt enable register */
56#define USBINTR 4 /* Interrupt Enable Register 04-05h */
57#define USBINTR_TIMEOUT BIT0 /* Timeout/CRC error enable */
58#define USBINTR_RESUME BIT1 /* Resume interrupt enable */
59#define USBINTR_IOC BIT2 /* Interrupt On Complete enable */
60#define USBINTR_SP BIT3 /* Short packet interrupt enable */
61
62/* Frame Number Register Offset 06-08h */
63#define USBFRNUM 6
64
65/* Frame List Base Address Register Offset 08-0Bh */
66#define USBFLBASEADD 8
67
68/* Start of Frame Modify Register Offset 0Ch */
69#define USBSOF 0x0c
70
71/* USB port status and control registers */
72#define USBPORTSC1 0x10 /*Port 1 offset 10-11h */
73#define USBPORTSC2 0x12 /*Port 2 offset 12-13h */
74
75#define USBPORTSC_CCS BIT0 /* Current Connect Status ("device present") */
76#define USBPORTSC_CSC BIT1 /* Connect Status Change */
77#define USBPORTSC_PED BIT2 /* Port Enable / Disable */
78#define USBPORTSC_PEDC BIT3 /* Port Enable / Disable Change */
79#define USBPORTSC_LSL BIT4 /* Line Status Low bit*/
80#define USBPORTSC_LSH BIT5 /* Line Status High bit*/
81#define USBPORTSC_RD BIT6 /* Resume Detect */
82#define USBPORTSC_LSDA BIT8 /* Low Speed Device Attached */
83#define USBPORTSC_PR BIT9 /* Port Reset */
84#define USBPORTSC_SUSP BIT12 /* Suspend */
85
86#define SETUP_PACKET_ID 0x2D
87#define INPUT_PACKET_ID 0x69
88#define OUTPUT_PACKET_ID 0xE1
89#define ERROR_PACKET_ID 0x55
90
91#define STALL_1_MICRO_SECOND 1
92#define STALL_1_MILLI_SECOND 1000
93
94#pragma pack(1)
95
96typedef struct {
97 UINT32 FrameListPtrTerminate : 1;
98 UINT32 FrameListPtrQSelect : 1;
99 UINT32 FrameListRsvd : 2;
100 UINT32 FrameListPtr : 28;
102
103typedef struct {
104 UINT32 QHHorizontalTerminate : 1;
105 UINT32 QHHorizontalQSelect : 1;
106 UINT32 QHHorizontalRsvd : 2;
107 UINT32 QHHorizontalPtr : 28;
108 UINT32 QHVerticalTerminate : 1;
109 UINT32 QHVerticalQSelect : 1;
110 UINT32 QHVerticalRsvd : 2;
111 UINT32 QHVerticalPtr : 28;
112} QUEUE_HEAD;
113
114typedef struct {
115 QUEUE_HEAD QueueHead;
116 UINT32 Reserved1;
117 UINT32 Reserved2;
118 VOID *PtrNext;
119 VOID *PtrDown;
120 VOID *Reserved3;
121 UINT32 Reserved4;
122} QH_STRUCT;
123
124typedef struct {
125 UINT32 TDLinkPtrTerminate : 1;
126 UINT32 TDLinkPtrQSelect : 1;
127 UINT32 TDLinkPtrDepthSelect : 1;
128 UINT32 TDLinkPtrRsvd : 1;
129 UINT32 TDLinkPtr : 28;
130 UINT32 TDStatusActualLength : 11;
131 UINT32 TDStatusRsvd : 5;
132 UINT32 TDStatus : 8;
133 UINT32 TDStatusIOC : 1;
134 UINT32 TDStatusIOS : 1;
135 UINT32 TDStatusLS : 1;
136 UINT32 TDStatusErr : 2;
137 UINT32 TDStatusSPD : 1;
138 UINT32 TDStatusRsvd2 : 2;
139 UINT32 TDTokenPID : 8;
140 UINT32 TDTokenDevAddr : 7;
141 UINT32 TDTokenEndPt : 4;
142 UINT32 TDTokenDataToggle : 1;
143 UINT32 TDTokenRsvd : 1;
144 UINT32 TDTokenMaxLen : 11;
145 UINT32 TDBufferPtr;
146} TD;
147
148typedef struct {
149 TD TDData;
150 UINT8 *PtrTDBuffer;
151 VOID *PtrNextTD;
152 VOID *PtrNextQH;
153 UINT16 TDBufferLength;
154 UINT16 Reserved;
155} TD_STRUCT;
156
157#pragma pack()
158
160
162 UINT8 *BitArrayPtr;
163 UINTN BitArraySizeInBytes;
164 UINT8 *MemoryBlockPtr;
165 UINTN MemoryBlockSizeInBytes;
167};
168
169#define USB_UHC_DEV_SIGNATURE SIGNATURE_32 ('p', 'u', 'h', 'c')
170typedef struct {
171 UINTN Signature;
172 PEI_USB_HOST_CONTROLLER_PPI UsbHostControllerPpi;
173 EDKII_IOMMU_PPI *IoMmu;
174 EFI_PEI_PPI_DESCRIPTOR PpiDescriptor;
175 //
176 // EndOfPei callback is used to stop the UHC DMA operation
177 // after exit PEI phase.
178 //
179 EFI_PEI_NOTIFY_DESCRIPTOR EndOfPeiNotifyList;
180
181 UINT32 UsbHostControllerBaseAddress;
182 FRAMELIST_ENTRY *FrameListEntry;
183 QH_STRUCT *ConfigQH;
184 QH_STRUCT *BulkQH;
185 //
186 // Header1 used for QH,TD memory blocks management
187 //
188 MEMORY_MANAGE_HEADER *Header1;
190
191#define PEI_RECOVERY_USB_UHC_DEV_FROM_UHCI_THIS(a) CR (a, USB_UHC_DEV, UsbHostControllerPpi, USB_UHC_DEV_SIGNATURE)
192#define PEI_RECOVERY_USB_UHC_DEV_FROM_THIS_NOTIFY(a) CR (a, USB_UHC_DEV, EndOfPeiNotifyList, USB_UHC_DEV_SIGNATURE)
193
218EFIAPI
220 IN EFI_PEI_SERVICES **PeiServices,
222 IN UINT8 DeviceAddress,
223 IN UINT8 DeviceSpeed,
224 IN UINT8 MaximumPacketLength,
225 IN EFI_USB_DEVICE_REQUEST *Request,
226 IN EFI_USB_DATA_DIRECTION TransferDirection,
227 IN OUT VOID *Data OPTIONAL,
228 IN OUT UINTN *DataLength OPTIONAL,
229 IN UINTN TimeOut,
230 OUT UINT32 *TransferResult
231 );
232
261EFIAPI
263 IN EFI_PEI_SERVICES **PeiServices,
265 IN UINT8 DeviceAddress,
266 IN UINT8 EndPointAddress,
267 IN UINT8 MaximumPacketLength,
268 IN OUT VOID *Data,
269 IN OUT UINTN *DataLength,
270 IN OUT UINT8 *DataToggle,
271 IN UINTN TimeOut,
272 OUT UINT32 *TransferResult
273 );
274
288EFIAPI
290 IN EFI_PEI_SERVICES **PeiServices,
292 OUT UINT8 *PortNumber
293 );
294
309EFIAPI
311 IN EFI_PEI_SERVICES **PeiServices,
313 IN UINT8 PortNumber,
314 OUT EFI_USB_PORT_STATUS *PortStatus
315 );
316
331EFIAPI
333 IN EFI_PEI_SERVICES **PeiServices,
335 IN UINT8 PortNumber,
336 IN EFI_USB_PORT_FEATURE PortFeature
337 );
338
355EFIAPI
357 IN EFI_PEI_SERVICES **PeiServices,
359 IN UINT8 PortNumber,
360 IN EFI_USB_PORT_FEATURE PortFeature
361 );
362
374 IN USB_UHC_DEV *UhcDev
375 );
376
388 USB_UHC_DEV *UhcDev
389 );
390
400UINT16
402 IN USB_UHC_DEV *UhcDev,
403 IN UINT32 Port
404 );
405
414VOID
416 IN USB_UHC_DEV *UhcDev,
417 IN UINT32 Port,
418 IN UINT16 Data
419 );
420
429VOID
431 IN USB_UHC_DEV *UhcDev,
432 IN UINT32 Port,
433 IN UINT32 Data
434 );
435
443VOID
445 IN USB_UHC_DEV *UhcDev,
446 IN UINT32 StatusAddr
447 );
448
459BOOLEAN
461 IN USB_UHC_DEV *UhcDev,
462 IN UINT32 StatusRegAddr
463 );
464
473VOID
475 IN USB_UHC_DEV *UhcDev,
476 IN UINT32 FrameListRegAddr,
477 IN UINT32 Addr
478 );
479
491CreateQH (
492 IN USB_UHC_DEV *UhcDev,
493 OUT QH_STRUCT **PtrQH
494 );
495
503VOID
505 IN QH_STRUCT *PtrQH,
506 IN VOID *PtrNext
507 );
508
516VOID
518 IN QH_STRUCT *PtrQH,
519 IN BOOLEAN IsQH
520 );
521
529VOID
531 IN QH_STRUCT *PtrQH,
532 IN BOOLEAN IsValid
533 );
534
542VOID
544 IN QH_STRUCT *PtrQH,
545 IN VOID *PtrNext
546 );
547
555VOID
557 IN QH_STRUCT *PtrQH,
558 IN BOOLEAN IsQH
559 );
560
568VOID
570 IN QH_STRUCT *PtrQH,
571 IN BOOLEAN IsValid
572 );
573
587 IN USB_UHC_DEV *UhcDev,
588 IN UINT32 Size,
589 OUT VOID **PtrStruct
590 );
591
603CreateTD (
604 IN USB_UHC_DEV *UhcDev,
605 OUT TD_STRUCT **PtrTD
606 );
607
626 IN USB_UHC_DEV *UhcDev,
627 IN UINT8 DevAddr,
628 IN UINT8 Endpoint,
629 IN UINT8 DeviceSpeed,
630 IN UINT8 *DevRequest,
631 IN UINT8 *RequestPhy,
632 IN UINT8 RequestLen,
633 OUT TD_STRUCT **PtrTD
634 );
635
655GenDataTD (
656 IN USB_UHC_DEV *UhcDev,
657 IN UINT8 DevAddr,
658 IN UINT8 Endpoint,
659 IN UINT8 *PtrData,
660 IN UINT8 *DataPhy,
661 IN UINT8 Len,
662 IN UINT8 PktID,
663 IN UINT8 Toggle,
664 IN UINT8 DeviceSpeed,
665 OUT TD_STRUCT **PtrTD
666 );
667
684 IN USB_UHC_DEV *UhcDev,
685 IN UINT8 DevAddr,
686 IN UINT8 Endpoint,
687 IN UINT8 PktID,
688 IN UINT8 DeviceSpeed,
689 OUT TD_STRUCT **PtrTD
690 );
691
699VOID
701 IN TD_STRUCT *PtrTDStruct,
702 IN BOOLEAN IsValid
703 );
704
712VOID
714 IN TD_STRUCT *PtrTDStruct,
715 IN BOOLEAN IsQH
716 );
717
725VOID
727 IN TD_STRUCT *PtrTDStruct,
728 IN BOOLEAN IsDepth
729 );
730
738VOID
740 IN TD_STRUCT *PtrTDStruct,
741 IN VOID *PtrNext
742 );
743
752VOID *
754 IN TD_STRUCT *PtrTDStruct
755 );
756
764VOID
766 IN TD_STRUCT *PtrTDStruct,
767 IN BOOLEAN IsEnable
768 );
769
777VOID
779 IN TD_STRUCT *PtrTDStruct,
780 IN UINT8 MaxErrors
781 );
782
790VOID
792 IN TD_STRUCT *PtrTDStruct,
793 IN BOOLEAN IsLowSpeedDevice
794 );
795
803VOID
805 IN TD_STRUCT *PtrTDStruct,
806 IN BOOLEAN IsIsochronous
807 );
808
817VOID
819 IN TD_STRUCT *PtrTDStruct,
820 IN BOOLEAN IsSet
821 );
822
830VOID
832 IN TD_STRUCT *PtrTDStruct,
833 IN BOOLEAN IsActive
834 );
835
844UINT16
846 IN TD_STRUCT *PtrTDStruct,
847 IN UINT16 MaxLen
848 );
849
856VOID
858 IN TD_STRUCT *PtrTDStruct
859 );
860
867VOID
869 IN TD_STRUCT *PtrTDStruct
870 );
871
879VOID
881 IN TD_STRUCT *PtrTDStruct,
882 IN UINTN EndPoint
883 );
884
892VOID
894 IN TD_STRUCT *PtrTDStruct,
895 IN UINTN DevAddr
896 );
897
905VOID
907 IN TD_STRUCT *PtrTDStruct,
908 IN UINT8 PacketID
909 );
910
918VOID
920 IN TD_STRUCT *PtrTDStruct
921 );
922
931BOOLEAN
933 IN TD_STRUCT *PtrTDStruct
934 );
935
944BOOLEAN
946 IN TD_STRUCT *PtrTDStruct
947 );
948
957BOOLEAN
959 IN TD_STRUCT *PtrTDStruct
960 );
961
970BOOLEAN
972 IN TD_STRUCT *PtrTDStruct
973 );
974
983BOOLEAN
985 IN TD_STRUCT *PtrTDStruct
986 );
987
996BOOLEAN
998 IN TD_STRUCT *PtrTDStruct
999 );
1000
1009BOOLEAN
1011 IN TD_STRUCT *PtrTDStruct
1012 );
1013
1022UINT16
1024 IN TD_STRUCT *PtrTDStruct
1025 );
1026
1035BOOLEAN
1037 IN TD_STRUCT *PtrTDStruct
1038 );
1039
1048UINTN
1050 IN TD_STRUCT *PtrFirstTD
1051 );
1052
1060VOID
1061LinkTDToQH (
1062 IN QH_STRUCT *PtrQH,
1063 IN TD_STRUCT *PtrTD
1064 );
1065
1073VOID
1074LinkTDToTD (
1075 IN TD_STRUCT *PtrPreTD,
1076 IN TD_STRUCT *PtrTD
1077 );
1078
1095 IN USB_UHC_DEV *UhcDev,
1096 IN TD_STRUCT *PtrTD,
1097 OUT UINTN *ActualLen,
1098 IN UINTN TimeOut,
1099 OUT UINT32 *TransferResult
1100 );
1101
1119 IN USB_UHC_DEV *UhcDev,
1120 IN TD_STRUCT *PtrTD,
1121 IN OUT UINTN *ActualLen,
1122 IN UINT8 *DataToggle,
1123 IN UINTN TimeOut,
1124 OUT UINT32 *TransferResult
1125 );
1126
1134VOID
1136 IN USB_UHC_DEV *UhcDev,
1137 IN TD_STRUCT *PtrFirstTD
1138 );
1139
1151BOOLEAN
1153 IN TD_STRUCT *PtrTD,
1154 OUT UINT32 *Result,
1155 OUT UINTN *ErrTDPos,
1156 OUT UINTN *ActualTransferSize
1157 );
1158
1172 IN USB_UHC_DEV *UhcDev,
1173 OUT MEMORY_MANAGE_HEADER **MemoryHeader,
1174 IN UINTN MemoryBlockSizeInPages
1175 );
1176
1188 IN USB_UHC_DEV *UhcDev
1189 );
1190
1204 IN USB_UHC_DEV *UhcDev,
1205 OUT UINT8 **Pool,
1206 IN UINTN AllocSize
1207 );
1208
1222 IN MEMORY_MANAGE_HEADER *MemoryHeader,
1223 OUT VOID **Pool,
1224 IN UINTN NumberOfMemoryUnit
1225 );
1226
1235VOID
1237 IN USB_UHC_DEV *UhcDev,
1238 IN UINT8 *Pool,
1239 IN UINTN AllocSize
1240 );
1241
1249VOID
1251 IN MEMORY_MANAGE_HEADER *MemoryHeader,
1252 IN MEMORY_MANAGE_HEADER *NewMemoryHeader
1253 );
1254
1269 IN USB_UHC_DEV *Uhc,
1270 IN OUT VOID *Request,
1271 OUT UINT8 **MappedAddr,
1272 OUT VOID **Map
1273 );
1274
1292 IN USB_UHC_DEV *Uhc,
1293 IN EFI_USB_DATA_DIRECTION Direction,
1294 IN VOID *Data,
1295 IN OUT UINTN *Len,
1296 OUT UINT8 *PktId,
1297 OUT UINT8 **MappedAddr,
1298 OUT VOID **Map
1299 );
1300
1322IoMmuMap (
1323 IN EDKII_IOMMU_PPI *IoMmu,
1324 IN EDKII_IOMMU_OPERATION Operation,
1325 IN VOID *HostAddress,
1326 IN OUT UINTN *NumberOfBytes,
1327 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
1328 OUT VOID **Mapping
1329 );
1330
1338VOID
1339IoMmuUnmap (
1340 IN EDKII_IOMMU_PPI *IoMmu,
1341 IN VOID *Mapping
1342 );
1343
1365 IN EDKII_IOMMU_PPI *IoMmu,
1366 IN UINTN Pages,
1367 OUT VOID **HostAddress,
1368 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
1369 OUT VOID **Mapping
1370 );
1371
1378VOID
1379IoMmuInit (
1380 OUT EDKII_IOMMU_PPI **IoMmu
1381 );
1382
1383#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_USB_PORT_FEATURE
EFI_USB_DATA_DIRECTION
Definition: UsbIo.h:44
EDKII_IOMMU_OPERATION
Definition: IoMmu.h:44
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID SetQHVerticalQHorTDSelect(IN QH_STRUCT *PtrQH, IN BOOLEAN IsQH)
Definition: UhcPeim.c:1409
VOID SetFrameListBaseAddress(IN USB_UHC_DEV *UhcDev, IN UINT32 FrameListRegAddr, IN UINT32 Addr)
Definition: UhcPeim.c:1272
VOID SetTDTokenDeviceAddress(IN TD_STRUCT *PtrTDStruct, IN UINTN DevAddr)
Definition: UhcPeim.c:2168
VOID SetTDTokenEndPoint(IN TD_STRUCT *PtrTDStruct, IN UINTN EndPoint)
Definition: UhcPeim.c:2149
VOID SetTDDataBuffer(IN TD_STRUCT *PtrTDStruct)
EFI_STATUS EFIAPI UhcControlTransfer(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 DeviceAddress, IN UINT8 DeviceSpeed, IN UINT8 MaximumPacketLength, IN EFI_USB_DEVICE_REQUEST *Request, IN EFI_USB_DATA_DIRECTION TransferDirection, IN OUT VOID *Data OPTIONAL, IN OUT UINTN *DataLength OPTIONAL, IN UINTN TimeOut, OUT UINT32 *TransferResult)
Definition: UhcPeim.c:241
VOID SetTDTokenDataToggle1(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2114
EFI_STATUS EFIAPI UhcBulkTransfer(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 MaximumPacketLength, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN TimeOut, OUT UINT32 *TransferResult)
Definition: UhcPeim.c:489
BOOLEAN GetTDLinkPtrValidorInvalid(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2381
BOOLEAN CheckTDsResults(IN TD_STRUCT *PtrTD, OUT UINT32 *Result, OUT UINTN *ErrTDPos, OUT UINTN *ActualTransferSize)
Definition: UhcPeim.c:2688
VOID LinkTDToQH(IN QH_STRUCT *PtrQH, IN TD_STRUCT *PtrTD)
Definition: UhcPeim.c:2433
VOID SetTDLinkPtrValidorInvalid(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsValid)
Definition: UhcPeim.c:1864
VOID IoMmuUnmap(IN EDKII_IOMMU_PPI *IoMmu, IN VOID *Mapping)
Definition: DmaMem.c:103
EFI_STATUS CreateQH(IN USB_UHC_DEV *UhcDev, OUT QH_STRUCT **PtrQH)
Definition: UhcPeim.c:1295
VOID ClearStatusReg(IN USB_UHC_DEV *UhcDev, IN UINT32 StatusAddr)
Definition: UhcPeim.c:1225
EFI_STATUS CreateMemoryBlock(IN USB_UHC_DEV *UhcDev, OUT MEMORY_MANAGE_HEADER **MemoryHeader, IN UINTN MemoryBlockSizeInPages)
Definition: UhcPeim.c:2770
EFI_STATUS UhciMapUserRequest(IN USB_UHC_DEV *Uhc, IN OUT VOID *Request, OUT UINT8 **MappedAddr, OUT VOID **Map)
Definition: UhcPeim.c:3187
EFI_STATUS InitializeMemoryManagement(IN USB_UHC_DEV *UhcDev)
Definition: UhcPeim.c:2843
VOID SetQHHorizontalQHorTDSelect(IN QH_STRUCT *PtrQH, IN BOOLEAN IsQH)
Definition: UhcPeim.c:1348
EFI_STATUS EFIAPI UhcGetRootHubPortNumber(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, OUT UINT8 *PortNumber)
Definition: UhcPeim.c:708
UINTN CountTDsNumber(IN TD_STRUCT *PtrFirstTD)
Definition: UhcPeim.c:2405
VOID USBWritePortDW(IN USB_UHC_DEV *UhcDev, IN UINT32 Port, IN UINT32 Data)
Definition: UhcPeim.c:1208
EFI_STATUS CreateFrameList(USB_UHC_DEV *UhcDev)
Definition: UhcPeim.c:1101
EFI_STATUS CreateStatusTD(IN USB_UHC_DEV *UhcDev, IN UINT8 DevAddr, IN UINT8 Endpoint, IN UINT8 PktID, IN UINT8 DeviceSpeed, OUT TD_STRUCT **PtrTD)
Definition: UhcPeim.c:1763
VOID SetQHHorizontalLinkPtr(IN QH_STRUCT *PtrQH, IN VOID *PtrNext)
Definition: UhcPeim.c:1327
EFI_STATUS AllocMemInMemoryBlock(IN MEMORY_MANAGE_HEADER *MemoryHeader, OUT VOID **Pool, IN UINTN NumberOfMemoryUnit)
Definition: UhcPeim.c:2956
EFI_STATUS UhcAllocatePool(IN USB_UHC_DEV *UhcDev, OUT UINT8 **Pool, IN UINTN AllocSize)
Definition: UhcPeim.c:2874
VOID USBWritePortW(IN USB_UHC_DEV *UhcDev, IN UINT32 Port, IN UINT16 Data)
Definition: UhcPeim.c:1190
VOID SetorClearTDControlIOC(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsSet)
Definition: UhcPeim.c:2044
BOOLEAN IsStatusOK(IN USB_UHC_DEV *UhcDev, IN UINT32 StatusRegAddr)
Definition: UhcPeim.c:1247
VOID SetTDLinkPtrQHorTDSelect(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsQH)
Definition: UhcPeim.c:1884
VOID SetQHHorizontalValidorInvalid(IN QH_STRUCT *PtrQH, IN BOOLEAN IsValid)
Definition: UhcPeim.c:1368
VOID SetTDControlErrorCounter(IN TD_STRUCT *PtrTDStruct, IN UINT8 MaxErrors)
Definition: UhcPeim.c:1982
VOID UhcFreePool(IN USB_UHC_DEV *UhcDev, IN UINT8 *Pool, IN UINTN AllocSize)
Definition: UhcPeim.c:3091
EFI_STATUS InitializeUsbHC(IN USB_UHC_DEV *UhcDev)
Definition: UhcPeim.c:1041
BOOLEAN IsTDStatusBufferError(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2251
VOID SetTDStatusActiveorInactive(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsActive)
Definition: UhcPeim.c:2064
VOID DeleteQueuedTDs(IN USB_UHC_DEV *UhcDev, IN TD_STRUCT *PtrFirstTD)
Definition: UhcPeim.c:2645
EFI_STATUS EFIAPI UhcGetRootHubPortStatus(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 PortNumber, OUT EFI_USB_PORT_STATUS *PortStatus)
Definition: UhcPeim.c:756
BOOLEAN IsTDStatusCRCTimeOutError(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2317
EFI_STATUS AllocateTDorQHStruct(IN USB_UHC_DEV *UhcDev, IN UINT32 Size, OUT VOID **PtrStruct)
Definition: UhcPeim.c:1453
BOOLEAN IsTDStatusStalled(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2229
VOID SetTDLinkPtr(IN TD_STRUCT *PtrTDStruct, IN VOID *PtrNext)
Definition: UhcPeim.c:1923
EFI_STATUS GenDataTD(IN USB_UHC_DEV *UhcDev, IN UINT8 DevAddr, IN UINT8 Endpoint, IN UINT8 *PtrData, IN UINT8 *DataPhy, IN UINT8 Len, IN UINT8 PktID, IN UINT8 Toggle, IN UINT8 DeviceSpeed, OUT TD_STRUCT **PtrTD)
Definition: UhcPeim.c:1643
UINT16 GetTDStatusActualLength(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2361
EFI_STATUS GenSetupStageTD(IN USB_UHC_DEV *UhcDev, IN UINT8 DevAddr, IN UINT8 Endpoint, IN UINT8 DeviceSpeed, IN UINT8 *DevRequest, IN UINT8 *RequestPhy, IN UINT8 RequestLen, OUT TD_STRUCT **PtrTD)
Definition: UhcPeim.c:1529
EFI_STATUS EFIAPI UhcSetRootHubPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
Definition: UhcPeim.c:855
UINT16 SetTDTokenMaxLength(IN TD_STRUCT *PtrTDStruct, IN UINT16 MaxLen)
Definition: UhcPeim.c:2089
VOID SetTDLinkPtrDepthorBreadth(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsDepth)
Definition: UhcPeim.c:1903
VOID EnableorDisableTDShortPacket(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsEnable)
Definition: UhcPeim.c:1963
VOID SetTDLoworFullSpeedDevice(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsLowSpeedDevice)
Definition: UhcPeim.c:2005
VOID SetQHVerticalLinkPtr(IN QH_STRUCT *PtrQH, IN VOID *PtrNext)
Definition: UhcPeim.c:1388
BOOLEAN IsTDStatusNAKReceived(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2295
EFI_STATUS IoMmuMap(IN EDKII_IOMMU_PPI *IoMmu, IN EDKII_IOMMU_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
Definition: DmaMem.c:33
EFI_STATUS ExecuteControlTransfer(IN USB_UHC_DEV *UhcDev, IN TD_STRUCT *PtrTD, OUT UINTN *ActualLen, IN UINTN TimeOut, OUT UINT32 *TransferResult)
Definition: UhcPeim.c:2511
EFI_STATUS UhciMapUserData(IN USB_UHC_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: UhcPeim.c:3231
VOID * GetTDLinkPtr(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:1944
EFI_STATUS ExecBulkTransfer(IN USB_UHC_DEV *UhcDev, IN TD_STRUCT *PtrTD, IN OUT UINTN *ActualLen, IN UINT8 *DataToggle, IN UINTN TimeOut, OUT UINT32 *TransferResult)
Definition: UhcPeim.c:2574
VOID SetQHVerticalValidorInvalid(IN QH_STRUCT *PtrQH, IN BOOLEAN IsValid)
Definition: UhcPeim.c:1429
VOID IoMmuInit(OUT EDKII_IOMMU_PPI **IoMmu)
Definition: DmaMem.c:238
EFI_STATUS IoMmuAllocateBuffer(IN EDKII_IOMMU_PPI *IoMmu, IN UINTN Pages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
Definition: DmaMem.c:134
BOOLEAN IsTDStatusBitStuffError(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2339
UINT16 USBReadPortW(IN USB_UHC_DEV *UhcDev, IN UINT32 Port)
Definition: UhcPeim.c:1173
VOID SetTDTokenPacketID(IN TD_STRUCT *PtrTDStruct, IN UINT8 PacketID)
Definition: UhcPeim.c:2187
VOID SetTDControlIsochronousorNot(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsIsochronous)
Definition: UhcPeim.c:2024
VOID SetTDTokenDataToggle0(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2131
VOID LinkTDToTD(IN TD_STRUCT *PtrPreTD, IN TD_STRUCT *PtrTD)
Definition: UhcPeim.c:2465
EFI_STATUS EFIAPI UhcClearRootHubPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
Definition: UhcPeim.c:933
EFI_STATUS CreateTD(IN USB_UHC_DEV *UhcDev, OUT TD_STRUCT **PtrTD)
Definition: UhcPeim.c:1489
BOOLEAN IsTDStatusActive(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2207
VOID InsertMemoryHeaderToList(IN MEMORY_MANAGE_HEADER *MemoryHeader, IN MEMORY_MANAGE_HEADER *NewMemoryHeader)
Definition: UhcPeim.c:3159
BOOLEAN IsTDStatusBabbleError(IN TD_STRUCT *PtrTDStruct)
Definition: UhcPeim.c:2273
Definition: UhcPeim.h:124