[coreboot-gerrit] Patch set updated for coreboot: a1e8f1c usbdebug: Move ehci_debug_info into CAR_GLOBAL
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Tue Jun 18 21:22:03 CEST 2013
Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3475
-gerrit
commit a1e8f1cb5b8331f253f02526325fed3c269a1f07
Author: Aaron Durbin <adurbin at chromium.org>
Date: Fri Jun 14 00:41:19 2013 +0300
usbdebug: Move ehci_debug_info into 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 at gmail.com>
---
src/console/usbdebug_console.c | 8 +++---
src/cpu/intel/car/cache_as_ram_ht.inc | 5 ----
src/cpu/intel/haswell/cache_as_ram.inc | 9 ------
src/cpu/intel/model_2065x/cache_as_ram.inc | 9 ------
src/cpu/intel/model_206ax/cache_as_ram.inc | 9 ------
src/cpu/intel/model_6ex/cache_as_ram.inc | 5 ----
src/include/cbmem.h | 1 +
src/include/usbdebug.h | 6 ++--
src/lib/usbdebug.c | 44 ++++++++++++++++++++++--------
9 files changed, 40 insertions(+), 56 deletions(-)
diff --git a/src/console/usbdebug_console.c b/src/console/usbdebug_console.c
index dd61953..cb219a9 100644
--- a/src/console/usbdebug_console.c
+++ b/src/console/usbdebug_console.c
@@ -32,20 +32,20 @@ void set_ehci_base(unsigned ehci_base)
if (!dbg_info.ehci_debug)
return;
- diff = (unsigned)dbg_info.ehci_caps - ehci_base;
+ diff = dbg_info.ehci_caps - ehci_base;
dbg_info.ehci_regs -= diff;
dbg_info.ehci_debug -= diff;
- dbg_info.ehci_caps = (void*)ehci_base;
+ dbg_info.ehci_caps = ehci_base;
}
void set_ehci_debug(unsigned ehci_debug)
{
- dbg_info.ehci_debug = (void*)ehci_debug;
+ dbg_info.ehci_debug = ehci_debug;
}
unsigned get_ehci_debug(void)
{
- return (unsigned)dbg_info.ehci_debug;
+ return dbg_info.ehci_debug;
}
static void dbgp_init(void)
diff --git a/src/cpu/intel/car/cache_as_ram_ht.inc b/src/cpu/intel/car/cache_as_ram_ht.inc
index 8a845e9..fe1e29a 100644
--- a/src/cpu/intel/car/cache_as_ram_ht.inc
+++ b/src/cpu/intel/car/cache_as_ram_ht.inc
@@ -334,12 +334,7 @@ no_msr_11e:
post_code(0x2e)
/* 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
-#endif
/* Restore the BIST result. */
movl %ebp, %eax
diff --git a/src/cpu/intel/haswell/cache_as_ram.inc b/src/cpu/intel/haswell/cache_as_ram.inc
index 8601f46..2d1e86f 100644
--- a/src/cpu/intel/haswell/cache_as_ram.inc
+++ b/src/cpu/intel/haswell/cache_as_ram.inc
@@ -190,15 +190,6 @@ before_romstage:
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)
/* Disable cache. */
diff --git a/src/cpu/intel/model_2065x/cache_as_ram.inc b/src/cpu/intel/model_2065x/cache_as_ram.inc
index db0eaae..ec7335e 100644
--- a/src/cpu/intel/model_2065x/cache_as_ram.inc
+++ b/src/cpu/intel/model_2065x/cache_as_ram.inc
@@ -182,15 +182,6 @@ before_romstage:
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)
/* Disable cache. */
diff --git a/src/cpu/intel/model_206ax/cache_as_ram.inc b/src/cpu/intel/model_206ax/cache_as_ram.inc
index 2652cb7..b4119cc 100644
--- a/src/cpu/intel/model_206ax/cache_as_ram.inc
+++ b/src/cpu/intel/model_206ax/cache_as_ram.inc
@@ -182,15 +182,6 @@ before_romstage:
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)
/* Disable cache. */
diff --git a/src/cpu/intel/model_6ex/cache_as_ram.inc b/src/cpu/intel/model_6ex/cache_as_ram.inc
index 50fab35..ac3c66b 100644
--- a/src/cpu/intel/model_6ex/cache_as_ram.inc
+++ b/src/cpu/intel/model_6ex/cache_as_ram.inc
@@ -126,12 +126,7 @@ clear_mtrrs:
movl %eax, %cr0
/* 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
-#endif
movl %eax, %esp
/* Restore the BIST result. */
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index baec780..1daa60f 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -70,6 +70,7 @@
#define CBMEM_ID_ROOT 0xff4007ff
#define CBMEM_ID_VBOOT_HANDOFF 0x780074f0
#define CBMEM_ID_CAR_GLOBALS 0xcac4e6a3
+#define CBMEM_ID_EHCI_DEBUG 0xe4c1deb9
#define CBMEM_ID_NONE 0x00000000
#ifndef __ASSEMBLER__
diff --git a/src/include/usbdebug.h b/src/include/usbdebug.h
index c3b3437..b578ae6 100644
--- a/src/include/usbdebug.h
+++ b/src/include/usbdebug.h
@@ -24,9 +24,9 @@
#include <ehci.h>
struct ehci_debug_info {
- void *ehci_caps;
- void *ehci_regs;
- void *ehci_debug;
+ u32 ehci_caps;
+ u32 ehci_regs;
+ u32 ehci_debug;
u32 devnum;
u32 endpoint_out;
u32 endpoint_in;
diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c
index 200121f..64d6943 100644
--- a/src/lib/usbdebug.c
+++ b/src/lib/usbdebug.c
@@ -22,6 +22,9 @@
#include <console/console.h>
#include <arch/io.h>
#include <arch/byteorder.h>
+#include <cpu/x86/car.h>
+#include <cbmem.h>
+#include <string.h>
#include <usb_ch9.h>
#include <ehci.h>
@@ -86,6 +89,8 @@
#define DBGP_MAX_PACKET 8
#define DBGP_LOOPS 1000
+static struct ehci_debug_info glob_dbg_info CAR_GLOBAL;
+
static int dbgp_wait_until_complete(struct ehci_dbg_port *ehci_debug)
{
u32 ctrl;
@@ -204,7 +209,7 @@ static int dbgp_bulk_write(struct ehci_dbg_port *ehci_debug,
int dbgp_bulk_write_x(struct ehci_debug_info *dbg_info, const char *bytes, int size)
{
- return dbgp_bulk_write(dbg_info->ehci_debug, dbg_info->devnum,
+ return dbgp_bulk_write((struct ehci_dbg_port *) dbg_info->ehci_debug, dbg_info->devnum,
dbg_info->endpoint_out, bytes, size);
}
@@ -241,7 +246,7 @@ static int dbgp_bulk_read(struct ehci_dbg_port *ehci_debug, unsigned devnum,
int dbgp_bulk_read_x(struct ehci_debug_info *dbg_info, void *data, int size)
{
- return dbgp_bulk_read(dbg_info->ehci_debug, dbg_info->devnum,
+ return dbgp_bulk_read((struct ehci_dbg_port *) dbg_info->ehci_debug, dbg_info->devnum,
dbg_info->endpoint_in, data, size, DBGP_LOOPS);
}
@@ -383,7 +388,7 @@ int usbdebug_init(unsigned ehci_bar, unsigned offset, struct ehci_debug_info *in
ehci_regs = (struct ehci_regs *)(ehci_bar +
HC_LENGTH(read32((unsigned long)&ehci_caps->hc_capbase)));
ehci_debug = (struct ehci_dbg_port *)(ehci_bar + offset);
- info->ehci_debug = (void *)0;
+ info->ehci_debug = 0;
info->bufidx = 0;
try_next_time:
port_map_tried = 0;
@@ -541,9 +546,9 @@ try_next_port:
}
dbgp_printk("Test write done\n");
- info->ehci_caps = ehci_caps;
- info->ehci_regs = ehci_regs;
- info->ehci_debug = ehci_debug;
+ info->ehci_caps = (u32) ehci_caps;
+ info->ehci_regs = (u32) ehci_regs;
+ info->ehci_debug = (u32) ehci_debug;
info->devnum = devnum;
info->endpoint_out = dbgp_endpoint_out;
info->endpoint_in = dbgp_endpoint_in;
@@ -574,8 +579,7 @@ next_debug_port:
int early_usbdebug_init(void)
{
- struct ehci_debug_info *dbg_info = (struct ehci_debug_info *)
- (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
+ struct ehci_debug_info *dbg_info = car_get_var_ptr(&glob_dbg_info);
return usbdebug_init(CONFIG_EHCI_BAR, CONFIG_EHCI_DEBUG_OFFSET, dbg_info);
}
@@ -585,8 +589,7 @@ void usbdebug_tx_byte(struct ehci_debug_info *dbg_info, unsigned char data)
#if DBGP_DEBUG == 0
if (!dbg_info) {
/* "Find" dbg_info structure in Cache */
- dbg_info = (struct ehci_debug_info *)
- (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
+ dbg_info = car_get_var_ptr(&glob_dbg_info);
}
if (dbg_info->ehci_debug) {
@@ -604,8 +607,7 @@ void usbdebug_tx_flush(struct ehci_debug_info *dbg_info)
#if DBGP_DEBUG == 0
if (!dbg_info) {
/* "Find" dbg_info structure in Cache */
- dbg_info = (struct ehci_debug_info *)
- (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
+ dbg_info = car_get_var_ptr(&glob_dbg_info);
}
if (dbg_info->ehci_debug && dbg_info->bufidx > 0) {
@@ -614,3 +616,21 @@ void usbdebug_tx_flush(struct ehci_debug_info *dbg_info)
}
#endif
}
+
+#if CONFIG_CAR_MIGRATION && defined(__PRE_RAM__)
+static void migrate_ehci_debug(void)
+{
+ struct ehci_debug_info *dbg_info;
+ struct ehci_debug_info *dbg_info_cbmem;
+
+ dbg_info = car_get_var_ptr(&glob_dbg_info);
+
+ dbg_info_cbmem = cbmem_add(CBMEM_ID_EHCI_DEBUG, sizeof(*dbg_info));
+
+ if (dbg_info_cbmem == NULL)
+ return;
+
+ memcpy(dbg_info_cbmem, dbg_info, sizeof(*dbg_info));
+}
+CAR_MIGRATE(migrate_ehci_debug);
+#endif
More information about the coreboot-gerrit
mailing list