Lines Matching refs:thrd

560 static inline bool _queue_full(struct pl330_thread *thrd)  in _queue_full()  argument
562 return thrd->req[0].desc != NULL && thrd->req[1].desc != NULL; in _queue_full()
565 static inline bool is_manager(struct pl330_thread *thrd) in is_manager() argument
567 return thrd->dmac->manager == thrd; in is_manager()
571 static inline bool _manager_ns(struct pl330_thread *thrd) in _manager_ns() argument
573 return (thrd->dmac->pcfg.mode & DMAC_MODE_NS) ? true : false; in _manager_ns()
888 static bool _until_dmac_idle(struct pl330_thread *thrd) in _until_dmac_idle() argument
890 void __iomem *regs = thrd->dmac->base; in _until_dmac_idle()
907 static inline void _execute_DBGINSN(struct pl330_thread *thrd, in _execute_DBGINSN() argument
910 void __iomem *regs = thrd->dmac->base; in _execute_DBGINSN()
914 if (_until_dmac_idle(thrd)) { in _execute_DBGINSN()
915 dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n"); in _execute_DBGINSN()
922 val |= (thrd->id << 8); /* Channel Number */ in _execute_DBGINSN()
933 static inline u32 _state(struct pl330_thread *thrd) in _state() argument
935 void __iomem *regs = thrd->dmac->base; in _state()
938 if (is_manager(thrd)) in _state()
941 val = readl(regs + CS(thrd->id)) & 0xf; in _state()
957 if (is_manager(thrd)) in _state()
962 if (is_manager(thrd)) in _state()
967 if (is_manager(thrd)) in _state()
972 if (is_manager(thrd)) in _state()
977 if (is_manager(thrd)) in _state()
982 if (is_manager(thrd)) in _state()
991 static void _stop(struct pl330_thread *thrd) in _stop() argument
993 void __iomem *regs = thrd->dmac->base; in _stop()
997 if (_state(thrd) == PL330_STATE_FAULT_COMPLETING) in _stop()
998 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in _stop()
1001 if (_state(thrd) == PL330_STATE_COMPLETING in _stop()
1002 || _state(thrd) == PL330_STATE_KILLING in _stop()
1003 || _state(thrd) == PL330_STATE_STOPPED) in _stop()
1008 _execute_DBGINSN(thrd, insn, is_manager(thrd)); in _stop()
1011 if (inten & (1 << thrd->ev)) in _stop()
1012 writel(1 << thrd->ev, regs + INTCLR); in _stop()
1014 writel(inten & ~(1 << thrd->ev), regs + INTEN); in _stop()
1018 static bool _trigger(struct pl330_thread *thrd) in _trigger() argument
1020 void __iomem *regs = thrd->dmac->base; in _trigger()
1029 if (_state(thrd) != PL330_STATE_STOPPED) in _trigger()
1032 idx = 1 - thrd->lstenq; in _trigger()
1033 if (thrd->req[idx].desc != NULL) { in _trigger()
1034 req = &thrd->req[idx]; in _trigger()
1036 idx = thrd->lstenq; in _trigger()
1037 if (thrd->req[idx].desc != NULL) in _trigger()
1038 req = &thrd->req[idx]; in _trigger()
1048 if (idx == thrd->req_running) in _trigger()
1056 if (_manager_ns(thrd) && !ns) in _trigger()
1057 dev_info(thrd->dmac->ddma.dev, "%s:%d Recipe for ABORT!\n", in _trigger()
1060 go.chan = thrd->id; in _trigger()
1066 writel(readl(regs + INTEN) | (1 << thrd->ev), regs + INTEN); in _trigger()
1069 _execute_DBGINSN(thrd, insn, true); in _trigger()
1071 thrd->req_running = idx; in _trigger()
1076 static bool _start(struct pl330_thread *thrd) in _start() argument
1078 switch (_state(thrd)) { in _start()
1080 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in _start()
1082 if (_state(thrd) == PL330_STATE_KILLING) in _start()
1083 UNTIL(thrd, PL330_STATE_STOPPED) in _start()
1087 _stop(thrd); in _start()
1092 UNTIL(thrd, PL330_STATE_STOPPED) in _start()
1096 return _trigger(thrd); in _start()
1607 struct pl330_thread *thrd, unsigned index, in _setup_req() argument
1610 struct _pl330_req *req = &thrd->req[index]; in _setup_req()
1623 off += _emit_SEV(dry_run, &buf[off], thrd->ev); in _setup_req()
1628 pxs, thrd->ev); in _setup_req()
1671 static int pl330_submit_req(struct pl330_thread *thrd, in pl330_submit_req() argument
1674 struct pl330_dmac *pl330 = thrd->dmac; in pl330_submit_req()
1696 || pl330->dmac_tbd.reset_chan & (1 << thrd->id)) { in pl330_submit_req()
1697 dev_info(thrd->dmac->ddma.dev, "%s:%d\n", in pl330_submit_req()
1705 dev_info(thrd->dmac->ddma.dev, in pl330_submit_req()
1713 if (_queue_full(thrd)) { in pl330_submit_req()
1719 if (!_manager_ns(thrd)) in pl330_submit_req()
1726 idx = thrd->req[0].desc == NULL ? 0 : 1; in pl330_submit_req()
1732 ret = _setup_req(pl330, 1, thrd, idx, &xs); in pl330_submit_req()
1744 thrd->lstenq = idx; in pl330_submit_req()
1745 thrd->req[idx].desc = desc; in pl330_submit_req()
1746 _setup_req(pl330, 0, thrd, idx, &xs); in pl330_submit_req()
1807 struct pl330_thread *thrd = &pl330->channels[i]; in pl330_dotask() local
1811 _stop(thrd); in pl330_dotask()
1813 if (readl(regs + FSC) & (1 << thrd->id)) in pl330_dotask()
1819 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, err); in pl330_dotask()
1820 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, err); in pl330_dotask()
1823 thrd->req[0].desc = NULL; in pl330_dotask()
1824 thrd->req[1].desc = NULL; in pl330_dotask()
1825 thrd->req_running = -1; in pl330_dotask()
1885 struct pl330_thread *thrd; in pl330_update() local
1897 thrd = &pl330->channels[id]; in pl330_update()
1899 active = thrd->req_running; in pl330_update()
1904 descdone = thrd->req[active].desc; in pl330_update()
1907 thrd->req[active].desc = NULL; in pl330_update()
1908 thrd->req_running = -1; in pl330_update()
1910 _start(thrd); in pl330_update()
1943 static inline int _alloc_event(struct pl330_thread *thrd) in _alloc_event() argument
1945 struct pl330_dmac *pl330 = thrd->dmac; in _alloc_event()
1950 pl330->events[ev] = thrd->id; in _alloc_event()
1967 struct pl330_thread *thrd = NULL; in pl330_request_channel() local
1976 thrd = &pl330->channels[i]; in pl330_request_channel()
1977 if ((thrd->free) && (!_manager_ns(thrd) || in pl330_request_channel()
1979 thrd->ev = _alloc_event(thrd); in pl330_request_channel()
1980 if (thrd->ev >= 0) { in pl330_request_channel()
1981 thrd->free = false; in pl330_request_channel()
1982 thrd->lstenq = 1; in pl330_request_channel()
1983 thrd->req[0].desc = NULL; in pl330_request_channel()
1984 thrd->req[1].desc = NULL; in pl330_request_channel()
1985 thrd->req_running = -1; in pl330_request_channel()
1989 thrd = NULL; in pl330_request_channel()
1992 return thrd; in pl330_request_channel()
1996 static inline void _free_event(struct pl330_thread *thrd, int ev) in _free_event() argument
1998 struct pl330_dmac *pl330 = thrd->dmac; in _free_event()
2002 && pl330->events[ev] == thrd->id) in _free_event()
2006 static void pl330_release_channel(struct pl330_thread *thrd) in pl330_release_channel() argument
2008 if (!thrd || thrd->free) in pl330_release_channel()
2011 _stop(thrd); in pl330_release_channel()
2013 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
2014 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
2016 _free_event(thrd, thrd->ev); in pl330_release_channel()
2017 thrd->free = true; in pl330_release_channel()
2065 static inline void _reset_thread(struct pl330_thread *thrd) in _reset_thread() argument
2067 struct pl330_dmac *pl330 = thrd->dmac; in _reset_thread()
2069 thrd->req[0].mc_cpu = pl330->mcode_cpu in _reset_thread()
2070 + (thrd->id * pl330->mcbufsz); in _reset_thread()
2071 thrd->req[0].mc_bus = pl330->mcode_bus in _reset_thread()
2072 + (thrd->id * pl330->mcbufsz); in _reset_thread()
2073 thrd->req[0].desc = NULL; in _reset_thread()
2075 thrd->req[1].mc_cpu = thrd->req[0].mc_cpu in _reset_thread()
2077 thrd->req[1].mc_bus = thrd->req[0].mc_bus in _reset_thread()
2079 thrd->req[1].desc = NULL; in _reset_thread()
2081 thrd->req_running = -1; in _reset_thread()
2087 struct pl330_thread *thrd; in dmac_alloc_threads() local
2091 pl330->channels = kcalloc(1 + chans, sizeof(*thrd), in dmac_alloc_threads()
2098 thrd = &pl330->channels[i]; in dmac_alloc_threads()
2099 thrd->id = i; in dmac_alloc_threads()
2100 thrd->dmac = pl330; in dmac_alloc_threads()
2101 _reset_thread(thrd); in dmac_alloc_threads()
2102 thrd->free = true; in dmac_alloc_threads()
2106 thrd = &pl330->channels[chans]; in dmac_alloc_threads()
2107 thrd->id = chans; in dmac_alloc_threads()
2108 thrd->dmac = pl330; in dmac_alloc_threads()
2109 thrd->free = false; in dmac_alloc_threads()
2110 pl330->manager = thrd; in dmac_alloc_threads()
2196 struct pl330_thread *thrd; in dmac_free_threads() local
2201 thrd = &pl330->channels[i]; in dmac_free_threads()
2202 pl330_release_channel(thrd); in dmac_free_threads()
2585 struct pl330_thread *thrd = pch->thread; in pl330_get_current_xferred_count() local
2587 void __iomem *regs = thrd->dmac->base; in pl330_get_current_xferred_count()
2593 val = readl(regs + SA(thrd->id)); in pl330_get_current_xferred_count()
2596 val = readl(regs + DA(thrd->id)); in pl330_get_current_xferred_count()
3114 struct pl330_thread *thrd = &pl330->channels[ch]; in pl330_debugfs_show() local
3120 if (!pch->thread || thrd->id != pch->thread->id) in pl330_debugfs_show()
3126 seq_printf(s, "%d\t\t", thrd->id); in pl330_debugfs_show()