Lines Matching refs:thrd
559 static inline bool _queue_full(struct pl330_thread *thrd)
561 return thrd->req[0].desc != NULL && thrd->req[1].desc != NULL;
564 static inline bool is_manager(struct pl330_thread *thrd)
566 return thrd->dmac->manager == thrd;
570 static inline bool _manager_ns(struct pl330_thread *thrd)
572 return (thrd->dmac->pcfg.mode & DMAC_MODE_NS) ? true : false;
871 static bool _until_dmac_idle(struct pl330_thread *thrd)
873 void __iomem *regs = thrd->dmac->base;
890 static inline void _execute_DBGINSN(struct pl330_thread *thrd,
893 void __iomem *regs = thrd->dmac->base;
897 if (_until_dmac_idle(thrd)) {
898 dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n");
905 val |= (thrd->id << 8); /* Channel Number */
916 static inline u32 _state(struct pl330_thread *thrd)
918 void __iomem *regs = thrd->dmac->base;
921 if (is_manager(thrd))
924 val = readl(regs + CS(thrd->id)) & 0xf;
940 if (is_manager(thrd))
945 if (is_manager(thrd))
950 if (is_manager(thrd))
955 if (is_manager(thrd))
960 if (is_manager(thrd))
965 if (is_manager(thrd))
974 static void _stop(struct pl330_thread *thrd)
976 void __iomem *regs = thrd->dmac->base;
980 if (_state(thrd) == PL330_STATE_FAULT_COMPLETING)
981 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING);
984 if (_state(thrd) == PL330_STATE_COMPLETING
985 || _state(thrd) == PL330_STATE_KILLING
986 || _state(thrd) == PL330_STATE_STOPPED)
991 _execute_DBGINSN(thrd, insn, is_manager(thrd));
994 if (inten & (1 << thrd->ev))
995 writel(1 << thrd->ev, regs + INTCLR);
997 writel(inten & ~(1 << thrd->ev), regs + INTEN);
1000 /* Start doing req 'idx' of thread 'thrd' */
1001 static bool _trigger(struct pl330_thread *thrd)
1003 void __iomem *regs = thrd->dmac->base;
1012 if (_state(thrd) != PL330_STATE_STOPPED)
1015 idx = 1 - thrd->lstenq;
1016 if (thrd->req[idx].desc != NULL) {
1017 req = &thrd->req[idx];
1019 idx = thrd->lstenq;
1020 if (thrd->req[idx].desc != NULL)
1021 req = &thrd->req[idx];
1031 if (idx == thrd->req_running)
1039 if (_manager_ns(thrd) && !ns)
1040 dev_info(thrd->dmac->ddma.dev, "%s:%d Recipe for ABORT!\n",
1043 go.chan = thrd->id;
1049 writel(readl(regs + INTEN) | (1 << thrd->ev), regs + INTEN);
1052 _execute_DBGINSN(thrd, insn, true);
1054 thrd->req_running = idx;
1059 static bool pl330_start_thread(struct pl330_thread *thrd)
1061 switch (_state(thrd)) {
1063 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING);
1065 if (_state(thrd) == PL330_STATE_KILLING)
1066 UNTIL(thrd, PL330_STATE_STOPPED)
1070 _stop(thrd);
1075 UNTIL(thrd, PL330_STATE_STOPPED)
1079 return _trigger(thrd);
1415 struct pl330_thread *thrd, unsigned index,
1418 struct _pl330_req *req = &thrd->req[index];
1430 off += _emit_SEV(dry_run, &buf[off], thrd->ev);
1474 static int pl330_submit_req(struct pl330_thread *thrd,
1477 struct pl330_dmac *pl330 = thrd->dmac;
1499 || pl330->dmac_tbd.reset_chan & (1 << thrd->id)) {
1500 dev_info(thrd->dmac->ddma.dev, "%s:%d\n",
1508 dev_info(thrd->dmac->ddma.dev,
1516 if (_queue_full(thrd)) {
1522 if (!_manager_ns(thrd))
1529 idx = thrd->req[0].desc == NULL ? 0 : 1;
1535 ret = _setup_req(pl330, 1, thrd, idx, &xs);
1547 thrd->lstenq = idx;
1548 thrd->req[idx].desc = desc;
1549 _setup_req(pl330, 0, thrd, idx, &xs);
1610 struct pl330_thread *thrd = &pl330->channels[i];
1614 _stop(thrd);
1616 if (readl(regs + FSC) & (1 << thrd->id))
1622 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, err);
1623 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, err);
1626 thrd->req[0].desc = NULL;
1627 thrd->req[1].desc = NULL;
1628 thrd->req_running = -1;
1688 struct pl330_thread *thrd;
1700 thrd = &pl330->channels[id];
1702 active = thrd->req_running;
1707 descdone = thrd->req[active].desc;
1708 thrd->req[active].desc = NULL;
1710 thrd->req_running = -1;
1713 pl330_start_thread(thrd);
1744 static inline int _alloc_event(struct pl330_thread *thrd)
1746 struct pl330_dmac *pl330 = thrd->dmac;
1751 pl330->events[ev] = thrd->id;
1768 struct pl330_thread *thrd = NULL;
1777 thrd = &pl330->channels[i];
1778 if ((thrd->free) && (!_manager_ns(thrd) ||
1780 thrd->ev = _alloc_event(thrd);
1781 if (thrd->ev >= 0) {
1782 thrd->free = false;
1783 thrd->lstenq = 1;
1784 thrd->req[0].desc = NULL;
1785 thrd->req[1].desc = NULL;
1786 thrd->req_running = -1;
1790 thrd = NULL;
1793 return thrd;
1797 static inline void _free_event(struct pl330_thread *thrd, int ev)
1799 struct pl330_dmac *pl330 = thrd->dmac;
1803 && pl330->events[ev] == thrd->id)
1807 static void pl330_release_channel(struct pl330_thread *thrd)
1809 if (!thrd || thrd->free)
1812 _stop(thrd);
1814 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, PL330_ERR_ABORT);
1815 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, PL330_ERR_ABORT);
1817 _free_event(thrd, thrd->ev);
1818 thrd->free = true;
1866 static inline void _reset_thread(struct pl330_thread *thrd)
1868 struct pl330_dmac *pl330 = thrd->dmac;
1870 thrd->req[0].mc_cpu = pl330->mcode_cpu
1871 + (thrd->id * pl330->mcbufsz);
1872 thrd->req[0].mc_bus = pl330->mcode_bus
1873 + (thrd->id * pl330->mcbufsz);
1874 thrd->req[0].desc = NULL;
1876 thrd->req[1].mc_cpu = thrd->req[0].mc_cpu
1878 thrd->req[1].mc_bus = thrd->req[0].mc_bus
1880 thrd->req[1].desc = NULL;
1882 thrd->req_running = -1;
1888 struct pl330_thread *thrd;
1892 pl330->channels = kcalloc(1 + chans, sizeof(*thrd),
1899 thrd = &pl330->channels[i];
1900 thrd->id = i;
1901 thrd->dmac = pl330;
1902 _reset_thread(thrd);
1903 thrd->free = true;
1907 thrd = &pl330->channels[chans];
1908 thrd->id = chans;
1909 thrd->dmac = pl330;
1910 thrd->free = false;
1911 pl330->manager = thrd;
1997 struct pl330_thread *thrd;
2002 thrd = &pl330->channels[i];
2003 pl330_release_channel(thrd);
2384 struct pl330_thread *thrd = pch->thread;
2386 void __iomem *regs = thrd->dmac->base;
2392 val = readl(regs + SA(thrd->id));
2395 val = readl(regs + DA(thrd->id));
2940 struct pl330_thread *thrd = &pl330->channels[ch];
2946 if (!pch->thread || thrd->id != pch->thread->id)
2952 seq_printf(s, "%d\t\t", thrd->id);