]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h
[Description]:
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / Uhci.h
CommitLineData
913cb9dc 1/** @file\r
2\r
3Copyright (c) 2004 - 2007, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 Uhci.h\r
15\r
16Abstract:\r
17\r
18 The definition for UHCI driver model and HC protocol routines.\r
19\r
20Revision History\r
21\r
22\r
23**/\r
24\r
25#ifndef _UHCI_H\r
26#define _UHCI_H\r
27\r
ed7748fe 28\r
913cb9dc 29#include <PiDxe.h>\r
ed7748fe 30\r
913cb9dc 31#include <Protocol/Usb2HostController.h>\r
32#include <Protocol/UsbHostController.h>\r
33#include <Protocol/PciIo.h>\r
ed7748fe 34\r
913cb9dc 35#include <Library/DebugLib.h>\r
36#include <Library/BaseMemoryLib.h>\r
37#include <Library/UefiDriverEntryPoint.h>\r
38#include <Library/UefiBootServicesTableLib.h>\r
39#include <Library/UefiLib.h>\r
40#include <Library/BaseLib.h>\r
41#include <Library/MemoryAllocationLib.h>\r
dd4047a5 42#include <Library/PcdLib.h>\r
913cb9dc 43\r
44#include <IndustryStandard/Pci22.h>\r
45\r
46typedef struct _USB_HC_DEV USB_HC_DEV;\r
47\r
48#include "UsbHcMem.h"\r
49#include "UhciQueue.h"\r
50#include "UhciReg.h"\r
51#include "UhciSched.h"\r
52#include "UhciDebug.h"\r
53\r
54enum {\r
41e8ff27 55 UHC_1_MICROSECOND = 1,\r
56 UHC_1_MILLISECOND = 1000 * UHC_1_MICROSECOND,\r
57 UHC_1_SECOND = 1000 * UHC_1_MILLISECOND,\r
58\r
59 //\r
60 // UHCI register operation timeout, set by experience\r
913cb9dc 61 //\r
41e8ff27 62 UHC_GENERIC_TIMEOUT = UHC_1_SECOND,\r
68246fa8 63\r
913cb9dc 64 //\r
41e8ff27 65 // Wait for force global resume(FGR) complete, refers to\r
66 // specification[UHCI11-2.1.1]\r
68246fa8 67 //\r
41e8ff27 68 UHC_FORCE_GLOBAL_RESUME_STALL = 20 * UHC_1_MILLISECOND,\r
913cb9dc 69\r
41e8ff27 70 //\r
71 // Wait for roothub port reset and recovery, reset stall\r
68246fa8 72 // is set by experience, and recovery stall refers to\r
41e8ff27 73 // specification[UHCI11-2.1.1]\r
74 //\r
75 UHC_ROOT_PORT_RESET_STALL = 50 * UHC_1_MILLISECOND,\r
76 UHC_ROOT_PORT_RECOVERY_STALL = 10 * UHC_1_MILLISECOND,\r
913cb9dc 77\r
41e8ff27 78 //\r
68246fa8 79 // Sync and Async transfer polling interval, set by experience,\r
41e8ff27 80 // and the unit of Async is 100us.\r
81 //\r
82 UHC_SYNC_POLL_INTERVAL = 50 * UHC_1_MICROSECOND,\r
83 UHC_ASYNC_POLL_INTERVAL = 50 * 10000UL,\r
68246fa8 84\r
913cb9dc 85 //\r
86 // UHC raises TPL to TPL_NOTIFY to serialize all its operations\r
87 // to protect shared data structures.\r
88 //\r
89 UHCI_TPL = TPL_NOTIFY,\r
90\r
23c326c2 91 USB_HC_DEV_SIGNATURE = EFI_SIGNATURE_32 ('u', 'h', 'c', 'i')\r
913cb9dc 92};\r
93\r
94#pragma pack(1)\r
95typedef struct {\r
96 UINT8 PI;\r
97 UINT8 SubClassCode;\r
98 UINT8 BaseCode;\r
99} USB_CLASSC;\r
100#pragma pack()\r
101\r
913cb9dc 102#define UHC_FROM_USB2_HC_PROTO(This) CR(This, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE)\r
103\r
104//\r
105// USB_HC_DEV support the UHCI hardware controller. It schedules\r
106// the asynchronous interrupt transfer with the same method as\r
107// EHCI: a reversed tree structure. For synchronous interrupt,\r
108// control and bulk transfer, it uses three static queue head to\r
109// schedule them. SyncIntQh is for interrupt transfer. LsCtrlQh is\r
110// for LOW speed control transfer, and FsCtrlBulkQh is for FULL\r
111// speed control or bulk transfer. This is because FULL speed contrl\r
112// or bulk transfer can reclaim the unused bandwidth. Some USB\r
113// device requires this bandwidth reclamation capability.\r
114//\r
c52fa98c 115struct _USB_HC_DEV {\r
913cb9dc 116 UINT32 Signature;\r
913cb9dc 117 EFI_USB2_HC_PROTOCOL Usb2Hc;\r
118 EFI_PCI_IO_PROTOCOL *PciIo;\r
68246fa8 119 UINT64 OriginalPciAttributes;\r
913cb9dc 120\r
121 //\r
122 // Schedule data structures\r
123 //\r
124 UINT32 *FrameBase;\r
125 UHCI_QH_SW *SyncIntQh;\r
126 UHCI_QH_SW *CtrlQh;\r
127 UHCI_QH_SW *BulkQh;\r
128\r
129 //\r
130 // Structures to maintain asynchronus interrupt transfers.\r
131 // When asynchronous interrutp transfer is unlinked from\r
132 // the frame list, the hardware may still hold a pointer\r
133 // to it. To synchronize with hardware, its resoureces are\r
134 // released in two steps using Recycle and RecycleWait.\r
135 // Check the asynchronous interrupt management routines.\r
136 //\r
137 LIST_ENTRY AsyncIntList;\r
138 EFI_EVENT AsyncIntMonitor;\r
139 UHCI_ASYNC_REQUEST *Recycle;\r
140 UHCI_ASYNC_REQUEST *RecycleWait;\r
141\r
142\r
143 UINTN RootPorts;\r
144 USBHC_MEM_POOL *MemPool;\r
145 EFI_UNICODE_STRING_TABLE *CtrlNameTable;\r
146 VOID *FrameMapping;\r
c52fa98c 147};\r
913cb9dc 148\r
f527bce3 149extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;\r
150extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName;\r
151extern EFI_COMPONENT_NAME2_PROTOCOL gUhciComponentName2;\r
913cb9dc 152\r
153#endif\r