diff options
author | Vladimir Serbinenko <phcoder@gmail.com> | 2014-01-22 21:41:34 +0100 |
---|---|---|
committer | Vladimir Serbinenko <phcoder@gmail.com> | 2014-01-23 19:57:09 +0100 |
commit | 969f8617e9ff4e71a11a8fc4567e8c8de33585a0 (patch) | |
tree | f24e4fdfb932a7beca7dbc2127c27b61e37b3661 | |
parent | bca985557e3a7dc94c954d7295a963f654886a08 (diff) | |
download | coreboot-969f8617e9ff4e71a11a8fc4567e8c8de33585a0.tar.xz |
lenovo/x201: Reinit CBMEM only on S3 resume.
Change-Id: I0643cdab10cda3f19ab56223f5fa77376a8046ac
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-on: http://review.coreboot.org/4782
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
-rw-r--r-- | src/mainboard/lenovo/x201/romstage.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/mainboard/lenovo/x201/romstage.c b/src/mainboard/lenovo/x201/romstage.c index 57e1e505a0..5eb4fb9dd4 100644 --- a/src/mainboard/lenovo/x201/romstage.c +++ b/src/mainboard/lenovo/x201/romstage.c @@ -230,7 +230,6 @@ static inline u16 read_acpi16(u32 addr) void main(unsigned long bist) { u32 reg32; - int cbmem_initted; int s3resume = 0; timestamp_init(rdtsc ()); @@ -327,18 +326,24 @@ void main(unsigned long bist) outl(reg32 & ~(7 << 10), DEFAULT_PMBASE + 0x04); } - /* FIXME: If not in s3resume, raminit() calls cbmem_recovery(0), - * clears all of CBMEM region and puts in MRC training results. - * Tell here we are doing resume to avoid wiping CBMEM region - * again. */ - cbmem_initted = !cbmem_recovery(1); - #if CONFIG_HAVE_ACPI_RESUME /* If there is no high memory area, we didn't boot before, so * this is not a resume. In that case we just create the cbmem toc. */ - if (s3resume && cbmem_initted) { - void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME); + if (s3resume) { + void *resume_backup_memory; + + /* For non-S3-resume, CBMEM is inited in raminit code. */ + if (cbmem_recovery(1)) { + printk(BIOS_ERR, "Failed S3 resume.\n"); + ram_check(0x100000, 0x200000); + + /* Failed S3 resume, reset to come up cleanly */ + outb(0xe, 0xcf9); + hlt(); + } + + resume_backup_memory = cbmem_find(CBMEM_ID_RESUME); /* copy 1MB - 64K to high tables ram_base to prevent memory corruption * through stage 2. We could keep stuff like stack and heap in high tables @@ -351,13 +356,6 @@ void main(unsigned long bist) /* Magic for S3 resume */ pci_write_config32(PCI_DEV(0, 0x00, 0), SKPAD, 0xcafed00d); - } else if (s3resume) { - printk(BIOS_ERR, "Failed S3 resume.\n"); - ram_check(0x100000, 0x200000); - - /* Failed S3 resume, reset to come up cleanly */ - outb(0xe, 0xcf9); - hlt(); } else { pci_write_config32(PCI_DEV(0, 0x00, 0), SKPAD, 0xcafebabe); quick_ram_check(); |