static int scc2_test_engage_part(unsigned long scc_data) { uint8_t umid[16]; scc_partition_access acc; int status; uint8_t* umid_ptr = NULL; printk(KERN_ALERT "calling copy_from_user\n"); status = copy_from_user(&acc, (void*)scc_data, sizeof(acc)); if (status == 0) { if (acc.umid != NULL) { printk(KERN_ALERT "calling copy_from_user\n"); status = copy_from_user(umid, acc.umid, 16); umid_ptr = umid; } if (status == 0) { printk(KERN_ALERT "calling engage_partition\n"); acc.scc_status = scc_engage_partition((void*)acc.virt_address, umid_ptr, acc.permissions); status = copy_to_user((void*)scc_data, &acc, sizeof(acc)); } } return status; }
void *fsl_shw_smalloc(fsl_shw_uco_t * user_ctx, uint32_t size, const uint8_t * UMID, uint32_t permissions) { #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; } printk(KERN_ALERT "In fsh_shw_smalloc (km): partition_base:%p " "partition_base_phys: %p\n", part_base, (void *)part_phys); /* these bits should be in a separate function */ printk(KERN_ALERT "writing UMID and MAP to secure the partition\n"); scc_engage_partition(part_base, UMID, permissions); (void)user_ctx; /* unused param warning */ return part_base; #else /* FSL_HAVE_SCC2 */ (void)user_ctx; (void)size; (void)UMID; (void)permissions; return NULL; #endif /* FSL_HAVE_SCC2 */ }