From 1c4751fd1ac7bda72ab72ce352dc9b2131df2807 Mon Sep 17 00:00:00 2001 From: Raymond Mao Date: Sat, 3 Feb 2024 08:36:20 -0800 Subject: bloblist: add API to check the register conventions Add bloblist_check_reg_conv() to check whether the bloblist is compliant to the register conventions defined in Firmware Handoff specification. This API can be used for all Arm platforms. Signed-off-by: Raymond Mao --- common/bloblist.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'common/bloblist.c') diff --git a/common/bloblist.c b/common/bloblist.c index 2d373910b6d..980b1ddbcb4 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -542,3 +542,14 @@ int bloblist_maybe_init(void) return 0; } + +int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig) +{ + if (rzero || rsig != (BLOBLIST_MAGIC | BLOBLIST_REGCONV_VER) || + rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) { + gd->bloblist = NULL; /* Reset the gd bloblist pointer */ + return -EIO; + } + + return 0; +} -- cgit v1.2.3