Lines Matching refs:thrd

545 static inline bool _queue_full(struct pl330_thread *thrd)  in _queue_full()  argument
547 return thrd->req[0].desc != NULL && thrd->req[1].desc != NULL; in _queue_full()
550 static inline bool is_manager(struct pl330_thread *thrd) in is_manager() argument
552 return thrd->dmac->manager == thrd; in is_manager()
556 static inline bool _manager_ns(struct pl330_thread *thrd) in _manager_ns() argument
558 return (thrd->dmac->pcfg.mode & DMAC_MODE_NS) ? true : false; in _manager_ns()
857 static bool _until_dmac_idle(struct pl330_thread *thrd) in _until_dmac_idle() argument
859 void __iomem *regs = thrd->dmac->base; in _until_dmac_idle()
876 static inline void _execute_DBGINSN(struct pl330_thread *thrd, in _execute_DBGINSN() argument
879 void __iomem *regs = thrd->dmac->base; in _execute_DBGINSN()
885 val |= (thrd->id << 8); /* Channel Number */ in _execute_DBGINSN()
893 if (_until_dmac_idle(thrd)) { in _execute_DBGINSN()
894 dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n"); in _execute_DBGINSN()
902 static inline u32 _state(struct pl330_thread *thrd) in _state() argument
904 void __iomem *regs = thrd->dmac->base; in _state()
907 if (is_manager(thrd)) in _state()
910 val = readl(regs + CS(thrd->id)) & 0xf; in _state()
926 if (is_manager(thrd)) in _state()
931 if (is_manager(thrd)) in _state()
936 if (is_manager(thrd)) in _state()
941 if (is_manager(thrd)) in _state()
946 if (is_manager(thrd)) in _state()
951 if (is_manager(thrd)) in _state()
960 static void _stop(struct pl330_thread *thrd) in _stop() argument
962 void __iomem *regs = thrd->dmac->base; in _stop()
965 if (_state(thrd) == PL330_STATE_FAULT_COMPLETING) in _stop()
966 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in _stop()
969 if (_state(thrd) == PL330_STATE_COMPLETING in _stop()
970 || _state(thrd) == PL330_STATE_KILLING in _stop()
971 || _state(thrd) == PL330_STATE_STOPPED) in _stop()
977 writel(readl(regs + INTEN) & ~(1 << thrd->ev), regs + INTEN); in _stop()
979 _execute_DBGINSN(thrd, insn, is_manager(thrd)); in _stop()
983 static bool _trigger(struct pl330_thread *thrd) in _trigger() argument
985 void __iomem *regs = thrd->dmac->base; in _trigger()
994 if (_state(thrd) != PL330_STATE_STOPPED) in _trigger()
997 idx = 1 - thrd->lstenq; in _trigger()
998 if (thrd->req[idx].desc != NULL) { in _trigger()
999 req = &thrd->req[idx]; in _trigger()
1001 idx = thrd->lstenq; in _trigger()
1002 if (thrd->req[idx].desc != NULL) in _trigger()
1003 req = &thrd->req[idx]; in _trigger()
1013 if (idx == thrd->req_running) in _trigger()
1021 if (_manager_ns(thrd) && !ns) in _trigger()
1022 dev_info(thrd->dmac->ddma.dev, "%s:%d Recipe for ABORT!\n", in _trigger()
1025 go.chan = thrd->id; in _trigger()
1031 writel(readl(regs + INTEN) | (1 << thrd->ev), regs + INTEN); in _trigger()
1034 _execute_DBGINSN(thrd, insn, true); in _trigger()
1036 thrd->req_running = idx; in _trigger()
1041 static bool _start(struct pl330_thread *thrd) in _start() argument
1043 switch (_state(thrd)) { in _start()
1045 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); in _start()
1047 if (_state(thrd) == PL330_STATE_KILLING) in _start()
1048 UNTIL(thrd, PL330_STATE_STOPPED) in _start()
1052 _stop(thrd); in _start()
1057 UNTIL(thrd, PL330_STATE_STOPPED) in _start()
1061 return _trigger(thrd); in _start()
1391 struct pl330_thread *thrd, unsigned index, in _setup_req() argument
1394 struct _pl330_req *req = &thrd->req[index]; in _setup_req()
1406 off += _emit_SEV(dry_run, &buf[off], thrd->ev); in _setup_req()
1450 static int pl330_submit_req(struct pl330_thread *thrd, in pl330_submit_req() argument
1453 struct pl330_dmac *pl330 = thrd->dmac; in pl330_submit_req()
1475 || pl330->dmac_tbd.reset_chan & (1 << thrd->id)) { in pl330_submit_req()
1476 dev_info(thrd->dmac->ddma.dev, "%s:%d\n", in pl330_submit_req()
1484 dev_info(thrd->dmac->ddma.dev, in pl330_submit_req()
1492 if (_queue_full(thrd)) { in pl330_submit_req()
1498 if (!_manager_ns(thrd)) in pl330_submit_req()
1505 idx = thrd->req[0].desc == NULL ? 0 : 1; in pl330_submit_req()
1511 ret = _setup_req(pl330, 1, thrd, idx, &xs); in pl330_submit_req()
1523 thrd->lstenq = idx; in pl330_submit_req()
1524 thrd->req[idx].desc = desc; in pl330_submit_req()
1525 _setup_req(pl330, 0, thrd, idx, &xs); in pl330_submit_req()
1586 struct pl330_thread *thrd = &pl330->channels[i]; in pl330_dotask() local
1590 _stop(thrd); in pl330_dotask()
1592 if (readl(regs + FSC) & (1 << thrd->id)) in pl330_dotask()
1598 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, err); in pl330_dotask()
1599 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, err); in pl330_dotask()
1602 thrd->req[0].desc = NULL; in pl330_dotask()
1603 thrd->req[1].desc = NULL; in pl330_dotask()
1604 thrd->req_running = -1; in pl330_dotask()
1664 struct pl330_thread *thrd; in pl330_update() local
1676 thrd = &pl330->channels[id]; in pl330_update()
1678 active = thrd->req_running; in pl330_update()
1683 descdone = thrd->req[active].desc; in pl330_update()
1684 thrd->req[active].desc = NULL; in pl330_update()
1686 thrd->req_running = -1; in pl330_update()
1689 _start(thrd); in pl330_update()
1720 static inline int _alloc_event(struct pl330_thread *thrd) in _alloc_event() argument
1722 struct pl330_dmac *pl330 = thrd->dmac; in _alloc_event()
1727 pl330->events[ev] = thrd->id; in _alloc_event()
1744 struct pl330_thread *thrd = NULL; in pl330_request_channel() local
1753 thrd = &pl330->channels[i]; in pl330_request_channel()
1754 if ((thrd->free) && (!_manager_ns(thrd) || in pl330_request_channel()
1756 thrd->ev = _alloc_event(thrd); in pl330_request_channel()
1757 if (thrd->ev >= 0) { in pl330_request_channel()
1758 thrd->free = false; in pl330_request_channel()
1759 thrd->lstenq = 1; in pl330_request_channel()
1760 thrd->req[0].desc = NULL; in pl330_request_channel()
1761 thrd->req[1].desc = NULL; in pl330_request_channel()
1762 thrd->req_running = -1; in pl330_request_channel()
1766 thrd = NULL; in pl330_request_channel()
1769 return thrd; in pl330_request_channel()
1773 static inline void _free_event(struct pl330_thread *thrd, int ev) in _free_event() argument
1775 struct pl330_dmac *pl330 = thrd->dmac; in _free_event()
1779 && pl330->events[ev] == thrd->id) in _free_event()
1783 static void pl330_release_channel(struct pl330_thread *thrd) in pl330_release_channel() argument
1785 if (!thrd || thrd->free) in pl330_release_channel()
1788 _stop(thrd); in pl330_release_channel()
1790 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
1791 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, PL330_ERR_ABORT); in pl330_release_channel()
1793 _free_event(thrd, thrd->ev); in pl330_release_channel()
1794 thrd->free = true; in pl330_release_channel()
1842 static inline void _reset_thread(struct pl330_thread *thrd) in _reset_thread() argument
1844 struct pl330_dmac *pl330 = thrd->dmac; in _reset_thread()
1846 thrd->req[0].mc_cpu = pl330->mcode_cpu in _reset_thread()
1847 + (thrd->id * pl330->mcbufsz); in _reset_thread()
1848 thrd->req[0].mc_bus = pl330->mcode_bus in _reset_thread()
1849 + (thrd->id * pl330->mcbufsz); in _reset_thread()
1850 thrd->req[0].desc = NULL; in _reset_thread()
1852 thrd->req[1].mc_cpu = thrd->req[0].mc_cpu in _reset_thread()
1854 thrd->req[1].mc_bus = thrd->req[0].mc_bus in _reset_thread()
1856 thrd->req[1].desc = NULL; in _reset_thread()
1858 thrd->req_running = -1; in _reset_thread()
1864 struct pl330_thread *thrd; in dmac_alloc_threads() local
1868 pl330->channels = kcalloc(1 + chans, sizeof(*thrd), in dmac_alloc_threads()
1875 thrd = &pl330->channels[i]; in dmac_alloc_threads()
1876 thrd->id = i; in dmac_alloc_threads()
1877 thrd->dmac = pl330; in dmac_alloc_threads()
1878 _reset_thread(thrd); in dmac_alloc_threads()
1879 thrd->free = true; in dmac_alloc_threads()
1883 thrd = &pl330->channels[chans]; in dmac_alloc_threads()
1884 thrd->id = chans; in dmac_alloc_threads()
1885 thrd->dmac = pl330; in dmac_alloc_threads()
1886 thrd->free = false; in dmac_alloc_threads()
1887 pl330->manager = thrd; in dmac_alloc_threads()
1972 struct pl330_thread *thrd; in dmac_free_threads() local
1977 thrd = &pl330->channels[i]; in dmac_free_threads()
1978 pl330_release_channel(thrd); in dmac_free_threads()
2346 struct pl330_thread *thrd = pch->thread; in pl330_get_current_xferred_count() local
2348 void __iomem *regs = thrd->dmac->base; in pl330_get_current_xferred_count()
2354 val = readl(regs + SA(thrd->id)); in pl330_get_current_xferred_count()
2357 val = readl(regs + DA(thrd->id)); in pl330_get_current_xferred_count()