[coreboot-gerrit] Patch set updated for coreboot: 3b478e3 usbdebug: Improve receive speed
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Wed Feb 5 14:03:01 CET 2014
Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4700
-gerrit
commit 3b478e396bd2bd9f9d7f2bcf35159c8e10f45977
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Wed Jan 15 22:26:03 2014 +0200
usbdebug: Improve receive speed
Read from USB endpoint_in 8 bytes at a time, the maximum what
EHCI debug port capability has to offer.
Change-Id: I3d012d758a24b24f894e587b301f620933331407
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
src/console/usbdebug_console.c | 7 +------
src/drivers/usb/ehci_debug.c | 18 ++++++++++++++++++
src/include/console/usb.h | 1 +
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/console/usbdebug_console.c b/src/console/usbdebug_console.c
index 99726be..cb627bb 100644
--- a/src/console/usbdebug_console.c
+++ b/src/console/usbdebug_console.c
@@ -34,12 +34,7 @@ static void dbgp_tx_byte(unsigned char data)
static unsigned char dbgp_rx_byte(void)
{
- unsigned char data = 0xff;
-
- if (dbgp_ep_is_active(dbgp_console_input()))
- dbgp_bulk_read_x(dbgp_console_input(), &data, 1);
-
- return data;
+ return usbdebug_rx_byte(dbgp_console_input());
}
static void dbgp_tx_flush(void)
diff --git a/src/drivers/usb/ehci_debug.c b/src/drivers/usb/ehci_debug.c
index 94625c0..b28208d 100644
--- a/src/drivers/usb/ehci_debug.c
+++ b/src/drivers/usb/ehci_debug.c
@@ -48,6 +48,7 @@ struct dbgp_pipe
int timeout;
u8 bufidx;
+ u8 buflen;
char buf[8];
};
@@ -912,6 +913,23 @@ void usbdebug_tx_flush(struct dbgp_pipe *pipe)
dbgp_put(pipe);
}
+unsigned char usbdebug_rx_byte(struct dbgp_pipe *pipe)
+{
+ unsigned char data = 0xff;
+ if (!dbgp_try_get(pipe))
+ return 0xff;
+ while (pipe->bufidx >= pipe->buflen) {
+ pipe->buflen = 0;
+ pipe->bufidx = 0;
+ int count = dbgp_bulk_read_x(pipe, pipe->buf, 8);
+ if (count>0)
+ pipe->buflen = count;
+ }
+ data = pipe->buf[pipe->bufidx++];
+ dbgp_put(pipe);
+ return data;
+}
+
#if !defined(__PRE_RAM__) && !defined(__SMM__)
static void usbdebug_re_enable(unsigned ehci_base)
{
diff --git a/src/include/console/usb.h b/src/include/console/usb.h
index 47f3d74..430557f 100644
--- a/src/include/console/usb.h
+++ b/src/include/console/usb.h
@@ -32,5 +32,6 @@ int dbgp_bulk_write_x(struct dbgp_pipe *pipe, const char *bytes, int size);
int dbgp_bulk_read_x(struct dbgp_pipe *pipe, void *data, int size);
void usbdebug_tx_byte(struct dbgp_pipe *pipe, unsigned char data);
void usbdebug_tx_flush(struct dbgp_pipe *pipe);
+unsigned char usbdebug_rx_byte(struct dbgp_pipe *pipe);
#endif /* _CONSOLE_USB_H_ */
More information about the coreboot-gerrit
mailing list