aboutsummaryrefslogtreecommitdiff
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
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>
-rw-r--r--core/init.c2
-rw-r--r--doc/device-tree/ibm,opal/diagnostics.txt10
-rw-r--r--doc/device-tree/reserved-memory.txt3
-rw-r--r--hw/prd.c30
-rw-r--r--include/skiboot.h1
5 files changed, 46 insertions, 0 deletions
diff --git a/core/init.c b/core/init.c
index 445272a..e652970 100644
--- a/core/init.c
+++ b/core/init.c
@@ -723,6 +723,8 @@ void __noreturn main_cpu_entry(const void *fdt, u32 master_cpu)
/* ... and add remaining reservations to the DT */
mem_region_add_dt_reserved();
+ prd_register_reserved_memory();
+
load_and_boot_kernel(false);
}
diff --git a/doc/device-tree/ibm,opal/diagnostics.txt b/doc/device-tree/ibm,opal/diagnostics.txt
new file mode 100644
index 0000000..14da91c
--- /dev/null
+++ b/doc/device-tree/ibm,opal/diagnostics.txt
@@ -0,0 +1,10 @@
+
+ibm,opal/diagnostics device tree entries
+----------------------------------
+
+The diagnostics node under ibm,opal describes a userspace-to-firmware
+interface, supporting the runtime processor recovery diagnostics functions.
+
+The properties of a prd node are:
+
+ compatible = "ibm,opal-prd"
diff --git a/doc/device-tree/reserved-memory.txt b/doc/device-tree/reserved-memory.txt
index 0f6002d..ff0d6a4 100644
--- a/doc/device-tree/reserved-memory.txt
+++ b/doc/device-tree/reserved-memory.txt
@@ -25,3 +25,6 @@ The sub-nodes under the /reserved-memory node contain:
and size values are two cells each, as signified by the top-level
#{address,size}-cells
+ ibm,prd-label = "string"
+ - a string token for use by the prd system. Specific ranges may be
+ used by prd - those will be referenced by this label.
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);
}
diff --git a/include/skiboot.h b/include/skiboot.h
index 50f4937..163cc23 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -236,6 +236,7 @@ extern void prd_psi_interrupt(uint32_t proc);
extern void prd_tmgt_interrupt(uint32_t proc);
extern void prd_occ_reset(uint32_t proc);
extern void prd_init(void);
+extern void prd_register_reserved_memory(void);
/* Flatten device-tree */
extern void *create_dtb(const struct dt_node *root);