summaryrefslogtreecommitdiffstats
path: root/src/include/usr/nvram/import/skiboot.h
diff options
context:
space:
mode:
authorIlya Smirnov <ismirno@us.ibm.com>2018-10-08 15:27:28 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-11-07 20:36:51 -0600
commit22134d69a2016dd1ea6d9de858f4e68f732289ae (patch)
tree3e6996dc775e869d6643e748f83d728187add2c3 /src/include/usr/nvram/import/skiboot.h
parentbeca51100d6ba74914391b2a0baec830f427ec99 (diff)
downloadtalos-hostboot-22134d69a2016dd1ea6d9de858f4e68f732289ae.tar.gz
talos-hostboot-22134d69a2016dd1ea6d9de858f4e68f732289ae.zip
SMF: Port NVRAM Reading Logic From Skiboot
As part of SMF secure memory distribution, we need to be able to read the size of secure memory from NVRAM PNOR partition (for OpenPOWER). The functionality to read (index into) NVRAM already exists in skiboot. This commits ports the bare minimum functionality required to read NVRAM from skiboot to hb. Change-Id: I17b9014ec3df590bcd8745ae70e0f96e36580117 RTC: 192411 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/67414 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Dean Sanner <dsanner@us.ibm.com> Reviewed-by: Roland Veloz <rveloz@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/usr/nvram/import/skiboot.h')
-rw-r--r--src/include/usr/nvram/import/skiboot.h103
1 files changed, 103 insertions, 0 deletions
diff --git a/src/include/usr/nvram/import/skiboot.h b/src/include/usr/nvram/import/skiboot.h
new file mode 100644
index 000000000..689eef541
--- /dev/null
+++ b/src/include/usr/nvram/import/skiboot.h
@@ -0,0 +1,103 @@
+/* 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))
+
+static inline uint16_t be16_to_cpu(beint16_t be_val)
+{
+ return BE16_TO_CPU(be_val);
+}
+
+// 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
OpenPOWER on IntegriCloud