1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
|
/** @file
This file contains URB request, each request is warpped in a
URB (Usb Request Block).
Copyright (c) 2013-2015 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "Ohci.h"
/**
Create a TD
@Param Ohc UHC private data
@retval TD structure pointer
**/
TD_DESCRIPTOR *
OhciCreateTD (
IN USB_OHCI_HC_DEV *Ohc
)
{
TD_DESCRIPTOR *Td;
Td = UsbHcAllocateMem(Ohc->MemPool, sizeof(TD_DESCRIPTOR));
if (Td == NULL) {
DEBUG ((EFI_D_INFO, "STV allocate TD fail !\r\n"));
return NULL;
}
Td->CurrBufferPointer = 0;
Td->NextTD = 0;
Td->BufferEndPointer = 0;
Td->NextTDPointer = 0;
return Td;
}
/**
Free a TD
@Param Ohc UHC private data
@Param Td Pointer to a TD to free
@retval EFI_SUCCESS TD freed
**/
EFI_STATUS
OhciFreeTD (
IN USB_OHCI_HC_DEV *Ohc,
IN TD_DESCRIPTOR *Td
)
{
if (Td == NULL) {
return EFI_SUCCESS;
}
UsbHcFreeMem(Ohc->MemPool, Td, sizeof(TD_DESCRIPTOR));
return EFI_SUCCESS;
}
/**
Create a ED
@Param Ohc Device private data
@retval ED descriptor pointer
**/
ED_DESCRIPTOR *
OhciCreateED (
USB_OHCI_HC_DEV *Ohc
)
{
ED_DESCRIPTOR *Ed;
Ed = UsbHcAllocateMem(Ohc->MemPool, sizeof (ED_DESCRIPTOR));
if (Ed == NULL) {
DEBUG ((EFI_D_INFO, "STV allocate ED fail !\r\n"));
return NULL;
}
Ed->Word0.Skip = 1;
Ed->TdTailPointer = 0;
Ed->Word2.TdHeadPointer = 0;
Ed->NextED = 0;
return Ed;
}
/**
Free a ED
@Param Ohc UHC private data
@Param Ed Pointer to a ED to free
@retval EFI_SUCCESS ED freed
**/
EFI_STATUS
OhciFreeED (
IN USB_OHCI_HC_DEV *Ohc,
IN ED_DESCRIPTOR *Ed
)
{
if (Ed == NULL) {
return EFI_SUCCESS;
}
UsbHcFreeMem(Ohc->MemPool, Ed, sizeof(ED_DESCRIPTOR));
return EFI_SUCCESS;
}
/**
Free ED
@Param Ohc Device private data
@Param Ed Pointer to a ED to free
@retval EFI_SUCCESS ED freed
**/
EFI_STATUS
OhciFreeAllTDFromED (
IN USB_OHCI_HC_DEV *Ohc,
IN ED_DESCRIPTOR *Ed
)
{
TD_DESCRIPTOR *HeadTd;
TD_DESCRIPTOR *TailTd;
TD_DESCRIPTOR *Td;
TD_DESCRIPTOR *TempTd;
if (Ed == NULL) {
return EFI_SUCCESS;
}
HeadTd = TD_PTR (Ed->Word2.TdHeadPointer);
TailTd = (TD_DESCRIPTOR *)(UINTN)(Ed->TdTailPointer);
Td = HeadTd;
while (Td != TailTd) {
TempTd = Td;
Td = (TD_DESCRIPTOR *)(UINTN)(Td->NextTDPointer);
OhciFreeTD (Ohc, TempTd);
}
return EFI_SUCCESS;
}
/**
Find a working ED match the requirement
@Param EdHead Head of the ED list
@Param DeviceAddress Device address to search
@Param EndPointNum End point num to search
@Param EdDir ED Direction to search
@retval ED descriptor searched
**/
ED_DESCRIPTOR *
OhciFindWorkingEd (
IN ED_DESCRIPTOR *EdHead,
IN UINT8 DeviceAddress,
IN UINT8 EndPointNum,
IN UINT8 EdDir
)
{
ED_DESCRIPTOR *Ed;
for (Ed = EdHead; Ed != NULL; Ed = (ED_DESCRIPTOR *)(UINTN)(Ed->NextED)) {
if (Ed->Word2.Halted == 0 && Ed->Word0.Skip == 0 &&
Ed->Word0.FunctionAddress == DeviceAddress && Ed->Word0.EndPointNum == EndPointNum &&
Ed->Word0.Direction == EdDir) {
break;
}
}
return Ed;
}
/**
Initialize interrupt list.
@Param Ohc Device private data
@retval EFI_SUCCESS Initialization done
**/
EFI_STATUS
OhciInitializeInterruptList (
USB_OHCI_HC_DEV *Ohc
)
{
static UINT32 Leaf[32] = {0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30, 1, 17,
9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31};
UINT32 *HccaInterruptTable;
UINTN Index;
UINTN Level;
UINTN Count;
ED_DESCRIPTOR *NewEd;
HccaInterruptTable = Ohc->HccaMemoryBlock->HccaInterruptTable;
for (Index = 0; Index < 32; Index++) {
NewEd = OhciCreateED (Ohc);
if (NewEd == NULL) {
return EFI_OUT_OF_RESOURCES;
}
HccaInterruptTable[Index] = (UINT32)(UINTN)NewEd;
}
for (Index = 0; Index < 32; Index++) {
Ohc->IntervalList[0][Index] = (ED_DESCRIPTOR *)(UINTN)HccaInterruptTable[Leaf[Index]];
}
Count = 32;
for (Level = 1; Level <= 5; Level++) {
Count = Count >> 1;
for (Index = 0; Index < Count; Index++) {
Ohc->IntervalList[Level][Index] = OhciCreateED (Ohc);
if (HccaInterruptTable[Index] == 0) {
return EFI_OUT_OF_RESOURCES;
}
Ohc->IntervalList[Level - 1][Index * 2 ]->NextED = (UINT32)(UINTN)Ohc->IntervalList[Level][Index];
Ohc->IntervalList[Level - 1][Index * 2 + 1]->NextED = (UINT32)(UINTN)Ohc->IntervalList[Level][Index];
}
}
return EFI_SUCCESS;
}
/**
Attach an ED
@Param Ed Ed to be attached
@Param NewEd Ed to attach
@retval EFI_SUCCESS NewEd attached to Ed
@retval EFI_INVALID_PARAMETER Ed is NULL
**/
EFI_STATUS
OhciAttachED (
IN ED_DESCRIPTOR *Ed,
IN ED_DESCRIPTOR *NewEd
)
{
ED_DESCRIPTOR *Temp;
if (Ed == NULL) {
return EFI_INVALID_PARAMETER;
}
if (Ed->NextED == 0){
Ed->NextED = (UINT32)(UINTN)NewEd;
} else {
Temp = (ED_DESCRIPTOR *)(UINTN)(Ed->NextED);
Ed->NextED = (UINT32)(UINTN)NewEd;
NewEd->NextED = (UINT32)(UINTN)Temp;
}
return EFI_SUCCESS;
}
/**
Count ED number on a ED chain
@Param Ed Head of the ED chain
@retval ED number on the chain
**/
UINTN
CountEdNum (
IN ED_DESCRIPTOR *Ed
)
{
UINTN Count;
Count = 0;
while (Ed) {
Ed = (ED_DESCRIPTOR *)(UINTN)(Ed->NextED);
Count++;
}
return Count;
}
/**
Find the minimal burn ED list on a specific depth level
@Param Ohc Device private data
@Param Depth Depth level
@retval ED list found
**/
ED_DESCRIPTOR *
OhciFindMinInterruptEDList (
IN USB_OHCI_HC_DEV *Ohc,
IN UINT32 Depth
)
{
UINTN EdNum;
UINTN MinEdNum;
ED_DESCRIPTOR *TempEd;
ED_DESCRIPTOR *HeadEd;
UINTN Index;
if (Depth > 5) {
return NULL;
}
MinEdNum = 0xFFFFFFFF;
TempEd = NULL;
for (Index = 0; Index < (UINTN)(32 >> Depth); Index++) {
HeadEd = Ohc->IntervalList[Depth][Index];
EdNum = CountEdNum (HeadEd);
if (EdNum < MinEdNum) {
MinEdNum = EdNum;
TempEd = HeadEd;
}
}
ASSERT (TempEd != NULL);
return TempEd;
}
/**
Attach an ED to an ED list
@Param OHC UHC private data
@Param ListType Type of the ED list
@Param Ed ED to attach
@Param EdList ED list to be attached
@retval EFI_SUCCESS ED attached to ED list
**/
ED_DESCRIPTOR *
OhciAttachEDToList (
IN USB_OHCI_HC_DEV *Ohc,
IN DESCRIPTOR_LIST_TYPE ListType,
IN ED_DESCRIPTOR *Ed,
IN ED_DESCRIPTOR *EdList
)
{
ED_DESCRIPTOR *HeadEd;
HeadEd = NULL;
switch(ListType) {
case CONTROL_LIST:
HeadEd = (ED_DESCRIPTOR *) OhciGetMemoryPointer (Ohc, HC_CONTROL_HEAD);
if (HeadEd == NULL) {
OhciSetMemoryPointer (Ohc, HC_CONTROL_HEAD, Ed);
HeadEd = Ed;
} else {
OhciAttachED (HeadEd, Ed);
}
break;
case BULK_LIST:
HeadEd = (ED_DESCRIPTOR *) OhciGetMemoryPointer (Ohc, HC_BULK_HEAD);
if (HeadEd == NULL) {
OhciSetMemoryPointer (Ohc, HC_BULK_HEAD, Ed);
HeadEd = Ed;
} else {
OhciAttachED (HeadEd, Ed);
}
break;
case INTERRUPT_LIST:
OhciAttachED (EdList, Ed);
break;
default:
ASSERT (FALSE);
}
return HeadEd;
}
/**
Remove interrupt EDs that match requirement
@Param Ohc UHC private data
@Param IntEd The address of Interrupt endpoint
@retval EFI_SUCCESS EDs match requirement removed
**/
EFI_STATUS
OhciFreeInterruptEdByEd (
IN USB_OHCI_HC_DEV *Ohc,
IN ED_DESCRIPTOR *IntEd
)
{
ED_DESCRIPTOR *Ed;
ED_DESCRIPTOR *TempEd;
UINTN Index;
if (IntEd == NULL)
return EFI_SUCCESS;
for (Index = 0; Index < 32; Index++) {
Ed = (ED_DESCRIPTOR *)(UINTN)Ohc->HccaMemoryBlock->HccaInterruptTable[Index];
if (Ed == NULL) {
continue;
}
while (Ed->NextED != 0) {
if (Ed->NextED == (UINT32)(UINTN)IntEd ) {
TempEd = (ED_DESCRIPTOR *)(UINTN)(Ed->NextED);
Ed->NextED = TempEd->NextED;
OhciFreeED (Ohc, TempEd);
} else {
Ed = (ED_DESCRIPTOR *)(UINTN)(Ed->NextED);
}
}
}
return EFI_SUCCESS;
}
/**
Remove interrupt EDs that match requirement
@Param Ohc UHC private data
@Param FunctionAddress Requirement on function address
@Param EndPointNum Requirement on end point number
@retval EFI_SUCCESS EDs match requirement removed
**/
EFI_STATUS
OhciFreeInterruptEdByAddr (
IN USB_OHCI_HC_DEV *Ohc,
IN UINT8 FunctionAddress,
IN UINT8 EndPointNum
)
{
ED_DESCRIPTOR *Ed;
ED_DESCRIPTOR *TempEd;
UINTN Index;
for (Index = 0; Index < 32; Index++) {
Ed = (ED_DESCRIPTOR *)(UINTN)Ohc->HccaMemoryBlock->HccaInterruptTable[Index];
if (Ed == NULL) {
continue;
}
while (Ed->NextED != 0) {
TempEd = (ED_DESCRIPTOR *)(UINTN)(Ed->NextED);
if (TempEd->Word0.FunctionAddress == FunctionAddress &&
TempEd->Word0.EndPointNum == EndPointNum ) {
Ed->NextED = TempEd->NextED;
OhciFreeED (Ohc, TempEd);
} else {
Ed = (ED_DESCRIPTOR *)(UINTN)(Ed->NextED);
}
}
}
return EFI_SUCCESS;
}
/**
Link Td2 to the end of Td1
@Param Td1 TD to be linked
@Param Td2 TD to link
@retval EFI_SUCCESS TD successfully linked
@retval EFI_INVALID_PARAMETER Td1 is NULL
**/
EFI_STATUS
OhciLinkTD (
IN TD_DESCRIPTOR *Td1,
IN TD_DESCRIPTOR *Td2
)
{
TD_DESCRIPTOR *TempTd;
if (Td1 == NULL) {
return EFI_INVALID_PARAMETER;
}
if (Td1 == Td2) {
return EFI_SUCCESS;
}
TempTd = Td1;
while (TempTd->NextTD != 0) {
TempTd = (TD_DESCRIPTOR *)(UINTN)(TempTd->NextTD);
}
TempTd->NextTD = (UINT32)(UINTN)Td2;
TempTd->NextTDPointer = (UINT32)(UINTN)Td2;
return EFI_SUCCESS;
}
/**
Attach TD list to ED
@Param Ed ED which TD list attach on
@Param HeadTd Head of the TD list to attach
@retval EFI_SUCCESS TD list attached on the ED
**/
EFI_STATUS
OhciAttachTDListToED (
IN ED_DESCRIPTOR *Ed,
IN TD_DESCRIPTOR *HeadTd
)
{
TD_DESCRIPTOR *TempTd;
TempTd = TD_PTR (Ed->Word2.TdHeadPointer);
if (TempTd != NULL) {
while (TempTd->NextTD != 0) {
TempTd = (TD_DESCRIPTOR *)(UINTN)(TempTd->NextTD);
}
TempTd->NextTD = (UINT32)(UINTN)HeadTd;
TempTd->NextTDPointer = (UINT32)(UINTN)HeadTd;
} else {
Ed->Word2.TdHeadPointer = RIGHT_SHIFT_4 ((UINT32)(UINTN)HeadTd);
}
return EFI_SUCCESS;
}
/**
Set value to ED specific field
@Param Ed ED to be set
@Param Field Field to be set
@Param Value Value to set
@retval EFI_SUCCESS Value set
**/
EFI_STATUS
OhciSetEDField (
IN ED_DESCRIPTOR *Ed,
IN UINT32 Field,
IN UINT32 Value
)
{
if (Field & ED_FUNC_ADD) {
Ed->Word0.FunctionAddress = Value;
}
if (Field & ED_ENDPT_NUM) {
Ed->Word0.EndPointNum = Value;
}
if (Field & ED_DIR) {
Ed->Word0.Direction = Value;
}
if (Field & ED_SPEED) {
Ed->Word0.Speed = Value;
}
if (Field & ED_SKIP) {
Ed->Word0.Skip = Value;
}
if (Field & ED_FORMAT) {
Ed->Word0.Format = Value;
}
if (Field & ED_MAX_PACKET) {
Ed->Word0.MaxPacketSize = Value;
}
if (Field & ED_PDATA) {
Ed->Word0.FreeSpace = Value;
}
if (Field & ED_ZERO) {
Ed->Word2.Zero = Value;
}
if (Field & ED_TDTAIL_PTR) {
Ed->TdTailPointer = Value;
}
if (Field & ED_HALTED) {
Ed->Word2.Halted = Value;
}
if (Field & ED_DTTOGGLE) {
Ed->Word2.ToggleCarry = Value;
}
if (Field & ED_TDHEAD_PTR) {
Ed->Word2.TdHeadPointer = RIGHT_SHIFT_4 (Value);
}
if (Field & ED_NEXT_EDPTR) {
Ed->NextED = Value;
}
return EFI_SUCCESS;
}
/**
Get value from an ED's specific field
@Param Ed ED pointer
@Param Field Field to get value from
@retval Value of the field
**/
UINT32
OhciGetEDField (
IN ED_DESCRIPTOR *Ed,
IN UINT32 Field
)
{
switch (Field) {
case ED_FUNC_ADD:
return Ed->Word0.FunctionAddress;
break;
case ED_ENDPT_NUM:
return Ed->Word0.EndPointNum;
break;
case ED_DIR:
return Ed->Word0.Direction;
break;
case ED_SPEED:
return Ed->Word0.Speed;
break;
case ED_SKIP:
return Ed->Word0.Skip;
break;
case ED_FORMAT:
return Ed->Word0.Format;
break;
case ED_MAX_PACKET:
return Ed->Word0.MaxPacketSize;
break;
case ED_TDTAIL_PTR:
return Ed->TdTailPointer;
break;
case ED_HALTED:
return Ed->Word2.Halted;
break;
case ED_DTTOGGLE:
return Ed->Word2.ToggleCarry;
break;
case ED_TDHEAD_PTR:
return Ed->Word2.TdHeadPointer << 4;
break;
case ED_NEXT_EDPTR:
return Ed->NextED;
break;
default:
ASSERT (FALSE);
}
return 0;
}
/**
Set value to TD specific field
@Param Td TD to be set
@Param Field Field to be set
@Param Value Value to set
@retval EFI_SUCCESS Value set
**/
EFI_STATUS
OhciSetTDField (
IN TD_DESCRIPTOR *Td,
IN UINT32 Field,
IN UINT32 Value
)
{
if (Field & TD_PDATA) {
Td->Word0.Reserved = Value;
}
if (Field & TD_BUFFER_ROUND) {
Td->Word0.BufferRounding = Value;
}
if (Field & TD_DIR_PID) {
Td->Word0.DirPID = Value;
}
if (Field & TD_DELAY_INT) {
Td->Word0.DelayInterrupt = Value;
}
if (Field & TD_DT_TOGGLE) {
Td->Word0.DataToggle = Value | 0x2;
}
if (Field & TD_ERROR_CNT) {
Td->Word0.ErrorCount = Value;
}
if (Field & TD_COND_CODE) {
Td->Word0.ConditionCode = Value;
}
if (Field & TD_CURR_BUFFER_PTR) {
Td->CurrBufferPointer = Value;
}
if (Field & TD_NEXT_PTR) {
Td->NextTD = Value;
}
if (Field & TD_BUFFER_END_PTR) {
Td->BufferEndPointer = Value;
}
return EFI_SUCCESS;
}
/**
Get value from ED specific field
@Param Td TD pointer
@Param Field Field to get value from
@retval Value of the field
**/
UINT32
OhciGetTDField (
IN TD_DESCRIPTOR *Td,
IN UINT32 Field
)
{
switch (Field){
case TD_BUFFER_ROUND:
return Td->Word0.BufferRounding;
break;
case TD_DIR_PID:
return Td->Word0.DirPID;
break;
case TD_DELAY_INT:
return Td->Word0.DelayInterrupt;
break;
case TD_DT_TOGGLE:
return Td->Word0.DataToggle;
break;
case TD_ERROR_CNT:
return Td->Word0.ErrorCount;
break;
case TD_COND_CODE:
return Td->Word0.ConditionCode;
break;
case TD_CURR_BUFFER_PTR:
return Td->CurrBufferPointer;
break;
case TD_NEXT_PTR:
return Td->NextTD;
break;
case TD_BUFFER_END_PTR:
return Td->BufferEndPointer;
break;
default:
ASSERT (FALSE);
}
return 0;
}
/**
Free the Ed,Td,buffer that were created during transferring
@Param Ohc Device private data
**/
VOID
OhciFreeDynamicIntMemory(
IN USB_OHCI_HC_DEV *Ohc
)
{
INTERRUPT_CONTEXT_ENTRY *Entry;
if (Ohc != NULL) {
while (Ohc->InterruptContextList != NULL) {
Entry = Ohc->InterruptContextList;
Ohc->InterruptContextList = Ohc->InterruptContextList->NextEntry;
OhciFreeInterruptEdByEd (Ohc, Entry->Ed);
OhciFreeInterruptContextEntry (Ohc, Entry);
}
}
}
/**
Free the Ed that were initilized during driver was starting,
those memory were used as interrupt ED head
@Param Ohc Device private data
**/
VOID
OhciFreeFixedIntMemory (
IN USB_OHCI_HC_DEV *Ohc
)
{
static UINT32 Leaf[] = {32,16,8,4,2,1};
UINTN Index;
UINTN Level;
for (Level = 0; Level < 6; Level++) {
for (Index = 0; Index < Leaf[Level]; Index++) {
if (Ohc->IntervalList[Level][Index] != NULL) {
UsbHcFreeMem(Ohc->MemPool, Ohc->IntervalList[Level][Index], sizeof(ED_DESCRIPTOR));
}
}
}
}
/**
Release all OHCI used memory when OHCI going to quit
@Param Ohc Device private data
@retval EFI_SUCCESS Memory released
**/
EFI_STATUS
OhciFreeIntTransferMemory (
IN USB_OHCI_HC_DEV *Ohc
)
{
//
// Free the Ed,Td,buffer that were created during transferring
//
OhciFreeDynamicIntMemory (Ohc);
//
// Free the Ed that were initilized during driver was starting
//
OhciFreeFixedIntMemory (Ohc);
return EFI_SUCCESS;
}
|