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 | |
parent | 66277952893b27154c7e8cfd7db3822342946c45 (diff) | |
download | coreboot-8c1258ab8b7e2bd2adcf36e0b610b394f6b6d175.tar.xz |
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')
-rw-r--r-- | src/Kconfig | 10 | ||||
-rw-r--r-- | src/drivers/usb/ehci_debug.c | 29 |
2 files changed, 19 insertions, 20 deletions
diff --git a/src/Kconfig b/src/Kconfig index cba48af8e5..8de9dafe25 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -961,16 +961,6 @@ config DEBUG_SPI_FLASH help This option enables additional SPI flash related debug messages. -config DEBUG_USBDEBUG - bool "Output verbose USB 2.0 EHCI debug dongle messages" - default n - depends on USBDEBUG - help - This option enables additional USB 2.0 debug dongle related messages. - - Select this to debug the connection of usbdebug dongle. Note that - you need some other working console to receive the messages. - if SOUTHBRIDGE_INTEL_BD82X6X && DEFAULT_CONSOLE_LOGLEVEL_8 # Only visible with the right southbridge and loglevel. config DEBUG_INTEL_ME 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) |