diff options
author | Raymond Mao <raymond.mao@linaro.org> | 2024-02-03 08:36:20 -0800 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-02-29 09:24:21 -0500 |
commit | 1c4751fd1ac7bda72ab72ce352dc9b2131df2807 (patch) | |
tree | 0a5ca1167fe606aace81f1407395e8dbf92698aa | |
parent | 819abd0a1eaff9a921f5b917e152b85dab302e33 (diff) | |
download | u-boot-1c4751fd1ac7bda72ab72ce352dc9b2131df2807.zip u-boot-1c4751fd1ac7bda72ab72ce352dc9b2131df2807.tar.gz u-boot-1c4751fd1ac7bda72ab72ce352dc9b2131df2807.tar.bz2 |
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 <raymond.mao@linaro.org>
-rw-r--r-- | common/bloblist.c | 11 | ||||
-rw-r--r-- | include/bloblist.h | 20 |
2 files changed, 31 insertions, 0 deletions
diff --git a/common/bloblist.c b/common/bloblist.c index 2d37391..980b1dd 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; +} diff --git a/include/bloblist.h b/include/bloblist.h index 84fc943..f7e800f 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -78,6 +78,13 @@ enum { BLOBLIST_VERSION = 1, BLOBLIST_MAGIC = 0x4a0fb10b, + /* + * FIXME: + * Register convention version should be placed into a higher byte + * https://github.com/FirmwareHandoff/firmware_handoff/issues/32 + */ + BLOBLIST_REGCONV_VER = 1 << 24, + BLOBLIST_BLOB_ALIGN_LOG2 = 3, BLOBLIST_BLOB_ALIGN = 1 << BLOBLIST_BLOB_ALIGN_LOG2, @@ -461,4 +468,17 @@ static inline int bloblist_maybe_init(void) } #endif /* BLOBLIST */ +/** + * bloblist_check_reg_conv() - Check whether the bloblist is compliant to + * the register conventions according to the + * Firmware Handoff spec. + * + * @rfdt: Register that holds the FDT base address. + * @rzero: Register that must be zero. + * @rsig: Register that holds signature and register conventions version. + * Return: 0 if OK, -EIO if the bloblist is not compliant to the register + * conventions. + */ +int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig); + #endif /* __BLOBLIST_H */ |