#ifndef _POWERPC_INTR_H_
#define _POWERPC_INTR_H_
#define IPL_NONE 0
#define IPL_SOFTCLOCK 2
#define IPL_SOFTNET 3
#define IPL_SOFTTTY 4
#define IPL_BIO 5
#define IPL_NET 6
#define IPL_TTY 7
#define IPL_VM 8
#define IPL_AUDIO 9
#define IPL_CLOCK 10
#define IPL_SCHED 11
#define IPL_HIGH 12
#define IPL_NUM 13
#define IPL_MPFLOOR IPL_TTY
#define IPL_MPSAFE 0x100
#define IST_NONE 0
#define IST_PULSE 1
#define IST_EDGE 2
#define IST_LEVEL 3
#define __USE_MI_SOFTINTR
#include <sys/softintr.h>
#if defined(_KERNEL) && !defined(_LOCORE)
#include <sys/evcount.h>
#define PPC_NIRQ 66
#define PPC_CLK_IRQ 64
#define PPC_STAT_IRQ 65
int splraise(int);
int spllower(int);
void splx(int);
typedef int (ppc_splraise_t) (int);
typedef int (ppc_spllower_t) (int);
typedef void (ppc_splx_t) (int);
extern struct ppc_intr_func {
ppc_splraise_t *raise;
ppc_spllower_t *lower;
ppc_splx_t *x;
}ppc_intr_func;
extern int ppc_smask[IPL_NUM];
void ppc_smask_init(void);
char *ppc_intr_typename(int type);
void do_pending_int(void);
#ifdef DIAGNOSTIC
void splassert_fail(int, int, const char *);
extern int splassert_ctl;
void splassert_check(int, const char *);
#define splassert(__wantipl) do { \
if (splassert_ctl > 0) { \
splassert_check(__wantipl, __func__); \
} \
} while (0)
#define splsoftassert(wantipl) splassert(wantipl)
#else
#define splassert(wantipl) do { } while (0)
#define splsoftassert(wantipl) do { } while (0)
#endif
#define splbio() splraise(IPL_BIO)
#define splnet() splraise(IPL_NET)
#define spltty() splraise(IPL_TTY)
#define splaudio() splraise(IPL_AUDIO)
#define splclock() splraise(IPL_CLOCK)
#define splvm() splraise(IPL_VM)
#define splsched() splhigh()
#define splstatclock() splhigh()
#define splsoftclock() splraise(IPL_SOFTCLOCK)
#define splsoftnet() splraise(IPL_SOFTNET)
#define splsofttty() splraise(IPL_SOFTTTY)
#define SI_TO_IRQBIT(x) (1 << (x))
void softintr(int);
void dosoftint(int);
#define splhigh() splraise(IPL_HIGH)
#define spl0() spllower(IPL_NONE)
struct intrhand {
TAILQ_ENTRY(intrhand) ih_list;
int (*ih_fun)(void *);
void *ih_arg;
struct evcount ih_count;
int ih_type;
int ih_level;
int ih_flags;
int ih_irq;
const char *ih_what;
};
struct intrq {
TAILQ_HEAD(, intrhand) iq_list;
int iq_ipl;
int iq_ist;
};
extern int ppc_configed_intr_cnt;
#define MAX_PRECONF_INTR 16
extern struct intrhand ppc_configed_intr[MAX_PRECONF_INTR];
void intr_barrier(void *);
#define PPC_IPI_NOP 0
#define PPC_IPI_DDB 1
void ppc_send_ipi(struct cpu_info *, int);
#endif
#endif