OPAL NVRAM¶
The NVRAM requirements for OPAL systems is derived from LoPAPR, and all requirements listed in it apply to OPAL with some exceptions. Note that Section 8.4.1.1.3 “OF Configuration Variables” does NOT apply to OPAL, neither does 8.4.1.2 “DASD Spin-up Control”. Not that the RTAS calls of nvram-fetch and nvram-store are roughly equivalent to the OPAL_READ_NVRAM and OPAL_WRITE_NVRAM calls.
LoPAPR has a minimum requirement of 8KB of Non-Volatile Memory. While this requirement carries over, it’s important to note that historically all OPAL systems have had roughly 500kb of NVRAM.
See nvram Device Tree Node for details on how NVRAM is represented in the device tree. It’s fairly simple, it looks like this:
nvram {
compatible = "ibm,opal-nvram";
#bytes = <0x90000>;
};
OPAL_READ_NVRAM¶
#define OPAL_READ_NVRAM 7
int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
OPAL_READ_NVRAM call requests OPAL to read the data from system NVRAM
memory into a memory buffer. The data at offset
from nvram_image
will be copied to memory buffer
of size size
.
This is a synchronous OPAL call, as OPAL will typically read the content of
NVRAM from its storage (typically flash) during boot, so the call duration
should be along the lines of a memcpy()
operation rather than reading
from storage.
Parameters¶
uint64_t buffer
uint64_t size
uint64_t offset
buffer
the data from nvram will be copied to
buffer
size
the data of size
size
will be copiedoffset
the data will be copied from address equal to base
nvram_image
plusoffset
Return Values¶
- OPAL_SUCCESS
data from nvram to memory
buffer
copied successfully- OPAL_PARAMETER
a parameter
offset
orsize
was incorrect- OPAL_HARDWARE
either nvram is not initialized or permanent error related to nvram hardware.
OPAL_WRITE_NVRAM¶
#define OPAL_WRITE_NVRAM 8
int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
OPAL_WRITE_NVRAM call requests OPAL to write the data to actual system NVRAM memory
from memory buffer
at offset
, of size size
Parameters¶
uint64_t buffer
uint64_t size
uint64_t offset
buffer
data from
buffer
will be copied to nvramsize
the data of size
size
will be copiedoffset
the data will be copied to address which is equal to base
nvram_image
plusoffset
Return Values¶
- OPAL_SUCCESS
data from memory
buffer
to actual nvram_image copied successfully- OPAL_PARAMETER
a parameter
offset
orsize
was incorrect- OPAL_HARDWARE
either nvram is not initialized or permanent error related to nvram hardware.
- OPAL_BUSY
OPAL is currently busy, retry the OPAL_WRITE_NVRAM call.
- OPAL_BUSY_EVENT
OPAL is currently busy, call OPAL_POLL_EVENTS and then retry OPAL_WRITE_NVRAM