13 #include <linux/kernel.h>
17 #define HALF_QUEUES 32
19 #define MAX_QUEUE_LENGTH 4
21 #define QUEUE_STAT1_EMPTY 1
22 #define QUEUE_STAT1_NEARLY_EMPTY 2
23 #define QUEUE_STAT1_NEARLY_FULL 4
24 #define QUEUE_STAT1_FULL 8
25 #define QUEUE_STAT2_UNDERFLOW 1
26 #define QUEUE_STAT2_OVERFLOW 2
28 #define QUEUE_WATERMARK_0_ENTRIES 0
29 #define QUEUE_WATERMARK_1_ENTRY 1
30 #define QUEUE_WATERMARK_2_ENTRIES 2
31 #define QUEUE_WATERMARK_4_ENTRIES 3
32 #define QUEUE_WATERMARK_8_ENTRIES 4
33 #define QUEUE_WATERMARK_16_ENTRIES 5
34 #define QUEUE_WATERMARK_32_ENTRIES 6
35 #define QUEUE_WATERMARK_64_ENTRIES 7
38 #define QUEUE_IRQ_SRC_EMPTY 0
39 #define QUEUE_IRQ_SRC_NEARLY_EMPTY 1
40 #define QUEUE_IRQ_SRC_NEARLY_FULL 2
41 #define QUEUE_IRQ_SRC_FULL 3
42 #define QUEUE_IRQ_SRC_NOT_EMPTY 4
43 #define QUEUE_IRQ_SRC_NOT_NEARLY_EMPTY 5
44 #define QUEUE_IRQ_SRC_NOT_NEARLY_FULL 6
45 #define QUEUE_IRQ_SRC_NOT_FULL 7
61 void (*handler)(
void *pdev),
void *pdev);
68 extern char qmgr_queue_descs[
QUEUES][32];
71 unsigned int nearly_empty_watermark,
72 unsigned int nearly_full_watermark,
73 const char *desc_format,
const char*
name);
76 unsigned int nearly_empty_watermark,
77 unsigned int nearly_full_watermark);
78 #define qmgr_request_queue(queue, len, nearly_empty_watermark, \
79 nearly_full_watermark, desc_format, name) \
80 __qmgr_request_queue(queue, len, nearly_empty_watermark, \
81 nearly_full_watermark)
87 static inline void qmgr_put_entry(
unsigned int queue,
u32 val)
91 BUG_ON(!qmgr_queue_descs[queue]);
94 qmgr_queue_descs[queue], queue, val);
99 static inline u32 qmgr_get_entry(
unsigned int queue)
105 BUG_ON(!qmgr_queue_descs[queue]);
108 qmgr_queue_descs[queue], queue, val);
113 static inline int __qmgr_get_stat1(
unsigned int queue)
117 >> ((queue & 7) << 2)) & 0xF;
120 static inline int __qmgr_get_stat2(
unsigned int queue)
125 >> ((queue & 0xF) << 1)) & 0x3;
134 static inline int qmgr_stat_empty(
unsigned int queue)
146 static inline int qmgr_stat_below_low_watermark(
unsigned int queue)
161 static inline int qmgr_stat_above_high_watermark(
unsigned int queue)
173 static inline int qmgr_stat_full(
unsigned int queue)
188 static inline int qmgr_stat_underflow(
unsigned int queue)
199 static inline int qmgr_stat_overflow(
unsigned int queue)