2 * Definitions used in MIPS MT SMTC "Interprocessor Interrupt" code.
4 #ifndef __ASM_SMTC_IPI_H
5 #define __ASM_SMTC_IPI_H
7 #include <linux/spinlock.h>
9 //#define SMTC_IPI_DEBUG
12 #include <asm/mipsregs.h>
13 #include <asm/mipsmtregs.h>
14 #endif /* SMTC_IPI_DEBUG */
21 struct smtc_ipi *flink;
28 #endif /* SMTC_IPI_DEBUG */
35 #define LINUX_SMP_IPI 1
36 #define SMTC_CLOCK_TICK 2
37 #define IRQ_AFFINITY_IPI 3
40 * A queue of IPI messages
44 struct smtc_ipi *head;
46 struct smtc_ipi *tail;
50 static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
54 spin_lock_irqsave(&q->lock, flags);
56 q->head = q->tail = p;
63 p->sender = read_c0_tcbind();
64 p->stamp = read_c0_count();
65 #endif /* SMTC_IPI_DEBUG */
66 spin_unlock_irqrestore(&q->lock, flags);
69 static inline struct smtc_ipi *__smtc_ipi_dq(struct smtc_ipi_q *q)
77 q->head = q->head->flink;
79 /* Arguably unnecessary, but leaves queue cleaner */
87 static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
92 spin_lock_irqsave(&q->lock, flags);
94 spin_unlock_irqrestore(&q->lock, flags);
99 static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p)
103 spin_lock_irqsave(&q->lock, flags);
104 if (q->head == NULL) {
105 q->head = q->tail = p;
112 spin_unlock_irqrestore(&q->lock, flags);
115 static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q)
120 spin_lock_irqsave(&q->lock, flags);
122 spin_unlock_irqrestore(&q->lock, flags);
126 extern void smtc_send_ipi(int cpu, int type, unsigned int action);
128 #endif /* __ASM_SMTC_IPI_H */