From 32765e19a22f8366e562d7649cd726dc415600e1 Mon Sep 17 00:00:00 2001 From: Anshuman Khandual Date: Mon, 29 Sep 2014 20:15:36 +0530 Subject: dpo: Return OPAL_WRONG_STATE when not in DPO pending state This patch changes fsp_opal_get_dpo_status function to return OPAL_WRONG_STATE when not in DPO pending state. This will help the host to differentiate whether the system is in DPO pending state or not and then analyse the returned timeout value correctly. Signed-off-by: Anshuman Khandual Reviewed-by: Vasant Hegde Signed-off-by: Benjamin Herrenschmidt --- hw/fsp/fsp-dpo.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/fsp/fsp-dpo.c b/hw/fsp/fsp-dpo.c index 788c6c4..08d2ef2 100644 --- a/hw/fsp/fsp-dpo.c +++ b/hw/fsp/fsp-dpo.c @@ -43,13 +43,13 @@ unsigned long fsp_dpo_init_tb = 0; */ static int64_t fsp_opal_get_dpo_status(int64_t *dpo_timeout) { - int64_t timeout = 0; - - if (fsp_dpo_init_tb && fsp_dpo_pending) - timeout = DPO_TIMEOUT - tb_to_secs(mftb() - fsp_dpo_init_tb); - - *dpo_timeout = timeout; - return OPAL_SUCCESS; + if (fsp_dpo_init_tb && fsp_dpo_pending) { + *dpo_timeout = DPO_TIMEOUT - tb_to_secs(mftb() - fsp_dpo_init_tb); + return OPAL_SUCCESS; + } else { + *dpo_timeout = 0; + return OPAL_WRONG_STATE; + } } /* Process FSP DPO init message */ -- cgit v1.1