usbdebug: Put ehci_debug_info in CAR_GLOBAL

Store EHCI Debug Port runtime variables in CAR_GLOBAL.
For platforms without CAR_MIGRATION, logging on EHCI Debug Port is
temporarily lost when CAR is torn down at end of romstage.

On model_2065x and model_206ax ehci_debug_info was overlapping the MRC
variable region and additionally migration used incorrect size for
the structure.

Change-Id: I5e6c613b8a4b1dda43d5b69bd437753108760fca
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3475
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Kyösti Mälkki 2013-07-06 11:41:09 +03:00 committed by Stefan Reinauer
parent 41c10cd2d7
commit 8ee04d784c
6 changed files with 7 additions and 48 deletions

View File

@ -334,12 +334,7 @@ no_msr_11e:
post_code(0x2e) post_code(0x2e)
/* Set up the stack pointer. */ /* Set up the stack pointer. */
#if CONFIG_USBDEBUG
/* Leave some space for the struct ehci_debug_info. */
movl $(CACHE_AS_RAM_BASE + CACHE_AS_RAM_SIZE - 4 - 128), %esp
#else
movl $(CACHE_AS_RAM_BASE + CACHE_AS_RAM_SIZE - 4), %esp movl $(CACHE_AS_RAM_BASE + CACHE_AS_RAM_SIZE - 4), %esp
#endif
/* Restore the BIST result. */ /* Restore the BIST result. */
movl %ebp, %eax movl %ebp, %eax

View File

@ -190,15 +190,6 @@ before_romstage:
post_code(0x2f) post_code(0x2f)
/* Copy global variable space (for USBDEBUG) to memory */
#if CONFIG_USBDEBUG
cld
movl $(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - 24), %esi
movl $(CONFIG_RAMTOP - 24), %edi
movl $24, %ecx
rep movsb
#endif
post_code(0x30) post_code(0x30)
/* Disable cache. */ /* Disable cache. */

View File

@ -182,15 +182,6 @@ before_romstage:
post_code(0x2f) post_code(0x2f)
/* Copy global variable space (for USBDEBUG) to memory */
#if CONFIG_USBDEBUG
cld
movl $(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - 24), %esi
movl $(CONFIG_RAMTOP - 24), %edi
movl $24, %ecx
rep movsb
#endif
post_code(0x30) post_code(0x30)
/* Disable cache. */ /* Disable cache. */

View File

@ -182,15 +182,6 @@ before_romstage:
post_code(0x2f) post_code(0x2f)
/* Copy global variable space (for USBDEBUG) to memory */
#if CONFIG_USBDEBUG
cld
movl $(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - 24), %esi
movl $(CONFIG_RAMTOP - 24), %edi
movl $24, %ecx
rep movsb
#endif
post_code(0x30) post_code(0x30)
/* Disable cache. */ /* Disable cache. */

View File

@ -126,12 +126,7 @@ clear_mtrrs:
movl %eax, %cr0 movl %eax, %cr0
/* Set up the stack pointer. */ /* Set up the stack pointer. */
#if CONFIG_USBDEBUG
/* Leave some space for the struct ehci_debug_info. */
movl $(CACHE_AS_RAM_BASE + CACHE_AS_RAM_SIZE - 4 - 128), %eax
#else
movl $(CACHE_AS_RAM_BASE + CACHE_AS_RAM_SIZE - 4), %eax movl $(CACHE_AS_RAM_BASE + CACHE_AS_RAM_SIZE - 4), %eax
#endif
movl %eax, %esp movl %eax, %esp
/* Restore the BIST result. */ /* Restore the BIST result. */

View File

@ -23,6 +23,7 @@
#include <arch/io.h> #include <arch/io.h>
#include <device/pci.h> #include <device/pci.h>
#include <arch/byteorder.h> #include <arch/byteorder.h>
#include <cpu/x86/car.h>
#include <usb_ch9.h> #include <usb_ch9.h>
#include <ehci.h> #include <ehci.h>
@ -87,8 +88,8 @@
#define DBGP_MAX_PACKET 8 #define DBGP_MAX_PACKET 8
#define DBGP_LOOPS 1000 #define DBGP_LOOPS 1000
static struct ehci_debug_info glob_dbg_info CAR_GLOBAL;
#if !defined(__PRE_RAM__) && !defined(__SMM__) #if !defined(__PRE_RAM__) && !defined(__SMM__)
static struct ehci_debug_info glob_dbg_info;
static struct device_operations *ehci_drv_ops; static struct device_operations *ehci_drv_ops;
static struct device_operations ehci_dbg_ops; static struct device_operations ehci_dbg_ops;
#endif #endif
@ -602,7 +603,7 @@ void usbdebug_tx_flush(struct ehci_debug_info *dbg_info)
#if !defined(__PRE_RAM__) && !defined(__SMM__) #if !defined(__PRE_RAM__) && !defined(__SMM__)
static void usbdebug_re_enable(unsigned ehci_base) static void usbdebug_re_enable(unsigned ehci_base)
{ {
struct ehci_debug_info *dbg_info = dbgp_ehci_info(); struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info);
unsigned diff; unsigned diff;
if (!dbg_info->ehci_debug) if (!dbg_info->ehci_debug)
@ -617,7 +618,7 @@ static void usbdebug_re_enable(unsigned ehci_base)
static void usbdebug_disable(void) static void usbdebug_disable(void)
{ {
struct ehci_debug_info *dbg_info = dbgp_ehci_info(); struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info);
dbg_info->status &= ~DBGP_EP_ENABLED; dbg_info->status &= ~DBGP_EP_ENABLED;
} }
@ -662,18 +663,13 @@ int dbgp_ep_is_active(struct ehci_debug_info *dbg_info)
struct ehci_debug_info *dbgp_ehci_info(void) struct ehci_debug_info *dbgp_ehci_info(void)
{ {
#if __PRE_RAM__ return car_get_var_ptr(&glob_dbg_info);
/* "Find" dbg_info structure in Cache */
return (struct ehci_debug_info *)
(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
#else
return &glob_dbg_info;
#endif
} }
int usbdebug_init(void) int usbdebug_init(void)
{ {
struct ehci_debug_info *dbg_info = dbgp_ehci_info(); struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info);
#if defined(__PRE_RAM__) || !CONFIG_EARLY_CONSOLE #if defined(__PRE_RAM__) || !CONFIG_EARLY_CONSOLE
enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT); enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
#endif #endif