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>
This commit is contained in:
Lean Sheng Tan 2021-06-15 23:44:20 -07:00 committed by Werner Zeh
parent 9bb8aac53e
commit fefc2ea4c4
1 changed files with 7 additions and 0 deletions

View File

@ -15,6 +15,13 @@
#define FSP_VER_LEN 30 #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 { struct hob_header {
uint16_t type; uint16_t type;
uint16_t length; uint16_t length;