diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2015-10-12 11:16:25 +0800 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-10-14 16:33:59 +1100 |
commit | 2079f407966e17500ef2d0af37db719408be8bce (patch) | |
tree | 12ade7cb5e18e61ff2df0b403cf4e9a724312d73 /external | |
parent | 56f82b7131f26598e9dd8d20ce1dd4a5a599ff7d (diff) | |
download | skiboot-2079f407966e17500ef2d0af37db719408be8bce.zip skiboot-2079f407966e17500ef2d0af37db719408be8bce.tar.gz skiboot-2079f407966e17500ef2d0af37db719408be8bce.tar.bz2 |
opal-prd: Improve error-checking in hservices_init
Currently, a signature failure for the HBRT image prints a log message,
but doesn't actually abort the initialisation.
This change adds a failure path for this, as well as hbrt_init()
returning NULL.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/opal-prd/opal-prd.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c index 91db5e6..83c5cb5 100644 --- a/external/opal-prd/opal-prd.c +++ b/external/opal-prd/opal-prd.c @@ -631,7 +631,7 @@ int hservice_memory_error(uint64_t i_start_addr, uint64_t i_endAddr, return 0; } -void hservices_init(struct opal_prd_ctx *ctx, void *code) +int hservices_init(struct opal_prd_ctx *ctx, void *code) { uint64_t *s, *d; int i, sz; @@ -644,12 +644,19 @@ void hservices_init(struct opal_prd_ctx *ctx, void *code) hbrt_entry.addr = (void *)htobe64((unsigned long)code + 0x100); hbrt_entry.toc = 0; /* No toc for init entry point */ - if (memcmp(code, "HBRTVERS", 8) != 0) + if (memcmp(code, "HBRTVERS", 8) != 0) { pr_log(LOG_ERR, "IMAGE: Bad signature for " "ibm,hbrt-code-image! exiting"); + return -1; + } pr_debug("IMAGE: calling ibm,hbrt_init()"); hservice_runtime = call_hbrt_init(&hinterface); + if (!hservice_runtime) { + pr_log(LOG_ERR, "IMAGE: hbrt_init failed, exiting"); + return -1; + } + pr_log(LOG_NOTICE, "IMAGE: hbrt_init complete, version %016lx", hservice_runtime->interface_version); @@ -659,6 +666,8 @@ void hservices_init(struct opal_prd_ctx *ctx, void *code) /* Byte swap the function pointers */ for (i = 0; i < sz; i++) d[i] = be64toh(s[i]); + + return 0; } static void fixup_hinterface_table(void) @@ -1556,7 +1565,11 @@ static int run_prd_daemon(struct opal_prd_ctx *ctx) ipmi_init(ctx); pr_debug("HBRT: calling hservices_init"); - hservices_init(ctx, ctx->code_addr); + rc = hservices_init(ctx, ctx->code_addr); + if (rc) { + pr_log(LOG_ERR, "HBRT: Can't initiliase HBRT"); + goto out_close; + } pr_debug("HBRT: hservices_init done"); /* Test a scom */ |