acpi: Add IORT helper functions
[coreboot2.git] / src / drivers / usb / ehci_debug.h
blob26133861c84ff02e7dbab8dd3dfba76090b0f590
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef _EHCI_DEBUG_H_
4 #define _EHCI_DEBUG_H_
6 #include <types.h>
8 void usbdebug_re_enable(uintptr_t ehci_base);
9 void usbdebug_disable(void);
11 /* Returns 0 on success and sets MMIO base and dbg_offset if EHCI debug
12 * capability was found and enabled. Returns non-zero on error.
14 int ehci_debug_hw_enable(unsigned int *base, unsigned int *dbg_offset);
15 void ehci_debug_select_port(unsigned int port);
17 #define DBGP_EP_VALID (1<<0)
18 #define DBGP_EP_ENABLED (1<<1)
19 #define DBGP_EP_BUSY (1<<2)
20 #define DBGP_EP_NOT_PRESENT (1<<3)
21 #define DBGP_EP_STATMASK (DBGP_EP_VALID | DBGP_EP_ENABLED)
23 #define DBGP_MAX_ENDPOINTS 4
24 #define DBGP_SETUP_EP0 0 /* Compulsory endpoint 0. */
25 #define DBGP_CONSOLE_EPOUT 1
26 #define DBGP_CONSOLE_EPIN 2
28 struct ehci_dbg_port;
30 struct dbgp_pipe
32 u8 devnum;
33 u8 endpoint;
34 u8 pid;
35 u8 status;
36 u16 timeout;
38 u8 bufidx;
39 u8 buflen;
40 char buf[8];
41 } __packed;
43 void dbgp_put(struct dbgp_pipe *pipe);
44 int dbgp_try_get(struct dbgp_pipe *pipe);
46 struct dbgp_pipe *dbgp_console_output(void);
47 struct dbgp_pipe *dbgp_console_input(void);
48 int dbgp_ep_is_active(struct dbgp_pipe *pipe);
49 int dbgp_bulk_write_x(struct dbgp_pipe *pipe, const char *bytes, int size);
50 int dbgp_bulk_read_x(struct dbgp_pipe *pipe, void *data, int size);
52 int dbgp_control_msg(struct ehci_dbg_port *ehci_debug, unsigned int devnum,
53 int requesttype, int request, int value, int index, void *data, int size);
54 void dbgp_mdelay(int ms);
56 int dbgp_probe_gadget(struct ehci_dbg_port *ehci_debug, struct dbgp_pipe *pipe);
58 #endif /* _EHCI_DEBUG_H_ */