Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97367519 authored by Jonas Gorski's avatar Jonas Gorski Committed by Ralf Baechle
Browse files

MIPS: BCM63XX: Make nvram checksum failure non fatal



Some vendors modify the nvram layout moving the checksum to a different
place or dropping entirely, so reduce the checksum failure to a warning.

Reported-by: default avatarÁlvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: default avatarJonas Gorski <jogo@openwrt.org>
Cc: linux-mips@linux-mips.org
Cc: John Crispin <blogic@openwrt.org>
Cc: Maxime Bizon <mbizon@freebox.fr>
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 63c2b681
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -745,10 +745,7 @@ void __init board_prom_init(void)
		strcpy(cfe_version, "unknown");
		strcpy(cfe_version, "unknown");
	printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
	printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);


	if (bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET)) {
	bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
		printk(KERN_ERR PFX "invalid nvram checksum\n");
		return;
	}


	board_name = bcm63xx_nvram_get_name();
	board_name = bcm63xx_nvram_get_name();
	/* find board by name */
	/* find board by name */
+3 −4
Original line number Original line Diff line number Diff line
@@ -38,7 +38,7 @@ struct bcm963xx_nvram {
static struct bcm963xx_nvram nvram;
static struct bcm963xx_nvram nvram;
static int mac_addr_used;
static int mac_addr_used;


int __init bcm63xx_nvram_init(void *addr)
void __init bcm63xx_nvram_init(void *addr)
{
{
	unsigned int check_len;
	unsigned int check_len;
	u32 crc, expected_crc;
	u32 crc, expected_crc;
@@ -60,9 +60,8 @@ int __init bcm63xx_nvram_init(void *addr)
	crc = crc32_le(~0, (u8 *)&nvram, check_len);
	crc = crc32_le(~0, (u8 *)&nvram, check_len);


	if (crc != expected_crc)
	if (crc != expected_crc)
		return -EINVAL;
		pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n",

			expected_crc, crc);
	return 0;
}
}


u8 *bcm63xx_nvram_get_name(void)
u8 *bcm63xx_nvram_get_name(void)
+1 −3
Original line number Original line Diff line number Diff line
@@ -9,10 +9,8 @@
 *
 *
 * Initialized the local nvram copy from the target address and checks
 * Initialized the local nvram copy from the target address and checks
 * its checksum.
 * 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
 * bcm63xx_nvram_get_name() - returns the board name according to nvram