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>
diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h
index 0e11ece..285674b 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;