Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

static scc_return_t check_register_accessible ( uint32_t  register_offset,
uint32_t  smn_status,
uint32_t  scm_status 
) [static]

Given the current SCM and SMN status, verify that access to the requested register should be OK.

Parameters:
[in] register_offset register offset within SCC
[in] smn_status recent value from SMN_STATUS
[in] scm_status recent value from SCM_STATUS
Returns:
SCC_RET_OK if ok, SCC_RET_FAIL if not

Definition at line 2258 of file mxc_scc.c.

References offset_within_scm(), offset_within_smn(), SCC_RET_FAIL, SCC_RET_OK, SCM_CONFIGURATION, SCM_ERROR_STATUS, SCM_INTERRUPT_CTRL, SCM_STATUS, SCM_STATUS_BUSY, SMN_COMMAND, SMN_DEBUG_DETECT_STAT, SMN_STATE_FAIL, SMN_STATUS, and SMN_STATUS_STATE_MASK.

Referenced by scc_read_register(), and scc_write_register().

{
      int error_code = SCC_RET_FAIL;

      /* Verify that the register offset passed in is not among the verboten set
       * if the SMN is in Fail mode.
       */
      if (offset_within_smn(register_offset)) {
            if ((smn_status & SMN_STATUS_STATE_MASK) == SMN_STATE_FAIL) {
                  if (!((register_offset == SMN_STATUS) ||
                        (register_offset == SMN_COMMAND) ||
                        (register_offset == SMN_DEBUG_DETECT_STAT))) {
                        pr_debug
                            ("SCC Driver: Note: Security State is in FAIL state.\n");
                  } /* register not a safe one */
                  else {
                        /* SMN is in  FAIL, but register is a safe one */
                        error_code = SCC_RET_OK;
                  }
            } /* State is FAIL */
            else {
                  /* State is not fail.  All registers accessible. */
                  error_code = SCC_RET_OK;
            }
      }
      /* offset within SMN */
      /*  Not SCM register.  Check for SCM busy. */
      else if (offset_within_scm(register_offset)) {
            /* This is the 'cannot access' condition in the SCM */
            if ((scm_status & SCM_STATUS_BUSY)
                /* these are always available  - rest fail on busy */
                && !((register_offset == SCM_STATUS) ||
                   (register_offset == SCM_ERROR_STATUS) ||
                   (register_offset == SCM_INTERRUPT_CTRL) ||
                   (register_offset == SCM_CONFIGURATION))) {
                  pr_debug
                      ("SCC Driver: Note: Secure Memory is in BUSY state.\n");
            } /* status is busy & register inaccessible */
            else {
                  error_code = SCC_RET_OK;
            }
      }
      /* offset within SCM */
      return error_code;

}                       /* check_register_accessible() */


Generated by  Doxygen 1.6.0   Back to index