Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30878
Change subject: usbdebug: Remove option DEBUG_USBDEBUG ......................................................................
usbdebug: Remove option DEBUG_USBDEBUG
Superseeded with DEBUG_CONSOLE_INIT.
Change-Id: Idf470b8572ad992c8d4684a860412d9140f514ca Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/Kconfig M src/drivers/usb/ehci_debug.c 2 files changed, 19 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/30878/1
diff --git a/src/Kconfig b/src/Kconfig index fb24b5f..cc8cb08 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -961,16 +961,6 @@ 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 6d0339b..18d0491 100644 --- a/src/drivers/usb/ehci_debug.c +++ b/src/drivers/usb/ehci_debug.c @@ -34,13 +34,14 @@ 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 @@ #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 @@ 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 @@ 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)
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30878 )
Change subject: usbdebug: Remove option DEBUG_USBDEBUG ......................................................................
Patch Set 1: Code-Review+2
(1 comment)
https://review.coreboot.org/#/c/30878/1/src/drivers/usb/ehci_debug.c File src/drivers/usb/ehci_debug.c:
https://review.coreboot.org/#/c/30878/1/src/drivers/usb/ehci_debug.c@214 PS1, Line 214: if (!IS_ENABLED(CONFIG_DEBUG_CONSOLE_INIT) || dbgp_enabled()) Please mention functional change in commit message.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30878 )
Change subject: usbdebug: Remove option DEBUG_USBDEBUG ......................................................................
Patch Set 1: Code-Review+1
Hello Angel Pons, build bot (Jenkins), Nico Huber,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/30878
to look at the new patch set (#2).
Change subject: usbdebug: Remove option DEBUG_USBDEBUG ......................................................................
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 --- M src/Kconfig M src/drivers/usb/ehci_debug.c 2 files changed, 19 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/30878/2
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30878 )
Change subject: usbdebug: Remove option DEBUG_USBDEBUG ......................................................................
Patch Set 2: Code-Review+2
Kyösti Mälkki has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/30878 )
Change subject: usbdebug: Remove option DEBUG_USBDEBUG ......................................................................
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 --- M src/Kconfig M src/drivers/usb/ehci_debug.c 2 files changed, 19 insertions(+), 20 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
diff --git a/src/Kconfig b/src/Kconfig index cba48af..8de9daf 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -961,16 +961,6 @@ 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 6d0339b..18d0491 100644 --- a/src/drivers/usb/ehci_debug.c +++ b/src/drivers/usb/ehci_debug.c @@ -34,13 +34,14 @@ 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 @@ #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 @@ 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 @@ 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)