blob: 926d6585d035cb7448b7c80ec1bb98e08f0be5fa [file] [log] [blame]
Stefan Reinauerbb01f602009-07-21 21:20:45 +00001/*
2 * This file is part of the coreboot project.
3 *
Uwe Hermann06694a82010-09-23 18:16:46 +00004 * Copyright (C) 2007 AMD
5 * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
6 *
Stefan Reinauerbb01f602009-07-21 21:20:45 +00007 * 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
Stefan Reinauer56394482010-05-25 16:02:28 +000021#ifndef USBDEBUG_H
22#define USBDEBUG_H
Yinghai Lud57241f2007-02-28 11:17:02 +000023
Kyösti Mälkkifb387df2013-06-07 22:16:52 +030024#define EHCI_BAR_INDEX 0x10
Kyösti Mälkki8101aa62013-08-15 16:27:06 +030025#define PCI_EHCI_CLASSCODE 0x0c0320 /* USB2.0 with EHCI controller */
26
27typedef u32 pci_devfn_t;
28pci_devfn_t pci_ehci_dbg_dev(unsigned hcd_idx);
29unsigned long pci_ehci_base_regs(pci_devfn_t dev);
30void pci_ehci_dbg_set_port(pci_devfn_t dev, unsigned int port);
31void pci_ehci_dbg_enable(pci_devfn_t dev, unsigned long base);
Kyösti Mälkkifb387df2013-06-07 22:16:52 +030032
33#ifndef __PRE_RAM__
34#if !CONFIG_USBDEBUG
35#define pci_ehci_read_resources pci_dev_read_resources
36#else
37/* Relocation of EHCI Debug Port BAR
38 *
39 * PCI EHCI controller with Debug Port capability shall replace
40 * pci_dev_read_resources() with pci_ehci_read_resources() in its
41 * declaration of device_operations for .read_resources.
42 * This installs a hook to reconfigure usbdebug when resource allocator
43 * assigns a new BAR for the device.
44 */
45struct device;
46void pci_ehci_read_resources(struct device *dev);
47#endif
48#endif
Myles Watson127e9762010-08-04 19:29:11 +000049
Kyösti Mälkki026ff3e2013-07-08 18:11:44 +030050struct dbgp_pipe;
Kyösti Mälkki4d409b52013-07-05 21:38:54 +030051
Kyösti Mälkki9e7806a2013-07-06 11:56:49 +030052int usbdebug_init(void);
Kyösti Mälkki026ff3e2013-07-08 18:11:44 +030053
54struct dbgp_pipe *dbgp_console_output(void);
55struct dbgp_pipe *dbgp_console_input(void);
56int dbgp_ep_is_active(struct dbgp_pipe *pipe);
57int dbgp_bulk_write_x(struct dbgp_pipe *pipe, const char *bytes, int size);
58int dbgp_bulk_read_x(struct dbgp_pipe *pipe, void *data, int size);
59void usbdebug_tx_byte(struct dbgp_pipe *pipe, unsigned char data);
60void usbdebug_tx_flush(struct dbgp_pipe *pipe);
Sven Schnelle20fc6312011-10-30 09:57:35 +010061#endif