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);
1545 thrd->lstenq = idx;
1546 thrd->req[idx].desc = desc;
1547 _setup_req(pl330, 0, thrd, idx, &xs);
1608 struct pl330_thread *thrd = &pl330->channels[i];
1612 _stop(thrd);
1614 if (readl(regs + FSC) & (1 << thrd->id))
1620 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, err);
1621 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, err);
1624 thrd->req[0].desc = NULL;
1625 thrd->req[1].desc = NULL;
1626 thrd->req_running = -1;
1686 struct pl330_thread *thrd;
1698 thrd = &pl330->channels[id];
1700 active = thrd->req_running;
1705 descdone = thrd->req[active].desc;
1706 thrd->req[active].desc = NULL;
1708 thrd->req_running = -1;
1711 pl330_start_thread(thrd);
1742 static inline int _alloc_event(struct pl330_thread *thrd)
1744 struct pl330_dmac *pl330 = thrd->dmac;
1749 pl330->events[ev] = thrd->id;
1766 struct pl330_thread *thrd = NULL;
1775 thrd = &pl330->channels[i];
1776 if ((thrd->free) && (!_manager_ns(thrd) ||
1778 thrd->ev = _alloc_event(thrd);
1779 if (thrd->ev >= 0) {
1780 thrd->free = false;
1781 thrd->lstenq = 1;
1782 thrd->req[0].desc = NULL;
1783 thrd->req[1].desc = NULL;
1784 thrd->req_running = -1;
1788 thrd = NULL;
1791 return thrd;
1795 static inline void _free_event(struct pl330_thread *thrd, int ev)
1797 struct pl330_dmac *pl330 = thrd->dmac;
1801 && pl330->events[ev] == thrd->id)
1805 static void pl330_release_channel(struct pl330_thread *thrd)
1807 if (!thrd || thrd->free)
1810 _stop(thrd);
1812 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, PL330_ERR_ABORT);
1813 dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, PL330_ERR_ABORT);
1815 _free_event(thrd, thrd->ev);
1816 thrd->free = true;
1864 static inline void _reset_thread(struct pl330_thread *thrd)
1866 struct pl330_dmac *pl330 = thrd->dmac;
1868 thrd->req[0].mc_cpu = pl330->mcode_cpu
1869 + (thrd->id * pl330->mcbufsz);
1870 thrd->req[0].mc_bus = pl330->mcode_bus
1871 + (thrd->id * pl330->mcbufsz);
1872 thrd->req[0].desc = NULL;
1874 thrd->req[1].mc_cpu = thrd->req[0].mc_cpu
1876 thrd->req[1].mc_bus = thrd->req[0].mc_bus
1878 thrd->req[1].desc = NULL;
1880 thrd->req_running = -1;
1886 struct pl330_thread *thrd;
1890 pl330->channels = kcalloc(1 + chans, sizeof(*thrd),
1897 thrd = &pl330->channels[i];
1898 thrd->id = i;
1899 thrd->dmac = pl330;
1900 _reset_thread(thrd);
1901 thrd->free = true;
1905 thrd = &pl330->channels[chans];
1906 thrd->id = chans;
1907 thrd->dmac = pl330;
1908 thrd->free = false;
1909 pl330->manager = thrd;
1995 struct pl330_thread *thrd;
2000 thrd = &pl330->channels[i];
2001 pl330_release_channel(thrd);
2382 struct pl330_thread *thrd = pch->thread;
2384 void __iomem *regs = thrd->dmac->base;
2390 val = readl(regs + SA(thrd->id));
2393 val = readl(regs + DA(thrd->id));
2934 struct pl330_thread *thrd = &pl330->channels[ch];
2940 if (!pch->thread || thrd->id != pch->thread->id)
2946 seq_printf(s, "%d\t\t", thrd->id);