Lines Matching refs:thrd
551 static inline bool _queue_full(struct pl330_thread *thrd) in _queue_full() argument
553 return thrd->req[0].desc != NULL && thrd->req[1].desc != NULL; in _queue_full()
556 static inline bool is_manager(struct pl330_thread *thrd) in is_manager() argument
558 return thrd->dmac->manager == thrd; in is_manager()
562 static inline bool _manager_ns(struct pl330_thread *thrd) in _manager_ns() argument
564 return (thrd->dmac->pcfg.mode & DMAC_MODE_NS) ? true : false; in _manager_ns()
863 static bool _until_dmac_idle(struct pl330_thread *thrd) in _until_dmac_idle() argument
865 void __iomem *regs = thrd->dmac->base; in _until_dmac_idle()
882 static inline void _execute_DBGINSN(struct pl330_thread *thrd, in _execute_DBGINSN() argument
885 void __iomem *regs = thrd->dmac->base; in _execute_DBGINSN()
891 val |= (thrd->id << 8); /* Channel Number */ in _execute_DBGINSN()
899 if (_until_dmac_idle(thrd)) { in _execute_DBGINSN()
900 dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n"); in _execute_DBGINSN()
908 static inline u32 _state(struct pl330_thread *thrd) in _state() argument
910 void __iomem *regs = thrd->dmac->base; in _state()
913 if (is_manager(thrd)) in _state()
916 val = readl(regs + CS(thrd->id)) & 0xf; in _state()
932 if (is_manager(thrd)) in _state()
937 if (is_manager(thrd)) in _state()
942 if (is_manager(thrd)) in _state()
947 if (is_manager(thrd)) in _state()
952 if (is_manager(thrd)) in _state()
957 if (is_manager(thrd)) in _state()
966 static void _stop(struct pl330_thread *thrd) in _stop() argument
968 void __iomem *regs = thrd->dmac->base; in _stop()
972 if (_state(thrd) == PL330_STATE_FAULT_COMPLETING) in _stop()
973 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in _stop()
976 if (_state(thrd) == PL330_STATE_COMPLETING in _stop()
977 || _state(thrd) == PL330_STATE_KILLING in _stop()
978 || _state(thrd) == PL330_STATE_STOPPED) in _stop()
983 _execute_DBGINSN(thrd, insn, is_manager(thrd)); in _stop()
986 if (inten & (1 << thrd->ev)) in _stop()
987 writel(1 << thrd->ev, regs + INTCLR); in _stop()
989 writel(inten & ~(1 << thrd->ev), regs + INTEN); in _stop()
993 static bool _trigger(struct pl330_thread *thrd) in _trigger() argument
995 void __iomem *regs = thrd->dmac->base; in _trigger()
1004 if (_state(thrd) != PL330_STATE_STOPPED) in _trigger()
1007 idx = 1 - thrd->lstenq; in _trigger()
1008 if (thrd->req[idx].desc != NULL) { in _trigger()
1009 req = &thrd->req[idx]; in _trigger()
1011 idx = thrd->lstenq; in _trigger()
1012 if (thrd->req[idx].desc != NULL) in _trigger()
1013 req = &thrd->req[idx]; in _trigger()
1023 if (idx == thrd->req_running) in _trigger()
1031 if (_manager_ns(thrd) && !ns) in _trigger()
1032 dev_info(thrd->dmac->ddma.dev, "%s:%d Recipe for ABORT!\n", in _trigger()
1035 go.chan = thrd->id; in _trigger()
1041 writel(readl(regs + INTEN) | (1 << thrd->ev), regs + INTEN); in _trigger()
1044 _execute_DBGINSN(thrd, insn, true); in _trigger()
1046 thrd->req_running = idx; in _trigger()
1051 static bool _start(struct pl330_thread *thrd) in _start() argument
1053 switch (_state(thrd)) { in _start()
1055 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in _start()
1057 if (_state(thrd) == PL330_STATE_KILLING) in _start()
1058 UNTIL(thrd, PL330_STATE_STOPPED) in _start()
1062 _stop(thrd); in _start()
1067 UNTIL(thrd, PL330_STATE_STOPPED) in _start()
1071 return _trigger(thrd); in _start()
1401 struct pl330_thread *thrd, unsigned index, in _setup_req() argument
1404 struct _pl330_req *req = &thrd->req[index]; in _setup_req()
1416 off += _emit_SEV(dry_run, &buf[off], thrd->ev); in _setup_req()
1460 static int pl330_submit_req(struct pl330_thread *thrd, in pl330_submit_req() argument
1463 struct pl330_dmac *pl330 = thrd->dmac; in pl330_submit_req()
1485 || pl330->dmac_tbd.reset_chan & (1 << thrd->id)) { in pl330_submit_req()
1486 dev_info(thrd->dmac->ddma.dev, "%s:%d\n", in pl330_submit_req()
1494 dev_info(thrd->dmac->ddma.dev, in pl330_submit_req()
1502 if (_queue_full(thrd)) { in pl330_submit_req()
1508 if (!_manager_ns(thrd)) in pl330_submit_req()
1515 idx = thrd->req[0].desc == NULL ? 0 : 1; in pl330_submit_req()
1521 ret = _setup_req(pl330, 1, thrd, idx, &xs); in pl330_submit_req()
1533 thrd->lstenq = idx; in pl330_submit_req()
1534 thrd->req[idx].desc = desc; in pl330_submit_req()
1535 _setup_req(pl330, 0, thrd, idx, &xs); in pl330_submit_req()
1596 struct pl330_thread *thrd = &pl330->channels[i]; in pl330_dotask() local
1600 _stop(thrd); in pl330_dotask()
1602 if (readl(regs + FSC) & (1 << thrd->id)) in pl330_dotask()
1608 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, err); in pl330_dotask()
1609 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, err); in pl330_dotask()
1612 thrd->req[0].desc = NULL; in pl330_dotask()
1613 thrd->req[1].desc = NULL; in pl330_dotask()
1614 thrd->req_running = -1; in pl330_dotask()
1674 struct pl330_thread *thrd; in pl330_update() local
1686 thrd = &pl330->channels[id]; in pl330_update()
1688 active = thrd->req_running; in pl330_update()
1693 descdone = thrd->req[active].desc; in pl330_update()
1694 thrd->req[active].desc = NULL; in pl330_update()
1696 thrd->req_running = -1; in pl330_update()
1699 _start(thrd); in pl330_update()
1730 static inline int _alloc_event(struct pl330_thread *thrd) in _alloc_event() argument
1732 struct pl330_dmac *pl330 = thrd->dmac; in _alloc_event()
1737 pl330->events[ev] = thrd->id; in _alloc_event()
1754 struct pl330_thread *thrd = NULL; in pl330_request_channel() local
1763 thrd = &pl330->channels[i]; in pl330_request_channel()
1764 if ((thrd->free) && (!_manager_ns(thrd) || in pl330_request_channel()
1766 thrd->ev = _alloc_event(thrd); in pl330_request_channel()
1767 if (thrd->ev >= 0) { in pl330_request_channel()
1768 thrd->free = false; in pl330_request_channel()
1769 thrd->lstenq = 1; in pl330_request_channel()
1770 thrd->req[0].desc = NULL; in pl330_request_channel()
1771 thrd->req[1].desc = NULL; in pl330_request_channel()
1772 thrd->req_running = -1; in pl330_request_channel()
1776 thrd = NULL; in pl330_request_channel()
1779 return thrd; in pl330_request_channel()
1783 static inline void _free_event(struct pl330_thread *thrd, int ev) in _free_event() argument
1785 struct pl330_dmac *pl330 = thrd->dmac; in _free_event()
1789 && pl330->events[ev] == thrd->id) in _free_event()
1793 static void pl330_release_channel(struct pl330_thread *thrd) in pl330_release_channel() argument
1795 if (!thrd || thrd->free) in pl330_release_channel()
1798 _stop(thrd); in pl330_release_channel()
1800 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
1801 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
1803 _free_event(thrd, thrd->ev); in pl330_release_channel()
1804 thrd->free = true; in pl330_release_channel()
1852 static inline void _reset_thread(struct pl330_thread *thrd) in _reset_thread() argument
1854 struct pl330_dmac *pl330 = thrd->dmac; in _reset_thread()
1856 thrd->req[0].mc_cpu = pl330->mcode_cpu in _reset_thread()
1857 + (thrd->id * pl330->mcbufsz); in _reset_thread()
1858 thrd->req[0].mc_bus = pl330->mcode_bus in _reset_thread()
1859 + (thrd->id * pl330->mcbufsz); in _reset_thread()
1860 thrd->req[0].desc = NULL; in _reset_thread()
1862 thrd->req[1].mc_cpu = thrd->req[0].mc_cpu in _reset_thread()
1864 thrd->req[1].mc_bus = thrd->req[0].mc_bus in _reset_thread()
1866 thrd->req[1].desc = NULL; in _reset_thread()
1868 thrd->req_running = -1; in _reset_thread()
1874 struct pl330_thread *thrd; in dmac_alloc_threads() local
1878 pl330->channels = kcalloc(1 + chans, sizeof(*thrd), in dmac_alloc_threads()
1885 thrd = &pl330->channels[i]; in dmac_alloc_threads()
1886 thrd->id = i; in dmac_alloc_threads()
1887 thrd->dmac = pl330; in dmac_alloc_threads()
1888 _reset_thread(thrd); in dmac_alloc_threads()
1889 thrd->free = true; in dmac_alloc_threads()
1893 thrd = &pl330->channels[chans]; in dmac_alloc_threads()
1894 thrd->id = chans; in dmac_alloc_threads()
1895 thrd->dmac = pl330; in dmac_alloc_threads()
1896 thrd->free = false; in dmac_alloc_threads()
1897 pl330->manager = thrd; in dmac_alloc_threads()
1983 struct pl330_thread *thrd; in dmac_free_threads() local
1988 thrd = &pl330->channels[i]; in dmac_free_threads()
1989 pl330_release_channel(thrd); in dmac_free_threads()
2367 struct pl330_thread *thrd = pch->thread; in pl330_get_current_xferred_count() local
2369 void __iomem *regs = thrd->dmac->base; in pl330_get_current_xferred_count()
2375 val = readl(regs + SA(thrd->id)); in pl330_get_current_xferred_count()
2378 val = readl(regs + DA(thrd->id)); in pl330_get_current_xferred_count()
2918 struct pl330_thread *thrd = &pl330->channels[ch]; in pl330_debugfs_show() local
2924 if (!pch->thread || thrd->id != pch->thread->id) in pl330_debugfs_show()
2930 seq_printf(s, "%d\t\t", thrd->id); in pl330_debugfs_show()