From 38f9c49f343b4622ba3dd635aa953cca5f3bf37b Mon Sep 17 00:00:00 2001 From: Lee Leahy Date: Tue, 7 Jun 2016 08:45:17 -0700 Subject: [PATCH] UPSTREAM: arch/x86: Add debug spinloop Conditionally add a debug spinloop to enable easy connection of JTAG debuggers. TEST=Build and run on Galileo Gen2 with a JTAG debugger. BUG=None BRANCH=None TEST=None Change-Id: I7a21f9e6bfb10912d06ce48447c61202553630d0 Original-Signed-off-by: Lee Leahy Original-Reviewed-on: https://review.coreboot.org/15127 Original-Tested-by: build bot (Jenkins) Original-Reviewed-by: Aaron Durbin Signed-off-by: Aaron Durbin Reviewed-on: https://chromium-review.googlesource.com/351784 Commit-Ready: Furquan Shaikh Tested-by: Furquan Shaikh Reviewed-by: Furquan Shaikh --- src/arch/x86/Kconfig | 7 +++++++ src/arch/x86/bootblock_crt0.S | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig index 724c4dba61..8609e20136 100644 --- a/src/arch/x86/Kconfig +++ b/src/arch/x86/Kconfig @@ -117,6 +117,13 @@ config PC80_SYSTEM bool default y if ARCH_X86 +config BOOTBLOCK_DEBUG_SPINLOOP + bool + default n + help + Add a spin (JMP .) in bootblock_crt0.S during early bootblock to wait + for a JTAG debugger to break into the execution sequence. + config BOOTBLOCK_MAINBOARD_INIT string diff --git a/src/arch/x86/bootblock_crt0.S b/src/arch/x86/bootblock_crt0.S index 9fbce5dbb5..8ae82b4368 100644 --- a/src/arch/x86/bootblock_crt0.S +++ b/src/arch/x86/bootblock_crt0.S @@ -32,6 +32,15 @@ #include #include +#if IS_ENABLED(CONFIG_BOOTBLOCK_DEBUG_SPINLOOP) + + /* Wait for a JTAG debugger to break in and set EBX non-zero */ + xor %ebx, %ebx + +debug_spinloop: + cmp $0, %ebx + jz debug_spinloop +#endif bootblock_protected_mode_entry: /* Save BIST result */