arch/powerpc/platforms/powernv/opal-nvram.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powernv/opal-nvram.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powernv/opal-nvram.c- Extension
.c- Size
- 2255 bytes
- Lines
- 114
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/kernel.hlinux/init.hlinux/of.hasm/opal.hasm/nvram.hasm/machdep.h
Detected Declarations
function opal_nvram_sizefunction opal_nvram_readfunction opal_nvram_writefunction opal_nvram_init_log_partitionsfunction opal_nvram_init
Annotated Snippet
if (rc == OPAL_BUSY_EVENT) {
if (in_interrupt() || irqs_disabled())
mdelay(OPAL_BUSY_DELAY_MS);
else
msleep(OPAL_BUSY_DELAY_MS);
opal_poll_events(NULL);
} else if (rc == OPAL_BUSY) {
if (in_interrupt() || irqs_disabled())
mdelay(OPAL_BUSY_DELAY_MS);
else
msleep(OPAL_BUSY_DELAY_MS);
}
}
if (rc)
return -EIO;
*index += count;
return count;
}
static int __init opal_nvram_init_log_partitions(void)
{
/* Scan nvram for partitions */
nvram_scan_partitions();
nvram_init_oops_partition(0);
return 0;
}
machine_arch_initcall(powernv, opal_nvram_init_log_partitions);
void __init opal_nvram_init(void)
{
struct device_node *np;
const __be32 *nbytes_p;
np = of_find_compatible_node(NULL, NULL, "ibm,opal-nvram");
if (np == NULL)
return;
nbytes_p = of_get_property(np, "#bytes", NULL);
if (!nbytes_p) {
of_node_put(np);
return;
}
nvram_size = be32_to_cpup(nbytes_p);
pr_info("OPAL nvram setup, %u bytes\n", nvram_size);
of_node_put(np);
ppc_md.nvram_read = opal_nvram_read;
ppc_md.nvram_write = opal_nvram_write;
ppc_md.nvram_size = opal_nvram_size;
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/kernel.h`, `linux/init.h`, `linux/of.h`, `asm/opal.h`, `asm/nvram.h`, `asm/machdep.h`.
- Detected declarations: `function opal_nvram_size`, `function opal_nvram_read`, `function opal_nvram_write`, `function opal_nvram_init_log_partitions`, `function opal_nvram_init`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.