summaryrefslogtreecommitdiff
path: root/src/console
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2013-07-06 11:56:49 +0300
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-07-10 23:23:55 +0200
commit9e7806a788f9617d3dd9139a74ab3f7b03eb9581 (patch)
tree8d85d5ba21a8f3870335a0fe36b65e37a3f8c7c9 /src/console
parent4d409b5fc27e44f7c902f8402f661db56d62ac74 (diff)
usbdebug: Move ehci_debug_info allocation
Move ehci_debug_info allocation from console to lib, as console code was only built for ramstage. Implement dbgp_ehci_info() to return the EHCI context. Alread alias this as dbgp_console_input() and _output() to return the console stream context later on. Change-Id: Id6cc07d62953f0466df61eeb159e22b0e3287d4e Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/3625 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/console')
-rw-r--r--src/console/console.c3
-rw-r--r--src/console/usbdebug_console.c32
2 files changed, 16 insertions, 19 deletions
diff --git a/src/console/console.c b/src/console/console.c
index a0e8f6dbf9..6ebcd8b414 100644
--- a/src/console/console.c
+++ b/src/console/console.c
@@ -105,8 +105,7 @@ void console_init(void)
!defined(__BOOT_BLOCK__) && CONFIG_EARLY_CONSOLE
#if CONFIG_USBDEBUG
- enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
- early_usbdebug_init();
+ usbdebug_init();
#endif
#if CONFIG_CONSOLE_SERIAL
uart_init();
diff --git a/src/console/usbdebug_console.c b/src/console/usbdebug_console.c
index d6747792fe..7b5dcc05c7 100644
--- a/src/console/usbdebug_console.c
+++ b/src/console/usbdebug_console.c
@@ -24,27 +24,28 @@
#include <device/pci.h>
#include <pc80/mc146818rtc.h>
-static struct ehci_debug_info dbg_info;
static struct device_operations *ehci_drv_ops;
static struct device_operations ehci_dbg_ops;
static void usbdebug_re_enable(unsigned ehci_base)
{
+ struct ehci_debug_info *dbg_info = dbgp_ehci_info();
unsigned diff;
- if (!dbg_info.ehci_debug)
+ if (!dbg_info->ehci_debug)
return;
- diff = (unsigned)dbg_info.ehci_caps - ehci_base;
- dbg_info.ehci_regs -= diff;
- dbg_info.ehci_debug -= diff;
- dbg_info.ehci_caps = (void*)ehci_base;
- dbg_info.status |= DBGP_EP_ENABLED;
+ diff = (unsigned)dbg_info->ehci_caps - ehci_base;
+ dbg_info->ehci_regs -= diff;
+ dbg_info->ehci_debug -= diff;
+ dbg_info->ehci_caps = (void*)ehci_base;
+ dbg_info->status |= DBGP_EP_ENABLED;
}
static void usbdebug_disable(void)
{
- dbg_info.status &= ~DBGP_EP_ENABLED;
+ struct ehci_debug_info *dbg_info = dbgp_ehci_info();
+ dbg_info->status &= ~DBGP_EP_ENABLED;
}
static void pci_ehci_set_resources(struct device *dev)
@@ -82,35 +83,32 @@ void pci_ehci_read_resources(struct device *dev)
static void dbgp_init(void)
{
-#if !CONFIG_EARLY_CONSOLE
- enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
-#endif
- usbdebug_init(CONFIG_EHCI_BAR, CONFIG_EHCI_DEBUG_OFFSET, &dbg_info);
+ usbdebug_init();
}
static void dbgp_tx_byte(unsigned char data)
{
- usbdebug_tx_byte(&dbg_info, data);
+ usbdebug_tx_byte(dbgp_console_output(), data);
}
static unsigned char dbgp_rx_byte(void)
{
unsigned char data = 0xff;
- if (dbgp_ep_is_active(&dbg_info))
- dbgp_bulk_read_x(&dbg_info, &data, 1);
+ if (dbgp_ep_is_active(dbgp_console_input()))
+ dbgp_bulk_read_x(dbgp_console_input(), &data, 1);
return data;
}
static void dbgp_tx_flush(void)
{
- usbdebug_tx_flush(&dbg_info);
+ usbdebug_tx_flush(dbgp_console_output());
}
static int dbgp_tst_byte(void)
{
- return dbgp_ep_is_active(&dbgp_info);
+ return dbgp_ep_is_active(dbgp_console_input());
}
static const struct console_driver usbdebug_direct_console __console = {