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

void* fsl_shw_smalloc ( fsl_shw_uco_t user_ctx,
uint32_t  size,
const uint8_t *  UMID,
uint32_t  permissions 

Allocate a block of secure memory

user_ctx User context
size Memory size (octets). Note: currently only supports only single-partition sized blocks.
UMID User Mode ID to use when registering the partition.
permissions Permissions to initialize the partition with. Can be made by ORing flags from the fsl_shw_permission_t.
Address of the allocated memory. NULL if the call was not successful.

Definition at line 2067 of file shw_driver.c.

References scc_config_t::partition_size_bytes, scc_allocate_partition(), scc_configuration, scc_engage_partition(), scc_get_configuration(), scc_release_partition(), and SCC_RET_OK.

#ifdef FSL_HAVE_SCC2
      int part_no;
      void *part_base;
      uint32_t part_phys;
      scc_config_t *scc_configuration;

      /* Check that the memory size requested is correct */
      scc_configuration = scc_get_configuration();
      if (size != scc_configuration->partition_size_bytes) {
            return NULL;

      /* attempt to grab a partition. */
      if (scc_allocate_partition(0, &part_no, &part_base, &part_phys)
          != SCC_RET_OK) {
            return NULL;
#ifdef SHW_DEBUG
      LOG_KDIAG_ARGS("Partition_base: %p, partition_base_phys: %p\n",
                   part_base, (void *)part_phys);

      if (scc_engage_partition(part_base, UMID, permissions)
          != SCC_RET_OK) {
            /* Engagement failed, so the partition needs to be de-allocated */

#ifdef SHW_DEBUG
            LOG_KDIAG_ARGS("Failed to engage partition %p, de-allocating",

            return NULL;

      return part_base;

#else                   /* FSL_HAVE_SCC2 */

      return NULL;

#endif                        /* FSL_HAVE_SCC2 */

Generated by  Doxygen 1.6.0   Back to index