The attached patch adds building of firmware
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / files / include / asm-mips / mach-bcm63xx / bcm_tag.h
1 #ifndef __BCM63XX_TAG_H
2 #define __BCM63XX_TAG_H
3
4 #define IMAGE_LEN 10 /* Length of Length Field */
5 #define ADDRESS_LEN 12 /* Length of Address field */
6 #define TAGID_LEN 6 /* Length of tag ID */
7 #define TAGINFO_LEN 20 /* Length of vendor information field in tag */
8 #define TAGVER_LEN 4 /* Length of Tag Version */
9 #define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */
10
11 #define NUM_TAGID 5
12 #define IMAGETAG_CRC_START 0xFFFFFFFF
13
14 struct tagiddesc_t {
15 char tagid[TAGID_LEN + 1];
16 char tagiddesc[80];
17 };
18
19 // bc221 is used by BT Voyager and should be right
20 // bc310 should be right, and may apply to 3.08 code as well
21 #define TAGID_DEFINITIONS { \
22 { "bccfe", "Broadcom CFE flash image" }, \
23 { "bc300", "Broadcom code version 3.00-3.06 and all ftp/tftp flash" }, \
24 { "ag306", "Alice Gate (Pirelli, based on Broadcom 3.06)" }, \
25 { "bc221", "Broadcom code version 2.21" }, \
26 { "bc310", "Broadcom code version 3.10-3.12" }, \
27 }
28
29 struct bcm_tag_bccfe {
30 unsigned char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag
31 unsigned char sig_1[20]; // 4-23: Company Line 1
32 unsigned char sig_2[14]; // 24-37: Company Line 2
33 unsigned char chipid[6]; // 38-43: Chip this image is for
34 unsigned char boardid[16]; // 44-59: Board name
35 unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE
36 unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image
37 unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE
38 unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE
39 unsigned char rootAddress[ADDRESS_LEN]; // 94-105: Address in memory of rootfs
40 unsigned char rootLength[IMAGE_LEN]; // 106-115: Size of rootfs
41 unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel
42 unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel
43 unsigned char dualImage[2]; // 138-139: Unused at present
44 unsigned char inactiveFlag[2]; // 140-141: Unused at present
45 unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present
46 unsigned char tagId[TAGID_LEN]; // 162-167: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced
47 unsigned char tagIdCRC[4]; // 168-171: CRC32 of tagId
48 unsigned char reserved1[44]; // 172-215: Reserved area not in use
49 unsigned char imageCRC[4]; // 216-219: CRC32 of images
50 unsigned char reserved2[16]; // 220-235: Unused at present
51 unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion
52 unsigned char reserved3[16]; // 240-255: Unused at present
53 };
54
55 struct bcm_tag_bc300 {
56 unsigned char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag
57 unsigned char sig_1[20]; // 4-23: Company Line 1
58 unsigned char sig_2[14]; // 24-37: Company Line 2
59 unsigned char chipid[6]; // 38-43: Chip this image is for
60 unsigned char boardid[16]; // 44-59: Board name
61 unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE
62 unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image
63 unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE
64 unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE
65 unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image)
66 unsigned char flashRootLength[IMAGE_LEN]; // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image)
67 unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel
68 unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel
69 unsigned char dualImage[2]; // 138-139: Unused at present
70 unsigned char inactiveFlag[2]; // 140-141: Unused at present
71 unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present
72 unsigned char tagId[TAGID_LEN]; // 162-167: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced
73 unsigned char tagIdCRC[4]; // 168-173: CRC32 to ensure validity of tagId
74 unsigned char rootAddress[ADDRESS_LEN]; // 174-183: Address in memory of rootfs partition
75 unsigned char rootLength[IMAGE_LEN]; // 184-193: Size of rootfs partition
76 unsigned char reserved1[22]; // 194-215: Reserved area not in use
77 unsigned char imageCRC[4]; // 216-219: CRC32 of images
78 unsigned char reserved2[16]; // 220-235: Unused at present
79 unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion
80 unsigned char reserved3[16]; // 240-255: Unused at present
81 };
82
83 struct bcm_tag_ag306 {
84 unsigned char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag
85 unsigned char sig_1[20]; // 4-23: Company Line 1
86 unsigned char sig_2[14]; // 24-37: Company Line 2
87 unsigned char chipid[6]; // 38-43: Chip this image is for
88 unsigned char boardid[16]; // 44-59: Board name
89 unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE
90 unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image
91 unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE
92 unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE
93 unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image)
94 unsigned char flashRootLength[IMAGE_LEN]; // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image)
95 unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel
96 unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel
97 unsigned char dualImage[2]; // 138-139: Unused at present
98 unsigned char inactiveFlag[2]; // 140-141: Unused at present
99 unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present
100 unsigned char information2[54]; // 162-215: Compilation and related information (not generated/used by OpenWRT)
101 unsigned char kernelCRC[4] ; // 216-219: CRC32 of images
102 unsigned char rootAddress[ADDRESS_LEN]; // 220-231: Address in memory of rootfs partition
103 unsigned char tagIdCRC[4]; // 232-235: Checksum to ensure validity of tagId
104 unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion
105 unsigned char rootLength[IMAGE_LEN]; // 240-249: Size of rootfs
106 unsigned char tagId[TAGID_LEN]; // 250-255: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced
107 };
108
109 struct bcm_tag_bc221 {
110 unsigned char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag
111 unsigned char sig_1[20]; // 4-23: Company Line 1
112 unsigned char sig_2[14]; // 24-37: Company Line 2
113 unsigned char chipid[6]; // 38-43: Chip this image is for
114 unsigned char boardid[16]; // 44-59: Board name
115 unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE
116 unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image
117 unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE
118 unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE
119 unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image)
120 unsigned char flashRootLength[IMAGE_LEN]; // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image)
121 unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel
122 unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel
123 unsigned char dualImage[2]; // 138-139: Unused at present
124 unsigned char inactiveFlag[2]; // 140-141: Unused at present
125 unsigned char rsa_signature[TAGINFO_LEN]; // 142-161: RSA Signature (unused at present; some vendors may use this)
126 unsigned char reserved5[2]; // 162-163: Unused at present
127 unsigned char tagId[TAGID_LEN]; // 164-169: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced
128 unsigned char rootAddress[ADDRESS_LEN]; // 170-181: Address in memory of rootfs partition
129 unsigned char rootLength[IMAGE_LEN]; // 182-191: Size of rootfs partition
130 unsigned char flashLayoutVer[4]; // 192-195: Version flash layout
131 unsigned char kernelCRC[4]; // 196-199: Guessed to be kernel CRC
132 unsigned char reserved4[16]; // 200-215: Reserved area; unused at present
133 unsigned char imageCRC[4]; // 216-219: CRC32 of images
134 unsigned char reserved2[12]; // 220-231: Unused at present
135 unsigned char tagIdCRC[4]; // 232-235: CRC32 to ensure validity of tagId
136 unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion
137 unsigned char reserved3[16]; // 240-255: Unused at present
138 };
139
140 struct bcm_tag_bc310 {
141 unsigned char tagVersion[4]; // 0-3: Version of the image tag
142 unsigned char sig_1[20]; // 4-23: Company Line 1
143 unsigned char sig_2[14]; // 24-37: Company Line 2
144 unsigned char chipid[6]; // 38-43: Chip this image is for
145 unsigned char boardid[16]; // 44-59: Board name
146 unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE
147 unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image
148 unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE
149 unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE
150 unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image)
151 unsigned char flashRootLength[IMAGE_LEN]; // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image)
152 unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel
153 unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel
154 unsigned char dualImage[2]; // 138-139: Unused at present
155 unsigned char inactiveFlag[2]; // 140-141: Unused at present
156 unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present; Some vendors use this for optional information
157 unsigned char tagId[6]; // 162-167: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced
158 unsigned char tagIdCRC[4]; // 168-171: CRC32 to ensure validity of tagId
159 unsigned char rootAddress[ADDRESS_LEN]; // 172-183: Address in memory of rootfs partition
160 unsigned char rootLength[IMAGE_LEN]; // 184-193: Size of rootfs partition
161 unsigned char reserved1[22]; // 193-215: Reserved area not in use
162 unsigned char imageCRC[4]; // 216-219: CRC32 of images
163 unsigned char rootfsCRC[4]; // 220-227: CRC32 of rootfs partition
164 unsigned char kernelCRC[4]; // 224-227: CRC32 of kernel partition
165 unsigned char reserved2[8]; // 228-235: Unused at present
166 unsigned char headerCRC[4]; // 235-239: CRC32 of header excluding tagVersion
167 unsigned char reserved3[16]; // 240-255: Unused at present
168 };
169
170 union bcm_tag {
171 struct bcm_tag_bccfe bccfe;
172 struct bcm_tag_bc300 bc300;
173 struct bcm_tag_ag306 ag306;
174 struct bcm_tag_bc221 bc221;
175 struct bcm_tag_bc310 bc310;
176 };
177
178 #endif /* __BCM63XX_TAG_H */