aboutsummaryrefslogtreecommitdiff
path: root/libstb
diff options
context:
space:
mode:
authorClaudio Carvalho <cclaudio@linux.vnet.ibm.com>2017-12-09 02:52:33 -0200
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-12-18 21:30:57 -0600
commit68a25577cd896466eee563315ba8bf47a0438ede (patch)
treeef774c33466cf0d459861d669e19d48e8244b78a /libstb
parent63110a7734e6f22ae7c7cc06576c766ca7a7606a (diff)
downloadskiboot-68a25577cd896466eee563315ba8bf47a0438ede.zip
skiboot-68a25577cd896466eee563315ba8bf47a0438ede.tar.gz
skiboot-68a25577cd896466eee563315ba8bf47a0438ede.tar.bz2
libstb/cvc: update memory-region to point to /reserved-memory
The linux documentation, reserved-memory.txt, says that memory-region is a phandle that pairs to a children of /reserved-memory. This updates /ibm,secureboot/ibm,cvc/memory-region to point to /reserved-memory/secure-crypt-algo-code instead of /ibm,hostboot/reserved-memory/secure-crypt-algo-code. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libstb')
-rw-r--r--libstb/cvc.c33
-rw-r--r--libstb/cvc.h1
2 files changed, 33 insertions, 1 deletions
diff --git a/libstb/cvc.c b/libstb/cvc.c
index 4faeb96..e9df190 100644
--- a/libstb/cvc.c
+++ b/libstb/cvc.c
@@ -47,6 +47,9 @@ static struct container_verification_code *cvc = NULL;
static bool softrom = false;
static void *secure_rom_mem = NULL;
+static struct dt_node *cvc_resv_mem = NULL;
+static struct dt_node *cvc_node = NULL;
+
struct cvc_service {
int id;
uint64_t addr; /* base_addr + offset */
@@ -137,7 +140,6 @@ static void cvc_service_register(uint32_t id, uint32_t offset, uint32_t version)
static int cvc_reserved_mem_init(struct dt_node *parent) {
struct dt_node *node, *service;
struct dt_node *reserved_mem;
- struct dt_node *cvc_resv_mem = NULL;
uint32_t phandle;
uint64_t addr, size;
@@ -156,6 +158,7 @@ static int cvc_reserved_mem_init(struct dt_node *parent) {
if (dt_node_is_compatible(node, "ibm,container-verification-code")) {
phandle = dt_prop_get_u32(node, "memory-region");
cvc_resv_mem = dt_find_by_phandle(reserved_mem, phandle);
+ cvc_node = node;
break;
}
}
@@ -218,6 +221,34 @@ static int cvc_secure_rom_init(void) {
return 0;
}
+void cvc_update_reserved_memory_phandle(void) {
+ struct dt_node *reserved_mem;
+
+ if (!cvc_resv_mem || !cvc_node)
+ return;
+
+ /*
+ * The linux documentation, reserved-memory.txt, says that memory-region
+ * is a phandle that pairs to a children of /reserved-memory
+ */
+ reserved_mem = dt_find_by_path(dt_root, "/reserved-memory");
+ if (!reserved_mem) {
+ prlog(PR_ERR, "/reserved-memory not found\n");
+ return;
+ }
+ cvc_resv_mem = dt_find_by_name(reserved_mem, cvc_resv_mem->name);
+ if (cvc_resv_mem) {
+ dt_check_del_prop(cvc_node, "memory-region");
+ dt_add_property_cells(cvc_node, "memory-region", cvc_resv_mem->phandle);
+ } else {
+ prlog(PR_WARNING, "CVC not found in /reserved-memory\n");
+ return;
+ }
+
+ cvc_resv_mem = NULL;
+ cvc_node = NULL;
+}
+
int cvc_init(void)
{
struct dt_node *node;
diff --git a/libstb/cvc.h b/libstb/cvc.h
index 13c1b33..6bbd3a3 100644
--- a/libstb/cvc.h
+++ b/libstb/cvc.h
@@ -22,6 +22,7 @@ enum cvc_service_id {
CVC_VERIFY_SERVICE,
};
+void cvc_update_reserved_memory_phandle(void);
int cvc_init(void);
/************************************************************************