summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2024-02-29 09:24:49 -0500
committerTom Rini <[email protected]>2024-02-29 09:24:49 -0500
commitea3348ebc215d2a9d6dd14f40fb7e8c86dc45e4a (patch)
tree095062630056cd16bd398e01d896c43b0d089090 /include
parentcfc3e1db499d7d4307559cc911aa914dd131f945 (diff)
parent2b71470628c035ce3ccc76d12e50bdc453bdbc93 (diff)
Merge patch series "Handoff bloblist from previous boot stage"
Raymond Mao <[email protected]> says: This patch set adds/adapts a few bloblist APIs and implements Arm arch custom function to retrieve the bloblist (aka. Transfer List) from previous loader via boot arguments when BLOBLIST option is enabled and all boot arguments are compliant to the register conventions defined in the Firmware Handoff spec v0.9. If an arch wishes to have different behaviors for loading bloblist from the previous boot stage, it is required to implement the custom function xferlist_from_boot_arg().
Diffstat (limited to 'include')
-rw-r--r--include/bloblist.h47
1 files changed, 39 insertions, 8 deletions
diff --git a/include/bloblist.h b/include/bloblist.h
index 84fc9438191..7fbdd622bcf 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,
@@ -341,12 +348,13 @@ int bloblist_new(ulong addr, uint size, uint flags, uint align_log2);
* bloblist_check() - Check if a bloblist exists
*
* @addr: Address of bloblist
- * @size: Expected size of blobsize, or 0 to detect the size
+ * @size: Reserved space size for blobsize, or 0 to use the total size
* Return: 0 if OK, -ENOENT if the magic number doesn't match (indicating that
- * there problem is no bloblist at the given address), -EPROTONOSUPPORT
+ * there problem is no bloblist at the given address) or any fields for header
+ * size, used size and total size do not match, -EPROTONOSUPPORT
* if the version does not match, -EIO if the checksum does not match,
- * -EFBIG if the expected size does not match the detected size, -ENOSPC
- * if the size is not large enough to hold the headers
+ * -EFBIG if the reserved space size is small than the total size or total size
+ * is 0
*/
int bloblist_check(ulong addr, uint size);
@@ -418,11 +426,11 @@ const char *bloblist_tag_name(enum bloblist_tag_t tag);
* bloblist_reloc() - Relocate the bloblist and optionally resize it
*
* @to: Pointer to new bloblist location (must not overlap old location)
- * @to_size: New size for bloblist (must be larger than from_size)
- * @from: Pointer to bloblist to relocate
- * @from_size: Size of bloblist to relocate
+ * @to_size: New size for bloblist
+ * Return: 0 if OK, -ENOSPC if the new size is small than the bloblist total
+ * size.
*/
-void bloblist_reloc(void *to, uint to_size, void *from, uint from_size);
+int bloblist_reloc(void *to, uint to_size);
/**
* bloblist_init() - Init the bloblist system with a single bloblist
@@ -461,4 +469,27 @@ 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);
+
+/**
+ * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
+ * to the specified address.
+ *
+ * @addr: Address for the bloblist
+ * @size: Size of space reserved for the bloblist
+ * Return: 0 if OK, else on error
+ */
+int xferlist_from_boot_arg(ulong addr, ulong size);
+
#endif /* __BLOBLIST_H */