📄 adeos-ipipe-2.4.25-ppc-denx-1.0-03.patch
字号:
+#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);++#define __cli() __ipipe_stall_root()+#define __sti() __ipipe_unstall_root()+#define __save_flags_ptr(pflags) \+do { \+ *(pflags) = (!__ipipe_test_root()) << 15; \+} while(0)+#define __save_flags(flags) __save_flags_ptr((unsigned long *)&(flags))+#define __save_and_cli(flags) \+do { \+ (flags) = (!__ipipe_test_and_stall_root()) << 15; \+} while(0)+#define __save_and_sti(flags) ({__save_flags(flags);__sti();})+#define __restore_flags(flags) __ipipe_restore_root(!((flags) & MSR_EE))++static inline void local_irq_disable_hw(void)+{+ unsigned long msr;+ msr = mfmsr();+ mtmsr(msr & ~MSR_EE);+ __asm__ __volatile__("": : :"memory");+}++static inline void local_irq_enable_hw(void)+{+ unsigned long msr;+ __asm__ __volatile__("": : :"memory");+ msr = mfmsr();+ mtmsr(msr | MSR_EE);+}++static inline void local_irq_save_ptr_hw(unsigned long *flags)+{+ unsigned long msr;+ msr = mfmsr();+ *flags = msr;+ mtmsr(msr & ~MSR_EE);+ __asm__ __volatile__("": : :"memory");+}++#define local_save_flags_hw(flags) ((flags) = mfmsr())+#define local_irq_save_hw(flags) local_irq_save_ptr_hw(&flags)+#define local_irq_restore_hw(flags) mtmsr(flags)+#define local_test_iflag_hw(x) ((x) & MSR_EE)+#define irqs_disabled_hw() ((mfmsr() & MSR_EE) == 0)++#else /* !CONFIG_IPIPE */+ extern void __sti(void); extern void __cli(void); extern void __restore_flags(unsigned long);@@ -20,6 +74,8 @@ extern unsigned long __sti_end, __cli_en #define __save_and_cli(flags) ({__save_flags(flags);__cli();}) #define __save_and_sti(flags) ({__save_flags(flags);__sti();}) +#endif /* CONFIG_IPIPE */+ extern void do_lost_interrupts(unsigned long); #define mask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->disable) irq_desc[irq].handler->disable(irq);})diff -uNrp 2.4.25-ppc/include/asm-ppc/ipipe.h 2.4.25-ppc-ipipe/include/asm-ppc/ipipe.h--- 2.4.25-ppc/include/asm-ppc/ipipe.h 1970-01-01 01:00:00.000000000 +0100+++ 2.4.25-ppc-ipipe/include/asm-ppc/ipipe.h 2006-02-04 20:17:33.000000000 +0100@@ -0,0 +1,180 @@+/* -*- linux-c -*-+ * include/asm-ppc/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 __PPC_IPIPE_H+#define __PPC_IPIPE_H++#include <linux/config.h>++#ifdef CONFIG_IPIPE++#include <asm/ptrace.h>+#include <asm/irq.h>+#include <asm/bitops.h>+#include <linux/threads.h>++#define IPIPE_ARCH_STRING "1.0-03"+#define IPIPE_MAJOR_NUMBER 1+#define IPIPE_MINOR_NUMBER 0+#define IPIPE_PATCH_NUMBER 3++#define IPIPE_NR_XIRQS NR_IRQS+#define IPIPE_IRQ_ISHIFT 5 /* 25 for 32bits arch. */++/*+ * The first virtual interrupt is reserved for the timer (see+ * __ipipe_init_platform).+ */+#define IPIPE_TIMER_VIRQ IPIPE_VIRQ_BASE++#ifdef CONFIG_SMP+#error "I-pipe/ppc: SMP not yet implemented"+#else /* !CONFIG_SMP */+#define ipipe_processor_id() 0+#endif /* CONFIG_SMP */++#define prepare_to_switch(next) \+do { \+ __ipipe_dispatch_event(IPIPE_EVENT_SCHEDULE,next); \+ local_irq_disable_hw(); \+} while(0)++#define task_hijacked(p) \+ ( { \+ int x = ipipe_current_domain != ipipe_root_domain; \+ __clear_bit(IPIPE_SYNC_FLAG, \+ &ipipe_root_domain->cpudata[(p)->processor].status); \+ local_irq_enable_hw(); x; \+ } )++ /* PPC traps */+#define IPIPE_TRAP_ACCESS 0 /* Data or instruction access exception */+#define IPIPE_TRAP_ALIGNMENT 1 /* Alignment exception */+#define IPIPE_TRAP_ALTUNAVAIL 2 /* Altivec unavailable */+#define IPIPE_TRAP_PCE 3 /* Program check exception */+#define IPIPE_TRAP_MCE 4 /* Machine check exception */+#define IPIPE_TRAP_UNKNOWN 5 /* Unknown exception */+#define IPIPE_TRAP_IABR 6 /* Instruction breakpoint */+#define IPIPE_TRAP_RM 7 /* Run mode exception */+#define IPIPE_TRAP_SSTEP 8 /* Single-step exception */+#define IPIPE_TRAP_NREC 9 /* Non-recoverable exception */+#define IPIPE_TRAP_SOFTEMU 10 /* Software emulation */+#define IPIPE_TRAP_DEBUG 11 /* Debug exception */+#define IPIPE_TRAP_SPE 12 /* SPE exception */+#define IPIPE_TRAP_ALTASSIST 13 /* Altivec assist exception */+#define IPIPE_NR_FAULTS 14+/* Pseudo-vectors used for kernel events */+#define IPIPE_FIRST_EVENT IPIPE_NR_FAULTS+#define IPIPE_EVENT_SYSCALL (IPIPE_FIRST_EVENT)+#define IPIPE_EVENT_SCHEDULE (IPIPE_FIRST_EVENT + 1)+#define IPIPE_EVENT_SIGWAKE (IPIPE_FIRST_EVENT + 2)+#define IPIPE_EVENT_SETSCHED (IPIPE_FIRST_EVENT + 3)+#define IPIPE_EVENT_EXIT (IPIPE_FIRST_EVENT + 4)+#define IPIPE_LAST_EVENT IPIPE_EVENT_EXIT+#define IPIPE_NR_EVENTS (IPIPE_LAST_EVENT + 1)++struct ipipe_domain;++struct ipipe_sysinfo {++ int ncpus; /* Number of CPUs on board */+ u64 cpufreq; /* CPU frequency (in Hz) */++ /* Arch-dependent block */++ struct {+ unsigned tmirq; /* Timer tick IRQ */+ u64 tmfreq; /* Timer frequency */+ } archdep;+};++#define ipipe_read_tsc(t) \+ ({ \+ unsigned long __tbu; \+ __asm__ __volatile__ ("1: mftbu %0\n" \+ "mftb %1\n" \+ "mftbu %2\n" \+ "cmpw %2,%0\n" \+ "bne- 1b\n" \+ :"=r" (((unsigned long *)&t)[0]), \+ "=r" (((unsigned long *)&t)[1]), \+ "=r" (__tbu)); \+ t; \+ })++#define __ipipe_read_timebase() \+ ({ \+ unsigned long long t; \+ ipipe_read_tsc(t); \+ t; \+ })++extern unsigned tb_ticks_per_jiffy;+#define ipipe_cpu_freq() (HZ * tb_ticks_per_jiffy)+#define ipipe_tsc2ns(t) (((t) * 1000) / (ipipe_cpu_freq() / 1000000))++/* Private interface -- Internal use only */++#define __ipipe_check_platform() do { } while(0)++void __ipipe_init_platform(void);++#define __ipipe_enable_irq(irq) enable_irq(irq)++#define __ipipe_disable_irq(irq) disable_irq(irq)++void __ipipe_enable_pipeline(void);++void __ipipe_sync_stage(unsigned long syncmask);++int __ipipe_ack_irq(unsigned irq);++void __ipipe_do_IRQ(int irq,+ struct pt_regs *regs);++void __ipipe_do_timer(int irq,+ struct pt_regs *regs);++void __ipipe_do_critical_sync(unsigned irq,+ void *cookie);++extern unsigned long __ipipe_decr_ticks;++extern unsigned long long __ipipe_decr_next[];++extern struct pt_regs __ipipe_tick_regs[];++void __ipipe_handle_irq(int irq,+ struct pt_regs *regs);++void __ipipe_stall_root_raw(void);++void __ipipe_unstall_root_raw(void);++#define __ipipe_tick_irq IPIPE_TIMER_VIRQ++#else /* !CONFIG_IPIPE */++#define task_hijacked(p) 0++#endif /* CONFIG_IPIPE */++#endif /* !__PPC_IPIPE_H */diff -uNrp 2.4.25-ppc/include/asm-ppc/mmu_context.h 2.4.25-ppc-ipipe/include/asm-ppc/mmu_context.h--- 2.4.25-ppc/include/asm-ppc/mmu_context.h 2005-03-16 00:12:45.000000000 +0100+++ 2.4.25-ppc-ipipe/include/asm-ppc/mmu_context.h 2006-01-30 16:06:22.000000000 +0100@@ -148,12 +148,15 @@ static inline void get_mmu_context(struc */ static inline void destroy_context(struct mm_struct *mm) {+ unsigned long flags; if (mm->context != NO_CONTEXT) {+ local_irq_save_hw_cond(flags); clear_bit(mm->context, context_map); mm->context = NO_CONTEXT; #ifdef FEW_CONTEXTS atomic_inc(&nr_free_contexts); #endif+ local_irq_restore_hw_cond(flags); } } @@ -171,9 +174,12 @@ static inline void switch_mm(struct mm_s */ static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm) {+ unsigned long flags;+ local_irq_save_hw_cond(flags); current->thread.pgdir = mm->pgd; get_mmu_context(mm); set_context(mm->context, mm->pgd);+ local_irq_restore_hw_cond(flags); } extern void mmu_context_init(void);diff -uNrp 2.4.25-ppc/include/asm-ppc/system.h 2.4.25-ppc-ipipe/include/asm-ppc/system.h--- 2.4.25-ppc/include/asm-ppc/system.h 2003-10-30 01:34:06.000000000 +0100+++ 2.4.25-ppc-ipipe/include/asm-ppc/system.h 2006-01-30 16:06:18.000000000 +0100@@ -81,7 +81,9 @@ struct device_node; extern void note_scsi_host(struct device_node *, void *); struct task_struct;-#define prepare_to_switch() do { } while(0)+#ifndef CONFIG_IPIPE+#define prepare_to_switch(next) do { } while(0)+#endif /* CONFIG_IPIPE */ #define switch_to(prev,next,last) _switch_to((prev),(next),&(last)) extern void _switch_to(struct task_struct *, struct task_struct *, struct task_struct **);diff -uNrp 2.4.25-ppc/include/linux/ipipe.h 2.4.25-ppc-ipipe/include/linux/ipipe.h--- 2.4.25-ppc/include/linux/ipipe.h 1970-01-01 01:00:00.000000000 +0100+++ 2.4.25-ppc-ipipe/include/linux/ipipe.h 2006-01-30 16:06:18.000000000 +0100@@ -0,0 +1,794 @@+/* -*- 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++#include <linux/kernel.h>+#include <linux/list.h>+#include <linux/smp.h>++#define IPIPE_VERSION_STRING IPIPE_ARCH_STRING+#define IPIPE_RELEASE_NUMBER ((IPIPE_MAJOR_NUMBER << 16) | \+ (IPIPE_MINOR_NUMBER << 8) | \+ (IPIPE_PATCH_NUMBER))++#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))++typedef unsigned long cpumask_t;++#define cpus_andnot(dst,src1,src2) ((dst) = (src1) & ~(src2))+#define cpus_and(dst,src1,src2) ((dst) = (src1) & (src2))+#define cpus_equal(src1,src2) ((src1) == (src2))+#define cpus_empty(src) ((src) == 0)+#define cpus_clear(dst) ((dst) = 0)+#define cpus_weight(src) hweight32(src)+#define cpu_clear(cpu,dst) ((dst) &= ~(1UL << (cpu)))+#define cpu_isset(cpu,src) ((src) & (1UL << (cpu)))+#define cpu_set(cpu,dst) ((dst) |= (1UL << (cpu)))+#define cpumask_of_cpu(cpu) (1UL << (cpu))+#define cpu_test_and_set(cpu,dst) test_and_set_bit(cpu,&dst)+#define cpu_test_and_clear(cpu,dst) test_and_clear_bit(cpu,&dst)+#define first_cpu(src) (ffs(src) - 1)++#define num_online_cpus() smp_num_cpus+#define CPU_MASK_NONE 0+#define CPU_MASK_ALL (~0)+#define for_each_online_cpu(cpu) for ((cpu) = 0; (cpu) < NR_CPUS; (cpu)++) \+ if (cpu_isset(cpu,cpu_online_map))++#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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -