diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-01-10 13:07:42 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-01-13 13:02:23 +0000 |
commit | 8c1258ab8b7e2bd2adcf36e0b610b394f6b6d175 (patch) | |
tree | 12e858daf7a1348547bbfda21e62164a304c15e5 /src/drivers | |
parent | 66277952893b27154c7e8cfd7db3822342946c45 (diff) |
usbdebug: Remove option DEBUG_USBDEBUG
Superseeded with DEBUG_CONSOLE_INIT.
For dbgp_print_data() return early and skip reading
registers when dprintk() would not get printed anyways.
Change-Id: Idf470b8572ad992c8d4684a860412d9140f514ca
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/30878
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/usb/ehci_debug.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/drivers/usb/ehci_debug.c b/src/drivers/usb/ehci_debug.c index 6d0339b739..18d0491b04 100644 --- a/src/drivers/usb/ehci_debug.c +++ b/src/drivers/usb/ehci_debug.c @@ -34,13 +34,14 @@ struct ehci_debug_info { struct dbgp_pipe ep_pipe[DBGP_MAX_ENDPOINTS]; }; -#if IS_ENABLED(CONFIG_DEBUG_USBDEBUG) -static void dbgp_print_data(struct ehci_dbg_port *ehci_debug); -static int dbgp_enabled(void); +#if IS_ENABLED(CONFIG_DEBUG_CONSOLE_INIT) +/* When selected, you can debug the connection of usbdebug dongle. + * EHCI port register bits and USB packets are dumped on console, + * assuming some other console already works. + */ # define dprintk(LEVEL, args...) \ do { if (!dbgp_enabled()) printk(LEVEL, ##args); } while (0) #else -# define dbgp_print_data(x) do {} while (0) # define dprintk(LEVEL, args...) do {} while (0) #endif @@ -57,6 +58,9 @@ static int dbgp_enabled(void); #define DBGP_MICROFRAME_RETRIES 10 #define DBGP_MAX_PACKET 8 +static int dbgp_enabled(void); +static void dbgp_print_data(struct ehci_dbg_port *ehci_debug); + static struct ehci_debug_info glob_dbg_info CAR_GLOBAL; static struct ehci_debug_info * glob_dbg_info_p CAR_GLOBAL; @@ -202,13 +206,19 @@ static void dbgp_get_data(struct ehci_dbg_port *ehci_debug, void *buf, int size) bytes[i] = (hi >> (8*(i - 4))) & 0xff; } -#if IS_ENABLED(CONFIG_DEBUG_USBDEBUG) static void dbgp_print_data(struct ehci_dbg_port *ehci_debug) { - u32 ctrl = read32(&ehci_debug->control); - u32 lo = read32(&ehci_debug->data03); - u32 hi = read32(&ehci_debug->data47); - int len = DBGP_LEN(ctrl); + int len; + u32 ctrl, lo, hi; + + if (!IS_ENABLED(CONFIG_DEBUG_CONSOLE_INIT) || dbgp_enabled()) + return; + + ctrl = read32(&ehci_debug->control); + lo = read32(&ehci_debug->data03); + hi = read32(&ehci_debug->data47); + + len = DBGP_LEN(ctrl); if (len) { int i; dprintk(BIOS_SPEW, "dbgp: buf:"); @@ -219,7 +229,6 @@ static void dbgp_print_data(struct ehci_dbg_port *ehci_debug) dprintk(BIOS_SPEW, "\n"); } } -#endif static int dbgp_bulk_write(struct ehci_dbg_port *ehci_debug, struct dbgp_pipe *pipe, const char *bytes, int size) |