From 969f8617e9ff4e71a11a8fc4567e8c8de33585a0 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 22 Jan 2014 21:41:34 +0100 Subject: lenovo/x201: Reinit CBMEM only on S3 resume. Change-Id: I0643cdab10cda3f19ab56223f5fa77376a8046ac Signed-off-by: Vladimir Serbinenko Reviewed-on: http://review.coreboot.org/4782 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/mainboard/lenovo/x201/romstage.c | 30 ++++++++++++++---------------- 1 file 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(); -- cgit v1.2.3