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

scc_return_t scc_release_partition ( void *  part_base  ) 

Release a partition of secure memory

Parameters:
part_base Kernel virtual address of the partition to be released.
Returns:
SCC_RET_OK if successful.

Definition at line 298 of file scc2_driver.c.

References host_owns_partition(), SCC_READ_REGISTER, SCC_RET_FAIL, SCC_RET_OK, scc_write_register(), SCM_PART_NUMBER, SCM_PART_OWNERS_REG, SCM_ZCMD_CCMD_SHIFT, SCM_ZCMD_PART_SHIFT, SCM_ZCMD_REG, and ZCMD_DEALLOC_PART.

Referenced by fsl_shw_deregister_user(), fsl_shw_sfree(), fsl_shw_smalloc(), OS_DEV_MMAP(), and sah_handle_deregistration().

{
      uint32_t partition_no;

      if (part_base == NULL) {
            return SCC_RET_FAIL;
      }

      /* Ensure that this is a proper partition location */
      partition_no = SCM_PART_NUMBER((uint32_t) part_base);

      pr_debug("SCC2: Attempting to release partition %i, owners:%08x\n",
             partition_no, SCC_READ_REGISTER(SCM_PART_OWNERS_REG));

      /* check that the partition is ours to de-establish */
      if (!host_owns_partition(partition_no)) {
            return SCC_RET_FAIL;
      }

      /* TODO: The state of the zeroize engine (SRS field in the Command Status
       * Register) should be examined before issuing the zeroize command here.
       * To make the driver thread-safe, a lock should be taken out before
       * issuing the check and released after the zeroize command has been
       * issued.
       */

      /* Zero the partition to release it */
      scc_write_register(SCM_ZCMD_REG,
                     (partition_no << SCM_ZCMD_PART_SHIFT) |
                     (ZCMD_DEALLOC_PART << SCM_ZCMD_CCMD_SHIFT));
      mdelay(2);

      pr_debug("SCC2: done releasing partition %i, owners:%08x\n",
             partition_no, SCC_READ_REGISTER(SCM_PART_OWNERS_REG));

      /* Check that the de-assignment went correctly */
      if (host_owns_partition(partition_no)) {
            return SCC_RET_FAIL;
      }

      return SCC_RET_OK;
}


Generated by  Doxygen 1.6.0   Back to index