summaryrefslogtreecommitdiff
path: root/tools/imximage.h
diff options
context:
space:
mode:
authorLiu Hui-R64343 <r64343@freescale.com>2011-01-19 09:40:26 +0000
committerAlbert Aribaud <albert.aribaud@free.fr>2011-02-02 00:54:42 +0100
commit8a1edd7d54096ed28232a6cfec7288cd0426d988 (patch)
treedb6abbbf0c9fb3691c48505debd485be913f833a /tools/imximage.h
parentc4a3c7442bfcd226da8fe8747c3d7141fc531348 (diff)
downloadu-boot-imx-8a1edd7d54096ed28232a6cfec7288cd0426d988.zip
u-boot-imx-8a1edd7d54096ed28232a6cfec7288cd0426d988.tar.gz
u-boot-imx-8a1edd7d54096ed28232a6cfec7288cd0426d988.tar.bz2
imximage: Add MX53 boot image support
This patch add the MX53 boot image support. This patch has been tested on Freescale MX53EVK board and MX51EVK board. Signed-off-by: Jason Liu <r64343@freescale.com>
Diffstat (limited to 'tools/imximage.h')
-rw-r--r--tools/imximage.h110
1 files changed, 90 insertions, 20 deletions
diff --git a/tools/imximage.h b/tools/imximage.h
index b4d926d..38ca6be 100644
--- a/tools/imximage.h
+++ b/tools/imximage.h
@@ -24,12 +24,14 @@
#ifndef _IMXIMAGE_H_
#define _IMXIMAGE_H_
-#define MAX_HW_CFG_SIZE 60 /* Max number of registers imx can set */
-#define MAX_EXP_SIZE 4
+#include <config.h>
+
+#define MAX_HW_CFG_SIZE_V2 121 /* Max number of registers imx can set for v2 */
+#define MAX_HW_CFG_SIZE_V1 60 /* Max number of registers imx can set for v1 */
#define APP_CODE_BARKER 0xB1
#define DCD_BARKER 0xB17219E9
-#define HEADER_OFFSET 0x400
+#define HEADER_OFFSET 0x400
#define CMD_DATA_STR "DATA"
#define FLASH_OFFSET_STANDARD 0x400
@@ -38,8 +40,16 @@
#define FLASH_OFFSET_SPI FLASH_OFFSET_STANDARD
#define FLASH_OFFSET_ONENAND 0x100
+#define IVT_HEADER_TAG 0xD1
+#define IVT_VERSION 0x40
+#define DCD_HEADER_TAG 0xD2
+#define DCD_COMMAND_TAG 0xCC
+#define DCD_VERSION 0x40
+#define DCD_COMMAND_PARAM 0x4
+
enum imximage_cmd {
CMD_INVALID,
+ CMD_IMAGE_VERSION,
CMD_BOOT_FROM,
CMD_DATA
};
@@ -52,13 +62,11 @@ enum imximage_fld_types {
CFG_REG_VALUE
};
-typedef struct {
- uint8_t rsa_exponent[MAX_EXP_SIZE]; /* RSA public exponent */
- uint8_t *rsa_modulus; /* RSA modulus pointer */
- uint16_t exponent_size; /* Exponent size (bytes) */
- uint16_t modulus_size; /* Modulus size (bytes) */
- uint8_t init_flag; /* key initialized */
-} hab_rsa_public_key;
+enum imximage_version {
+ IMXIMAGE_VER_INVALID = -1,
+ IMXIMAGE_V1 = 1,
+ IMXIMAGE_V2
+};
typedef struct {
uint32_t type; /* Type of pointer (byte, halfword, word, wait/read) */
@@ -73,8 +81,8 @@ typedef struct {
typedef struct {
dcd_preamble_t preamble;
- dcd_type_addr_data_t addr_data[MAX_HW_CFG_SIZE];
-} dcd_t;
+ dcd_type_addr_data_t addr_data[MAX_HW_CFG_SIZE_V1];
+} dcd_v1_t;
typedef struct {
uint32_t app_code_jump_vector;
@@ -84,22 +92,84 @@ typedef struct {
uint32_t super_root_key;
uint32_t dcd_ptr;
uint32_t app_dest_ptr;
-} flash_header_t;
+} flash_header_v1_t;
typedef struct {
uint32_t length; /* Length of data to be read from flash */
} flash_cfg_parms_t;
-struct imx_header {
- flash_header_t fhdr;
- dcd_t dcd_table;
+typedef struct {
+ flash_header_v1_t fhdr;
+ dcd_v1_t dcd_table;
flash_cfg_parms_t ext_header;
+} imx_header_v1_t;
+
+typedef struct {
+ uint32_t addr;
+ uint32_t value;
+} dcd_addr_data_t;
+
+typedef struct {
+ uint8_t tag;
+ uint16_t length;
+ uint8_t version;
+} __attribute__((packed)) ivt_header_t;
+
+typedef struct {
+ uint8_t tag;
+ uint16_t length;
+ uint8_t param;
+} __attribute__((packed)) write_dcd_command_t;
+
+typedef struct {
+ ivt_header_t header;
+ write_dcd_command_t write_dcd_command;
+ dcd_addr_data_t addr_data[MAX_HW_CFG_SIZE_V2];
+} dcd_v2_t;
+
+typedef struct {
+ uint32_t start;
+ uint32_t size;
+ uint32_t plugin;
+} boot_data_t;
+
+typedef struct {
+ ivt_header_t header;
+ uint32_t entry;
+ uint32_t reserved1;
+ uint32_t dcd_ptr;
+ uint32_t boot_data_ptr;
+ uint32_t self;
+ uint32_t csf;
+ uint32_t reserved2;
+} flash_header_v2_t;
+
+typedef struct {
+ flash_header_v2_t fhdr;
+ boot_data_t boot_data;
+ dcd_v2_t dcd_table;
+} imx_header_v2_t;
+
+struct imx_header {
+ union {
+ imx_header_v1_t hdr_v1;
+ imx_header_v2_t hdr_v2;
+ } header;
uint32_t flash_offset;
};
-struct reg_config {
- uint32_t raddr;
- uint32_t rdata;
-};
+typedef void (*set_dcd_val_t)(struct imx_header *imxhdr,
+ char *name, int lineno,
+ int fld, uint32_t value,
+ uint32_t off);
+
+typedef void (*set_dcd_rst_t)(struct imx_header *imxhdr,
+ uint32_t dcd_len,
+ char *name, int lineno);
+
+typedef void (*set_imx_hdr_t)(struct imx_header *imxhdr,
+ uint32_t dcd_len,
+ struct stat *sbuf,
+ struct mkimage_params *params);
#endif /* _IMXIMAGE_H_ */