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