summaryrefslogtreecommitdiffstats
path: root/src/include/usr/nvram/nvram_interface.H
blob: 1df96b4120feb7969163c145d3c4d313d7cef872 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/usr/nvram/nvram_interface.H $                     */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2018                             */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef __NVRAM_INTERFACE_H
#define __NVRAM_INTERFACE_H

#include <errl/errlentry.H>

namespace NVRAM_TRACE
{
    extern trace_desc_t * g_trac_nvram;
}

namespace NVRAM
{

extern const char TEST_KEY[];
extern const char SMF_MEM_AMT_KEY[];

/**
 * @brief Utility function to read the i_key from the NVRAM PNOR partition.
 *        The value of the i_key, if any, will reside in o_val after the
 *        function returns. The function attempts to readSectionInfo for
 *        the NVRAM partition and will error if it's unable to read the
 *        section info. o_val will be nullptr if the key is not found in
 *        NVRAM.
 *
 * @param[in] i_key: the key of the key/value pair representing the data
 *                   that needs to be read from NVRAM.
 * @pre              The key should be a null-terminated string and must not be
 *                   nullptr. The function will assert if i_key is nullptr.
 *
 * @param[out] o_val: The pointer to the location in NVRAM where the i_key
 *                    is located or nullptr if the key is not found.
 *
 * @return error handle: nullptr - success; non-nullptr - an error occurred
 */
errlHndl_t nvramRead(const char* i_key, const char*& o_val);

}
#endif
OpenPOWER on IntegriCloud