imximage.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * (C) Copyright 2009
  3. * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
  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. #ifndef _IMXIMAGE_H_
  24. #define _IMXIMAGE_H_
  25. #define MAX_HW_CFG_SIZE 60 /* Max number of registers imx can set */
  26. #define MAX_EXP_SIZE 4
  27. #define APP_CODE_BARKER 0xB1
  28. #define DCD_BARKER 0xB17219E9
  29. #define HEADER_OFFSET 0x400
  30. #define CMD_DATA_STR "DATA"
  31. #define FLASH_OFFSET_STANDARD 0x400
  32. #define FLASH_OFFSET_NAND FLASH_OFFSET_STANDARD
  33. #define FLASH_OFFSET_SD FLASH_OFFSET_STANDARD
  34. #define FLASH_OFFSET_SPI FLASH_OFFSET_STANDARD
  35. #define FLASH_OFFSET_ONENAND 0x100
  36. enum imximage_cmd {
  37. CMD_INVALID,
  38. CMD_BOOT_FROM,
  39. CMD_DATA
  40. };
  41. enum imximage_fld_types {
  42. CFG_INVALID = -1,
  43. CFG_COMMAND,
  44. CFG_REG_SIZE,
  45. CFG_REG_ADDRESS,
  46. CFG_REG_VALUE
  47. };
  48. typedef struct {
  49. uint8_t rsa_exponent[MAX_EXP_SIZE]; /* RSA public exponent */
  50. uint8_t *rsa_modulus; /* RSA modulus pointer */
  51. uint16_t exponent_size; /* Exponent size (bytes) */
  52. uint16_t modulus_size; /* Modulus size (bytes) */
  53. uint8_t init_flag; /* key initialized */
  54. } hab_rsa_public_key;
  55. typedef struct {
  56. uint32_t type; /* Type of pointer (byte, halfword, word, wait/read) */
  57. uint32_t addr; /* Address to write to */
  58. uint32_t value; /* Data to write */
  59. } dcd_type_addr_data_t;
  60. typedef struct {
  61. uint32_t barker; /* Barker for sanity check */
  62. uint32_t length; /* Device configuration length (without preamble) */
  63. } dcd_preamble_t;
  64. typedef struct {
  65. dcd_preamble_t preamble;
  66. dcd_type_addr_data_t addr_data[MAX_HW_CFG_SIZE];
  67. } dcd_t;
  68. typedef struct {
  69. uint32_t app_code_jump_vector;
  70. uint32_t app_code_barker;
  71. uint32_t app_code_csf;
  72. uint32_t dcd_ptr_ptr;
  73. uint32_t super_root_key;
  74. uint32_t dcd_ptr;
  75. uint32_t app_dest_ptr;
  76. } flash_header_t;
  77. typedef struct {
  78. uint32_t length; /* Length of data to be read from flash */
  79. } flash_cfg_parms_t;
  80. struct imx_header {
  81. flash_header_t fhdr;
  82. dcd_t dcd_table;
  83. flash_cfg_parms_t ext_header;
  84. uint32_t flash_offset;
  85. };
  86. struct reg_config {
  87. uint32_t raddr;
  88. uint32_t rdata;
  89. };
  90. #endif /* _IMXIMAGE_H_ */