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

scc_partition_status_t scc_partition_status ( void *  part_base  ) 

Query the status of a partition of secure memory

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

Definition at line 379 of file scc2_driver.c.

References scc_config_t::partition_count, partition_engaged(), SCC_PART_S_ALLOCATED, SCC_PART_S_AVAILABLE, SCC_PART_S_ENGAGED, SCC_PART_S_UNAVAILABLE, SCC_PART_S_UNUSABLE, SCC_READ_REGISTER, SCM_PART_NUMBER, SCM_PART_OWNERS_REG, SCM_POWN_MASK, SCM_POWN_PART_FREE, SCM_POWN_PART_OTHER, SCM_POWN_PART_OWNED, SCM_POWN_PART_UNUSABLE, and SCM_POWN_SHIFT.

Referenced by fsl_shw_sstatus().

{
      uint32_t part_no;
      uint32_t part_owner;

      /* Determine the partition number from the address */
      part_no = SCM_PART_NUMBER((uint32_t) part_base);

      /* Check if the partition is implemented */
      if (part_no >= scc_configuration.partition_count) {
            return SCC_PART_S_UNUSABLE;
      }

      /* Determine the value of the partition owners register */
      part_owner = (SCC_READ_REGISTER(SCM_PART_OWNERS_REG)
                  >> (part_no * SCM_POWN_SHIFT)) & SCM_POWN_MASK;

      switch (part_owner) {
      case SCM_POWN_PART_OTHER:
            return SCC_PART_S_UNAVAILABLE;
            break;
      case SCM_POWN_PART_FREE:
            return SCC_PART_S_AVAILABLE;
            break;
      case SCM_POWN_PART_OWNED:
            /* could be allocated or engaged*/
            if (partition_engaged(part_no)) {
                  return SCC_PART_S_ENGAGED;
            } else {
                  return SCC_PART_S_ALLOCATED;
            }
            break;
      case SCM_POWN_PART_UNUSABLE:
      default:
            return SCC_PART_S_UNUSABLE;
            break;
      }
}


Generated by  Doxygen 1.6.0   Back to index