Kyösti Mälkki | cb141bc | 2014-02-07 19:24:23 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007 AMD |
| 5 | * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #ifndef _EHCI_DEBUG_H_ |
| 22 | #define _EHCI_DEBUG_H_ |
| 23 | |
Kyösti Mälkki | ea6736a | 2014-02-10 00:00:44 +0200 | [diff] [blame] | 24 | #include <types.h> |
| 25 | |
Kyösti Mälkki | cb141bc | 2014-02-07 19:24:23 +0200 | [diff] [blame] | 26 | void usbdebug_re_enable(unsigned ehci_base); |
| 27 | void usbdebug_disable(void); |
| 28 | |
Kyösti Mälkki | 6f6a249 | 2014-02-09 19:21:30 +0200 | [diff] [blame] | 29 | /* Returns 0 on success and sets MMIO base and dbg_offset if EHCI debug |
| 30 | * capability was found and enabled. Returns non-zero on error. |
| 31 | */ |
| 32 | int ehci_debug_hw_enable(unsigned *base, unsigned *dbg_offset); |
Kyösti Mälkki | cb141bc | 2014-02-07 19:24:23 +0200 | [diff] [blame] | 33 | void ehci_debug_select_port(unsigned int port); |
| 34 | |
Kyösti Mälkki | 8cde852 | 2014-02-09 23:35:39 +0200 | [diff] [blame] | 35 | #define DBGP_EP_VALID (1<<0) |
| 36 | #define DBGP_EP_ENABLED (1<<1) |
| 37 | #define DBGP_EP_BUSY (1<<2) |
| 38 | #define DBGP_EP_STATMASK (DBGP_EP_VALID | DBGP_EP_ENABLED) |
| 39 | |
| 40 | struct dbgp_pipe |
| 41 | { |
| 42 | u8 devnum; |
| 43 | u8 endpoint; |
| 44 | u8 pid; |
| 45 | u8 status; |
| 46 | int timeout; |
| 47 | |
| 48 | u8 bufidx; |
| 49 | u8 buflen; |
| 50 | char buf[8]; |
| 51 | }; |
| 52 | |
| 53 | void dbgp_put(struct dbgp_pipe *pipe); |
| 54 | int dbgp_try_get(struct dbgp_pipe *pipe); |
| 55 | |
Kyösti Mälkki | ea6736a | 2014-02-10 00:00:44 +0200 | [diff] [blame] | 56 | struct dbgp_pipe *dbgp_console_output(void); |
| 57 | struct dbgp_pipe *dbgp_console_input(void); |
| 58 | int dbgp_ep_is_active(struct dbgp_pipe *pipe); |
| 59 | int dbgp_bulk_write_x(struct dbgp_pipe *pipe, const char *bytes, int size); |
| 60 | int dbgp_bulk_read_x(struct dbgp_pipe *pipe, void *data, int size); |
| 61 | |
Kyösti Mälkki | cb141bc | 2014-02-07 19:24:23 +0200 | [diff] [blame] | 62 | #endif /* _EHCI_DEBUG_H_ */ |