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.

Dependency Surface

Detected Declarations

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

Implementation Notes