diff options
Diffstat (limited to 'EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h')
-rw-r--r-- | EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h | 1733 |
1 files changed, 1593 insertions, 140 deletions
diff --git a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h b/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h index d6f841bf40..c5ae155f90 100644 --- a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h +++ b/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h @@ -28,7 +28,7 @@ Revision History #include <IndustryStandard/pci22.h>
-#define EFI_D_UHCI EFI_D_INFO
+#define EFI_D_UHCI EFI_D_INFO
//
// stall time
@@ -45,21 +45,20 @@ Revision History //
// 50 ms
//
-#define INTERRUPT_POLLING_TIME 50 * 1000 * 10
+#define INTERRUPT_POLLING_TIME 50 * 1000 * 10
//
// UHCI IO Space Address Register Register locates at
// offset 20 ~ 23h of PCI Configuration Space (UHCI spec, Revision 1.1),
// so, its BAR Index is 4.
//
-#define USB_BAR_INDEX 4
+#define USB_BAR_INDEX 4
//
// One memory block uses 1 page (common buffer for QH,TD use.)
//
#define NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES 1
-
#define bit(a) 1 << (a)
//
@@ -82,13 +81,13 @@ extern UINT16 USBBaseAddr; #define USBCMD_MAXP bit (7) /* Max Packet (0 = 32, 1 = 64) */
/* Status register */
-#define USBSTS 2 /* Status Register Offset 02-03h */
-#define USBSTS_USBINT bit (0) /* Interrupt due to IOC */
-#define USBSTS_ERROR bit (1) /* Interrupt due to error */
-#define USBSTS_RD bit (2) /* Resume Detect */
-#define USBSTS_HSE bit (3) /* Host System Error*/
-#define USBSTS_HCPE bit (4) /* Host Controller Process Error*/
-#define USBSTS_HCH bit (5) /* HC Halted */
+#define USBSTS 2 /* Status Register Offset 02-03h */
+#define USBSTS_USBINT bit (0) /* Interrupt due to IOC */
+#define USBSTS_ERROR bit (1) /* Interrupt due to error */
+#define USBSTS_RD bit (2) /* Resume Detect */
+#define USBSTS_HSE bit (3) /* Host System Error*/
+#define USBSTS_HCPE bit (4) /* Host Controller Process Error*/
+#define USBSTS_HCH bit (5) /* HC Halted */
/* Interrupt enable register */
#define USBINTR 4 /* Interrupt Enable Register 04-05h */
@@ -98,13 +97,13 @@ extern UINT16 USBBaseAddr; #define USBINTR_SP bit (3) /* Short packet interrupt enable */
/* Frame Number Register Offset 06-08h */
-#define USBFRNUM 6
+#define USBFRNUM 6
/* Frame List Base Address Register Offset 08-0Bh */
-#define USBFLBASEADD 8
+#define USBFLBASEADD 8
/* Start of Frame Modify Register Offset 0Ch */
-#define USBSOF 0x0c
+#define USBSOF 0x0c
/* USB port status and control registers */
#define USBPORTSC1 0x10 /*Port 1 offset 10-11h */
@@ -126,16 +125,16 @@ extern UINT16 USBBaseAddr; //
// Class Code Register offset
//
-#define CLASSC 0x09
+#define CLASSC 0x09
//
// USB IO Space Base Address Register offset
//
-#define USBBASE 0x20
+#define USBBASE 0x20
//
// USB legacy Support
//
-#define USB_EMULATION 0xc0
+#define USB_EMULATION 0xc0
//
// USB Base Class Code,Sub-Class Code and Programming Interface.
@@ -224,6 +223,7 @@ typedef struct { //
//////////////////////////////////////////////////////////////////////////
#define USB_HC_DEV_FROM_THIS(a) CR (a, USB_HC_DEV, UsbHc, USB_HC_DEV_SIGNATURE)
+#define USB2_HC_DEV_FROM_THIS(a) CR (a, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE)
#define USB_HC_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'h', 'c', 'i')
#define INTERRUPT_LIST_SIGNATURE EFI_SIGNATURE_32 ('i', 'n', 't', 's')
@@ -267,6 +267,7 @@ typedef struct _MEMORY_MANAGE_HEADER { typedef struct {
UINTN Signature;
EFI_USB_HC_PROTOCOL UsbHc;
+ EFI_USB2_HC_PROTOCOL Usb2Hc;
EFI_PCI_IO_PROTOCOL *PciIo;
//
@@ -289,196 +290,683 @@ WriteUHCCommandReg ( IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 CmdAddrOffset,
IN UINT16 UsbCmd
- );
+ )
+/*++
+
+Routine Description:
+
+ Write UHCI Command Register
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ CmdAddrOffset - Command address offset
+ UsbCmd - Data to write
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
EFI_STATUS
ReadUHCCommandReg (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 CmdAddrOffset,
IN OUT UINT16 *Data
- );
+ )
+/*++
+
+Routine Description:
+
+ Read UHCI Command Register
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ CmdAddrOffset - Command address offset
+ Data - Data to return
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
EFI_STATUS
WriteUHCStatusReg (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 StatusAddrOffset,
IN UINT16 UsbSts
- );
+ )
+/*++
+
+Routine Description:
+
+ Write UHCI Staus Register
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ StatusAddrOffset - Status address offset
+ UsbSts - Data to write
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
EFI_STATUS
ReadUHCStatusReg (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 StatusAddrOffset,
IN OUT UINT16 *Data
- );
+ )
+/*++
+
+Routine Description:
+
+ Read UHCI Staus Register
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ StatusAddrOffset - Status address offset
+ UsbSts - Data to return
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
EFI_STATUS
ClearStatusReg (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 StatusAddrOffset
- );
+ )
+/*++
+
+Routine Description:
+
+ Clear the content of UHC's Status Register
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ StatusAddrOffset - Status address offset
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
EFI_STATUS
ReadUHCFrameNumberReg (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 FrameNumAddrOffset,
IN OUT UINT16 *Data
- );
+ )
+/*++
+
+Routine Description:
+
+ Read from UHC's Frame Number Register
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ FrameNumAddrOffset - Frame number register offset
+ Data - Data to return
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
EFI_STATUS
WriteUHCFrameListBaseReg (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 FlBaseAddrOffset,
IN UINT32 UsbFrameListBaseAddr
- );
+ )
+/*++
+
+Routine Description:
+
+ Write to UHC's Frame List Base Register
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ FlBaseAddrOffset - Frame Base address register
+ UsbFrameListBaseAddr - Address to write
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
EFI_STATUS
ReadRootPortReg (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 PortAddrOffset,
IN OUT UINT16 *Data
- );
+ )
+/*++
+
+Routine Description:
+
+ Read from UHC's Root Port Register
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ PortAddrOffset - Port Addrress Offset,
+ Data - Data to return
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
EFI_STATUS
WriteRootPortReg (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 PortAddrOffset,
IN UINT16 ControlBits
- );
+ )
+/*++
+
+Routine Description:
+
+ Write to UHC's Root Port Register
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ PortAddrOffset - Port Addrress Offset,
+ ControlBits - Data to write
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
EFI_STATUS
WaitForUHCHalt (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 StatusRegAddr,
IN UINTN Timeout
- );
+ )
+/*++
+
+Routine Description:
+
+ Wait until UHCI halt or timeout
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ StatusRegAddr - Status Register Address
+ Timeout - Time out value in us
+
+Returns:
+
+ EFI_DEVICE_ERROR - Unable to read the status register
+ EFI_TIMEOUT - Time out
+ EFI_SUCCESS - Success
+
+--*/
+;
BOOLEAN
IsStatusOK (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 StatusRegAddr
- );
+ )
+/*++
+
+Routine Description:
+
+ Judge whether the host controller operates well
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ StatusRegAddr - Status register address
+
+Returns:
+
+ TRUE - Status is good
+ FALSE - Status is bad
+
+--*/
+;
BOOLEAN
IsHostSysOrProcessErr (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 StatusRegAddr
- );
+ )
+/*++
-//
-// This routine programs the USB frame number register. We assume that the
-// HC schedule execution is stopped.
-//
-EFI_STATUS
-SetFrameNumberReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FRNUMAddr,
- IN UINT16 Index
- );
+Routine Description:
+
+ Judge the status is HostSys,ProcessErr error or good
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ StatusRegAddr - Status register address
+
+Returns:
+
+ TRUE - Status is good
+ FALSE - Status is bad
+
+--*/
+;
UINT16
GetCurrentFrameNumber (
IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FRNUMAddr
- );
+ IN UINT32 FrameNumAddrOffset
+ )
+/*++
+
+Routine Description:
+
+ Get Current Frame Number
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ FrameNumAddrOffset - FrameNum register AddrOffset
+
+Returns:
+
+ Frame number
+
+--*/
+;
EFI_STATUS
SetFrameListBaseAddress (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 FLBASEADDRReg,
IN UINT32 Addr
- );
+ )
+/*++
+
+Routine Description:
+
+ Set FrameListBase Address
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ FlBaseAddrReg - FrameListBase register
+ Addr - Address to set
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+;
UINT32
GetFrameListBaseAddress (
IN EFI_PCI_IO_PROTOCOL *PciIo,
IN UINT32 FLBAddr
- );
+ )
+/*++
+
+Routine Description:
+
+ Get Current Frame Number
+
+Arguments:
+
+ PciIo - EFI_PCI_IO_PROTOCOL
+ FrameNumAddrOffset - FrameNum register AddrOffset
+
+Returns:
+
+ Frame number
+
+--*/
+;
EFI_STATUS
CreateFrameList (
IN USB_HC_DEV *HcDev,
IN UINT32 FLBASEADDRReg
- );
+ )
+/*++
+
+Routine Description:
+
+ CreateFrameList
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+ FlBaseAddrReg - Frame List register
+
+Returns:
+
+ EFI_OUT_OF_RESOURCES - Can't allocate memory resources
+ EFI_UNSUPPORTED - Map memory fail
+ EFI_SUCCESS - Success
+
+--*/
+;
EFI_STATUS
FreeFrameListEntry (
IN USB_HC_DEV *UhcDev
- );
+ )
+/*++
+
+Routine Description:
+
+ Free FrameList buffer
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+
+Returns:
+
+ EFI_SUCCESS - success
+
+--*/
+;
VOID
InitFrameList (
IN USB_HC_DEV *HcDev
- );
+ )
+/*++
+
+Routine Description:
+
+ Initialize FrameList
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+Returns:
+ VOID
+
+--*/
+;
EFI_STATUS
CreateQH (
IN USB_HC_DEV *HcDev,
OUT QH_STRUCT **pptrQH
- );
+ )
+/*++
+
+Routine Description:
+
+ CreateQH
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+ pptrQH - QH_STRUCT content to return
+Returns:
+
+ EFI_SUCCESS - Success
+ EFI_OUT_OF_RESOURCES - Can't allocate memory
+
+--*/
+;
VOID
SetQHHorizontalLinkPtr (
IN QH_STRUCT *ptrQH,
IN VOID *ptrNext
- );
+ )
+/*++
+
+Routine Description:
+
+ Set QH Horizontal Link Pointer
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+ ptrNext - Data to write
-VOID *
+Returns:
+
+ VOID
+
+--*/
+;
+
+VOID *
GetQHHorizontalLinkPtr (
IN QH_STRUCT *ptrQH
- );
+ )
+/*++
+
+Routine Description:
+
+ Get QH Horizontal Link Pointer
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+
+
+Returns:
+
+ Data to return
+
+--*/
+;
VOID
SetQHHorizontalQHorTDSelect (
IN QH_STRUCT *ptrQH,
IN BOOLEAN bQH
- );
+ )
+/*++
+
+Routine Description:
+
+ Set QH Horizontal QH or TD
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+ bQH - TRUE is QH FALSE is TD
+
+Returns:
+ VOID
+
+--*/
+;
VOID
SetQHHorizontalValidorInvalid (
IN QH_STRUCT *ptrQH,
IN BOOLEAN bValid
- );
+ )
+/*++
+
+Routine Description:
+
+ Set QH Horizontal Valid or Invalid
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+ bValid - TRUE is Valid FALSE is Invalid
+
+Returns:
+ VOID
+
+--*/
+;
VOID
SetQHVerticalLinkPtr (
IN QH_STRUCT *ptrQH,
IN VOID *ptrNext
- );
+ )
+/*++
+
+Routine Description:
-VOID *
+ Set QH Vertical Link Pointer
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+ ptrNext - Data to write
+Returns:
+
+ VOID
+
+--*/
+;
+
+VOID *
GetQHVerticalLinkPtr (
IN QH_STRUCT *ptrQH
- );
+ )
+/*++
+
+Routine Description:
+
+ Get QH Vertical Link Pointer
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+
+Returns:
+
+ Data to return
+
+--*/
+;
VOID
SetQHVerticalQHorTDSelect (
IN QH_STRUCT *ptrQH,
IN BOOLEAN bQH
- );
+ )
+/*++
+
+Routine Description:
+
+ Set QH Vertical QH or TD
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+ bQH - TRUE is QH FALSE is TD
+
+Returns:
+
+ VOID
+
+--*/
+;
BOOLEAN
IsQHHorizontalQHSelect (
IN QH_STRUCT *ptrQH
- );
+ )
+/*++
+
+Routine Description:
+
+ Is QH Horizontal QH Select
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+
+Returns:
+
+ TRUE - QH
+ FALSE - TD
+
+--*/
+;
VOID
SetQHVerticalValidorInvalid (
IN QH_STRUCT *ptrQH,
IN BOOLEAN bValid
- );
+ )
+/*++
+
+Routine Description:
+
+ Set QH Vertical Valid or Invalid
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+ IsValid - TRUE is valid FALSE is invalid
+
+Returns:
+
+ VOID
+
+--*/
+;
BOOLEAN
GetQHVerticalValidorInvalid (
IN QH_STRUCT *ptrQH
- );
+ )
+/*++
+
+Routine Description:
+
+ Get QH Vertical Valid or Invalid
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+
+Returns:
+
+ TRUE - Valid
+ FALSE - Invalid
+
+--*/
+;
EFI_STATUS
AllocateTDStruct (
IN USB_HC_DEV *HcDev,
OUT TD_STRUCT **ppTDStruct
- );
+ )
/*++
Routine Description:
@@ -494,12 +982,13 @@ Returns: EFI_SUCCESS
--*/
+;
EFI_STATUS
CreateTD (
IN USB_HC_DEV *HcDev,
OUT TD_STRUCT **pptrTD
- );
+ )
/*++
Routine Description:
@@ -517,6 +1006,7 @@ Returns: EFI_SUCCESS - Success
--*/
+;
EFI_STATUS
@@ -528,7 +1018,7 @@ GenSetupStageTD ( IN UINT8 *pDevReq,
IN UINT8 RequestLen,
OUT TD_STRUCT **ppTD
- );
+ )
/*++
Routine Description:
@@ -550,6 +1040,7 @@ Returns: EFI_SUCCESS - Success
--*/
+;
EFI_STATUS
GenDataTD (
@@ -562,7 +1053,7 @@ GenDataTD ( IN UINT8 Toggle,
IN BOOLEAN bSlow,
OUT TD_STRUCT **ppTD
- );
+ )
/*++
Routine Description:
@@ -586,6 +1077,7 @@ Returns: EFI_SUCCESS - Success
--*/
+;
EFI_STATUS
CreateStatusTD (
@@ -595,7 +1087,7 @@ CreateStatusTD ( IN UINT8 PktID,
IN BOOLEAN bSlow,
OUT TD_STRUCT **ppTD
- );
+ )
/*++
Routine Description:
@@ -617,237 +1109,918 @@ Returns: EFI_SUCCESS - Success
--*/
+;
VOID
SetTDLinkPtrValidorInvalid (
IN TD_STRUCT *ptrTDStruct,
IN BOOLEAN bValid
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Link Pointer Valid or Invalid
+
+Arguments:
+
+ ptrTDStruct - TD_STRUCT
+ bValid - TRUE is valid FALSE is invalid
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDLinkPtrQHorTDSelect (
IN TD_STRUCT *ptrTDStruct,
IN BOOLEAN bQH
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Link Pointer QH or TD Select
+
+Arguments:
+
+ ptrTDStruct - TD_STRUCT
+ bQH - TRUE is QH FALSE is TD
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDLinkPtrDepthorBreadth (
IN TD_STRUCT *ptrTDStruct,
IN BOOLEAN bDepth
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Link Pointer depth or bread priority
+
+Arguments:
+
+ ptrTDStruct - TD_STRUCT
+ bDepth - TRUE is Depth FALSE is Breadth
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDLinkPtr (
IN TD_STRUCT *ptrTDStruct,
IN VOID *ptrNext
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Link Pointer
+
+Arguments:
-VOID *
+ ptrTDStruct - TD_STRUCT
+ ptrNext - Pointer to set
+
+Returns:
+
+ VOID
+
+--*/
+;
+
+VOID *
GetTDLinkPtr (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Get TD Link Pointer
+
+Arguments:
+
+ ptrTDStruct - TD_STRUCT
+
+Returns:
+
+ Pointer to get
+
+--*/
+;
VOID
EnableorDisableTDShortPacket (
IN TD_STRUCT *ptrTDStruct,
IN BOOLEAN bEnable
- );
+ )
+/*++
+
+Routine Description:
+
+ Enable or Disable TD ShortPacket
+
+Arguments:
+
+ ptrTDStruct - TD_STRUCT
+ bEnable - TRUE is Enanble FALSE is Disable
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDControlErrorCounter (
IN TD_STRUCT *ptrTDStruct,
IN UINT8 nMaxErrors
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Control ErrorCounter
+
+Arguments:
+
+ ptrTDStruct - TD_STRUCT
+ nMaxErrors - Error counter number
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDLoworFullSpeedDevice (
IN TD_STRUCT *ptrTDStruct,
IN BOOLEAN bLowSpeedDevice
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD status low speed or full speed
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+ bLowSpeedDevice - Show low speed or full speed
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDControlIsochronousorNot (
IN TD_STRUCT *ptrTDStruct,
IN BOOLEAN bIsochronous
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD status Isochronous or not
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+ IsIsochronous - Show Isochronous or not
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetorClearTDControlIOC (
IN TD_STRUCT *ptrTDStruct,
IN BOOLEAN bSet
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD status IOC IsSet
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+ IsSet - Show IOC set or not
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDStatusActiveorInactive (
IN TD_STRUCT *ptrTDStruct,
IN BOOLEAN bActive
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD status active or not
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+ IsActive - Active or not
+
+Returns:
+
+ VOID
+
+--*/
+;
UINT16
SetTDTokenMaxLength (
IN TD_STRUCT *ptrTDStruct,
IN UINT16 nMaxLen
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Token maxlength
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+ MaximumLength - Maximum length of TD Token
+
+Returns:
+
+ Real maximum length set to TD Token
+
+--*/
+;
VOID
SetTDTokenDataToggle1 (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Token data toggle1
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDTokenDataToggle0 (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Token data toggle0
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ VOID
+
+--*/
+;
UINT8
GetTDTokenDataToggle (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Get TD Token data toggle
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ data toggle value
+
+--*/
+;
VOID
SetTDTokenEndPoint (
IN TD_STRUCT *ptrTDStruct,
IN UINTN nEndPoint
- );
+ )
+/*++
+
+Routine Description:
+
+ Set Data Token endpoint number
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+ EndPoint - End point number
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDTokenDeviceAddress (
IN TD_STRUCT *ptrTDStruct,
IN UINTN nDevAddr
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Token device address
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+ DeviceAddress - Device address
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDTokenPacketID (
IN TD_STRUCT *ptrTDStruct,
IN UINT8 nPID
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD Token packet ID
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+ PID - Packet ID
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetTDDataBuffer (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Set TD data buffer
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ VOID
+
+--*/
+;
BOOLEAN
IsTDStatusActive (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Indicate whether TD status active or not
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ TRUE - Active
+ FALSE - Inactive
+
+--*/
+;
BOOLEAN
IsTDStatusStalled (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Indicate whether TD status stalled or not
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ TRUE - Stalled
+ FALSE - not stalled
+
+--*/
+;
BOOLEAN
IsTDStatusBufferError (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Indicate whether TD status buffer error or not
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ TRUE - Buffer error
+ FALSE - No error
+
+--*/
+;
BOOLEAN
IsTDStatusBabbleError (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Indicate whether TD status babble error or not
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ TRUE - Babble error
+ FALSE - No error
+
+--*/
+;
BOOLEAN
IsTDStatusNAKReceived (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Indicate whether TD status NAK received
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ TRUE - NAK received
+ FALSE - NAK not received
+
+--*/
+;
BOOLEAN
IsTDStatusCRCTimeOutError (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Indicate whether TD status CRC timeout error or not
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ TRUE - CRC timeout error
+ FALSE - CRC timeout no error
+
+--*/
+;
BOOLEAN
IsTDStatusBitStuffError (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Indicate whether TD status bit stuff error or not
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ TRUE - Bit stuff error
+ FALSE - Bit stuff no error
+
+--*/
+;
UINT16
GetTDStatusActualLength (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Get TD status length
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ Return Td status length
+
+--*/
+;
UINT16
GetTDTokenMaxLength (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Get TD Token maximum length
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ Return TD token maximum length
+
+--*/
+;
UINT8
GetTDTokenEndPoint (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Get TD Token endpoint number
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ Return TD Token endpoint number
+
+--*/
+;
UINT8
GetTDTokenDeviceAddress (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Get TD Token device address
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ Return TD Token device address
+
+--*/
+;
UINT8
GetTDTokenPacketID (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Get TD Token packet ID
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ Return TD Token packet ID
-UINT8 *
+--*/
+;
+
+UINT8 *
GetTDDataBuffer (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Get the point to TD data buffer
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ Return a point to TD data buffer
+
+--*/
+;
BOOLEAN
GetTDLinkPtrValidorInvalid (
IN TD_STRUCT *ptrTDStruct
- );
+ )
+/*++
+
+Routine Description:
+
+ Get TD LinkPtr valid or not
+
+Arguments:
+
+ ptrTDStruct - A point to TD_STRUCT
+
+Returns:
+
+ TRUE - Invalid
+ FALSE - Valid
+
+--*/
+;
UINTN
CountTDsNumber (
IN TD_STRUCT *ptrFirstTD
- );
+ )
+/*++
+
+Routine Description:
+
+ Get the number of TDs
+
+Arguments:
+
+ PtrFirstTD - A point to the first TD_STRUCT
+
+Returns:
+
+ Return the number of TDs
+
+--*/
+;
VOID
LinkTDToQH (
IN QH_STRUCT *ptrQH,
IN TD_STRUCT *ptrTD
- );
+ )
+/*++
+
+Routine Description:
+
+ Link TD To QH
+
+Arguments:
+
+ PtrQH - QH_STRUCT
+ PtrTD - TD_STRUCT
+Returns:
+
+ VOID
+
+--*/
+;
VOID
LinkTDToTD (
IN TD_STRUCT *ptrPreTD,
IN TD_STRUCT *ptrTD
- );
+ )
+/*++
+
+Routine Description:
+
+ Link TD To TD
+
+Arguments:
+
+ ptrPreTD - Previous TD_STRUCT to be linked
+ PtrTD - TD_STRUCT to link
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetorClearCurFrameListTerminate (
IN FRAMELIST_ENTRY *pCurEntry,
IN BOOLEAN bSet
- );
+ )
+/*++
+
+Routine Description:
+
+ Set or clear current framelist terminate
+
+Arguments:
+
+ pCurEntry - A point to FRAMELIST_ENTITY
+ IsSet - TRUE to empty the frame and indicate the Pointer field is valid
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
SetCurFrameListQHorTD (
IN FRAMELIST_ENTRY *pCurEntry,
IN BOOLEAN bQH
- );
+ )
+/*++
+
+Routine Description:
+
+ Set current framelist QH or TD
+
+Arguments:
+
+ pCurEntry - A point to FRAMELIST_ENTITY
+ IsQH - TRUE to set QH and FALSE to set TD
+
+Returns:
+
+ VOID
+
+--*/
+;
BOOLEAN
GetCurFrameListTerminate (
IN FRAMELIST_ENTRY *pCurEntry
- );
+ )
+/*++
+
+Routine Description:
+
+ Get current framelist terminate
+
+Arguments:
+
+ pCurEntry - A point to FRAMELIST_ENTITY
+
+Returns:
+
+ TRUE - Terminate
+ FALSE - Not terminate
+
+--*/
+;
VOID
SetCurFrameListPointer (
IN FRAMELIST_ENTRY *pCurEntry,
IN UINT8 *ptr
- );
+ )
+/*++
-VOID *
+Routine Description:
+
+ Set current framelist pointer
+
+Arguments:
+
+ pCurEntry - A point to FRAMELIST_ENTITY
+ ptr - A point to FrameListPtr point to
+
+Returns:
+
+ VOID
+
+--*/
+;
+
+VOID *
GetCurFrameListPointer (
IN FRAMELIST_ENTRY *pCurEntry
- );
+ )
+/*++
+
+Routine Description:
+
+ Get current framelist pointer
+
+Arguments:
+
+ pCurEntry - A point to FRAMELIST_ENTITY
+
+Returns:
+
+ A point FrameListPtr point to
+
+--*/
+;
VOID
LinkQHToFrameList (
IN FRAMELIST_ENTRY *pEntry,
IN UINT16 FrameListIndex,
IN QH_STRUCT *ptrQH
- );
+ )
/*++
Routine Description:
@@ -864,14 +2037,7 @@ Returns: VOID
--*/
-VOID
-DeleteQHTDs (
- IN FRAMELIST_ENTRY *pEntry,
- IN QH_STRUCT *ptrQH,
- IN TD_STRUCT *ptrFirstTD,
- IN UINT16 FrameListIndex,
- IN BOOLEAN SearchOther
- );
+;
VOID
DelLinkSingleQH (
@@ -880,13 +2046,50 @@ DelLinkSingleQH ( IN UINT16 FrameListIndex,
IN BOOLEAN SearchOther,
IN BOOLEAN Delete
- );
+ )
+/*++
+
+Routine Description:
+
+ Unlink from frame list and delete single QH
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+ PtrQH - QH_STRUCT
+ FrameListIndex - Frame List Index
+ SearchOther - Search Other QH
+ Delete - TRUE is to delete the QH
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
DeleteQueuedTDs (
IN USB_HC_DEV *HcDev,
IN TD_STRUCT *ptrFirstTD
- );
+ )
+/*++
+
+Routine Description:
+
+ Delete Queued TDs
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+ PtrFirstTD - TD link list head
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
InsertQHTDToINTList (
@@ -902,10 +2105,12 @@ InsertQHTDToINTList ( IN UINT8 *DataBuffer,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
IN VOID *Context
- );
+ )
/*++
Routine Description:
+
Insert QH and TD To Interrupt List
+
Arguments:
HcDev - USB_HC_DEV
@@ -920,11 +2125,14 @@ Arguments: DataBuffer - Data buffer
CallBackFunction- CallBackFunction after interrupt transfeer
Context - CallBackFunction Context passed as function parameter
+
Returns:
+
EFI_SUCCESS - Sucess
EFI_INVALID_PARAMETER - Paremeter is error
--*/
+;
EFI_STATUS
DeleteAsyncINTQHTDs (
@@ -932,11 +2140,12 @@ DeleteAsyncINTQHTDs ( IN UINT8 DeviceAddress,
IN UINT8 EndPointAddress,
OUT UINT8 *DataToggle
- );
+ )
/*++
Routine Description:
Delete Async INT QH and TDs
+
Arguments:
HcDev - USB_HC_DEV
@@ -945,10 +2154,13 @@ Arguments: DataToggle - Data Toggle
Returns:
+
EFI_SUCCESS - Sucess
EFI_INVALID_PARAMETER - Paremeter is error
--*/
+;
+
BOOLEAN
CheckTDsResults (
IN TD_STRUCT *ptrTD,
@@ -956,7 +2168,7 @@ CheckTDsResults ( OUT UINT32 *Result,
OUT UINTN *ErrTDPos,
OUT UINTN *ActualTransferSize
- );
+ )
/*++
Routine Description:
@@ -977,6 +2189,8 @@ Returns: FALSE - Fail
--*/
+;
+
VOID
ExecuteAsyncINTTDs (
IN USB_HC_DEV *HcDev,
@@ -984,7 +2198,7 @@ ExecuteAsyncINTTDs ( OUT UINT32 *Result,
OUT UINTN *ErrTDPos,
OUT UINTN *ActualLen
- ) ;
+ )
/*++
Routine Description:
@@ -1004,12 +2218,14 @@ Returns: VOID
--*/
+;
+
VOID
UpdateAsyncINTQHTDs (
IN INTERRUPT_LIST *ptrList,
IN UINT32 Result,
IN UINT32 ErrTDPos
- );
+ )
/*++
Routine Description:
@@ -1027,16 +2243,19 @@ Returns: VOID
--*/
+;
+
VOID
ReleaseInterruptList (
IN USB_HC_DEV *HcDev,
IN LIST_ENTRY *ListHead
- );
+ )
/*++
Routine Description:
Release Interrupt List
+
Arguments:
HcDev - USB_HC_DEV
@@ -1047,6 +2266,8 @@ Returns: VOID
--*/
+;
+
EFI_STATUS
ExecuteControlTransfer (
IN USB_HC_DEV *HcDev,
@@ -1055,7 +2276,7 @@ ExecuteControlTransfer ( OUT UINTN *ActualLen,
IN UINTN TimeOut,
OUT UINT32 *TransferResult
- );
+ )
/*++
Routine Description:
@@ -1077,6 +2298,8 @@ Returns: --*/
+;
+
EFI_STATUS
ExecBulkorSyncInterruptTransfer (
IN USB_HC_DEV *HcDev,
@@ -1086,7 +2309,7 @@ ExecBulkorSyncInterruptTransfer ( OUT UINT8 *DataToggle,
IN UINTN TimeOut,
OUT UINT32 *TransferResult
- );
+ )
/*++
Routine Description:
@@ -1107,81 +2330,311 @@ Returns: EFI_SUCCESS - Sucess
EFI_DEVICE_ERROR - Error
--*/
+;
EFI_STATUS
InitializeMemoryManagement (
IN USB_HC_DEV *HcDev
- );
+ )
+/*++
+
+Routine Description:
+
+ Initialize Memory Management
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+
+Returns:
+
+ EFI_SUCCESS - Success
+
+--*/
+;
EFI_STATUS
CreateMemoryBlock (
IN USB_HC_DEV *HcDev,
IN MEMORY_MANAGE_HEADER **MemoryHeader,
IN UINTN MemoryBlockSizeInPages
- );
+ )
+/*++
+
+Routine Description:
+
+ Use PciIo->AllocateBuffer to allocate common buffer for the memory block,
+ and use PciIo->Map to map the common buffer for Bus Master Read/Write.
+
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+ MemoryHeader - MEMORY_MANAGE_HEADER to output
+ MemoryBlockSizeInPages - MemoryBlockSizeInPages
+
+Returns:
+
+ EFI_SUCCESS - Success
+ EFI_OUT_OF_RESOURCES - Out of resources
+ EFI_UNSUPPORTED - Unsupported
+
+--*/
+;
EFI_STATUS
FreeMemoryHeader (
IN USB_HC_DEV *HcDev,
IN MEMORY_MANAGE_HEADER *MemoryHeader
- );
+ )
+/*++
+
+Routine Description:
+
+ Free Memory Header
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+ MemoryHeader - MemoryHeader to be freed
+
+Returns:
+
+ EFI_INVALID_PARAMETER - Parameter is error
+ EFI_SUCCESS - Success
+
+--*/
+;
EFI_STATUS
UhciAllocatePool (
IN USB_HC_DEV *UhcDev,
IN UINT8 **Pool,
IN UINTN AllocSize
- );
+ )
+/*++
+
+Routine Description:
+
+ Uhci Allocate Pool
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+ Pool - Place to store pointer to the memory buffer
+ AllocSize - Alloc Size
+
+Returns:
+
+ EFI_SUCCESS - Success
+
+--*/
+;
VOID
UhciFreePool (
IN USB_HC_DEV *HcDev,
IN UINT8 *Pool,
IN UINTN AllocSize
- );
+ )
+/*++
+
+Routine Description:
+
+ Uhci Free Pool
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+ Pool - Pool to free
+ AllocSize - Pool size
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
InsertMemoryHeaderToList (
IN MEMORY_MANAGE_HEADER *MemoryHeader,
IN MEMORY_MANAGE_HEADER *NewMemoryHeader
- );
+ )
+/*++
+
+Routine Description:
+
+ Insert Memory Header To List
+
+Arguments:
+
+ MemoryHeader - MEMORY_MANAGE_HEADER
+ NewMemoryHeader - MEMORY_MANAGE_HEADER
+
+Returns:
+
+ VOID
+
+--*/
+;
EFI_STATUS
AllocMemInMemoryBlock (
IN MEMORY_MANAGE_HEADER *MemoryHeader,
IN VOID **Pool,
IN UINTN NumberOfMemoryUnit
- );
+ )
+/*++
+
+Routine Description:
+
+ Alloc Memory In MemoryBlock
+
+Arguments:
+
+ MemoryHeader - MEMORY_MANAGE_HEADER
+ Pool - Place to store pointer to memory
+ NumberOfMemoryUnit - Number Of Memory Unit
+
+Returns:
+
+ EFI_NOT_FOUND - Can't find the free memory
+ EFI_SUCCESS - Success
+
+--*/
+;
BOOLEAN
IsMemoryBlockEmptied (
IN MEMORY_MANAGE_HEADER *MemoryHeaderPtr
- );
+ )
+/*++
+
+/*++
+
+Routine Description:
+
+ Is Memory Block Emptied
+
+Arguments:
+
+ MemoryHeaderPtr - MEMORY_MANAGE_HEADER
+
+Returns:
+
+ TRUE - Empty
+ FALSE - Not Empty
+
+--*/
+;
VOID
DelinkMemoryBlock (
IN MEMORY_MANAGE_HEADER *FirstMemoryHeader,
IN MEMORY_MANAGE_HEADER *FreeMemoryHeader
- );
+ )
+/*++
+
+Routine Description:
+
+ Delink Memory Block
+
+Arguments:
+
+ FirstMemoryHeader - MEMORY_MANAGE_HEADER
+ NeedFreeMemoryHeader - MEMORY_MANAGE_HEADER
+
+Returns:
+
+ VOID
+
+--*/
+;
EFI_STATUS
DelMemoryManagement (
IN USB_HC_DEV *HcDev
- );
+ )
+/*++
+
+Routine Description:
+
+ Delete Memory Management
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+
+Returns:
+
+ EFI_SUCCESS - Success
+
+--*/
+;
VOID
EnableMaxPacketSize (
IN USB_HC_DEV *HcDev
- );
+ )
+/*++
+
+Routine Description:
+
+ Enable Max Packet Size
+
+Arguments:
+
+ HcDev - USB_HC_DEV
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
CleanUsbTransactions (
IN USB_HC_DEV *HcDev
- );
+ )
+/*++
+
+Routine Description:
+
+ Clean USB Transactions
+
+Arguments:
+
+ HcDev - A point to USB_HC_DEV
+
+Returns:
+
+ VOID
+
+--*/
+;
VOID
TurnOffUSBEmulation (
IN EFI_PCI_IO_PROTOCOL *PciIo
- );
+ )
+/*++
+
+Routine Description:
+
+ Set current framelist QH or TD
+
+Arguments:
+
+ pCurEntry - A point to FRAMELIST_ENTITY
+ IsQH - TRUE to set QH and FALSE to set TD
+
+Returns:
+
+ VOID
+
+--*/
+;
#endif
|