Lines Matching refs:res

74 static void ffa_to_smccc_error(struct arm_smccc_res *res, u64 ffa_errno)
76 *res = (struct arm_smccc_res) {
82 static void ffa_to_smccc_res_prop(struct arm_smccc_res *res, int ret, u64 prop)
85 *res = (struct arm_smccc_res) { .a0 = FFA_SUCCESS,
88 ffa_to_smccc_error(res, ret);
92 static void ffa_to_smccc_res(struct arm_smccc_res *res, int ret)
94 ffa_to_smccc_res_prop(res, ret, 0);
98 struct arm_smccc_res *res)
100 cpu_reg(ctxt, 0) = res->a0;
101 cpu_reg(ctxt, 1) = res->a1;
102 cpu_reg(ctxt, 2) = res->a2;
103 cpu_reg(ctxt, 3) = res->a3;
116 struct arm_smccc_res res;
123 &res);
125 return res.a0 == FFA_SUCCESS ? FFA_RET_SUCCESS : res.a2;
130 struct arm_smccc_res res;
135 &res);
137 return res.a0 == FFA_SUCCESS ? FFA_RET_SUCCESS : res.a2;
140 static void ffa_mem_frag_tx(struct arm_smccc_res *res, u32 handle_lo,
146 res);
149 static void ffa_mem_frag_rx(struct arm_smccc_res *res, u32 handle_lo,
155 res);
158 static void ffa_mem_xfer(struct arm_smccc_res *res, u64 func_id, u32 len,
163 res);
166 static void ffa_mem_reclaim(struct arm_smccc_res *res, u32 handle_lo,
172 res);
175 static void ffa_retrieve_req(struct arm_smccc_res *res, u32 len)
180 res);
183 static void ffa_rx_release(struct arm_smccc_res *res)
188 res);
191 static void do_ffa_rxtx_map(struct arm_smccc_res *res,
256 ffa_to_smccc_res(res, ret);
270 static void do_ffa_rxtx_unmap(struct arm_smccc_res *res,
300 ffa_to_smccc_res(res, ret);
371 static void do_ffa_mem_frag_tx(struct arm_smccc_res *res,
403 ffa_mem_reclaim(res, handle_lo, handle_hi, 0);
404 WARN_ON(res->a0 != FFA_SUCCESS);
408 ffa_mem_frag_tx(res, handle_lo, handle_hi, fraglen, endpoint_id);
409 if (res->a0 != FFA_SUCCESS && res->a0 != FFA_MEM_FRAG_RX)
416 ffa_to_smccc_res(res, ret);
430 struct arm_smccc_res *res,
494 ffa_mem_xfer(res, func_id, len, fraglen);
496 if (res->a0 != FFA_MEM_FRAG_RX)
499 if (res->a3 != fraglen)
501 } else if (res->a0 != FFA_SUCCESS) {
509 ffa_to_smccc_res(res, ret);
517 #define do_ffa_mem_xfer(fid, res, ctxt) \
521 __do_ffa_mem_xfer((fid), (res), (ctxt)); \
524 static void do_ffa_mem_reclaim(struct arm_smccc_res *res,
547 ffa_retrieve_req(res, sizeof(*buf));
549 if (res->a0 != FFA_MEM_RETRIEVE_RESP)
552 len = res->a1;
553 fraglen = res->a2;
566 ffa_rx_release(res);
572 ffa_rx_release(res);
578 ffa_rx_release(res);
581 ffa_mem_frag_rx(res, handle_lo, handle_hi, fragoff);
582 if (res->a0 != FFA_MEM_FRAG_TX) {
587 fraglen = res->a3;
589 ffa_rx_release(res);
592 ffa_mem_reclaim(res, handle_lo, handle_hi, flags);
593 if (res->a0 != FFA_SUCCESS)
604 ffa_to_smccc_res(res, ret);
637 static bool do_ffa_features(struct arm_smccc_res *res,
662 ffa_to_smccc_res_prop(res, ret, prop);
669 struct arm_smccc_res res;
671 arm_smccc_1_1_smc(FFA_ID_GET, 0, 0, 0, 0, 0, 0, 0, &res);
672 if (res.a0 != FFA_SUCCESS)
675 if (res.a2 != HOST_FFA_ID)
679 0, 0, 0, 0, 0, 0, &res);
680 if (res.a0 != FFA_SUCCESS)
683 switch (res.a2) {
703 static void do_ffa_version(struct arm_smccc_res *res,
709 res->a0 = FFA_RET_NOT_SUPPORTED;
715 res->a0 = hyp_ffa_version;
726 res);
727 if (res->a0 == FFA_RET_NOT_SUPPORTED)
734 res->a0 = FFA_RET_NOT_SUPPORTED;
737 res->a0 = hyp_ffa_version;
743 static void do_ffa_part_get(struct arm_smccc_res *res,
755 ffa_to_smccc_res(res, FFA_RET_BUSY);
761 res);
763 if (res->a0 != FFA_SUCCESS)
766 count = res->a2;
775 partition_sz = res->a3;
783 ffa_to_smccc_res(res, FFA_RET_ABORTED);
794 struct arm_smccc_res res;
814 ffa_to_smccc_error(&res, FFA_RET_INVALID_PARAMETERS);
820 if (!do_ffa_features(&res, host_ctxt))
825 do_ffa_rxtx_map(&res, host_ctxt);
828 do_ffa_rxtx_unmap(&res, host_ctxt);
832 do_ffa_mem_xfer(FFA_FN64_MEM_SHARE, &res, host_ctxt);
835 do_ffa_mem_reclaim(&res, host_ctxt);
839 do_ffa_mem_xfer(FFA_FN64_MEM_LEND, &res, host_ctxt);
842 do_ffa_mem_frag_tx(&res, host_ctxt);
845 do_ffa_version(&res, host_ctxt);
848 do_ffa_part_get(&res, host_ctxt);
855 ffa_to_smccc_error(&res, FFA_RET_NOT_SUPPORTED);
857 ffa_set_retval(host_ctxt, &res);
863 struct arm_smccc_res res;
869 arm_smccc_1_1_smc(FFA_VERSION, FFA_VERSION_1_1, 0, 0, 0, 0, 0, 0, &res);
870 if (res.a0 == FFA_RET_NOT_SUPPORTED)
886 if (FFA_MAJOR_VERSION(res.a0) != 1)
889 if (FFA_MINOR_VERSION(res.a0) < FFA_MINOR_VERSION(FFA_VERSION_1_1))
890 hyp_ffa_version = res.a0;