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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/include/usr/nvram/import/skiboot.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 __SKIBOOT_H
#define __SKIBOOT_H
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <tracinterface.H>
#include <trace/trace.H>
#include <nvram/nvram_interface.H>
typedef uint16_t beint16_t;
typedef beint16_t be16;
#define BE16_TO_CPU(le_val) ((uint16_t)(le_val))
#define CPU_TO_BE16(native) ((beint16_t)(native))
static inline uint16_t be16_to_cpu(beint16_t be_val)
{
return BE16_TO_CPU(be_val);
}
/**
* cpu_to_be16 - convert a uint16_t value to big endian.
* @native: value to convert
*/
static inline beint16_t cpu_to_be16(uint16_t native)
{
return CPU_TO_BE16(native);
}
// For console logging
#define PR_EMERG 0
#define PR_ALERT 1
#define PR_CRIT 2
#define PR_ERR 3
#define PR_WARNING 4
#define PR_NOTICE 5
#define PR_PRINTF PR_NOTICE
#define PR_INFO 6
#define PR_DEBUG 7
#define PR_TRACE 8
#define PR_INSANE 9
// Skiboot-specific trace plug-in
#define prlog(l, f, args...) \
do { \
if(l == PR_TRACE || \
l <= PR_ERR) \
{ \
TRACFCOMP(NVRAM_TRACE::g_trac_nvram, f, ##args); \
} \
else \
{ \
TRACDCOMP(NVRAM_TRACE::g_trac_nvram, f, ##args); \
} \
} while(0)
#define prerror(fmt...) do { prlog(PR_ERR, fmt); } while(0)
#define prlog_once(arg, ...) \
({ \
static bool __prlog_once = false; \
if (!__prlog_once) { \
__prlog_once = true; \
prlog(arg, ##__VA_ARGS__); \
} \
})
extern "C"
{
// Various stubs for NVRAM checking/manipulation. Note that on hostboot
// side we rely on getSectionInfo to carry out most of these tasks.
bool nvram_has_loaded(void)
{
return true;
}
bool nvram_wait_for_load(void)
{
return true;
}
bool nvram_validate(void)
{
return true;
}
}
#endif
|