Arthur Heymans has uploaded this change for review.

View Change

src/drivers/usb: Make the EHCI debug console work in the bootblock

Currently this needlessly initializes the hardware in the both the
romstage and the bootblock, but it works.

Tested on Google/peppy.

Change-Id: Ib77f2fc7f3d8fa524405601bae15cce9f76ffc6f
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
M src/device/Makefile.inc
M src/drivers/usb/Makefile.inc
M src/drivers/usb/ehci_debug.c
M src/include/console/usb.h
M src/soc/amd/stoneyridge/Makefile.inc
M src/soc/intel/broadwell/Makefile.inc
M src/southbridge/intel/common/Makefile.inc
7 files changed, 11 insertions(+), 3 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/80/30480/1
diff --git a/src/device/Makefile.inc b/src/device/Makefile.inc
index d1ca356..e6e9f1b 100644
--- a/src/device/Makefile.inc
+++ b/src/device/Makefile.inc
@@ -27,6 +27,7 @@
verstage-y += device_const.c
romstage-y += device_const.c
ramstage-y += device_const.c
+bootblock-$(CONFIG_PCI) += pci_early.c
romstage-$(CONFIG_PCI) += pci_early.c
postcar-$(CONFIG_PCI) += pci_early.c

diff --git a/src/drivers/usb/Makefile.inc b/src/drivers/usb/Makefile.inc
index bc58f32..9495578 100644
--- a/src/drivers/usb/Makefile.inc
+++ b/src/drivers/usb/Makefile.inc
@@ -1,3 +1,4 @@
+bootblock-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += ehci_debug.c pci_ehci.c console.c gadget.c
romstage-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += ehci_debug.c pci_ehci.c console.c gadget.c
postcar-$(CONFIG_USBDEBUG) += ehci_debug.c pci_ehci.c console.c gadget.c

diff --git a/src/drivers/usb/ehci_debug.c b/src/drivers/usb/ehci_debug.c
index bec5164..23aa38c 100644
--- a/src/drivers/usb/ehci_debug.c
+++ b/src/drivers/usb/ehci_debug.c
@@ -719,7 +719,8 @@
* CBMEM_INIT_HOOKs for postcar and ramstage as we recover state
* from CBMEM.
*/
- if (IS_ENABLED(CONFIG_USBDEBUG_IN_ROMSTAGE) && ENV_ROMSTAGE)
+ if (IS_ENABLED(CONFIG_USBDEBUG_IN_ROMSTAGE)
+ && (ENV_ROMSTAGE || ENV_BOOTBLOCK))
usbdebug_hw_init();

/* USB console init is done early in ramstage if it was
@@ -731,4 +732,5 @@
if (!IS_ENABLED(CONFIG_USBDEBUG_IN_ROMSTAGE) && ENV_RAMSTAGE
&& !IS_ENABLED(CONFIG_POSTCAR_STAGE))
usbdebug_hw_init();
+
}
diff --git a/src/include/console/usb.h b/src/include/console/usb.h
index 23f5f7a..d4429e6 100644
--- a/src/include/console/usb.h
+++ b/src/include/console/usb.h
@@ -28,8 +28,9 @@
int usb_can_rx_byte(int idx);

#define __CONSOLE_USB_ENABLE__ (IS_ENABLED(CONFIG_CONSOLE_USB) && \
- ((ENV_ROMSTAGE && IS_ENABLED(CONFIG_USBDEBUG_IN_ROMSTAGE)) || \
- ENV_POSTCAR || ENV_RAMSTAGE))
+ ((ENV_BOOTBLOCK && IS_ENABLED(CONFIG_USBDEBUG_IN_ROMSTAGE)) || \
+ (ENV_ROMSTAGE && IS_ENABLED(CONFIG_USBDEBUG_IN_ROMSTAGE)) || \
+ ENV_POSTCAR || ENV_RAMSTAGE))

#define USB_PIPE_FOR_CONSOLE 0
#define USB_PIPE_FOR_GDB 0
diff --git a/src/soc/amd/stoneyridge/Makefile.inc b/src/soc/amd/stoneyridge/Makefile.inc
index 46f1581..4514dd4 100644
--- a/src/soc/amd/stoneyridge/Makefile.inc
+++ b/src/soc/amd/stoneyridge/Makefile.inc
@@ -42,6 +42,7 @@
bootblock-y += bootblock/bootblock.c
bootblock-y += gpio.c
bootblock-y += i2c.c
+bootblock-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += enable_usbdebug.c
bootblock-y += monotonic_timer.c
bootblock-y += pmutil.c
bootblock-y += reset.c
diff --git a/src/soc/intel/broadwell/Makefile.inc b/src/soc/intel/broadwell/Makefile.inc
index 91d2834..20b9fa8 100644
--- a/src/soc/intel/broadwell/Makefile.inc
+++ b/src/soc/intel/broadwell/Makefile.inc
@@ -61,6 +61,7 @@
ramstage-y += tsc_freq.c
romstage-y += tsc_freq.c
smm-y += tsc_freq.c
+bootblock-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += usb_debug.c
romstage-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += usb_debug.c
postcar-$(CONFIG_USBDEBUG) += usb_debug.c
ramstage-$(CONFIG_USBDEBUG) += usb_debug.c
diff --git a/src/southbridge/intel/common/Makefile.inc b/src/southbridge/intel/common/Makefile.inc
index f4d22f7..d76122b 100644
--- a/src/southbridge/intel/common/Makefile.inc
+++ b/src/southbridge/intel/common/Makefile.inc
@@ -29,6 +29,7 @@
postcar-y += pmbase.c
smm-y += pmbase.c

+bootblock-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += usb_debug.c
romstage-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += usb_debug.c
postcar-$(CONFIG_USBDEBUG) += usb_debug.c
ramstage-$(CONFIG_USBDEBUG) += usb_debug.c

To view, visit change 30480. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ib77f2fc7f3d8fa524405601bae15cce9f76ffc6f
Gerrit-Change-Number: 30480
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-MessageType: newchange