diff options
author | Lean Sheng Tan <lean.sheng.tan@intel.com> | 2021-06-15 23:44:20 -0700 |
---|---|---|
committer | Werner Zeh <werner.zeh@siemens.com> | 2021-06-18 06:03:16 +0000 |
commit | fefc2ea4c41a1a786fb0b0dc890da1d1370f0731 (patch) | |
tree | 9aeda447cf7cb66764b6d37bf3f4bcc9196d0319 /src | |
parent | 9bb8aac53e8d06afaa710df8c6e2e3e8b0221c9c (diff) |
intel/fsp2_0: Add FSP_ARRAY_LOAD macro
Add FSP_ARRAY_LOAD macro for checking and loading
array type configs into array type UPDs to increase readability.
Signed-off-by: Lean Sheng Tan <lean.sheng.tan@intel.com>
Change-Id: I307340a2bfc0a54f2ab7241af2f24dfbf8bb111d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55559
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/intel/fsp2_0/include/fsp/util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h index 0e11eceda4..285674b912 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/util.h +++ b/src/drivers/intel/fsp2_0/include/fsp/util.h @@ -15,6 +15,13 @@ #define FSP_VER_LEN 30 +/* Macro for checking and loading array type configs into array type UPDs */ +#define FSP_ARRAY_LOAD(dst, src) \ +do { \ + _Static_assert(ARRAY_SIZE(dst) >= ARRAY_SIZE(src), "copy buffer overflow!"); \ + memcpy(dst, src, sizeof(src)); \ +} while (0) + struct hob_header { uint16_t type; uint16_t length; |