nds32: Remove the architecture
[platform/kernel/u-boot.git] / include / image.h
index 97e5f2e..e4c6a50 100644 (file)
@@ -48,6 +48,7 @@ struct fdt_region;
 extern ulong image_load_addr;          /* Default Load Address */
 extern ulong image_save_addr;          /* Default Save Address */
 extern ulong image_save_size;          /* Default Save Size */
+extern ulong image_load_offset;        /* Default Load Address Offset */
 
 /* An invalid size, meaning that the image size is not known */
 #define IMAGE_SIZE_INVAL       (-1UL)
@@ -227,6 +228,7 @@ enum {
        IH_TYPE_IMX8IMAGE,              /* Freescale IMX8Boot Image     */
        IH_TYPE_COPRO,                  /* Coprocessor Image for remoteproc*/
        IH_TYPE_SUNXI_EGON,             /* Allwinner eGON Boot Image */
+       IH_TYPE_SUNXI_TOC0,             /* Allwinner TOC0 Boot Image */
 
        IH_TYPE_COUNT,                  /* Number of image types */
 };
@@ -350,6 +352,7 @@ typedef struct bootm_headers {
 #define        BOOTM_STATE_OS_PREP     (0x00000100)
 #define        BOOTM_STATE_OS_FAKE_GO  (0x00000200)    /* 'Almost' run the OS */
 #define        BOOTM_STATE_OS_GO       (0x00000400)
+#define        BOOTM_STATE_PRE_LOAD    0x00000800
        int             state;
 
 #if defined(CONFIG_LMB) && !defined(USE_HOSTCC)
@@ -1017,6 +1020,21 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
 
 int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
 
+/**
+ * fit_pre_load_data() - add public key to fdt blob
+ *
+ * Adds public key to the node pre load.
+ *
+ * @keydir:    Directory containing keys
+ * @keydest:   FDT blob to write public key
+ * @fit:       Pointer to the FIT format image header
+ *
+ * returns:
+ *     0, on success
+ *     < 0, on failure
+ */
+int fit_pre_load_data(const char *keydir, void *keydest, void *fit);
+
 int fit_cipher_data(const char *keydir, void *keydest, void *fit,
                    const char *comment, int require_keys,
                    const char *engine_id, const char *cmdname);
@@ -1291,7 +1309,7 @@ ll_entry_declare(struct crypto_algo, __name, cryptos)
 struct padding_algo {
        const char *name;
        int (*verify)(struct image_sign_info *info,
-                     uint8_t *pad, int pad_len,
+                     const uint8_t *pad, int pad_len,
                      const uint8_t *hash, int hash_len);
 };
 
@@ -1324,6 +1342,19 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name);
 struct padding_algo *image_get_padding_algo(const char *name);
 
 /**
+ * image_pre_load() - Manage pre load header
+ *
+ * Manage the pre-load header before launching the image.
+ * It checks the signature of the image. It also set the
+ * variable image_load_offset to skip this header before
+ * launching the image.
+ *
+ * @param addr         Address of the image
+ * @return: 0 on success, -ve on error
+ */
+int image_pre_load(ulong addr);
+
+/**
  * fit_image_verify_required_sigs() - Verify signatures marked as 'required'
  *
  * @fit:               FIT to check