TianoCore EDK2 master
Loading...
Searching...
No Matches
EhciReg.h
Go to the documentation of this file.
1
10#ifndef _EFI_EHCI_REG_H_
11#define _EFI_EHCI_REG_H_
12
13//
14// Capability register offset
15//
16#define EHC_CAPLENGTH_OFFSET 0 // Capability register length offset
17#define EHC_HCSPARAMS_OFFSET 0x04 // Structural Parameters 04-07h
18#define EHC_HCCPARAMS_OFFSET 0x08 // Capability parameters offset
19
20//
21// Capability register bit definition
22//
23#define HCSP_NPORTS 0x0F // Number of root hub port
24#define HCCP_64BIT 0x01 // 64-bit addressing capability
25
26//
27// Operational register offset
28//
29#define EHC_USBCMD_OFFSET 0x0 // USB command register offset
30#define EHC_USBSTS_OFFSET 0x04 // Statue register offset
31#define EHC_USBINTR_OFFSET 0x08 // USB interrutp offset
32#define EHC_FRINDEX_OFFSET 0x0C // Frame index offset
33#define EHC_CTRLDSSEG_OFFSET 0x10 // Control data structure segment offset
34#define EHC_FRAME_BASE_OFFSET 0x14 // Frame list base address offset
35#define EHC_ASYNC_HEAD_OFFSET 0x18 // Next asynchronous list address offset
36#define EHC_CONFIG_FLAG_OFFSET 0x40 // Configure flag register offset
37#define EHC_PORT_STAT_OFFSET 0x44 // Port status/control offset
38
39#define EHC_FRAME_LEN 1024
40
41//
42// Register bit definition
43//
44#define CONFIGFLAG_ROUTE_EHC 0x01 // Route port to EHC
45
46#define USBCMD_RUN 0x01 // Run/stop
47#define USBCMD_RESET 0x02 // Start the host controller reset
48#define USBCMD_ENABLE_PERIOD 0x10 // Enable periodic schedule
49#define USBCMD_ENABLE_ASYNC 0x20 // Enable asynchronous schedule
50#define USBCMD_IAAD 0x40 // Interrupt on async advance doorbell
51
52#define USBSTS_IAA 0x20 // Interrupt on async advance
53#define USBSTS_PERIOD_ENABLED 0x4000 // Periodic schedule status
54#define USBSTS_ASYNC_ENABLED 0x8000 // Asynchronous schedule status
55#define USBSTS_HALT 0x1000 // Host controller halted
56#define USBSTS_SYS_ERROR 0x10 // Host system error
57#define USBSTS_INTACK_MASK 0x003F // Mask for the interrupt ACK, the WC
58 // (write clean) bits in USBSTS register
59
60#define PORTSC_CONN 0x01 // Current Connect Status
61#define PORTSC_CONN_CHANGE 0x02 // Connect Status Change
62#define PORTSC_ENABLED 0x04 // Port Enable / Disable
63#define PORTSC_ENABLE_CHANGE 0x08 // Port Enable / Disable Change
64#define PORTSC_OVERCUR 0x10 // Over current Active
65#define PORTSC_OVERCUR_CHANGE 0x20 // Over current Change
66#define PORSTSC_RESUME 0x40 // Force Port Resume
67#define PORTSC_SUSPEND 0x80 // Port Suspend State
68#define PORTSC_RESET 0x100 // Port Reset
69#define PORTSC_LINESTATE_K 0x400 // Line Status K-state
70#define PORTSC_LINESTATE_J 0x800 // Line Status J-state
71#define PORTSC_POWER 0x1000 // Port Power
72#define PORTSC_OWNER 0x2000 // Port Owner
73#define PORTSC_CHANGE_MASK 0x2A // Mask of the port change bits,
74 // they are WC (write clean)
75//
76// PCI Configuration Registers
77//
78#define EHC_BAR_INDEX 0 // how many bytes away from USB_BASE to 0x10
79
80#define EHC_LINK_TERMINATED(Link) (((Link) & 0x01) != 0)
81
82#define EHC_ADDR(High, QhHw32) \
83 ((VOID *) (UINTN) (LShiftU64 ((High), 32) | ((QhHw32) & 0xFFFFFFF0)))
84
85#define EHCI_IS_DATAIN(EndpointAddr) EHC_BIT_IS_SET((EndpointAddr), 0x80)
86
87//
88// Structure to map the hardware port states to the
89// UEFI's port states.
90//
91typedef struct {
92 UINT16 HwState;
93 UINT16 UefiState;
95
96//
97// Ehci Data and Ctrl Structures
98//
99#pragma pack(1)
100typedef struct {
101 UINT8 Pi;
102 UINT8 SubClassCode;
103 UINT8 BaseCode;
104} USB_CLASSC;
105#pragma pack()
106
116UINT32
118 IN PEI_USB2_HC_DEV *Ehc,
119 IN UINT32 Offset
120 )
121;
122
132UINT32
134 IN PEI_USB2_HC_DEV *Ehc,
135 IN UINT32 Offset
136 )
137;
138
147VOID
149 IN PEI_USB2_HC_DEV *Ehc,
150 IN UINT32 Offset,
151 IN UINT32 Data
152 )
153;
154
161VOID
164 )
165;
166
180 IN PEI_USB2_HC_DEV *Ehc,
181 IN UINT32 Timeout
182 )
183;
184
192VOID
195 )
196;
197
207BOOLEAN
208EhcIsHalt (
210 )
211;
212
222BOOLEAN
225 )
226;
227
240 IN PEI_USB2_HC_DEV *Ehc,
241 IN UINT32 Timeout
242 )
243;
244
256EhcHaltHC (
257 IN PEI_USB2_HC_DEV *Ehc,
258 IN UINT32 Timeout
259 )
260;
261
273EhcRunHC (
274 IN PEI_USB2_HC_DEV *Ehc,
275 IN UINT32 Timeout
276 )
277;
278
295EhcInitHC (
297 )
298;
299
300#endif
EFI_STATUS EhcResetHC(IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
Definition: EhciReg.c:477
VOID EhcWriteOpReg(IN USB2_HC_DEV *Ehc, IN UINT32 Offset, IN UINT32 Data)
Definition: EhciReg.c:183
EFI_STATUS EhcInitHC(IN USB2_HC_DEV *Ehc)
Definition: EhciReg.c:562
EFI_STATUS EhcSetAndWaitDoorBell(IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
Definition: EhciReg.c:343
BOOLEAN EhcIsHalt(IN USB2_HC_DEV *Ehc)
Definition: EhciReg.c:442
EFI_STATUS EhcHaltHC(IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
Definition: EhciReg.c:511
VOID EhcClearLegacySupport(IN USB2_HC_DEV *Ehc)
Definition: EhciReg.c:295
UINT32 EhcReadCapRegister(IN USB2_HC_DEV *Ehc, IN UINT32 Offset)
Definition: EhciReg.c:23
BOOLEAN EhcIsSysError(IN USB2_HC_DEV *Ehc)
Definition: EhciReg.c:459
EFI_STATUS EhcRunHC(IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
Definition: EhciReg.c:534
UINT32 EhcReadOpReg(IN USB2_HC_DEV *Ehc, IN UINT32 Offset)
Definition: EhciReg.c:147
VOID EhcAckAllInterrupt(IN USB2_HC_DEV *Ehc)
Definition: EhciReg.c:376
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29