summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2022-02-02 20:09:27 +0100
committerMartin Roth <martinroth@google.com>2022-02-10 21:26:09 +0000
commit1ba6049ad92c9dbc0f5a388d6211ba25bf989cc0 (patch)
tree170a140e02032e2e05db92e5df6c15f89851c0e7 /src/drivers
parentb8a23013c5952bcde1201d1e1181a965380dc12a (diff)
drivers/smmstore/store.c: Add static assertion based on fmap
Instead of having runtime failures that are hard to debug because SMM debugging is disabled by default assert some properties of fmap at buildtime. Change-Id: I5b5b511142d93d5799565a8936e9a087117044b3 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61562 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/smmstore/store.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/smmstore/store.c b/src/drivers/smmstore/store.c
index 24e8a88edd..6ba3f53695 100644
--- a/src/drivers/smmstore/store.c
+++ b/src/drivers/smmstore/store.c
@@ -2,6 +2,7 @@
#include <boot_device.h>
#include <fmap.h>
+#include <fmap_config.h>
#include <commonlib/helpers.h>
#include <commonlib/region.h>
#include <console/console.h>
@@ -10,6 +11,13 @@
#define SMMSTORE_REGION "SMMSTORE"
+
+_Static_assert(IS_ALIGNED(FMAP_SECTION_SMMSTORE_START, SMM_BLOCK_SIZE),
+ "SMMSTORE FMAP region not aligned to 64K");
+
+_Static_assert(SMM_BLOCK_SIZE <= FMAP_SECTION_SMMSTORE_SIZE,
+ "SMMSTORE FMAP region must be at least 64K");
+
/*
* The region format is still not finalized, but so far it looks like this:
* (