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