TianoCore EDK2 master
Loading...
Searching...
No Matches
UhciReg.h
Go to the documentation of this file.
1
10#ifndef _EFI_UHCI_REG_H_
11#define _EFI_UHCI_REG_H_
12
13//
14// UHCI register offset
15//
16
17#define UHCI_FRAME_NUM 1024
18
19//
20// Register offset and PCI related staff
21//
22#define USB_BAR_INDEX 4
23
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
31
32//
33// Packet IDs
34//
35#define SETUP_PACKET_ID 0x2D
36#define INPUT_PACKET_ID 0x69
37#define OUTPUT_PACKET_ID 0xE1
38#define ERROR_PACKET_ID 0x55
39
40//
41// USB port status and control bit definition.
42//
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
53
54//
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.
58//
59#define USB_MAX_ROOTHUB_PORT 0x0F
60
61//
62// Command register bit definitions
63//
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)
72
73//
74// USB Status register bit definitions
75//
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
82
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
90
100UINT16
102 IN EFI_PCI_IO_PROTOCOL *PciIo,
103 IN UINT32 Offset
104 );
105
116VOID
118 IN EFI_PCI_IO_PROTOCOL *PciIo,
119 IN UINT32 Offset,
120 IN UINT16 Data
121 );
122
133VOID
135 IN EFI_PCI_IO_PROTOCOL *PciIo,
136 IN UINT32 Offset,
137 IN UINT16 Bit
138 );
139
150VOID
152 IN EFI_PCI_IO_PROTOCOL *PciIo,
153 IN UINT32 Offset,
154 IN UINT16 Bit
155 );
156
166VOID
168 IN USB_HC_DEV *Uhc
169 );
170
183 IN USB_HC_DEV *Uhc,
184 IN UINTN Timeout
185 );
186
196BOOLEAN
199 );
200
211VOID
213 IN EFI_PCI_IO_PROTOCOL *PciIo,
214 IN VOID *Addr
215 );
216
225VOID
228 );
229
230#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
BOOLEAN UhciIsHcWorking(IN EFI_PCI_IO_PROTOCOL *PciIo)
Definition: UhciReg.c:195
EFI_STATUS UhciStopHc(IN USB_HC_DEV *Uhc, IN UINTN Timeout)
Definition: UhciReg.c:158
VOID UhciClearRegBit(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset, IN UINT16 Bit)
Definition: UhciReg.c:110
VOID UhciTurnOffUsbEmulation(IN EFI_PCI_IO_PROTOCOL *PciIo)
Definition: UhciReg.c:251
VOID UhciWriteReg(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset, IN UINT16 Data)
Definition: UhciReg.c:57
VOID UhciSetRegBit(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset, IN UINT16 Bit)
Definition: UhciReg.c:88
VOID UhciSetFrameListBaseAddr(IN EFI_PCI_IO_PROTOCOL *PciIo, IN VOID *Addr)
Definition: UhciReg.c:220
UINT16 UhciReadReg(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset)
Definition: UhciReg.c:22
VOID UhciAckAllInterrupt(IN USB_HC_DEV *Uhc)
Definition: UhciReg.c:131