diff options
author | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-06-09 08:04:52 +0000 |
---|---|---|
committer | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-06-09 08:04:52 +0000 |
commit | b1dfb3f7eb3c6ea58052a9ff0dcea8ae38fcfff1 (patch) | |
tree | 5e341dab6b35e5eb581715f43801905698b552aa /target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx | |
parent | a37a557c2e56530f6d97a35e3a7db2e9ea24e0a3 (diff) |
[brcm63xx] rework imagetag firmware generator and MTD partition parser to accomodate with all known
imagetag versions from Broadcom and vendors, patch from Daniel Dickinson (fixes #4987).
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16393 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx')
-rw-r--r-- | target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm_tag.h | 193 |
1 files changed, 168 insertions, 25 deletions
diff --git a/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm_tag.h b/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm_tag.h index 7c170c05d9..1613150e49 100644 --- a/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm_tag.h +++ b/target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm_tag.h @@ -3,32 +3,175 @@ #define IMAGE_LEN 10 /* Length of Length Field */ #define ADDRESS_LEN 12 /* Length of Address field */ +#define TAGID_LEN 6 /* Length of tag ID */ +#define TAGINFO_LEN 20 /* Length of vendor information field in tag */ +#define TAGVER_LEN 4 /* Length of Tag Version */ -struct bcm_tag { - unsigned char tagVersion[4]; // Version of the image tag - unsigned char sig_1[20]; // Company Line 1 - unsigned char sig_2[14]; // Company Line 2 - unsigned char chipid[6]; // Chip this image is for - unsigned char boardid[16]; // Board name - unsigned char big_endian[2]; // Map endianness -- 1 BE 0 LE - unsigned char totalLength[IMAGE_LEN]; //Total length of image - unsigned char cfeAddress[ADDRESS_LEN]; // Address in memory of CFE - unsigned char cfeLength[IMAGE_LEN]; // Size of CFE - unsigned char cfeRootAddress[ADDRESS_LEN]; // Address in memory of rootfs - unsigned char cfeRootLength[IMAGE_LEN]; // Size of rootfs - unsigned char kernelAddress[ADDRESS_LEN]; // Address in memory of kernel - unsigned char kernelLength[IMAGE_LEN]; // Size of kernel - unsigned char dualImage[2]; // Unused at present - unsigned char inactiveFlag[2]; // Unused at present - unsigned char reserved1[74]; // Reserved area not in use - unsigned char imageCRC[4]; // CRC32 of images -// unsigned char reserved2[16]; // Unused at present - unsigned char reserved2[4]; //Unused - unsigned char rootAddress[ADDRESS_LEN]; // Address in memory of rootfs - unsigned char headerCRC[4]; // CRC32 of header excluding tagVersion -// unsigned char reserved3[16]; // Unused at present - unsigned char reserved3[6]; // Unused at present - unsigned char rootLength[IMAGE_LEN]; // Size of rootfs +#define NUM_TAGID 5 +#define IMAGETAG_CRC_START 0xFFFFFFFF + +struct tagiddesc_t { + char tagid[TAGID_LEN + 1]; + char tagiddesc[80]; +}; + + // what is called bc308 may actually be BT Voyager-specific + // bc310 should be right +#define TAGID_DEFINITIONS { \ + { "bccfe", "Broadcom CFE flash image" }, \ + { "bc300", "Broadcom code version 3.00-3.06 and all ftp/tftp flash" }, \ + { "ag306", "Alice Gate (Pirelli, based on Broadcom 3.06)" }, \ + { "bc308", "Broadcom code version 3.08" }, \ + { "bc310", "Broadcom code version 3.10-3.12" }, \ +} + +struct bcm_tag_bccfe { + unsigned char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag + unsigned char sig_1[20]; // 4-23: Company Line 1 + unsigned char sig_2[14]; // 24-37: Company Line 2 + unsigned char chipid[6]; // 38-43: Chip this image is for + unsigned char boardid[16]; // 44-59: Board name + unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE + unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image + unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE + unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE + unsigned char rootAddress[ADDRESS_LEN]; // 94-105: Address in memory of rootfs + unsigned char rootLength[IMAGE_LEN]; // 106-115: Size of rootfs + unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel + unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel + unsigned char dualImage[2]; // 138-139: Unused at present + unsigned char inactiveFlag[2]; // 140-141: Unused at present + unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present + 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 + unsigned char tagIdCRC[4]; // 168-171: CRC32 of tagId + unsigned char reserved1[44]; // 172-215: Reserved area not in use + unsigned char imageCRC[4]; // 216-219: CRC32 of images + unsigned char reserved2[16]; // 220-235: Unused at present + unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion + unsigned char reserved3[16]; // 240-255: Unused at present +}; + +struct bcm_tag_bc300 { + unsigned char tagVersion[4]; // 0-3: Version of the image tag + unsigned char sig_1[20]; // 4-23: Company Line 1 + unsigned char sig_2[14]; // 24-37: Company Line 2 + unsigned char chipid[6]; // 38-43: Chip this image is for + unsigned char boardid[16]; // 44-59: Board name + unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE + unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image + unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE + unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE + unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image) + 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) + unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel + unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel + unsigned char dualImage[2]; // 138-139: Unused at present + unsigned char inactiveFlag[2]; // 140-141: Unused at present + unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present + 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 + unsigned char tagIdCRC[4]; // 168-173: CRC32 to ensure validity of tagId + unsigned char rootAddress[ADDRESS_LEN]; // 174-183: Address in memory of rootfs partition + unsigned char rootLength[IMAGE_LEN]; // 184-193: Size of rootfs partition + unsigned char reserved1[22]; // 194-215: Reserved area not in use + unsigned char imageCRC[4]; // 216-219: CRC32 of images + unsigned char reserved2[16]; // 220-235: Unused at present + unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion + unsigned char reserved3[16]; // 240-255: Unused at present +}; + +struct bcm_tag_ag306 { + unsigned char tagVersion[4]; // 0-3: Version of the image tag + unsigned char sig_1[20]; // 4-23: Company Line 1 + unsigned char sig_2[14]; // 24-37: Company Line 2 + unsigned char chipid[6]; // 38-43: Chip this image is for + unsigned char boardid[16]; // 44-59: Board name + unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE + unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image + unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE + unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE + unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image) + 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) + unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel + unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel + unsigned char dualImage[2]; // 138-139: Unused at present + unsigned char inactiveFlag[2]; // 140-141: Unused at present + unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present + unsigned char information2[54]; // 162-215: Compilation and related information (not generated/used by OpenWRT) + unsigned char kernelCRC[4] ; // 216-219: CRC32 of images + unsigned char rootAddress[ADDRESS_LEN]; // 220-231: Address in memory of rootfs partition + unsigned char tagIdCRC[4]; // 232-235: Checksum to ensure validity of tagId + unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion + unsigned char rootLength[IMAGE_LEN]; // 240-249: Size of rootfs + 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 +}; + +struct bcm_tag_bc308 { + unsigned char tagVersion[4]; // 0-3: Version of the image tag + unsigned char sig_1[20]; // 4-23: Company Line 1 + unsigned char sig_2[14]; // 24-37: Company Line 2 + unsigned char chipid[6]; // 38-43: Chip this image is for + unsigned char boardid[16]; // 44-59: Board name + unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE + unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image + unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE + unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE + unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image) + 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) + unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel + unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel + unsigned char dualImage[2]; // 138-139: Unused at present + unsigned char inactiveFlag[2]; // 140-141: Unused at present + unsigned char information1[TAGINFO_LEN+2]; // 142-163: Unused at present + 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 + unsigned char rootAddress[ADDRESS_LEN]; // 170-181: Address in memory of rootfs partition + unsigned char rootLength[IMAGE_LEN]; // 182-191: Size of rootfs partition + unsigned char flashLayoutVer[2]; // 192-193: Version flash layout + unsigned char curflashLayoutVer[2]; // 194-195: Unused at present + unsigned char kernelCRC[4]; // 196-199: Guessed to be kernel CRC + unsigned char reserved4[16]; // 200-215: Reserved area; unused at present + unsigned char imageCRC[4]; // 216-219: CRC32 of images + unsigned char reserved2[12]; // 220-231: Unused at present + unsigned char tagIdCRC[4]; // 232-235: CRC32 to ensure validity of tagId + unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion + unsigned char reserved3[16]; // 240-255: Unused at present +}; + +struct bcm_tag_bc310 { + unsigned char tagVersion[4]; // 0-3: Version of the image tag + unsigned char sig_1[20]; // 4-23: Company Line 1 + unsigned char sig_2[14]; // 24-37: Company Line 2 + unsigned char chipid[6]; // 38-43: Chip this image is for + unsigned char boardid[16]; // 44-59: Board name + unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE + unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image + unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE + unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE + unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image) + 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) + unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel + unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel + unsigned char dualImage[2]; // 138-139: Unused at present + unsigned char inactiveFlag[2]; // 140-141: Unused at present + unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present; Some vendors use this for optional information + 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 + unsigned char tagIdCRC[4]; // 168-171: CRC32 to ensure validity of tagId + unsigned char rootAddress[ADDRESS_LEN]; // 172-183: Address in memory of rootfs partition + unsigned char rootLength[IMAGE_LEN]; // 184-193: Size of rootfs partition + unsigned char reserved1[22]; // 193-215: Reserved area not in use + unsigned char imageCRC[4]; // 216-219: CRC32 of images + unsigned char rootfsCRC[4]; // 220-227: CRC32 of rootfs partition + unsigned char kernelCRC[4]; // 224-227: CRC32 of kernel partition + unsigned char reserved2[8]; // 228-235: Unused at present + unsigned char headerCRC[4]; // 235-239: CRC32 of header excluding tagVersion + unsigned char reserved3[16]; // 240-255: Unused at present +}; + +union bcm_tag { + struct bcm_tag_bccfe bccfe; + struct bcm_tag_bc300 bc300; + struct bcm_tag_ag306 ag306; + struct bcm_tag_bc308 bc308; + struct bcm_tag_bc310 bc310; }; #endif /* __BCM63XX_TAG_H */ |