From: "Pali Rohár" <pali@kernel.org>
To: "Stefan Roese" <sr@denx.de>, "Marek Behún" <marek.behun@nic.cz>,
"Tony Dinh" <mibodhi@gmail.com>
Cc: u-boot@lists.denx.de
Subject: [PATCH u-boot-marvell 1/7] tools: kwbimage: Define structures for extended kwbimage v0 headers
Date: Tue, 15 Feb 2022 19:59:19 +0100 [thread overview]
Message-ID: <20220215185925.16060-2-pali@kernel.org> (raw)
In-Reply-To: <20220215185925.16060-1-pali@kernel.org>
They are used by Marvell Dove 88AP510 BootROM.
After the main header is a list of optional extended headers and after that
is a list of optional binary executable headers. Between each two extended
headers is additional 0x20 byte long padding.
Original Kirkwood SoCs support only one extended header and no binary
executable header.
Extension of struct ext_hdr_v0 is backward compatible with the old
definition. Only reserved[] fields are changed.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
tools/kwbimage.h | 51 +++++++++++++++++++++++++++++++++++++++---------
1 file changed, 42 insertions(+), 9 deletions(-)
diff --git a/tools/kwbimage.h b/tools/kwbimage.h
index 9ebc7d72d363..706bebddf4fa 100644
--- a/tools/kwbimage.h
+++ b/tools/kwbimage.h
@@ -48,9 +48,13 @@ struct main_hdr_v0 {
uint32_t destaddr; /* 0x10-0x13 */
uint32_t execaddr; /* 0x14-0x17 */
uint8_t satapiomode; /* 0x18 */
- uint8_t rsvd3; /* 0x19 */
+ uint8_t nandblocksize; /* 0x19 */
+ union {
+ uint8_t nandbadblklocation; /* 0x1A */
uint16_t ddrinitdelay; /* 0x1A-0x1B */
- uint16_t rsvd2; /* 0x1C-0x1D */
+ };
+ uint8_t rsvd2; /* 0x1C */
+ uint8_t bin; /* 0x1D */
uint8_t ext; /* 0x1E */
uint8_t checksum; /* 0x1F */
} __packed;
@@ -60,14 +64,43 @@ struct ext_hdr_v0_reg {
uint32_t rdata;
} __packed;
-#define EXT_HDR_V0_REG_COUNT ((0x1dc - 0x20) / sizeof(struct ext_hdr_v0_reg))
-
+/* Structure of the extension header, version 0 (Kirkwood, Dove) */
struct ext_hdr_v0 {
- uint32_t offset;
- uint8_t reserved[0x20 - sizeof(uint32_t)];
- struct ext_hdr_v0_reg rcfg[EXT_HDR_V0_REG_COUNT];
- uint8_t reserved2[7];
- uint8_t checksum;
+ /*
+ * Beware that extension header offsets specified in 88AP510 Functional
+ * Specifications are relative to the start of the main header, not to
+ * the start of the extension header itself.
+ */
+ uint32_t offset; /* 0x0-0x3 */
+ uint8_t rsvd1[8]; /* 0x4-0xB */
+ uint32_t enddelay; /* 0xC-0xF */
+ uint32_t match_addr; /* 0x10-0x13 */
+ uint32_t match_mask; /* 0x14-0x17 */
+ uint32_t match_value; /* 0x18-0x1B */
+ uint8_t ddrwritetype; /* 0x1C */
+ uint8_t ddrresetmpp; /* 0x1D */
+ uint8_t ddrclkenmpp; /* 0x1E */
+ uint8_t ddrinitdelay; /* 0x1F */
+ struct ext_hdr_v0_reg rcfg[55]; /* 0x20-0x1D7 */
+ uint8_t rsvd2[7]; /* 0x1D8-0x1DE */
+ uint8_t checksum; /* 0x1DF */
+} __packed;
+
+/* Structure of the binary code header, version 0 (Dove) */
+struct bin_hdr_v0 {
+ uint32_t match_addr; /* 0x00-0x03 */
+ uint32_t match_mask; /* 0x04-0x07 */
+ uint32_t match_value; /* 0x08-0x0B */
+ uint32_t offset; /* 0x0C-0x0F */
+ uint32_t destaddr; /* 0x10-0x13 */
+ uint32_t size; /* 0x14-0x17 */
+ uint32_t execaddr; /* 0x18-0x1B */
+ uint32_t params[4]; /* 0x1C-0x2B */
+ uint8_t params_flags; /* 0x2C */
+ uint8_t rsvd1; /* 0x2D */
+ uint8_t rsvd2; /* 0x2E */
+ uint8_t checksum; /* 0x2F */
+ uint8_t code[2000]; /* 0x30-0x7FF */
} __packed;
/* Structure of the main header, version 1 (Armada 370/XP/375/38x/39x) */
--
2.20.1
next prev parent reply other threads:[~2022-02-15 18:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 18:59 [PATCH u-boot-marvell 0/7] tools: kwbimage: Support for parsing extended v0 format Pali Rohár
2022-02-15 18:59 ` Pali Rohár [this message]
2022-02-16 9:47 ` [PATCH u-boot-marvell 1/7] tools: kwbimage: Define structures for extended kwbimage v0 headers Stefan Roese
2022-02-15 18:59 ` [PATCH u-boot-marvell 2/7] tools: kwbimage: Fix calculating size of kwbimage v0 header Pali Rohár
2022-02-16 9:47 ` Stefan Roese
2022-02-15 18:59 ` [PATCH u-boot-marvell 3/7] tools: kwbimage: Add support for dumping extended and binary v0 headers Pali Rohár
2022-02-16 9:48 ` Stefan Roese
2022-02-15 18:59 ` [PATCH u-boot-marvell 4/7] tools: kwbimage: Do not show mkimage error message in dumpimage Pali Rohár
2022-02-16 9:48 ` Stefan Roese
2022-02-15 18:59 ` [PATCH u-boot-marvell 5/7] tools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION for v0 images Pali Rohár
2022-02-16 9:48 ` Stefan Roese
2022-02-15 18:59 ` [PATCH u-boot-marvell 6/7] tools: kwbimage: Fix help how to extract DDR3 training code Pali Rohár
2022-02-16 9:49 ` Stefan Roese
2022-02-15 18:59 ` [PATCH u-boot-marvell 7/7] tools: kwbimage: Add me as an author of kwbimage Pali Rohár
2022-02-16 9:49 ` Stefan Roese
2022-02-16 9:55 ` [PATCH u-boot-marvell 0/7] tools: kwbimage: Support for parsing extended v0 format Tony Dinh
2022-02-17 7:10 ` Stefan Roese
2022-02-17 9:18 ` Pali Rohár
2022-02-17 9:43 ` [PATCH u-boot-marvell v2 " Pali Rohár
2022-02-17 9:43 ` [PATCH u-boot-marvell v2 1/7] tools: kwbimage: Define structures for extended kwbimage v0 headers Pali Rohár
2022-02-17 9:43 ` [PATCH u-boot-marvell v2 2/7] tools: kwbimage: Fix calculating size of kwbimage v0 header Pali Rohár
2022-02-17 9:43 ` [PATCH u-boot-marvell v2 3/7] tools: kwbimage: Add support for dumping extended and binary v0 headers Pali Rohár
2022-02-17 10:57 ` Stefan Roese
2022-02-17 9:43 ` [PATCH u-boot-marvell v2 4/7] tools: kwbimage: Do not show mkimage error message in dumpimage Pali Rohár
2022-02-17 9:43 ` [PATCH u-boot-marvell v2 5/7] tools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION for v0 images Pali Rohár
2022-02-17 9:43 ` [PATCH u-boot-marvell v2 6/7] tools: kwbimage: Fix help how to extract DDR3 training code Pali Rohár
2022-02-17 9:43 ` [PATCH u-boot-marvell v2 7/7] tools: kwbimage: Add me as an author of kwbimage Pali Rohár
2022-02-17 15:39 ` [PATCH u-boot-marvell v2 0/7] tools: kwbimage: Support for parsing extended v0 format Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220215185925.16060-2-pali@kernel.org \
--to=pali@kernel.org \
--cc=marek.behun@nic.cz \
--cc=mibodhi@gmail.com \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox