vserver 1.9.3
[linux-2.6.git] / include / asm-ppc64 / hardirq.h
1 #ifndef __ASM_HARDIRQ_H
2 #define __ASM_HARDIRQ_H
3
4 /*
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version
8  * 2 of the License, or (at your option) any later version.
9  */
10
11 #include <linux/config.h>
12 #include <linux/cache.h>
13 #include <linux/preempt.h>
14
15 typedef struct {
16         unsigned int __softirq_pending;
17         struct task_struct * __ksoftirqd_task;
18 } ____cacheline_aligned irq_cpustat_t;
19
20 #include <linux/irq_cpustat.h>  /* Standard mappings for irq_cpustat_t above */
21
22 /*
23  * We put the hardirq and softirq counter into the preemption
24  * counter. The bitmask has the following meaning:
25  *
26  * - bits 0-7 are the preemption count (max preemption depth: 256)
27  * - bits 8-15 are the softirq count (max # of softirqs: 256)
28  * - bits 16-24 are the hardirq count (max # of hardirqs: 512)
29  *
30  * - ( bit 26 is the PREEMPT_ACTIVE flag. )
31  *
32  * PREEMPT_MASK: 0x000000ff
33  * SOFTIRQ_MASK: 0x0000ff00
34  * HARDIRQ_MASK: 0x01ff0000
35  */
36
37 #define PREEMPT_BITS    8
38 #define SOFTIRQ_BITS    8
39 #define HARDIRQ_BITS    9
40
41 #define PREEMPT_SHIFT   0
42 #define SOFTIRQ_SHIFT   (PREEMPT_SHIFT + PREEMPT_BITS)
43 #define HARDIRQ_SHIFT   (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
44
45 /*
46  * The hardirq mask has to be large enough to have
47  * space for potentially all IRQ sources in the system
48  * nesting on a single CPU:
49  */
50 #if (1 << HARDIRQ_BITS) < NR_IRQS
51 # error HARDIRQ_BITS is too low!
52 #endif
53
54 #define irq_enter()             (preempt_count() += HARDIRQ_OFFSET)
55 #define irq_exit()                                                      \
56 do {                                                                    \
57                 preempt_count() -= IRQ_EXIT_OFFSET;                     \
58                 if (!in_interrupt() && softirq_pending(smp_processor_id())) \
59                         do_softirq();                                   \
60                 preempt_enable_no_resched();                            \
61 } while (0)
62
63 #endif /* __ASM_HARDIRQ_H */