Lines Matching refs:thrd

553 static inline bool _queue_full(struct pl330_thread *thrd)  in _queue_full()  argument
555 return thrd->req[0].desc != NULL && thrd->req[1].desc != NULL; in _queue_full()
558 static inline bool is_manager(struct pl330_thread *thrd) in is_manager() argument
560 return thrd->dmac->manager == thrd; in is_manager()
564 static inline bool _manager_ns(struct pl330_thread *thrd) in _manager_ns() argument
566 return (thrd->dmac->pcfg.mode & DMAC_MODE_NS) ? true : false; in _manager_ns()
865 static bool _until_dmac_idle(struct pl330_thread *thrd) in _until_dmac_idle() argument
867 void __iomem *regs = thrd->dmac->base; in _until_dmac_idle()
884 static inline void _execute_DBGINSN(struct pl330_thread *thrd, in _execute_DBGINSN() argument
887 void __iomem *regs = thrd->dmac->base; in _execute_DBGINSN()
891 if (_until_dmac_idle(thrd)) { in _execute_DBGINSN()
892 dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n"); in _execute_DBGINSN()
899 val |= (thrd->id << 8); /* Channel Number */ in _execute_DBGINSN()
910 static inline u32 _state(struct pl330_thread *thrd) in _state() argument
912 void __iomem *regs = thrd->dmac->base; in _state()
915 if (is_manager(thrd)) in _state()
918 val = readl(regs + CS(thrd->id)) & 0xf; in _state()
934 if (is_manager(thrd)) in _state()
939 if (is_manager(thrd)) in _state()
944 if (is_manager(thrd)) in _state()
949 if (is_manager(thrd)) in _state()
954 if (is_manager(thrd)) in _state()
959 if (is_manager(thrd)) in _state()
968 static void _stop(struct pl330_thread *thrd) in _stop() argument
970 void __iomem *regs = thrd->dmac->base; in _stop()
974 if (_state(thrd) == PL330_STATE_FAULT_COMPLETING) in _stop()
975 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in _stop()
978 if (_state(thrd) == PL330_STATE_COMPLETING in _stop()
979 || _state(thrd) == PL330_STATE_KILLING in _stop()
980 || _state(thrd) == PL330_STATE_STOPPED) in _stop()
985 _execute_DBGINSN(thrd, insn, is_manager(thrd)); in _stop()
988 if (inten & (1 << thrd->ev)) in _stop()
989 writel(1 << thrd->ev, regs + INTCLR); in _stop()
991 writel(inten & ~(1 << thrd->ev), regs + INTEN); in _stop()
995 static bool _trigger(struct pl330_thread *thrd) in _trigger() argument
997 void __iomem *regs = thrd->dmac->base; in _trigger()
1006 if (_state(thrd) != PL330_STATE_STOPPED) in _trigger()
1009 idx = 1 - thrd->lstenq; in _trigger()
1010 if (thrd->req[idx].desc != NULL) { in _trigger()
1011 req = &thrd->req[idx]; in _trigger()
1013 idx = thrd->lstenq; in _trigger()
1014 if (thrd->req[idx].desc != NULL) in _trigger()
1015 req = &thrd->req[idx]; in _trigger()
1025 if (idx == thrd->req_running) in _trigger()
1033 if (_manager_ns(thrd) && !ns) in _trigger()
1034 dev_info(thrd->dmac->ddma.dev, "%s:%d Recipe for ABORT!\n", in _trigger()
1037 go.chan = thrd->id; in _trigger()
1043 writel(readl(regs + INTEN) | (1 << thrd->ev), regs + INTEN); in _trigger()
1046 _execute_DBGINSN(thrd, insn, true); in _trigger()
1048 thrd->req_running = idx; in _trigger()
1053 static bool _start(struct pl330_thread *thrd) in _start() argument
1055 switch (_state(thrd)) { in _start()
1057 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in _start()
1059 if (_state(thrd) == PL330_STATE_KILLING) in _start()
1060 UNTIL(thrd, PL330_STATE_STOPPED) in _start()
1064 _stop(thrd); in _start()
1069 UNTIL(thrd, PL330_STATE_STOPPED) in _start()
1073 return _trigger(thrd); in _start()
1409 struct pl330_thread *thrd, unsigned index, in _setup_req() argument
1412 struct _pl330_req *req = &thrd->req[index]; in _setup_req()
1424 off += _emit_SEV(dry_run, &buf[off], thrd->ev); in _setup_req()
1468 static int pl330_submit_req(struct pl330_thread *thrd, in pl330_submit_req() argument
1471 struct pl330_dmac *pl330 = thrd->dmac; in pl330_submit_req()
1493 || pl330->dmac_tbd.reset_chan & (1 << thrd->id)) { in pl330_submit_req()
1494 dev_info(thrd->dmac->ddma.dev, "%s:%d\n", in pl330_submit_req()
1502 dev_info(thrd->dmac->ddma.dev, in pl330_submit_req()
1510 if (_queue_full(thrd)) { in pl330_submit_req()
1516 if (!_manager_ns(thrd)) in pl330_submit_req()
1523 idx = thrd->req[0].desc == NULL ? 0 : 1; in pl330_submit_req()
1529 ret = _setup_req(pl330, 1, thrd, idx, &xs); in pl330_submit_req()
1539 thrd->lstenq = idx; in pl330_submit_req()
1540 thrd->req[idx].desc = desc; in pl330_submit_req()
1541 _setup_req(pl330, 0, thrd, idx, &xs); in pl330_submit_req()
1602 struct pl330_thread *thrd = &pl330->channels[i]; in pl330_dotask() local
1606 _stop(thrd); in pl330_dotask()
1608 if (readl(regs + FSC) & (1 << thrd->id)) in pl330_dotask()
1614 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, err); in pl330_dotask()
1615 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, err); in pl330_dotask()
1618 thrd->req[0].desc = NULL; in pl330_dotask()
1619 thrd->req[1].desc = NULL; in pl330_dotask()
1620 thrd->req_running = -1; in pl330_dotask()
1680 struct pl330_thread *thrd; in pl330_update() local
1692 thrd = &pl330->channels[id]; in pl330_update()
1694 active = thrd->req_running; in pl330_update()
1699 descdone = thrd->req[active].desc; in pl330_update()
1700 thrd->req[active].desc = NULL; in pl330_update()
1702 thrd->req_running = -1; in pl330_update()
1705 _start(thrd); in pl330_update()
1736 static inline int _alloc_event(struct pl330_thread *thrd) in _alloc_event() argument
1738 struct pl330_dmac *pl330 = thrd->dmac; in _alloc_event()
1743 pl330->events[ev] = thrd->id; in _alloc_event()
1760 struct pl330_thread *thrd = NULL; in pl330_request_channel() local
1769 thrd = &pl330->channels[i]; in pl330_request_channel()
1770 if ((thrd->free) && (!_manager_ns(thrd) || in pl330_request_channel()
1772 thrd->ev = _alloc_event(thrd); in pl330_request_channel()
1773 if (thrd->ev >= 0) { in pl330_request_channel()
1774 thrd->free = false; in pl330_request_channel()
1775 thrd->lstenq = 1; in pl330_request_channel()
1776 thrd->req[0].desc = NULL; in pl330_request_channel()
1777 thrd->req[1].desc = NULL; in pl330_request_channel()
1778 thrd->req_running = -1; in pl330_request_channel()
1782 thrd = NULL; in pl330_request_channel()
1785 return thrd; in pl330_request_channel()
1789 static inline void _free_event(struct pl330_thread *thrd, int ev) in _free_event() argument
1791 struct pl330_dmac *pl330 = thrd->dmac; in _free_event()
1795 && pl330->events[ev] == thrd->id) in _free_event()
1799 static void pl330_release_channel(struct pl330_thread *thrd) in pl330_release_channel() argument
1801 if (!thrd || thrd->free) in pl330_release_channel()
1804 _stop(thrd); in pl330_release_channel()
1806 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
1807 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
1809 _free_event(thrd, thrd->ev); in pl330_release_channel()
1810 thrd->free = true; in pl330_release_channel()
1858 static inline void _reset_thread(struct pl330_thread *thrd) in _reset_thread() argument
1860 struct pl330_dmac *pl330 = thrd->dmac; in _reset_thread()
1862 thrd->req[0].mc_cpu = pl330->mcode_cpu in _reset_thread()
1863 + (thrd->id * pl330->mcbufsz); in _reset_thread()
1864 thrd->req[0].mc_bus = pl330->mcode_bus in _reset_thread()
1865 + (thrd->id * pl330->mcbufsz); in _reset_thread()
1866 thrd->req[0].desc = NULL; in _reset_thread()
1868 thrd->req[1].mc_cpu = thrd->req[0].mc_cpu in _reset_thread()
1870 thrd->req[1].mc_bus = thrd->req[0].mc_bus in _reset_thread()
1872 thrd->req[1].desc = NULL; in _reset_thread()
1874 thrd->req_running = -1; in _reset_thread()
1880 struct pl330_thread *thrd; in dmac_alloc_threads() local
1884 pl330->channels = kcalloc(1 + chans, sizeof(*thrd), in dmac_alloc_threads()
1891 thrd = &pl330->channels[i]; in dmac_alloc_threads()
1892 thrd->id = i; in dmac_alloc_threads()
1893 thrd->dmac = pl330; in dmac_alloc_threads()
1894 _reset_thread(thrd); in dmac_alloc_threads()
1895 thrd->free = true; in dmac_alloc_threads()
1899 thrd = &pl330->channels[chans]; in dmac_alloc_threads()
1900 thrd->id = chans; in dmac_alloc_threads()
1901 thrd->dmac = pl330; in dmac_alloc_threads()
1902 thrd->free = false; in dmac_alloc_threads()
1903 pl330->manager = thrd; in dmac_alloc_threads()
1989 struct pl330_thread *thrd; in dmac_free_threads() local
1994 thrd = &pl330->channels[i]; in dmac_free_threads()
1995 pl330_release_channel(thrd); in dmac_free_threads()
2371 struct pl330_thread *thrd = pch->thread; in pl330_get_current_xferred_count() local
2373 void __iomem *regs = thrd->dmac->base; in pl330_get_current_xferred_count()
2379 val = readl(regs + SA(thrd->id)); in pl330_get_current_xferred_count()
2382 val = readl(regs + DA(thrd->id)); in pl330_get_current_xferred_count()
2920 struct pl330_thread *thrd = &pl330->channels[ch]; in pl330_debugfs_show() local
2926 if (!pch->thread || thrd->id != pch->thread->id) in pl330_debugfs_show()
2932 seq_printf(s, "%d\t\t", thrd->id); in pl330_debugfs_show()