Intel (sandy/ivy): Avoid calling cbmem_initialize() twice

Delay the copying of MRC cache data from CAR to CBMEM until after
sdram_initialize() returns and cbmem_initialize() completes.
Calling cbmem_initialize() twice would complicate the decision logic
of when CBMEM area needs to be wiped clean.

Change-Id: Ic59e94cb2436293efc47b52f7418f5dbf76c714a
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/4666
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
Kyösti Mälkki 2014-01-04 11:02:45 +02:00
parent 1e5cacc8f8
commit 78938481eb
10 changed files with 18 additions and 6 deletions

View File

@ -245,6 +245,8 @@ void main(unsigned long bist)
MCHBAR16(SSKPD) = 0xCAFE; MCHBAR16(SSKPD) = 0xCAFE;
cbmem_was_initted = !cbmem_initialize(); cbmem_was_initted = !cbmem_initialize();
if (boot_mode!=2)
save_mrc_data(&pei_data);
#if CONFIG_HAVE_ACPI_RESUME #if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so /* If there is no high memory area, we didn't boot before, so

View File

@ -289,6 +289,8 @@ void main(unsigned long bist)
MCHBAR16(SSKPD) = 0xCAFE; MCHBAR16(SSKPD) = 0xCAFE;
cbmem_was_initted = !cbmem_initialize(); cbmem_was_initted = !cbmem_initialize();
if (boot_mode!=2)
save_mrc_data(&pei_data);
#if CONFIG_HAVE_ACPI_RESUME #if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so /* If there is no high memory area, we didn't boot before, so

View File

@ -245,6 +245,8 @@ void main(unsigned long bist)
MCHBAR16(SSKPD) = 0xCAFE; MCHBAR16(SSKPD) = 0xCAFE;
cbmem_was_initted = !cbmem_initialize(); cbmem_was_initted = !cbmem_initialize();
if (boot_mode!=2)
save_mrc_data(&pei_data);
#if CONFIG_HAVE_ACPI_RESUME #if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so /* If there is no high memory area, we didn't boot before, so

View File

@ -297,6 +297,8 @@ void main(unsigned long bist)
MCHBAR16(SSKPD) = 0xCAFE; MCHBAR16(SSKPD) = 0xCAFE;
cbmem_was_initted = !cbmem_initialize(); cbmem_was_initted = !cbmem_initialize();
if (boot_mode!=2)
save_mrc_data(&pei_data);
#if CONFIG_HAVE_ACPI_RESUME #if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so /* If there is no high memory area, we didn't boot before, so

View File

@ -297,6 +297,8 @@ void main(unsigned long bist)
MCHBAR16(SSKPD) = 0xCAFE; MCHBAR16(SSKPD) = 0xCAFE;
cbmem_was_initted = !cbmem_initialize(); cbmem_was_initted = !cbmem_initialize();
if (boot_mode!=2)
save_mrc_data(&pei_data);
#if CONFIG_HAVE_ACPI_RESUME #if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so /* If there is no high memory area, we didn't boot before, so

View File

@ -296,6 +296,8 @@ void main(unsigned long bist)
MCHBAR16(SSKPD) = 0xCAFE; MCHBAR16(SSKPD) = 0xCAFE;
cbmem_was_initted = !cbmem_initialize(); cbmem_was_initted = !cbmem_initialize();
if (boot_mode!=2)
save_mrc_data(&pei_data);
#if CONFIG_HAVE_ACPI_RESUME #if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so /* If there is no high memory area, we didn't boot before, so

View File

@ -318,6 +318,8 @@ void main(unsigned long bist)
MCHBAR16(SSKPD) = 0xCAFE; MCHBAR16(SSKPD) = 0xCAFE;
cbmem_was_initted = !cbmem_initialize(); cbmem_was_initted = !cbmem_initialize();
if (boot_mode!=2)
save_mrc_data(&pei_data);
#if CONFIG_HAVE_ACPI_RESUME #if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so /* If there is no high memory area, we didn't boot before, so

View File

@ -325,6 +325,8 @@ void main(unsigned long bist)
MCHBAR16(SSKPD) = 0xCAFE; MCHBAR16(SSKPD) = 0xCAFE;
cbmem_was_initted = !cbmem_initialize(); cbmem_was_initted = !cbmem_initialize();
if (boot_mode!=2)
save_mrc_data(&pei_data);
#if CONFIG_HAVE_ACPI_RESUME #if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so /* If there is no high memory area, we didn't boot before, so

View File

@ -54,7 +54,7 @@
#define CMOS_OFFSET_MRC_SEED_CHK 160 #define CMOS_OFFSET_MRC_SEED_CHK 160
#endif #endif
static void save_mrc_data(struct pei_data *pei_data) void save_mrc_data(struct pei_data *pei_data)
{ {
u16 c1, c2, checksum; u16 c1, c2, checksum;
@ -63,7 +63,6 @@ static void save_mrc_data(struct pei_data *pei_data)
int output_len = ALIGN(pei_data->mrc_output_len, 16); int output_len = ALIGN(pei_data->mrc_output_len, 16);
/* Save the MRC S3 restore data to cbmem */ /* Save the MRC S3 restore data to cbmem */
cbmem_initialize();
mrcdata = cbmem_add mrcdata = cbmem_add
(CBMEM_ID_MRCDATA, (CBMEM_ID_MRCDATA,
output_len + sizeof(struct mrc_data_container)); output_len + sizeof(struct mrc_data_container));
@ -297,8 +296,4 @@ void sdram_initialize(struct pei_data *pei_data)
post_system_agent_init(pei_data); post_system_agent_init(pei_data);
report_memory_config(); report_memory_config();
/* S3 resume: don't save scrambler seed or MRC data */
if (pei_data->boot_mode != 2)
save_mrc_data(pei_data);
} }

View File

@ -30,6 +30,7 @@ struct sys_info {
} __attribute__ ((packed)); } __attribute__ ((packed));
void sdram_initialize(struct pei_data *pei_data); void sdram_initialize(struct pei_data *pei_data);
void save_mrc_data(struct pei_data *pei_data);
int fixup_sandybridge_errata(void); int fixup_sandybridge_errata(void);
#endif /* RAMINIT_H */ #endif /* RAMINIT_H */