From e2ab540ac169cac9737ff09605182a333086f848 Mon Sep 17 00:00:00 2001 From: Vasant Hegde Date: Thu, 21 Sep 2017 19:49:47 +0530 Subject: [PATCH 1/2] opal-prd: Fix occ_reset call HBRT OCC reset interface depends on service processor type. FSP -> reset_pm_complex() BMC -> process_occ_reset() This patch adds logic to detect service processor type and then make appropriate occ reset call. CC: Jeremy Kerr CC: Daniel M Crowell Signed-off-by: Vasant Hegde Signed-off-by: Shilpasri G Bhat Signed-off-by: Vasant Hegde Signed-off-by: Shilpasri G Bhat Signed-off-by: Stewart Smith --- external/opal-prd/opal-prd.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c index a09a6366..20ce5dac 100644 --- a/external/opal-prd/opal-prd.c +++ b/external/opal-prd/opal-prd.c @@ -246,6 +246,21 @@ static void pr_log_daemon_init(void) } } +/* Check service processor type */ +static bool is_fsp_system(void) +{ + char *path; + int rc; + + rc = asprintf(&path, "%s/fsps", devicetree_base); + if (rc < 0) { + pr_log(LOG_ERR, "FW: error creating '/fsps' path %m"); + return false; + } + + return access(path, F_OK) ? false : true; +} + /** * ABI check that we can't perform at build-time: we want to ensure that the * layout of struct host_interfaces matches that defined in the thunk. @@ -1336,18 +1351,27 @@ static int pm_complex_reset(uint64_t chip) { int rc; - if (hservice_runtime->reset_pm_complex) { + /* + * FSP system -> reset_pm_complex + * BMC system -> process_occ_reset + */ + if (is_fsp_system()) { + if (!hservice_runtime->reset_pm_complex) { + pr_log_nocall("reset_pm_complex"); + return -1; + } + pr_debug("PM: calling pm_complex_reset(%ld)", chip); rc = call_reset_pm_complex(chip); + } else { + if (!hservice_runtime->process_occ_reset) { + pr_log_nocall("process_occ_reset"); + return -1; + } - } else if (hservice_runtime->process_occ_reset) { pr_debug("PM: calling process_occ_reset(%ld)", chip); call_process_occ_reset(chip); rc = 0; - - } else { - pr_log_nocall("reset_pm_complex/process_occ_reset"); - rc = -1; } return rc; -- 2.13.5