From: "Rafał Miłecki" <zajec5@gmail.com>
To: linux-mtd@lists.infradead.org,
David Woodhouse <David.Woodhouse@intel.com>,
Artem Bityutskiy <dedekind1@gmail.com>,
Brian Norris <computersforpeace@gmail.com>
Cc: "Hauke Mehrtens" <hauke@hauke-m.de>, "Rafał Miłecki" <zajec5@gmail.com>
Subject: [PATCH V2] mtd: bcm47xxpart: find NVRAM partitions in middle blocks
Date: Mon, 18 Aug 2014 20:20:27 +0200 [thread overview]
Message-ID: <1408386027-12120-1-git-send-email-zajec5@gmail.com> (raw)
In-Reply-To: <1408004566-22271-1-git-send-email-zajec5@gmail.com>
Old devices used to have NVRAM at the very end of flash and they could
be unaligned (starting at some offset in a block).
In new devices NVRAM can be located quite randomly, however it seems to
always start at the beginning of a block. For example Netgear R6250 has
NVRAM located right after the bootloader, before the kernel partition.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
V2: Ignore last block to avoid having two "nvram" partitions.
---
drivers/mtd/bcm47xxpart.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index 035690e..da641ac 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -224,6 +224,16 @@ static int bcm47xxpart_parse(struct mtd_info *master,
continue;
}
+ /* New (ARM?) devices may have NVRAM in some middle block. Last
+ * block will be checked later, so skip it.
+ */
+ if (offset != master->size - blocksize &&
+ buf[0x000 / 4] == NVRAM_HEADER) {
+ bcm47xxpart_add_part(&parts[curr_part++], "nvram",
+ offset, 0);
+ continue;
+ }
+
/* Read middle of the block */
if (mtd_read(master, offset + 0x8000, 0x4,
&bytes_read, (uint8_t *)buf) < 0) {
--
1.8.4.5
next prev parent reply other threads:[~2014-08-18 18:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-14 8:22 [PATCH] mtd: bcm47xxpart: find NVRAM partitions in middle blocks Rafał Miłecki
2014-08-18 18:20 ` Rafał Miłecki [this message]
2014-09-18 6:16 ` [PATCH V2] " Brian Norris
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=1408386027-12120-1-git-send-email-zajec5@gmail.com \
--to=zajec5@gmail.com \
--cc=David.Woodhouse@intel.com \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=hauke@hauke-m.de \
--cc=linux-mtd@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).