~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-sparc/hardirq.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* hardirq.h: 32-bit Sparc hard IRQ support.
  2  *
  3  * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
  4  * Copyright (C) 1998-2000 Anton Blanchard (anton@linuxcare.com)
  5  */
  6 
  7 #ifndef __SPARC_HARDIRQ_H
  8 #define __SPARC_HARDIRQ_H
  9 
 10 #include <linux/config.h>
 11 #include <linux/threads.h>
 12 #include <linux/brlock.h>
 13 #include <linux/spinlock.h>
 14 
 15 /* entry.S is sensitive to the offsets of these fields */
 16 typedef struct {
 17         unsigned int __softirq_active;
 18         unsigned int __softirq_mask;
 19 #ifndef CONFIG_SMP
 20         unsigned int __local_irq_count;
 21 #else
 22         unsigned int __unused_on_SMP;   /* DaveM says use brlock for SMP irq. KAO */
 23 #endif
 24         unsigned int __local_bh_count;
 25         unsigned int __syscall_count;
 26 } ____cacheline_aligned irq_cpustat_t;
 27 
 28 #include <linux/irq_cpustat.h>  /* Standard mappings for irq_cpustat_t above */
 29 /* Note that local_irq_count() is replaced by sparc64 specific version for SMP */
 30 
 31 #ifndef CONFIG_SMP
 32 #define irq_enter(cpu, irq)     ((void)(irq), local_irq_count(cpu)++)
 33 #define irq_exit(cpu, irq)      ((void)(irq), local_irq_count(cpu)--)
 34 #else
 35 #undef local_irq_count
 36 #define local_irq_count(cpu)    (__brlock_array[cpu][BR_GLOBALIRQ_LOCK])
 37 #define irq_enter(cpu, irq)     br_read_lock(BR_GLOBALIRQ_LOCK)
 38 #define irq_exit(cpu, irq)      br_read_unlock(BR_GLOBALIRQ_LOCK)
 39 #endif
 40 
 41 /*
 42  * Are we in an interrupt context? Either doing bottom half
 43  * or hardware interrupt processing?
 44  */
 45 #define in_interrupt() ((local_irq_count(smp_processor_id()) + \
 46                          local_bh_count(smp_processor_id())) != 0)
 47 
 48 /* This tests only the local processors hw IRQ context disposition.  */
 49 #define in_irq() (local_irq_count(smp_processor_id()) != 0)
 50 
 51 #ifndef CONFIG_SMP
 52 
 53 #define hardirq_trylock(cpu)    ((void)(cpu), local_irq_count(smp_processor_id()) == 0)
 54 #define hardirq_endlock(cpu)    do { (void)(cpu); } while(0)
 55 
 56 #define synchronize_irq()       barrier()
 57 
 58 #else /* (CONFIG_SMP) */
 59 
 60 static __inline__ int irqs_running(void)
 61 {
 62         int i;
 63 
 64         for (i = 0; i < smp_num_cpus; i++)
 65                 if (local_irq_count(cpu_logical_map(i)))
 66                         return 1;
 67         return 0;
 68 }
 69 
 70 extern unsigned char global_irq_holder;
 71 
 72 static inline void release_irqlock(int cpu)
 73 {
 74         /* if we didn't own the irq lock, just ignore... */
 75         if(global_irq_holder == (unsigned char) cpu) {
 76                 global_irq_holder = NO_PROC_ID;
 77                 br_write_unlock(BR_GLOBALIRQ_LOCK);
 78         }
 79 }
 80 
 81 static inline int hardirq_trylock(int cpu)
 82 {
 83         spinlock_t *lock = &__br_write_locks[BR_GLOBALIRQ_LOCK].lock;
 84 
 85         return (!local_irq_count(cpu) && !spin_is_locked(lock));
 86 }
 87 
 88 #define hardirq_endlock(cpu)    do { (void)(cpu); } while (0)
 89 
 90 extern void synchronize_irq(void);
 91 
 92 #endif /* CONFIG_SMP */
 93 
 94 #endif /* __SPARC_HARDIRQ_H */
 95 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.