From 24100100181bd770ce0f1181a1770a0808790cde Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Mon, 12 Aug 2013 20:40:37 +0300 Subject: usbdebug: Change debug port scanning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On AMD platforms, setting of USBDEBUG_DEFAULT_PORT=0 tries to scan all physical ports one after other in incrementing order. To avoid possible problems with other USB devices, one can select the port number here and bypass the scan. Intel platforms can communicate with usbdebug dongle on one physical port only, and this option makes no difference there. Change-Id: I45be6cc3aa91b74650eda2d444c9fcad39d58897 Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/3872 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/lib/usbdebug.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c index 4a1228f158..c9247881f0 100644 --- a/src/lib/usbdebug.c +++ b/src/lib/usbdebug.c @@ -421,8 +421,13 @@ static int usbdebug_init_(unsigned ehci_bar, unsigned offset, struct ehci_debug_ HC_LENGTH(read32((unsigned long)&ehci_caps->hc_capbase))); ehci_debug = (struct ehci_dbg_port *)(ehci_bar + offset); info->ehci_debug = (void *)0; - memset(&info->ep_pipe, 0, sizeof (info->ep_pipe)); + + if (CONFIG_USBDEBUG_DEFAULT_PORT > 0) + set_debug_port(CONFIG_USBDEBUG_DEFAULT_PORT); + else + set_debug_port(1); + try_next_time: port_map_tried = 0; @@ -630,6 +635,7 @@ err: //return ret; next_debug_port: +#if CONFIG_USBDEBUG_DEFAULT_PORT==0 port_map_tried |= (1 << (debug_port - 1)); new_debug_port = ((debug_port-1 + 1) % n_ports) + 1; if (port_map_tried != ((1 << n_ports) - 1)) { @@ -637,10 +643,15 @@ next_debug_port: goto try_next_port; } if (--playtimes) { - //set_debug_port(new_debug_port); - set_debug_port(debug_port); + set_debug_port(new_debug_port); goto try_next_time; } +#else + if (0) + goto try_next_port; + if (--playtimes) + goto try_next_time; +#endif return -10; } @@ -774,7 +785,7 @@ int usbdebug_init(void) struct ehci_debug_info *dbg_info = dbgp_ehci_info(); #if defined(__PRE_RAM__) || !CONFIG_EARLY_CONSOLE - enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT); + enable_usbdebug(0); #endif return usbdebug_init_(CONFIG_EHCI_BAR, CONFIG_EHCI_DEBUG_OFFSET, dbg_info); } -- cgit v1.2.3