aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Brown <matthew.brown.dev@gmail.com>2017-03-22 10:28:34 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-03-24 12:35:22 +1100
commit9ffbfe269ec6ef9b6e2ef914be79dcf902fc2898 (patch)
treecbba1162ecb7b1a36a5801ec517e3bf1c98198a0
parent352b096851f773d842c2e7ef909034ca1696a594 (diff)
downloadskiboot-9ffbfe269ec6ef9b6e2ef914be79dcf902fc2898.zip
skiboot-9ffbfe269ec6ef9b6e2ef914be79dcf902fc2898.tar.gz
skiboot-9ffbfe269ec6ef9b6e2ef914be79dcf902fc2898.tar.bz2
core/init: Add hdat-map property to OPAL node
Exports the HDAT heap to the OS. This allows the OS to view the HDAT heap directly. This allows us to view the HDAT area without having to use getmemproc. Signed-off-by: Matt Brown <matthew.brown.dev@gmail.com> Reviewed-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--core/opal.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/opal.c b/core/opal.c
index 88ca2af..7bc403c 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -119,15 +119,44 @@ void __opal_register(uint64_t token, void *func, unsigned int nargs)
opal_num_args[token] = nargs;
}
+/*
+ * add_opal_firmware_exports_node: adds properties to the device-tree which
+ * the OS will then change into sysfs nodes.
+ * The properties must be placed under /ibm,opal/firmware/exports.
+ * The new sysfs nodes are created under /opal/exports.
+ * To be correctly exported the properties must contain:
+ * name
+ * base memory location (u64)
+ * size (u64)
+ */
+static void add_opal_firmware_exports_node(struct dt_node *node)
+{
+ struct dt_node *exports = dt_new(node, "exports");
+ uint64_t sym_start = (uint64_t)__sym_map_start;
+ uint64_t sym_size = (uint64_t)__sym_map_end - sym_start;
+
+ dt_add_property_u64s(exports, "symbol-map", sym_start, sym_size);
+ dt_add_property_u64s(exports, "hdat-map", SPIRA_HEAP_BASE,
+ SPIRA_HEAP_SIZE);
+}
+
static void add_opal_firmware_node(void)
{
struct dt_node *firmware = dt_new(opal_node, "firmware");
uint64_t sym_start = (uint64_t)__sym_map_start;
uint64_t sym_size = (uint64_t)__sym_map_end - sym_start;
+
dt_add_property_string(firmware, "compatible", "ibm,opal-firmware");
dt_add_property_string(firmware, "name", "firmware");
dt_add_property_string(firmware, "version", version);
+ /*
+ * As previous OS versions use symbol-map located at
+ * /ibm,opal/firmware we will keep a copy of symbol-map here
+ * for backwards compatibility
+ */
dt_add_property_u64s(firmware, "symbol-map", sym_start, sym_size);
+
+ add_opal_firmware_exports_node(firmware);
}
void add_opal_node(void)