summaryrefslogtreecommitdiff
path: root/Include/Protocol/AmiUsbController.h
blob: 39d8d46e01d1aa5a0d27bac17793c41d2c0c4e05 (plain)
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
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
//****************************************************************************
//****************************************************************************
//**                                                                        **
//**             (C)Copyright 1985-2016, American Megatrends, Inc.          **
//**                                                                        **
//**                          All Rights Reserved.                          **
//**                                                                        **
//**                 5555 Oakbrook Pkwy, Norcross, GA 30093                 **
//**                                                                        **
//**                          Phone (770)-246-8600                          **
//**                                                                        **
//****************************************************************************
//****************************************************************************

//****************************************************************************
// $Header: /Alaska/SOURCE/Modules/USB/ALASKA/Protocol/AmiUsbController.h 36    10/16/16 10:24p Wilsonlee $
//
// $Revision: 36 $
//
// $Date: 10/16/16 10:24p $
//
//****************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/USB/ALASKA/Protocol/AmiUsbController.h $
// 
// 36    10/16/16 10:24p Wilsonlee
// [TAG]  		EIP288158
// [Category]  	Improvement
// [Description]  	Check if gUsbData is integrity.
// [Files]  		amiusb.cif, usbsb.c, AmiUsbLib.cif, AmiUsbLib.sdl,
// AmiUsbSmmGlobalDataValidationLib.c,
// AmiUsbSmmGlobalDataValidationLib.cif,
// AmiUsbSmmGlobalDataValidationLib.mak, Crc32.c, amiusb.c, amiusb.h,
// ehci.c, elib.c, ohci.c, syskbc.c, uhci.c, usb.c, usbCCID.c, usbdef.h,
// usbhid.c, usbhub.c, usbkbd.c, usbmass.c, usbms.c, usbrt.mak, xhci.c,
// amiusbhc.c, efiusbccid.c, efiusbmass.c, uhcd.c, usbmisc.c,
// AmiUsbController.h, AmiUsbLibInclude.cif,
// AmiUsbSmmGlobalDataValidationLib.h
// 
// 35    3/02/16 9:43p Wilsonlee
// [TAG]  		EIP254309
// [Category]  	Bug Fix
// [Severity]  	Normal
// [Symptom]  	GK-FORCE K83 USB KB function abnormal.
// [RootCause]  	This device has an interrupt out endpoint and doesn't
// support "Set Report" request.
// [Solution]  	Use the interrupt out endpoint instead of sending "Set
// Report" request.
// [Files]  		AmiUsbController.h, xhci.c, usbmass.c, usbkbd.h, usbkbd.c,
// usbhub.c, usbhid.c, usbdef.h, usbCCID.c, usb.c, uhci.c, ohci.c, ehci.c,
// amiusb.h, efiusbms,c, amiusbhc.c
// 
// 34    11/04/15 9:54p Wilsonlee
// TAG]  		EIP241067
// [Category]  	Improvement
// [Description]  	Add the device descriptor to the DEV_INFO structure.
// [Files]  		usb.c, usbdef.h, xhci.c, usbbus.c, AmiUsbController.h
// 
// 33    4/10/15 3:07a Wilsonlee
// [TAG]  		EIP207413
// [Category]  	Improvement
// [Description]  	Install UsbApiTable and UsbMassApitTable in
// AmiUsbSmmProtocol.
// [Files]  		amiusbhc.c, AmiUsbController.h, usbdef.h, usbCCID.c, uhci.c,
// ehci.c, amiusbrtCCID.h, amiusb.h, amiusb.c, uhcd.c
// 
// 32    12/24/14 10:42p Wilsonlee
// [TAG]  		EIP196287
// [Category]  	Improvement
// [Description]  	Display info of connected usb controllers and remove or
// grayed-out some item according the connected usb controller number.
// [Files]  		uhcd.c, usbport.c, usb.uni, usb.sd, usbsetup.c,
// AmiUsbController.h, UsbPolicy.h
// 
// 31    6/11/14 8:23p Wilsonlee
// [TAG]  		EIP172625
// [Category]  	Improvement
// [Description]  	Usb skip table function adds the flag
// "SKIP_FLAG_SKIP_MULTI_LEVEL" that skips usb ports include down stream
// ports.
// [Files]  		usbport.c, AmiUsbController.h
// 
// 30    7/03/13 5:25a Ryanchou
// [TAG]  		EIP123988
// [Category]  	Improvement
// [Description]  	Move the code creating BBS table to end of POST.
// [Files]  		UsbBbs.c, UsbInt13.c, UsbInt13.cif, UsbInt13.h,
// UsbInt13.mak, UsbInt13.sdl, efiusbmass.c, uhcd.c, uhcd.h,
// AmiUsbController.h
// 
// 29    9/03/12 5:23a Roberthsu
// [TAG]           EIP88776
// [Category]      Improvement
// [Description]   Implement keep port function.
// [Files]         usbport.c,AmiUsbController.h
// 
// 28    8/29/12 8:42a Ryanchou
// [TAG]  		EIP77262
// [Category]  	New Feature
// [Description]  	Remove SMM dependency of USB.
// [Files]  		usb.sdl, usbport.c, amiusb.c, amiusb.dxs, amiusb.h, ehci.c,
// elib.c, ohci.c, uhci.c, usb.c, usbdef.h, usbrt.mak, xhci.c, amiusbhc.c,
// efiusbccid.c, efiusbhid.c, efiusbkb.c, efiusbmass.c, uhcd.c, uhcd.dxs,
// uhcd.h, usbmisc.c, AmiUsbController.h
// 
// 27    1/14/12 4:10a Ryanchou
// [TAG]  		EIP80609
// [Category]  	Bug Fix
// [Severity]  	Important
// [Symptom]  	If to enable debug mode and set launch CSM is "Never" in
// setup, system will hang at 0xB1
// [RootCause]  	The pointer AmiUsb is invalid if CSM is not launched,
// that may cause CPU exception.
// [Solution]  	Added USB smm protocol, and use SmmLocateProtocol to get
// the pointer.
// [Files]  		amiusb.c, AmiUsbController.h, usbrt.mak, usbsb.c
// 
// 26    12/26/11 2:25a Roberthsu
// [TAG]           EIP74609
// [Category]      Improvement
// [Description]   Add check oemskiplist at check port change.
// [Files]         usbport.c,usb.c,AmiUsbController.h
// 
// 25    11/08/11 8:26a Wilsonlee
// [TAG]  		EIP74876
// [Category]  	New Feature
// [Description]  	Add USB API for shutdown single USB controller.
// [Files]  		amiusb.c, amiusb.h, usb.c, usbdef.h, uhcd.c, uhcd.h,
// AmiUsbController.h
// 
// 24    8/05/11 6:19a Ryanchou
// [TAG]  		EIP60706
// [Category]  	Improvement
// [Description]  	Move gUsbBadDeviceTable into SMRAM.
// [Files]  		usbport.c, amiusb.c, usb.c, uhcd.c, AmiUsbController.h
// 
// 23    7/15/11 6:31a Ryanchou
// [TAG]  		EIP38434
// [Category]  	New Feature
// [Description]  	Added USB HID report protocol support.
// [Files]  		amiusb.c, AmiUsbController.h, amiusbhc.c, efiusbkb.c,
// efiusbkb.h, efiusbpoint.c, ehci.c, ohci.c, uhcd.c uhcd.cif, uhci.c,
// usb.c, usbdef.h, usbhid.c, usbkbd.c, usbkbd.h, usbms.c, usbpoint.c,
// usbrt.cif, usbsb.c, usbsetup.c, usbsrc.sdl, xhci.c
// 
// 22    7/12/11 8:18a Ryanchou
// [TAG]  		EIP56918
// [Category]  	New Feature
// [Description]  	Added CCID device support.
// [Files]  		amiusb.c, amiusb.h, amiusbrtCCID.h, ehci.c, ohci.c, uhci.c,
// usb.c, UsbCCID.c, usbdef.h, usbrt.cif, usbsetup.c, efiusbccid.c,
// framework.cif, uhcd.c, uhcd.cif, uhcd.h, usbsrc.sdl, AmiusbCCID.h,
// AmiUsbController.h, AmiUSBProtocols.cif
// 
// 21    6/22/11 2:13a Ryanchou
// [TAG] EIP62695
// [Improvement] Add new oemskiplist function
// [Description] Add skip function by controller or port.Skip by device
// type or port number.
// 
// 20    4/06/11 3:28a Ryanchou
// [TAG]  		EIP55275
// [Category]  	Bug Fix
// [Severity]  	Important
// [Symptom]  	EBDA:108 conflict
// [RootCause]  	The EIP48064 save EFI_USB_PROTOCOL pointer in EBDA:108,
// but Keymon filter driver used the same location.
// [Solution]  	Use the EBDA:32 to save EFI_USB_PROTOCOL pointer and add a
// signature in EFI_USB_PROTOCOL.
// [Files]  		amidef.h, AmiUsbController.h, uhcd.c, usbsb.c
// 
// 19    4/06/11 12:45a Ryanchou
// [TAG]  		EIP51653
// [Category]  	New Feature
// [Description]  	Added an interface that skips specific port
// enumeration.
// [Files]  		AmiUsbController.h, uhcd.c, uhcd.h, usb.c, usbdef.h,
// usbport.c
// 
// 18    3/30/11 9:07a Ryanchou
// [TAG]  		EIP41483
// [Category]  	Improvement
// [Description]  	Stop timer SMI after legacy shutdown.
// [Files]  		amiusb.c, AmiUsbController.h, ohci.c
// 
// 17    2/22/11 5:11a Tonylo
// [TAG]  		EIP52339
// [Category]  	New Feature
// [Description]  	USB changes of USB host safe disabling solution.
// [Files]  		USB.C
// UHCD.C
// UHCD.H
// AmiUsbController.h
// 
// 16    11/22/10 8:46a Ryanchou
// [TAG]  		EIP48064
// [Category]  	Improvement
// [Description]  	The SB template implemented elink
// AcpiEnableCallbackList, the XHCI/EHCI hand off function should be
// invoked via the elink AcpiEnableCallbackList.
// [Files]  		amidef.h, amiusb.c, amiusb.dxs, amiusb.h,
// AmiUsbController.h, usb.sdl, usbrt.mak, usbsb.c
// 
// 15    7/15/10 4:45a Tonylo
// EIP15489 - Add USB HandOff function for shurdown/init USB legacy
// through USB API function.
// 
// 14    4/02/10 9:00a Olegi
// 
// 13    10/02/09 10:51a Olegi
// Code cleanup.
// 
// 12    11/25/08 6:04p Olegi
// Support for OEM USB Boot Override feature. EIP#17052.
// 
// 11    6/27/08 6:00p Olegi
// - USB_MASS_DEV structure has been updated
// - Several equates moved from USBDEF.H
// 
// 10    5/16/08 12:07p Olegi
// Compliance with AMI coding standard.
// 
// 9     8/09/07 3:50p Artems
// Added new protocol function GetRuntimeRegion
// 
// 8     6/03/07 11:26p Olegi
// Added UsbBbsRemoveMassStorage function.
// 
// 7     5/29/07 6:14p Olegi
// Added UsbChangeEfiToLegacy function.
// 
// 1     3/15/05 9:23a Olegi
// Initial VSS check-in.
//
//****************************************************************************

//<AMI_FHDR_START>
//-----------------------------------------------------------------------------
//
//  Name:           AmiUsbController.h
//
//  Description:    AMI USB Driver Protocol definition
//
//-----------------------------------------------------------------------------
//<AMI_FHDR_END>

#ifndef _USB_PROT_H
#define _USB_PROT_H

#include <EFI.h>
#include <Protocol\AmiUsbCCID.h>

#define EFI_USB_PROTOCOL_GUID    \
  { 0x2ad8e2d2, 0x2e91, 0x4cd1, 0x95, 0xf5, 0xe7, 0x8f, 0xe5, 0xeb, 0xe3, 0x16 }

#define AMI_USB_SMM_PROTOCOL_GUID    \
  { 0x3ef7500e, 0xcf55, 0x474f, 0x8e, 0x7e, 0x0, 0x9e, 0xe, 0xac, 0xec, 0xd2 }

GUID_VARIABLE_DECLARATION(gEfiUsbProtocolGuid,EFI_USB_PROTOCOL_GUID);

GUID_VARIABLE_DECLARATION(gAmiUsbSmmProtocolGuid,AMI_USB_SMM_PROTOCOL_GUID);

#ifndef GUID_VARIABLE_DEFINITION
#include <Protocol/BlockIo.h>
#include <AmiDxeLib.h>

typedef union {
    VOID  *fpUHCIDescPtrs;
    VOID  *fpOHCIDescPtrs;
    VOID  *fpEHCIDescPtrs;
} DESC_PTRS;

typedef struct {
	UINT8			Flag;			
	UINT8			ReportId;
	UINT16			UsagePage;
	UINT32			ReportCount;
	UINT8			ReportSize;
	UINT32			LogicalMin;
	UINT32			LogicalMax;
    UINT32          PhysicalMax;        //(EIP127014)
    UINT32          PhysicalMin;        //(EIP127014)
    UINT8           UnitExponent;       //(EIP127014)
	UINT16 			UsageCount;
	UINT16			*Usages;
	UINT16			MaxUsages;
	UINT16			UsageMin;
	UINT16			UsageMax;
} HID_REPORT_FIELD;

typedef struct {
	UINT8 				Flag;
	UINT16				AbsMaxX; 			
	UINT16				AbsMaxY;
        UINT16          	ReportDescLen;
        UINT8				FieldCount;
	HID_REPORT_FIELD	**Fields;
} HID_REPORT;

#pragma pack(push, 1)

typedef struct {
    UINT8       DescLength;
    UINT8       DescType;
    UINT16      BcdUsb;
    UINT8       BaseClass;
    UINT8       SubClass;
    UINT8       Protocol;
    UINT8       MaxPacketSize0;
    UINT16      VendorId;
    UINT16      DeviceId;
    UINT16      BcdDevice;
    UINT8       MfgStr;
    UINT8       ProductStr;
    UINT8       SerialStr;
    UINT8       NumConfigs;
} DEV_DESC;

#pragma pack(pop)

typedef struct _HC_STRUC HC_STRUC;
typedef struct _DEV_INFO DEV_INFO;
typedef struct _DEV_DRIVER DEV_DRIVER;
typedef struct _URP_STRUC URP_STRUC;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        HC_STRUC
//
// Description: USB Host Controller structure
//
// Fields:   Name       Type    Description
//      ------------------------------------------------------------
//      bHCNumber   UINT8   Host Controller number, 1-based
//      bHCType     UINT8   Host Controller Type, U/O/E HCI
//      fpFrameList UINT32* Host Controller Frame List Address
//      BaseAddress UINTN   Host Controller Base Address, memory (EHCI,OHCI) or IO (UHCI)
//      bNumPorts   UINT8   Number of root ports, 1-based
//      wBusDevFuncNum UINT16   PCI location, bus (Bits8..15), device (Bits3..7), function(bits0..2)
//      fpIRQInfo   IRQ_INFO IRQ information
//      stDescPtrs  DESC_PTRS   Commonly used descriptor pointers, see definition of DESC_PTRS
//      wAsyncListSize  UINT16  Async. list size
//      bOpRegOffset UINT8  Operation region offset
//      dMaxBulkDataSize    UINT32 Maximum Bulk Transfer data size
//      dHCFlag     UINT32  Host Controller flag
//      bExtCapPtr  UINT8   EHCI Extended Capabilities Pointer
//      bRegOfs     UINT8   EHCI Capabilities PCI register Offset
//      DebugPort   UINT8   Port number of EHCI debug port
//      usbbus_data VOID*   USB Bus data specific to this Host Controller
//      Controller  EFI_HANDLE  EFI Handle of this controller
//      pHCdp   EFI_DEVICE_PATH_PROTOCOL* Pointer to this controller's device path
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

struct _HC_STRUC {
    UINT8           bHCNumber;
    UINT8           bHCType;
    UINT32          *fpFrameList;
    UINTN           BaseAddress;
    UINTN           BaseAddressSize;
    UINT8           bNumPorts;
    UINT16          wBusDevFuncNum;
    UINT8           Irq;
    DESC_PTRS       stDescPtrs;
    UINT16          wAsyncListSize;
    UINT8           bOpRegOffset;
    UINT32          dMaxBulkDataSize;
    UINT32	    dHCSParams;
    UINT32	    dHCCParams;
    UINT32          dHCFlag;
    UINT8           bExtCapPtr; // EHCI Extended Capabilities Pointer
    UINT8           DebugPort;
    VOID*           usbbus_data;
    EFI_HANDLE      Controller;
    EFI_DEVICE_PATH_PROTOCOL    *pHCdp;
    UINT8           PwrCapPtr;	//(EIP54018+)
    VOID	    *PciIo;
    UINT16          Vid;
    UINT16          Did;
    EFI_HANDLE      HwSmiHandle;
    UINT16          SplitPeriodicIndex;
#if !USB_RUNTIME_DRIVER_IN_SMM
    UINT32			MemPoolPages;
    UINT8			*MemPool;
    UINT32			MemBlkStsBytes;
    UINT32			*MemBlkSts;
#endif
};

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        DEV_INFO
//
// Description: USB Device Information Structure
//
// Fields:   Name       Type    Description
//      ------------------------------------------------------------
//  bFlag       UINT8   Device Information flags
//  bDeviceType UINT8   Device Type
//  wVendorId   UINT16  Device VID
//  wDeviceId   UINT16  Device DID
//  bDeviceAddress  UINT8   Device USB Address
//  bHCNumber   UINT8   Host Controller Number this device is attached to
//  bHubDeviceNumber    UINT8   USB Hub Device Number this device is attached to
//  bHubPortNumber  UINT8   USB Hub Port Number this device is attached to
//  bEndpointNum    UINT8   Endpoint number
//  bEndpointSpeed  UINT8   Endpoint speed
//  bLUN        UINT8   Device Logical Unit number
//  wEndp0MaxPacket UINT16  Endpoint0 max packet size, in Bytes
//  bNumConfigs UINT8   Number of configurations
//  bConfigNum  UINT8   Active configuration number (0-based)
//  bInterfaceNum   UINT8   Active interface number
//  bAltSettingNum  UINT8   Alternate setting number (0-based)
//  bCallBackIndex  UINT8   Callback function index
//  fpPollTDPtr     UINT8*  Polling TD pointer
//  fpPollTEPtr     UINT8*  Polling ED pointer
//  bHubNumPorts    UINT8   Hub # of ports (USB hubs only)
//  bHubPowerOnDelay    UINT8 Hub power-on delay (USB hubs only)
//  fpLUN0DevInfoPtr    DEV_INFO* Pointer to Lun0 device (for multiple-LUN devices)
//  wDataIn/OutSync   UINT16   toggle tracking information
//  bStorageType    UINT8   USB_MASS_DEV_ARMD, USB_MASS_DEV_HDD, etc.
//  wIntMaxPkt  UINT16  Interrupt Max Packet size, in Bytes
//  bPresent    UINT8   Device presence indicator
//  bIntEndpoint    UINT8   Interrupt endpoint number
//  bBulkInEndpoint UINT8   Bulk-In endpoint number
//  bBulkOutEndpoint    UINT8   Bulk-Out endpoint number
//  bProtocol   UINT8   Protocol
//  wEmulationOption    UINT16  USB Mass Storage Drive Emulation Option, from Setup
//  bHiddenSectors  UINT8   Number of hidden sectors, for USB mass storage devices only
//  bSubClass   UINT8   Device sub-class
//  wBlockSize  UINT16  USB Mass Storage Device block size, in Bytes
//  dMaxLba     UINT32  USB Mass Storage Device Maximum LBA number
//  bHeads      UINT8   USB Mass Storage Device # of heads
//  bSectors    UINT8   USB Mass Storage Device # of sectors
//  wCylinders  UINT16  USB Mass Storage Device # of cylinders
//  bNonLBAHeads UINT8   USB Mass Storage Device # of heads reported in Non-LBA (CHS) functions
//  bNonLBASectors  UINT8   USB Mass Storage Device # of sectors reported in Non-LBA (CHS) functions
//  wNonLBACylinders    UINT16  USB Mass Storage Device # of cylinders reported in Non-LBA (CHS) functions
//  bEmuType    UINT8   USB Mass Storage Device emulation type
//  bPhyDevType UINT8   USB Mass Storage Device physical type
//  bMediaType  UINT8   USB Mass Storage Device media type
//  bDriveNumber    UINT8   USB Mass Storage Device INT13 drive number
//  wBulkInMaxPkt   UINT16  USB Mass Storage Device Bulk-In max packet size, in Bytes
//  wBulkOutMaxPkt  UINT16  USB Mass Storage Device Bulk-Out max packet size, in Bytes
//  wIncompatFlags  UINT16  USB Mass Storage Device Incompatibility flags
//  MassDev     VOID*   USB Mass Storage Device EFI handle
//  fpDeviceDriver  DEV_DRIVER*   Device driver pointer
//  bLastStatus UINT8   Last transaction status
//  pExtra      UINT8*  Pointer to extra device specific data
//  UINT32      UINT8   USB Mass Storage Device # of heads
//  Handle      UINT32[2]   USB Device Handle
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
struct _DEV_INFO {
    UINT32      Flag;          //00
    UINT8       bDeviceType;    //01
    UINT16      wVendorId;      //02
    UINT16      wDeviceId;      //04
    UINT8       bDeviceAddress; //06

    UINT8       bHCNumber;      //07
    UINT8       bHubDeviceNumber;   //08
    UINT8       bHubPortNumber; //09
//    UINT8       bEndpointNum;   //0A //(EIP70933-)
    UINT8       bEndpointSpeed; //0B
    UINT8       bLUN;           //0C
    UINT16      wEndp0MaxPacket;//0D
//    UINT8       bNumConfigs;    //0F
    UINT8       bConfigNum;     //10
    UINT8       bInterfaceNum;  //11
    UINT8       bAltSettingNum; //12

    UINT8       bCallBackIndex; //13
    UINT8       *fpPollTDPtr;   //14
    UINT8       *fpPollEDPtr;   //18

    UINT8       bHubNumPorts;   //1C
    UINT8       bHubPowerOnDelay;//1D

    struct _DEV_INFO *fpLUN0DevInfoPtr; //1E
//    UINT8       bDataSync;      //22

    UINT16      wDataInSync;    // 22
    UINT16      wDataOutSync;   // 24
    UINT8       bStorageType;   // 26, USB_MASS_DEV_ARMD, USB_MASS_DEV_HDD, etc.
    UINT16      IntInMaxPkt;     //27
    UINT8       IntInEndpoint;   //2A
    UINT16      IntOutMaxPkt;
    UINT8       IntOutEndpoint;
    UINT8       bBulkInEndpoint;
    UINT8       bBulkOutEndpoint;

    UINT8       bBaseClass;     // BASE_CLASS_HID, BASE_CLASS_MASS_STORAGE or BASE_CLASS_HUB
    UINT8       bSubClass;
    UINT8       bProtocol;          //
    UINT16      wEmulationOption;   //
    UINT8       bHiddenSectors;     //

    UINT16      wBlockSize;         //
    UINT64      MaxLba;            //
    UINT16      Heads;             //
    UINT8       bSectors;           //
    UINT16      wCylinders;         //
    UINT16      NonLBAHeads;       //
    UINT8       bNonLBASectors;     //
    UINT16      wNonLBACylinders;   //
    UINT8       bEmuType;           //
    UINT8       bPhyDevType;        //
    UINT8       bMediaType;         //
    UINT8       bDriveNumber;       //
    UINT16      wBulkInMaxPkt;      //
    UINT16      wBulkOutMaxPkt;     //
    UINT16      wIncompatFlags;     //
    VOID        *MassDev;           //
    DEV_DRIVER  *fpDeviceDriver;    //
    UINT8       bLastStatus;        //
    UINT8       *pExtra;            //
    UINT32      Handle[2];
    UINT8       DevNameString[64];
    VOID        *DevMiscInfo;
    UINT8        HubDepth;
    UINT8         *fpPollDataBuffer;        //Polling Data Buffer    //(EIP54782+)
    VOID *pCCIDDescriptor; // Ptr to CCID descriptor
    UINT32      *DataRates;           // List of DataRates supported by CCID  
    UINT32      *ClockFrequencies;    // List of Frequencies suported by CCID
    DLIST        ICCDeviceList;        // Linked list of ICC devices. :Linked to "ICCDeviceLink"
	HID_REPORT	HidReport;
	UINT8 		HidDevType;
	UINT8       bPollInterval;          //(EIP84455+)
	UINT16		PollingLength;
	UINT16      HubPortConnectMap;
    UINT8       BpbMediaDesc;
    DEV_DESC    DevDesc;
};

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        DEV_DRIVER
//
// Description: USB Device Driver Structure
//
// Fields:   Name       Type    Description
//      ------------------------------------------------------------
//  bDevType    UINT8   Device Type
//  bBaseClass  UINT8   Device Base Type
//  bSubClass   UINT8   Device Subclass
//  bProtocol   UINT8   Device Protocol
//  pfnDeviceInit   VOID    Device Initialization Function
//  pfnCheckDeviceType  UINT8   Check Device Type Function
//  pfnConfigureDevice  DEV_INFO*   Configure Device Function
//  pfnDisconnectDevice UINT8   Disconnect Device Function
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

struct _DEV_DRIVER {
    UINT8           bDevType;
    UINT8           bBaseClass;
    UINT8           bSubClass;
    UINT8           bProtocol;
    VOID            (*pfnDeviceInit)(VOID);
    UINT8           (*pfnCheckDeviceType)(DEV_INFO*, UINT8, UINT8, UINT8);
    DEV_INFO*       (*pfnConfigureDevice)(HC_STRUC*, DEV_INFO*, UINT8*, UINT16, UINT16);
    UINT8           (*pfnDisconnectDevice)(DEV_INFO*);
    VOID            (*pfnDriverRequest)(DEV_INFO*, URP_STRUC*);
};

#pragma pack(push, 1)

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        CK_PRESENCE
//
// Description: This is a URP (USB Request Packet) structure for the BIOS
//      API call CheckPresence (API #0)
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT16      wBiosRev;       // USB BIOS Revision
    UINT8       bBiosActive;    // USB BIOS active/inactive
    UINT8       bNumBootDev;    // # of USB boot device
    UINT16      wUsbDataArea;   // USB Data area
    UINT8       bNumKeyboards;  // Number of USB keyboards present
    UINT8       bNumMice;       // Number of USB mice present
    UINT8       bNumPoint;      // Number of USB point present				//<(EIP38434+)
    UINT8       bNumHubs;       // Number of USB hubs present
    UINT8       bNumStorage;    // Number of USB storage devices present
///////// DO NOT ADD ANY FIELD HERE. IF IT IS NECESSARY PLEASE UPDATE THE CODE
///////// IN THE FUNCTION USBWrap_GetDeviceCount in the file USBWRAP.ASM
    UINT8       bNumHarddisk;   // Number of hard disk emulated USB devices
    UINT8       bNumCDROM;      // Number of CDROM emulated USB devices
    UINT8       bNumFloppy;     // Number of floppy emulated USB devices
} CK_PRESENCE;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        START_HC
//
// Description: This is a URP (USB Request Packet) structure for the BIOS
//      API call StartHC and MoveDataArea (API #20 & #24)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      wDataAreaFlag   UINT16  Indicates which data area to use
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT16  wDataAreaFlag;      // Data area to use
} START_HC;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        GET_DEV_INFO
//
// Description: This is a URP (USB Request Packet) structure for the BIOS
//      API call GetDeviceInfo (API #25)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevNumber  UINT8   Device # whose info is requested
//      bHCNumber   UINT8   HC # to which this device is connected (0 if no such device found)
//      bDevType    UINT8   Device type (0 if no such device found)
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8   bDevNumber;
    UINT8   bHCNumber;
    UINT8   bDevType;
} GET_DEV_INFO;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        CHK_DEV_PRSNC
//
// Description: This is a URP (USB Request Packet) structure for the BIOS
//      API call CheckDevicePresence (API #26)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevType    UINT8           Type of device to look for
//      fpHCStruc   FPHC_STRUC      Pointer to HC being checked for device connection
//      bNumber     UINT8           Number of devices connected
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevType;
    HC_STRUC    *fpHCStruc;
    UINT8       bNumber;
} CHK_DEV_PRSNC;

typedef struct {
    UINT8   ScrLock:    1;
    UINT8   NumLock:    1;
    UINT8   CapsLock:   1;
    UINT8   Resrvd:     5;
} LED_MAP;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        KB_LEDS_DATA
//
// Description: This is a URP (USB Request Packet) structure for the BIOS
//              API call LightenKeyboardLeds(API #2B)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      fpLedMap    UINT32       32-bit Pointer to LED_MAP structure
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT32 fpLedMap;
} KB_LEDS_DATA;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:         SECURITY_IF
//
// Description:  This is a URP (USB Request Packet) structure for the BIOS
//               API call SecurityInterface (API #2Ah)
//
// Fields:        Name           Type            Description
//               ------------------------------------------------------------
//               fpBuffer        FAR     Buffer pointer to read/write data
//               dLength         UINT32   Length of the buffer
//               dWaitTime       UINT32   Wait time for the transaction in msec
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
        UINT32  fpBuffer;
        UINT32  dLength;
        UINT32  dWaitTime;
} SECURITY_IF;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_GET_DEV_INFO
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassGetDeviceInfo (API #27h, SubFunc 00h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      bDevType    UINT8   Device type byte (HDD, CD, Removable)
//      bEmuType    UINT8   Emulation type used
//      fpDevId     UINT32  Far pointer to the device ID
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;       // (Return value)
    UINT32      dSenseData;     // USB Sense data
    UINT8       bDevType;       // Device type
    UINT8       bEmuType;       // Emulation type
//  UINT8       bPhyDevType;    // Physical device type
    UINT32      fpDevId;        // Far ptr to the device id
// DO NOT ADD OR DELETE ANY FIELD ABOVE - This should match the MASS_INQUIRY
// structure for proper working
    UINT8       bTotalMassDev;  // TotalNumber of devices
    UINT8       bReserved;
    UINT16      wPciInfo;       // PCI Bus/Dev/Func number of HC the device is connected to
    UINT32      Handle[2];      // Device handle
} MASS_GET_DEV_INFO;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_GET_DEV_STATUS
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MASS_GET_DEV_STATUS (API #27h, SubFunc XXh)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      bDeviceStatus   UINT8   Connection status of the Mass device
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;
    UINT8       bDeviceStatus;
} MASS_GET_DEV_STATUS;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_GET_DEV_GEO
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassGetDeviceGeometry (API #27h,
//      SubFunc 01h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      bNumHeads   UINT8   Number of heads
//      wNumCylinders   UINT16  Number of cylinders
//      bNumSectors UINT8   Number of sectors
//      bLBANumHeads    UINT8   Number of heads (for INT13h function 48h)
//      wLBANumCyls UINT16  Number of cylinders (for INT13h function 48h)
//      bLBANumSectors  UINT8   Number of sectors (for INT13h function 48h)
//      wUINT8sPerSector    UINT16  Number of bytes per sector
//      bMediaType  UINT8   Media type
//      dLastLBA    UINT32  Last LBA address
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8           bDevAddr;   // (Return value)
    UINT32          dSenseData; // USB Sense data
    UINT16          NumHeads;
    UINT16          wNumCylinders;
    UINT8           bNumSectors;
    UINT16          LBANumHeads;
    UINT16          wLBANumCyls;
    UINT8           bLBANumSectors;
    UINT16          wBytesPerSector;
    UINT8           bMediaType;
    UINT64          LastLBA;
    UINT8	        bInt13FuncNum;	//(EIP13457+)
    UINT8           BpbMediaDesc;
} MASS_GET_DEV_GEO;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_RESET
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassResetDevice (API #27h, SubFunc 02h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;       // USB Device Address
    UINT32      dSenseData;     // USB Sense data
} MASS_RESET;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_ASSIGN_DRIVE_NUM
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call USBMass_AssignDriveNumber
//      (API #27h, SubFunc 0Eh)
//
// Fields:   Name       Type    Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      bLogDevNum  UINT8   Logical Drive Number to assign to the device
//      bHeads      UINT8   Number of heads
//      bSectors    UINT8   Number of sectors/track
//      wCylinders  UINT16  Number of cylinders
//      wBlockSize  UINT16  Sector size in bytes
//      bLUN        UINT8   Maximum LUNs in the system
//      bSpeed      UINT8   <>0 if the device is hi-speed device
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;   // USB Device Address
    UINT8       bLogDevNum; // Logical Drive Number to assign to the device
    UINT8       bHeads;
    UINT8       bSectors;
    UINT16      wCylinders;
    UINT16      wBlockSize;
    UINT8       bLUN;
    UINT8       bSpeed;
} MASS_ASSIGN_DRIVE_NUM;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_READ
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassReadDevice (API #27h, SubFunc 03h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      dStartLBA   UINT32  Starting LBA address
//      wNumBlks    UINT16  Number of blocks to read
//      wPreSkipSize    UINT16  Number of bytes to skip before
//      wPostSkipSize   UINT16  Number of bytes to skip after
//      fpBufferPtr UINT32  Far buffer pointer
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       DevAddr;        // USB Device Address
    UINT32      SenseData;      // USB Sense data
    UINT64      StartLba;       // Starting LBA address
    UINT16      NumBlks;        // Number of blocks to read
    UINT16      PreSkipSize;    // Number of bytes to skip before
    UINT16      PostSkipSize;   // Number of bytes to skip after
    UINT32      BufferPtr;      // Far buffer pointer
} MASS_READ;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_WRITE
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassWriteDevice (API #27h, SubFunc 04h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      dStartLBA   UINT32  Starting LBA address
//      wNumBlks    UINT16  Number of blocks to write
//      wPreSkipSize    UINT16  Number of bytes to skip before
//      wPostSkipSize   UINT16  Number of bytes to skip after
//      fpBufferPtr UINT32  Far buffer pointer
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       DevAddr;        // USB Device Address
    UINT32      SenseData;      // USB Sense data
    UINT64      StartLba;       // Starting LBA address
    UINT16      NumBlks;        // Number of blocks to write
    UINT16      PreSkipSize;    // Number of bytes to skip before
    UINT16      PostSkipSize;   // Number of bytes to skip after
    UINT32      BufferPtr;      // Far buffer pointer
} MASS_WRITE;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_VERIFY
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassVerifyDevice (API #27h, SubFunc 05h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      dStartLBA   UINT32  Starting LBA address
//      wNumBlks    UINT16  Number of blocks to verify
//      wPreSkipSize    UINT16  Number of bytes to skip before
//      wPostSkipSize   UINT16  Number of bytes to skip after
//      fpBufferPtr UINT32  Far buffer pointer
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       DevAddr;        // USB Device Address
    UINT32      SenseData;      // USB Sense data
    UINT64      StartLba;       // Starting LBA address
    UINT16      NumBlks;        // Number of blocks to verify
    UINT16      PreSkipSize;    // Number of bytes to skip before
    UINT16      PostSkipSize;   // Number of bytes to skip after
    UINT32      BufferPtr;      // Far buffer pointer
} MASS_VERIFY;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_FORMAT
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassFormatDevice (API #27h, SubFunc 06h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      bHeadNumber UINT8   Head number to format
//      bTrackNumber    UINT8   Track number to format
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;       // USB Device Address
    UINT32      dSenseData;     // USB Sense data
    UINT8       bHeadNumber;    // Head number to format
    UINT8       bTrackNumber;   // Track number to format
} MASS_FORMAT;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_REQ_SENSE
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassRequestSense (API #27h, SubFunc 07h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;       // USB Device Address
    UINT32      dSenseData;     // USB Sense data
} MASS_REQ_SENSE;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_TEST_UNIT_RDY
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassTestUnitReady (API #27h, SubFunc 08h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;       // USB Device Address
    UINT32      dSenseData;     // USB Sense data
} MASS_TEST_UNIT_RDY;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_START_STOP_UNIT
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassStartStopUnit (API #27h, SubFunc 09h)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      bCommand    UINT8   0 - Stop, 1 - Start
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;       // USB Device Address
    UINT32      dSenseData;     // USB Sense data
    UINT8       bCommand;       // 0 - Stop, 1 - Start
} MASS_START_STOP_UNIT;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_READ_CAPACITY
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassReadCapacity (API #27h, SubFunc 0Ah)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      dMaxLBA     UINT32  Maximum LBA address
//      dBlockSize  UINT32  Block size
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;       // USB Device Address
    UINT32      dSenseData;     // USB Sense data
    UINT32      dMaxLBA;        // Max LBA address
    UINT32      dBlockSize;     // Block size
} MASS_READ_CAPACITY;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_MODE_SENSE
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassModeSense (API #27h, SubFunc 0Bh)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      bNumHeads   UINT8   Number of heads
//      wNumCylinders   UINT16  Number of cylinders
//      bNumSectors UINT8   Number of sectors
//      wBytesPerSector UINT16  Number of bytes per sector
//      bMediaType  UINT8   Media type
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;       // USB Device Address
    UINT32      dSenseData;     // USB Sense data
    UINT8       bNumHeads;      // Number of heads
    UINT16      wNumCylinders;  // Number of cylinders
    UINT8       bNumSectors;    // Number of sectors
    UINT16      wBytesPerSector;// Number of bytes per sector
    UINT8       bMediaType;     // Media type
} MASS_MODE_SENSE;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_INQUIRY
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassInquiry (API #27h, SubFunc 0Ch)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    UINT8   USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      bDevType    UINT8   Device type byte (HDD, CD, Removable)
//      bEmuType    BYTE    Emulation type used
//      fpDevId     UINT32  Far pointer to the device ID
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;       // USB Device Address
    UINT32      dSenseData;     // USB Sense data
    UINT8       bDevType;       // Device type
    UINT8       bEmuType;       // Emulation type
    UINT32      fpDevId;        // Far ptr to the device id
// DO NOT ADD OR DELETE ANY FIELD ABOVE - This should match the
// MASS_GET_DEV_INFO structure for proper working
} MASS_INQUIRY;

typedef struct {
    DEV_INFO        *fpDevInfo;
    MASS_INQUIRY    *fpInqData;
} MASS_GET_DEV_PARMS;

typedef struct {
    DEV_INFO*   fpDevInfo;
} MASS_CHK_DEV_READY;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        MASS_CMD_PASS_THRU
//
// Description: This is a Mass URP (Mass USB Request Packet) structure for
//      the BIOS API call MassCmdPassThru command (API #27h,
//      SubFunc 0Dh)
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bDevAddr    BYTE    USB device address of the device
//      dSenseData  UINT32  Sense data of the last command
//      fpCmdBuffer UINT32  Far pointer to the command buffer
//      wCmdLength  UINT16  Command length
//      fpDataBuffer    UINT32  Far pointer for data buffer
//      wDataLength UINT16  Data length
//      bXferDir    BYTE    Data transfer direction
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT8       bDevAddr;
    UINT32      dSenseData;
    UINT32      fpCmdBuffer;
    UINT16      wCmdLength;
    UINT32      fpDataBuffer;
    UINT16      wDataLength;
    UINT8       bXferDir;
} MASS_CMD_PASS_THRU;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        HCPROC_PARAM
//
// Description: N/A
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct _HCPROC_PARAM{
    VOID*       paramBuffer; //parameters as they should apear in stack of
                            // of the corresponding function invocation
    unsigned    bHCType;
    unsigned    paramSize;
    UINTN       retVal;
} HCPROC_PARAM;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        COREPROC_PARAM
//
// Description: This is a Core Procedure URP  structure for
//      the BIOS API call core command (API #2eh )
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct _COREPROC_PARAM{
    VOID*       paramBuffer; //parameters as they should apear in stack of
                            // of the corresponding function invocation
    unsigned    paramSize;
    UINTN       retVal;
} COREPROC_PARAM, * FPCOREPROC_PARAM;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        GET_DEV_ADDR
//
// Description: This is a URP structure for the BIOS API(API #32h)
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
    UINT16	Vid;		// Vendor Id
	UINT16	Did;		// Device Id
    UINT8   DevAddr;	// USB Device Address
} GET_DEV_ADDR;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        HC_START_STOP
//
// Description: This is a URP structure for the BIOS API(API #36)
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef struct {
	BOOLEAN 	Start;
	HC_STRUC    *HcStruc;
} HC_START_STOP;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        CCID_GETSMARTCLASSDESCRIPTOR
//
// Description: This is a Core Procedure URP  structure for
//      the BIOS API call USB_API_CCID_DEVICE_REQUEST command (API #2Fh )
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _CCID_GETSMARTCLASSDESCRIPTOR{
    OUT UINTN            fpResponseBuffer;
    IN  UINT8            Slot;
    OUT UINTN            fpDevInfo;            
} CCID_GETSMARTCLASSDESCRIPTOR, * FPCCID_GETSMARTCLASSDESCRIPTOR;


//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        CCID_ATR
//
// Description: This is a Core Procedure URP  structure for
//      the BIOS API call USB_API_CCID_DEVICE_REQUEST command (API #2Fh )
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _CCID_ATR{
    IN UINT8            Slot;
    IN OUT UINTN        ATRData;
    OUT UINTN           fpDevInfo;
} CCID_ATR, * FPCCID_ATR;


//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        CCID_POWERUP_SLOT
//
// Description: This is a Core Procedure URP  structure for
//      the BIOS API call USB_API_CCID_DEVICE_REQUEST command (API #2Fh )
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _CCID_POWERUP_SLOT{
    IN UINT8            Slot;
    OUT UINT8            bStatus;
    OUT UINT8            bError;
    IN OUT UINTN        ATRData;
    OUT UINTN            fpDevInfo;                        
} CCID_POWERUP_SLOT, * FPCCID_POWERUP_SLOT;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        CCID_POWERDOWN_SLOT
//
// Description: This is a Core Procedure URP  structure for
//      the BIOS API call USB_API_CCID_DEVICE_REQUEST command (API #2Fh )
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _CCID_POWERDOWN_SLOT{
    IN  UINT8            Slot;
    OUT UINT8            bStatus;
    OUT UINT8            bError;
    OUT UINTN            fpDevInfo;            
} CCID_POWERDOWN_SLOT, * FPCCID_POWERDOWN_SLOT;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        CCID_GETSLOT_STATUS
//
// Description: This is a Core Procedure URP  structure for
//      the BIOS API call USB_API_CCID_DEVICE_REQUEST command (API #2Fh )
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _CCID_GETSLOT_STATUS{
    OUT UINT8            bStatus;
    OUT UINT8            bError;
    OUT UINT8            bClockStatus;    
    IN  UINT8            Slot;
    OUT UINTN            fpDevInfo;            
} CCID_GETSLOT_STATUS, * FPCCID_GETSLOT_STATUS;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        CCID_XFRBLOCK
//
// Description: This is a Core Procedure URP  structure for
//      the BIOS API call USB_API_CCID_DEVICE_REQUEST command (API #2Fh )
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _CCID_CCID_XFRBLOCK{
    IN UINTN            CmdLength;
    IN UINTN            fpCmdBuffer;
    IN UINT8            ISBlock;
    OUT UINT8            bStatus;
    OUT UINT8            bError;
    IN OUT UINTN        ResponseLength;
    OUT UINTN            fpResponseBuffer;
    IN  UINT8            Slot;
    OUT UINTN            fpDevInfo;
} CCID_XFRBLOCK, * FPCCID_XFRBLOCK;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        CCID_GET_PARAMS
//
// Description: This is a Core Procedure URP  structure for
//      the BIOS API call USB_API_CCID_DEVICE_REQUEST command (API #2Fh )
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _CCID_GET_PARAMS{
    OUT UINT8            bStatus;
    OUT UINT8            bError;
    IN OUT UINTN        ResponseLength;
    OUT UINTN            fpResponseBuffer;
    IN  UINT8            Slot;
    OUT UINTN            fpDevInfo;
} CCID_GET_PARAMS, * FPCCID_GET_PARAMS;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        API_DATA
//
// Description: This is a union data type of all the API related data
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

typedef union {
    CK_PRESENCE             CkPresence;
    START_HC                StartHc;
    GET_DEV_INFO            GetDevInfo;
    CHK_DEV_PRSNC           ChkDevPrsnc;
    SECURITY_IF             SecurityIf;
    MASS_GET_DEV_INFO       MassGetDevInfo;
    MASS_GET_DEV_STATUS     MassGetDevSts;
    MASS_GET_DEV_GEO        MassGetDevGeo;
    MASS_RESET              MassReset;
    MASS_READ               MassRead;
    MASS_WRITE              MassWrite;
    MASS_VERIFY             MassVerify;
    MASS_FORMAT             MassFormat;
    MASS_REQ_SENSE          MassReqSense;
    MASS_TEST_UNIT_RDY      MassTstUnitRdy;
    MASS_START_STOP_UNIT    MassStartStop;
    MASS_READ_CAPACITY      MassReadCap;
    MASS_MODE_SENSE         MassModeSense;
    MASS_INQUIRY            MassInquiry;
    MASS_CMD_PASS_THRU      MassCmdPassThru;
    MASS_ASSIGN_DRIVE_NUM   MassAssignNum;
    MASS_CHK_DEV_READY      MassChkDevReady;
    MASS_GET_DEV_PARMS      MassGetDevParms;
    KB_LEDS_DATA            KbLedsData;
    UINT8                   Owner;
    HCPROC_PARAM            HcProc;
    COREPROC_PARAM          CoreProc;
    UINT8                   KbcControlCode;            //(EIP29733+)
    GET_DEV_ADDR            GetDevAddr;
    UINT8                   DevAddr;
    //    CCID APIs
    CCID_GETSMARTCLASSDESCRIPTOR CCIDSmartClassDescriptor;
    CCID_ATR                    CCIDAtr;
    CCID_POWERUP_SLOT           CCIDPowerupSlot;
    CCID_POWERDOWN_SLOT         CCIDPowerdownSlot;
    CCID_GETSLOT_STATUS         CCIDGetSlotStatus;
    CCID_XFRBLOCK               CCIDXfrBlock;
    CCID_GET_PARAMS             CCIDGetParameters;
	UINT16					HcBusDevFuncNum;    //(EIP74876+)
	HC_START_STOP			HcStartStop;
} U_API_DATA;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        URP_STRUC
//
// Description: This structure is the URP structure
//
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bFuncNumber UINT8       Function number of the URP
//      bSubFunc    UINT8       Sub-func number of the URP
//      bRetValue   UINT8       Return value
//      ApiData     API_DATA    Refer structure definition
//----------------------------------------------------------------------------
//<AMI_SHDR_END>

struct _URP_STRUC {
    UINT8       bFuncNumber;
    UINT8       bSubFunc;
    UINT8       bRetValue;
    U_API_DATA  ApiData;
};

#pragma pack(pop)

typedef struct {
	UINT8	NumUsbKbds;
	UINT8	NumUsbMice;
	UINT8	NumUsbPoint; 				//(EIP38434+)
	UINT8	NumUsbMass;
	UINT8	NumUsbHubs;
	UINT8	NumUsbCcids;
	UINT8	NumUhcis;
    UINT8   NumOhcis;
    UINT8   NumEhcis;
    UINT8   NumXhcis;
} CONNECTED_USB_DEVICES_NUM;

typedef VOID (EFIAPI *EFI_USB_REPORT_DEVICES ) (
  CONNECTED_USB_DEVICES_NUM	*);

typedef struct _EFI_USB_HOTPLUG_DEVS {
	BOOLEAN cdrom;
	BOOLEAN	floppy;
} EFI_USB_HOTPLUG_DEVS;

typedef EFI_STATUS (EFIAPI *EFI_USB_GET_HOTPLUG_DEVS ) (
  EFI_USB_HOTPLUG_DEVS *);

typedef EFI_STATUS (EFIAPI *EFI_USB_GET_RUNTIME_REGION ) (
  EFI_PHYSICAL_ADDRESS *,
  EFI_PHYSICAL_ADDRESS *);

typedef UINT8 (EFIAPI *EFI_USB_GET_NEXT_MASS_DEVICE_NAME ) (
  UINT8*, UINT8, UINT8);

typedef struct
{
    EFI_BLOCK_IO_PROTOCOL   BlockIoProtocol;
    EFI_BLOCK_IO_MEDIA      *Media;
    VOID                    *DevInfo;
    UINT16                  LogicalAddress;
    EFI_HANDLE              Handle;
    UINT16                  PciBDF;
    UINT8                   *DevString;
    UINT8                   StorageType;
} USB_MASS_DEV;

//(EIP51653+)>
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:        USB_SKIP_LIST
//
//
// Description:    If your roothub port 4 insert a hub.You want to skip hub's port 2.
//                 Set bRootPort = 4,  dRoutePath =2
//				   If your roothub port 4 insert a hub1.And hub1 port 2 insert a hub2. 
//				   You want to skip hub2's port 1. 
//                 Set bRootPort = 4,  dRoutePath =21 
// Fields:   Name       Type        Description
//      ------------------------------------------------------------
//      bSkipType   BYTE        Skip by which Type
//      bSkipAll   	BYTE        If this flag is 1 than skip all ports. 
//      wBDF        WORD        Bus Dev Function
//		bRootPort	BYTE		Root port path
//      dRoutePath 	DWORD       Hub route path. See description.
//      bBaseClass 	BYTE        Device Type
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
#define SKIP_FOR_ALLCONTROLLER              	0x1		//(EIP62695)
                                        //(EIP88776+)>
#define SKIP_FLAG_SKIP_PORT              	    0x0		 
#define SKIP_FLAG_KEEP_PORT              	    0x1		 
#define SKIP_FLAG_SKIP_LEVEL         	        0x2 //Skip usb ports on the same level.
#define SKIP_FLAG_SKIP_MULTI_LEVEL              0x3 //Skip usb ports which include down stream ports.
                                        //<(EIP88776+)
typedef struct _USB_SKIP_LIST{
	UINT8 	bSkipType;
    UINT8  	bFlag; 					    //(EIP88776)
    UINT16  wBDF;
	UINT8	bRootPort;
    UINT32  dRoutePath;
    UINT8   bBaseClass;
} USB_SKIP_LIST;
//<(EIP51653+) 

//----------------------------------------------------------------------------
//      USB Mass Storage Related Data Structures and Equates
//----------------------------------------------------------------------------
#define USB_EMU_NONE            0
#define USB_EMU_FLOPPY_ONLY     1
#define USB_EMU_HDD_ONLY        2
#define USB_EMU_HDD_OR_FDD      3
#define USB_EMU_FORCED_FDD      4

#define BAID_TYPE_HDD           1
#define BAID_TYPE_RMD_HDD       2
#define BAID_TYPE_CDROM	        3
#define BAID_TYPE_RMD_FDD       4
#define BAID_TYPE_FDD           5

// Values for Mass Storage Device type
//-------------------------------------
#define USB_MASS_DEV_UNKNOWN    0
#define USB_MASS_DEV_HDD        1
#define USB_MASS_DEV_CDROM      2
#define USB_MASS_DEV_ARMD       3
#define USB_MASS_DEV_FDD        4
#define USB_MASS_DEV_MO         5


#define STOP_USB_CONTROLLER     0				//(EIP43475+)
#define START_USB_CONTROLLER    1				//(EIP43475+)

typedef VOID (*API_FUNC)(URP_STRUC*);
typedef VOID (EFIAPI *EFI_USB_CHANGE_EFI_TO_LEGACY) (UINT8);
//typedef EFI_STATUS (EFIAPI *EFI_USB_BBS_REMOVE_MASSSTORAGE) ();

typedef EFI_STATUS (EFIAPI *EFI_INSTALL_USB_LEGACY_BOOT_DEVICES)(VOID);
typedef EFI_STATUS (EFIAPI *EFI_USB_INSTALL_LEGACY_DEVICE)(USB_MASS_DEV*);
typedef EFI_STATUS (EFIAPI *EFI_USB_UNINSTALL_LEGACY_DEVICE)(USB_MASS_DEV*);
typedef EFI_STATUS (EFIAPI *EFI_GET_ASSIGN_USB_BOOT_PORT)(UINT8*, UINT8*);
typedef VOID (EFIAPI *EFI_KBC_ACCESS_CONTROL)(UINT8);
typedef EFI_STATUS (EFIAPI *EFI_USB_RT_LEGACY_CONTROL)(VOID *);
typedef VOID (EFIAPI *EFI_USB_STOP_UNSUPPORTED_HC)();
typedef VOID (EFIAPI *EFI_USB_SHUTDOWN_LEGACY)(); 			//<(EIP52339+)
typedef VOID (EFIAPI *EFI_USB_COPY_SKIP_TABLE)(USB_SKIP_LIST*, UINT8);			//(EIP51653+)	
typedef VOID (EFIAPI *EFI_USB_RT_STOP_CONTROLLER)(UINT16);		    //(EIP74876+)
typedef VOID (EFIAPI *EFI_USB_INVOKE_API)(VOID*);
typedef struct _EFI_USB_PROTOCOL {
	UINT32							Signature;				//(EIP55275+)
	VOID        					*USBDataPtr;
//    VOID                            *UsbBadDeviceTable;		//(EIP60706-)
	EFI_USB_REPORT_DEVICES			UsbReportDevices;
	EFI_USB_GET_NEXT_MASS_DEVICE_NAME	UsbGetNextMassDeviceName;
    EFI_USB_CHANGE_EFI_TO_LEGACY    UsbChangeEfiToLegacy;
//    EFI_USB_BBS_REMOVE_MASSSTORAGE  UsbBbsRemoveMassStorage;
    EFI_USB_GET_RUNTIME_REGION      UsbGetRuntimeRegion;
    EFI_INSTALL_USB_LEGACY_BOOT_DEVICES InstallUsbLegacyBootDevices;
    EFI_USB_INSTALL_LEGACY_DEVICE   UsbInstallLegacyDevice;
    EFI_USB_UNINSTALL_LEGACY_DEVICE UsbUninstallLegacyDevice;
    EFI_GET_ASSIGN_USB_BOOT_PORT    UsbGetAssignBootPort;
    EFI_KBC_ACCESS_CONTROL          UsbRtKbcAccessControl;
    EFI_USB_RT_LEGACY_CONTROL       UsbLegacyControl;
	EFI_USB_STOP_UNSUPPORTED_HC		UsbStopUnsupportedHc;
    EFI_USB_SHUTDOWN_LEGACY       UsbRtShutDownLegacy;      //EIP52339+
    EFI_USB_COPY_SKIP_TABLE       	UsbCopySkipTable;			//(EIP51653+)	
    EFI_USB_RT_STOP_CONTROLLER      UsbRtStopController;	        //(EIP74876+)
    EFI_USB_INVOKE_API				UsbInvokeApi;
} EFI_USB_PROTOCOL;

typedef struct {
    UINT32                          ConstantDataCrc32;
    UINT32                          Crc32Hash;
} AMI_USB_GLOBAL_DATA_VALIDATION;

typedef struct {
	EFI_USB_STOP_UNSUPPORTED_HC		UsbStopUnsupportedHc;
    API_FUNC                        *UsbApiTable;
    API_FUNC                        *UsbMassApiTable;
    AMI_USB_GLOBAL_DATA_VALIDATION  GlobalDataValidation;
} AMI_USB_SMM_PROTOCOL;

#endif
#endif // _USB_PROT_H

//****************************************************************************
//****************************************************************************
//**                                                                        **
//**             (C)Copyright 1985-2016, American Megatrends, Inc.          **
//**                                                                        **
//**                          All Rights Reserved.                          **
//**                                                                        **
//**                 5555 Oakbrook Pkwy, Norcross, GA 30093                 **
//**                                                                        **
//**                          Phone (770)-246-8600                          **
//**                                                                        **
//****************************************************************************
//****************************************************************************