bcm963xx_tag.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __LINUX_BCM963XX_TAG_H__
  3. #define __LINUX_BCM963XX_TAG_H__
  4. #include <linux/types.h>
  5. #define TAGVER_LEN 4 /* Length of Tag Version */
  6. #define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */
  7. #define SIG1_LEN 20 /* Company Signature 1 Length */
  8. #define SIG2_LEN 14 /* Company Signature 2 Length */
  9. #define BOARDID_LEN 16 /* Length of BoardId */
  10. #define ENDIANFLAG_LEN 2 /* Endian Flag Length */
  11. #define CHIPID_LEN 6 /* Chip Id Length */
  12. #define IMAGE_LEN 10 /* Length of Length Field */
  13. #define ADDRESS_LEN 12 /* Length of Address field */
  14. #define IMAGE_SEQUENCE_LEN 4 /* Image sequence Length */
  15. #define RSASIG_LEN 20 /* Length of RSA Signature in tag */
  16. #define TAGINFO1_LEN 30 /* Length of vendor information field1 in tag */
  17. #define FLASHLAYOUTVER_LEN 4 /* Length of Flash Layout Version String tag */
  18. #define TAGINFO2_LEN 16 /* Length of vendor information field2 in tag */
  19. #define ALTTAGINFO_LEN 54 /* Alternate length for vendor information; Pirelli */
  20. #define NUM_PIRELLI 2
  21. #define IMAGETAG_CRC_START 0xFFFFFFFF
  22. #define PIRELLI_BOARDS { \
  23. "AGPF-S0", \
  24. "DWV-S0", \
  25. }
  26. /* Extended flash address, needs to be subtracted
  27. * from bcm_tag flash image offsets.
  28. */
  29. #define BCM963XX_EXTENDED_SIZE 0xBFC00000
  30. /*
  31. * The broadcom firmware assumes the rootfs starts the image,
  32. * therefore uses the rootfs start (flash_image_address)
  33. * to determine where to flash the image. Since we have the kernel first
  34. * we have to give it the kernel address, but the crc uses the length
  35. * associated with this address (root_length), which is added to the kernel
  36. * length (kernel_length) to determine the length of image to flash and thus
  37. * needs to be rootfs + deadcode (jffs2 EOF marker)
  38. */
  39. struct bcm_tag {
  40. /* 0-3: Version of the image tag */
  41. char tag_version[TAGVER_LEN];
  42. /* 4-23: Company Line 1 */
  43. char sig_1[SIG1_LEN];
  44. /* 24-37: Company Line 2 */
  45. char sig_2[SIG2_LEN];
  46. /* 38-43: Chip this image is for */
  47. char chip_id[CHIPID_LEN];
  48. /* 44-59: Board name */
  49. char board_id[BOARDID_LEN];
  50. /* 60-61: Map endianness -- 1 BE 0 LE */
  51. char big_endian[ENDIANFLAG_LEN];
  52. /* 62-71: Total length of image */
  53. char total_length[IMAGE_LEN];
  54. /* 72-83: Address in memory of CFE */
  55. char cfe__address[ADDRESS_LEN];
  56. /* 84-93: Size of CFE */
  57. char cfe_length[IMAGE_LEN];
  58. /* 94-105: Address in memory of image start
  59. * (kernel for OpenWRT, rootfs for stock firmware)
  60. */
  61. char flash_image_start[ADDRESS_LEN];
  62. /* 106-115: Size of rootfs */
  63. char root_length[IMAGE_LEN];
  64. /* 116-127: Address in memory of kernel */
  65. char kernel_address[ADDRESS_LEN];
  66. /* 128-137: Size of kernel */
  67. char kernel_length[IMAGE_LEN];
  68. /* 138-141: Image sequence number
  69. * (to be incremented when flashed with a new image)
  70. */
  71. char image_sequence[IMAGE_SEQUENCE_LEN];
  72. /* 142-161: RSA Signature (not used; some vendors may use this) */
  73. char rsa_signature[RSASIG_LEN];
  74. /* 162-191: Compilation and related information (not used in OpenWrt) */
  75. char information1[TAGINFO1_LEN];
  76. /* 192-195: Version flash layout */
  77. char flash_layout_ver[FLASHLAYOUTVER_LEN];
  78. /* 196-199: kernel+rootfs CRC32 */
  79. __u32 fskernel_crc;
  80. /* 200-215: Unused except on Alice Gate where is is information */
  81. char information2[TAGINFO2_LEN];
  82. /* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
  83. __u32 image_crc;
  84. /* 220-223: CRC32 of rootfs partition */
  85. __u32 rootfs_crc;
  86. /* 224-227: CRC32 of kernel partition */
  87. __u32 kernel_crc;
  88. /* 228-235: Unused at present */
  89. char reserved1[8];
  90. /* 236-239: CRC32 of header excluding last 20 bytes */
  91. __u32 header_crc;
  92. /* 240-255: Unused at present */
  93. char reserved2[16];
  94. };
  95. #endif /* __LINUX_BCM63XX_TAG_H__ */