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
 
  39  * A queue of IPI messages
 
  43         struct smtc_ipi *head;
 
  45         struct smtc_ipi *tail;
 
  49 static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
 
  53         spin_lock_irqsave(&q->lock, flags);
 
  55                 q->head = q->tail = p;
 
  62         p->sender = read_c0_tcbind();
 
  63         p->stamp = read_c0_count();
 
  64 #endif /* SMTC_IPI_DEBUG */
 
  65         spin_unlock_irqrestore(&q->lock, flags);
 
  68 static inline struct smtc_ipi *__smtc_ipi_dq(struct smtc_ipi_q *q)
 
  76                 q->head = q->head->flink;
 
  78                 /* Arguably unnecessary, but leaves queue cleaner */
 
  86 static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
 
  91         spin_lock_irqsave(&q->lock, flags);
 
  93         spin_unlock_irqrestore(&q->lock, flags);
 
  98 static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p)
 
 102         spin_lock_irqsave(&q->lock, flags);
 
 103         if (q->head == NULL) {
 
 104                 q->head = q->tail = p;
 
 111         spin_unlock_irqrestore(&q->lock, flags);
 
 114 static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q)
 
 119         spin_lock_irqsave(&q->lock, flags);
 
 121         spin_unlock_irqrestore(&q->lock, flags);
 
 125 extern void smtc_send_ipi(int cpu, int type, unsigned int action);
 
 127 #endif /* __ASM_SMTC_IPI_H */