]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.h
3 The definition for UHCI register operation routines.
5 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _EFI_UHCI_REG_H_
11 #define _EFI_UHCI_REG_H_
14 // UHCI register offset
17 #define UHCI_FRAME_NUM 1024
20 // Register offset and PCI related staff
22 #define USB_BAR_INDEX 4
24 #define USBCMD_OFFSET 0
25 #define USBSTS_OFFSET 2
26 #define USBINTR_OFFSET 4
27 #define USBPORTSC_OFFSET 0x10
28 #define USB_FRAME_NO_OFFSET 6
29 #define USB_FRAME_BASE_OFFSET 8
30 #define USB_EMULATION_OFFSET 0xC0
35 #define SETUP_PACKET_ID 0x2D
36 #define INPUT_PACKET_ID 0x69
37 #define OUTPUT_PACKET_ID 0xE1
38 #define ERROR_PACKET_ID 0x55
41 // USB port status and control bit definition.
43 #define USBPORTSC_CCS BIT0 // Current Connect Status
44 #define USBPORTSC_CSC BIT1 // Connect Status Change
45 #define USBPORTSC_PED BIT2 // Port Enable / Disable
46 #define USBPORTSC_PEDC BIT3 // Port Enable / Disable Change
47 #define USBPORTSC_LSL BIT4 // Line Status Low BIT
48 #define USBPORTSC_LSH BIT5 // Line Status High BIT
49 #define USBPORTSC_RD BIT6 // Resume Detect
50 #define USBPORTSC_LSDA BIT8 // Low Speed Device Attached
51 #define USBPORTSC_PR BIT9 // Port Reset
52 #define USBPORTSC_SUSP BIT12 // Suspend
55 // UHCI Spec said it must implement 2 ports each host at least,
56 // and if more, check whether the bit7 of PORTSC is always 1.
57 // So here assume the max of port number each host is 16.
59 #define USB_MAX_ROOTHUB_PORT 0x0F
62 // Command register bit definitions
64 #define USBCMD_RS BIT0 // Run/Stop
65 #define USBCMD_HCRESET BIT1 // Host reset
66 #define USBCMD_GRESET BIT2 // Global reset
67 #define USBCMD_EGSM BIT3 // Global Suspend Mode
68 #define USBCMD_FGR BIT4 // Force Global Resume
69 #define USBCMD_SWDBG BIT5 // SW Debug mode
70 #define USBCMD_CF BIT6 // Config Flag (sw only)
71 #define USBCMD_MAXP BIT7 // Max Packet (0 = 32, 1 = 64)
74 // USB Status register bit definitions
76 #define USBSTS_USBINT BIT0 // Interrupt due to IOC
77 #define USBSTS_ERROR BIT1 // Interrupt due to error
78 #define USBSTS_RD BIT2 // Resume Detect
79 #define USBSTS_HSE BIT3 // Host System Error
80 #define USBSTS_HCPE BIT4 // Host Controller Process Error
81 #define USBSTS_HCH BIT5 // HC Halted
83 #define USBTD_ACTIVE BIT7 // TD is still active
84 #define USBTD_STALLED BIT6 // TD is stalled
85 #define USBTD_BUFFERR BIT5 // Buffer underflow or overflow
86 #define USBTD_BABBLE BIT4 // Babble condition
87 #define USBTD_NAK BIT3 // NAK is received
88 #define USBTD_CRC BIT2 // CRC/Time out error
89 #define USBTD_BITSTUFF BIT1 // Bit stuff error
95 @param PciIo The EFI_PCI_IO_PROTOCOL to use.
96 @param Offset Register offset to USB_BAR_INDEX.
98 @return Content of register.
103 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
110 Write data to UHCI register.
112 @param PciIo The EFI_PCI_IO_PROTOCOL to use.
113 @param Offset Register offset to USB_BAR_INDEX.
114 @param Data Data to write.
121 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
129 Set a bit of the UHCI Register.
131 @param PciIo The EFI_PCI_IO_PROTOCOL to use.
132 @param Offset Register offset to USB_BAR_INDEX.
133 @param Bit The bit to set.
140 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
148 Clear a bit of the UHCI Register.
150 @param PciIo The PCI_IO protocol to access the PCI.
151 @param Offset Register offset to USB_BAR_INDEX.
152 @param Bit The bit to clear.
159 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
166 Clear all the interrutp status bits, these bits
169 @param Uhc The UHCI device.
175 UhciAckAllInterrupt (
181 Stop the host controller.
183 @param Uhc The UHCI device.
184 @param Timeout Max time allowed.
186 @retval EFI_SUCCESS The host controller is stopped.
187 @retval EFI_TIMEOUT Failed to stop the host controller.
199 Check whether the host controller operates well.
201 @param PciIo The PCI_IO protocol to use.
203 @retval TRUE Host controller is working.
204 @retval FALSE Host controller is halted or system error.
209 IN EFI_PCI_IO_PROTOCOL
*PciIo
214 Set the UHCI frame list base address. It can't use
215 UhciWriteReg which access memory in UINT16.
217 @param PciIo The EFI_PCI_IO_PROTOCOL to use.
218 @param Addr Address to set.
224 UhciSetFrameListBaseAddr (
225 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
231 Disable USB Emulation.
233 @param PciIo The EFI_PCI_IO_PROTOCOL protocol to use.
239 UhciTurnOffUsbEmulation (
240 IN EFI_PCI_IO_PROTOCOL
*PciIo