]>
Commit | Line | Data |
---|---|---|
8edcde5e SB |
1 | /* |
2 | * (C) Copyright 2009 | |
3 | * Stefano Babic, DENX Software Engineering, [email protected]. | |
4 | * | |
5 | * See file CREDITS for list of people who contributed to this | |
6 | * project. | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public License as | |
10 | * published by the Free Software Foundation; either version 2 of | |
11 | * the License, or (at your option) any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with this program; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
21 | * MA 02111-1307 USA | |
22 | */ | |
23 | ||
24 | #ifndef _IMXIMAGE_H_ | |
25 | #define _IMXIMAGE_H_ | |
26 | ||
27 | #define MAX_HW_CFG_SIZE 60 /* Max number of registers imx can set */ | |
28 | #define MAX_EXP_SIZE 4 | |
29 | #define APP_CODE_BARKER 0xB1 | |
30 | #define DCD_BARKER 0xB17219E9 | |
31 | #define HEADER_OFFSET 0x400 | |
32 | ||
33 | ||
34 | #define CMD_DATA_STR "DATA" | |
35 | #define FLASH_OFFSET_STANDARD 0x400 | |
36 | #define FLASH_OFFSET_NAND FLASH_OFFSET_STANDARD | |
37 | #define FLASH_OFFSET_SD FLASH_OFFSET_STANDARD | |
38 | #define FLASH_OFFSET_SPI FLASH_OFFSET_STANDARD | |
39 | #define FLASH_OFFSET_ONENAND 0x100 | |
40 | ||
41 | enum imximage_cmd { | |
42 | CMD_INVALID, | |
43 | CMD_BOOT_FROM, | |
44 | CMD_DATA | |
45 | }; | |
46 | ||
47 | enum imximage_fld_types { | |
48 | CFG_INVALID = -1, | |
49 | CFG_COMMAND, | |
50 | CFG_REG_SIZE, | |
51 | CFG_REG_ADDRESS, | |
52 | CFG_REG_VALUE | |
53 | }; | |
54 | ||
55 | typedef struct { | |
56 | uint8_t rsa_exponent[MAX_EXP_SIZE]; /* RSA public exponent */ | |
57 | uint8_t *rsa_modulus; /* RSA modulus pointer */ | |
58 | uint16_t exponent_size; /* Exponent size (bytes) */ | |
59 | uint16_t modulus_size; /* Modulus size (bytes) */ | |
60 | uint8_t init_flag; /* key initialized */ | |
61 | } hab_rsa_public_key; | |
62 | ||
63 | typedef struct { | |
64 | uint32_t type; /* Type of pointer (byte, halfword, word, wait/read) */ | |
65 | uint32_t addr; /* Address to write to */ | |
66 | uint32_t value; /* Data to write */ | |
67 | } dcd_type_addr_data_t; | |
68 | ||
69 | typedef struct { | |
70 | uint32_t barker; /* Barker for sanity check */ | |
71 | uint32_t length; /* Device configuration length (without preamble) */ | |
72 | } dcd_preamble_t; | |
73 | ||
74 | typedef struct { | |
75 | dcd_preamble_t preamble; | |
76 | dcd_type_addr_data_t addr_data[MAX_HW_CFG_SIZE]; | |
77 | } dcd_t; | |
78 | ||
79 | typedef struct { | |
80 | uint32_t app_code_jump_vector; | |
81 | uint32_t app_code_barker; | |
82 | uint32_t app_code_csf; | |
83 | uint32_t dcd_ptr_ptr; | |
5b28e913 | 84 | uint32_t super_root_key; |
8edcde5e SB |
85 | uint32_t dcd_ptr; |
86 | uint32_t app_dest_ptr; | |
87 | } flash_header_t; | |
88 | ||
89 | typedef struct { | |
90 | uint32_t length; /* Length of data to be read from flash */ | |
91 | } flash_cfg_parms_t; | |
92 | ||
93 | struct imx_header { | |
94 | flash_header_t fhdr; | |
95 | dcd_t dcd_table; | |
96 | flash_cfg_parms_t ext_header; | |
97 | uint32_t flash_offset; | |
98 | }; | |
99 | ||
100 | struct reg_config { | |
101 | uint32_t raddr; | |
102 | uint32_t rdata; | |
103 | }; | |
104 | ||
105 | #endif /* _IMXIMAGE_H_ */ |