diff options
Diffstat (limited to 'include')
152 files changed, 7022 insertions, 2161 deletions
diff --git a/include/asm-alpha/elf.h b/include/asm-alpha/elf.h index 0cf5ecbec..bca9bbfea 100644 --- a/include/asm-alpha/elf.h +++ b/include/asm-alpha/elf.h @@ -34,6 +34,13 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 8192 +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical + use of this is to invoke "./ld.so someprog" to test out a new version of + the loader. We need to make sure that it is out of the way of the program + that it will "exec", and that there is sufficient room for the brk. */ + +#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) + /* $0 is set by ld.so to a pointer to a function which might be registered using atexit. This provides a mean for the dynamic linker to call DT_FINI functions for shared libraries that have diff --git a/include/asm-alpha/floppy.h b/include/asm-alpha/floppy.h index b9471de7b..9be100c4f 100644 --- a/include/asm-alpha/floppy.h +++ b/include/asm-alpha/floppy.h @@ -48,6 +48,8 @@ static int FDC2 = -1; #define N_FDC 2 #define N_DRIVE 8 +#define FLOPPY_MOTOR_MASK 0xf0 + /* * Most Alphas have no problems with floppy DMA crossing 64k borders. Sigh... */ diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 7d80c32f8..fdb1e4d0b 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h @@ -18,6 +18,7 @@ #define flush_cache_range(mm, start, end) do { } while (0) #define flush_cache_page(vma, vmaddr) do { } while (0) #define flush_page_to_ram(page) do { } while (0) +#define flush_icache_range(start, end) do { } while (0) /* * Force a context reload. This is needed when we diff --git a/include/asm-alpha/uaccess.h b/include/asm-alpha/uaccess.h index 870fd290c..a76b1fc38 100644 --- a/include/asm-alpha/uaccess.h +++ b/include/asm-alpha/uaccess.h @@ -10,6 +10,10 @@ * performed or not. If get_fs() == USER_DS, checking is performed, with * get_fs() == KERNEL_DS, checking is bypassed. * + * Or at least it did once upon a time. Nowadays it is a mask that + * defines which bits of the address space are off limits. This is a + * wee bit faster than the above. + * * For historical reasons, these macros are grossly misnamed. */ @@ -20,9 +24,17 @@ #define VERIFY_WRITE 1 #define get_fs() (current->tss.fs) -#define set_fs(x) (current->tss.fs = (x)) #define get_ds() (KERNEL_DS) +/* Our scheme relies on all bits being preserved. Trap those evil + Intellists in their plot to use unsigned short. */ + +extern unsigned long __bad_fs_size(void); + +#define set_fs(x) (current->tss.fs = \ + sizeof(x) == sizeof(unsigned long) ? (x) \ + : __bad_fs_size()) + /* * Is a address valid? This does a straighforward calculation rather * than tests. diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index a19ff035e..2e83b1b48 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -12,15 +12,16 @@ */ #include <linux/config.h> +#include <asm/processor.h> #define CONFIG_BUGi386 -static void no_halt(char *s, int *ints) +__initfunc(static void no_halt(char *s, int *ints)) { hlt_works_ok = 0; } -static void no_387(char *s, int *ints) +__initfunc(static void no_387(char *s, int *ints)) { hard_math = 0; __asm__("movl %%cr0,%%eax\n\t" @@ -28,9 +29,9 @@ static void no_387(char *s, int *ints) "movl %%eax,%%cr0\n\t" : : : "ax"); } -static char fpu_error = 0; +static char __initdata fpu_error = 0; -static void copro_timeout(void) +__initfunc(static void copro_timeout(void)) { fpu_error = 1; timer_table[COPRO_TIMER].expires = jiffies+100; @@ -41,10 +42,11 @@ static void copro_timeout(void) outb_p(0,0xf0); } -static void check_fpu(void) +static double __initdata x = 4195835.0; +static double __initdata y = 3145727.0; + +__initfunc(static void check_fpu(void)) { - static double x = 4195835.0; - static double y = 3145727.0; unsigned short control_word; if (!hard_math) { @@ -91,15 +93,13 @@ static void check_fpu(void) "fninit" : "=m" (*&fdiv_bug) : "m" (*&x), "m" (*&y)); - if (!fdiv_bug) { + if (!fdiv_bug) printk("Ok, fpu using exception 16 error reporting.\n"); - return; - - } - printk("Hmm, FDIV bug i%c86 system\n", '0'+x86); + else + printk("Hmm, fpu using exception 16 error reporting with FDIV bug.\n"); } -static void check_hlt(void) +__initfunc(static void check_hlt(void)) { printk(KERN_INFO "Checking 'hlt' instruction... "); if (!hlt_works_ok) { @@ -110,7 +110,7 @@ static void check_hlt(void) printk("Ok.\n"); } -static void check_tlb(void) +__initfunc(static void check_tlb(void)) { #ifndef CONFIG_M386 /* @@ -125,10 +125,53 @@ static void check_tlb(void) #endif } -static void check_bugs(void) +/* + * Most 386 processors have a bug where a POPAD can lock the + * machine even from user space. + */ + +__initfunc(static void check_popad(void)) +{ +#ifdef CONFIG_M386 + int res, inp = (int) &res; + + printk(KERN_INFO "Checking for popad bug... "); + __asm__ __volatile__( + "movl $12345678,%%eax; movl $0,%%edi; pusha; popa; movl (%%edx,%%edi),%%ecx " + : "=eax" (res) + : "edx" (inp) + : "eax", "ecx", "edx", "edi" ); + /* If this fails, it means that any user program may lock CPU hard. Too bad. */ + if (res != 12345678) printk( "Bad.\n" ); + else printk( "Ok.\n" ); +#endif +} + +/* + * B step AMD K6 before B 9729AIJW have hardware bugs that can cause + * misexecution of code under Linux. Owners of such processors should + * contact AMD for precise details and a CPU swap. + * + * See http://www.creaweb.fr/bpc/k6bug_faq.html + * http://www.amd.com/K6/k6docs/revgd.html + */ + +__initfunc(static void check_amd_k6(void)) +{ + /* B Step AMD K6 */ + if(x86_model==6 && x86_mask==1 && memcmp(x86_vendor_id, "AuthenticAMD", 12)==0) + { + printk(KERN_INFO "AMD K6 stepping B detected - system stability may be impaired. Please see.\n"); + printk(KERN_INFO "http://www.creaweb.fr/bpc/k6bug_faq.html"); + } +} + +__initfunc(static void check_bugs(void)) { check_tlb(); check_fpu(); check_hlt(); + check_popad(); + check_amd_k6(); system_utsname.machine[1] = '0' + x86; } diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index 71009ec5c..46a4a7ada 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h @@ -27,18 +27,24 @@ typedef struct user_i387_struct elf_fpregset_t; #define ELF_DATA ELFDATA2LSB; #define ELF_ARCH EM_386 - /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program - starts %edx contains a pointer to a function which might be - registered using `atexit'. This provides a mean for the - dynamic linker to call DT_FINI functions for shared libraries - that have been loaded before the code runs. +/* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx + contains a pointer to a function which might be registered using `atexit'. + This provides a mean for the dynamic linker to call DT_FINI functions for + shared libraries that have been loaded before the code runs. - A value of 0 tells we have no such handler. */ + A value of 0 tells we have no such handler. */ #define ELF_PLAT_INIT(_r) _r->edx = 0 #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical + use of this is to invoke "./ld.so someprog" to test out a new version of + the loader. We need to make sure that it is out of the way of the program + that it will "exec", and that there is sufficient room for the brk. */ + +#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) + /* Wow, the "main" arch needs arch dependent functions too.. :) */ /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is diff --git a/include/asm-i386/floppy.h b/include/asm-i386/floppy.h index 06a3fa1b6..0a7cf8563 100644 --- a/include/asm-i386/floppy.h +++ b/include/asm-i386/floppy.h @@ -288,6 +288,8 @@ static int FDC2 = -1; #define N_FDC 2 #define N_DRIVE 8 +#define FLOPPY_MOTOR_MASK 0xf0 + /* * The DMA channel used by the floppy controller cannot access data at * addresses >= 16MB diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 347611f1b..9274056f8 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -19,6 +19,7 @@ #define flush_cache_range(mm, start, end) do { } while (0) #define flush_cache_page(vma, vmaddr) do { } while (0) #define flush_page_to_ram(page) do { } while (0) +#define flush_icache_range(start, end) do { } while (0) /* * TLB flushing: @@ -201,6 +202,7 @@ static inline void flush_tlb_range(struct mm_struct *mm, #define _PAGE_PRESENT 0x001 #define _PAGE_RW 0x002 #define _PAGE_USER 0x004 +#define _PAGE_WT 0x008 #define _PAGE_PCD 0x010 #define _PAGE_ACCESSED 0x020 #define _PAGE_DIRTY 0x040 diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h index 941916118..a2947ce3e 100644 --- a/include/asm-i386/string.h +++ b/include/asm-i386/string.h @@ -23,7 +23,8 @@ * set, making the functions fast and clean. String instructions have been * used through-out, making for "slightly" unclear code :-) * - * Copyright (C) 1991, 1992 Linus Torvalds + * NO Copyright (C) 1991, 1992 Linus Torvalds, + * consider these trivial functions to be PD. */ #define __HAVE_ARCH_STRCPY diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h index d8b03e17c..84bb65f76 100644 --- a/include/asm-i386/uaccess.h +++ b/include/asm-i386/uaccess.h @@ -18,10 +18,20 @@ * For historical reasons, these macros are grossly misnamed. */ +extern unsigned long __bad_fs_size(void); + #define get_fs() (current->tss.segment) -#define set_fs(x) (current->tss.segment = (x)) #define get_ds() (KERNEL_DS) +/* Some architectures -- Alpha for one -- use "segment" schemes that + require all bits to be preserved, thus the i386 traditional `ushort' + doesn't work. To head off problems early, force the Intel folks + to do it Right as well. */ + +#define set_fs(x) (current->tss.segment = \ + sizeof(x) == sizeof(unsigned long) ? (x) \ + : __bad_fs_size()) + /* * Address Ok: * diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h index 570521687..ee282c0a9 100644 --- a/include/asm-m68k/elf.h +++ b/include/asm-m68k/elf.h @@ -27,14 +27,21 @@ typedef struct user_m68kfp_struct elf_fpregset_t; #define ELF_DATA ELFDATA2MSB; #define ELF_ARCH EM_68K - /* For SVR4/m68k the function pointer to be registered with - `atexit' is passed in %a1. Although my copy of the ABI has - no such statement, it is actually used on ASV. */ +/* For SVR4/m68k the function pointer to be registered with `atexit' is + passed in %a1. Although my copy of the ABI has no such statement, it + is actually used on ASV. */ #define ELF_PLAT_INIT(_r) _r->a1 = 0 #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical + use of this is to invoke "./ld.so someprog" to test out a new version of + the loader. We need to make sure that it is out of the way of the program + that it will "exec", and that there is sufficient room for the brk. */ + +#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) + #define ELF_CORE_COPY_REGS(pr_reg, regs) \ /* Bleech. */ \ pr_reg[0] = regs->d1; \ diff --git a/include/asm-m68k/namei.h b/include/asm-m68k/namei.h index 4ecdd7ca7..d01ddf852 100644 --- a/include/asm-m68k/namei.h +++ b/include/asm-m68k/namei.h @@ -12,7 +12,7 @@ * Look at asm-sparc/namei.h for details. */ -#define __prefix_namei(retrieve_mode, name, base, buf, res_dir, res_inode, \ - last_name, last_entry, last_error) 1 +#define __prefix_lookup_dentry(name, follow_link) \ + do {} while (0) #endif diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h index 589dfe956..ef2246585 100644 --- a/include/asm-m68k/pgtable.h +++ b/include/asm-m68k/pgtable.h @@ -159,6 +159,8 @@ extern inline void flush_pages_to_ram (unsigned long address, int n) } } +#define flush_icache_range(start, end) do { } while (0) + /* * flush all user-space atc entries. */ diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h index e723cae21..4d8c0e171 100644 --- a/include/asm-mips/bootinfo.h +++ b/include/asm-mips/bootinfo.h @@ -7,6 +7,8 @@ * 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. + * + * $Id:$ */ #ifndef __ASM_MIPS_BOOTINFO_H #define __ASM_MIPS_BOOTINFO_H @@ -29,7 +31,8 @@ #define MACH_DECSTATION 5 /* DECStation 5000/2x for now */ #define MACH_SNI_RM200_PCI 6 /* RM200/RM300/RM400 PCI series */ #define MACH_SGI_INDY 7 /* R4?K and R5K Indy workstaions */ -#define MACH_LAST 7 +#define MACH_RESERVED 8 /* Erlkoenig ... */ +#define MACH_LAST 8 #define MACH_NAMES {"unknown", "Deskstation rPC44", "Deskstation Tyne", \ "Acer PICA 61", "Mips Magnum 4000", "DECStation", "RM200 PCI", \ @@ -46,8 +49,10 @@ #define MACH_GROUP_SNI_RM 4 /* Siemens Nixdorf RM series */ #define MACH_GROUP_ACN 5 #define MACH_GROUP_SGI 6 /* Silicon Graphics workstations and servers */ +#define MACH_GROUP_RESERVED 7 /* Erlkoenig ... */ -#define GROUP_NAMES { "unknown", "Jazz", "Digital", "ARC", "SNI", "ACN" } +#define GROUP_NAMES { "unknown", "Jazz", "Digital", "ARC", \ + "SNI", "ACN", "You'd like to know" } /* * Valid machtype values for group unknown (low order halfword of mips_machtype) @@ -102,6 +107,13 @@ #define MACH_SGI_INDY 0 /* R4?K and R5K Indy workstaions */ /* + * Valid machtype for group RESERVED + */ +#define MACH_RESERVED 0 /* Proto "27" hardware */ + +#define GROUP_RESERVED { "You'd like to know" } + +/* * Valid cputype values */ #define CPU_UNKNOWN 0 @@ -131,13 +143,14 @@ #define CPU_R5000 24 #define CPU_R5000A 25 #define CPU_R4640 26 -#define CPU_LAST 27 +#define CPU_NEVADA 27 /* RM5230, RM5260 */ +#define CPU_LAST 27 #define CPU_NAMES { "unknown", "R2000", "R3000", "R3000A", "R3041", "R3051", \ "R3052", "R3081", "R3081E", "R4000PC", "R4000SC", "R4000MC", \ "R4200", "R4400PC", "R4400SC", "R4400MC", "R4600", "R6000", \ "R6000A", "R8000", "R10000", "R4300", "R4650", "R4700", "R5000", \ - "R5000A", "R4640" } + "R5000A", "R4640", "Nevada" } #define CL_SIZE (80) diff --git a/include/asm-mips/bugs.h b/include/asm-mips/bugs.h index 5f00d4508..15fe291f4 100644 --- a/include/asm-mips/bugs.h +++ b/include/asm-mips/bugs.h @@ -2,7 +2,9 @@ * include/asm-mips/bugs.h * * Copyright (C) 1995 Waldorf Electronics - * written by Ralf Baechle + * Copyright (C) 1997 Ralf Baechle + * + * $Id:$ */ #include <asm/bootinfo.h> @@ -14,21 +16,25 @@ */ -static void check_wait(void) +static inline void check_wait(void) { printk("Checking for 'wait' instruction... "); switch(mips_cputype) { - case CPU_R4200: - case CPU_R4300: - case CPU_R4600: - case CPU_R5000: - wait_available = 1; - printk(" available.\n"); - break; - default: - printk(" unavailable.\n"); - break; - } + case CPU_R4200: + case CPU_R4300: + case CPU_R4600: + case CPU_R4640: + case CPU_R4650: + case CPU_R4700: + case CPU_R5000: + case CPU_NEVADA: + wait_available = 1; + printk(" available.\n"); + break; + default: + printk(" unavailable.\n"); + break; + } } static void check_bugs(void) diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h index 97e670510..87dae378f 100644 --- a/include/asm-mips/elf.h +++ b/include/asm-mips/elf.h @@ -40,4 +40,11 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; */ #define ELF_PLAT_INIT(_r) _r->regs[2] = 0; +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical + use of this is to invoke "./ld.so someprog" to test out a new version of + the loader. We need to make sure that it is out of the way of the program + that it will "exec", and that there is sufficient room for the brk. */ + +#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) + #endif /* __ASM_MIPS_ELF_H */ diff --git a/include/asm-mips/floppy.h b/include/asm-mips/floppy.h index 4409b538e..412057a0b 100644 --- a/include/asm-mips/floppy.h +++ b/include/asm-mips/floppy.h @@ -6,6 +6,8 @@ * for more details. * * Copyright (C) 1995 + * + * $Id:$ */ #ifndef __ASM_MIPS_FLOPPY_H #define __ASM_MIPS_FLOPPY_H @@ -95,6 +97,8 @@ static int FDC2=-1; #define N_FDC 1 /* do you *really* want a second controller? */ #define N_DRIVE 8 +#define FLOPPY_MOTOR_MASK 0xf0 + /* * The DMA channel used by the floppy controller cannot access data at * addresses >= 16MB diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h index b09ca61a4..f544d741f 100644 --- a/include/asm-mips/irq.h +++ b/include/asm-mips/irq.h @@ -24,4 +24,13 @@ extern int setup_x86_irq(int irq, struct irqaction * new); extern void disable_irq(unsigned int); extern void enable_irq(unsigned int); +extern unsigned int local_irq_count[]; + +#ifdef __SMP__ +#error Send superfluous SMP boxes to ralf@uni-koblenz.de +#else +#define irq_enter(cpu, irq) (++local_irq_count[cpu]) +#define irq_exit(cpu, irq) (--local_irq_count[cpu]) +#endif + #endif /* __ASM_MIPS_IRQ_H */ diff --git a/include/asm-mips/namei.h b/include/asm-mips/namei.h index b9c0aea15..56dd5c690 100644 --- a/include/asm-mips/namei.h +++ b/include/asm-mips/namei.h @@ -8,50 +8,45 @@ #include <linux/config.h> -#ifdef CONFIG_BINFMT_IRIX - /* Only one at this time. */ #define IRIX32_EMUL "usr/gnemul/irix/" -#if 0 /* XXX FIXME */ - -extern int __namei(int, const char *, struct inode *, char *, struct inode **, - struct inode **, struct qstr *, struct dentry **, int *); - -static __inline__ int -__prefix_namei(int retrieve_mode, const char * name, struct inode * base, - char * buf, struct inode ** res_dir, struct inode ** res_inode, - struct qstr * last_name, struct dentry ** last_entry, - int * last_error) +static inline struct dentry * +__mips_lookup_dentry(const char *name, int follow_link) { int error; + struct dentry *base; if (current->personality != PER_IRIX32) - return -EINVAL; - - while (*name == '/') - name++; - - atomic_inc(¤t->fs->root->i_count); - error = __namei(NAM_FOLLOW_LINK, IRIX32_EMUL, current->fs->root, - buf, NULL, &base, NULL, NULL, NULL); - if (error) - return error; - - error = __namei(retrieve_mode, name, base, buf, res_dir, res_inode, - last_name, last_entry, last_error); - if (error) - return error; - - return 0; + return ERR_PTR(-ENOENT); + + base = lookup_dentry (IRIX32_EMUL, + dget (current->fs->root), 1); + + if (IS_ERR (base)) return base; + + base = lookup_dentry (name, base, follow_link); + + if (IS_ERR (base)) return base; + + if (!base->d_inode) { + dput(base); + return ERR_PTR(-ENOENT); + } + + return base; } -#endif /* XXX FIXME */ +#ifdef CONFIG_BINFMT_IRIX + +#define __prefix_lookup_dentry(name, follow_link) \ + dentry = __mips_lookup_dentry (name, follow_link); \ + if (!IS_ERR (dentry)) return dentry; #else /* !defined(CONFIG_BINFMT_IRIX) */ -#define __prefix_namei(retrieve_mode, name, base, buf, res_dir, res_inode, \ - last_name, last_entry, last_error) 1 +#define __prefix_lookup_dentry(name, follow_link) \ + do {} while (0) #endif /* !defined(CONFIG_BINFMT_IRIX) */ diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 3717bb398..c0b3a4d86 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h @@ -25,6 +25,7 @@ extern void (*flush_cache_range)(struct mm_struct *mm, unsigned long start, extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page); extern void (*flush_cache_sigtramp)(unsigned long addr); extern void (*flush_page_to_ram)(unsigned long page); +#define flush_icache_range(start, end) flush_cache_all() /* TLB flushing: * diff --git a/include/asm-mips/posix_types.h b/include/asm-mips/posix_types.h index deffcf200..21217ebae 100644 --- a/include/asm-mips/posix_types.h +++ b/include/asm-mips/posix_types.h @@ -36,7 +36,7 @@ typedef long __kernel_time_t; typedef long __kernel_clock_t; typedef long __kernel_daddr_t; typedef char * __kernel_caddr_t; -/* typedef unsigned long __kernel_sigset_t; anybody using this type? */ +typedef unsigned long __kernel_sigset_t; #ifdef __GNUC__ typedef long long __kernel_loff_t; diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h index a3af51c4e..bdd80fd01 100644 --- a/include/asm-mips/sigcontext.h +++ b/include/asm-mips/sigcontext.h @@ -7,11 +7,13 @@ * * Copyright (C) 1996, 1997 by Ralf Baechle * - * $Id: sigcontext.h,v 1.2 1997/06/25 14:50:02 ralf Exp $ + * $Id: sigcontext.h,v 1.2 1997/06/25 20:49:07 ralf Exp $ */ #ifndef __ASM_MIPS_SIGCONTEXT_H #define __ASM_MIPS_SIGCONTEXT_H +#include <linux/posix_types.h> + /* * Keep this struct definition in sync with the sigcontext fragment * in arch/mips/tools/offset.c @@ -32,7 +34,7 @@ struct sigcontext { unsigned int sc_cause; /* Unused */ unsigned int sc_badvaddr; /* Unused */ - sigset_t sc_sigset; + __kernel_sigset_t sc_sigset; /* DANGER: kernel vs. libc sigset_t ... */ unsigned long __pad0[3]; /* pad for constant size */ }; diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h index d21105928..d7fe49864 100644 --- a/include/asm-mips/signal.h +++ b/include/asm-mips/signal.h @@ -5,40 +5,20 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 1995, 1996 by Ralf Baechle + * Copyright (C) 1995, 1996, 1997 by Ralf Baechle + * + * $Id:$ */ #ifndef __ASM_MIPS_SIGNAL_H +#define __ASM_MIPS_SIGNAL_H #include <asm/sgidefs.h> -/* Any one of these symbols __need_* means that GNU libc - wants us just to define one data type. So don't define - the symbols that indicate this file's entire job has been done. */ -#if !defined(__need_signums) && !defined(__need_fake_sigfuns) && \ - !defined(__need__nsig) -#define __ASM_MIPS_SIGNAL_H -#endif - -#ifdef __ASM_MIPS_SIGNAL_H typedef unsigned long sigset_t; -#endif /* __ASM_MIPS_SIGNAL_H */ -#if !defined (___nsig_defined) && \ - (defined (__ASM_MIPS_SIGNAL_H) || defined (__need__nsig)) -#define ___nsig_defined -#define _NSIG 65 -#endif -#undef __need__nsig -#ifdef __KERNEL__ +#define _NSIG 32 #define NSIG _NSIG -#endif -#if !defined (__signums_defined) && \ - (defined (__ASM_MIPS_SIGNAL_H) || defined (__need_signums)) -#define __signums_defined -/* - * 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). */ @@ -73,10 +53,7 @@ typedef unsigned long sigset_t; #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). */ -#endif /* need signums */ -#undef __need_signums -#ifdef __ASM_MIPS_SIGNAL_H /* * 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 @@ -113,24 +90,14 @@ typedef unsigned long sigset_t; #define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility: set only the low 32 bit of the sigset. */ -#ifndef __sighandler_t_defined -#define __sighandler_t_defined /* Type of a signal handler. */ typedef void (*__sighandler_t)(int); -#endif -#endif -#if !defined (__fake_sigfuns_defined) && \ - (defined (__ASM_MIPS_SIGNAL_H) || defined (__need_fake_sigfuns)) -#define __fake_sigfuns_defined /* 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 */ -#endif -#undef __need_fake_sigfuns -#ifdef __ASM_MIPS_SIGNAL_H struct sigaction { unsigned int sa_flags; __sighandler_t sa_handler; @@ -173,6 +140,5 @@ struct sigaction { #define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */ #define BRK_MULOVF 1023 /* Multiply overflow */ #endif /* defined (__KERNEL__) || defined (__USE_MISC) */ -#endif /* defined (__ASM_MIPS_SIGNAL_H) */ #endif /* !defined (__ASM_MIPS_SIGNAL_H) */ diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h index f0f0e9ff8..4e627d6b0 100644 --- a/include/asm-mips/socket.h +++ b/include/asm-mips/socket.h @@ -48,19 +48,16 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */ #define SO_SECURITY_ENCRYPTION_NETWORK 24 /* Types of sockets. */ -enum __socket_type -{ - SOCK_DGRAM = 1, /* Connectionless, unreliable datagrams - of fixed maximum length. */ - SOCK_STREAM = 2, /* Sequenced, reliable, connection-based - byte streams. */ - SOCK_RAW = 3, /* Raw protocol interface. */ - SOCK_RDM = 4, /* Reliably-delivered messages. */ - SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, - datagrams of fixed maximum length. */ - SOCK_PACKET = 10, /* linux specific way of getting packets at +#define SOCK_DGRAM 1 /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_STREAM 2 /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_RAW 3 /* Raw protocol interface. */ +#define SOCK_RDM 4 /* Reliably-delivered messages. */ +#define SOCK_SEQPACKET 5 /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#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 --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h index 4a110338a..1481c667d 100644 --- a/include/asm-mips/stackframe.h +++ b/include/asm-mips/stackframe.h @@ -10,8 +10,11 @@ #include <asm/offset.h> #define SAVE_ALL \ + .set push; \ + .set reorder; \ mfc0 k0, CP0_STATUS; \ sll k0, 3; /* extract cu0 bit */ \ + .set pop; \ bltz k0, 8f; \ move k1, sp; \ /* Called from user mode, new stack. */ \ @@ -68,7 +71,10 @@ * that a modified IE mask will be nullified. */ #define RESTORE_ALL \ + .set push; \ + .set reorder; \ mfc0 t0, CP0_STATUS; \ + .set pop; \ ori t0, 0x1f; \ xori t0, 0x1f; \ mtc0 t0, CP0_STATUS; \ diff --git a/include/asm-mips/string.h b/include/asm-mips/string.h index daf1045ed..bc9007010 100644 --- a/include/asm-mips/string.h +++ b/include/asm-mips/string.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, 1995, 1996, 1997 by Ralf Baechle * - * $Id: string.h,v 1.2 1997/07/23 14:40:10 ralf Exp $ + * $Id: string.h,v 1.2 1997/07/24 01:49:29 ralf Exp $ */ #ifndef __ASM_MIPS_STRING_H #define __ASM_MIPS_STRING_H @@ -94,25 +94,25 @@ extern __inline__ int strcmp(__const__ char *__cs, __const__ char *__ct) #define __HAVE_ARCH_STRNCMP extern __inline__ int strncmp(__const__ char *__cs, __const__ char *__ct, size_t __count) { - char __res; + int __res; __asm__ __volatile__( ".set\tnoreorder\n\t" ".set\tnoat\n" - "1:\tlbu\t%3,(%0)\n\t" + "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" + "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" - : "=r" (__cs), "=r" (__ct), "=r" (__count), "=r" (__res) - : "0" (__cs), "1" (__ct), "2" (__count) + : "=r" (__cs), "=r" (__ct), "=r" (__count), "=r" (__res) + : "0" (__cs), "1" (__ct), "2" (__count) : "$1"); return __res; diff --git a/include/asm-ppc/bitops.h b/include/asm-ppc/bitops.h index 3b8a24575..0a848013d 100644 --- a/include/asm-ppc/bitops.h +++ b/include/asm-ppc/bitops.h @@ -1,17 +1,26 @@ +/* + * $Id: bitops.h,v 1.7 1997/08/03 00:12:07 paulus Exp $ + * bitops.h: Bit string operations on the ppc + */ + #ifndef _ASM_PPC_BITOPS_H_ #define _ASM_PPC_BITOPS_H_ #include <asm/system.h> #include <asm/byteorder.h> -#include <linux/kernel.h> /* for printk */ - -#define BIT(n) 1<<(n&0x1F) -typedef unsigned long BITFIELD; +extern void set_bit(int nr, volatile void *addr); +extern void clear_bit(int nr, volatile void *addr); +extern void change_bit(int nr, volatile void *addr); +extern int test_and_set_bit(int nr, volatile void *addr); +extern int test_and_clear_bit(int nr, volatile void *addr); +extern int test_and_change_bit(int nr, volatile void *addr); /* - * These are ifdef'd out here because using : "cc" as a constraing + * These are if'd out here because using : "cc" as a constraint * results in errors from gcc. -- Cort + * Besides, they need to be changed so we have both set_bit + * and test_and_set_bit, etc. */ #if 0 extern __inline__ int set_bit(int nr, void * addr) @@ -20,9 +29,6 @@ extern __inline__ int set_bit(int nr, void * addr) unsigned long mask = 1 << (nr & 0x1f); unsigned long *p = ((unsigned long *)addr) + (nr >> 5); - if ((unsigned long)addr & 3) - printk("set_bit(%lx, %p)\n", nr, addr); - __asm__ __volatile__( "1:lwarx %0,0,%3 \n\t" "or %1,%0,%2 \n\t" @@ -32,7 +38,7 @@ extern __inline__ int set_bit(int nr, void * addr) : "r" (mask), "r" (p) /*: "cc" */); -n return (old & mask) != 0; + return (old & mask) != 0; } extern __inline__ unsigned long clear_bit(unsigned long nr, void *addr) @@ -41,8 +47,6 @@ extern __inline__ unsigned long clear_bit(unsigned long nr, void *addr) unsigned long mask = 1 << (nr & 0x1f); unsigned long *p = ((unsigned long *)addr) + (nr >> 5); - if ((unsigned long)addr & 3) - printk("clear_bit(%lx, %p)\n", nr, addr); __asm__ __volatile__("\n\ 1: lwarx %0,0,%3 andc %1,%0,%2 @@ -61,8 +65,6 @@ extern __inline__ unsigned long change_bit(unsigned long nr, void *addr) unsigned long mask = 1 << (nr & 0x1f); unsigned long *p = ((unsigned long *)addr) + (nr >> 5); - if ((unsigned long)addr & 3) - printk("change_bit(%lx, %p)\n", nr, addr); __asm__ __volatile__("\n\ 1: lwarx %0,0,%3 xor %1,%0,%2 @@ -76,10 +78,19 @@ extern __inline__ unsigned long change_bit(unsigned long nr, void *addr) } #endif +extern __inline__ unsigned long test_bit(int nr, __const__ volatile void *addr) +{ + __const__ unsigned int *p = (__const__ unsigned int *) addr; + + return (p[nr >> 5] >> (nr & 0x1f)) & 1UL; +} + extern __inline__ int ffz(unsigned int x) { int n; + if (x == ~0) + return 32; x = ~x & (x+1); /* set LS zero to 1, other bits to 0 */ __asm__ ("cntlzw %0,%1" : "=r" (n) : "r" (x)); return 31 - n; @@ -89,34 +100,11 @@ extern __inline__ int ffz(unsigned int x) * This implementation of find_{first,next}_zero_bit was stolen from * Linus' asm-alpha/bitops.h. */ +#define find_first_zero_bit(addr, size) \ + find_next_zero_bit((addr), (size), 0) -extern __inline__ unsigned long find_first_zero_bit(void * addr, unsigned long size) -{ - unsigned int * p = ((unsigned int *) addr); - unsigned int result = 0; - unsigned int tmp; - - if (size == 0) - return 0; - while (size & ~31UL) { - if (~(tmp = *(p++))) - goto found_middle; - result += 32; - size -= 32; - } - if (!size) - return result; - tmp = *p; - tmp |= ~0UL << size; -found_middle: - return result + ffz(tmp); -} - -/* - * Find next zero bit in a bitmap reasonably efficiently.. - */ -extern __inline__ unsigned long find_next_zero_bit(void * addr, unsigned long size, - unsigned long offset) +extern __inline__ unsigned long find_next_zero_bit(void * addr, + unsigned long size, unsigned long offset) { unsigned int * p = ((unsigned int *) addr) + (offset >> 5); unsigned int result = offset & ~31UL; @@ -127,17 +115,17 @@ extern __inline__ unsigned long find_next_zero_bit(void * addr, unsigned long si size -= result; offset &= 31UL; if (offset) { - tmp = *(p++); + tmp = *p++; tmp |= ~0UL >> (32-offset); if (size < 32) goto found_first; - if (~tmp) + if (tmp != ~0U) goto found_middle; size -= 32; result += 32; } - while (size & ~31UL) { - if (~(tmp = *(p++))) + while (size >= 32) { + if ((tmp = *p++) != ~0U) goto found_middle; result += 32; size -= 32; @@ -153,101 +141,98 @@ found_middle: #define _EXT2_HAVE_ASM_BITOPS_ -#define ext2_find_first_zero_bit(addr, size) \ - ext2_find_next_zero_bit((addr), (size), 0) +#ifdef __KERNEL__ +/* + * test_and_{set,clear}_bit guarantee atomicity without + * disabling interrupts. + */ +#define ext2_set_bit(nr, addr) test_and_set_bit((nr) ^ 0x18, addr) +#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 0x18, addr) +#else extern __inline__ int ext2_set_bit(int nr, void * addr) { -#ifdef __KERNEL__ - int s = _disable_interrupts(); -#endif - int mask; - unsigned char *ADDR = (unsigned char *) addr; - int oldbit; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - oldbit = (*ADDR & mask) ? 1 : 0; - *ADDR |= mask; -#ifdef __KERNEL__ - _enable_interrupts(s); -#endif - return oldbit; + int mask; + unsigned char *ADDR = (unsigned char *) addr; + int oldbit; + + ADDR += nr >> 3; + mask = 1 << (nr & 0x07); + oldbit = (*ADDR & mask) ? 1 : 0; + *ADDR |= mask; + return oldbit; } extern __inline__ int ext2_clear_bit(int nr, void * addr) { -#ifdef __KERNEL__ - int s = _disable_interrupts(); -#endif - int mask; - unsigned char *ADDR = (unsigned char *) addr; - int oldbit; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - oldbit = (*ADDR & mask) ? 1 : 0; - *ADDR = *ADDR & ~mask; -#ifdef __KERNEL__ - _enable_interrupts(s); -#endif - return oldbit; -} + int mask; + unsigned char *ADDR = (unsigned char *) addr; + int oldbit; - -/* The following routine need not be atomic. */ -extern __inline__ unsigned long test_bit(int nr, void *addr) -{ - return 1UL & (((__const__ unsigned int *) addr)[nr >> 5] >> (nr & 31)); + ADDR += nr >> 3; + mask = 1 << (nr & 0x07); + oldbit = (*ADDR & mask) ? 1 : 0; + *ADDR = *ADDR & ~mask; + return oldbit; } +#endif /* __KERNEL__ */ extern __inline__ int ext2_test_bit(int nr, __const__ void * addr) { - int mask; __const__ unsigned char *ADDR = (__const__ unsigned char *) addr; - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - return ((mask & *ADDR) != 0); + return (ADDR[nr >> 3] >> (nr & 7)) & 1; } -extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) +/* + * This implementation of ext2_find_{first,next}_zero_bit was stolen from + * Linus' asm-alpha/bitops.h and modified for a big-endian machine. + */ + +#define ext2_find_first_zero_bit(addr, size) \ + ext2_find_next_zero_bit((addr), (size), 0) + +extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr, + unsigned long size, unsigned long offset) { - unsigned long *p = ((unsigned long *) addr) + (offset >> 5); - unsigned long result = offset & ~31UL; - unsigned long tmp; + unsigned int *p = ((unsigned int *) addr) + (offset >> 5); + unsigned int result = offset & ~31UL; + unsigned int tmp; if (offset >= size) return size; size -= result; offset &= 31UL; - if(offset) { - tmp = *(p++); - tmp |= le32_to_cpu(~0UL >> (32-offset)); - if(size < 32) + if (offset) { + tmp = cpu_to_le32p(p++); + tmp |= ~0UL >> (32-offset); + if (size < 32) goto found_first; - if(~tmp) + if (tmp != ~0U) goto found_middle; size -= 32; result += 32; } - while(size & ~31UL) { - if(~(tmp = *(p++))) + while (size >= 32) { + if ((tmp = cpu_to_le32p(p++)) != ~0U) goto found_middle; result += 32; size -= 32; } - if(!size) + if (!size) return result; - tmp = *p; - + tmp = cpu_to_le32p(p); found_first: - return result + ffz(le32_to_cpu(tmp) | (~0UL << size)); + tmp |= ~0U << size; found_middle: - return result + ffz(le32_to_cpu(tmp)); + return result + ffz(tmp); } -#endif /* _ASM_PPC_BITOPS_H */ - +/* Bitmap functions for the minix filesystem. */ +#define minix_set_bit(nr,addr) ext2_set_bit(nr,addr) +#define minix_clear_bit(nr,addr) ext2_clear_bit(nr,addr) +#define minix_test_bit(nr,addr) ext2_test_bit(nr,addr) +#define minix_find_first_zero_bit(addr,size) ext2_find_first_zero_bit(addr,size) +#endif /* _ASM_PPC_BITOPS_H */ diff --git a/include/asm-ppc/byteorder.h b/include/asm-ppc/byteorder.h index eab03c752..8fee6e46f 100644 --- a/include/asm-ppc/byteorder.h +++ b/include/asm-ppc/byteorder.h @@ -4,17 +4,17 @@ #include <asm/types.h> #ifndef __BIG_ENDIAN -#define __BIG_ENDIAN +#define __BIG_ENDIAN 4321 #endif #ifndef __BIG_ENDIAN_BITFIELD #define __BIG_ENDIAN_BITFIELD #endif -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) +#define ntohl(x) ((unsigned long)(x)) +#define ntohs(x) ((unsigned short)(x)) +#define htonl(x) ((unsigned long)(x)) +#define htons(x) ((unsigned short)(x)) #define __htonl(x) ntohl(x) #define __htons(x) ntohs(x) @@ -54,7 +54,7 @@ extern inline void st_le32(volatile unsigned *addr, unsigned val) asm volatile("stwbrx %0,0,%1" : : "r" (val), "r" (addr) : "memory"); } - +#if 0 extern __inline__ __u16 cpu_to_le16(__u16 value) { return ld_le16(&value); @@ -63,6 +63,29 @@ extern __inline__ __u32 cpu_to_le32(__u32 value) { return ld_le32(&value); } +#else +extern __inline__ __u16 cpu_to_le16(__u16 value) +{ + __u16 result; + + asm("rlwimi %0,%1,8,16,23" + : "=r" (result) + : "r" (value), "0" (value >> 8)); + return result; +} +extern __inline__ __u32 cpu_to_le32(__u32 value) +{ + __u32 result; + + asm("rlwimi %0,%1,24,16,23\n\t" + "rlwimi %0,%1,8,8,15\n\t" + "rlwimi %0,%1,24,0,7" + : "=r" (result) + : "r" (value), "0" (value >> 24)); + return result; +} +#endif /* 0 */ + #define cpu_to_be16(x) (x) #define cpu_to_be32(x) (x) diff --git a/include/asm-ppc/checksum.h b/include/asm-ppc/checksum.h index 7b55f0032..1395cb0aa 100644 --- a/include/asm-ppc/checksum.h +++ b/include/asm-ppc/checksum.h @@ -3,22 +3,6 @@ /* - * This is a version of ip_compute_csum() optimized for IP headers, - * which always checksum on 4 octet boundaries. - */ -extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); - -/* - * computes the checksum of the TCP/UDP pseudo-header - * returns a 16-bit checksum, already complemented - */ -extern unsigned short int csum_tcpudp_magic(unsigned long saddr, - unsigned long daddr, - unsigned short len, - unsigned short proto, - unsigned int sum); - -/* * computes the checksum of a memory block at buff, length len, * and adds in "sum" (32-bit) * @@ -30,43 +14,76 @@ extern unsigned short int csum_tcpudp_magic(unsigned long saddr, * * it's best to have buff aligned on a 32-bit boundary */ -extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); +extern 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 + * Computes the checksum of a memory block at src, length len, + * and adds in "sum" (32-bit), while copying the block to dst. + * If an access exception occurs on src or dst, it stores -EFAULT + * to *src_err or *dst_err respectively (if that pointer is not + * NULL), and, for an error on src, zeroes the rest of dst. * - * here even more important to align src and dst on a 32-bit (or even - * better 64-bit) boundary + * Like csum_partial, this must be called with even lengths, + * except for the last fragment. */ -unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum); +extern unsigned int csum_partial_copy_generic(const char *src, char *dst, + int len, unsigned int sum, + int *src_err, int *dst_err); + +#define csum_partial_copy_from_user(src, dst, len, sum, errp) \ + csum_partial_copy_generic((src), (dst), (len), (sum), (errp), 0) /* - * 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) + * Old versions which ignore errors. */ -#define csum_partial_copy_fromuser csum_partial_copy +#define csum_partial_copy(src, dst, len, sum) \ + csum_partial_copy_generic((src), (dst), (len), (sum), 0, 0) +#define csum_partial_copy_fromuser(src, dst, len, sum) \ + csum_partial_copy_generic((src), (dst), (len), (sum), 0, 0) + /* - * this is a new version of the above that records errors it finds in *errp, - * but continues and zeros the rest of the buffer. - * - * right now - it just calls csum_partial_copy() - * -- Cort + * turns a 32-bit partial checksum (e.g. from csum_partial) into a + * 1's complement 16-bit checksum. */ -extern __inline__ -unsigned int csum_partial_copy_from_user ( const char *src, char *dst, - int len, int sum, int *err_ptr) +static inline unsigned int csum_fold(unsigned int sum) { - int *dst_err_ptr=NULL; - return csum_partial_copy( src, dst, len, sum); + unsigned int tmp; + + /* swap the two 16-bit halves of sum */ + __asm__("rlwinm %0,%1,16,0,31" : "=r" (tmp) : "r" (sum)); + /* if there is a carry from adding the two 16-bit halves, + it will carry from the lower half into the upper half, + giving us the correct sum in the upper half. */ + sum = ~(sum + tmp) >> 16; + return sum; } /* * this routine is used for miscellaneous IP-like checksums, mainly * in icmp.c -A */ + */ +static inline unsigned short ip_compute_csum(unsigned char * buff, int len) +{ + return csum_fold(csum_partial(buff, len, 0)); +} + +/* + * This is a version of ip_compute_csum() optimized for IP headers, + * which always checksum on 4 octet boundaries. ihl is the number + * of 32-bit words and is always >= 5. + */ +extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); + +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 16-bit checksum, already complemented + */ +extern unsigned short csum_tcpudp_magic(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum); -extern unsigned short ip_compute_csum(unsigned char * buff, int len); -extern unsigned int csum_fold(unsigned int sum); #endif diff --git a/include/asm-ppc/cuda.h b/include/asm-ppc/cuda.h new file mode 100644 index 000000000..3f1a47cf2 --- /dev/null +++ b/include/asm-ppc/cuda.h @@ -0,0 +1,74 @@ +/* + * Definitions for talking to the CUDA. The CUDA is a microcontroller + * which controls the ADB, system power, RTC, and various other things. + * + * Copyright (C) 1996 Paul Mackerras. + */ + +/* First byte sent to or received from CUDA */ +#define ADB_PACKET 0 +#define CUDA_PACKET 1 +#define ERROR_PACKET 2 +#define TIMER_PACKET 3 +#define POWER_PACKET 4 +#define MACIIC_PACKET 5 + +/* ADB commands (2nd byte) */ +#define ADB_BUSRESET 0 +#define ADB_FLUSH(id) (1 + ((id) << 4)) +#define ADB_WRITEREG(id, reg) (8 + (reg) + ((id) << 4)) +#define ADB_READREG(id, reg) (0xc + (reg) + ((id) << 4)) + +/* ADB default device IDs (upper 4 bits of 2nd byte) */ +#define ADB_DONGLE 1 /* "software execution control" devices */ +#define ADB_KEYBOARD 2 +#define ADB_MOUSE 3 +#define ADB_TABLET 4 +#define ADB_MODEM 5 +#define ADB_MISC 7 /* maybe a monitor */ + +/* CUDA commands (2nd byte) */ +#define CUDA_WARM_START 0 +#define CUDA_AUTOPOLL 1 +#define CUDA_GET_6805_ADDR 2 +#define CUDA_GET_TIME 3 +#define CUDA_GET_PRAM 7 +#define CUDA_SET_6805_ADDR 8 +#define CUDA_SET_TIME 9 +#define CUDA_POWERDOWN 0xa +#define CUDA_POWERUP_TIME 0xb +#define CUDA_SET_PRAM 0xc +#define CUDA_MS_RESET 0xd +#define CUDA_SEND_DFAC 0xe +#define CUDA_RESET_SYSTEM 0x11 +#define CUDA_SET_IPL 0x12 +#define CUDA_SET_AUTO_RATE 0x14 +#define CUDA_GET_AUTO_RATE 0x16 +#define CUDA_SET_DEVICE_LIST 0x19 +#define CUDA_GET_DEVICE_LIST 0x1a +#define CUDA_GET_SET_IIC 0x22 + +#ifdef __KERNEL__ + +struct cuda_request { + unsigned char data[16]; + int nbytes; + unsigned char reply[16]; + int reply_len; + unsigned char reply_expected; + unsigned char sent; + unsigned char got_reply; + void (*done)(struct cuda_request *); + void *arg; + struct cuda_request *next; +}; + +void via_cuda_init(void); +int cuda_request(struct cuda_request *req, + void (*done)(struct cuda_request *), int nbytes, ...); +int cuda_send_request(struct cuda_request *req); +void cuda_poll(void); +int adb_register(int default_id, + void (*handler)(unsigned char *, int, struct pt_regs *)); + +#endif /* __KERNEL */ diff --git a/include/asm-ppc/current.h b/include/asm-ppc/current.h index d7a0a9215..49415ce9f 100644 --- a/include/asm-ppc/current.h +++ b/include/asm-ppc/current.h @@ -1,10 +1,9 @@ #ifndef _PPC_CURRENT_H #define _PPC_CURRENT_H -#include <linux/config.h> - -extern struct task_struct *current_set[1]; - -register struct task_struct *current asm("r2"); +/* + * We keep `current' in r2 for speed. + */ +register struct task_struct *current asm ("r2"); #endif /* !(_PPC_CURRENT_H) */ diff --git a/include/asm-ppc/dbdma.h b/include/asm-ppc/dbdma.h new file mode 100644 index 000000000..38cd15803 --- /dev/null +++ b/include/asm-ppc/dbdma.h @@ -0,0 +1,92 @@ +/* + * Definitions for using the Apple Descriptor-Based DMA controller + * in Power Macintosh computers. + * + * Copyright (C) 1996 Paul Mackerras. + */ + +#ifndef _ASM_DBDMA_H_ +#define _ASM_DBDMA_H_ +/* + * DBDMA control/status registers. All little-endian. + */ +struct dbdma_regs { + unsigned int control; /* lets you change bits in status */ + unsigned int status; /* DMA and device status bits (see below) */ + unsigned int cmdptr_hi; /* upper 32 bits of command address */ + unsigned int cmdptr; /* (lower 32 bits of) command address (phys) */ + unsigned int intr_sel; /* select interrupt condition bit */ + unsigned int br_sel; /* select branch condition bit */ + unsigned int wait_sel; /* select wait condition bit */ + unsigned int xfer_mode; + unsigned int data2ptr_hi; + unsigned int data2ptr; + unsigned int res1; + unsigned int address_hi; + unsigned int br_addr_hi; + unsigned int res2[3]; +}; + +/* Bits in control and status registers */ +#define RUN 0x8000 +#define PAUSE 0x4000 +#define FLUSH 0x2000 +#define WAKE 0x1000 +#define DEAD 0x0800 +#define ACTIVE 0x0400 +#define BT 0x0100 +#define DEVSTAT 0x00ff + +/* + * DBDMA command structure. These fields are all little-endian! + */ +struct dbdma_cmd { + unsigned short req_count; /* requested byte transfer count */ + unsigned short command; /* command word (has bit-fields) */ + unsigned int phy_addr; /* physical data address */ + unsigned int cmd_dep; /* command-dependent field */ + unsigned short res_count; /* residual count after completion */ + unsigned short xfer_status; /* transfer status */ +}; + +/* DBDMA command values in command field */ +#define OUTPUT_MORE 0 /* transfer memory data to stream */ +#define OUTPUT_LAST 0x1000 /* ditto followed by end marker */ +#define INPUT_MORE 0x2000 /* transfer stream data to memory */ +#define INPUT_LAST 0x3000 /* ditto, expect end marker */ +#define STORE_WORD 0x4000 /* write word (4 bytes) to device reg */ +#define LOAD_WORD 0x5000 /* read word (4 bytes) from device reg */ +#define DBDMA_NOP 0x6000 /* do nothing */ +#define DBDMA_STOP 0x7000 /* suspend processing */ + +/* Key values in command field */ +#define KEY_STREAM0 0 /* usual data stream */ +#define KEY_STREAM1 0x100 /* control/status stream */ +#define KEY_STREAM2 0x200 /* device-dependent stream */ +#define KEY_STREAM3 0x300 /* device-dependent stream */ +#define KEY_REGS 0x500 /* device register space */ +#define KEY_SYSTEM 0x600 /* system memory-mapped space */ +#define KEY_DEVICE 0x700 /* device memory-mapped space */ + +/* Interrupt control values in command field */ +#define INTR_NEVER 0 /* don't interrupt */ +#define INTR_IFSET 0x10 /* intr if condition bit is 1 */ +#define INTR_IFCLR 0x20 /* intr if condition bit is 0 */ +#define INTR_ALWAYS 0x30 /* always interrupt */ + +/* Branch control values in command field */ +#define BR_NEVER 0 /* don't branch */ +#define BR_IFSET 0x4 /* branch if condition bit is 1 */ +#define BR_IFCLR 0x8 /* branch if condition bit is 0 */ +#define BR_ALWAYS 0xc /* always branch */ + +/* Wait control values in command field */ +#define WAIT_NEVER 0 /* don't wait */ +#define WAIT_IFSET 1 /* wait if condition bit is 1 */ +#define WAIT_IFCLR 2 /* wait if condition bit is 0 */ +#define WAIT_ALWAYS 3 /* always wait */ + +/* Align an address for a DBDMA command structure */ +#define DBDMA_ALIGN(x) (((unsigned)(x) + sizeof(struct dbdma_cmd) - 1) \ + & -sizeof(struct dbdma_cmd)) +#endif /* _ASM_DBDMA_H_ */ diff --git a/include/asm-ppc/dma.h b/include/asm-ppc/dma.h index 7becf0190..f27c4c988 100644 --- a/include/asm-ppc/dma.h +++ b/include/asm-ppc/dma.h @@ -23,7 +23,15 @@ #ifndef _ASM_DMA_H #define _ASM_DMA_H -#ifdef CONFIG_PREP +#ifndef MAX_DMA_CHANNELS +#define MAX_DMA_CHANNELS 8 +#endif + +/* The maximum address that we can perform a DMA transfer to on this platform */ +/* Doesn't really apply... */ +#define MAX_DMA_ADDRESS 0xFFFFFFFF + +#if defined(CONFIG_PREP) || defined(CONFIG_CHRP) #include <asm/io.h> /* need byte IO */ @@ -51,7 +59,8 @@ * - 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. + * On PReP, DMA transfers are limited to the lower 16MB of _physical_ memory. + * On CHRP, the W83C553F (and VLSI Tollgate?) support full 32 bit addressing. * Note that addresses loaded into registers must be _physical_ addresses, * not logical addresses (which may differ if paging is active). * @@ -83,11 +92,8 @@ * */ -#define MAX_DMA_CHANNELS 8 - -/* The maximum address that we can perform a DMA transfer to on this platform */ -/* Doesn't really apply... */ -#define MAX_DMA_ADDRESS 0xFFFFFFFF +#define POWERSTACK_SND_DMA 6 +#define POWERSTACK_SND_DMA2 7 /* 8237 DMA controllers */ #define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ @@ -150,6 +156,9 @@ #define DMA_HI_PAGE_6 0x489 #define DMA_HI_PAGE_7 0x48A +#define DMA1_EXT_REG 0x40B +#define DMA2_EXT_REG 0x4D6 + #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 */ @@ -214,9 +223,11 @@ static __inline__ void set_dma_page(unsigned int dmanr, int pagenr) switch(dmanr) { case 0: dma_outb(pagenr, DMA_LO_PAGE_0); + dma_outb(pagenr>>8, DMA_HI_PAGE_0); break; case 1: dma_outb(pagenr, DMA_LO_PAGE_1); + dma_outb(pagenr>>8, DMA_HI_PAGE_1); break; case 2: dma_outb(pagenr, DMA_LO_PAGE_2); @@ -225,15 +236,24 @@ static __inline__ void set_dma_page(unsigned int dmanr, int pagenr) case 3: dma_outb(pagenr, DMA_LO_PAGE_3); break; - case 5: + case 5: dma_outb(pagenr & 0xfe, DMA_LO_PAGE_5); + dma_outb(pagenr>>8, DMA_HI_PAGE_5); break; case 6: - dma_outb(pagenr & 0xfe, DMA_LO_PAGE_6); + if (POWERSTACK_SND_DMA == 6 || POWERSTACK_SND_DMA2 == 6) + dma_outb(pagenr, DMA_LO_PAGE_6); + else + dma_outb(pagenr & 0xfe, DMA_LO_PAGE_6); + dma_outb(pagenr>>8, DMA_HI_PAGE_6); break; case 7: - dma_outb(pagenr & 0xfe, DMA_LO_PAGE_7); - break; + if (POWERSTACK_SND_DMA == 7 || POWERSTACK_SND_DMA2 == 7) + dma_outb(pagenr, DMA_LO_PAGE_7); + else + dma_outb(pagenr & 0xfe, DMA_LO_PAGE_7); + dma_outb(pagenr>>8, DMA_HI_PAGE_7); + break; } } @@ -247,8 +267,14 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int phys) dma_outb( phys & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); dma_outb( (phys>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); } else { + if (dmanr == POWERSTACK_SND_DMA || dmanr == POWERSTACK_SND_DMA2) { + dma_outb( phys & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); + dma_outb( (phys>>8) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); + dma_outb( (dmanr&3), DMA2_EXT_REG); + } else { dma_outb( (phys>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); dma_outb( (phys>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); + } } set_dma_page(dmanr, phys>>16); } @@ -269,8 +295,13 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); } else { + if (dmanr == POWERSTACK_SND_DMA || dmanr == POWERSTACK_SND_DMA2) { + dma_outb( count & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); + dma_outb( (count>>8) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_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 ); + } } } @@ -297,10 +328,16 @@ static __inline__ int get_dma_residue(unsigned int dmanr) return (dmanr<=3)? count : (count<<1); } +#endif /* CONFIG_PREP || CONFIG_CHRP */ + +#ifdef CONFIG_PMAC + +#define DMA_MODE_READ 1 +#define DMA_MODE_WRITE 2 + +#endif /* CONFIG_PMAC */ /* These are in kernel/dma.c: */ extern void free_dma(unsigned int dmanr); /* release it again */ -#endif /* CONFIG_PREP */ - #endif /* _ASM_DMA_H */ diff --git a/include/asm-ppc/elf.h b/include/asm-ppc/elf.h index d0e758efd..a63612ffa 100644 --- a/include/asm-ppc/elf.h +++ b/include/asm-ppc/elf.h @@ -6,8 +6,8 @@ */ #include <asm/ptrace.h> -#define ELF_NGREG 32 -#define ELF_NFPREG 32 +#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ +#define ELF_NFPREG 33 /* includes fpscr */ /* * This is used to ensure we don't load something for the wrong architecture. @@ -24,10 +24,22 @@ #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical + use of this is to invoke "./ld.so someprog" to test out a new version of + the loader. We need to make sure that it is out of the way of the program + that it will "exec", and that there is sufficient room for the brk. */ + +#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) + 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]; +#define ELF_CORE_COPY_REGS(gregs, regs) \ + memcpy(gregs, regs, \ + sizeof(struct pt_regs) < sizeof(elf_gregset_t)? \ + sizeof(struct pt_regs): sizeof(elf_gregset_t)); + #endif diff --git a/include/asm-ppc/floppy.h b/include/asm-ppc/floppy.h index 342379294..580350eb0 100644 --- a/include/asm-ppc/floppy.h +++ b/include/asm-ppc/floppy.h @@ -13,21 +13,24 @@ #define fd_inb(port) inb_p(port) #define fd_outb(port,value) outb_p(port,value) -#define fd_enable_dma() enable_dma(FLOPPY_DMA) -#define fd_disable_dma() disable_dma(FLOPPY_DMA) -#define fd_request_dma() request_dma(FLOPPY_DMA,"floppy") -#define fd_free_dma() free_dma(FLOPPY_DMA) -#define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA) -#define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA,mode) -#define fd_set_dma_addr(addr) set_dma_addr(FLOPPY_DMA,(unsigned int)virt_to_bus(addr)) -#define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count) -#define fd_enable_irq() enable_irq(FLOPPY_IRQ) -#define fd_disable_irq() disable_irq(FLOPPY_IRQ) -#define fd_cacheflush(addr,size) /* nothing */ -#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 fd_enable_dma(channel) enable_dma(channel) +#define fd_disable_dma(channel) disable_dma(channel) +#define fd_request_dma(channel) request_dma(channel,"floppy") +#define fd_free_dma(channel) free_dma(channel) +#define fd_clear_dma_ff(channel) clear_dma_ff(channel) +#define fd_set_dma_mode(channel,mode) set_dma_mode(channel,mode) +#define fd_set_dma_addr(channel,addr) set_dma_addr(channel, \ + (unsigned int)virt_to_bus(addr)) +#define fd_set_dma_count(channel,count) set_dma_count(channel, count) + +#define fd_enable_irq(irq) enable_irq(irq) +#define fd_disable_irq(irq) disable_irq(irq) +#define fd_cacheflush(addr,size) /* nothing */ +#define fd_request_irq() request_irq(irq, floppy_interrupt, \ + SA_INTERRUPT \ + | SA_SAMPLE_RANDOM, \ + "floppy", NULL) +#define fd_free_irq(irq) free_irq(irq, NULL); __inline__ void virtual_dma_init(void) { @@ -46,6 +49,8 @@ static int FDC2 = -1; #define N_FDC 2 /* Don't change this! */ #define N_DRIVE 8 +#define FLOPPY_MOTOR_MASK 0xf0 + /* * The PowerPC has no problems with floppy DMA crossing 64k borders. */ diff --git a/include/asm-ppc/hardirq.h b/include/asm-ppc/hardirq.h new file mode 100644 index 000000000..a21a9e0d4 --- /dev/null +++ b/include/asm-ppc/hardirq.h @@ -0,0 +1,58 @@ +#ifndef __ASM_HARDIRQ_H +#define __ASM_HARDIRQ_H + +extern unsigned int local_irq_count[NR_CPUS]; +#define in_interrupt() (local_irq_count[smp_processor_id()] != 0) + +#ifndef __SMP__ + +#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) +#define hardirq_endlock(cpu) do { } while (0) + +#define hardirq_enter(cpu) (local_irq_count[cpu]++) +#define hardirq_exit(cpu) (local_irq_count[cpu]--) + +#define synchronize_irq() do { } while (0) + +#else /* __SMP__ */ + +extern unsigned char global_irq_holder; +extern spinlock_t global_irq_lock; +extern atomic_t global_irq_count; + +#define release_irqlock(cpu) \ +do { if(global_irq_holder == (unsigned char) cpu) { \ + global_irq_holder = NO_PROC_ID; \ + spin_unlock(&global_irq_lock); \ + } \ +} while(0) + +/* Ordering of the counter bumps is _deadly_ important. */ +#define hardirq_enter(cpu) \ + do { ++local_irq_count[cpu]; atomic_inc(&global_irq_count); } while(0) + +#define hardirq_exit(cpu) \ + do { atomic_dec(&global_irq_count); --local_irq_count[cpu]; } while(0) + +#define hardirq_trylock(cpu) \ +({ unsigned long flags; int ret = 1; \ + __save_flags(flags); \ + __cli(); \ + if(atomic_add_return(1, &global_irq_count) != 1 || \ + *(((unsigned char *)(&global_irq_lock)))) { \ + atomic_dec(&global_irq_count); \ + __restore_flags(flags); \ + ret = 0; \ + } else { \ + ++local_irq_count[cpu]; \ + __sti(); \ + } \ + ret; \ +}) + +#define hardirq_endlock(cpu) do { __cli(); hardirq_exit(cpu); __sti(); } while(0) + +extern void synchronize_irq(void); +#endif /* __SMP__ */ + +#endif /* __ASM_HARDIRQ_H */ diff --git a/include/asm-ppc/hydra.h b/include/asm-ppc/hydra.h new file mode 100644 index 000000000..bb291c8b1 --- /dev/null +++ b/include/asm-ppc/hydra.h @@ -0,0 +1,105 @@ +/* + * linux/hydra.h -- Mac I/O `Hydra' definitions + * + * Copyright (C) 1997 Geert Uytterhoeven + * + * 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. + * + * This file is based on the following documentation: + * + * Macintosh Technology in the Common Hardware Reference Platform + * Apple Computer, Inc. + * + * © Copyright 1995 Apple Computer, Inc. All rights reserved. + * + * It's available online from http://chrp.apple.com/MacTech.pdf. + * You can obtain paper copies of this book from computer bookstores or by + * writing Morgan Kaufmann Publishers, Inc., 340 Pine Street, Sixth Floor, San + * Francisco, CA 94104. Reference ISBN 1-55860-393-X. + * + * 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. + */ + +#ifndef _ASMPPC_HYDRA_H +#define _ASMPPC_HYDRA_H + +#ifdef __KERNEL__ + +struct Hydra { + /* DBDMA Controller Register Space */ + char Pad1[0x30]; + u_int CachePD; + u_int IDs; + u_int Feature_Control; + char Pad2[0x7fc4]; + /* DBDMA Channel Register Space */ + char SCSI_DMA[0x100]; + char Pad3[0x300]; + char SCCA_Tx_DMA[0x100]; + char SCCA_Rx_DMA[0x100]; + char SCCB_Tx_DMA[0x100]; + char SCCB_Rx_DMA[0x100]; + char Pad4[0x7800]; + /* Device Register Space */ + char SCSI[0x1000]; + char ADB[0x1000]; + char SCC_Legacy[0x1000]; + char SCC[0x1000]; + char Pad9[0x2000]; + char VIA[0x2000]; + char Pad10[0x28000]; + char OpenPIC[0x40000]; +}; + +extern volatile struct Hydra *Hydra; + + + /* + * Feature Control Register + */ + +#define HYDRA_FC_SCC_CELL_EN 0x00000001 /* Enable SCC Clock */ +#define HYDRA_FC_SCSI_CELL_EN 0x00000002 /* Enable SCSI Clock */ +#define HYDRA_FC_SCCA_ENABLE 0x00000004 /* Enable SCC A Lines */ +#define HYDRA_FC_SCCB_ENABLE 0x00000008 /* Enable SCC B Lines */ +#define HYDRA_FC_ARB_BYPASS 0x00000010 /* Bypass Internal Arbiter */ +#define HYDRA_FC_RESET_SCC 0x00000020 /* Reset SCC */ +#define HYDRA_FC_MPIC_ENABLE 0x00000040 /* Enable OpenPIC */ +#define HYDRA_FC_SLOW_SCC_PCLK 0x00000080 /* 1=15.6672, 0=25 MHz */ +#define HYDRA_FC_MPIC_IS_MASTER 0x00000100 /* OpenPIC Master Mode */ + + + /* + * OpenPIC Interrupt Sources + */ + +#define HYDRA_INT_SIO 0 +#define HYDRA_INT_SCSI_DMA 1 +#define HYDRA_INT_SCCA_TX_DMA 2 +#define HYDRA_INT_SCCA_RX_DMA 3 +#define HYDRA_INT_SCCB_TX_DMA 4 +#define HYDRA_INT_SCCB_RX_DMA 5 +#define HYDRA_INT_SCSI 6 +#define HYDRA_INT_SCCA 7 +#define HYDRA_INT_SCCB 8 +#define HYDRA_INT_VIA 9 +#define HYDRA_INT_ADB 10 +#define HYDRA_INT_ADB_NMI 11 +#define HYDRA_INT_EXT1 12 +#define HYDRA_INT_EXT2 13 +#define HYDRA_INT_EXT3 14 +#define HYDRA_INT_EXT4 15 +#define HYDRA_INT_EXT5 16 +#define HYDRA_INT_EXT6 17 +#define HYDRA_INT_EXT7 18 +#define HYDRA_INT_SPARE 19 + +#endif /* __KERNEL__ */ +volatile struct Hydra *find_hydra(void); +void hydra_post_openpic_init(void); + +#endif /* _ASMPPC_HYDRA_H */ diff --git a/include/asm-ppc/ide.h b/include/asm-ppc/ide.h index bc16288a8..4cce72d28 100644 --- a/include/asm-ppc/ide.h +++ b/include/asm-ppc/ide.h @@ -21,10 +21,12 @@ #define ide_sti() sti() -#ifdef CONFIG_PREP - typedef unsigned short ide_ioreg_t; +void ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); +void prep_ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); +void pmac_ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); +#if defined(CONFIG_PREP) || defined(CONFIG_CHRP) static __inline__ int ide_default_irq(ide_ioreg_t base) { switch (base) { @@ -49,18 +51,6 @@ static __inline__ ide_ioreg_t ide_default_io_base(int index) } } -static __inline__ void ide_init_hwif_ports (ide_ioreg_t *p, ide_ioreg_t base, int *irq) -{ - ide_ioreg_t port = base; - int i = 8; - - while (i--) - *p++ = port++; - *p++ = base + 0x206; - if (irq != NULL) - *irq = 0; -} - typedef union { unsigned all : 8; /* all of the bits together */ struct { @@ -89,7 +79,8 @@ static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent #define ide_fix_driveid(id) do {} while (0) -#endif +#endif /* CONFIG_CHRP || CONFIG_PREP */ + #ifdef CONFIG_PMAC @@ -107,7 +98,6 @@ extern __inline__ ide_ioreg_t ide_default_io_base(int index) return index; } -extern void ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); typedef union { unsigned all : 8; /* all of the bits together */ diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index e2dfcc49a..bc0d16497 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h @@ -5,7 +5,6 @@ #include <asm/page.h> #include <asm/byteorder.h> -#ifdef CONFIG_PREP /* from the Carolina Technical Spec -- Cort */ #define IBM_ACORN 0x82A #define SIO_CONFIG_RA 0x398 @@ -17,68 +16,50 @@ #define IBM_L2_INVALIDATE 0x814 #define IBM_SYS_CTL 0x81c +extern unsigned long io_base; #define SLOW_DOWN_IO +#define _IO_BASE io_base -#ifndef PCI_DRAM_OFFSET -#define PCI_DRAM_OFFSET 0x80000000 -#endif +extern unsigned long pci_dram_offset; +#undef PCI_DRAM_OFFSET +#define PCI_DRAM_OFFSET pci_dram_offset #define readb(addr) (*(volatile unsigned char *) (addr)) -#define readw(addr) (*(volatile unsigned short *) (addr)) -#define readl(addr) (*(volatile unsigned int *) (addr)) +#define readw(addr) ld_le16((volatile unsigned short *)(addr)) +#define readl(addr) ld_le32((volatile unsigned *)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)) - -void outsl(int port, long *ptr, int len); - -__inline__ unsigned char outb(unsigned char val, int port); -__inline__ unsigned short outw(unsigned short val, int port); -__inline__ unsigned long outl(unsigned long val, int port); -__inline__ unsigned char inb(int port); -__inline__ unsigned short inw(int port); -__inline__ unsigned long inl(int port); - -#define inb_p inb -#define inw_p inw -#define inl_p inl -#define outb_p outb -#define outw_p outw -#define outl_p outl - -#endif /* CONFIG_PREP */ - -#ifdef CONFIG_PMAC -/* - * Read and write the non-volatile RAM. - */ -extern int nvram_readb(int addr); -extern void nvram_writeb(int addr, int val); - -#ifndef PCI_DRAM_OFFSET -#define PCI_DRAM_OFFSET 0 -#endif - -#define inb(port) in_8((unsigned char *)(port)) -#define outb(val, port) out_8((unsigned char *)(port), (val)) -#define inw(port) in_le16((unsigned short *)(port)) -#define outw(val, port) out_le16((unsigned short *)(port), (val)) -#define inl(port) in_le32((unsigned long *)(port)) -#define outl(val, port) out_le32((unsigned long *)(port), (val)) - -#define inb_p(port) in_8((unsigned char *)(port)) -#define outb_p(val, port) out_8((unsigned char *)(port), (val)) -#define inw_p(port) in_le16((unsigned short *)(port)) -#define outw_p(val, port) out_le16((unsigned short *)(port), (val)) -#define inl_p(port) in_le32(((unsigned long *)port)) -#define outl_p(val, port) out_le32((unsigned long *)(port), (val)) - -#define insw(port, buf, ns) _insw((unsigned short *)(port), (buf), (ns)) -#define outsw(port, buf, ns) _outsw((unsigned short *)(port), (buf), (ns)) -#define insl(port, buf, nl) _insl((unsigned long *)(port), (buf), (nl)) -#define outsl(port, buf, nl) _outsl((unsigned long *)(port), (buf), (nl)) -#endif /* CONFIG_PMAC */ - +#define writew(b,addr) st_le16((volatile unsigned short *)(addr),(b)) +#define writel(b,addr) st_le32((volatile unsigned *)(addr),(b)) + +#define insb(port, buf, ns) _insb((unsigned char *)((port)+_IO_BASE), (buf), (ns)) +#define outsb(port, buf, ns) _outsb((unsigned char *)((port)+_IO_BASE), (buf), (ns)) +#define insw(port, buf, ns) _insw((unsigned short *)((port)+_IO_BASE), (buf), (ns)) +#define outsw(port, buf, ns) _outsw((unsigned short *)((port)+_IO_BASE), (buf), (ns)) +#define insl(port, buf, nl) _insl((unsigned long *)((port)+_IO_BASE), (buf), (nl)) +#define outsl(port, buf, nl) _outsl((unsigned long *)((port)+_IO_BASE), (buf), (nl)) + +#define inb(port) in_8((unsigned char *)((port)+_IO_BASE)) +#define outb(val, port) out_8((unsigned char *)((port)+_IO_BASE), (val)) +#define inw(port) in_le16((unsigned short *)((port)+_IO_BASE)) +#define outw(val, port) out_le16((unsigned short *)((port)+_IO_BASE), (val)) +#define inl(port) in_le32((unsigned *)((port)+_IO_BASE)) +#define outl(val, port) out_le32((unsigned *)((port)+_IO_BASE), (val)) + +#define inb_p(port) in_8((unsigned char *)((port)+_IO_BASE)) +#define outb_p(val, port) out_8((unsigned char *)((port)+_IO_BASE), (val)) +#define inw_p(port) in_le16((unsigned short *)((port)+_IO_BASE)) +#define outw_p(val, port) out_le16((unsigned short *)((port)+_IO_BASE), (val)) +#define inl_p(port) in_le32(((unsigned *)(port)+_IO_BASE)) +#define outl_p(val, port) out_le32((unsigned *)((port)+_IO_BASE), (val)) + +extern void _insb(volatile unsigned char *port, void *buf, int ns); +extern void _outsb(volatile unsigned char *port, const void *buf, int ns); +extern void _insw(volatile unsigned short *port, void *buf, int ns); +extern void _outsw(volatile unsigned short *port, const void *buf, int ns); +extern void _insl(volatile unsigned long *port, void *buf, int nl); +extern void _outsl(volatile unsigned long *port, const void *buf, int nl); + +#ifdef __KERNEL__ /* * The PCI bus is inherently Little-Endian. The PowerPC is being * run Big-Endian. Thus all values which cross the [PCI] barrier @@ -88,14 +69,16 @@ extern void nvram_writeb(int addr, int val); */ extern inline unsigned long virt_to_bus(volatile void * address) { - if (address == (void *)0) return 0; - return ((unsigned long)((long)address - KERNELBASE + PCI_DRAM_OFFSET)); + if (address == (void *)0) + return 0; + return (unsigned long)address - KERNELBASE + PCI_DRAM_OFFSET; } extern inline void * bus_to_virt(unsigned long address) { - if (address == 0) return 0; - return ((void *)(address - PCI_DRAM_OFFSET + KERNELBASE)); + if (address == 0) + return 0; + return (void *)(address - PCI_DRAM_OFFSET + KERNELBASE); } /* @@ -103,31 +86,23 @@ extern inline void * bus_to_virt(unsigned long address) * I/O devices etc. */ extern void *ioremap(unsigned long address, unsigned long size); +extern void iounmap(unsigned long *addr); /* - * Change virtual addresses to physical addresses and vv. - * These are trivial on the 1:1 Linux/i386 mapping (but if we ever - * make the kernel segment mapped at 0, we need to do translation - * on the i386 as well) + * Change virtual addresses to physical addresses and vv, for + * addresses in the area where the kernel has the RAM mapped. */ extern inline unsigned long virt_to_phys(volatile void * address) { - return (unsigned long) address; + return (unsigned long) address - KERNELBASE; } extern inline void * phys_to_virt(unsigned long address) { - return (void *) address; + return (void *) (address + KERNELBASE); } -#define _IO_BASE ((unsigned long)0x80000000) - -/* - * These are much more useful le/be io functions from Paul - * than leXX_to_cpu() style functions since the ppc has - * load/store byte reverse instructions - * -- Cort - */ +#endif /* __KERNEL__ */ /* * Enforce In-order Execution of I/O: diff --git a/include/asm-ppc/ioctls.h b/include/asm-ppc/ioctls.h index 2039f4954..f56e53db7 100644 --- a/include/asm-ppc/ioctls.h +++ b/include/asm-ppc/ioctls.h @@ -83,8 +83,8 @@ #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ #define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ -#define TIOCSBRK 0x5427 /* BSD compatibility */ -#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 diff --git a/include/asm-ppc/ipc.h b/include/asm-ppc/ipc.h index f368d14c8..1872790e4 100644 --- a/include/asm-ppc/ipc.h +++ b/include/asm-ppc/ipc.h @@ -1,10 +1,10 @@ -#ifndef __i386_IPC_H__ -#define __i386_IPC_H__ +#ifndef __PPC_IPC_H__ +#define __PPC_IPC_H__ /* - * These are used to wrap system calls on x86. + * These are used to wrap system calls on PowerPC. * - * See arch/i386/kernel/sys_i386.c for ugly details.. + * See arch/ppc/kernel/syscalls.c for ugly details.. */ struct ipc_kludge { struct msgbuf *msgp; @@ -25,4 +25,4 @@ struct ipc_kludge { #define IPCCALL(version,op) ((version)<<16 | (op)) -#endif +#endif /* __PPC_IPC_H__ */ diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h index ebffe2bcb..28e788a65 100644 --- a/include/asm-ppc/irq.h +++ b/include/asm-ppc/irq.h @@ -3,11 +3,19 @@ #include <linux/config.h> -#ifdef CONFIG_PMAC -#define NR_IRQS 32 -#else -#define NR_IRQS 16 -#endif +/* + * this is the # irq's for all ppc arch's (pmac/chrp/prep) + * so it is the max of them all - which happens to be chrp + * -- Cort + */ +#define NR_IRQS (NUM_8259_INTERRUPTS+NUM_OPENPIC_INTERRUPTS) + +#define NUM_8259_INTERRUPTS 16 +#define NUM_OPENPIC_INTERRUPTS 20 +#define is_8259_irq(n) ((n) < NUM_8259_INTERRUPTS) +#define openpic_to_irq(n) ((n)+NUM_8259_INTERRUPTS) +#define irq_to_openpic(n) ((n)-NUM_8259_INTERRUPTS) +#define IRQ_8259_CASCADE NUM_8259_INTERRUPTS extern void disable_irq(unsigned int); extern void enable_irq(unsigned int); diff --git a/include/asm-ppc/keyboard.h b/include/asm-ppc/keyboard.h index 0c7240d14..d56dd6a27 100644 --- a/include/asm-ppc/keyboard.h +++ b/include/asm-ppc/keyboard.h @@ -2,9 +2,9 @@ * linux/include/asm-ppc/keyboard.h * * Created 3 Nov 1996 by Geert Uytterhoeven - * Modified for Power Macintosh by Paul Mackerras * - * $Id: keyboard.h,v 1.3 1997/07/24 01:55:57 ralf Exp $ + * $Id: keyboard.h,v 1.4 1997/08/05 09:44:39 ralf Exp $ + * Modified for Power Macintosh by Paul Mackerras */ /* diff --git a/include/asm-ppc/linux_logo.h b/include/asm-ppc/linux_logo.h new file mode 100644 index 000000000..7e88d4ccf --- /dev/null +++ b/include/asm-ppc/linux_logo.h @@ -0,0 +1,914 @@ +/* + * include/asm-ppc/linux_logo.h: A linux logo to be displayed on boot + * (pinched from the sparc port). + * + * Copyright (C) 1996 Larry Ewing (lewing@isc.tamu.edu) + * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + * + * You can put anything here, but: + * LINUX_LOGO_COLORS has to be less than 224 + * values have to start from 0x20 + * (i.e. linux_logo_{red,green,blue}[0] is color 0x20) + */ + +#include <linux/init.h> + +#define LINUX_LOGO_HEIGHT 80 +#define LINUX_LOGO_WIDTH 80 +#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, +}; diff --git a/include/asm-ppc/mc146818rtc.h b/include/asm-ppc/mc146818rtc.h index e69de29bb..7e406b07d 100644 --- a/include/asm-ppc/mc146818rtc.h +++ b/include/asm-ppc/mc146818rtc.h @@ -0,0 +1,27 @@ +/* + * Machine dependent access functions for RTC registers. + */ +#ifndef __ASM_PPC_MC146818RTC_H +#define __ASM_PPC_MC146818RTC_H + +#include <asm/io.h> + +#ifndef RTC_PORT +#define RTC_PORT(x) (0x70 + (x)) +#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ +#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)); \ +inb_p(RTC_PORT(1)); \ +}) +#define CMOS_WRITE(val, addr) ({ \ +outb_p((addr),RTC_PORT(0)); \ +outb_p((val),RTC_PORT(1)); \ +}) + +#endif /* __ASM_PPC_MC146818RTC_H */ diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h index c6c835229..57ce8eda8 100644 --- a/include/asm-ppc/mmu.h +++ b/include/asm-ppc/mmu.h @@ -144,7 +144,7 @@ typedef struct _MMU_context pte **pmap; /* Two-level page-map structure */ } MMU_context; -/* Used to set up SDR register */ +/* Used to set up SDR1 register */ #define HASH_TABLE_SIZE_64K 0x00010000 #define HASH_TABLE_SIZE_128K 0x00020000 #define HASH_TABLE_SIZE_256K 0x00040000 @@ -160,4 +160,12 @@ typedef struct _MMU_context #define HASH_TABLE_MASK_2M 0x01F #define HASH_TABLE_MASK_4M 0x03F +/* invalidate a TLB entry */ +extern inline void _tlbie(unsigned long va) +{ + asm volatile ("tlbie %0" : : "r"(va)); +} + +extern void _tlbia(void); /* invalidate all TLB entries */ + #endif diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h index 89a649bb3..06a7544ec 100644 --- a/include/asm-ppc/mmu_context.h +++ b/include/asm-ppc/mmu_context.h @@ -29,7 +29,6 @@ extern void set_context(int context); do { \ struct mm_struct *mm = (tsk)->mm; \ if (mm->context == NO_CONTEXT) { \ - int i; \ if (next_mmu_context == LAST_CONTEXT) \ mmu_context_overflow(); \ mm->context = MUNGE_CONTEXT(++next_mmu_context);\ diff --git a/include/asm-ppc/namei.h b/include/asm-ppc/namei.h new file mode 100644 index 000000000..3f87dc9ea --- /dev/null +++ b/include/asm-ppc/namei.h @@ -0,0 +1,19 @@ +/* $Id: namei.h,v 1.3 1997/09/06 09:27:42 ralf Exp $ + * linux/include/asm-ppc/namei.h + * Adapted from linux/include/asm-alpha/namei.h + * + * Included from linux/fs/namei.c + */ + +#ifndef __PPC_NAMEI_H +#define __PPC_NAMEI_H + +/* This dummy routine maybe changed to something useful + * for /usr/gnemul/ emulation stuff. + * Look at asm-sparc/namei.h for details. + */ + +#define __prefix_lookup_dentry(name, follow_link) \ + do {} while (0) + +#endif /* __PPC_NAMEI_H */ diff --git a/include/asm-ppc/nvram.h b/include/asm-ppc/nvram.h index 665bc76af..ea7bf1914 100644 --- a/include/asm-ppc/nvram.h +++ b/include/asm-ppc/nvram.h @@ -12,15 +12,15 @@ /* RTC Offsets */ -#define RTC_SECONDS 0x1FF9 -#define RTC_MINUTES 0x1FFA -#define RTC_HOURS 0x1FFB -#define RTC_DAY_OF_WEEK 0x1FFC -#define RTC_DAY_OF_MONTH 0x1FFD -#define RTC_MONTH 0x1FFE -#define RTC_YEAR 0x1FFF -#define RTC_CONTROLA 0x1FF8 -#define RTC_CONTROLB 0x1FF9 +#define MOTO_RTC_SECONDS 0x1FF9 +#define MOTO_RTC_MINUTES 0x1FFA +#define MOTO_RTC_HOURS 0x1FFB +#define MOTO_RTC_DAY_OF_WEEK 0x1FFC +#define MOTO_RTC_DAY_OF_MONTH 0x1FFD +#define MOTO_RTC_MONTH 0x1FFE +#define MOTO_RTC_YEAR 0x1FFF +#define MOTO_RTC_CONTROLA 0x1FF8 +#define MOTO_RTC_CONTROLB 0x1FF9 #ifndef BCD_TO_BIN #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h index a18d5e324..000a64416 100644 --- a/include/asm-ppc/page.h +++ b/include/asm-ppc/page.h @@ -13,11 +13,11 @@ /* * these virtual mappings for prep and pmac * on the prep machine the io areas are at different physical locations - * than their virtual address. On the pmac the io areas + * than their virtual address. On the pmac and chrp the io areas * are mapped 1-1 virtual/physical. * -- Cort */ -#ifdef CONFIG_PREP +#if defined(CONFIG_PREP) || defined(CONFIG_CHRP) #define KERNELBASE 0x90000000 #endif #ifdef CONFIG_PMAC @@ -81,14 +81,14 @@ typedef unsigned long pgprot_t; #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) -/* map phys->virtual and virtual->phys */ +/* map phys->virtual and virtual->phys for RAM pages */ #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) -#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) +#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) #define MAP_PAGE_RESERVED (1<<15) -extern __inline__ unsigned long get_prezerod_page(void); +extern unsigned long get_prezerod_page(void); #endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */ diff --git a/include/asm-ppc/pci-bridge.h b/include/asm-ppc/pci-bridge.h new file mode 100644 index 000000000..68a026b65 --- /dev/null +++ b/include/asm-ppc/pci-bridge.h @@ -0,0 +1,20 @@ +#ifndef _ASM_PCI_BRIDGE_H +#define _ASM_PCI_BRIDGE_H + +unsigned long pmac_find_bridges(unsigned long, unsigned long); + +/* + * pci_io_base returns the memory address at which you can access + * the I/O space for PCI bus number `bus' (or NULL on error). + */ +void *pci_io_base(unsigned int bus); + +/* + * pci_device_loc returns the bus number and device/function number + * for a device on a PCI bus, given its device_node struct. + * It returns 0 if OK, -1 on error. + */ +int pci_device_loc(struct device_node *dev, unsigned char *bus_ptr, + unsigned char *devfn_ptr); + +#endif diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index fd52a64c7..d6698d9b2 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h @@ -1,22 +1,25 @@ #ifndef _PPC_PGTABLE_H #define _PPC_PGTABLE_H -#include <linux/config.h> -#include <asm/page.h> -#include <asm/mmu.h> +#include <linux/mm.h> extern void flush_tlb_all(void); extern void flush_tlb_mm(struct mm_struct *mm); extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); extern void flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end); -extern void flush_tlb(void); -/* Caches aren't brain-dead on the ppc. */ -#define flush_cache_all() -#define flush_cache_mm(mm) -#define flush_cache_range(mm, start, end) -#define flush_cache_page(vma, vmaddr) +/* + * No cache flushing is required when address mappings are + * changed, because the caches on PowerPCs are physically + * addressed. + */ +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_range(mm, a, b) do { } while (0) +#define flush_cache_page(vma, p) do { } while (0) +extern void flush_icache_range(unsigned long, unsigned long); + /* * For the page specified, write modified lines in the data cache * out to memory, and invalidate lines in the instruction cache. @@ -25,6 +28,20 @@ extern void flush_page_to_ram(unsigned long); extern unsigned long va_to_phys(unsigned long address); +/* + * The PowerPC MMU uses a hash table containing PTEs, together with + * a set of 16 segment registers (on 32-bit implementations), to define + * the virtual to physical address mapping. + * + * We use the hash table as an extended TLB, i.e. a cache of currently + * active mappings. We maintain a two-level page table tree, much like + * that used by the i386, for the sake of the Linux memory management code. + * Low-level assembler code in head.S (procedure hash_page) is responsible + * for extracting ptes from the tree and putting them into the hash table + * when necessary, and updating the accessed and modified bits in the + * page table tree. + */ + /* PMD_SHIFT determines the size of the area mapped by the second-level page tables */ #define PMD_SHIFT 22 #define PMD_SIZE (1UL << PMD_SHIFT) @@ -133,9 +150,7 @@ extern unsigned long empty_zero_page[1024]; /* to set the page-dir */ /* tsk is a task_struct and pgdir is a pte_t */ -#define SET_PAGE_DIR(tsk,pgdir) ({ \ - ((tsk)->tss.pg_tables = (unsigned long *)(pgdir)); \ -}) +#define SET_PAGE_DIR(tsk,pgdir) 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; } @@ -146,7 +161,7 @@ extern inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) & ~PAGE_MASK) != 0; extern inline int pmd_present(pmd_t pmd) { return (pmd_val(pmd) & PAGE_MASK) != 0; } extern inline void pmd_clear(pmd_t * pmdp) { pmd_val(*pmdp) = 0; } - + /* * 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 @@ -370,13 +385,27 @@ extern pgd_t swapper_pg_dir[1024]; * as entries are faulted into the hash table by the low-level * data/instruction access exception handlers. */ -#define update_mmu_cache(vma,address,pte) while(0){} +#define update_mmu_cache(vma, addr, pte) do { } while (0) +/* + * When flushing the tlb entry for a page, we also need to flush the + * hash table entry. flush_hash_page is assembler (for speed) in head.S. + */ +extern void flush_hash_segments(unsigned low_vsid, unsigned high_vsid); +extern void flush_hash_page(unsigned context, unsigned long va); + +extern inline void +flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr) +{ + if (vmaddr < TASK_SIZE) + flush_hash_page(vma->vm_mm->context, vmaddr); +} #define SWP_TYPE(entry) (((entry) >> 1) & 0x7f) #define SWP_OFFSET(entry) ((entry) >> 8) #define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8)) +#define module_map vmalloc +#define module_unmap vfree - -#endif /* _PPC_PAGE_H */ +#endif /* _PPC_PGTABLE_H */ diff --git a/include/asm-ppc/pnp.h b/include/asm-ppc/pnp.h index 53f27eff4..15335ff35 100644 --- a/include/asm-ppc/pnp.h +++ b/include/asm-ppc/pnp.h @@ -17,10 +17,11 @@ #ifndef _PNP_ #define _PNP_ +#ifndef __ASSEMBLY__ #define MAX_MEM_REGISTERS 9 #define MAX_IO_PORTS 20 #define MAX_IRQS 7 -#define MAX_DMA_CHANNELS 7 +/*#define MAX_DMA_CHANNELS 7*/ /* Interrupt controllers */ @@ -638,4 +639,5 @@ typedef union _PnP_TAG_PACKET { } PnP_TAG_PACKET; +#endif /* __ASSEMBLY__ */ #endif /* ndef _PNP_ */ diff --git a/include/asm-ppc/poll.h b/include/asm-ppc/poll.h new file mode 100644 index 000000000..bcec653c1 --- /dev/null +++ b/include/asm-ppc/poll.h @@ -0,0 +1,22 @@ +#ifndef __PPC_POLL_H +#define __PPC_POLL_H + +#define POLLIN 0x0001 +#define POLLPRI 0x0002 +#define POLLOUT 0x0004 +#define POLLERR 0x0008 +#define POLLHUP 0x0010 +#define POLLNVAL 0x0020 +#define POLLRDNORM 0x0040 +#define POLLRDBAND 0x0080 +#define POLLWRNORM 0x0100 +#define POLLWRBAND 0x0200 +#define POLLMSG 0x0400 + +struct pollfd { + int fd; + short events; + short revents; +}; + +#endif diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h index 1e6baf0a6..fc46a3a3c 100644 --- a/include/asm-ppc/processor.h +++ b/include/asm-ppc/processor.h @@ -1,8 +1,8 @@ #ifndef __ASM_PPC_PROCESSOR_H #define __ASM_PPC_PROCESSOR_H -#include <linux/config.h> - +#include <asm/ptrace.h> +#include <asm/residual.h> /* Bit encodings for Machine State Register (MSR) */ #define MSR_POW (1<<18) /* Enable Power Management */ @@ -22,11 +22,12 @@ #define MSR_RI (1<<1) /* Recoverable Exception */ #define MSR_LE (1<<0) /* Little-Endian enable */ -#define MSR_ MSR_FE0|MSR_FE1|MSR_ME +#define MSR_ MSR_ME|MSR_FE0|MSR_FE1|MSR_RI #define MSR_KERNEL MSR_|MSR_IR|MSR_DR -#define MSR_USER MSR_FE0|MSR_FE1|MSR_ME|MSR_PR|MSR_EE|MSR_IR|MSR_DR +#define MSR_USER MSR_KERNEL|MSR_PR|MSR_EE -/* Bit encodings for Hardware Implementation Register (HID0) */ +/* Bit encodings for Hardware Implementation Register (HID0) + on PowerPC 603, 604, etc. processors (not 601). */ #define HID0_EMCP (1<<31) /* Enable Machine Check pin */ #define HID0_EBA (1<<29) /* Enable Bus Address Parity */ #define HID0_EBD (1<<28) /* Enable Bus Data Parity */ @@ -46,15 +47,37 @@ #define HID0_DCI (1<<10) /* Data Cache Invalidate */ #define HID0_SIED (1<<7) /* Serial Instruction Execution [Disable] */ #define HID0_BHTE (1<<2) /* Branch History Table Enable */ + /* fpscr settings */ #define FPSCR_FX (1<<31) #define FPSCR_FEX (1<<30) +#define _MACH_Motorola 1 /* motorola prep */ +#define _MACH_IBM 2 /* ibm prep */ +#define _MACH_Pmac 4 /* pmac or pmac clone (non-chrp) */ +#define _MACH_chrp 8 /* chrp machine */ + #ifndef __ASSEMBLY__ +extern int _machine; + +/* if we're a prep machine */ +#define is_prep (_machine & (_MACH_Motorola|_MACH_IBM)) /* - * PowerPC machine specifics + * if we have openfirmware - pmac/chrp have it implicitly + * but we have to check residual data to know on prep */ -extern inline void start_thread(struct pt_regs *, unsigned long, unsigned long ); +extern __inline__ int have_of(void) +{ + if ( (_machine & (_MACH_Pmac|_MACH_chrp)) /*|| + ( is_prep && (res.VitalProductData.FirmwareSupplier & OpenFirmware))*/) + return 1; + else + return 0; +} + +struct task_struct; +void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp); +void release_thread(struct task_struct *); /* * Bus types @@ -65,54 +88,38 @@ extern inline void start_thread(struct pt_regs *, unsigned long, unsigned long ) #define MCA_bus__is_a_macro /* for versions in ksyms.c */ /* - * Write Protection works right in supervisor mode on the PowerPC + * this is the minimum allowable io space due to the location + * of the io areas on prep (first one at 0x80000000) but + * as soon as I get around to remapping the io areas with the BATs + * to match the mac we can raise this. -- Cort */ -#define wp_works_ok 1 -#define wp_works_ok__is_a_macro /* for versions in ksyms.c */ - #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) -struct thread_struct -{ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3) + +struct thread_struct { unsigned long ksp; /* Kernel stack pointer */ - unsigned long *pg_tables; /* MMU information */ -#ifdef CONFIG_PMAC - unsigned long last_pc; /* PC when last entered system */ - unsigned long user_stack; /* [User] Stack when entered kernel */ -#endif - unsigned long fpscr_pad; /* (so we can save fpscr with stfd) */ - unsigned long fpscr; /* fp status reg */ - double fpr[32]; /* Complete floating point set */ - unsigned long fp_used; unsigned long wchan; /* Event task is sleeping on */ - struct pt_regs *regs; /* Pointer to saved register state */ + struct pt_regs *regs; /* Pointer to saved register state */ unsigned long fs; /* for get_fs() validation */ signed long last_syscall; - unsigned long pad[2]; /* pad to 16-byte boundry */ + double fpr[32]; /* Complete floating point set */ + unsigned long fpscr_pad; /* fpr ... fpscr must be contiguous */ + unsigned long fpscr; /* Floating point status */ }; -/* Points to the thread_struct of the thread (if any) which - currently owns the FPU. */ -#define fpu_tss (&(last_task_used_math->tss)) - -#ifdef CONFIG_PMAC -#define LAZY_TSS_FPR_INIT 0,0,0,0,{0}, -#endif -#ifdef CONFIG_PREP -#define LAZY_TSS_FPR_INIT 0,0,{0}, -#endif +#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) #define INIT_TSS { \ - sizeof(init_stack) + (long) &init_stack, /* ksp */ \ - (long *)swapper_pg_dir, /* pg_tables */ \ - LAZY_TSS_FPR_INIT \ - 0, /*fp_used*/ 0, /*wchan*/ \ - sizeof(init_stack) + (long)&init_stack - \ - sizeof(struct pt_regs), /* regs */ \ - KERNEL_DS /*fs*/, 0 /*last_syscall*/ \ + INIT_SP, /* ksp */ \ + 0, /* wchan */ \ + (struct pt_regs *)INIT_SP - 1, /* regs */ \ + KERNEL_DS, /*fs*/ \ + 0, /* last_syscall */ \ + {0}, 0, 0 \ } #define INIT_MMAP { &init_mm, KERNELBASE/*0*/, 0xffffffff/*0x40000000*/, \ @@ -124,15 +131,8 @@ struct thread_struct static inline unsigned long thread_saved_pc(struct thread_struct *t) { return (t->regs) ? t->regs->nip : 0; - /*return (t->last_pc);*/ } -extern int _machine; -#define _MACH_Motorola 0 -#define _MACH_IBM 1 -#define _MACH_Be 2 -#define _MACH_Pmac 3 - /* * NOTE! The task struct and the stack go together */ @@ -145,11 +145,12 @@ int ll_printk(const char *, ...); void ll_puts(const char *); #endif /* ndef ASSEMBLY*/ - * Return_address is a replacement for __builtin_return_address(count) + #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) - -#endif /* __ASM_PPC_PROCESSOR_H */ + +/* + * Return_address is a replacement for __builtin_return_address(count) * which on certain architectures cannot reasonably be implemented in GCC * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386). * Note that __builtin_return_address(x>=1) is forbidden because the GCC @@ -158,5 +159,4 @@ void ll_puts(const char *); */ #define return_address() __builtin_return_address(0) -#endif - +#endif /* __ASM_PPC_PROCESSOR_H */ diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h new file mode 100644 index 000000000..f5ec558aa --- /dev/null +++ b/include/asm-ppc/prom.h @@ -0,0 +1,65 @@ +/* + * Definitions for talking to the Open Firmware PROM on + * Power Macintosh computers. + * + * Copyright (C) 1996 Paul Mackerras. + */ + +typedef void *phandle; +typedef void *ihandle; + +extern ihandle prom_stdout; +extern ihandle prom_chosen; +extern phandle cpu_node; +extern char prom_display_path[]; + +struct reg_property { + unsigned int address; + unsigned int size; +}; + +struct translation_property { + unsigned int virt; + unsigned int size; + unsigned int phys; + unsigned int flags; +}; + +struct property { + char *name; + int length; + unsigned char *value; + struct property *next; +}; + +struct device_node { + char *name; + char *type; + phandle node; + int n_addrs; + struct reg_property *addrs; + int n_intrs; + int *intrs; + char *full_name; + struct property *properties; + struct device_node *parent; + struct device_node *child; + struct device_node *sibling; + struct device_node *next; /* next device of same type */ + struct device_node *allnext; /* next in list of all nodes */ +}; + +/* Prototypes */ +void abort(void); +void prom_exit(void); +void *call_prom(const char *service, int nargs, int nret, ...); +void prom_print(const char *msg); +void prom_init(char *params, int unused, void (*)(void *)); +void set_prom_callback(void); +unsigned long copy_device_tree(unsigned long, unsigned long); +struct device_node *find_devices(const char *name); +struct device_node *find_type_devices(const char *type); +struct device_node *find_path_device(const char *path); +unsigned char *get_property(struct device_node *node, const char *name, + int *lenp); +void print_properties(struct device_node *node); diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h index 13b526172..c46bdb9b7 100644 --- a/include/asm-ppc/ptrace.h +++ b/include/asm-ppc/ptrace.h @@ -2,63 +2,52 @@ #define _PPC_PTRACE_H /* + * This struct defines the way the registers are stored on the + * kernel stack during a system call or other kernel entry. + * * this should only contain volatile regs * since we can keep non-volatile in the tss * should set this up when only volatiles are saved * by intr code. * - * I can't find any reference to the above comment (from Gary Thomas) - * about _underhead/_overhead in the sys V abi for the ppc - * dated july 25, 1994. + * Since this is going on the stack, *CARE MUST BE TAKEN* to insure + * that the overall structure is a multiple of 16 bytes in length. * - * the stack must be kept to a size that is a multiple of 16 - * so this includes the stack frame overhead - * -- Cort. - */ - -/* - * GCC sometimes accesses words at negative offsets from the stack - * pointer, although the SysV ABI says it shouldn't. To cope with - * this, we leave this much untouched space on the stack on exception - * entry. + * Note that the offsets of the fields in this struct correspond with + * the PT_* values below. This simplifies arch/ppc/kernel/ptrace.c. */ -#define STACK_FRAME_OVERHEAD 16 -#define STACK_UNDERHEAD 64 #ifndef __ASSEMBLY__ struct pt_regs { unsigned long gpr[32]; - unsigned long nip; - unsigned long msr; - unsigned long ctr; - unsigned long link; - unsigned long ccr; - unsigned long xer; - unsigned long dar; /* Fault registers */ - unsigned long dsisr; -#if 0 - unsigned long srr1; - unsigned long srr0; - unsigned long hash1, hash2; - unsigned long imiss, dmiss; - unsigned long icmp, dcmp; -#endif + unsigned long nip; + unsigned long msr; unsigned long orig_gpr3; /* Used for restarting system calls */ - unsigned long result; /* Result of a system call */ + unsigned long ctr; + unsigned long link; + unsigned long xer; + unsigned long ccr; + unsigned long mq; /* 601 only (not used at present) */ unsigned long trap; /* Reason for being here */ - unsigned long marker; /* Should have DEADDEAD */ + unsigned long dar; /* Fault registers */ + unsigned long dsisr; + unsigned long result; /* Result of a system call */ }; +#endif + +#define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */ +/* Size of stack frame allocated when calling signal handler. */ +#define __SIGNAL_FRAMESIZE 64 #define instruction_pointer(regs) ((regs)->nip) #define user_mode(regs) ((regs)->msr & 0x4000) -#ifdef KERNEL -extern void show_regs(struct pt_regs *); -#endif -/* should include and generate these in ppc_defs.h -- Cort */ -/* Offsets used by 'ptrace' system call interface */ -/* Note: these should correspond to gpr[x] */ +/* + * Offsets used by 'ptrace' system call interface. + * These can't be changed without breaking binary compatibility + * with MkLinux, etc. + */ #define PT_R0 0 #define PT_R1 1 #define PT_R2 2 @@ -94,14 +83,18 @@ extern void show_regs(struct pt_regs *); #define PT_NIP 32 #define PT_MSR 33 +#ifdef __KERNEL__ #define PT_ORIG_R3 34 +#endif #define PT_CTR 35 #define PT_LNK 36 #define PT_XER 37 #define PT_CCR 38 +#define PT_MQ 39 -#define PT_FPR0 48 -#endif /* __ASSEMBLY__ */ +#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */ +#define PT_FPR31 (PT_FPR0 + 2*31) +#define PT_FPSCR (PT_FPR0 + 2*32 + 1) -#endif /* _PPC_PTRACE_H */ +#endif diff --git a/include/asm-ppc/residual.h b/include/asm-ppc/residual.h index 3812decf6..428dd22f7 100644 --- a/include/asm-ppc/residual.h +++ b/include/asm-ppc/residual.h @@ -13,6 +13,8 @@ #ifndef _RESIDUAL_ #define _RESIDUAL_ +#ifndef __ASSEMBLY__ + #define MAX_CPUS 32 /* These should be set to the maximum */ #define MAX_MEMS 64 /* number possible for this system. */ #define MAX_DEVICES 256 /* Changing these will change the */ @@ -311,5 +313,9 @@ typedef struct _RESIDUAL { unsigned char DevicePnPHeap[2*MAX_DEVICES*AVE_PNP_SIZE]; } RESIDUAL; + +extern RESIDUAL res; +void print_residual_device_info(void); +#endif /* __ASSEMBLY__ */ #endif /* ndef _RESIDUAL_ */ diff --git a/include/asm-ppc/resource.h b/include/asm-ppc/resource.h index bd0d5e02d..4555502a2 100644 --- a/include/asm-ppc/resource.h +++ b/include/asm-ppc/resource.h @@ -7,10 +7,10 @@ #define RLIMIT_STACK 3 /* max stack size */ #define RLIMIT_CORE 4 /* max core file size */ #define RLIMIT_RSS 5 /* max resident set size */ -#define RLIMIT_NOFILE 6 /* max number of open files */ -#define RLIMIT_AS 7 /* address space limit(?) */ -#define RLIMIT_NPROC 8 /* max number of processes */ -#define RLIMIT_MEMLOCK 9 /* max locked-in-memory address space */ +#define RLIMIT_NPROC 6 /* max number of processes */ +#define RLIMIT_NOFILE 7 /* max number of open files */ +#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ +#define RLIMIT_AS 9 /* address space limit(?) */ #define RLIM_NLIMITS 10 @@ -24,10 +24,10 @@ {_STK_LIM, _STK_LIM}, /* RLIMIT_STACK */ \ { 0, LONG_MAX}, /* RLIMIT_CORE */ \ {LONG_MAX, LONG_MAX}, /* RLIMIT_RSS */ \ - { NR_OPEN, NR_OPEN}, /* RLIMIT_NOFILE */ \ - {LONG_MAX, LONG_MAX}, /* RLIMIT_AS */ \ {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, /* RLIMIT_NPROC */ \ + { NR_OPEN, NR_OPEN}, /* RLIMIT_NOFILE */ \ {LONG_MAX, LONG_MAX}, /* RLIMIT_MEMLOCK */ \ + {LONG_MAX, LONG_MAX}, /* RLIMIT_AS */ \ } #endif /* __KERNEL__ */ diff --git a/include/asm-ppc/scatterlist.h b/include/asm-ppc/scatterlist.h index 80aa3b64a..6c5105291 100644 --- a/include/asm-ppc/scatterlist.h +++ b/include/asm-ppc/scatterlist.h @@ -1,6 +1,8 @@ #ifndef _PPC_SCATTERLIST_H #define _PPC_SCATTERLIST_H +#include <linux/config.h> + struct scatterlist { char * address; /* Location data is to be transferred to */ char * alt_address; /* Location of actual if address is a @@ -8,6 +10,23 @@ struct scatterlist { unsigned int length; }; +#ifdef CONFIG_PMAC +/* + * This is used in the scsi code to decide if bounce buffers are needed. + * Fortunately the dma controllers on the PowerMac are a bit better + * than on PCs... + */ +#define ISA_DMA_THRESHOLD (~0UL) +#endif + +#ifdef CONFIG_PREP +/* PReP systems are like PCs */ #define ISA_DMA_THRESHOLD (0x00ffffff) +#endif + +#ifdef CONFIG_CHRP +/* The W83C553F supports 32-bit DMA on ISA */ +#define ISA_DMA_THRESHOLD (~0UL) +#endif #endif /* !(_PPC_SCATTERLIST_H) */ diff --git a/include/asm-ppc/semaphore.h b/include/asm-ppc/semaphore.h index a4dfa0312..f6a2a59f2 100644 --- a/include/asm-ppc/semaphore.h +++ b/include/asm-ppc/semaphore.h @@ -44,13 +44,13 @@ static inline int waking_non_zero(struct semaphore *sem) __asm__ __volatile__( "1: lwarx %1,0,%2\n" " cmpwi 0,%1,0\n" - " addi %1,%1,-1\n" + " addic %1,%1,-1\n" " ble- 2f\n" " stwcx. %1,0,%2\n" " bne- 1b\n" - " mr %0,%1\n" + " li %0,1\n" "2:" - : "=r" (ret), "=r" (tmp) + : "=r" (ret), "=&r" (tmp) : "r" (&sem->waking), "0" (0) : "cr0", "memory"); diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h index 7f54dd779..db17e6552 100644 --- a/include/asm-ppc/smp.h +++ b/include/asm-ppc/smp.h @@ -6,21 +6,54 @@ #ifndef _PPC_SMP_H #define _PPC_SMP_H +#include <linux/kernel.h> /* for panic */ + #ifdef __SMP__ #ifndef __ASSEMBLY__ -extern struct prom_cpuinfo linux_cpus[NCPUS]; - -/* Per processor PPC parameters we need. */ +extern unsigned long cpu_present_map; +/* per processor PPC parameters we need. */ struct cpuinfo_PPC { - unsigned long udelay_val; /* that's it */ + unsigned long udelay_val; }; extern struct cpuinfo_PPC cpu_data[NR_CPUS]; + +struct klock_info { + unsigned char kernel_flag; + unsigned char akp; +}; + +extern struct klock_info klock_info; + +#define KLOCK_HELD 0xff +#define KLOCK_CLEAR 0x00 + +#define PROC_CHANGE_PENALTY 20 + +extern __volatile__ int cpu_number_map[NR_CPUS]; +extern __volatile__ int cpu_logical_map[NR_CPUS]; +extern unsigned long smp_proc_in_lock[NR_CPUS]; + +extern __inline__ int hard_smp_processor_id(void) +{ + int cpuid; + if ( ! have_of() ) /* assume prep */ + panic("hard_smp_processor_id()\n"); + else + panic("hard_smp_processor_id()\n"); + + return cpuid; +} + +#define smp_processor_id() hard_smp_processor_id() + #endif /* __ASSEMBLY__ */ #endif /* !(__SMP__) */ +#define NO_PROC_ID 0xFF /* No processor magic marker */ + #endif /* !(_PPC_SMP_H) */ diff --git a/include/asm-ppc/smp_lock.h b/include/asm-ppc/smp_lock.h new file mode 100644 index 000000000..0174acfac --- /dev/null +++ b/include/asm-ppc/smp_lock.h @@ -0,0 +1,59 @@ +#ifndef __PPC_SMPLOCK_H +#define __PPC_SMPLOCK_H + +#include <linux/kernel.h> /* for panic */ +#ifndef __SMP__ + +#define lock_kernel() do { } while (0) +#define unlock_kernel() do { } while (0) +#define release_kernel_lock(task, cpu, depth) ((depth) = 1) +#define reacquire_kernel_lock(task, cpu, depth) do { } while(0) + +#else + +/* Release global kernel lock and global interrupt lock */ +#define release_kernel_lock(task, cpu, depth) \ +do { \ + if((depth = (task)->lock_depth) != 0) { \ + __cli(); \ + (task)->lock_depth = 0; \ + klock_info.akp = NO_PROC_ID; \ + klock_info.kernel_flag = 0; \ + } \ + release_irqlock(cpu); \ + __sti(); \ +} while(0) + +/* Re-acquire the kernel lock */ +#define reacquire_kernel_lock(task, cpu, depth) \ +do { if (depth) \ + { __cli(); \ + __asm__ __volatile__( \ + "blr __lock_kernel\n\t" \ + "stw %2,%0\n\t" \ + : "=m" (task->lock_depth) \ + : "d" (cpu), "c" (depth)); \ + __sti(); \ + } \ +} while (0) + +/* The following acquire and release the master kernel global lock, + * the idea is that the usage of this mechanmism becomes less and less + * as time goes on, to the point where they are no longer needed at all + * and can thus disappear. + */ + +extern __inline__ void lock_kernel(void) +{ + panic("lock_kernel()\n"); +} + +/* Release kernel global lock. */ +extern __inline__ void unlock_kernel(void) +{ + panic("unlock_kernel()\n"); +} + + +#endif /* __SMP__ */ +#endif /* __PPC_SMPLOCK_H */ diff --git a/include/asm-ppc/socket.h b/include/asm-ppc/socket.h index 632717509..62a4062cf 100644 --- a/include/asm-ppc/socket.h +++ b/include/asm-ppc/socket.h @@ -34,4 +34,9 @@ #define SO_PASSCRED 20 #define SO_PEERCRED 21 +/* Security levels - as per NRL IPv6 - don't actually do anything */ +#define SO_SECURITY_AUTHENTICATION 22 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define SO_SECURITY_ENCRYPTION_NETWORK 24 + #endif /* _ASM_SOCKET_H */ diff --git a/include/asm-ppc/softirq.h b/include/asm-ppc/softirq.h new file mode 100644 index 000000000..7cea505a8 --- /dev/null +++ b/include/asm-ppc/softirq.h @@ -0,0 +1,151 @@ +/* + * Software interrupts.. + */ + +#ifndef __ASM_SOFTIRQ_H +#define __ASM_SOFTIRQ_H + +#include <asm/atomic.h> +#include <asm/hardirq.h> + +/* + * The locking mechanism for base handlers, to prevent re-entrancy, + * is entirely private to an implementation, it should not be + * referenced at all outside of this file. + */ +#define get_active_bhs() (bh_mask & bh_active) + +#ifndef __SMP__ + +extern int __ppc_bh_counter; + +#define clear_active_bhs(x) atomic_clear_mask((x),&bh_active) + +extern inline void init_bh(int nr, void (*routine)(void)) +{ + bh_base[nr] = routine; + bh_mask_count[nr] = 0; + bh_mask |= 1 << nr; +} + +extern inline void remove_bh(int nr) +{ + bh_base[nr] = NULL; + bh_mask &= ~(1 << nr); +} + +extern inline void mark_bh(int nr) +{ + set_bit(nr, &bh_active); +} + +/* + * These use a mask count to correctly handle + * nested disable/enable calls + */ +extern inline void disable_bh(int nr) +{ + bh_mask &= ~(1 << nr); + bh_mask_count[nr]++; +} + +extern inline void enable_bh(int nr) +{ + if (!--bh_mask_count[nr]) + bh_mask |= 1 << nr; +} + + +extern inline void start_bh_atomic(void) +{ + __ppc_bh_counter++; + barrier(); +} + +extern inline void end_bh_atomic(void) +{ + barrier(); + __ppc_bh_counter--; +} + +/* These are for the irq's testing the lock */ +#define softirq_trylock() (__ppc_bh_counter? 0: ((__ppc_bh_counter=1),1)) +#define softirq_endlock() (__ppc_bh_counter = 0) + +#else /* __SMP__ */ + +extern atomic_t __sparc_bh_counter; + +#define start_bh_atomic() \ + do { atomic_inc(&__sparc_bh_counter); synchronize_irq(); } while(0) + +#define end_bh_atomic() atomic_dec(&__sparc_bh_counter) + +#include <asm/spinlock.h> + +extern spinlock_t global_bh_lock; + +#define init_bh(nr, routine) \ +do { unsigned long flags; \ + int ent = nr; \ + spin_lock_irqsave(&global_bh_lock, flags); \ + bh_base[ent] = routine; \ + bh_mask_count[ent] = 0; \ + bh_mask |= 1 << ent; \ + spin_unlock_irqrestore(&global_bh_lock, flags); \ +} while(0) + +#define remove_bh(nr) \ +do { unsigned long flags; \ + int ent = nr; \ + spin_lock_irqsave(&global_bh_lock, flags); \ + bh_base[ent] = NULL; \ + bh_mask &= ~(1 << ent); \ + spin_unlock_irqrestore(&global_bh_lock, flags); \ +} while(0) + +#define mark_bh(nr) \ +do { unsigned long flags; \ + spin_lock_irqsave(&global_bh_lock, flags); \ + bh_active |= (1 << nr); \ + spin_unlock_irqrestore(&global_bh_lock, flags); \ +} while(0) + +#define disable_bh(nr) \ +do { unsigned long flags; \ + int ent = nr; \ + spin_lock_irqsave(&global_bh_lock, flags); \ + bh_mask &= ~(1 << ent); \ + bh_mask_count[ent]++; \ + spin_unlock_irqrestore(&global_bh_lock, flags); \ +} while(0) + +#define enable_bh(nr) \ +do { unsigned long flags; \ + int ent = nr; \ + spin_lock_irqsave(&global_bh_lock, flags); \ + if (!--bh_mask_count[ent]) \ + bh_mask |= 1 << ent; \ + spin_unlock_irqrestore(&global_bh_lock, flags); \ +} while(0) + +#define softirq_trylock() \ +({ \ + int ret = 1; \ + if(atomic_add_return(1, &__sparc_bh_counter) != 1) { \ + atomic_dec(&__sparc_bh_counter); \ + ret = 0; \ + } \ + ret; \ +}) +#define softirq_endlock() atomic_dec(&__sparc_bh_counter) +#define clear_active_bhs(mask) \ +do { unsigned long flags; \ + spin_lock_irqsave(&global_bh_lock, flags); \ + bh_active &= ~(mask); \ + spin_unlock_irqrestore(&global_bh_lock, flags); \ +} while(0) + +#endif /* __SMP__ */ + +#endif diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h new file mode 100644 index 000000000..b2fb48d03 --- /dev/null +++ b/include/asm-ppc/spinlock.h @@ -0,0 +1,187 @@ +#ifndef __ASM_SPINLOCK_H +#define __ASM_SPINLOCK_H + +#ifndef __SMP__ + +typedef struct { } spinlock_t; +#define SPIN_LOCK_UNLOCKED { } + +#define spin_lock_init(lock) do { } while(0) +#define spin_lock(lock) do { } while(0) +#define spin_trylock(lock) do { } while(0) +#define spin_unlock(lock) do { } while(0) +#define spin_lock_irq(lock) cli() +#define spin_unlock_irq(lock) sti() + +#define spin_lock_irqsave(lock, flags) \ + do { save_flags(flags); cli(); } while (0) +#define spin_unlock_irqrestore(lock, flags) \ + restore_flags(flags) + +/* + * Read-write spinlocks, allowing multiple readers + * but only one writer. + * + * NOTE! it is quite common to have readers in interrupts + * but no interrupt writers. For those circumstances we + * can "mix" irq-safe locks - any writer needs to get a + * irq-safe write-lock, but readers can get non-irqsafe + * read-locks. + */ +typedef struct { } rwlock_t; +#define RW_LOCK_UNLOCKED { } + +#define read_lock(lock) do { } while(0) +#define read_unlock(lock) do { } while(0) +#define write_lock(lock) do { } while(0) +#define write_unlock(lock) do { } while(0) +#define read_lock_irq(lock) cli() +#define read_unlock_irq(lock) sti() +#define write_lock_irq(lock) cli() +#define write_unlock_irq(lock) sti() + +#define read_lock_irqsave(lock, flags) \ + do { save_flags(flags); cli(); } while (0) +#define read_unlock_irqrestore(lock, flags) \ + restore_flags(flags) +#define write_lock_irqsave(lock, flags) \ + do { save_flags(flags); cli(); } while (0) +#define write_unlock_irqrestore(lock, flags) \ + restore_flags(flags) + +#else /* __SMP__ */ + +/* Simple spin lock operations. There are two variants, one clears IRQ's + * on the local processor, one does not. + * + * We make no fairness assumptions. They have a cost. + */ + +struct _spinlock_debug { + volatile unsigned long lock; + volatile unsigned long owner_pc; +}; + +typedef struct _spinlock_debug spinlock_t; + +#define SPIN_LOCK_UNLOCKED { 0, 0 } + +#define SPIN_LOCK_UNLOCKED { 0, 0 } +#define spin_lock_init(lp) do { (lp)->owner_pc = 0; (lp)->lock = 0; } while(0) +#define spin_unlock_wait(lp) do { barrier(); } while((lp)->lock) + +extern void _spin_lock(spinlock_t *lock); +extern int _spin_trylock(spinlock_t *lock); +extern void _spin_unlock(spinlock_t *lock); +extern void _spin_lock_irq(spinlock_t *lock); +extern void _spin_unlock_irq(spinlock_t *lock); +extern void _spin_lock_irqsave(spinlock_t *lock); +extern void _spin_unlock_irqrestore(spinlock_t *lock); + +#define spin_lock(lp) _spin_lock(lp) +#define spin_trylock(lp) _spin_trylock(lp) +#define spin_unlock(lp) _spin_unlock(lp) +#define spin_lock_irq(lp) _spin_lock_irq(lp) +#define spin_unlock_irq(lp) _spin_unlock_irq(lp) +#define spin_lock_irqsave(lp, flags) do { __save_and_cli(flags); \ + _spin_lock_irqsave(lp); } while (0) +#define spin_unlock_irqrestore(lp, flags) do { _spin_unlock_irqrestore(lp); \ + __restore_flags(flags); } while(0) +#if 0 +extern __inline__ void spin_unlock(spinlock_t *lock) +{ + __asm__ __volatile__("stw 0,%0" : : "m" (lock) : "memory"); +} + +static inline void spin_lock(spinlock_t * lock) +{ + int stuck = 10000000; + int tmp, val; + + __asm__ __volatile__( + " mtctr %2\n" + "1: lwarx %0,0,%3\n" + " andi. %1,%0,1\n\t" + " ori %0,%0,1\n\t" + " bne- 2f\n\t" + " stwcx. %0,0,%3\n\t" + "2: bdnzf- 2,1b" + : "=r" (tmp), "=r" (val) + : "r" (stuck), "r" (lock) + : "ctr"); + if (!val) + { + unsigned long __nip; + asm("mfnip %0\n": "=r" (__nip)); + printk("spinlock stuck at %08lx\n", __nip); + } +} +#define spin_trylock(lock) (!set_bit(0,(lock))) + +#define spin_lock_irq(lock) \ + do { __cli(); spin_lock(lock); } while (0) + +#define spin_unlock_irq(lock) \ + do { spin_unlock(lock); __sti(); } while (0) + +#define spin_lock_irqsave(lock, flags) \ + do { __save_flags(flags); __cli(); spin_lock(lock); } while (0) + +#define spin_unlock_irqrestore(lock, flags) \ + do { spin_unlock(lock); __restore_flags(flags); } while (0) +#endif + +struct _rwlock_debug { + volatile unsigned int lock; + unsigned long owner_pc; +}; +typedef struct _rwlock_debug rwlock_t; + +#define RW_LOCK_UNLOCKED { 0, 0 } + +extern void _read_lock(rwlock_t *rw); +extern void _read_unlock(rwlock_t *rw); +extern void _write_lock(rwlock_t *rw); +extern void _write_unlock(rwlock_t *rw); +extern void _read_lock_irq(rwlock_t *rw); +extern void _read_unlock_irq(rwlock_t *rw); +extern void _write_lock_irq(rwlock_t *rw); +extern void _write_unlock_irq(rwlock_t *rw); +extern void _read_lock_irqsave(rwlock_t *rw); +extern void _read_unlock_irqrestore(rwlock_t *rw); +extern void _write_lock_irqsave(rwlock_t *rw); +extern void _write_unlock_irqrestore(rwlock_t *rw); + +#define read_lock(rw) _read_lock(rw) +#define read_unlock(rw) _read_unlock(rw) +#define write_lock(rw) _write_lock(rw) +#define write_unlock(rw) _write_unlock(rw) +#define read_lock_irq(rw) _read_lock_irq(rw) +#define read_unlock_irq(rw) _read_unlock_irq(rw) +#define write_lock_irq(rw) _write_lock_irq(rw) +#define write_unlock_irq(rw) _write_unlock_irq(rw) + +#define read_lock_irqsave(rw, flags) \ +do { __save_and_cli(flags); _read_lock_irqsave(rw); } while (0) + +#define read_unlock_irqrestore(rw, flags) do { _read_unlock_irqrestore(rw); \ + __restore_flags(flags); } while(0) + +#define write_lock_irqsave(rw, flags) \ +do { __save_and_cli(flags); _write_lock_irqsave(rw); } while(0) + +#define write_unlock_irqrestore(rw, flags) do { _write_unlock_irqrestore(rw); \ + __restore_flags(flags); } while(0) + + +#endif /* SMP */ +#endif /* __ASM_SPINLOCK_H */ + + + + + + + + + diff --git a/include/asm-ppc/string.h b/include/asm-ppc/string.h index 207ab3689..1af5e6270 100644 --- a/include/asm-ppc/string.h +++ b/include/asm-ppc/string.h @@ -12,16 +12,7 @@ #define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMCMP #define __HAVE_ARCH_MEMCHR -/*#define bzero(addr,size) memset((addr),(int)(0),(size))*/ -extern inline void * memchr(const void * cs,int c,size_t count) -{ - unsigned long i = 0; - while ( count != i ) - { - if ( (char)c == *(char *)(cs + i) ) - return (void *)(cs + i); - i--; - } - return NULL; -} + +extern int strcasecmp(const char *, const char *); + #endif diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index df527e474..11700eb41 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -1,40 +1,69 @@ #ifndef __PPC_SYSTEM_H #define __PPC_SYSTEM_H -#include <linux/delay.h> +#include <linux/kdev_t.h> +#include <asm/processor.h> #define mb() __asm__ __volatile__ ("sync" : : : "memory") #define __save_flags(flags) ({\ __asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory"); }) -/* using Paul's in misc.S now -- Cort */ -extern void __restore_flags(unsigned long flags); +#define __save_and_cli(flags) ({__save_flags(flags);__cli();}) +extern __inline__ void __restore_flags(unsigned long flags) +{ + extern unsigned lost_interrupts; + extern void do_lost_interrupts(unsigned long); + + if ((flags & MSR_EE) && lost_interrupts != 0) { + do_lost_interrupts(flags); + } else { + __asm__ __volatile__ ("sync; mtmsr %0; isync" + : : "r" (flags) : "memory"); + } +} + + +#if 0 /* - #define __sti() _soft_sti(void) - #define __cli() _soft_cli(void) + * Gcc bug prevents us from using this inline func so for now + * it lives in misc.S */ +void __inline__ __restore_flags(unsigned long flags) +{ + extern unsigned lost_interrupts; + __asm__ __volatile__ ( + "andi. 0,%0,%2 \n\t" + "beq 2f \n\t" + "cmpi 0,%1,0 \n\t" + "bne do_lost_interrupts \n\t" + "2: sync \n\t" + "mtmsr %0 \n\t" + "isync \n\t" + : + : "r" (flags), "r"(lost_interrupts), "i" (1<<15)/*MSR_EE*/ + : "0", "cc"); +} +#endif + extern void __sti(void); extern void __cli(void); - -extern void _hard_sti(void); -extern void _hard_cli(void); -extern void _soft_sti(void); -extern void _soft_cli(void); extern int _disable_interrupts(void); extern void _enable_interrupts(int); +extern void print_backtrace(unsigned long *); +extern void show_regs(struct pt_regs * regs); extern void flush_instruction_cache(void); extern void hard_reset_now(void); extern void poweroff_now(void); -extern void find_scsi_boot(void); +/*extern void note_bootable_part(kdev_t, int);*/ extern int sd_find_target(void *, int); extern int _get_PVR(void); extern void via_cuda_init(void); +extern void pmac_nvram_init(void); extern void read_rtc_time(void); extern void pmac_find_display(void); extern void giveup_fpu(void); -extern void store_cache_range(unsigned long, unsigned long); extern void cvt_fd(float *from, double *to); extern void cvt_df(double *from, float *to); @@ -53,27 +82,29 @@ extern int do_signal(unsigned long oldmask, struct pt_regs *regs); extern void dump_regs(struct pt_regs *); #ifndef __SMP__ + #define cli() __cli() #define sti() __sti() #define save_flags(flags) __save_flags(flags) #define restore_flags(flags) __restore_flags(flags) -#else -#error need global cli/sti etc. defined for SMP -#endif +#else /* __SMP__ */ -#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) +extern void __global_cli(void); +extern void __global_sti(void); +extern unsigned long __global_save_flags(void); +extern void __global_restore_flags(unsigned long); +#define cli() __global_cli() +#define sti() __global_sti() +#define save_flags(x) ((x)=__global_save_flags()) +#define restore_flags(x) __global_restore_flags(x) -/* this guy lives in arch/ppc/kernel */ -extern inline unsigned long *xchg_u32(void *m, unsigned long val); +#endif /* !__SMP__ */ + +#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) -/* - * these guys don't exist. - * someone should create them. - * -- Cort - */ extern void *xchg_u64(void *ptr, unsigned long val); -extern int xchg_u8(char *m, char val); +extern void *xchg_u32(void *m, unsigned long val); /* * This function doesn't exist, so you'll get a linker error @@ -85,6 +116,9 @@ extern int xchg_u8(char *m, char val); */ extern void __xchg_called_with_bad_pointer(void); +#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) +#define tas(ptr) (xchg((ptr),1)) + static inline unsigned long __xchg(unsigned long x, void * ptr, int size) { switch (size) { @@ -99,13 +133,6 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) } - - -extern inline int tas(char * m) -{ - return xchg_u8(m,1); -} - extern inline void * xchg_ptr(void * m, void * val) { return (void *) xchg_u32(m, (unsigned long) val); diff --git a/include/asm-ppc/termbits.h b/include/asm-ppc/termbits.h index 65cab0612..df1014281 100644 --- a/include/asm-ppc/termbits.h +++ b/include/asm-ppc/termbits.h @@ -125,6 +125,7 @@ struct termios { #define B57600 00020 #define B115200 00021 #define B230400 00022 +#define B460800 00023 #define CSIZE 00001400 #define CS5 00000000 diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h index 46cd67f37..326d7d8e9 100644 --- a/include/asm-sparc/elf.h +++ b/include/asm-sparc/elf.h @@ -1,4 +1,4 @@ -/* $Id: elf.h,v 1.5 1996/08/08 00:06:13 ecd Exp $ */ +/* $Id: elf.h,v 1.7 1997/08/29 17:04:34 richard Exp $ */ #ifndef __ASMSPARC_ELF_H #define __ASMSPARC_ELF_H @@ -30,5 +30,12 @@ typedef unsigned long elf_fpregset_t; #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical + use of this is to invoke "./ld.so someprog" to test out a new version of + the loader. We need to make sure that it is out of the way of the program + that it will "exec", and that there is sufficient room for the brk. */ + +#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000) + #endif /* !(__ASMSPARC_ELF_H) */ diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h index 8ce53ae35..d8f559440 100644 --- a/include/asm-sparc/namei.h +++ b/include/asm-sparc/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.6 1997/07/17 02:24:25 davem Exp $ +/* $Id: namei.h,v 1.8 1997/09/05 12:38:51 jj Exp $ * linux/include/asm-sparc/namei.h * * Routines to handle famous /usr/gnemul/s*. @@ -11,41 +11,40 @@ #define SPARC_BSD_EMUL "usr/gnemul/sunos/" #define SPARC_SOL_EMUL "usr/gnemul/solaris/" -#if 0 /* XXX FIXME */ - -extern int __namei(int, const char *, struct inode *, char *, struct inode **, - struct inode **, struct qstr *, struct dentry **, int *); - -static __inline__ int -__prefix_namei(int retrieve_mode, const char * name, struct inode * base, - char * buf, struct inode ** res_dir, struct inode ** res_inode, - struct qstr * last_name, struct dentry ** last_entry, - int * last_error) +static inline struct dentry * +__sparc_lookup_dentry(const char *name, int follow_link) { int error; - - if (!(current->personality & (PER_BSD|PER_SVR4))) - return -ENOENT; - - while (*name == '/') - name++; - - atomic_inc(¤t->fs->root->i_count); - error = __namei(NAM_FOLLOW_LINK, - current->personality & PER_BSD ? - SPARC_BSD_EMUL : SPARC_SOL_EMUL, current->fs->root, - buf, NULL, &base, NULL, NULL, NULL); - if (error) - return error; - - error = __namei(retrieve_mode, name, base, buf, res_dir, res_inode, - last_name, last_entry, last_error); - if (error) - return error; - - return 0; + struct dentry *base; + + switch (current->personality) { + case PER_BSD: + case PER_SVR4: + break; + default: + return ERR_PTR(-ENOENT); + } + + base = lookup_dentry ((current->personality == PER_BSD) ? + SPARC_BSD_EMUL : SPARC_SOL_EMUL, + dget (current->fs->root), 1); + + if (IS_ERR (base)) return base; + + base = lookup_dentry (name, base, follow_link); + + if (IS_ERR (base)) return base; + + if (!base->d_inode) { + dput(base); + return ERR_PTR(-ENOENT); + } + + return base; } -#endif /* XXX FIXME */ +#define __prefix_lookup_dentry(name, follow_link) \ + dentry = __sparc_lookup_dentry (name, follow_link); \ + if (!IS_ERR (dentry)) return dentry; #endif /* __SPARC_NAMEI_H */ diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index de8ce5687..dd6428edf 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.62 1997/06/27 14:55:00 jj Exp $ */ +/* $Id: pgtable.h,v 1.63 1997/08/13 04:44:15 paulus Exp $ */ #ifndef _SPARC_PGTABLE_H #define _SPARC_PGTABLE_H @@ -298,6 +298,7 @@ extern void (*flush_cache_mm)(struct mm_struct *); extern void (*flush_cache_range)(struct mm_struct *, unsigned long start, unsigned long end); extern void (*flush_cache_page)(struct vm_area_struct *, unsigned long address); +#define flush_icache_range(start, end) do { } while (0) extern void (*flush_tlb_all)(void); extern void (*flush_tlb_mm)(struct mm_struct *); diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h index 12baf0222..33341d399 100644 --- a/include/asm-sparc64/atomic.h +++ b/include/asm-sparc64/atomic.h @@ -1,4 +1,4 @@ -/* $Id: atomic.h,v 1.15 1997/07/03 09:18:09 davem Exp $ +/* $Id: atomic.h,v 1.18 1997/08/07 03:38:31 davem Exp $ * atomic.h: Thankfully the V9 is at least reasonable for this * stuff. * @@ -23,29 +23,29 @@ typedef struct { int counter; } atomic_t; extern __inline__ void atomic_add(int i, atomic_t *v) { __asm__ __volatile__(" -1: lduw [%1], %%g1 - add %%g1, %0, %%g2 - cas [%1], %%g1, %%g2 - sub %%g1, %%g2, %%g1 - brnz,pn %%g1, 1b +1: lduw [%1], %%g5 + add %%g5, %0, %%g7 + cas [%1], %%g5, %%g7 + sub %%g5, %%g7, %%g5 + brnz,pn %%g5, 1b nop" : /* No outputs */ : "HIr" (i), "r" (__atomic_fool_gcc(v)) - : "g1", "g2"); + : "g5", "g7", "memory"); } extern __inline__ void atomic_sub(int i, atomic_t *v) { __asm__ __volatile__(" -1: lduw [%1], %%g1 - sub %%g1, %0, %%g2 - cas [%1], %%g1, %%g2 - sub %%g1, %%g2, %%g1 - brnz,pn %%g1, 1b +1: lduw [%1], %%g5 + sub %%g5, %0, %%g7 + cas [%1], %%g5, %%g7 + sub %%g5, %%g7, %%g5 + brnz,pn %%g5, 1b nop" : /* No outputs */ : "HIr" (i), "r" (__atomic_fool_gcc(v)) - : "g1", "g2"); + : "g5", "g7", "memory"); } /* Same as above, but return the result value. */ @@ -53,15 +53,15 @@ extern __inline__ int atomic_add_return(int i, atomic_t *v) { unsigned long oldval; __asm__ __volatile__(" -1: lduw [%2], %%g1 - add %%g1, %1, %%g2 - cas [%2], %%g1, %%g2 - sub %%g1, %%g2, %%g1 - brnz,pn %%g1, 1b - add %%g2, %1, %0" +1: lduw [%2], %%g5 + add %%g5, %1, %%g7 + cas [%2], %%g5, %%g7 + sub %%g5, %%g7, %%g5 + brnz,pn %%g5, 1b + add %%g7, %1, %0" : "=&r" (oldval) : "HIr" (i), "r" (__atomic_fool_gcc(v)) - : "g1", "g2"); + : "g5", "g7", "memory"); return (int)oldval; } @@ -69,15 +69,15 @@ extern __inline__ int atomic_sub_return(int i, atomic_t *v) { unsigned long oldval; __asm__ __volatile__(" -1: lduw [%2], %%g1 - sub %%g1, %1, %%g2 - cas [%2], %%g1, %%g2 - sub %%g1, %%g2, %%g1 - brnz,pn %%g1, 1b - sub %%g2, %1, %0" +1: lduw [%2], %%g5 + sub %%g5, %1, %%g7 + cas [%2], %%g5, %%g7 + sub %%g5, %%g7, %%g5 + brnz,pn %%g5, 1b + sub %%g7, %1, %0" : "=&r" (oldval) : "HIr" (i), "r" (__atomic_fool_gcc(v)) - : "g1", "g2"); + : "g5", "g7", "memory"); return (int)oldval; } diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h index f0d11e6ef..ab4523e9d 100644 --- a/include/asm-sparc64/bitops.h +++ b/include/asm-sparc64/bitops.h @@ -1,7 +1,7 @@ -/* $Id: bitops.h,v 1.19 1997/07/08 10:17:37 davem Exp $ +/* $Id: bitops.h,v 1.22 1997/08/07 02:54:04 davem Exp $ * bitops.h: Bit string operations on the V9. * - * Copyright 1996 David S. Miller (davem@caip.rutgers.edu) + * Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu) */ #ifndef _SPARC64_BITOPS_H @@ -21,84 +21,117 @@ extern __inline__ unsigned long test_and_set_bit(unsigned long nr, void *addr) { - unsigned long oldbit; - unsigned long temp0, temp1; unsigned long * m = ((unsigned long *) addr) + (nr >> 6); + unsigned long oldbit; __asm__ __volatile__(" - ldx [%4], %0 -1: - andcc %0, %3, %2 +1: ldx [%2], %%g7 + andcc %%g7, %1, %0 bne,pn %%xcc, 2f - xor %0, %3, %1 - casx [%4], %0, %1 - cmp %0, %1 - bne,a,pn %%xcc, 1b - ldx [%4], %0 + xor %%g7, %1, %%g5 + casx [%2], %%g7, %%g5 + cmp %%g7, %%g5 + bne,pn %%xcc, 1b + nop 2: -" : "=&r" (temp0), "=&r" (temp1), "=&r" (oldbit) +" : "=&r" (oldbit) : "HIr" (1UL << (nr & 63)), "r" (m) - : "cc"); + : "g5", "g7", "cc", "memory"); return oldbit != 0; } extern __inline__ void set_bit(unsigned long nr, void *addr) { - (void) test_and_set_bit(nr, addr); + unsigned long * m = ((unsigned long *) addr) + (nr >> 6); + + __asm__ __volatile__(" +1: ldx [%1], %%g7 + andcc %%g7, %0, %%g0 + bne,pn %%xcc, 2f + xor %%g7, %0, %%g5 + casx [%1], %%g7, %%g5 + cmp %%g7, %%g5 + bne,pn %%xcc, 1b + nop +2: +" : /* no outputs */ + : "HIr" (1UL << (nr & 63)), "r" (m) + : "g5", "g7", "cc", "memory"); } extern __inline__ unsigned long test_and_clear_bit(unsigned long nr, void *addr) { - unsigned long oldbit; - unsigned long temp0, temp1; unsigned long * m = ((unsigned long *) addr) + (nr >> 6); + unsigned long oldbit; __asm__ __volatile__(" - ldx [%4], %0 -1: - andcc %0, %3, %2 +1: ldx [%2], %%g7 + andcc %%g7, %1, %0 be,pn %%xcc, 2f - xor %0, %3, %1 - casx [%4], %0, %1 - cmp %0, %1 - bne,a,pn %%xcc, 1b - ldx [%4], %0 + xor %%g7, %1, %%g5 + casx [%2], %%g7, %%g5 + cmp %%g7, %%g5 + bne,pn %%xcc, 1b + nop 2: -" : "=&r" (temp0), "=&r" (temp1), "=&r" (oldbit) +" : "=&r" (oldbit) : "HIr" (1UL << (nr & 63)), "r" (m) - : "cc"); + : "g5", "g7", "cc", "memory"); return oldbit != 0; } extern __inline__ void clear_bit(unsigned long nr, void *addr) { - (void) test_and_clear_bit(nr, addr); + unsigned long * m = ((unsigned long *) addr) + (nr >> 6); + + __asm__ __volatile__(" +1: ldx [%1], %%g7 + andcc %%g7, %0, %%g0 + be,pn %%xcc, 2f + xor %%g7, %0, %%g5 + casx [%1], %%g7, %%g5 + cmp %%g7, %%g5 + bne,pn %%xcc, 1b + nop +2: +" : /* no outputs */ + : "HIr" (1UL << (nr & 63)), "r" (m) + : "g5", "g7", "cc", "memory"); } extern __inline__ unsigned long test_and_change_bit(unsigned long nr, void *addr) { - unsigned long oldbit; - unsigned long temp0, temp1; unsigned long * m = ((unsigned long *) addr) + (nr >> 6); + unsigned long oldbit; __asm__ __volatile__(" - ldx [%4], %0 -1: - and %0, %3, %2 - xor %0, %3, %1 - casx [%4], %0, %1 - cmp %0, %1 - bne,a,pn %%xcc, 1b - ldx [%4], %0 -" : "=&r" (temp0), "=&r" (temp1), "=&r" (oldbit) +1: ldx [%2], %%g7 + and %%g7, %1, %0 + xor %%g7, %1, %%g5 + casx [%2], %%g7, %%g5 + cmp %%g7, %%g5 + bne,pn %%xcc, 1b + nop +" : "=&r" (oldbit) : "HIr" (1UL << (nr & 63)), "r" (m) - : "cc"); + : "g5", "g7", "cc", "memory"); return oldbit != 0; } extern __inline__ void change_bit(unsigned long nr, void *addr) { - (void) test_and_change_bit(nr, addr); + unsigned long * m = ((unsigned long *) addr) + (nr >> 6); + + __asm__ __volatile__(" +1: ldx [%1], %%g7 + xor %%g7, %0, %%g5 + casx [%1], %%g7, %%g5 + cmp %%g7, %%g5 + bne,pn %%xcc, 1b + nop +" : /* no outputs */ + : "HIr" (1UL << (nr & 63)), "r" (m) + : "g5", "g7", "cc", "memory"); } extern __inline__ unsigned long test_bit(int nr, __const__ void *addr) @@ -201,47 +234,43 @@ found_middle: */ extern __inline__ int set_le_bit(int nr,void * addr) { - unsigned long oldbit; - unsigned long temp0, temp1; unsigned int * m = ((unsigned int *) addr) + (nr >> 5); + unsigned long oldbit; __asm__ __volatile__(" - lduwa [%4] %5, %0 -1: - andcc %0, %3, %2 +1: lduwa [%2] %3, %%g7 + andcc %%g7, %1, %0 bne,pn %%icc, 2f - xor %0, %3, %1 - casa [%4] %5, %0, %1 - cmp %0, %1 - bne,a,pn %%icc, 1b - lduwa [%4] %5, %0 + xor %%g7, %1, %%g5 + casa [%2] %3, %%g7, %%g5 + cmp %%g7, %%g5 + bne,pn %%icc, 1b + nop 2: -" : "=&r" (temp0), "=&r" (temp1), "=&r" (oldbit) +" : "=&r" (oldbit) : "HIr" (1UL << (nr & 31)), "r" (m), "i" (ASI_PL) - : "cc"); + : "g5", "g7", "cc", "memory"); return oldbit != 0; } extern __inline__ int clear_le_bit(int nr, void * addr) { - unsigned long oldbit; - unsigned long temp0, temp1; unsigned int * m = ((unsigned int *) addr) + (nr >> 5); + unsigned long oldbit; __asm__ __volatile__(" - lduwa [%4] %5, %0 -1: - andcc %0, %3, %2 +1: lduwa [%2] %3, %%g7 + andcc %%g7, %1, %0 be,pn %%icc, 2f - xor %0, %3, %1 - casa [%4] %5, %0, %1 - cmp %0, %1 - bne,a,pn %%icc, 1b - lduwa [%4] %5, %0 + xor %%g7, %1, %%g5 + casa [%2] %3, %%g7, %%g5 + cmp %%g7, %%g5 + bne,pn %%icc, 1b + nop 2: -" : "=&r" (temp0), "=&r" (temp1), "=&r" (oldbit) +" : "=&r" (oldbit) : "HIr" (1UL << (nr & 31)), "r" (m), "i" (ASI_PL) - : "cc"); + : "g5", "g7", "cc", "memory"); return oldbit != 0; } diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h index b1ff474c3..bb32044c0 100644 --- a/include/asm-sparc64/checksum.h +++ b/include/asm-sparc64/checksum.h @@ -1,4 +1,4 @@ -/* $Id: checksum.h,v 1.9 1997/06/26 04:05:17 davem Exp $ */ +/* $Id: checksum.h,v 1.10 1997/08/09 18:09:03 jj Exp $ */ #ifndef __SPARC64_CHECKSUM_H #define __SPARC64_CHECKSUM_H @@ -42,47 +42,25 @@ extern unsigned int csum_partial(unsigned char * buff, int len, unsigned int sum csum_partial_copy_nocheck(src,dst,len,sum) #define csum_partial_copy_fromuser(s, d, l, w) \ csum_partial_copy_from_user((char *) (s), (d), (l), (w), NULL) + +extern unsigned int csum_partial_copy_sparc64(const char *src, char *dst, int len, unsigned int sum); extern __inline__ unsigned int csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) { - register unsigned long ret asm("o0") = (unsigned long)src; - register char *d asm("o1") = dst; - register unsigned long l asm("g1") = len; - - __asm__ __volatile__ (" - wr %%g0, %5, %%asi - call __csum_partial_copy_sparc_generic - mov %4, %%g7 - srl %%o0, 0, %%o0 - " : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (sum), "i" (ASI_P) : - "o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g5", "g7"); - return (unsigned int)ret; + __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "i" (ASI_P)); + return csum_partial_copy_sparc64(src, dst, len, sum); } extern __inline__ unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, unsigned int sum, int *err) { - register unsigned long ret asm("o0") = (unsigned long)src; - register char *d asm("o1") = dst; - register unsigned long l asm("g1") = len; - register unsigned long s asm("g7") = sum; - - __asm__ __volatile__ (" - .section __ex_table,#alloc - .align 8 - .xword 1f,2 - .previous - wr %%g0, %6, %%asi -1: - call __csum_partial_copy_sparc_generic - stx %5, [%%sp + 0x7ff + 128] - srl %%o0, 0, %%o0 - " : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (s), "r" (err), "i" (ASI_S) : - "o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g5", "g7"); - return (unsigned int)ret; + __asm__ __volatile__ ("wr %%g0, %0, %%asi + stx %1, [%%sp + 0x7ff + 128] + " : : "i" (ASI_S), "r" (err)); + return csum_partial_copy_sparc64(src, dst, len, sum); } #if 0 diff --git a/include/asm-sparc64/delay.h b/include/asm-sparc64/delay.h index f70d99b68..eac45ef9a 100644 --- a/include/asm-sparc64/delay.h +++ b/include/asm-sparc64/delay.h @@ -1,4 +1,4 @@ -/* $Id: delay.h,v 1.5 1997/06/18 12:36:23 jj Exp $ +/* $Id: delay.h,v 1.6 1997/07/29 21:11:22 davem Exp $ * delay.h: Linux delay routines on the V9. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu). @@ -7,7 +7,9 @@ #ifndef __SPARC64_DELAY_H #define __SPARC64_DELAY_H -extern unsigned long loops_per_sec; +#ifdef __SMP__ +#include <asm/smp.h> +#endif extern __inline__ void __delay(unsigned long loops) { @@ -23,7 +25,7 @@ extern __inline__ void __delay(unsigned long loops) : "cc"); } -extern __inline__ void udelay(unsigned long usecs) +extern __inline__ void __udelay(unsigned long usecs, unsigned long lps) { usecs *= 0x00000000000010c6UL; /* 2**32 / 1000000 */ @@ -31,11 +33,19 @@ extern __inline__ void udelay(unsigned long usecs) mulx %1, %2, %0 srlx %0, 32, %0 " : "=r" (usecs) - : "r" (usecs), "r" (loops_per_sec)); + : "r" (usecs), "r" (lps)); __delay(usecs); } +#ifdef __SMP__ +#define __udelay_val cpu_data[smp_processor_id()].udelay_val +#else +#define __udelay_val loops_per_sec +#endif + +#define udelay(usecs) __udelay((usecs),__udelay_val) + extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c) { return (a*b)/c; diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h new file mode 100644 index 000000000..0fe16f474 --- /dev/null +++ b/include/asm-sparc64/ebus.h @@ -0,0 +1,97 @@ +/* $Id: ebus.h,v 1.3 1997/09/05 23:00:14 ecd Exp $ + * ebus.h: PCI to Ebus pseudo driver software state. + * + * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) + */ + +#ifndef __SPARC64_EBUS_H +#define __SPARC64_EBUS_H + +#include <asm/oplib.h> + +struct linux_ebus_child { + struct linux_ebus_child *next; + struct linux_ebus_device *parent; + int prom_node; + char prom_name[64]; + unsigned long base_address[PROMREG_MAX]; + int num_addrs; + unsigned int irqs[PROMINTR_MAX]; + int num_irqs; +}; + +struct linux_ebus_device { + struct linux_ebus_device *next; + struct linux_ebus_child *children; + struct linux_ebus *parent; + int prom_node; + char prom_name[64]; + unsigned long base_address[PROMREG_MAX]; + int num_addrs; + unsigned int irqs[PROMINTR_MAX]; + int num_irqs; +}; + +struct linux_ebus { + struct linux_ebus *next; + struct linux_ebus_device *devices; + struct linux_pbm_info *parent; + struct pci_dev *self; + int prom_node; + char prom_name[64]; + struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX]; + int num_ebus_ranges; +}; + +struct linux_ebus_dma { + unsigned int dcsr; + unsigned int dacr; + unsigned int dbcr; +}; + +#define EBUS_DCSR_INT_PEND 0x00000001 +#define EBUS_DCSR_ERR_PEND 0x00000002 +#define EBUS_DCSR_DRAIN 0x00000004 +#define EBUS_DCSR_INT_EN 0x00000010 +#define EBUS_DCSR_RESET 0x00000080 +#define EBUS_DCSR_WRITE 0x00000100 +#define EBUS_DCSR_EN_DMA 0x00000200 +#define EBUS_DCSR_CYC_PEND 0x00000400 +#define EBUS_DCSR_DIAG_RD_DONE 0x00000800 +#define EBUS_DCSR_DIAG_WR_DONE 0x00001000 +#define EBUS_DCSR_EN_CNT 0x00002000 +#define EBUS_DCSR_TC 0x00004000 +#define EBUS_DCSR_DIS_CSR_DRN 0x00010000 +#define EBUS_DCSR_BURST_SZ_MASK 0x000c0000 +#define EBUS_DCSR_BURST_SZ_1 0x00080000 +#define EBUS_DCSR_BURST_SZ_4 0x00000000 +#define EBUS_DCSR_BURST_SZ_8 0x00040000 +#define EBUS_DCSR_BURST_SZ_16 0x000c0000 +#define EBUS_DCSR_DIAG_EN 0x00100000 +#define EBUS_DCSR_DIS_ERR_PEND 0x00400000 +#define EBUS_DCSR_TCI_DIS 0x00800000 +#define EBUS_DCSR_EN_NEXT 0x01000000 +#define EBUS_DCSR_DMA_ON 0x02000000 +#define EBUS_DCSR_A_LOADED 0x04000000 +#define EBUS_DCSR_NA_LOADED 0x08000000 +#define EBUS_DCSR_DEV_ID_MASK 0xf0000000 + +extern struct linux_ebus *ebus_chain; + +extern unsigned long ebus_init(unsigned long, unsigned long); + +#define for_each_ebus(bus) \ + for((bus) = ebus_chain; (bus); (bus) = (bus)->next) + +#define for_each_ebusdev(dev, bus) \ + for((dev) = (bus)->devices; (dev); (dev) = (dev)->next) + +#define for_each_edevchild(dev, child) \ + for((child) = (dev)->children; (child); (child) = (child)->next) + +#define for_all_ebusdev(dev, bus) \ + for ((bus) = ebus_chain, ((dev) = (bus) ? (bus)->devices : 0); \ + (bus); ((dev) = (dev)->next ? (dev)->next : \ + ((bus) = (bus)->next, (bus) ? (bus)->devices : 0))) + +#endif /* !(__SPARC64_EBUS_H) */ diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h index 1cef89ff1..39b07b166 100644 --- a/include/asm-sparc64/elf.h +++ b/include/asm-sparc64/elf.h @@ -1,4 +1,4 @@ -/* $Id: elf.h,v 1.7 1997/06/14 21:28:07 davem Exp $ */ +/* $Id: elf.h,v 1.8 1997/08/21 18:09:07 richard Exp $ */ #ifndef __ASM_SPARC64_ELF_H #define __ASM_SPARC64_ELF_H @@ -39,4 +39,13 @@ typedef unsigned long elf_fpregset_t; #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 8192 +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical + use of this is to invoke "./ld.so someprog" to test out a new version of + the loader. We need to make sure that it is out of the way of the program + that it will "exec", and that there is sufficient room for the brk. */ + +#ifndef ELF_ET_DYN_BASE +#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) +#endif + #endif /* !(__ASM_SPARC64_ELF_H) */ diff --git a/include/asm-sparc64/fbio.h b/include/asm-sparc64/fbio.h index 6d2f1e730..c890793ed 100644 --- a/include/asm-sparc64/fbio.h +++ b/include/asm-sparc64/fbio.h @@ -36,6 +36,9 @@ /* Does not seem to be listed in the Sun file either */ #define FBTYPE_CREATOR 22 +#define FBTYPE_PCI_GENERIC 1000 +#define FBTYPE_PCI_MACH64 1001 + /* fbio ioctls */ /* Returned by FBIOGTYPE */ struct fbtype { diff --git a/include/asm-sparc64/fhc.h b/include/asm-sparc64/fhc.h new file mode 100644 index 000000000..487a40389 --- /dev/null +++ b/include/asm-sparc64/fhc.h @@ -0,0 +1,45 @@ +/* $Id: fhc.h,v 1.1 1997/08/08 04:26:40 davem Exp $ + * fhc.h: Structures for central/fhc pseudo driver on Sunfire/Starfire/Wildfire. + * + * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) + */ + +#ifndef _SPARC64_FHC_H +#define _SPARC64_FHC_H + +#include <asm/firehose.h> +#include <asm/oplib.h> + +struct linux_fhc; + +struct linux_central { + struct linux_fhc *child; + int prom_node; + char prom_name[64]; + + struct linux_prom_ranges central_ranges[PROMREG_MAX]; + int num_central_ranges; +}; + +struct linux_fhc { + struct linux_fhc *next; + struct linux_central *parent; /* NULL if not central FHC */ + struct fhc_regs fhc_regs; + int prom_node; + char prom_name[64]; + + struct linux_prom_ranges fhc_ranges[PROMREG_MAX]; + int num_fhc_ranges; +}; + +extern struct linux_central *central_bus; + +extern void prom_apply_central_ranges(struct linux_central *central, + struct linux_prom_registers *regs, + int nregs); + +extern void prom_apply_fhc_ranges(struct linux_fhc *fhc, + struct linux_prom_registers *regs, + int nregs); + +#endif /* !(_SPARC64_FHC_H) */ diff --git a/include/asm-sparc64/firehose.h b/include/asm-sparc64/firehose.h index 931671d4f..e4f4bb7e7 100644 --- a/include/asm-sparc64/firehose.h +++ b/include/asm-sparc64/firehose.h @@ -1,6 +1,6 @@ -/* $Id: firehose.h,v 1.1 1997/04/11 02:38:47 davem Exp $ +/* $Id: firehose.h,v 1.2 1997/08/08 04:26:31 davem Exp $ * firehose.h: Defines for the Fire Hose Controller (FHC) found - * on Sunfire/Wildfire systems. + * on Sunfire/Starfire/Wildfire systems. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) */ @@ -33,38 +33,38 @@ struct fhc_internal_regs { * for the FHC, thus we have the following few structs... */ struct fhc_ign_reg { -/*0x2000*/ u64 fhc_ign; /* FHC Interrupt Group Number */ +/*0x2000*/ u64 fhc_ign; /* FHC Interrupt Group Number */ }; struct fhc_fanfail_regs { -/*0x4000*/ u64 fhc_ff_imap; /* FHC FanFail Interrupt Map */ - u64 _unused1; -/*0x4010*/ u64 fhc_ff_istate; /* FHC FanFail Interrupt State */ +/*0x4000*/ u32 _pad0, fhc_ff_imap; /* FHC FanFail Interrupt Map */ + u64 _pad1; +/*0x4010*/ u32 _pad2, fhc_ff_iclr; /* FHC FanFail Interrupt Clear */ }; struct fhc_system_regs { -/*0x6000*/ u64 fhc_sys_imap; /* FHC System Interrupt Map */ - u64 _unused1; -/*0x6010*/ u64 fhc_sys_istate; /* FHC System Interrupt State */ +/*0x6000*/ u32 _pad0, fhc_sys_imap; /* FHC System Interrupt Map */ + u64 _pad1; +/*0x6010*/ u32 _pad2, fhc_sys_iclr; /* FHC System Interrupt Clear */ }; struct fhc_uart_regs { -/*0x8000*/ u64 fhc_uart_imap; /* FHC UART Interrupt Map */ - u64 _unused1; -/*0x8010*/ u64 fhc_uart_istate;/* FHC UART Interrupt State */ +/*0x8000*/ u32 _pad0, fhc_uart_imap; /* FHC UART Interrupt Map */ + u64 _pad1; +/*0x8010*/ u32 _pad2, fhc_uart_iclr; /* FHC UART Interrupt Clear */ }; struct fhc_tod_regs { -/*0xa000*/ u64 fhc_tod_imap; /* FHC TOD Interrupt Map */ - u64 _unused1; -/*0xa010*/ u64 fhc_tod_istate; /* FHC TOD Interrupt State */ +/*0xa000*/ u32 _pad0, fhc_tod_imap; /* FHC TOD Interrupt Map */ + u64 _pad1; +/*0xa010*/ u32 _pad2, fhc_tod_iclr; /* FHC TOD Interrupt Clear */ }; /* All of the above. */ struct fhc_regs { struct fhc_internal_regs *pregs; struct fhc_ign_reg *ireg; - struct fhc_fanfil_regs *ffregs; + struct fhc_fanfail_regs *ffregs; struct fhc_system_regs *sregs; struct fhc_uart_regs *uregs; struct fhc_tod_regs *tregs; diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h index bbef85483..48d46a9f6 100644 --- a/include/asm-sparc64/floppy.h +++ b/include/asm-sparc64/floppy.h @@ -1,13 +1,17 @@ -/* $Id: floppy.h,v 1.3 1997/07/11 03:03:22 davem Exp $ +/* $Id: floppy.h,v 1.4 1997/09/05 23:00:15 ecd Exp $ * asm-sparc64/floppy.h: Sparc specific parts of the Floppy driver. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + * + * Ultra/PCI support added: Sep 1997 Eddie C. Dost (ecd@skynet.be) */ #ifndef __ASM_SPARC64_FLOPPY_H #define __ASM_SPARC64_FLOPPY_H +#include <linux/config.h> + #include <asm/page.h> #include <asm/pgtable.h> #include <asm/system.h> @@ -23,19 +27,12 @@ * 3) Intel 82077 controller manual */ struct sun_flpy_controller { - volatile unsigned char status_82072; /* Main Status reg. */ -#define dcr_82072 status_82072 /* Digital Control reg. */ -#define status1_82077 status_82072 /* Auxiliary Status reg. 1 */ - - volatile unsigned char data_82072; /* Data fifo. */ -#define status2_82077 data_82072 /* Auxiliary Status reg. 2 */ - + volatile unsigned char status1_82077; /* Auxiliary Status reg. 1 */ + volatile unsigned char status2_82077; /* Auxiliary Status reg. 2 */ volatile unsigned char dor_82077; /* Digital Output reg. */ volatile unsigned char tapectl_82077; /* What the? Tape control reg? */ - volatile unsigned char status_82077; /* Main Status Register. */ #define drs_82077 status_82077 /* Digital Rate Select reg. */ - volatile unsigned char data_82077; /* Data fifo. */ volatile unsigned char ___unused; volatile unsigned char dir_82077; /* Digital Input reg. */ @@ -47,27 +44,43 @@ static struct sun_flpy_controller *sun_fdc = NULL; volatile unsigned char *fdc_status; struct sun_floppy_ops { - unsigned char (*fd_inb)(int port); - void (*fd_outb)(unsigned char value, int port); + unsigned char (*fd_inb) (unsigned long port); + void (*fd_outb) (unsigned char value, unsigned long port); + void (*fd_enable_dma) (void); + void (*fd_disable_dma) (void); + void (*fd_set_dma_mode) (int); + void (*fd_set_dma_addr) (char *); + void (*fd_set_dma_count) (int); + unsigned int (*get_dma_residue) (void); + void (*fd_enable_irq) (void); + void (*fd_disable_irq) (void); + int (*fd_request_irq) (void); + void (*fd_free_irq) (void); + int (*fd_eject) (int); }; static struct sun_floppy_ops sun_fdops; -#define fd_inb(port) sun_fdops.fd_inb(port) -#define fd_outb(value,port) sun_fdops.fd_outb(value,port) -#define fd_enable_dma() sun_fd_enable_dma() -#define fd_disable_dma() sun_fd_disable_dma() -#define fd_request_dma() (0) /* nothing... */ -#define fd_free_dma() /* nothing... */ -#define fd_clear_dma_ff() /* nothing... */ -#define fd_set_dma_mode(mode) sun_fd_set_dma_mode(mode) -#define fd_set_dma_addr(addr) sun_fd_set_dma_addr(addr) -#define fd_set_dma_count(count) sun_fd_set_dma_count(count) -#define fd_enable_irq() /* nothing... */ -#define fd_disable_irq() /* nothing... */ +#define fd_inb(port) sun_fdops.fd_inb(port) +#define fd_outb(value,port) sun_fdops.fd_outb(value,port) + +#define fd_enable_dma(channel) sun_fdops.fd_enable_dma() +#define fd_disable_dma(channel) sun_fdops.fd_disable_dma() +#define fd_request_dma(channel) (0) /* nothing... */ +#define fd_free_dma(channel) /* nothing... */ +#define fd_clear_dma_ff(channel) /* nothing... */ +#define fd_set_dma_mode(channel,mode) sun_fdops.fd_set_dma_mode(mode) +#define fd_set_dma_addr(channel,addr) sun_fdops.fd_set_dma_addr(addr) +#define fd_set_dma_count(channel,count) sun_fdops.fd_set_dma_count(count) +#define get_dma_residue(channel,x) sun_fdops.get_dma_residue() + +#define fd_enable_irq(irq) /* nothing... */ +#define fd_disable_irq(irq) /* nothing... */ +#define fd_request_irq(irq) sun_fd_request_irq() +#define fd_free_irq(irq) /* nothing... */ + +#define fd_eject(drive) sun_fdops.fd_eject(drive) #define fd_cacheflush(addr, size) /* nothing... */ -#define fd_request_irq() sun_fd_request_irq() -#define fd_free_irq() /* nothing... */ #if 0 /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */ #define fd_dma_mem_alloc(size) ((unsigned long) vmalloc(size)) #define fd_dma_mem_free(addr,size) (vfree((void *)(addr))) @@ -94,7 +107,7 @@ static struct sun_floppy_ops sun_fdops; */ #define FDC1 sun_floppy_init() -static int FDC2=-1; +static int FDC2 = -1; #define N_FDC 1 #define N_DRIVE 8 @@ -102,63 +115,11 @@ static int FDC2=-1; /* No 64k boundary crossing problems on the Sparc. */ #define CROSS_64KB(a,s) (0) -/* Routines unique to each controller type on a Sun. */ -static unsigned char sun_82072_fd_inb(int port) -{ - switch(port & 7) { - default: - printk("floppy: Asked to read unknown port %d\n", port); - panic("floppy: Port bolixed."); - case 4: /* FD_STATUS */ - return sun_fdc->status_82072 & ~STATUS_DMA; - case 5: /* FD_DATA */ - return sun_fdc->data_82072; - case 7: /* FD_DIR */ - return (*AUXREG & AUXIO_FLPY_DCHG)? 0x80: 0; - }; - panic("sun_82072_fd_inb: How did I get here?"); -} - -static void sun_82072_fd_outb(unsigned char value, int port) -{ - switch(port & 7) { - default: - printk("floppy: Asked to write to unknown port %d\n", port); - panic("floppy: Port bolixed."); - case 2: /* FD_DOR */ - /* Oh geese, 82072 on the Sun has no DOR register, - * the functionality is implemented via the AUXIO - * I/O register. So we must emulate the behavior. - * - * ASSUMPTIONS: There will only ever be one floppy - * drive attached to a Sun controller - * and it will be at drive zero. - */ - { - unsigned bits = 0; - if (value & 0x10) bits |= AUXIO_FLPY_DSEL; - if ((value & 0x80) == 0) bits |= AUXIO_FLPY_EJCT; - set_auxio(bits, (~bits) & (AUXIO_FLPY_DSEL|AUXIO_FLPY_EJCT)); - } - break; - case 5: /* FD_DATA */ - sun_fdc->data_82072 = value; - break; - case 7: /* FD_DCR */ - sun_fdc->dcr_82072 = value; - break; - case 4: /* FD_STATUS */ - sun_fdc->status_82072 = value; - break; - }; - return; -} - -static unsigned char sun_82077_fd_inb(int port) +static unsigned char sun_82077_fd_inb(unsigned long port) { switch(port & 7) { default: - printk("floppy: Asked to read unknown port %d\n", port); + printk("floppy: Asked to read unknown port %lx\n", port); panic("floppy: Port bolixed."); case 4: /* FD_STATUS */ return sun_fdc->status_82077 & ~STATUS_DMA; @@ -171,11 +132,11 @@ static unsigned char sun_82077_fd_inb(int port) panic("sun_82072_fd_inb: How did I get here?"); } -static void sun_82077_fd_outb(unsigned char value, int port) +static void sun_82077_fd_outb(unsigned char value, unsigned long port) { switch(port & 7) { default: - printk("floppy: Asked to write to unknown port %d\n", port); + printk("floppy: Asked to write to unknown port %lx\n", port); panic("floppy: Port bolixed."); case 2: /* FD_DOR */ /* Happily, the 82077 has a real DOR register. */ @@ -218,7 +179,7 @@ static __inline__ void virtual_dma_init(void) /* nothing... */ } -static __inline__ void sun_fd_disable_dma(void) +static void sun_fd_disable_dma(void) { doing_pdma = 0; if (pdma_base) { @@ -227,7 +188,7 @@ static __inline__ void sun_fd_disable_dma(void) } } -static __inline__ void sun_fd_set_dma_mode(int mode) +static void sun_fd_set_dma_mode(int mode) { switch(mode) { case DMA_MODE_READ: @@ -242,17 +203,17 @@ static __inline__ void sun_fd_set_dma_mode(int mode) } } -static __inline__ void sun_fd_set_dma_addr(char *buffer) +static void sun_fd_set_dma_addr(char *buffer) { pdma_vaddr = buffer; } -static __inline__ void sun_fd_set_dma_count(int length) +static void sun_fd_set_dma_count(int length) { pdma_size = length; } -static __inline__ void sun_fd_enable_dma(void) +static void sun_fd_enable_dma(void) { pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size); pdma_base = pdma_vaddr; @@ -274,23 +235,207 @@ static int sun_fd_request_irq(void) } else return 0; } +static void sun_fd_enable_irq(void) +{ +} + +static void sun_fd_disable_irq(void) +{ +} + +static void sun_fd_free_irq(void) +{ +} + +static unsigned int sun_get_dma_residue(void) +{ + /* XXX This isn't really correct. XXX */ + return 0; +} + +static int sun_fd_eject(int drive) +{ + set_dor(0x00, 0xff, 0x90); + udelay(500); + set_dor(0x00, 0x6f, 0x00); + udelay(500); + return 0; +} + +#ifdef CONFIG_PCI +#include <asm/ebus.h> + +static struct linux_ebus_dma *sun_fd_ebus_dma; + +extern void floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs); + +static unsigned char sun_pci_fd_inb(unsigned long port) +{ + return inb(port); +} + +static void sun_pci_fd_outb(unsigned char val, unsigned long port) +{ + outb(val, port); +} + +static void sun_pci_fd_enable_dma(void) +{ + unsigned int dcsr; + + dcsr = readl((unsigned long)&sun_fd_ebus_dma->dcsr); + dcsr |= (EBUS_DCSR_EN_DMA | EBUS_DCSR_EN_CNT); + writel(dcsr, (unsigned long)&sun_fd_ebus_dma->dcsr); +} + +static void sun_pci_fd_disable_dma(void) +{ + unsigned int dcsr; + + dcsr = readl((unsigned long)&sun_fd_ebus_dma->dcsr); + dcsr &= ~(EBUS_DCSR_EN_DMA | EBUS_DCSR_EN_CNT); + writel(dcsr, (unsigned long)&sun_fd_ebus_dma->dcsr); +} + +static void sun_pci_fd_set_dma_mode(int mode) +{ + unsigned int dcsr; + + dcsr = readl((unsigned long)&sun_fd_ebus_dma->dcsr); + /* + * For EBus WRITE means to system memory, which is + * READ for us. + */ + if (mode == DMA_MODE_WRITE) + dcsr &= ~(EBUS_DCSR_WRITE); + else + dcsr |= EBUS_DCSR_WRITE; + writel(dcsr, (unsigned long)&sun_fd_ebus_dma->dcsr); +} + +static void sun_pci_fd_set_dma_count(int length) +{ + writel(length, (unsigned long)&sun_fd_ebus_dma->dbcr); +} + +static void sun_pci_fd_set_dma_addr(char *buffer) +{ + unsigned int addr; + + addr = virt_to_bus(buffer); + writel(addr, (unsigned long)&sun_fd_ebus_dma->dacr); +} + +static void sun_pci_fd_enable_irq(void) +{ + unsigned int dcsr; + + dcsr = readl((unsigned long)&sun_fd_ebus_dma->dcsr); + dcsr |= EBUS_DCSR_INT_EN; + writel(dcsr, (unsigned long)&sun_fd_ebus_dma->dcsr); +} + +static void sun_pci_fd_disable_irq(void) +{ + unsigned int dcsr; + + dcsr = readl((unsigned long)&sun_fd_ebus_dma->dcsr); + dcsr &= ~(EBUS_DCSR_INT_EN); + writel(dcsr, (unsigned long)&sun_fd_ebus_dma->dcsr); +} + +static int sun_pci_fd_request_irq(void) +{ + int error; + + error = request_irq(FLOPPY_IRQ, floppy_interrupt, SA_SHIRQ, "floppy", sun_fdc); + return ((error == 0) ? 0 : -1); +} + +static void sun_pci_fd_free_irq(void) +{ + free_irq(FLOPPY_IRQ, sun_fdc); +} + +static unsigned int sun_pci_get_dma_residue(void) +{ + unsigned int res; + + res = readl((unsigned long)&sun_fd_ebus_dma->dbcr); + return res; +} + +static int sun_pci_fd_eject(int drive) +{ + return -EINVAL; +} +#endif + static struct linux_prom_registers fd_regs[2]; -static int sun_floppy_init(void) +static unsigned long sun_floppy_init(void) { char state[128]; int fd_node, num_regs; struct linux_sbus *bus; struct linux_sbus_device *sdev; - use_virtual_dma = 1; - FLOPPY_IRQ = 11; for_all_sbusdev (sdev, bus) { if (!strcmp(sdev->prom_name, "SUNW,fdtwo")) break; } - if (!bus) return -1; + if (!bus) { +#ifdef CONFIG_PCI + struct linux_ebus *ebus; + struct linux_ebus_device *edev; + + for_all_ebusdev(edev, ebus) { + if (!strcmp(edev->prom_name, "fdthree")) + break; + } + if (!edev) + return -1; + + if (check_region(edev->base_address[1], sizeof(struct linux_ebus_dma))) { + printk("sun_floppy_init: can't get region %016lx (%d)\n", + edev->base_address[1], (int)sizeof(struct linux_ebus_dma)); + return -1; + } + request_region(edev->base_address[1], sizeof(struct linux_ebus_dma), "floppy DMA"); + + sun_fdc = (struct sun_flpy_controller *)edev->base_address[0]; + FLOPPY_IRQ = edev->irqs[0]; + + sun_fd_ebus_dma = (struct linux_ebus_dma *)edev->base_address[1]; + writel(EBUS_DCSR_BURST_SZ_16, (unsigned long)&sun_fd_ebus_dma->dcsr); + + sun_fdops.fd_inb = sun_pci_fd_inb; + sun_fdops.fd_outb = sun_pci_fd_outb; + + use_virtual_dma = 0; + sun_fdops.fd_enable_dma = sun_pci_fd_enable_dma; + sun_fdops.fd_disable_dma = sun_pci_fd_disable_dma; + sun_fdops.fd_set_dma_mode = sun_pci_fd_set_dma_mode; + sun_fdops.fd_set_dma_addr = sun_pci_fd_set_dma_addr; + sun_fdops.fd_set_dma_count = sun_pci_fd_set_dma_count; + sun_fdops.get_dma_residue = sun_pci_get_dma_residue; + + sun_fdops.fd_enable_irq = sun_pci_fd_enable_irq; + sun_fdops.fd_disable_irq = sun_pci_fd_disable_irq; + sun_fdops.fd_request_irq = sun_pci_fd_request_irq; + sun_fdops.fd_free_irq = sun_pci_fd_free_irq; + + sun_fdops.fd_eject = sun_pci_fd_eject; + + fdc_status = &sun_fdc->status_82077; + FLOPPY_MOTOR_MASK = 0xf0; + + return (unsigned long)sun_fdc; +#else + return -1; +#endif + } fd_node = sdev->prom_node; prom_getproperty(fd_node, "status", state, sizeof(state)); if(!strcmp(state, "disabled")) return -1; @@ -304,29 +449,34 @@ static int sun_floppy_init(void) fd_regs[0].which_io, 0x0); /* Last minute sanity check... */ - if(sun_fdc->status_82072 == 0xff) { + if(sun_fdc->status1_82077 == 0xff) { sun_fdc = NULL; return -1; } sun_fdops.fd_inb = sun_82077_fd_inb; sun_fdops.fd_outb = sun_82077_fd_outb; + + use_virtual_dma = 1; + sun_fdops.fd_enable_dma = sun_fd_enable_dma; + sun_fdops.fd_disable_dma = sun_fd_disable_dma; + sun_fdops.fd_set_dma_mode = sun_fd_set_dma_mode; + sun_fdops.fd_set_dma_addr = sun_fd_set_dma_addr; + sun_fdops.fd_set_dma_count = sun_fd_set_dma_count; + sun_fdops.get_dma_residue = sun_get_dma_residue; + + sun_fdops.fd_enable_irq = sun_fd_enable_irq; + sun_fdops.fd_disable_irq = sun_fd_disable_irq; + sun_fdops.fd_request_irq = sun_fd_request_irq; + sun_fdops.fd_free_irq = sun_fd_free_irq; + + sun_fdops.fd_eject = sun_fd_eject; + fdc_status = &sun_fdc->status_82077; /* printk("DOR @0x%p\n", &sun_fdc->dor_82077); */ /* P3 */ /* Success... */ - return (int) ((unsigned long)sun_fdc); -} - -static int sparc_eject(void) -{ - set_dor(0x00, 0xff, 0x90); - udelay(500); - set_dor(0x00, 0x6f, 0x00); - udelay(500); - return 0; + return (unsigned long)sun_fdc; } -#define fd_eject(drive) sparc_eject() - #endif /* !(__ASM_SPARC64_FLOPPY_H) */ diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h index 03ee543b1..5ca51ac77 100644 --- a/include/asm-sparc64/hardirq.h +++ b/include/asm-sparc64/hardirq.h @@ -8,16 +8,20 @@ #include <linux/tasks.h> -extern unsigned int local_irq_count[NR_CPUS]; -#define in_interrupt() (local_irq_count[smp_processor_id()] != 0) +#ifndef __SMP__ +extern unsigned int local_irq_count; +#else +#define local_irq_count (cpu_data[smp_processor_id()].irq_count) +#endif +#define in_interrupt() (local_irq_count != 0) #ifndef __SMP__ -#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) +#define hardirq_trylock(cpu) (local_irq_count == 0) #define hardirq_endlock(cpu) do { } while(0) -#define hardirq_enter(cpu) (local_irq_count[cpu]++) -#define hardirq_exit(cpu) (local_irq_count[cpu]--) +#define hardirq_enter(cpu) (local_irq_count++) +#define hardirq_exit(cpu) (local_irq_count--) #define synchronize_irq() do { } while(0) @@ -43,14 +47,16 @@ static inline void release_irqlock(int cpu) static inline void hardirq_enter(int cpu) { - ++local_irq_count[cpu]; + ++cpu_data[cpu].irq_count; atomic_inc(&global_irq_count); + membar("#StoreLoad | #StoreStore"); } static inline void hardirq_exit(int cpu) { + membar("#StoreStore | #LoadStore"); atomic_dec(&global_irq_count); - --local_irq_count[cpu]; + --cpu_data[cpu].irq_count; } static inline int hardirq_trylock(int cpu) @@ -58,13 +64,14 @@ static inline int hardirq_trylock(int cpu) unsigned long flags; __save_and_cli(flags); - if(atomic_add_return(1, &global_irq_count) != 1 || - *(((unsigned char *)(&global_irq_lock)))) { + atomic_inc(&global_irq_count); + if(atomic_read(&global_irq_count) != 1 || + (*(((unsigned char *)(&global_irq_lock)))) != 0) { atomic_dec(&global_irq_count); __restore_flags(flags); return 0; } - ++local_irq_count[cpu]; + ++cpu_data[cpu].irq_count; return 1; } diff --git a/include/asm-sparc64/head.h b/include/asm-sparc64/head.h index e3ff51686..570e6989f 100644 --- a/include/asm-sparc64/head.h +++ b/include/asm-sparc64/head.h @@ -1,324 +1,9 @@ -/* $Id: head.h,v 1.27 1997/07/13 17:30:43 davem Exp $ */ +/* $Id: head.h,v 1.30 1997/08/08 08:34:33 jj Exp $ */ #ifndef _SPARC64_HEAD_H #define _SPARC64_HEAD_H #include <asm/pstate.h> #define KERNBASE 0x400000 -#define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop; - -/* We need a "cleaned" instruction... */ -#define CLEAN_WINDOW \ - rdpr %cleanwin, %l0; add %l0, 1, %l0; \ - wrpr %l0, 0x0, %cleanwin; \ - clr %o0; clr %o1; clr %o2; clr %o3; \ - clr %o4; clr %o5; clr %o6; clr %o7; \ - clr %l0; clr %l1; clr %l2; clr %l3; \ - clr %l4; clr %l5; clr %l6; clr %l7; \ - retry; \ - nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop; - -#define TRAP(routine) \ - ba,pt %xcc, etrap; \ - rd %pc, %g7; \ - call routine; \ - add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ - ba,pt %xcc, rtrap; \ - clr %l6; \ - nop; \ - nop; - -#define TRAP_NOSAVE(routine) \ - ba,pt %xcc, routine; \ - nop; \ - nop; nop; nop; nop; nop; nop; - -#define TRAPTL1(routine) \ - ba,pt %xcc, etraptl1; \ - rd %pc, %g7; \ - call routine; \ - add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ - ba,pt %xcc, rtrap; \ - clr %l6; \ - nop; \ - nop; - -#define TRAP_ARG(routine, arg) \ - ba,pt %xcc, etrap; \ - rd %pc, %g7; \ - add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ - call routine; \ - mov arg, %o1; \ - ba,pt %xcc, rtrap; \ - clr %l6; \ - nop; - -#define TRAPTL1_ARG(routine, arg) \ - ba,pt %xcc, etraptl1; \ - rd %pc, %g7; \ - add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ - call routine; \ - mov arg, %o1; \ - ba,pt %xcc, rtrap; \ - clr %l6; \ - nop; - -#define SYSCALL_TRAP(routine, systbl) \ - ba,pt %xcc, etrap; \ - rd %pc, %g7; \ - sethi %hi(systbl), %l7; \ - call routine; \ - or %l7, %lo(systbl), %l7; \ - nop; nop; nop; - -#define ACCESS_EXCEPTION_TRAP(routine) \ - rdpr %pstate, %g1; \ - wrpr %g1, PSTATE_MG|PSTATE_AG, %pstate; \ - ba,pt %xcc, etrap; \ - rd %pc, %g7; \ - call routine; \ - add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ - ba,pt %xcc, rtrap; \ - clr %l6; - -#define ACCESS_EXCEPTION_TRAPTL1(routine) \ - rdpr %pstate, %g1; \ - wrpr %g1, PSTATE_MG|PSTATE_AG, %pstate; \ - ba,pt %xcc, etraptl1; \ - rd %pc, %g7; \ - call routine; \ - add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ - ba,pt %xcc, rtrap; \ - clr %l6; - -#define SUNOS_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sunos_sys_table) -#define LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table32) -#define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64) -#define GETCC_TRAP TRAP(getcc) -#define SETCC_TRAP TRAP(setcc) -/* FIXME: Write these actually */ -#define NETBSD_SYSCALL_TRAP TRAP(netbsd_syscall) -#define SOLARIS_SYSCALL_TRAP TRAP(solaris_syscall) -#define BREAKPOINT_TRAP TRAP(breakpoint_trap) -#define INDIRECT_SOLARIS_SYSCALL(tlvl) TRAP_ARG(indirect_syscall, tlvl) - -#define TRAP_IRQ(routine, level) \ - rdpr %pil, %g2; \ - wrpr %g0, 15, %pil; \ - ba,pt %xcc, etrap_irq; \ - rd %pc, %g7; \ - mov level, %o0; \ - call routine; \ - add %sp, STACK_BIAS + REGWIN_SZ, %o1; \ - ba,a,pt %xcc, rtrap_clr_l6; - -/* On UP this is ok, and worth the effort, for SMP we need - * a different mechanism and thus cannot do it all in trap table. -DaveM - */ -#ifndef __SMP__ -#define TRAP_IVEC \ - ldxa [%g2] ASI_UDB_INTR_R, %g3; \ - and %g3, 0x7ff, %g3; \ - sllx %g3, 3, %g3; \ - ldx [%g1 + %g3], %g5; \ - wr %g5, 0x0, %set_softint; \ - stxa %g0, [%g0] ASI_INTR_RECEIVE; \ - membar #Sync; \ - retry; -#else -#define TRAP_IVEC TRAP_NOSAVE(do_ivec) -#endif - -#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl) - -#define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl) - -#define FLUSH_WINDOW_TRAP \ - ba,pt %xcc, etrap; \ - rd %pc, %g7; \ - flushw; \ - ldx [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC], %l1; \ - add %l1, 4, %l2; \ - stx %l1, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TPC]; \ - ba,pt %xcc, rtrap_clr_l6; \ - stx %l2, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC]; - -/* Before touching these macros, you owe it to yourself to go and - * see how arch/sparc64/kernel/winfixup.S works... -DaveM - */ - -/* Normal kernel spill */ -#define SPILL_0_NORMAL \ - stx %l0, [%sp + STACK_BIAS + 0x00]; \ - stx %l1, [%sp + STACK_BIAS + 0x08]; \ - stx %l2, [%sp + STACK_BIAS + 0x10]; \ - stx %l3, [%sp + STACK_BIAS + 0x18]; \ - stx %l4, [%sp + STACK_BIAS + 0x20]; \ - stx %l5, [%sp + STACK_BIAS + 0x28]; \ - stx %l6, [%sp + STACK_BIAS + 0x30]; \ - stx %l7, [%sp + STACK_BIAS + 0x38]; \ - stx %i0, [%sp + STACK_BIAS + 0x40]; \ - stx %i1, [%sp + STACK_BIAS + 0x48]; \ - stx %i2, [%sp + STACK_BIAS + 0x50]; \ - stx %i3, [%sp + STACK_BIAS + 0x58]; \ - stx %i4, [%sp + STACK_BIAS + 0x60]; \ - stx %i5, [%sp + STACK_BIAS + 0x68]; \ - stx %i6, [%sp + STACK_BIAS + 0x70]; \ - stx %i7, [%sp + STACK_BIAS + 0x78]; \ - saved; retry; nop; nop; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; nop; nop; nop; - -/* Normal 64bit spill */ -#define SPILL_1_GENERIC(xxx) \ - wr %g0, xxx, %asi; \ - stxa %l0, [%sp + STACK_BIAS + 0x00] %asi; \ - stxa %l1, [%sp + STACK_BIAS + 0x08] %asi; \ - stxa %l2, [%sp + STACK_BIAS + 0x10] %asi; \ - stxa %l3, [%sp + STACK_BIAS + 0x18] %asi; \ - stxa %l4, [%sp + STACK_BIAS + 0x20] %asi; \ - stxa %l5, [%sp + STACK_BIAS + 0x28] %asi; \ - stxa %l6, [%sp + STACK_BIAS + 0x30] %asi; \ - stxa %l7, [%sp + STACK_BIAS + 0x38] %asi; \ - stxa %i0, [%sp + STACK_BIAS + 0x40] %asi; \ - stxa %i1, [%sp + STACK_BIAS + 0x48] %asi; \ - stxa %i2, [%sp + STACK_BIAS + 0x50] %asi; \ - stxa %i3, [%sp + STACK_BIAS + 0x58] %asi; \ - stxa %i4, [%sp + STACK_BIAS + 0x60] %asi; \ - stxa %i5, [%sp + STACK_BIAS + 0x68] %asi; \ - stxa %i6, [%sp + STACK_BIAS + 0x70] %asi; \ - stxa %i7, [%sp + STACK_BIAS + 0x78] %asi; \ - saved; retry; nop; nop; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; \ - b,a,pt %xcc, spill_fixup_mna; \ - b,a,pt %xcc, spill_fixup; - -/* Normal 32bit spill */ -#define SPILL_2_GENERIC(xxx) \ - wr %g0, xxx, %asi; \ - srl %sp, 0, %sp; \ - stwa %l0, [%sp + 0x00] %asi; \ - stwa %l1, [%sp + 0x04] %asi; \ - stwa %l2, [%sp + 0x08] %asi; \ - stwa %l3, [%sp + 0x0c] %asi; \ - stwa %l4, [%sp + 0x10] %asi; \ - stwa %l5, [%sp + 0x14] %asi; \ - stwa %l6, [%sp + 0x18] %asi; \ - stwa %l7, [%sp + 0x1c] %asi; \ - stwa %i0, [%sp + 0x20] %asi; \ - stwa %i1, [%sp + 0x24] %asi; \ - stwa %i2, [%sp + 0x28] %asi; \ - stwa %i3, [%sp + 0x2c] %asi; \ - stwa %i4, [%sp + 0x30] %asi; \ - stwa %i5, [%sp + 0x34] %asi; \ - stwa %i6, [%sp + 0x38] %asi; \ - stwa %i7, [%sp + 0x3c] %asi; \ - saved; retry; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; nop; \ - b,a,pt %xcc, spill_fixup_mna; \ - b,a,pt %xcc, spill_fixup; - -#define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP) -#define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP) -#define SPILL_3_NORMAL SPILL_0_NORMAL -#define SPILL_4_NORMAL SPILL_0_NORMAL -#define SPILL_5_NORMAL SPILL_0_NORMAL -#define SPILL_6_NORMAL SPILL_0_NORMAL -#define SPILL_7_NORMAL SPILL_0_NORMAL - -#define SPILL_0_OTHER SPILL_0_NORMAL -#define SPILL_1_OTHER SPILL_1_GENERIC(ASI_AIUS) -#define SPILL_2_OTHER SPILL_2_GENERIC(ASI_AIUS) -#define SPILL_3_OTHER SPILL_3_NORMAL -#define SPILL_4_OTHER SPILL_4_NORMAL -#define SPILL_5_OTHER SPILL_5_NORMAL -#define SPILL_6_OTHER SPILL_6_NORMAL -#define SPILL_7_OTHER SPILL_7_NORMAL - -/* Normal kernel fill */ -#define FILL_0_NORMAL \ - ldx [%sp + STACK_BIAS + 0x00], %l0; \ - ldx [%sp + STACK_BIAS + 0x08], %l1; \ - ldx [%sp + STACK_BIAS + 0x10], %l2; \ - ldx [%sp + STACK_BIAS + 0x18], %l3; \ - ldx [%sp + STACK_BIAS + 0x20], %l4; \ - ldx [%sp + STACK_BIAS + 0x28], %l5; \ - ldx [%sp + STACK_BIAS + 0x30], %l6; \ - ldx [%sp + STACK_BIAS + 0x38], %l7; \ - ldx [%sp + STACK_BIAS + 0x40], %i0; \ - ldx [%sp + STACK_BIAS + 0x48], %i1; \ - ldx [%sp + STACK_BIAS + 0x50], %i2; \ - ldx [%sp + STACK_BIAS + 0x58], %i3; \ - ldx [%sp + STACK_BIAS + 0x60], %i4; \ - ldx [%sp + STACK_BIAS + 0x68], %i5; \ - ldx [%sp + STACK_BIAS + 0x70], %i6; \ - ldx [%sp + STACK_BIAS + 0x78], %i7; \ - restored; retry; nop; nop; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; nop; nop; nop; - -/* Normal 64bit fill */ -#define FILL_1_GENERIC(xxx) \ - wr %g0, xxx, %asi; \ - ldxa [%sp + STACK_BIAS + 0x00] %asi, %l0; \ - ldxa [%sp + STACK_BIAS + 0x08] %asi, %l1; \ - ldxa [%sp + STACK_BIAS + 0x10] %asi, %l2; \ - ldxa [%sp + STACK_BIAS + 0x18] %asi, %l3; \ - ldxa [%sp + STACK_BIAS + 0x20] %asi, %l4; \ - ldxa [%sp + STACK_BIAS + 0x28] %asi, %l5; \ - ldxa [%sp + STACK_BIAS + 0x30] %asi, %l6; \ - ldxa [%sp + STACK_BIAS + 0x38] %asi, %l7; \ - ldxa [%sp + STACK_BIAS + 0x40] %asi, %i0; \ - ldxa [%sp + STACK_BIAS + 0x48] %asi, %i1; \ - ldxa [%sp + STACK_BIAS + 0x50] %asi, %i2; \ - ldxa [%sp + STACK_BIAS + 0x58] %asi, %i3; \ - ldxa [%sp + STACK_BIAS + 0x60] %asi, %i4; \ - ldxa [%sp + STACK_BIAS + 0x68] %asi, %i5; \ - ldxa [%sp + STACK_BIAS + 0x70] %asi, %i6; \ - ldxa [%sp + STACK_BIAS + 0x78] %asi, %i7; \ - restored; retry; nop; nop; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; \ - b,a,pt %xcc, fill_fixup_mna; \ - b,a,pt %xcc, fill_fixup; - -/* Normal 32bit fill */ -#define FILL_2_GENERIC(xxx) \ - wr %g0, xxx, %asi; \ - srl %sp, 0, %sp; \ - lduwa [%sp + 0x00] %asi, %l0; \ - lduwa [%sp + 0x04] %asi, %l1; \ - lduwa [%sp + 0x08] %asi, %l2; \ - lduwa [%sp + 0x0c] %asi, %l3; \ - lduwa [%sp + 0x10] %asi, %l4; \ - lduwa [%sp + 0x14] %asi, %l5; \ - lduwa [%sp + 0x18] %asi, %l6; \ - lduwa [%sp + 0x1c] %asi, %l7; \ - lduwa [%sp + 0x20] %asi, %i0; \ - lduwa [%sp + 0x24] %asi, %i1; \ - lduwa [%sp + 0x28] %asi, %i2; \ - lduwa [%sp + 0x2c] %asi, %i3; \ - lduwa [%sp + 0x30] %asi, %i4; \ - lduwa [%sp + 0x34] %asi, %i5; \ - lduwa [%sp + 0x38] %asi, %i6; \ - lduwa [%sp + 0x3c] %asi, %i7; \ - restored; retry; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; nop; \ - b,a,pt %xcc, fill_fixup_mna; \ - b,a,pt %xcc, fill_fixup; - -#define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP) -#define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP) -#define FILL_3_NORMAL FILL_0_NORMAL -#define FILL_4_NORMAL FILL_0_NORMAL -#define FILL_5_NORMAL FILL_0_NORMAL -#define FILL_6_NORMAL FILL_0_NORMAL -#define FILL_7_NORMAL FILL_0_NORMAL - -#define FILL_0_OTHER FILL_0_NORMAL -#define FILL_1_OTHER FILL_1_GENERIC(ASI_AIUS) -#define FILL_2_OTHER FILL_2_GENERIC(ASI_AIUS) -#define FILL_3_OTHER FILL_3_NORMAL -#define FILL_4_OTHER FILL_4_NORMAL -#define FILL_5_OTHER FILL_5_NORMAL -#define FILL_6_OTHER FILL_6_NORMAL -#define FILL_7_OTHER FILL_7_NORMAL #endif /* !(_SPARC64_HEAD_H) */ diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h new file mode 100644 index 000000000..e305ccf91 --- /dev/null +++ b/include/asm-sparc64/ide.h @@ -0,0 +1,263 @@ +/* $Id: ide.h,v 1.4 1997/08/30 16:29:29 davem Exp $ + * ide.h: Ultra/PCI specific IDE glue. + * + * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) + */ + +#ifndef _SPARC64_IDE_H +#define _SPARC64_IDE_H + +#ifdef __KERNEL__ + +typedef unsigned long ide_ioreg_t; + +#undef MAX_HWIFS +#define MAX_HWIFS 2 + +extern int sparc64_ide_ports_known; +extern ide_ioreg_t sparc64_ide_regbase[MAX_HWIFS]; +extern ide_ioreg_t sparc64_idedma_regbase; /* one for both channels */ +extern unsigned int sparc64_ide_irq; + +extern void sparc64_ide_probe(void); + +#define ide_sti() sti() + +static __inline__ int ide_default_irq(ide_ioreg_t base) +{ + if(sparc64_ide_ports_known == 0) + sparc64_ide_probe(); + return sparc64_ide_irq; +} + +static __inline__ ide_ioreg_t ide_default_io_base(int index) +{ + if(sparc64_ide_ports_known == 0) + sparc64_ide_probe(); + return sparc64_ide_regbase[index]; +} + +static __inline__ void ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq) +{ + ide_ioreg_t port = base; + int i = 9; + + while(i--) + *p++ = port++; + if(base == sparc64_ide_regbase[0]) + *p = sparc64_idedma_regbase + 0x2; + else + *p = sparc64_idedma_regbase + 0xa; + if(irq != NULL) + *irq = sparc64_ide_irq; +} + +typedef union { + unsigned int all : 8; /* all of the bits together */ + struct { + unsigned int bit7 : 1; + unsigned int lba : 1; + unsigned int bit5 : 1; + unsigned int unit : 1; + unsigned int head : 4; + } b; +} select_t; + +static __inline__ int ide_request_irq(unsigned int irq, + void (*handler)(int, void *, struct pt_regs *), + unsigned long flags, const char *name, void *devid) +{ + return request_irq(irq, handler, SA_SHIRQ, name, devid); +} + +static __inline__ void ide_free_irq(unsigned int irq, void *dev_id) +{ + free_irq(irq, dev_id); +} + +static __inline__ int ide_check_region(ide_ioreg_t base, unsigned int size) +{ + return check_region(base, size); +} + +static __inline__ void ide_request_region(ide_ioreg_t base, unsigned int size, + const char *name) +{ + request_region(base, size, name); +} + +static __inline__ void ide_release_region(ide_ioreg_t base, unsigned int size) +{ + release_region(base, size); +} + +#undef SUPPORT_SLOW_DATA_PORTS +#define SUPPORT_SLOW_DATA_PORTS 0 + +#undef SUPPORT_VLB_SYNC +#define SUPPORT_VLB_SYNC 0 + +#undef HD_DATA +#define HD_DATA ((ide_ioreg_t)0) + +static __inline__ int ide_ack_intr(ide_ioreg_t status_port, ide_ioreg_t irq_port) +{ + unsigned char stat = inb(irq_port); + + if(stat & 0x4) { + outb((inb(irq_port) & 0x60) | 4, irq_port); + return 1; + } + return 0; +} + +/* From m68k code... */ + +#define insl(data_reg, buffer, wcount) insw(data_reg, buffer, (wcount)<<1) +#define outsl(data_reg, buffer, wcount) outsw(data_reg, buffer, (wcount)<<1) + +#define insw(port, buf, nr) ide_insw((port), (buf), (nr)) +#define outsw(port, buf, nr) ide_outsw((port), (buf), (nr)) + +static __inline__ void ide_insw(unsigned long port, + void *dst, + unsigned long count) +{ + volatile unsigned short *data_port; + u16 *ps = dst; + u32 *pi; + + data_port = (volatile unsigned short *)port; + + if(((u64)ps) & 0x2) { + *ps++ = *data_port; + count--; + } + pi = (u32 *)ps; + while(count >= 2) { + u32 w; + + w = (*data_port) << 16; + w |= (*data_port); + *pi++ = w; + count -= 2; + } + ps = (u16 *)pi; + if(count) + *ps = *data_port; +} + +static __inline__ void ide_outsw(unsigned long port, + const void *src, + unsigned long count) +{ + volatile unsigned short *data_port; + const u16 *ps = src; + const u32 *pi; + + data_port = (volatile unsigned short *)port; + + if(((u64)src) & 0x2) { + *data_port = *ps++; + count--; + } + pi = (const u32 *)ps; + while(count >= 2) { + u32 w; + + w = *pi++; + *data_port = (w >> 16); + *data_port = w; + count -= 2; + } + ps = (const u16 *)pi; + if(count) + *data_port = *ps; +} + +#define T_CHAR (0x0000) /* char: don't touch */ +#define T_SHORT (0x4000) /* short: 12 -> 21 */ +#define T_INT (0x8000) /* int: 1234 -> 4321 */ +#define T_TEXT (0xc000) /* text: 12 -> 21 */ + +#define T_MASK_TYPE (0xc000) +#define T_MASK_COUNT (0x3fff) + +#define D_CHAR(cnt) (T_CHAR | (cnt)) +#define D_SHORT(cnt) (T_SHORT | (cnt)) +#define D_INT(cnt) (T_INT | (cnt)) +#define D_TEXT(cnt) (T_TEXT | (cnt)) + +static u_short driveid_types[] = { + D_SHORT(10), /* config - vendor2 */ + D_TEXT(20), /* serial_no */ + D_SHORT(3), /* buf_type - ecc_bytes */ + D_TEXT(48), /* fw_rev - model */ + D_CHAR(2), /* max_multsect - vendor3 */ + D_SHORT(1), /* dword_io */ + D_CHAR(2), /* vendor4 - capability */ + D_SHORT(1), /* reserved50 */ + D_CHAR(4), /* vendor5 - tDMA */ + D_SHORT(4), /* field_valid - cur_sectors */ + D_INT(1), /* cur_capacity */ + D_CHAR(2), /* multsect - multsect_valid */ + D_INT(1), /* lba_capacity */ + D_SHORT(194) /* dma_1word - reservedyy */ +}; + +#define num_driveid_types (sizeof(driveid_types)/sizeof(*driveid_types)) + +static __inline__ void ide_fix_driveid(struct hd_driveid *id) +{ + u_char *p = (u_char *)id; + int i, j, cnt; + u_char t; + + for (i = 0; i < num_driveid_types; i++) { + cnt = driveid_types[i] & T_MASK_COUNT; + switch (driveid_types[i] & T_MASK_TYPE) { + case T_CHAR: + p += cnt; + break; + case T_SHORT: + for (j = 0; j < cnt; j++) { + t = p[0]; + p[0] = p[1]; + p[1] = t; + p += 2; + } + break; + case T_INT: + for (j = 0; j < cnt; j++) { + t = p[0]; + p[0] = p[3]; + p[3] = t; + t = p[1]; + p[1] = p[2]; + p[2] = t; + p += 4; + } + break; + case T_TEXT: + for (j = 0; j < cnt; j += 2) { + t = p[0]; + p[0] = p[1]; + p[1] = t; + p += 2; + } + break; + }; + } +} + +static __inline__ void ide_release_lock (int *ide_lock) +{ +} + +static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, struct pt_regs *), void *data) +{ +} + +#endif /* __KERNEL__ */ + +#endif /* _SPARC64_IDE_H */ diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index 2d062924d..e6d13f2de 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h @@ -1,4 +1,4 @@ -/* $Id: io.h,v 1.10 1997/04/10 05:13:29 davem Exp $ */ +/* $Id: io.h,v 1.12 1997/08/19 03:11:52 davem Exp $ */ #ifndef __SPARC64_IO_H #define __SPARC64_IO_H @@ -7,83 +7,122 @@ #include <asm/page.h> /* IO address mapping routines need this */ #include <asm/system.h> +#include <asm/asi.h> -extern __inline__ unsigned long inb_local(unsigned long addr) -{ - return 0; -} +/* PC crapola... */ +#define __SLOW_DOWN_IO do { } while (0) +#define SLOW_DOWN_IO do { } while (0) -extern __inline__ void outb_local(unsigned char b, unsigned long addr) +extern __inline__ unsigned long virt_to_phys(volatile void *addr) { - return; + return ((((unsigned long)addr) - PAGE_OFFSET) | 0x80000000UL); } -extern __inline__ unsigned long inb(unsigned long addr) +extern __inline__ void *phys_to_virt(unsigned long addr) { - return 0; + return ((void *)((addr & ~0x80000000) + PAGE_OFFSET)); } -extern __inline__ unsigned long inw(unsigned long addr) -{ - return 0; -} +#define virt_to_bus virt_to_phys +#define bus_to_virt phys_to_virt -extern __inline__ unsigned long inl(unsigned long addr) +extern __inline__ unsigned int inb(unsigned long addr) { - return 0; -} + unsigned int ret; -extern __inline__ void outb(unsigned char b, unsigned long addr) -{ - return; -} + __asm__ __volatile__("lduba [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); -extern __inline__ void outw(unsigned short b, unsigned long addr) -{ - return; + return ret; } -extern __inline__ void outl(unsigned int b, unsigned long addr) +extern __inline__ unsigned int inw(unsigned long addr) { - return; -} + unsigned int ret; -/* - * Memory functions - */ -extern __inline__ unsigned long readb(unsigned long addr) -{ - return 0; -} + __asm__ __volatile__("lduha [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); -extern __inline__ unsigned long readw(unsigned long addr) -{ - return 0; + return ret; } -extern __inline__ unsigned long readl(unsigned long addr) +extern __inline__ unsigned int inl(unsigned long addr) { - return 0; + unsigned int ret; + + __asm__ __volatile__("lduwa [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); + + return ret; } -extern __inline__ void writeb(unsigned short b, unsigned long addr) +extern __inline__ void outb(unsigned char b, unsigned long addr) { - return; + __asm__ __volatile__("stba %0, [%1] %2" + : /* no outputs */ + : "r" (b), "r" (addr), "i" (ASI_PL)); } -extern __inline__ void writew(unsigned short b, unsigned long addr) +extern __inline__ void outw(unsigned short w, unsigned long addr) { - return; + __asm__ __volatile__("stha %0, [%1] %2" + : /* no outputs */ + : "r" (w), "r" (addr), "i" (ASI_PL)); } -extern __inline__ void writel(unsigned int b, unsigned long addr) +extern __inline__ void outl(unsigned int l, unsigned long addr) { - return; + __asm__ __volatile__("stwa %0, [%1] %2" + : /* no outputs */ + : "r" (l), "r" (addr), "i" (ASI_PL)); } #define inb_p inb #define outb_p outb +extern void outsb(unsigned long addr, const void *src, unsigned long count); +extern void outsw(unsigned long addr, const void *src, unsigned long count); +extern void outsl(unsigned long addr, const void *src, unsigned long count); +extern void insb(unsigned long addr, void *dst, unsigned long count); +extern void insw(unsigned long addr, void *dst, unsigned long count); +extern void insl(unsigned long addr, void *dst, unsigned long count); + +/* Memory functions, same as I/O accesses on Ultra. */ +#define readb(addr) inb(addr) +#define readw(addr) inw(addr) +#define readl(addr) inl(addr) +#define writeb(b, addr) outb((b), (addr)) +#define writew(w, addr) outw((w), (addr)) +#define writel(l, addr) outl((l), (addr)) + +/* Memcpy to/from I/O space is just a regular memory operation on Ultra as well. */ + +#if 0 /* XXX Not exactly, we need to use ASI_*L from/to the I/O end, + * XXX so these are disabled until we code that stuff. + */ +#define memset_io(a,b,c) memset(((char *)(a)),(b),(c)) +#define memcpy_fromio(a,b,c) memcpy((a),((char *)(b)),(c)) +#define memcpy_toio(a,b,c) memcpy(((char *)(a)),(b),(c)) +#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),((char *)(b)),(c),(d)) +#endif + +static inline int check_signature(unsigned long io_addr, + const unsigned char *signature, + int length) +{ + int retval = 0; + do { + if (readb(io_addr++) != *signature++) + goto out; + } while (--length); + retval = 1; +out: + return retval; +} + extern void sparc_ultra_mapioaddr (unsigned long physaddr, unsigned long virt_addr, int bus, int rdonly); extern void sparc_ultra_unmapioaddr (unsigned long virt_addr); @@ -103,7 +142,4 @@ extern void *sparc_alloc_io (u32 pa, void *va, int sz, char *name, u32 io, int r extern void sparc_free_io (void *va, int sz); extern void *sparc_dvma_malloc (int sz, char *name, __u32 *dvma_addr); -#define virt_to_phys(x) __pa((unsigned long)(x)) -#define phys_to_virt(x) __va((unsigned long)(x)) - #endif /* !(__SPARC64_IO_H) */ diff --git a/include/asm-sparc64/ioctls.h b/include/asm-sparc64/ioctls.h index 1d6c1cace..8a4a2c91d 100644 --- a/include/asm-sparc64/ioctls.h +++ b/include/asm-sparc64/ioctls.h @@ -1,4 +1,4 @@ -/* $Id: ioctls.h,v 1.4 1997/06/23 07:26:03 davem Exp $ */ +/* $Id: ioctls.h,v 1.5 1997/08/12 04:13:13 ecd Exp $ */ #ifndef _ASM_SPARC64_IOCTLS_H #define _ASM_SPARC64_IOCTLS_H @@ -105,6 +105,8 @@ #define TIOCSERGETLSR 0x5459 /* Get line status register */ #define TIOCSERGETMULTI 0x545A /* Get multiport config */ #define TIOCSERSETMULTI 0x545B /* Set multiport config */ +#define TIOCMIWAIT 0x545C /* Wait for change on serial input line(s) */ +#define TIOCGICOUNT 0x545D /* Read serial port inline interrupt counts */ /* Kernel definitions */ #ifdef __KERNEL__ diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h index fbb43c69a..f52844fe4 100644 --- a/include/asm-sparc64/iommu.h +++ b/include/asm-sparc64/iommu.h @@ -7,6 +7,7 @@ #include <asm/page.h> #include <asm/sysio.h> +#include <asm/spinlock.h> /* The iommu handles all virtual to physical address translations * that occur between the SYSIO and physical memory. Access by @@ -43,8 +44,12 @@ #define IOPTE_WRITE 0x0000000000000002 /* Writeable */ struct iommu_struct { - struct sysio_regs *sysio_regs; - iopte_t *page_table; + struct sysio_regs *sysio_regs; + unsigned int *sbuf_flushflag_va; + unsigned long sbuf_flushflag_pa; + spinlock_t iommu_lock; + + iopte_t *page_table; /* For convenience */ unsigned long start; /* First managed virtual address */ diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h index 1a23abb72..2f946fbab 100644 --- a/include/asm-sparc64/irq.h +++ b/include/asm-sparc64/irq.h @@ -1,4 +1,4 @@ -/* $Id: irq.h,v 1.4 1997/04/04 00:50:20 davem Exp $ +/* $Id: irq.h,v 1.6 1997/08/07 08:06:40 davem Exp $ * irq.h: IRQ registers on the 64-bit Sparc. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -9,7 +9,31 @@ #include <linux/linkage.h> -#include <asm/system.h> /* For NCPUS */ +/* Sparc64 extensions to the interrupt registry flags. Mostly this is + * for passing along what bus type the device is on and also the true + * format of the dev_id cookie, see below. + */ +#define SA_BUSMASK 0x0f000 +#define SA_SBUS 0x01000 +#define SA_PCI 0x02000 +#define SA_FHC 0x03000 +#define SA_EBUS 0x04000 +#define SA_BUS(mask) ((mask) & SA_BUSMASK) + +struct devid_cookie { + /* Caller specifies these. */ + void *real_dev_id; /* What dev_id would usually contain. */ + unsigned int *imap; /* Anonymous IMAP register */ + unsigned int *iclr; /* Anonymous ICLR register */ + int pil; /* Anonymous PIL */ + void *bus_cookie; /* SYSIO regs, PSYCHO regs, etc. */ + + /* Return values. */ + unsigned int ret_ino; + unsigned int ret_pil; +}; + +#define SA_DCOOKIE 0x10000 #define NR_IRQS 15 diff --git a/include/asm-sparc64/keyboard.h b/include/asm-sparc64/keyboard.h new file mode 100644 index 000000000..dba75e0de --- /dev/null +++ b/include/asm-sparc64/keyboard.h @@ -0,0 +1,43 @@ +/* $Id: keyboard.h,v 1.1 1997/09/04 05:50:39 ecd Exp $ + * linux/include/asm-sparc64/keyboard.h + * + * Created Aug 29 1997 by Eddie C. Dost (ecd@skynet.be) + */ + +/* + * This file contains the Ultra/PCI architecture specific keyboard definitions + */ + +#ifndef _SPARC64_KEYBOARD_H +#define _SPARC64_KEYBOARD_H 1 + +#ifdef __KERNEL__ + +#define KEYBOARD_IRQ 1 +#define DISABLE_KBD_DURING_INTERRUPTS 0 + +extern int pcikbd_setkeycode(unsigned int scancode, unsigned int keycode); +extern int pcikbd_getkeycode(unsigned int scancode); +extern int pcikbd_pretranslate(unsigned char scancode, char raw_mode); +extern int pcikbd_translate(unsigned char scancode, unsigned char *keycode, + char raw_mode); +extern char pcikbd_unexpected_up(unsigned char keycode); +extern void pcikbd_leds(unsigned char leds); +extern void pcikbd_init_hw(void); +extern unsigned char pcikbd_sysrq_xlate[128]; + +#define kbd_setkeycode pcikbd_setkeycode +#define kbd_getkeycode pcikbd_getkeycode +#define kbd_pretranslate pcikbd_pretranslate +#define kbd_translate pcikbd_translate +#define kbd_unexpected_up pcikbd_unexpected_up +#define kbd_leds pcikbd_leds +#define kbd_init_hw pcikbd_init_hw +#define kbd_sysrq_xlate pcikbd_sysrq_xlate +#define kbd_init pcikbd_init + +#define SYSRQ_KEY 0x54 + +#endif /* __KERNEL__ */ + +#endif /* !(_SPARC64_KEYBOARD_H) */ diff --git a/include/asm-sparc64/linux_logo.h b/include/asm-sparc64/linux_logo.h index 35254c6a3..59bd61866 100644 --- a/include/asm-sparc64/linux_logo.h +++ b/include/asm-sparc64/linux_logo.h @@ -1,4 +1,4 @@ -/* $Id: linux_logo.h,v 1.1 1997/04/16 17:51:37 jj Exp $ +/* $Id: linux_logo.h,v 1.3 1997/08/25 07:50:35 jj Exp $ * include/asm-sparc64/linux_logo.h: This is a linux logo * to be displayed on boot. * diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h index 7e7aa0433..53745626e 100644 --- a/include/asm-sparc64/mmu_context.h +++ b/include/asm-sparc64/mmu_context.h @@ -1,4 +1,4 @@ -/* $Id: mmu_context.h,v 1.17 1997/07/13 19:13:39 davem Exp $ */ +/* $Id: mmu_context.h,v 1.19 1997/08/07 02:54:08 davem Exp $ */ #ifndef __SPARC64_MMU_CONTEXT_H #define __SPARC64_MMU_CONTEXT_H @@ -11,20 +11,33 @@ #ifndef __ASSEMBLY__ -#define destroy_context(mm) do { } while(0) - extern unsigned long tlb_context_cache; #define CTX_VERSION_SHIFT PAGE_SHIFT #define CTX_VERSION_MASK ((~0UL) << CTX_VERSION_SHIFT) #define CTX_FIRST_VERSION ((1UL << CTX_VERSION_SHIFT) + 1UL) -extern void get_new_mmu_context(struct mm_struct *mm, unsigned long ctx); +extern void get_new_mmu_context(struct mm_struct *mm, unsigned long *ctx); -/* Initialize the context related info for a new mm_struct +/* Initialize/destroy the context related info for a new mm_struct * instance. */ -#define init_new_context(mm) get_new_mmu_context((mm), tlb_context_cache) +#define init_new_context(mm) ((mm)->context = NO_CONTEXT) +#define destroy_context(mm) ((mm)->context = NO_CONTEXT) + +#ifdef __SMP__ +#define LOCAL_FLUSH_PENDING(cpu) \ + ((cpu_data[(cpu)].last_tlbversion_seen ^ tlb_context_cache) & CTX_VERSION_MASK) +#define DO_LOCAL_FLUSH(cpu) do { __flush_tlb_all(); \ + cpu_data[cpu].last_tlbversion_seen = \ + tlb_context_cache & CTX_VERSION_MASK; \ + } while(0) +#else +#define LOCAL_FLUSH_PENDING(cpu) 0 +#define DO_LOCAL_FLUSH(cpu) do { __flush_tlb_all(); } while(0) +#endif + +extern void __flush_tlb_all(void); extern __inline__ void get_mmu_context(struct task_struct *tsk) { @@ -32,11 +45,13 @@ extern __inline__ void get_mmu_context(struct task_struct *tsk) struct mm_struct *mm = tsk->mm; flushw_user(); + if(LOCAL_FLUSH_PENDING(current->processor)) + DO_LOCAL_FLUSH(current->processor); if(!(tsk->tss.flags & SPARC_FLAG_KTHREAD) && !(tsk->flags & PF_EXITING)) { unsigned long ctx = tlb_context_cache; if((mm->context ^ ctx) & CTX_VERSION_MASK) - get_new_mmu_context(mm, ctx); + get_new_mmu_context(mm, &tlb_context_cache); /* Don't worry, set_fs() will restore it... */ tsk->tss.ctx = (tsk->tss.current_ds ? diff --git a/include/asm-sparc64/namei.h b/include/asm-sparc64/namei.h index e80c11979..70d0f337f 100644 --- a/include/asm-sparc64/namei.h +++ b/include/asm-sparc64/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.5 1997/07/17 02:24:28 davem Exp $ +/* $Id: namei.h,v 1.8 1997/09/06 02:25:27 davem Exp $ * linux/include/asm-sparc64/namei.h * * Routines to handle famous /usr/gnemul/s*. @@ -11,40 +11,39 @@ #define SPARC_BSD_EMUL "usr/gnemul/sunos/" #define SPARC_SOL_EMUL "usr/gnemul/solaris/" -#if 0 /* XXX FIXME */ -extern int __namei(int, const char *, struct inode *, char *, struct inode **, - struct inode **, struct qstr *, struct dentry **, int *); - -static inline int -__prefix_namei(int retrieve_mode, const char * name, struct inode * base, - char * buf, struct inode ** res_dir, struct inode ** res_inode, - struct qstr * last_name, struct dentry ** last_entry, - int * last_error) +static inline struct dentry * +__sparc64_lookup_dentry(const char *name, int follow_link) { - int error; - - if (!(current->personality & (PER_BSD|PER_SVR4))) - return -ENOENT; - - while (*name == '/') - name++; - - atomic_inc(¤t->fs->root->i_count); - error = __namei(NAM_FOLLOW_LINK, - current->personality & PER_BSD ? - SPARC_BSD_EMUL : SPARC_SOL_EMUL, current->fs->root, - buf, NULL, &base, NULL, NULL, NULL); - if (error) - return error; - - error = __namei(retrieve_mode, name, base, buf, res_dir, res_inode, - last_name, last_entry, last_error); - if (error) - return error; - - return 0; + struct dentry *base; + + switch (current->personality) { + case PER_BSD: + case PER_SVR4: + break; + default: + return ERR_PTR(-ENOENT); + } + + base = lookup_dentry ((current->personality == PER_BSD) ? + SPARC_BSD_EMUL : SPARC_SOL_EMUL, + dget (current->fs->root), 1); + + if (IS_ERR (base)) return base; + + base = lookup_dentry (name, base, follow_link); + + if (IS_ERR (base)) return base; + + if (!base->d_inode) { + dput(base); + return ERR_PTR(-ENOENT); + } + + return base; } -#endif /* XXX FIXME */ +#define __prefix_lookup_dentry(name, follow_link) \ + dentry = __sparc64_lookup_dentry (name, follow_link); \ + if (!IS_ERR (dentry)) return dentry; #endif /* __SPARC64_NAMEI_H */ diff --git a/include/asm-sparc64/openprom.h b/include/asm-sparc64/openprom.h index 92fddcbf9..5855ddfec 100644 --- a/include/asm-sparc64/openprom.h +++ b/include/asm-sparc64/openprom.h @@ -1,4 +1,4 @@ -/* $Id: openprom.h,v 1.4 1997/03/24 06:42:08 davem Exp $ */ +/* $Id: openprom.h,v 1.6 1997/08/17 22:40:09 ecd Exp $ */ #ifndef __SPARC64_OPENPROM_H #define __SPARC64_OPENPROM_H @@ -210,6 +210,39 @@ struct linux_prom_ranges { unsigned int or_size; }; +/* Ranges and reg properties are a bit different for PCI. */ +struct linux_prom_pci_registers { + unsigned int phys_hi; + unsigned int phys_mid; + unsigned int phys_lo; + + unsigned int size_hi; + unsigned int size_lo; +}; + +struct linux_prom_pci_ranges { + unsigned int child_phys_hi; /* Only certain bits are encoded here. */ + unsigned int child_phys_mid; + unsigned int child_phys_lo; + + unsigned int parent_phys_hi; + unsigned int parent_phys_lo; + + unsigned int size_hi; + unsigned int size_lo; +}; + +struct linux_prom_ebus_ranges { + unsigned int child_phys_hi; + unsigned int child_phys_lo; + + unsigned int parent_phys_hi; + unsigned int parent_phys_mid; + unsigned int parent_phys_lo; + + unsigned int size; +}; + #endif /* !(__ASSEMBLY__) */ #endif /* !(__SPARC64_OPENPROM_H) */ diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h index d39d3d494..a4e8e5a8f 100644 --- a/include/asm-sparc64/page.h +++ b/include/asm-sparc64/page.h @@ -1,4 +1,4 @@ -/* $Id: page.h,v 1.14 1997/06/26 22:32:03 davem Exp $ */ +/* $Id: page.h,v 1.15 1997/08/09 04:56:54 davem Exp $ */ #ifndef _SPARC64_PAGE_H #define _SPARC64_PAGE_H @@ -82,13 +82,11 @@ typedef unsigned long iopgprot_t; #endif /* (STRICT_MM_TYPECHECKS) */ -#endif /* !(__ASSEMBLY__) */ +#define TASK_UNMAPPED_BASE ((current->tss.flags & SPARC_FLAG_32BIT) ? \ + (0x0000000070000000UL) : \ + (0x0000030000000000UL)) -#ifndef __ASSEMBLY__ -#define TASK_UNMAPPED_BASE 0x0000000070000000UL -#else -#define TASK_UNMAPPED_BASE 0x0000000070000000 -#endif +#endif /* !(__ASSEMBLY__) */ /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h new file mode 100644 index 000000000..fec37e16e --- /dev/null +++ b/include/asm-sparc64/pbm.h @@ -0,0 +1,101 @@ +/* $Id: pbm.h,v 1.7 1997/08/25 06:01:14 davem Exp $ + * pbm.h: U2P PCI bus module pseudo driver software state. + * + * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) + */ + +#ifndef __SPARC64_PBM_H +#define __SPARC64_PBM_H + +#include <linux/bios32.h> +#include <linux/pci.h> + +#include <asm/psycho.h> +#include <asm/oplib.h> + +struct linux_pbm_info; + +/* This is what we use to determine what the PROM has assigned so + * far, so that we can perform assignments for addresses which + * were not taken care of by OBP. See psycho.c for details. + * Per-PBM these are ordered by start address. + */ +struct pci_vma { + struct pci_vma *next; + struct linux_pbm_info *pbm; + unsigned int start; + unsigned int end; + unsigned int base_reg; + unsigned int _pad; +}; + +struct linux_psycho; + +struct linux_pbm_info { + struct linux_psycho *parent; + struct pci_vma *IO_assignments; + struct pci_vma *MEM_assignments; + int prom_node; + char prom_name[64]; + struct linux_prom_pci_ranges pbm_ranges[PROMREG_MAX]; + int num_pbm_ranges; + + /* Now things for the actual PCI bus probes. */ + unsigned int pci_first_busno; + unsigned int pci_last_busno; + struct pci_bus pci_bus; +}; + +struct linux_psycho { + struct linux_psycho *next; + struct psycho_regs *psycho_regs; + unsigned long *pci_config_space; + unsigned long *pci_IO_space; + unsigned long *pci_mem_space; + u32 upa_portid; + struct linux_pbm_info pbm_A; + struct linux_pbm_info pbm_B; +}; + +/* PCI devices which are not bridges have this placed in their pci_dev + * sysdata member. This makes OBP aware PCI device drivers easier to + * code. + */ +struct pcidev_cookie { + struct linux_pbm_info *pbm; + int prom_node; +}; + +extern struct linux_psycho *psycho_root; + +/* Special PCI IRQ encoding, this just makes life easier for the generic + * irq registry layer, there is already enough crap in there due to sbus, + * fhc, and dcookies. + */ +#define PCI_IRQ_IDENT 0x80000000 /* This tells irq.c what we are */ +#define PCI_IRQ_IMAP_OFF 0x7ff00000 /* Offset from first PSYCHO imap */ +#define PCI_IRQ_IMAP_OFF_SHFT 20 +#define PCI_IRQ_BUSNO 0x000f8000 /* PSYCHO instance, currently unused */ +#define PCI_IRQ_BUSNO_SHFT 15 +#define PCI_IRQ_IGN 0x000007c0 /* PSYCHO "Int Group Number" */ +#define PCI_IRQ_INO 0x0000003f /* PSYCHO INO */ + +#define PCI_IRQ_P(__irq) (((__irq) & PCI_IRQ_IDENT) != 0) + +extern __inline__ unsigned int pci_irq_encode(unsigned long imap_off, + unsigned long psycho_instance, + unsigned long ign, + unsigned long ino) +{ + unsigned int irq; + + irq = PCI_IRQ_IDENT; + irq |= ((imap_off << PCI_IRQ_IMAP_OFF_SHFT) & PCI_IRQ_IMAP_OFF); + irq |= ((psycho_instance << PCI_IRQ_BUSNO_SHFT) & PCI_IRQ_BUSNO); + irq |= ((ign << 6) & PCI_IRQ_IGN); + irq |= (ino & PCI_IRQ_INO); + + return irq; +} + +#endif /* !(__SPARC64_PBM_H) */ diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index 5d31b3bf5..d58977981 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.50 1997/07/24 16:48:31 davem Exp $ +/* $Id: pgtable.h,v 1.57 1997/08/13 04:44:20 paulus Exp $ * pgtable.h: SpitFire page table operations. * * Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu) @@ -159,12 +159,13 @@ extern void *sparc_init_alloc(unsigned long *kbrk, unsigned long size); /* Cache and TLB flush operations. */ /* These are the same regardless of whether this is an SMP kernel or not. */ -#define flush_cache_mm(mm) do { } while(0) -#define flush_cache_range(mm, start, end) do { } while(0) -#define flush_cache_page(vma, page) do { } while(0) +#define flush_cache_mm(mm) flushw_user() +#define flush_cache_range(mm, start, end) flushw_user() +#define flush_cache_page(vma, page) flushw_user() /* This operation in unnecessary on the SpitFire since D-CACHE is write-through. */ #define flush_page_to_ram(page) do { } while (0) +#define flush_icache_range(start, end) do { } while (0) extern void __flush_cache_all(void); @@ -207,7 +208,7 @@ extern void smp_flush_tlb_all(void); extern void smp_flush_tlb_mm(struct mm_struct *mm); extern void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end); -extern void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long page); +extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page); #define flush_cache_all() smp_flush_cache_all() #define flush_tlb_all() smp_flush_tlb_all() @@ -230,7 +231,7 @@ extern __inline__ void flush_tlb_page(struct vm_area_struct *vma, unsigned long struct mm_struct *mm = vma->vm_mm; if(mm->context != NO_CONTEXT) - smp_flush_tlb_page(vma, page); + smp_flush_tlb_page(mm, page & PAGE_MASK); } #endif @@ -259,18 +260,21 @@ extern inline unsigned long pmd_page(pmd_t pmd) extern inline unsigned long pgd_page(pgd_t pgd) { return (unsigned long) __va(pgd_val(pgd)); } +#define PMD_NONE_MAGIC 0x80 +#define PGD_NONE_MAGIC 0x40 + 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 void pte_clear(pte_t *pte) { pte_val(*pte) = 0; } -extern inline int pmd_none(pmd_t pmd) { return pmd_val(pmd)==null_pte_table; } -extern inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) & ~PAGE_MASK); } -extern inline int pmd_present(pmd_t pmd) { return pmd_val(pmd)!=null_pte_table; } +extern inline int pmd_none(pmd_t pmd) { return pmd_val(pmd)&PMD_NONE_MAGIC; } +extern inline int pmd_bad(pmd_t pmd) { return 0; } +extern inline int pmd_present(pmd_t pmd) { return !(pmd_val(pmd)&PMD_NONE_MAGIC);} extern inline void pmd_clear(pmd_t *pmdp) { pmd_val(*pmdp) = null_pte_table; } -extern inline int pgd_none(pgd_t pgd) { return pgd_val(pgd)==null_pmd_table; } -extern inline int pgd_bad(pgd_t pgd) { return (pgd_val(pgd) & ~PAGE_MASK); } -extern inline int pgd_present(pgd_t pgd) { return pgd_val(pgd)!=null_pmd_table; } +extern inline int pgd_none(pgd_t pgd) { return pgd_val(pgd) & PGD_NONE_MAGIC; } +extern inline int pgd_bad(pgd_t pgd) { return 0; } +extern inline int pgd_present(pgd_t pgd) { return !(pgd_val(pgd)&PGD_NONE_MAGIC);} extern inline void pgd_clear(pgd_t *pgdp) { pgd_val(*pgdp) = null_pmd_table; } /* The following only work if pte_present() is true. @@ -332,148 +336,127 @@ extern inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address) extern inline pte_t *pte_offset(pmd_t *dir, unsigned long address) { return (pte_t *) pmd_page(*dir) + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); } -extern __inline__ void __init_pmd(pmd_t *pmdp) +/* Very stupidly, we used to get new pgd's and pmd's, init their contents + * to point to the NULL versions of the next level page table, later on + * completely re-init them the same way, then free them up. This wasted + * a lot of work and caused unnecessary memory traffic. How broken... + * We fix this by caching them. + */ + +#ifdef __SMP__ +/* Sliiiicck */ +#define pgd_quicklist (cpu_data[smp_processor_id()].pgd_cache) +#define pmd_quicklist (cpu_data[smp_processor_id()].pmd_cache) +#define pte_quicklist (cpu_data[smp_processor_id()].pte_cache) +#define pgtable_cache_size (cpu_data[smp_processor_id()].pgcache_size) +#else +extern unsigned long *pgd_quicklist; +extern unsigned long *pmd_quicklist; +extern unsigned long *pte_quicklist; +extern unsigned long pgtable_cache_size; +#endif + +extern pgd_t *get_pgd_slow(void); + +extern __inline__ pgd_t *get_pgd_fast(void) { - extern void __bfill64(void *, unsigned long *); - - __bfill64((void *)pmdp, &null_pte_table); + pgd_t *ret; + + if((ret = (pgd_t *)pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)pgd_val(*ret); + pgd_val(ret[0]) = pgd_val(ret[1]); + (pgtable_cache_size)--; + } else + ret = get_pgd_slow(); + return ret; } -/* Turning this off makes things much faster, but eliminates some - * sanity checking as well. - */ -/* #define PGTABLE_SANITY_CHECKS */ +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + pgd_val(*pgd) = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + (pgtable_cache_size)++; +} -/* Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on supervisor - * bits if any. - */ -extern inline void pte_free_kernel(pte_t *pte) -{ free_page((unsigned long)pte); } +extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long address_premasked); -extern inline pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) +extern __inline__ pmd_t *get_pmd_fast(void) { - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t *page = (pte_t *) get_free_page(GFP_KERNEL); - if (pmd_none(*pmd)) { - if (page) { - pmd_set(pmd, page); - return page + address; - } - pmd_set(pmd, BAD_PTE); - return NULL; - } - free_page((unsigned long) page); - } -#ifdef PGTABLE_SANITY_CHECKS - if (pmd_bad(*pmd)) { - printk("Bad pmd in pte_alloc_kernel: %08lx\n", pmd_val(*pmd)); - pmd_set(pmd, BAD_PTE); - return NULL; + pmd_t *ret; + + if((ret = (pmd_t *)pmd_quicklist) != NULL) { + pmd_quicklist = (unsigned long *)pmd_val(*ret); + pmd_val(ret[0]) = pmd_val(ret[1]); + (pgtable_cache_size)--; } -#endif - return (pte_t *) pmd_page(*pmd) + address; + return ret; } -extern inline void pmd_free_kernel(pmd_t *pmd) -{ free_page((unsigned long) pmd); } +extern __inline__ void free_pmd_fast(pgd_t *pmd) +{ + pmd_val(*pmd) = (unsigned long) pmd_quicklist; + pmd_quicklist = (unsigned long *) pmd; + (pgtable_cache_size)++; +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); -extern inline pmd_t * pmd_alloc_kernel(pgd_t *pgd, unsigned long address) +extern __inline__ pte_t *get_pte_fast(void) { - address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); - if (pgd_none(*pgd)) { - pmd_t *page = (pmd_t *) get_free_page(GFP_KERNEL); - if (pgd_none(*pgd)) { - if (page) { - __init_pmd(page); - pgd_set(pgd, page); - return page + address; - } - pgd_set(pgd, BAD_PMD); - return NULL; - } - free_page((unsigned long) page); - } -#ifdef PGTABLE_SANITY_CHECKS - if (pgd_bad(*pgd)) { - printk("Bad pgd in pmd_alloc_kernel: %08lx\n", pgd_val(*pgd)); - pgd_set(pgd, BAD_PMD); - return NULL; + pte_t *ret; + + if((ret = (pte_t *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)pte_val(*ret); + pte_val(ret[0]) = pte_val(ret[1]); + (pgtable_cache_size)--; } -#endif - return (pmd_t *) pgd_page(*pgd) + address; + return ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + pte_val(*pte) = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + (pgtable_cache_size)++; } -extern inline void pte_free(pte_t * pte) -{ free_page((unsigned long)pte); } +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) +#define pmd_free_kernel(pmd) free_pmd_fast(pmd) +#define pmd_free(pmd) free_pmd_fast(pmd) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() extern inline pte_t * pte_alloc(pmd_t *pmd, unsigned long address) { address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); if (pmd_none(*pmd)) { - pte_t *page = (pte_t *) get_free_page(GFP_KERNEL); - if (pmd_none(*pmd)) { - if (page) { - pmd_set(pmd, page); - return page + address; - } - pmd_set(pmd, BAD_PTE); - return NULL; - } - free_page((unsigned long) page); - } -#ifdef PGTABLE_SANITY_CHECKS - if (pmd_bad(*pmd)) { - printk("Bad pmd in pte_alloc: %08lx\n", pmd_val(*pmd)); - pmd_set(pmd, BAD_PTE); - return NULL; + pte_t *page = get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + pmd_set(pmd, page); + return page + address; } -#endif return (pte_t *) pmd_page(*pmd) + address; } -extern inline void pmd_free(pmd_t * pmd) -{ free_page((unsigned long) pmd); } - extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) { address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); if (pgd_none(*pgd)) { - pmd_t *page = (pmd_t *) get_free_page(GFP_KERNEL); - if (pgd_none(*pgd)) { - if (page) { - __init_pmd(page); - pgd_set(pgd, page); - return page + address; - } - pgd_set(pgd, BAD_PMD); - return NULL; - } - free_page((unsigned long) page); - } -#ifdef PGTABLE_SANITY_CHECKS - if (pgd_bad(*pgd)) { - printk("Bad pgd in pmd_alloc: %08lx\n", pgd_val(*pgd)); - pgd_set(pgd, BAD_PMD); - return NULL; + pmd_t *page = get_pmd_fast(); + + if (!page) + return get_pmd_slow(pgd, address); + pgd_set(pgd, page); + return page + address; } -#endif return (pmd_t *) pgd_page(*pgd) + address; } -extern inline void pgd_free(pgd_t * pgd) -{ free_page((unsigned long)pgd); } - -extern inline pgd_t * pgd_alloc(void) -{ - extern void __bfill64(void *, unsigned long *); - pgd_t *pgd = (pgd_t *) __get_free_page(GFP_KERNEL); - - if (pgd) - __bfill64((void *)pgd, &null_pmd_table); - return pgd; -} +#define pte_alloc_kernel(pmd, addr) pte_alloc(pmd, addr) +#define pmd_alloc_kernel(pgd, addr) pmd_alloc(pgd, addr) extern pgd_t swapper_pg_dir[1024]; @@ -505,22 +488,18 @@ struct mmu_sglist { extern __u32 mmu_get_scsi_one(char *, unsigned long, struct linux_sbus *sbus); extern void mmu_get_scsi_sgl(struct mmu_sglist *, int, struct linux_sbus *sbus); +extern void mmu_release_scsi_one(u32 vaddr, unsigned long len, + struct linux_sbus *sbus); +extern void mmu_release_scsi_sgl(struct mmu_sglist *sg, int sz, struct linux_sbus *sbus); + +#define NEED_DMA_SYNCHRONIZATION +#define mmu_sync_dma(dma_addr, len, sbus_instance) \ + mmu_release_scsi_one((dma_addr), (len), (sbus_instance)) + /* These do nothing with the way I have things setup. */ -#define mmu_release_scsi_one(vaddr, len, sbus) do { } while(0) -#define mmu_release_scsi_sgl(sg, sz, sbus) do { } while(0) #define mmu_lockarea(vaddr, len) (vaddr) #define mmu_unlockarea(vaddr, len) do { } while(0) - -extern void fixup_dcache_alias(struct vm_area_struct *vma, unsigned long address, - pte_t pte); - -extern inline void update_mmu_cache(struct vm_area_struct * vma, - unsigned long address, pte_t pte) -{ - /* Find and fix bad virutal cache aliases. */ - if((vma->vm_flags & (VM_WRITE|VM_SHARED)) == (VM_WRITE|VM_SHARED)) - fixup_dcache_alias(vma, address, pte); -} +#define update_mmu_cache(vma, address, pte) do { } while(0) /* Make a non-present pseudo-TTE. */ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h index 019bbf600..b47f75b7f 100644 --- a/include/asm-sparc64/processor.h +++ b/include/asm-sparc64/processor.h @@ -1,4 +1,4 @@ -/* $Id: processor.h,v 1.32 1997/07/01 21:59:38 davem Exp $ +/* $Id: processor.h,v 1.33 1997/08/19 14:18:36 jj Exp $ * include/asm-sparc64/processor.h * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -55,10 +55,13 @@ struct thread_struct { #endif /* !(__ASSEMBLY__) */ -#define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */ -#define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */ -#define SPARC_FLAG_NEWSIGNALS 0x4 /* task wants new-style signals */ -#define SPARC_FLAG_32BIT 0x8 /* task is older 32-bit binary */ +#define SPARC_FLAG_USEDFPUL 0x01 /* Used f0-f31 */ +#define SPARC_FLAG_USEDFPUU 0x02 /* Used f32-f62 */ +#define SPARC_FLAG_USEDFPU 0x04 /* If ever FEF bit was set while TSTATE_PEF */ +#define SPARC_FLAG_KTHREAD 0x10 /* task is a kernel thread */ +#define SPARC_FLAG_UNALIGNED 0x20 /* is allowed to do unaligned accesses */ +#define SPARC_FLAG_NEWSIGNALS 0x40 /* task wants new-style signals */ +#define SPARC_FLAG_32BIT 0x80 /* task is older 32-bit binary */ #define INIT_MMAP { &init_mm, 0xfffff80000000000, 0xfffff80001000000, \ PAGE_SHARED , VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } @@ -89,7 +92,7 @@ extern __inline__ unsigned long thread_saved_pc(struct thread_struct *t) /* Do necessary setup to start up a newly executed thread. */ #define start_thread(regs, pc, sp) \ do { \ - regs->tstate = (regs->tstate & (TSTATE_CWP)) | (TSTATE_IE|TSTATE_PEF); \ + regs->tstate = (regs->tstate & (TSTATE_CWP)) | (TSTATE_IE); \ regs->tpc = ((pc & (~3)) - 4); \ regs->tnpc = regs->tpc + 4; \ regs->y = 0; \ @@ -125,7 +128,7 @@ do { \ pc &= 0x00000000ffffffffUL; \ sp &= 0x00000000ffffffffUL; \ \ - regs->tstate = (regs->tstate & (TSTATE_CWP))|(TSTATE_IE|TSTATE_AM|TSTATE_PEF); \ + regs->tstate = (regs->tstate & (TSTATE_CWP))|(TSTATE_IE|TSTATE_AM); \ regs->tpc = ((pc & (~3)) - 4); \ regs->tnpc = regs->tpc + 4; \ regs->y = 0; \ diff --git a/include/asm-sparc64/psycho.h b/include/asm-sparc64/psycho.h new file mode 100644 index 000000000..46bcd4640 --- /dev/null +++ b/include/asm-sparc64/psycho.h @@ -0,0 +1,350 @@ +/* $Id: psycho.h,v 1.2 1997/08/11 14:35:40 davem Exp $ + * psycho.h: UltraSparc AX specific PCI definitions. + * + * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) + */ + +#ifndef __SPARC64_PSYCHO_H +#define __SPARC64_PSYCHO_H + +#include <linux/types.h> + +/* Ultra AX PSYCHO Register Set, one per controller probed. */ +struct psycho_regs { +/*0x0000*/ u64 upa_id; /* PSYCHO UPA Port ID Register */ +/*0x0008*/ u64 upa_cfg; /* PSYCHO UPA Config Register */ +/*0x0010*/ u64 control; /* PSYCHO Control Register */ +/*0x0018*/ u64 __pad0; +/*0x0020*/ u64 ecc_control; /* ECC Control Register */ +/*0x0028*/ u64 __pad1; + + /* Uncorrectable Error Fault Registers */ +/*0x0030*/ u64 ue_afsr; /* UE Async Fault Status */ +/*0x0038*/ u64 ue_afar; /* UE Async Fault Address */ + + /* Correctable Error Fault Registers */ +/*0x0040*/ u64 ce_afsr; /* CE Async Fault Status */ +/*0x0048*/ u64 ce_afar; /* CE Async Fault Address */ + + u64 __pad2[0x16]; + + /* Performance Monitoring Registers */ +/*0x0100*/ u64 pmon_control; +/*0x0108*/ u64 pmon_counter; + + u64 __pad3[0x1e]; + + /* PCI Bus IOMMU lives here */ +/*0x0200*/ u64 iommu_control; /* IOMMU Control */ +/*0x0208*/ u64 iommu_tsbbase; /* IOMMU TSB Base */ +/*0x0210*/ u64 iommu_flush; /* IOMMU Flush Register */ + + u64 __pad4[0x13d]; + + /* Interrupt mapping/control registers */ +/*0x0c00*/ u64 imap_a_slot0; /* PCI A Slot 0 Int Mapping */ +/*0x0c08*/ u64 imap_a_slot1; /* PCI A Slot 1 Int Mapping */ + + u64 __pad5[0x2]; + +/*0x0c20*/ u64 imap_b_slot0; /* PCI B Slot 0 Int Mapping */ +/*0x0c28*/ u64 imap_b_slot1; /* PCI B Slot 1 Int Mapping */ +/*0x0c30*/ u64 imap_b_slot2; /* PCI B Slot 2 Int Mapping */ +/*0x0c38*/ u64 imap_b_slot3; /* PCI B Slot 3 Int Mapping */ + + u64 __pad6[0x78]; + +/*0x1000*/ u64 imap_scsi; /* SCSI Int Mapping */ +/*0x1008*/ u64 imap_eth; /* Ethernet Int Mapping */ +/*0x1010*/ u64 imap_bpp; /* Parallel Port Int Mapping */ +/*0x1018*/ u64 imap_au_rec; /* Audio Record Int Mapping */ +/*0x1020*/ u64 imap_au_play; /* Audio Playback Int Mapping */ +/*0x1028*/ u64 imap_pfail; /* Power Fail Int Mapping */ +/*0x1030*/ u64 imap_kms; /* Kbd/Mouse/Ser Int Mapping */ +/*0x1038*/ u64 imap_flpy; /* Floppy Int Mapping */ +/*0x1040*/ u64 imap_shw; /* Spare HW Int Mapping */ +/*0x1048*/ u64 imap_kbd; /* Kbd Only Int Mapping */ +/*0x1050*/ u64 imap_ms; /* Mouse Only Int Mapping */ +/*0x1058*/ u64 imap_ser; /* Serial Only Int Mapping */ +/*0x1060*/ u64 imap_tim0; /* Timer 0 Int Mapping */ +/*0x1068*/ u64 imap_tim1; /* Timer 1 Int Mapping */ +/*0x1070*/ u64 imap_ue; /* UE Int Mapping */ +/*0x1078*/ u64 imap_ce; /* CE Int Mapping */ +/*0x1080*/ u64 imap_a_err; /* PCI A Err Int Mapping */ +/*0x1088*/ u64 imap_b_err; /* PCI B Err Int Mapping */ +/*0x1090*/ u64 imap_pmgmt; /* Power Mgmt Int Mapping */ +/*0x1098*/ u64 imap_gfx; /* OB Graphics Int Mapping */ +/*0x10a0*/ u64 imap_eupa; /* UPA Expansion Int Mapping */ + + u64 __pad7[0x6b]; + + /* Interrupt Clear Registers */ +/*0x1400*/ u64 iclr_a_slot0[4]; /* PCI A Slot 0 Clear Int Reg */ +/*0x1420*/ u64 iclr_a_slot1[4]; /* PCI A Slot 1 Clear Int Reg */ + + u64 __pad8[0x8]; + +/*0x1480*/ u64 iclr_b_slot0[4]; /* PCI B Slot 0 Clear Int Reg */ +/*0x14a0*/ u64 iclr_b_slot1[4]; /* PCI B Slot 1 Clear Int Reg */ +/*0x14c0*/ u64 iclr_b_slot2[4]; /* PCI B Slot 2 Clear Int Reg */ +/*0x14e0*/ u64 iclr_b_slot3[4]; /* PCI B Slot 3 Clear Int Reg */ + + u64 __pad9[0x60]; + +/*0x1800*/ u64 iclr_scsi; +/*0x1808*/ u64 iclr_eth; +/*0x1810*/ u64 iclr_bpp; +/*0x1818*/ u64 iclr_au_rec; +/*0x1820*/ u64 iclr_au_play; +/*0x1828*/ u64 iclr_pfail; +/*0x1830*/ u64 iclr_kms; +/*0x1838*/ u64 iclr_flpy; +/*0x1840*/ u64 iclr_shw; +/*0x1848*/ u64 iclr_kbd; +/*0x1850*/ u64 iclr_ms; +/*0x1858*/ u64 iclr_ser; +/*0x1860*/ u64 iclr_tim0; +/*0x1868*/ u64 iclr_tim1; +/*0x1870*/ u64 iclr_ue; +/*0x1878*/ u64 iclr_ce; +/*0x1880*/ u64 iclr_a_err; +/*0x1888*/ u64 iclr_b_err; +/*0x1890*/ u64 iclr_pmgmt; + + u64 __pad10[0x2d]; + + /* Interrupt Retry Timer. */ +/*0x1a00*/ u64 irq_retry; + + u64 __pad11[0x3f]; + + /* Counters/Timers */ +/*0x1c00*/ u64 tim0_cnt; +/*0x1c08*/ u64 tim0_lim; +/*0x1c10*/ u64 tim1_cnt; +/*0x1c18*/ u64 tim1_lim; + + u64 __pad12[0x7c]; + + /* PCI Bus A Registers */ +/*0x2000*/ u64 pci_a_control; /* PCI Bus A Control Register */ +/*0x2008*/ u64 __pad13; +/*0x2010*/ u64 pci_a_afsr; /* PCI Bus A Async Fault Status */ +/*0x2018*/ u64 pci_a_afar; /* PCI Bus A Async Fault Address*/ +/*0x2020*/ u64 pci_a_diag; /* PCI Bus A Diag Register */ + + u64 __pad14[0xfb]; + + /* PCI Bus A/IOMMU Streaming Buffer Registers */ +/*0x2800*/ u64 sbuf_a_control; /* StrBuffer Control */ +/*0x2808*/ u64 sbuf_a_pflush; /* StrBuffer Page Flush */ +/*0x2810*/ u64 sbuf_a_fsync; /* StrBuffer Flush Sync Reg */ + + u64 __pad15[0x2fd]; + + /* PCI Bus B Registers */ +/*0x4000*/ u64 pci_b_control; /* PCI Bus B Control Register */ +/*0x4008*/ u64 __pad16; +/*0x4010*/ u64 pci_b_afsr; /* PCI Bus B Async Fault Status */ +/*0x4018*/ u64 pci_b_afar; /* PCI Bus B Async Fault Address*/ +/*0x4020*/ u64 pci_b_diag; /* PCI Bus B Diag Register */ + + u64 __pad17[0x7b]; + + /* IOMMU diagnostic things */ +/*0x4400*/ u64 iommu_vdiag; /* VADDR Diagnostic Register */ +/*0x4408*/ u64 iommu_tcompare; /* IOMMU TLB Tag Compare */ + + u64 __pad18[0x7e]; + + /* PCI Bus B/IOMMU Streaming Buffer Registers */ +/*0x4800*/ u64 sbuf_b_control; /* StrBuffer Control */ +/*0x4808*/ u64 sbuf_b_pflush; /* StrBuffer Page Flush */ +/*0x4810*/ u64 sbuf_b_fsync; /* StrBuffer Flush Sync Reg */ + + u64 __pad19[0xafd]; + + /* DMA Scoreboard Diagnostic Registers */ +/*0xa000*/ u64 dscore_reg0; /* DMA Scoreboard Diag Reg 0 */ +/*0xa008*/ u64 dscore_reg1; /* DMA Scoreboard Diag Reg 1 */ + + u64 __pad20[0x9e]; + + /* More IOMMU diagnostic things */ +/*0xa500*/ u64 iommu_lru[16]; /* IOMMU LRU Queue Diag */ +/*0xa580*/ u64 iommu_tag[16]; /* IOMMU TLB Tag Diag */ +/*0xa600*/ u64 iommu_data[16]; /* IOMMU TLB Data RAM Diag */ + + u64 __pad21[0x30]; + + /* Interrupt State Diagnostics */ +/*0xa800*/ u64 pci_istate; +/*0xa808*/ u64 obio_istate; + + u64 __pad22[0xfe]; + + /* Streaming Buffer A Diagnostic Area */ +/*0xb000*/ u64 sbuf_a_data[128]; /* StrBuffer Data Ram Diag */ +/*0xb400*/ u64 sbuf_a_errs[128]; /* StrBuffer Error Status Diag*/ +/*0xb800*/ u64 sbuf_a_ptag[16]; /* StrBuffer Page Tag Diag */ +/*0xb880*/ u64 __pad23[16]; +/*0xb900*/ u64 sbuf_a_ltag[16]; /* StrBuffer Line Tag Diag */ + + u64 __pad24[0xd0]; + + /* Streaming Buffer B Diagnostic Area */ +/*0xc000*/ u64 sbuf_b_data[128]; /* StrBuffer Data Ram Diag */ +/*0xc400*/ u64 sbuf_b_errs[128]; /* StrBuffer Error Status Diag*/ +/*0xc800*/ u64 sbuf_b_ptag[16]; /* StrBuffer Page Tag Diag */ +/*0xc880*/ u64 __pad25[16]; +/*0xc900*/ u64 sbuf_b_ltag[16]; /* StrBuffer Line Tag Diag */ +}; + +/* PSYCHO UPA Port ID */ +#define PSYCHO_UPPID_FESC 0xff00000000000000 /* FCode escape, 0xfc */ +#define PSYCHO_UPPID_RESV1 0x00fffff800000000 /* Reserved */ +#define PSYCHO_UPPID_ENV 0x0000000400000000 /* Cannot generate ECC */ +#define PSYCHO_UPPID_ORD 0x0000000200000000 /* One Outstanding Read */ +#define PSYCHO_UPPID_RESV2 0x0000000180000000 /* Reserved */ +#define PSYCHO_UPPID_PDQ 0x000000007e000000 /* Data Queue size */ +#define PSYCHO_UPPID_PRQ 0x0000000001e00000 /* Request Queue size */ +#define PSYCHO_UPPID_UCAP 0x00000000001f0000 /* UPA Capabilities */ +#define PSYCHO_UPPID_JEDEC 0x000000000000ffff /* JEDEC ID for PSYCHO */ + +/* PSYCHO UPA Configuration Register */ +#define PSYCHO_UPCFG_RESV 0xffffffffffffff00 /* Reserved */ +#define PSYCHO_UPCFG_SCIQ1 0x00000000000000f0 /* Unused, always zero */ +#define PSYCHO_UPCFG_SCIQ2 0x000000000000000f /* Requests Queue size 0x2 */ + +/* PSYCHO Control Register */ +#define PSYCHO_CONTROL_IMPL 0xf000000000000000 /* Implementation of this PSYCHO*/ +#define PSYCHO_CONTROL_VER 0x0f00000000000000 /* Version of this PSYCHO */ +#define PSYCHO_CONTROL_MID 0x00f8000000000000 /* UPA Module ID of PSYCHO */ +#define PSYCHO_CONTROL_IGN 0x0007c00000000000 /* Interrupt Group Number */ +#define PSYCHO_CONTROL_RESV 0x00003ffffffffff0 /* Reserved */ +#define PSYCHO_CONTROL_APCKEN 0x0000000000000008 /* Address Parity Check Enable */ +#define PSYCHO_CONTROL_APERR 0x0000000000000004 /* Incoming System Addr Parerr */ +#define PSYCHO_CONTROL_IAP 0x0000000000000002 /* Invert UPA Parity */ +#define PSYCHO_CONTROL_MODE 0x0000000000000001 /* PSYCHO clock mode */ + +/* PSYCHO ECC Control Register */ +#define PSYCHO_ECNTRL_ECCEN 0x8000000000000000 /* Enable ECC Checking */ +#define PSYCHO_ECNTRL_UEEN 0x4000000000000000 /* Enable UE Interrupts */ +#define PSYCHO_ECNTRL_CEEN 0x2000000000000000 /* Enable CE Interrupts */ + +/* Uncorrectable Error AFSR, AFAR holds low 40bits of faulting physical address. */ +#define PSYCHO_UEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */ +#define PSYCHO_UEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */ +#define PSYCHO_UEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */ +#define PSYCHO_UEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */ +#define PSYCHO_UEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */ +#define PSYCHO_UEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/ +#define PSYCHO_UEAFSR_RESV1 0x03ff000000000000 /* Reserved */ +#define PSYCHO_UEAFSR_BMSK 0x0000ffff00000000 /* Bytemask of failed transfer */ +#define PSYCHO_UEAFSR_DOFF 0x00000000e0000000 /* Doubleword Offset */ +#define PSYCHO_UEAFSR_MID 0x000000001f000000 /* UPA MID causing the fault */ +#define PSYCHO_UEAFSR_BLK 0x0000000000800000 /* Trans was block operation */ +#define PSYCHO_UEAFSR_RESV2 0x00000000007fffff /* Reserved */ + +/* Correctable Error AFSR, AFAR holds low 40bits of faulting physical address. */ +#define PSYCHO_CEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */ +#define PSYCHO_CEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */ +#define PSYCHO_CEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */ +#define PSYCHO_CEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */ +#define PSYCHO_CEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */ +#define PSYCHO_CEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/ +#define PSYCHO_CEAFSR_RESV1 0x0300000000000000 /* Reserved */ +#define PSYCHO_CEAFSR_ESYND 0x00ff000000000000 /* Syndrome Bits */ +#define PSYCHO_UEAFSR_SIZE 0x0000ffff00000000 /* Bytemask of failed transfer */ +#define PSYCHO_CEAFSR_DOFF 0x00000000e0000000 /* Double Offset */ +#define PSYCHO_CEAFSR_MID 0x000000001f000000 /* UPA MID causing the fault */ +#define PSYCHO_CEAFSR_BLK 0x0000000000800000 /* Trans was block operation */ +#define PSYCHO_CEAFSR_RESV2 0x00000000007fffff /* Reserved */ + +/* DMA Scoreboard Diagnostic Register(s) */ +#define PSYCHO_DSCORE_VALID 0x8000000000000000 /* Entry is valid */ +#define PSYCHO_DSCORE_C 0x4000000000000000 /* Transaction cacheable */ +#define PSYCHO_DSCORE_READ 0x2000000000000000 /* Transaction was a read */ +#define PSYCHO_DSCORE_TAG 0x1f00000000000000 /* Transaction ID */ +#define PSYCHO_DSCORE_ADDR 0x00fffffffff80000 /* Transaction PADDR */ +#define PSYCHO_DSCORE_BMSK 0x000000000007fff8 /* Bytemask of pending transfer */ +#define PSYCHO_DSCORE_SRC 0x0000000000000007 /* Transaction source */ + +/* PSYCHO PCI Control Register */ +#define PSYCHO_PCICTRL_RESV1 0xfffffff000000000 /* Reserved */ +#define PSYCHO_PCICTRL_SBH_ERR 0x0000000800000000 /* Streaming byte hole error */ +#define PSYCHO_PCICTRL_SERR 0x0000000400000000 /* SERR signal asserted */ +#define PSYCHO_PCICTRL_SPEED 0x0000000200000000 /* PCI speed (1 is U2P clock) */ +#define PSYCHO_PCICTRL_RESV2 0x00000001ffc00000 /* Reserved */ +#define PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000 /* PCI arbitration parking */ +#define PSYCHO_PCICTRL_RESV3 0x00000000001ff800 /* Reserved */ +#define PSYCHO_PCICTRL_SBH_INT 0x0000000000000400 /* Streaming byte hole int enab */ +#define PSYCHO_PCICTRL_WEN 0x0000000000000200 /* Power Mgmt Wake Enable */ +#define PSYCHO_PCICTRL_EEN 0x0000000000000100 /* PCI Error Interrupt Enable */ +#define PSYCHO_PCICTRL_RESV4 0x00000000000000c0 /* Reserved */ +#define PSYCHO_PCICTRL_AEN 0x000000000000003f /* PCI DVMA Arbitration Enable */ + +/* PSYCHO PCI AFSR, AFAR holds low 40 bits of physical address causing the fault. */ +#define PSYCHO_PCIAFSR_PMA 0x8000000000000000 /* Primary Master Abort Error */ +#define PSYCHO_PCIAFSR_PTA 0x4000000000000000 /* Primary Target Abort Error */ +#define PSYCHO_PCIAFSR_PRTRY 0x2000000000000000 /* Primary Excessive Retries */ +#define PSYCHO_PCIAFSR_PPERR 0x1000000000000000 /* Primary Parity Error */ +#define PSYCHO_PCIAFSR_SMA 0x0800000000000000 /* Secondary Master Abort Error */ +#define PSYCHO_PCIAFSR_STA 0x0400000000000000 /* Secondary Target Abort Error */ +#define PSYCHO_PCIAFSR_SRTRY 0x0200000000000000 /* Secondary Excessive Retries */ +#define PSYCHO_PCIAFSR_SPERR 0x0100000000000000 /* Secondary Parity Error */ +#define PSYCHO_PCIAFSR_RESV1 0x00ff000000000000 /* Reserved */ +#define PSYCHO_PCIAFSR_SIZE 0x0000ffff00000000 /* Bytemask of failed transfer */ +#define PSYCHO_PCIAFSR_BLK 0x0000000080000000 /* Trans was block operation */ +#define PSYCHO_PCIAFSR_RESV2 0x0000000040000000 /* Reserved */ +#define PSYCHO_PCIAFSR_MID 0x000000003e000000 /* MID causing the error */ +#define PSYCHO_PCIAFSR_RESV3 0x0000000001ffffff /* Reserved */ + +/* IOMMU things defined fully in asm-sparc64/iommu.h */ + +/* Streaming Buffer Control Register */ +#define PSYCHO_SBUFCTRL_RESV 0xffffffffffffff80 /* Reserved */ +#define PSYCHO_SBUFCTRL_LRU_LP 0x0000000000000070 /* LRU Lock Pointer */ +#define PSYCHO_SBUFCTRL_LRU_LE 0x0000000000000008 /* LRU Lock Enable */ +#define PSYCHO_SBUFCTRL_RR_DIS 0x0000000000000004 /* Rerun Disable */ +#define PSYCHO_SBUFCTRL_DE 0x0000000000000002 /* Diag Mode Enable */ +#define PSYCHO_SBUFCTRL_SB_EN 0x0000000000000001 /* Streaming Buffer Enable */ + +/* Streaming Buffer Page Invalidate/Flush Register */ +#define PSYCHO_SBUFFLUSH_ADDR 0x00000000ffffe000 /* DVMA Page to be flushed */ +#define PSYCHO_SBUFFLUSH_RESV 0x0000000000001fff /* Ignored bits */ + +/* Streaming Buffer Flush Synchronization Register */ +#define PSYCHO_SBUFSYNC_ADDR 0x000001ffffffffc0 /* Physical address to update */ +#define PSYCHO_SBUFSYNC_RESV 0x000000000000003f /* Ignored bits */ + +/* PSYCHO Interrupt mapping register(s). */ +#define PSYCHO_IMAP_RESV1 0xffffffff00000000 /* Reserved */ +#define PSYCHO_IMAP_VALID 0x0000000080000000 /* This enables delivery. */ +#define PSYCHO_IMAP_TID 0x000000007c000000 /* Target ID (MID to send it to)*/ +#define PSYCHO_IMAP_RESV2 0x0000000003fff800 /* Reserved */ +#define PSYCHO_IMAP_IGN 0x00000000000007c0 /* Interrupt Group Number. */ +#define PSYCHO_IMAP_INO 0x000000000000003f /* Interrupt Number Offset. */ +#define PSYCHO_IMAP_INR 0x00000000000007ff /* Interrupt # (Gfx/UPA_slave) */ + +/* PSYCHO Interrupt clear pseudo register(s). */ +#define PSYCHO_ICLR_RESV1 0xfffffffffffffff0 /* Reserved */ +#define PSYCHO_ICLR_IDLE 0x0000000000000000 /* Transition to idle state. */ +#define PSYCHO_ICLR_TRANSMIT 0x0000000000000001 /* Transition to transmit state */ +#define PSYCHO_ICLR_RESV2 0x0000000000000002 /* Reserved. */ +#define PSYCHO_ICLR_PENDING 0x0000000000000003 /* Transition to pending state. */ + +/* PSYCHO Interrupt Retry Timer register. */ +#define PSYCHO_IRETRY_LIMIT 0x00000000000fffff /* The retry interval. */ + +/* PSYCHO Interrupt State registers. XXX fields to be documented later */ + +/* PSYCHO Counter register. XXX fields to be documented later */ + +/* PSYCHO Limit register. XXX fields to be documented later */ + +/* PSYCHO Performance Monitor Control register. XXX fields to be documented later */ + +/* PSYCHO Performance Monitor Counter register. XXX fields to be documented later */ + +#endif /* !(__SPARC64_PSYCHO_H) */ diff --git a/include/asm-sparc64/sab82532.h b/include/asm-sparc64/sab82532.h new file mode 100644 index 000000000..09146f39e --- /dev/null +++ b/include/asm-sparc64/sab82532.h @@ -0,0 +1,375 @@ +/* $Id: sab82532.h,v 1.3 1997/09/03 11:55:04 ecd Exp $ + * sab82532.h: Register Definitions for the Siemens SAB82532 DUSCC + * + * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) + */ + +#ifndef _SPARC64_SAB82532_H +#define _SPARC64_SAB82532_H + +#include <linux/types.h> +#include <linux/serial.h> + +struct sab82532_async_rd_regs { + u8 rfifo[0x20]; /* Receive FIFO */ + u8 star; /* Status Register */ + u8 __pad1; + u8 mode; /* Mode Register */ + u8 timr; /* Timer Register */ + u8 xon; /* XON Character */ + u8 xoff; /* XOFF Character */ + u8 tcr; /* Termination Character Register */ + u8 dafo; /* Data Format */ + u8 rfc; /* RFIFO Control Register */ + u8 __pad2; + u8 rbcl; /* Receive Byte Count Low */ + u8 rbch; /* Receive Byte Count High */ + u8 ccr0; /* Channel Configuration Register 0 */ + u8 ccr1; /* Channel Configuration Register 1 */ + u8 ccr2; /* Channel Configuration Register 2 */ + u8 ccr3; /* Channel Configuration Register 3 */ + u8 __pad3[4]; + u8 vstr; /* Version Status Register */ + u8 __pad4[3]; + u8 gis; /* Global Interrupt Status */ + u8 ipc; /* Interrupt Port Configuration */ + u8 isr0; /* Interrupt Status 0 */ + u8 isr1; /* Interrupt Status 1 */ + u8 pvr; /* Port Value Register */ + u8 pis; /* Port Interrupt Status */ + u8 pcr; /* Port Configuration Register */ + u8 ccr4; /* Channel Configuration Register 4 */ +}; + +struct sab82532_async_wr_regs { + u8 xfifo[0x20]; /* Transmit FIFO */ + u8 cmdr; /* Command Register */ + u8 __pad1; + u8 mode; + u8 timr; + u8 xon; + u8 xoff; + u8 tcr; + u8 dafo; + u8 rfc; + u8 __pad2; + u8 xbcl; /* Transmit Byte Count Low */ + u8 xbch; /* Transmit Byte Count High */ + u8 ccr0; + u8 ccr1; + u8 ccr2; + u8 ccr3; + u8 tsax; /* Time-Slot Assignment Reg. Transmit */ + u8 tsar; /* Time-Slot Assignment Reg. Receive */ + u8 xccr; /* Transmit Channel Capacity Register */ + u8 rccr; /* Receive Channel Capacity Register */ + u8 bgr; /* Baud Rate Generator Register */ + u8 tic; /* Transmit Immediate Character */ + u8 mxn; /* Mask XON Character */ + u8 mxf; /* Mask XOFF Character */ + u8 iva; /* Interrupt Vector Address */ + u8 ipc; + u8 imr0; /* Interrupt Mask Register 0 */ + u8 imr1; /* Interrupt Mask Register 1 */ + u8 pvr; + u8 pim; /* Port Interrupt Mask */ + u8 pcr; + u8 ccr4; +}; + +struct sab82532_async_rw_regs { /* Read/Write registers */ + u8 __pad1[0x20]; + u8 __pad2; + u8 __pad3; + u8 mode; + u8 timr; + u8 xon; + u8 xoff; + u8 tcr; + u8 dafo; + u8 rfc; + u8 __pad4; + u8 __pad5; + u8 __pad6; + u8 ccr0; + u8 ccr1; + u8 ccr2; + u8 ccr3; + u8 __pad7; + u8 __pad8; + u8 __pad9; + u8 __pad10; + u8 __pad11; + u8 __pad12; + u8 __pad13; + u8 __pad14; + u8 __pad15; + u8 ipc; + u8 __pad16; + u8 __pad17; + u8 pvr; + u8 __pad18; + u8 pcr; + u8 ccr4; +}; + +union sab82532_async_regs { + __volatile__ struct sab82532_async_rd_regs r; + __volatile__ struct sab82532_async_wr_regs w; + __volatile__ struct sab82532_async_rw_regs rw; +}; + +#define NR_PORTS 2 + +union sab82532_irq_status { + unsigned short stat; + struct { + unsigned char isr0; + unsigned char isr1; + } sreg; +}; + +struct sab82532 { + int magic; + int baud_base; + union sab82532_async_regs *regs; + int irq; + int flags; /* defined in tty.h */ + int type; /* SAB82532 version */ + struct tty_struct *tty; + int read_status_mask; + int ignore_status_mask; + int timeout; + int xmit_fifo_size; + int recv_fifo_size; + int custom_divisor; + int quot; + int x_char; + int close_delay; + unsigned short closing_wait; + unsigned short closing_wait2; + int all_sent; + int is_console; + unsigned char interrupt_mask0; + unsigned char interrupt_mask1; + unsigned char pvr_dtr_bit; + unsigned char pvr_dsr_bit; + unsigned char dcd; + unsigned char cts; + unsigned char dsr; + unsigned long event; + unsigned long last_active; + int line; + int count; + int blocked_open; + long session; + long pgrp; + unsigned char *xmit_buf; + int xmit_head; + int xmit_tail; + int xmit_cnt; + struct tq_struct tqueue; + struct tq_struct tqueue_hangup; + struct async_icount icount; + struct termios normal_termios; + struct termios callout_termios; + struct wait_queue *open_wait; + struct wait_queue *close_wait; + struct wait_queue *delta_msr_wait; + struct sab82532 *next; + struct sab82532 *prev; +}; + + +/* RFIFO Status Byte */ +#define SAB82532_RSTAT_PE 0x80 +#define SAB82532_RSTAT_FE 0x40 +#define SAB82532_RSTAT_PARITY 0x01 + +/* Status Register (STAR) */ +#define SAB82532_STAR_XDOV 0x80 +#define SAB82532_STAR_XFW 0x40 +#define SAB82532_STAR_RFNE 0x20 +#define SAB82532_STAR_FCS 0x10 +#define SAB82532_STAR_TEC 0x08 +#define SAB82532_STAR_CEC 0x04 +#define SAB82532_STAR_CTS 0x02 + +/* Command Register (CMDR) */ +#define SAB82532_CMDR_RMC 0x80 +#define SAB82532_CMDR_RRES 0x40 +#define SAB82532_CMDR_RFRD 0x20 +#define SAB82532_CMDR_STI 0x10 +#define SAB82532_CMDR_XF 0x08 +#define SAB82532_CMDR_XRES 0x01 + +/* Mode Register (MODE) */ +#define SAB82532_MODE_FRTS 0x40 +#define SAB82532_MODE_FCTS 0x20 +#define SAB82532_MODE_FLON 0x10 +#define SAB82532_MODE_RAC 0x08 +#define SAB82532_MODE_RTS 0x04 +#define SAB82532_MODE_TRS 0x02 +#define SAB82532_MODE_TLP 0x01 + +/* Timer Register (TIMR) */ +#define SAB82532_TIMR_CNT_MASK 0xe0 +#define SAB82532_TIMR_VALUE_MASK 0x1f + +/* Data Format (DAFO) */ +#define SAB82532_DAFO_XBRK 0x40 +#define SAB82532_DAFO_STOP 0x20 +#define SAB82532_DAFO_PAR_SPACE 0x00 +#define SAB82532_DAFO_PAR_ODD 0x08 +#define SAB82532_DAFO_PAR_EVEN 0x10 +#define SAB82532_DAFO_PAR_MARK 0x18 +#define SAB82532_DAFO_PARE 0x04 +#define SAB82532_DAFO_CHL8 0x00 +#define SAB82532_DAFO_CHL7 0x01 +#define SAB82532_DAFO_CHL6 0x02 +#define SAB82532_DAFO_CHL5 0x03 + +/* RFIFO Control Register (RFC) */ +#define SAB82532_RFC_DPS 0x40 +#define SAB82532_RFC_DXS 0x20 +#define SAB82532_RFC_RFDF 0x10 +#define SAB82532_RFC_RFTH_1 0x00 +#define SAB82532_RFC_RFTH_4 0x04 +#define SAB82532_RFC_RFTH_16 0x08 +#define SAB82532_RFC_RFTH_32 0x0c +#define SAB82532_RFC_TCDE 0x01 + +/* Received Byte Count High (RBCH) */ +#define SAB82532_RBCH_DMA 0x80 +#define SAB82532_RBCH_CAS 0x20 + +/* Transmit Byte Count High (XBCH) */ +#define SAB82532_XBCH_DMA 0x80 +#define SAB82532_XBCH_CAS 0x20 +#define SAB82532_XBCH_XC 0x10 + +/* Channel Configuration Register 0 (CCR0) */ +#define SAB82532_CCR0_PU 0x80 +#define SAB82532_CCR0_MCE 0x40 +#define SAB82532_CCR0_SC_NRZ 0x00 +#define SAB82532_CCR0_SC_NRZI 0x08 +#define SAB82532_CCR0_SC_FM0 0x10 +#define SAB82532_CCR0_SC_FM1 0x14 +#define SAB82532_CCR0_SC_MANCH 0x18 +#define SAB82532_CCR0_SM_HDLC 0x00 +#define SAB82532_CCR0_SM_SDLC_LOOP 0x01 +#define SAB82532_CCR0_SM_BISYNC 0x02 +#define SAB82532_CCR0_SM_ASYNC 0x03 + +/* Channel Configuration Register 1 (CCR1) */ +#define SAB82532_CCR1_ODS 0x10 +#define SAB82532_CCR1_BCR 0x08 +#define SAB82532_CCR1_CM_MASK 0x07 + +/* Channel Configuration Register 2 (CCR2) */ +#define SAB82532_CCR2_SOC1 0x80 +#define SAB82532_CCR2_SOC0 0x40 +#define SAB82532_CCR2_BR9 0x80 +#define SAB82532_CCR2_BR8 0x40 +#define SAB82532_CCR2_BDF 0x20 +#define SAB82532_CCR2_SSEL 0x10 +#define SAB82532_CCR2_XCS0 0x20 +#define SAB82532_CCR2_RCS0 0x10 +#define SAB82532_CCR2_TOE 0x08 +#define SAB82532_CCR2_RWX 0x04 +#define SAB82532_CCR2_DIV 0x01 + +/* Channel Configuration Register 3 (CCR3) */ +#define SAB82532_CCR3_PSD 0x01 + +/* Time Slot Assignment Register Transmit (TSAX) */ +#define SAB82532_TSAX_TSNX_MASK 0xfc +#define SAB82532_TSAX_XCS2 0x02 /* see also CCR2 */ +#define SAB82532_TSAX_XCS1 0x01 + +/* Time Slot Assignment Register Receive (TSAR) */ +#define SAB82532_TSAR_TSNR_MASK 0xfc +#define SAB82532_TSAR_RCS2 0x02 /* see also CCR2 */ +#define SAB82532_TSAR_RCS1 0x01 + +/* Version Status Register (VSTR) */ +#define SAB82532_VSTR_CD 0x80 +#define SAB82532_VSTR_DPLA 0x40 +#define SAB82532_VSTR_VN_MASK 0x0f +#define SAB82532_VSTR_VN_1 0x00 +#define SAB82532_VSTR_VN_2 0x01 +#define SAB82532_VSTR_VN_3_2 0x02 + +/* Global Interrupt Status Register (GIS) */ +#define SAB82532_GIS_PI 0x80 +#define SAB82532_GIS_ISA1 0x08 +#define SAB82532_GIS_ISA0 0x04 +#define SAB82532_GIS_ISB1 0x02 +#define SAB82532_GIS_ISB0 0x01 + +/* Interrupt Vector Address (IVA) */ +#define SAB82532_IVA_MASK 0xf1 + +/* Interrupt Port Configuration (IPC) */ +#define SAB82532_IPC_VIS 0x80 +#define SAB82532_IPC_SLA1 0x10 +#define SAB82532_IPC_SLA0 0x08 +#define SAB82532_IPC_CASM 0x04 +#define SAB82532_IPC_IC_OPEN_DRAIN 0x00 +#define SAB82532_IPC_IC_ACT_LOW 0x01 +#define SAB82532_IPC_IC_ACT_HIGH 0x03 + +/* Interrupt Status Register 0 (ISR0) */ +#define SAB82532_ISR0_TCD 0x80 +#define SAB82532_ISR0_TIME 0x40 +#define SAB82532_ISR0_PERR 0x20 +#define SAB82532_ISR0_FERR 0x10 +#define SAB82532_ISR0_PLLA 0x08 +#define SAB82532_ISR0_CDSC 0x04 +#define SAB82532_ISR0_RFO 0x02 +#define SAB82532_ISR0_RPF 0x01 + +/* Interrupt Status Register 1 (ISR1) */ +#define SAB82532_ISR1_BRK 0x80 +#define SAB82532_ISR1_BRKT 0x40 +#define SAB82532_ISR1_ALLS 0x20 +#define SAB82532_ISR1_XOFF 0x10 +#define SAB82532_ISR1_TIN 0x08 +#define SAB82532_ISR1_CSC 0x04 +#define SAB82532_ISR1_XON 0x02 +#define SAB82532_ISR1_XPR 0x01 + +/* Interrupt Mask Register 0 (IMR0) */ +#define SAB82532_IMR0_TCD 0x80 +#define SAB82532_IMR0_TIME 0x40 +#define SAB82532_IMR0_PERR 0x20 +#define SAB82532_IMR0_FERR 0x10 +#define SAB82532_IMR0_PLLA 0x08 +#define SAB82532_IMR0_CDSC 0x04 +#define SAB82532_IMR0_RFO 0x02 +#define SAB82532_IMR0_RPF 0x01 + +/* Interrupt Mask Register 1 (IMR1) */ +#define SAB82532_IMR1_BRK 0x80 +#define SAB82532_IMR1_BRKT 0x40 +#define SAB82532_IMR1_ALLS 0x20 +#define SAB82532_IMR1_XOFF 0x10 +#define SAB82532_IMR1_TIN 0x08 +#define SAB82532_IMR1_CSC 0x04 +#define SAB82532_IMR1_XON 0x02 +#define SAB82532_IMR1_XPR 0x01 + +/* Port Interrupt Status Register (PIS) */ +#define SAB82532_PIS_SYNC_B 0x08 +#define SAB82532_PIS_DTR_B 0x04 +#define SAB82532_PIS_DTR_A 0x02 +#define SAB82532_PIS_SYNC_A 0x01 + +/* Channel Configuration Register 4 (CCR4) */ +#define SAB82532_CCR4_MCK4 0x80 +#define SAB82532_CCR4_EBRG 0x40 +#define SAB82532_CCR4_TST1 0x20 +#define SAB82532_CCR4_ICD 0x10 + + +#endif /* !(_SPARC64_SAB82532_H) */ diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h index 3fb21e06e..2c89a84ba 100644 --- a/include/asm-sparc64/sbus.h +++ b/include/asm-sparc64/sbus.h @@ -1,4 +1,4 @@ -/* $Id: sbus.h,v 1.3 1997/03/21 17:57:24 jj Exp $ +/* $Id: sbus.h,v 1.5 1997/08/12 04:13:16 ecd Exp $ * sbus.h: Defines for the Sun SBus. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -87,9 +87,7 @@ extern struct linux_sbus *SBus_chain; for((device) = (bus)->devices; (device); (device)=(device)->next) #define for_all_sbusdev(device, bus) \ - for((bus) = SBus_chain, (device) = (bus)->devices; (bus); (device)=((device)->next ? (device)->next : ((bus) = (bus)->next, (bus) ? (bus)->devices : 0))) - -/* XXX This is promlib stuff, what is it doing here? XXX */ + for((bus) = SBus_chain, ((device) = (bus) ? (bus)->devices : 0); (bus); (device)=((device)->next ? (device)->next : ((bus) = (bus)->next, (bus) ? (bus)->devices : 0))) /* Apply promlib probed SBUS ranges to registers. */ extern void prom_apply_sbus_ranges(struct linux_sbus *sbus, diff --git a/include/asm-sparc64/semaphore.h b/include/asm-sparc64/semaphore.h index 297173a89..4a5912bb9 100644 --- a/include/asm-sparc64/semaphore.h +++ b/include/asm-sparc64/semaphore.h @@ -38,20 +38,28 @@ extern void __up(struct semaphore * sem); extern __inline__ void down(struct semaphore * sem) { - if (atomic_dec_return(&sem->count) < 0) + int result; + + result = atomic_dec_return(&sem->count); + membar("#StoreLoad | #StoreStore"); + if (result < 0) __down(sem); } extern __inline__ int down_interruptible(struct semaphore *sem) { - int ret = 0; - if (atomic_dec_return(&sem->count) < 0) + int result, ret = 0; + + result = atomic_dec_return(&sem->count); + membar("#StoreLoad | #StoreStore"); + if (result < 0) ret = __down_interruptible(sem); return ret; } extern __inline__ void up(struct semaphore * sem) { + membar("#StoreStore | #LoadStore"); if (atomic_inc_return(&sem->count) <= 0) __up(sem); } diff --git a/include/asm-sparc64/shmparam.h b/include/asm-sparc64/shmparam.h index ded0406b4..3b90c34b1 100644 --- a/include/asm-sparc64/shmparam.h +++ b/include/asm-sparc64/shmparam.h @@ -1,4 +1,4 @@ -/* $Id: shmparam.h,v 1.1 1996/12/26 14:22:36 davem Exp $ */ +/* $Id: shmparam.h,v 1.2 1997/08/04 16:16:55 davem Exp $ */ #ifndef _ASMSPARC64_SHMPARAM_H #define _ASMSPARC64_SHMPARAM_H @@ -41,7 +41,7 @@ #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)) -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ +#define SHMLBA (PAGE_SIZE<<1) /* attach addr a multiple of this */ #define SHMSEG SHMMNI /* max shared segs per process */ #endif /* _ASMSPARC64_SHMPARAM_H */ diff --git a/include/asm-sparc64/sigcontext.h b/include/asm-sparc64/sigcontext.h index 3fba2f834..8934cd9b1 100644 --- a/include/asm-sparc64/sigcontext.h +++ b/include/asm-sparc64/sigcontext.h @@ -1,4 +1,4 @@ -/* $Id: sigcontext.h,v 1.8 1997/06/20 11:54:41 davem Exp $ */ +/* $Id: sigcontext.h,v 1.9 1997/08/19 14:18:38 jj Exp $ */ #ifndef __SPARC64_SIGCONTEXT_H #define __SPARC64_SIGCONTEXT_H @@ -31,7 +31,6 @@ struct sigcontext32 { int sigc_oswins; /* outstanding windows */ /* stack ptrs for each regwin buf */ - /* XXX 32-bit ptrs pinhead... */ unsigned sigc_spbuf[SUNOS_MAXWIN]; /* Windows to restore after signal */ @@ -75,11 +74,7 @@ typedef struct { unsigned int si_float_regs [64]; unsigned long si_fsr; unsigned long si_gsr; - unsigned int si_fpqdepth; - struct { - unsigned int *insn_addr; - unsigned int insn; - } si_fpqueue [16]; + unsigned long si_fprs; } __siginfo_fpu_t; #endif /* !(__ASSEMBLY__) */ diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index 116f83237..363be0fe9 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h @@ -6,6 +6,7 @@ #ifndef _SPARC64_SMP_H #define _SPARC64_SMP_H +#include <linux/tasks.h> #include <asm/asi.h> #ifndef __ASSEMBLY__ @@ -29,8 +30,20 @@ extern struct prom_cpuinfo linux_cpus[NR_CPUS]; /* Per processor Sparc parameters we need. */ +/* Keep this a multiple of 64-bytes for cache reasons. */ struct cpuinfo_sparc { - unsigned long udelay_val; /* that's it */ + /* Dcache line 1 */ + unsigned long irq_count; + unsigned int multiplier; + unsigned int counter; + unsigned long last_tlbversion_seen; + unsigned long pgcache_size; + + /* Dcache line 2 */ + unsigned long *pgd_cache; + unsigned long *pmd_cache; + unsigned long *pte_cache; + unsigned long udelay_val; }; extern struct cpuinfo_sparc cpu_data[NR_CPUS]; @@ -49,21 +62,8 @@ extern struct klock_info klock_info; * Private routines/data */ -extern int smp_found_cpus; extern unsigned char boot_cpu_id; extern unsigned long cpu_present_map; -extern __volatile__ unsigned long smp_invalidate_needed[NR_CPUS]; -extern __volatile__ unsigned long kernel_counter; -extern __volatile__ unsigned char active_kernel_processor; -extern void smp_message_irq(void); -extern unsigned long ipi_count; -extern __volatile__ unsigned long kernel_counter; -extern __volatile__ unsigned long syscall_count; - -extern void print_lock_state(void); - -typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long, - unsigned long, unsigned long); /* * General functions that each host system must provide. @@ -88,30 +88,12 @@ extern __inline__ int hard_smp_processor_id(void) #define smp_processor_id() (current->processor) -extern __volatile__ unsigned long smp_proc_in_lock[NR_CPUS]; /* for computing process time */ #endif /* !(__ASSEMBLY__) */ -/* Sparc specific messages. */ -#define MSG_CROSS_CALL 0x0005 /* run func on cpus */ - -/* Empirical PROM processor mailbox constants. If the per-cpu mailbox - * contains something other than one of these then the ipi is from - * Linux's active_kernel_processor. This facility exists so that - * the boot monitor can capture all the other cpus when one catches - * a watchdog reset or the user enters the monitor using L1-A keys. - */ -#define MBOX_STOPCPU 0xFB -#define MBOX_IDLECPU 0xFC -#define MBOX_IDLECPU2 0xFD -#define MBOX_STOPCPU2 0xFE - -#define PROC_CHANGE_PENALTY 20 - -#define SMP_FROM_INT 1 -#define SMP_FROM_SYSCALL 2 +#define PROC_CHANGE_PENALTY 20 #endif /* !(__SMP__) */ -#define NO_PROC_ID 0xFF +#define NO_PROC_ID 0xFF #endif /* !(_SPARC64_SMP_H) */ diff --git a/include/asm-sparc64/smp_lock.h b/include/asm-sparc64/smp_lock.h index 3012ed6bb..a01d9ec35 100644 --- a/include/asm-sparc64/smp_lock.h +++ b/include/asm-sparc64/smp_lock.h @@ -28,6 +28,7 @@ do { \ __cli(); \ (task)->lock_depth = 0; \ klock_info.akp = NO_PROC_ID; \ + membar("#LoadStore | #StoreStore"); \ klock_info.kernel_flag = 0; \ } \ release_irqlock(cpu); \ @@ -45,7 +46,7 @@ do { \ " mov %1, %%g2" \ : /* No outputs. */ \ : "r" (klip), "r" (depth) \ - : "g2", "g3", "g5", "g7", "memory", "cc"); \ + : "g2", "g3", "g5", "memory", "cc"); \ } \ } while(0) @@ -63,9 +64,9 @@ extern __inline__ void lock_kernel(void) __asm__ __volatile__(" mov %%o7, %%g5 call ___lock_kernel - ld [%%g6 + %0], %%g2 + lduw [%%g6 + %0], %%g2 " : : "i" (AOFF_task_lock_depth), "r" (klip) - : "g2", "g3", "g5", "g7", "memory", "cc"); + : "g2", "g3", "g5", "memory", "cc"); } /* Release kernel global lock. */ @@ -76,7 +77,7 @@ extern __inline__ void unlock_kernel(void) __asm__ __volatile__(" mov %%o7, %%g5 call ___unlock_kernel - ld [%%g6 + %0], %%g2 + lduw [%%g6 + %0], %%g2 " : : "i" (AOFF_task_lock_depth), "r" (klip) : "g2", "g3", "g5", "memory", "cc"); } diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h index cf2e51c71..65880b033 100644 --- a/include/asm-sparc64/spinlock.h +++ b/include/asm-sparc64/spinlock.h @@ -68,33 +68,35 @@ typedef struct { } rwlock_t; typedef unsigned char spinlock_t; #define SPIN_LOCK_UNLOCKED 0 -#define spin_lock_init(lock) (*(lock) = 0) -#define spin_unlock_wait(lock) do { barrier(); } while(*(volatile spinlock_t *)lock) + +#define spin_lock_init(lock) (*((unsigned char *)(lock)) = 0) + +#define spin_unlock_wait(lock) \ +do { membar("#LoadLoad"); \ +} while(*((volatile unsigned char *)lock)) extern __inline__ void spin_lock(spinlock_t *lock) { __asm__ __volatile__(" -1: ldstub [%0], %%g2 - brz,pt %%g2, 2f - membar #LoadLoad | #LoadStore - b,a %%xcc, 3f -2: - .text 2 -3: ldub [%0], %%g2 -4: brnz,a,pt %%g2, 4b - ldub [%0], %%g2 - b,a 1b +1: ldstub [%0], %%g7 + brnz,pn %%g7, 2f + membar #StoreLoad | #StoreStore + .subsection 2 +2: ldub [%0], %%g7 + brnz,pt %%g7, 2b + membar #LoadLoad + b,a,pt %%xcc, 1b .previous " : /* no outputs */ : "r" (lock) - : "g2", "memory"); + : "g7", "memory"); } extern __inline__ int spin_trylock(spinlock_t *lock) { unsigned int result; __asm__ __volatile__("ldstub [%1], %0\n\t" - "membar #LoadLoad | #LoadStore" + "membar #StoreLoad | #StoreStore" : "=r" (result) : "r" (lock) : "memory"); @@ -104,7 +106,7 @@ extern __inline__ int spin_trylock(spinlock_t *lock) extern __inline__ void spin_unlock(spinlock_t *lock) { __asm__ __volatile__("membar #StoreStore | #LoadStore\n\t" - "stb %%g0, [%0]" + "stb %%g0, [%0]\n\t" : /* No outputs */ : "r" (lock) : "memory"); @@ -114,20 +116,18 @@ extern __inline__ void spin_lock_irq(spinlock_t *lock) { __asm__ __volatile__(" wrpr %%g0, 15, %%pil -1: ldstub [%0], %%g2 - brz,pt %%g2, 2f - membar #LoadLoad | #LoadStore - b,a 3f -2: - .text 2 -3: ldub [%0], %%g2 -4: brnz,a,pt %%g2, 4b - ldub [%0], %%g2 - b,a 1b +1: ldstub [%0], %%g7 + brnz,pn %%g7, 2f + membar #StoreLoad | #StoreStore + .subsection 2 +2: ldub [%0], %%g7 + brnz,pt %%g7, 2b + membar #LoadLoad + b,a,pt %%xcc, 1b .previous " : /* no outputs */ : "r" (lock) - : "g2", "memory"); + : "g7", "memory"); } extern __inline__ void spin_unlock_irq(spinlock_t *lock) @@ -147,20 +147,18 @@ do { register spinlock_t *lp asm("g1"); \ __asm__ __volatile__( \ "\n rdpr %%pil, %0\n" \ " wrpr %%g0, 15, %%pil\n" \ - "1: ldstub [%1], %%g2\n" \ - " brz,pt %%g2, 2f\n" \ - " membar #LoadLoad | #LoadStore\n" \ - " b,a 3f\n" \ - "2:\n" \ - " .text 2\n" \ - "3: ldub [%1], %%g2\n" \ - "4: brnz,a,pt %%g2, 4b\n" \ - " ldub [%1], %%g2\n" \ - " b,a 1b\n" \ + "1: ldstub [%1], %%g7\n" \ + " brnz,pn %%g7, 2f\n" \ + " membar #StoreLoad | #StoreStore\n" \ + " .subsection 2\n" \ + "2: ldub [%1], %%g7\n" \ + " brnz,pt %%g7, 2b\n" \ + " membar #LoadLoad\n" \ + " b,a,pt %%xcc, 1b\n" \ " .previous\n" \ : "=&r" (flags) \ : "r" (lp) \ - : "g2", "memory"); \ + : "g7", "memory"); \ } while(0) extern __inline__ void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) @@ -182,94 +180,83 @@ typedef unsigned long rwlock_t; extern __inline__ void read_lock(rwlock_t *rw) { __asm__ __volatile__(" - ldx [%0], %%g2 -1: brgez,pt %%g2, 4f - add %%g2, 1, %%g3 - b,a 2f -4: casx [%0], %%g2, %%g3 - cmp %%g2, %%g3 - bne,a,pn %%xcc, 1b - ldx [%0], %%g2 - membar #LoadLoad | #LoadStore - .text 2 -2: ldx [%0], %%g2 -3: brlz,a,pt %%g2, 3b - ldx [%0], %%g2 - b 4b - add %%g2, 1, %%g3 +1: ldx [%0], %%g5 + brlz,pn %%g5, 2f +4: add %%g5, 1, %%g7 + casx [%0], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%xcc, 1b + membar #StoreLoad | #StoreStore + .subsection 2 +2: ldx [%0], %%g5 + brlz,pt %%g5, 2b + membar #LoadLoad + b,a,pt %%xcc, 4b .previous " : /* no outputs */ : "r" (rw) - : "g2", "g3", "cc", "memory"); + : "g5", "g7", "cc", "memory"); } extern __inline__ void read_unlock(rwlock_t *rw) { __asm__ __volatile__(" - membar #StoreStore | #LoadStore - ldx [%0], %%g2 -1: sub %%g2, 1, %%g3 - casx [%0], %%g2, %%g3 - cmp %%g2, %%g3 - bne,a,pn %%xcc, 1b - ldx [%0], %%g2 +1: ldx [%0], %%g5 + sub %%g5, 1, %%g7 + casx [%0], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%xcc, 1b + membar #StoreLoad | #StoreStore " : /* no outputs */ : "r" (rw) - : "g2", "g3", "cc", "memory"); + : "g5", "g7", "cc", "memory"); } extern __inline__ void write_lock(rwlock_t *rw) { __asm__ __volatile__(" - sethi %%uhi(0x8000000000000000), %%g5 - ldx [%0], %%g2 - sllx %%g5, 32, %%g5 -1: brgez,pt %%g2, 4f - or %%g2, %%g5, %%g3 - b,a 5f -4: casx [%0], %%g2, %%g3 - cmp %%g2, %%g3 - bne,a,pn %%xcc, 1b - ldx [%0], %%g2 - andncc %%g3, %%g5, %%g0 - be,pt %%xcc, 2f - membar #LoadLoad | #LoadStore - b,a 7f -2: - .text 2 -7: ldx [%0], %%g2 -3: andn %%g2, %%g5, %%g3 - casx [%0], %%g2, %%g3 - cmp %%g2, %%g3 - bne,a,pn %%xcc, 3b - ldx [%0], %%g2 - membar #LoadLoad | #LoadStore -5: ldx [%0], %%g2 -6: brlz,a,pt %%g2, 6b - ldx [%0], %%g2 - b 4b - or %%g2, %%g5, %%g3 + sethi %%uhi(0x8000000000000000), %%g3 + sllx %%g3, 32, %%g3 +1: ldx [%0], %%g5 + brlz,pn %%g5, 5f +4: or %%g5, %%g3, %%g7 + casx [%0], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%xcc, 1b + andncc %%g7, %%g3, %%g0 + bne,pn %%xcc, 7f + membar #StoreLoad | #StoreStore + .subsection 2 +7: ldx [%0], %%g5 + andn %%g5, %%g3, %%g7 + casx [%0], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%xcc, 7b + membar #StoreLoad | #StoreStore +5: ldx [%0], %%g5 + brnz,pt %%g5, 5b + membar #LoadLoad + b,a,pt %%xcc, 4b .previous " : /* no outputs */ : "r" (rw) - : "g2", "g3", "g5", "memory", "cc"); + : "g3", "g5", "g7", "memory", "cc"); } extern __inline__ void write_unlock(rwlock_t *rw) { __asm__ __volatile__(" - membar #StoreStore | #LoadStore - sethi %%uhi(0x8000000000000000), %%g5 - ldx [%0], %%g2 - sllx %%g5, 32, %%g5 -1: andn %%g2, %%g5, %%g3 - casx [%0], %%g2, %%g3 - cmp %%g2, %%g3 - bne,a,pn %%xcc, 1b - ldx [%0], %%g2 + sethi %%uhi(0x8000000000000000), %%g3 + sllx %%g3, 32, %%g3 +1: ldx [%0], %%g5 + andn %%g5, %%g3, %%g7 + casx [%0], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%xcc, 1b + membar #StoreLoad | #StoreStore " : /* no outputs */ : "r" (rw) - : "g2", "g3", "g5", "memory", "cc"); + : "g3", "g5", "g7", "memory", "cc"); } #define read_lock_irq(lock) do { __cli(); read_lock(lock); } while (0) diff --git a/include/asm-sparc64/svr4.h b/include/asm-sparc64/svr4.h index 13f59bb7c..5dcee9d3f 100644 --- a/include/asm-sparc64/svr4.h +++ b/include/asm-sparc64/svr4.h @@ -43,15 +43,13 @@ enum { #define SVR4_MAXWIN 31 typedef struct { - uint rwin_lo[8]; - uint rwin_in[8]; + u32 rwin_lo[8]; + u32 rwin_in[8]; } svr4_rwindow_t; typedef struct { int count; - - /* XXX 32-bit pointers on 64-bit kernel... fixme XXX */ - int *winptr [SVR4_MAXWIN]; /* pointer to the windows */ + u32 winptr [SVR4_MAXWIN]; /* pointer to the windows */ svr4_rwindow_t win[SVR4_MAXWIN]; /* the windows */ } svr4_gwindows_t; @@ -59,28 +57,23 @@ typedef struct { typedef int svr4_gregset_t[SVR4_NREGS]; typedef struct { - double fpu_regs[32]; - void *fp_q; - unsigned fp_fsr; + u64 fpu_regs[32]; + u32 fp_q; + u32 fp_fsr; u_char fp_nqel; u_char fp_nqsize; u_char inuse; /* if fpu is in use */ } svr4_fregset_t; typedef struct { - uint id; /* if this holds "xrs" string => ptr is valid */ - - /* XXX what is caddr_t on sparc64?? XXX */ - caddr_t ptr; + u32 id; /* if this holds "xrs" string => ptr is valid */ + u32 ptr; } svr4_xrs_t; /* Machine dependant context */ typedef struct { svr4_gregset_t greg; /* registers 0..19 (see top) */ - - /* XXX 32-bit pointers again... fixme XXX */ - svr4_gwindows_t *gwin; /* may point to register windows */ - + u32 gwin; /* may point to register windows */ svr4_fregset_t freg; /* floating point registers */ svr4_xrs_t xrs; /* mhm? */ int pad[19]; @@ -101,15 +94,12 @@ typedef struct svr4_stack_t { /* Context used by getcontext and setcontext */ typedef struct svr4_ucontext_t { - u_int flags; /* context flags, indicate what is loaded */ - - /* XXX 32-bit pointer... fixme XXX */ - struct svr4_ucontext *link; - - svr4_sigset_t sigmask; - svr4_stack_t stack; - svr4_mcontext_t mcontext; - int pad[23]; + u32 flags; /* context flags, indicate what is loaded */ + u32 link; + svr4_sigset_t sigmask; + svr4_stack_t stack; + svr4_mcontext_t mcontext; + int pad[23]; } svr4_ucontext_t; /* windows hold the windows as they were at signal time, diff --git a/include/asm-sparc64/sysio.h b/include/asm-sparc64/sysio.h index 05d72706d..2fdcc9317 100644 --- a/include/asm-sparc64/sysio.h +++ b/include/asm-sparc64/sysio.h @@ -1,4 +1,4 @@ -/* $Id: sysio.h,v 1.2 1997/04/03 12:26:45 davem Exp $ +/* $Id: sysio.h,v 1.7 1997/08/18 03:47:26 davem Exp $ * sysio.h: UltraSparc sun5 specific SBUS definitions. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -49,7 +49,7 @@ struct sysio_regs { * slot 5) MACIO * slot 6) SLAVIO * - * On Sunfire/Wildfire enterprise boxen these upper slots + * On Sunfire/Starfire/Wildfire enterprise boxen these upper slots * are unused. */ /*0x2020*/ u64 sbus_s0cfg; /* SBUS Slot 0 Config */ @@ -72,83 +72,83 @@ struct sysio_regs { /* SBUS/IOMMU Streaming Buffer Registers */ /*0x2800*/ u64 sbuf_control; /* StrBuffer Control */ /*0x2808*/ u64 sbuf_pflush; /* StrBuffer Page Flush */ -/*0x2810*/ u64 sbus_fsync; /* StrBuffer Flush Synchronization Reg */ +/*0x2810*/ u64 sbuf_fsync; /* StrBuffer Flush Synchronization Reg */ u64 __pad4[0x7d]; /* Interrupt mapping/control registers */ -/*0x2c00*/ u32 imap_slot0, _uim0; /* SBUS Slot 0 Int Mapping */ -/*0x2c08*/ u32 imap_slot1, _uim1; /* SBUS Slot 1 Int Mapping */ -/*0x2c10*/ u32 imap_slot2, _uim2; /* SBUS Slot 2 Int Mapping */ -/*0x2c18*/ u32 imap_slot3, _uim3; /* SBUS Slot 3 Int Mapping */ +/*0x2c00*/ u32 _uim0, imap_slot0; /* SBUS Slot 0 Int Mapping */ +/*0x2c08*/ u32 _uim1, imap_slot1; /* SBUS Slot 1 Int Mapping */ +/*0x2c10*/ u32 _uim2, imap_slot2; /* SBUS Slot 2 Int Mapping */ +/*0x2c18*/ u32 _uim3, imap_slot3; /* SBUS Slot 3 Int Mapping */ /* Interrupt Retry Timer. */ -/*0x2c20*/ u32 irq_retry, _irpad; +/*0x2c20*/ u32 _irpad, irq_retry; u64 __pad5[0x7b]; /* The following are only used on Fusion/Electron/Pulsar - * desktop systems, they mean nothing on Sunfire/Wildfire + * desktop systems, they mean nothing on Sunfire/Starfire/Wildfire */ -/*0x3000*/ u32 imap_scsi, _uis; /* SCSI Int Mapping */ -/*0x3008*/ u32 imap_eth, _uie; /* Ethernet Int Mapping */ -/*0x3010*/ u32 imap_bpp, _uip; /* Parallel Port Int Mapping */ -/*0x3018*/ u32 imap_audio, _uia; /* Audio Int Mapping */ -/*0x3020*/ u32 imap_pfail, _uipf; /* Power Fail Int Mapping */ -/*0x3028*/ u32 imap_kms, _uik; /* Kbd/Mouse/Serial Int Mapping */ -/*0x3030*/ u32 imap_flpy, _uif; /* Floppy Int Mapping */ -/*0x3038*/ u32 imap_shw, _uishw; /* Spare HW Int Mapping */ -/*0x3040*/ u32 imap_kbd, _uikbd; /* Kbd Only Int Mapping */ -/*0x3048*/ u32 imap_ms, _uims; /* Mouse Only Int Mapping */ -/*0x3050*/ u32 imap_ser, _uiser; /* Serial Only Int Mapping */ +/*0x3000*/ u32 _uis, imap_scsi; /* SCSI Int Mapping */ +/*0x3008*/ u32 _uie, imap_eth; /* Ethernet Int Mapping */ +/*0x3010*/ u32 _uip, imap_bpp; /* Parallel Port Int Mapping */ +/*0x3018*/ u32 _uia, imap_audio; /* Audio Int Mapping */ +/*0x3020*/ u32 _uipf, imap_pfail; /* Power Fail Int Mapping */ +/*0x3028*/ u32 _uik, imap_kms; /* Kbd/Mouse/Serial Int Mapping */ +/*0x3030*/ u32 _uif, imap_flpy; /* Floppy Int Mapping */ +/*0x3038*/ u32 _uishw, imap_shw; /* Spare HW Int Mapping */ +/*0x3040*/ u32 _uikbd, imap_kbd; /* Kbd Only Int Mapping */ +/*0x3048*/ u32 _uims, imap_ms; /* Mouse Only Int Mapping */ +/*0x3050*/ u32 _uiser, imap_ser; /* Serial Only Int Mapping */ /*0x3058*/ u64 _imap_unused; -/*0x3060*/ u32 imap_tim0, _uit0; /* Timer 0 Int Mapping */ -/*0x3068*/ u32 imap_tim1, _uit1; /* Timer 1 Int Mapping */ -/*0x3070*/ u32 imap_ue, _uiue; /* UE Int Mapping */ -/*0x3078*/ u32 imap_ce, _uice; /* CE Int Mapping */ -/*0x3080*/ u32 imap_sberr, _uisbe; /* SBUS Err Int Mapping */ -/*0x3088*/ u32 imap_pmgmt, _uipm; /* Power Mgmt Int Mapping */ -/*0x3090*/ u32 imap_gfx, _uigfx; /* OB Graphics Int Mapping */ -/*0x3098*/ u32 imap_eupa, _uieupa; /* UPA Expansion Int Mapping */ +/*0x3060*/ u32 _uit0, imap_tim0; /* Timer 0 Int Mapping */ +/*0x3068*/ u32 _uit1, imap_tim1; /* Timer 1 Int Mapping */ +/*0x3070*/ u32 _uiue, imap_ue; /* UE Int Mapping */ +/*0x3078*/ u32 _uice, imap_ce; /* CE Int Mapping */ +/*0x3080*/ u32 _uisbe, imap_sberr; /* SBUS Err Int Mapping */ +/*0x3088*/ u32 _uipm, imap_pmgmt; /* Power Mgmt Int Mapping */ +/*0x3090*/ u32 _uigfx, imap_gfx; /* OB Graphics Int Mapping */ +/*0x3098*/ u32 _uieupa, imap_eupa; /* UPA Expansion Int Mapping */ u64 __pad6[0x6c]; /* Interrupt Clear Registers */ -/*0x3400*/ u64 iclr_unused0; -/*0x3408*/ u32 iclr_slot0, _ucs0; +/*0x3400*/ u32 __ucu0, iclr_unused0; +/*0x3408*/ u32 _ucs0, iclr_slot0; u64 __pad7[0x7]; -/*0x3448*/ u32 iclr_slot1, _ucs1; +/*0x3448*/ u32 _ucs1, iclr_slot1; u64 __pad8[0x7]; -/*0x3488*/ u32 iclr_slot2, _ucs2; +/*0x3488*/ u32 _ucs2, iclr_slot2; u64 __pad9[0x7]; -/*0x34c8*/ u32 iclr_slot3, _ucs3; +/*0x34c8*/ u32 _ucs3, iclr_slot3; u64 __pad10[0x66]; -/*0x3800*/ u32 iclr_scsi, _ucscsi; -/*0x3808*/ u32 iclr_eth, _uceth; -/*0x3810*/ u32 iclr_bpp, _ucbpp; -/*0x3818*/ u32 iclr_audio, _ucaudio; -/*0x3820*/ u32 iclr_pfail, _ucpfail; -/*0x3828*/ u32 iclr_kms, _uckms; -/*0x3830*/ u32 iclr_flpt, _ucflpy; -/*0x3838*/ u32 iclr_shw, _ucshw; -/*0x3840*/ u32 iclr_kbd, _uckbd; -/*0x3848*/ u32 iclr_ms, _ucms; -/*0x3850*/ u32 iclr_ser, _ucser; +/*0x3800*/ u32 _ucscsi, iclr_scsi; +/*0x3808*/ u32 _uceth, iclr_eth; +/*0x3810*/ u32 _ucbpp, iclr_bpp; +/*0x3818*/ u32 _ucaudio, iclr_audio; +/*0x3820*/ u32 _ucpfail, iclr_pfail; +/*0x3828*/ u32 _uckms, iclr_kms; +/*0x3830*/ u32 _ucflpy, iclr_flpt; +/*0x3838*/ u32 _ucshw, iclr_shw; +/*0x3840*/ u32 _uckbd, iclr_kbd; +/*0x3848*/ u32 _ucms, iclr_ms; +/*0x3850*/ u32 _ucser, iclr_ser; /*0x3858*/ u64 iclr_unused1; -/*0x3860*/ u32 iclr_tim0, _uctim0; -/*0x3868*/ u32 iclr_tim1, _uctim1; -/*0x3870*/ u32 iclr_ue, _ucue; -/*0x3878*/ u32 iclr_ce, _ucce; -/*0x3880*/ u32 iclr_serr, _ucserr; -/*0x3888*/ u32 iclr_pmgmt, _ucpmgmt; +/*0x3860*/ u32 _uctim0, iclr_tim0; +/*0x3868*/ u32 _uctim1, iclr_tim1; +/*0x3870*/ u32 _ucue, iclr_ue; +/*0x3878*/ u32 _ucce, iclr_ce; +/*0x3880*/ u32 _ucserr, iclr_serr; +/*0x3888*/ u32 _ucpmgmt, iclr_pmgmt; u64 __pad11[0x6e]; /* Counters/Timers */ -/*0x3c00*/ u32 tim0_cnt, _tim0_u0; -/*0x3c08*/ u32 tim0_lim, _tim0_u1; -/*0x3c10*/ u32 tim1_cnt, _tim1_u0; -/*0x3c18*/ u32 tim1_lim, _tim1_u1; +/*0x3c00*/ u64 tim0_cnt; +/*0x3c08*/ u64 tim0_lim; +/*0x3c10*/ u64 tim1_cnt; +/*0x3c18*/ u64 tim1_lim; u64 __pad12[0x7c]; @@ -169,11 +169,13 @@ struct sysio_regs { /*0x4580*/ u64 iommu_tag[16]; /* IOMMU TLB Tag Diagnostic Access */ /*0x4600*/ u64 iommu_data[32]; /* IOMMU TLB Data RAM Diagnostic Access */ + u64 __pad15[0x20]; + /* Interrupt State Diagnostics */ /*0x4800*/ u64 sbus_istate; /*0x4808*/ u64 obio_istate; - u64 __pad15[0xfe]; + u64 __pad16[0xfe]; /* Streaming Buffer Diagnostic Area */ /*0x5000*/ u64 sbuf_data[128]; /* StrBuffer Data Ram Diagnostic */ @@ -278,7 +280,7 @@ struct sysio_regs { #define SYSIO_SBAFSR_MID 0x000003e000000000 /* MID causing the error */ #define SYSIO_SBAFSR_RESV3 0x0000001fffffffff /* Reserved */ -/* SYSIO SBUS Slot Configuration Register */ +/* SYSIO SBUS Slot Configuration Register(s) */ #define SYSIO_SBSCFG_RESV1 0xfffffffff8000000 /* Reserved */ #define SYSIO_SBSCFG_SADDR 0x0000000007ff0000 /* Segment Address (PA[40:30]) */ #define SYSIO_SBSCFG_CP 0x0000000000008000 /* Bypasses are cacheable */ @@ -324,14 +326,115 @@ struct sysio_regs { /* SYSIO Interrupt Retry Timer register. */ #define SYSIO_IRETRY_LIMIT 0x000000ff /* The retry interval. */ -/* SYSIO Interrupt State registers. XXX fields to be documented later */ - -/* SYSIO Counter register. XXX fields to be documented later */ +/* SYSIO Interrupt State registers. */ +#define SYSIO_ISTATE_IDLE 0x0 /* No interrupt received or pending */ +#define SYSIO_ISTATE_TRANSMIT 0x1 /* Received, but IRQ not dispatched */ +#define SYSIO_ISTATE_ILLEGAL 0x2 /* Impossible state */ +#define SYSIO_ISTATE_PENDING 0x3 /* Received and dispatched */ -/* SYSIO Limit register. XXX fields to be documented later */ - -/* SYSIO Performance Monitor Control register. XXX fields to be documented later */ +/* Two ways to get at the right bits, your choice... note that level + * zero is illegal. For slots 0 --> 3 the formula for the bit range + * in the register is: + * + * LSB ((SBUS_SLOT X 16) + (SBUS_LEVEL X 2)) + * MSB ((SBUS_SLOT X 16) + (SBUS_LEVEL X 2)) + 1 + * + * Thus the following macro. + */ +#define SYSIO_SBUS_ISTATE(regval, slot, level) \ + (((regval) >> (((slot) * 16) + ((level) * 2))) & 0x3) + +#define SYSIO_SBUS_ISTATE_S0L1 0x000000000000000c /* Slot 0, level 1 */ +#define SYSIO_SBUS_ISTATE_S0L2 0x0000000000000030 /* Slot 0, level 2 */ +#define SYSIO_SBUS_ISTATE_S0L3 0x00000000000000c0 /* Slot 0, level 3 */ +#define SYSIO_SBUS_ISTATE_S0L4 0x0000000000000300 /* Slot 0, level 4 */ +#define SYSIO_SBUS_ISTATE_S0L5 0x0000000000000c00 /* Slot 0, level 5 */ +#define SYSIO_SBUS_ISTATE_S0L6 0x0000000000003000 /* Slot 0, level 6 */ +#define SYSIO_SBUS_ISTATE_S0L7 0x000000000000c000 /* Slot 0, level 7 */ +#define SYSIO_SBUS_ISTATE_S1L1 0x00000000000c0000 /* Slot 1, level 1 */ +#define SYSIO_SBUS_ISTATE_S1L2 0x0000000000300000 /* Slot 1, level 2 */ +#define SYSIO_SBUS_ISTATE_S1L3 0x0000000000c00000 /* Slot 1, level 3 */ +#define SYSIO_SBUS_ISTATE_S1L4 0x0000000003000000 /* Slot 1, level 4 */ +#define SYSIO_SBUS_ISTATE_S1L5 0x000000000c000000 /* Slot 1, level 5 */ +#define SYSIO_SBUS_ISTATE_S1L6 0x0000000030000000 /* Slot 1, level 6 */ +#define SYSIO_SBUS_ISTATE_S1L7 0x00000000c0000000 /* Slot 1, level 7 */ +#define SYSIO_SBUS_ISTATE_S2L1 0x0000000c00000000 /* Slot 2, level 1 */ +#define SYSIO_SBUS_ISTATE_S2L2 0x0000003000000000 /* Slot 2, level 2 */ +#define SYSIO_SBUS_ISTATE_S2L3 0x000000c000000000 /* Slot 2, level 3 */ +#define SYSIO_SBUS_ISTATE_S2L4 0x0000030000000000 /* Slot 2, level 4 */ +#define SYSIO_SBUS_ISTATE_S2L5 0x00000c0000000000 /* Slot 2, level 5 */ +#define SYSIO_SBUS_ISTATE_S2L6 0x0000300000000000 /* Slot 2, level 6 */ +#define SYSIO_SBUS_ISTATE_S2L7 0x0000c00000000000 /* Slot 2, level 7 */ +#define SYSIO_SBUS_ISTATE_S3L1 0x000c000000000000 /* Slot 3, level 1 */ +#define SYSIO_SBUS_ISTATE_S3L2 0x0030000000000000 /* Slot 3, level 2 */ +#define SYSIO_SBUS_ISTATE_S3L3 0x00c0000000000000 /* Slot 3, level 3 */ +#define SYSIO_SBUS_ISTATE_S3L4 0x0300000000000000 /* Slot 3, level 4 */ +#define SYSIO_SBUS_ISTATE_S3L5 0x0c00000000000000 /* Slot 3, level 5 */ +#define SYSIO_SBUS_ISTATE_S3L6 0x3000000000000000 /* Slot 3, level 6 */ +#define SYSIO_SBUS_ISTATE_S3L7 0xc000000000000000 /* Slot 3, level 7 */ + +/* For OBIO devices things are a bit different, you just have to know what + * you are looking for. + */ +#define SYSIO_OBIO_ISTATE_SCSI 0x0000000000000003 /* Scsi */ +#define SYSIO_OBIO_ISTATE_ETH 0x000000000000000c /* Ethernet */ +#define SYSIO_OBIO_ISTATE_PP 0x0000000000000030 /* Parallel Port */ +#define SYSIO_OBIO_ISTATE_AUDIO 0x00000000000000c0 /* Sun Audio */ +#define SYSIO_OBIO_ISTATE_PFAIL 0x0000000000000300 /* Power Fail */ +#define SYSIO_OBIO_ISTATE_KBMS 0x0000000000000c00 /* kbd/mouse/serial */ +#define SYSIO_OBIO_ISTATE_FLPY 0x0000000000003000 /* Floppy Controller */ +#define SYSIO_OBIO_ISTATE_SPHW 0x000000000000c000 /* Spare HW */ +#define SYSIO_OBIO_ISTATE_KBD 0x0000000000030000 /* Keyboard */ +#define SYSIO_OBIO_ISTATE_MS 0x00000000000c0000 /* Mouse */ +#define SYSIO_OBIO_ISTATE_SER 0x0000000000300000 /* Serial */ +#define SYSIO_OBIO_ISTATE_TIM0 0x0000000000c00000 /* Timer 0 */ +#define SYSIO_OBIO_ISTATE_TIM1 0x0000000003000000 /* Timer 1 */ +#define SYSIO_OBIO_ISTATE_UE 0x000000000c000000 /* Uncorrectable Err */ +#define SYSIO_OBIO_ISTATE_CE 0x0000000030000000 /* Correctable Err */ +#define SYSIO_OBIO_ISTATE_SERR 0x00000000c0000000 /* SBUS Err */ +#define SYSIO_OBIO_ISTATE_PMGMT 0x0000000300000000 /* Power Management */ +#define SYSIO_OBIO_ISTATE_RSVI 0x0000000400000000 /* Reserved Int */ +#define SYSIO_OBIO_ISTATE_EUPA 0x0000000800000000 /* Expansion UPA (creator) */ +#define SYSIO_OBIO_ISTATE_RESV 0xfffffff000000000 /* Reserved... */ + +/* SYSIO Counter and Limit registers are documented in timer.h as these + * are generic SUN4U things. + */ -/* SYSIO Performance Monitor Counter register. XXX fields to be documented later */ +/* SYSIO Performance Monitor Control register. */ +#define SYSIO_PCNTRL_CLR1 0x0000000000008000 /* Clear SEL1 counter */ +#define SYSIO_PCNTRL_SEL1_SDR 0x0000000000000000 /* SEL1: Streaming DVMA reads */ +#define SYSIO_PCNTRL_SEL1_SDW 0x0000000000000100 /* SEL1: Streaming DVMA writes */ +#define SYSIO_PCNTRL_SEL1_CDR 0x0000000000000200 /* SEL1: Consistent DVMA reads */ +#define SYSIO_PCNTRL_SEL1_CDW 0x0000000000000300 /* SEL1: Consistent DVMA writes */ +#define SYSIO_PCNTRL_SEL1_TMISS 0x0000000000000400 /* SEL1: IOMMU TLB misses */ +#define SYSIO_PCNTRL_SEL1_SMISS 0x0000000000000500 /* SEL1: Streaming Buffer misses */ +#define SYSIO_PCNTRL_SEL1_SDC 0x0000000000000600 /* SEL1: SBUS dvma cycles */ +#define SYSIO_PCNTRL_SEL1_DB 0x0000000000000700 /* SEL1: DVMA bytes transferred */ +#define SYSIO_PCNTRL_SEL1_IRQ 0x0000000000000800 /* SEL1: Interrupts */ +#define SYSIO_PCNTRL_SEL1_UIN 0x0000000000000900 /* SEL1: UPA IRQ NACK's */ +#define SYSIO_PCNTRL_SEL1_PRD 0x0000000000000a00 /* SEL1: PIO reads */ +#define SYSIO_PCNTRL_SEL1_PWR 0x0000000000000b00 /* SEL1: PIO writes */ +#define SYSIO_PCNTRL_SEL1_SRR 0x0000000000000c00 /* SEL1: SBUS reruns */ +#define SYSIO_PCNTRL_SEL1_SPIO 0x0000000000000d00 /* SEL1: SYSIO PIO cycles */ +#define SYSIO_PCNTRL_CLR0 0x0000000000000080 /* Clear SEL0 counter */ +#define SYSIO_PCNTRL_SEL0_SDR 0x0000000000000000 /* SEL0: Streaming DVMA reads */ +#define SYSIO_PCNTRL_SEL0_SDW 0x0000000000000001 /* SEL0: Streaming DVMA writes */ +#define SYSIO_PCNTRL_SEL0_CDR 0x0000000000000002 /* SEL0: Consistent DVMA reads */ +#define SYSIO_PCNTRL_SEL0_CDW 0x0000000000000003 /* SEL0: Consistent DVMA writes */ +#define SYSIO_PCNTRL_SEL0_TMISS 0x0000000000000004 /* SEL0: IOMMU TLB misses */ +#define SYSIO_PCNTRL_SEL0_SMISS 0x0000000000000005 /* SEL0: Streaming Buffer misses */ +#define SYSIO_PCNTRL_SEL0_SDC 0x0000000000000006 /* SEL0: SBUS dvma cycles */ +#define SYSIO_PCNTRL_SEL0_DB 0x0000000000000007 /* SEL0: DVMA bytes transferred */ +#define SYSIO_PCNTRL_SEL0_IRQ 0x0000000000000008 /* SEL0: Interrupts */ +#define SYSIO_PCNTRL_SEL0_UIN 0x0000000000000009 /* SEL0: UPA IRQ NACK's */ +#define SYSIO_PCNTRL_SEL0_PRD 0x000000000000000a /* SEL0: PIO reads */ +#define SYSIO_PCNTRL_SEL0_PWR 0x000000000000000b /* SEL0: PIO writes */ +#define SYSIO_PCNTRL_SEL0_SRR 0x000000000000000c /* SEL0: SBUS reruns */ +#define SYSIO_PCNTRL_SEL0_SPIO 0x000000000000000d /* SEL0: SYSIO PIO cycles */ + +/* SYSIO Performance Monitor Counter register. */ +#define SYSIO_PCOUNT_CNT0 0xffffffff00000000 /* Counter zero */ +#define SYSIO_PCOUNT_CNT1 0x00000000ffffffff /* Counter one */ #endif /* !(__SPARC64_SYSIO_H) */ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index ab05190e9..9f29c06e6 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.29 1997/07/24 16:48:32 davem Exp $ */ +/* $Id: system.h,v 1.36 1997/08/19 14:18:33 jj Exp $ */ #ifndef __SPARC64_SYSTEM_H #define __SPARC64_SYSTEM_H @@ -6,8 +6,6 @@ #include <asm/processor.h> #include <asm/asm_offsets.h> -#define NCPUS 4 /* No SMP yet */ - #ifndef __ASSEMBLY__ /* * Sparc (general) CPU types @@ -103,7 +101,7 @@ extern void __global_restore_flags(unsigned long flags); #define membar(type) __asm__ __volatile__ ("membar " type : : : "memory"); -#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr)) +#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") #define flushw_all() __asm__ __volatile__("flushw") @@ -131,18 +129,27 @@ extern __inline__ void flushw_user(void) * I do not clobber it, when in fact I do. Please, * when modifying this code inspect output of sched.s very * carefully to make sure things still work. -DaveM + * + * SMP NOTE: At first glance it looks like there is a tiny + * race window here at the end. The possible problem + * would be if a tlbcachesync MONDO vector got delivered + * to us right before we set the final %g6 thread reg + * value. But that is impossible since only the holder + * of scheduler_lock can send a tlbcachesync MONDO and + * by definition we hold it right now. Normal tlb + * flush xcalls can come in, but those are safe and do + * not reference %g6. */ #define switch_to(prev, next) \ do { __label__ switch_continue; \ register unsigned long task_pc asm("o7"); \ - (prev)->tss.kregs->fprs = 0; \ + (prev)->tss.kregs->tstate &= ~TSTATE_PEF; \ task_pc = ((unsigned long) &&switch_continue) - 0x8; \ (next)->mm->cpu_vm_mask |= (1UL << smp_processor_id()); \ __asm__ __volatile__( \ "rdpr %%pstate, %%g2\n\t" \ "wrpr %%g2, 0x3, %%pstate\n\t" \ "flushw\n\t" \ -/*XXX*/ "wr %%g0, 0, %%fprs\n\t" \ "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \ "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \ "rdpr %%wstate, %%o5\n\t" \ @@ -151,6 +158,7 @@ do { __label__ switch_continue; \ "rdpr %%cwp, %%o5\n\t" \ "stx %%o7, [%%g6 + %4]\n\t" \ "st %%o5, [%%g6 + %5]\n\t" \ + "membar #Sync\n\t" \ "mov %0, %%g6\n\t" \ "ld [%0 + %5], %%g1\n\t" \ "wrpr %%g1, %%cwp\n\t" \ @@ -176,30 +184,35 @@ do { __label__ switch_continue; \ "o0", "o1", "o2", "o3", "o4", "o5"); \ switch_continue: } while(0) -/* Unlike the hybrid v7/v8 kernel, we can assume swap exists under V9. */ -extern __inline__ unsigned long xchg_u32(__volatile__ unsigned int *m, unsigned int val) +extern __inline__ unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) { - __asm__ __volatile__("swap [%2], %0" - : "=&r" (val) - : "0" (val), "r" (m)); + __asm__ __volatile__(" + mov %0, %%g5 +1: lduw [%2], %%g7 + cas [%2], %%g7, %0 + cmp %%g7, %0 + bne,a,pn %%icc, 1b + mov %%g5, %0 + membar #StoreLoad | #StoreStore +" : "=&r" (val) + : "0" (val), "r" (m) + : "g5", "g7", "cc", "memory"); return val; } -/* Bolix, must use casx for 64-bit values. */ -extern __inline__ unsigned long xchg_u64(__volatile__ unsigned long *m, - unsigned long val) +extern __inline__ unsigned long xchg64(__volatile__ unsigned long *m, unsigned long val) { - unsigned long temp; __asm__ __volatile__(" - mov %0, %%g1 -1: ldx [%3], %1 - casx [%3], %1, %0 - cmp %1, %0 + mov %0, %%g5 +1: ldx [%2], %%g7 + casx [%2], %%g7, %0 + cmp %%g7, %0 bne,a,pn %%xcc, 1b - mov %%g1, %0 -" : "=&r" (val), "=&r" (temp) + mov %%g5, %0 + membar #StoreLoad | #StoreStore +" : "=&r" (val) : "0" (val), "r" (m) - : "g1", "cc"); + : "g5", "g7", "cc", "memory"); return val; } @@ -213,9 +226,9 @@ static __inline__ unsigned long __xchg(unsigned long x, __volatile__ void * ptr, { switch (size) { case 4: - return xchg_u32(ptr, x); + return xchg32(ptr, x); case 8: - return xchg_u64(ptr, x); + return xchg64(ptr, x); }; __xchg_called_with_bad_pointer(); return x; diff --git a/include/asm-sparc64/termbits.h b/include/asm-sparc64/termbits.h index 01e8364c6..5c89cd6ca 100644 --- a/include/asm-sparc64/termbits.h +++ b/include/asm-sparc64/termbits.h @@ -148,13 +148,17 @@ struct termios { #define HUPCL 0x00000400 #define CLOCAL 0x00000800 #define CBAUDEX 0x00001000 -/* We'll never see these speeds with the Zilogs, but for completeness... */ #define B57600 0x00001001 #define B115200 0x00001002 #define B230400 0x00001003 #define B460800 0x00001004 /* This is what we can do with the Zilogs. */ #define B76800 0x00001005 +/* This is what we can do with the SAB82532. */ +#define B153600 0x00001006 +#define B307200 0x00001007 +#define B614400 0x00001008 +#define B921600 0x00001009 #define CIBAUD 0x100f0000 /* input baud rate (not used) */ #define CMSPAR 0x40000000 /* mark or space (stick) parity */ #define CRTSCTS 0x80000000 /* flow control */ diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h new file mode 100644 index 000000000..bb0a56efd --- /dev/null +++ b/include/asm-sparc64/ttable.h @@ -0,0 +1,333 @@ +/* $Id: ttable.h,v 1.3 1997/08/29 15:52:35 jj Exp $ */ +#ifndef _SPARC64_TTABLE_H +#define _SPARC64_TTABLE_H + +#include <linux/config.h> + +#define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop; + +/* We need a "cleaned" instruction... */ +#define CLEAN_WINDOW \ + rdpr %cleanwin, %l0; add %l0, 1, %l0; \ + wrpr %l0, 0x0, %cleanwin; \ + clr %o0; clr %o1; clr %o2; clr %o3; \ + clr %o4; clr %o5; clr %o6; clr %o7; \ + clr %l0; clr %l1; clr %l2; clr %l3; \ + clr %l4; clr %l5; clr %l6; clr %l7; \ + retry; \ + nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop; + +#define TRAP(routine) \ + sethi %hi(109f), %g7; \ + ba,pt %xcc, etrap; \ +109: or %g7, %lo(109b), %g7; \ + call routine; \ + add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ + ba,pt %xcc, rtrap; \ + clr %l6; \ + nop; + +#define TRAP_NOSAVE(routine) \ + ba,pt %xcc, routine; \ + nop; \ + nop; nop; nop; nop; nop; nop; + +#define TRAPTL1(routine) \ + sethi %hi(109f), %g7; \ + ba,pt %xcc, etraptl1; \ +109: or %g7, %lo(109b), %g7; \ + call routine; \ + add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ + ba,pt %xcc, rtrap; \ + clr %l6; \ + nop; + +#define TRAP_ARG(routine, arg) \ + sethi %hi(109f), %g7; \ + ba,pt %xcc, etrap; \ +109: or %g7, %lo(109b), %g7; \ + add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ + call routine; \ + mov arg, %o1; \ + ba,pt %xcc, rtrap; \ + clr %l6; + +#define TRAPTL1_ARG(routine, arg) \ + sethi %hi(109f), %g7; \ + ba,pt %xcc, etraptl1; \ +109: or %g7, %lo(109b), %g7; \ + add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ + call routine; \ + mov arg, %o1; \ + ba,pt %xcc, rtrap; \ + clr %l6; + +#define SYSCALL_TRAP(routine, systbl) \ + sethi %hi(109f), %g7; \ + ba,pt %xcc, etrap; \ +109: or %g7, %lo(109b), %g7; \ + call routine; \ + sethi %hi(systbl), %l7; \ + nop; nop; nop; + +#define ACCESS_EXCEPTION_TRAP(routine) \ + rdpr %pstate, %g1; \ + wrpr %g1, PSTATE_MG|PSTATE_AG, %pstate; \ + ba,pt %xcc, etrap; \ + rd %pc, %g7; \ + call routine; \ + add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ + ba,pt %xcc, rtrap; \ + clr %l6; + +#define ACCESS_EXCEPTION_TRAPTL1(routine) \ + rdpr %pstate, %g1; \ + wrpr %g1, PSTATE_MG|PSTATE_AG, %pstate; \ + ba,pt %xcc, etraptl1; \ + rd %pc, %g7; \ + call routine; \ + add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ + ba,pt %xcc, rtrap; \ + clr %l6; + +#define INDIRECT_SOLARIS_SYSCALL(num) \ + sethi %hi(109f), %g7; \ + ba,pt %xcc, etrap; \ +109: or %g7, %lo(109b), %g7; \ + ba,pt %xcc, tl0_solaris + 0xc; \ + mov num, %g1; \ + nop;nop;nop; + +#define SUNOS_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sunos_sys_table) +#define LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table32) +#define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64) +#define GETCC_TRAP TRAP(getcc) +#define SETCC_TRAP TRAP(setcc) +#ifdef CONFIG_SOLARIS_EMUL +#define SOLARIS_SYSCALL_TRAP TRAP(solaris_sparc_syscall) +#else +#define SOLARIS_SYSCALL_TRAP TRAP(solaris_syscall) +#endif +/* FIXME: Write these actually */ +#define NETBSD_SYSCALL_TRAP TRAP(netbsd_syscall) +#define BREAKPOINT_TRAP TRAP(breakpoint_trap) + +#define TRAP_IRQ(routine, level) \ + rdpr %pil, %g2; \ + wrpr %g0, 15, %pil; \ + b,pt %xcc, etrap_irq; \ + rd %pc, %g7; \ + mov level, %o0; \ + call routine; \ + add %sp, STACK_BIAS + REGWIN_SZ, %o1; \ + ba,a,pt %xcc, rtrap_clr_l6; + +#ifdef __SMP__ +#define TRAP_TICK \ + rdpr %pil, %g2; \ + wrpr %g0, 15, %pil; \ + b,pt %xcc, etrap_irq; \ + rd %pc, %g7; \ + call smp_percpu_timer_interrupt; \ + add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ + b,pt %xcc, rtrap; \ + clr %l6; +#else +#define TRAP_TICK TRAP_IRQ(handler_irq, 14) +#endif + +#define TRAP_IVEC TRAP_NOSAVE(do_ivec) + +#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl) + +#define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl) + +#define FLUSH_WINDOW_TRAP \ + ba,pt %xcc, etrap; \ + rd %pc, %g7; \ + flushw; \ + ldx [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC], %l1; \ + add %l1, 4, %l2; \ + stx %l1, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TPC]; \ + ba,pt %xcc, rtrap_clr_l6; \ + stx %l2, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC]; + +/* Before touching these macros, you owe it to yourself to go and + * see how arch/sparc64/kernel/winfixup.S works... -DaveM + */ + +/* Normal kernel spill */ +#define SPILL_0_NORMAL \ + stx %l0, [%sp + STACK_BIAS + 0x00]; \ + stx %l1, [%sp + STACK_BIAS + 0x08]; \ + stx %l2, [%sp + STACK_BIAS + 0x10]; \ + stx %l3, [%sp + STACK_BIAS + 0x18]; \ + stx %l4, [%sp + STACK_BIAS + 0x20]; \ + stx %l5, [%sp + STACK_BIAS + 0x28]; \ + stx %l6, [%sp + STACK_BIAS + 0x30]; \ + stx %l7, [%sp + STACK_BIAS + 0x38]; \ + stx %i0, [%sp + STACK_BIAS + 0x40]; \ + stx %i1, [%sp + STACK_BIAS + 0x48]; \ + stx %i2, [%sp + STACK_BIAS + 0x50]; \ + stx %i3, [%sp + STACK_BIAS + 0x58]; \ + stx %i4, [%sp + STACK_BIAS + 0x60]; \ + stx %i5, [%sp + STACK_BIAS + 0x68]; \ + stx %i6, [%sp + STACK_BIAS + 0x70]; \ + stx %i7, [%sp + STACK_BIAS + 0x78]; \ + saved; retry; nop; nop; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; nop; nop; nop; + +/* Normal 64bit spill */ +#define SPILL_1_GENERIC(xxx) \ + wr %g0, xxx, %asi; \ + stxa %l0, [%sp + STACK_BIAS + 0x00] %asi; \ + stxa %l1, [%sp + STACK_BIAS + 0x08] %asi; \ + stxa %l2, [%sp + STACK_BIAS + 0x10] %asi; \ + stxa %l3, [%sp + STACK_BIAS + 0x18] %asi; \ + stxa %l4, [%sp + STACK_BIAS + 0x20] %asi; \ + stxa %l5, [%sp + STACK_BIAS + 0x28] %asi; \ + stxa %l6, [%sp + STACK_BIAS + 0x30] %asi; \ + stxa %l7, [%sp + STACK_BIAS + 0x38] %asi; \ + stxa %i0, [%sp + STACK_BIAS + 0x40] %asi; \ + stxa %i1, [%sp + STACK_BIAS + 0x48] %asi; \ + stxa %i2, [%sp + STACK_BIAS + 0x50] %asi; \ + stxa %i3, [%sp + STACK_BIAS + 0x58] %asi; \ + stxa %i4, [%sp + STACK_BIAS + 0x60] %asi; \ + stxa %i5, [%sp + STACK_BIAS + 0x68] %asi; \ + stxa %i6, [%sp + STACK_BIAS + 0x70] %asi; \ + stxa %i7, [%sp + STACK_BIAS + 0x78] %asi; \ + saved; retry; nop; nop; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; \ + b,a,pt %xcc, spill_fixup_mna; \ + b,a,pt %xcc, spill_fixup; + +/* Normal 32bit spill */ +#define SPILL_2_GENERIC(xxx) \ + wr %g0, xxx, %asi; \ + srl %sp, 0, %sp; \ + stwa %l0, [%sp + 0x00] %asi; \ + stwa %l1, [%sp + 0x04] %asi; \ + stwa %l2, [%sp + 0x08] %asi; \ + stwa %l3, [%sp + 0x0c] %asi; \ + stwa %l4, [%sp + 0x10] %asi; \ + stwa %l5, [%sp + 0x14] %asi; \ + stwa %l6, [%sp + 0x18] %asi; \ + stwa %l7, [%sp + 0x1c] %asi; \ + stwa %i0, [%sp + 0x20] %asi; \ + stwa %i1, [%sp + 0x24] %asi; \ + stwa %i2, [%sp + 0x28] %asi; \ + stwa %i3, [%sp + 0x2c] %asi; \ + stwa %i4, [%sp + 0x30] %asi; \ + stwa %i5, [%sp + 0x34] %asi; \ + stwa %i6, [%sp + 0x38] %asi; \ + stwa %i7, [%sp + 0x3c] %asi; \ + saved; retry; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; nop; \ + b,a,pt %xcc, spill_fixup_mna; \ + b,a,pt %xcc, spill_fixup; + +#define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP) +#define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP) +#define SPILL_3_NORMAL SPILL_0_NORMAL +#define SPILL_4_NORMAL SPILL_0_NORMAL +#define SPILL_5_NORMAL SPILL_0_NORMAL +#define SPILL_6_NORMAL SPILL_0_NORMAL +#define SPILL_7_NORMAL SPILL_0_NORMAL + +#define SPILL_0_OTHER SPILL_0_NORMAL +#define SPILL_1_OTHER SPILL_1_GENERIC(ASI_AIUS) +#define SPILL_2_OTHER SPILL_2_GENERIC(ASI_AIUS) +#define SPILL_3_OTHER SPILL_3_NORMAL +#define SPILL_4_OTHER SPILL_4_NORMAL +#define SPILL_5_OTHER SPILL_5_NORMAL +#define SPILL_6_OTHER SPILL_6_NORMAL +#define SPILL_7_OTHER SPILL_7_NORMAL + +/* Normal kernel fill */ +#define FILL_0_NORMAL \ + ldx [%sp + STACK_BIAS + 0x00], %l0; \ + ldx [%sp + STACK_BIAS + 0x08], %l1; \ + ldx [%sp + STACK_BIAS + 0x10], %l2; \ + ldx [%sp + STACK_BIAS + 0x18], %l3; \ + ldx [%sp + STACK_BIAS + 0x20], %l4; \ + ldx [%sp + STACK_BIAS + 0x28], %l5; \ + ldx [%sp + STACK_BIAS + 0x30], %l6; \ + ldx [%sp + STACK_BIAS + 0x38], %l7; \ + ldx [%sp + STACK_BIAS + 0x40], %i0; \ + ldx [%sp + STACK_BIAS + 0x48], %i1; \ + ldx [%sp + STACK_BIAS + 0x50], %i2; \ + ldx [%sp + STACK_BIAS + 0x58], %i3; \ + ldx [%sp + STACK_BIAS + 0x60], %i4; \ + ldx [%sp + STACK_BIAS + 0x68], %i5; \ + ldx [%sp + STACK_BIAS + 0x70], %i6; \ + ldx [%sp + STACK_BIAS + 0x78], %i7; \ + restored; retry; nop; nop; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; nop; nop; nop; + +/* Normal 64bit fill */ +#define FILL_1_GENERIC(xxx) \ + wr %g0, xxx, %asi; \ + ldxa [%sp + STACK_BIAS + 0x00] %asi, %l0; \ + ldxa [%sp + STACK_BIAS + 0x08] %asi, %l1; \ + ldxa [%sp + STACK_BIAS + 0x10] %asi, %l2; \ + ldxa [%sp + STACK_BIAS + 0x18] %asi, %l3; \ + ldxa [%sp + STACK_BIAS + 0x20] %asi, %l4; \ + ldxa [%sp + STACK_BIAS + 0x28] %asi, %l5; \ + ldxa [%sp + STACK_BIAS + 0x30] %asi, %l6; \ + ldxa [%sp + STACK_BIAS + 0x38] %asi, %l7; \ + ldxa [%sp + STACK_BIAS + 0x40] %asi, %i0; \ + ldxa [%sp + STACK_BIAS + 0x48] %asi, %i1; \ + ldxa [%sp + STACK_BIAS + 0x50] %asi, %i2; \ + ldxa [%sp + STACK_BIAS + 0x58] %asi, %i3; \ + ldxa [%sp + STACK_BIAS + 0x60] %asi, %i4; \ + ldxa [%sp + STACK_BIAS + 0x68] %asi, %i5; \ + ldxa [%sp + STACK_BIAS + 0x70] %asi, %i6; \ + ldxa [%sp + STACK_BIAS + 0x78] %asi, %i7; \ + restored; retry; nop; nop; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; \ + b,a,pt %xcc, fill_fixup_mna; \ + b,a,pt %xcc, fill_fixup; + +/* Normal 32bit fill */ +#define FILL_2_GENERIC(xxx) \ + wr %g0, xxx, %asi; \ + srl %sp, 0, %sp; \ + lduwa [%sp + 0x00] %asi, %l0; \ + lduwa [%sp + 0x04] %asi, %l1; \ + lduwa [%sp + 0x08] %asi, %l2; \ + lduwa [%sp + 0x0c] %asi, %l3; \ + lduwa [%sp + 0x10] %asi, %l4; \ + lduwa [%sp + 0x14] %asi, %l5; \ + lduwa [%sp + 0x18] %asi, %l6; \ + lduwa [%sp + 0x1c] %asi, %l7; \ + lduwa [%sp + 0x20] %asi, %i0; \ + lduwa [%sp + 0x24] %asi, %i1; \ + lduwa [%sp + 0x28] %asi, %i2; \ + lduwa [%sp + 0x2c] %asi, %i3; \ + lduwa [%sp + 0x30] %asi, %i4; \ + lduwa [%sp + 0x34] %asi, %i5; \ + lduwa [%sp + 0x38] %asi, %i6; \ + lduwa [%sp + 0x3c] %asi, %i7; \ + restored; retry; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; nop; \ + b,a,pt %xcc, fill_fixup_mna; \ + b,a,pt %xcc, fill_fixup; + +#define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP) +#define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP) +#define FILL_3_NORMAL FILL_0_NORMAL +#define FILL_4_NORMAL FILL_0_NORMAL +#define FILL_5_NORMAL FILL_0_NORMAL +#define FILL_6_NORMAL FILL_0_NORMAL +#define FILL_7_NORMAL FILL_0_NORMAL + +#define FILL_0_OTHER FILL_0_NORMAL +#define FILL_1_OTHER FILL_1_GENERIC(ASI_AIUS) +#define FILL_2_OTHER FILL_2_GENERIC(ASI_AIUS) +#define FILL_3_OTHER FILL_3_NORMAL +#define FILL_4_OTHER FILL_4_NORMAL +#define FILL_5_OTHER FILL_5_NORMAL +#define FILL_6_OTHER FILL_6_NORMAL +#define FILL_7_OTHER FILL_7_NORMAL + +#endif /* !(_SPARC64_TTABLE_H) */ diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h index c0668e3f2..1d06cce7d 100644 --- a/include/asm-sparc64/uaccess.h +++ b/include/asm-sparc64/uaccess.h @@ -1,4 +1,4 @@ -/* $Id: uaccess.h,v 1.20 1997/07/13 18:23:45 davem Exp $ */ +/* $Id: uaccess.h,v 1.22 1997/08/19 15:25:35 jj Exp $ */ #ifndef _ASM_UACCESS_H #define _ASM_UACCESS_H @@ -30,8 +30,11 @@ #define get_fs() (current->tss.current_ds) #define get_ds() (KERNEL_DS) + +extern spinlock_t scheduler_lock; + #define set_fs(val) \ -do { \ +do { spin_lock(&scheduler_lock); \ current->tss.current_ds = (val); \ if ((val) == KERNEL_DS) { \ flushw_user (); \ @@ -41,6 +44,7 @@ do { \ } \ spitfire_set_secondary_context(current->tss.ctx); \ __asm__ __volatile__("flush %g6"); \ + spin_unlock(&scheduler_lock); \ } while(0) #define __user_ok(addr,size) 1 @@ -77,7 +81,7 @@ extern inline int verify_area(int type, const void * addr, unsigned long size) struct exception_table_entry { - unsigned long insn, fixup; + unsigned insn, fixup; }; /* Returns 0 if exception not found and fixup otherwise. */ @@ -151,8 +155,8 @@ __asm__ __volatile__( \ " mov %3, %0\n\n\t" \ ".previous\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 8\n\t" \ - ".xword 1b, 3b\n\t" \ + ".align 4\n\t" \ + ".word 1b, 3b\n\t" \ ".previous\n\n\t" \ : "=r" (ret) : "r" (x), "r" (__m(addr)), \ "i" (-EFAULT), "i" (ASI_S)) @@ -163,8 +167,8 @@ __asm__ __volatile__( \ "/* Put user asm ret, inline. */\n" \ "1:\t" "st"#size "a %1, [%2] %3\n\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 8\n\t" \ - ".xword 1b, __ret_efault\n\n\t" \ + ".align 4\n\t" \ + ".word 1b, __ret_efault\n\n\t" \ ".previous\n\n\t" \ : "=r" (foo) : "r" (x), "r" (__m(addr)), "i" (ASI_S)); \ else \ @@ -178,8 +182,8 @@ __asm__ __volatile( \ " restore %%g0, %3, %%o0\n\n\t" \ ".previous\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 8\n\t" \ - ".xword 1b, 3b\n\n\t" \ + ".align 4\n\t" \ + ".word 1b, 3b\n\n\t" \ ".previous\n\n\t" \ : "=r" (foo) : "r" (x), "r" (__m(addr)), \ "i" (ret), "i" (ASI_S)) @@ -221,8 +225,8 @@ __asm__ __volatile__( \ " mov %3, %0\n\n\t" \ ".previous\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 8\n\t" \ - ".xword 1b, 3b\n\n\t" \ + ".align 4\n\t" \ + ".word 1b, 3b\n\n\t" \ ".previous\n\t" \ : "=r" (ret), "=r" (x) : "r" (__m(addr)), \ "i" (-EFAULT), "i" (ASI_S)) @@ -233,8 +237,8 @@ __asm__ __volatile__( \ "/* Get user asm ret, inline. */\n" \ "1:\t" "ld"#size "a [%1] %2, %0\n\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 8\n\t" \ - ".xword 1b,__ret_efault\n\n\t" \ + ".align 4\n\t" \ + ".word 1b,__ret_efault\n\n\t" \ ".previous\n\t" \ : "=r" (x) : "r" (__m(addr)), "i" (ASI_S)); \ else \ @@ -248,8 +252,8 @@ __asm__ __volatile__( \ " restore %%g0, %3, %%o0\n\n\t" \ ".previous\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 8\n\t" \ - ".xword 1b, 3b\n\n\t" \ + ".align 4\n\t" \ + ".word 1b, 3b\n\n\t" \ ".previous\n\t" \ : "=r" (x) : "r" (__m(addr)), "i" (retval), "i" (ASI_S)) diff --git a/include/linux/a.out.h b/include/linux/a.out.h index 172664afa..af8a1dfa5 100644 --- a/include/linux/a.out.h +++ b/include/linux/a.out.h @@ -34,7 +34,7 @@ enum machine_type { /* skip a bunch so we don't run into any of sun's numbers */ M_386 = 100, M_MIPS1 = 151, /* MIPS R3000/R3000 binary */ - M_MIPS2 = 152, /* MIPS R6000/R4000 binary */ + M_MIPS2 = 152 /* MIPS R6000/R4000 binary */ }; #if !defined (N_MAGIC) diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h new file mode 100644 index 000000000..843c0ad8c --- /dev/null +++ b/include/linux/arcdevice.h @@ -0,0 +1,353 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. NET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the ARCnet handlers. + * + * Version: $Id: arcdevice.h,v 1.2 1997/09/05 08:57:56 mj Exp $ + * + * Authors: Avery Pennarun <apenwarr@bond.net> + * David Woodhouse <dwmw2@cam.ac.uk> + * + * 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. + * + */ +#ifndef _LINUX_ARCDEVICE_H +#define _LINUX_ARCDEVICE_H + +#include <linux/config.h> +#include <linux/if_arcnet.h> + +#ifdef __KERNEL__ + +#define ARC_20020 1 +#define ARC_RIM_I 2 +#define ARC_90xx 3 +#define ARC_90xx_IO 4 + +#define MAX_ARCNET_DEVS 8 + + +/* The card sends the reconfiguration signal when it loses the connection to + * the rest of its network. It is a 'Hello, is anybody there?' cry. This + * usually happens when a new computer on the network is powered on or when + * the cable is broken. + * + * Define DETECT_RECONFIGS if you want to detect network reconfigurations. + * Recons may be a real nuisance on a larger ARCnet network; if you are a + * network administrator you probably would like to count them. + * Reconfigurations will be recorded in stats.tx_carrier_errors (the last + * field of the /proc/net/dev file). + * + * Define SHOW_RECONFIGS if you really want to see a log message whenever + * a RECON occurs. + */ +#define DETECT_RECONFIGS +#undef SHOW_RECONFIGS + + +/* RECON_THRESHOLD is the maximum number of RECON messages to receive within + * one minute before printing a "cabling problem" warning. You must have + * DETECT_RECONFIGS enabled if you want to use this. The default value + * should be fine. + * + * After that, a "cabling restored" message will be printed on the next IRQ + * if no RECON messages have been received for 10 seconds. + * + * Do not define RECON_THRESHOLD at all if you want to disable this feature. + */ +#define RECON_THRESHOLD 30 + + +/* Define this to the minimum "timeout" value. If a transmit takes longer + * than TX_TIMEOUT jiffies, Linux will abort the TX and retry. On a large + * network, or one with heavy network traffic, this timeout may need to be + * increased. The larger it is, though, the longer it will be between + * necessary transmits - don't set this too large. + */ +#define TX_TIMEOUT 20 + + +/* Display warnings about the driver being an ALPHA version. + */ +#define ALPHA_WARNING + + +/* New debugging bitflags: each option can be enabled individually. + * + * These can be set while the driver is running by typing: + * ifconfig arc0 down metric 1xxx HOSTNAME + * where 1xxx is 1000 + the debug level you want + * and HOSTNAME is your hostname/ip address + * and then resetting your routes. + * + * An ioctl() should be used for this instead, someday. + * + * Note: only debug flags included in the ARCNET_DEBUG_MAX define will + * actually be available. GCC will (at least, GCC 2.7.0 will) notice + * lines using a BUGLVL not in ARCNET_DEBUG_MAX and automatically optimize + * them out. + */ +#define D_NORMAL 1 /* important operational info */ +#define D_EXTRA 2 /* useful, but non-vital information */ +#define D_INIT 4 /* show init/probe messages */ +#define D_INIT_REASONS 8 /* show reasons for discarding probes */ +/* debug levels below give LOTS of output during normal operation! */ +#define D_DURING 16 /* trace operations (including irq's) */ +#define D_TX 32 /* show tx packets */ +#define D_RX 64 /* show rx packets */ +#define D_SKB 128 /* show skb's */ + +#ifndef ARCNET_DEBUG_MAX +#define ARCNET_DEBUG_MAX (~0) /* enable ALL debug messages */ +#endif + +#ifndef ARCNET_DEBUG +#define ARCNET_DEBUG (D_NORMAL|D_EXTRA) +#endif +extern int arcnet_debug; + +/* macros to simplify debug checking */ +#define BUGLVL(x) if ((ARCNET_DEBUG_MAX)&arcnet_debug&(x)) +#define BUGMSG2(x,msg,args...) BUGLVL(x) printk(msg, ## args) +#define BUGMSG(x,msg,args...) BUGMSG2(x,"%s%6s: " msg, \ + x==D_NORMAL ? KERN_WARNING : \ + x<=D_INIT_REASONS ? KERN_INFO : KERN_DEBUG , \ + dev->name , ## args) + + +#define SETMASK AINTMASK(lp->intmask) + + /* Time needed to resetthe card - in jiffies. This works on my SMC + * PC100. I can't find a reference that tells me just how long I + * should wait. + */ +#define RESETtime (HZ * 3 / 10) /* reset */ + + /* these are the max/min lengths of packet data. (including + * ClientData header) + * note: packet sizes 250, 251, 252 are impossible (God knows why) + * so exception packets become necessary. + * + * These numbers are compared with the length of the full packet, + * including ClientData header. + */ +#define MTU 253 /* normal packet max size */ +#define MinTU 257 /* extended packet min size */ +#define XMTU 508 /* extended packet max size */ + + /* status/interrupt mask bit fields */ +#define TXFREEflag 0x01 /* transmitter available */ +#define TXACKflag 0x02 /* transmitted msg. ackd */ +#define RECONflag 0x04 /* system reconfigured */ +#define TESTflag 0x08 /* test flag */ +#define RESETflag 0x10 /* power-on-reset */ +#define RES1flag 0x20 /* reserved - usually set by jumper */ +#define RES2flag 0x40 /* reserved - usually set by jumper */ +#define NORXflag 0x80 /* receiver inhibited */ + + /* Flags used for IO-mapped memory operations */ +#define AUTOINCflag 0x40 /* Increase location with each access */ +#define IOMAPflag 0x02 /* (for 90xx) Use IO mapped memory, not mmap */ +#define ENABLE16flag 0x80 /* (for 90xx) Enable 16-bit mode */ + + /* in the command register, the following bits have these meanings: + * 0-2 command + * 3-4 page number (for enable rcv/xmt command) + * 7 receive broadcasts + */ +#define NOTXcmd 0x01 /* disable transmitter */ +#define NORXcmd 0x02 /* disable receiver */ +#define TXcmd 0x03 /* enable transmitter */ +#define RXcmd 0x04 /* enable receiver */ +#define CONFIGcmd 0x05 /* define configuration */ +#define CFLAGScmd 0x06 /* clear flags */ +#define TESTcmd 0x07 /* load test flags */ + + /* flags for "clear flags" command */ +#define RESETclear 0x08 /* power-on-reset */ +#define CONFIGclear 0x10 /* system reconfigured */ + + /* flags for "load test flags" command */ +#define TESTload 0x08 /* test flag (diagnostic) */ + + /* byte deposited into first address of buffers on reset */ +#define TESTvalue 0321 /* that's octal for 0xD1 :) */ + + /* for "enable receiver" command */ +#define RXbcasts 0x80 /* receive broadcasts */ + + /* flags for "define configuration" command */ +#define NORMALconf 0x00 /* 1-249 byte packets */ +#define EXTconf 0x08 /* 250-504 byte packets */ + + /* Starts receiving packets into recbuf. + */ +#define EnableReceiver() ACOMMAND(RXcmd|(recbuf<<3)|RXbcasts) + + + +#define JIFFER(time) for (delayval=jiffies+time; jiffies<delayval;) ; + + /* a complete ARCnet packet */ +union ArcPacket +{ + struct archdr hardheader; /* the hardware header */ + u_char raw[512]; /* raw packet info, incl ClientData */ +}; + + + /* the "client data" header - RFC1201 information + * notice that this screws up if it's not an even number of bytes + * <sigh> + */ +struct ClientData +{ + /* data that's NOT part of real packet - we MUST get rid of it before + * actually sending!! + */ + u_char saddr, /* Source address - needed for IPX */ + daddr; /* Destination address */ + + /* data that IS part of real packet */ + u_char protocol_id, /* ARC_P_IP, ARC_P_ARP, etc */ + split_flag; /* for use with split packets */ + u_short sequence; /* sequence number */ +}; +#define EXTRA_CLIENTDATA (sizeof(struct ClientData)-4) + + + /* the "client data" header - RFC1051 information + * this also screws up if it's not an even number of bytes + * <sigh again> + */ +struct S_ClientData +{ + /* data that's NOT part of real packet - we MUST get rid of it before + * actually sending!! + */ + u_char saddr, /* Source address - needed for IPX */ + daddr, /* Destination address */ + junk; /* padding to make an even length */ + + /* data that IS part of real packet */ + u_char protocol_id; /* ARC_P_IP, ARC_P_ARP, etc */ +}; +#define S_EXTRA_CLIENTDATA (sizeof(struct S_ClientData)-1) + + +/* "Incoming" is information needed for each address that could be sending + * to us. Mostly for partially-received split packets. + */ +struct Incoming +{ + struct sk_buff *skb; /* packet data buffer */ + unsigned char lastpacket, /* number of last packet (from 1) */ + numpackets; /* number of packets in split */ + u_short sequence; /* sequence number of assembly */ +}; + +struct Outgoing +{ + struct sk_buff *skb; /* buffer from upper levels */ + struct ClientData *hdr; /* clientdata of last packet */ + u_char *data; /* pointer to data in packet */ + short length, /* bytes total */ + dataleft, /* bytes left */ + segnum, /* segment being sent */ + numsegs, /* number of segments */ + seglen; /* length of segment */ +}; + + +struct arcnet_local { + struct net_device_stats stats; + u_short sequence; /* sequence number (incs with each packet) */ + u_short aborted_seq; + u_char stationid, /* our 8-bit station address */ + recbuf, /* receive buffer # (0 or 1) */ + txbuf, /* transmit buffer # (2 or 3) */ + txready, /* buffer where a packet is ready to send */ + config, /* current value of CONFIG register */ + timeout, /* Extended timeout for COM20020 */ + backplane, /* Backplane flag for COM20020 */ + setup, /* Contents of setup register */ + intmask; /* current value of INTMASK register */ + short intx, /* in TX routine? */ + in_txhandler, /* in TX_IRQ handler? */ + sending, /* transmit in progress? */ + lastload_dest, /* can last loaded packet be acked? */ + lasttrans_dest; /* can last TX'd packet be acked? */ + +#if defined(DETECT_RECONFIGS) && defined(RECON_THRESHOLD) + time_t first_recon, /* time of "first" RECON message to count */ + last_recon; /* time of most recent RECON */ + int num_recons, /* number of RECONs between first and last. */ + network_down; /* do we think the network is down? */ +#endif + + struct timer_list timer; /* the timer interrupt struct */ + struct Incoming incoming[256]; /* one from each address */ + struct Outgoing outgoing; /* packet currently being sent */ + + int card_type; + char *card_type_str; + + void (*inthandler) (struct device *dev); + int (*arcnet_reset) (struct device *dev, int reset_delay); + void (*asetmask) (struct device *dev, u_char mask); + void (*acommand) (struct device *dev, u_char command); + u_char (*astatus) (struct device *dev); + void (*en_dis_able_TX) (struct device *dev, int enable); + void (*prepare_tx)(struct device *dev,u_char *hdr,int hdrlen, + char *data,int length,int daddr,int exceptA, int offset); + void (*openclose_device)(int open); + + struct device *adev; /* RFC1201 protocol device */ + + /* These are last to ensure that the chipset drivers don't depend on the + * CONFIG_ARCNET_ETH and CONFIG_ARCNET_1051 options. + */ + +#ifdef CONFIG_ARCNET_ETH + struct device *edev; /* Ethernet-Encap device */ +#endif + +#ifdef CONFIG_ARCNET_1051 + struct device *sdev; /* RFC1051 protocol device */ +#endif +}; + +/* Functions exported by arcnet.c + */ + +#if ARCNET_DEBUG_MAX & D_SKB +extern void arcnet_dump_skb(struct device *dev,struct sk_buff *skb, + char *desc); +#else +#define arcnet_dump_skb(dev,skb,desc) ; +#endif + +#if (ARCNET_DEBUG_MAX & D_RX) || (ARCNET_DEBUG_MAX & D_TX) +extern void arcnet_dump_packet(struct device *dev,u_char *buffer,int ext, + char *desc); +#else +#define arcnet_dump_packet(dev,buffer,ext,desc) ; +#endif + +extern void arcnet_tx_done(struct device *dev, struct arcnet_local *lp); +extern void arcnet_makename(char *device); +extern void arcnet_interrupt(int irq,void *dev_id,struct pt_regs *regs); +extern void arcnet_setup(struct device *dev); +extern int arcnet_go_tx(struct device *dev,int enable_irq); +extern void arcnetA_continue_tx(struct device *dev); +extern void arcnet_rx(struct arcnet_local *lp, u_char *arcsoft, short length, int saddr, int daddr); +extern void arcnet_use_count(int open); + + +#endif /* __KERNEL__ */ +#endif /* _LINUX_ARCDEVICE_H */ diff --git a/include/linux/blk.h b/include/linux/blk.h index 412f0c1c3..66ef4b47e 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -97,6 +97,9 @@ extern int ddv_init(void); #ifdef CONFIG_AMIGA_Z2RAM extern int z2_init(void); #endif +#ifdef CONFIG_MAC_FLOPPY +extern int swim3_init(void); +#endif extern void set_device_ro(kdev_t dev,int flag); void add_blkdev_randomness(int major); diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 82390ea64..2735f37ea 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -46,15 +46,34 @@ struct dentry { struct dentry * d_mounts; /* mount information */ struct dentry * d_covers; struct list_head d_hash; /* lookup hash list */ - struct list_head d_alias; /* inode alias list */ struct list_head d_lru; /* d_count = 0 LRU list */ struct qstr d_name; unsigned long d_time; /* used by d_revalidate */ + struct dentry_operations *d_op; +}; + +struct dentry_operations { int (*d_revalidate)(struct dentry *); + int (*d_hash) (struct dentry *,struct qstr *); + int (*d_compare) (struct dentry *,struct qstr *, struct qstr *); + void (*d_delete)(struct dentry *); }; +/* the dentry parameter passed to d_hash and d_compare is the parent + * directory of the entries to be compared. It is used in case these + * functions need any directory specific information for determining + * equivalency classes. Using the dentry itself might not work, as it + * might be a negative dentry which has no information associated with + * it */ + + + /* d_flags entries */ #define DCACHE_AUTOFS_PENDING 0x0001 /* autofs: "under construction" */ +#define DCACHE_NFSFS_RENAMED 0x0002 /* this dentry has been "silly + * renamed" and has to be + * deleted on the last dput() + */ /* * d_drop() unhashes the entry from the parent @@ -81,11 +100,10 @@ static inline void d_drop(struct dentry * dentry) extern void d_instantiate(struct dentry *, struct inode *); extern void d_delete(struct dentry *); - /* allocate/de-allocate */ -extern void d_free(struct dentry *); extern struct dentry * d_alloc(struct dentry * parent, const struct qstr *name); extern void shrink_dcache(void); +extern int d_invalidate(struct dentry *); /* only used at mount-time */ extern struct dentry * d_alloc_root(struct inode * root_inode, struct dentry * old_root); @@ -97,7 +115,7 @@ extern struct dentry * d_alloc_root(struct inode * root_inode, struct dentry * o extern void d_add(struct dentry * entry, struct inode * inode); /* used for rename() and baskets */ -extern void d_move(struct dentry * entry, struct dentry * newparent, struct qstr * newname); +extern void d_move(struct dentry * entry, struct dentry * newdentry); /* appendix may either be NULL or be used for transname suffixes */ extern struct dentry * d_lookup(struct dentry * dir, struct qstr * name); @@ -119,12 +137,4 @@ static inline struct dentry * dget(struct dentry *dentry) extern void dput(struct dentry *); -/* - * This is ugly. The inode:dentry relationship is a 1:n - * relationship, so we have to return one (random) dentry - * from the alias list. We select the first one.. - */ -#define i_dentry(inode) \ - list_entry((inode)->i_dentry.next, struct dentry, d_alias) - #endif /* __LINUX_DCACHE_H */ diff --git a/include/linux/fd.h b/include/linux/fd.h index da7293c35..a32532668 100644 --- a/include/linux/fd.h +++ b/include/linux/fd.h @@ -248,7 +248,7 @@ struct floppy_fdc_state { int dtr; unsigned char version; /* FDC version code */ unsigned char dor; - int address; /* io address */ + unsigned long address; /* io address */ unsigned int rawcmd:2; unsigned int reset:1; unsigned int need_configure:1; diff --git a/include/linux/fs.h b/include/linux/fs.h index 665b56c38..8dd814564 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -93,7 +93,7 @@ extern int max_files, nr_files; /* * Flags that can be altered by MS_REMOUNT */ -#define MS_RMT_MASK (MS_RDONLY|MS_MANDLOCK) +#define MS_RMT_MASK (MS_RDONLY|MS_MANDLOCK|MS_NOATIME) /* * Magic mount flag number. Has to be or-ed to the flag values. @@ -250,6 +250,7 @@ static inline int buffer_protected(struct buffer_head * bh) #include <linux/affs_fs_i.h> #include <linux/ufs_fs_i.h> #include <linux/romfs_fs_i.h> +#include <linux/smb_fs_i.h> /* * Attribute flags. These should be or-ed together to figure out what @@ -327,8 +328,6 @@ struct inode { struct page *i_pages; struct dquot *i_dquot[MAXQUOTAS]; - struct list_head i_dentry; - unsigned long i_state; unsigned int i_flags; @@ -350,20 +349,21 @@ struct inode { struct affs_inode_info affs_i; struct ufs_inode_info ufs_i; struct romfs_inode_info romfs_i; + struct smb_inode_info smbfs_i; struct socket socket_i; void *generic_ip; } u; }; /* Inode state bits.. */ -#define I_DIRTY 0 -#define I_LOCK 1 -#define I_FREEING 2 +#define I_DIRTY 1 +#define I_LOCK 2 +#define I_FREEING 4 extern void __mark_inode_dirty(struct inode *); static inline void mark_inode_dirty(struct inode *inode) { - if (!test_and_set_bit(I_DIRTY, &inode->i_state)) + if (!(inode->i_state & I_DIRTY)) __mark_inode_dirty(inode); } @@ -481,6 +481,7 @@ extern int fasync_helper(struct inode *, struct file *, int, struct fasync_struc #include <linux/affs_fs_sb.h> #include <linux/ufs_fs_sb.h> #include <linux/romfs_fs_sb.h> +#include <linux/smb_fs_sb.h> struct super_block { kdev_t s_dev; @@ -501,6 +502,7 @@ struct super_block { struct inode *s_ibasket; short int s_ibasket_count; short int s_ibasket_max; + struct list_head s_dirty; /* dirty inodes */ union { struct minix_sb_info minix_sb; @@ -513,6 +515,7 @@ struct super_block { struct affs_sb_info affs_sb; struct ufs_sb_info ufs_sb; struct romfs_sb_info romfs_sb; + struct smb_sb_info smbfs_sb; void *generic_sbp; } u; }; @@ -529,7 +532,7 @@ struct file_operations { 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); + int (*readdir) (struct file *, void *, filldir_t); unsigned int (*poll) (struct file *, poll_table *); int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); int (*mmap) (struct inode *, struct file *, struct vm_area_struct *); @@ -672,7 +675,7 @@ extern inline void mark_buffer_dirty(struct buffer_head * bh, int flag) } extern int check_disk_change(kdev_t dev); -extern int invalidate_inodes(kdev_t dev); +extern int invalidate_inodes(struct super_block * sb); extern void invalidate_inode_pages(struct inode *); extern void invalidate_buffers(kdev_t dev); extern int floppy_is_wp(int minor); diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h index 0a6b9c735..b321d292c 100644 --- a/include/linux/hdlcdrv.h +++ b/include/linux/hdlcdrv.h @@ -117,7 +117,7 @@ struct hdlcdrv_ioctl { #define HDLCDRV_MAGIC 0x5ac6e778 #define HDLCDRV_IFNAMELEN 6 -#define HDLCDRV_HDLCBUFFER 16 /* should be a power of 2 for speed reasons */ +#define HDLCDRV_HDLCBUFFER 32 /* should be a power of 2 for speed reasons */ #define HDLCDRV_BITBUFFER 256 /* should be a power of 2 for speed reasons */ #undef HDLCDRV_LOOPBACK /* define for HDLC debugging purposes */ #define HDLCDRV_DEBUG diff --git a/include/linux/hfmodem.h b/include/linux/hfmodem.h new file mode 100644 index 000000000..739dc5acd --- /dev/null +++ b/include/linux/hfmodem.h @@ -0,0 +1,254 @@ +/*****************************************************************************/ + +/* + * hfmodem.h -- Linux soundcard HF FSK driver. + * + * Copyright (C) 1997 Thomas Sailer (sailer@ife.ee.ethz.ch) + * Swiss Federal Institute of Technology (ETH), Electronics Lab + * + * 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. + * + * + * This is the Linux realtime sound output driver + */ + +/*****************************************************************************/ + +#ifndef _HFMODEM_H +#define _HFMODEM_H +/* --------------------------------------------------------------------- */ + +#include <linux/version.h> + +#include <linux/ioctl.h> +#include <linux/types.h> +#include <linux/fs.h> +#if LINUX_VERSION_CODE >= 0x20100 +#include <linux/poll.h> +#endif + +/* --------------------------------------------------------------------- */ + +#define HFMODEM_MINOR 145 + +#define HFMODEM_SRATE 8000 +#define HFMODEM_MAXBITS 4800 /* required for GTOR 300 baud mode */ +#define HFMODEM_MINBAUD 40 +#define HFMODEM_MAXBAUD 400 +#define HFMODEM_MAXCORRLEN ((HFMODEM_SRATE+HFMODEM_MINBAUD-1)/HFMODEM_MINBAUD) + +/* --------------------------------------------------------------------- */ + +typedef unsigned long hfmodem_time_t; +typedef int hfmodem_soft_t; +typedef unsigned long hfmodem_id_t; + +/* --------------------------------------------------------------------- */ + +struct hfmodem_ioctl_fsk_tx_request { + hfmodem_time_t tstart; + hfmodem_time_t tinc; + int inv; + hfmodem_id_t id; + unsigned int nbits; + unsigned char *data; + unsigned int freq[2]; +}; + +struct hfmodem_ioctl_fsk_rx_request { + hfmodem_time_t tstart; + hfmodem_time_t tinc; + unsigned int baud; + hfmodem_id_t id; + unsigned int nbits; + hfmodem_soft_t *data; + unsigned int freq[2]; +}; + +struct hfmodem_ioctl_mixer_params { + int src; + int igain; + int ogain; +}; + +struct hfmodem_ioctl_sample_params { + __s16 *data; + int len; +}; + +#define HFMODEM_IOCTL_FSKTXREQUEST _IOW('H', 0, struct hfmodem_ioctl_fsk_tx_request) +#define HFMODEM_IOCTL_FSKRXREQUEST _IOW('H', 1, struct hfmodem_ioctl_fsk_rx_request) +#define HFMODEM_IOCTL_CLEARRQ _IO('H', 3) +#define HFMODEM_IOCTL_GETCURTIME _IOR('H', 4, hfmodem_time_t) +#define HFMODEM_IOCTL_WAITRQ _IOR('H', 5, hfmodem_id_t) +#define HFMODEM_IOCTL_MIXERPARAMS _IOW('H', 6, struct hfmodem_ioctl_mixer_params) +#define HFMODEM_IOCTL_SAMPLESTART _IOW('H', 7, struct hfmodem_ioctl_sample_params) +#define HFMODEM_IOCTL_SAMPLEFINISHED _IO('H', 8) + +/* --------------------------------------------------------------------- */ +#ifdef __KERNEL__ + + +#define DMA_MODE_AUTOINIT 0x10 + +#define NR_DEVICE 1 + +#define HFMODEM_FRAGSAMPLES (HFMODEM_SRATE/100) +#define HFMODEM_FRAGSIZE (HFMODEM_FRAGSAMPLES*2) +#define HFMODEM_NUMFRAGS 8 +#define HFMODEM_EXCESSFRAGS 3 + +#define HFMODEM_NUMRXSLOTS 20 +#define HFMODEM_NUMTXSLOTS 4 + +#define HFMODEM_CORRELATOR_CACHE 8 + +enum slot_st { ss_unused = 0, ss_ready, ss_oper, ss_retired }; +typedef int hfmodem_conv_t; + +struct hfmodem_state { + const struct hfmodem_scops *scops; + + /* io params */ + struct { + unsigned int base_addr; + unsigned int dma; + unsigned int irq; + } io; + + struct { + unsigned int seriobase; + unsigned int pariobase; + unsigned int midiiobase; + unsigned int flags; + } ptt_out; + + struct { + __s16 *buf; + unsigned int lastfrag; + unsigned int fragptr; + unsigned int last_dmaptr; + int ptt_frames; + } dma; + + struct { + unsigned int last_tvusec; + unsigned long long time_cnt; + hfmodem_time_t lasttime; +#ifdef __i386__ + unsigned int starttime_lo, starttime_hi; +#endif /* __i386__ */ + } clk; + + int active; + struct wait_queue *wait; + + struct { + __s16 *kbuf; + __s16 *ubuf; + __s16 *kptr; + unsigned int size; + int rem; + } sbuf; + + struct { + hfmodem_time_t last_time; + unsigned int tx_phase; + + struct hfmodem_l1_rxslot { + enum slot_st state; + hfmodem_time_t tstart, tinc; + hfmodem_soft_t *data; + hfmodem_soft_t *userdata; + unsigned int nbits; + unsigned int cntbits; + hfmodem_id_t id; + unsigned int corrlen; + hfmodem_conv_t scale; + unsigned int corr_cache; + } rxslots[HFMODEM_NUMRXSLOTS]; + + struct hfmodem_l1_txslot { + enum slot_st state; + hfmodem_time_t tstart, tinc; + unsigned char *data; + unsigned int nbits; + unsigned int cntbits; + hfmodem_id_t id; + unsigned char inv; + unsigned int phinc; + unsigned int phase_incs[2]; + } txslots[HFMODEM_NUMTXSLOTS]; + } l1; +}; + +struct hfmodem_correlator_cache { + int refcnt; + int lru; + unsigned short phase_incs[2]; + hfmodem_conv_t correlator[2][2][HFMODEM_MAXCORRLEN]; +}; + +struct hfmodem_scops { + unsigned int extent; + + void (*init)(struct hfmodem_state *dev); + void (*prepare_input)(struct hfmodem_state *dev); + void (*trigger_input)(struct hfmodem_state *dev); + void (*prepare_output)(struct hfmodem_state *dev); + void (*trigger_output)(struct hfmodem_state *dev); + void (*stop)(struct hfmodem_state *dev); + unsigned int (*intack)(struct hfmodem_state *dev); + void (*mixer)(struct hfmodem_state *dev, int src, int igain, int ogain); +}; + +/* --------------------------------------------------------------------- */ + +extern int hfmodem_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); +#if LINUX_VERSION_CODE >= 0x20100 +extern unsigned int hfmodem_poll(struct file *file, poll_table *wait); +#else +extern int hfmodem_select(struct inode *inode, struct file *file, int sel_type, select_table *wait); +#endif + +extern void hfmodem_clear_rq(struct hfmodem_state *dev); +extern void hfmodem_input_samples(struct hfmodem_state *dev, hfmodem_time_t tstart, + hfmodem_time_t tinc, __s16 *samples); +extern int hfmodem_output_samples(struct hfmodem_state *dev, hfmodem_time_t tstart, + hfmodem_time_t tinc, __s16 *samples); +extern long hfmodem_next_tx_event(struct hfmodem_state *dev, hfmodem_time_t curr); +extern void hfmodem_finish_pending_rx_requests(struct hfmodem_state *dev); +extern void hfmodem_wakeup(struct hfmodem_state *dev); + + +extern int hfmodem_sbcprobe(struct hfmodem_state *dev); +extern int hfmodem_wssprobe(struct hfmodem_state *dev); + +extern void hfmodem_refclock_probe(void); +extern void hfmodem_refclock_init(struct hfmodem_state *dev); +extern hfmodem_time_t hfmodem_refclock_current(struct hfmodem_state *dev, hfmodem_time_t expected, int exp_valid); + +/* --------------------------------------------------------------------- */ + +extern const char hfmodem_drvname[]; +extern const char hfmodem_drvinfo[]; + +extern struct hfmodem_state hfmodem_state[NR_DEVICE]; +extern struct hfmodem_correlator_cache hfmodem_correlator_cache[HFMODEM_CORRELATOR_CACHE]; + +/* --------------------------------------------------------------------- */ +#endif /* __KERNEL__ */ +/* --------------------------------------------------------------------- */ +#endif /* _HFMODEM_H */ diff --git a/include/linux/if.h b/include/linux/if.h index 06e2d740e..09c066cb3 100644 --- a/include/linux/if.h +++ b/include/linux/if.h @@ -39,6 +39,9 @@ #define IFF_MULTICAST 0x1000 /* Supports multicast */ +#define IFF_PORTSEL 0x2000 /* can set media type */ +#define IFF_AUTOMEDIA 0x4000 /* auto media select active */ + /* * The ifaddr structure contains information about one address * of an interface. They are maintained by the different address diff --git a/include/linux/if_arcnet.h b/include/linux/if_arcnet.h new file mode 100644 index 000000000..8b2ba0aae --- /dev/null +++ b/include/linux/if_arcnet.h @@ -0,0 +1,63 @@ +/* + * 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. + * + * Global definitions for the ARCnet interface. + * + * Version: $Id: if_arcnet.h,v 1.2 1997/09/05 08:57:54 mj Exp $ + * + * Author: David Woodhouse <dwmw2@cam.ac.uk> + * Avery Pennarun <apenwarr@bond.net> + * + * 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. + */ + +#ifndef _LINUX_IF_ARCNET_H +#define _LINUX_IF_ARCNET_H + + +/* + * These are the defined ARCnet Protocol ID's. + */ + + /* RFC1201 Protocol ID's */ +#define ARC_P_IP 212 /* 0xD4 */ +#define ARC_P_ARP 213 /* 0xD5 */ +#define ARC_P_RARP 214 /* 0xD6 */ +#define ARC_P_IPX 250 /* 0xFA */ +#define ARC_P_NOVELL_EC 236 /* 0xEC */ + + /* Old RFC1051 Protocol ID's */ +#define ARC_P_IP_RFC1051 240 /* 0xF0 */ +#define ARC_P_ARP_RFC1051 241 /* 0xF1 */ + + /* MS LanMan/WfWg protocol */ +#define ARC_P_ETHER 0xE8 + + /* Unsupported/indirectly supported protocols */ +#define ARC_P_DATAPOINT_BOOT 0 /* very old Datapoint equipment */ +#define ARC_P_DATAPOINT_MOUNT 1 +#define ARC_P_POWERLAN_BEACON 8 /* Probably ATA-Netbios related */ +#define ARC_P_POWERLAN_BEACON2 243 +#define ARC_P_LANSOFT 251 /* 0xFB - what is this? */ +#define ARC_P_ATALK 0xDD + + +/* + * This is an ARCnet frame header. + */ + +struct archdr /* was struct HardHeader */ +{ + u_char source, /* source ARCnet - filled in automagically */ + destination, /* destination ARCnet - 0 for broadcast */ + offset1, /* offset of ClientData (256-byte packets) */ + offset2; /* offset of ClientData (512-byte packets) */ + +}; + +#endif /* _LINUX_IF_ARCNET_H */ diff --git a/include/linux/if_pppvar.h b/include/linux/if_pppvar.h index 2538d3408..720e5cdad 100644 --- a/include/linux/if_pppvar.h +++ b/include/linux/if_pppvar.h @@ -1,4 +1,4 @@ -/* $Id: if_pppvar.h,v 1.3 1996/09/01 07:45:23 davem Exp $ */ +/* $Id: if_pppvar.h,v 1.4 1997/09/03 11:55:06 ecd Exp $ */ /* * if_pppvar.h - private structures and declarations for PPP. * @@ -72,7 +72,7 @@ struct ppp_buffer { __s32 count; /* Count of characters in bufr */ __s32 head; /* index to head of list */ __s32 tail; /* index to tail of list */ - __u32 locked; /* Buffer is being sent */ + unsigned long locked; /* Buffer is being sent */ __s32 type; /* Type of the buffer */ /* =0, device read buffer */ /* =1, device write buffer */ @@ -93,7 +93,7 @@ struct ppp { __s32 magic; /* magic value for structure */ /* Bitmapped flag fields. */ - __u32 inuse; /* are we allocated? */ + unsigned long inuse; /* are we allocated? */ __u8 escape; /* 0x20 if prev char was PPP_ESC*/ __u8 toss; /* toss this frame */ diff --git a/include/linux/ip_fw.h b/include/linux/ip_fw.h index 3a33555f7..0b6c103f1 100644 --- a/include/linux/ip_fw.h +++ b/include/linux/ip_fw.h @@ -65,15 +65,15 @@ struct ip_fw struct in_addr fw_smsk, fw_dmsk; /* Mask for src and dest IP addr */ struct in_addr fw_via; /* IP address of interface "via" */ struct device *fw_viadev; /* device of interface "via" */ - unsigned short fw_flg; /* Flags word */ - unsigned short fw_nsp, fw_ndp; /* N'of src ports and # of dst ports */ + __u16 fw_flg; /* Flags word */ + __u16 fw_nsp, fw_ndp; /* N'of src ports and # of dst ports */ /* in ports array (dst ports follow */ /* src ports; max of 10 ports in all; */ /* count of 0 means match all ports) */ #define IP_FW_MAX_PORTS 10 /* A reasonable maximum */ - unsigned short fw_pts[IP_FW_MAX_PORTS]; /* Array of port numbers to match */ + __u16 fw_pts[IP_FW_MAX_PORTS]; /* Array of port numbers to match */ unsigned long fw_pcnt,fw_bcnt; /* Packet and byte counters */ - unsigned char fw_tosand, fw_tosxor; /* Revised packet priority */ + __u8 fw_tosand, fw_tosxor; /* Revised packet priority */ char fw_vianame[IFNAMSIZ]; /* name of interface "via" */ }; diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 51b319891..c6f2497fd 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -68,6 +68,16 @@ asmlinkage int printk(const char * fmt, ...) */ #define fsuser() (current->fsuid == 0) +/* + * Display an IP address in readable format. + */ + +#define NIPQUAD(addr) \ + (((addr) >> 0) & 0xff), \ + (((addr) >> 8) & 0xff), \ + (((addr) >> 16) & 0xff), \ + (((addr) >> 24) & 0xff) + #endif /* __KERNEL__ */ #define SI_LOAD_SHIFT 16 diff --git a/include/linux/lp.h b/include/linux/lp.h index 5554600a2..368cd9bef 100644 --- a/include/linux/lp.h +++ b/include/linux/lp.h @@ -123,6 +123,7 @@ struct lp_struct { unsigned int lastcall; unsigned int runchars; unsigned int waittime; + unsigned int should_relinquish; struct lp_stats stats; }; diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index dba07c796..2c7843ea7 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -219,7 +219,7 @@ extern struct file_operations fat_dir_operations; extern int fat_readdirx(struct inode *inode, struct file *filp, void *dirent, fat_filldir_t fat_filldir, filldir_t filldir, int shortnames, int longnames, int both); -extern int fat_readdir(struct inode *inode, struct file *filp, +extern int fat_readdir(struct file *filp, void *dirent, filldir_t); extern int fat_dir_ioctl(struct inode * inode, struct file * filp, unsigned int cmd, unsigned long arg); diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3f2301ace..4a530fe8f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -130,8 +130,21 @@ struct net_device_stats }; +/* Media selection options. */ +enum { + IF_PORT_UNKNOWN = 0, + IF_PORT_10BASE2, + IF_PORT_10BASET, + IF_PORT_AUI, + IF_PORT_100BASET, + IF_PORT_100BASETX, + IF_PORT_100BASEFX +}; + #ifdef __KERNEL__ +extern const char *if_port_text[]; + #include <linux/skbuff.h> /* @@ -163,7 +176,7 @@ struct device unsigned long mem_end; /* shared mem end */ unsigned long mem_start; /* shared mem start */ unsigned long base_addr; /* device I/O address */ - unsigned char irq; /* device IRQ number */ + unsigned int irq; /* device IRQ number */ /* Low-level status flags. */ volatile unsigned char start, /* start an operation */ diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index e89bc495f..b0163ec22 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h @@ -47,13 +47,6 @@ struct nfs_inode_info { unsigned long attrtimeo; /* - * This is to support the clandestine rename on unlink. - * Instead of the directory inode, we might as well keep - * its NFS FH, but that requires a kmalloc. - */ - struct inode * silly_inode; - - /* * This is the list of dirty unwritten pages. * NFSv3 will want to add a list for written but uncommitted * pages. diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index ae88f161d..4d089f946 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h @@ -137,6 +137,7 @@ fh_put(struct svc_fh *fhp) if (fhp->fh_dverified) { fh_unlock(fhp); dput(fhp->fh_handle.fh_dentry); + fhp->fh_dverified = 0; } } #else @@ -159,6 +160,7 @@ __fh_put(struct svc_fh *fhp, char *file, int line) } else { fh_unlock(fhp); dput(dentry); + fhp->fh_dverified = 0; } } #endif diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h index 690f0095f..0bf4a5a58 100644 --- a/include/linux/nfsd/syscall.h +++ b/include/linux/nfsd/syscall.h @@ -112,8 +112,7 @@ union nfsctl_res { * Kernel syscall implementation. */ #if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE) -extern asmlinkage int sys_nfsservctl(int, struct nfsctl_arg *, - union nfsctl_res *); +extern asmlinkage int sys_nfsservctl(int, void *, void *); #else #define sys_nfsservctl sys_ni_syscall #endif diff --git a/include/linux/openpic.h b/include/linux/openpic.h new file mode 100644 index 000000000..863e65997 --- /dev/null +++ b/include/linux/openpic.h @@ -0,0 +1,364 @@ +/* + * linux/openpic.h -- OpenPIC definitions + * + * Copyright (C) 1997 Geert Uytterhoeven + * + * 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. + * + * This file is based on the following documentation: + * + * The Open Programmable Interrupt Controller (PIC) + * Register Interface Specification Revision 1.2 + * + * Issue Date: October 1995 + * + * Issued jointly by Advanced Micro Devices and Cyrix Corporation + * + * AMD is a registered trademark of Advanced Micro Devices, Inc. + * Copyright (C) 1995, Advanced Micro Devices, Inc. and Cyrix, Inc. + * All Rights Reserved. + * + * To receive a copy of this documentation, send an email to openpic@amd.com. + * + * 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. + */ + +#ifndef _LINUX_OPENPIC_H +#define _LINUX_OPENPIC_H + +#if !defined(__powerpc__) && !defined(__i386__) +#error Unsupported OpenPIC platform +#endif + + +#ifdef __KERNEL__ + + /* + * OpenPIC supports up to 2048 interrupt sources and up to 32 processors + */ + +#define OPENPIC_MAX_SOURCES 2048 +#define OPENPIC_MAX_PROCESSORS 32 + +#define OPENPIC_NUM_TIMERS 4 +#define OPENPIC_NUM_IPI 4 +#define OPENPIC_NUM_PRI 16 +#define OPENPIC_NUM_VECTORS 256 + + + /* + * OpenPIC Registers are 32 bits and aligned on 128 bit boundaries + */ + +typedef struct _OpenPIC_Reg { + u_int Reg; /* Little endian! */ + char Pad[0xc]; +} OpenPIC_Reg; + + + /* + * Per Processor Registers + */ + +typedef struct _OpenPIC_Processor { + /* + * Private Shadow Registers (for SLiC backwards compatibility) + */ + u_int IPI0_Dispatch_Shadow; /* Write Only */ + char Pad1[0x4]; + u_int IPI0_Vector_Priority_Shadow; /* Read/Write */ + char Pad2[0x34]; + /* + * Interprocessor Interrupt Command Ports + */ + OpenPIC_Reg _IPI_Dispatch[OPENPIC_NUM_IPI]; /* Write Only */ + /* + * Current Task Priority Register + */ + OpenPIC_Reg _Current_Task_Priority; /* Read/Write */ +#ifndef __powerpc__ + /* + * Who Am I Register + */ + OpenPIC_Reg _Who_Am_I; /* Read Only */ +#else + char Pad3[0x10]; +#endif +#ifndef __i386__ + /* + * Interrupt Acknowledge Register + */ + OpenPIC_Reg _Interrupt_Acknowledge; /* Read Only */ +#else + char Pad4[0x10]; +#endif + /* + * End of Interrupt (EOI) Register + */ + OpenPIC_Reg _EOI; /* Read/Write */ + char Pad5[0xf40]; +} OpenPIC_Processor; + + + /* + * Timer Registers + */ + +typedef struct _OpenPIC_Timer { + OpenPIC_Reg _Current_Count; /* Read Only */ + OpenPIC_Reg _Base_Count; /* Read/Write */ + OpenPIC_Reg _Vector_Priority; /* Read/Write */ + OpenPIC_Reg _Destination; /* Read/Write */ +} OpenPIC_Timer; + + + /* + * Global Registers + */ + +typedef struct _OpenPIC_Global { + /* + * Feature Reporting Registers + */ + OpenPIC_Reg _Feature_Reporting0; /* Read Only */ + OpenPIC_Reg _Feature_Reporting1; /* Future Expansion */ + /* + * Global Configuration Registers + */ + OpenPIC_Reg _Global_Configuration0; /* Read/Write */ + OpenPIC_Reg _Global_Configuration1; /* Future Expansion */ + /* + * Vendor Specific Registers + */ + OpenPIC_Reg _Vendor_Specific[4]; + /* + * Vendor Identification Register + */ + OpenPIC_Reg _Vendor_Identification; /* Read Only */ + /* + * Processor Initialization Register + */ + OpenPIC_Reg _Processor_Initialization; /* Read/Write */ + /* + * IPI Vector/Priority Registers + */ + OpenPIC_Reg _IPI_Vector_Priority[OPENPIC_NUM_IPI]; /* Read/Write */ + /* + * Spurious Vector Register + */ + OpenPIC_Reg _Spurious_Vector; /* Read/Write */ + /* + * Global Timer Registers + */ + OpenPIC_Reg _Timer_Frequency; /* Read/Write */ + OpenPIC_Timer Timer[OPENPIC_NUM_TIMERS]; + char Pad1[0xee00]; +} OpenPIC_Global; + + + /* + * Interrupt Source Registers + */ + +typedef struct _OpenPIC_Source { + OpenPIC_Reg _Vector_Priority; /* Read/Write */ + OpenPIC_Reg _Destination; /* Read/Write */ +} OpenPIC_Source; + + + /* + * OpenPIC Register Map + */ + +struct OpenPIC { +#ifndef __powerpc__ + /* + * Per Processor Registers --- Private Access + */ + OpenPIC_Processor Private; +#else + char Pad1[0x1000]; +#endif + /* + * Global Registers + */ + OpenPIC_Global Global; + /* + * Interrupt Source Configuration Registers + */ + OpenPIC_Source Source[OPENPIC_MAX_SOURCES]; + /* + * Per Processor Registers + */ + OpenPIC_Processor Processor[OPENPIC_MAX_PROCESSORS]; +}; + +extern volatile struct OpenPIC *OpenPIC; + + + /* + * Current Task Priority Register + */ + +#define OPENPIC_CURRENT_TASK_PRIORITY_MASK 0x0000000f + + /* + * Who Am I Register + */ + +#define OPENPIC_WHO_AM_I_ID_MASK 0x0000001f + + /* + * Feature Reporting Register 0 + */ + +#define OPENPIC_FEATURE_LAST_SOURCE_MASK 0x07ff0000 +#define OPENPIC_FEATURE_LAST_SOURCE_SHIFT 16 +#define OPENPIC_FEATURE_LAST_PROCESSOR_MASK 0x00001f00 +#define OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT 8 +#define OPENPIC_FEATURE_VERSION_MASK 0x000000ff + + /* + * Global Configuration Register 0 + */ + +#define OPENPIC_CONFIG_RESET 0x80000000 +#define OPENPIC_CONFIG_8259_PASSTHROUGH_DISABLE 0x20000000 +#define OPENPIC_CONFIG_BASE_MASK 0x000fffff + + /* + * Vendor Identification Register + */ + +#define OPENPIC_VENDOR_ID_STEPPING_MASK 0x00ff0000 +#define OPENPIC_VENDOR_ID_STEPPING_SHIFT 16 +#define OPENPIC_VENDOR_ID_DEVICE_ID_MASK 0x0000ff00 +#define OPENPIC_VENDOR_ID_DEVICE_ID_SHIFT 8 +#define OPENPIC_VENDOR_ID_VENDOR_ID_MASK 0x000000ff + + /* + * Vector/Priority Registers + */ + +#define OPENPIC_MASK 0x80000000 +#define OPENPIC_ACTIVITY 0x40000000 /* Read Only */ +#define OPENPIC_PRIORITY_MASK 0x000f0000 +#define OPENPIC_PRIORITY_SHIFT 16 +#define OPENPIC_VECTOR_MASK 0x000000ff + + + /* + * Interrupt Source Registers + */ + +#define OPENPIC_SENSE_POLARITY 0x00800000 /* Undoc'd */ +#define OPENPIC_SENSE_LEVEL 0x00400000 + + + /* + * Timer Registers + */ + +#define OPENPIC_COUNT_MASK 0x7fffffff +#define OPENPIC_TIMER_TOGGLE 0x80000000 +#define OPENPIC_TIMER_COUNT_INHIBIT 0x80000000 + + + /* + * Aliases to make life simpler + */ + +/* Per Processor Registers */ +#define IPI_Dispatch(i) _IPI_Dispatch[i].Reg +#define Current_Task_Priority _Current_Task_Priority.Reg +#ifndef __powerpc__ +#define Who_Am_I _Who_Am_I.Reg +#endif +#ifndef __i386__ +#define Interrupt_Acknowledge _Interrupt_Acknowledge.Reg +#endif +#define EOI _EOI.Reg + +/* Global Registers */ +#define Feature_Reporting0 _Feature_Reporting0.Reg +#define Feature_Reporting1 _Feature_Reporting1.Reg +#define Global_Configuration0 _Global_Configuration0.Reg +#define Global_Configuration1 _Global_Configuration1.Reg +#define Vendor_Specific(i) _Vendor_Specific[i].Reg +#define Vendor_Identification _Vendor_Identification.Reg +#define Processor_Initialization _Processor_Initialization.Reg +#define IPI_Vector_Priority(i) _IPI_Vector_Priority[i].Reg +#define Spurious_Vector _Spurious_Vector.Reg +#define Timer_Frequency _Timer_Frequency.Reg + +/* Timer Registers */ +#define Current_Count _Current_Count.Reg +#define Base_Count _Base_Count.Reg +#define Vector_Priority _Vector_Priority.Reg +#define Destination _Destination.Reg + +/* Interrupt Source Registers */ +#define Vector_Priority _Vector_Priority.Reg +#define Destination _Destination.Reg + + + /* + * Vendor and Device IDs + */ + +#define OPENPIC_VENDOR_ID_APPLE 0x14 +#define OPENPIC_DEVICE_ID_APPLE_HYDRA 0x46 + + + /* + * OpenPIC Operations + */ + +/* Global Operations */ +extern void openpic_init(void); +extern void openpic_reset(void); +extern void openpic_enable_8259_pass_through(void); +extern void openpic_disable_8259_pass_through(void); +#ifndef __i386__ +extern u_int openpic_irq(u_int cpu); +#endif +#ifndef __powerpc__ +extern void openpic_eoi(void); +extern u_int openpic_get_priority(void); +extern void openpic_set_priority(u_int pri); +#else +extern void openpic_eoi(u_int cpu); +extern u_int openpic_get_priority(u_int cpu); +extern void openpic_set_priority(u_int cpu, u_int pri); +#endif +extern u_int openpic_get_spurious(void); +extern void openpic_set_spurious(u_int vector); +extern void openpic_init_processor(u_int cpumask); + +/* Interprocessor Interrupts */ +extern void openpic_initipi(u_int ipi, u_int pri, u_int vector); +#ifndef __powerpc__ +extern void openpic_cause_IPI(u_int ipi, u_int cpumask); +#else +extern void openpic_cause_IPI(u_int cpu, u_int ipi, u_int cpumask); +#endif + +/* Timer Interrupts */ +extern void openpic_inittimer(u_int timer, u_int pri, u_int vector); +extern void openpic_maptimer(u_int timer, u_int cpumask); + +/* Interrupt Sources */ +extern void openpic_enable_irq(u_int irq); +extern void openpic_disable_irq(u_int irq); +extern void openpic_initirq(u_int irq, u_int pri, u_int vector, int polarity, + int is_level); +extern void openpic_mapirq(u_int irq, u_int cpumask); +extern void openpic_set_sense(u_int irq, int sense); + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_OPENPIC_H */ diff --git a/include/linux/parport.h b/include/linux/parport.h index eca37ac03..c3106ffdf 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -1,4 +1,4 @@ -/* $Id: parport.h,v 1.2 1997/07/29 04:00:12 ralf Exp $ */ +/* $Id: parport.h,v 1.3 1997/08/06 19:16:45 miguel Exp $ */ #ifndef _PARPORT_H_ #define _PARPORT_H_ @@ -81,6 +81,9 @@ struct parport_operations { void (*enable_irq)(struct parport *); void (*disable_irq)(struct parport *); int (*examine_irq)(struct parport *); + + void (*inc_use_count)(void); + void (*dec_use_count)(void); }; #define PARPORT_CONTROL_STROBE 0x1 diff --git a/include/linux/pci.h b/include/linux/pci.h index 138e67bfe..94c321bdf 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -221,6 +221,9 @@ */ #define PCI_VENDOR_ID_COMPAQ 0x0e11 #define PCI_DEVICE_ID_COMPAQ_1280 0x3033 +#define PCI_DEVICE_ID_COMPAQ_NETELL100 0xae32 +#define PCI_DEVICE_ID_COMPAQ_NETELL10 0xae34 +#define PCI_DEVICE_ID_COMPAQ_NETFLEX3 0xae35 #define PCI_DEVICE_ID_COMPAQ_THUNDER 0xf130 #define PCI_VENDOR_ID_NCR 0x1000 @@ -247,11 +250,13 @@ #define PCI_DEVICE_ID_VLSI_82C593 0x0006 #define PCI_DEVICE_ID_VLSI_82C594 0x0007 #define PCI_DEVICE_ID_VLSI_82C597 0x0009 +#define PCI_DEVICE_ID_VLSI_VAS96011 0x0702 #define PCI_VENDOR_ID_ADL 0x1005 #define PCI_DEVICE_ID_ADL_2301 0x2301 #define PCI_VENDOR_ID_NS 0x100b +#define PCI_DEVICE_ID_NS_87415 0x0002 #define PCI_DEVICE_ID_NS_87410 0xd001 #define PCI_VENDOR_ID_TSENG 0x100c @@ -270,9 +275,11 @@ #define PCI_DEVICE_ID_DEC_TULIP 0x0002 #define PCI_DEVICE_ID_DEC_TGA 0x0004 #define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009 +#define PCI_DEVICE_ID_DEC_TGA2 0x000D #define PCI_DEVICE_ID_DEC_FDDI 0x000F #define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014 #define PCI_DEVICE_ID_DEC_21142 0x0019 +#define PCI_DEVICE_ID_DEC_21143 0x0019 #define PCI_DEVICE_ID_DEC_21052 0x0021 #define PCI_DEVICE_ID_DEC_21152 0x0024 @@ -283,13 +290,17 @@ #define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8 #define PCI_DEVICE_ID_CIRRUS_5436 0x00ac #define PCI_DEVICE_ID_CIRRUS_5446 0x00b8 +#define PCI_DEVICE_ID_CIRRUS_5480 0x00bc #define PCI_DEVICE_ID_CIRRUS_5464 0x00d4 +#define PCI_DEVICE_ID_CIRRUS_5465 0x00d6 #define PCI_DEVICE_ID_CIRRUS_6729 0x1100 +#define PCI_DEVICE_ID_CIRRUS_6832 0x1110 #define PCI_DEVICE_ID_CIRRUS_7542 0x1200 #define PCI_DEVICE_ID_CIRRUS_7543 0x1202 #define PCI_DEVICE_ID_CIRRUS_7541 0x1204 #define PCI_VENDOR_ID_IBM 0x1014 +#define PCI_DEVICE_ID_IBM_FIRE_CORAL 0x000a #define PCI_DEVICE_ID_IBM_82G2675 0x001d #define PCI_DEVICE_ID_IBM_82351 0x0022 @@ -312,6 +323,7 @@ #define PCI_DEVICE_ID_MATROX_MGA_2 0x0518 #define PCI_DEVICE_ID_MATROX_MIL 0x0519 #define PCI_DEVICE_ID_MATROX_MYS 0x051A +#define PCI_DEVICE_ID_MATROX_MIL_2 0x051b #define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 #define PCI_VENDOR_ID_CT 0x102c @@ -334,6 +346,7 @@ #define PCI_DEVICE_ID_SI_501 0x0406 #define PCI_DEVICE_ID_SI_496 0x0496 #define PCI_DEVICE_ID_SI_601 0x0601 +#define PCI_DEVICE_ID_SI_5107 0x5107 #define PCI_DEVICE_ID_SI_5511 0x5511 #define PCI_DEVICE_ID_SI_5513 0x5513 #define PCI_DEVICE_ID_SI_5571 0x5571 @@ -366,6 +379,10 @@ #define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 #define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130 +#define PCI_VENDOR_ID_TI 0x104c +#define PCI_DEVICE_ID_TI_PCI1130 0xac12 +#define PCI_DEVICE_ID_TI_PCI1131 0xac15 + #define PCI_VENDOR_ID_OAK 0x104e #define PCI_DEVICE_ID_OAK_OTI107 0x0107 @@ -381,6 +398,11 @@ #define PCI_VENDOR_ID_PROMISE 0x105a #define PCI_DEVICE_ID_PROMISE_5300 0x5300 +#define PCI_VENDOR_ID_APPLE 0x106b +#define PCI_DEVICE_ID_APPLE_BANDIT 0x0001 +#define PCI_DEVICE_ID_APPLE_GC 0x0002 +#define PCI_DEVICE_ID_APPLE_HYDRA 0x000e + #define PCI_VENDOR_ID_N9 0x105d #define PCI_DEVICE_ID_N9_I128 0x2309 #define PCI_DEVICE_ID_N9_I128_2 0x2339 @@ -415,10 +437,23 @@ #define PCI_VENDOR_ID_FOREX 0x1083 #define PCI_VENDOR_ID_OLICOM 0x108d +#define PCI_DEVICE_ID_OLICOM_OC3136 0x0001 +#define PCI_DEVICE_ID_OLICOM_OC2315 0x0011 +#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012 +#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013 +#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014 +#define PCI_DEVICE_ID_OLICOM_OC6151 0x0021 + +#define PCI_VENDOR_ID_SUN 0x108e +#define PCI_DEVICE_ID_SUN_EBUS 0x1000 +#define PCI_DEVICE_ID_SUN_HAPPYMEAL 0x1001 +#define PCI_DEVICE_ID_SUN_PBM 0x8000 #define PCI_VENDOR_ID_CMD 0x1095 #define PCI_DEVICE_ID_CMD_640 0x0640 +#define PCI_DEVICE_ID_CMD_643 0x0643 #define PCI_DEVICE_ID_CMD_646 0x0646 +#define PCI_DEVICE_ID_CMD_670 0x0670 #define PCI_VENDOR_ID_VISION 0x1098 #define PCI_DEVICE_ID_VISION_QD8500 0x0001 @@ -438,6 +473,9 @@ #define PCI_DEVICE_ID_WINBOND_82C105 0x0105 #define PCI_DEVICE_ID_WINBOND_83C553 0x0565 +#define PCI_VENDOR_ID_DATABOOK 0x10b3 +#define PCI_DEVICE_ID_DATABOOK_87144 0xb106 + #define PCI_VENDOR_ID_3COM 0x10b7 #define PCI_DEVICE_ID_3COM_3C590 0x5900 #define PCI_DEVICE_ID_3COM_3C595TX 0x5950 @@ -447,6 +485,8 @@ #define PCI_DEVICE_ID_3COM_3C900COMBO 0x9001 #define PCI_DEVICE_ID_3COM_3C905TX 0x9050 +#define PCI_VENDOR_ID_SMC 0x10b8 + #define PCI_VENDOR_ID_AL 0x10b9 #define PCI_DEVICE_ID_AL_M1445 0x1445 #define PCI_DEVICE_ID_AL_M1449 0x1449 @@ -457,8 +497,11 @@ #define PCI_DEVICE_ID_AL_M1513 0x1513 #define PCI_DEVICE_ID_AL_M4803 0x5215 +#define PCI_VENDOR_ID_MITSUBISHI 0x10ba + #define PCI_VENDOR_ID_NEOMAGIC 0x10c8 #define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2070 0x0001 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128V 0x0002 #define PCI_VENDOR_ID_ASP 0x10cd #define PCI_DEVICE_ID_ASP_ABP940 0x1200 @@ -487,6 +530,10 @@ #define PCI_VENDOR_ID_REALTEK 0x10ec #define PCI_DEVICE_ID_REALTEK_8029 0x8029 +#define PCI_DEVICE_ID_REALTEK_8129 0x8129 + +#define PCI_VENDOR_ID_TRUEVISION 0x10fa +#define PCI_DEVICE_ID_TRUEVISION_T1000 0x000c #define PCI_VENDOR_ID_INIT 0x1101 #define PCI_DEVICE_ID_INIT_320P 0x9100 @@ -498,6 +545,7 @@ #define PCI_DEVICE_ID_VIA_82C576 0x0576 #define PCI_DEVICE_ID_VIA_82C585 0x0585 #define PCI_DEVICE_ID_VIA_82C586 0x0586 +#define PCI_DEVICE_ID_VIA_82C926 0x0926 #define PCI_DEVICE_ID_VIA_82C416 0x1571 #define PCI_VENDOR_ID_VORTEX 0x1119 @@ -527,6 +575,9 @@ #define PCI_VENDOR_ID_IMAGINGTECH 0x112f #define PCI_DEVICE_ID_IMAGINGTECH_ICPCI 0x0000 +#define PCI_VENDOR_ID_PHILIPS 0x1131 +#define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146 + #define PCI_VENDOR_ID_PLX 0x113c #define PCI_DEVICE_ID_PLX_9060 0x0001 @@ -543,21 +594,38 @@ #define PCI_VENDOR_ID_MUTECH 0x1159 #define PCI_DEVICE_ID_MUTECH_MV1000 0x0001 +#define PCI_VENDOR_ID_RENDITION 0x1163 +#define PCI_DEVICE_ID_RENDITION_VERITE 0x0001 + #define PCI_VENDOR_ID_TOSHIBA 0x1179 #define PCI_DEVICE_ID_TOSHIBA_601 0x0601 +#define PCI_VENDOR_ID_RICOH 0x1180 +#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466 + #define PCI_VENDOR_ID_ZEITNET 0x1193 #define PCI_DEVICE_ID_ZEITNET_1221 0x0001 #define PCI_DEVICE_ID_ZEITNET_1225 0x0002 #define PCI_VENDOR_ID_OMEGA 0x119b -#define PCI_DEVICE_ID_OMEGA_PCMCIA 0x1221 +#define PCI_DEVICE_ID_OMEGA_82C092G 0x1221 + +#define PCI_VENDOR_ID_GALILEO 0x11ab +#define PCI_DEVICE_ID_GALILEO_GT64011 0x4146 + +#define PCI_VENDOR_ID_NP 0x11bc +#define PCI_DEVICE_ID_NP_PCI_FDDI 0x0001 #define PCI_VENDOR_ID_SPECIALIX 0x11cb #define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000 #define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 +#define PCI_VENDOR_ID_IKON 0x11d5 +#define PCI_DEVICE_ID_IKON_10115 0x0115 +#define PCI_DEVICE_ID_IKON_10117 0x0117 + #define PCI_VENDOR_ID_ZORAN 0x11de +#define PCI_DEVICE_ID_ZORAN_36057 0x6057 #define PCI_DEVICE_ID_ZORAN_36120 0x6120 #define PCI_VENDOR_ID_COMPEX 0x11f6 @@ -584,7 +652,7 @@ #define PCI_VENDOR_ID_OPTIBASE 0x1255 #define PCI_DEVICE_ID_OPTIBASE_FORGE 0x1110 #define PCI_DEVICE_ID_OPTIBASE_FUSION 0x1210 -#define PCI_DEVICE_ID_OPTIBASE_VPLEX 0x2120 +#define PCI_DEVICE_ID_OPTIBASE_VPLEX 0x2110 #define PCI_DEVICE_ID_OPTIBASE_VPLEXCC 0x2120 #define PCI_DEVICE_ID_OPTIBASE_VQUEST 0x2130 @@ -596,6 +664,7 @@ #define PCI_VENDOR_ID_3DLABS 0x3d3d #define PCI_DEVICE_ID_3DLABS_300SX 0x0001 +#define PCI_DEVICE_ID_3DLABS_500TX 0x0002 #define PCI_DEVICE_ID_3DLABS_DELTA 0x0003 #define PCI_DEVICE_ID_3DLABS_PERMEDIA 0x0004 @@ -616,6 +685,9 @@ #define PCI_DEVICE_ID_S3_964_1 0x88d0 #define PCI_DEVICE_ID_S3_964_2 0x88d1 #define PCI_DEVICE_ID_S3_968 0x88f0 +#define PCI_DEVICE_ID_S3_TRIO64V2 0x8901 +#define PCI_DEVICE_ID_S3_PLATO_PXG 0x8902 +#define PCI_DEVICE_ID_S3_ViRGE_DXGX 0x8a01 #define PCI_VENDOR_ID_INTEL 0x8086 #define PCI_DEVICE_ID_INTEL_82375 0x0482 @@ -714,7 +786,12 @@ struct pci_dev { * necessary. The field must not be 0 unless the device * cannot generate interrupts at all. */ - unsigned char irq; /* irq generated by this device */ + unsigned int irq; /* irq generated by this device */ + + /* Base registers for this device, can be adjusted by + * pcibios_fixup() as necessary. + */ + unsigned long base_address[6]; }; struct pci_bus { @@ -751,6 +828,8 @@ extern struct pci_dev *pci_devices; /* list of all devices */ extern unsigned long pci_init (unsigned long mem_start, unsigned long mem_end); +extern unsigned int pci_scan_bus(struct pci_bus *bus, unsigned long *mem_startp); + extern struct pci_dev_info *pci_lookup_dev (unsigned int vendor, unsigned int dev); extern const char *pci_strclass (unsigned int class); diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 901a8b9ef..e7b84f348 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -51,7 +51,8 @@ enum root_directory_inos { PROC_HARDWARE, PROC_SLABINFO, PROC_PARPORT, - PROC_OMIRR /* whether enabled or not */ + PROC_OMIRR, /* whether enabled or not */ + PROC_PPC_HTAB }; enum pid_directory_inos { @@ -182,6 +183,8 @@ enum scsi_directory_inos { PROC_SCSI_ATARI, PROC_SCSI_IDESCSI, PROC_SCSI_SGIWD93, + PROC_SCSI_MESH, + PROC_SCSI_53C94, PROC_SCSI_SCSI_DEBUG, PROC_SCSI_NOT_PRESENT, PROC_SCSI_FILE, /* I'm assuming here that we */ @@ -323,7 +326,7 @@ extern int proc_match(int, const char *,struct proc_dir_entry *); * The /proc root directory has extended versions to take care * of the /proc/<pid> subdirectories. */ -extern int proc_readdir(struct inode *, struct file *, void *, filldir_t); +extern int proc_readdir(struct file *, void *, filldir_t); extern int proc_lookup(struct inode *, struct dentry *); struct openpromfs_dev { @@ -363,6 +366,7 @@ extern struct inode_operations proc_fd_inode_operations; extern struct inode_operations proc_ringbuf_inode_operations; #endif extern struct inode_operations proc_omirr_inode_operations; +extern struct inode_operations proc_ppc_htab_inode_operations; #endif @@ -379,3 +383,8 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent); extern void proc_tty_init(void); extern void proc_tty_register_driver(struct tty_driver *driver); extern void proc_tty_unregister_driver(struct tty_driver *driver); + +/* + * proc_devtree.c + */ +extern void proc_device_tree_init(void); diff --git a/include/linux/sched.h b/include/linux/sched.h index f1fc28b18..16f024490 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -472,6 +472,16 @@ extern inline int suser(void) return 0; } +/* + * Routines for handling mm_structs + */ +extern struct mm_struct * mm_alloc(void); +static inline void mmget(struct mm_struct * mm) +{ + mm->count++; +} +extern void mmput(struct mm_struct *); + extern int copy_thread(int, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); extern void flush_thread(void); extern void exit_thread(void); diff --git a/include/linux/smb.h b/include/linux/smb.h index 1bba4859e..8953686b0 100644 --- a/include/linux/smb.h +++ b/include/linux/smb.h @@ -1,119 +1,76 @@ /* * smb.h * - * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke + * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke + * Copyright (C) 1997 by Volker Lendecke * */ #ifndef _LINUX_SMB_H #define _LINUX_SMB_H -#define SMB_PORT 139 -#define SMB_MAXNAMELEN 255 -#define SMB_MAXPATHLEN 1024 - -#define SMB_DEF_MAX_XMIT 32768 - -/* Allocate max. 1 page */ -#define TRANS2_MAX_TRANSFER (4096-17) - -#include <asm/types.h> -#ifdef __KERNEL__ -typedef u8 byte; -typedef u16 word; -typedef u32 dword; -#else -typedef unsigned char byte; -typedef unsigned short word; -typedef unsigned long dword; -#endif - -/* The following macros have been taken directly from Samba. Thanks, - Andrew! */ - -#undef CAREFUL_ALIGNMENT +#include <linux/types.h> -/* we know that the 386 can handle misalignment and has the "right" - byteorder */ -#if defined(__i386__) -#define CAREFUL_ALIGNMENT 0 -#endif - -#ifndef CAREFUL_ALIGNMENT -#define CAREFUL_ALIGNMENT 1 -#endif +enum smb_protocol { + SMB_PROTOCOL_NONE, + SMB_PROTOCOL_CORE, + SMB_PROTOCOL_COREPLUS, + SMB_PROTOCOL_LANMAN1, + SMB_PROTOCOL_LANMAN2, + SMB_PROTOCOL_NT1 +}; -#define BVAL(buf,pos) (((u8 *)(buf))[pos]) -#define PVAL(buf,pos) ((unsigned)BVAL(buf,pos)) -#define BSET(buf,pos,val) (BVAL(buf,pos) = (val)) +enum smb_case_hndl { + SMB_CASE_DEFAULT, + SMB_CASE_LOWER, + SMB_CASE_UPPER +}; +struct smb_dskattr { + __u16 total; + __u16 allocblocks; + __u16 blocksize; + __u16 free; +}; -#if CAREFUL_ALIGNMENT -#define WVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) -#define DVAL(buf,pos) (WVAL(buf,pos)|WVAL(buf,(pos)+2)<<16) +struct smb_conn_opt { -#define SSVALX(buf,pos,val) (BVAL(buf,pos)=(val)&0xFF,BVAL(buf,pos+1)=(val)>>8) -#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16)) -#define WSET(buf,pos,val) { word __val = (val); \ - SSVALX((buf),(pos),((word)(__val))); } -#define DSET(buf,pos,val) { dword __val = (val); \ - SIVALX((buf),(pos),((dword)(__val))); } -#else -/* this handles things for architectures like the 386 that can handle - alignment errors */ -/* - WARNING: This section is dependent on the length of word and dword - being correct -*/ -#define WVAL(buf,pos) (*(word *)((char *)(buf) + (pos))) -#define DVAL(buf,pos) (*(dword *)((char *)(buf) + (pos))) -#define WSET(buf,pos,val) WVAL(buf,pos)=((word)(val)) -#define DSET(buf,pos,val) DVAL(buf,pos)=((dword)(val)) -#endif + /* The socket */ + unsigned int fd; + enum smb_protocol protocol; + enum smb_case_hndl case_handling; -/* where to find the base of the SMB packet proper */ -#define smb_base(buf) ((byte *)(((byte *)(buf))+4)) + /* Connection-Options */ -#define LANMAN1 -#define LANMAN2 -#define NT1 + __u32 max_xmit; + __u16 server_uid; + __u16 tid; -enum smb_protocol { - PROTOCOL_NONE, - PROTOCOL_CORE, - PROTOCOL_COREPLUS, - PROTOCOL_LANMAN1, - PROTOCOL_LANMAN2, - PROTOCOL_NT1 -}; + /* The following are LANMAN 1.0 options */ + __u16 secmode; + __u16 maxmux; + __u16 maxvcs; + __u16 rawmode; + __u32 sesskey; -enum smb_case_hndl { - CASE_DEFAULT, - CASE_LOWER, - CASE_UPPER + /* The following are NT LM 0.12 options */ + __u32 maxraw; + __u32 capabilities; + __u16 serverzone; }; #ifdef __KERNEL__ -enum smb_conn_state { - CONN_VALID, /* everything's fine */ - CONN_INVALID, /* Something went wrong, but did not - try to reconnect yet. */ - CONN_RETRIED /* Tried a reconnection, but was refused */ -}; - -struct smb_dskattr { - word total; - word allocblocks; - word blocksize; - word free; -}; +#define SMB_MAXNAMELEN 255 +#define SMB_MAXPATHLEN 1024 /* * Contains all relevant data on a SMB networked file. */ -struct smb_dirent { +struct smb_fattr { + + __u16 attr; unsigned long f_ino; umode_t f_mode; @@ -127,16 +84,40 @@ struct smb_dirent { time_t f_ctime; unsigned long f_blksize; unsigned long f_blocks; - - int opened; /* is it open on the fileserver? */ - word fileid; /* What id to handle a file with? */ - word attr; /* Attribute fields, DOS value */ - - unsigned short access; /* Access bits. */ - unsigned long f_pos; /* File position. (For readdir.) */ - unsigned char name[SMB_MAXNAMELEN+1]; - int len; /* namelength */ }; -#endif /* __KERNEL__ */ -#endif /* _LINUX_SMB_H */ +struct smb_dirent { + struct smb_fattr attr; + + int f_pos; + int len; + __u8 name[SMB_MAXNAMELEN]; +}; + +enum smb_conn_state { + CONN_VALID, /* everything's fine */ + CONN_INVALID, /* Something went wrong, but did not + try to reconnect yet. */ + CONN_RETRIED /* Tried a reconnection, but was refused */ +}; + +/* + * The readdir cache size controls how many directory entries are cached. + */ +#define SMB_READDIR_CACHE_SIZE 64 + +#define SMB_SUPER_MAGIC 0x517B + +#define SMB_SERVER(inode) (&(inode->i_sb->u.smbfs_sb)) +#define SMB_INOP(inode) (&(inode->u.smbfs_i)) + +#define SMB_HEADER_LEN 37 /* includes everything up to, but not + * including smb_bcc */ +#define SMB_DEF_MAX_XMIT 32768 +#define SMB_INITIAL_PACKET_SIZE 4000 + +/* Allocate max. 1 page */ +#define TRANS2_MAX_TRANSFER (4096-17) + +#endif +#endif diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index c129cb540..be01f3048 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h @@ -2,6 +2,7 @@ * smb_fs.h * * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke + * Copyright (C) 1997 by Volker Lendecke * */ @@ -9,72 +10,37 @@ #define _LINUX_SMB_FS_H #include <linux/smb.h> -#include <linux/fs.h> -#include <linux/in.h> -#include <linux/types.h> -#include <linux/vmalloc.h> - -#include <linux/smb_mount.h> -#include <linux/smb_fs_sb.h> -#include <linux/smb_fs_i.h> /* * ioctl commands */ #define SMB_IOC_GETMOUNTUID _IOR('u', 1, uid_t) +#define SMB_IOC_NEWCONN _IOW('u', 2, struct smb_conn_opt) #ifdef __KERNEL__ -/* - * The readdir cache size controls how many directory entries are cached. - */ -#define SMB_READDIR_CACHE_SIZE 64 - -/* - * This defines the number of filenames cached in memory to avoid - * constructing filenames from \ - */ -#define SMB_CACHE_TABLE_SIZE 64 - -#define SMB_SUPER_MAGIC 0x517B +#include <asm/unaligned.h> +#define WVAL(buf,pos) \ +(le16_to_cpu(get_unaligned((__u16 *)((__u8 *)(buf) + (pos))))) +#define DVAL(buf,pos) \ +(le32_to_cpu(get_unaligned((__u32 *)((__u8 *)(buf) + (pos))))) +#define WSET(buf,pos,val) \ +put_unaligned(cpu_to_le16((__u16)(val)), (__u16 *)((__u8 *)(buf) + (pos))) +#define DSET(buf,pos,val) \ +put_unaligned(cpu_to_le32((__u32)(val)), (__u32 *)((__u8 *)(buf) + (pos))) +/* where to find the base of the SMB packet proper */ +#define smb_base(buf) ((__u8 *)(((__u8 *)(buf))+4)) -#define SMB_SBP(sb) ((struct smb_sb_info *)(sb->u.generic_sbp)) -#define SMB_INOP(inode) ((struct smb_inode_info *)(inode->u.generic_ip)) - -#define SMB_SERVER(inode) (&(SMB_SBP(inode->i_sb)->s_server)) -#define SMB_SERVATTR(inode) (&(SMB_SBP(inode->i_sb)->s_attr)) - -#define SMB_FINFO(inode) (&(SMB_INOP(inode)->finfo)) - -#define SMB_HEADER_LEN 37 /* includes everything up to, but not - * including smb_bcc */ +#include <linux/vmalloc.h> #ifdef DEBUG_SMB_MALLOC -#include <linux/malloc.h> - extern int smb_malloced; -extern int smb_current_kmalloced; extern int smb_current_vmalloced; static inline void * -smb_kmalloc(unsigned int size, int priority) -{ - smb_malloced += 1; - smb_current_kmalloced += 1; - return kmalloc(size, priority); -} - -static inline void -smb_kfree_s(void *obj, int size) -{ - smb_current_kmalloced -= 1; - kfree_s(obj, size); -} - -static inline void * smb_vmalloc(unsigned int size) { smb_malloced += 1; @@ -98,47 +64,20 @@ smb_vfree(void *obj) #endif /* DEBUG_SMB_MALLOC */ -#if DEBUG_SMB > 0 -#define DPRINTK(format, args...) printk(format , ## args) -#else -#define DPRINTK(format, args...) -#endif - -#if DEBUG_SMB > 1 -#define DDPRINTK(format, args...) printk(format , ## args) -#else -#define DDPRINTK(format, args...) -#endif - - -static inline ino_t -smb_info_ino(struct smb_inode_info *info) -{ -#if 0 - return (ino_t) info; -#else - if (info != NULL) - { - return info->finfo.f_ino; - } - return 1; -#endif -} +struct smb_sb_info; /* linux/fs/smbfs/file.c */ extern struct inode_operations smb_file_inode_operations; -int smb_make_open(struct inode *i, int right); /* linux/fs/smbfs/dir.c */ extern struct inode_operations smb_dir_inode_operations; -struct smb_inode_info *smb_find_inode(struct smb_server *server, ino_t ino); +struct smb_inode_info *smb_find_inode(struct smb_sb_info *server, ino_t ino); void smb_free_inode_info(struct smb_inode_info *i); -void smb_free_all_inodes(struct smb_server *server); -void smb_init_root(struct smb_server *server); -int smb_stat_root(struct smb_server *server); +void smb_free_all_inodes(struct smb_sb_info *server); +void smb_init_root(struct smb_sb_info *server); +int smb_stat_root(struct smb_sb_info *server); void smb_init_dir_cache(void); void smb_invalid_dir_cache(unsigned long ino); -void smb_invalidate_all_inodes(struct smb_server *server); void smb_free_dir_cache(void); /* linux/fs/smbfs/ioctl.c */ @@ -149,63 +88,61 @@ int smb_ioctl (struct inode * inode, struct file * filp, struct super_block *smb_read_super(struct super_block *sb, void *raw_data, int silent); extern int init_smb_fs(void); +void smb_invalidate_inodes(struct smb_sb_info *server); +int smb_revalidate_inode(struct inode *i); +int smb_refresh_inode(struct inode *i); int smb_notify_change(struct inode *inode, struct iattr *attr); -void smb_invalidate_connection(struct smb_server *server); -int smb_conn_is_valid(struct smb_server *server); +void smb_invalidate_connection(struct smb_sb_info *server); +int smb_conn_is_valid(struct smb_sb_info *server); +unsigned long smb_invent_inos(unsigned long n); +struct inode *smb_iget(struct super_block *, struct smb_fattr *); /* linux/fs/smbfs/proc.c */ -dword smb_len(unsigned char *packet); -byte *smb_encode_smb_length(byte *p, dword len); -__u8 *smb_setup_header(struct smb_server *server, byte command, - word wct, word bcc); -void smb_init_root_dirent(struct smb_server *server, struct smb_dirent *entry); -int smb_proc_open(struct smb_server *server, - struct smb_inode_info *dir, const char *name, int len, - struct smb_dirent *entry); -int smb_proc_close(struct smb_server *server, - __u16 fileid, __u32 mtime); -int smb_proc_read(struct smb_server *server, struct smb_dirent *finfo, - off_t offset, long count, char *data, int fs); -int smb_proc_read_raw(struct smb_server *server, struct smb_dirent *finfo, - off_t offset, long count, char *data); -int smb_proc_write(struct smb_server *server, struct smb_dirent *finfo, - off_t offset, int count, const char *data); -int smb_proc_write_raw(struct smb_server *server, struct smb_dirent *finfo, - off_t offset, long count, const char *data); -int smb_proc_create(struct inode *dir, const char *name, int len, - word attr, time_t ctime); -int smb_proc_mv(struct inode *odir, const char *oname, const int olen, - struct inode *ndir, const char *nname, const int nlen); -int smb_proc_mkdir(struct inode *dir, const char *name, const int len); -int smb_proc_rmdir(struct inode *dir, const char *name, const int len); -int smb_proc_unlink(struct inode *dir, const char *name, const int len); -int smb_proc_readdir(struct smb_server *server, struct inode *dir, - int fpos, int cache_size, - struct smb_dirent *entry); -int smb_proc_getattr(struct inode *dir, const char *name, int len, - struct smb_dirent *entry); -int smb_proc_setattr(struct smb_server *server, - struct inode *ino, - struct smb_dirent *new_finfo); -int smb_proc_chkpath(struct smb_server *server, char *path, int len, - int *result); -int smb_proc_dskattr(struct super_block *super, struct smb_dskattr *attr); -int smb_proc_reconnect(struct smb_server *server); -int smb_proc_connect(struct smb_server *server); -int smb_proc_disconnect(struct smb_server *server); -int smb_proc_trunc(struct smb_server *server, word fid, dword length); +__u32 smb_len(unsigned char *packet); +__u8 *smb_encode_smb_length(__u8 *p, __u32 len); +__u8 *smb_setup_header(struct smb_sb_info *server, __u8 command, + __u16 wct, __u16 bcc); +int smb_offerconn(struct smb_sb_info *server); +int smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt); +int smb_close(struct dentry *); +int smb_open(struct dentry *, int); +static inline int +smb_is_open(struct inode *i) +{ + return (i->u.smbfs_i.open == SMB_SERVER(i)->generation); +} + +int smb_proc_read(struct inode *, off_t, long, char *); +int smb_proc_write(struct inode *, off_t, int, const char *); +int smb_proc_create(struct dentry *, struct qstr *, __u16, time_t); +int smb_proc_mv(struct dentry *, struct qstr *, struct dentry *, struct qstr *); +int smb_proc_mkdir(struct dentry *, struct qstr *); +int smb_proc_rmdir(struct dentry *, struct qstr *); +int smb_proc_unlink(struct dentry *dir, struct qstr *); +int smb_proc_readdir(struct dentry *dir, int fpos, int cache_size, struct smb_dirent *entry); +int smb_proc_getattr(struct dentry *dir, struct qstr *name, + struct smb_fattr *entry); +int smb_proc_setattr(struct smb_sb_info *server, + struct dentry *dir, + struct smb_fattr *new_finfo); +int smb_proc_dskattr(struct super_block *sb, struct statfs *attr); +int smb_proc_reconnect(struct smb_sb_info *server); +int smb_proc_connect(struct smb_sb_info *server); +int smb_proc_disconnect(struct smb_sb_info *server); +int smb_proc_trunc(struct smb_sb_info *server, __u16 fid, __u32 length); +void smb_init_root_dirent(struct smb_sb_info *server, struct smb_fattr *); /* linux/fs/smbfs/sock.c */ -int smb_release(struct smb_server *server); -int smb_connect(struct smb_server *server); -int smb_request(struct smb_server *server); -int smb_request_read_raw(struct smb_server *server, +int smb_release(struct smb_sb_info *server); +int smb_connect(struct smb_sb_info *server); +int smb_request(struct smb_sb_info *server); +int smb_request_read_raw(struct smb_sb_info *server, unsigned char *target, int max_len); -int smb_request_write_raw(struct smb_server *server, +int smb_request_write_raw(struct smb_sb_info *server, unsigned const char *source, int length); -int smb_catch_keepalive(struct smb_server *server); -int smb_dont_catch_keepalive(struct smb_server *server); -int smb_trans2_request(struct smb_server *server, __u16 trans2_command, +int smb_catch_keepalive(struct smb_sb_info *server); +int smb_dont_catch_keepalive(struct smb_sb_info *server); +int smb_trans2_request(struct smb_sb_info *server, __u16 trans2_command, int ldata, unsigned char *data, int lparam, unsigned char *param, int *lrdata, unsigned char **rdata, diff --git a/include/linux/smb_fs_i.h b/include/linux/smb_fs_i.h index b6e38fd18..743e3954a 100644 --- a/include/linux/smb_fs_i.h +++ b/include/linux/smb_fs_i.h @@ -2,6 +2,7 @@ * smb_fs_i.h * * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke + * Copyright (C) 1997 by Volker Lendecke * */ @@ -9,25 +10,22 @@ #define _LINUX_SMB_FS_I #ifdef __KERNEL__ -#include <linux/smb.h> - -enum smb_inode_state { - SMB_INODE_VALID = 19, /* Inode currently in use */ - SMB_INODE_LOOKED_UP, /* directly before iget */ - SMB_INODE_CACHED, /* in a path to an inode which is in use */ - SMB_INODE_INVALID -}; +#include <linux/types.h> /* * smb fs inode data (in memory only) */ struct smb_inode_info { - enum smb_inode_state state; - int nused; /* for directories: - number of references in memory */ - struct smb_inode_info *dir; - struct smb_inode_info *next, *prev; - struct smb_dirent finfo; + + /* + * file handles are local to a connection. A file is open if + * (open == generation). + */ + unsigned int open; + __u16 fileid; /* What id to handle a file with? */ + __u16 attr; /* Attribute fields, DOS value */ + + __u16 access; /* Access bits. */ }; #endif diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h index 863062022..72b805e60 100644 --- a/include/linux/smb_fs_sb.h +++ b/include/linux/smb_fs_sb.h @@ -2,76 +2,41 @@ * smb_fs_sb.h * * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke + * Copyright (C) 1997 by Volker Lendecke * */ #ifndef _SMB_FS_SB #define _SMB_FS_SB +#ifdef __KERNEL__ + +#include <linux/types.h> #include <linux/smb.h> -#include <linux/smb_fs_i.h> #include <linux/smb_mount.h> -#include <linux/types.h> - -#ifdef __KERNEL__ -struct smb_server { - enum smb_protocol protocol; /* The protocol this - connection accepts. */ - enum smb_case_hndl case_handling; - struct file * sock_file; /* The socket we transfer - data on. */ - int lock; /* To prevent mismatch in - protocols. */ - struct wait_queue *wait; +struct smb_sb_info { + enum smb_conn_state state; + struct file * sock_file; - __u32 max_xmit; - char hostname[256]; - word pid; - word server_uid; - word mid; - word tid; + struct smb_mount_data m; - struct smb_mount_data m; /* We store the complete information here - * to be able to reconnect. - */ + /* Connections are counted. Each time a new socket arrives, + * generation is incremented. + */ + unsigned int generation; + pid_t conn_pid; + struct smb_conn_opt opt; - unsigned short rcls; /* The error codes we received */ - unsigned short err; + struct semaphore sem; __u32 packet_size; unsigned char * packet; - - enum smb_conn_state state; - unsigned long reconnect_time; /* The time of the last attempt */ - - /* The following are LANMAN 1.0 options transferred to us in - SMBnegprot */ - word secmode; - word maxmux; - word maxvcs; - word blkmode; - dword sesskey; + unsigned short rcls; /* The error codes we received */ + unsigned short err; /* We use our on data_ready callback, but need the original one */ void *data_ready; - - /* We do not have unique numbers for files in the smb protocol - like NFS-filehandles. (SMB was designed for DOS, not for - UNIX!) So we have to create our own inode numbers. We keep - a complete path of smb_inode_info's to each active - inode. The inode number is then created by the address of - this structure. */ - struct smb_inode_info root; -}; - -/* - * This is the part of the super-block (in memory) for the SMB file system. - */ - -struct smb_sb_info { - struct smb_server s_server; - struct smb_dskattr s_attr; }; #endif /* __KERNEL__ */ diff --git a/include/linux/smb_mount.h b/include/linux/smb_mount.h index 7f1748731..0a8a10ee2 100644 --- a/include/linux/smb_mount.h +++ b/include/linux/smb_mount.h @@ -2,6 +2,7 @@ * smb_mount.h * * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke + * Copyright (C) 1997 by Volker Lendecke * */ @@ -9,26 +10,12 @@ #define _LINUX_SMB_MOUNT_H #include <linux/types.h> -#include <linux/in.h> -#define SMB_MOUNT_VERSION 5 +#define SMB_MOUNT_VERSION 6 struct smb_mount_data { int version; - unsigned int fd; uid_t mounted_uid; /* Who may umount() this filesystem? */ - struct sockaddr_in addr; - - char server_name[17]; - char client_name[17]; - char service[64]; - char root_path[64]; - - char username[64]; - char password[64]; - char domain[64]; - - unsigned short max_xmit; uid_t uid; gid_t gid; diff --git a/include/linux/sockios.h b/include/linux/sockios.h index 5be29bc57..5147dd23c 100644 --- a/include/linux/sockios.h +++ b/include/linux/sockios.h @@ -54,6 +54,9 @@ #define SIOCADDMULTI 0x8931 /* Multicast address lists */ #define SIOCDELMULTI 0x8932 #define SIOGIFINDEX 0x8933 /* name -> if_index mapping */ +#define SIOGIFNAME 0x8934 /* if_index -> name mapping */ +#define SIOCGIFCOUNT 0x8935 /* get number of interfaces */ +#define SIOCDIFADDR 0x8936 /* delete PA address */ #define SIOCGIFBR 0x8940 /* Bridging support */ #define SIOCSIFBR 0x8941 /* Set bridging options */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 75fdf6c3d..1e18516d7 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -172,8 +172,9 @@ enum NET_IPV4_IGMP_TIMER_SCALE, NET_IPV4_IGMP_AGE_THRESHOLD, NET_TCP_SYNCOOKIES, - NET_TCP_ALWAYS_SYNCOOKIE, NET_TCP_STDURG, + NET_TCP_SYN_TAILDROP, + NET_TCP_MAX_SYN_BACKLOG, }; diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h index 77e4efb5d..e3a469fb5 100644 --- a/include/linux/trdevice.h +++ b/include/linux/trdevice.h @@ -33,7 +33,7 @@ extern int tr_header(struct sk_buff *skb, struct device *dev, void *saddr, unsigned len); extern int tr_rebuild_header(struct sk_buff *skb); extern unsigned short tr_type_trans(struct sk_buff *skb, struct device *dev); - +extern void tr_reformat(struct sk_buff *, unsigned int); extern struct device * init_trdev(struct device *, int); #endif diff --git a/include/linux/tty.h b/include/linux/tty.h index bc3ec7d27..0052d0510 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -77,8 +77,11 @@ extern struct screen_info screen_info; #define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */ #define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */ +#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */ -#define VIDEO_TYPE_SGI 0x61 /* Various SGI graphics hardware */ +#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */ + +#define VIDEO_TYPE_SGI 0x70 /* Various SGI graphics hardware */ /* * This character is the same as _POSIX_VDISABLE: it cannot be used as diff --git a/include/linux/udp.h b/include/linux/udp.h index 471301a2f..ab75a1e81 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h @@ -19,10 +19,10 @@ struct udphdr { - unsigned short source; - unsigned short dest; - unsigned short len; - unsigned short check; + __u16 source; + __u16 dest; + __u16 len; + __u16 check; }; diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 6a9c00c2a..5cee95332 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -52,6 +52,7 @@ extern int addrconf_notify(struct notifier_block *this, void * data); extern int addrconf_add_ifaddr(void *arg); +extern int addrconf_del_ifaddr(void *arg); extern int addrconf_set_dstaddr(void *arg); extern struct inet6_ifaddr * ipv6_chk_addr(struct in6_addr *addr); diff --git a/include/net/netlink.h b/include/net/netlink.h index b9e91a3d3..17aa55583 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -2,14 +2,7 @@ #define __NET_NETLINK_H #define NET_MAJOR 36 /* Major 18 is reserved for networking */ -/* so.... ^^ is this 36? */ -/* and the things below... */ -#define MAX_LINKS 16 /* 18,0 for route updates, 18,1 for SKIP, 18,2 debug tap 18,3 PPP reserved */ - /* 4-7 are psi0-psi3 8 is arpd 9 is ppp */ - /* 10 is for IPSEC <John Ioannidis> */ - /* 11 IPv6 route updates */ - /* 12 is for firewall trapout */ - +#define MAX_LINKS 32 #define MAX_QBYTES 32768 /* Maximum bytes in the queue */ #include <linux/netlink.h> @@ -23,7 +16,7 @@ extern int init_netlink(void); /* * skb should fit one page. This choice is good for headerless malloc. */ -#define NLMSG_GOODSIZE (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF)) +#define NLMSG_GOODSIZE (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF)-32) #define NLMSG_RECOVERY_TIMEO (HZ/2) /* If deleivery was failed, retry after */ @@ -62,13 +55,11 @@ extern __inline__ void nlmsg_ack(struct nlmsg_ctl* ctl, unsigned long seq, #define NETLINK_SKIP 1 /* Reserved for ENskip */ #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ #define NETLINK_FIREWALL 3 /* Firewalling hook */ -#define NETLINK_PSI 4 /* PSI devices - 4 to 7 */ -#define NETLINK_ARPD 8 -#define NETLINK_IPSEC 10 /* IPSEC */ -#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ -#define NETLINK_IP6_FW 13 -/* Wouldn't this suffice instead of the confusion at the top of - this file? i.e. 3 is firewall or ppp... */ -/* #define MAX_LINKS 16 */ - +#define NETLINK_FREE 4 /* PSI devices - 4 to 7 (obsolete) */ +#define NETLINK_ARPD 8 /* ARP daemon for big switched networks */ +#define NETLINK_IPSEC 10 /* IPSEC (JI) */ +#define NETLINK_ROUTE6 11 /* Af_inet6 route communication channel */ +#define NETLINK_IP6_FW 13 /* IPv6 firewall trap outs */ +#define NETLINK_DNRT 14 /* DECnet routing messages */ +#define NETLINK_TAPBASE 16 /* 16->31 are the ethertap devices */ #endif diff --git a/include/net/snmp.h b/include/net/snmp.h index a9dd844d1..f8da9a0d4 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h @@ -122,6 +122,5 @@ struct udp_mib unsigned long UdpInErrors; unsigned long UdpOutDatagrams; }; - #endif diff --git a/include/net/sock.h b/include/net/sock.h index a6035bd57..1e40d3a2d 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -23,6 +23,7 @@ * Pauline Middelink : identd support * Alan Cox : Eliminate low level recv/recvfrom * David S. Miller : New socket lookup architecture. + * Steve Whitehouse: Default routines for sock_ops * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -88,7 +89,7 @@ struct unix_opt char * name; int locks; struct unix_address *addr; - struct inode * inode; + struct dentry * dentry; struct semaphore readsem; struct sock * other; struct sock ** list; @@ -281,6 +282,8 @@ struct tcp_opt struct open_request *syn_wait_queue; struct open_request **syn_wait_last; + int syn_backlog; + struct tcp_func *af_specific; }; @@ -430,8 +433,8 @@ struct sock 'timed out' */ unsigned char protocol; volatile unsigned char state; - unsigned char ack_backlog; - unsigned char max_ack_backlog; + unsigned short ack_backlog; + unsigned short max_ack_backlog; unsigned char priority; unsigned char debug; int rcvbuf; @@ -734,7 +737,7 @@ static __inline__ int max(unsigned int a, unsigned int b) return a; } -extern struct sock * sk_alloc(int priority); +extern struct sock * sk_alloc(int family, int priority); extern void sk_free(struct sock *sk); extern void destroy_sock(struct sock *sk); @@ -762,12 +765,42 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *sk, int noblock, int *errcode); -extern int sock_no_fcntl(struct socket *, unsigned int, unsigned long); +/* + * Functions to fill in entries in struct proto_ops when a protocol + * does not implement a particular function. + */ +extern int sock_no_dup(struct socket *, struct socket *); +extern int sock_no_release(struct socket *, + struct socket *); +extern int sock_no_bind(struct socket *, + struct sockaddr *, int); +extern int sock_no_connect(struct socket *, + struct sockaddr *, int, int); +extern int sock_no_socketpair(struct socket *, + struct socket *); +extern int sock_no_accept(struct socket *, + struct socket *, int); +extern int sock_no_getname(struct socket *, + struct sockaddr *, int *, int); +extern unsigned int sock_no_poll(struct socket *, + poll_table *); +extern int sock_no_ioctl(struct socket *, unsigned int, + unsigned long); +extern int sock_no_listen(struct socket *, int); +extern int sock_no_shutdown(struct socket *, int); extern int sock_no_getsockopt(struct socket *, int , int, char *, int *); extern int sock_no_setsockopt(struct socket *, int, int, char *, int); -extern int sock_no_listen(struct socket *, int); +extern int sock_no_fcntl(struct socket *, + unsigned int, unsigned long); +extern int sock_no_sendmsg(struct socket *, + struct msghdr *, int, + struct scm_cookie *); +extern int sock_no_recvmsg(struct socket *, + struct msghdr *, int, + struct scm_cookie *); + /* * Default socket callbacks and setup code */ @@ -775,6 +808,7 @@ extern int sock_no_listen(struct socket *, int); extern void sock_def_callback1(struct sock *); extern void sock_def_callback2(struct sock *, int); extern void sock_def_callback3(struct sock *); +extern void sock_def_destruct(struct sock *); /* Initialise core socket variables */ extern void sock_init_data(struct socket *sock, struct sock *sk); diff --git a/include/net/tcp.h b/include/net/tcp.h index d0f812e4d..57840f7e9 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -60,6 +60,22 @@ static __inline__ int tcp_bhashfn(__u16 lport) return (lport ^ (lport >> 7)) & (TCP_BHTABLE_SIZE - 1); } +/* Find the next port that hashes h that is larger than lport. + * If you change the hash, change this function to match, or you will + * break TCP port selection. This function must also NOT wrap around + * when the next number exceeds the largest possible port (2^16-1). + */ +static __inline__ int tcp_bhashnext(__u16 short lport, __u16 h) +{ + __u32 s; /* don't change this to a smaller type! */ + + s = (lport ^ (h ^ tcp_bhashfn(lport))); + if (s > lport) + return s; + s = lport + TCP_BHTABLE_SIZE; + return (s ^ (h ^ tcp_bhashfn(s))); +} + static __inline__ int tcp_sk_bhashfn(struct sock *sk) { __u16 lport = sk->num; @@ -227,23 +243,25 @@ struct tcp_v6_open_req { }; #endif +/* this structure is too big */ struct open_request { - struct open_request *dl_next; - struct open_request **dl_pprev; + struct open_request *dl_next; /* Must be first member! */ __u32 rcv_isn; __u32 snt_isn; __u16 rmt_port; __u16 mss; - __u8 snd_wscale; - __u8 rcv_wscale; - char sack_ok; - char tstamp_ok; - char wscale_ok; + __u8 retrans; + __u8 __pad; + unsigned snd_wscale : 4, + rcv_wscale : 4, + sack_ok : 1, + tstamp_ok : 1, + wscale_ok : 1; + /* The following two fields can be easily recomputed I think -AK */ __u32 window_clamp; /* window clamp at creation time */ __u32 rcv_wnd; /* rcv_wnd offered first time */ __u32 ts_recent; unsigned long expires; - int retrans; struct or_calltable *class; struct sock *sk; union { @@ -314,6 +332,13 @@ struct tcp_func { void (*send_reset) (struct sk_buff *skb); + struct open_request * (*search_open_req) (struct tcp_opt *, void *, + struct tcphdr *, + struct open_request **); + + struct sock * (*cookie_check) (struct sock *, struct sk_buff *, + void *); + int sockaddr_len; }; @@ -431,6 +456,7 @@ extern void tcp_read_wakeup(struct sock *); extern void tcp_write_xmit(struct sock *); extern void tcp_time_wait(struct sock *); extern void tcp_do_retransmit(struct sock *, int); +extern void tcp_simple_retransmit(struct sock *); /* tcp_output.c */ @@ -458,6 +484,9 @@ extern void tcp_retransmit_timer(unsigned long); extern void tcp_delack_timer(unsigned long); extern void tcp_probe_timer(unsigned long); +extern struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, + void *); + /* * TCP slow timer @@ -566,7 +595,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state) default: if (oldstate==TCP_ESTABLISHED) tcp_statistics.TcpCurrEstab--; - if (state == TCP_TIME_WAIT) + if (state == TCP_TIME_WAIT || state == TCP_CLOSE) sk->prot->rehash(sk); } } @@ -654,23 +683,61 @@ extern __inline__ void tcp_select_initial_window(__u32 space, __u16 mss, (*window_clamp) = min(65535<<(*rcv_wscale),*window_clamp); } -extern __inline__ void tcp_synq_unlink(struct tcp_opt *tp, struct open_request *req) +#define SYNQ_DEBUG 1 + +extern __inline__ void tcp_synq_unlink(struct tcp_opt *tp, struct open_request *req, struct open_request *prev) { - if(req->dl_next) - req->dl_next->dl_pprev = req->dl_pprev; - else - tp->syn_wait_last = req->dl_pprev; - *req->dl_pprev = req->dl_next; +#ifdef SYNQ_DEBUG + if (prev->dl_next != req) { + printk(KERN_DEBUG "synq_unlink: bad prev ptr: %p\n",prev); + return; + } +#endif + if(!req->dl_next) { +#ifdef SYNQ_DEBUG + if (tp->syn_wait_last != (void*) req) + printk(KERN_DEBUG "synq_unlink: bad last ptr %p,%p\n", + req,tp->syn_wait_last); +#endif + tp->syn_wait_last = (struct open_request **)prev; + } + prev->dl_next = req->dl_next; } extern __inline__ void tcp_synq_queue(struct tcp_opt *tp, struct open_request *req) -{ +{ +#ifdef SYNQ_DEBUG + if (*tp->syn_wait_last != NULL) + printk("synq_queue: last ptr doesn't point to last req.\n"); +#endif req->dl_next = NULL; - req->dl_pprev = tp->syn_wait_last; - *tp->syn_wait_last = req; + *tp->syn_wait_last = req; tp->syn_wait_last = &req->dl_next; } +extern __inline__ void tcp_synq_init(struct tcp_opt *tp) +{ + tp->syn_wait_queue = NULL; + tp->syn_wait_last = &tp->syn_wait_queue; +} + +extern __inline__ struct open_request *tcp_synq_unlink_tail(struct tcp_opt *tp) +{ + struct open_request *head = tp->syn_wait_queue; +#ifdef SYNQ_DEBUG + if (!head) { + printk(KERN_DEBUG "tail drop on empty queue? - bug\n"); + return NULL; + } +#endif + printk(KERN_DEBUG "synq tail drop with expire=%ld\n", + head->expires-jiffies); + if (head->dl_next == NULL) + tp->syn_wait_last = &tp->syn_wait_queue; + tp->syn_wait_queue = head->dl_next; + return head; +} + extern void __tcp_inc_slow_timer(struct tcp_sl_timer *slt); extern __inline__ void tcp_inc_slow_timer(int timer) { |