]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h
modify coding style
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / Uhci.h
index c37894d3a8c7680a99ebecb75621175753bb4e52..92c78333ebff4a3cce50a84155806d55bb404a02 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+  The definition for UHCI driver model and HC protocol routines.\r
+\r
 Copyright (c) 2004 - 2007, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -9,35 +11,18 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  Uhci.h\r
-\r
-Abstract:\r
-\r
-  The definition for UHCI driver model and HC protocol routines.\r
-\r
-Revision History\r
-\r
-\r
 **/\r
 \r
-#ifndef _UHCI_H\r
-#define _UHCI_H\r
+#ifndef _EFI_UHCI_H_\r
+#define _EFI_UHCI_H_\r
+\r
 \r
-//\r
-// The package level header files this module uses\r
-//\r
 #include <PiDxe.h>\r
-//\r
-// The protocols, PPI and GUID defintions for this module\r
-//\r
+\r
 #include <Protocol/Usb2HostController.h>\r
 #include <Protocol/UsbHostController.h>\r
 #include <Protocol/PciIo.h>\r
-//\r
-// The Library classes this module consumes\r
-//\r
+\r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
@@ -45,6 +30,7 @@ Revision History
 #include <Library/UefiLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
+#include <Library/PcdLib.h>\r
 \r
 #include <IndustryStandard/Pci22.h>\r
 \r
@@ -56,27 +42,46 @@ typedef struct _USB_HC_DEV  USB_HC_DEV;
 #include "UhciSched.h"\r
 #include "UhciDebug.h"\r
 \r
-enum {\r
+typedef enum {\r
+  UHC_1_MICROSECOND             = 1,\r
+  UHC_1_MILLISECOND             = 1000 * UHC_1_MICROSECOND,\r
+  UHC_1_SECOND                  = 1000 * UHC_1_MILLISECOND,\r
+\r
   //\r
-  // Stall times\r
+  // UHCI register operation timeout, set by experience\r
   //\r
-  STALL_1_MS               = 1000,\r
-  STALL_1_SECOND           = 1000 *STALL_1_MS,\r
+  UHC_GENERIC_TIMEOUT           = UHC_1_SECOND,\r
 \r
-  UHC_SYN_POLL             = 50,\r
-  FORCE_GLOBAL_RESUME_TIME = 20 *STALL_1_MS,\r
-  ROOT_PORT_REST_TIME      = 50 *STALL_1_MS,\r
-  PORT_RESET_RECOVERY_TIME = 10 *STALL_1_MS,\r
-  INTERRUPT_POLLING_TIME   = 50 * 10000UL,\r
+  //\r
+  // Wait for force global resume(FGR) complete, refers to\r
+  // specification[UHCI11-2.1.1]\r
+  //\r
+  UHC_FORCE_GLOBAL_RESUME_STALL = 20 * UHC_1_MILLISECOND,\r
 \r
   //\r
-  // UHC raises TPL to TPL_NOTIFY to serialize all its operations\r
-  // to protect shared data structures.\r
+  // Wait for roothub port reset and recovery, reset stall\r
+  // is set by experience, and recovery stall refers to\r
+  // specification[UHCI11-2.1.1]\r
   //\r
-  UHCI_TPL                 = TPL_NOTIFY,\r
+  UHC_ROOT_PORT_RESET_STALL     = 50 * UHC_1_MILLISECOND,\r
+  UHC_ROOT_PORT_RECOVERY_STALL  = 10 * UHC_1_MILLISECOND,\r
+\r
+  //\r
+  // Sync and Async transfer polling interval, set by experience,\r
+  // and the unit of Async is 100us.\r
+  //\r
+  UHC_SYNC_POLL_INTERVAL        = 50 * UHC_1_MICROSECOND,\r
+  UHC_ASYNC_POLL_INTERVAL       = 50 * 10000UL\r
+}UHC_TIMEOUT_EXPERIENCE_VALUE;\r
 \r
-  USB_HC_DEV_SIGNATURE     = EFI_SIGNATURE_32 ('u', 'h', 'c', 'i'),\r
-};\r
+\r
+//\r
+// UHC raises TPL to TPL_NOTIFY to serialize all its operations\r
+// to protect shared data structures.\r
+//\r
+#define  UHCI_TPL                     TPL_NOTIFY\r
+\r
+#define  USB_HC_DEV_SIGNATURE         EFI_SIGNATURE_32 ('u', 'h', 'c', 'i')\r
 \r
 #pragma pack(1)\r
 typedef struct {\r
@@ -86,7 +91,6 @@ typedef struct {
 } USB_CLASSC;\r
 #pragma pack()\r
 \r
-#define UHC_FROM_USB_HC_PROTO(This)   CR(This, USB_HC_DEV, UsbHc, USB_HC_DEV_SIGNATURE)\r
 #define UHC_FROM_USB2_HC_PROTO(This)  CR(This, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE)\r
 \r
 //\r
@@ -100,11 +104,11 @@ typedef struct {
 // or bulk transfer can reclaim the unused bandwidth. Some USB\r
 // device requires this bandwidth reclamation capability.\r
 //\r
-typedef struct _USB_HC_DEV {\r
+struct _USB_HC_DEV {\r
   UINT32                    Signature;\r
-  EFI_USB_HC_PROTOCOL       UsbHc;\r
   EFI_USB2_HC_PROTOCOL      Usb2Hc;\r
   EFI_PCI_IO_PROTOCOL       *PciIo;\r
+  UINT64                    OriginalPciAttributes;\r
 \r
   //\r
   // Schedule data structures\r
@@ -132,9 +136,10 @@ typedef struct _USB_HC_DEV {
   USBHC_MEM_POOL            *MemPool;\r
   EFI_UNICODE_STRING_TABLE  *CtrlNameTable;\r
   VOID                      *FrameMapping;\r
-} USB_HC_DEV;\r
+};\r
 \r
-extern EFI_DRIVER_BINDING_PROTOCOL  gUhciDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL  gUhciComponentName;\r
+extern EFI_DRIVER_BINDING_PROTOCOL   gUhciDriverBinding;\r
+extern EFI_COMPONENT_NAME_PROTOCOL   gUhciComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL  gUhciComponentName2;\r
 \r
 #endif\r