[Skiboot] [PATCH v3 1/3] core: Implement generic dump region opal call
Joel Stanley
joel at jms.id.au
Thu May 31 14:29:41 AEST 2018
This provides an implementation of the OPAL_REGISTER_DUMP_REGION and
OPAL_UNREGISTER_DUMP_REGION calls that can be used by all systems.
It enables the callbacks for the ibm-fsp machine, preserving the
existing behaviour.
Signed-off-by: Joel Stanley <joel at jms.id.au>
---
core/Makefile.inc | 2 +-
core/dump-region.c | 39 +++++++++++++++++++++++++++++++++++++++
hw/fsp/fsp-mdst-table.c | 8 +++-----
include/platform.h | 12 ++++++++++++
4 files changed, 55 insertions(+), 6 deletions(-)
create mode 100644 core/dump-region.c
diff --git a/core/Makefile.inc b/core/Makefile.inc
index d36350590edb..2d2f74778f4c 100644
--- a/core/Makefile.inc
+++ b/core/Makefile.inc
@@ -9,7 +9,7 @@ CORE_OBJS += vpd.o hostservices.o platform.o nvram.o nvram-format.o hmi.o
CORE_OBJS += console-log.o ipmi.o time-utils.o pel.o pool.o errorlog.o
CORE_OBJS += timer.o i2c.o rtc.o flash.o sensor.o ipmi-opal.o
CORE_OBJS += flash-subpartition.o bitmap.o buddy.o pci-quirk.o powercap.o psr.o
-CORE_OBJS += pci-dt-slot.o direct-controls.o cpufeatures.o
+CORE_OBJS += pci-dt-slot.o direct-controls.o cpufeatures.o dump-region.o
ifeq ($(SKIBOOT_GCOV),1)
CORE_OBJS += gcov-profiling.o
diff --git a/core/dump-region.c b/core/dump-region.c
new file mode 100644
index 000000000000..afa4c2685b89
--- /dev/null
+++ b/core/dump-region.c
@@ -0,0 +1,39 @@
+/* Copyright 2018 IBM 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.
+ */
+
+#define pr_fmt(fmt) "DUMP: " fmt
+
+#include <opal.h>
+#include <skiboot.h>
+
+static int64_t opal_register_dump_region(uint32_t id, uint64_t addr,
+ uint64_t size)
+{
+ if (platform.register_dump_region)
+ return platform.register_dump_region(id, addr, size);
+
+ return OPAL_UNSUPPORTED;
+}
+opal_call(OPAL_REGISTER_DUMP_REGION, opal_register_dump_region, 3);
+
+static int64_t opal_unregister_dump_region(uint32_t id)
+{
+ if (platform.unregister_dump_region)
+ return platform.unregister_dump_region(id);
+
+ return OPAL_UNSUPPORTED;
+}
+opal_call(OPAL_UNREGISTER_DUMP_REGION, opal_unregister_dump_region, 1);
diff --git a/hw/fsp/fsp-mdst-table.c b/hw/fsp/fsp-mdst-table.c
index 0f145ba5551a..54d3c0613687 100644
--- a/hw/fsp/fsp-mdst-table.c
+++ b/hw/fsp/fsp-mdst-table.c
@@ -415,11 +415,9 @@ void fsp_mdst_table_init(void)
if (!fsp_present())
return;
- /* OPAL interface */
- opal_register(OPAL_REGISTER_DUMP_REGION,
- fsp_opal_register_dump_region, 3);
- opal_register(OPAL_UNREGISTER_DUMP_REGION,
- fsp_opal_unregister_dump_region, 1);
+ /* Register callbacks */
+ platform.register_dump_region = fsp_opal_register_dump_region;
+ platform.unregister_dump_region = fsp_opal_unregister_dump_region;
if (!fsp_mdst_supported())
return;
diff --git a/include/platform.h b/include/platform.h
index a77764464001..c9b2dd88e4f6 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -207,6 +207,18 @@ struct platform {
* OPAL terminate
*/
void __attribute__((noreturn)) (*terminate)(const char *msg);
+
+ /*
+ * Dump region registration
+ *
+ * Allows machine specific actions to be taken when
+ * OPAL_REGISTER_DUMP_REGION and OPAL_UNREGISTER_DUMP_REGION
+ * are called.
+ */
+ int64_t (*register_dump_region)(uint32_t id,
+ uint64_t addr,
+ uint64_t size);
+ int64_t (*unregister_dump_region)(uint32_t id);
};
extern struct platform __platforms_start;
--
2.17.0
More information about the Skiboot
mailing list