Lines Matching refs:thrd

559 static inline bool _queue_full(struct pl330_thread *thrd)  in _queue_full()  argument
561 return thrd->req[0].desc != NULL && thrd->req[1].desc != NULL; in _queue_full()
564 static inline bool is_manager(struct pl330_thread *thrd) in is_manager() argument
566 return thrd->dmac->manager == thrd; in is_manager()
570 static inline bool _manager_ns(struct pl330_thread *thrd) in _manager_ns() argument
572 return (thrd->dmac->pcfg.mode & DMAC_MODE_NS) ? true : false; in _manager_ns()
871 static bool _until_dmac_idle(struct pl330_thread *thrd) in _until_dmac_idle() argument
873 void __iomem *regs = thrd->dmac->base; in _until_dmac_idle()
890 static inline void _execute_DBGINSN(struct pl330_thread *thrd, in _execute_DBGINSN() argument
893 void __iomem *regs = thrd->dmac->base; in _execute_DBGINSN()
897 if (_until_dmac_idle(thrd)) { in _execute_DBGINSN()
898 dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n"); in _execute_DBGINSN()
905 val |= (thrd->id << 8); /* Channel Number */ in _execute_DBGINSN()
916 static inline u32 _state(struct pl330_thread *thrd) in _state() argument
918 void __iomem *regs = thrd->dmac->base; in _state()
921 if (is_manager(thrd)) in _state()
924 val = readl(regs + CS(thrd->id)) & 0xf; in _state()
940 if (is_manager(thrd)) in _state()
945 if (is_manager(thrd)) in _state()
950 if (is_manager(thrd)) in _state()
955 if (is_manager(thrd)) in _state()
960 if (is_manager(thrd)) in _state()
965 if (is_manager(thrd)) in _state()
974 static void _stop(struct pl330_thread *thrd) in _stop() argument
976 void __iomem *regs = thrd->dmac->base; in _stop()
980 if (_state(thrd) == PL330_STATE_FAULT_COMPLETING) in _stop()
981 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in _stop()
984 if (_state(thrd) == PL330_STATE_COMPLETING in _stop()
985 || _state(thrd) == PL330_STATE_KILLING in _stop()
986 || _state(thrd) == PL330_STATE_STOPPED) in _stop()
991 _execute_DBGINSN(thrd, insn, is_manager(thrd)); in _stop()
994 if (inten & (1 << thrd->ev)) in _stop()
995 writel(1 << thrd->ev, regs + INTCLR); in _stop()
997 writel(inten & ~(1 << thrd->ev), regs + INTEN); in _stop()
1001 static bool _trigger(struct pl330_thread *thrd) in _trigger() argument
1003 void __iomem *regs = thrd->dmac->base; in _trigger()
1012 if (_state(thrd) != PL330_STATE_STOPPED) in _trigger()
1015 idx = 1 - thrd->lstenq; in _trigger()
1016 if (thrd->req[idx].desc != NULL) { in _trigger()
1017 req = &thrd->req[idx]; in _trigger()
1019 idx = thrd->lstenq; in _trigger()
1020 if (thrd->req[idx].desc != NULL) in _trigger()
1021 req = &thrd->req[idx]; in _trigger()
1031 if (idx == thrd->req_running) in _trigger()
1039 if (_manager_ns(thrd) && !ns) in _trigger()
1040 dev_info(thrd->dmac->ddma.dev, "%s:%d Recipe for ABORT!\n", in _trigger()
1043 go.chan = thrd->id; in _trigger()
1049 writel(readl(regs + INTEN) | (1 << thrd->ev), regs + INTEN); in _trigger()
1052 _execute_DBGINSN(thrd, insn, true); in _trigger()
1054 thrd->req_running = idx; in _trigger()
1059 static bool pl330_start_thread(struct pl330_thread *thrd) in pl330_start_thread() argument
1061 switch (_state(thrd)) { in pl330_start_thread()
1063 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in pl330_start_thread()
1065 if (_state(thrd) == PL330_STATE_KILLING) in pl330_start_thread()
1066 UNTIL(thrd, PL330_STATE_STOPPED) in pl330_start_thread()
1070 _stop(thrd); in pl330_start_thread()
1075 UNTIL(thrd, PL330_STATE_STOPPED) in pl330_start_thread()
1079 return _trigger(thrd); in pl330_start_thread()
1415 struct pl330_thread *thrd, unsigned index, in _setup_req() argument
1418 struct _pl330_req *req = &thrd->req[index]; in _setup_req()
1430 off += _emit_SEV(dry_run, &buf[off], thrd->ev); in _setup_req()
1474 static int pl330_submit_req(struct pl330_thread *thrd, in pl330_submit_req() argument
1477 struct pl330_dmac *pl330 = thrd->dmac; in pl330_submit_req()
1499 || pl330->dmac_tbd.reset_chan & (1 << thrd->id)) { in pl330_submit_req()
1500 dev_info(thrd->dmac->ddma.dev, "%s:%d\n", in pl330_submit_req()
1508 dev_info(thrd->dmac->ddma.dev, in pl330_submit_req()
1516 if (_queue_full(thrd)) { in pl330_submit_req()
1522 if (!_manager_ns(thrd)) in pl330_submit_req()
1529 idx = thrd->req[0].desc == NULL ? 0 : 1; in pl330_submit_req()
1535 ret = _setup_req(pl330, 1, thrd, idx, &xs); in pl330_submit_req()
1545 thrd->lstenq = idx; in pl330_submit_req()
1546 thrd->req[idx].desc = desc; in pl330_submit_req()
1547 _setup_req(pl330, 0, thrd, idx, &xs); in pl330_submit_req()
1608 struct pl330_thread *thrd = &pl330->channels[i]; in pl330_dotask() local
1612 _stop(thrd); in pl330_dotask()
1614 if (readl(regs + FSC) & (1 << thrd->id)) in pl330_dotask()
1620 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, err); in pl330_dotask()
1621 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, err); in pl330_dotask()
1624 thrd->req[0].desc = NULL; in pl330_dotask()
1625 thrd->req[1].desc = NULL; in pl330_dotask()
1626 thrd->req_running = -1; in pl330_dotask()
1686 struct pl330_thread *thrd; in pl330_update() local
1698 thrd = &pl330->channels[id]; in pl330_update()
1700 active = thrd->req_running; in pl330_update()
1705 descdone = thrd->req[active].desc; in pl330_update()
1706 thrd->req[active].desc = NULL; in pl330_update()
1708 thrd->req_running = -1; in pl330_update()
1711 pl330_start_thread(thrd); in pl330_update()
1742 static inline int _alloc_event(struct pl330_thread *thrd) in _alloc_event() argument
1744 struct pl330_dmac *pl330 = thrd->dmac; in _alloc_event()
1749 pl330->events[ev] = thrd->id; in _alloc_event()
1766 struct pl330_thread *thrd = NULL; in pl330_request_channel() local
1775 thrd = &pl330->channels[i]; in pl330_request_channel()
1776 if ((thrd->free) && (!_manager_ns(thrd) || in pl330_request_channel()
1778 thrd->ev = _alloc_event(thrd); in pl330_request_channel()
1779 if (thrd->ev >= 0) { in pl330_request_channel()
1780 thrd->free = false; in pl330_request_channel()
1781 thrd->lstenq = 1; in pl330_request_channel()
1782 thrd->req[0].desc = NULL; in pl330_request_channel()
1783 thrd->req[1].desc = NULL; in pl330_request_channel()
1784 thrd->req_running = -1; in pl330_request_channel()
1788 thrd = NULL; in pl330_request_channel()
1791 return thrd; in pl330_request_channel()
1795 static inline void _free_event(struct pl330_thread *thrd, int ev) in _free_event() argument
1797 struct pl330_dmac *pl330 = thrd->dmac; in _free_event()
1801 && pl330->events[ev] == thrd->id) in _free_event()
1805 static void pl330_release_channel(struct pl330_thread *thrd) in pl330_release_channel() argument
1807 if (!thrd || thrd->free) in pl330_release_channel()
1810 _stop(thrd); in pl330_release_channel()
1812 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
1813 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
1815 _free_event(thrd, thrd->ev); in pl330_release_channel()
1816 thrd->free = true; in pl330_release_channel()
1864 static inline void _reset_thread(struct pl330_thread *thrd) in _reset_thread() argument
1866 struct pl330_dmac *pl330 = thrd->dmac; in _reset_thread()
1868 thrd->req[0].mc_cpu = pl330->mcode_cpu in _reset_thread()
1869 + (thrd->id * pl330->mcbufsz); in _reset_thread()
1870 thrd->req[0].mc_bus = pl330->mcode_bus in _reset_thread()
1871 + (thrd->id * pl330->mcbufsz); in _reset_thread()
1872 thrd->req[0].desc = NULL; in _reset_thread()
1874 thrd->req[1].mc_cpu = thrd->req[0].mc_cpu in _reset_thread()
1876 thrd->req[1].mc_bus = thrd->req[0].mc_bus in _reset_thread()
1878 thrd->req[1].desc = NULL; in _reset_thread()
1880 thrd->req_running = -1; in _reset_thread()
1886 struct pl330_thread *thrd; in dmac_alloc_threads() local
1890 pl330->channels = kcalloc(1 + chans, sizeof(*thrd), in dmac_alloc_threads()
1897 thrd = &pl330->channels[i]; in dmac_alloc_threads()
1898 thrd->id = i; in dmac_alloc_threads()
1899 thrd->dmac = pl330; in dmac_alloc_threads()
1900 _reset_thread(thrd); in dmac_alloc_threads()
1901 thrd->free = true; in dmac_alloc_threads()
1905 thrd = &pl330->channels[chans]; in dmac_alloc_threads()
1906 thrd->id = chans; in dmac_alloc_threads()
1907 thrd->dmac = pl330; in dmac_alloc_threads()
1908 thrd->free = false; in dmac_alloc_threads()
1909 pl330->manager = thrd; in dmac_alloc_threads()
1995 struct pl330_thread *thrd; in dmac_free_threads() local
2000 thrd = &pl330->channels[i]; in dmac_free_threads()
2001 pl330_release_channel(thrd); in dmac_free_threads()
2382 struct pl330_thread *thrd = pch->thread; in pl330_get_current_xferred_count() local
2384 void __iomem *regs = thrd->dmac->base; in pl330_get_current_xferred_count()
2390 val = readl(regs + SA(thrd->id)); in pl330_get_current_xferred_count()
2393 val = readl(regs + DA(thrd->id)); in pl330_get_current_xferred_count()
2934 struct pl330_thread *thrd = &pl330->channels[ch]; in pl330_debugfs_show() local
2940 if (!pch->thread || thrd->id != pch->thread->id) in pl330_debugfs_show()
2946 seq_printf(s, "%d\t\t", thrd->id); in pl330_debugfs_show()