]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h
Clean up to update the reference of the these macros:
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / Uhci.h
... / ...
CommitLineData
1/** @file\r
2\r
3 The definition for UHCI driver model and HC protocol routines.\r
4\r
5Copyright (c) 2004 - 2007, Intel Corporation\r
6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _EFI_UHCI_H_\r
17#define _EFI_UHCI_H_\r
18\r
19\r
20#include <Uefi.h>\r
21\r
22#include <Protocol/Usb2HostController.h>\r
23#include <Protocol/UsbHostController.h>\r
24#include <Protocol/PciIo.h>\r
25\r
26#include <Library/DebugLib.h>\r
27#include <Library/BaseMemoryLib.h>\r
28#include <Library/UefiDriverEntryPoint.h>\r
29#include <Library/UefiBootServicesTableLib.h>\r
30#include <Library/UefiLib.h>\r
31#include <Library/BaseLib.h>\r
32#include <Library/MemoryAllocationLib.h>\r
33#include <Library/PcdLib.h>\r
34\r
35#include <IndustryStandard/Pci22.h>\r
36\r
37typedef struct _USB_HC_DEV USB_HC_DEV;\r
38\r
39#include "UsbHcMem.h"\r
40#include "UhciQueue.h"\r
41#include "UhciReg.h"\r
42#include "UhciSched.h"\r
43#include "UhciDebug.h"\r
44#include "ComponentName.h"\r
45\r
46typedef enum {\r
47 UHC_1_MICROSECOND = 1,\r
48 UHC_1_MILLISECOND = 1000 * UHC_1_MICROSECOND,\r
49 UHC_1_SECOND = 1000 * UHC_1_MILLISECOND,\r
50\r
51 //\r
52 // UHCI register operation timeout, set by experience\r
53 //\r
54 UHC_GENERIC_TIMEOUT = UHC_1_SECOND,\r
55\r
56 //\r
57 // Wait for force global resume(FGR) complete, refers to\r
58 // specification[UHCI11-2.1.1]\r
59 //\r
60 UHC_FORCE_GLOBAL_RESUME_STALL = 20 * UHC_1_MILLISECOND,\r
61\r
62 //\r
63 // Wait for roothub port reset and recovery, reset stall\r
64 // is set by experience, and recovery stall refers to\r
65 // specification[UHCI11-2.1.1]\r
66 //\r
67 UHC_ROOT_PORT_RESET_STALL = 50 * UHC_1_MILLISECOND,\r
68 UHC_ROOT_PORT_RECOVERY_STALL = 10 * UHC_1_MILLISECOND,\r
69\r
70 //\r
71 // Sync and Async transfer polling interval, set by experience,\r
72 // and the unit of Async is 100us.\r
73 //\r
74 UHC_SYNC_POLL_INTERVAL = 50 * UHC_1_MICROSECOND,\r
75 UHC_ASYNC_POLL_INTERVAL = 50 * 10000UL\r
76}UHC_TIMEOUT_EXPERIENCE_VALUE;\r
77\r
78\r
79//\r
80// UHC raises TPL to TPL_NOTIFY to serialize all its operations\r
81// to protect shared data structures.\r
82//\r
83#define UHCI_TPL TPL_NOTIFY\r
84\r
85#define USB_HC_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'h', 'c', 'i')\r
86\r
87#pragma pack(1)\r
88typedef struct {\r
89 UINT8 PI;\r
90 UINT8 SubClassCode;\r
91 UINT8 BaseCode;\r
92} USB_CLASSC;\r
93#pragma pack()\r
94\r
95#define UHC_FROM_USB2_HC_PROTO(This) CR(This, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE)\r
96\r
97//\r
98// USB_HC_DEV support the UHCI hardware controller. It schedules\r
99// the asynchronous interrupt transfer with the same method as\r
100// EHCI: a reversed tree structure. For synchronous interrupt,\r
101// control and bulk transfer, it uses three static queue head to\r
102// schedule them. SyncIntQh is for interrupt transfer. LsCtrlQh is\r
103// for LOW speed control transfer, and FsCtrlBulkQh is for FULL\r
104// speed control or bulk transfer. This is because FULL speed contrl\r
105// or bulk transfer can reclaim the unused bandwidth. Some USB\r
106// device requires this bandwidth reclamation capability.\r
107//\r
108struct _USB_HC_DEV {\r
109 UINT32 Signature;\r
110 EFI_USB2_HC_PROTOCOL Usb2Hc;\r
111 EFI_PCI_IO_PROTOCOL *PciIo;\r
112 UINT64 OriginalPciAttributes;\r
113\r
114 //\r
115 // Schedule data structures\r
116 //\r
117 UINT32 *FrameBase;\r
118 UHCI_QH_SW *SyncIntQh;\r
119 UHCI_QH_SW *CtrlQh;\r
120 UHCI_QH_SW *BulkQh;\r
121\r
122 //\r
123 // Structures to maintain asynchronus interrupt transfers.\r
124 // When asynchronous interrutp transfer is unlinked from\r
125 // the frame list, the hardware may still hold a pointer\r
126 // to it. To synchronize with hardware, its resoureces are\r
127 // released in two steps using Recycle and RecycleWait.\r
128 // Check the asynchronous interrupt management routines.\r
129 //\r
130 LIST_ENTRY AsyncIntList;\r
131 EFI_EVENT AsyncIntMonitor;\r
132 UHCI_ASYNC_REQUEST *Recycle;\r
133 UHCI_ASYNC_REQUEST *RecycleWait;\r
134\r
135\r
136 UINTN RootPorts;\r
137 USBHC_MEM_POOL *MemPool;\r
138 EFI_UNICODE_STRING_TABLE *CtrlNameTable;\r
139 VOID *FrameMapping;\r
140};\r
141\r
142extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;\r
143extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName;\r
144extern EFI_COMPONENT_NAME2_PROTOCOL gUhciComponentName2;\r
145\r
146/**\r
147 Test to see if this driver supports ControllerHandle. Any\r
148 ControllerHandle that has UsbHcProtocol installed will be supported.\r
149\r
150 @param This Protocol instance pointer.\r
151 @param Controller Handle of device to test.\r
152 @param RemainingDevicePath Not used.\r
153\r
154 @return EFI_SUCCESS This driver supports this device.\r
155 @return EFI_UNSUPPORTED This driver does not support this device.\r
156\r
157**/\r
158EFI_STATUS\r
159EFIAPI\r
160UhciDriverBindingSupported (\r
161 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
162 IN EFI_HANDLE Controller,\r
163 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
164 );\r
165\r
166/**\r
167 Starting the Usb UHCI Driver.\r
168\r
169 @param This Protocol instance pointer.\r
170 @param Controller Handle of device to test.\r
171 @param RemainingDevicePath Not used.\r
172\r
173 @retval EFI_SUCCESS This driver supports this device.\r
174 @retval EFI_UNSUPPORTED This driver does not support this device.\r
175 @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.\r
176 EFI_OUT_OF_RESOURCES- Failed due to resource shortage.\r
177\r
178**/\r
179EFI_STATUS\r
180EFIAPI\r
181UhciDriverBindingStart (\r
182 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
183 IN EFI_HANDLE Controller,\r
184 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
185 );\r
186\r
187/**\r
188 Stop this driver on ControllerHandle. Support stoping any child handles\r
189 created by this driver.\r
190\r
191 @param This Protocol instance pointer.\r
192 @param Controller Handle of device to stop driver on.\r
193 @param NumberOfChildren Number of Children in the ChildHandleBuffer.\r
194 @param ChildHandleBuffer List of handles for the children we need to stop.\r
195\r
196 @return EFI_SUCCESS\r
197 @return others\r
198\r
199**/\r
200EFI_STATUS\r
201EFIAPI\r
202UhciDriverBindingStop (\r
203 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
204 IN EFI_HANDLE Controller,\r
205 IN UINTN NumberOfChildren,\r
206 IN EFI_HANDLE *ChildHandleBuffer\r
207 );\r
208\r
209#endif\r