static int post_cmd_wait_resp( cmd_t *cmd ) { int ret = -1 ; struct te_request *request; struct te_oper_param *param; request = malloc(sizeof(*request)); param = malloc(sizeof(*param)); if(!request || !param){ printf("post cmd out of memory\n"); return -1 ; } package_cmd(request,param, cmd); /* Send request to Swd and wait */ printf("begin to enter smc\n"); ret =sunxi_smc_call( TEE_SMC_SST_COMMAND, virt_to_phys(request), virt_to_phys(param), 0 ); printf("after smc\n"); /* Parse the return from Swd */ parse_resp(request, param, cmd); free(request); free(param); return ret ; }
/* parse the buffer and init the response structure with header list and body */ int http_resp_init(http_resp_t *resp, char *buf, size_t len) { if (!buf) { log_error("http_resp_init: buf is NULL"); return -1; } if (parse_resp(resp, buf, len) < 0) return -1; else return 0; }
/* * Post command to Swd and wait the resp */ static int post_cmd_wait_resp( cmd_t *cmd ) { int ret = -1 ; struct te_request *request; struct te_oper_param *param; struct secure_storage_t *sst ; sst = sst_get_aw_storage(); request = sst->request ; param = sst->param ; package_cmd(request,param, cmd); /* Send request to Swd and wait */ dprintk("begin to enter smc\n"); ret =te_generic_smc( TEE_SMC_SST_COMMAND, virt_to_phys(request), virt_to_phys(param), 0 ); /* ret = call_firmware_op( send_command, TEE_SMC_SST_COMMAND, virt_to_phys(request), virt_to_phys(param), 0 ); */ dprintk("after smc\n"); /* Parse the return from Swd */ parse_resp(request, param, cmd); return 0 ; }