aboutsummaryrefslogtreecommitdiff
path: root/doc/opal-api/opal-nvram-read-write-7-8.html
blob: 39e15ecc0037061402c489e9cf4f9c67e19ea16d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>

<html lang="en" data-content_root="../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>OPAL NVRAM &#8212; skiboot d365a01
 documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
    <link rel="stylesheet" type="text/css" href="../_static/classic.css?v=514cf933" />
    
    <script src="../_static/documentation_options.js?v=e1fecbe9"></script>
    <script src="../_static/doctools.js?v=888ff710"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Get/Set System Parameters" href="opal-param-89-90.html" />
    <link rel="prev" title="OPAL_NPU_SPA_SETUP" href="opal-npu2-opencapi-159-160-161-171-172.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="opal-param-89-90.html" title="Get/Set System Parameters"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="opal-npu2-opencapi-159-160-161-171-172.html" title="OPAL_NPU_SPA_SETUP"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">skiboot d365a01
 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">OPAL API Documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">OPAL NVRAM</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="opal-nvram">
<span id="nvram"></span><h1>OPAL NVRAM<a class="headerlink" href="#opal-nvram" title="Link to this heading"></a></h1>
<p>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
<cite>nvram-fetch</cite> and <cite>nvram-store</cite> are roughly equivalent to the
<a class="reference internal" href="#opal-read-nvram"><span class="std std-ref">OPAL_READ_NVRAM</span></a> and <a class="reference internal" href="#opal-write-nvram"><span class="std std-ref">OPAL_WRITE_NVRAM</span></a> calls.</p>
<p>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.</p>
<p>See <a class="reference internal" href="../device-tree/ibm%2Copal/nvram.html#device-tree-ibm-opal-nvram"><span class="std std-ref">nvram Device Tree Node</span></a> for details on how NVRAM is represented
in the device tree. It’s fairly simple, it looks like this:</p>
<div class="highlight-dts notranslate"><div class="highlight"><pre><span></span><span class="nc">nvram</span> <span class="p">{</span>
      <span class="nf">compatible</span> <span class="o">=</span> <span class="s">&quot;ibm,opal-nvram&quot;</span><span class="p">;</span>
      <span class="nf">#bytes</span> <span class="o">=</span> <span class="p">&lt;</span><span class="mh">0x90000</span><span class="p">&gt;;</span>
<span class="p">};</span>
</pre></div>
</div>
<section id="opal-read-nvram">
<span id="id1"></span><h2>OPAL_READ_NVRAM<a class="headerlink" href="#opal-read-nvram" title="Link to this heading"></a></h2>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#define OPAL_READ_NVRAM                         7</span>

<span class="kt">int64_t</span><span class="w"> </span><span class="nf">opal_read_nvram</span><span class="p">(</span><span class="kt">uint64_t</span><span class="w"> </span><span class="n">buffer</span><span class="p">,</span><span class="w"> </span><span class="kt">uint64_t</span><span class="w"> </span><span class="n">size</span><span class="p">,</span><span class="w"> </span><span class="kt">uint64_t</span><span class="w"> </span><span class="n">offset</span><span class="p">);</span>
</pre></div>
</div>
<p><a class="reference internal" href="#opal-read-nvram"><span class="std std-ref">OPAL_READ_NVRAM</span></a> call requests OPAL to read the data from system NVRAM
memory into a memory buffer. The data at <code class="docutils literal notranslate"><span class="pre">offset</span></code> from nvram_image
will be copied to memory <code class="docutils literal notranslate"><span class="pre">buffer</span></code> of size <code class="docutils literal notranslate"><span class="pre">size</span></code>.</p>
<p>This is a <em>synchronous</em> 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 <code class="docutils literal notranslate"><span class="pre">memcpy()</span></code> operation rather than reading
from storage.</p>
<section id="parameters">
<h3>Parameters<a class="headerlink" href="#parameters" title="Link to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">uint64_t</span> <span class="n">buffer</span>
<span class="n">uint64_t</span> <span class="n">size</span>
<span class="n">uint64_t</span> <span class="n">offset</span>
</pre></div>
</div>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">buffer</span></code></dt><dd><p>the data from nvram will be copied to <code class="docutils literal notranslate"><span class="pre">buffer</span></code></p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">size</span></code></dt><dd><p>the data of size <code class="docutils literal notranslate"><span class="pre">size</span></code> will be copied</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">offset</span></code></dt><dd><p>the data will be copied from address equal to base <code class="docutils literal notranslate"><span class="pre">nvram_image</span></code> plus <code class="docutils literal notranslate"><span class="pre">offset</span></code></p>
</dd>
</dl>
</section>
<section id="return-values">
<h3>Return Values<a class="headerlink" href="#return-values" title="Link to this heading"></a></h3>
<dl class="simple">
<dt><a class="reference internal" href="return-codes.html#opal-success"><span class="std std-ref">OPAL_SUCCESS</span></a></dt><dd><p>data from nvram to memory <code class="docutils literal notranslate"><span class="pre">buffer</span></code> copied successfully</p>
</dd>
<dt><a class="reference internal" href="return-codes.html#opal-parameter"><span class="std std-ref">OPAL_PARAMETER</span></a></dt><dd><p>a parameter <code class="docutils literal notranslate"><span class="pre">offset</span></code> or <code class="docutils literal notranslate"><span class="pre">size</span></code> was incorrect</p>
</dd>
<dt><a class="reference internal" href="return-codes.html#opal-hardware"><span class="std std-ref">OPAL_HARDWARE</span></a></dt><dd><p>either nvram is not initialized or permanent error related to nvram hardware.</p>
</dd>
</dl>
</section>
</section>
<section id="opal-write-nvram">
<span id="id2"></span><h2>OPAL_WRITE_NVRAM<a class="headerlink" href="#opal-write-nvram" title="Link to this heading"></a></h2>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#define OPAL_WRITE_NVRAM                        8</span>

<span class="kt">int64_t</span><span class="w"> </span><span class="nf">opal_write_nvram</span><span class="p">(</span><span class="kt">uint64_t</span><span class="w"> </span><span class="n">buffer</span><span class="p">,</span><span class="w"> </span><span class="kt">uint64_t</span><span class="w"> </span><span class="n">size</span><span class="p">,</span><span class="w"> </span><span class="kt">uint64_t</span><span class="w"> </span><span class="n">offset</span><span class="p">);</span>
</pre></div>
</div>
<p><a class="reference internal" href="#opal-write-nvram"><span class="std std-ref">OPAL_WRITE_NVRAM</span></a> call requests OPAL to write the data to actual system NVRAM memory
from memory <code class="docutils literal notranslate"><span class="pre">buffer</span></code> at <code class="docutils literal notranslate"><span class="pre">offset</span></code>, of size <code class="docutils literal notranslate"><span class="pre">size</span></code></p>
<section id="id3">
<h3>Parameters<a class="headerlink" href="#id3" title="Link to this heading"></a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">uint64_t</span> <span class="n">buffer</span>
<span class="n">uint64_t</span> <span class="n">size</span>
<span class="n">uint64_t</span> <span class="n">offset</span>
</pre></div>
</div>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">buffer</span></code></dt><dd><p>data from <code class="docutils literal notranslate"><span class="pre">buffer</span></code> will be copied to nvram</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">size</span></code></dt><dd><p>the data of size <code class="docutils literal notranslate"><span class="pre">size</span></code> will be copied</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">offset</span></code></dt><dd><p>the data will be copied to address which is equal to base <code class="docutils literal notranslate"><span class="pre">nvram_image</span></code> plus <code class="docutils literal notranslate"><span class="pre">offset</span></code></p>
</dd>
</dl>
</section>
<section id="id4">
<h3>Return Values<a class="headerlink" href="#id4" title="Link to this heading"></a></h3>
<dl class="simple">
<dt><a class="reference internal" href="return-codes.html#opal-success"><span class="std std-ref">OPAL_SUCCESS</span></a></dt><dd><p>data from memory <code class="docutils literal notranslate"><span class="pre">buffer</span></code> to actual nvram_image copied successfully</p>
</dd>
<dt><a class="reference internal" href="return-codes.html#opal-parameter"><span class="std std-ref">OPAL_PARAMETER</span></a></dt><dd><p>a parameter <code class="docutils literal notranslate"><span class="pre">offset</span></code> or <code class="docutils literal notranslate"><span class="pre">size</span></code> was incorrect</p>
</dd>
<dt><a class="reference internal" href="return-codes.html#opal-hardware"><span class="std std-ref">OPAL_HARDWARE</span></a></dt><dd><p>either nvram is not initialized or permanent error related to nvram hardware.</p>
</dd>
<dt><a class="reference internal" href="return-codes.html#opal-busy"><span class="std std-ref">OPAL_BUSY</span></a></dt><dd><p>OPAL is currently busy, retry the <a class="reference internal" href="#opal-write-nvram"><span class="std std-ref">OPAL_WRITE_NVRAM</span></a> call.</p>
</dd>
<dt><a class="reference internal" href="return-codes.html#opal-busy-event"><span class="std std-ref">OPAL_BUSY_EVENT</span></a></dt><dd><p>OPAL is currently busy, call <a class="reference internal" href="opal-poll-events.html#opal-poll-events"><span class="std std-ref">OPAL_POLL_EVENTS</span></a> and then retry <a class="reference internal" href="#opal-write-nvram"><span class="std std-ref">OPAL_WRITE_NVRAM</span></a></p>
</dd>
</dl>
</section>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <div>
    <h3><a href="../index.html">Table of Contents</a></h3>
    <ul>
<li><a class="reference internal" href="#">OPAL NVRAM</a><ul>
<li><a class="reference internal" href="#opal-read-nvram">OPAL_READ_NVRAM</a><ul>
<li><a class="reference internal" href="#parameters">Parameters</a></li>
<li><a class="reference internal" href="#return-values">Return Values</a></li>
</ul>
</li>
<li><a class="reference internal" href="#opal-write-nvram">OPAL_WRITE_NVRAM</a><ul>
<li><a class="reference internal" href="#id3">Parameters</a></li>
<li><a class="reference internal" href="#id4">Return Values</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  </div>
  <div>
    <h4>Previous topic</h4>
    <p class="topless"><a href="opal-npu2-opencapi-159-160-161-171-172.html"
                          title="previous chapter">OPAL_NPU_SPA_SETUP</a></p>
  </div>
  <div>
    <h4>Next topic</h4>
    <p class="topless"><a href="opal-param-89-90.html"
                          title="next chapter">Get/Set System Parameters</a></p>
  </div>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/opal-api/opal-nvram-read-write-7-8.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="opal-param-89-90.html" title="Get/Set System Parameters"
             >next</a> |</li>
        <li class="right" >
          <a href="opal-npu2-opencapi-159-160-161-171-172.html" title="OPAL_NPU_SPA_SETUP"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">skiboot d365a01
 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >OPAL API Documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">OPAL NVRAM</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
    &#169; Copyright 2016-2017, IBM, others.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
    </div>
  </body>
</html>