Update to support to produce Component Name and & Component Name 2 protocol based...
[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
42\r
43#include <IndustryStandard/Pci22.h>\r
44\r
45typedef struct _USB_HC_DEV USB_HC_DEV;\r
46\r
47#include "UsbHcMem.h"\r
48#include "UhciQueue.h"\r
49#include "UhciReg.h"\r
50#include "UhciSched.h"\r
51#include "UhciDebug.h"\r
52\r
53enum {\r
54 //\r
55 // Stall times\r
56 //\r
57 STALL_1_MS = 1000,\r
58 STALL_1_SECOND = 1000 *STALL_1_MS,\r
59\r
60 UHC_SYN_POLL = 50,\r
61 FORCE_GLOBAL_RESUME_TIME = 20 *STALL_1_MS,\r
62 ROOT_PORT_REST_TIME = 50 *STALL_1_MS,\r
63 PORT_RESET_RECOVERY_TIME = 10 *STALL_1_MS,\r
64 INTERRUPT_POLLING_TIME = 50 * 10000UL,\r
65\r
66 //\r
67 // UHC raises TPL to TPL_NOTIFY to serialize all its operations\r
68 // to protect shared data structures.\r
69 //\r
70 UHCI_TPL = TPL_NOTIFY,\r
71\r
c52fa98c 72 USB_HC_DEV_SIGNATURE = EFI_SIGNATURE_32 ('u', 'h', 'c', 'i')\r
913cb9dc 73};\r
74\r
75#pragma pack(1)\r
76typedef struct {\r
77 UINT8 PI;\r
78 UINT8 SubClassCode;\r
79 UINT8 BaseCode;\r
80} USB_CLASSC;\r
81#pragma pack()\r
82\r
83#define UHC_FROM_USB_HC_PROTO(This) CR(This, USB_HC_DEV, UsbHc, USB_HC_DEV_SIGNATURE)\r
84#define UHC_FROM_USB2_HC_PROTO(This) CR(This, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE)\r
85\r
86//\r
87// USB_HC_DEV support the UHCI hardware controller. It schedules\r
88// the asynchronous interrupt transfer with the same method as\r
89// EHCI: a reversed tree structure. For synchronous interrupt,\r
90// control and bulk transfer, it uses three static queue head to\r
91// schedule them. SyncIntQh is for interrupt transfer. LsCtrlQh is\r
92// for LOW speed control transfer, and FsCtrlBulkQh is for FULL\r
93// speed control or bulk transfer. This is because FULL speed contrl\r
94// or bulk transfer can reclaim the unused bandwidth. Some USB\r
95// device requires this bandwidth reclamation capability.\r
96//\r
c52fa98c 97struct _USB_HC_DEV {\r
913cb9dc 98 UINT32 Signature;\r
99 EFI_USB_HC_PROTOCOL UsbHc;\r
100 EFI_USB2_HC_PROTOCOL Usb2Hc;\r
101 EFI_PCI_IO_PROTOCOL *PciIo;\r
102\r
103 //\r
104 // Schedule data structures\r
105 //\r
106 UINT32 *FrameBase;\r
107 UHCI_QH_SW *SyncIntQh;\r
108 UHCI_QH_SW *CtrlQh;\r
109 UHCI_QH_SW *BulkQh;\r
110\r
111 //\r
112 // Structures to maintain asynchronus interrupt transfers.\r
113 // When asynchronous interrutp transfer is unlinked from\r
114 // the frame list, the hardware may still hold a pointer\r
115 // to it. To synchronize with hardware, its resoureces are\r
116 // released in two steps using Recycle and RecycleWait.\r
117 // Check the asynchronous interrupt management routines.\r
118 //\r
119 LIST_ENTRY AsyncIntList;\r
120 EFI_EVENT AsyncIntMonitor;\r
121 UHCI_ASYNC_REQUEST *Recycle;\r
122 UHCI_ASYNC_REQUEST *RecycleWait;\r
123\r
124\r
125 UINTN RootPorts;\r
126 USBHC_MEM_POOL *MemPool;\r
127 EFI_UNICODE_STRING_TABLE *CtrlNameTable;\r
128 VOID *FrameMapping;\r
c52fa98c 129};\r
913cb9dc 130\r
f527bce3 131extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;\r
132extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName;\r
133extern EFI_COMPONENT_NAME2_PROTOCOL gUhciComponentName2;\r
913cb9dc 134\r
135#endif\r