aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorSven Schnelle <svens@stackframe.org>2012-07-26 14:31:40 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2012-07-26 15:52:00 +0200
commit82704c63b98202fe2a24032697369cd190202d3f (patch)
treee1893f92423bd4e4c111fb57fe54429327dbf9cb /src/lib
parent0b7b7b6334de592b82d36ee47bc25b1b72043681 (diff)
USBDEBUG: buffer up to 8 bytes
EHCI debug allows to send message with 8 bytes length, but we're only sending one byte in each transaction. Buffer up to 8 bytes to speed up debug output. Change-Id: I9dbb406833c4966c3afbd610e1b13a8fa3d62f39 Signed-off-by: Sven Schnelle <svens@stackframe.org> Reviewed-on: http://review.coreboot.org/1357 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber <nico.huber@secunet.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/usbdebug.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c
index 800ee52ae3..fd234260c2 100644
--- a/src/lib/usbdebug.c
+++ b/src/lib/usbdebug.c
@@ -377,7 +377,7 @@ int usbdebug_init(unsigned ehci_bar, unsigned offset, struct ehci_debug_info *in
HC_LENGTH(read32((unsigned long)&ehci_caps->hc_capbase)));
ehci_debug = (struct ehci_dbg_port *)(ehci_bar + offset);
info->ehci_debug = (void *)0;
-
+ info->bufidx = 0;
try_next_time:
port_map_tried = 0;
@@ -573,15 +573,34 @@ int early_usbdebug_init(void)
return usbdebug_init(CONFIG_EHCI_BAR, CONFIG_EHCI_DEBUG_OFFSET, dbg_info);
}
-void usbdebug_tx_byte(unsigned char data)
+void usbdebug_tx_byte(struct ehci_debug_info *dbg_info, unsigned char data)
{
- struct ehci_debug_info *dbg_info;
- /* "Find" dbg_info structure in Cache */
- dbg_info = (struct ehci_debug_info *)
- (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
+ if (!dbg_info) {
+ /* "Find" dbg_info structure in Cache */
+ dbg_info = (struct ehci_debug_info *)
+ (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
+ }
if (dbg_info->ehci_debug) {
- dbgp_bulk_write_x(dbg_info, (char*)&data, 1);
+ dbg_info->buf[dbg_info->bufidx++] = data;
+ if (dbg_info->bufidx >= 8) {
+ dbgp_bulk_write_x(dbg_info, dbg_info->buf, dbg_info->bufidx);
+ dbg_info->bufidx = 0;
+ }
+ }
+}
+
+void usbdebug_tx_flush(struct ehci_debug_info *dbg_info)
+{
+ if (!dbg_info) {
+ /* "Find" dbg_info structure in Cache */
+ dbg_info = (struct ehci_debug_info *)
+ (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
+ }
+
+ if (dbg_info->ehci_debug && dbg_info->bufidx > 0) {
+ dbgp_bulk_write_x(dbg_info, dbg_info->buf, dbg_info->bufidx);
+ dbg_info->bufidx = 0;
}
}