aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2015-05-19 17:05:38 +0800
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-05-21 15:03:35 +1000
commitf7b322e049bcf599511af475be340e86b3049001 (patch)
tree390f8de392be80f50af02274a416bd061e793b5d /hw
parenta88495a1439ff20345870a82565658249be55d23 (diff)
downloadskiboot-f7b322e049bcf599511af475be340e86b3049001.zip
skiboot-f7b322e049bcf599511af475be340e86b3049001.tar.gz
skiboot-f7b322e049bcf599511af475be340e86b3049001.tar.bz2
hw/prd: Expose prd ranges via device tree
Currently, the prd reserved ranges are present in the reserved-ranges nodes in the device tree. While this works, it's difficult to filter the actual PRD ranges from general reserved memory. This change links the prd ranges into the /reserved-memory nodes, by adding ibm,prd-label properties to those used for PRD. This change adds a prd node to the ibm,opal node too, to giver kernel & userspace information about the prd infrastructure provided by OPAL. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/prd.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/hw/prd.c b/hw/prd.c
index 4862213..e775adb 100644
--- a/hw/prd.c
+++ b/hw/prd.c
@@ -21,6 +21,7 @@
#include <chip.h>
#include <opal-msg.h>
#include <fsp.h>
+#include <mem_region.h>
enum events {
EVENT_ATTN = 1 << 0,
@@ -32,6 +33,7 @@ static uint8_t events[MAX_CHIPS];
static uint64_t ipoll_status[MAX_CHIPS];
static struct opal_prd_msg prd_msg;
static bool prd_msg_inuse, prd_active;
+struct dt_node *prd_node;
/* Locking:
*
@@ -358,4 +360,32 @@ void prd_init(void)
queue_prd_msg = queue_prd_msg_hbrt;
opal_register(OPAL_PRD_MSG, opal_prd_msg, 1);
}
+
+ prd_node = dt_new(opal_node, "diagnostics");
+ dt_add_property_strings(prd_node, "compatible", "ibm,opal-prd");
+}
+
+void prd_register_reserved_memory(void)
+{
+ struct mem_region *region;
+
+ if (!prd_node)
+ return;
+
+ lock(&mem_region_lock);
+ for (region = mem_region_next(NULL); region;
+ region = mem_region_next(region)) {
+
+ if (region->type != REGION_HW_RESERVED)
+ continue;
+
+ if (!region->node)
+ continue;
+
+ if (!dt_find_property(region->node, "ibm,prd-label")) {
+ dt_add_property_string(region->node, "ibm,prd-label",
+ region->name);
+ }
+ }
+ unlock(&mem_region_lock);
}