#ifndef __LINUX_BCM963XX_NVRAM_H__
#define __LINUX_BCM963XX_NVRAM_H__
#include <linux/crc32.h>
#include <linux/if_ether.h>
#include <linux/sizes.h>
#include <linux/types.h>
#define BCM963XX_NVRAM_V4_SIZE …
#define BCM963XX_NVRAM_V5_SIZE …
#define BCM963XX_DEFAULT_PSI_SIZE …
enum bcm963xx_nvram_nand_part { … };
struct bcm963xx_nvram { … };
#define BCM963XX_NVRAM_NAND_PART_OFFSET(nvram, part) …
static inline u64 __pure bcm963xx_nvram_nand_part_offset(
const struct bcm963xx_nvram *nvram,
enum bcm963xx_nvram_nand_part part)
{ … }
#define BCM963XX_NVRAM_NAND_PART_SIZE(nvram, part) …
static inline u64 __pure bcm963xx_nvram_nand_part_size(
const struct bcm963xx_nvram *nvram,
enum bcm963xx_nvram_nand_part part)
{ … }
static int __maybe_unused bcm963xx_nvram_checksum(
const struct bcm963xx_nvram *nvram,
u32 *expected_out, u32 *actual_out)
{
u32 expected, actual;
size_t len;
if (nvram->version <= 4) {
expected = nvram->checksum_v4;
len = BCM963XX_NVRAM_V4_SIZE - sizeof(u32);
} else {
expected = nvram->checksum_v5;
len = BCM963XX_NVRAM_V5_SIZE - sizeof(u32);
}
actual = crc32_le_combine(
crc32_le(~0, (u8 *)nvram, len), 0, sizeof(u32));
if (expected_out)
*expected_out = expected;
if (actual_out)
*actual_out = actual;
return expected == actual ? 0 : -EINVAL;
};
#endif