2013-04-23 13:55:36 +00:00
|
|
|
From 152addd3a965759b69fbdb9a76526f1f5070bc9a Mon Sep 17 00:00:00 2001
|
2013-02-15 12:23:49 +00:00
|
|
|
From: Jonas Gorski <jogo@openwrt.org>
|
|
|
|
Date: Tue, 12 Feb 2013 22:00:10 +0100
|
|
|
|
Subject: [PATCH] MIPS: BCM63XX: make nvram checksum failure non fatal
|
2013-04-23 13:55:36 +00:00
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
2013-02-15 12:23:49 +00:00
|
|
|
|
|
|
|
Some vendors modify the nvram layout moving the checksum to a different
|
2013-04-23 13:55:36 +00:00
|
|
|
place or dropping entirely, so reduce the checksum failure to a warning.
|
2013-02-15 12:23:49 +00:00
|
|
|
|
|
|
|
Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
|
|
|
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
|
|
|
---
|
2013-04-23 13:55:36 +00:00
|
|
|
|
|
|
|
I'm not sure if it should be that "loud" (pr_warn) because users can't
|
|
|
|
actually do anything to fix it, so maybe pr_debug would be fine, too.
|
|
|
|
|
2013-02-15 12:23:49 +00:00
|
|
|
arch/mips/bcm63xx/boards/board_bcm963xx.c | 5 +----
|
|
|
|
arch/mips/bcm63xx/nvram.c | 7 +++----
|
|
|
|
arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h | 4 +---
|
|
|
|
3 files changed, 5 insertions(+), 11 deletions(-)
|
|
|
|
|
|
|
|
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
|
|
|
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
2013-04-23 13:55:36 +00:00
|
|
|
@@ -745,10 +745,7 @@ void __init board_prom_init(void)
|
2013-02-15 12:23:49 +00:00
|
|
|
strcpy(cfe_version, "unknown");
|
|
|
|
printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
|
|
|
|
|
|
|
|
- if (bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET)) {
|
|
|
|
- printk(KERN_ERR PFX "invalid nvram checksum\n");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
+ bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
|
|
|
|
|
|
|
|
board_name = bcm63xx_nvram_get_name();
|
|
|
|
/* find board by name */
|
|
|
|
--- a/arch/mips/bcm63xx/nvram.c
|
|
|
|
+++ b/arch/mips/bcm63xx/nvram.c
|
|
|
|
@@ -38,7 +38,7 @@ struct bcm963xx_nvram {
|
|
|
|
static struct bcm963xx_nvram nvram;
|
|
|
|
static int mac_addr_used;
|
|
|
|
|
|
|
|
-int __init bcm63xx_nvram_init(void *addr)
|
|
|
|
+void __init bcm63xx_nvram_init(void *addr)
|
|
|
|
{
|
|
|
|
unsigned int check_len;
|
|
|
|
u32 crc, expected_crc;
|
|
|
|
@@ -60,9 +60,8 @@ int __init bcm63xx_nvram_init(void *addr
|
|
|
|
crc = crc32_le(~0, (u8 *)&nvram, check_len);
|
|
|
|
|
|
|
|
if (crc != expected_crc)
|
|
|
|
- return -EINVAL;
|
|
|
|
-
|
|
|
|
- return 0;
|
2013-04-23 13:55:36 +00:00
|
|
|
+ pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n",
|
2013-02-15 12:23:49 +00:00
|
|
|
+ expected_crc, crc);
|
|
|
|
}
|
|
|
|
|
|
|
|
u8 *bcm63xx_nvram_get_name(void)
|
|
|
|
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
|
|
|
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
|
|
|
@@ -9,10 +9,8 @@
|
|
|
|
*
|
|
|
|
* Initialized the local nvram copy from the target address and checks
|
|
|
|
* its checksum.
|
|
|
|
- *
|
|
|
|
- * Returns 0 on success.
|
|
|
|
*/
|
|
|
|
-int __init bcm63xx_nvram_init(void *nvram);
|
|
|
|
+void bcm63xx_nvram_init(void *nvram);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bcm63xx_nvram_get_name() - returns the board name according to nvram
|