EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h

Go to the documentation of this file.
00001 
00016 #ifndef _EFI_EHCI_H_
00017 #define _EFI_EHCI_H_
00018 
00019 
00020 #include <Uefi.h>
00021 
00022 #include <Protocol/Usb2HostController.h>
00023 #include <Protocol/PciIo.h>
00024 
00025 #include <Guid/EventGroup.h>
00026 
00027 #include <Library/DebugLib.h>
00028 #include <Library/BaseMemoryLib.h>
00029 #include <Library/UefiDriverEntryPoint.h>
00030 #include <Library/UefiBootServicesTableLib.h>
00031 #include <Library/UefiLib.h>
00032 #include <Library/BaseLib.h>
00033 #include <Library/MemoryAllocationLib.h>
00034 #include <Library/PcdLib.h>
00035 
00036 #include <IndustryStandard/Pci.h>
00037 
00038 typedef struct _USB2_HC_DEV  USB2_HC_DEV;
00039 
00040 #include "UsbHcMem.h"
00041 #include "EhciReg.h"
00042 #include "EhciUrb.h"
00043 #include "EhciSched.h"
00044 #include "EhciDebug.h"
00045 #include "ComponentName.h"
00046 
00047 //
00048 // EHC timeout experience values
00049 //
00050 
00051 #define EHC_1_MICROSECOND            1
00052 #define EHC_1_MILLISECOND            (1000 * EHC_1_MICROSECOND)
00053 #define EHC_1_SECOND                 (1000 * EHC_1_MILLISECOND)
00054 
00055 //
00056 // EHCI register operation timeout, set by experience
00057 //
00058 #define EHC_RESET_TIMEOUT            (1 * EHC_1_SECOND)
00059 #define EHC_GENERIC_TIMEOUT          (10 * EHC_1_MILLISECOND)
00060 
00061 //
00062 // Wait for roothub port power stable, refers to Spec[EHCI1.0-2.3.9]
00063 //
00064 #define EHC_ROOT_PORT_RECOVERY_STALL (20 * EHC_1_MILLISECOND)
00065 
00066 //
00067 // Sync and Async transfer polling interval, set by experience,
00068 // and the unit of Async is 100us, means 50ms as interval.
00069 //
00070 #define EHC_SYNC_POLL_INTERVAL       (1 * EHC_1_MILLISECOND)
00071 #define EHC_ASYNC_POLL_INTERVAL      (50 * 10000U)
00072 
00073 //
00074 // EHC raises TPL to TPL_NOTIFY to serialize all its operations
00075 // to protect shared data structures.
00076 //
00077 #define  EHC_TPL                TPL_NOTIFY
00078 
00079 //
00080 //Iterate through the doule linked list. NOT delete safe
00081 //
00082 #define EFI_LIST_FOR_EACH(Entry, ListHead)    \
00083   for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
00084 
00085 //
00086 //Iterate through the doule linked list. This is delete-safe.
00087 //Don't touch NextEntry
00088 //
00089 #define EFI_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead)            \
00090   for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink;\
00091       Entry != (ListHead); Entry = NextEntry, NextEntry = Entry->ForwardLink)
00092 
00093 #define EFI_LIST_CONTAINER(Entry, Type, Field) BASE_CR(Entry, Type, Field)
00094 
00095 
00096 #define EHC_LOW_32BIT(Addr64)     ((UINT32)(((UINTN)(Addr64)) & 0XFFFFFFFF))
00097 #define EHC_HIGH_32BIT(Addr64)    ((UINT32)(RShiftU64((UINTN)(Addr64), 32) & 0XFFFFFFFF))
00098 #define EHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
00099 
00100 #define EHC_REG_BIT_IS_SET(Ehc, Offset, Bit) \
00101           (EHC_BIT_IS_SET(EhcReadOpReg ((Ehc), (Offset)), (Bit)))
00102 
00103 #define USB2_HC_DEV_SIGNATURE  SIGNATURE_32 ('e', 'h', 'c', 'i')
00104 #define EHC_FROM_THIS(a)       CR(a, USB2_HC_DEV, Usb2Hc, USB2_HC_DEV_SIGNATURE)
00105 
00106 struct _USB2_HC_DEV {
00107   UINTN                     Signature;
00108   EFI_USB2_HC_PROTOCOL      Usb2Hc;
00109 
00110   EFI_PCI_IO_PROTOCOL       *PciIo;
00111   UINT64                    OriginalPciAttributes;
00112   USBHC_MEM_POOL            *MemPool;
00113 
00114   //
00115   // Schedule data shared between asynchronous and periodic
00116   // transfers:
00117   // ShortReadStop, as its name indicates, is used to terminate
00118   // the short read except the control transfer. EHCI follows
00119   // the alternative next QTD point when a short read happens.
00120   // For control transfer, even the short read happens, try the
00121   // status stage.
00122   //
00123   EHC_QTD                  *ShortReadStop;
00124   EFI_EVENT                 PollTimer;
00125 
00126   //
00127   // ExitBootServicesEvent is used to stop the EHC DMA operation 
00128   // after exit boot service.
00129   //
00130   EFI_EVENT                 ExitBootServiceEvent;
00131 
00132   //
00133   // Asynchronous(bulk and control) transfer schedule data:
00134   // ReclaimHead is used as the head of the asynchronous transfer
00135   // list. It acts as the reclamation header.
00136   //
00137   EHC_QH                   *ReclaimHead;
00138 
00139   //
00140   // Peroidic (interrupt) transfer schedule data:
00141   //
00142   VOID                      *PeriodFrame;     // the buffer pointed by this pointer is used to store pci bus address of the QH descriptor.
00143   VOID                      *PeriodFrameHost; // the buffer pointed by this pointer is used to store host memory address of the QH descriptor.
00144   VOID                      *PeriodFrameMap;
00145 
00146   EHC_QH                    *PeriodOne;
00147   LIST_ENTRY                AsyncIntTransfers;
00148 
00149   //
00150   // EHCI configuration data
00151   //
00152   UINT32                    HcStructParams; // Cache of HC structure parameter, EHC_HCSPARAMS_OFFSET
00153   UINT32                    HcCapParams;    // Cache of HC capability parameter, HCCPARAMS
00154   UINT32                    CapLen;         // Capability length
00155 
00156   //
00157   // Misc
00158   //
00159   EFI_UNICODE_STRING_TABLE  *ControllerNameTable;
00160 };
00161 
00162 
00163 extern EFI_DRIVER_BINDING_PROTOCOL      gEhciDriverBinding;
00164 extern EFI_COMPONENT_NAME_PROTOCOL      gEhciComponentName;
00165 extern EFI_COMPONENT_NAME2_PROTOCOL     gEhciComponentName2;
00166 
00180 EFI_STATUS
00181 EFIAPI
00182 EhcDriverBindingSupported (
00183   IN EFI_DRIVER_BINDING_PROTOCOL *This,
00184   IN EFI_HANDLE                  Controller,
00185   IN EFI_DEVICE_PATH_PROTOCOL    *RemainingDevicePath
00186   );
00187 
00201 EFI_STATUS
00202 EFIAPI
00203 EhcDriverBindingStart (
00204   IN EFI_DRIVER_BINDING_PROTOCOL *This,
00205   IN EFI_HANDLE                  Controller,
00206   IN EFI_DEVICE_PATH_PROTOCOL    *RemainingDevicePath
00207   );
00208 
00222 EFI_STATUS
00223 EFIAPI
00224 EhcDriverBindingStop (
00225   IN EFI_DRIVER_BINDING_PROTOCOL *This,
00226   IN EFI_HANDLE                  Controller,
00227   IN UINTN                       NumberOfChildren,
00228   IN EFI_HANDLE                  *ChildHandleBuffer
00229   );
00230 
00231 #endif
00232 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines