vserver 1.9.3
[linux-2.6.git] / include / asm-h8300 / hardirq.h
1 #ifndef __H8300_HARDIRQ_H
2 #define __H8300_HARDIRQ_H
3
4 #include <linux/kernel.h>
5 #include <linux/config.h>
6 #include <linux/threads.h>
7 #include <linux/interrupt.h>
8 #include <linux/irq.h>
9
10 typedef struct {
11         unsigned int __softirq_pending;
12         unsigned int __syscall_count;
13         struct task_struct * __ksoftirqd_task;
14 } ____cacheline_aligned irq_cpustat_t;
15
16 #include <linux/irq_cpustat.h>  /* Standard mappings for irq_cpustat_t above */
17
18 /*
19  * We put the hardirq and softirq counter into the preemption
20  * counter. The bitmask has the following meaning:
21  *
22  * - bits 0-7 are the preemption count (max preemption depth: 256)
23  * - bits 8-15 are the softirq count (max # of softirqs: 256)
24  * - bits 16-23 are the hardirq count (max # of hardirqs: 256)
25  *
26  * - ( bit 26 is the PREEMPT_ACTIVE flag. )
27  *
28  * PREEMPT_MASK: 0x000000ff
29  * HARDIRQ_MASK: 0x0000ff00
30  * SOFTIRQ_MASK: 0x00ff0000
31  */
32
33 #define PREEMPT_BITS    8
34 #define SOFTIRQ_BITS    8
35 #define HARDIRQ_BITS    8
36
37 #define PREEMPT_SHIFT   0
38 #define SOFTIRQ_SHIFT   (PREEMPT_SHIFT + PREEMPT_BITS)
39 #define HARDIRQ_SHIFT   (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
40
41 /*
42  * The hardirq mask has to be large enough to have
43  * space for potentially all IRQ sources in the system
44  * nesting on a single CPU:
45  */
46 #if (1 << HARDIRQ_BITS) < NR_IRQS
47 # error HARDIRQ_BITS is too low!
48 #endif
49
50 #define irq_enter()             (preempt_count() += HARDIRQ_OFFSET)
51 #define irq_exit()                                                      \
52 do {                                                                    \
53                 preempt_count() -= IRQ_EXIT_OFFSET;                     \
54                 if (!in_interrupt() && softirq_pending(smp_processor_id())) \
55                         do_softirq();                                   \
56                 preempt_enable_no_resched();                            \
57 } while (0)
58
59 #endif