diff options
Diffstat (limited to 'src/drivers/usb/ehci_debug.c')
-rw-r--r-- | src/drivers/usb/ehci_debug.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/drivers/usb/ehci_debug.c b/src/drivers/usb/ehci_debug.c index 18d0491b04..c5fb984d54 100644 --- a/src/drivers/usb/ehci_debug.c +++ b/src/drivers/usb/ehci_debug.c @@ -66,13 +66,18 @@ static struct ehci_debug_info * glob_dbg_info_p CAR_GLOBAL; static inline struct ehci_debug_info *dbgp_ehci_info(void) { - if (IS_ENABLED(CONFIG_USBDEBUG_IN_PRE_RAM) - && (ENV_ROMSTAGE || ENV_BOOTBLOCK || ENV_VERSTAGE)) - glob_dbg_info_p = - (struct ehci_debug_info *)_car_ehci_dbg_info_start; - if (car_get_var(glob_dbg_info_p) == NULL) - car_set_var(glob_dbg_info_p, &glob_dbg_info); - + if (car_get_var(glob_dbg_info_p) == NULL) { + struct ehci_debug_info *info; + if (ENV_BOOTBLOCK || ENV_VERSTAGE || ENV_ROMSTAGE) { + /* The message likely does not show if we hit this. */ + if (sizeof(*info) > _car_ehci_dbg_info_size) + die("BUG: Increase ehci_dbg_info reserve in CAR"); + info = (void *)_car_ehci_dbg_info_start; + } else { + info = &glob_dbg_info; + } + car_set_var(glob_dbg_info_p, info); + } return car_get_var(glob_dbg_info_p); } |