[Skiboot] [PATCH 1/3] libstb: export CVC/securerom code memory range
Stewart Smith
stewart at linux.ibm.com
Mon Jul 29 11:44:28 AEST 2019
This is useful to capture a real in-memory image for use in a simulator
(such as Mambo) without having to go through the complexity of setting
up the in-memory image yourself.
Signed-off-by: Stewart Smith <stewart at linux.ibm.com>
---
libstb/cvc.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/libstb/cvc.c b/libstb/cvc.c
index d46617b29070..37ba29f6273b 100644
--- a/libstb/cvc.c
+++ b/libstb/cvc.c
@@ -140,6 +140,7 @@ 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 *exports;
uint32_t phandle;
uint64_t addr, size;
@@ -169,6 +170,13 @@ static int cvc_reserved_mem_init(struct dt_node *parent) {
addr = dt_get_address(cvc_resv_mem, 0, &size);
cvc_register(addr, addr + size-1);
+ exports = dt_find_by_path(dt_root, "/ibm,opal/firmware/exports");
+ if (!exports) {
+ prerror("OCC: dt node /ibm,opal/firmware/exports not found\n");
+ return false;
+ }
+ dt_add_property_u64s(exports, "CVC", addr, size-1);
+
/*
* Each child of the CVC node describes a CVC service
*/
@@ -197,8 +205,9 @@ static int cvc_reserved_mem_init(struct dt_node *parent) {
static int cvc_secure_rom_init(void) {
const uint32_t reg_addr = SECURE_ROM_XSCOM_ADDRESS;
- uint64_t reg_data;
+ struct dt_node *exports;
struct proc_chip *chip;
+ uint64_t reg_data;
if (!secure_rom_mem) {
secure_rom_mem = malloc(SECURE_ROM_MEMORY_SIZE);
@@ -216,6 +225,16 @@ static int cvc_secure_rom_init(void) {
SECURE_ROM_MEMORY_SIZE);
cvc_register((uint64_t)secure_rom_mem,
(uint64_t)secure_rom_mem + SECURE_ROM_MEMORY_SIZE-1);
+
+ exports = dt_find_by_path(dt_root, "/ibm,opal/firmware/exports");
+ if (!exports) {
+ prerror("OCC: dt node /ibm,opal/firmware/exports not found\n");
+ return false;
+ }
+
+ dt_add_property_u64s(exports, "securerom", (uint64_t)secure_rom_mem,
+ SECURE_ROM_MEMORY_SIZE-1);
+
cvc_service_register(CVC_SHA512_SERVICE, SECURE_ROM_SHA512_OFFSET, 1);
cvc_service_register(CVC_VERIFY_SERVICE, SECURE_ROM_VERIFY_OFFSET, 1);
return 0;
--
2.21.0
More information about the Skiboot
mailing list