summaryrefslogtreecommitdiff
path: root/src/northbridge/intel/sandybridge
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2016-05-29 17:05:06 +0200
committerMartin Roth <martinroth@google.com>2016-06-12 12:27:32 +0200
commitbb9c90a2074ac0138a4d1083bf0d9f52a39b47d5 (patch)
tree364fb78606771e633c2829d5a0cdcb8147a22137 /src/northbridge/intel/sandybridge
parent70e03fea5bd3448058abe5d03764c17326a2c017 (diff)
downloadcoreboot-bb9c90a2074ac0138a4d1083bf0d9f52a39b47d5.tar.xz
nb/intel: Factor out common MRC code
Remove code duplication and use the common function store_current_mrc_cache instead. No functionality is changed. Tested on Sandybridge Lenovo T520. Change-Id: I4aa5463f1b1d5e1afbe44b4bfc659524d86204db Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/15074 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/northbridge/intel/sandybridge')
-rw-r--r--src/northbridge/intel/sandybridge/raminit.c25
-rw-r--r--src/northbridge/intel/sandybridge/raminit_mrc.c25
2 files changed, 3 insertions, 47 deletions
diff --git a/src/northbridge/intel/sandybridge/raminit.c b/src/northbridge/intel/sandybridge/raminit.c
index 1ed77ebd44..6bb77b2c6a 100644
--- a/src/northbridge/intel/sandybridge/raminit.c
+++ b/src/northbridge/intel/sandybridge/raminit.c
@@ -3938,31 +3938,10 @@ static void final_registers(ramctr_timing * ctrl)
| 0xc);
}
-static void save_timings(ramctr_timing * ctrl)
+static void save_timings(ramctr_timing *ctrl)
{
- struct mrc_data_container *mrcdata;
- int output_len = ALIGN(sizeof (*ctrl), 16);
-
/* Save the MRC S3 restore data to cbmem */
- mrcdata = cbmem_add
- (CBMEM_ID_MRCDATA,
- output_len + sizeof(struct mrc_data_container));
-
- printk(BIOS_DEBUG, "Relocate MRC DATA from %p to %p (%u bytes)\n",
- ctrl, mrcdata, output_len);
-
- mrcdata->mrc_signature = MRC_DATA_SIGNATURE;
- mrcdata->mrc_data_size = output_len;
- mrcdata->reserved = 0;
- memcpy(mrcdata->mrc_data, ctrl, sizeof (*ctrl));
-
- /* Zero the unused space in aligned buffer. */
- if (output_len > sizeof (*ctrl))
- memset(mrcdata->mrc_data+sizeof (*ctrl), 0,
- output_len - sizeof (*ctrl));
-
- mrcdata->mrc_checksum = compute_ip_checksum(mrcdata->mrc_data,
- mrcdata->mrc_data_size);
+ store_current_mrc_cache(ctrl, sizeof(*ctrl));
}
static void restore_timings(ramctr_timing * ctrl)
diff --git a/src/northbridge/intel/sandybridge/raminit_mrc.c b/src/northbridge/intel/sandybridge/raminit_mrc.c
index c26f012ff3..8754e4295c 100644
--- a/src/northbridge/intel/sandybridge/raminit_mrc.c
+++ b/src/northbridge/intel/sandybridge/raminit_mrc.c
@@ -52,32 +52,9 @@
void save_mrc_data(struct pei_data *pei_data)
{
u16 c1, c2, checksum;
- struct mrc_data_container *mrcdata;
- int output_len = ALIGN(pei_data->mrc_output_len, 16);
/* Save the MRC S3 restore data to cbmem */
- mrcdata = cbmem_add
- (CBMEM_ID_MRCDATA,
- output_len + sizeof(struct mrc_data_container));
-
- if (mrcdata != NULL) {
- printk(BIOS_DEBUG, "Relocate MRC DATA from %p to %p (%u bytes)\n",
- pei_data->mrc_output, mrcdata, output_len);
-
- mrcdata->mrc_signature = MRC_DATA_SIGNATURE;
- mrcdata->mrc_data_size = output_len;
- mrcdata->reserved = 0;
- memcpy(mrcdata->mrc_data, pei_data->mrc_output,
- pei_data->mrc_output_len);
-
- /* Zero the unused space in aligned buffer. */
- if (output_len > pei_data->mrc_output_len)
- memset(mrcdata->mrc_data+pei_data->mrc_output_len, 0,
- output_len - pei_data->mrc_output_len);
-
- mrcdata->mrc_checksum = compute_ip_checksum(mrcdata->mrc_data,
- mrcdata->mrc_data_size);
- }
+ store_current_mrc_cache(pei_data->mrc_output, pei_data->mrc_output_len);
/* Save the MRC seed values to CMOS */
cmos_write32(CMOS_OFFSET_MRC_SEED, pei_data->scrambler_seed);