rockchip: mkimage: pad the header to 8-bytes (using a 'nop') for RK3399
[oweals/u-boot.git] / tools / rkcommon.h
index b4f6f327dc17f85be0933dc927336ca153b5de33..3d645168c2656ac39cbeb0580bdd479f5222f4f8 100644 (file)
@@ -33,6 +33,19 @@ int rkcommon_check_params(struct image_tool_params *params);
  */
 const char *rkcommon_get_spl_hdr(struct image_tool_params *params);
 
+/**
+ * rkcommon_get_spl_hdr_padto8() - check if we need to pad to 8 bytes
+ *
+ * Rockchip's bootrom starts execution right after the SPL header (i.e.
+ * at offset 4), but we can not reasonably align the test section of
+ * an AArch64 SPL at 4 bytes (as this would break natural alignment
+ * and any embedded constants might cause an alignment exception, which
+ * is illegal in privileged modes).
+ *
+ * Padding is (for now) assumed to occur with a single AArch64 'nop'.
+ */
+const bool rkcommon_get_spl_hdr_padto8(struct image_tool_params *params);
+
 /**
  * rkcommon_get_spl_size() - get spl size for a Rockchip boot image
  *
@@ -77,4 +90,14 @@ bool rkcommon_need_rc4_spl(struct image_tool_params *params);
  */
 void rkcommon_rc4_encode_spl(void *buf, unsigned int offset, unsigned int size);
 
+/**
+ * rkcommon_vrec_header() - allocate memory for the header
+ *
+ * @params:     Pointer to the tool params structure
+ * @tparams:    Pointer tot the image type structure (for setting
+ *              the header and header_size)
+ */
+void rkcommon_vrec_header(struct image_tool_params *params,
+                         struct image_type_params *tparams);
+
 #endif