include/linux/bcm963xx_nvram.h
Source file repositories/reference/linux-study-clean/include/linux/bcm963xx_nvram.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/bcm963xx_nvram.h- Extension
.h- Size
- 2870 bytes
- Lines
- 110
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/crc32.hlinux/if_ether.hlinux/sizes.hlinux/types.h
Detected Declarations
struct bcm963xx_nvramenum bcm963xx_nvram_nand_partfunction bcm963xx_nvram_nand_part_offsetfunction bcm963xx_nvram_nand_part_sizefunction bcm963xx_nvram_checksum
Annotated Snippet
struct bcm963xx_nvram {
u32 version;
char bootline[256];
char name[16];
u32 main_tp_number;
u32 psi_size;
u32 mac_addr_count;
u8 mac_addr_base[ETH_ALEN];
u8 __reserved1[2];
u32 checksum_v4;
u8 __reserved2[292];
u32 nand_part_offset[__BCM963XX_NVRAM_NAND_NR_PARTS];
u32 nand_part_size[__BCM963XX_NVRAM_NAND_NR_PARTS];
u8 __reserved3[388];
u32 checksum_v5;
};
#define BCM963XX_NVRAM_NAND_PART_OFFSET(nvram, part) \
bcm963xx_nvram_nand_part_offset(nvram, BCM963XX_NVRAM_NAND_PART_ ##part)
static inline u64 __pure bcm963xx_nvram_nand_part_offset(
const struct bcm963xx_nvram *nvram,
enum bcm963xx_nvram_nand_part part)
{
return nvram->nand_part_offset[part] * SZ_1K;
}
#define BCM963XX_NVRAM_NAND_PART_SIZE(nvram, part) \
bcm963xx_nvram_nand_part_size(nvram, BCM963XX_NVRAM_NAND_PART_ ##part)
static inline u64 __pure bcm963xx_nvram_nand_part_size(
const struct bcm963xx_nvram *nvram,
enum bcm963xx_nvram_nand_part part)
{
return nvram->nand_part_size[part] * SZ_1K;
}
/*
* bcm963xx_nvram_checksum - Verify nvram checksum
*
* @nvram: pointer to full size nvram data structure
* @expected_out: optional pointer to store expected checksum value
* @actual_out: optional pointer to store actual checksum value
*
* Return: 0 if the checksum is valid, otherwise -EINVAL
*/
static int __maybe_unused bcm963xx_nvram_checksum(
const struct bcm963xx_nvram *nvram,
u32 *expected_out, u32 *actual_out)
{
const u32 zero = 0;
u32 expected, actual;
size_t len;
if (nvram->version <= 4) {
expected = nvram->checksum_v4;
len = BCM963XX_NVRAM_V4_SIZE;
} else {
expected = nvram->checksum_v5;
len = BCM963XX_NVRAM_V5_SIZE;
}
/* Calculate the CRC32 of the nvram with the checksum field set to 0. */
actual = crc32_le(~0, nvram, len - sizeof(u32));
actual = crc32_le(actual, &zero, sizeof(u32));
if (expected_out)
*expected_out = expected;
if (actual_out)
*actual_out = actual;
return expected == actual ? 0 : -EINVAL;
};
#endif /* __LINUX_BCM963XX_NVRAM_H__ */
Annotation
- Immediate include surface: `linux/crc32.h`, `linux/if_ether.h`, `linux/sizes.h`, `linux/types.h`.
- Detected declarations: `struct bcm963xx_nvram`, `enum bcm963xx_nvram_nand_part`, `function bcm963xx_nvram_nand_part_offset`, `function bcm963xx_nvram_nand_part_size`, `function bcm963xx_nvram_checksum`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.