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

scc_return_t scc_zeroize_memories ( void   ) 

Zeroize Red and Black memories of the SCC. This will start the Zeroizing process. The routine will return when the memories have zeroized or failed to do so. The driver will poll waiting for this to occur, so this routine must not be called from interrupt level. Some future version of driver may elect instead to sleep.

Returns:
0 or error if initialization fails.

Definition at line 422 of file mxc_scc.c.

{
      scc_return_t return_status = SCC_RET_FAIL;
      uint32_t status;

      if (scc_availability == SCC_STATUS_INITIAL) {
            scc_init();
      }

      if (scc_availability == SCC_STATUS_OK) {
            unsigned long irq_flags;      /* for IRQ save/restore */

            /* Lock access to crypto memory of the SCC */
            spin_lock_irqsave(&scc_crypto_lock, irq_flags);

            /* Start the Zeroize by setting a bit in the SCM_INTERRUPT_CTRL
             * register */
            SCC_WRITE_REGISTER(SCM_INTERRUPT_CTRL,
                           SCM_INTERRUPT_CTRL_MASK_INTERRUPTS
                           | SCM_INTERRUPT_CTRL_ZEROIZE_MEMORY);

            scc_wait_completion();

            /* Get any error info */
            status = SCC_READ_REGISTER(SCM_ERROR_STATUS);

            /* unlock the SCC */
            spin_unlock_irqrestore(&scc_crypto_lock, irq_flags);

            if (!(status & SCM_ERR_ZEROIZE_FAILED)) {
                  return_status = SCC_RET_OK;
            } else {
                  pr_debug
                      ("SCC: Zeroize failed.  SCM Error Status is 0x%08x\n",
                       status);
            }

            /* Clear out any status. */
            SCC_WRITE_REGISTER(SCM_INTERRUPT_CTRL,
                           SCM_INTERRUPT_CTRL_CLEAR_INTERRUPT
                           | SCM_INTERRUPT_CTRL_MASK_INTERRUPTS);

            /* and any error status */
            SCC_WRITE_REGISTER(SCM_ERROR_STATUS, 0);
      }

      return return_status;
}                       /* scc_zeroize_memories */


Generated by  Doxygen 1.6.0   Back to index