summaryrefslogtreecommitdiff
path: root/src/northbridge/intel/nehalem
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-06-15 15:59:44 +0300
committerPatrick Georgi <patrick@georgi-clan.de>2014-06-25 11:41:14 +0200
commit743a218a6098fc2433c844214651d0c3624d08ad (patch)
treef4c29975920a16f5a1a215b404632372cfa646f3 /src/northbridge/intel/nehalem
parentb0cbb2cd174a55098135f3419c50ad2a8f72a1eb (diff)
downloadcoreboot-743a218a6098fc2433c844214651d0c3624d08ad.tar.xz
nehalem sandy ivy: Check cbmem_add() result for MRC data
In theory we could run out of CBMEM space so check the entry was added. There is no interest to support builds without EARLY_CBMEM_INIT. Change-Id: I68dd7c20e3d3692331aaafa2a692c5c0dfce95d5 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/6033 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com>
Diffstat (limited to 'src/northbridge/intel/nehalem')
-rw-r--r--src/northbridge/intel/nehalem/raminit.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c
index 21cc987bff..a2960f6e00 100644
--- a/src/northbridge/intel/nehalem/raminit.c
+++ b/src/northbridge/intel/nehalem/raminit.c
@@ -1687,7 +1687,6 @@ static void dump_timings(struct raminfo *info)
*/
static void save_timings(struct raminfo *info)
{
-#if CONFIG_EARLY_CBMEM_INIT
struct ram_training train;
struct mrc_data_container *mrcdata;
int output_len = ALIGN(sizeof(train), 16);
@@ -1722,22 +1721,23 @@ static void save_timings(struct raminfo *info)
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",
- &train, mrcdata, output_len);
+ if (mrcdata != NULL) {
+ printk(BIOS_DEBUG, "Relocate MRC DATA from %p to %p (%u bytes)\n",
+ &train, mrcdata, output_len);
- mrcdata->mrc_signature = MRC_DATA_SIGNATURE;
- mrcdata->mrc_data_size = output_len;
- mrcdata->reserved = 0;
- memcpy(mrcdata->mrc_data, &train, sizeof(train));
+ mrcdata->mrc_signature = MRC_DATA_SIGNATURE;
+ mrcdata->mrc_data_size = output_len;
+ mrcdata->reserved = 0;
+ memcpy(mrcdata->mrc_data, &train, sizeof(train));
- /* Zero the unused space in aligned buffer. */
- if (output_len > sizeof(train))
- memset(mrcdata->mrc_data + sizeof(train), 0,
- output_len - sizeof(train));
+ /* Zero the unused space in aligned buffer. */
+ if (output_len > sizeof(train))
+ memset(mrcdata->mrc_data + sizeof(train), 0,
+ output_len - sizeof(train));
- mrcdata->mrc_checksum = compute_ip_checksum(mrcdata->mrc_data,
- mrcdata->mrc_data_size);
-#endif
+ mrcdata->mrc_checksum = compute_ip_checksum(mrcdata->mrc_data,
+ mrcdata->mrc_data_size);
+ }
}
#if REAL