📄 adeos-ipipe-2.6.12-bf533-1.2-00.patch
字号:
struct pt_regs; struct seq_file;+#ifdef CONFIG_IPIPE+#include <asm/semaphore.h>+struct task_struct;+#endif /* CONFIG_IPIPE */ typedef void (*irq_handler_t) (unsigned int, struct irqdesc *, struct pt_regs *);@@ -59,6 +63,11 @@ struct irqdesc { void *chipdata; void *data; unsigned int disable_depth;+#ifdef CONFIG_IPIPE+ struct task_struct *thread;+ struct semaphore thrsem;+ void (*thrhandler)(unsigned irq, struct pt_regs *);+#endif /* CONFIG_IPIPE */ unsigned int triggered:1; /* IRQ has occurred */ unsigned int running:1; /* IRQ is running */diff -uNrp linux-2.6.12/include/asm-blackfin/system.h 2.6.12-ipipe/include/asm-blackfin/system.h--- linux-2.6.12/include/asm-blackfin/system.h 2005-10-31 06:50:53.000000000 +0100+++ 2.6.12-ipipe/include/asm-blackfin/system.h 2006-02-14 21:03:10.000000000 +0100@@ -46,6 +46,84 @@ asmlinkage void resume(void); extern volatile unsigned long irq_flags; +#ifdef CONFIG_IPIPE++void __ipipe_stall_root(void);++void __ipipe_unstall_root(void);++unsigned long __ipipe_test_root(void);++unsigned long __ipipe_test_and_stall_root(void);++void __ipipe_restore_root(unsigned long flags);++#ifdef CONFIG_DEBUG_HWERR+#define __all_masked_irq_flags 0x3f+#define __save_and_cli_hw(x) do { \+ __asm__ __volatile__ ( \+ "cli %0;\n\tsti %1;" \+ :"=&d"(x): "d" (0x3F)); \+} while (0)+#else+#define __all_masked_irq_flags 0x1f+#define __save_and_cli_hw(x) do { \+ __asm__ __volatile__ ( \+ "cli %0;" \+ :"=&d"(x):); \+} while (0)+#endif+#define irqs_enabled_from_flags_hw(x) ((x) != __all_masked_irq_flags)++#define local_save_flags(x) \+do { \+ (x) = __ipipe_test_root()?__all_masked_irq_flags:irq_flags; \+} while(0)++#define local_irq_save(x) \+do { \+ (x) = __ipipe_test_and_stall_root()?__all_masked_irq_flags:irq_flags; \+} while(0)++#define local_irq_restore(x) __ipipe_restore_root((x) == __all_masked_irq_flags)+#define local_irq_disable() __ipipe_stall_root()+#define local_irq_enable() __ipipe_unstall_root()+#define irqs_disabled() __ipipe_test_root()++#define local_irq_enable_hw() \+do { \+ __asm__ __volatile__ ( \+ "sti %0;" \+ ::"d"(irq_flags)); \+} while(0)++#define local_irq_disable_hw() \+do { \+ int _tmp_dummy; \+ __asm__ __volatile__ ( \+ "cli %0;" \+ :"=d" (_tmp_dummy):); \+} while(0)++#define local_save_flags_hw(x) asm volatile ("cli %0;" \+ "sti %0;" \+ :"=d"(x):);+#define local_irq_restore_hw(x) do { \+ if (irqs_enabled_from_flags_hw(x)) \+ local_irq_enable_hw(); \+} while (0)++#define local_irq_save_hw(x) __save_and_cli_hw(x)++#define irqs_disabled_hw() \+({ \+ unsigned long flags; \+ local_save_flags_hw(flags); \+ !irqs_enabled_from_flags_hw(flags); \+})++#else /* !CONFIG_IPIPE */+ #define local_irq_enable() do { \ __asm__ __volatile__ ( \ "sti %0;" \@@ -98,6 +176,14 @@ extern volatile unsigned long irq_flags; !irqs_enabled_from_flags(flags); \ }) +#define local_irq_save_hw(flags) local_irq_save(flags)+#define local_irq_restore_hw(flags) local_irq_restore(flags)+#define local_irq_enable_hw() local_irq_enable()+#define local_irq_disable_hw(flags) local_irq_disable()+#define irqs_disabled_hw(flags) irqs_disabled()++#endif /* CONFIG_IPIPE */+ /* * Force strict CPU ordering. */@@ -137,7 +223,7 @@ static inline unsigned long __xchg(unsig unsigned long tmp = 0; unsigned long flags = 0; - local_irq_save(flags);+ local_irq_save_hw(flags); switch (size) { case 1:@@ -159,7 +245,7 @@ static inline unsigned long __xchg(unsig : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory"); break; }- local_irq_restore(flags);+ local_irq_restore_hw(flags); return tmp; } @@ -174,7 +260,7 @@ static inline unsigned long __cmpxchg(vo unsigned long tmp = 0; unsigned long flags = 0; - local_irq_save(flags);+ local_irq_save_hw(flags); switch (size) { case 1:@@ -205,7 +291,7 @@ static inline unsigned long __cmpxchg(vo : "=&d" (tmp) : "d" (old), "d" (new), "m" (*__xg(ptr)) : "memory"); break; }- local_irq_restore(flags);+ local_irq_restore_hw(flags); return tmp; } diff -uNrp linux-2.6.12/include/linux/hardirq.h 2.6.12-ipipe/include/linux/hardirq.h--- linux-2.6.12/include/linux/hardirq.h 2005-08-15 11:13:56.000000000 +0200+++ 2.6.12-ipipe/include/linux/hardirq.h 2006-02-11 22:36:37.000000000 +0100@@ -86,8 +86,21 @@ extern void synchronize_irq(unsigned int # define synchronize_irq(irq) barrier() #endif +#ifdef CONFIG_IPIPE+#define nmi_enter() \+do { \+ if (ipipe_current_domain == ipipe_root_domain) \+ irq_enter(); \+} while(0)+#define nmi_exit() \+do { \+ if (ipipe_current_domain == ipipe_root_domain) \+ sub_preempt_count(HARDIRQ_OFFSET); \+} while(0)+#else /* !CONFIG_IPIPE */ #define nmi_enter() irq_enter() #define nmi_exit() sub_preempt_count(HARDIRQ_OFFSET)+#endif /* CONFIG_IPIPE */ #ifndef CONFIG_VIRT_CPU_ACCOUNTING static inline void account_user_vtime(struct task_struct *tsk)diff -uNrp linux-2.6.12/include/linux/ipipe.h 2.6.12-ipipe/include/linux/ipipe.h--- linux-2.6.12/include/linux/ipipe.h 1970-01-01 01:00:00.000000000 +0100+++ 2.6.12-ipipe/include/linux/ipipe.h 2006-02-06 12:05:22.000000000 +0100@@ -0,0 +1,792 @@+/* -*- linux-c -*-+ * include/linux/ipipe.h+ *+ * Copyright (C) 2002-2005 Philippe Gerum.+ *+ * This program is free software; you can redistribute it and/or modify+ * it under the terms of the GNU General Public License as published by+ * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,+ * USA; either version 2 of the License, or (at your option) any later+ * version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.+ */++#ifndef __LINUX_IPIPE_H+#define __LINUX_IPIPE_H++#include <linux/config.h>+#include <linux/spinlock.h>+#include <linux/cache.h>+#include <asm/ipipe.h>++#ifdef CONFIG_IPIPE++#define IPIPE_VERSION_STRING IPIPE_ARCH_STRING+#define IPIPE_RELEASE_NUMBER ((IPIPE_MAJOR_NUMBER << 16) | \+ (IPIPE_MINOR_NUMBER << 8) | \+ (IPIPE_PATCH_NUMBER))++#ifndef BROKEN_BUILTIN_RETURN_ADDRESS+#define __BUILTIN_RETURN_ADDRESS0 ((unsigned long)__builtin_return_address(0))+#define __BUILTIN_RETURN_ADDRESS1 ((unsigned long)__builtin_return_address(1))+#endif /* !BUILTIN_RETURN_ADDRESS */++#define IPIPE_ROOT_PRIO 100+#define IPIPE_ROOT_ID 0+#define IPIPE_ROOT_NPTDKEYS 4 /* Must be <= BITS_PER_LONG */++#define IPIPE_RESET_TIMER 0x1+#define IPIPE_GRAB_TIMER 0x2++/* Global domain flags */+#define IPIPE_SPRINTK_FLAG 0 /* Synchronous printk() allowed */++#define IPIPE_STALL_FLAG 0 /* Stalls a pipeline stage */+#define IPIPE_SYNC_FLAG 1 /* The interrupt syncer is running for the domain */++#define IPIPE_HANDLE_FLAG 0+#define IPIPE_PASS_FLAG 1+#define IPIPE_ENABLE_FLAG 2+#define IPIPE_DYNAMIC_FLAG IPIPE_HANDLE_FLAG+#define IPIPE_STICKY_FLAG 3+#define IPIPE_SYSTEM_FLAG 4+#define IPIPE_LOCK_FLAG 5+#define IPIPE_SHARED_FLAG 6+#define IPIPE_EXCLUSIVE_FLAG 31 /* ipipe_catch_event() is the reason why. */++#define IPIPE_HANDLE_MASK (1 << IPIPE_HANDLE_FLAG)+#define IPIPE_PASS_MASK (1 << IPIPE_PASS_FLAG)+#define IPIPE_ENABLE_MASK (1 << IPIPE_ENABLE_FLAG)+#define IPIPE_DYNAMIC_MASK IPIPE_HANDLE_MASK+#define IPIPE_EXCLUSIVE_MASK (1 << IPIPE_EXCLUSIVE_FLAG)+#define IPIPE_STICKY_MASK (1 << IPIPE_STICKY_FLAG)+#define IPIPE_SYSTEM_MASK (1 << IPIPE_SYSTEM_FLAG)+#define IPIPE_LOCK_MASK (1 << IPIPE_LOCK_FLAG)+#define IPIPE_SHARED_MASK (1 << IPIPE_SHARED_FLAG)+#define IPIPE_SYNC_MASK (1 << IPIPE_SYNC_FLAG)++#define IPIPE_DEFAULT_MASK (IPIPE_HANDLE_MASK|IPIPE_PASS_MASK)+#define IPIPE_STDROOT_MASK (IPIPE_HANDLE_MASK|IPIPE_PASS_MASK|IPIPE_SYSTEM_MASK)++#define IPIPE_EVENT_SELF 0x80000000++/* Number of virtual IRQs */+#define IPIPE_NR_VIRQS BITS_PER_LONG+/* First virtual IRQ # */+#define IPIPE_VIRQ_BASE (((IPIPE_NR_XIRQS + BITS_PER_LONG - 1) / BITS_PER_LONG) * BITS_PER_LONG)+/* Total number of IRQ slots */+#define IPIPE_NR_IRQS (IPIPE_VIRQ_BASE + IPIPE_NR_VIRQS)+/* Number of indirect words needed to map the whole IRQ space. */+#define IPIPE_IRQ_IWORDS ((IPIPE_NR_IRQS + BITS_PER_LONG - 1) / BITS_PER_LONG)+#define IPIPE_IRQ_IMASK (BITS_PER_LONG - 1)+#define IPIPE_IRQMASK_ANY (~0L)+#define IPIPE_IRQMASK_VIRT (IPIPE_IRQMASK_ANY << (IPIPE_VIRQ_BASE / BITS_PER_LONG))++#ifdef CONFIG_SMP++#define IPIPE_NR_CPUS NR_CPUS+#define ipipe_declare_cpuid int cpuid+#define ipipe_load_cpuid() do { \+ (cpuid) = ipipe_processor_id(); \+ } while(0)+#define ipipe_lock_cpu(flags) do { \+ local_irq_save_hw(flags); \+ (cpuid) = ipipe_processor_id(); \+ } while(0)+#define ipipe_unlock_cpu(flags) local_irq_restore_hw(flags)+#define ipipe_get_cpu(flags) ipipe_lock_cpu(flags)+#define ipipe_put_cpu(flags) ipipe_unlock_cpu(flags)+#define ipipe_current_domain (ipipe_percpu_domain[ipipe_processor_id()])++#else /* !CONFIG_SMP */++#define IPIPE_NR_CPUS 1+#define ipipe_declare_cpuid const int cpuid = 0+#define ipipe_load_cpuid() do { } while(0)+#define ipipe_lock_cpu(flags) local_irq_save_hw(flags)+#define ipipe_unlock_cpu(flags) local_irq_restore_hw(flags)+#define ipipe_get_cpu(flags) do { (void)(flags); } while(0)+#define ipipe_put_cpu(flags) do { } while(0)+#define ipipe_current_domain (ipipe_percpu_domain[0])++#endif /* CONFIG_SMP */++#define ipipe_virtual_irq_p(irq) ((irq) >= IPIPE_VIRQ_BASE && \+ (irq) < IPIPE_NR_IRQS)++typedef void (*ipipe_irq_handler_t)(unsigned irq,+ void *cookie);++typedef int (*ipipe_irq_ackfn_t)(unsigned irq);++#define IPIPE_SAME_HANDLER ((ipipe_irq_handler_t)(-1))++struct ipipe_domain {++ struct list_head p_link; /* Link in pipeline */++ struct ipcpudata {+ unsigned long status;+ unsigned long irq_pending_hi;+ unsigned long irq_pending_lo[IPIPE_IRQ_IWORDS];+ struct ipirqcnt {+ unsigned long pending_hits;+ unsigned long total_hits;+ } irq_counters[IPIPE_NR_IRQS];+ } ____cacheline_aligned_in_smp cpudata[IPIPE_NR_CPUS];++ struct {+ unsigned long control;+ ipipe_irq_ackfn_t acknowledge;+ ipipe_irq_handler_t handler;+ void *cookie;+ } ____cacheline_aligned irqs[IPIPE_NR_IRQS];++ int (*evhand[IPIPE_NR_EVENTS])(unsigned event,+ struct ipipe_domain *from,+ void *data); /* Event handlers. */+ unsigned long long evself; /* Self-monitored event bits. */++#ifdef CONFIG_IPIPE_STATS+ struct ipipe_stats { /* All in timebase units. */+ unsigned long long last_stall_date;+ unsigned long last_stall_eip;+ unsigned long max_stall_time;+ unsigned long max_stall_eip;+ struct ipipe_irq_stats {+ unsigned long long last_receipt_date;+ unsigned long max_delivery_time;+ } irq_stats[IPIPE_NR_IRQS];+ } ____cacheline_aligned_in_smp stats[IPIPE_NR_CPUS];+#endif /* CONFIG_IPIPE_STATS */+ unsigned long flags;+ unsigned domid;+ const char *name;+ int priority;+ void *pdd;+};++struct ipipe_domain_attr {++ unsigned domid; /* Domain identifier -- Magic value set by caller */+ const char *name; /* Domain name -- Warning: won't be dup'ed! */+ int priority; /* Priority in interrupt pipeline */+ void (*entry) (void); /* Domain entry point */+ void *pdd; /* Per-domain (opaque) data pointer */+};++/* The following macros must be used hw interrupts off. */++#define __ipipe_irq_cookie(ipd,irq) (ipd)->irqs[irq].cookie+#define __ipipe_irq_handler(ipd,irq) (ipd)->irqs[irq].handler++#define __ipipe_cpudata_irq_hits(ipd,cpuid,irq) ((ipd)->cpudata[cpuid].irq_counters[irq].total_hits)++#define __ipipe_set_irq_bit(ipd,cpuid,irq) \+do { \+ if (!test_bit(IPIPE_LOCK_FLAG,&(ipd)->irqs[irq].control)) { \+ __set_bit(irq & IPIPE_IRQ_IMASK,&(ipd)->cpudata[cpuid].irq_pending_lo[irq >> IPIPE_IRQ_ISHIFT]); \+ __set_bit(irq >> IPIPE_IRQ_ISHIFT,&(ipd)->cpudata[cpuid].irq_pending_hi); \+ } \+} while(0)++#define __ipipe_clear_pend(ipd,cpuid,irq) \+do { \+ __clear_bit(irq & IPIPE_IRQ_IMASK,&(ipd)->cpudata[cpuid].irq_pending_lo[irq >> IPIPE_IRQ_ISHIFT]); \+ if ((ipd)->cpudata[cpuid].irq_pending_lo[irq >> IPIPE_IRQ_ISHIFT] == 0) \+ __clear_bit(irq >> IPIPE_IRQ_ISHIFT,&(ipd)->cpudata[cpuid].irq_pending_hi); \+} while(0)++#define __ipipe_lock_irq(ipd,cpuid,irq) \+do { \+ if (!test_and_set_bit(IPIPE_LOCK_FLAG,&(ipd)->irqs[irq].control)) \+ __ipipe_clear_pend(ipd,cpuid,irq); \+} while(0)++#define __ipipe_unlock_irq(ipd,irq) \+do { \+ int __cpuid, __nr_cpus = num_online_cpus(); \+ if (test_and_clear_bit(IPIPE_LOCK_FLAG,&(ipd)->irqs[irq].control)) \+ for (__cpuid = 0; __cpuid < __nr_cpus; __cpuid++) \+ if ((ipd)->cpudata[__cpuid].irq_counters[irq].pending_hits > 0) { /* We need atomic ops next. */ \+ set_bit(irq & IPIPE_IRQ_IMASK,&(ipd)->cpudata[__cpuid].irq_pending_lo[irq >> IPIPE_IRQ_ISHIFT]); \+ set_bit(irq >> IPIPE_IRQ_ISHIFT,&(ipd)->cpudata[__cpuid].irq_pending_hi); \+ } \+} while(0)++#define __ipipe_clear_irq(ipd,irq) \+do { \+ int __cpuid, __nr_cpus = num_online_cpus(); \+ clear_bit(IPIPE_LOCK_FLAG,&(ipd)->irqs[irq].control); \+ for (__cpuid = 0; __cpuid < __nr_cpus; __cpuid++) { \+ (ipd)->cpudata[__cpuid].irq_counters[irq].pending_hits = 0; \+ __ipipe_clear_pend(ipd,__cpuid,irq); \+ } \+} while(0)++#ifdef __RAW_SPIN_LOCK_UNLOCKED+#define spin_lock_hw(x) _raw_spin_lock(x)+#define spin_trylock_hw(x) _raw_spin_trylock(x)+#define spin_unlock_hw(x) _raw_spin_unlock(x)+#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)+#define write_lock_hw(x) _raw_write_lock(x)+#define write_trylock_hw(x) _raw_write_trylock(x)+#define write_unlock_hw(x) _raw_write_unlock(x)+#define read_lock_hw(x) _raw_read_lock(x)+#define read_trylock_hw(x) _raw_read_trylock(x)+#define read_unlock_hw(x) _raw_read_unlock(x)+#else /* UP non-debug */+#define write_lock_hw(lock) do { (void)(lock); } while (0)+#define write_trylock_hw(lock) ({ (void)(lock); 1; })+#define write_unlock_hw(lock) do { (void)(lock); } while (0)+#define read_lock_hw(lock) do { (void)(lock); } while (0)+#define read_trylock_hw(lock) ({ (void)(lock); 1; })+#define read_unlock_hw(lock) do { (void)(lock); } while (0)+#endif /* CONFIG_SMP || CONFIG_DEBUG_SPINLOCK */+#else /* !__RAW_SPIN_LOCK_UNLOCKED */+#define spin_lock_hw(x) _spin_lock(x)+#define spin_unlock_hw(x) _spin_unlock(x)+#define spin_trylock_hw(x) _spin_trylock(x)+#define write_lock_hw(x) _write_lock(x)+#define write_unlock_hw(x) _write_unlock(x)+#define write_trylock_hw(x) _write_trylock(x)+#define read_lock_hw(x) _read_lock(x)+#defin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -