Lines Matching refs:tcs

264 	struct tcs_group *tcs = &drv->tcs[type];  in tcs_invalidate()  local
267 if (bitmap_empty(tcs->slots, MAX_TCS_SLOTS)) in tcs_invalidate()
270 for (m = tcs->offset; m < tcs->offset + tcs->num_tcs; m++) in tcs_invalidate()
273 bitmap_zero(tcs->slots, MAX_TCS_SLOTS); in tcs_invalidate()
304 struct tcs_group *tcs; in get_tcs_for_msg() local
327 tcs = &drv->tcs[type]; in get_tcs_for_msg()
328 if (msg->state == RPMH_ACTIVE_ONLY_STATE && !tcs->num_tcs) in get_tcs_for_msg()
329 tcs = &drv->tcs[WAKE_TCS]; in get_tcs_for_msg()
331 return tcs; in get_tcs_for_msg()
353 struct tcs_group *tcs; in get_req_from_tcs() local
357 tcs = &drv->tcs[i]; in get_req_from_tcs()
358 if (tcs->mask & BIT(tcs_id)) in get_req_from_tcs()
359 return tcs->req[tcs_id - tcs->offset]; in get_req_from_tcs()
460 if (!drv->tcs[ACTIVE_TCS].num_tcs) in tcs_tx_done()
473 if (!drv->tcs[ACTIVE_TCS].num_tcs) in tcs_tx_done()
546 static int check_for_req_inflight(struct rsc_drv *drv, struct tcs_group *tcs, in check_for_req_inflight() argument
552 int i = tcs->offset; in check_for_req_inflight()
554 for_each_set_bit_from(i, drv->tcs_in_use, tcs->offset + tcs->num_tcs) { in check_for_req_inflight()
578 static int find_free_tcs(struct tcs_group *tcs) in find_free_tcs() argument
580 const struct rsc_drv *drv = tcs->drv; in find_free_tcs()
582 unsigned long max = tcs->offset + tcs->num_tcs; in find_free_tcs()
584 i = find_next_zero_bit(drv->tcs_in_use, max, tcs->offset); in find_free_tcs()
606 static int claim_tcs_for_req(struct rsc_drv *drv, struct tcs_group *tcs, in claim_tcs_for_req() argument
615 ret = check_for_req_inflight(drv, tcs, msg); in claim_tcs_for_req()
619 return find_free_tcs(tcs); in claim_tcs_for_req()
646 struct tcs_group *tcs; in rpmh_rsc_send_data() local
650 tcs = get_tcs_for_msg(drv, msg); in rpmh_rsc_send_data()
651 if (IS_ERR(tcs)) in rpmh_rsc_send_data()
652 return PTR_ERR(tcs); in rpmh_rsc_send_data()
658 (tcs_id = claim_tcs_for_req(drv, tcs, msg)) >= 0, in rpmh_rsc_send_data()
661 tcs->req[tcs_id - tcs->offset] = msg; in rpmh_rsc_send_data()
663 if (msg->state == RPMH_ACTIVE_ONLY_STATE && tcs->type != ACTIVE_TCS) { in rpmh_rsc_send_data()
703 static int find_slots(struct tcs_group *tcs, const struct tcs_request *msg, in find_slots() argument
711 slot = bitmap_find_next_zero_area(tcs->slots, MAX_TCS_SLOTS, in find_slots()
713 if (slot >= tcs->num_tcs * tcs->ncpt) in find_slots()
715 i += tcs->ncpt; in find_slots()
718 bitmap_set(tcs->slots, slot, msg->num_cmds); in find_slots()
720 offset = slot / tcs->ncpt; in find_slots()
721 *tcs_id = offset + tcs->offset; in find_slots()
722 *cmd_id = slot % tcs->ncpt; in find_slots()
742 struct tcs_group *tcs; in rpmh_rsc_write_ctrl_data() local
746 tcs = get_tcs_for_msg(drv, msg); in rpmh_rsc_write_ctrl_data()
747 if (IS_ERR(tcs)) in rpmh_rsc_write_ctrl_data()
748 return PTR_ERR(tcs); in rpmh_rsc_write_ctrl_data()
751 ret = find_slots(tcs, msg, &tcs_id, &cmd_id); in rpmh_rsc_write_ctrl_data()
776 const struct tcs_group *tcs = &drv->tcs[ACTIVE_TCS]; in rpmh_rsc_ctrlr_is_busy() local
785 if (!tcs->num_tcs) in rpmh_rsc_ctrlr_is_busy()
786 tcs = &drv->tcs[WAKE_TCS]; in rpmh_rsc_ctrlr_is_busy()
788 max = tcs->offset + tcs->num_tcs; in rpmh_rsc_ctrlr_is_busy()
789 set = find_next_bit(drv->tcs_in_use, max, tcs->offset); in rpmh_rsc_ctrlr_is_busy()
807 if (!drv->tcs[CONTROL_TCS].num_tcs || !drv->genpd_nb.notifier_call) in rpmh_rsc_write_next_wakeup()
970 struct tcs_group *tcs; in rpmh_probe_tcs_config() local
1007 tcs = &drv->tcs[tcs_cfg[i].type]; in rpmh_probe_tcs_config()
1008 if (tcs->drv) in rpmh_probe_tcs_config()
1010 tcs->drv = drv; in rpmh_probe_tcs_config()
1011 tcs->type = tcs_cfg[i].type; in rpmh_probe_tcs_config()
1012 tcs->num_tcs = tcs_cfg[i].n; in rpmh_probe_tcs_config()
1013 tcs->ncpt = ncpt; in rpmh_probe_tcs_config()
1015 if (!tcs->num_tcs || tcs->type == CONTROL_TCS) in rpmh_probe_tcs_config()
1018 if (st + tcs->num_tcs > max_tcs || in rpmh_probe_tcs_config()
1019 st + tcs->num_tcs >= BITS_PER_BYTE * sizeof(tcs->mask)) in rpmh_probe_tcs_config()
1022 tcs->mask = ((1 << tcs->num_tcs) - 1) << st; in rpmh_probe_tcs_config()
1023 tcs->offset = st; in rpmh_probe_tcs_config()
1024 st += tcs->num_tcs; in rpmh_probe_tcs_config()
1119 writel_relaxed(drv->tcs[ACTIVE_TCS].mask, in rpmh_rsc_probe()