2 * Definitions used in MIPS MT SMTC "Interprocessor Interrupt" code.
4 #ifndef __ASM_SMTC_IPI_H
5 #define __ASM_SMTC_IPI_H
7 //#define SMTC_IPI_DEBUG
10 #include <asm/mipsregs.h>
11 #include <asm/mipsmtregs.h>
12 #endif /* SMTC_IPI_DEBUG */
19 struct smtc_ipi *flink;
26 #endif /* SMTC_IPI_DEBUG */
33 #define LINUX_SMP_IPI 1
34 #define SMTC_CLOCK_TICK 2
37 * A queue of IPI messages
41 struct smtc_ipi *head;
43 struct smtc_ipi *tail;
47 static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
51 spin_lock_irqsave(&q->lock, flags);
53 q->head = q->tail = p;
60 p->sender = read_c0_tcbind();
61 p->stamp = read_c0_count();
62 #endif /* SMTC_IPI_DEBUG */
63 spin_unlock_irqrestore(&q->lock, flags);
66 static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
71 spin_lock_irqsave(&q->lock, flags);
76 q->head = q->head->flink;
78 /* Arguably unnecessary, but leaves queue cleaner */
82 spin_unlock_irqrestore(&q->lock, flags);
86 static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p)
90 spin_lock_irqsave(&q->lock, flags);
91 if (q->head == NULL) {
92 q->head = q->tail = p;
99 spin_unlock_irqrestore(&q->lock, flags);
102 static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q)
107 spin_lock_irqsave(&q->lock, flags);
109 spin_unlock_irqrestore(&q->lock, flags);
113 extern void smtc_send_ipi(int cpu, int type, unsigned int action);
115 #endif /* __ASM_SMTC_IPI_H */