usbdebug: Fix init and add support for postcar

Hardware / Coreboot - Kyösti Mälkki [] - 14 September 2017 08:26 EDT

It was originally designed such that if usbdebug_init() was called before cbmem_initialize(), it would fetch the already-initialized state from CBMEM. This changed when cbmem_find() behaviour changed to require cbmem_initialize() to be called first. As a result, ramstage had to reinitialize all of the EHCI controller and USB endpoints on entry. This was slow, specially with AMD hardware where one can scan USB ports to probe for the debug dongle.

For postcar and ramstage, move usbdebug entry such that it is triggered from CBMEM_INIT_HOOK instead of console_init(). Side-effect of this is usbdebug console shows 'coreboot-xxx ... starting...' line only for romstage.

Initialisation for usbdebug is never done in postcar. If you have USBDEBUG_IN_ROMSTAGE=n, postcar will not have console output on usb either.

While at it, fix also some other __PRE_RAM__ cases to ENV_ROMSTAGE and alike.

Change-Id: If8ab973321a801abc5529f3ff68c5dccae9512ad

d07f377 usbdebug: Fix init and add support for postcar
src/drivers/usb/ | 1 +
src/drivers/usb/ehci_debug.c | 81 +++++++++++++++++++++++++++-----------------
src/drivers/usb/pci_ehci.c | 4 +--
src/include/console/usb.h | 3 +-
4 files changed, 55 insertions(+), 34 deletions(-)


  • Share