1 /*++
2 
3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4 
5 
6   This program and the accompanying materials are licensed and made available under
7 
8   the terms and conditions of the BSD License that accompanies this distribution.
9 
10   The full text of the license may be found at
11 
12   http://opensource.org/licenses/bsd-license.php.
13 
14 
15 
16   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 
18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 
20 
21 
22 
23 Module Name:
24   UsbPolicy.h
25 
26 Abstract:
27 
28 --*/
29 
30 #ifndef _USB_POLICY_H_
31 #define _USB_POLICY_H_
32 
33 EFI_FORWARD_DECLARATION (EFI_USB_POLICY_PROTOCOL);
34 
35 #define USB_POLICY_GUID \
36   {\
37     0xf617b358, 0x12cf, 0x414a, 0xa0, 0x69, 0x60, 0x67, 0x7b, 0xda, 0x13, 0xb4\
38   }
39 
40 #define TIANO_CODE_BASE           0x00
41 #define ICBD_CODE_BASE            0x01
42 
43 #define ATUO_TYPE                 0x00
44 #define USB_FDD_TYPE              0x01
45 #define HDD_TYPE                  0x02
46 #define ZIP_TYPE                  0x03
47 #define CDROM_TYPE                0x04
48 #define SIZE_TYPE                 0x05
49 
50 #define ZIP_FDD                 0x80
51 
52 #define FDD_EMULATION             0x00
53 #define HDD_EMULATION             0x01
54 
55 #define HIGH_SPEED                0x00
56 #define FULL_SPEED                0x01
57 #define SUPER_SPEED               0x02
58 
59 #define LEGACY_KB_EN              0x01
60 #define LEGACY_KB_DIS             0x00
61 #define LEGACY_MS_EN              0x01
62 #define LEGACY_MS_DIS             0x00
63 #define LEGACY_USB_EN             0x00
64 #define LEGACY_USB_DIS            0x01
65 #define LEGACY_FREE_SUPP          0x01
66 #define LEGACY_FREE_UN_SUPP       0x00
67 #define LEGACY_PERIOD_SUPP        0x01
68 #define LEGACY_PERIOD_UN_SUPP     0x00
69 
70 #define LEGACY_USB_TIME_TUE_ENABLE       0x01
71 #define LEGACY_USB_TIME_TUE_DISABLE      0x00
72 #define USB_HAVE_HUB_INTERNEL            0x01
73 #define USB_NOT_HAVE_HUB_INTERNEL        0x00
74 
75 #define USB_POLICY_PROTOCOL_REVISION_1 1
76 #define USB_POLICY_PROTOCOL_REVISION_2 2
77 
78 #ifndef __GNUC__
79 #pragma warning ( disable : 4306 )
80 #pragma warning ( disable : 4054 )
81 #endif
82 
83 #define GET_USB_CFG (UsbCfg);\
84  do{\
85   UINT16                *pSegOfEbda;\
86   UINT32                mToEbda;\
87   pSegOfEbda = (UINT16 *)(UINTN)0x40E;\
88   mToEbda    = (UINT32)(((UINTN)(*pSegOfEbda) << 4) + 0x80);\
89   UsbCfg     = (USB_CFG *)(UINTN)mToEbda;\
90  }while(0);
91 
92 #pragma    pack(1)
93 typedef struct {
94     UINT8   HasUSBKeyboard:1;
95     UINT8   HasUSBMouse:1;
96     UINT8   LegacyFreeSupport:1;
97     UINT8   UsbOperationMode:1;
98     UINT8   LegacyKBEnable:1;
99     UINT8   LegacyMSEnable:1;
100     UINT8   USBPeriodSupport:1;
101     UINT8   Reserved:1;
102 } USB_DEVICE_INFOR;
103 
104 typedef struct {
105     UINT8               Codebase;
106     UINT8               USBHDDForceType;
107     UINT8               Configurated;
108     UINT8               LpcAcpiBase;
109     UINT8               AcpiTimerReg;
110     UINT8               Reserved1[0x01];
111     UINT8               LegacyUsbEnable;
112     USB_DEVICE_INFOR    UsbDeviceInfor;
113     UINT16              UsbEmulationSize;
114     UINT8               Reserved2[0x06];
115 } USB_CFG;
116 #pragma pack()
117 
118 typedef struct _EFI_USB_POLICY_PROTOCOL{
119   UINT8   Version;
120   UINT8   UsbMassStorageEmulationType;  // 1: FDD_Type; 2: HDD_Type; other:Auto_Type*
121   UINT8   UsbOperationMode;             // 0: High_Speed; 1: Full_Speed;
122   UINT8   LegacyKBEnable;               // 0: Disabled;   1: Enabled*
123   UINT8   LegacyMSEnable;               // 0: Disabled;   1: Enabled*
124   UINT8   USBPeriodSupport;             // 0; Unsupport;  1: Support
125   UINT8   LegacyUsbEnable;              // 1: Disabled;   0: Enabled*
126   UINT8   LegacyFreeSupport;            // 0: Unsupport;  1: Support
127   UINT8   CodeBase;
128   UINT8   LpcAcpiBase;                  // 40h(default)
129   UINT8   AcpiTimerReg;
130   UINT8   UsbTimeTue;
131   UINT8   InternelHubExist;             // 1: Host have internel hub on board; 0: No internel hub on board
132   UINT8   EnumWaitPortStableStall;      // Value for wait port stable when enum a new dev.
133   UINT16  UsbEmulationSize;             // Mbytes.
134   UINT8   UsbZipEmulationType;
135   UINT8   Reserved[3];                  // Reserved fields for future expansion w/o protocol change
136 } EFI_USB_POLICY_PROTOCOL;
137 
138 extern EFI_GUID gUsbPolicyGuid;
139 
140 #endif
141