Browse Source

intel: Fix mailbox config return status

Modify mailbox config return code to improve debugging.

Signed-off-by: Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com>
Change-Id: I0a223291f4c5296203b3295a679a5857a446c692
pull/1937/head
Hadi Asyrafi 5 years ago
parent
commit
b68ba6cc79
  1. 26
      plat/intel/soc/common/include/socfpga_mailbox.h
  2. 12
      plat/intel/soc/common/soc/socfpga_mailbox.c

26
plat/intel/soc/common/include/socfpga_mailbox.h

@ -79,14 +79,24 @@
#define MBOX_WRONG_ID -3
/* Mailbox status */
#define RECONFIG_STATUS_STATE 0
#define RECONFIG_STATUS_PIN_STATUS 2
#define RECONFIG_STATUS_SOFTFUNC_STATUS 3
#define PIN_STATUS_NSTATUS (U(1) << 31)
#define SOFTFUNC_STATUS_SEU_ERROR (1 << 3)
#define SOFTFUNC_STATUS_INIT_DONE (1 << 1)
#define SOFTFUNC_STATUS_CONF_DONE (1 << 0)
#define MBOX_CFGSTAT_STATE_CONFIG 0x10000000
#define RECONFIG_STATUS_STATE 0
#define RECONFIG_STATUS_PIN_STATUS 2
#define RECONFIG_STATUS_SOFTFUNC_STATUS 3
#define PIN_STATUS_NSTATUS (U(1) << 31)
#define SOFTFUNC_STATUS_SEU_ERROR (1 << 3)
#define SOFTFUNC_STATUS_INIT_DONE (1 << 1)
#define SOFTFUNC_STATUS_CONF_DONE (1 << 0)
#define MBOX_CFGSTAT_STATE_IDLE 0x00000000
#define MBOX_CFGSTAT_STATE_CONFIG 0x10000000
#define MBOX_CFGSTAT_STATE_FAILACK 0x08000000
#define MBOX_CFGSTAT_STATE_ERROR_INVALID 0xf0000001
#define MBOX_CFGSTAT_STATE_ERROR_CORRUPT 0xf0000002
#define MBOX_CFGSTAT_STATE_ERROR_AUTH 0xf0000003
#define MBOX_CFGSTAT_STATE_ERROR_CORE_IO 0xf0000004
#define MBOX_CFGSTAT_STATE_ERROR_HARDWARE 0xf0000005
#define MBOX_CFGSTAT_STATE_ERROR_FAKE 0xf0000006
#define MBOX_CFGSTAT_STATE_ERROR_BOOT_INFO 0xf0000007
#define MBOX_CFGSTAT_STATE_ERROR_QSPI_ERROR 0xf0000008
/* Mailbox reconfiguration commands */
#define MBOX_CONFIG_STATUS 4

12
plat/intel/soc/common/soc/socfpga_mailbox.c

@ -291,23 +291,23 @@ uint32_t intel_mailbox_get_config_status(uint32_t cmd)
status = mailbox_send_cmd(1, cmd, NULL, 0, 0, response);
if (status < 0)
return INTEL_SIP_SMC_STATUS_ERROR;
return status;
res = response[RECONFIG_STATUS_STATE];
if (res && res != MBOX_CFGSTAT_STATE_CONFIG)
return INTEL_SIP_SMC_STATUS_ERROR;
return res;
res = response[RECONFIG_STATUS_PIN_STATUS];
if (!(res & PIN_STATUS_NSTATUS))
return INTEL_SIP_SMC_STATUS_ERROR;
return MBOX_CFGSTAT_STATE_ERROR_HARDWARE;
res = response[RECONFIG_STATUS_SOFTFUNC_STATUS];
if (res & SOFTFUNC_STATUS_SEU_ERROR)
return INTEL_SIP_SMC_STATUS_ERROR;
return MBOX_CFGSTAT_STATE_ERROR_HARDWARE;
if ((res & SOFTFUNC_STATUS_CONF_DONE) &&
(res & SOFTFUNC_STATUS_INIT_DONE))
return INTEL_SIP_SMC_STATUS_OK;
return 0;
return INTEL_SIP_SMC_STATUS_BUSY;
return MBOX_CFGSTAT_STATE_CONFIG;
}

Loading…
Cancel
Save