cpu/amd/car/post_cache_as_ram: Avoid trailing spaces

Looking at the coreboot console logs there are sometimes trailing
whitespaces in the output, for example, if writing `Done` was not
possible.

Adapt the code, that spaces are only added when needed.

Change-Id: Ia0af493ab62b6fab24e8a2629cf5fd67329e0af7
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/12357
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Paul Menzel 2015-11-07 09:15:06 +01:00 committed by Martin Roth
parent 4aac08afec
commit 42b6265035
1 changed files with 12 additions and 12 deletions

View File

@ -32,20 +32,20 @@ static size_t backup_size(void)
static void memcpy_(void *d, const void *s, size_t len) static void memcpy_(void *d, const void *s, size_t len)
{ {
print_car_debug(" Copy [%08x-%08x] to [%08x - %08x] ... ", print_car_debug(" Copy [%08x-%08x] to [%08x - %08x] ...",
(uint32_t) s, (uint32_t) (s + len - 1), (uint32_t) d, (uint32_t) (d + len - 1)); (uint32_t) s, (uint32_t) (s + len - 1), (uint32_t) d, (uint32_t) (d + len - 1));
memcpy(d, s, len); memcpy(d, s, len);
} }
static void memset_(void *d, int val, size_t len) static void memset_(void *d, int val, size_t len)
{ {
print_car_debug(" Fill [%08x-%08x] ... ", (uint32_t) d, (uint32_t) (d + len - 1)); print_car_debug(" Fill [%08x-%08x] ...", (uint32_t) d, (uint32_t) (d + len - 1));
memset(d, val, len); memset(d, val, len);
} }
static int memcmp_(void *d, const void *s, size_t len) static int memcmp_(void *d, const void *s, size_t len)
{ {
print_car_debug(" Compare [%08x-%08x] with [%08x - %08x] ... ", print_car_debug(" Compare [%08x-%08x] with [%08x - %08x] ...",
(uint32_t) s, (uint32_t) (s + len - 1), (uint32_t) d, (uint32_t) (d + len - 1)); (uint32_t) s, (uint32_t) (s + len - 1), (uint32_t) d, (uint32_t) (d + len - 1));
return memcmp(d, s, len); return memcmp(d, s, len);
} }
@ -61,13 +61,13 @@ static void prepare_romstage_ramstack(void *resume_backup_memory)
} }
memset_((void *)(CONFIG_RAMTOP - backup_top), 0, backup_top); memset_((void *)(CONFIG_RAMTOP - backup_top), 0, backup_top);
print_car_debug("Done\n"); print_car_debug(" Done\n");
} }
static void prepare_ramstage_region(void *resume_backup_memory) static void prepare_ramstage_region(void *resume_backup_memory)
{ {
size_t backup_top = backup_size(); size_t backup_top = backup_size();
print_car_debug("Prepare ramstage memory region... "); print_car_debug("Prepare ramstage memory region...");
if (resume_backup_memory) { if (resume_backup_memory) {
memcpy_(resume_backup_memory, (void *) CONFIG_RAMBASE, HIGH_MEMORY_SAVE - backup_top); memcpy_(resume_backup_memory, (void *) CONFIG_RAMBASE, HIGH_MEMORY_SAVE - backup_top);
@ -76,7 +76,7 @@ static void prepare_ramstage_region(void *resume_backup_memory)
memset_((void*)0, 0, CONFIG_RAMTOP - backup_top); memset_((void*)0, 0, CONFIG_RAMTOP - backup_top);
} }
print_car_debug("Done\n"); print_car_debug(" Done\n");
} }
/* Disable Erratum 343 Workaround, see RevGuide for Fam10h, Pub#41322 Rev 3.33 */ /* Disable Erratum 343 Workaround, see RevGuide for Fam10h, Pub#41322 Rev 3.33 */
@ -129,18 +129,18 @@ void post_cache_as_ram(void)
size_t car_size = car_data_size(); size_t car_size = car_data_size();
void *migrated_car = (void *)(CONFIG_RAMTOP - car_size); void *migrated_car = (void *)(CONFIG_RAMTOP - car_size);
print_car_debug("Copying data from cache to RAM... "); print_car_debug("Copying data from cache to RAM...");
memcpy_(migrated_car, &_car_data_start[0], car_size); memcpy_(migrated_car, &_car_data_start[0], car_size);
print_car_debug("Done\n"); print_car_debug(" Done\n");
print_car_debug("Verifying data integrity in RAM... "); print_car_debug("Verifying data integrity in RAM...");
if (memcmp_(migrated_car, &_car_data_start[0], car_size) == 0) if (memcmp_(migrated_car, &_car_data_start[0], car_size) == 0)
print_car_debug("Done\n"); print_car_debug(" Done\n");
else else
print_car_debug("FAILED\n"); print_car_debug(" FAILED\n");
/* New stack grows right below migrated_car. */ /* New stack grows right below migrated_car. */
print_car_debug("Switching to use RAM as stack... "); print_car_debug("Switching to use RAM as stack...");
cache_as_ram_switch_stack(migrated_car); cache_as_ram_switch_stack(migrated_car);
/* We do not come back. */ /* We do not come back. */