diff options
Diffstat (limited to 'include')
120 files changed, 3526 insertions, 1340 deletions
diff --git a/include/asm-alpha/namei.h b/include/asm-alpha/namei.h index 644ec0990..5cc9bb394 100644 --- a/include/asm-alpha/namei.h +++ b/include/asm-alpha/namei.h @@ -12,7 +12,6 @@ * Look at asm-sparc/namei.h for details. */ -#define __prefix_lookup_dentry(name, lookup_flags) \ - do {} while (0) +#define __emul_prefix() NULL #endif /* __ALPHA_NAMEI_H */ diff --git a/include/asm-arm/arch-arc/system.h b/include/asm-arm/arch-arc/system.h index 7f204b1f5..31db5f390 100644 --- a/include/asm-arm/arch-arc/system.h +++ b/include/asm-arm/arch-arc/system.h @@ -20,7 +20,11 @@ #endif -#define arch_do_idle() do { } while (0) +extern __inline__ void arch_idle(void) +{ + while (!current->need_resched && !hlt_counter); +} + #define arch_power_off() do { } while (0) extern __inline__ void arch_reset(char mode) diff --git a/include/asm-arm/arch-cl7500/system.h b/include/asm-arm/arch-cl7500/system.h index a8a0ee518..a44cc9373 100644 --- a/include/asm-arm/arch-cl7500/system.h +++ b/include/asm-arm/arch-cl7500/system.h @@ -8,8 +8,11 @@ #include <asm/iomd.h> -#define arch_do_idle() \ - outb(0, IOMD_SUSMODE) +extern __inline__ void arch_idle(void) +{ + while (!current->need_resched && !hlt_counter) + outb(0, IOMD_SUSMODE); +} #define arch_reset(mode) \ do { \ diff --git a/include/asm-arm/arch-cl7500/vmalloc.h b/include/asm-arm/arch-cl7500/vmalloc.h new file mode 100644 index 000000000..98f3604dd --- /dev/null +++ b/include/asm-arm/arch-cl7500/vmalloc.h @@ -0,0 +1,16 @@ +/* + * linux/include/asm-arm/arch-cl7500/vmalloc.h + */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/include/asm-arm/arch-ebsa110/hardware.h b/include/asm-arm/arch-ebsa110/hardware.h index 0de487421..c8ebe67c3 100644 --- a/include/asm-arm/arch-ebsa110/hardware.h +++ b/include/asm-arm/arch-ebsa110/hardware.h @@ -27,6 +27,7 @@ * RAM definitions */ #define FLUSH_BASE_PHYS 0x40000000 +#define UNCACHEABLE_ADDR 0xf3000000 #else /* __ASSEMBLY__ */ diff --git a/include/asm-arm/arch-ebsa110/system.h b/include/asm-arm/arch-ebsa110/system.h index 2ec712d06..767623096 100644 --- a/include/asm-arm/arch-ebsa110/system.h +++ b/include/asm-arm/arch-ebsa110/system.h @@ -6,7 +6,31 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H -#define arch_do_idle() cpu_do_idle() +/* + * This machine must never stop it MCLK. However, if we are + * idle for a long time, slow the processor clock to MCLK. + */ +extern __inline__ void arch_idle(void) +{ + unsigned long start_idle; + + start_idle = jiffies; + + do { + if (current->need_resched || hlt_counter) + goto slow_out; + } while (time_before(start_idle, jiffies + HZ/3)); + + cpu_do_idle(IDLE_CLOCK_SLOW); + + while (!current->need_resched && !hlt_counter) { + /* do nothing slowly */ + } + + cpu_do_idle(IDLE_CLOCK_FAST); +slow_out: +} + #define arch_power_off() do { } while (0) #define arch_reset(mode) cpu_reset(0x80000000) diff --git a/include/asm-arm/arch-ebsa110/vmalloc.h b/include/asm-arm/arch-ebsa110/vmalloc.h new file mode 100644 index 000000000..d9d09f03c --- /dev/null +++ b/include/asm-arm/arch-ebsa110/vmalloc.h @@ -0,0 +1,16 @@ +/* + * linux/include/asm-arm/arch-ebsa110/vmalloc.h + */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h index 9aeaf6712..b3c1f2931 100644 --- a/include/asm-arm/arch-ebsa285/hardware.h +++ b/include/asm-arm/arch-ebsa285/hardware.h @@ -58,7 +58,7 @@ #define FLASH_BASE 0xf8000000 #define PCIMEM_SIZE 0x01000000 -#define PCIMEM_BASE 0xe0000000 +#define PCIMEM_BASE 0xf0000000 #elif defined(CONFIG_ARCH_CO285) @@ -105,6 +105,7 @@ #define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET) #define FLUSH_BASE_PHYS 0x50000000 +#define UNCACHEABLE_ADDR (ARMCSR_BASE + 0x108) /* PIC irq control */ diff --git a/include/asm-arm/arch-ebsa285/system.h b/include/asm-arm/arch-ebsa285/system.h index 46e60a084..0e37477b2 100644 --- a/include/asm-arm/arch-ebsa285/system.h +++ b/include/asm-arm/arch-ebsa285/system.h @@ -8,7 +8,28 @@ #include <asm/hardware.h> #include <asm/leds.h> -#define arch_do_idle() cpu_do_idle() +extern __inline__ void arch_idle(void) +{ + unsigned long start_idle; + + start_idle = jiffies; + + do { + if (current->need_resched || hlt_counter) + goto slow_out; + cpu_do_idle(IDLE_WAIT_FAST); + } while (time_before(start_idle, jiffies + HZ/3)); + + cpu_do_idle(IDLE_CLOCK_SLOW); + + while (!current->need_resched && !hlt_counter) { + cpu_do_idle(IDLE_WAIT_SLOW); + } + + cpu_do_idle(IDLE_CLOCK_FAST); +slow_out: +} + #define arch_power_off() do { } while (0) extern __inline__ void arch_reset(char mode) diff --git a/include/asm-arm/arch-ebsa285/vmalloc.h b/include/asm-arm/arch-ebsa285/vmalloc.h new file mode 100644 index 000000000..63dbeb9af --- /dev/null +++ b/include/asm-arm/arch-ebsa285/vmalloc.h @@ -0,0 +1,16 @@ +/* + * linux/include/asm-arm/arch-ebsa285/vmalloc.h + */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END (PAGE_OFFSET + 0x20000000) diff --git a/include/asm-arm/arch-nexuspci/system.h b/include/asm-arm/arch-nexuspci/system.h index 3ef541df3..0726698e7 100644 --- a/include/asm-arm/arch-nexuspci/system.h +++ b/include/asm-arm/arch-nexuspci/system.h @@ -6,7 +6,12 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H -#define arch_do_idle() cpu_do_idle() +extern __inline__ void arch_idle(void) +{ + while (!current->need_resched && !hlt_counter) + cpu_do_idle(IDLE_WAIT_SLOW); +} + #define arch_reset(mode) do { } while (0) #define arch_power_off() do { } while (0) diff --git a/include/asm-arm/arch-nexuspci/vmalloc.h b/include/asm-arm/arch-nexuspci/vmalloc.h new file mode 100644 index 000000000..5c8d17dd7 --- /dev/null +++ b/include/asm-arm/arch-nexuspci/vmalloc.h @@ -0,0 +1,16 @@ +/* + * linux/include/asm-arm/arch-nexuspci/vmalloc.h + */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END (PAGE_OFFSET + 0x20000000) diff --git a/include/asm-arm/arch-rpc/hardware.h b/include/asm-arm/arch-rpc/hardware.h index 0ae320b86..80cca92e7 100644 --- a/include/asm-arm/arch-rpc/hardware.h +++ b/include/asm-arm/arch-rpc/hardware.h @@ -39,6 +39,7 @@ #define SCREEN1_BASE 0xd0000000 #define FLUSH_BASE 0xdf000000 +#define UNCACHEABLE_ADDR 0xdf010000 #ifndef __ASSEMBLY__ diff --git a/include/asm-arm/arch-rpc/system.h b/include/asm-arm/arch-rpc/system.h index 1282c9505..135f3892d 100644 --- a/include/asm-arm/arch-rpc/system.h +++ b/include/asm-arm/arch-rpc/system.h @@ -7,7 +7,28 @@ #include <asm/iomd.h> #include <asm/io.h> -#define arch_do_idle() cpu_do_idle() +extern __inline__ void arch_idle(void) +{ + unsigned long start_idle; + + start_idle = jiffies; + + do { + if (current->need_resched || hlt_counter) + goto slow_out; + cpu_do_idle(IDLE_WAIT_FAST); + } while (time_before(start_idle, jiffies + HZ/3)); + + cpu_do_idle(IDLE_CLOCK_SLOW); + + while (!current->need_resched && !hlt_counter) { + cpu_do_idle(IDLE_WAIT_SLOW); + } + + cpu_do_idle(IDLE_CLOCK_FAST); +slow_out: +} + #define arch_power_off() do { } while (0) extern __inline__ void arch_reset(char mode) diff --git a/include/asm-arm/arch-rpc/vmalloc.h b/include/asm-arm/arch-rpc/vmalloc.h new file mode 100644 index 000000000..828869fc7 --- /dev/null +++ b/include/asm-arm/arch-rpc/vmalloc.h @@ -0,0 +1,16 @@ +/* + * linux/include/asm-arm/arch-rpc/vmalloc.h + */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/include/asm-arm/arch-sa1100/hardware.h b/include/asm-arm/arch-sa1100/hardware.h index 86358d96b..e93cbe7d9 100644 --- a/include/asm-arm/arch-sa1100/hardware.h +++ b/include/asm-arm/arch-sa1100/hardware.h @@ -13,6 +13,7 @@ #define FLUSH_BASE_PHYS 0xe0000000 /* SA1100 zero bank */ #define FLUSH_BASE 0xdf000000 #define FLUSH_BASE_MINICACHE 0xdf800000 +#define UNCACHEABLE_ADDR 0xfa050000 /* * PCMCIA IO is mapped to 0xe0000000. We are likely to use in*()/out*() diff --git a/include/asm-arm/arch-sa1100/keyboard.h b/include/asm-arm/arch-sa1100/keyboard.h index c03526bf5..da214d3ed 100644 --- a/include/asm-arm/arch-sa1100/keyboard.h +++ b/include/asm-arm/arch-sa1100/keyboard.h @@ -1,27 +1,51 @@ /* - * linux/include/asm-arm/arch-sa1100/keyboard.h - * - * Keyboard driver definitions for SA1100 architecture - * - * This really has to be cleaned up somehow... - * + * linux/include/asm-arm/arch-sa1100/keyboard.h + * Created 16 Dec 1999 by Nicolas Pitre <nico@cam.org> + * This file contains the SA1100 architecture specific keyboard definitions */ -#define KEYBOARD_IRQ +#ifndef _SA1100_KEYBOARD_H +#define _SA1100_KEYBOARD_H -#define NR_SCANCODES 128 +#include <linux/config.h> -#define kbd_setkeycode(sc,kc) (-EINVAL) -#define kbd_getkeycode(sc) (-EINVAL) -#define kbd_pretranslate(sc,kc) 1 -#define kbd_translate(sc, kcp, raw) kbd_drv_translate(sc, kcp, raw) -#define kbd_init_hw() kbd_drv_init() -#define kbd_unexpected_up -#define kbd_leds(leds) +#ifdef CONFIG_SA1100_BRUTUS -#define kbd_sysrq_xlate -#define kbd_disable_irq() -#define kbd_enable_irq() +extern int Brutus_kbd_translate(unsigned char scancode, unsigned char *keycode, + char raw_mode); +extern void Brutus_kbd_leds(unsigned char leds); +extern void Brutus_kbd_init_hw(void); +extern void Brutus_kbd_enable_irq(void); +extern void Brutus_kbd_disable_irq(void); +extern unsigned char Brutus_kbd_sysrq_xlate[128]; + +#define kbd_setkeycode(x...) (-ENOSYS) +#define kbd_getkeycode(x...) (-ENOSYS) +#define kbd_translate Brutus_kbd_translate +#define kbd_unexpected_up(x...) (1) +#define kbd_leds Brutus_kbd_leds +#define kbd_init_hw Brutus_kbd_init_hw +#define kbd_enable_irq Brutus_kbd_enable_irq +#define kbd_disable_irq Brutus_kbd_disable_irq +#define kbd_sysrq_xlate Brutus_kbd_sysrq_xlate + +#define SYSRQ_KEY 0x54 + +#else + +/* dummy i.e. no real keyboard */ +#define kbd_setkeycode(x...) (-ENOSYS) +#define kbd_getkeycode(x...) (-ENOSYS) +#define kbd_translate(x...) (0) +#define kbd_unexpected_up(x...) (1) +#define kbd_leds(x...) (0) +#define kbd_init_hw(x...) (0) +#define kbd_enable_irq(x...) (0) +#define kbd_disable_irq(x...) (0) + +#endif + + +#endif /* _SA1100_KEYBOARD_H */ -#define SYSRQ_KEY 0x54 diff --git a/include/asm-arm/arch-sa1100/system.h b/include/asm-arm/arch-sa1100/system.h index 4e883ee6a..3b56a4220 100644 --- a/include/asm-arm/arch-sa1100/system.h +++ b/include/asm-arm/arch-sa1100/system.h @@ -5,43 +5,43 @@ */ #include <linux/config.h> -#ifdef CONFIG_SA1100_VICTOR - -#define arch_reset( x ) { \ - /* switch off power supply */ \ - mdelay(2000); \ - GPCR = GPIO_GPIO23; \ - while(1); \ +extern __inline__ void arch_idle(void) +{ + while (!current->need_resched && !hlt_counter) { + cpu_do_idle(IDLE_CLOCK_SLOW); + cpu_do_idle(IDLE_WAIT_FAST); + cpu_do_idle(IDLE_CLOCK_FAST); } +} -#else - -#define arch_reset(x) cpu_reset(0) +#ifdef CONFIG_SA1100_VICTOR -#endif +extern inline void arch_power_off(void) +{ + /* switch off power supply */ + mdelay(2000); + GPCR = GPIO_GPIO23; + while(1); +} +/* power off unconditionally */ +#define arch_reset(x) arch_power_off() -#if 0 -#define arch_do_idle() cpu_do_idle() #else -/* Enter SA1100 idle mode (see data sheet sec 9.5). - * It seems that the wait-on-interrupt just hang the CPU forever if it's - * on the end of a cache line. Workaround: we force an explicit alignment - * before it. - */ -#define arch_do_idle() \ - do { \ - __asm__ __volatile__( \ -" mcr p15, 0, %0, c15, c2, 2 @ Disable clock switching \n" \ -" ldr %0, [%0] @ Must perform a non-cached access \n" \ -" b 1f @ Seems we must align the next \n" \ -" .align 5 @ instruction on a cache line \n" \ -"1: mcr p15, 0, %0, c15, c8, 2 @ Wait for interrupts \n" \ -" mov r0, r0 @ insert NOP to ensure SA1100 re-awakes\n" \ -" mcr p15, 0, %0, c15, c1, 2 @ Reenable clock switching \n" \ - : : "r" (&ICIP) : "cc" ); \ - } while (0) -#endif + +extern inline void arch_reset(char mode) +{ + if (mode == 's') { + /* Jump into ROM at address 0 */ + cpu_reset(0); + } else { + /* Activate SA1100 watchdog and wait for the trigger... */ + OSMR3 = OSCR + 3686400/2; /* in 1/2 sec */ + OWER |= OWER_WME; + OIER |= OIER_E3; + } +} #define arch_power_off() do { } while (0) +#endif diff --git a/include/asm-arm/arch-sa1100/vmalloc.h b/include/asm-arm/arch-sa1100/vmalloc.h new file mode 100644 index 000000000..42affe414 --- /dev/null +++ b/include/asm-arm/arch-sa1100/vmalloc.h @@ -0,0 +1,16 @@ +/* + * linux/include/asm-arm/arch-sa1100/vmalloc.h + */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/include/asm-arm/arch-shark/dma.h b/include/asm-arm/arch-shark/dma.h new file mode 100644 index 000000000..bf62c8ff8 --- /dev/null +++ b/include/asm-arm/arch-shark/dma.h @@ -0,0 +1,18 @@ +/* + * linux/include/asm-arm/arch-shark/dma.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + */ +#ifndef __ASM_ARCH_DMA_H +#define __ASM_ARCH_DMA_H + +/* Use only the lowest 4MB, nothing else works. + * The rest is not DMAable. See dev / .properties + * in OpenFirmware. + */ +#define MAX_DMA_ADDRESS 0xC0400000 +#define MAX_DMA_CHANNELS 8 +#define DMA_ISA_CASCADE 4 + +#endif /* _ASM_ARCH_DMA_H */ + diff --git a/include/asm-arm/arch-shark/hardware.h b/include/asm-arm/arch-shark/hardware.h new file mode 100644 index 000000000..1fb25abd1 --- /dev/null +++ b/include/asm-arm/arch-shark/hardware.h @@ -0,0 +1,49 @@ +/* + * linux/include/asm-arm/arch-shark/hardware.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + * + * derived from: + * linux/include/asm-arm/arch-ebsa110/hardware.h + * Copyright (C) 1996-1999 Russell King. + */ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +#ifndef __ASSEMBLER__ + +/* + * Mapping areas + */ +#define IO_BASE 0xe0000000 + +/* + * RAM definitions + */ +#define FLUSH_BASE_PHYS 0x60000000 + +#else + +#define IO_BASE 0 + +#endif + +#define IO_SIZE 0x10000000 +#define IO_START 0x40000000 + +#define FLUSH_BASE 0xdf000000 +#define PCIO_BASE 0xe0000000 + + +/* defines for the Framebuffer */ +#define FB_BASE 0xd0000000 +#define FB_START 0x06000000 +#define FB_SIZE 0x00200000 + +/* Registers for Framebuffer */ +#define FBREG_BASE (FB_BASE + FB_SIZE) +#define FBREG_START 0x06800000 +#define FBREG_SIZE 0x000c0000 + +#endif + diff --git a/include/asm-arm/arch-shark/ide.h b/include/asm-arm/arch-shark/ide.h new file mode 100644 index 000000000..a9e373e98 --- /dev/null +++ b/include/asm-arm/arch-shark/ide.h @@ -0,0 +1,45 @@ +/* + * linux/include/asm-arm/arch-shark/ide.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + * + * derived from: + * linux/include/asm-arm/arch-ebsa285/ide.h + * Copyright (c) 1998 Russell King + */ + +#include <asm/irq.h> + +/* + * Set up a hw structure for a specified data port, control port and IRQ. + * This should follow whatever the default interface uses. + */ +static __inline__ void +ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int irq) +{ + ide_ioreg_t reg = (ide_ioreg_t) data_port; + int i; + + memset(hw, 0, sizeof(*hw)); + + for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { + hw->io_ports[i] = reg; + reg += 1; + } + hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port; + hw->irq = irq; +} + +/* + * This registers the standard ports for this architecture with the IDE + * driver. + */ +static __inline__ void +ide_init_default_hwifs(void) +{ + hw_regs_t hw; + + ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, 14); + ide_register_hw(&hw, NULL); +} + diff --git a/include/asm-arm/arch-shark/io.h b/include/asm-arm/arch-shark/io.h new file mode 100644 index 000000000..ff0def03a --- /dev/null +++ b/include/asm-arm/arch-shark/io.h @@ -0,0 +1,207 @@ +/* + * linux/include/asm-arm/arch-shark/io.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + * + * derived from: + * linux/include/asm-arm/arch-ebsa110/io.h + * Copyright (C) 1997,1998 Russell King + */ + +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffffffff + +/* + * We use two different types of addressing - PC style addresses, and ARM + * addresses. PC style accesses the PC hardware with the normal PC IO + * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+ + * and are translated to the start of IO. + */ +#define __PORT_PCIO(x) (!((x) & 0x80000000)) + +/* + * Dynamic IO functions - let the compiler + * optimize the expressions + */ +#define DECLARE_DYN_OUT(fnsuffix,instr) \ +extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port) \ +{ \ + unsigned long temp; \ + __asm__ __volatile__( \ + "tst %2, #0x80000000\n\t" \ + "mov %0, %4\n\t" \ + "addeq %0, %0, %3\n\t" \ + "str" ##instr## " %1, [%0, %2] @ out"###fnsuffix \ + : "=&r" (temp) \ + : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \ + : "cc"); \ +} + +#define DECLARE_DYN_IN(sz,fnsuffix,instr) \ +extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ +{ \ + unsigned long temp, value; \ + __asm__ __volatile__( \ + "tst %2, #0x80000000\n\t" \ + "mov %0, %4\n\t" \ + "addeq %0, %0, %3\n\t" \ + "ldr" ##instr## " %1, [%0, %2] @ in"###fnsuffix \ + : "=&r" (temp), "=r" (value) \ + : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \ + : "cc"); \ + return (unsigned sz)value; \ +} + +extern __inline__ unsigned int __ioaddr (unsigned int port) \ +{ \ + if (__PORT_PCIO(port)) \ + return (unsigned int)(PCIO_BASE + (port)); \ + else \ + return (unsigned int)(IO_BASE + (port)); \ +} + +#define DECLARE_IO(sz,fnsuffix,instr) \ + DECLARE_DYN_OUT(fnsuffix,instr) \ + DECLARE_DYN_IN(sz,fnsuffix,instr) + +DECLARE_IO(char,b,"b") +DECLARE_IO(short,w,"h") +DECLARE_IO(long,l,"") + +#undef DECLARE_IO +#undef DECLARE_DYN_OUT +#undef DECLARE_DYN_IN + +/* + * Constant address IO functions + * + * These have to be macros for the 'J' constraint to work - + * +/-4096 immediate operand. + */ +#define __outbc(value,port) \ +({ \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "strb %0, [%1, %2] @ outbc" \ + : : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ + else \ + __asm__ __volatile__( \ + "strb %0, [%1, %2] @ outbc" \ + : : "r" (value), "r" (IO_BASE), "r" (port)); \ +}) + +#define __inbc(port) \ +({ \ + unsigned char result; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldrb %0, [%1, %2] @ inbc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" (port)); \ + else \ + __asm__ __volatile__( \ + "ldrb %0, [%1, %2] @ inbc" \ + : "=r" (result) : "r" (IO_BASE), "r" (port)); \ + result; \ +}) + +#define __outwc(value,port) \ +({ \ + unsigned long v = value; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "strh %0, [%1, %2] @ outwc" \ + : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" (port)); \ + else \ + __asm__ __volatile__( \ + "strh %0, [%1, %2] @ outwc" \ + : : "r" (v|v<<16), "r" (IO_BASE), "r" (port)); \ +}) + +#define __inwc(port) \ +({ \ + unsigned short result; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldrh %0, [%1, %2] @ inwc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" (port)); \ + else \ + __asm__ __volatile__( \ + "ldrh %0, [%1, %2] @ inwc" \ + : "=r" (result) : "r" (IO_BASE), "r" (port)); \ + result & 0xffff; \ +}) + +#define __outlc(value,port) \ +({ \ + unsigned long v = value; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outlc" \ + : : "r" (v), "r" (PCIO_BASE), "Jr" (port)); \ + else \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outlc" \ + : : "r" (v), "r" (IO_BASE), "r" (port)); \ +}) + +#define __inlc(port) \ +({ \ + unsigned long result; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inlc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" (port)); \ + else \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inlc" \ + : "=r" (result) : "r" (IO_BASE), "r" (port)); \ + result; \ +}) + +#define __ioaddrc(port) \ +({ \ + unsigned long addr; \ + if (__PORT_PCIO((port))) \ + addr = PCIO_BASE + (port); \ + else \ + addr = IO_BASE + (port); \ + addr; \ +}) + +#define __mem_pci(addr) addr + +#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p)) +#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p)) +#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p)) +#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p)) +#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) +#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) + +#define __arch_getb(addr) (*(volatile unsigned char *)(addr)) +#define __arch_getw(addr) (*(volatile unsigned short *)(addr)) +#define __arch_getl(addr) (*(volatile unsigned long *)(addr)) + +#define __arch_putb(b,addr) (*(volatile unsigned char *)(addr) = (b)) +#define __arch_putw(b,addr) (*(volatile unsigned short *)(addr) = (b)) +#define __arch_putl(b,addr) (*(volatile unsigned long *)(addr) = (b)) + +/* + * Translated address IO functions + * + * IO address has already been translated to a virtual address + */ +#define outb_t(v,p) \ + (*(volatile unsigned char *)(p) = (v)) + +#define inb_t(p) \ + (*(volatile unsigned char *)(p)) + +#define outl_t(v,p) \ + (*(volatile unsigned long *)(p) = (v)) + +#define inl_t(p) \ + (*(volatile unsigned long *)(p)) + +#endif diff --git a/include/asm-arm/arch-shark/irq.h b/include/asm-arm/arch-shark/irq.h new file mode 100644 index 000000000..7dae77e02 --- /dev/null +++ b/include/asm-arm/arch-shark/irq.h @@ -0,0 +1,123 @@ +/* + * linux/include/asm-arm/arch-shark/irq.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + * + * derived from linux/arch/ppc/kernel/i8259.c and: + * include/asm-arm/arch-ebsa110/irq.h + * Copyright (C) 1996-1998 Russell King + */ + +#define fixup_irq(x) (x) + +/* + * 8259A PIC functions to handle ISA devices: + */ + +/* + * This contains the irq mask for both 8259A irq controllers, + * Let through the cascade-interrupt no. 2 (ff-(1<<2)==fb) + */ +static unsigned char cached_irq_mask[2] = { 0xfb, 0xff }; + +/* + * These have to be protected by the irq controller spinlock + * before being called. + */ +static void shark_disable_8259A_irq(unsigned int irq) +{ + unsigned int mask; + if (irq<8) { + mask = 1 << irq; + cached_irq_mask[0] |= mask; + } else { + mask = 1 << (irq-8); + cached_irq_mask[1] |= mask; + } + outb(cached_irq_mask[1],0xA1); + outb(cached_irq_mask[0],0x21); +} + +static void shark_enable_8259A_irq(unsigned int irq) +{ + unsigned int mask; + if (irq<8) { + mask = ~(1 << irq); + cached_irq_mask[0] &= mask; + } else { + mask = ~(1 << (irq-8)); + cached_irq_mask[1] &= mask; + } + outb(cached_irq_mask[1],0xA1); + outb(cached_irq_mask[0],0x21); +} + +/* + * Careful! The 8259A is a fragile beast, it pretty + * much _has_ to be done exactly like this (mask it + * first, _then_ send the EOI, and the order of EOI + * to the two 8259s is important! + */ +static void shark_mask_and_ack_8259A_irq(unsigned int irq) +{ + if (irq & 8) { + cached_irq_mask[1] |= 1 << (irq-8); + inb(0xA1); /* DUMMY */ + outb(cached_irq_mask[1],0xA1); + } else { + cached_irq_mask[0] |= 1 << irq; + outb(cached_irq_mask[0],0x21); + } +} + +static void bogus_int(int irq, void *dev_id, struct pt_regs *regs) +{ + printk("Got interrupt %i!\n",irq); +} + +static struct irqaction cascade; + +static __inline__ void irq_init_irq(void) +{ + int irq; + + for (irq = 0; irq < NR_IRQS; irq++) { + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = shark_mask_and_ack_8259A_irq; + irq_desc[irq].mask = shark_disable_8259A_irq; + irq_desc[irq].unmask = shark_enable_8259A_irq; + } + + /* The PICs are initialized to level triggered and auto eoi! + * If they are set to edge triggered they lose some IRQs, + * if they are set to manual eoi they get locked up after + * a short time + */ + + /* init master interrupt controller */ + outb(0x19, 0x20); /* Start init sequence, level triggered */ + outb(0x00, 0x21); /* Vector base */ + outb(0x04, 0x21); /* Cascade (slave) on IRQ2 */ + outb(0x03, 0x21); /* Select 8086 mode , auto eoi*/ + outb(0x0A, 0x20); + /* init slave interrupt controller */ + outb(0x19, 0xA0); /* Start init sequence, level triggered */ + outb(0x08, 0xA1); /* Vector base */ + outb(0x02, 0xA1); /* Cascade (slave) on IRQ2 */ + outb(0x03, 0xA1); /* Select 8086 mode, auto eoi */ + outb(0x0A, 0xA0); + outb(cached_irq_mask[1],0xA1); + outb(cached_irq_mask[0],0x21); + //request_region(0x20,0x2,"pic1"); + //request_region(0xA0,0x2,"pic2"); + + cascade.handler = bogus_int; + cascade.flags = 0; + cascade.mask = 0; + cascade.name = "cascade"; + cascade.next = NULL; + cascade.dev_id = NULL; + setup_arm_irq(2,&cascade); + +} diff --git a/include/asm-arm/arch-shark/irqs.h b/include/asm-arm/arch-shark/irqs.h new file mode 100644 index 000000000..eabfb4b70 --- /dev/null +++ b/include/asm-arm/arch-shark/irqs.h @@ -0,0 +1,11 @@ +/* + * linux/include/asm-arm/arch-shark/irqs.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + */ + +#define NR_IRQS 16 + +#define IRQ_ISA_KEYBOARD 1 +#define AUX_IRQ 12 +#define IRQ_HARDDISK 14 diff --git a/include/asm-arm/arch-shark/keyboard.h b/include/asm-arm/arch-shark/keyboard.h new file mode 100644 index 000000000..523bd065f --- /dev/null +++ b/include/asm-arm/arch-shark/keyboard.h @@ -0,0 +1,95 @@ +/* + * linux/include/asm-arm/arch-ebsa285/keyboard.h + * + * Keyboard driver definitions for EBSA285 architecture + * + * (C) 1998 Russell King + * (C) 1998 Phil Blundell + */ +#include <linux/ioport.h> +#include <asm/irq.h> +#include <asm/io.h> +#include <asm/system.h> + +extern int have_isa_bridge; + +extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); +extern int pckbd_getkeycode(unsigned int scancode); +extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, + char raw_mode); +extern char pckbd_unexpected_up(unsigned char keycode); +extern void pckbd_leds(unsigned char leds); +extern void pckbd_init_hw(void); +extern unsigned char pckbd_sysrq_xlate[128]; + +#define KEYBOARD_IRQ IRQ_ISA_KEYBOARD + +#define NR_SCANCODES 128 + +#define kbd_setkeycode(sc,kc) \ + ({ \ + int __ret; \ + if (have_isa_bridge) \ + __ret = pckbd_setkeycode(sc,kc);\ + else \ + __ret = -EINVAL; \ + __ret; \ + }) + +#define kbd_getkeycode(sc) \ + ({ \ + int __ret; \ + if (have_isa_bridge) \ + __ret = pckbd_getkeycode(sc); \ + else \ + __ret = -EINVAL; \ + __ret; \ + }) + +#define kbd_translate(sc, kcp, rm) \ + ({ \ + pckbd_translate(sc, kcp, rm); \ + }) + +#define kbd_unexpected_up pckbd_unexpected_up + +#define kbd_leds(leds) \ + do { \ + if (have_isa_bridge) \ + pckbd_leds(leds); \ + } while (0) + +#define kbd_init_hw() \ + do { \ + if (have_isa_bridge) \ + pckbd_init_hw(); \ + } while (0) + +#define kbd_sysrq_xlate pckbd_sysrq_xlate + +#define kbd_disable_irq() +#define kbd_enable_irq() + +#define SYSRQ_KEY 0x54 + +/* resource allocation */ +#define kbd_request_region() request_region(0x60, 16, "keyboard") +#define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \ + "keyboard", NULL) + +/* How to access the keyboard macros on this platform. */ +#define kbd_read_input() inb(KBD_DATA_REG) +#define kbd_read_status() inb(KBD_STATUS_REG) +#define kbd_write_output(val) outb(val, KBD_DATA_REG) +#define kbd_write_command(val) outb(val, KBD_CNTL_REG) + +/* Some stoneage hardware needs delays after some operations. */ +#define kbd_pause() do { } while(0) + +/* + * Machine specific bits for the PS/2 driver + */ +#define aux_request_irq(hand, dev_id) \ + request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id) + +#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) diff --git a/include/asm-arm/arch-shark/memory.h b/include/asm-arm/arch-shark/memory.h new file mode 100644 index 000000000..d3ede01ec --- /dev/null +++ b/include/asm-arm/arch-shark/memory.h @@ -0,0 +1,35 @@ +/* + * linux/include/asm-arm/arch-shark/memory.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + * + * derived from: + * linux/include/asm-arm/arch-ebsa110/memory.h + * Copyright (c) 1996-1999 Russell King. + */ +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +/* + * Task size: 3GB + */ +#define TASK_SIZE (0xc0000000UL) +#define TASK_SIZE_26 (0x04000000UL) + +/* + * Page offset: = 3GB + */ +#define PAGE_OFFSET (0xC0000000UL) +#define PHYS_OFFSET (0x08000000UL) + +#define __virt_to_phys__is_a_macro +#define __phys_to_virt__is_a_macro +#define __virt_to_phys(vpage) (vpage - PAGE_OFFSET + PHYS_OFFSET) +#define __phys_to_virt(ppage) (ppage - PHYS_OFFSET + PAGE_OFFSET) + +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) __virt_to_phys(x) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) __phys_to_virt(x) + +#endif diff --git a/include/asm-arm/arch-shark/param.h b/include/asm-arm/arch-shark/param.h new file mode 100644 index 000000000..f6b5f9e71 --- /dev/null +++ b/include/asm-arm/arch-shark/param.h @@ -0,0 +1,10 @@ +/* + * linux/include/asm-arm/arch-shark/param.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + */ + +/* This must be a power of 2 because the RTC + * can't use anything else. + */ +#define HZ 64 diff --git a/include/asm-arm/arch-shark/processor.h b/include/asm-arm/arch-shark/processor.h new file mode 100644 index 000000000..bd99869af --- /dev/null +++ b/include/asm-arm/arch-shark/processor.h @@ -0,0 +1,28 @@ +/* + * linux/include/asm-arm/arch-ebsa110/processor.h + * + * Copyright (C) 1996-1999 Russell King + * + * Changelog: + * 21-Mar-1999 RMK Added asm/arch/memory.h + */ + +#ifndef __ASM_ARCH_PROCESSOR_H +#define __ASM_ARCH_PROCESSOR_H + +#include <asm/arch/memory.h> + +/* + * Bus types + */ +#define EISA_bus 0 +#define EISA_bus__is_a_macro /* for versions in ksyms.c */ +#define MCA_bus 0 +#define MCA_bus__is_a_macro /* for versions in ksyms.c */ + +/* This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + +#endif diff --git a/include/asm-arm/arch-shark/serial.h b/include/asm-arm/arch-shark/serial.h new file mode 100644 index 000000000..7b23d4fb5 --- /dev/null +++ b/include/asm-arm/arch-shark/serial.h @@ -0,0 +1,33 @@ +/* + * linux/include/asm-arm/arch-ebsa110/serial.h + * + * Copyright (c) 1996,1997,1998 Russell King. + * + * Changelog: + * 15-10-1996 RMK Created + */ +#ifndef __ASM_ARCH_SERIAL_H +#define __ASM_ARCH_SERIAL_H + +/* + * This assumes you have a 1.8432 MHz clock for your UART. + * + * It'd be nice if someone built a serial card with a 24.576 MHz + * clock, since the 16550A is capable of handling a top speed of 1.5 + * megabits/second; but this requires the faster clock. + */ +#define BASE_BAUD (1843200 / 16) + +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) + +#define RS_TABLE_SIZE 2 + + /* UART CLK PORT IRQ FLAGS */ +#define STD_SERIAL_PORT_DEFNS \ + { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ + +#define EXTRA_SERIAL_PORT_DEFNS + +#endif + diff --git a/include/asm-arm/arch-shark/system.h b/include/asm-arm/arch-shark/system.h new file mode 100644 index 000000000..b0d34e811 --- /dev/null +++ b/include/asm-arm/arch-shark/system.h @@ -0,0 +1,21 @@ +/* + * linux/include/asm-arm/arch-ebsa110/system.h + * + * Copyright (c) 1996-1998 Russell King. + */ +#ifndef __ASM_ARCH_SYSTEM_H +#define __ASM_ARCH_SYSTEM_H + +extern __inline__ void arch_reset(char mode) +{ + /* + * loop endlessly + */ + cli(); +} + +#define arch_power_off() do { } while (0) +#define arch_do_idle() do {} while (0) +/*cpu_do_idle()*/ + +#endif diff --git a/include/asm-arm/arch-shark/time.h b/include/asm-arm/arch-shark/time.h new file mode 100644 index 000000000..32f9d7593 --- /dev/null +++ b/include/asm-arm/arch-shark/time.h @@ -0,0 +1,101 @@ +/* + * linux/include/asm-arm/arch-shark/time.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + * + * Uses the real time clock because you can't run + * the timer with level triggered interrupts and + * you can't run the shark with edge triggered + * inetrrupts (loses ints and hangs). + * + * derived from linux/drivers/char/rtc.c and: + * linux/include/asm-arm/arch-ebsa110/time.h + * Copyright (c) 1996,1997,1998 Russell King. + */ + +#include <linux/config.h> +#include <asm/leds.h> +#include <linux/mc146818rtc.h> + +#define IRQ_TIMER 8 + +extern void get_rtc_time(struct rtc_time *rtc_tm); +extern void set_rtc_irq_bit(unsigned char bit); +extern unsigned long epoch; + +static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + + CMOS_READ(RTC_INTR_FLAGS); + +#ifdef CONFIG_LEDS + { + static int count = 50; + if (--count == 0) { + count = 50; + leds_event(led_timer); + } + } +#endif + + { +#ifdef DIVISOR + static unsigned int divisor; + + if (divisor-- == 0) { + divisor = DIVISOR - 1; +#else + { +#endif + do_timer(regs); + } + } +} + +static struct irqaction timerirq = { + timer_interrupt, + SA_INTERRUPT, + 0, + "timer", + NULL, + NULL +}; + +/* + * Set up timer interrupt, and return the current time in seconds. + */ +extern __inline__ void setup_timer(void) +{ + struct rtc_time r_time; + unsigned long flags; + int tmp = 0; + unsigned char val; + + /* + * Set the clock to 128 Hz, we already have a valid + * vector now: + */ + + while (HZ > (1<<tmp)) + tmp++; + + /* + * Check that the input was really a power of 2. + */ + if (HZ != (1<<tmp)) + panic("Please set HZ to a power of 2!"); + + save_flags(flags); + cli(); + val = CMOS_READ(RTC_FREQ_SELECT) & 0xf0; + val |= (16 - tmp); + CMOS_WRITE(val, RTC_FREQ_SELECT); + restore_flags(flags); + set_rtc_irq_bit(RTC_PIE); + + get_rtc_time(&r_time); + xtime.tv_sec = mktime(r_time.tm_year+epoch, r_time.tm_mon+1, r_time.tm_mday, + r_time.tm_hour, r_time.tm_min, r_time.tm_sec); + + setup_arm_irq(IRQ_TIMER, &timerirq); +} diff --git a/include/asm-arm/arch-shark/timex.h b/include/asm-arm/arch-shark/timex.h new file mode 100644 index 000000000..9588719c2 --- /dev/null +++ b/include/asm-arm/arch-shark/timex.h @@ -0,0 +1,5 @@ +/* + * linux/include/asm-arm/arch-shark/timex.h + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + */ diff --git a/include/asm-arm/arch-shark/uncompress.h b/include/asm-arm/arch-shark/uncompress.h new file mode 100644 index 000000000..d6097d43f --- /dev/null +++ b/include/asm-arm/arch-shark/uncompress.h @@ -0,0 +1,34 @@ +/* + * linux/include/asm-arm/arch-ebsa110/uncompress.h + * + * Copyright (C) 1996,1997,1998 Russell King + */ + +/* + * This does not append a newline + */ +static void puts(const char *s) +{ + __asm__ __volatile__(" + ldrb %0, [%2], #1 + teq %0, #0 + beq 3f +1: strb %0, [%3] +2: ldrb %1, [%3, #0x14] + and %1, %1, #0x60 + teq %1, #0x60 + bne 2b + teq %0, #'\n' + moveq %0, #'\r' + beq 1b + ldrb %0, [%2], #1 + teq %0, #0 + bne 1b +3: " : : "r" (0), "r" (0), "r" (s), "r" (0xf0000be0) : "cc"); +} + +/* + * nothing to do + */ +#define arch_decomp_setup() +#define arch_decomp_wdog() diff --git a/include/asm-arm/checksum.h b/include/asm-arm/checksum.h index 9d048a3ba..b91f5e7f4 100644 --- a/include/asm-arm/checksum.h +++ b/include/asm-arm/checksum.h @@ -123,12 +123,14 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, adcs %0, %0, %3 adcs %0, %0, %4 adcs %0, %0, %5 + adc %0, %0, #0 adds %0, %0, %0, lsl #16 - addcs %0, %0, #0x10000" + addcs %0, %0, #0x10000 + mvn %0, %0" : "=&r"(sum) - : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len) << 16), "Ir" (proto << 8) + : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (proto << 8) : "cc"); - return (~sum) >> 16; + return sum >> 16; } diff --git a/include/asm-arm/cpu-multi32.h b/include/asm-arm/cpu-multi32.h index b959f4994..b8a5b58f8 100644 --- a/include/asm-arm/cpu-multi32.h +++ b/include/asm-arm/cpu-multi32.h @@ -95,7 +95,7 @@ extern struct processor { /* * Idle the processor */ - int (*_do_idle)(void); + int (*_do_idle)(int mode); /* * flush I cache for a page */ @@ -110,7 +110,7 @@ extern const struct processor sa110_processor_functions; #define cpu_check_bugs() processor._check_bugs() #define cpu_proc_init() processor._proc_init() #define cpu_proc_fin() processor._proc_fin() -#define cpu_do_idle() processor._do_idle() +#define cpu_do_idle(mode) processor._do_idle(mode) #define cpu_flush_cache_all() processor._flush_cache_all() #define cpu_flush_cache_area(start,end,flags) processor._flush_cache_area(start,end,flags) diff --git a/include/asm-arm/cpu-single.h b/include/asm-arm/cpu-single.h index 74cffcdb5..6a4c256f2 100644 --- a/include/asm-arm/cpu-single.h +++ b/include/asm-arm/cpu-single.h @@ -49,7 +49,7 @@ extern void cpu_data_abort(unsigned long pc); extern void cpu_check_bugs(void); extern void cpu_proc_init(void); extern void cpu_proc_fin(void); -extern int cpu_do_idle(void); +extern int cpu_do_idle(int mode); extern void cpu_flush_cache_all(void); extern void cpu_flush_cache_area(unsigned long address, unsigned long end, int flags); diff --git a/include/asm-arm/namei.h b/include/asm-arm/namei.h index 082f2c910..a402d3b9d 100644 --- a/include/asm-arm/namei.h +++ b/include/asm-arm/namei.h @@ -12,51 +12,14 @@ #define ARM_BSD_EMUL "usr/gnemul/bsd/" -static inline struct dentry * -__arm_lookup_dentry(const char *name, int lookup_flags) +static inline char *__emul_prefix(void) { - struct dentry *base; - char *emul; - switch (current->personality) { case PER_BSD: - emul = ARM_BSD_EMUL; break; + return ARM_BSD_EMUL; default: return NULL; } - - base = lookup_dentry (emul, dget (current->fs->root), - (LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_SLASHOK)); - - if (IS_ERR (base)) return NULL; - - base = lookup_dentry (name, base, lookup_flags); - - if (IS_ERR (base)) return NULL; - - if (!base->d_inode) { - struct dentry *fromroot; - - fromroot = lookup_dentry (name, dget (current->fs->root), - lookup_flags); - - if (IS_ERR (fromroot)) return base; - - if (fromroot->d_inode) { - dput(base); - return fromroot; - } - - dput(fromroot); - } - - return base; } -#define __prefix_lookup_dentry(name, lookup_flags) \ - if (current->personality) { \ - dentry = __arm_lookup_dentry (name, lookup_flags); \ - if (dentry) return dentry; \ - } - #endif /* __ASMARM_NAMEI_H */ diff --git a/include/asm-arm/proc-armv/pgtable.h b/include/asm-arm/proc-armv/pgtable.h index e9260057f..d4a57d8a2 100644 --- a/include/asm-arm/proc-armv/pgtable.h +++ b/include/asm-arm/proc-armv/pgtable.h @@ -12,6 +12,7 @@ #define __ASM_PROC_PGTABLE_H #include <asm/proc/domain.h> +#include <asm/arch/vmalloc.h> /* * entries per page directory level: they are two-level, so @@ -21,19 +22,6 @@ #define PTRS_PER_PMD 1 #define PTRS_PER_PGD 4096 -/* - * Just any arbitrary offset to the start of the vmalloc VM area: the - * current 8MB value just means that there will be a 8MB "hole" after the - * physical memory until the kernel virtual memory starts. That means that - * any out-of-bounds memory accesses will hopefully be caught. - * The vmalloc() routines leaves a hole of 4kB between each vmalloced - * area for the same reason. ;) - */ -#define VMALLOC_OFFSET (8*1024*1024) -#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) -#define VMALLOC_END (PAGE_OFFSET + 0x10000000) - /**************** * PMD functions * ****************/ @@ -139,7 +127,7 @@ extern __inline__ unsigned long pmd_page(pmd_t pmd) #define PAGE_NONE __pgprot(_L_PTE_DEFAULT) #define PAGE_COPY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_BUFFERABLE) #define PAGE_SHARED __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_BUFFERABLE | L_PTE_WRITE) -#define PAGE_READONLY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ) +#define PAGE_READONLY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_BUFFERABLE) #define PAGE_KERNEL __pgprot(_L_PTE_DEFAULT | L_PTE_CACHEABLE | L_PTE_BUFFERABLE | L_PTE_DIRTY | L_PTE_WRITE) #define _PAGE_CHG_MASK (PAGE_MASK | L_PTE_DIRTY | L_PTE_YOUNG) diff --git a/include/asm-i386/namei.h b/include/asm-i386/namei.h index 5708ffd8d..814865088 100644 --- a/include/asm-i386/namei.h +++ b/include/asm-i386/namei.h @@ -12,7 +12,6 @@ * Look at asm-sparc/namei.h for details. */ -#define __prefix_lookup_dentry(name, lookup_flags) \ - do {} while (0) +#define __emul_prefix() NULL #endif /* __I386_NAMEI_H */ diff --git a/include/asm-ia64/namei.h b/include/asm-ia64/namei.h index 74e195253..0507e03dc 100644 --- a/include/asm-ia64/namei.h +++ b/include/asm-ia64/namei.h @@ -11,7 +11,6 @@ * for /usr/gnemul/ emulation stuff. * Look at asm-sparc/namei.h for details. */ -#define __prefix_lookup_dentry(name, lookup_flags) \ - do {} while (0) +#define __emul_prefix() NULL #endif /* _ASM_IA64_NAMEI_H */ diff --git a/include/asm-m68k/namei.h b/include/asm-m68k/namei.h index 7b4f02680..f33f243b6 100644 --- a/include/asm-m68k/namei.h +++ b/include/asm-m68k/namei.h @@ -12,7 +12,6 @@ * Look at asm-sparc/namei.h for details. */ -#define __prefix_lookup_dentry(name, lookup_flags) \ - do {} while (0) +#define __emul_prefix() NULL #endif diff --git a/include/asm-mips/namei.h b/include/asm-mips/namei.h index 64acd52ff..5361d07fd 100644 --- a/include/asm-mips/namei.h +++ b/include/asm-mips/namei.h @@ -13,42 +13,18 @@ /* Only one at this time. */ #define IRIX32_EMUL "usr/gnemul/irix/" -static inline struct dentry * -__mips_lookup_dentry(const char *name, int lookup_flags) -{ - struct dentry *base; +#ifdef CONFIG_BINFMT_IRIX +static inline char *__emul_prefix(void) +{ if (current->personality != PER_IRIX32) - return ERR_PTR(-ENOENT); - - base = lookup_dentry (IRIX32_EMUL, - dget (current->fs->root), - (LOOKUP_FOLLOW | LOOKUP_DIRECTORY)); - - if (IS_ERR (base)) return base; - - base = lookup_dentry (name, base, lookup_flags); - - if (IS_ERR (base)) return base; - - if (!base->d_inode) { - dput(base); - return ERR_PTR(-ENOENT); - } - - return base; + return NULL; + return IRIX32_EMUL; } -#ifdef CONFIG_BINFMT_IRIX - -#define __prefix_lookup_dentry(name, lookup_flags) \ - dentry = __mips_lookup_dentry (name, lookup_flags); \ - if (!IS_ERR (dentry)) return dentry; - #else /* !defined(CONFIG_BINFMT_IRIX) */ -#define __prefix_lookup_dentry(name, lookup_flags) \ - do {} while (0) +#define __emul_prefix() NULL #endif /* !defined(CONFIG_BINFMT_IRIX) */ diff --git a/include/asm-mips64/namei.h b/include/asm-mips64/namei.h index 3152a3836..aed1ebf52 100644 --- a/include/asm-mips64/namei.h +++ b/include/asm-mips64/namei.h @@ -13,7 +13,6 @@ * Look at asm-sparc/namei.h for details. */ -#define __prefix_lookup_dentry(name, lookup_flags) \ - do {} while (0) +#define __emul_prefix() NULL #endif /* _ASM_NAMEI_H */ diff --git a/include/asm-ppc/namei.h b/include/asm-ppc/namei.h index 9e0268b03..cd871903d 100644 --- a/include/asm-ppc/namei.h +++ b/include/asm-ppc/namei.h @@ -13,7 +13,6 @@ * Look at asm-sparc/namei.h for details. */ -#define __prefix_lookup_dentry(name, lookup_flags) \ - do {} while (0) +#define __emul_prefix() NULL #endif /* __PPC_NAMEI_H */ diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h index bf0d00c0a..85462da1e 100644 --- a/include/asm-sh/bitops.h +++ b/include/asm-sh/bitops.h @@ -103,7 +103,7 @@ extern __inline__ unsigned long ffz(unsigned long word) { unsigned long result; - __asm__("1:\n" + __asm__("1:\n\t" "shlr %1\n\t" "bt/s 1b\n\t" " add #1, %0" diff --git a/include/asm-sh/byteorder.h b/include/asm-sh/byteorder.h index dcc9f8241..cddaeb58e 100644 --- a/include/asm-sh/byteorder.h +++ b/include/asm-sh/byteorder.h @@ -19,7 +19,7 @@ static __inline__ __const__ __u32 ___arch__swab32(__u32 x) static __inline__ __const__ __u16 ___arch__swab16(__u16 x) { - __asm__("swap.b %0,%0" + __asm__("swap.b %0, %0" : "=r" (x) : "0" (x)); return x; diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h index ae0272e9b..846e64509 100644 --- a/include/asm-sh/checksum.h +++ b/include/asm-sh/checksum.h @@ -55,24 +55,6 @@ unsigned int csum_partial_copy_from_user ( const char *src, char *dst, return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); } -#if 0 - -/* Not used at the moment. It is difficult to imagine for what purpose - it can be used :-) Please, do not forget to verify_area before it --ANK - */ - -/* - * This combination is currently not used, but possible: - */ - -extern __inline__ -unsigned int csum_partial_copy_to_user ( const char *src, char *dst, - int len, int sum, int *err_ptr) -{ - return csum_partial_copy_generic ( src, dst, len, sum, NULL, err_ptr); -} -#endif - /* * These are the old (and unsafe) way of doing checksums, a warning message will be * printed if they are used and an exeption occurs. @@ -91,12 +73,12 @@ static __inline__ unsigned int csum_fold(unsigned int sum) { unsigned int __dummy; __asm__("clrt\n\t" - "mov %0,%1\n\t" + "mov %0, %1\n\t" "shll16 %0\n\t" - "addc %0,%1\n\t" + "addc %0, %1\n\t" "movt %0\n\t" "shlr16 %1\n\t" - "add %1,%0" + "add %1, %0" : "=r" (sum), "=&r" (__dummy) : "0" (sum)); return ~sum; @@ -114,24 +96,24 @@ static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int unsigned int sum, __dummy; __asm__ __volatile__( - "mov.l @%1+,%0\n\t" - "add #-4,%2\n\t" + "mov.l @%1+, %0\n\t" + "add #-4, %2\n\t" "clrt\n\t" - "mov.l @%1+,%3\n\t" - "addc %3,%0\n\t" - "mov.l @%1+,%3\n\t" - "addc %3,%0\n\t" - "mov.l @%1+,%3\n\t" - "addc %3,%0\n" + "mov.l @%1+, %3\n\t" + "addc %3, %0\n\t" + "mov.l @%1+, %3\n\t" + "addc %3, %0\n\t" + "mov.l @%1+, %3\n\t" + "addc %3, %0\n" "1:\t" - "mov.l @%1+,%3\n\t" - "addc %3,%0\n\t" + "mov.l @%1+, %3\n\t" + "addc %3, %0\n\t" "movt %3\n\t" "dt %2\n\t" "bf/s 1b\n\t" - " cmp/eq #1,%3\n\t" - "mov #0,%3\n\t" - "addc %3,%0\n\t" + " cmp/eq #1, %3\n\t" + "mov #0, %3\n\t" + "addc %3, %0\n\t" /* Since the input registers which are loaded with iph and ihl are modified, we must also specify them as outputs, or gcc will assume they contain their original values. */ @@ -153,11 +135,11 @@ static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, unsigned long len_proto = (proto<<16)+len; #endif __asm__("clrt\n\t" - "addc %0,%1\n\t" - "addc %2,%1\n\t" - "addc %3,%1\n\t" + "addc %0, %1\n\t" + "addc %2, %1\n\t" + "addc %3, %1\n\t" "movt %0\n\t" - "add %1,%0" + "add %1, %0" : "=r" (sum), "=r" (len_proto) : "r" (daddr), "r" (saddr), "1" (len_proto), "0" (sum)); return sum; @@ -195,26 +177,26 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, { unsigned int __dummy; __asm__("clrt\n\t" - "mov.l @(0,%2),%1\n\t" - "addc %1,%0\n\t" - "mov.l @(4,%2),%1\n\t" - "addc %1,%0\n\t" - "mov.l @(8,%2),%1\n\t" - "addc %1,%0\n\t" - "mov.l @(12,%2),%1\n\t" - "addc %1,%0\n\t" - "mov.l @(0,%3),%1\n\t" - "addc %1,%0\n\t" - "mov.l @(4,%3),%1\n\t" - "addc %1,%0\n\t" - "mov.l @(8,%3),%1\n\t" - "addc %1,%0\n\t" - "mov.l @(12,%3),%1\n\t" - "addc %1,%0\n\t" - "addc %4,%0\n\t" - "addc %5,%0\n\t" + "mov.l @(0,%2), %1\n\t" + "addc %1, %0\n\t" + "mov.l @(4,%2), %1\n\t" + "addc %1, %0\n\t" + "mov.l @(8,%2), %1\n\t" + "addc %1, %0\n\t" + "mov.l @(12,%2), %1\n\t" + "addc %1, %0\n\t" + "mov.l @(0,%3), %1\n\t" + "addc %1, %0\n\t" + "mov.l @(4,%3), %1\n\t" + "addc %1, %0\n\t" + "mov.l @(8,%3), %1\n\t" + "addc %1, %0\n\t" + "mov.l @(12,%3), %1\n\t" + "addc %1, %0\n\t" + "addc %4, %0\n\t" + "addc %5, %0\n\t" "movt %1\n\t" - "add %1,%0\n" + "add %1, %0\n" : "=r" (sum), "=&r" (__dummy) : "r" (saddr), "r" (daddr), "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)); diff --git a/include/asm-sh/current.h b/include/asm-sh/current.h index fe65bfcc9..3bd231173 100644 --- a/include/asm-sh/current.h +++ b/include/asm-sh/current.h @@ -12,8 +12,8 @@ static __inline__ struct task_struct * get_current(void) { struct task_struct *current; - __asm__("stc r4_bank,%0\n\t" - "add %1,%0" + __asm__("stc $r4_bank, %0\n\t" + "add %1, %0" :"=&r" (current) :"r" (-8192)); return current; diff --git a/include/asm-sh/delay.h b/include/asm-sh/delay.h index 222561a3e..3e25684fe 100644 --- a/include/asm-sh/delay.h +++ b/include/asm-sh/delay.h @@ -8,7 +8,7 @@ extern __inline__ void __delay(unsigned long loops) { __asm__ __volatile__( - "tst %0,%0\n\t" + "tst %0, %0\n\t" "1:\t" "bf/s 1b\n\t" " dt %0" @@ -19,8 +19,8 @@ extern __inline__ void __delay(unsigned long loops) extern __inline__ void __udelay(unsigned long usecs, unsigned long lps) { usecs *= 0x000010c6; /* 2**32 / 1000000 */ - __asm__("dmulu.l %0,%2\n\t" - "sts mach,%0" + __asm__("dmulu.l %0, %2\n\t" + "sts $mach, %0" : "=r" (usecs) : "0" (usecs), "r" (lps) : "macl", "mach"); diff --git a/include/asm-sh/mman.h b/include/asm-sh/mman.h index 19b02f6da..49fecaed5 100644 --- a/include/asm-sh/mman.h +++ b/include/asm-sh/mman.h @@ -25,6 +25,12 @@ #define MCL_CURRENT 1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ +#define MADV_NORMAL 0x0 /* default page-in behavior */ +#define MADV_RANDOM 0x1 /* page-in minimum required */ +#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ +#define MADV_WILLNEED 0x3 /* pre-fault pages */ +#define MADV_DONTNEED 0x4 /* discard these pages */ + /* compatibility flags */ #define MAP_ANON MAP_ANONYMOUS #define MAP_FILE 0 diff --git a/include/asm-sh/namei.h b/include/asm-sh/namei.h index 582fc77e3..a51522ac1 100644 --- a/include/asm-sh/namei.h +++ b/include/asm-sh/namei.h @@ -12,7 +12,6 @@ * Look at asm-sparc/namei.h for details. */ -#define __prefix_lookup_dentry(name, lookup_flags) \ - do {} while (0) +#define __emul_prefix() NULL #endif /* __ASM_SH_NAMEI_H */ diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h index 962461a33..1fcfb1300 100644 --- a/include/asm-sh/processor.h +++ b/include/asm-sh/processor.h @@ -45,8 +45,10 @@ extern struct sh_cpuinfo boot_cpu_data; /* * User space process size: 2GB. + * + * Since SH7709 and SH7750 have "area 7", we can't use 0x7c000000--0x7fffffff */ -#define TASK_SIZE 0x80000000 +#define TASK_SIZE 0x7c000000UL /* This decides where the kernel will search for a free chunk of vm * space during mmap's. @@ -54,19 +56,25 @@ extern struct sh_cpuinfo boot_cpu_data; #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) /* - * FPU structure and data - */ -/* FD-bit of SR register. - * When it's set, it means the processor doesn't have right to use FPU, - * and it results exception when the floating operation is executed. + * Bit of SR register + * + * FD-bit: + * When it's set, it means the processor doesn't have right to use FPU, + * and it results exception when the floating operation is executed. + * + * IMASK-bit: + * Interrupt level mask */ -#define SR_FD 0x00008000 +#define SR_FD 0x00008000 +#define SR_IMASK 0x000000f0 -#define NUM_FPU_REGS 16 +/* + * FPU structure and data + */ struct sh_fpu_hard_struct { - unsigned long fp_regs[NUM_FPU_REGS]; - unsigned long xf_regs[NUM_FPU_REGS]; + unsigned long fp_regs[16]; + unsigned long long xd_regs[8]; unsigned long fpscr; unsigned long fpul; @@ -75,13 +83,13 @@ struct sh_fpu_hard_struct { /* Dummy fpu emulator */ struct sh_fpu_soft_struct { - unsigned long fp_regs[NUM_FPU_REGS]; + unsigned long fp_regs[16]; + unsigned long long xd_regs[8]; unsigned long fpscr; unsigned long fpul; - unsigned long xf_regs[NUM_FPU_REGS]; - unsigned char lookahead; - unsigned long entry_pc; + unsigned char lookahead; + unsigned long entry_pc; }; union sh_fpu_union { @@ -120,7 +128,7 @@ struct thread_struct { regs->pr = 0; \ regs->sr = 0; /* User mode. */ \ regs->pc = new_pc; \ - regs->sp = new_sp + regs->regs[15] = new_sp /* Forward declaration, a strange C thing */ struct task_struct; @@ -189,6 +197,9 @@ extern void save_fpu(struct task_struct *__tsk); (tsk)->flags &= ~PF_USEDFPU; \ } while (0) +/* Double presision, NANS as NANS, rounding to nearest, no exceptions */ +#define FPSCR_INIT 0x00080000 + /* * Return saved PC of a blocked thread. */ diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h index ad3ab8905..369fc23bb 100644 --- a/include/asm-sh/ptrace.h +++ b/include/asm-sh/ptrace.h @@ -2,19 +2,49 @@ #define __ASM_SH_PTRACE_H /* - * Copyright (C) 1999 Niibe Yutaka + * Copyright (C) 1999, 2000 Niibe Yutaka * */ /* + * As GCC does: + * 0 - 15 are integer registers + * 17 - 22 are control/special registers + * 24 - 39 fp registers + * 40 - 47 xd registers + * 48 - fpscr register + * ----------------------------- + * Not as GCC: + * 16 --- program counter PC + * 23 --- syscall # + */ +#define REG_REG0 0 +#define REG_REG15 15 +#define REG_PC 16 + +#define REG_PR 17 +#define REG_SR 18 +#define REG_GBR 19 +#define REG_MACH 20 +#define REG_MACL 21 +#define REG_FPUL 22 + +#define REG_SYSCALL 23 + +#define REG_FPREG0 24 +#define REG_FPREG15 39 +#define REG_XDREG0 40 +#define REG_XDREG14 47 +#define REG_FPSCR 48 + +/* * This struct defines the way the registers are stored on the * kernel stack during a system call or other kernel entry. */ struct pt_regs { long syscall_nr; unsigned long sr; - unsigned long sp; - unsigned long regs[15]; + unsigned long regs[16]; unsigned long gbr; unsigned long mach; unsigned long macl; @@ -26,6 +56,60 @@ struct pt_regs { #define user_mode(regs) (((regs)->sr & 0x40000000)==0) #define instruction_pointer(regs) ((regs)->pc) extern void show_regs(struct pt_regs *); + +/* User Break Controller */ + +#if defined(__sh3__) +/* The value is for sh4, please fix... */ +#define UBC_BARA 0xff200000 +#define UBC_BAMRA 0xff200004 +#define UBC_BBRA 0xff200008 +#define UBC_BASRA 0xff000014 +#define UBC_BARB 0xff20000c +#define UBC_BAMRB 0xff200010 +#define UBC_BBRB 0xff200014 +#define UBC_BASRB 0xff000018 +#define UBC_BDRB 0xff200018 +#define UBC_BDMRB 0xff20001c +#define UBC_BRCR 0xff200020 +#elif defined(__SH4__) +#define UBC_BARA 0xff200000 +#define UBC_BAMRA 0xff200004 +#define UBC_BBRA 0xff200008 +#define UBC_BASRA 0xff000014 +#define UBC_BARB 0xff20000c +#define UBC_BAMRB 0xff200010 +#define UBC_BBRB 0xff200014 +#define UBC_BASRB 0xff000018 +#define UBC_BDRB 0xff200018 +#define UBC_BDMRB 0xff20001c +#define UBC_BRCR 0xff200020 +#endif + +#define BAMR_ASID (1 << 2) +#define BAMR_NONE 0 +#define BAMR_10 0x1 +#define BAMR_12 0x2 +#define BAMR_ALL 0x3 +#define BAMR_16 0x8 +#define BAMR_20 0x9 + +#define BBR_INST (1 << 4) +#define BBR_DATA (2 << 4) +#define BBR_READ (1 << 2) +#define BBR_WRITE (2 << 4) +#define BBR_BYTE 0x1 +#define BBR_HALF 0x2 +#define BBR_LONG 0x3 +#define BBR_QUAD (1 << 6) + +#define BRCR_CMFA (1 << 15) +#define BRCR_CMFB (1 << 14) +#define BRCR_PCBA (1 << 10) /* 1: after execution */ +#define BRCR_DBEB (1 << 7) +#define BRCR_PCBB (1 << 6) +#define BRCR_SEQ (1 << 3) +#define BRCR_UBDE (1 << 0) #endif #endif /* __ASM_SH_PTRACE_H */ diff --git a/include/asm-sh/sigcontext.h b/include/asm-sh/sigcontext.h index c1a77873b..6f61ed38c 100644 --- a/include/asm-sh/sigcontext.h +++ b/include/asm-sh/sigcontext.h @@ -5,14 +5,22 @@ struct sigcontext { unsigned long oldmask; /* CPU registers */ - unsigned long sc_regs[15]; + unsigned long sc_regs[16]; unsigned long sc_gbr; unsigned long sc_mach; unsigned long sc_macl; unsigned long sc_pr; - unsigned long sc_sp; unsigned long sc_sr; unsigned long sc_pc; + +#if defined(__SH4__) + /* FPU registers */ + unsigned long sc_fpregs[16]; + unsigned long long sc_xdregs[8]; + unsigned int sc_fpscr; + unsigned int sc_fpul; + unsigned int sc_ownedfp; +#endif }; #endif /* __ASM_SH_SIGCONTEXT_H */ diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h index bcff30489..3eab1c123 100644 --- a/include/asm-sh/string.h +++ b/include/asm-sh/string.h @@ -13,11 +13,11 @@ extern __inline__ char *strcpy(char *__dest, const char *__src) unsigned long __dummy; __asm__ __volatile__("1:\n\t" - "mov.b @%1+,%2\n\t" - "mov.b %2,@%0\n\t" - "cmp/eq #0,%2\n\t" + "mov.b @%1+, %2\n\t" + "mov.b %2, @%0\n\t" + "cmp/eq #0, %2\n\t" "bf/s 1b\n\t" - " add #1,%0\n\t" + " add #1, %0\n\t" : "=r" (__dest), "=r" (__src), "=&z" (__dummy) : "0" (__dest), "1" (__src) : "memory"); @@ -36,13 +36,13 @@ extern __inline__ char *strncpy(char *__dest, const char *__src, size_t __n) __asm__ __volatile__( "1:\n" - "mov.b @%1+,%2\n\t" - "mov.b %2,@%0\n\t" - "cmp/eq #0,%2\n\t" + "mov.b @%1+, %2\n\t" + "mov.b %2, @%0\n\t" + "cmp/eq #0, %2\n\t" "bt/s 2f\n\t" " cmp/eq %5,%1\n\t" "bf/s 1b\n\t" - " add #1,%0\n" + " add #1, %0\n" "2:" : "=r" (__dest), "=r" (__src), "=&z" (__dummy) : "0" (__dest), "1" (__src), "r" (__src+__n) @@ -58,17 +58,17 @@ extern __inline__ int strcmp(const char *__cs, const char *__ct) unsigned long __dummy; __asm__ __volatile__( - "mov.b @%1+,%3\n" + "mov.b @%1+, %3\n" "1:\n\t" - "mov.b @%0+,%2\n\t" - "cmp/eq #0,%3\n\t" + "mov.b @%0+, %2\n\t" + "cmp/eq #0, %3\n\t" "bt 2f\n\t" - "cmp/eq %2,%3\n\t" + "cmp/eq %2, %3\n\t" "bt/s 1b\n\t" - " mov.b @%1+,%3\n\t" - "add #-2,%1\n\t" - "mov.b @%1,%3\n\t" - "sub %3,%2\n" + " mov.b @%1+, %3\n\t" + "add #-2, %1\n\t" + "mov.b @%1, %3\n\t" + "sub %3, %2\n" "2:" : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy) : "0" (__cs), "1" (__ct)); @@ -83,20 +83,20 @@ extern __inline__ int strncmp(const char *__cs, const char *__ct, size_t __n) unsigned long __dummy; __asm__ __volatile__( - "mov.b @%1+,%3\n" + "mov.b @%1+, %3\n" "1:\n\t" - "mov.b @%0+,%2\n\t" - "cmp/eq %6,%0\n\t" + "mov.b @%0+, %2\n\t" + "cmp/eq %6, %0\n\t" "bt/s 2f\n\t" - " cmp/eq #0,%3\n\t" + " cmp/eq #0, %3\n\t" "bt/s 3f\n\t" - " cmp/eq %3,%2\n\t" + " cmp/eq %3, %2\n\t" "bt/s 1b\n\t" - " mov.b @%1+,%3\n\t" - "add #-2,%1\n\t" - "mov.b @%1,%3\n" + " mov.b @%1+, %3\n\t" + "add #-2, %1\n\t" + "mov.b @%1, %3\n" "2:\n\t" - "sub %3,%2\n" + "sub %3, %2\n" "3:" :"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy) : "0" (__cs), "1" (__ct), "r" (__cs+__n)); diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h index e76071bf2..130800b47 100644 --- a/include/asm-sh/system.h +++ b/include/asm-sh/system.h @@ -2,7 +2,7 @@ #define __ASM_SH_SYSTEM_H /* - * Copyright (C) 1999, 2000 Niibe Yutaka + * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima */ /* @@ -93,13 +93,15 @@ extern void __xchg_called_with_bad_pointer(void); /* Interrupt Control */ extern __inline__ void __sti(void) { - unsigned long __dummy; + unsigned long __dummy0, __dummy1; __asm__ __volatile__("stc $sr, %0\n\t" "and %1, %0\n\t" + "stc $r5_bank, %1\n\t" + "or %1, %0\n\t" "ldc %0, $sr" - : "=&r" (__dummy) - : "r" (0xefffffff) + : "=&r" (__dummy0), "=r" (__dummy1) + : "1" (~0xf0) : "memory"); } @@ -107,10 +109,10 @@ extern __inline__ void __cli(void) { unsigned long __dummy; __asm__ __volatile__("stc $sr, %0\n\t" - "or %1, %0\n\t" + "or #0xf0, %0\n\t" "ldc %0, $sr" - : "=&r" (__dummy) - : "r" (0x10000000) + : "=&z" (__dummy) + : /* no inputs */ : "memory"); } @@ -118,35 +120,72 @@ extern __inline__ void __cli(void) x = (__extension__ ({ unsigned long __sr; \ __asm__ __volatile__( \ "stc $sr, %0" \ - : "=r" (__sr) \ + : "=&r" (__sr) \ : /* no inputs */ \ : "memory"); \ - (__sr & 0xffff7f0f);})) + (__sr & 0x000000f0);})) #define __save_and_cli(x) \ x = (__extension__ ({ unsigned long __dummy,__sr; \ __asm__ __volatile__( \ "stc $sr, %1\n\t" \ - "or %0, %1\n\t" \ - "stc $sr, %0\n\t" \ - "ldc %1, $sr" \ - : "=r" (__sr), "=&r" (__dummy) \ - : "0" (0x10000000) \ - : "memory"); (__sr & 0xffff7f0f); })) + "mov %1, %0\n\t" \ + "or #0xf0, %0\n\t" \ + "ldc %0, $sr" \ + : "=&z" (__dummy), "=&r" (__sr) \ + : /* no inputs */ \ + : "memory"); (__sr & 0x000000f0); })) #define __restore_flags(x) do { \ - unsigned long __dummy; \ - __asm__ __volatile__( \ + unsigned long __dummy0, __dummy1; \ + if (x != 0xf0) /* not CLI-ed? */ \ + __asm__ __volatile__( \ "stc $sr, %0\n\t" \ "and %1, %0\n\t" \ - "or %2, %0\n\t" \ + "stc $r5_bank, %1\n\t" \ + "or %1, %0\n\t" \ "ldc %0, $sr" \ - : "=&r" (__dummy) \ - : "r" (0x000080f0), /* IMASK+FD */ \ - "r" (x) \ + : "=&r" (__dummy0), "=r" (__dummy1) \ + : "1" (0xffffff0f) \ : "memory"); \ } while (0) +/* + * Jump to P2 area. + * When handling TLB or caches, we need to do it from P2 area. + */ +#define jump_to_P2() \ +do { \ + unsigned long __dummy; \ + __asm__ __volatile__( \ + "mov.l 1f, %0\n\t" \ + "or %1, %0\n\t" \ + "jmp @%0\n\t" \ + " nop\n\t" \ + ".balign 4\n" \ + "1: .long 2f\n" \ + "2:" \ + : "=&r" (__dummy) \ + : "r" (0x20000000)); \ +} while (0) + +/* + * Back to P1 area. + */ +#define back_to_P1() \ +do { \ + unsigned long __dummy; \ + __asm__ __volatile__( \ + "nop;nop;nop;nop;nop;nop\n\t" \ + "mov.l 1f, %0\n\t" \ + "jmp @%0\n\t" \ + " nop\n\t" \ + ".balign 4\n" \ + "1: .long 2f\n" \ + "2:" \ + : "=&r" (__dummy)); \ +} while (0) + /* For spinlocks etc */ #define local_irq_save(x) __save_and_cli(x) #define local_irq_restore(x) __restore_flags(x) diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h index b64de2cd5..65ed58fd8 100644 --- a/include/asm-sh/uaccess.h +++ b/include/asm-sh/uaccess.h @@ -1,4 +1,4 @@ -/* $Id: uaccess.h,v 1.6 1999/10/29 13:10:44 gniibe Exp $ +/* $Id: uaccess.h,v 1.10 2000/03/24 13:53:45 gniibe Exp $ * * User space memory access functions * @@ -47,7 +47,7 @@ */ #define __range_ok(addr,size) ({ \ unsigned long flag,sum; \ - __asm__("clrt; addc %3,%1; movt %0; cmp/hi %4,%1; rotcl %0" \ + __asm__("clrt; addc %3, %1; movt %0; cmp/hi %4, %1; rotcl %0" \ :"=&r" (flag), "=r" (sum) \ :"1" (addr), "r" ((int)(size)), "r" (current->addr_limit.seg)); \ flag; }) @@ -137,17 +137,17 @@ default: __get_user_unknown(); break; \ ({ \ __asm__ __volatile__( \ "1:\n\t" \ - "mov." insn " %2,%1\n\t" \ - "mov #0,%0\n" \ - "2:\n\t" \ + "mov." insn " %2, %1\n\t" \ + "mov #0, %0\n" \ + "2:\n" \ ".section .fixup,\"ax\"\n" \ "3:\n\t" \ - "mov #0,%1\n\t" \ - "mov.l 4f,%0\n\t" \ + "mov #0, %1\n\t" \ + "mov.l 4f, %0\n\t" \ "jmp @%0\n\t" \ - " mov %3,%0\n" \ + " mov %3, %0\n" \ "4: .long 2b\n\t" \ - ".previous\n\t" \ + ".previous\n" \ ".section __ex_table,\"a\"\n\t" \ ".long 1b, 3b\n\t" \ ".previous" \ @@ -189,17 +189,17 @@ default: __put_user_unknown(); break; \ ({ \ __asm__ __volatile__( \ "1:\n\t" \ - "mov." insn " %1,%2\n\t" \ - "mov #0,%0\n" \ - "2:\n\t" \ + "mov." insn " %1, %2\n\t" \ + "mov #0, %0\n" \ + "2:\n" \ ".section .fixup,\"ax\"\n" \ "3:\n\t" \ "nop\n\t" \ - "mov.l 4f,%0\n\t" \ + "mov.l 4f, %0\n\t" \ "jmp @%0\n\t" \ - "mov %3,%0\n" \ + "mov %3, %0\n" \ "4: .long 2b\n\t" \ - ".previous\n\t" \ + ".previous\n" \ ".section __ex_table,\"a\"\n\t" \ ".long 1b, 3b\n\t" \ ".previous" \ @@ -218,18 +218,18 @@ __copy_user(void *__to, const void *__from, __kernel_size_t __n) __asm__ __volatile__( "9:\n\t" - "mov.b @%2+,%1\n\t" + "mov.b @%2+, %1\n\t" "dt %0\n" "1:\n\t" - "mov.b %1,@%3\n\t" + "mov.b %1, @%3\n\t" "bf/s 9b\n\t" - " add #1,%3\n" - "2:" + " add #1, %3\n" + "2:\n" ".section .fixup,\"ax\"\n" "3:\n\t" - "mov.l 5f,%1\n\t" + "mov.l 5f, %1\n\t" "jmp @%1\n\t" - " mov %7,%0\n\t" + " mov %7, %0\n\t" ".balign 4\n" "5: .long 2b\n" ".previous\n" @@ -238,7 +238,7 @@ __copy_user(void *__to, const void *__from, __kernel_size_t __n) " .long 9b,3b\n" " .long 1b,2b\n" ".previous" - : "=&r" (res), "=&z" (__dummy), "=&r" (_f), "=&r" (_t) + : "=r" (res), "=&z" (__dummy), "=r" (_f), "=r" (_t) : "2" (__from), "3" (__to), "0" (__n), "i" (-EFAULT) : "memory"); @@ -297,23 +297,21 @@ if (__copy_from_user(to,from,n)) \ extern __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size) { - __kernel_size_t res; - unsigned long __a, __s; + unsigned long __a; __asm__ __volatile__( "9:\n\t" - "dt %2\n" + "dt %0\n" "1:\n\t" - "mov.b %5,@%1\n\t" + "mov.b %4, @%1\n\t" "bf/s 9b\n\t" - " add #1,%1\n\t" - "sub %2,%0\n" + " add #1, %1\n" "2:\n" ".section .fixup,\"ax\"\n" "3:\n\t" - "mov.l 4f,%0\n\t" - "jmp @%0\n\t" - " mov %7,%0\n" + "mov.l 4f, %1\n\t" + "jmp @%1\n\t" + " nop\n" ".balign 4\n" "4: .long 2b\n" ".previous\n" @@ -321,10 +319,10 @@ __clear_user(void *addr, __kernel_size_t size) " .balign 4\n" " .long 1b,3b\n" ".previous" - : "=&r" (res), "=&r" (__a), "=&r" (__s) - : "1" (addr), "2" (size), "r" (0), "0" (size), "i" (-EFAULT)); + : "=r" (size), "=r" (__a) + : "0" (size), "1" (addr), "r" (0)); - return res; + return size; } #define clear_user(addr,n) ({ \ @@ -342,31 +340,31 @@ __strncpy_from_user(unsigned long __dest, unsigned long __src, int __count) __asm__ __volatile__( "9:\n" - "mov.b @%2+,%1\n\t" - "cmp/eq #0,%1\n\t" + "mov.b @%2+, %1\n\t" + "cmp/eq #0, %1\n\t" "bt/s 2f\n" "1:\n" - "mov.b %1,@%3\n\t" - "dt %0\n\t" + "mov.b %1, @%3\n\t" + "dt %7\n\t" "bf/s 9b\n\t" - " add #1,%3\n\t" - "sub %6,%0\n" - "2:\n" + " add #1, %3\n\t" + "2:\n\t" + "sub %7, %0\n" + "3:\n" ".section .fixup,\"ax\"\n" - "3:\n\t" - "mov.l 4f,%1\n\t" + "4:\n\t" + "mov.l 5f, %1\n\t" "jmp @%1\n\t" - " mov %8,%0\n\t" + " mov %8, %0\n\t" ".balign 4\n" - "4: .long 2b\n" + "5: .long 3b\n" ".previous\n" ".section __ex_table,\"a\"\n" " .balign 4\n" - " .long 9b,3b\n" - " .long 1b,2b\n" + " .long 9b,4b\n" ".previous" - : "=&r" (res), "=&z" (__dummy), "=&r" (_s), "=&r" (_d) - : "2" (__src), "3" (__dest), "r" (__count), "0" (__count), + : "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d) + : "0" (__count), "2" (__src), "3" (__dest), "r" (__count), "i" (-EFAULT) : "memory"); @@ -393,19 +391,19 @@ extern __inline__ long __strnlen_user(const char *__s, long __n) __asm__ __volatile__( "9:\n" - "cmp/eq %4,%0\n\t" + "cmp/eq %4, %0\n\t" "bt 2f\n" "1:\t" - "mov.b @(%0,%3),%1\n\t" - "tst %1,%1\n\t" + "mov.b @(%0,%3), %1\n\t" + "tst %1, %1\n\t" "bf/s 9b\n\t" - " add #1,%0\n" + " add #1, %0\n" "2:\n" ".section .fixup,\"ax\"\n" "3:\n\t" - "mov.l 4f,%1\n\t" + "mov.l 4f, %1\n\t" "jmp @%1\n\t" - " mov %5,%0\n" + " mov %5, %0\n" ".balign 4\n" "4: .long 2b\n" ".previous\n" diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h index 20f5f659b..baaff1798 100644 --- a/include/asm-sh/unistd.h +++ b/include/asm-sh/unistd.h @@ -227,6 +227,8 @@ #define __NR_setfsuid32 215 #define __NR_setfsgid32 216 #define __NR_pivot_root 217 +#define __NR_mincore 218 +#define __NR_madvise 219 /* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */ diff --git a/include/asm-sh/user.h b/include/asm-sh/user.h index 243cc04fd..6888368aa 100644 --- a/include/asm-sh/user.h +++ b/include/asm-sh/user.h @@ -30,16 +30,16 @@ */ struct user_fpu_struct { - unsigned long fp_regs[NUM_FPU_REGS]; - unsigned long xf_regs[NUM_FPU_REGS]; + unsigned long fp_regs[16]; + unsigned long long xd_regs[8]; unsigned long fpscr; unsigned long fpul; }; struct user { struct pt_regs regs; /* entire machine state */ - struct user_fpu_struct fpu; /* Math Co-processor registers. */ - int u_fpvalid; /* True if math co-processor being used. */ + struct user_fpu_struct fpu; /* Math Co-processor registers */ + int u_fpvalid; /* True if math co-processor being used */ size_t u_tsize; /* text size (pages) */ size_t u_dsize; /* data size (pages) */ size_t u_ssize; /* stack size (pages) */ @@ -48,7 +48,7 @@ struct user { unsigned long start_stack; /* stack starting address */ long int signal; /* signal causing core dump */ struct regs * u_ar0; /* help gdb find registers */ - struct user_fpu_struct* u_fpstate; /* Math Co-processor pointer. */ + struct user_fpu_struct* u_fpstate; /* Math Co-processor pointer */ unsigned long magic; /* identifies a core file */ char u_comm[32]; /* user command name */ }; diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h index 71610a59f..cafd68674 100644 --- a/include/asm-sparc/io.h +++ b/include/asm-sparc/io.h @@ -1,5 +1,5 @@ /* - * $Id: io.h,v 1.25 2000/01/22 07:35:46 zaitcev Exp $ + * $Id: io.h,v 1.26 2000/03/30 01:43:26 davem Exp $ */ #ifndef __SPARC_IO_H #define __SPARC_IO_H @@ -49,6 +49,31 @@ extern __inline__ void writel(unsigned int b, unsigned long addr) { *(volatile unsigned long*)addr = flip_dword(b); } +/* Now the 'raw' versions. */ +extern __inline__ unsigned long __raw_readb(unsigned long addr) { + return *(volatile unsigned char*)addr; +} + +extern __inline__ unsigned long __raw_readw(unsigned long addr) { + return *(volatile unsigned short*)addr; +} + +extern __inline__ unsigned long __raw_readl(unsigned long addr) { + return *(volatile unsigned long*)addr; +} + +extern __inline__ void __raw_writeb(unsigned char b, unsigned long addr) { + *(volatile unsigned char*)addr = b; +} + +extern __inline__ void __raw_writew(unsigned short b, unsigned long addr) { + *(volatile unsigned short*)addr = b; +} + +extern __inline__ void __raw_writel(unsigned int b, unsigned long addr) { + *(volatile unsigned long*)addr = b; +} + /* * I/O space operations * diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h index 89cd1c3a9..18430c8d1 100644 --- a/include/asm-sparc/namei.h +++ b/include/asm-sparc/namei.h @@ -11,53 +11,16 @@ #define SPARC_BSD_EMUL "usr/gnemul/sunos/" #define SPARC_SOL_EMUL "usr/gnemul/solaris/" -static inline struct dentry * -__sparc_lookup_dentry(const char *name, int lookup_flags) +static inline char * __emul_prefix(void) { - struct dentry *base; - char *emul; - switch (current->personality) { case PER_BSD: - emul = SPARC_BSD_EMUL; break; + return SPARC_BSD_EMUL; case PER_SVR4: - emul = SPARC_SOL_EMUL; break; + return SPARC_SOL_EMUL; default: return NULL; } - - base = lookup_dentry (emul, - dget (current->fs->root), - (LOOKUP_FOLLOW | LOOKUP_DIRECTORY)); - - if (IS_ERR (base)) return NULL; - - base = lookup_dentry (name, base, lookup_flags); - - if (IS_ERR (base)) return NULL; - - if (!base->d_inode) { - struct dentry *fromroot; - - fromroot = lookup_dentry (name, dget (current->fs->root), lookup_flags); - - if (IS_ERR (fromroot)) return base; - - if (fromroot->d_inode) { - dput(base); - return fromroot; - } - - dput(fromroot); - } - - return base; } -#define __prefix_lookup_dentry(name, lookup_flags) \ - if (current->personality) { \ - dentry = __sparc_lookup_dentry (name, lookup_flags); \ - if (dentry) return dentry; \ - } - #endif /* __SPARC_NAMEI_H */ diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h index 0fc2aa247..379c8cc97 100644 --- a/include/asm-sparc/page.h +++ b/include/asm-sparc/page.h @@ -1,4 +1,4 @@ -/* $Id: page.h,v 1.51 2000/03/15 07:19:25 davem Exp $ +/* $Id: page.h,v 1.52 2000/03/28 06:07:25 anton Exp $ * page.h: Various defines and such for MMU operations on the Sparc for * the Linux kernel. * @@ -32,11 +32,20 @@ #ifndef __ASSEMBLY__ -#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; } while (0) - -#define PAGE_BUG(page) do { \ - BUG(); \ +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) +/* We need the mb()'s so we don't trigger a compiler bug - Anton */ +#define BUG() do { \ + mb(); \ + __builtin_trap(); \ + mb(); \ +} while(0) +#else +#define BUG() do { \ + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; \ } while (0) +#endif + +#define PAGE_BUG(page) BUG() #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index 8925923b0..04b34e5e9 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.93 2000/03/21 01:04:53 anton Exp $ */ +/* $Id: pgtable.h,v 1.94 2000/03/28 06:07:25 anton Exp $ */ #ifndef _SPARC_PGTABLE_H #define _SPARC_PGTABLE_H @@ -96,12 +96,18 @@ BTFIXUPDEF_SIMM13(user_ptrs_per_pgd) #define VMALLOC_START (0xfe300000) #define VMALLOC_END ~0x0UL +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) +#define pte_ERROR(e) __builtin_trap() +#define pmd_ERROR(e) __builtin_trap() +#define pgd_ERROR(e) __builtin_trap() +#else #define pte_ERROR(e) \ printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) #define pmd_ERROR(e) \ printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) #define pgd_ERROR(e) \ printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) +#endif BTFIXUPDEF_INT(page_none) BTFIXUPDEF_INT(page_shared) diff --git a/include/asm-sparc64/asm_offsets.h b/include/asm-sparc64/asm_offsets.h index 3ed7dd760..8a5eb1246 100644 --- a/include/asm-sparc64/asm_offsets.h +++ b/include/asm-sparc64/asm_offsets.h @@ -266,33 +266,39 @@ #define ASIZ_thread_w_saved 0x00000001 #define AOFF_thread_fpdepth 0x0000000d #define ASIZ_thread_fpdepth 0x00000001 -#define AOFF_thread_fpsaved 0x0000000e +#define AOFF_thread_fault_code 0x0000000e +#define ASIZ_thread_fault_code 0x00000001 +#define AOFF_thread_use_blkcommit 0x0000000f +#define ASIZ_thread_use_blkcommit 0x00000001 +#define AOFF_thread_fault_address 0x00000010 +#define ASIZ_thread_fault_address 0x00000008 +#define AOFF_thread_fpsaved 0x00000018 #define ASIZ_thread_fpsaved 0x00000007 -#define AOFF_thread___pad1 0x00000015 -#define ASIZ_thread___pad1 0x00000003 -#define AOFF_thread_kregs 0x00000018 +#define AOFF_thread___pad2 0x0000001f +#define ASIZ_thread___pad2 0x00000001 +#define AOFF_thread_kregs 0x00000020 #define ASIZ_thread_kregs 0x00000008 -#define AOFF_thread_utraps 0x00000020 +#define AOFF_thread_utraps 0x00000028 #define ASIZ_thread_utraps 0x00000008 -#define AOFF_thread_gsr 0x00000028 +#define AOFF_thread_gsr 0x00000030 #define ASIZ_thread_gsr 0x00000007 -#define AOFF_thread___pad2 0x0000002f -#define ASIZ_thread___pad2 0x00000001 -#define AOFF_thread_xfsr 0x00000030 +#define AOFF_thread___pad3 0x00000037 +#define ASIZ_thread___pad3 0x00000001 +#define AOFF_thread_xfsr 0x00000038 #define ASIZ_thread_xfsr 0x00000038 -#define AOFF_thread_reg_window 0x00000068 +#define AOFF_thread_reg_window 0x00000070 #define ASIZ_thread_reg_window 0x00000380 -#define AOFF_thread_rwbuf_stkptrs 0x000003e8 +#define AOFF_thread_rwbuf_stkptrs 0x000003f0 #define ASIZ_thread_rwbuf_stkptrs 0x00000038 -#define AOFF_thread_user_cntd0 0x00000420 +#define AOFF_thread_user_cntd0 0x00000428 #define ASIZ_thread_user_cntd0 0x00000008 -#define AOFF_thread_user_cntd1 0x00000428 +#define AOFF_thread_user_cntd1 0x00000430 #define ASIZ_thread_user_cntd1 0x00000008 -#define AOFF_thread_kernel_cntd0 0x00000430 +#define AOFF_thread_kernel_cntd0 0x00000438 #define ASIZ_thread_kernel_cntd0 0x00000008 -#define AOFF_thread_kernel_cntd1 0x00000438 +#define AOFF_thread_kernel_cntd1 0x00000440 #define ASIZ_thread_kernel_cntd1 0x00000008 -#define AOFF_thread_pcr_reg 0x00000440 +#define AOFF_thread_pcr_reg 0x00000448 #define ASIZ_thread_pcr_reg 0x00000008 #define ASIZ_thread 0x00000450 @@ -554,33 +560,39 @@ #define ASIZ_thread_w_saved 0x00000001 #define AOFF_thread_fpdepth 0x0000000d #define ASIZ_thread_fpdepth 0x00000001 -#define AOFF_thread_fpsaved 0x0000000e +#define AOFF_thread_fault_code 0x0000000e +#define ASIZ_thread_fault_code 0x00000001 +#define AOFF_thread_use_blkcommit 0x0000000f +#define ASIZ_thread_use_blkcommit 0x00000001 +#define AOFF_thread_fault_address 0x00000010 +#define ASIZ_thread_fault_address 0x00000008 +#define AOFF_thread_fpsaved 0x00000018 #define ASIZ_thread_fpsaved 0x00000007 -#define AOFF_thread___pad1 0x00000015 -#define ASIZ_thread___pad1 0x00000003 -#define AOFF_thread_kregs 0x00000018 +#define AOFF_thread___pad2 0x0000001f +#define ASIZ_thread___pad2 0x00000001 +#define AOFF_thread_kregs 0x00000020 #define ASIZ_thread_kregs 0x00000008 -#define AOFF_thread_utraps 0x00000020 +#define AOFF_thread_utraps 0x00000028 #define ASIZ_thread_utraps 0x00000008 -#define AOFF_thread_gsr 0x00000028 +#define AOFF_thread_gsr 0x00000030 #define ASIZ_thread_gsr 0x00000007 -#define AOFF_thread___pad2 0x0000002f -#define ASIZ_thread___pad2 0x00000001 -#define AOFF_thread_xfsr 0x00000030 +#define AOFF_thread___pad3 0x00000037 +#define ASIZ_thread___pad3 0x00000001 +#define AOFF_thread_xfsr 0x00000038 #define ASIZ_thread_xfsr 0x00000038 -#define AOFF_thread_reg_window 0x00000068 +#define AOFF_thread_reg_window 0x00000070 #define ASIZ_thread_reg_window 0x00000380 -#define AOFF_thread_rwbuf_stkptrs 0x000003e8 +#define AOFF_thread_rwbuf_stkptrs 0x000003f0 #define ASIZ_thread_rwbuf_stkptrs 0x00000038 -#define AOFF_thread_user_cntd0 0x00000420 +#define AOFF_thread_user_cntd0 0x00000428 #define ASIZ_thread_user_cntd0 0x00000008 -#define AOFF_thread_user_cntd1 0x00000428 +#define AOFF_thread_user_cntd1 0x00000430 #define ASIZ_thread_user_cntd1 0x00000008 -#define AOFF_thread_kernel_cntd0 0x00000430 +#define AOFF_thread_kernel_cntd0 0x00000438 #define ASIZ_thread_kernel_cntd0 0x00000008 -#define AOFF_thread_kernel_cntd1 0x00000438 +#define AOFF_thread_kernel_cntd1 0x00000440 #define ASIZ_thread_kernel_cntd1 0x00000008 -#define AOFF_thread_pcr_reg 0x00000440 +#define AOFF_thread_pcr_reg 0x00000448 #define ASIZ_thread_pcr_reg 0x00000008 #define ASIZ_thread 0x00000450 @@ -840,33 +852,39 @@ #define ASIZ_thread_w_saved 0x00000001 #define AOFF_thread_fpdepth 0x0000000d #define ASIZ_thread_fpdepth 0x00000001 -#define AOFF_thread_fpsaved 0x0000000e +#define AOFF_thread_fault_code 0x0000000e +#define ASIZ_thread_fault_code 0x00000001 +#define AOFF_thread_use_blkcommit 0x0000000f +#define ASIZ_thread_use_blkcommit 0x00000001 +#define AOFF_thread_fault_address 0x00000010 +#define ASIZ_thread_fault_address 0x00000008 +#define AOFF_thread_fpsaved 0x00000018 #define ASIZ_thread_fpsaved 0x00000007 -#define AOFF_thread___pad1 0x00000015 -#define ASIZ_thread___pad1 0x00000003 -#define AOFF_thread_kregs 0x00000018 +#define AOFF_thread___pad2 0x0000001f +#define ASIZ_thread___pad2 0x00000001 +#define AOFF_thread_kregs 0x00000020 #define ASIZ_thread_kregs 0x00000008 -#define AOFF_thread_utraps 0x00000020 +#define AOFF_thread_utraps 0x00000028 #define ASIZ_thread_utraps 0x00000008 -#define AOFF_thread_gsr 0x00000028 +#define AOFF_thread_gsr 0x00000030 #define ASIZ_thread_gsr 0x00000007 -#define AOFF_thread___pad2 0x0000002f -#define ASIZ_thread___pad2 0x00000001 -#define AOFF_thread_xfsr 0x00000030 +#define AOFF_thread___pad3 0x00000037 +#define ASIZ_thread___pad3 0x00000001 +#define AOFF_thread_xfsr 0x00000038 #define ASIZ_thread_xfsr 0x00000038 -#define AOFF_thread_reg_window 0x00000068 +#define AOFF_thread_reg_window 0x00000070 #define ASIZ_thread_reg_window 0x00000380 -#define AOFF_thread_rwbuf_stkptrs 0x000003e8 +#define AOFF_thread_rwbuf_stkptrs 0x000003f0 #define ASIZ_thread_rwbuf_stkptrs 0x00000038 -#define AOFF_thread_user_cntd0 0x00000420 +#define AOFF_thread_user_cntd0 0x00000428 #define ASIZ_thread_user_cntd0 0x00000008 -#define AOFF_thread_user_cntd1 0x00000428 +#define AOFF_thread_user_cntd1 0x00000430 #define ASIZ_thread_user_cntd1 0x00000008 -#define AOFF_thread_kernel_cntd0 0x00000430 +#define AOFF_thread_kernel_cntd0 0x00000438 #define ASIZ_thread_kernel_cntd0 0x00000008 -#define AOFF_thread_kernel_cntd1 0x00000438 +#define AOFF_thread_kernel_cntd1 0x00000440 #define ASIZ_thread_kernel_cntd1 0x00000008 -#define AOFF_thread_pcr_reg 0x00000440 +#define AOFF_thread_pcr_reg 0x00000448 #define ASIZ_thread_pcr_reg 0x00000008 #define ASIZ_thread 0x00000450 #endif /* SPIN_LOCK_DEBUG */ diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h index 6a6ec52b1..512d16410 100644 --- a/include/asm-sparc64/bitops.h +++ b/include/asm-sparc64/bitops.h @@ -1,4 +1,4 @@ -/* $Id: bitops.h,v 1.27 2000/02/09 03:28:33 davem Exp $ +/* $Id: bitops.h,v 1.28 2000/03/27 10:38:56 davem Exp $ * bitops.h: Bit string operations on the V9. * * Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu) @@ -8,132 +8,17 @@ #define _SPARC64_BITOPS_H #include <asm/byteorder.h> -#include <asm/asi.h> /* For the little endian spaces. */ -/* These can all be exported to userland, because the atomic - * primitives used are not privileged. - */ - -/* Set bit 'nr' in 64-bit quantity at address 'addr' where bit '0' - * is in the highest of the eight bytes and bit '63' is the high bit - * within the first byte. Sparc is BIG-Endian. Unless noted otherwise - * all bit-ops return 0 if bit was previously clear and != 0 otherwise. - */ +extern long __test_and_set_bit(unsigned long nr, void *addr); +extern long __test_and_clear_bit(unsigned long nr, void *addr); +extern long __test_and_change_bit(unsigned long nr, void *addr); -extern __inline__ int test_and_set_bit(unsigned long nr, void *addr) -{ - unsigned long * m = ((unsigned long *) addr) + (nr >> 6); - unsigned long oldbit; - - __asm__ __volatile__(" -1: ldx [%2], %%g7 - andcc %%g7, %1, %0 - bne,pn %%xcc, 2f - xor %%g7, %1, %%g5 - casx [%2], %%g7, %%g5 - cmp %%g7, %%g5 - bne,pn %%xcc, 1b - nop -2: -" : "=&r" (oldbit) - : "HIr" (1UL << (nr & 63)), "r" (m) - : "g5", "g7", "cc", "memory"); - return oldbit != 0; -} - -extern __inline__ void set_bit(unsigned long nr, void *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__ int test_and_clear_bit(unsigned long nr, void *addr) -{ - unsigned long * m = ((unsigned long *) addr) + (nr >> 6); - unsigned long oldbit; - - __asm__ __volatile__(" -1: ldx [%2], %%g7 - andcc %%g7, %1, %0 - be,pn %%xcc, 2f - xor %%g7, %1, %%g5 - casx [%2], %%g7, %%g5 - cmp %%g7, %%g5 - bne,pn %%xcc, 1b - nop -2: -" : "=&r" (oldbit) - : "HIr" (1UL << (nr & 63)), "r" (m) - : "g5", "g7", "cc", "memory"); - return oldbit != 0; -} - -extern __inline__ void clear_bit(unsigned long nr, void *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__ int test_and_change_bit(unsigned long nr, void *addr) -{ - unsigned long * m = ((unsigned long *) addr) + (nr >> 6); - unsigned long oldbit; - - __asm__ __volatile__(" -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) - : "g5", "g7", "cc", "memory"); - return oldbit != 0; -} - -extern __inline__ void change_bit(unsigned long nr, void *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"); -} +#define test_and_set_bit(nr,addr) (__test_and_set_bit(nr,addr)!=0) +#define test_and_clear_bit(nr,addr) (__test_and_clear_bit(nr,addr)!=0) +#define test_and_change_bit(nr,addr) (__test_and_change_bit(nr,addr)!=0) +#define set_bit(nr,addr) ((void)__test_and_set_bit(nr,addr)) +#define clear_bit(nr,addr) ((void)__test_and_clear_bit(nr,addr)) +#define change_bit(nr,addr) ((void)__test_and_change_bit(nr,addr)) extern __inline__ int test_bit(int nr, __const__ void *addr) { @@ -280,50 +165,13 @@ found_middle: #define find_first_zero_bit(addr, size) \ find_next_zero_bit((addr), (size), 0) -/* Now for the ext2 filesystem bit operations and helper routines. - * Note the usage of the little endian ASI's, werd, V9 is supreme. - */ -extern __inline__ int set_le_bit(int nr,void * addr) -{ - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); - unsigned long oldbit; - - __asm__ __volatile__(" -1: lduwa [%2] %3, %%g7 - andcc %%g7, %1, %0 - bne,pn %%icc, 2f - xor %%g7, %1, %%g5 - casa [%2] %3, %%g7, %%g5 - cmp %%g7, %%g5 - bne,pn %%icc, 1b - nop -2: -" : "=&r" (oldbit) - : "HIr" (1UL << (nr & 31)), "r" (m), "i" (ASI_PL) - : "g5", "g7", "cc", "memory"); - return oldbit != 0; -} - -extern __inline__ int clear_le_bit(int nr, void * addr) -{ - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); - unsigned long oldbit; +extern long __test_and_set_le_bit(int nr, void *addr); +extern long __test_and_clear_le_bit(int nr, void *addr); - __asm__ __volatile__(" -1: lduwa [%2] %3, %%g7 - andcc %%g7, %1, %0 - be,pn %%icc, 2f - xor %%g7, %1, %%g5 - casa [%2] %3, %%g7, %%g5 - cmp %%g7, %%g5 - bne,pn %%icc, 1b - nop -2: -" : "=&r" (oldbit) - : "HIr" (1UL << (nr & 31)), "r" (m), "i" (ASI_PL) - : "g5", "g7", "cc", "memory"); - return oldbit != 0; -} +#define test_and_set_le_bit(nr,addr) (__test_and_set_le_bit(nr,addr)!=0) +#define test_and_clear_le_bit(nr,addr) (__test_and_clear_le_bit(nr,addr)!=0) +#define set_le_bit(nr,addr) ((void)__test_and_set_le_bit(nr,addr)) +#define clear_le_bit(nr,addr) ((void)__test_and_clear_le_bit(nr,addr)) extern __inline__ int test_le_bit(int nr, __const__ void * addr) { @@ -375,8 +223,8 @@ found_middle: #ifdef __KERNEL__ -#define ext2_set_bit set_le_bit -#define ext2_clear_bit clear_le_bit +#define ext2_set_bit test_and_set_le_bit +#define ext2_clear_bit test_and_clear_le_bit #define ext2_test_bit test_le_bit #define ext2_find_first_zero_bit find_first_zero_le_bit #define ext2_find_next_zero_bit find_next_zero_le_bit diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index f8bdaa826..2ca3b4693 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h @@ -1,4 +1,4 @@ -/* $Id: io.h,v 1.33 2000/02/25 05:47:38 davem Exp $ */ +/* $Id: io.h,v 1.34 2000/03/30 01:40:54 davem Exp $ */ #ifndef __SPARC64_IO_H #define __SPARC64_IO_H @@ -156,6 +156,68 @@ extern __inline__ void _writel(unsigned int l, unsigned long addr) #define writew(__w, __addr) (_writew((__w), (unsigned long)(__addr))) #define writel(__l, __addr) (_writel((__l), (unsigned long)(__addr))) +/* Now versions without byte-swapping. */ +extern __inline__ unsigned int _raw_readb(unsigned long addr) +{ + unsigned int ret; + + __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_raw_readb */" + : "=r" (ret) + : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); + + return ret; +} + +extern __inline__ unsigned int _raw_readw(unsigned long addr) +{ + unsigned int ret; + + __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_raw_readw */" + : "=r" (ret) + : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); + + return ret; +} + +extern __inline__ unsigned int _raw_readl(unsigned long addr) +{ + unsigned int ret; + + __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_raw_readl */" + : "=r" (ret) + : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); + + return ret; +} + +extern __inline__ void _raw_writeb(unsigned char b, unsigned long addr) +{ + __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_raw_writeb */" + : /* no outputs */ + : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); +} + +extern __inline__ void _raw_writew(unsigned short w, unsigned long addr) +{ + __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_raw_writew */" + : /* no outputs */ + : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); +} + +extern __inline__ void _raw_writel(unsigned int l, unsigned long addr) +{ + __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_raw_writel */" + : /* no outputs */ + : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); +} + +#define __raw_readb(__addr) (_raw_readb((unsigned long)(__addr))) +#define __raw_readw(__addr) (_raw_readw((unsigned long)(__addr))) +#define __raw_readl(__addr) (_raw_readl((unsigned long)(__addr))) +#define __raw_writeb(__b, __addr) (_raw_writeb((__b), (unsigned long)(__addr))) +#define __raw_writew(__w, __addr) (_raw_writew((__w), (unsigned long)(__addr))) +#define __raw_writel(__l, __addr) (_raw_writel((__l), (unsigned long)(__addr))) + /* Valid I/O Space regions are anywhere, because each PCI bus supported * can live in an arbitrary area of the physical address range. */ diff --git a/include/asm-sparc64/namei.h b/include/asm-sparc64/namei.h index d3d57545c..7f6dd9495 100644 --- a/include/asm-sparc64/namei.h +++ b/include/asm-sparc64/namei.h @@ -11,53 +11,16 @@ #define SPARC_BSD_EMUL "usr/gnemul/sunos/" #define SPARC_SOL_EMUL "usr/gnemul/solaris/" -static inline struct dentry * -__sparc64_lookup_dentry(const char *name, int lookup_flags) +static inline char * __emul_prefix(void) { - struct dentry *base; - char *emul; - switch (current->personality) { case PER_BSD: - emul = SPARC_BSD_EMUL; break; + return SPARC_BSD_EMUL; case PER_SVR4: - emul = SPARC_SOL_EMUL; break; + return SPARC_SOL_EMUL; default: return NULL; } - - base = lookup_dentry (emul, - dget (current->fs->root), - (LOOKUP_FOLLOW | LOOKUP_DIRECTORY)); - - if (IS_ERR (base)) return NULL; - - base = lookup_dentry (name, base, lookup_flags); - - if (IS_ERR (base)) return NULL; - - if (!base->d_inode) { - struct dentry *fromroot; - - fromroot = lookup_dentry (name, dget (current->fs->root), lookup_flags); - - if (IS_ERR (fromroot)) return base; - - if (fromroot->d_inode) { - dput(base); - return fromroot; - } - - dput(fromroot); - } - - return base; } -#define __prefix_lookup_dentry(name, lookup_flags) \ - if (current->personality) { \ - dentry = __sparc64_lookup_dentry (name, lookup_flags); \ - if (dentry) return dentry; \ - } - #endif /* __SPARC64_NAMEI_H */ diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h index d1141d105..c17e9bf23 100644 --- a/include/asm-sparc64/pbm.h +++ b/include/asm-sparc64/pbm.h @@ -1,4 +1,4 @@ -/* $Id: pbm.h,v 1.21 2000/03/10 02:42:17 davem Exp $ +/* $Id: pbm.h,v 1.22 2000/03/25 05:18:30 davem Exp $ * pbm.h: UltraSparc PCI controller software state. * * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com) @@ -143,6 +143,10 @@ struct pci_pbm_info { struct resource io_space; struct resource mem_space; + /* State of 66MHz capabilities on this PBM. */ + int is_66mhz_capable; + int all_devs_66mhz; + /* This PBM's streaming buffer. */ struct pci_strbuf stc; diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h index fe4d9e1fa..697dc6fbc 100644 --- a/include/asm-sparc64/pgalloc.h +++ b/include/asm-sparc64/pgalloc.h @@ -70,27 +70,11 @@ 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() - -extern __inline__ void flush_tlb_mm(struct mm_struct *mm) -{ - if (CTX_VALID(mm->context)) - smp_flush_tlb_mm(mm); -} - -extern __inline__ void flush_tlb_range(struct mm_struct *mm, unsigned long start, - unsigned long end) -{ - if (CTX_VALID(mm->context)) - smp_flush_tlb_range(mm, start, end); -} - -extern __inline__ void flush_tlb_page(struct vm_area_struct *vma, unsigned long page) -{ - struct mm_struct *mm = vma->vm_mm; - - if (CTX_VALID(mm->context)) - smp_flush_tlb_page(mm, page); -} +#define flush_tlb_mm(mm) smp_flush_tlb_mm(mm) +#define flush_tlb_range(mm, start, end) \ + smp_flush_tlb_range(mm, start, end) +#define flush_tlb_page(vma, page) \ + smp_flush_tlb_page((vma)->vm_mm, page) #endif /* ! __SMP__ */ diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index 056b60f6a..0d49e700e 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.121 2000/03/02 20:37:41 davem Exp $ +/* $Id: pgtable.h,v 1.124 2000/03/27 10:38:56 davem Exp $ * pgtable.h: SpitFire page table operations. * * Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu) @@ -214,26 +214,9 @@ extern inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot) #define pte_page(x) (mem_map+pte_pagenr(x)) /* Be very careful when you change these three, they are delicate. */ -static __inline__ pte_t pte_mkyoung(pte_t _pte) -{ if(pte_val(_pte) & _PAGE_READ) - return __pte(pte_val(_pte)|(_PAGE_ACCESSED|_PAGE_R)); - else - return __pte(pte_val(_pte)|(_PAGE_ACCESSED)); -} - -static __inline__ pte_t pte_mkwrite(pte_t _pte) -{ if(pte_val(_pte) & _PAGE_MODIFIED) - return __pte(pte_val(_pte)|(_PAGE_WRITE|_PAGE_W)); - else - return __pte(pte_val(_pte)|(_PAGE_WRITE)); -} - -static __inline__ pte_t pte_mkdirty(pte_t _pte) -{ if(pte_val(_pte) & _PAGE_WRITE) - return __pte(pte_val(_pte)|(_PAGE_MODIFIED|_PAGE_W)); - else - return __pte(pte_val(_pte)|(_PAGE_MODIFIED)); -} +#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_ACCESSED | _PAGE_R)) +#define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_WRITE)) +#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_MODIFIED | _PAGE_W)) /* to find an entry in a page-table-directory. */ #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD)) @@ -256,41 +239,7 @@ extern pgd_t swapper_pg_dir[1]; #define mmu_lockarea(vaddr, len) (vaddr) #define mmu_unlockarea(vaddr, len) do { } while(0) -/* There used to be some funny code here which tried to guess which - * TLB wanted the mapping, that wasn't accurate enough to justify it's - * existance. The real way to do that is to have each TLB miss handler - * pass in a distinct code to do_sparc64_fault() and do it more accurately - * there. - * - * What we do need to handle here is prevent I-cache corruption. The - * deal is that the I-cache snoops stores from other CPUs and all DMA - * activity, however stores from the local processor are not snooped. - * The dynamic linker and our signal handler mechanism take care of - * the cases where they write into instruction space, but when a page - * is copied in the kernel and then executed in user-space is not handled - * right. This leads to corruptions if things are "just right", consider - * the following scenerio: - * 1) Process 1 frees up a page that was used for the PLT of libc in - * it's address space. - * 2) Process 2 writes into a page in the PLT of libc for the first - * time. do_wp_page() copies the page locally, the local I-cache of - * the processor does not notice the writes during the page copy. - * The new page used just so happens to be the one just freed in #1. - * 3) After the PLT write, later the cpu calls into an unresolved PLT - * entry, the CPU executes old instructions from process 1's PLT - * table. - * 4) Splat. - */ -extern void __flush_icache_page(unsigned long phys_page); -#define update_mmu_cache(__vma, __address, _pte) \ -do { \ - unsigned short __flags = ((__vma)->vm_flags); \ - if ((__flags & VM_EXEC) != 0 && \ - ((pte_val(_pte) & (_PAGE_PRESENT | _PAGE_WRITE | _PAGE_MODIFIED)) == \ - (_PAGE_PRESENT | _PAGE_WRITE | _PAGE_MODIFIED))) { \ - __flush_icache_page(pte_pagenr(_pte) << PAGE_SHIFT); \ - } \ -} while(0) +extern void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte); #define flush_icache_page(vma, pg) do { } while(0) diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h index 158fbbf39..7237736fe 100644 --- a/include/asm-sparc64/processor.h +++ b/include/asm-sparc64/processor.h @@ -1,4 +1,4 @@ -/* $Id: processor.h,v 1.61 2000/01/21 11:39:22 jj Exp $ +/* $Id: processor.h,v 1.63 2000/03/27 10:38:57 davem Exp $ * include/asm-sparc64/processor.h * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -51,15 +51,16 @@ struct thread_struct { unsigned long ksp __attribute__ ((aligned(16))); unsigned char wstate, cwp, flags; mm_segment_t current_ds; - unsigned char w_saved, fpdepth; + unsigned char w_saved, fpdepth, fault_code, use_blkcommit; + unsigned long fault_address; unsigned char fpsaved[7]; - unsigned char __pad1[3]; - struct pt_regs *kregs; + unsigned char __pad2; /* D$ line 2, 3, 4 */ + struct pt_regs *kregs; unsigned long *utraps; unsigned char gsr[7]; - unsigned char __pad2; + unsigned char __pad3; unsigned long xfsr[7]; struct reg_window reg_window[NSWINS]; @@ -73,11 +74,16 @@ struct thread_struct { #endif /* !(__ASSEMBLY__) */ -#define SPARC_FLAG_UNALIGNED 0x01 /* is allowed to do unaligned accesses */ -#define SPARC_FLAG_NEWSIGNALS 0x02 /* task wants new-style signals */ -#define SPARC_FLAG_32BIT 0x04 /* task is older 32-bit binary */ -#define SPARC_FLAG_NEWCHILD 0x08 /* task is just-spawned child process */ -#define SPARC_FLAG_PERFCTR 0x10 /* task has performance counters active */ +#define SPARC_FLAG_UNALIGNED 0x01 /* is allowed to do unaligned accesses */ +#define SPARC_FLAG_NEWSIGNALS 0x02 /* task wants new-style signals */ +#define SPARC_FLAG_32BIT 0x04 /* task is older 32-bit binary */ +#define SPARC_FLAG_NEWCHILD 0x08 /* task is just-spawned child process */ +#define SPARC_FLAG_PERFCTR 0x10 /* task has performance counters active */ + +#define FAULT_CODE_WRITE 0x01 /* Write access, implies D-TLB */ +#define FAULT_CODE_DTLB 0x02 /* Miss happened in D-TLB */ +#define FAULT_CODE_ITLB 0x04 /* Miss happened in I-TLB */ +#define FAULT_CODE_WINFIXUP 0x08 /* Miss happened during spill/fill */ #define INIT_MMAP { &init_mm, 0xfffff80000000000, 0xfffff80001000000, \ NULL, PAGE_SHARED , VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } @@ -85,10 +91,12 @@ struct thread_struct { #define INIT_THREAD { \ /* ksp, wstate, cwp, flags, current_ds, */ \ 0, 0, 0, 0, KERNEL_DS, \ -/* w_saved, fpdepth, fpsaved, pad1, kregs, */ \ - 0, 0, { 0 }, { 0 }, 0, \ -/* utraps, gsr, pad2, xfsr, */ \ - 0, { 0 }, 0, { 0 }, \ +/* w_saved, fpdepth, fault_code, use_blkcommit, */ \ + 0, 0, 0, 0, \ +/* fault_address, fpsaved, __pad2, kregs, */ \ + 0, { 0 }, 0, 0, \ +/* utraps, gsr, __pad3, xfsr, */ \ + 0, { 0 }, 0, { 0 }, \ /* reg_window */ \ { { { 0, }, { 0, } }, }, \ /* rwbuf_stkptrs */ \ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index 87379139b..1429e7772 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.56 2000/03/06 22:33:45 davem Exp $ */ +/* $Id: system.h,v 1.57 2000/03/27 10:38:57 davem Exp $ */ #ifndef __SPARC64_SYSTEM_H #define __SPARC64_SYSTEM_H @@ -131,16 +131,8 @@ extern void __global_restore_flags(unsigned long flags); extern void synchronize_user_stack(void); -extern __inline__ void flushw_user(void) -{ - __asm__ __volatile__(" - rdpr %%otherwin, %%g1 - brz,pt %%g1, 1f - mov %%o7, %%g3 - call __flushw_user - clr %%g2 -1:" : : : "g1", "g2", "g3"); -} +extern void __flushw_user(void); +#define flushw_user() __flushw_user() #define flush_user_windows flushw_user #define flush_register_windows flushw_all diff --git a/include/linux/blk.h b/include/linux/blk.h index f06443c04..fd9e46712 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -54,6 +54,11 @@ extern int ez_init(void); extern int bpcd_init(void); extern int ps2esdi_init(void); +#if defined(CONFIG_ARCH_S390) +extern int mdisk_init(void); +extern int dasd_init(void); +#endif /* CONFIG_ARCH_S390 */ + extern void set_device_ro(kdev_t dev,int flag); void add_blkdev_randomness(int major); @@ -352,6 +357,23 @@ static void floppy_off(unsigned int nr); #define DEVICE_ON(device) #define DEVICE_OFF(device) + +#elif (MAJOR_NR == MDISK_MAJOR) + +#define DEVICE_NAME "mdisk" +#define DEVICE_REQUEST mdisk_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == DASD_MAJOR) + +#define DEVICE_NAME "dasd" +#define DEVICE_REQUEST do_dasd_request +#define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #elif (MAJOR_NR == I2O_MAJOR) #define DEVICE_NAME "I2O block" diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8a05bdca2..fb673b0af 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -32,6 +32,7 @@ struct request { int errors; unsigned long sector; unsigned long nr_sectors; + unsigned long hard_sector, hard_nr_sectors; unsigned int nr_segments; unsigned int nr_hw_segments; unsigned long current_nr_sectors; diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 75d9fb540..359905839 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h @@ -14,6 +14,7 @@ */ extern unsigned long max_low_pfn; +extern unsigned long min_low_pfn; /* * node_bootmem_map is a map pointer - the bits represent all physical diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h index 4fa2e967e..97e7b59e2 100644 --- a/include/linux/cycx_x25.h +++ b/include/linux/cycx_x25.h @@ -12,6 +12,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ +* 2000/04/02 acme dprintk and cycx_debug * 1999/01/03 acme judicious use of data types * 1999/01/02 acme #define X25_ACK_N3 0x4411 * 1998/12/28 acme cleanup: lot'o'things removed @@ -30,6 +31,11 @@ #define X25_MBOX_OFFS 0x300 /* general mailbox block */ #define X25_RXMBOX_OFFS 0x340 /* receive mailbox */ +/* Debug */ +#define dprintk(level, format, a...) if (cycx_debug >= level) printk(format, ##a) + +extern unsigned int cycx_debug; + /* Data Structures */ /* X.25 Command Block. */ typedef struct X25Cmd diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 4cc4c56ce..f28b3bd9e 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -1,6 +1,9 @@ #ifndef __LINUX_DCACHE_H #define __LINUX_DCACHE_H +#include <asm/atomic.h> +#include <linux/mount.h> + #ifdef __KERNEL__ /* @@ -105,7 +108,10 @@ struct dentry_operations { * s_nfsd_free_path semaphore will be down */ -/* +/** + * d_drop - drop a dentry + * @dentry: dentry to drop + * * d_drop() unhashes the entry from the parent * dentry hashes, so that it won't be found through * a VFS lookup any more. Note that this is different @@ -118,6 +124,7 @@ struct dentry_operations { * to invalidate a dentry for some reason (NFS * timeouts or autofs deletes). */ + static __inline__ void d_drop(struct dentry * dentry) { list_del(&dentry->d_hash); @@ -164,10 +171,16 @@ extern int have_submounts(struct dentry *); * This adds the entry to the hash queues. */ extern void d_rehash(struct dentry *); -/* + +/** + * d_add - add dentry to hash queues + * @entry: dentry to add + * @inode: The inode to attach to this dentry + * * This adds the entry to the hash queues and initializes "d_inode". * The entry was actually filled in earlier during "d_alloc()" */ + static __inline__ void d_add(struct dentry * entry, struct inode * inode) { d_rehash(entry); @@ -183,10 +196,24 @@ extern struct dentry * d_lookup(struct dentry *, struct qstr *); /* validate "insecure" dentry pointer */ extern int d_validate(struct dentry *, struct dentry *, unsigned int, unsigned int); +extern char * __d_path(struct dentry *, struct vfsmount *, struct dentry *, + struct vfsmount *, char *, int); /* write full pathname into buffer and return start of pathname */ -extern char * d_path(struct dentry *, char *, int); - +#define d_path(dentry, vfsmnt, buffer, buflen) \ + __d_path(dentry, vfsmnt, current->fs->root, current->fs->rootmnt, \ + buffer, buflen) + /* Allocation counts.. */ + +/** + * dget - get a reference to a dentry + * @dentry: dentry to get a reference too + * + * Given a dentry or NULL pointer increment the reference count + * if appropriate and return the dentry. A dentry will not be + * destroyed when it has references. + */ + static __inline__ struct dentry * dget(struct dentry *dentry) { if (dentry) @@ -194,6 +221,13 @@ static __inline__ struct dentry * dget(struct dentry *dentry) return dentry; } +/** + * d_unhashed - is dentry hashed + * @dentry: entry to check + * + * Returns true if the dentry passed is not currently hashed + */ + static __inline__ int d_unhashed(struct dentry *dentry) { return list_empty(&dentry->d_hash); @@ -201,6 +235,13 @@ static __inline__ int d_unhashed(struct dentry *dentry) extern void dput(struct dentry *); +/* MOUNT_REWRITE: replace with the check for d_vfsmnt */ +static __inline__ int d_mountpoint(struct dentry *dentry) +{ + return dentry != dentry->d_mounts; +} + + #endif /* __KERNEL__ */ #endif /* __LINUX_DCACHE_H */ diff --git a/include/linux/errno.h b/include/linux/errno.h index ac2128445..653227803 100644 --- a/include/linux/errno.h +++ b/include/linux/errno.h @@ -11,6 +11,16 @@ #define ERESTARTNOHAND 514 /* restart if no handler.. */ #define ENOIOCTLCMD 515 /* No ioctl command */ +/* Defined for the NFSv3 protocol */ +#define EBADHANDLE 521 /* Illegal NFS file handle */ +#define ENOTSYNC 522 /* Update synchronization mismatch */ +#define EBADCOOKIE 523 /* Cookie is stale */ +#define ENOTSUPP 524 /* Operation is not supported */ +#define ETOOSMALL 525 /* Buffer or request is too small */ +#define ESERVERFAULT 526 /* An untranslatable error occurred */ +#define EBADTYPE 527 /* Type not supported by server */ +#define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */ + #endif #endif diff --git a/include/linux/fs.h b/include/linux/fs.h index c1d3ffe75..57bade5c6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -79,7 +79,6 @@ extern int max_super_blocks, nr_super_blocks; #define FS_NO_PRELIM 4 /* prevent preloading of dentries, even if * FS_NO_DCACHE is not set. */ -#define FS_IBASKET 8 /* FS does callback to free_ibasket() if space gets low. */ /* * These are the fs-independent mount-flags: up to 16 flags are supported @@ -456,6 +455,7 @@ struct fown_struct { struct file { struct list_head f_list; struct dentry *f_dentry; + struct vfsmount *f_vfsmnt; struct file_operations *f_op; atomic_t f_count; unsigned int f_flags; @@ -507,16 +507,24 @@ struct file_lock { struct file *fl_file; unsigned char fl_flags; unsigned char fl_type; - off_t fl_start; - off_t fl_end; + loff_t fl_start; + loff_t fl_end; void (*fl_notify)(struct file_lock *); /* unblock callback */ + void (*fl_insert)(struct file_lock *); /* lock insertion callback */ + void (*fl_remove)(struct file_lock *); /* lock removal callback */ union { struct nfs_lock_info nfs_fl; } fl_u; }; +/* The following constant reflects the upper bound of the file/locking space */ +#ifndef OFFSET_MAX +#define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1))) +#define OFFSET_MAX INT_LIMIT(loff_t) +#endif + extern struct file_lock *file_lock_table; #include <linux/fcntl.h> @@ -539,10 +547,36 @@ struct fasync_struct { struct file *fa_file; }; +struct nameidata { + struct dentry *dentry; + struct vfsmount *mnt; + struct qstr last; +}; + #define FASYNC_MAGIC 0x4601 extern int fasync_helper(int, struct file *, int, struct fasync_struct **); +#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ +#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ + +struct quota_mount_options +{ + unsigned int flags; /* Flags for diskquotas on this device */ + struct semaphore dqio_sem; /* lock device while I/O in progress */ + struct semaphore dqoff_sem; /* serialize quota_off() and quota_on() on device */ + struct file *files[MAXQUOTAS]; /* fp's to quotafiles */ + time_t inode_expire[MAXQUOTAS]; /* expiretime for inode-quota */ + time_t block_expire[MAXQUOTAS]; /* expiretime for block-quota */ + char rsquash[MAXQUOTAS]; /* for quotas threat root as any other user */ +}; + +/* + * Umount options + */ + +#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ + #include <linux/minix_fs_sb.h> #include <linux/ext2_fs_sb.h> #include <linux/hpfs_fs_sb.h> @@ -582,9 +616,6 @@ struct super_block { struct dentry *s_root; wait_queue_head_t s_wait; - struct inode *s_ibasket; - short int s_ibasket_count; - short int s_ibasket_max; struct list_head s_dirty; /* dirty inodes */ struct list_head s_files; @@ -688,7 +719,7 @@ struct inode_operations { int (*rename) (struct inode *, struct dentry *, struct inode *, struct dentry *); int (*readlink) (struct dentry *, char *,int); - struct dentry * (*follow_link) (struct dentry *, struct dentry *, unsigned int); + int (*follow_link) (struct dentry *, struct nameidata *); void (*truncate) (struct inode *); int (*permission) (struct inode *, int); int (*revalidate) (struct dentry *); @@ -812,10 +843,9 @@ extern int do_truncate(struct dentry *, loff_t start); extern int get_unused_fd(void); extern void put_unused_fd(unsigned int); -extern struct file *filp_open(const char *, int, int, struct dentry *); -extern struct file *dentry_open(struct dentry *, int); +extern struct file *filp_open(const char *, int, int); +extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); extern int filp_close(struct file *, fl_owner_t id); - extern char * getname(const char *); #define __getname() ((char *) __get_free_page(GFP_KERNEL)) #define putname(name) free_page((unsigned long)(name)) @@ -930,13 +960,8 @@ extern int get_write_access(struct inode *); extern void put_write_access(struct inode *); extern struct dentry * do_mknod(const char *, int, dev_t); extern int do_pipe(int *); -extern int do_unlink(const char * name, struct dentry *); -extern struct dentry * __open_namei(const char *, int, int, struct dentry *); -static inline struct dentry * open_namei(const char *pathname) -{ - return __open_namei(pathname, 0, 0, NULL); -} +extern int open_namei(const char *, int, int, struct nameidata *); extern int kernel_read(struct file *, unsigned long, char *, unsigned long); extern struct file * open_exec(const char *); @@ -968,6 +993,8 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *); #define LOOKUP_DIRECTORY (2) #define LOOKUP_SLASHOK (4) #define LOOKUP_CONTINUE (8) +#define LOOKUP_POSITIVE (16) +#define LOOKUP_PARENT (32) /* * "descriptor" for what we're up to with a read for sendfile(). @@ -987,12 +1014,13 @@ typedef struct { typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long); - -extern struct dentry * lookup_dentry(const char *, struct dentry *, unsigned int); +extern struct dentry * lookup_dentry(const char *, unsigned int); +extern int walk_init(const char *, unsigned, struct nameidata *); +extern int walk_name(const char *, unsigned, struct nameidata *); extern struct dentry * lookup_one(const char *, struct dentry *); extern struct dentry * __namei(const char *, unsigned int); -#define namei(pathname) __namei(pathname, 1) +#define namei(pathname) __namei(pathname, LOOKUP_FOLLOW) #define lnamei(pathname) __namei(pathname, 0) extern void iput(struct inode *); @@ -1062,9 +1090,9 @@ extern ssize_t generic_read_dir(struct file *, char *, size_t, loff_t *); extern struct file_operations generic_ro_fops; extern int vfs_readlink(struct dentry *, char *, int, const char *); -extern struct dentry *vfs_follow_link(struct dentry *, struct dentry *, unsigned, const char *); +extern int vfs_follow_link(struct nameidata *, const char *); extern int page_readlink(struct dentry *, char *, int); -extern struct dentry *page_follow_link(struct dentry *, struct dentry *, unsigned); +extern int page_follow_link(struct dentry *, struct nameidata *); extern struct inode_operations page_symlink_inode_operations; extern int vfs_readdir(struct file *, filldir_t, void *); diff --git a/include/linux/ibmtr.h b/include/linux/ibmtr.h new file mode 100644 index 000000000..3e341078b --- /dev/null +++ b/include/linux/ibmtr.h @@ -0,0 +1,454 @@ +/* Definitions for an IBM Token Ring card. */ +/* This file is distributed under the GNU GPL */ + +/* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */ + +#define TR_RETRY_INTERVAL (5*HZ) /* 500 on PC = 5 s */ +#define TR_RESET_INTERVAL (HZ/20) /* 5 on PC = 50 ms */ +#define TR_BUSY_INTERVAL (HZ/5) /* 5 on PC = 200 ms */ +#define TR_SPIN_INTERVAL (3*HZ) /* 3 seconds before init timeout */ +#define TR_RETRIES 6 /* number of open retries */ + +#define TR_ISA 1 +#define TR_MCA 2 +#define TR_ISAPNP 3 +#define NOTOK 0 +#define TOKDEBUG 1 + +#define IBMTR_SHARED_RAM_SIZE 0x10000 +#define IBMTR_IO_EXTENT 4 +#define IBMTR_MAX_ADAPTERS 2 + +#define CHANNEL_ID 0X1F30 +#define AIP 0X1F00 +#define AIPCHKSUM1 0X1F60 +#define AIPCHKSUM2 0X1FF0 +#define AIPADAPTYPE 0X1FA0 +#define AIPDATARATE 0X1FA2 +#define AIPEARLYTOKEN 0X1FA4 +#define AIPAVAILSHRAM 0X1FA6 +#define AIPSHRAMPAGE 0X1FA8 +#define AIP4MBDHB 0X1FAA +#define AIP16MBDHB 0X1FAC +#define AIPFID 0X1FBA + +/* Note, 0xA20 == 0x220 since motherboard decodes 10 bits. I left everything + the way my documentation had it, ie: 0x0A20. */ +#define ADAPTINTCNTRL 0x02f0 /* Adapter interrupt control */ +#define ADAPTRESET 0x1 /* Control Adapter reset (add to base) */ +#define ADAPTRESETREL 0x2 /* Release Adapter from reset ( """) */ +#define ADAPTINTREL 0x3 /* Adapter interrupt release */ + +#define MMIOStartLocP 0x0a20 /* Primary adapter's starting MMIO area */ +#define MMIOStartLocA 0x0a24 /* Alternate adapter's starting MMIO area */ + +#define GLOBAL_INT_ENABLE 0x02f0 + +/* MMIO bits 0-4 select register */ +#define RRR_EVEN 0x00 /* Shared RAM relocation registers - even and odd */ +/* Used to set the starting address of shared RAM */ +/* Bits 1 through 7 of this register map to bits 13 through 19 of the shared RAM address.*/ +/* ie: 0x02 sets RAM address to ...ato! issy su wazzoo !! GODZILLA!!! */ +#define RRR_ODD 0x01 +/* Bits 2 and 3 of this register can be read to determine shared RAM size */ +/* 00 for 8k, 01 for 16k, 10 for 32k, 11 for 64k */ +#define WRBR_EVEN 0x02 /* Write region base registers - even and odd */ +#define WRBR_ODD 0x03 +#define WWOR_EVEN 0x04 /* Write window open registers - even and odd */ +#define WWOR_ODD 0x05 +#define WWCR_EVEN 0x06 /* Write window close registers - even and odd */ +#define WWCR_ODD 0x07 + +/* Interrupt status registers - PC system - even and odd */ +#define ISRP_EVEN 0x08 + +#define TCR_INT 0x10 /* Bit 4 - Timer interrupt. The TVR_EVEN timer has + expired. */ +#define ERR_INT 0x08 /* Bit 3 - Error interrupt. The adapter has had an + internal error. */ +#define ACCESS_INT 0x04 /* Bit 2 - Access interrupt. You have attempted to + write to an invalid area of shared RAM or an invalid + register within the MMIO. */ +/* In addition, the following bits within ISRP_EVEN can be turned on or off by you */ +/* to control the interrupt processing: */ +#define INT_IRQ 0x80 /* Bit 7 - If 0 the adapter will issue a CHCK, if 1 and + IRQ. This should normally be set (by you) to 1. */ +#define INT_ENABLE 0x40 /* Bit 6 - Interrupt enable. If 0, no interrupts will + occur. If 1, interrupts will occur normally. + Normally set to 1. */ +/* Bit 0 - Primary or alternate adapter. Set to zero if this adapter is the primary adapter,*/ +/* 1 if this adapter is the alternate adapter. */ + + +#define ISRP_ODD 0x09 + +#define ADAP_CHK_INT 0x40 /* Bit 6 - Adapter check. the adapter has + encountered a serious problem and has closed + itself. Whoa. */ +#define SRB_RESP_INT 0x20 /* Bit 5 - SRB response. The adapter has accepted + an SRB request and set the return code within + the SRB. */ +#define ASB_FREE_INT 0x10 /* Bit 4 - ASB free. The adapter has read the ASB + and this area can be safely reused. This interrupt + is only used if your application has set the ASB + free request bit in ISRA_ODD or if an error was + detected in your response. */ +#define ARB_CMD_INT 0x08 /* Bit 3 - ARB command. The adapter has given you a + command for action. The command is located in the + ARB area of shared memory. */ +#define SSB_RESP_INT 0x04 /* Bit 2 - SSB response. The adapter has posted a + response to your SRB (the response is located in + the SSB area of shared memory). */ +/* Bit 1 - Bridge frame forward complete. */ + + + +#define ISRA_EVEN 0x0A /* Interrupt status registers - adapter - even and odd */ +/* Bit 7 - Internal parity error (on adapter's internal bus) */ +/* Bit 6 - Timer interrupt pending */ +/* Bit 5 - Access interrupt (attempt by adapter to access illegal address) */ +/* Bit 4 - Adapter microcode problem (microcode dead-man timer expired) */ +/* Bit 3 - Adapter processor check status */ +/* Bit 2 - Reserved */ +/* Bit 1 - Adapter hardware interrupt mask (prevents internal interrupts) */ +/* Bit 0 - Adapter software interrupt mask (prevents internal software interrupts) */ + +#define ISRA_ODD 0x0B +#define CMD_IN_SRB 0x20 /* Bit 5 - Indicates that you have placed a new + command in the SRB and are ready for the adapter to + process the command. */ +#define RESP_IN_ASB 0x10 /* Bit 4 - Indicates that you have placed a response + (an ASB) in the shared RAM which is available for + the adapter's use. */ +/* Bit 3 - Indicates that you are ready to put an SRB in the shared RAM, but that a previous */ +/* command is still pending. The adapter will then interrupt you when the previous */ +/* command is completed */ +/* Bit 2 - Indicates that you are ready to put an ASB in the shared RAM, but that a previous */ +/* ASB is still pending. The adapter will then interrupt you when the previous ASB */ +/* is copied. */ +#define ARB_FREE 0x2 +#define SSB_FREE 0x1 + +#define TCR_EVEN 0x0C /* Timer control registers - even and odd */ +#define TCR_ODD 0x0D +#define TVR_EVEN 0x0E /* Timer value registers - even and odd */ +#define TVR_ODD 0x0F +#define SRPR_EVEN 0x18 /* Shared RAM paging registers - even and odd */ +#define SRPR_ENABLE_PAGING 0xc0 +#define SRPR_ODD 0x19 /* Not used. */ +#define TOKREAD 0x60 +#define TOKOR 0x40 +#define TOKAND 0x20 +#define TOKWRITE 0x00 + +/* MMIO bits 5-6 select operation */ +/* 00 is used to write to a register */ +/* 01 is used to bitwise AND a byte with a register */ +/* 10 is used to bitwise OR a byte with a register */ +/* 11 is used to read from a register */ + +/* MMIO bits 7-8 select area of interest.. see below */ +/* 00 selects attachment control area. */ +/* 01 is reserved. */ +/* 10 selects adapter identification area A containing the adapter encoded address. */ +/* 11 selects the adapter identification area B containing test patterns. */ + +#define PCCHANNELID 5049434F3631313039393020 +#define MCCHANNELID 4D4152533633583435313820 + +#define ACA_OFFSET 0x1e00 +#define ACA_SET 0x40 +#define ACA_RESET 0x20 +#define ACA_RW 0x00 + +#ifdef ENABLE_PAGING +#define SET_PAGE(x) (isa_writeb((x), \ + ti->mmio + ACA_OFFSET + ACA_RW + SRPR_EVEN)) +#else +#define SET_PAGE(x) +#endif + +typedef enum { IN_PROGRESS, SUCCESS, FAILURE, CLOSED } open_state; + +/* do_tok_int possible values */ +#define FIRST_INT 1 +#define NOT_FIRST 2 + +struct tok_info { + unsigned char irq; + __u32 mmio; + unsigned char hw_address[32]; + unsigned char adapter_type; + unsigned char data_rate; + unsigned char token_release; + unsigned char avail_shared_ram; + unsigned char shared_ram_paging; + unsigned short dhb_size4mb; + unsigned short rbuf_len4; + unsigned short rbuf_cnt4; + unsigned short maxmtu4; + unsigned short dhb_size16mb; + unsigned short rbuf_len16; + unsigned short rbuf_cnt16; + unsigned short maxmtu16; + /* Additions by David Morris */ + unsigned char do_tok_int; + wait_queue_head_t wait_for_tok_int; + wait_queue_head_t wait_for_reset; + unsigned char sram_base; + /* Additions by Peter De Schrijver */ + unsigned char page_mask; /* mask to select RAM page to Map*/ + unsigned char mapped_ram_size; /* size of RAM page */ + __u32 sram; /* Shared memory base address */ + __u32 init_srb; /* Initial System Request Block address */ + __u32 srb; /* System Request Block address */ + __u32 ssb; /* System Status Block address */ + __u32 arb; /* Adapter Request Block address */ + __u32 asb; /* Adapter Status Block address */ + __u8 init_srb_page; + __u8 srb_page; + __u8 ssb_page; + __u8 arb_page; + __u8 asb_page; + unsigned short exsap_station_id; + unsigned short global_int_enable; + struct sk_buff *current_skb; + struct net_device_stats tr_stats; + unsigned char auto_ringspeedsave; + open_state open_status; + unsigned char readlog_pending; + unsigned short adapter_int_enable; /* Adapter-specific int enable */ + struct timer_list tr_timer; + unsigned char ring_speed; + __u32 func_addr; + unsigned int retry_count; + spinlock_t lock; /* SMP protection */ +}; + +/* token ring adapter commands */ +#define DIR_INTERRUPT 0x00 /* struct srb_interrupt */ +#define DIR_MOD_OPEN_PARAMS 0x01 +#define DIR_OPEN_ADAPTER 0x03 /* struct dir_open_adapter */ +#define DIR_CLOSE_ADAPTER 0x04 +#define DIR_SET_GRP_ADDR 0x06 +#define DIR_SET_FUNC_ADDR 0x07 /* struct srb_set_funct_addr */ +#define DIR_READ_LOG 0x08 /* struct srb_read_log */ +#define DLC_OPEN_SAP 0x15 /* struct dlc_open_sap */ +#define DLC_CLOSE_SAP 0x16 +#define DATA_LOST 0x20 /* struct asb_rec */ +#define REC_DATA 0x81 /* struct arb_rec_req */ +#define XMIT_DATA_REQ 0x82 /* struct arb_xmit_req */ +#define DLC_STATUS 0x83 /* struct arb_dlc_status */ +#define RING_STAT_CHANGE 0x84 /* struct dlc_open_sap ??? */ + +/* DIR_OPEN_ADAPTER options */ +#define OPEN_PASS_BCON_MAC 0x0100 +#define NUM_RCV_BUF 2 +#define RCV_BUF_LEN 1024 +#define DHB_LENGTH 2048 +#define NUM_DHB 2 +#define DLC_MAX_SAP 2 +#define DLC_MAX_STA 1 + +/* DLC_OPEN_SAP options */ +#define MAX_I_FIELD 0x0088 +#define SAP_OPEN_IND_SAP 0x04 +#define SAP_OPEN_PRIORITY 0x20 +#define SAP_OPEN_STATION_CNT 0x1 +#define XMIT_DIR_FRAME 0x0A +#define XMIT_UI_FRAME 0x0d +#define XMIT_XID_CMD 0x0e +#define XMIT_TEST_CMD 0x11 + +/* srb close return code */ +#define SIGNAL_LOSS 0x8000 +#define HARD_ERROR 0x4000 +#define XMIT_BEACON 0x1000 +#define LOBE_FAULT 0x0800 +#define AUTO_REMOVAL 0x0400 +#define REMOVE_RECV 0x0100 +#define LOG_OVERFLOW 0x0080 +#define RING_RECOVER 0x0020 + +struct srb_init_response { + unsigned char command; + unsigned char init_status; + unsigned char init_status_2; + unsigned char reserved[3]; + __u16 bring_up_code; + __u16 encoded_address; + __u16 level_address; + __u16 adapter_address; + __u16 parms_address; + __u16 mac_address; +}; + +struct dir_open_adapter { + unsigned char command; + char reserved[7]; + __u16 open_options; + unsigned char node_address[6]; + unsigned char group_address[4]; + unsigned char funct_address[4]; + __u16 num_rcv_buf; + __u16 rcv_buf_len; + __u16 dhb_length; + unsigned char num_dhb; + char reserved2; + unsigned char dlc_max_sap; + unsigned char dlc_max_sta; + unsigned char dlc_max_gsap; + unsigned char dlc_max_gmem; + unsigned char dlc_t1_tick_1; + unsigned char dlc_t2_tick_1; + unsigned char dlc_ti_tick_1; + unsigned char dlc_t1_tick_2; + unsigned char dlc_t2_tick_2; + unsigned char dlc_ti_tick_2; + unsigned char product_id[18]; +}; + +struct srb_open_response { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2[3]; + __u16 error_code; + __u16 asb_addr; + __u16 srb_addr; + __u16 arb_addr; + __u16 ssb_addr; +}; + +struct dlc_open_sap { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2; + __u16 station_id; + unsigned char timer_t1; + unsigned char timer_t2; + unsigned char timer_ti; + unsigned char maxout; + unsigned char maxin; + unsigned char maxout_incr; + unsigned char max_retry_count; + unsigned char gsap_max_mem; + __u16 max_i_field; + unsigned char sap_value; + unsigned char sap_options; + unsigned char station_count; + unsigned char sap_gsap_mem; + unsigned char gsap[0]; +}; + +struct srb_xmit { + unsigned char command; + unsigned char cmd_corr; + unsigned char ret_code; + unsigned char reserved1; + __u16 station_id; +}; + +struct srb_interrupt { + unsigned char command; + unsigned char cmd_corr; + unsigned char ret_code; +}; + +struct srb_read_log { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2; + unsigned char line_errors; + unsigned char internal_errors; + unsigned char burst_errors; + unsigned char A_C_errors; + unsigned char abort_delimiters; + unsigned char reserved3; + unsigned char lost_frames; + unsigned char recv_congest_count; + unsigned char frame_copied_errors; + unsigned char frequency_errors; + unsigned char token_errors; +}; + +struct asb_xmit_resp { + unsigned char command; + unsigned char cmd_corr; + unsigned char ret_code; + unsigned char reserved; + __u16 station_id; + __u16 frame_length; + unsigned char hdr_length; + unsigned char rsap_value; +}; + +struct arb_xmit_req { + unsigned char command; + unsigned char cmd_corr; + unsigned char reserved1[2]; + __u16 station_id; + __u16 dhb_address; +}; + +struct arb_rec_req { + unsigned char command; + unsigned char reserved1[3]; + __u16 station_id; + __u16 rec_buf_addr; + unsigned char lan_hdr_len; + unsigned char dlc_hdr_len; + __u16 frame_len; + unsigned char msg_type; +}; + +struct asb_rec { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2; + __u16 station_id; + __u16 rec_buf_addr; +}; + +struct rec_buf { + /* unsigned char reserved1[2]; */ + __u16 buf_ptr; + unsigned char reserved2; + __u16 buf_len; + unsigned char data[0]; +}; + +struct arb_dlc_status { + unsigned char command; + unsigned char reserved1[3]; + __u16 station_id; + __u16 status; + unsigned char frmr_data[5]; + unsigned char access_prio; + unsigned char rem_addr[TR_ALEN]; + unsigned char rsap_value; +}; + +struct arb_ring_stat_change { + unsigned char command; + unsigned char reserved1[5]; + __u16 ring_status; +}; + +struct srb_close_adapter { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; +}; + +struct srb_set_funct_addr { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2[3]; + unsigned char funct_address[4]; +}; + diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h index f5d80a778..38adbdcc0 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h @@ -21,7 +21,7 @@ */ /* - * ==FILEVERSION 20000115== + * ==FILEVERSION 20000324== * * NOTE TO MAINTAINERS: * If you modify this file at all, please set the above date. @@ -140,6 +140,7 @@ struct ifpppcstatsreq { #define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ #define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ #define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ +#define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ diff --git a/include/linux/input.h b/include/linux/input.h index 4cc82fbf4..17f6c046f 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -47,6 +47,35 @@ struct input_event { }; /* + * The device ID structure; + */ + +struct input_id { + __u16 bus; + __u16 vendor; + __u16 product; +}; + +/* + * Protocol version. + */ + +#define EV_VERSION 0x010000 + +/* + * IOCTLs (0x00 - 0x7f) + */ + +#define EVIOCGVERSION _IOR('E', 0x01, __u32) /* get driver version */ +#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ +#define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ +#define EVIOCSREP _IOW('E', 0x03, int[2]) /* get repeat settings */ +#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x03, len) /* get device name */ +#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ +#define EVIOCGABSLIM(num) _IOR('E', 0x40 + num, int[4]) /* get abs event limits */ +#define EVIOCGABS(num) _IOR('E', 0x80 + num, int) /* get abs value */ + +/* * Event types */ @@ -273,11 +302,12 @@ struct input_event { #define BTN_THUMB2 0x122 #define BTN_TOP 0x123 #define BTN_TOP2 0x124 -#define BTN_BASE 0x125 -#define BTN_BASE2 0x126 -#define BTN_BASE3 0x127 -#define BTN_BASE4 0x128 -#define BTN_BASE5 0x129 +#define BTN_PINKIE 0x125 +#define BTN_BASE 0x126 +#define BTN_BASE2 0x127 +#define BTN_BASE3 0x128 +#define BTN_BASE4 0x129 +#define BTN_BASE5 0x12a #define BTN_GAMEPAD 0x130 #define BTN_A 0x130 @@ -383,6 +413,7 @@ struct input_event { */ #include <linux/sched.h> +#include <linux/devfs_fs_kernel.h> #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) #define BIT(x) (1<<((x)%BITS_PER_LONG)) @@ -393,6 +424,8 @@ struct input_dev { void *private; int number; + char *name; + struct input_id id; unsigned long evbit[NBITS(EV_MAX)]; unsigned long keybit[NBITS(KEY_MAX)]; @@ -430,17 +463,21 @@ struct input_handler { void *private; void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); - int (*connect)(struct input_handler *handler, struct input_dev *dev); + struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev); void (*disconnect)(struct input_handle *handle); - struct input_handle *handle; + struct file_operations *fops; + int minor; + struct input_handle *handle; struct input_handler *next; }; struct input_handle { void *private; + + int open; struct input_dev *dev; struct input_handler *handler; @@ -455,9 +492,12 @@ void input_unregister_device(struct input_dev *); void input_register_handler(struct input_handler *); void input_unregister_handler(struct input_handler *); -void input_open_device(struct input_handle *); +int input_open_device(struct input_handle *); void input_close_device(struct input_handle *); +devfs_handle_t input_register_minor(char *name, int minor, int minor_base); +void input_unregister_minor(devfs_handle_t handle); + void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); #define input_report_key(a,b,c) input_event(a, EV_KEY, b, c) diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index d949bd649..694046eaa 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h @@ -146,12 +146,14 @@ struct nlm_host * nlm_lookup_host(struct svc_client *, struct sockaddr_in *, int, int); struct rpc_clnt * nlm_bind_host(struct nlm_host *); void nlm_rebind_host(struct nlm_host *); +struct nlm_host * nlm_get_host(struct nlm_host *); void nlm_release_host(struct nlm_host *); void nlm_shutdown_hosts(void); /* * Server-side lock handling */ +int nlmsvc_async_call(struct nlm_rqst *, u32, rpc_action); u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, struct nlm_lock *, int, struct nlm_cookie *); u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); diff --git a/include/linux/lockd/nlm.h b/include/linux/lockd/nlm.h index 4bc44e7d9..e22388d50 100644 --- a/include/linux/lockd/nlm.h +++ b/include/linux/lockd/nlm.h @@ -12,11 +12,8 @@ #include <linux/config.h> /* Maximum file offset in file_lock.fl_end */ -#ifdef OFFSET_MAX -# define NLM_OFFSET_MAX OFFSET_MAX -#else -# define NLM_OFFSET_MAX ((off_t) 0x7fffffff) -#endif +# define NLM_OFFSET_MAX ((s32) 0x7fffffff) +# define NLM4_OFFSET_MAX ((s64) ((~(u64)0) >> 1)) /* Return states for NLM */ enum { diff --git a/include/linux/mm.h b/include/linux/mm.h index 0e35a9c79..453b31d7c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -163,7 +163,7 @@ typedef struct page { #define PG_error 1 #define PG_referenced 2 #define PG_uptodate 3 -#define PG__unused_00 4 +#define PG_dirty 4 #define PG_decr_after 5 #define PG_unused_01 6 #define PG__unused_02 7 @@ -180,6 +180,8 @@ typedef struct page { #define Page_Uptodate(page) test_bit(PG_uptodate, &(page)->flags) #define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) #define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) +#define PageDirty(page) test_bit(PG_dirty, &(page)->flags) +#define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags) #define PageLocked(page) test_bit(PG_locked, &(page)->flags) #define LockPage(page) set_bit(PG_locked, &(page)->flags) #define TryLockPage(page) test_and_set_bit(PG_locked, &(page)->flags) @@ -188,7 +190,7 @@ typedef struct page { wake_up(&page->wait); \ } while (0) #define PageError(page) test_bit(PG_error, &(page)->flags) -#define SetPageError(page) test_and_set_bit(PG_error, &(page)->flags) +#define SetPageError(page) set_bit(PG_error, &(page)->flags) #define ClearPageError(page) clear_bit(PG_error, &(page)->flags) #define PageReferenced(page) test_bit(PG_referenced, &(page)->flags) #define PageDecrAfter(page) test_bit(PG_decr_after, &(page)->flags) @@ -205,6 +207,9 @@ typedef struct page { #define PageClearSwapCache(page) clear_bit(PG_swap_cache, &(page)->flags) #define PageTestandClearSwapCache(page) test_and_clear_bit(PG_swap_cache, &(page)->flags) +#define PageSwapEntry(page) test_bit(PG_swap_entry, &(page)->flags) +#define SetPageSwapEntry(page) set_bit(PG_swap_entry, &(page)->flags) +#define ClearPageSwapEntry(page) clear_bit(PG_swap_entry, &(page)->flags) #ifdef CONFIG_HIGHMEM #define PageHighMem(page) test_bit(PG_highmem, &(page)->flags) @@ -406,7 +411,8 @@ extern int check_pgt_cache(void); extern void free_area_init(unsigned long * zones_size); extern void free_area_init_node(int nid, pg_data_t *pgdat, - unsigned long * zones_size, unsigned long zone_start_paddr); + unsigned long * zones_size, unsigned long zone_start_paddr, + unsigned long *zholes_size); extern void mem_init(void); extern void show_mem(void); extern void si_meminfo(struct sysinfo * val); diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 82d3e62f4..05a846297 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -102,7 +102,7 @@ extern pg_data_t *pgdat_list; */ extern void show_free_areas_core(int); extern void free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, - unsigned long *zones_size, unsigned long paddr); + unsigned long *zones_size, unsigned long paddr, unsigned long *zholes_size); #ifndef CONFIG_DISCONTIGMEM diff --git a/include/linux/mount.h b/include/linux/mount.h index c2dcfe93f..547163d2e 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -11,20 +11,6 @@ #ifndef _LINUX_MOUNT_H #define _LINUX_MOUNT_H -#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ -#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ - -struct quota_mount_options -{ - unsigned int flags; /* Flags for diskquotas on this device */ - struct semaphore dqio_sem; /* lock device while I/O in progress */ - struct semaphore dqoff_sem; /* serialize quota_off() and quota_on() on device */ - struct file *files[MAXQUOTAS]; /* fp's to quotafiles */ - time_t inode_expire[MAXQUOTAS]; /* expiretime for inode-quota */ - time_t block_expire[MAXQUOTAS]; /* expiretime for block-quota */ - char rsquash[MAXQUOTAS]; /* for quotas threat root as any other user */ -}; - struct vfsmount { kdev_t mnt_dev; /* Device this applies to */ @@ -34,10 +20,14 @@ struct vfsmount struct vfsmount *mnt_next; /* pointer to next in linkedlist */ }; -/* - * Umount options - */ - -#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ +/* MOUNT_REWRITE: fill these */ +static inline struct vfsmount *mntget(struct vfsmount *mnt) +{ + return mnt; +} + +static inline void mntput(struct vfsmount *mnt) +{ +} #endif /* _LINUX_MOUNT_H */ diff --git a/include/linux/nbd.h b/include/linux/nbd.h index cdd77e932..c981a6911 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h @@ -15,6 +15,7 @@ #define NBD_CLEAR_QUE _IO( 0xab, 5 ) #define NBD_PRINT_DEBUG _IO( 0xab, 6 ) #define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) +#define NBD_DISCONNECT _IO( 0xab, 8 ) #ifdef MAJOR_NR diff --git a/include/linux/net.h b/include/linux/net.h index d91b6bcf6..0269a037e 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -53,12 +53,14 @@ typedef enum { SS_DISCONNECTING /* in process of disconnecting */ } socket_state; -#define SO_ACCEPTCON (1<<16) /* performed a listen */ -#define SO_WAITDATA (1<<17) /* wait data to read */ -#define SO_NOSPACE (1<<18) /* no space to write */ +#define __SO_ACCEPTCON (1<<16) /* performed a listen */ #ifdef __KERNEL__ +#define SOCK_ASYNC_NOSPACE 0 +#define SOCK_ASYNC_WAITDATA 1 +#define SOCK_NOSPACE 2 + struct socket { socket_state state; diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h index 12cf75136..178eb4c06 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/include/linux/netfilter_ipv4/ip_conntrack.h @@ -67,13 +67,13 @@ struct ip_conntrack_expect struct ip_conntrack *expectant; }; -#if defined(CONFIG_IP_NF_NAT) || defined(CONFIG_IP_NF_NAT_MODULE) +#ifdef CONFIG_IP_NF_NAT_NEEDED #include <linux/netfilter_ipv4/ip_nat.h> #endif #if defined(CONFIG_IP_NF_FTP) || defined(CONFIG_IP_NF_FTP_MODULE) #include <linux/netfilter_ipv4/ip_conntrack_ftp.h> -#if defined(CONFIG_IP_NF_NAT) || defined(CONFIG_IP_NF_NAT_MODULE) +#ifdef CONFIG_IP_NF_NAT_NEEDED #include <linux/netfilter_ipv4/ip_nat_ftp.h> #endif #endif @@ -119,7 +119,7 @@ struct ip_conntrack #endif } help; -#if defined(CONFIG_IP_NF_NAT) || defined(CONFIG_IP_NF_NAT_MODULE) +#ifdef CONFIG_IP_NF_NAT_NEEDED struct { struct ip_nat_info info; union { @@ -132,7 +132,7 @@ struct ip_conntrack int masq_index; #endif } nat; -#endif /* CONFIG_IP_NF_NAT || CONFIG_IP_NF_NAT_MODULE */ +#endif /* CONFIG_IP_NF_NAT_NEEDED */ }; diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h index a164aed4f..c5fabbbd9 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h @@ -19,7 +19,6 @@ enum ip_ct_ftp_type IP_CT_FTP_PASV = IP_CT_DIR_REPLY }; -/* Protected by ip_conntrack_lock */ /* We record seq number and length of ftp ip/port text here: all in host order. */ struct ip_ct_ftp diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h index 8bbd6230f..a78776235 100644 --- a/include/linux/netfilter_ipv4/ip_queue.h +++ b/include/linux/netfilter_ipv4/ip_queue.h @@ -2,7 +2,7 @@ * This is a module which is used for queueing IPv4 packets and * communicating with userspace via netlink. * - * (C) 2000 James Morris + * (C) 2000 James Morris, this code is GPL. */ #ifndef _IP_QUEUE_H #define _IP_QUEUE_H @@ -27,7 +27,7 @@ typedef struct ipq_packet_msg { char indev_name[IFNAMSIZ]; /* Name of incoming interface */ char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */ size_t data_len; /* Length of packet data */ - /* Optional packet data follows */ + unsigned char payload[0]; /* Optional packet data */ } ipq_packet_msg_t; /* Messages sent from userspace */ @@ -40,7 +40,7 @@ typedef struct ipq_verdict_msg { unsigned int value; /* Verdict to hand to netfilter */ unsigned long id; /* Packet ID for this verdict */ size_t data_len; /* Length of replacement data */ - /* Optional replacement data follows */ + unsigned char payload[0]; /* Optional replacement packet */ } ipq_verdict_msg_t; typedef struct ipq_peer_msg { @@ -50,37 +50,19 @@ typedef struct ipq_peer_msg { } msg; } ipq_peer_msg_t; -/* Each queued packet has one of these states */ +/* Packet delivery modes */ enum { - IPQ_PS_NEW, /* Newly arrived packet */ - IPQ_PS_WAITING, /* User has been notified of packet, - we're waiting for a verdict */ - IPQ_PS_VERDICT /* Packet has been assigned verdict, - waiting to be reinjected */ -}; -#define IPQ_PS_MAX IPQ_PS_VERDICT - -/* The queue operates in one of these states */ -enum { - IPQ_QS_HOLD, /* Hold all packets in queue */ - IPQ_QS_COPY, /* Copy metadata and/or packets to user */ - IPQ_QS_FLUSH /* Flush and drop all queue entries */ -}; -#define IPQ_QS_MAX IPQ_QS_FLUSH - -/* Modes requested by peer */ -enum { - IPQ_COPY_NONE, /* Copy nothing */ + IPQ_COPY_NONE, /* Initial mode, packets are dropped */ IPQ_COPY_META, /* Copy metadata */ IPQ_COPY_PACKET /* Copy metadata + packet (range) */ -}; +}; #define IPQ_COPY_MAX IPQ_COPY_PACKET /* Types of messages */ #define IPQM_BASE 0x10 /* standard netlink messages below this */ -#define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */ -#define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */ -#define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */ +#define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */ +#define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */ +#define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */ #define IPQM_MAX (IPQM_BASE + 4) #endif /*_IP_QUEUE_H*/ diff --git a/include/linux/netfilter_ipv4/ipt_REJECT.h b/include/linux/netfilter_ipv4/ipt_REJECT.h index 1ceebe211..eeafdf468 100644 --- a/include/linux/netfilter_ipv4/ipt_REJECT.h +++ b/include/linux/netfilter_ipv4/ipt_REJECT.h @@ -6,8 +6,7 @@ enum ipt_reject_with { IPT_ICMP_HOST_UNREACHABLE, IPT_ICMP_PROT_UNREACHABLE, IPT_ICMP_PORT_UNREACHABLE, - IPT_ICMP_ECHOREPLY, - IPT_TCP_RESET, + IPT_ICMP_ECHOREPLY }; struct ipt_reject_info { diff --git a/include/linux/nfs.h b/include/linux/nfs.h index 3dca58cbc..aa36f7bd3 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h @@ -9,6 +9,7 @@ #include <linux/sunrpc/msg_prot.h> +#define NFS_PROGRAM 100003 #define NFS_PORT 2049 #define NFS_MAXDATA 8192 #define NFS_MAXPATHLEN 1024 @@ -26,7 +27,9 @@ #define NFSMODE_SOCK 0140000 #define NFSMODE_FIFO 0010000 - +#define NFS_MNT_PROGRAM 100005 +#define NFS_MNT_PORT 627 + /* * NFS stats. The good thing with these values is that NFSv3 errors are * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which @@ -84,187 +87,27 @@ enum nfs_ftype { NFFIFO = 8 }; +#if defined(__KERNEL__) +/* + * This is the kernel NFS client file handle representation + */ +#define NFS_MAXFHSIZE 64 struct nfs_fh { - char data[NFS_FHSIZE]; + unsigned short size; + unsigned char data[NFS_MAXFHSIZE]; }; -#define NFS_PROGRAM 100003 -#define NFS_VERSION 2 -#define NFSPROC_NULL 0 -#define NFSPROC_GETATTR 1 -#define NFSPROC_SETATTR 2 -#define NFSPROC_ROOT 3 -#define NFSPROC_LOOKUP 4 -#define NFSPROC_READLINK 5 -#define NFSPROC_READ 6 -#define NFSPROC_WRITECACHE 7 -#define NFSPROC_WRITE 8 -#define NFSPROC_CREATE 9 -#define NFSPROC_REMOVE 10 -#define NFSPROC_RENAME 11 -#define NFSPROC_LINK 12 -#define NFSPROC_SYMLINK 13 -#define NFSPROC_MKDIR 14 -#define NFSPROC_RMDIR 15 -#define NFSPROC_READDIR 16 -#define NFSPROC_STATFS 17 - -/* Mount support for NFSroot */ -#ifdef __KERNEL__ -#define NFS_MNT_PROGRAM 100005 -#define NFS_MNT_VERSION 1 -#define NFS_MNT_PORT 627 -#define NFS_MNTPROC_MNT 1 -#define NFS_MNTPROC_UMNT 3 - /* * This is really a general kernel constant, but since nothing like * this is defined in the kernel headers, I have to do it here. */ #define NFS_OFFSET_MAX ((__s64)((~(__u64)0) >> 1)) -#endif /* __KERNEL__ */ - -#if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) - -extern struct rpc_program nfs_program; -extern struct rpc_stat nfs_rpcstat; - -struct nfs_time { - __u32 seconds; - __u32 useconds; -}; - -struct nfs_fattr { - enum nfs_ftype type; - __u32 mode; - __u32 nlink; - __u32 uid; - __u32 gid; - __u32 size; - __u32 blocksize; - __u32 rdev; - __u32 blocks; - __u32 fsid; - __u32 fileid; - struct nfs_time atime; - struct nfs_time mtime; - struct nfs_time ctime; -}; - -struct nfs_fsinfo { - __u32 tsize; - __u32 bsize; - __u32 blocks; - __u32 bfree; - __u32 bavail; -}; - -/* Arguments to the write call. - * Note that NFS_WRITE_MAXIOV must be <= (MAX_IOVEC-2) from sunrpc/xprt.h - */ -#define NFS_WRITE_MAXIOV 8 enum nfs3_stable_how { NFS_UNSTABLE = 0, NFS_DATA_SYNC = 1, NFS_FILE_SYNC = 2 }; - -struct nfs_writeargs { - struct nfs_fh * fh; - __u32 offset; - __u32 count; - enum nfs3_stable_how stable; - unsigned int nriov; - struct iovec iov[NFS_WRITE_MAXIOV]; -}; - -struct nfs_writeverf { - enum nfs3_stable_how committed; - __u32 verifier[2]; -}; - -struct nfs_writeres { - struct nfs_fattr * fattr; - struct nfs_writeverf * verf; - __u32 count; -}; - -#ifdef NFS_NEED_XDR_TYPES - -struct nfs_sattrargs { - struct nfs_fh * fh; - struct iattr * sattr; -}; - -struct nfs_diropargs { - struct nfs_fh * fh; - const char * name; -}; - -struct nfs_readlinkargs { - struct nfs_fh * fh; - const void * buffer; -}; - -struct nfs_readargs { - struct nfs_fh * fh; - __u32 offset; - __u32 count; - void * buffer; -}; - -struct nfs_createargs { - struct nfs_fh * fh; - const char * name; - struct iattr * sattr; -}; - -struct nfs_renameargs { - struct nfs_fh * fromfh; - const char * fromname; - struct nfs_fh * tofh; - const char * toname; -}; - -struct nfs_linkargs { - struct nfs_fh * fromfh; - struct nfs_fh * tofh; - const char * toname; -}; - -struct nfs_symlinkargs { - struct nfs_fh * fromfh; - const char * fromname; - const char * topath; - struct iattr * sattr; -}; - -struct nfs_readdirargs { - struct nfs_fh * fh; - __u32 cookie; - void * buffer; - int bufsiz; -}; - -struct nfs_diropok { - struct nfs_fh * fh; - struct nfs_fattr * fattr; -}; - -struct nfs_readres { - struct nfs_fattr * fattr; - unsigned int count; -}; - -struct nfs_readdirres { - void * buffer; - int bufsiz; - u32 cookie; -}; - -#endif /* NFS_NEED_XDR_TYPES */ #endif /* __KERNEL__ */ - -#endif +#endif /* _LINUX_NFS_H */ diff --git a/include/linux/nfs2.h b/include/linux/nfs2.h new file mode 100644 index 000000000..0ed951713 --- /dev/null +++ b/include/linux/nfs2.h @@ -0,0 +1,74 @@ +/* + * NFS protocol definitions + * + * This file contains constants for Version 2 of the protocol. + */ +#ifndef _LINUX_NFS2_H +#define _LINUX_NFS2_H + +#define NFS2_PORT 2049 +#define NFS2_MAXDATA 8192 +#define NFS2_MAXPATHLEN 1024 +#define NFS2_MAXNAMLEN 255 +#define NFS2_MAXGROUPS 16 +#define NFS2_FHSIZE 32 +#define NFS2_COOKIESIZE 4 +#define NFS2_FIFO_DEV (-1) +#define NFS2MODE_FMT 0170000 +#define NFS2MODE_DIR 0040000 +#define NFS2MODE_CHR 0020000 +#define NFS2MODE_BLK 0060000 +#define NFS2MODE_REG 0100000 +#define NFS2MODE_LNK 0120000 +#define NFS2MODE_SOCK 0140000 +#define NFS2MODE_FIFO 0010000 + + +/* NFSv2 file types - beware, these are not the same in NFSv3 */ +enum nfs2_ftype { + NF2NON = 0, + NF2REG = 1, + NF2DIR = 2, + NF2BLK = 3, + NF2CHR = 4, + NF2LNK = 5, + NF2SOCK = 6, + NF2BAD = 7, + NF2FIFO = 8 +}; + +struct nfs2_fh { + char data[NFS2_FHSIZE]; +}; + +/* + * Procedure numbers for NFSv2 + */ +#define NFS2_VERSION 2 +#define NFSPROC_NULL 0 +#define NFSPROC_GETATTR 1 +#define NFSPROC_SETATTR 2 +#define NFSPROC_ROOT 3 +#define NFSPROC_LOOKUP 4 +#define NFSPROC_READLINK 5 +#define NFSPROC_READ 6 +#define NFSPROC_WRITECACHE 7 +#define NFSPROC_WRITE 8 +#define NFSPROC_CREATE 9 +#define NFSPROC_REMOVE 10 +#define NFSPROC_RENAME 11 +#define NFSPROC_LINK 12 +#define NFSPROC_SYMLINK 13 +#define NFSPROC_MKDIR 14 +#define NFSPROC_RMDIR 15 +#define NFSPROC_READDIR 16 +#define NFSPROC_STATFS 17 + +#define NFS_MNT_PROGRAM 100005 +#define NFS_MNT_VERSION 1 +#define MNTPROC_NULL 0 +#define MNTPROC_MNT 1 +#define MNTPROC_UMNT 3 +#define MNTPROC_UMNTALL 4 + +#endif /* _LINUX_NFS2_H */ diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h index cf5405b35..1f45a9296 100644 --- a/include/linux/nfs3.h +++ b/include/linux/nfs3.h @@ -4,14 +4,12 @@ #ifndef _LINUX_NFS3_H #define _LINUX_NFS3_H -#include <linux/sunrpc/msg_prot.h> -#include <linux/nfs.h> - #define NFS3_PORT 2049 -#define NFS3_MAXDATA 8192 +#define NFS3_MAXDATA 32768 #define NFS3_MAXPATHLEN PATH_MAX #define NFS3_MAXNAMLEN NAME_MAX #define NFS3_MAXGROUPS 16 +#define NFS3_FHSIZE 64 #define NFS3_COOKIESIZE 4 #define NFS3_FIFO_DEV (-1) #define NFS3MODE_FMT 0170000 @@ -23,7 +21,6 @@ #define NFS3MODE_SOCK 0140000 #define NFS3MODE_FIFO 0010000 - /* Flags for access() call */ #define NFS3_ACCESS_READ 0x0001 #define NFS3_ACCESS_LOOKUP 0x0002 @@ -33,9 +30,11 @@ #define NFS3_ACCESS_EXECUTE 0x0020 /* Flags for create mode */ -#define NFS3_CREATE_UNCHECKED 0 -#define NFS3_CREATE_GUARDED 1 -#define NFS3_CREATE_EXCLUSIVE 2 +enum nfs3_createmode { + NFS3_CREATE_UNCHECKED = 0, + NFS3_CREATE_GUARDED = 1, + NFS3_CREATE_EXCLUSIVE = 2 +}; /* NFSv3 file system properties */ #define NFS3_FSF_LINK 0x0001 @@ -60,180 +59,41 @@ enum nfs3_ftype { }; #define NFS3_VERSION 3 -#define NFSPROC_NULL 0 -#define NFSPROC_GETATTR 1 -#define NFSPROC_SETATTR 2 -#define NFSPROC_ROOT 3 -#define NFSPROC_LOOKUP 4 -#define NFSPROC_READLINK 5 -#define NFSPROC_READ 6 -#define NFSPROC_WRITECACHE 7 -#define NFSPROC_WRITE 8 -#define NFSPROC_CREATE 9 -#define NFSPROC_REMOVE 10 -#define NFSPROC_RENAME 11 -#define NFSPROC_LINK 12 -#define NFSPROC_SYMLINK 13 -#define NFSPROC_MKDIR 14 -#define NFSPROC_RMDIR 15 -#define NFSPROC_READDIR 16 -#define NFSPROC_STATFS 17 +#define NFS3PROC_NULL 0 +#define NFS3PROC_GETATTR 1 +#define NFS3PROC_SETATTR 2 +#define NFS3PROC_LOOKUP 3 +#define NFS3PROC_ACCESS 4 +#define NFS3PROC_READLINK 5 +#define NFS3PROC_READ 6 +#define NFS3PROC_WRITE 7 +#define NFS3PROC_CREATE 8 +#define NFS3PROC_MKDIR 9 +#define NFS3PROC_SYMLINK 10 +#define NFS3PROC_MKNOD 11 +#define NFS3PROC_REMOVE 12 +#define NFS3PROC_RMDIR 13 +#define NFS3PROC_RENAME 14 +#define NFS3PROC_LINK 15 +#define NFS3PROC_READDIR 16 +#define NFS3PROC_READDIRPLUS 17 +#define NFS3PROC_FSSTAT 18 +#define NFS3PROC_FSINFO 19 +#define NFS3PROC_PATHCONF 20 +#define NFS3PROC_COMMIT 21 + +#define NFS_MNT3_PROGRAM 100005 +#define NFS_MNT3_VERSION 3 +#define MOUNTPROC3_NULL 0 +#define MOUNTPROC3_MNT 1 +#define MOUNTPROC3_UMNT 3 +#define MOUNTPROC3_UMNTALL 4 + #if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) /* Number of 32bit words in post_op_attr */ #define NFS3_POST_OP_ATTR_WORDS 22 -struct nfs3_fattr { - enum nfs3_ftype type; - __u32 mode; - __u32 nlink; - __u32 uid; - __u32 gid; - __u64 size; - __u64 used; - __u32 rdev_maj; - __u32 rdev_min; - __u32 fsid; - __u32 fileid; - struct nfs_time atime; - struct nfs_time mtime; - struct nfs_time ctime; -}; - -struct nfs3_wcc_attr { - __u64 size; - struct nfs_time mtime; - struct nfs_time ctime; -}; - -struct nfs3_wcc_data { - struct nfs3_wcc_attr before; - struct nfs3_wcc_attr after; -}; - -struct nfs3_sattr { - __u32 valid; - __u32 mode; - __u32 uid; - __u32 gid; - __u64 size; - struct nfs_time atime; - struct nfs_time mtime; -}; - -struct nfs3_entry { - __u32 fileid; - char * name; - unsigned int length; - __u32 cookie; - __u32 eof; -}; - -struct nfs3_fsinfo { - __u32 tsize; - __u32 bsize; - __u32 blocks; - __u32 bfree; - __u32 bavail; -}; - -#ifdef NFS_NEED_XDR_TYPES - -struct nfs3_sattrargs { - struct nfs_fh * fh; - struct nfs_sattr * sattr; -}; - -struct nfs3_diropargs { - struct nfs_fh * fh; - const char * name; -}; - -struct nfs3_readargs { - struct nfs_fh * fh; - __u32 offset; - __u32 count; - void * buffer; -}; - -struct nfs3_writeargs { - struct nfs_fh * fh; - __u32 offset; - __u32 count; - const void * buffer; -}; - -struct nfs3_createargs { - struct nfs_fh * fh; - const char * name; - struct nfs_sattr * sattr; -}; - -struct nfs3_renameargs { - struct nfs_fh * fromfh; - const char * fromname; - struct nfs_fh * tofh; - const char * toname; -}; - -struct nfs3_linkargs { - struct nfs_fh * fromfh; - struct nfs_fh * tofh; - const char * toname; -}; - -struct nfs3_symlinkargs { - struct nfs_fh * fromfh; - const char * fromname; - const char * topath; - struct nfs_sattr * sattr; -}; - -struct nfs3_readdirargs { - struct nfs_fh * fh; - __u32 cookie; - void * buffer; - unsigned int bufsiz; -}; - -struct nfs3_diropok { - struct nfs_fh * fh; - struct nfs_fattr * fattr; -}; - -struct nfs3_readres { - struct nfs_fattr * fattr; - unsigned int count; -}; - -struct nfs3_readlinkres { - char ** string; - unsigned int * lenp; - unsigned int maxlen; - void * buffer; -}; - -struct nfs3_readdirres { - void * buffer; - unsigned int bufsiz; -}; - -/* - * The following are for NFSv3 - */ -struct nfs3_fh { - __u32 size; - __u8 data[NFS3_FHSIZE] -}; - -struct nfs3_wcc_attr { - __u64 size; - struct nfs_time mtime; - struct nfs_time ctime; -}; - -#endif /* NFS_NEED_XDR_TYPES */ #endif /* __KERNEL__ */ - -#endif +#endif /* _LINUX_NFS3_H */ diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 19f1740f1..5f9a5dded 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -10,14 +10,16 @@ #define _LINUX_NFS_FS_H #include <linux/config.h> -#include <linux/signal.h> -#include <linux/sched.h> -#include <linux/pagemap.h> #include <linux/in.h> +#include <linux/mm.h> +#include <linux/pagemap.h> + +#include <linux/sunrpc/debug.h> -#include <linux/sunrpc/sched.h> #include <linux/nfs.h> -#include <linux/nfs_mount.h> +#include <linux/nfs2.h> +#include <linux/nfs3.h> +#include <linux/nfs_xdr.h> /* * Enable debugging support for nfs client. @@ -63,17 +65,20 @@ #define NFS_DSERVER(dentry) (&(dentry)->d_sb->u.nfs_sb.s_server) #define NFS_SERVER(inode) (&(inode)->i_sb->u.nfs_sb.s_server) #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) +#define NFS_PROTO(inode) (NFS_SERVER(inode)->rpc_ops) #define NFS_REQUESTLIST(inode) (NFS_SERVER(inode)->rw_requests) #define NFS_ADDR(inode) (RPC_PEERADDR(NFS_CLIENT(inode))) #define NFS_CONGESTED(inode) (RPC_CONGESTED(NFS_CLIENT(inode))) - +#define NFS_COOKIEVERF(inode) ((inode)->u.nfs_i.cookieverf) #define NFS_READTIME(inode) ((inode)->u.nfs_i.read_cache_jiffies) -#define NFS_OLDMTIME(inode) ((inode)->u.nfs_i.read_cache_mtime) +#define NFS_CACHE_CTIME(inode) ((inode)->u.nfs_i.read_cache_ctime) +#define NFS_CACHE_MTIME(inode) ((inode)->u.nfs_i.read_cache_mtime) +#define NFS_CACHE_ATIME(inode) ((inode)->u.nfs_i.read_cache_atime) +#define NFS_CACHE_ISIZE(inode) ((inode)->u.nfs_i.read_cache_isize) #define NFS_NEXTSCAN(inode) ((inode)->u.nfs_i.nextscan) #define NFS_CACHEINV(inode) \ do { \ - NFS_READTIME(inode) = jiffies - 1000000; \ - NFS_OLDMTIME(inode) = 0; \ + NFS_READTIME(inode) = jiffies - NFS_MAXATTRTIMEO(inode) - 1; \ } while (0) #define NFS_ATTRTIMEO(inode) ((inode)->u.nfs_i.attrtimeo) #define NFS_MINATTRTIMEO(inode) \ @@ -82,15 +87,18 @@ do { \ #define NFS_MAXATTRTIMEO(inode) \ (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ : NFS_SERVER(inode)->acregmax) +#define NFS_ATTRTIMEO_UPDATE(inode) ((inode)->u.nfs_i.attrtimeo_timestamp) #define NFS_FLAGS(inode) ((inode)->u.nfs_i.flags) #define NFS_REVALIDATING(inode) (NFS_FLAGS(inode) & NFS_INO_REVALIDATING) -#define NFS_COOKIES(inode) ((inode)->u.nfs_i.cookies) -#define NFS_DIREOF(inode) ((inode)->u.nfs_i.direof) #define NFS_FILEID(inode) ((inode)->u.nfs_i.fileid) #define NFS_FSID(inode) ((inode)->u.nfs_i.fsid) +/* Inode Flags */ +#define NFS_USE_READDIRPLUS(inode) ((NFS_FLAGS(inode) & NFS_INO_ADVISE_RDPLUS) ? 1 : 0) +#define NFS_MONOTONE_COOKIES(inode) ((NFS_SERVER(inode)->flags & NFS_NONMONOTONE_COOKIES) ? 0 : 1) + /* * These are the default flags for swap requests */ @@ -124,45 +132,6 @@ unsigned long page_index(struct page *page) } #ifdef __KERNEL__ - -/* - * linux/fs/nfs/proc.c - */ -extern int nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr); -extern int nfs_proc_setattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct iattr *sattr); -extern int nfs_proc_lookup(struct nfs_server *server, struct nfs_fh *dir, - const char *name, struct nfs_fh *fhandle, - struct nfs_fattr *fattr); -extern int nfs_proc_read(struct nfs_server *server, struct nfs_fh *fhandle, - int swap, unsigned long offset, unsigned int count, - void *buffer, struct nfs_fattr *fattr); -extern int nfs_proc_write(struct nfs_server *server, struct nfs_fh *fhandle, - int swap, unsigned long offset, unsigned int count, - const void *buffer, struct nfs_fattr *fattr); -extern int nfs_proc_create(struct nfs_server *server, struct nfs_fh *dir, - const char *name, struct iattr *sattr, - struct nfs_fh *fhandle, struct nfs_fattr *fattr); -extern int nfs_proc_remove(struct nfs_server *server, struct nfs_fh *dir, - const char *name); -extern int nfs_proc_rename(struct nfs_server *server, - struct nfs_fh *old_dir, const char *old_name, - struct nfs_fh *new_dir, const char *new_name); -extern int nfs_proc_link(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fh *dir, const char *name); -extern int nfs_proc_symlink(struct nfs_server *server, struct nfs_fh *dir, - const char *name, const char *path, - struct iattr *sattr); -extern int nfs_proc_mkdir(struct nfs_server *server, struct nfs_fh *dir, - const char *name, struct iattr *sattr, - struct nfs_fh *fhandle, struct nfs_fattr *fattr); -extern int nfs_proc_rmdir(struct nfs_server *server, struct nfs_fh *dir, - const char *name); -extern int nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fsinfo *res); - - /* * linux/fs/nfs/inode.c */ @@ -191,8 +160,6 @@ extern struct address_space_operations nfs_file_aops; extern struct inode_operations nfs_dir_inode_operations; extern struct file_operations nfs_dir_operations; extern struct dentry_operations nfs_dentry_operations; -extern void nfs_flush_dircache(struct inode *); -extern void nfs_free_dircache(struct inode *); /* * linux/fs/nfs/symlink.c @@ -244,7 +211,7 @@ nfs_wb_all(struct inode *inode) static inline int nfs_wb_page(struct inode *inode, struct page* page) { - int error = nfs_sync_file(inode, 0, page_offset(page), PAGE_CACHE_SIZE, FLUSH_WAIT | FLUSH_STABLE); + int error = nfs_sync_file(inode, 0, page_index(page), 1, FLUSH_WAIT | FLUSH_STABLE); return (error < 0) ? error : 0; } @@ -268,6 +235,7 @@ extern int nfs_readpage(struct dentry *, struct page *); * (Used only by nfsroot module) */ extern int nfs_mount(struct sockaddr_in *, char *, struct nfs_fh *); +extern int nfs3_mount(struct sockaddr_in *, char *, struct nfs_fh *); /* * inline functions @@ -281,6 +249,30 @@ nfs_revalidate_inode(struct nfs_server *server, struct dentry *dentry) return __nfs_revalidate_inode(server, dentry); } +static inline loff_t +nfs_size_to_loff_t(__u64 size) +{ + loff_t maxsz = (((loff_t) ULONG_MAX) << PAGE_CACHE_SHIFT) + PAGE_CACHE_SIZE - 1; + if (size > maxsz) + return maxsz; + return (loff_t) size; +} + +static inline ino_t +nfs_fileid_to_ino_t(u64 fileid) +{ + ino_t ino = (ino_t) fileid; + if (sizeof(ino_t) < sizeof(u64)) + ino ^= fileid >> (sizeof(u64)-sizeof(ino_t)) * 8; + return ino; +} + +static inline time_t +nfs_time_to_secs(__u64 time) +{ + return (time_t)(time >> 32); +} + /* NFS root */ extern int nfs_root_mount(struct super_block *sb); diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index d4a80639b..05e259900 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h @@ -1,8 +1,8 @@ #ifndef _NFS_FS_I #define _NFS_FS_I -#include <linux/nfs.h> -#include <linux/pipe_fs_i.h> +#include <asm/types.h> +#include <linux/list.h> /* * nfs fs inode data in memory @@ -11,8 +11,8 @@ struct nfs_inode_info { /* * The 64bit 'inode number' */ - __u32 fsid; - __u32 fileid; + __u64 fsid; + __u64 fileid; /* * Various flags @@ -37,8 +37,18 @@ struct nfs_inode_info { * mtime != read_cache_mtime */ unsigned long read_cache_jiffies; - unsigned long read_cache_mtime; + __u64 read_cache_ctime; + __u64 read_cache_mtime; + __u64 read_cache_atime; + __u64 read_cache_isize; unsigned long attrtimeo; + unsigned long attrtimeo_timestamp; + + /* + * This is the cookie verifier used for NFSv3 readdir + * operations + */ + __u32 cookieverf[2]; /* * This is the list of dirty unwritten pages. @@ -55,15 +65,12 @@ struct nfs_inode_info { struct inode *hash_next, *hash_prev; unsigned long nextscan; - - /* Readdir caching information. */ - void *cookies; - u32 direof; }; /* * Legal inode flag values */ +#define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */ #define NFS_INO_REVALIDATING 0x0004 /* revalidating attrs */ #define NFS_IS_SNAPSHOT 0x0010 /* a snapshot file */ #define NFS_INO_FLUSH 0x0020 /* inode is due for flushing */ @@ -74,6 +81,7 @@ struct nfs_inode_info { struct nfs_lock_info { u32 state; u32 flags; + struct nlm_host *host; }; /* diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 418faaa33..da76c1d62 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -1,22 +1,22 @@ #ifndef _NFS_FS_SB #define _NFS_FS_SB -#include <linux/nfs.h> -#include <linux/in.h> - /* * NFS client parameters stored in the superblock. */ struct nfs_server { struct rpc_clnt * client; /* RPC client handle */ + struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ int flags; /* various flags */ - int rsize; /* read size */ - int wsize; /* write size */ + unsigned int rsize; /* read size */ + unsigned int wsize; /* write size */ + unsigned int dtsize; /* readdir size */ unsigned int bsize; /* server block size */ unsigned int acregmin; /* attr cache timeouts */ unsigned int acregmax; unsigned int acdirmin; unsigned int acdirmax; + unsigned int namelen; char * hostname; /* remote hostname */ struct nfs_reqlist * rw_requests; /* async read/write requests */ }; @@ -26,7 +26,6 @@ struct nfs_server { */ struct nfs_sb_info { struct nfs_server s_server; - struct nfs_fh s_root; }; #endif diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h index 60493b150..8e11ef368 100644 --- a/include/linux/nfs_mount.h +++ b/include/linux/nfs_mount.h @@ -8,6 +8,8 @@ * * structure passed from user-space to kernel-space during an nfs mount */ +#include <linux/in.h> +#include <linux/nfs.h> /* * WARNING! Do not delete or change the order of these fields. If @@ -16,12 +18,12 @@ * mount-to-kernel version compatibility. Some of these aren't used yet * but here they are anyway. */ -#define NFS_MOUNT_VERSION 3 +#define NFS_MOUNT_VERSION 4 struct nfs_mount_data { int version; /* 1 */ int fd; /* 1 */ - struct nfs_fh root; /* 1 */ + struct nfs2_fh old_root; /* 1 */ int flags; /* 1 */ int rsize; /* 1 */ int wsize; /* 1 */ @@ -35,6 +37,7 @@ struct nfs_mount_data { char hostname[256]; /* 1 */ int namlen; /* 2 */ unsigned int bsize; /* 3 */ + struct nfs_fh root; /* 4 */ }; /* bits in the flags field */ @@ -49,5 +52,13 @@ struct nfs_mount_data { #define NFS_MOUNT_VER3 0x0080 /* 3 */ #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ #define NFS_MOUNT_NONLM 0x0200 /* 3 */ +#define NFS_MOUNT_FLAGMASK 0xFFFF + +/* + * Private flags - not to be set by mount program + */ +#ifdef __KERNEL__ +#define NFS_NONMONOTONE_COOKIES 0x00010000 +#endif /* __KERNEL__ */ #endif diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h new file mode 100644 index 000000000..eca3e1b2d --- /dev/null +++ b/include/linux/nfs_xdr.h @@ -0,0 +1,374 @@ +#ifndef _LINUX_NFS_XDR_H +#define _LINUX_NFS_XDR_H + +extern struct rpc_program nfs_program; +extern struct rpc_stat nfs_rpcstat; + +struct nfs_fattr { + unsigned short valid; /* which fields are valid */ + __u64 pre_size; /* pre_op_attr.size */ + __u64 pre_mtime; /* pre_op_attr.mtime */ + __u64 pre_ctime; /* pre_op_attr.ctime */ + enum nfs_ftype type; /* always use NFSv2 types */ + __u32 mode; + __u32 nlink; + __u32 uid; + __u32 gid; + __u64 size; + union { + struct { + __u32 blocksize; + __u32 blocks; + } nfs2; + struct { + __u64 used; + } nfs3; + } du; + __u32 rdev; + __u64 fsid; + __u64 fileid; + __u64 atime; + __u64 mtime; + __u64 ctime; +}; + +#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ +#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ +#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ + +/* + * Info on the file system + */ +struct nfs_fsinfo { + __u32 rtmax; /* max. read transfer size */ + __u32 rtpref; /* pref. read transfer size */ + __u32 rtmult; /* reads should be multiple of this */ + __u32 wtmax; /* max. write transfer size */ + __u32 wtpref; /* pref. write transfer size */ + __u32 wtmult; /* writes should be multiple of this */ + __u32 dtpref; /* pref. readdir transfer size */ + __u64 maxfilesize; + __u64 bsize; /* block size */ + __u64 tbytes; /* total size in bytes */ + __u64 fbytes; /* # of free bytes */ + __u64 abytes; /* # of bytes available to user */ + __u64 tfiles; /* # of files */ + __u64 ffiles; /* # of free files */ + __u64 afiles; /* # of files available to user */ + __u32 linkmax;/* max # of hard links */ + __u32 namelen;/* max name length */ +}; + +/* Arguments to the read call. + * Note that NFS_READ_MAXIOV must be <= (MAX_IOVEC-2) from sunrpc/xprt.h + */ +#define NFS_READ_MAXIOV 8 + +struct nfs_readargs { + struct nfs_fh * fh; + __u64 offset; + __u32 count; + unsigned int nriov; + struct iovec iov[NFS_READ_MAXIOV]; +}; + +struct nfs_readres { + struct nfs_fattr * fattr; + unsigned int count; + int eof; +}; + +/* Arguments to the write call. + * Note that NFS_WRITE_MAXIOV must be <= (MAX_IOVEC-2) from sunrpc/xprt.h + */ +#define NFS_WRITE_MAXIOV 8 +struct nfs_writeargs { + struct nfs_fh * fh; + __u32 offset; + __u32 count; + enum nfs3_stable_how stable; + unsigned int nriov; + struct iovec iov[NFS_WRITE_MAXIOV]; +}; + +struct nfs_writeverf { + enum nfs3_stable_how committed; + __u32 verifier[2]; +}; + +struct nfs_writeres { + struct nfs_fattr * fattr; + struct nfs_writeverf * verf; + __u32 count; +}; + +/* + * Argument struct for decode_entry function + */ +struct nfs_entry { + struct page * page; + __u64 ino; + __u64 cookie, + prev_cookie; + const char * name; + unsigned int len; + int eof; + struct nfs_fh fh; + struct nfs_fattr fattr; + unsigned long offset, + prev; +}; + +/* + * The following types are for NFSv2 only. + */ +struct nfs_sattrargs { + struct nfs_fh * fh; + struct iattr * sattr; +}; + +struct nfs_diropargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; +}; + +struct nfs_createargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; + struct iattr * sattr; +}; + +struct nfs_renameargs { + struct nfs_fh * fromfh; + const char * fromname; + unsigned int fromlen; + struct nfs_fh * tofh; + const char * toname; + unsigned int tolen; +}; + +struct nfs_linkargs { + struct nfs_fh * fromfh; + struct nfs_fh * tofh; + const char * toname; + unsigned int tolen; +}; + +struct nfs_symlinkargs { + struct nfs_fh * fromfh; + const char * fromname; + unsigned int fromlen; + const char * topath; + unsigned int tolen; + struct iattr * sattr; +}; + +struct nfs_readdirargs { + struct nfs_fh * fh; + __u32 cookie; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs_diropok { + struct nfs_fh * fh; + struct nfs_fattr * fattr; +}; + +struct nfs_readlinkargs { + struct nfs_fh * fh; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs_readlinkres { + void * buffer; + unsigned int bufsiz; +}; + +struct nfs_readdirres { + void * buffer; + unsigned int bufsiz; +}; + +struct nfs3_sattrargs { + struct nfs_fh * fh; + struct iattr * sattr; + unsigned int guard; + __u64 guardtime; +}; + +struct nfs3_diropargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; +}; + +struct nfs3_accessargs { + struct nfs_fh * fh; + __u32 access; +}; + +struct nfs3_createargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; + struct iattr * sattr; + enum nfs3_createmode createmode; + __u32 verifier[2]; +}; + +struct nfs3_mkdirargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; + struct iattr * sattr; +}; + +struct nfs3_symlinkargs { + struct nfs_fh * fromfh; + const char * fromname; + unsigned int fromlen; + const char * topath; + unsigned int tolen; + struct iattr * sattr; +}; + +struct nfs3_mknodargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; + enum nfs3_ftype type; + struct iattr * sattr; + dev_t rdev; +}; + +struct nfs3_renameargs { + struct nfs_fh * fromfh; + const char * fromname; + unsigned int fromlen; + struct nfs_fh * tofh; + const char * toname; + unsigned int tolen; +}; + +struct nfs3_linkargs { + struct nfs_fh * fromfh; + struct nfs_fh * tofh; + const char * toname; + unsigned int tolen; +}; + +struct nfs3_readdirargs { + struct nfs_fh * fh; + __u64 cookie; + __u32 verf[2]; + void * buffer; + unsigned int bufsiz; + int plus; +}; + +struct nfs3_diropres { + struct nfs_fattr * dir_attr; + struct nfs_fh * fh; + struct nfs_fattr * fattr; +}; + +struct nfs3_accessres { + struct nfs_fattr * fattr; + __u32 access; +}; + +struct nfs3_readlinkargs { + struct nfs_fh * fh; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs3_readlinkres { + struct nfs_fattr * fattr; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs3_renameres { + struct nfs_fattr * fromattr; + struct nfs_fattr * toattr; +}; + +struct nfs3_linkres { + struct nfs_fattr * dir_attr; + struct nfs_fattr * fattr; +}; + +struct nfs3_readdirres { + struct nfs_fattr * dir_attr; + __u32 * verf; + void * buffer; + unsigned int bufsiz; + int plus; +}; + +/* + * RPC procedure vector for NFSv2/NFSv3 demuxing + */ +struct nfs_rpc_ops { + int version; /* Protocol version */ + + int (*getroot) (struct nfs_server *, struct nfs_fh *, + struct nfs_fattr *); + int (*getattr) (struct dentry *, struct nfs_fattr *); + int (*setattr) (struct dentry *, struct nfs_fattr *, + struct iattr *); + int (*lookup) (struct dentry *, struct qstr *, + struct nfs_fh *, struct nfs_fattr *); + int (*access) (struct dentry *, int , int); + int (*readlink)(struct dentry *, void *, unsigned int); + int (*read) (struct dentry *, struct nfs_fattr *, + int, loff_t, unsigned int, + void *buffer, int *eofp); + int (*write) (struct dentry *, struct nfs_fattr *, + int, loff_t, unsigned int, + void *buffer, struct nfs_writeverf *verfp); + int (*commit) (struct dentry *, struct nfs_fattr *, + unsigned long, unsigned int); + int (*create) (struct dentry *, struct qstr *, struct iattr *, + int, struct nfs_fh *, struct nfs_fattr *); + int (*remove) (struct dentry *, struct qstr *); + int (*rename) (struct dentry *, struct qstr *, + struct dentry *, struct qstr *); + int (*link) (struct dentry *, struct dentry *, struct qstr *); + int (*symlink) (struct dentry *, struct qstr *, struct qstr *, + struct iattr *, struct nfs_fh *, + struct nfs_fattr *); + int (*mkdir) (struct dentry *, struct qstr *, struct iattr *, + struct nfs_fh *, struct nfs_fattr *); + int (*rmdir) (struct dentry *, struct qstr *); + int (*readdir) (struct dentry *, u64 cookie, void *, unsigned int, + int); + int (*mknod) (struct dentry *, struct qstr *, struct iattr *, + dev_t, struct nfs_fh *, struct nfs_fattr *); + int (*statfs) (struct nfs_server *, struct nfs_fh *, + struct nfs_fsinfo *); + u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); +}; + +/* + * NFS_CALL(getattr, inode, (fattr)); + * into + * NFS_PROTO(inode)->getattr(fattr); + */ +#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args + +/* + * Function vectors etc. for the NFS client + */ +extern struct nfs_rpc_ops nfs_v2_clientops; +extern struct nfs_rpc_ops nfs_v3_clientops; +extern struct rpc_version nfs_version2; +extern struct rpc_version nfs_version3; +extern struct rpc_program nfs_program; + +#endif diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h index 22c7ff1e8..f59c6a6ef 100644 --- a/include/linux/nfsd/const.h +++ b/include/linux/nfsd/const.h @@ -10,6 +10,8 @@ #define _LINUX_NFSD_CONST_H #include <linux/nfs.h> +#include <linux/nfs2.h> +#include <linux/nfs3.h> /* * Maximum protocol version supported by knfsd @@ -21,18 +23,6 @@ */ #define NFSSVC_MAXBLKSIZE 8192 -#define NFS2_MAXPATHLEN 1024 -#define NFS2_MAXNAMLEN 255 -#define NFS2_FHSIZE NFS_FHSIZE -#define NFS2_COOKIESIZE 4 - -#define NFS3_MAXPATHLEN PATH_MAX -#define NFS3_MAXNAMLEN NAME_MAX -#define NFS3_FHSIZE 64 -#define NFS3_COOKIEVERFSIZE 8 -#define NFS3_CREATEVERFSIZE 8 -#define NFS3_WRITEVERFSIZE 8 - #ifdef __KERNEL__ #ifndef NFS_SUPER_MAGIC diff --git a/include/linux/pci.h b/include/linux/pci.h index 55423de5c..a5eb6ca4c 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -340,7 +340,7 @@ struct pci_dev { struct resource dma_resource[DEVICE_COUNT_DMA]; struct resource irq_resource[DEVICE_COUNT_IRQ]; - char name[48]; /* device name */ + char name[80]; /* device name */ char slot_name[8]; /* slot name */ int active; /* ISAPnP: device is active */ int ro; /* ISAPnP: read only */ @@ -510,6 +510,7 @@ int pci_assign_resource(struct pci_dev *dev, int i); int pci_claim_resource(struct pci_dev *, int); void pci_assign_unassigned_resources(void); +void pdev_assign_unassigned_resources(struct pci_dev *dev); void pci_set_bus_ranges(void); void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), int (*)(struct pci_dev *, u8, u8)); diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h index d9ba188a0..fc39f2658 100644 --- a/include/linux/ppp_channel.h +++ b/include/linux/ppp_channel.h @@ -16,11 +16,12 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * ==FILEVERSION 20000225== + * ==FILEVERSION 20000322== */ #include <linux/list.h> #include <linux/skbuff.h> +#include <linux/poll.h> struct ppp_channel; @@ -61,7 +62,10 @@ extern int ppp_register_channel(struct ppp_channel *); /* Detach a channel from its PPP unit (e.g. on hangup). */ extern void ppp_unregister_channel(struct ppp_channel *); -/* Get the unit number associated with a channel */ +/* Get the channel number for a channel */ +extern int ppp_channel_index(struct ppp_channel *); + +/* Get the unit number associated with a channel, or -1 if none */ extern int ppp_unit_number(struct ppp_channel *); /* diff --git a/include/linux/proc_fs_i.h b/include/linux/proc_fs_i.h index 5060d08fc..d4bde0989 100644 --- a/include/linux/proc_fs_i.h +++ b/include/linux/proc_fs_i.h @@ -2,7 +2,7 @@ struct proc_inode_info { struct task_struct *task; int type; union { - struct dentry *(*proc_get_link)(struct inode *); + int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **); int (*proc_read)(struct task_struct *task, char *page); } op; struct file *file; diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h index 9478513f9..6ba4ebbcd 100644 --- a/include/linux/raid/md_u.h +++ b/include/linux/raid/md_u.h @@ -17,6 +17,12 @@ /* ioctls */ +/* compat */ +#define REGISTER_DEV _IO (MD_MAJOR, 1) +#define START_MD _IO (MD_MAJOR, 2) +#define STOP_MD _IO (MD_MAJOR, 3) + + /* status */ #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) diff --git a/include/linux/sched.h b/include/linux/sched.h index 75d010ca4..aa30e2cc1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -185,12 +185,13 @@ struct fs_struct { atomic_t count; int umask; struct dentry * root, * pwd; + struct vfsmount * rootmnt, * pwdmnt; }; #define INIT_FS { \ ATOMIC_INIT(1), \ 0022, \ - NULL, NULL \ + NULL, NULL, NULL, NULL \ } /* Maximum number of active map areas.. This is a random (large) number */ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 429089cc5..f229d4f82 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -207,20 +207,45 @@ extern __inline__ atomic_t *skb_datarefp(struct sk_buff *skb) return (atomic_t *)(skb->end); } +/** + * skb_queue_empty - check if a queue is empty + * @list: queue head + * + * Returns true if the queue is empty, false otherwise + */ + extern __inline__ int skb_queue_empty(struct sk_buff_head *list) { return (list->next == (struct sk_buff *) list); } +/** + * skb_get - reference buffer + * @skb: buffer to reference + * + * Makes another reference to a socket buffer and returns a pointer + * to the buffer. + */ + extern __inline__ struct sk_buff *skb_get(struct sk_buff *skb) { atomic_inc(&skb->users); return skb; } -/* If users==1, we are the only owner and are can avoid redundant +/* + * If users==1, we are the only owner and are can avoid redundant * atomic change. */ + +/** + * kfree_skb - free an sk_buff + * @skb: The buffer to free + * + * Drop a reference to the buffer and free it if the usage count has + * hit zero. + */ + extern __inline__ void kfree_skb(struct sk_buff *skb) { if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users)) @@ -234,16 +259,47 @@ extern __inline__ void kfree_skb_fast(struct sk_buff *skb) kfree_skbmem(skb); } +/** + * skb_cloned - is the buffer a clone + * @skb: Buffer to check + * + * Returns true if the buffer was generated with skb_clone and is + * one of multiple shared copies of the buffer. Cloned buffers are + * shared data so must not be written to under normal circumstances. + */ + extern __inline__ int skb_cloned(struct sk_buff *skb) { return skb->cloned && atomic_read(skb_datarefp(skb)) != 1; } +/** + * skb_shared - is the buffer shared + * @skb: buffer to check + * + * Returns true if more than one person has a reference to this + * buffer. + */ + extern __inline__ int skb_shared(struct sk_buff *skb) { return (atomic_read(&skb->users) != 1); } +/** + * skb_share_check - check if buffer is shared and if so clone it + * @skb: buffer to check + * @pri: priority for memory allocation + * + * If the buffer is shared the buffer is cloned and the old copy + * drops a reference. A new clone with a single reference is returned. + * If the buffer is not shared the original buffer is returned. When + * being called from interrupt status or with spinlocks held pri must + * be GFP_ATOMIC. + * + * NULL is returned on a memory allocation failure. + */ + extern __inline__ struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) { if (skb_shared(skb)) { @@ -263,6 +319,20 @@ extern __inline__ struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) * a packet thats being forwarded. */ +/** + * skb_unshare - make a copy of a shared buffer + * @skb: buffer to check + * @pri: priority for memory allocation + * + * If the socket buffer is a clone then this function creates a new + * copy of the data, drops a reference count on the old copy and returns + * the new copy with the reference count at 1. If the buffer is not a clone + * the original buffer is returned. When called with a spinlock held or + * from interrupt state pri must be GFP_ATOMIC + * + * NULL is returned on a memory allocation failure. + */ + extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) { struct sk_buff *nskb; @@ -273,11 +343,18 @@ extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) return nskb; } -/* +/** + * skb_peek + * @list_: list to peek at + * * Peek an sk_buff. Unlike most other operations you _MUST_ * be careful with this one. A peek leaves the buffer on the - * list and someone else may run off with it. For an interrupt - * type system cli() peek the buffer copy the data and sti(); + * list and someone else may run off with it. You must hold + * the appropriate locks or have a private queue to do this. + * + * Returns NULL for an empty list or a pointer to the head element. + * The reference count is not incremented and the reference is therefore + * volatile. Use with caution. */ extern __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) @@ -288,6 +365,20 @@ extern __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) return list; } +/** + * skb_peek_tail + * @list_: list to peek at + * + * Peek an sk_buff. Unlike most other operations you _MUST_ + * be careful with this one. A peek leaves the buffer on the + * list and someone else may run off with it. You must hold + * the appropriate locks or have a private queue to do this. + * + * Returns NULL for an empty list or a pointer to the tail element. + * The reference count is not incremented and the reference is therefore + * volatile. Use with caution. + */ + extern __inline__ struct sk_buff *skb_peek_tail(struct sk_buff_head *list_) { struct sk_buff *list = ((struct sk_buff *)list_)->prev; @@ -296,8 +387,11 @@ extern __inline__ struct sk_buff *skb_peek_tail(struct sk_buff_head *list_) return list; } -/* - * Return the length of an sk_buff queue +/** + * skb_queue_len - get queue length + * @list_: list to measure + * + * Return the length of an sk_buff queue. */ extern __inline__ __u32 skb_queue_len(struct sk_buff_head *list_) @@ -320,6 +414,17 @@ extern __inline__ void skb_queue_head_init(struct sk_buff_head *list) * can only be called with interrupts disabled. */ +/** + * __skb_queue_head - queue a buffer at the list head + * @list: list to use + * @newsk: buffer to queue + * + * Queue a buffer at the start of a list. This function takes no locks + * and you must therefore hold required locks before calling it. + * + * A buffer cannot be placed on two lists at the same time. + */ + extern __inline__ void __skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) { struct sk_buff *prev, *next; @@ -334,6 +439,19 @@ extern __inline__ void __skb_queue_head(struct sk_buff_head *list, struct sk_buf prev->next = newsk; } + +/** + * skb_queue_head - queue a buffer at the list head + * @list: list to use + * @newsk: buffer to queue + * + * Queue a buffer at the start of the list. This function takes the + * list lock and can be used safely with other locking sk_buff functions + * safely. + * + * A buffer cannot be placed on two lists at the same time. + */ + extern __inline__ void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) { unsigned long flags; @@ -343,9 +461,17 @@ extern __inline__ void skb_queue_head(struct sk_buff_head *list, struct sk_buff spin_unlock_irqrestore(&list->lock, flags); } -/* - * Insert an sk_buff at the end of a list. - */ +/** + * __skb_queue_tail - queue a buffer at the list tail + * @list: list to use + * @newsk: buffer to queue + * + * Queue a buffer at the end of a list. This function takes no locks + * and you must therefore hold required locks before calling it. + * + * A buffer cannot be placed on two lists at the same time. + */ + extern __inline__ void __skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) { @@ -361,6 +487,18 @@ extern __inline__ void __skb_queue_tail(struct sk_buff_head *list, struct sk_buf prev->next = newsk; } +/** + * skb_queue_tail - queue a buffer at the list tail + * @list: list to use + * @newsk: buffer to queue + * + * Queue a buffer at the tail of the list. This function takes the + * list lock and can be used safely with other locking sk_buff functions + * safely. + * + * A buffer cannot be placed on two lists at the same time. + */ + extern __inline__ void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) { unsigned long flags; @@ -370,8 +508,13 @@ extern __inline__ void skb_queue_tail(struct sk_buff_head *list, struct sk_buff spin_unlock_irqrestore(&list->lock, flags); } -/* - * Remove an sk_buff from a list. +/** + * __skb_dequeue - remove from the head of the queue + * @list: list to dequeue from + * + * Remove the head of the list. This function does not take any locks + * so must be used with appropriate locks held only. The head item is + * returned or NULL if the list is empty. */ extern __inline__ struct sk_buff *__skb_dequeue(struct sk_buff_head *list) @@ -394,6 +537,15 @@ extern __inline__ struct sk_buff *__skb_dequeue(struct sk_buff_head *list) return result; } +/** + * skb_dequeue - remove from the head of the queue + * @list: list to dequeue from + * + * Remove the head of the list. The list lock is taken so the function + * may be used safely with other locking list functions. The head item is + * returned or NULL if the list is empty. + */ + extern __inline__ struct sk_buff *skb_dequeue(struct sk_buff_head *list) { long flags; @@ -421,9 +573,16 @@ extern __inline__ void __skb_insert(struct sk_buff *newsk, list->qlen++; } -/* - * Place a packet before a given packet in a list +/** + * skb_insert - insert a buffer + * @old: buffer to insert before + * @newsk: buffer to insert + * + * Place a packet before a given packet in a list. The list locks are taken + * and this function is atomic with respect to other list locked calls + * A buffer cannot be placed on two lists at the same time. */ + extern __inline__ void skb_insert(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; @@ -442,6 +601,17 @@ extern __inline__ void __skb_append(struct sk_buff *old, struct sk_buff *newsk) __skb_insert(newsk, old, old->next, old->list); } +/** + * skb_append - append a buffer + * @old: buffer to insert after + * @newsk: buffer to insert + * + * Place a packet after a given packet in a list. The list locks are taken + * and this function is atomic with respect to other list locked calls. + * A buffer cannot be placed on two lists at the same time. + */ + + extern __inline__ void skb_append(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; @@ -455,6 +625,7 @@ extern __inline__ void skb_append(struct sk_buff *old, struct sk_buff *newsk) * remove sk_buff from list. _Must_ be called atomically, and with * the list known.. */ + extern __inline__ void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) { struct sk_buff * next, * prev; @@ -469,11 +640,17 @@ extern __inline__ void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *li prev->next = next; } -/* - * Remove an sk_buff from its list. Works even without knowing the list it - * is sitting on, which can be handy at times. It also means that THE LIST - * MUST EXIST when you unlink. Thus a list must have its contents unlinked - * _FIRST_. +/** + * skb_unlink - remove a buffer from a list + * @skb: buffer to remove + * + * Place a packet after a given packet in a list. The list locks are taken + * and this function is atomic with respect to other list locked calls + * + * Works even without knowing the list it is sitting on, which can be + * handy at times. It also means that THE LIST MUST EXIST when you + * unlink. Thus a list must have its contents unlinked before it is + * destroyed. */ extern __inline__ void skb_unlink(struct sk_buff *skb) @@ -491,6 +668,16 @@ extern __inline__ void skb_unlink(struct sk_buff *skb) } /* XXX: more streamlined implementation */ + +/** + * __skb_dequeue_tail - remove from the tail of the queue + * @list: list to dequeue from + * + * Remove the tail of the list. This function does not take any locks + * so must be used with appropriate locks held only. The tail item is + * returned or NULL if the list is empty. + */ + extern __inline__ struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) { struct sk_buff *skb = skb_peek_tail(list); @@ -499,6 +686,15 @@ extern __inline__ struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) return skb; } +/** + * skb_dequeue - remove from the head of the queue + * @list: list to dequeue from + * + * Remove the head of the list. The list lock is taken so the function + * may be used safely with other locking list functions. The tail item is + * returned or NULL if the list is empty. + */ + extern __inline__ struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list) { long flags; @@ -522,6 +718,16 @@ extern __inline__ unsigned char *__skb_put(struct sk_buff *skb, unsigned int len return tmp; } +/** + * skb_put - add data to a buffer + * @skb: buffer to use + * @len: amount of data to add + * + * This function extends the used data area of the buffer. If this would + * exceed the total buffer size the kernel will panic. A pointer to the + * first byte of the extra data is returned + */ + extern __inline__ unsigned char *skb_put(struct sk_buff *skb, unsigned int len) { unsigned char *tmp=skb->tail; @@ -540,6 +746,16 @@ extern __inline__ unsigned char *__skb_push(struct sk_buff *skb, unsigned int le return skb->data; } +/** + * skb_push - add data to the start of a buffer + * @skb: buffer to use + * @len: amount of data to add + * + * This function extends the used data area of the buffer at the buffer + * start. If this would exceed the total buffer headroom the kernel will + * panic. A pointer to the first byte of the extra data is returned + */ + extern __inline__ unsigned char *skb_push(struct sk_buff *skb, unsigned int len) { skb->data-=len; @@ -556,6 +772,17 @@ extern __inline__ char *__skb_pull(struct sk_buff *skb, unsigned int len) return skb->data+=len; } +/** + * skb_pull - remove data from the start of a buffer + * @skb: buffer to use + * @len: amount of data to remove + * + * This function removes data from the start of a buffer, returning + * the memory to the headroom. A pointer to the next data in the buffer + * is returned. Once the data has been pulled future pushes will overwrite + * the old data + */ + extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) { if (len > skb->len) @@ -563,28 +790,61 @@ extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len return __skb_pull(skb,len); } +/** + * skb_headroom - bytes at buffer head + * @skb: buffer to check + * + * Return the number of bytes of free space at the head of an sk_buff + */ + extern __inline__ int skb_headroom(const struct sk_buff *skb) { return skb->data-skb->head; } +/** + * skb_tailroom - bytes at buffer end + * @skb: buffer to check + * + * Return the number of bytes of free space at the tail of an sk_buff + */ + extern __inline__ int skb_tailroom(const struct sk_buff *skb) { return skb->end-skb->tail; } +/** + * skb_reserve - adjust headroom + * @skb: buffer to alter + * @len: bytes to move + * + * Increase the headroom of an empty sk_buff by reducing the tail + * room. This is only allowed for an empty buffer. + */ + extern __inline__ void skb_reserve(struct sk_buff *skb, unsigned int len) { skb->data+=len; skb->tail+=len; } + extern __inline__ void __skb_trim(struct sk_buff *skb, unsigned int len) { skb->len = len; skb->tail = skb->data+len; } +/** + * skb_trim - remove end from a buffer + * @skb: buffer to alter + * @len: new length + * + * Cut the length of a buffer down by removing data from the tail. If + * the buffer is already under the length specified it is not modified. + */ + extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) { if (skb->len > len) { @@ -592,6 +852,16 @@ extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) } } +/** + * skb_orphan - orphan a buffer + * @skb: buffer to orphan + * + * If a buffer currently has an owner then we call the owners + * destructor function and make the skb unowned. The buffer continues + * to exist but is no longer charged to its former owner. + */ + + extern __inline__ void skb_orphan(struct sk_buff *skb) { if (skb->destructor) @@ -600,6 +870,16 @@ extern __inline__ void skb_orphan(struct sk_buff *skb) skb->sk = NULL; } +/** + * skb_purge - empty a list + * @list: list to empty + * + * Delete all buffers on an sk_buff list. Each buffer is removed from + * the list and one reference dropped. This function takes the list + * lock and is atomic with respect to other list locking functions. + */ + + extern __inline__ void skb_queue_purge(struct sk_buff_head *list) { struct sk_buff *skb; @@ -607,6 +887,16 @@ extern __inline__ void skb_queue_purge(struct sk_buff_head *list) kfree_skb(skb); } +/** + * __skb_purge - empty a list + * @list: list to empty + * + * Delete all buffers on an sk_buff list. Each buffer is removed from + * the list and one reference dropped. This function does not take the + * list lock and the caller must hold the relevant locks to use it. + */ + + extern __inline__ void __skb_queue_purge(struct sk_buff_head *list) { struct sk_buff *skb; @@ -614,6 +904,19 @@ extern __inline__ void __skb_queue_purge(struct sk_buff_head *list) kfree_skb(skb); } +/** + * dev_alloc_skb - allocate an skbuff for sending + * @length: length to allocate + * + * Allocate a new sk_buff and assign it a usage count of one. The + * buffer has unspecified headroom built in. Users should allocate + * the headroom they think they need without accounting for the + * built in space. The built in space is used for optimisations. + * + * NULL is returned in there is no free memory. Although this function + * allocates memory it can be called from an interrupt. + */ + extern __inline__ struct sk_buff *dev_alloc_skb(unsigned int length) { struct sk_buff *skb; @@ -624,6 +927,22 @@ extern __inline__ struct sk_buff *dev_alloc_skb(unsigned int length) return skb; } +/** + * skb_cow - copy a buffer if need be + * @skb: buffer to copy + * @headroom: needed headroom + * + * If the buffer passed lacks sufficient headroom or is a clone then + * it is copied and the additional headroom made available. If there + * is no free memory NULL is returned. The new buffer is returned if + * a copy was made (and the old one dropped a reference). The existing + * buffer is returned otherwise. + * + * This function primarily exists to avoid making two copies when making + * a writable copy of a buffer and then growing the headroom. + */ + + extern __inline__ struct sk_buff * skb_cow(struct sk_buff *skb, unsigned int headroom) { diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 279636434..a45f0ae2e 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -63,6 +63,7 @@ struct rpc_task { void (*tk_callback)(struct rpc_task *); void (*tk_action)(struct rpc_task *); void (*tk_exit)(struct rpc_task *); + void (*tk_release)(struct rpc_task *); void * tk_calldata; /* diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 1e17e52bb..fb33c6b5f 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -10,6 +10,7 @@ #ifndef SUNRPC_SVC_H #define SUNRPC_SVC_H +#include <linux/in.h> #include <linux/sunrpc/types.h> #include <linux/sunrpc/xdr.h> #include <linux/sunrpc/svcauth.h> diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 5a29918e6..98bf0ec20 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -59,6 +59,7 @@ void xdr_init(void); /* * Miscellaneous XDR helper functions */ +u32 * xdr_encode_array(u32 *p, const char *s, unsigned int len); u32 * xdr_encode_string(u32 *p, const char *s); u32 * xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen); u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *); @@ -93,6 +94,9 @@ xdr_adjust_iovec(struct iovec *iov, u32 *p) return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base); } +void xdr_shift_iovec(struct iovec *, int, size_t); +void xdr_zero_iovec(struct iovec *, int, size_t); + #endif /* __KERNEL__ */ #endif /* _SUNRPC_XDR_H_ */ diff --git a/include/linux/swap.h b/include/linux/swap.h index d79fd68ef..d24ff0e0a 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -154,7 +154,7 @@ static inline int is_page_shared(struct page *page) return 1; count = page_count(page); if (PageSwapCache(page)) - count += swap_count(page) - 2; + count += swap_count(page) - 2 - !!page->buffers; return count > 1; } @@ -173,6 +173,8 @@ do { \ #define lru_cache_del(page) \ do { \ + if (!PageLocked(page)) \ + BUG(); \ spin_lock(&pagemap_lru_lock); \ list_del(&(page)->lru); \ nr_lru_pages--; \ diff --git a/include/linux/tty.h b/include/linux/tty.h index 48b7e0819..5d3d791d3 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -376,6 +376,9 @@ extern void start_tty(struct tty_struct * tty); extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc); extern int tty_register_driver(struct tty_driver *driver); extern int tty_unregister_driver(struct tty_driver *driver); +extern void tty_register_devfs (struct tty_driver *driver, unsigned int flags, + unsigned minor); +extern void tty_unregister_devfs (struct tty_driver *driver, unsigned minor); extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, int buflen); extern void tty_write_message(struct tty_struct *tty, char *msg); diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h index 47980eaaf..c1a255da9 100644 --- a/include/linux/udf_fs.h +++ b/include/linux/udf_fs.h @@ -56,12 +56,4 @@ #define udf_info(f, a...) \ printk (KERN_INFO "UDF-fs INFO " ## f, ## a); -#ifdef __KERNEL__ -/* - * Function prototypes (all other prototypes included in udfdecl.h) - */ -extern int init_udf_fs(void); - -#endif /* __KERNEL__ */ - #endif /* !defined(_LINUX_UDF_FS_H) */ diff --git a/include/linux/usb.h b/include/linux/usb.h index c011f8238..772264c52 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1,13 +1,6 @@ #ifndef __LINUX_USB_H #define __LINUX_USB_H -#include <linux/types.h> -#include <linux/ioctl.h> -#include <linux/version.h> -#include <linux/sched.h> -#include <linux/delay.h> -#include <linux/interrupt.h> /* for in_interrupt() */ - /* USB constants */ /* @@ -130,6 +123,12 @@ #ifdef __KERNEL__ +#include <linux/types.h> +#include <linux/ioctl.h> +#include <linux/version.h> +#include <linux/sched.h> +#include <linux/delay.h> +#include <linux/interrupt.h> /* for in_interrupt() */ #include <linux/config.h> #include <linux/list.h> @@ -364,10 +363,9 @@ struct usb_driver { */ typedef int (*usb_device_irq)(int, void *, int, void *); -/* -------------------------------------------------------------------------------------* - * New USB Structures * - * -------------------------------------------------------------------------------------*/ - +/*----------------------------------------------------------------------------* + * New USB Structures * + *----------------------------------------------------------------------------*/ #define USB_DISABLE_SPD 0x0001 #define USB_ISO_ASAP 0x0002 @@ -499,7 +497,7 @@ struct irq_wrapper_data { usb_device_irq handler; }; -/* ------------------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ struct usb_operations { int (*allocate)(struct usb_device *); @@ -712,6 +710,7 @@ static inline unsigned int __default_pipe(struct usb_device *dev) * Send and receive control messages.. */ int usb_new_device(struct usb_device *dev); +int usb_reset_device(struct usb_device *dev); int usb_set_address(struct usb_device *dev); int usb_get_descriptor(struct usb_device *dev, unsigned char desctype, unsigned char descindex, void *buf, int size); diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h new file mode 100644 index 000000000..95eaa937a --- /dev/null +++ b/include/linux/usbdevice_fs.h @@ -0,0 +1,170 @@ +/*****************************************************************************/ + +/* + * usbdevice_fs.h -- USB device file system. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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. + * + * History: + * 0.1 04.01.2000 Created + * + * $Id: usbdevice_fs.h,v 1.1 2000/01/06 18:40:41 tom Exp $ + */ + +/*****************************************************************************/ + +#ifndef _LINUX_USBDEVICE_FS_H +#define _LINUX_USBDEVICE_FS_H + +/* --------------------------------------------------------------------- */ + +#define USBDEVICE_SUPER_MAGIC 0x9fa2 + +/* usbdevfs ioctl codes */ + +struct usbdevfs_ctrltransfer { + __u8 requesttype; + __u8 request; + __u16 value; + __u16 index; + __u16 length; + __u32 timeout; /* in milliseconds */ + void *data; +}; + +struct usbdevfs_bulktransfer { + unsigned int ep; + unsigned int len; + unsigned int timeout; /* in milliseconds */ + void *data; +}; + +struct usbdevfs_setinterface { + unsigned int interface; + unsigned int altsetting; +}; + +struct usbdevfs_disconnectsignal { + unsigned int signr; + void *context; +}; + +#define USBDEVFS_URB_DISABLE_SPD 1 +#define USBDEVFS_URB_ISO_ASAP 2 + +#define USBDEVFS_URB_TYPE_ISO 0 +#define USBDEVFS_URB_TYPE_INTERRUPT 1 +#define USBDEVFS_URB_TYPE_CONTROL 2 +#define USBDEVFS_URB_TYPE_BULK 3 + +struct usbdevfs_iso_packet_desc { + unsigned int length; + unsigned int actual_length; + unsigned int status; +}; + +struct usbdevfs_urb { + unsigned char type; + unsigned char endpoint; + int status; + unsigned int flags; + void *buffer; + int buffer_length; + int actual_length; + int start_frame; + int number_of_packets; + int error_count; + unsigned int signr; /* signal to be sent on error, -1 if none should be sent */ + void *usercontext; + struct usbdevfs_iso_packet_desc iso_frame_desc[0]; +}; + +#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) +#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) +#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) +#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) +#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) +#define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb) +#define USBDEVFS_DISCARDURB _IO('U', 11) +#define USBDEVFS_REAPURB _IOW('U', 12, void *) +#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) +#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) +#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) +#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) + +/* --------------------------------------------------------------------- */ + +#ifdef __KERNEL__ + +#include <linux/list.h> +#include <asm/semaphore.h> + +/* + * inode number macros + */ +#define ITYPE(x) ((x)&(0xf<<28)) +#define ISPECIAL (0<<28) +#define IBUS (1<<28) +#define IDEVICE (2<<28) +#define IBUSNR(x) (((x)>>8)&0xff) +#define IDEVNR(x) ((x)&0xff) + +#define IROOT 1 + +/* + * sigh. rwsemaphores do not (yet) work from modules + */ + +#define rw_semaphore semaphore +#define init_rwsem init_MUTEX +#define down_read down +#define down_write down +#define up_read up +#define up_write up + + +struct dev_state { + struct list_head list; /* state list */ + struct rw_semaphore devsem; /* protects modifications to dev (dev == NULL indicating disconnect) */ + struct usb_device *dev; + struct file *file; + spinlock_t lock; /* protects the async urb lists */ + struct list_head async_pending; + struct list_head async_completed; + wait_queue_head_t wait; /* wake up if a request completed */ + unsigned int discsignr; + struct task_struct *disctask; + void *disccontext; + unsigned long ifclaimed; +}; + +/* internal methods & data */ +extern struct usb_driver usbdevfs_driver; +extern struct file_operations usbdevfs_drivers_fops; +extern struct file_operations usbdevfs_devices_fops; +extern struct file_operations usbdevfs_device_file_operations; +extern struct inode_operations usbdevfs_device_inode_operations; +extern struct inode_operations usbdevfs_bus_inode_operations; +extern struct file_operations usbdevfs_bus_file_operations; +extern void usbdevfs_conn_disc_event(void); + + +#endif /* __KERNEL__ */ + +/* --------------------------------------------------------------------- */ +#endif /* _LINUX_USBDEVICE_FS_H */ diff --git a/include/net/sock.h b/include/net/sock.h index 6782beca0..9b7720969 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -263,10 +263,11 @@ struct tcp_opt { __u16 mss_cache; /* Cached effective mss, not including SACKS */ __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ - __u8 dup_acks; /* Consequetive duplicate acks seen from other end */ + __u8 dup_acks; /* Consecutive duplicate acks seen from other end */ __u8 retransmits; - __u16 __empty1; + __u8 __empty1; + __u8 sorry; __u8 defer_accept; /* RTT measurement */ @@ -726,7 +727,7 @@ do { spin_lock_bh(&((__sk)->lock.slock)); \ if ((__sk)->backlog.tail != NULL) \ __release_sock(__sk); \ (__sk)->lock.users = 0; \ - wake_up(&((__sk)->lock.wq)); \ + if (waitqueue_active(&((__sk)->lock.wq))) wake_up(&((__sk)->lock.wq)); \ spin_unlock_bh(&((__sk)->lock.slock)); \ } while(0) @@ -837,11 +838,19 @@ extern void sklist_insert_socket(struct sock **list, struct sock *sk); extern void sklist_destroy_socket(struct sock **list, struct sock *sk); #ifdef CONFIG_FILTER -/* + +/** + * sk_filter - run a packet through a socket filter + * @skb: buffer to filter + * @filter: filter to apply + * * Run the filter code and then cut skb->data to correct size returned by * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller - * than pkt_len we keep whole skb->data. + * than pkt_len we keep whole skb->data. This is the socket level + * wrapper to sk_run_filter. It returns 0 if the packet should + * be accepted or 1 if the packet should be tossed. */ + extern __inline__ int sk_filter(struct sk_buff *skb, struct sk_filter *filter) { int pkt_len; @@ -855,6 +864,14 @@ extern __inline__ int sk_filter(struct sk_buff *skb, struct sk_filter *filter) return 0; } +/** + * sk_filter_release: Release a socket filter + * @sk: socket + * @fp: filter to remove + * + * Remove a filter from a socket and release its resources. + */ + extern __inline__ void sk_filter_release(struct sock *sk, struct sk_filter *fp) { unsigned int size = sk_filter_len(fp); @@ -1135,6 +1152,12 @@ extern __inline__ unsigned long sock_wspace(struct sock *sk) return amt; } +extern __inline__ void sk_wake_async(struct sock *sk, int how, int band) +{ + if (sk->socket && sk->socket->fasync_list) + sock_wake_async(sk->socket, how, band); +} + #define SOCK_MIN_SNDBUF 2048 #define SOCK_MIN_RCVBUF 128 /* Must be less or equal SOCK_MIN_SNDBUF */ @@ -1169,6 +1192,14 @@ extern __inline__ int sock_rcvlowat(struct sock *sk, int waitall, int len) return waitall ? len : min(sk->rcvlowat, len); } +/* Alas, with timeout socket operations are not restartable. + * Compare this to poll(). + */ +extern __inline__ int sock_intr_errno(long timeo) +{ + return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; +} + /* * Enable debug/info messages */ diff --git a/include/net/tcp.h b/include/net/tcp.h index dacdfa2a7..02b320842 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -669,8 +669,6 @@ extern void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, struct sk_buff *skb); -extern void tcp_v4_send_reset(struct sk_buff *skb); - extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); @@ -908,6 +906,13 @@ struct tcp_skb_cb { #define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) +/* + * Compute minimal free write space needed to queue new packets. + */ +#define tcp_min_write_space(__sk) \ + (atomic_read(&(__sk)->wmem_alloc) / 2) + + /* This determines how many packets are "in the network" to the best * of our knowledge. In many cases it is conservative, but where * detailed information is available from the receiver (via SACK @@ -1342,6 +1347,15 @@ extern __inline__ void tcp_init_buffer_space(struct sock *sk) if (sk->rcvbuf < 3*rcvbuf) sk->rcvbuf = min (3*rcvbuf, sysctl_rmem_max); + + /* Reserve slack space to reduce jitter of advertised window. */ + if (tp->window_clamp >= tcp_full_space(sk)) { + int nwin = tcp_full_space(sk) - tp->mss_clamp; + + if (nwin >= MAX_TCP_WINDOW && nwin >= 2*tp->advmss) + tp->window_clamp = nwin; + } + if (sk->sndbuf < 3*sndbuf) sk->sndbuf = min (3*sndbuf, sysctl_wmem_max); } diff --git a/include/scsi/sg.h b/include/scsi/sg.h index 20b7d158e..283e81695 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h @@ -11,9 +11,13 @@ Original driver (sg.h): Version 2 and 3 extensions to driver: * Copyright (C) 1998 - 2000 Douglas Gilbert - Version: 3.1.12 (20000222) + Version: 3.1.13 (20000323) This version is for 2.3/2.4 series kernels. + Changes since 3.1.12 (20000222) + - make sg_header interface use SCSI_DATA_UNKNOWN + - add SG_DXFER_UNKNOWN define to sg interface + - stop allocating data buffers to non data transfer commands Changes since 3.1.10 (20000123) - make device allocation dynamic (get rid of SG_EXTRA_DEVS) - move to sg0,sg1,sg2 rather than sga,sgb,sgc @@ -147,6 +151,7 @@ typedef struct sg_io_hdr additional property than during indirect IO the user buffer is copied into the kernel buffers before the transfer */ +#define SG_DXFER_UNKNOWN -5 /* Unknown data direction */ /* following flag values can be "or"-ed together */ #define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */ |