Lines Matching full:queue
3 * Intel IXP4xx Queue Manager driver for Linux
28 void qmgr_put_entry(unsigned int queue, u32 val) in qmgr_put_entry() argument
31 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ in qmgr_put_entry()
33 printk(KERN_DEBUG "Queue %s(%i) put %X\n", in qmgr_put_entry()
34 qmgr_queue_descs[queue], queue, val); in qmgr_put_entry()
36 __raw_writel(val, &qmgr_regs->acc[queue][0]); in qmgr_put_entry()
39 u32 qmgr_get_entry(unsigned int queue) in qmgr_get_entry() argument
42 val = __raw_readl(&qmgr_regs->acc[queue][0]); in qmgr_get_entry()
44 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ in qmgr_get_entry()
46 printk(KERN_DEBUG "Queue %s(%i) get %X\n", in qmgr_get_entry()
47 qmgr_queue_descs[queue], queue, val); in qmgr_get_entry()
52 static int __qmgr_get_stat1(unsigned int queue) in __qmgr_get_stat1() argument
54 return (__raw_readl(&qmgr_regs->stat1[queue >> 3]) in __qmgr_get_stat1()
55 >> ((queue & 7) << 2)) & 0xF; in __qmgr_get_stat1()
58 static int __qmgr_get_stat2(unsigned int queue) in __qmgr_get_stat2() argument
60 BUG_ON(queue >= HALF_QUEUES); in __qmgr_get_stat2()
61 return (__raw_readl(&qmgr_regs->stat2[queue >> 4]) in __qmgr_get_stat2()
62 >> ((queue & 0xF) << 1)) & 0x3; in __qmgr_get_stat2()
66 * qmgr_stat_empty() - checks if a hardware queue is empty
67 * @queue: queue number
69 * Returns non-zero value if the queue is empty.
71 int qmgr_stat_empty(unsigned int queue) in qmgr_stat_empty() argument
73 BUG_ON(queue >= HALF_QUEUES); in qmgr_stat_empty()
74 return __qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY; in qmgr_stat_empty()
78 * qmgr_stat_below_low_watermark() - checks if a queue is below low watermark
79 * @queue: queue number
81 * Returns non-zero value if the queue is below low watermark.
83 int qmgr_stat_below_low_watermark(unsigned int queue) in qmgr_stat_below_low_watermark() argument
85 if (queue >= HALF_QUEUES) in qmgr_stat_below_low_watermark()
87 (queue - HALF_QUEUES)) & 0x01; in qmgr_stat_below_low_watermark()
88 return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY; in qmgr_stat_below_low_watermark()
92 * qmgr_stat_full() - checks if a hardware queue is full
93 * @queue: queue number
95 * Returns non-zero value if the queue is full.
97 int qmgr_stat_full(unsigned int queue) in qmgr_stat_full() argument
99 if (queue >= HALF_QUEUES) in qmgr_stat_full()
101 (queue - HALF_QUEUES)) & 0x01; in qmgr_stat_full()
102 return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL; in qmgr_stat_full()
106 * qmgr_stat_overflow() - checks if a hardware queue experienced overflow
107 * @queue: queue number
109 * Returns non-zero value if the queue experienced overflow.
111 int qmgr_stat_overflow(unsigned int queue) in qmgr_stat_overflow() argument
113 return __qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW; in qmgr_stat_overflow()
116 void qmgr_set_irq(unsigned int queue, int src, in qmgr_set_irq() argument
122 if (queue < HALF_QUEUES) { in qmgr_set_irq()
126 reg = &qmgr_regs->irqsrc[queue >> 3]; /* 8 queues per u32 */ in qmgr_set_irq()
127 bit = (queue % 8) * 4; /* 3 bits + 1 reserved bit per queue */ in qmgr_set_irq()
134 irq_handlers[queue] = handler; in qmgr_set_irq()
135 irq_pdevs[queue] = pdev; in qmgr_set_irq()
150 i = __fls(en_bitmap); /* number of the last "low" queue */ in qmgr_irq1_a0()
175 i = __fls(req_bitmap); /* number of the last "high" queue */ in qmgr_irq2_a0()
194 i = __fls(req_bitmap); /* number of the last queue */ in qmgr_irq()
203 void qmgr_enable_irq(unsigned int queue) in qmgr_enable_irq() argument
206 int half = queue / 32; in qmgr_enable_irq()
207 u32 mask = 1 << (queue & (HALF_QUEUES - 1)); in qmgr_enable_irq()
215 void qmgr_disable_irq(unsigned int queue) in qmgr_disable_irq() argument
218 int half = queue / 32; in qmgr_disable_irq()
219 u32 mask = 1 << (queue & (HALF_QUEUES - 1)); in qmgr_disable_irq()
237 int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, in qmgr_request_queue() argument
242 int __qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, in qmgr_request_queue()
250 BUG_ON(queue >= QUEUES); in qmgr_request_queue()
285 if (__raw_readl(&qmgr_regs->sram[queue])) { in qmgr_request_queue()
301 " queue %i\n", queue); in qmgr_request_queue()
311 __raw_writel(cfg | (addr << 14), &qmgr_regs->sram[queue]); in qmgr_request_queue()
313 snprintf(qmgr_queue_descs[queue], sizeof(qmgr_queue_descs[0]), in qmgr_request_queue()
315 printk(KERN_DEBUG "qmgr: requested queue %s(%i) addr = 0x%02X\n", in qmgr_request_queue()
316 qmgr_queue_descs[queue], queue, addr); in qmgr_request_queue()
327 void qmgr_release_queue(unsigned int queue) in qmgr_release_queue() argument
331 BUG_ON(queue >= QUEUES); /* not in valid range */ in qmgr_release_queue()
334 cfg = __raw_readl(&qmgr_regs->sram[queue]); in qmgr_release_queue()
352 printk(KERN_DEBUG "qmgr: releasing queue %s(%i)\n", in qmgr_release_queue()
353 qmgr_queue_descs[queue], queue); in qmgr_release_queue()
354 qmgr_queue_descs[queue][0] = '\x0'; in qmgr_release_queue()
357 while ((addr = qmgr_get_entry(queue))) in qmgr_release_queue()
358 printk(KERN_ERR "qmgr: released queue %i not empty: 0x%08X\n", in qmgr_release_queue()
359 queue, addr); in qmgr_release_queue()
361 __raw_writel(0, &qmgr_regs->sram[queue]); in qmgr_release_queue()
367 irq_handlers[queue] = NULL; /* catch IRQ bugs */ in qmgr_release_queue()
420 err = devm_request_irq(dev, irq1, handler1, 0, "IXP4xx Queue Manager", in ixp4xx_qmgr_probe()
428 err = devm_request_irq(dev, irq2, handler2, 0, "IXP4xx Queue Manager", in ixp4xx_qmgr_probe()
439 dev_info(dev, "IXP4xx Queue Manager initialized.\n"); in ixp4xx_qmgr_probe()
452 .compatible = "intel,ixp4xx-ahb-queue-manager",