summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-08-28 22:00:09 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-08-28 22:00:09 +0000
commit1a1d77dd589de5a567fa95e36aa6999c704ceca4 (patch)
tree141e31f89f18b9fe0831f31852e0435ceaccafc5 /include
parentfb9c690a18b3d66925a65b17441c37fa14d4370b (diff)
Merge with 2.4.0-test7.
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/bitops.h2
-rw-r--r--include/asm-alpha/fcntl.h4
-rw-r--r--include/asm-alpha/mmu_context.h3
-rw-r--r--include/asm-alpha/unistd.h1
-rw-r--r--include/asm-arm/a.out.h2
-rw-r--r--include/asm-arm/arch-arc/hardware.h2
-rw-r--r--include/asm-arm/arch-arc/ide.h1
-rw-r--r--include/asm-arm/arch-arc/irq.h15
-rw-r--r--include/asm-arm/arch-arc/system.h16
-rw-r--r--include/asm-arm/arch-cl7500/dma.h4
-rw-r--r--include/asm-arm/arch-cl7500/hardware.h4
-rw-r--r--include/asm-arm/arch-cl7500/ide.h17
-rw-r--r--include/asm-arm/arch-cl7500/serial.h9
-rw-r--r--include/asm-arm/arch-cl7500/time.h3
-rw-r--r--include/asm-arm/arch-cl7500/uncompress.h17
-rw-r--r--include/asm-arm/arch-ebsa110/hardware.h2
-rw-r--r--include/asm-arm/arch-ebsa285/hardware.h9
-rw-r--r--include/asm-arm/arch-ebsa285/irq.h5
-rw-r--r--include/asm-arm/arch-ebsa285/irqs.h1
-rw-r--r--include/asm-arm/arch-ebsa285/keyboard.h5
-rw-r--r--include/asm-arm/arch-ebsa285/memory.h57
-rw-r--r--include/asm-arm/arch-ebsa285/system.h1
-rw-r--r--include/asm-arm/arch-ebsa285/time.h2
-rw-r--r--include/asm-arm/arch-l7200/hardware.h2
-rw-r--r--include/asm-arm/arch-l7200/ide.h2
-rw-r--r--include/asm-arm/arch-l7200/io.h200
-rw-r--r--include/asm-arm/arch-l7200/memory.h6
-rw-r--r--include/asm-arm/arch-l7200/system.h9
-rw-r--r--include/asm-arm/arch-l7200/time.h2
-rw-r--r--include/asm-arm/arch-l7200/uncompress.h25
-rw-r--r--include/asm-arm/arch-rpc/hardware.h1
-rw-r--r--include/asm-arm/arch-sa1100/cerf.h16
-rw-r--r--include/asm-arm/arch-sa1100/hardware.h4
-rw-r--r--include/asm-arm/arch-sa1100/ide.h24
-rw-r--r--include/asm-arm/arch-sa1100/irq.h1
-rw-r--r--include/asm-arm/arch-sa1100/uncompress.h4
-rw-r--r--include/asm-arm/arch-shark/keyboard.h2
-rw-r--r--include/asm-arm/assembler.h4
-rw-r--r--include/asm-arm/dma.h1
-rw-r--r--include/asm-arm/hardware.h6
-rw-r--r--include/asm-arm/leds.h9
-rw-r--r--include/asm-arm/mc146818rtc.h3
-rw-r--r--include/asm-arm/mmu_context.h2
-rw-r--r--include/asm-arm/page.h4
-rw-r--r--include/asm-arm/pgalloc.h1
-rw-r--r--include/asm-arm/pgtable.h9
-rw-r--r--include/asm-arm/proc-armo/assembler.h26
-rw-r--r--include/asm-arm/proc-armo/cache.h3
-rw-r--r--include/asm-arm/proc-armo/locks.h158
-rw-r--r--include/asm-arm/proc-armo/system.h18
-rw-r--r--include/asm-arm/proc-armv/assembler.h13
-rw-r--r--include/asm-arm/proc-armv/elf.h2
-rw-r--r--include/asm-arm/proc-armv/system.h30
-rw-r--r--include/asm-arm/proc-armv/uaccess.h24
-rw-r--r--include/asm-arm/resource.h28
-rw-r--r--include/asm-arm/system.h372
-rw-r--r--include/asm-arm/termbits.h2
-rw-r--r--include/asm-arm/termios.h2
-rw-r--r--include/asm-arm/uaccess.h46
-rw-r--r--include/asm-arm/unaligned.h2
-rw-r--r--include/asm-arm/unistd.h1
-rw-r--r--include/asm-arm/user.h2
-rw-r--r--include/asm-i386/apic.h1
-rw-r--r--include/asm-i386/apicdef.h4
-rw-r--r--include/asm-i386/bugs.h2
-rw-r--r--include/asm-i386/e820.h6
-rw-r--r--include/asm-i386/fcntl.h12
-rw-r--r--include/asm-i386/mmu_context.h2
-rw-r--r--include/asm-i386/unistd.h2
-rw-r--r--include/asm-ia64/acpi-ext.h2
-rw-r--r--include/asm-ia64/asmmacro.h2
-rw-r--r--include/asm-ia64/efi.h1
-rw-r--r--include/asm-ia64/ia32.h19
-rw-r--r--include/asm-ia64/io.h5
-rw-r--r--include/asm-ia64/machvec.h48
-rw-r--r--include/asm-ia64/machvec_dig.h2
-rw-r--r--include/asm-ia64/machvec_init.h6
-rw-r--r--include/asm-ia64/mmu_context.h51
-rw-r--r--include/asm-ia64/offsets.h6
-rw-r--r--include/asm-ia64/page.h9
-rw-r--r--include/asm-ia64/pal.h21
-rw-r--r--include/asm-ia64/param.h14
-rw-r--r--include/asm-ia64/pci.h71
-rw-r--r--include/asm-ia64/pgtable.h12
-rw-r--r--include/asm-ia64/processor.h39
-rw-r--r--include/asm-ia64/scatterlist.h1
-rw-r--r--include/asm-ia64/siginfo.h5
-rw-r--r--include/asm-ia64/smp.h4
-rw-r--r--include/asm-ia64/spinlock.h111
-rw-r--r--include/asm-ia64/system.h129
-rw-r--r--include/asm-ia64/unistd.h1
-rw-r--r--include/asm-m68k/mmu_context.h6
-rw-r--r--include/asm-m68k/unistd.h1
-rw-r--r--include/asm-mips/fcntl.h16
-rw-r--r--include/asm-mips/mmu_context.h3
-rw-r--r--include/asm-mips/unistd.h4
-rw-r--r--include/asm-mips64/fcntl.h10
-rw-r--r--include/asm-mips64/mmu_context.h11
-rw-r--r--include/asm-mips64/unistd.h10
-rw-r--r--include/asm-ppc/mmu_context.h2
-rw-r--r--include/asm-ppc/unistd.h1
-rw-r--r--include/asm-s390/mmu_context.h2
-rw-r--r--include/asm-s390/unistd.h1
-rw-r--r--include/asm-sh/dma.h1
-rw-r--r--include/asm-sh/machvec_init.h2
-rw-r--r--include/asm-sh/mmu_context.h3
-rw-r--r--include/asm-sh/unistd.h1
-rw-r--r--include/asm-sparc/bitops.h10
-rw-r--r--include/asm-sparc/fcntl.h15
-rw-r--r--include/asm-sparc/md.h13
-rw-r--r--include/asm-sparc/mmu_context.h2
-rw-r--r--include/asm-sparc/page.h2
-rw-r--r--include/asm-sparc/pgtable.h8
-rw-r--r--include/asm-sparc/spinlock.h9
-rw-r--r--include/asm-sparc/unistd.h8
-rw-r--r--include/asm-sparc64/bitops.h6
-rw-r--r--include/asm-sparc64/fcntl.h12
-rw-r--r--include/asm-sparc64/hardirq.h16
-rw-r--r--include/asm-sparc64/kdebug.h76
-rw-r--r--include/asm-sparc64/machines.h71
-rw-r--r--include/asm-sparc64/md.h91
-rw-r--r--include/asm-sparc64/mmu_context.h40
-rw-r--r--include/asm-sparc64/openprom.h8
-rw-r--r--include/asm-sparc64/page.h2
-rw-r--r--include/asm-sparc64/pgtable.h5
-rw-r--r--include/asm-sparc64/spinlock.h2
-rw-r--r--include/asm-sparc64/unistd.h6
-rw-r--r--include/linux/agp_backend.h3
-rw-r--r--include/linux/capi.h30
-rw-r--r--include/linux/dirent.h8
-rw-r--r--include/linux/etherdevice.h7
-rw-r--r--include/linux/file.h40
-rw-r--r--include/linux/fs.h22
-rw-r--r--include/linux/highmem.h3
-rw-r--r--include/linux/if_packet.h1
-rw-r--r--include/linux/if_tun.h92
-rw-r--r--include/linux/in6.h11
-rw-r--r--include/linux/input.h31
-rw-r--r--include/linux/isdn.h2
-rw-r--r--include/linux/isdn_divertif.h14
-rw-r--r--include/linux/kernelcapi.h96
-rw-r--r--include/linux/major.h2
-rw-r--r--include/linux/mca.h107
-rw-r--r--include/linux/mm.h1
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h14
-rw-r--r--include/linux/netfilter_ipv4/ip_queue.h4
-rw-r--r--include/linux/nfsd/nfsd.h2
-rw-r--r--include/linux/nfsd/xdr.h2
-rw-r--r--include/linux/nfsd/xdr3.h6
-rw-r--r--include/linux/pci_ids.h8
-rw-r--r--include/linux/raid/md_k.h2
-rw-r--r--include/linux/rtnetlink.h4
-rw-r--r--include/linux/sched.h7
-rw-r--r--include/linux/serial.h3
-rw-r--r--include/linux/skbuff.h6
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/smb.h7
-rw-r--r--include/linux/smb_fs.h8
-rw-r--r--include/linux/smb_fs_sb.h16
-rw-r--r--include/linux/smb_mount.h35
-rw-r--r--include/linux/sound.h25
-rw-r--r--include/linux/sysctl.h9
-rw-r--r--include/linux/ufs_fs.h13
-rw-r--r--include/linux/usb.h5
-rw-r--r--include/net/dst.h1
-rw-r--r--include/net/snmp.h40
-rw-r--r--include/net/sock.h118
-rw-r--r--include/net/tcp.h607
-rw-r--r--include/net/tcp_ecn.h155
170 files changed, 2096 insertions, 1786 deletions
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h
index 4cdfb21d5..69bfdcaf1 100644
--- a/include/asm-alpha/bitops.h
+++ b/include/asm-alpha/bitops.h
@@ -271,6 +271,8 @@ extern inline unsigned long find_next_zero_bit(void * addr, unsigned long size,
tmp = *p;
found_first:
tmp |= ~0UL << size;
+ if (tmp == ~0UL) /* Are any bits zero? */
+ return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
diff --git a/include/asm-alpha/fcntl.h b/include/asm-alpha/fcntl.h
index 0c4a08e30..314e3addb 100644
--- a/include/asm-alpha/fcntl.h
+++ b/include/asm-alpha/fcntl.h
@@ -63,4 +63,8 @@ struct flock {
__kernel_pid_t l_pid;
};
+#ifdef __KERNEL__
+#define flock64 flock
+#endif
+
#endif
diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h
index b44e4a428..219b8bd4e 100644
--- a/include/asm-alpha/mmu_context.h
+++ b/include/asm-alpha/mmu_context.h
@@ -205,11 +205,12 @@ ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
# endif
#endif
-extern inline void
+extern inline int
init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
mm->context = 0;
tsk->thread.ptbr = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
+ return 0;
}
extern inline void
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index 75453ddfd..4a5b98607 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -314,6 +314,7 @@
#define __NR_pivot_root 374
#define __NR_mincore 375
#define __NR_pciconfig_iobase 376
+#define __NR_getdents64 377
#if defined(__GNUC__)
diff --git a/include/asm-arm/a.out.h b/include/asm-arm/a.out.h
index f78a7b295..91463a42b 100644
--- a/include/asm-arm/a.out.h
+++ b/include/asm-arm/a.out.h
@@ -1,7 +1,7 @@
#ifndef __ARM_A_OUT_H__
#define __ARM_A_OUT_H__
-#include <linux/types.h>
+#include <asm/types.h>
struct exec
{
diff --git a/include/asm-arm/arch-arc/hardware.h b/include/asm-arm/arch-arc/hardware.h
index 8d734d2bb..789f4cf6f 100644
--- a/include/asm-arm/arch-arc/hardware.h
+++ b/include/asm-arm/arch-arc/hardware.h
@@ -82,7 +82,7 @@
* RAM definitions
*/
#define GET_MEMORY_END(p) (PAGE_OFFSET + (p->u1.s.page_size) * (p->u1.s.nr_pages))
-#define PARAMS_BASE (PAGE_OFFSET + 0x7c000)
+#define PARAMS_OFFSET 0x7c000
#else
diff --git a/include/asm-arm/arch-arc/ide.h b/include/asm-arm/arch-arc/ide.h
index c24213b20..3a7c9a968 100644
--- a/include/asm-arm/arch-arc/ide.h
+++ b/include/asm-arm/arch-arc/ide.h
@@ -12,6 +12,7 @@
* 29-07-1998 RMK Major re-work of IDE architecture specific code
*/
#include <asm/irq.h>
+#include <asm/mach-types.h>
/*
* Set up a hw structure for a specified data port, control port and IRQ.
diff --git a/include/asm-arm/arch-arc/irq.h b/include/asm-arm/arch-arc/irq.h
index 97b3c499e..61997a1b2 100644
--- a/include/asm-arm/arch-arc/irq.h
+++ b/include/asm-arm/arch-arc/irq.h
@@ -10,14 +10,24 @@
* 11-01-1998 RMK Added mask_and_ack_irq
* 22-08-1998 RMK Restructured IRQ routines
*/
+#include <linux/config.h>
#include <asm/ioc.h>
+#ifdef CONFIG_ARCH_ARC
+#define a_clf() clf()
+#define a_stf() stf()
+#else
+#define a_clf() do { } while (0)
+#define a_stf() do { } while (0)
+#endif
+
#define fixup_irq(x) (x)
static void arc_mask_irq_ack_a(unsigned int irq)
{
unsigned int temp;
+ a_clf();
__asm__ __volatile__(
"ldrb %0, [%2]\n"
" bic %0, %0, %1\n"
@@ -26,30 +36,35 @@ static void arc_mask_irq_ack_a(unsigned int irq)
: "=&r" (temp)
: "r" (1 << (irq & 7)), "r" (ioaddr(IOC_IRQMASKA)),
"r" (ioaddr(IOC_IRQCLRA)));
+ a_stf();
}
static void arc_mask_irq_a(unsigned int irq)
{
unsigned int temp;
+ a_clf();
__asm__ __volatile__(
"ldrb %0, [%2]\n"
" bic %0, %0, %1\n"
" strb %0, [%2]"
: "=&r" (temp)
: "r" (1 << (irq & 7)), "r" (ioaddr(IOC_IRQMASKA)));
+ a_stf();
}
static void arc_unmask_irq_a(unsigned int irq)
{
unsigned int temp;
+ a_clf();
__asm__ __volatile__(
"ldrb %0, [%2]\n"
" orr %0, %0, %1\n"
" strb %0, [%2]"
: "=&r" (temp)
: "r" (1 << (irq & 7)), "r" (ioaddr(IOC_IRQMASKA)));
+ a_stf();
}
static void arc_mask_irq_b(unsigned int irq)
diff --git a/include/asm-arm/arch-arc/system.h b/include/asm-arm/arch-arc/system.h
index 578f6f70b..0caf739d6 100644
--- a/include/asm-arm/arch-arc/system.h
+++ b/include/asm-arm/arch-arc/system.h
@@ -3,22 +3,6 @@
*
* Copyright (c) 1996-1999 Russell King and Dave Gilbert
*/
-#include <linux/config.h>
-
-#ifdef CONFIG_ARCH_ARC
-
-#define cliIF() \
- do { \
- unsigned long temp; \
- __asm__ __volatile__( \
-" mov %0, pc\n" \
-" orr %0, %0, #0x0c000000\n" \
-" teqp %0, #0\n" \
- : "=r" (temp) \
- : ); \
- } while(0)
-
-#endif
static void arch_idle(void)
{
diff --git a/include/asm-arm/arch-cl7500/dma.h b/include/asm-arm/arch-cl7500/dma.h
index 7bab998b9..1d6a8829d 100644
--- a/include/asm-arm/arch-cl7500/dma.h
+++ b/include/asm-arm/arch-cl7500/dma.h
@@ -7,13 +7,15 @@
#ifndef __ASM_ARCH_DMA_H
#define __ASM_ARCH_DMA_H
+/* DMA is not yet implemented! It should be the same as acorn, copy over.. */
+
/*
* This is the maximum DMA address that can be DMAd to.
* There should not be more than (0xd0000000 - 0xc0000000)
* bytes of RAM.
*/
#define MAX_DMA_ADDRESS 0xd0000000
-#define MAX_DMA_CHANNELS 1
+#define MAX_DMA_CHANNELS 0
#define DMA_S0 0
diff --git a/include/asm-arm/arch-cl7500/hardware.h b/include/asm-arm/arch-cl7500/hardware.h
index 76978f79b..938389b20 100644
--- a/include/asm-arm/arch-cl7500/hardware.h
+++ b/include/asm-arm/arch-cl7500/hardware.h
@@ -67,6 +67,8 @@
#define IOEB_BASE ((volatile unsigned char *)0xe0350050)
#define PCIO_FLOPPYDMABASE ((volatile unsigned char *)0xe002a000)
#define PCIO_BASE 0xe0010000
+/* in/out bias for the ISA slot region */
+#define ISASLOT_IO 0x80400000
/*
* RAM definitions
@@ -77,8 +79,6 @@
p->u1.s.pages_in_bank[2] + \
p->u1.s.pages_in_bank[3]))
-#define PARAMS_BASE 0
-
#define FLUSH_BASE_PHYS 0x00000000 /* ROM */
#else
diff --git a/include/asm-arm/arch-cl7500/ide.h b/include/asm-arm/arch-cl7500/ide.h
index 53daa0969..d928d8596 100644
--- a/include/asm-arm/arch-cl7500/ide.h
+++ b/include/asm-arm/arch-cl7500/ide.h
@@ -7,6 +7,7 @@
* 29-07-1998 RMK Major re-work of IDE architecture specific code
*/
#include <asm/irq.h>
+#include <asm/arch/hardware.h>
/*
* Set up a hw structure for a specified data port, control port and IRQ.
@@ -15,7 +16,7 @@
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;
+ ide_ioreg_t reg = data_port;
int i;
memset(hw, 0, sizeof(*hw));
@@ -24,9 +25,14 @@ ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq)
hw->io_ports[i] = reg;
reg += 1;
}
- hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port;
- if (irq)
+ if (ctrl_port) {
+ hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
+ } else {
+ hw->io_ports[IDE_CONTROL_OFFSET] = data_port + 0x206;
+ }
+ if (irq != NULL)
*irq = 0;
+ hw->io_ports[IDE_IRQ_OFFSET] = 0;
}
/*
@@ -36,4 +42,9 @@ ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq)
static __inline__ void
ide_init_default_hwifs(void)
{
+ hw_regs_t hw;
+
+ ide_init_hwif_ports(&hw, ISASLOT_IO + 0x1f0, ISASLOT_IO + 0x3f6, NULL);
+ hw.irq = IRQ_ISA_14;
+ ide_register_hw(&hw, NULL);
}
diff --git a/include/asm-arm/arch-cl7500/serial.h b/include/asm-arm/arch-cl7500/serial.h
index 256b2a34e..4611f7975 100644
--- a/include/asm-arm/arch-cl7500/serial.h
+++ b/include/asm-arm/arch-cl7500/serial.h
@@ -11,6 +11,8 @@
#ifndef __ASM_ARCH_SERIAL_H
#define __ASM_ARCH_SERIAL_H
+#include <asm/arch/hardware.h>
+
/*
* This assumes you have a 1.8432 MHz clock for your UART.
*
@@ -27,9 +29,10 @@
/* UART CLK PORT IRQ FLAGS */
#define STD_SERIAL_PORT_DEFNS \
{ 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \
- { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ \
- { 0, BASE_BAUD, 0x804002e8, 41, STD_COM_FLAGS }, /* ttyS2 */ \
- { 0, BASE_BAUD, 0x804003e8, 40, STD_COM_FLAGS }, /* ttyS3 */ \
+ { 0, BASE_BAUD, 0x2F8, 0, STD_COM_FLAGS }, /* ttyS1 */ \
+ /* ISA Slot Serial ports */ \
+ { 0, BASE_BAUD, ISASLOT_IO + 0x2e8, 41, STD_COM_FLAGS }, /* ttyS2 */ \
+ { 0, BASE_BAUD, ISASLOT_IO + 0x3e8, 40, STD_COM_FLAGS }, /* ttyS3 */ \
{ 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \
{ 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS5 */ \
{ 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS6 */ \
diff --git a/include/asm-arm/arch-cl7500/time.h b/include/asm-arm/arch-cl7500/time.h
index e2c927605..7851607fc 100644
--- a/include/asm-arm/arch-cl7500/time.h
+++ b/include/asm-arm/arch-cl7500/time.h
@@ -8,7 +8,6 @@
* 10-Oct-1996 RMK Brought up to date with arch-sa110eval
* 04-Dec-1997 RMK Updated for new arch/arm/time.c
*/
-extern void ioctime_init(void);
static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
@@ -33,8 +32,6 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
*/
extern __inline__ void setup_timer(void)
{
- ioctime_init();
-
timer_irq.handler = timer_interrupt;
setup_arm_irq(IRQ_TIMER, &timer_irq);
diff --git a/include/asm-arm/arch-cl7500/uncompress.h b/include/asm-arm/arch-cl7500/uncompress.h
index 0585c8318..12ffdc98d 100644
--- a/include/asm-arm/arch-cl7500/uncompress.h
+++ b/include/asm-arm/arch-cl7500/uncompress.h
@@ -5,11 +5,12 @@
*/
#define BASE 0x03010000
+#define SERBASE (BASE + (0x3f8 << 2))
static __inline__ void putc(char c)
{
- while (!(*((volatile unsigned int *)(BASE + 0xbf4)) & 0x20));
- *((volatile unsigned int *)(BASE + 0xbe0)) = c;
+ while (!(*((volatile unsigned int *)(SERBASE + 0x14)) & 0x20));
+ *((volatile unsigned int *)(SERBASE)) = c;
}
/*
@@ -27,13 +28,13 @@ static void puts(const char *s)
static __inline__ void arch_decomp_setup(void)
{
- int baud = 3686400 / (9600 * 16);
+ int baud = 3686400 / (9600 * 32);
- *((volatile unsigned int *)(BASE + 0xBEC)) = 0x80;
- *((volatile unsigned int *)(BASE + 0xBE0)) = baud & 0xff;
- *((volatile unsigned int *)(BASE + 0xBE4)) = (baud & 0xff00) >> 8;
- *((volatile unsigned int *)(BASE + 0xBEC)) = 3; /* 8 bits */
- *((volatile unsigned int *)(BASE + 0xBF0)) = 3; /* DTR, RTS */
+ *((volatile unsigned int *)(SERBASE + 0xC)) = 0x80;
+ *((volatile unsigned int *)(SERBASE + 0x0)) = baud & 0xff;
+ *((volatile unsigned int *)(SERBASE + 0x4)) = (baud & 0xff00) >> 8;
+ *((volatile unsigned int *)(SERBASE + 0xC)) = 3; /* 8 bits */
+ *((volatile unsigned int *)(SERBASE + 0x10)) = 3; /* DTR, RTS */
}
/*
diff --git a/include/asm-arm/arch-ebsa110/hardware.h b/include/asm-arm/arch-ebsa110/hardware.h
index 08723718c..18ee0f968 100644
--- a/include/asm-arm/arch-ebsa110/hardware.h
+++ b/include/asm-arm/arch-ebsa110/hardware.h
@@ -42,7 +42,7 @@
#define UNCACHEABLE_ADDR 0xf3000000
-#define PARAMS_BASE (PAGE_OFFSET + 0x400)
+#define PARAMS_OFFSET 0x400
#endif
diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h
index 142a2ddbc..ae5817d9e 100644
--- a/include/asm-arm/arch-ebsa285/hardware.h
+++ b/include/asm-arm/arch-ebsa285/hardware.h
@@ -11,7 +11,7 @@
#include <linux/config.h>
#include <asm/arch/memory.h>
-#ifdef CONFIG_FOOTBRIDGE_HOST
+#ifdef CONFIG_ARCH_FOOTBRIDGE
/* Virtual Physical Size
* 0xff800000 0x40000000 1MB X-Bus
* 0xff000000 0x7c000000 1MB PCI I/O space
@@ -61,7 +61,9 @@
#define PCIMEM_BASE 0xf0000000
#elif defined(CONFIG_ARCH_CO285)
-
+/*
+ * This is the COEBSA285 cut-down mapping
+ */
#define PCIMEM_SIZE 0x80000000
#define PCIMEM_BASE 0x80000000
@@ -85,7 +87,7 @@
#else
-#error Add your add-in architecture here
+#error "Undefined footbridge architecture"
#endif
@@ -102,7 +104,6 @@
#define XBUS_SWITCH_J17_9 ((*XBUS_SWITCH) & (1 << 6))
#define PARAMS_OFFSET 0x0100
-#define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET)
#define FLUSH_BASE_PHYS 0x50000000
#define UNCACHEABLE_ADDR (ARMCSR_BASE + 0x108)
diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h
index b6f2639b5..791c00fae 100644
--- a/include/asm-arm/arch-ebsa285/irq.h
+++ b/include/asm-arm/arch-ebsa285/irq.h
@@ -13,12 +13,13 @@
#include <asm/hardware.h>
#include <asm/dec21285.h>
#include <asm/irq.h>
+#include <asm/mach-types.h>
/*
* Footbridge IRQ translation table
* Converts from our IRQ numbers into FootBridge masks
*/
-static int dc21285_irq_mask[] = {
+static const int dc21285_irq_mask[] = {
IRQ_MASK_UART_RX, /* 0 */
IRQ_MASK_UART_TX, /* 1 */
IRQ_MASK_TIMER1, /* 2 */
@@ -45,8 +46,10 @@ static int isa_irq = -1;
static inline int fixup_irq(unsigned int irq)
{
+#ifdef PCIIACK_BASE
if (irq == isa_irq)
irq = *(unsigned char *)PCIIACK_BASE;
+#endif
return irq;
}
diff --git a/include/asm-arm/arch-ebsa285/irqs.h b/include/asm-arm/arch-ebsa285/irqs.h
index 9ad99a458..6a60fae42 100644
--- a/include/asm-arm/arch-ebsa285/irqs.h
+++ b/include/asm-arm/arch-ebsa285/irqs.h
@@ -8,6 +8,7 @@
* 20-Jan-1998 RMK Started merge of EBSA286, CATS and NetWinder
* 01-Feb-1999 PJB ISA IRQs start at 0 not 16
*/
+#include <asm/mach-types.h>
#define NR_IRQS 36
#define NR_DC21285_IRQS 16
diff --git a/include/asm-arm/arch-ebsa285/keyboard.h b/include/asm-arm/arch-ebsa285/keyboard.h
index 691514e6b..f3c05b072 100644
--- a/include/asm-arm/arch-ebsa285/keyboard.h
+++ b/include/asm-arm/arch-ebsa285/keyboard.h
@@ -6,11 +6,10 @@
* (C) 1998 Russell King
* (C) 1998 Phil Blundell
*/
+#include <linux/ioport.h>
#include <asm/irq.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,
@@ -71,7 +70,7 @@ extern unsigned char pckbd_sysrq_xlate[128];
#define SYSRQ_KEY 0x54
/* resource allocation */
-#define kbd_request_region()
+#define kbd_request_region() request_region(0x60, 16, "keyboard")
#define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \
"keyboard", NULL)
diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h
index 18d7dacb0..d9859cb76 100644
--- a/include/asm-arm/arch-ebsa285/memory.h
+++ b/include/asm-arm/arch-ebsa285/memory.h
@@ -17,58 +17,53 @@
#include <linux/config.h>
-#if defined(CONFIG_FOOTBRIDGE_HOST)
-
+#if defined(CONFIG_FOOTBRIDGE_ADDIN)
/*
- * Task size: 3GB
+ * If we may be using add-in footbridge mode, then we must
+ * use the out-of-line translation that makes use of the
+ * PCI BAR
*/
-#define TASK_SIZE (0xc0000000UL)
-#define TASK_SIZE_26 (0x04000000UL)
+#ifndef __ASSEMBLY__
+extern unsigned long __virt_to_bus(unsigned long);
+extern unsigned long __bus_to_virt(unsigned long);
+#endif
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET (0xc0000000UL)
-#define PHYS_OFFSET (0x00000000UL)
+#elif defined(CONFIG_FOOTBRIDGE_HOST)
#define __virt_to_bus__is_a_macro
#define __virt_to_bus(x) ((x) - 0xe0000000)
#define __bus_to_virt__is_a_macro
#define __bus_to_virt(x) ((x) + 0xe0000000)
-#elif defined(CONFIG_FOOTBRIDGE_ADDIN)
+#else
-#if defined(CONFIG_ARCH_CO285)
+#error "Undefined footbridge mode"
-/*
- * Task size: 1.5GB
- */
-#define TASK_SIZE (0x60000000UL)
-#define TASK_SIZE_26 (0x04000000UL)
+#endif
-/*
- * Page offset: 1.5GB
- */
+#if defined(CONFIG_ARCH_FOOTBRIDGE)
+
+/* Task size and page offset at 3GB */
+#define TASK_SIZE (0xc0000000UL)
+#define PAGE_OFFSET (0xc0000000UL)
+
+#elif defined(CONFIG_ARCH_CO285)
+
+/* Task size and page offset at 1.5GB */
+#define TASK_SIZE (0x60000000UL)
#define PAGE_OFFSET (0x60000000UL)
-#define PHYS_OFFSET (0x00000000UL)
#else
-#error Add in your architecture here
+#error "Undefined footbridge architecture"
#endif
-#ifndef __ASSEMBLY__
-extern unsigned long __virt_to_bus(unsigned long);
-extern unsigned long __bus_to_virt(unsigned long);
-#endif
-
-#endif
+#define TASK_SIZE_26 (0x04000000UL)
+#define PHYS_OFFSET (0x00000000UL)
/*
- * On Footbridge machines, the dram is contiguous.
- * On Host Footbridge, these conversions are constant.
- * On an add-in footbridge, these depend on register settings.
+ * The DRAM is always contiguous.
*/
#define __virt_to_phys__is_a_macro
#define __virt_to_phys(vpage) ((unsigned long)(vpage) - PAGE_OFFSET)
diff --git a/include/asm-arm/arch-ebsa285/system.h b/include/asm-arm/arch-ebsa285/system.h
index 4704e3de3..dbbaf9444 100644
--- a/include/asm-arm/arch-ebsa285/system.h
+++ b/include/asm-arm/arch-ebsa285/system.h
@@ -7,6 +7,7 @@
#include <asm/io.h>
#include <asm/hardware.h>
#include <asm/leds.h>
+#include <asm/mach-types.h>
static void arch_idle(void)
{
diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h
index cc28f3449..2ae77bcb1 100644
--- a/include/asm-arm/arch-ebsa285/time.h
+++ b/include/asm-arm/arch-ebsa285/time.h
@@ -21,7 +21,7 @@
#include <asm/dec21285.h>
#include <asm/leds.h>
-#include <asm/system.h>
+#include <asm/mach-types.h>
static int rtc_base;
diff --git a/include/asm-arm/arch-l7200/hardware.h b/include/asm-arm/arch-l7200/hardware.h
index d800cbc8d..a9209af7b 100644
--- a/include/asm-arm/arch-l7200/hardware.h
+++ b/include/asm-arm/arch-l7200/hardware.h
@@ -41,7 +41,7 @@
#define FLUSH_BASE_PHYS 0x40000000 /* ROM */
#define FLUSH_BASE 0xdf000000
-#define PARAMS_BASE (PAGE_OFFSET + 0x0100)
+#define PARAMS_OFFSET (0x0100)
#define Z_PARAMS_BASE (RAM_START + PARAMS_OFFSET)
#define PCIO_BASE IO_BASE
diff --git a/include/asm-arm/arch-l7200/ide.h b/include/asm-arm/arch-l7200/ide.h
index aff8aaf9c..61cec831a 100644
--- a/include/asm-arm/arch-l7200/ide.h
+++ b/include/asm-arm/arch-l7200/ide.h
@@ -4,7 +4,7 @@
* Copyright (c) 2000 Steve Hill (sjhill@cotw.com)
*
* Changelog:
- * 29-03-2000 SJH Created file placeholder
+ * 03-29-2000 SJH Created file placeholder
*/
#include <asm/irq.h>
diff --git a/include/asm-arm/arch-l7200/io.h b/include/asm-arm/arch-l7200/io.h
index 787b62108..720282bbe 100644
--- a/include/asm-arm/arch-l7200/io.h
+++ b/include/asm-arm/arch-l7200/io.h
@@ -1,10 +1,10 @@
/*
* linux/include/asm-arm/arch-l7200/io.h
*
- * Copyright (C) 2000 Steven Hill (sjhill@cotw.com)
+ * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
*
* Modifications:
- * 21-03-2000 SJH Created from linux/include/asm-arm/arch-nexuspci/io.h
+ * 03-21-2000 SJH Created from linux/include/asm-arm/arch-nexuspci/io.h
*/
#ifndef __ASM_ARM_ARCH_IO_H
#define __ASM_ARM_ARCH_IO_H
@@ -14,188 +14,6 @@
#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. Note that all addresses are
- * shifted left!
- */
-#define __PORT_PCIO(x) (!((x) & 0x80000000))
-
-/*
- * Dynamic IO functions.
- */
-
-extern __inline__ void __outb (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"
- "strb %1, [%0, %2, lsl #2] @ outb"
- : "=&r" (temp)
- : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
- : "cc");
-}
-
-extern __inline__ void __outw (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 %1, [%0, %2, lsl #2] @ outw"
- : "=&r" (temp)
- : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
- : "cc");
-}
-
-extern __inline__ void __outl (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 %1, [%0, %2, lsl #2] @ outl"
- : "=&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, lsl #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 << 2)); \
- else \
- return (unsigned int)(IO_BASE + (port << 2)); \
-}
-
-#define DECLARE_IO(sz,fnsuffix,instr) \
- DECLARE_DYN_IN(sz,fnsuffix,instr)
-
-DECLARE_IO(char,b,"b")
-DECLARE_IO(short,w,"")
-DECLARE_IO(int,l,"")
-
-#undef DECLARE_IO
-#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) << 2)); \
- else \
- __asm__ __volatile__( \
- "strb %0, [%1, %2] @ outbc" \
- : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \
-})
-
-#define __inbc(port) \
-({ \
- unsigned char result; \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "ldrb %0, [%1, %2] @ inbc" \
- : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "ldrb %0, [%1, %2] @ inbc" \
- : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
- result; \
-})
-
-#define __outwc(value,port) \
-({ \
- unsigned long v = value; \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "str %0, [%1, %2] @ outwc" \
- : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "str %0, [%1, %2] @ outwc" \
- : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2)); \
-})
-
-#define __inwc(port) \
-({ \
- unsigned short result; \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "ldr %0, [%1, %2] @ inwc" \
- : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "ldr %0, [%1, %2] @ inwc" \
- : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
- 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) << 2)); \
- else \
- __asm__ __volatile__( \
- "str %0, [%1, %2] @ outlc" \
- : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \
-})
-
-#define __inlc(port) \
-({ \
- unsigned long result; \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "ldr %0, [%1, %2] @ inlc" \
- : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "ldr %0, [%1, %2] @ inlc" \
- : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
- result; \
-})
-
-#define __ioaddrc(port) \
- (__PORT_PCIO((port)) ? PCIO_BASE + ((port) << 2) : IO_BASE + ((port) << 2))
-
-#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 __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p))
-
-/*
* Translated address IO functions
*
* IO address has already been translated to a virtual address
@@ -207,4 +25,18 @@ DECLARE_IO(int,l,"")
#define outl_t(v,p) (*(volatile unsigned long *)(p) = (v))
#define inl_t(p) (*(volatile unsigned long *)(p))
+/*
+ * FIXME - These are to allow for linking. On all the other
+ * ARM platforms, the entire IO space is contiguous.
+ * The 7200 has three separate IO spaces. The below
+ * macros will eventually become more involved. Use
+ * with caution and don't be surprised by kernel oopses!!!
+ */
+#define inb(p) inb_t(p)
+#define inw(p) inw_t(p)
+#define inl(p) inl_t(p)
+#define outb(v,p) outb_t(v,p)
+#define outw(v,p) outw_t(v,p)
+#define outl(v,p) outl_t(v,p)
+
#endif
diff --git a/include/asm-arm/arch-l7200/memory.h b/include/asm-arm/arch-l7200/memory.h
index f2aaabd5c..d07a1ddc1 100644
--- a/include/asm-arm/arch-l7200/memory.h
+++ b/include/asm-arm/arch-l7200/memory.h
@@ -1,7 +1,7 @@
/*
* linux/include/asm-arm/arch-l7200/memory.h
*
- * Copyright (c) 2000 Steven Hill (sjhill@cotw.com)
+ * Copyright (c) 2000 Steve Hill (sjhill@cotw.com)
* Copyright (c) 2000 Rob Scott (rscott@mtrob.fdns.net)
*
* Changelog:
@@ -9,8 +9,8 @@
* 04-13-2000 RS Changed bus macros for new addr
* 05-03-2000 SJH Removed bus macros and fixed virt_to_phys macro
*/
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
/*
* Task size: 3GB
diff --git a/include/asm-arm/arch-l7200/system.h b/include/asm-arm/arch-l7200/system.h
index c299629dd..0f5ecbab0 100644
--- a/include/asm-arm/arch-l7200/system.h
+++ b/include/asm-arm/arch-l7200/system.h
@@ -1,21 +1,22 @@
/*
* linux/include/asm-arm/arch-l7200/system.h
*
- * Copyright (c) 2000 Steven Hill (sjhill@cotw.com)
+ * Copyright (c) 2000 Steve Hill (sjhill@cotw.com)
*
* Changelog
* 03-21-2000 SJH Created
* 04-26-2000 SJH Fixed functions
* 05-03-2000 SJH Removed usage of obsolete 'iomd.h'
+ * 05-31-2000 SJH Properly implemented 'arch_idle'
*/
#ifndef __ASM_ARCH_SYSTEM_H
#define __ASM_ARCH_SYSTEM_H
static void arch_idle(void)
{
- while (!current->need_resched && !hlt_counter)
- { };
-/* outb(0, IOMD_SUSMODE);*/
+ while (!current->need_resched && !hlt_counter) {
+ cpu_do_idle(IDLE_WAIT_SLOW);
+ }
}
extern inline void arch_reset(char mode)
diff --git a/include/asm-arm/arch-l7200/time.h b/include/asm-arm/arch-l7200/time.h
index 077735e21..1d4ef492b 100644
--- a/include/asm-arm/arch-l7200/time.h
+++ b/include/asm-arm/arch-l7200/time.h
@@ -54,8 +54,6 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
*/
extern __inline__ void setup_timer(void)
{
- xtime.tv_sec = RTC_RTCDR;
-
RTC_RTCC = 0; /* Clear interrupt */
timer_irq.handler = timer_interrupt;
diff --git a/include/asm-arm/arch-l7200/uncompress.h b/include/asm-arm/arch-l7200/uncompress.h
index d2e56455b..d7ac5f65e 100644
--- a/include/asm-arm/arch-l7200/uncompress.h
+++ b/include/asm-arm/arch-l7200/uncompress.h
@@ -2,18 +2,43 @@
* linux/include/asm-arm/arch-l7200/uncompress.h
*
* Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
+ *
+ * Changelog:
+ * 05-01-2000 SJH Created
+ * 05-13-2000 SJH Filled in function bodies
+ * 07-26-2000 SJH Removed hard coded buad rate
*/
+#include <asm/hardware.h>
+
+#define IO_UART IO_START + 0x00044000
+
+#define __raw_writeb(v,p) (*(volatile unsigned char *)(p) = (v))
+#define __raw_readb(p) (*(volatile unsigned char *)(p))
+
static __inline__ void putc(char c)
{
+ while(__raw_readb(IO_UART + 0x18) & 0x20 ||
+ __raw_readb(IO_UART + 0x18) & 0x08);
+ __raw_writeb(c, IO_UART + 0x00);
}
static void puts(const char *s)
{
+ while (*s) {
+ if (*s == 10) { /* If a LF, add CR */
+ putc(10);
+ putc(13);
+ }
+ putc(*(s++));
+ }
}
static __inline__ void arch_decomp_setup(void)
{
+ __raw_writeb(0x00, IO_UART + 0x08); /* Set HSB */
+ __raw_writeb(0x00, IO_UART + 0x20); /* Disable IRQs */
+ __raw_writeb(0x01, IO_UART + 0x14); /* Enable UART */
}
#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-rpc/hardware.h b/include/asm-arm/arch-rpc/hardware.h
index ab7183140..ce1a27b13 100644
--- a/include/asm-arm/arch-rpc/hardware.h
+++ b/include/asm-arm/arch-rpc/hardware.h
@@ -78,7 +78,6 @@
p->u1.s.pages_in_bank[2] + \
p->u1.s.pages_in_bank[3]))
-#define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET)
#define Z_PARAMS_BASE (RAM_START + PARAMS_OFFSET)
#define FLUSH_BASE_PHYS 0x00000000 /* ROM */
diff --git a/include/asm-arm/arch-sa1100/cerf.h b/include/asm-arm/arch-sa1100/cerf.h
new file mode 100644
index 000000000..95d58a17b
--- /dev/null
+++ b/include/asm-arm/arch-sa1100/cerf.h
@@ -0,0 +1,16 @@
+#ifndef _INCLUDE_CERF_H_
+#define _INCLUDE_CERF_H_
+
+/* GPIOs for CF+ slot lines */
+#define GPIO_CF_IRQ GPIO_GPIO (22) /* 1111 MBGNT _OR_ CF IRQ */
+#define GPIO_CF_CD GPIO_GPIO (23) /* 1111 MBREQ _OR_ CF CD */
+#define GPIO_CF_BVD2 GPIO_GPIO (19) /* Graphics IRQ _OR_ CF BVD */
+#define GPIO_CF_BVD1 GPIO_GPIO (20) /* 1111 IRQ _OR_ CF BVD */
+
+#define IRQ_GPIO_CF_IRQ IRQ_GPIO22
+#define IRQ_GPIO_CF_CD IRQ_GPIO23
+#define IRQ_GPIO_CF_BVD2 IRQ_GPIO19
+#define IRQ_GPIO_CF_BVD1 IRQ_GPIO20
+
+#endif
+
diff --git a/include/asm-arm/arch-sa1100/hardware.h b/include/asm-arm/arch-sa1100/hardware.h
index 8f9a13152..a4a1b5884 100644
--- a/include/asm-arm/arch-sa1100/hardware.h
+++ b/include/asm-arm/arch-sa1100/hardware.h
@@ -77,6 +77,10 @@ extern void set_GPIO_IRQ_edge( int gpio_mask, int edge_mask );
#define machine_has_neponset() (0)
#endif
+#ifdef CONFIG_SA1100_CERF
+#include "cerf.h"
+#endif
+
#ifdef CONFIG_SA1100_EMPEG
#include "empeg.h"
#endif
diff --git a/include/asm-arm/arch-sa1100/ide.h b/include/asm-arm/arch-sa1100/ide.h
index 63cdc6833..ac2190140 100644
--- a/include/asm-arm/arch-sa1100/ide.h
+++ b/include/asm-arm/arch-sa1100/ide.h
@@ -7,10 +7,9 @@
#include <linux/config.h>
-#ifdef CONFIG_BLK_DEV_IDE
-
#include <asm/irq.h>
-#include <asm/arch/hardware.h>
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
/*
* Set up a hw structure for a specified data port, control port and IRQ.
@@ -118,7 +117,24 @@ ide_init_default_hwifs(void)
ide_register_hw(&hw, NULL);
#endif
}
+ else if (machine_is_lart()) {
+#ifdef CONFIG_SA1100_LART
+ hw_regs_t hw;
+
+ /* Enable GPIO as interrupt line */
+ GPDR &= ~GPIO_GPIO1;
+ set_GPIO_IRQ_edge(GPIO_GPIO1, GPIO_RISING_EDGE);
+
+ /* set PCMCIA interface timing */
+ MECR = 0x00060006;
+
+ /* init the interface */
+/* ide_init_hwif_ports(&hw, 0xe00000000, 0xe00001000, NULL); */
+ ide_init_hwif_ports(&hw, 0xe00001000, 0xe00000000, NULL);
+ hw.irq = IRQ_GPIO1;
+ ide_register_hw(&hw, NULL);
+#endif
+ }
}
-#endif
diff --git a/include/asm-arm/arch-sa1100/irq.h b/include/asm-arm/arch-sa1100/irq.h
index 6e24e97b1..8c6b0e821 100644
--- a/include/asm-arm/arch-sa1100/irq.h
+++ b/include/asm-arm/arch-sa1100/irq.h
@@ -16,6 +16,7 @@
*/
#include <linux/config.h>
#include <asm/irq.h>
+#include <asm/mach-types.h>
#define fixup_irq(x) (x)
diff --git a/include/asm-arm/arch-sa1100/uncompress.h b/include/asm-arm/arch-sa1100/uncompress.h
index 7f9359782..5f4648ee6 100644
--- a/include/asm-arm/arch-sa1100/uncompress.h
+++ b/include/asm-arm/arch-sa1100/uncompress.h
@@ -9,6 +9,8 @@
#include "hardware.h"
#include "serial_reg.h"
+#include <asm/mach-types.h>
+
/* Assabet's Status Control "Register" */
unsigned long SCR_value;
@@ -29,7 +31,7 @@ static void puts( const char *s )
serial_port = (unsigned long *)_Ser3UTCR0;
else
serial_port = (unsigned long *)_Ser1UTCR0;
- } else if (machine_is_brutus())
+ } else if (machine_is_brutus()||machine_is_nanoengine())
serial_port = (unsigned long *)_Ser1UTCR0;
else if (machine_is_empeg() || machine_is_bitsy() ||
machine_is_victor() || machine_is_lart())
diff --git a/include/asm-arm/arch-shark/keyboard.h b/include/asm-arm/arch-shark/keyboard.h
index 523bd065f..dcb47641e 100644
--- a/include/asm-arm/arch-shark/keyboard.h
+++ b/include/asm-arm/arch-shark/keyboard.h
@@ -11,8 +11,6 @@
#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,
diff --git a/include/asm-arm/assembler.h b/include/asm-arm/assembler.h
index 9d122b4de..c3e44c921 100644
--- a/include/asm-arm/assembler.h
+++ b/include/asm-arm/assembler.h
@@ -7,5 +7,9 @@
* Do not include any C declarations in this file - it is included by
* assembler source.
*/
+#ifndef __ASSEMBLY__
+#error "Only include this from assembly code"
+#endif
+
#include <asm/proc/ptrace.h>
#include <asm/proc/assembler.h>
diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h
index ed2d9627b..78c65b599 100644
--- a/include/asm-arm/dma.h
+++ b/include/asm-arm/dma.h
@@ -4,7 +4,6 @@
typedef unsigned int dmach_t;
#include <linux/config.h>
-#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <asm/system.h>
#include <asm/memory.h>
diff --git a/include/asm-arm/hardware.h b/include/asm-arm/hardware.h
index 697976d89..594552e84 100644
--- a/include/asm-arm/hardware.h
+++ b/include/asm-arm/hardware.h
@@ -11,4 +11,10 @@
#include <asm/arch/hardware.h>
+#ifdef PARAMS_OFFSET
+#define PARAMS_BASE ((PAGE_OFFSET) + (PARAMS_OFFSET))
+#else
+#define PARAMS_BASE 0
+#endif
+
#endif
diff --git a/include/asm-arm/leds.h b/include/asm-arm/leds.h
index 84a67f767..7eebdb1c2 100644
--- a/include/asm-arm/leds.h
+++ b/include/asm-arm/leds.h
@@ -25,17 +25,20 @@ typedef enum {
led_amber_on,
led_amber_off,
led_red_on,
- led_red_off
+ led_red_off,
+ /*
+ * I want this between led_timer and led_start, but
+ * someone has decided to export this to user space
+ */
+ led_halted
} led_event_t;
/* Use this routine to handle LEDs */
#ifdef CONFIG_LEDS
extern void (*leds_event)(led_event_t);
-#define set_leds_event(r) leds_event = r
#else
#define leds_event(e)
-#define set_leds_event(r)
#endif
#endif
diff --git a/include/asm-arm/mc146818rtc.h b/include/asm-arm/mc146818rtc.h
index d6e300943..7b81e0c42 100644
--- a/include/asm-arm/mc146818rtc.h
+++ b/include/asm-arm/mc146818rtc.h
@@ -4,6 +4,7 @@
#ifndef _ASM_MC146818RTC_H
#define _ASM_MC146818RTC_H
+#include <asm/arch/irqs.h>
#include <asm/io.h>
#ifndef RTC_PORT
@@ -24,6 +25,4 @@ outb_p((addr),RTC_PORT(0)); \
outb_p((val),RTC_PORT(1)); \
})
-#define RTC_IRQ 8
-
#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h
index 6ebf76a6c..f358628a9 100644
--- a/include/asm-arm/mmu_context.h
+++ b/include/asm-arm/mmu_context.h
@@ -15,7 +15,7 @@
#include <asm/proc-fns.h>
#define destroy_context(mm) do { } while(0)
-#define init_new_context(tsk,mm) do { } while(0)
+#define init_new_context(tsk,mm) 0
static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
{
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 4f24702a2..7201ff558 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -91,8 +91,8 @@ extern __inline__ int get_order(unsigned long size)
#define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
#ifndef CONFIG_DISCONTIGMEM
-#define MAP_NR(addr) ((__pa(addr) - PHYS_OFFSET) >> PAGE_SHIFT)
-#define virt_to_page(kaddr) (mem_map + ((__pa(kaddr) - PHYS_OFFSET) >> PAGE_SHIFT))
+#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT) - \
+ (PHYS_OFFSET >> PAGE_SHIFT))
#define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
#endif
diff --git a/include/asm-arm/pgalloc.h b/include/asm-arm/pgalloc.h
index c0548236b..a16a0d54c 100644
--- a/include/asm-arm/pgalloc.h
+++ b/include/asm-arm/pgalloc.h
@@ -5,7 +5,6 @@
#define _ASMARM_PGALLOC_H
#include <linux/config.h>
-#include <linux/threads.h>
#include <asm/processor.h>
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index 850ea4139..65b39ad72 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -7,7 +7,6 @@
#include <linux/config.h>
#include <asm/arch/memory.h>
#include <asm/proc-fns.h>
-#include <asm/system.h>
/*
* PMD_SHIFT determines the size of the area a second-level page table can map
@@ -80,7 +79,8 @@ extern void __handle_bad_pmd_kernel(pmd_t *pmd);
#define pte_clear(ptep) set_pte((ptep), __pte(0))
#ifndef CONFIG_DISCONTIGMEM
-#define pte_page(x) (mem_map + (unsigned long)(((pte_val(pte) - PHYS_OFFSET) >> PAGE_SHIFT)))
+#define pte_page(x) (mem_map + (pte_val((x)) >> PAGE_SHIFT) - \
+ (PHYS_OFFSET >> PAGE_SHIFT))
#else
/*
* I'm not happy with this - we needlessly convert a physical address
@@ -88,7 +88,7 @@ extern void __handle_bad_pmd_kernel(pmd_t *pmd);
* which, if __va and __pa are expensive causes twice the expense for
* zero gain. --rmk
*/
-#define pte_page(x) (mem_map + MAP_NR(__va(pte_val(pte))))
+#define pte_page(x) (mem_map + MAP_NR(__va(pte_val((x)))))
#endif
#define pmd_none(pmd) (!pmd_val(pmd))
@@ -173,9 +173,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
#define module_map vmalloc
#define module_unmap vfree
-/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
-#define PageSkip(page) (machine_is_riscpc() && test_bit(PG_skip, &(page)->flags))
-
#define io_remap_page_range remap_page_range
#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-arm/proc-armo/assembler.h b/include/asm-arm/proc-armo/assembler.h
index d611ea4dd..42b23aa89 100644
--- a/include/asm-arm/proc-armo/assembler.h
+++ b/include/asm-arm/proc-armo/assembler.h
@@ -6,10 +6,6 @@
* This file contains arm architecture specific defines
* for the different processors
*/
-#ifndef __ASSEMBLY__
-#error "Only include this from assembly code"
-#endif
-
#define MODE_USR USR26_MODE
#define MODE_FIQ FIQ26_MODE
#define MODE_IRQ IRQ26_MODE
@@ -60,3 +56,25 @@
#define SVCMODE(tmpreg)\
teqp pc, $0x00000003;\
mov r0, r0
+
+
+/*
+ * Save the current IRQ state and disable IRQs
+ * Note that this macro assumes FIQs are enabled, and
+ * that the processor is in SVC mode.
+ */
+ .macro save_and_disable_irqs, oldcpsr, temp
+ mov \oldcpsr, pc
+ orr \temp, \oldcpsr, #0x08000000
+ teqp \temp, #0
+ .endm
+
+/*
+ * Restore interrupt state previously stored in
+ * a register
+ * ** Actually do nothing on Arc - hope that the caller uses a MOVS PC soon
+ * after!
+ */
+ .macro restore_irqs, oldcpsr
+ @ This be restore_irqs
+ .endm
diff --git a/include/asm-arm/proc-armo/cache.h b/include/asm-arm/proc-armo/cache.h
index 75250fb3b..ca99bcf82 100644
--- a/include/asm-arm/proc-armo/cache.h
+++ b/include/asm-arm/proc-armo/cache.h
@@ -10,6 +10,9 @@
#define flush_icache_page(vma,page) do { } while (0)
#define flush_icache_range(start,end) do { } while (0)
+/* DAG: ARM3 will flush cache on MEMC updates anyway? so don't bother */
+#define clean_cache_area(_start,_size) do { } while (0)
+
/*
* TLB flushing:
*
diff --git a/include/asm-arm/proc-armo/locks.h b/include/asm-arm/proc-armo/locks.h
new file mode 100644
index 000000000..fcf0cab01
--- /dev/null
+++ b/include/asm-arm/proc-armo/locks.h
@@ -0,0 +1,158 @@
+/*
+ * linux/include/asm-arm/proc-armo/locks.h
+ *
+ * Copyright (C) 2000 Russell King
+ * Fixes for 26 bit machines, (C) 2000 Dave Gilbert
+ *
+ * Interrupt safe locking assembler.
+ *
+ */
+#ifndef __ASM_PROC_LOCKS_H
+#define __ASM_PROC_LOCKS_H
+
+/* Decrements by 1, fails if value < 0 */
+#define __down_op(ptr,fail) \
+ ({ \
+ __asm__ __volatile__ ( \
+ "@ atomic down operation\n" \
+" mov r0, pc\n" \
+" orr lr, r0, #0x08000000\n" \
+" teqp lr, #0\n" \
+" ldr lr, [%0]\n" \
+" and r0, r0, #0x0c000003\n" \
+" subs lr, lr, #1\n" \
+" str lr, [%0]\n" \
+" orrmi r0, r0, #0x80000000 @ set N\n" \
+" teqp r0, #0\n" \
+" movmi r0, %0\n" \
+" blmi " SYMBOL_NAME_STR(fail) \
+ : \
+ : "r" (ptr) \
+ : "r0", "lr", "cc"); \
+ })
+
+#define __down_op_ret(ptr,fail) \
+ ({ \
+ unsigned int result; \
+ __asm__ __volatile__ ( \
+" @ down_op_ret\n" \
+" mov r0, pc\n" \
+" orr lr, r0, #0x08000000\n" \
+" teqp lr, #0\n" \
+" ldr lr, [%1]\n" \
+" and r0, r0, #0x0c000003\n" \
+" subs lr, lr, #1\n" \
+" str lr, [%1]\n" \
+" orrmi r0, r0, #0x80000000 @ set N\n" \
+" teqp r0, #0\n" \
+" movmi r0, %1\n" \
+" movpl r0, #0\n" \
+" blmi " SYMBOL_NAME_STR(fail) "\n" \
+" mov %0, r0" \
+ : "=&r" (result) \
+ : "r" (ptr) \
+ : "r0", "lr", "cc"); \
+ result; \
+ })
+
+#define __up_op(ptr,wake) \
+ ({ \
+ __asm__ __volatile__ ( \
+ "@ up_op\n" \
+" mov r0, pc\n" \
+" orr lr, r0, #0x08000000\n" \
+" teqp lr, #0\n" \
+" ldr lr, [%0]\n" \
+" and r0, r0, #0x0c000003\n" \
+" adds lr, lr, #1\n" \
+" str lr, [%0]\n" \
+" orrle r0, r0, #0x80000000 @ set N - should this be mi ??? DAG ! \n" \
+" teqp r0, #0\n" \
+" movmi r0, %0\n" \
+" blmi " SYMBOL_NAME_STR(wake) \
+ : \
+ : "r" (ptr) \
+ : "r0", "lr", "cc"); \
+ })
+
+/*
+ * The value 0x01000000 supports up to 128 processors and
+ * lots of processes. BIAS must be chosen such that sub'ing
+ * BIAS once per CPU will result in the long remaining
+ * negative.
+ */
+#define RW_LOCK_BIAS 0x01000000
+#define RW_LOCK_BIAS_STR "0x01000000"
+
+/* Decrements by RW_LOCK_BIAS rather than 1, fails if value != 0 */
+#define __down_op_write(ptr,fail) \
+ ({ \
+ __asm__ __volatile__( \
+ "@ down_op_write\n" \
+" mov r0, pc\n" \
+" orr lr, r0, #0x08000000\n" \
+" teqp lr, #0\n" \
+" and r0, r0, #0x0c000003\n" \
+\
+" ldr lr, [%0]\n" \
+" subs lr, lr, %1\n" \
+" str lr, [%0]\n" \
+\
+" orreq r0, r0, #0x40000000 @ set Z \n"\
+" teqp r0, #0\n" \
+" movne r0, %0\n" \
+" blne " SYMBOL_NAME_STR(fail) \
+ : \
+ : "r" (ptr), "I" (RW_LOCK_BIAS) \
+ : "r0", "lr", "cc"); \
+ })
+
+/* Increments by RW_LOCK_BIAS, wakes if value >= 0 */
+#define __up_op_write(ptr,wake) \
+ ({ \
+ __asm__ __volatile__( \
+ "@ up_op_read\n" \
+" mov r0, pc\n" \
+" orr lr, r0, #0x08000000\n" \
+" teqp lr, #0\n" \
+\
+" ldr lr, [%0]\n" \
+" and r0, r0, #0x0c000003\n" \
+" adds lr, lr, %1\n" \
+" str lr, [%0]\n" \
+\
+" orrcs r0, r0, #0x20000000 @ set C\n" \
+" teqp r0, #0\n" \
+" movcs r0, %0\n" \
+" blcs " SYMBOL_NAME_STR(wake) \
+ : \
+ : "r" (ptr), "I" (RW_LOCK_BIAS) \
+ : "r0", "lr", "cc"); \
+ })
+
+#define __down_op_read(ptr,fail) \
+ __down_op(ptr, fail)
+
+#define __up_op_read(ptr,wake) \
+ ({ \
+ __asm__ __volatile__( \
+ "@ up_op_read\n" \
+" mov r0, pc\n" \
+" orr lr, r0, #0x08000000\n" \
+" teqp lr, #0\n" \
+\
+" ldr lr, [%0]\n" \
+" and r0, r0, #0x0c000003\n" \
+" adds lr, lr, %1\n" \
+" str lr, [%0]\n" \
+\
+" orreq r0, r0, #0x40000000 @ Set Z \n" \
+" teqp r0, #0\n" \
+" moveq r0, %0\n" \
+" bleq " SYMBOL_NAME_STR(wake) \
+ : \
+ : "r" (ptr), "I" (1) \
+ : "r0", "lr", "cc"); \
+ })
+
+#endif
diff --git a/include/asm-arm/proc-armo/system.h b/include/asm-arm/proc-armo/system.h
index 36a3515e7..42a6bc70a 100644
--- a/include/asm-arm/proc-armo/system.h
+++ b/include/asm-arm/proc-armo/system.h
@@ -77,6 +77,24 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int
: "memory"); \
} while(0)
+#define __clf() do { \
+ unsigned long temp; \
+ __asm__ __volatile__( \
+" mov %0, pc @ clf\n" \
+" orr %0, %0, #0x04000000\n" \
+" teqp %0, #0\n" \
+ : "=r" (temp)); \
+ } while(0)
+
+#define __stf() do { \
+ unsigned long temp; \
+ __asm__ __volatile__( \
+" mov %0, pc @ stf\n" \
+" bic %0, %0, #0x04000000\n" \
+" teqp %0, #0\n" \
+ : "=r" (temp)); \
+ } while(0)
+
/*
* save current IRQ & FIQ state
*/
diff --git a/include/asm-arm/proc-armv/assembler.h b/include/asm-arm/proc-armv/assembler.h
index 788a22b87..aaec7f9c7 100644
--- a/include/asm-arm/proc-armv/assembler.h
+++ b/include/asm-arm/proc-armv/assembler.h
@@ -6,10 +6,6 @@
* This file contains ARM processor specifics for
* the ARM6 and better processors.
*/
-#ifndef __ASSEMBLY__
-#error "Only include this from assembly code"
-#endif
-
#define MODE_USR USR_MODE
#define MODE_FIQ FIQ_MODE
#define MODE_IRQ IRQ_MODE
@@ -35,9 +31,8 @@
instr regs
/*
- * Save the current IRQ state and disable IRQs
- * Note that this macro assumes FIQs are enabled, and
- * that the processor is in SVC mode.
+ * Save the current IRQ state and disable IRQs. Note that this macro
+ * assumes FIQs are enabled, and that the processor is in SVC mode.
*/
.macro save_and_disable_irqs, oldcpsr, temp
mrs \oldcpsr, cpsr
@@ -46,8 +41,8 @@
.endm
/*
- * Restore interrupt state previously stored in
- * a register
+ * Restore interrupt state previously stored in a register. We don't
+ * guarantee that this will preserve the flags.
*/
.macro restore_irqs, oldcpsr
msr cpsr_c, \oldcpsr
diff --git a/include/asm-arm/proc-armv/elf.h b/include/asm-arm/proc-armv/elf.h
index 3c41d577b..c5eb263aa 100644
--- a/include/asm-arm/proc-armv/elf.h
+++ b/include/asm-arm/proc-armv/elf.h
@@ -17,6 +17,6 @@
there is no other ELF system currently supported by iBCS.
@@ Could print a warning message to encourage users to upgrade. */
#define SET_PERSONALITY(ex,ibcs2) \
- set_personality((ex).e_flags&EF_ARM_APCS26 ?PER_LINUX :PER_LINUX_32BIT)
+ set_personality(((ex).e_flags&EF_ARM_APCS26 ?PER_LINUX :PER_LINUX_32BIT))
#endif
diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h
index d9ef8ffd9..e05e6356f 100644
--- a/include/asm-arm/proc-armv/system.h
+++ b/include/asm-arm/proc-armv/system.h
@@ -79,6 +79,36 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */
})
/*
+ * Enable FIQs
+ */
+#define __stf() \
+ ({ \
+ unsigned long temp; \
+ __asm__ __volatile__( \
+ "mrs %0, cpsr @ stf\n" \
+" bic %0, %0, #64\n" \
+" msr cpsr_c, %0" \
+ : "=r" (temp) \
+ : \
+ : "memory"); \
+ })
+
+/*
+ * Disable FIQs
+ */
+#define __clf() \
+ ({ \
+ unsigned long temp; \
+ __asm__ __volatile__( \
+ "mrs %0, cpsr @ clf\n" \
+" orr %0, %0, #64\n" \
+" msr cpsr_c, %0" \
+ : "=r" (temp) \
+ : \
+ : "memory"); \
+ })
+
+/*
* save current IRQ & FIQ state
*/
#define __save_flags(x) \
diff --git a/include/asm-arm/proc-armv/uaccess.h b/include/asm-arm/proc-armv/uaccess.h
index 67afdd2ae..af146abf9 100644
--- a/include/asm-arm/proc-armv/uaccess.h
+++ b/include/asm-arm/proc-armv/uaccess.h
@@ -41,7 +41,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
"2:\n" \
" .section .fixup,\"ax\"\n" \
" .align 2\n" \
- "3: mvn %0, %3\n" \
+ "3: mov %0, %3\n" \
" b 2b\n" \
" .previous\n" \
" .section __ex_table,\"a\"\n" \
@@ -49,7 +49,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
" .long 1b, 3b\n" \
" .previous" \
: "=r" (err) \
- : "r" (x), "r" (addr), "i" (EFAULT), "0" (err))
+ : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err))
#define __put_user_asm_half(x,addr,err) \
({ \
@@ -60,7 +60,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
"3:\n" \
" .section .fixup,\"ax\"\n" \
" .align 2\n" \
- "4: mvn %0, %5\n" \
+ "4: mov %0, %5\n" \
" b 3b\n" \
" .previous\n" \
" .section __ex_table,\"a\"\n" \
@@ -71,7 +71,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
: "=r" (err) \
: "r" (__temp), "r" (__temp >> 8), \
"r" (addr), "r" ((int)(addr) + 1), \
- "i" (EFAULT), "0" (err)); \
+ "i" (-EFAULT), "0" (err)); \
})
#define __put_user_asm_word(x,addr,err) \
@@ -80,7 +80,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
"2:\n" \
" .section .fixup,\"ax\"\n" \
" .align 2\n" \
- "3: mvn %0, %3\n" \
+ "3: mov %0, %3\n" \
" b 2b\n" \
" .previous\n" \
" .section __ex_table,\"a\"\n" \
@@ -88,7 +88,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
" .long 1b, 3b\n" \
" .previous" \
: "=r" (err) \
- : "r" (x), "r" (addr), "i" (EFAULT), "0" (err))
+ : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err))
#define __get_user_asm_byte(x,addr,err) \
__asm__ __volatile__( \
@@ -96,7 +96,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
"2:\n" \
" .section .fixup,\"ax\"\n" \
" .align 2\n" \
- "3: mvn %0, %3\n" \
+ "3: mov %0, %3\n" \
" mov %1, #0\n" \
" b 2b\n" \
" .previous\n" \
@@ -105,7 +105,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
" .long 1b, 3b\n" \
" .previous" \
: "=r" (err), "=r" (x) \
- : "r" (addr), "i" (EFAULT), "0" (err))
+ : "r" (addr), "i" (-EFAULT), "0" (err))
#define __get_user_asm_half(x,addr,err) \
({ \
@@ -117,7 +117,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
"3:\n" \
" .section .fixup,\"ax\"\n" \
" .align 2\n" \
- "4: mvn %0, %5\n" \
+ "4: mov %0, %5\n" \
" mov %1, #0\n" \
" b 3b\n" \
" .previous\n" \
@@ -128,7 +128,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
" .previous" \
: "=r" (err), "=r" (x), "=&r" (__temp) \
: "r" (addr), "r" ((int)(addr) + 1), \
- "i" (EFAULT), "0" (err)); \
+ "i" (-EFAULT), "0" (err)); \
})
@@ -138,7 +138,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
"2:\n" \
" .section .fixup,\"ax\"\n" \
" .align 2\n" \
- "3: mvn %0, %3\n" \
+ "3: mov %0, %3\n" \
" mov %1, #0\n" \
" b 2b\n" \
" .previous\n" \
@@ -147,7 +147,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
" .long 1b, 3b\n" \
" .previous" \
: "=r" (err), "=r" (x) \
- : "r" (addr), "i" (EFAULT), "0" (err))
+ : "r" (addr), "i" (-EFAULT), "0" (err))
extern unsigned long __arch_copy_from_user(void *to, const void *from, unsigned long n);
#define __do_copy_from_user(to,from,n) \
diff --git a/include/asm-arm/resource.h b/include/asm-arm/resource.h
index aea5122a0..8a26bc85d 100644
--- a/include/asm-arm/resource.h
+++ b/include/asm-arm/resource.h
@@ -18,26 +18,26 @@
#define RLIM_NLIMITS 10
+#ifdef __KERNEL__
+
/*
* SuS says limits have to be unsigned.
* Which makes a ton more sense anyway.
*/
#define RLIM_INFINITY (~0UL)
-#ifdef __KERNEL__
-
-#define INIT_RLIMITS \
-{ \
- { LONG_MAX, LONG_MAX }, \
- { LONG_MAX, LONG_MAX }, \
- { LONG_MAX, LONG_MAX }, \
- { _STK_LIM, _STK_LIM }, \
- { 0, LONG_MAX }, \
- { LONG_MAX, LONG_MAX }, \
- { 0, 0 }, \
- { INR_OPEN, INR_OPEN }, \
- { LONG_MAX, LONG_MAX }, \
- { LONG_MAX, LONG_MAX }, \
+#define INIT_RLIMITS \
+{ \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { _STK_LIM, RLIM_INFINITY }, \
+ { 0, RLIM_INFINITY }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { 0, 0 }, \
+ { INR_OPEN, INR_OPEN }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
+ { RLIM_INFINITY, RLIM_INFINITY }, \
}
#endif /* __KERNEL__ */
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index c7f71bb14..a1142be1a 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -1,11 +1,10 @@
#ifndef __ASM_ARM_SYSTEM_H
#define __ASM_ARM_SYSTEM_H
-#include <linux/kernel.h>
-
#ifdef __KERNEL__
#include <linux/config.h>
+#include <linux/linkage.h>
/* information about the system we're running on */
extern unsigned int system_rev;
@@ -13,365 +12,14 @@ extern unsigned int system_serial_low;
extern unsigned int system_serial_high;
extern unsigned int mem_fclk_21285;
-/* The type of machine we're running on */
-extern unsigned int __machine_arch_type;
-
-/* see arch/arm/kernel/arch.c for a description of these */
-#define MACH_TYPE_EBSA110 0
-#define MACH_TYPE_RISCPC 1
-#define MACH_TYPE_NEXUSPCI 3
-#define MACH_TYPE_EBSA285 4
-#define MACH_TYPE_NETWINDER 5
-#define MACH_TYPE_CATS 6
-#define MACH_TYPE_TBOX 7
-#define MACH_TYPE_CO285 8
-#define MACH_TYPE_CLPS7110 9
-#define MACH_TYPE_ARCHIMEDES 10
-#define MACH_TYPE_A5K 11
-#define MACH_TYPE_ETOILE 12
-#define MACH_TYPE_LACIE_NAS 13
-#define MACH_TYPE_CLPS7500 14
-#define MACH_TYPE_SHARK 15
-#define MACH_TYPE_BRUTUS 16
-#define MACH_TYPE_PERSONAL_SERVER 17
-#define MACH_TYPE_ITSY 18
-#define MACH_TYPE_L7200 19
-/* 20 is free - contact rmk@arm.linux.org.uk directly if you wish to use this number */
-#define MACH_TYPE_INTEGRATOR 21
-#define MACH_TYPE_BITSY 22
-#define MACH_TYPE_IXP1200 23
-#define MACH_TYPE_THINCLIENT 24
-#define MACH_TYPE_ASSABET 25
-#define MACH_TYPE_VICTOR 26
-#define MACH_TYPE_LART 27
-#define MACH_TYPE_RANGER 28
-#define MACH_TYPE_GRAPHICSCLIENT 29
-#define MACH_TYPE_XP860 30
-
/*
- * Sort out a definition for machine_arch_type
- * The rules are:
- * 1. If one architecture is selected, then all machine_is_xxx()
- * are constant.
- * 2. If two or more architectures are selected, then the selected
- * machine_is_xxx() are variable, and the unselected machine_is_xxx()
- * are constant zero.
- *
- * In general, you should use machine_is_xxxx() in your code, not:
- * - switch (machine_arch_type) { }
- * - if (machine_arch_type = xxxx)
- * - __machine_arch_type
- *
- * Please note that these are kept in numeric order (ie, the same
- * order as the list above).
+ * This tells us if we have an ISA bridge
+ * present in a PCI system.
*/
-#ifdef CONFIG_ARCH_EBSA110
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_EBSA110
-# endif
-# define machine_is_ebsa110() (machine_arch_type == MACH_TYPE_EBSA110)
-#else
-# define machine_is_ebsa110() (0)
-#endif
-
-#ifdef CONFIG_ARCH_RPC
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_RISCPC
-# endif
-# define machine_is_riscpc() (machine_arch_type == MACH_TYPE_RISCPC)
-#else
-# define machine_is_riscpc() (0)
-#endif
-
-#ifdef CONFIG_ARCH_EBSA285
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_EBSA285
-# endif
-# define machine_is_ebsa285() (machine_arch_type == MACH_TYPE_EBSA285)
-#else
-# define machine_is_ebsa285() (0)
-#endif
-
-#ifdef CONFIG_ARCH_NETWINDER
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_NETWINDER
-# endif
-# define machine_is_netwinder() (machine_arch_type == MACH_TYPE_NETWINDER)
-#else
-# define machine_is_netwinder() (0)
-#endif
-
-#ifdef CONFIG_ARCH_CATS
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_CATS
-# endif
-# define machine_is_cats() (machine_arch_type == MACH_TYPE_CATS)
-#else
-# define machine_is_cats() (0)
-#endif
-
-#ifdef CONFIG_ARCH_CO285
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_CO285
-# endif
-# define machine_is_co285() (machine_arch_type == MACH_TYPE_CO285)
-#else
-# define machine_is_co285() (0)
-#endif
-
-#ifdef CONFIG_ARCH_ARC
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_ARCHIMEDES
-# endif
-# define machine_is_arc() (machine_arch_type == MACH_TYPE_ARCHIMEDES)
-#else
-# define machine_is_arc() (0)
-#endif
-
-#ifdef CONFIG_ARCH_A5K
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_A5K
-# endif
-# define machine_is_a5k() (machine_arch_type == MACH_TYPE_A5K)
-#else
-# define machine_is_a5k() (0)
-#endif
-
-#ifdef CONFIG_ARCH_CLPS7500
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_CLPS7500
-# endif
-# define machine_is_clps7500() (machine_arch_type == MACH_TYPE_CLPS7500)
-#else
-# define machine_is_clps7500() (0)
-#endif
-
-#ifdef CONFIG_ARCH_SHARK
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_SHARK
-# endif
-# define machine_is_shark() (machine_arch_type == MACH_TYPE_SHARK)
-#else
-# define machine_is_shark() (0)
-#endif
-
-#ifdef CONFIG_SA1100_BRUTUS
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_BRUTUS
-# endif
-# define machine_is_brutus() (machine_arch_type == MACH_TYPE_BRUTUS)
-#else
-# define machine_is_brutus() (0)
-#endif
-
-#ifdef CONFIG_ARCH_PERSONAL_SERVER
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_PERSONAL_SERVER
-# endif
-# define machine_is_personal_server() (machine_arch_type == MACH_TYPE_PERSONAL_SERVER)
-#else
-# define machine_is_personal_server() (0)
-#endif
-
-#ifdef CONFIG_SA1100_ITSY
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_ITSY
-# endif
-# define machine_is_itsy() (machine_arch_type == MACH_TYPE_ITSY)
-#else
-# define machine_is_itsy() (0)
-#endif
-
-#ifdef CONFIG_ARCH_L7200
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_L7200
-# endif
-# define machine_is_l7200() (machine_arch_type == MACH_TYPE_L7200)
+#ifdef CONFIG_PCI
+extern int have_isa_bridge;
#else
-# define machine_is_l7200() (0)
-#endif
-
-#ifdef CONFIG_SA1100_BITSY
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_BITSY
-# endif
-# define machine_is_bitsy() (machine_arch_type == MACH_TYPE_BITSY)
-#else
-# define machine_is_bitsy() (0)
-#endif
-
-#ifdef CONFIG_SA1100_THINCLIENT
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_THINCLIENT
-# endif
-# define machine_is_thinclient() (machine_arch_type == MACH_TYPE_THINCLIENT)
-#else
-# define machine_is_thinclient() (0)
-#endif
-
-#ifdef CONFIG_SA1100_ASSABET
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_ASSABET
-# endif
-# define machine_is_assabet() (machine_arch_type == MACH_TYPE_ASSABET)
-#else
-# define machine_is_assabet() (0)
-#endif
-
-#ifdef CONFIG_SA1100_VICTOR
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_VICTOR
-# endif
-# define machine_is_victor() (machine_arch_type == MACH_TYPE_VICTOR)
-#else
-# define machine_is_victor() (0)
-#endif
-
-#ifdef CONFIG_SA1100_LART
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_LART
-# endif
-# define machine_is_lart() (machine_arch_type == MACH_TYPE_LART)
-#else
-# define machine_is_lart() (0)
-#endif
-
-#ifdef CONFIG_SA1100_GRAPHICSCLIENT
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_GRAPHICSCLIENT
-# endif
-# define machine_is_grpahicsclient() \
- (machine_arch_type == MACH_TYPE_GRAPHICSCLIENT)
-#else
-# define machine_is_graphicsclient() \
- (0)
-#endif
-
-#ifdef CONFIG_SA1100_XP860
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_XP860
-# endif
-# define machine_is_xp860() (machine_arch_type == MACH_TYPE_XP860)
-#else
-# define machine_is_xp860() (0)
-#endif
-
-/*
- * The following are currently unregistered
- */
-#ifdef CONFIG_SA1100_EMPEG
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_EMPEG
-# endif
-# define machine_is_empeg() (machine_arch_type == MACH_TYPE_EMPEG)
-#else
-# define machine_is_empeg() (0)
-#endif
-
-#ifdef CONFIG_SA1100_TIFON
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_TIFON
-# endif
-# define machine_is_tifon() (machine_arch_type == MACH_TYPE_TIFON)
-#else
-# define machine_is_tifon() (0)
-#endif
-
-#ifdef CONFIG_SA1100_PLEB
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_PLEB
-# endif
-# define machine_is_pleb() (machine_arch_type == MACH_TYPE_PLEB)
-#else
-# define machine_is_pleb() (0)
-#endif
-
-#ifdef CONFIG_SA1100_PENNY
-# ifdef machine_arch_type
-# undef machine_arch_type
-# define machine_arch_type __machine_arch_type
-# else
-# define machine_arch_type MACH_TYPE_PENNY
-# endif
-# define machine_is_penny() (machine_arch_type == MACH_TYPE_PENNY)
-#else
-# define machine_is_penny() (0)
-#endif
-
-#ifndef machine_arch_type
-#define machine_arch_type __machine_arch_type
+#define have_isa_bridge (0)
#endif
#include <asm/proc-fns.h>
@@ -408,8 +56,6 @@ extern struct task_struct *__switch_to(struct task_struct *prev, struct task_str
mb(); \
} while (0)
-#endif
-
/* For spinlocks etc */
#define local_irq_save(x) __save_flags_cli(x)
#define local_irq_restore(x) __restore_flags(x)
@@ -422,10 +68,14 @@ extern struct task_struct *__switch_to(struct task_struct *prev, struct task_str
#define cli() __cli()
#define sti() __sti()
+#define clf() __clf()
+#define stf() __stf()
#define save_flags(x) __save_flags(x)
#define restore_flags(x) __restore_flags(x)
#define save_flags_cli(x) __save_flags_cli(x)
-#endif
+#endif /* CONFIG_SMP */
+
+#endif /* __KERNEL__ */
#endif
diff --git a/include/asm-arm/termbits.h b/include/asm-arm/termbits.h
index 9922760e4..198181423 100644
--- a/include/asm-arm/termbits.h
+++ b/include/asm-arm/termbits.h
@@ -1,8 +1,6 @@
#ifndef __ASM_ARM_TERMBITS_H
#define __ASM_ARM_TERMBITS_H
-#include <linux/posix_types.h>
-
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
diff --git a/include/asm-arm/termios.h b/include/asm-arm/termios.h
index c45cea198..6d589dd1d 100644
--- a/include/asm-arm/termios.h
+++ b/include/asm-arm/termios.h
@@ -68,8 +68,6 @@ struct termio {
#ifdef __KERNEL__
-#include <linux/string.h>
-
/*
* Translate a "termio" structure into a "termios". Ugh.
*/
diff --git a/include/asm-arm/uaccess.h b/include/asm-arm/uaccess.h
index 8bcfa7078..add086e55 100644
--- a/include/asm-arm/uaccess.h
+++ b/include/asm-arm/uaccess.h
@@ -46,7 +46,14 @@ extern __inline__ int verify_area(int type, const void * addr, unsigned long siz
/*
* Single-value transfer routines. They automatically use the right
- * size if we just have the right pointer type.
+ * size if we just have the right pointer type. Note that the functions
+ * which read from user space (*get_*) need to take care not to leak
+ * kernel data even if the calling code is buggy and fails to check
+ * the return value. This means zeroing out the destination variable
+ * or buffer on error. Normally this is done out of line by the
+ * fixup code, but there are a few places where it intrudes on the
+ * main code path. When we only write to user space, there is no
+ * problem.
*
* The "__xxx" versions of the user access functions do not verify the
* address space - it must have been done previously with a separate
@@ -54,24 +61,27 @@ extern __inline__ int verify_area(int type, const void * addr, unsigned long siz
*
* The "xxx_ret" versions return constant specified in the third
* argument if something bad happens.
+ *
+ * The "xxx_error" versions set the third argument to EFAULT if an
+ * error occurs, and leave it unchanged on success. Note that these
+ * versions are void (ie, don't return a value as such).
*/
#define get_user(x,p) __get_user_check((x),(p),sizeof(*(p)))
#define __get_user(x,p) __get_user_nocheck((x),(p),sizeof(*(p)))
+#define __get_user_error(x,p,e) __get_user_nocheck_error((x),(p),sizeof(*(p)),(e))
#define get_user_ret(x,p,r) ({ if (get_user(x,p)) return r; })
#define __get_user_ret(x,p,r) ({ if (__get_user(x,p)) return r; })
#define put_user(x,p) __put_user_check((__typeof(*(p)))(x),(p),sizeof(*(p)))
#define __put_user(x,p) __put_user_nocheck((__typeof(*(p)))(x),(p),sizeof(*(p)))
+#define __put_user_error(x,p,e) __put_user_nocheck_error((x),(p),sizeof(*(p)),(e))
#define put_user_ret(x,p,r) ({ if (put_user(x,p)) return r; })
#define __put_user_ret(x,p,r) ({ if (__put_user(x,p)) return r; })
static __inline__ unsigned long copy_from_user(void *to, const void *from, unsigned long n)
{
- char *end = (char *)to + n;
- if (access_ok(VERIFY_READ, from, n)) {
+ if (access_ok(VERIFY_READ, from, n))
__do_copy_from_user(to, from, n);
- if (n) memset(end - n, 0, n);
- }
return n;
}
@@ -147,26 +157,38 @@ extern __inline__ long strnlen_user(const char *s, long n)
({ \
long __gu_err = -EFAULT, __gu_val = 0; \
const __typeof__(*(ptr)) *__gu_addr = (ptr); \
- if (access_ok(VERIFY_READ,__gu_addr,size)) \
+ if (access_ok(VERIFY_READ,__gu_addr,size)) { \
+ __gu_err = 0; \
__get_user_size(__gu_val,__gu_addr,(size),__gu_err); \
+ } \
(x) = (__typeof__(*(ptr)))__gu_val; \
__gu_err; \
})
#define __get_user_nocheck(x,ptr,size) \
({ \
- long __gu_err = 0, __gu_val = 0; \
+ long __gu_err = 0, __gu_val; \
__get_user_size(__gu_val,(ptr),(size),__gu_err); \
(x) = (__typeof__(*(ptr)))__gu_val; \
__gu_err; \
})
+#define __get_user_nocheck_error(x,ptr,size,err) \
+({ \
+ long __gu_val; \
+ __get_user_size(__gu_val,(ptr),(size),(err)); \
+ (x) = (__typeof__(*(ptr)))__gu_val; \
+ (void) 0; \
+})
+
#define __put_user_check(x,ptr,size) \
({ \
long __pu_err = -EFAULT; \
__typeof__(*(ptr)) *__pu_addr = (ptr); \
- if (access_ok(VERIFY_WRITE,__pu_addr,size)) \
+ if (access_ok(VERIFY_WRITE,__pu_addr,size)) { \
+ __pu_err = 0; \
__put_user_size((x),__pu_addr,(size),__pu_err); \
+ } \
__pu_err; \
})
@@ -177,11 +199,16 @@ extern __inline__ long strnlen_user(const char *s, long n)
__pu_err; \
})
+#define __put_user_nocheck_error(x,ptr,size,err) \
+({ \
+ __put_user_size((x),(ptr),(size),err); \
+ (void) 0; \
+})
+
extern long __get_user_bad(void);
#define __get_user_size(x,ptr,size,retval) \
do { \
- retval = 0; \
switch (size) { \
case 1: __get_user_asm_byte(x,ptr,retval); break; \
case 2: __get_user_asm_half(x,ptr,retval); break; \
@@ -194,7 +221,6 @@ extern long __put_user_bad(void);
#define __put_user_size(x,ptr,size,retval) \
do { \
- retval = 0; \
switch (size) { \
case 1: __put_user_asm_byte(x,ptr,retval); break; \
case 2: __put_user_asm_half(x,ptr,retval); break; \
diff --git a/include/asm-arm/unaligned.h b/include/asm-arm/unaligned.h
index 2ff6723d8..44aa2e3b1 100644
--- a/include/asm-arm/unaligned.h
+++ b/include/asm-arm/unaligned.h
@@ -1,7 +1,7 @@
#ifndef __ASM_ARM_UNALIGNED_H
#define __ASM_ARM_UNALIGNED_H
-#include <linux/types.h>
+#include <asm/types.h>
extern int __bug_unaligned_x(void *ptr);
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 241cb03a8..9dcd00962 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -223,6 +223,7 @@
#define __NR_setgid32 (__NR_SYSCALL_BASE+214)
#define __NR_setfsuid32 (__NR_SYSCALL_BASE+215)
#define __NR_setfsgid32 (__NR_SYSCALL_BASE+216)
+#define __NR_getdents64 (__NR_SYSCALL_BASE+217)
#define __sys2(x) #x
#define __sys1(x) __sys2(x)
diff --git a/include/asm-arm/user.h b/include/asm-arm/user.h
index e49d3db8e..3e8b0f879 100644
--- a/include/asm-arm/user.h
+++ b/include/asm-arm/user.h
@@ -2,7 +2,7 @@
#define _ARM_USER_H
#include <asm/page.h>
-#include <linux/ptrace.h>
+#include <asm/ptrace.h>
/* Core file format: The core file is written in such a way that gdb
can understand it and provide useful information to the user (under
linux we use the 'trad-core' bfd). There are quite a number of
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index ce1662409..733ec4cc0 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -68,6 +68,7 @@ extern int get_maxlvt(void);
extern void connect_bsp_APIC (void);
extern void disconnect_bsp_APIC (void);
extern void disable_local_APIC (void);
+extern int verify_local_APIC (void);
extern void cache_APIC_registers (void);
extern void sync_Arb_IDs(void);
extern void setup_local_APIC (void);
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h
index d8a210952..a331d78b8 100644
--- a/include/asm-i386/apicdef.h
+++ b/include/asm-i386/apicdef.h
@@ -11,10 +11,12 @@
#define APIC_DEFAULT_PHYS_BASE 0xfee00000
#define APIC_ID 0x20
+#define APIC_ID_MASK (0x0F<<24)
#define GET_APIC_ID(x) (((x)>>24)&0x0F)
#define APIC_LVR 0x30
+#define APIC_LVR_MASK 0xFF00FF
#define GET_APIC_VERSION(x) ((x)&0xFF)
-#define GET_APIC_MAXLVT(x) (((x)>>16)&0x0F)
+#define GET_APIC_MAXLVT(x) (((x)>>16)&0xFF)
#define APIC_INTEGRATED(x) ((x)&0xF0)
#define APIC_TASKPRI 0x80
#define APIC_TPRI_MASK 0xFF
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index 04ec17c63..0ec21d98a 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -463,7 +463,7 @@ static void __init check_config(void)
&& boot_cpu_data.x86 == 5
&& boot_cpu_data.x86_model == 2
&& (boot_cpu_data.x86_mask < 6 || boot_cpu_data.x86_mask == 11))
- panic("Kernel compiled for PPro+, assumes a local APIC without the read-before-write bug!");
+ panic("Kernel compiled for PMMX+, assumes a local APIC without the read-before-write bug!");
#endif
/*
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index d98013db9..5c285aee7 100644
--- a/include/asm-i386/e820.h
+++ b/include/asm-i386/e820.h
@@ -28,9 +28,9 @@
struct e820map {
int nr_map;
struct e820entry {
- long long addr; /* start of memory segment */
- long long size; /* size of memory segment */
- long type; /* type of memory segment */
+ unsigned long long addr; /* start of memory segment */
+ unsigned long long size; /* size of memory segment */
+ unsigned long type; /* type of memory segment */
} map[E820MAX];
};
diff --git a/include/asm-i386/fcntl.h b/include/asm-i386/fcntl.h
index 971b563a8..5292b3798 100644
--- a/include/asm-i386/fcntl.h
+++ b/include/asm-i386/fcntl.h
@@ -35,6 +35,10 @@
#define F_SETSIG 10 /* for sockets. */
#define F_GETSIG 11 /* for sockets. */
+#define F_GETLK64 12 /* using 'struct flock64' */
+#define F_SETLK64 13
+#define F_SETLKW64 14
+
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
@@ -62,4 +66,12 @@ struct flock {
pid_t l_pid;
};
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
#endif
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index 75b33ae5c..0c201e1d2 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -10,7 +10,7 @@
* possibly do the LDT unload here?
*/
#define destroy_context(mm) do { } while(0)
-#define init_new_context(tsk,mm) do { } while (0)
+#define init_new_context(tsk,mm) 0
#ifdef CONFIG_SMP
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 36f4e3176..83ff6b8b7 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -225,6 +225,8 @@
#define __NR_mincore 218
#define __NR_madvise 219
#define __NR_madvise1 219 /* delete when C lib stub is removed */
+#define __NR_getdents64 220
+#define __NR_fcntl64 221
/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
diff --git a/include/asm-ia64/acpi-ext.h b/include/asm-ia64/acpi-ext.h
index c3999f148..24f9822e6 100644
--- a/include/asm-ia64/acpi-ext.h
+++ b/include/asm-ia64/acpi-ext.h
@@ -69,7 +69,7 @@ typedef struct {
u8 eid;
} acpi_entry_lsapic_t;
-typedef struct {
+typedef struct acpi_entry_iosapic {
u8 type;
u8 length;
u16 reserved;
diff --git a/include/asm-ia64/asmmacro.h b/include/asm-ia64/asmmacro.h
index 4991bb26e..614ca7e8e 100644
--- a/include/asm-ia64/asmmacro.h
+++ b/include/asm-ia64/asmmacro.h
@@ -23,7 +23,7 @@
#endif
#define ENTRY(name) \
- .align 16; \
+ .align 32; \
.proc name; \
name:
diff --git a/include/asm-ia64/efi.h b/include/asm-ia64/efi.h
index 543132486..5d311d32e 100644
--- a/include/asm-ia64/efi.h
+++ b/include/asm-ia64/efi.h
@@ -226,6 +226,7 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right)
}
extern void efi_init (void);
+extern void efi_map_pal_code (void);
extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
extern void efi_gettimeofday (struct timeval *tv);
extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */
diff --git a/include/asm-ia64/ia32.h b/include/asm-ia64/ia32.h
index 80cc76755..c6732837c 100644
--- a/include/asm-ia64/ia32.h
+++ b/include/asm-ia64/ia32.h
@@ -40,7 +40,6 @@ struct flock32 {
__kernel_off_t32 l_start;
__kernel_off_t32 l_len;
__kernel_pid_t32 l_pid;
- short __unused;
};
@@ -105,11 +104,21 @@ typedef struct {
} sigset32_t;
struct sigaction32 {
- unsigned int sa_handler; /* Really a pointer, but need to deal
- with 32 bits */
+ unsigned int sa_handler; /* Really a pointer, but need to deal
+ with 32 bits */
unsigned int sa_flags;
- unsigned int sa_restorer; /* Another 32 bit pointer */
- sigset32_t sa_mask; /* A 32 bit mask */
+ unsigned int sa_restorer; /* Another 32 bit pointer */
+ sigset32_t sa_mask; /* A 32 bit mask */
+};
+
+typedef unsigned int old_sigset32_t; /* at least 32 bits */
+
+struct old_sigaction32 {
+ unsigned int sa_handler; /* Really a pointer, but need to deal
+ with 32 bits */
+ old_sigset32_t sa_mask; /* A 32 bit mask */
+ unsigned int sa_flags;
+ unsigned int sa_restorer; /* Another 32 bit pointer */
};
typedef struct sigaltstack_ia32 {
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index a371f1361..0740af45f 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -47,6 +47,10 @@ phys_to_virt(unsigned long address)
return (void *) (address + PAGE_OFFSET);
}
+/*
+ * The following two macros are deprecated and scheduled for removal.
+ * Please use the PCI-DMA interface defined in <asm/pci.h> instead.
+ */
#define bus_to_virt phys_to_virt
#define virt_to_bus virt_to_phys
@@ -315,6 +319,7 @@ __writeq (unsigned long val, void *addr)
#define writeq(v,a) __writeq((v), (void *) (a))
#define __raw_writeb writeb
#define __raw_writew writew
+#define __raw_writel writel
#define __raw_writeq writeq
#ifndef inb_p
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index 890224329..3ac473f14 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -4,8 +4,8 @@
* Copyright (C) 1999 Silicon Graphics, Inc.
* Copyright (C) Srinivasa Thirumalachar <sprasad@engr.sgi.com>
* Copyright (C) Vijay Chander <vijay@engr.sgi.com>
- * Copyright (C) 1999 Hewlett-Packard Co.
- * Copyright (C) David Mosberger-Tang <davidm@hpl.hp.com>
+ * Copyright (C) 1999-2000 Hewlett-Packard Co.
+ * Copyright (C) 1999-2000 David Mosberger-Tang <davidm@hpl.hp.com>
*/
#ifndef _ASM_IA64_MACHVEC_H
#define _ASM_IA64_MACHVEC_H
@@ -21,6 +21,7 @@ struct pt_regs;
struct task_struct;
struct timeval;
struct vm_area_struct;
+struct acpi_entry_iosapic;
typedef void ia64_mv_setup_t (char **);
typedef void ia64_mv_irq_init_t (void);
@@ -30,15 +31,33 @@ typedef void ia64_mv_mca_init_t (void);
typedef void ia64_mv_mca_handler_t (void);
typedef void ia64_mv_cmci_handler_t (int, void *, struct pt_regs *);
typedef void ia64_mv_log_print_t (void);
+typedef void ia64_mv_register_iosapic_t (struct acpi_entry_iosapic *);
+
+extern void machvec_noop (void);
# if defined (CONFIG_IA64_HP_SIM)
# include <asm/machvec_hpsim.h>
# elif defined (CONFIG_IA64_DIG)
# include <asm/machvec_dig.h>
# elif defined (CONFIG_IA64_SGI_SN1_SIM)
-# include <asm/machvec_sgi_sn1_SIM.h>
+# include <asm/machvec_sn1.h>
# elif defined (CONFIG_IA64_GENERIC)
+# ifdef MACHVEC_PLATFORM_HEADER
+# include MACHVEC_PLATFORM_HEADER
+# else
+# define platform_name ia64_mv.name
+# define platform_setup ia64_mv.setup
+# define platform_irq_init ia64_mv.irq_init
+# define platform_map_nr ia64_mv.map_nr
+# define platform_mca_init ia64_mv.mca_init
+# define platform_mca_handler ia64_mv.mca_handler
+# define platform_cmci_handler ia64_mv.cmci_handler
+# define platform_log_print ia64_mv.log_print
+# define platform_pci_fixup ia64_mv.pci_fixup
+# define platform_register_iosapic ia64_mv.register_iosapic
+# endif
+
struct ia64_machine_vector {
const char *name;
ia64_mv_setup_t *setup;
@@ -49,6 +68,7 @@ struct ia64_machine_vector {
ia64_mv_mca_handler_t *mca_handler;
ia64_mv_cmci_handler_t *cmci_handler;
ia64_mv_log_print_t *log_print;
+ ia64_mv_register_iosapic_t *register_iosapic;
};
#define MACHVEC_INIT(name) \
@@ -61,22 +81,12 @@ struct ia64_machine_vector {
platform_mca_init, \
platform_mca_handler, \
platform_cmci_handler, \
- platform_log_print \
+ platform_log_print, \
+ platform_register_iosapic \
}
-# ifndef MACHVEC_INHIBIT_RENAMING
-# define platform_name ia64_mv.name
-# define platform_setup ia64_mv.setup
-# define platform_irq_init ia64_mv.irq_init
-# define platform_map_nr ia64_mv.map_nr
-# define platform_mca_init ia64_mv.mca_init
-# define platform_mca_handler ia64_mv.mca_handler
-# define platform_cmci_handler ia64_mv.cmci_handler
-# define platform_log_print ia64_mv.log_print
-# endif
-
extern struct ia64_machine_vector ia64_mv;
-extern void machvec_noop (void);
+extern void machvec_init (const char *name);
# else
# error Unknown configuration. Update asm-ia64/machvec.h.
@@ -104,5 +114,11 @@ extern void machvec_noop (void);
#ifndef platform_log_print
# define platform_log_print ((ia64_mv_log_print_t *) machvec_noop)
#endif
+#ifndef platform_pci_fixup
+# define platform_pci_fixup ((ia64_mv_pci_fixup_t *) machvec_noop)
+#endif
+#ifndef platform_register_iosapic
+# define platform_register_iosapic ((ia64_mv_register_iosapic_t *) machvec_noop)
+#endif
#endif /* _ASM_IA64_MACHVEC_H */
diff --git a/include/asm-ia64/machvec_dig.h b/include/asm-ia64/machvec_dig.h
index a63e586c8..dedf37cdd 100644
--- a/include/asm-ia64/machvec_dig.h
+++ b/include/asm-ia64/machvec_dig.h
@@ -5,6 +5,7 @@ extern ia64_mv_setup_t dig_setup;
extern ia64_mv_irq_init_t dig_irq_init;
extern ia64_mv_pci_fixup_t dig_pci_fixup;
extern ia64_mv_map_nr_t map_nr_dense;
+extern ia64_mv_register_iosapic_t dig_register_iosapic;
/*
* This stuff has dual use!
@@ -18,5 +19,6 @@ extern ia64_mv_map_nr_t map_nr_dense;
#define platform_irq_init dig_irq_init
#define platform_pci_fixup dig_pci_fixup
#define platform_map_nr map_nr_dense
+#define platform_register_iosapic dig_register_iosapic
#endif /* _ASM_IA64_MACHVEC_DIG_h */
diff --git a/include/asm-ia64/machvec_init.h b/include/asm-ia64/machvec_init.h
index 60859418a..2cae5accf 100644
--- a/include/asm-ia64/machvec_init.h
+++ b/include/asm-ia64/machvec_init.h
@@ -1,4 +1,6 @@
-#define MACHVEC_INHIBIT_RENAMING
+#define __MACHVEC_HDR(n) <asm/machvec_##n##.h>
+#define __MACHVEC_EXPAND(n) __MACHVEC_HDR(n)
+#define MACHVEC_PLATFORM_HEADER __MACHVEC_EXPAND(MACHVEC_PLATFORM_NAME)
#include <asm/machvec.h>
@@ -7,3 +9,5 @@
= MACHVEC_INIT(name);
#define MACHVEC_DEFINE(name) MACHVEC_HELPER(name)
+
+MACHVEC_DEFINE(MACHVEC_PLATFORM_NAME)
diff --git a/include/asm-ia64/mmu_context.h b/include/asm-ia64/mmu_context.h
index 22c2b2297..c50eacaf0 100644
--- a/include/asm-ia64/mmu_context.h
+++ b/include/asm-ia64/mmu_context.h
@@ -2,12 +2,13 @@
#define _ASM_IA64_MMU_CONTEXT_H
/*
- * Copyright (C) 1998, 1999 Hewlett-Packard Co
- * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com>
+ * Copyright (C) 1998-2000 Hewlett-Packard Co
+ * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com>
*/
#include <linux/config.h>
#include <linux/sched.h>
+#include <linux/spinlock.h>
#include <asm/processor.h>
@@ -26,21 +27,6 @@
* architecture manual guarantees this number to be in the range
* 18-24.
*
- * A context number has the following format:
- *
- * +--------------------+---------------------+
- * | generation number | region id |
- * +--------------------+---------------------+
- *
- * A context number of 0 is considered "invalid".
- *
- * The generation number is incremented whenever we end up having used
- * up all available region ids. At that point with flush the entire
- * TLB and reuse the first region id. The new generation number
- * ensures that when we context switch back to an old process, we do
- * not inadvertently end up using its possibly reused region id.
- * Instead, we simply allocate a new region id for that process.
- *
* Copyright (C) 1998 David Mosberger-Tang <davidm@hpl.hp.com>
*/
@@ -56,9 +42,15 @@
#define IA64_HW_CONTEXT_MASK ((1UL << IA64_HW_CONTEXT_BITS) - 1)
-extern unsigned long ia64_next_context;
+struct ia64_ctx {
+ spinlock_t lock;
+ unsigned int next; /* next context number to use */
+ unsigned int limit; /* next >= limit => must call wrap_mmu_context() */
+};
-extern void get_new_mmu_context (struct mm_struct *mm);
+extern struct ia64_ctx ia64_ctx;
+
+extern void wrap_mmu_context (struct mm_struct *mm);
static inline void
enter_lazy_tlb (struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
@@ -76,18 +68,31 @@ ia64_rid (unsigned long context, unsigned long region_addr)
}
extern inline void
+get_new_mmu_context (struct mm_struct *mm)
+{
+ spin_lock(&ia64_ctx.lock);
+ {
+ if (ia64_ctx.next >= ia64_ctx.limit)
+ wrap_mmu_context(mm);
+ mm->context = ia64_ctx.next++;
+ }
+ spin_unlock(&ia64_ctx.lock);
+
+}
+
+extern inline void
get_mmu_context (struct mm_struct *mm)
{
/* check if our ASN is of an older generation and thus invalid: */
- if (((mm->context ^ ia64_next_context) & ~IA64_HW_CONTEXT_MASK) != 0) {
+ if (mm->context == 0)
get_new_mmu_context(mm);
- }
}
-extern inline void
+extern inline int
init_new_context (struct task_struct *p, struct mm_struct *mm)
{
mm->context = 0;
+ return 0;
}
extern inline void
@@ -103,7 +108,7 @@ reload_context (struct mm_struct *mm)
unsigned long rid_incr = 0;
unsigned long rr0, rr1, rr2, rr3, rr4;
- rid = (mm->context & IA64_HW_CONTEXT_MASK);
+ rid = mm->context;
#ifndef CONFIG_IA64_TLB_CHECKS_REGION_NUMBER
rid <<= 3; /* make space for encoding the region number */
diff --git a/include/asm-ia64/offsets.h b/include/asm-ia64/offsets.h
index c5c02dedf..88cad88d5 100644
--- a/include/asm-ia64/offsets.h
+++ b/include/asm-ia64/offsets.h
@@ -11,10 +11,10 @@
#define PT_PTRACED_BIT 0
#define PT_TRACESYS_BIT 1
-#define IA64_TASK_SIZE 2768 /* 0xad0 */
+#define IA64_TASK_SIZE 2864 /* 0xb30 */
#define IA64_PT_REGS_SIZE 400 /* 0x190 */
#define IA64_SWITCH_STACK_SIZE 560 /* 0x230 */
-#define IA64_SIGINFO_SIZE 136 /* 0x88 */
+#define IA64_SIGINFO_SIZE 128 /* 0x80 */
#define UNW_FRAME_INFO_SIZE 448 /* 0x1c0 */
#define IA64_TASK_PTRACE_OFFSET 48 /* 0x30 */
@@ -23,7 +23,7 @@
#define IA64_TASK_PROCESSOR_OFFSET 100 /* 0x64 */
#define IA64_TASK_THREAD_OFFSET 896 /* 0x380 */
#define IA64_TASK_THREAD_KSP_OFFSET 896 /* 0x380 */
-#define IA64_TASK_THREAD_SIGMASK_OFFSET 2648 /* 0xa58 */
+#define IA64_TASK_THREAD_SIGMASK_OFFSET 2744 /* 0xab8 */
#define IA64_TASK_PID_OFFSET 188 /* 0xbc */
#define IA64_TASK_MM_OFFSET 88 /* 0x58 */
#define IA64_PT_REGS_CR_IPSR_OFFSET 0 /* 0x0 */
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index f046dad86..62881b538 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -100,13 +100,14 @@ typedef unsigned long pgprot_t;
#define MAP_NR_SN1(addr) (((unsigned long) (addr) - PAGE_OFFSET) >> PAGE_SHIFT)
#ifdef CONFIG_IA64_GENERIC
-# define virt_to_page(kaddr) (mem_map + platform_map_nr(kaddr))
+# include <asm/machvec.h>
+# define virt_to_page(kaddr) (mem_map + platform_map_nr(kaddr))
#elif defined (CONFIG_IA64_SN_SN1_SIM)
-# define virt_to_page(kaddr) (mem_map + MAP_NR_SN1(kaddr))
+# define virt_to_page(kaddr) (mem_map + MAP_NR_SN1(kaddr))
#else
-# define virt_to_page(kaddr) (mem_map + MAP_NR_DENSE(kaddr))
+# define virt_to_page(kaddr) (mem_map + MAP_NR_DENSE(kaddr))
#endif
-#define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
+#define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
# endif /* __KERNEL__ */
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 5169b3f82..d55b16253 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -18,7 +18,8 @@
* 00/03/07 davidm Updated pal_cache_flush() to be in sync with PAL v2.6.
* 00/03/23 cfleck Modified processor min-state save area to match updated PAL & SAL info
* 00/05/24 eranian Updated to latest PAL spec, fix structures bugs, added
- * 00/05/25 eranian Support for stack calls, and statis physical calls
+ * 00/05/25 eranian Support for stack calls, and static physical calls
+ * 00/06/18 eranian Support for stacked physical calls
*/
/*
@@ -646,10 +647,12 @@ struct ia64_pal_retval {
extern struct ia64_pal_retval ia64_pal_call_static (u64, u64, u64, u64);
extern struct ia64_pal_retval ia64_pal_call_stacked (u64, u64, u64, u64);
extern struct ia64_pal_retval ia64_pal_call_phys_static (u64, u64, u64, u64);
+extern struct ia64_pal_retval ia64_pal_call_phys_stacked (u64, u64, u64, u64);
#define PAL_CALL(iprv,a0,a1,a2,a3) iprv = ia64_pal_call_static(a0, a1, a2, a3)
#define PAL_CALL_STK(iprv,a0,a1,a2,a3) iprv = ia64_pal_call_stacked(a0, a1, a2, a3)
#define PAL_CALL_PHYS(iprv,a0,a1,a2,a3) iprv = ia64_pal_call_phys_static(a0, a1, a2, a3)
+#define PAL_CALL_PHYS_STK(iprv,a0,a1,a2,a3) iprv = ia64_pal_call_phys_stacked(a0, a1, a2, a3)
typedef int (*ia64_pal_handler) (u64, ...);
extern ia64_pal_handler ia64_pal;
@@ -951,7 +954,7 @@ typedef union pal_power_mgmt_info_u {
/* Return information about processor's optional power management capabilities. */
extern inline s64
ia64_pal_halt_info (pal_power_mgmt_info_u_t *power_buf)
-{
+{
struct ia64_pal_retval iprv;
PAL_CALL_STK(iprv, PAL_HALT_INFO, (unsigned long) power_buf, 0, 0);
return iprv.status;
@@ -1370,17 +1373,17 @@ typedef union pal_itr_valid_u {
dirty_bit_valid : 1,
mem_attr_valid : 1,
reserved : 60;
- } pal_itr_valid_s;
-} pal_itr_valid_u_t;
+ } pal_tr_valid_s;
+} pal_tr_valid_u_t;
/* Read a translation register */
extern inline s64
-ia64_pal_vm_tr_read (u64 reg_num, u64 tr_type, u64 tr_buffer, pal_itr_valid_u_t *itr_valid)
-{
+ia64_pal_tr_read (u64 reg_num, u64 tr_type, u64 *tr_buffer, pal_tr_valid_u_t *tr_valid)
+{
struct ia64_pal_retval iprv;
- PAL_CALL(iprv, PAL_VM_TR_READ, reg_num, tr_type, tr_buffer);
- if (itr_valid)
- itr_valid->piv_val = iprv.v0;
+ PAL_CALL_PHYS_STK(iprv, PAL_VM_TR_READ, reg_num, tr_type,(u64)__pa(tr_buffer));
+ if (tr_valid)
+ tr_valid->piv_val = iprv.v0;
return iprv.status;
}
diff --git a/include/asm-ia64/param.h b/include/asm-ia64/param.h
index bc4c19ae6..a410b8892 100644
--- a/include/asm-ia64/param.h
+++ b/include/asm-ia64/param.h
@@ -10,23 +10,13 @@
#include <linux/config.h>
-#ifdef CONFIG_IA64_HP_SIM
+#if defined(CONFIG_IA64_HP_SIM) || defined(CONFIG_IA64_SOFTSDV_HACKS)
/*
* Yeah, simulating stuff is slow, so let us catch some breath between
* timer interrupts...
*/
# define HZ 20
-#endif
-
-#ifdef CONFIG_IA64_DIG
-# ifdef CONFIG_IA64_SOFTSDV_HACKS
-# define HZ 20
-# else
-# define HZ 100
-# endif
-#endif
-
-#ifndef HZ
+#else
# define HZ 1024
#endif
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index 0c40b0e6b..01c038774 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -1,6 +1,14 @@
#ifndef _ASM_IA64_PCI_H
#define _ASM_IA64_PCI_H
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/spinlock.h>
+
+#include <asm/io.h>
+#include <asm/scatterlist.h>
+
/*
* Can be used to override the logic in pci_scan_bus for skipping
* already-configured bus numbers - to be used for buggy BIOSes or
@@ -11,6 +19,8 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
+struct pci_dev;
+
extern inline void pcibios_set_master(struct pci_dev *dev)
{
/* No special bus mastering setup handling */
@@ -23,18 +33,8 @@ extern inline void pcibios_penalize_isa_irq(int irq)
/*
* Dynamic DMA mapping API.
- * IA-64 has everything mapped statically.
*/
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/types.h>
-
-#include <asm/io.h>
-#include <asm/scatterlist.h>
-
-struct pci_dev;
-
/*
* Allocate and map kernel buffer using consistent mode DMA for a device.
* hwdev should be valid struct pci_dev pointer for PCI devices,
@@ -64,13 +64,7 @@ extern void pci_free_consistent (struct pci_dev *hwdev, size_t size,
* Once the device is given the dma address, the device owns this memory
* until either pci_unmap_single or pci_dma_sync_single is performed.
*/
-extern inline dma_addr_t
-pci_map_single (struct pci_dev *hwdev, void *ptr, size_t size, int direction)
-{
- if (direction == PCI_DMA_NONE)
- BUG();
- return virt_to_bus(ptr);
-}
+extern dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction);
/*
* Unmap a single streaming mode DMA translation. The dma_addr and size
@@ -80,13 +74,7 @@ pci_map_single (struct pci_dev *hwdev, void *ptr, size_t size, int direction)
* After this call, reads by the cpu to the buffer are guarenteed to see
* whatever the device wrote there.
*/
-extern inline void
-pci_unmap_single (struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction)
-{
- if (direction == PCI_DMA_NONE)
- BUG();
- /* Nothing to do */
-}
+extern void pci_unmap_single (struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction);
/*
* Map a set of buffers described by scatterlist in streaming
@@ -104,26 +92,14 @@ pci_unmap_single (struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int d
* Device ownership issues as mentioned above for pci_map_single are
* the same here.
*/
-extern inline int
-pci_map_sg (struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction)
-{
- if (direction == PCI_DMA_NONE)
- BUG();
- return nents;
-}
+extern int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction);
/*
* Unmap a set of streaming mode DMA translations.
* Again, cpu read rules concerning calls here are the same as for
* pci_unmap_single() above.
*/
-extern inline void
-pci_unmap_sg (struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction)
-{
- if (direction == PCI_DMA_NONE)
- BUG();
- /* Nothing to do */
-}
+extern void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction);
/*
* Make physical memory consistent for a single
@@ -135,13 +111,7 @@ pci_unmap_sg (struct pci_dev *hwdev, struct scatterlist *sg, int nents, int dire
* next point you give the PCI dma address back to the card, the
* device again owns the buffer.
*/
-extern inline void
-pci_dma_sync_single (struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction)
-{
- if (direction == PCI_DMA_NONE)
- BUG();
- /* Nothing to do */
-}
+extern void pci_dma_sync_single (struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction);
/*
* Make physical memory consistent for a set of streaming mode DMA
@@ -150,20 +120,15 @@ pci_dma_sync_single (struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size,
* The same as pci_dma_sync_single but for a scatter-gather list,
* same rules and usage.
*/
-extern inline void
-pci_dma_sync_sg (struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction)
-{
- if (direction == PCI_DMA_NONE)
- BUG();
- /* Nothing to do */
-}
+extern void pci_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction);
/* Return whether the given PCI device DMA address mask can
* be supported properly. For example, if your device can
* only drive the low 24-bits during PCI bus mastering, then
* you would pass 0x00ffffff as the mask to this function.
*/
-extern inline int pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
+extern inline int
+pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
{
return 1;
}
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index 9963ebb73..fcf340ee0 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -286,7 +286,17 @@ extern pmd_t *ia64_bad_pagetable (void);
* contains the memory attribute bits, dirty bits, and various other
* bits as well.
*/
-#define pgprot_noncached(prot) __pgprot((pgprot_val(prot) & ~_PAGE_MA_MASK) | _PAGE_MA_UC)
+#define pgprot_noncached(prot) __pgprot((pgprot_val(prot) & ~_PAGE_MA_MASK) | _PAGE_MA_UC)
+
+/*
+ * Macro to make mark a page protection value as "write-combining".
+ * Note that "protection" is really a misnomer here as the protection
+ * value contains the memory attribute bits, dirty bits, and various
+ * other bits as well. Accesses through a write-combining translation
+ * works bypasses the caches, but does allow for consecutive writes to
+ * be combined into single (but larger) write transactions.
+ */
+#define pgprot_writecombine(prot) __pgprot((pgprot_val(prot) & ~_PAGE_MA_MASK) | _PAGE_MA_WC)
/*
* Return the region index for virtual address ADDRESS.
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 5024801ae..c37fc76b1 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -19,6 +19,7 @@
#include <asm/types.h>
#define IA64_NUM_DBG_REGS 8
+#define IA64_NUM_PM_REGS 4
/*
* TASK_SIZE really is a mis-named. It really is the maximum user
@@ -152,12 +153,13 @@
#define IA64_THREAD_FPH_VALID (__IA64_UL(1) << 0) /* floating-point high state valid? */
#define IA64_THREAD_DBG_VALID (__IA64_UL(1) << 1) /* debug registers valid? */
-#define IA64_THREAD_UAC_NOPRINT (__IA64_UL(1) << 2) /* don't log unaligned accesses */
-#define IA64_THREAD_UAC_SIGBUS (__IA64_UL(1) << 3) /* generate SIGBUS on unaligned acc. */
-#define IA64_THREAD_KRBS_SYNCED (__IA64_UL(1) << 4) /* krbs synced with process vm? */
+#define IA64_THREAD_PM_VALID (__IA64_UL(1) << 2) /* performance registers valid? */
+#define IA64_THREAD_UAC_NOPRINT (__IA64_UL(1) << 3) /* don't log unaligned accesses */
+#define IA64_THREAD_UAC_SIGBUS (__IA64_UL(1) << 4) /* generate SIGBUS on unaligned acc. */
+#define IA64_THREAD_KRBS_SYNCED (__IA64_UL(1) << 5) /* krbs synced with process vm? */
#define IA64_KERNEL_DEATH (__IA64_UL(1) << 63) /* see die_if_kernel()... */
-#define IA64_THREAD_UAC_SHIFT 2
+#define IA64_THREAD_UAC_SHIFT 3
#define IA64_THREAD_UAC_MASK (IA64_THREAD_UAC_NOPRINT | IA64_THREAD_UAC_SIGBUS)
#ifndef __ASSEMBLY__
@@ -285,6 +287,14 @@ struct thread_struct {
struct ia64_fpreg fph[96]; /* saved/loaded on demand */
__u64 dbr[IA64_NUM_DBG_REGS];
__u64 ibr[IA64_NUM_DBG_REGS];
+#ifdef CONFIG_PERFMON
+ __u64 pmc[IA64_NUM_PM_REGS];
+ __u64 pmd[IA64_NUM_PM_REGS];
+ __u64 pmod[IA64_NUM_PM_REGS];
+# define INIT_THREAD_PM {0, }, {0, }, {0, },
+#else
+# define INIT_THREAD_PM
+#endif
__u64 map_base; /* base address for mmap() */
#ifdef CONFIG_IA32_SUPPORT
__u64 eflag; /* IA32 EFLAGS reg */
@@ -316,6 +326,7 @@ struct thread_struct {
{{{{0}}}, }, /* fph */ \
{0, }, /* dbr */ \
{0, }, /* ibr */ \
+ INIT_THREAD_PM \
0x2000000000000000 /* map_base */ \
INIT_THREAD_IA32, \
0 /* siginfo */ \
@@ -338,8 +349,12 @@ struct thread_struct {
struct mm_struct;
struct task_struct;
-/* Free all resources held by a thread. */
-extern void release_thread (struct task_struct *);
+/*
+ * Free all resources held by a thread. This is called after the
+ * parent of DEAD_TASK has collected the exist status of the task via
+ * wait(). This is a no-op on IA-64.
+ */
+#define release_thread(dead_task)
/*
* This is the mechanism for creating a new kernel thread.
@@ -392,6 +407,18 @@ ia64_set_fpu_owner (struct task_struct *t)
extern void __ia64_init_fpu (void);
extern void __ia64_save_fpu (struct ia64_fpreg *fph);
extern void __ia64_load_fpu (struct ia64_fpreg *fph);
+extern void ia64_save_debug_regs (unsigned long *save_area);
+extern void ia64_load_debug_regs (unsigned long *save_area);
+
+#ifdef CONFIG_IA32_SUPPORT
+extern void ia32_save_state (struct thread_struct *thread);
+extern void ia32_load_state (struct thread_struct *thread);
+#endif
+
+#ifdef CONFIG_PERFMON
+extern void ia64_save_pm_regs (struct thread_struct *thread);
+extern void ia64_load_pm_regs (struct thread_struct *thread);
+#endif
#define ia64_fph_enable() __asm__ __volatile__ (";; rsm psr.dfh;; srlz.d;;" ::: "memory");
#define ia64_fph_disable() __asm__ __volatile__ (";; ssm psr.dfh;; srlz.d;;" ::: "memory");
diff --git a/include/asm-ia64/scatterlist.h b/include/asm-ia64/scatterlist.h
index 5a119b6c8..192eef92e 100644
--- a/include/asm-ia64/scatterlist.h
+++ b/include/asm-ia64/scatterlist.h
@@ -13,6 +13,7 @@ struct scatterlist {
* indirection buffer, NULL otherwise:
*/
char *alt_address;
+ char *orig_address; /* Save away the original buffer address (used by pci-dma.c) */
unsigned int length; /* buffer length */
};
diff --git a/include/asm-ia64/siginfo.h b/include/asm-ia64/siginfo.h
index 7222fb285..a54312e12 100644
--- a/include/asm-ia64/siginfo.h
+++ b/include/asm-ia64/siginfo.h
@@ -14,12 +14,13 @@ typedef union sigval {
} sigval_t;
#define SI_MAX_SIZE 128
-#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 3)
+#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 4)
typedef struct siginfo {
int si_signo;
int si_errno;
int si_code;
+ int __pad0;
union {
int _pad[SI_PAD_SIZE];
@@ -212,7 +213,7 @@ typedef struct siginfo {
#define SIGEV_THREAD 2 /* deliver via thread creation */
#define SIGEV_MAX_SIZE 64
-#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
+#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
typedef struct sigevent {
sigval_t sigev_value;
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 6175de538..0788865fc 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -99,5 +99,9 @@ hard_smp_processor_id(void)
extern void __init init_smp_config (void);
extern void smp_do_timer (struct pt_regs *regs);
+extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info,
+ int retry, int wait);
+
+
#endif /* CONFIG_SMP */
#endif /* _ASM_IA64_SMP_H */
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
index fedd8f8c6..24b85b4d6 100644
--- a/include/asm-ia64/spinlock.h
+++ b/include/asm-ia64/spinlock.h
@@ -15,8 +15,11 @@
#include <asm/bitops.h>
#include <asm/atomic.h>
+#undef NEW_LOCK
+
+#ifdef NEW_LOCK
typedef struct {
- volatile unsigned int lock;
+ volatile unsigned char lock;
} spinlock_t;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
@@ -26,44 +29,86 @@ typedef struct {
* Streamlined test_and_set_bit(0, (x)). We use test-and-test-and-set
* rather than a simple xchg to avoid writing the cache-line when
* there is contention.
+ *
+ * XXX Fix me: instead of preserving ar.pfs, we should just mark it
+ * XXX as "clobbered". Unfortunately, the Mar 2000 release of the compiler
+ * XXX doesn't let us do that. The August release fixes that.
*/
-#if 1 /* Bad code generation? */
-#define spin_lock(x) __asm__ __volatile__ ( \
- "mov ar.ccv = r0\n" \
- "mov r29 = 1\n" \
- ";;\n" \
- "1:\n" \
- "ld4 r2 = %0\n" \
- ";;\n" \
- "cmp4.eq p0,p7 = r0,r2\n" \
- "(p7) br.cond.spnt.few 1b \n" \
- "cmpxchg4.acq r2 = %0, r29, ar.ccv\n" \
- ";;\n" \
- "cmp4.eq p0,p7 = r0, r2\n" \
- "(p7) br.cond.spnt.few 1b\n" \
- ";;\n" \
- :: "m" __atomic_fool_gcc((x)) : "r2", "r29", "memory")
-
-#else
-#define spin_lock(x) \
-{ \
- spinlock_t *__x = (x); \
- \
- do { \
- while (__x->lock); \
- } while (cmpxchg_acq(&__x->lock, 0, 1)); \
+#define spin_lock(x) \
+{ \
+ register char *addr __asm__ ("r31") = (char *) &(x)->lock; \
+ long saved_pfs; \
+ \
+ __asm__ __volatile__ ( \
+ "mov r30=1\n" \
+ "mov ar.ccv=r0\n" \
+ ";;\n" \
+ IA64_SEMFIX"cmpxchg1.acq r30=[%1],r30,ar.ccv\n" \
+ ";;\n" \
+ "cmp.ne p15,p0=r30,r0\n" \
+ "mov %0=ar.pfs\n" \
+ "(p15) br.call.spnt.few b7=ia64_spinlock_contention\n" \
+ ";;\n" \
+ "1: (p15) mov ar.pfs=%0;;\n" /* force a new bundle */ \
+ : "=&r"(saved_pfs) : "r"(addr) \
+ : "p15", "r28", "r29", "r30", "memory"); \
}
-#endif
+
+#define spin_trylock(x) \
+({ \
+ register char *addr __asm__ ("r31") = (char *) &(x)->lock; \
+ register long result; \
+ \
+ __asm__ __volatile__ ( \
+ "mov r30=1\n" \
+ "mov ar.ccv=r0\n" \
+ ";;\n" \
+ IA64_SEMFIX"cmpxchg1.acq %0=[%1],r30,ar.ccv\n" \
+ : "=r"(result) : "r"(addr) : "r30", "memory"); \
+ (result == 0); \
+})
#define spin_is_locked(x) ((x)->lock != 0)
+#define spin_unlock(x) ({((spinlock_t *) x)->lock = 0;})
+#define spin_unlock_wait(x) ({ while ((x)->lock); })
-#define spin_unlock(x) ({((spinlock_t *) x)->lock = 0; barrier();})
+#else /* !NEW_LOCK */
-/* Streamlined !test_and_set_bit(0, (x)) */
-#define spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0)
+typedef struct {
+ volatile unsigned int lock;
+} spinlock_t;
+
+#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
+#define spin_lock_init(x) ((x)->lock = 0)
+/*
+ * Streamlined test_and_set_bit(0, (x)). We use test-and-test-and-set
+ * rather than a simple xchg to avoid writing the cache-line when
+ * there is contention.
+ */
+#define spin_lock(x) __asm__ __volatile__ ( \
+ "mov ar.ccv = r0\n" \
+ "mov r29 = 1\n" \
+ ";;\n" \
+ "1:\n" \
+ "ld4 r2 = %0\n" \
+ ";;\n" \
+ "cmp4.eq p0,p7 = r0,r2\n" \
+ "(p7) br.cond.spnt.few 1b \n" \
+ IA64_SEMFIX"cmpxchg4.acq r2 = %0, r29, ar.ccv\n" \
+ ";;\n" \
+ "cmp4.eq p0,p7 = r0, r2\n" \
+ "(p7) br.cond.spnt.few 1b\n" \
+ ";;\n" \
+ :: "m" __atomic_fool_gcc((x)) : "r2", "r29", "memory")
+
+#define spin_is_locked(x) ((x)->lock != 0)
+#define spin_unlock(x) ({((spinlock_t *) x)->lock = 0; barrier();})
+#define spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0)
#define spin_unlock_wait(x) ({ do { barrier(); } while ((x)->lock); })
+#endif /* !NEW_LOCK */
+
typedef struct {
volatile int read_counter:31;
volatile int write_lock:1;
@@ -73,12 +118,12 @@ typedef struct {
#define read_lock(rw) \
do { \
int tmp = 0; \
- __asm__ __volatile__ ("1:\tfetchadd4.acq %0 = %1, 1\n" \
+ __asm__ __volatile__ ("1:\t"IA64_SEMFIX"fetchadd4.acq %0 = %1, 1\n" \
";;\n" \
"tbit.nz p6,p0 = %0, 31\n" \
"(p6) br.cond.sptk.few 2f\n" \
".section .text.lock,\"ax\"\n" \
- "2:\tfetchadd4.rel %0 = %1, -1\n" \
+ "2:\t"IA64_SEMFIX"fetchadd4.rel %0 = %1, -1\n" \
";;\n" \
"3:\tld4.acq %0 = %1\n" \
";;\n" \
@@ -94,7 +139,7 @@ do { \
#define read_unlock(rw) \
do { \
int tmp = 0; \
- __asm__ __volatile__ ("fetchadd4.rel %0 = %1, -1\n" \
+ __asm__ __volatile__ (IA64_SEMFIX"fetchadd4.rel %0 = %1, -1\n" \
: "=r" (tmp) \
: "m" (__atomic_fool_gcc(rw)) \
: "memory"); \
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index abffefa01..25438c18e 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -27,6 +27,15 @@
#define GATE_ADDR (0xa000000000000000 + PAGE_SIZE)
+#if defined(CONFIG_ITANIUM_ASTEP_SPECIFIC) || defined(CONFIG_ITANIUM_BSTEP_SPECIFIC)
+ /* Workaround for Errata 97. */
+# define IA64_SEMFIX_INSN mf;
+# define IA64_SEMFIX "mf;"
+#else
+# define IA64_SEMFIX_INSN
+# define IA64_SEMFIX ""
+#endif
+
#ifndef __ASSEMBLY__
#include <linux/types.h>
@@ -231,13 +240,13 @@ extern unsigned long __bad_increment_for_ia64_fetch_and_add (void);
({ \
switch (sz) { \
case 4: \
- __asm__ __volatile__ ("fetchadd4.rel %0=%1,%3" \
+ __asm__ __volatile__ (IA64_SEMFIX"fetchadd4.rel %0=%1,%3" \
: "=r"(tmp), "=m"(__atomic_fool_gcc(v)) \
: "m" (__atomic_fool_gcc(v)), "i"(n)); \
break; \
\
case 8: \
- __asm__ __volatile__ ("fetchadd8.rel %0=%1,%3" \
+ __asm__ __volatile__ (IA64_SEMFIX"fetchadd8.rel %0=%1,%3" \
: "=r"(tmp), "=m"(__atomic_fool_gcc(v)) \
: "m" (__atomic_fool_gcc(v)), "i"(n)); \
break; \
@@ -280,22 +289,22 @@ __xchg (unsigned long x, volatile void *ptr, int size)
switch (size) {
case 1:
- __asm__ __volatile ("xchg1 %0=%1,%2" : "=r" (result)
+ __asm__ __volatile (IA64_SEMFIX"xchg1 %0=%1,%2" : "=r" (result)
: "m" (*(char *) ptr), "r" (x) : "memory");
return result;
case 2:
- __asm__ __volatile ("xchg2 %0=%1,%2" : "=r" (result)
+ __asm__ __volatile (IA64_SEMFIX"xchg2 %0=%1,%2" : "=r" (result)
: "m" (*(short *) ptr), "r" (x) : "memory");
return result;
case 4:
- __asm__ __volatile ("xchg4 %0=%1,%2" : "=r" (result)
+ __asm__ __volatile (IA64_SEMFIX"xchg4 %0=%1,%2" : "=r" (result)
: "m" (*(int *) ptr), "r" (x) : "memory");
return result;
case 8:
- __asm__ __volatile ("xchg8 %0=%1,%2" : "=r" (result)
+ __asm__ __volatile (IA64_SEMFIX"xchg8 %0=%1,%2" : "=r" (result)
: "m" (*(long *) ptr), "r" (x) : "memory");
return result;
}
@@ -305,7 +314,6 @@ __xchg (unsigned long x, volatile void *ptr, int size)
#define xchg(ptr,x) \
((__typeof__(*(ptr))) __xchg ((unsigned long) (x), (ptr), sizeof(*(ptr))))
-#define tas(ptr) (xchg ((ptr), 1))
/*
* Atomic compare and exchange. Compare OLD with MEM, if identical,
@@ -324,50 +332,50 @@ extern long __cmpxchg_called_with_bad_pointer(void);
struct __xchg_dummy { unsigned long a[100]; };
#define __xg(x) (*(struct __xchg_dummy *)(x))
-#define ia64_cmpxchg(sem,ptr,old,new,size) \
-({ \
- __typeof__(ptr) _p_ = (ptr); \
- __typeof__(new) _n_ = (new); \
- __u64 _o_, _r_; \
- \
- switch (size) { \
- case 1: _o_ = (__u8 ) (old); break; \
- case 2: _o_ = (__u16) (old); break; \
- case 4: _o_ = (__u32) (old); break; \
- case 8: _o_ = (__u64) (old); break; \
- default: \
- } \
- __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(_o_)); \
- switch (size) { \
- case 1: \
- __asm__ __volatile__ ("cmpxchg1."sem" %0=%2,%3,ar.ccv" \
- : "=r"(_r_), "=m"(__xg(_p_)) \
- : "m"(__xg(_p_)), "r"(_n_)); \
- break; \
- \
- case 2: \
- __asm__ __volatile__ ("cmpxchg2."sem" %0=%2,%3,ar.ccv" \
- : "=r"(_r_), "=m"(__xg(_p_)) \
- : "m"(__xg(_p_)), "r"(_n_)); \
- break; \
- \
- case 4: \
- __asm__ __volatile__ ("cmpxchg4."sem" %0=%2,%3,ar.ccv" \
- : "=r"(_r_), "=m"(__xg(_p_)) \
- : "m"(__xg(_p_)), "r"(_n_)); \
- break; \
- \
- case 8: \
- __asm__ __volatile__ ("cmpxchg8."sem" %0=%2,%3,ar.ccv" \
- : "=r"(_r_), "=m"(__xg(_p_)) \
- : "m"(__xg(_p_)), "r"(_n_)); \
- break; \
- \
- default: \
- _r_ = __cmpxchg_called_with_bad_pointer(); \
- break; \
- } \
- (__typeof__(old)) _r_; \
+#define ia64_cmpxchg(sem,ptr,old,new,size) \
+({ \
+ __typeof__(ptr) _p_ = (ptr); \
+ __typeof__(new) _n_ = (new); \
+ __u64 _o_, _r_; \
+ \
+ switch (size) { \
+ case 1: _o_ = (__u8 ) (long) (old); break; \
+ case 2: _o_ = (__u16) (long) (old); break; \
+ case 4: _o_ = (__u32) (long) (old); break; \
+ case 8: _o_ = (__u64) (long) (old); break; \
+ default: \
+ } \
+ __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(_o_)); \
+ switch (size) { \
+ case 1: \
+ __asm__ __volatile__ (IA64_SEMFIX"cmpxchg1."sem" %0=%2,%3,ar.ccv" \
+ : "=r"(_r_), "=m"(__xg(_p_)) \
+ : "m"(__xg(_p_)), "r"(_n_)); \
+ break; \
+ \
+ case 2: \
+ __asm__ __volatile__ (IA64_SEMFIX"cmpxchg2."sem" %0=%2,%3,ar.ccv" \
+ : "=r"(_r_), "=m"(__xg(_p_)) \
+ : "m"(__xg(_p_)), "r"(_n_)); \
+ break; \
+ \
+ case 4: \
+ __asm__ __volatile__ (IA64_SEMFIX"cmpxchg4."sem" %0=%2,%3,ar.ccv" \
+ : "=r"(_r_), "=m"(__xg(_p_)) \
+ : "m"(__xg(_p_)), "r"(_n_)); \
+ break; \
+ \
+ case 8: \
+ __asm__ __volatile__ (IA64_SEMFIX"cmpxchg8."sem" %0=%2,%3,ar.ccv" \
+ : "=r"(_r_), "=m"(__xg(_p_)) \
+ : "m"(__xg(_p_)), "r"(_n_)); \
+ break; \
+ \
+ default: \
+ _r_ = __cmpxchg_called_with_bad_pointer(); \
+ break; \
+ } \
+ (__typeof__(old)) _r_; \
})
#define cmpxchg_acq(ptr,o,n) ia64_cmpxchg("acq", (ptr), (o), (n), sizeof(*(ptr)))
@@ -418,15 +426,15 @@ extern struct task_struct *ia64_switch_to (void *next_task);
extern void ia64_save_extra (struct task_struct *task);
extern void ia64_load_extra (struct task_struct *task);
-#define __switch_to(prev,next,last) do { \
- if (((prev)->thread.flags & IA64_THREAD_DBG_VALID) \
- || IS_IA32_PROCESS(ia64_task_regs(prev))) \
- ia64_save_extra(prev); \
- if (((next)->thread.flags & IA64_THREAD_DBG_VALID) \
- || IS_IA32_PROCESS(ia64_task_regs(next))) \
- ia64_load_extra(next); \
- ia64_psr(ia64_task_regs(next))->dfh = (ia64_get_fpu_owner() != (next)); \
- (last) = ia64_switch_to((next)); \
+#define __switch_to(prev,next,last) do { \
+ if (((prev)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID)) \
+ || IS_IA32_PROCESS(ia64_task_regs(prev))) \
+ ia64_save_extra(prev); \
+ if (((next)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID)) \
+ || IS_IA32_PROCESS(ia64_task_regs(next))) \
+ ia64_load_extra(next); \
+ ia64_psr(ia64_task_regs(next))->dfh = (ia64_get_fpu_owner() != (next)); \
+ (last) = ia64_switch_to((next)); \
} while (0)
#ifdef CONFIG_SMP
@@ -444,6 +452,7 @@ extern void ia64_load_extra (struct task_struct *task);
*/
# define switch_to(prev,next,last) do { \
if (ia64_get_fpu_owner() == (prev) && ia64_psr(ia64_task_regs(prev))->mfh) { \
+ ia64_psr(ia64_task_regs(prev))->mfh = 0; \
(prev)->thread.flags |= IA64_THREAD_FPH_VALID; \
__ia64_save_fpu((prev)->thread.fph); \
} \
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 82de77440..456376e1b 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -203,6 +203,7 @@
#define __NR_lstat 1211
#define __NR_fstat 1212
#define __NR_clone2 1213
+#define __NR_getdents64 1214
#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
diff --git a/include/asm-m68k/mmu_context.h b/include/asm-m68k/mmu_context.h
index d481eb316..003933fae 100644
--- a/include/asm-m68k/mmu_context.h
+++ b/include/asm-m68k/mmu_context.h
@@ -12,10 +12,11 @@
static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
{
}
-extern inline void
+extern inline int
init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
mm->context = virt_to_phys(mm->pgd);
+ return 0;
}
#define destroy_context(mm) do { } while(0)
@@ -108,9 +109,10 @@ extern unsigned char ctx_next_to_die;
extern unsigned char ctx_live[SUN3_CONTEXTS_NUM];
/* set the context for a new task to unmapped */
-static inline void init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
mm->context = SUN3_INVALID_CONTEXT;
+ return 0;
}
/* find the context given to this process, and if it hasn't already
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
index 715eb6496..9b88477aa 100644
--- a/include/asm-m68k/unistd.h
+++ b/include/asm-m68k/unistd.h
@@ -220,6 +220,7 @@
#define __NR_setgid32 214
#define __NR_setfsuid32 215
#define __NR_setfsgid32 216
+#define __NR_getdents64 220
/* user-visible error numbers are in the range -1 - -122: see
<asm-m68k/errno.h> */
diff --git a/include/asm-mips/fcntl.h b/include/asm-mips/fcntl.h
index 87d52eb80..8417da12e 100644
--- a/include/asm-mips/fcntl.h
+++ b/include/asm-mips/fcntl.h
@@ -44,6 +44,10 @@
#define F_SETSIG 10 /* for sockets. */
#define F_GETSIG 11 /* for sockets. */
+#define F_GETLK64 33 /* using 'struct flock64' */
+#define F_SETLK64 34
+#define F_SETLKW64 35
+
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
@@ -68,9 +72,17 @@ typedef struct flock {
short l_whence;
__kernel_off_t l_start;
__kernel_off_t l_len;
- long l_sysid; /* XXXXXXXXXXXXXXXXXXXXXXXXX */
+ long l_sysid; /* ABI junk, unused on Linux */
__kernel_pid_t l_pid;
- long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
+ long pad[4]; /* ABI junk, unused on Linux */
} flock_t;
+typedef struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+} flock64_t;
+
#endif /* __ASM_MIPS_FCNTL_H */
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index 2e9809bba..9be6976e8 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -57,10 +57,11 @@ get_new_mmu_context(struct mm_struct *mm, unsigned long asid)
* Initialize the context related info for a new mm_struct
* instance.
*/
-extern inline void
+extern inline int
init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
mm->context = 0;
+ return 0;
}
extern inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index ff127260c..8d8b5f6c8 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -1205,11 +1205,13 @@
#define __NR_pivot_root (__NR_Linux + 216)
#define __NR_mincore (__NR_Linux + 217)
#define __NR_madvise (__NR_Linux + 218)
+#define __NR_getdents64 (__NR_Linux + 219)
+#define __NR_fcntl64 (__NR_Linux + 220)
/*
* Offset of the last Linux flavoured syscall
*/
-#define __NR_Linux_syscalls 218
+#define __NR_Linux_syscalls 220
#ifndef _LANGUAGE_ASSEMBLY
diff --git a/include/asm-mips64/fcntl.h b/include/asm-mips64/fcntl.h
index a057c6610..95d7dd1c9 100644
--- a/include/asm-mips64/fcntl.h
+++ b/include/asm-mips64/fcntl.h
@@ -44,6 +44,12 @@
#define F_SETSIG 10 /* for sockets. */
#define F_GETSIG 11 /* for sockets. */
+#ifdef __KERNEL__
+#define F_GETLK64 33 /* using 'struct flock64' */
+#define F_SETLK64 34
+#define F_SETLKW64 35
+#endif
+
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
@@ -73,4 +79,8 @@ typedef struct flock {
long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
} flock_t;
+#ifdef __KERNEL__
+#define flock64 flock
+#endif
+
#endif /* _ASM_FCNTL_H */
diff --git a/include/asm-mips64/mmu_context.h b/include/asm-mips64/mmu_context.h
index 0fe300bda..9979f0b3c 100644
--- a/include/asm-mips64/mmu_context.h
+++ b/include/asm-mips64/mmu_context.h
@@ -70,7 +70,7 @@ get_new_cpu_mmu_context(struct mm_struct *mm, unsigned long cpu)
* Initialize the context related info for a new mm_struct
* instance.
*/
-extern inline void
+extern inline int
init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
#ifndef CONFIG_SMP
@@ -82,12 +82,11 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
* Init the "context" values so that a tlbpid allocation
* happens on the first switch.
*/
- if (mm->context)
- memset((void *)mm->context, 0, smp_num_cpus *
- sizeof(unsigned long));
- else
- printk("Warning: init_new_context failed\n");
+ if (mm->context == 0)
+ return -ENOMEM;
+ memset((void *)mm->context, 0, smp_num_cpus * sizeof(unsigned long));
#endif
+ return 0;
}
extern inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
diff --git a/include/asm-mips64/unistd.h b/include/asm-mips64/unistd.h
index 5c3689b3a..f63bfb145 100644
--- a/include/asm-mips64/unistd.h
+++ b/include/asm-mips64/unistd.h
@@ -1,5 +1,4 @@
-/* $Id: unistd.h,v 1.10 2000/02/18 00:24:49 ralf Exp $
- *
+/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
@@ -1204,11 +1203,13 @@
#define __NR_Linux32_root_pivot (__NR_Linux32 + 216)
#define __NR_Linux32_mincore (__NR_Linux32 + 217)
#define __NR_Linux32_madvise (__NR_Linux32 + 218)
+#define __NR_Linux32_getdents64 (__NR_Linux32 + 219)
+#define __NR_Linux32_fcntl64 (__NR_Linux32 + 220)
/*
* Offset of the last Linux o32 flavoured syscall
*/
-#define __NR_Linux32_syscalls 218
+#define __NR_Linux32_syscalls 220
/*
* Linux 64-bit syscalls are in the range from 5000 to 5999.
@@ -1427,11 +1428,12 @@
#define __NR_root_pivot (__NR_Linux + 210)
#define __NR_mincore (__NR_Linux + 211)
#define __NR_madvise (__NR_Linux + 212)
+#define __NR_getdents64 (__NR_Linux + 213)
/*
* Offset of the last Linux flavoured syscall
*/
-#define __NR_Linux_syscalls 212
+#define __NR_Linux_syscalls 213
#ifndef _LANGUAGE_ASSEMBLY
diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h
index bdb1447ed..414dd1cdc 100644
--- a/include/asm-ppc/mmu_context.h
+++ b/include/asm-ppc/mmu_context.h
@@ -77,7 +77,7 @@ do { \
/*
* Set up the context for a new address space.
*/
-#define init_new_context(tsk,mm) ((mm)->context = NO_CONTEXT)
+#define init_new_context(tsk,mm) (((mm)->context = NO_CONTEXT), 0)
/*
* We're finished using the context for an address space.
diff --git a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
index db4e6499b..3b884cbb4 100644
--- a/include/asm-ppc/unistd.h
+++ b/include/asm-ppc/unistd.h
@@ -205,6 +205,7 @@
#define __NR_sys_pciconfig_write 199
#define __NR_sys_pciconfig_iobase 200
#define __NR_multiplexer 201
+#define __NR_getdents64 202
#define __NR(n) #n
diff --git a/include/asm-s390/mmu_context.h b/include/asm-s390/mmu_context.h
index c2a215135..71f0f66df 100644
--- a/include/asm-s390/mmu_context.h
+++ b/include/asm-s390/mmu_context.h
@@ -12,7 +12,7 @@
/*
* get a new mmu context.. S390 don't know about contexts.
*/
-#define init_new_context(tsk,mm) do { } while (0)
+#define init_new_context(tsk,mm) 0
#define destroy_context(mm) flush_tlb_mm(mm)
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index 4dd04edbc..e7da084b0 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -208,6 +208,7 @@
#define __NR_pivot_root 217
#define __NR_mincore 218
#define __NR_madvise 219
+#define __NR_getdents64 220
/* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h
index f20096234..0227057b9 100644
--- a/include/asm-sh/dma.h
+++ b/include/asm-sh/dma.h
@@ -1,6 +1,7 @@
#ifndef __ASM_SH_DMA_H
#define __ASM_SH_DMA_H
+#include <linux/config.h>
#include <asm/io.h> /* need byte IO */
#define MAX_DMA_CHANNELS 8
diff --git a/include/asm-sh/machvec_init.h b/include/asm-sh/machvec_init.h
index 3e82b3f62..9e7de808f 100644
--- a/include/asm-sh/machvec_init.h
+++ b/include/asm-sh/machvec_init.h
@@ -12,6 +12,8 @@
#ifndef __SH_MACHVEC_INIT_H
#define __SH_MACHVEC_INIT_H
+#include <linux/config.h>
+
/*
* In a GENERIC kernel, we have lots of these vectors floating about,
* all but one of which we want to go away. In a non-GENERIC kernel,
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h
index 82517a5af..268754e71 100644
--- a/include/asm-sh/mmu_context.h
+++ b/include/asm-sh/mmu_context.h
@@ -67,10 +67,11 @@ get_mmu_context(struct mm_struct *mm)
* Initialize the context related info for a new mm_struct
* instance.
*/
-extern __inline__ void init_new_context(struct task_struct *tsk,
+extern __inline__ int init_new_context(struct task_struct *tsk,
struct mm_struct *mm)
{
mm->context = NO_CONTEXT;
+ return 0;
}
/*
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index 0594308fe..132a4edc1 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -229,6 +229,7 @@
#define __NR_pivot_root 217
#define __NR_mincore 218
#define __NR_madvise 219
+#define __NR_getdents64 220
/* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
index 16daf7a3a..8ab8bdaf0 100644
--- a/include/asm-sparc/bitops.h
+++ b/include/asm-sparc/bitops.h
@@ -1,4 +1,4 @@
-/* $Id: bitops.h,v 1.59 2000/07/13 01:51:50 davem Exp $
+/* $Id: bitops.h,v 1.60 2000/08/10 23:49:16 davem Exp $
* bitops.h: Bit string operations on the Sparc.
*
* Copyright 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -232,6 +232,8 @@ extern __inline__ unsigned long find_next_zero_bit(void *addr, unsigned long siz
found_first:
tmp |= ~0UL << size;
+ if (tmp == ~0UL) /* Are any bits zero? */
+ return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
@@ -379,7 +381,11 @@ extern __inline__ unsigned long find_next_zero_le_bit(void *addr, unsigned long
tmp = *p;
found_first:
- return result + ffz(__swab32(tmp) | (~0UL << size));
+ tmp = __swab32(tmp) | (~0UL << size);
+ if (tmp == ~0UL) /* Are any bits zero? */
+ return result + size; /* Nope. */
+ return result + ffz(tmp);
+
found_middle:
return result + ffz(__swab32(tmp));
}
diff --git a/include/asm-sparc/fcntl.h b/include/asm-sparc/fcntl.h
index 2a373ed60..344765930 100644
--- a/include/asm-sparc/fcntl.h
+++ b/include/asm-sparc/fcntl.h
@@ -1,4 +1,4 @@
-/* $Id: fcntl.h,v 1.13 2000/07/06 01:41:45 davem Exp $ */
+/* $Id: fcntl.h,v 1.14 2000/08/12 20:49:49 jj Exp $ */
#ifndef _SPARC_FCNTL_H
#define _SPARC_FCNTL_H
@@ -34,6 +34,10 @@
#define F_SETSIG 10 /* for sockets. */
#define F_GETSIG 11 /* for sockets. */
+#define F_GETLK64 12 /* using 'struct flock64' */
+#define F_SETLK64 13
+#define F_SETLKW64 14
+
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
@@ -62,4 +66,13 @@ struct flock {
short __unused;
};
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+ short __unused;
+};
+
#endif
diff --git a/include/asm-sparc/md.h b/include/asm-sparc/md.h
deleted file mode 100644
index e0d0e85a5..000000000
--- a/include/asm-sparc/md.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* $Id: md.h,v 1.1 1997/12/15 15:12:39 jj Exp $
- * md.h: High speed xor_block operation for RAID4/5
- *
- */
-
-#ifndef __ASM_MD_H
-#define __ASM_MD_H
-
-/* #define HAVE_ARCH_XORBLOCK */
-
-#define MD_XORBLOCK_ALIGNMENT sizeof(long)
-
-#endif /* __ASM_MD_H */
diff --git a/include/asm-sparc/mmu_context.h b/include/asm-sparc/mmu_context.h
index 604c447a9..274707e2d 100644
--- a/include/asm-sparc/mmu_context.h
+++ b/include/asm-sparc/mmu_context.h
@@ -13,7 +13,7 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk,
* Initialize a new mmu context. This is invoked when a new
* address space instance (unique or shared) is instantiated.
*/
-#define init_new_context(tsk, mm) ((mm)->context = NO_CONTEXT)
+#define init_new_context(tsk, mm) (((mm)->context = NO_CONTEXT), 0)
/*
* Destroy a dead context. This occurs when mmput drops the
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
index 47022fbba..e6373384f 100644
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -1,4 +1,4 @@
-/* $Id: page.h,v 1.53 2000/06/04 08:36:33 anton Exp $
+/* $Id: page.h,v 1.54 2000/08/10 01:04:53 davem Exp $
* page.h: Various defines and such for MMU operations on the Sparc for
* the Linux kernel.
*
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index 2debbf084..8562fc287 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -1,4 +1,4 @@
-/* $Id: pgtable.h,v 1.101 2000/08/09 00:00:17 davem Exp $ */
+/* $Id: pgtable.h,v 1.102 2000/08/14 00:46:13 anton Exp $ */
#ifndef _SPARC_PGTABLE_H
#define _SPARC_PGTABLE_H
@@ -201,11 +201,9 @@ extern unsigned long empty_zero_page;
#define SIZEOF_PTR_LOG2 2
-BTFIXUPDEF_CALL_CONST(unsigned long, sparc_pte_pagenr, pte_t)
BTFIXUPDEF_CALL_CONST(unsigned long, pmd_page, pmd_t)
BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page, pgd_t)
-#define sparc_pte_pagenr(pte) BTFIXUP_CALL(sparc_pte_pagenr)(pte)
#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd)
#define pgd_page(pgd) BTFIXUP_CALL(pgd_page)(pgd)
@@ -305,7 +303,9 @@ BTFIXUPDEF_CALL_CONST(pte_t, pte_mkyoung, pte_t)
/* Permanent address of a page. */
#define page_address(page) ((page)->virtual)
-#define pte_page(x) (mem_map+sparc_pte_pagenr(x))
+
+BTFIXUPDEF_CALL(struct page *, pte_page, pte_t)
+#define pte_page(pte) BTFIXUP_CALL(pte_page)(pte)
/*
* Conversion functions: convert a page and protection to a page entry,
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
index 0b3df22b9..84b0f03f5 100644
--- a/include/asm-sparc/spinlock.h
+++ b/include/asm-sparc/spinlock.h
@@ -16,7 +16,7 @@
* Define this to use the verbose/debugging versions in
* arch/sparc/lib/debuglocks.c
*
- * Be sure to make check_asm whenever changing this option.
+ * Be sure to make dep whenever changing this option.
*/
#define SPIN_LOCK_DEBUG
@@ -28,7 +28,7 @@ struct _spinlock_debug {
typedef struct _spinlock_debug spinlock_t;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0 }
-#define spin_lock_init(lp) do { (lp)->owner_pc = 0; (lp)->lock = 0; } while(0)
+#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0)
#define spin_is_locked(lp) (*((volatile unsigned char *)(&((lp)->lock))) != 0)
#define spin_unlock_wait(lp) do { barrier(); } while(*(volatile unsigned char *)(&(lp)->lock))
@@ -49,6 +49,8 @@ typedef struct _rwlock_debug rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, {0} }
+#define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0)
+
extern void _do_read_lock(rwlock_t *rw, char *str);
extern void _do_read_unlock(rwlock_t *rw, char *str);
extern void _do_write_lock(rwlock_t *rw, char *str);
@@ -144,6 +146,9 @@ typedef struct { volatile unsigned int lock; } rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
+#define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0)
+
+
/* Sort of like atomic_t's on Sparc, but even more clever.
*
* ------------------------------------
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 989c6742c..741949c5e 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -1,4 +1,4 @@
-/* $Id: unistd.h,v 1.66 2000/01/29 17:57:25 jj Exp $ */
+/* $Id: unistd.h,v 1.70 2000/08/14 05:39:07 jj Exp $ */
#ifndef _SPARC_UNISTD_H
#define _SPARC_UNISTD_H
@@ -67,7 +67,7 @@
#define __NR_geteuid 49 /* SunOS calls getuid() */
#define __NR_getegid 50 /* SunOS calls getgid() */
#define __NR_acct 51 /* Common */
-/* #define __NR_ni_syscall 52 ENOSYS under SunOS */
+/* #define __NR_memory_ordering 52 Linux sparc64 specific */
#define __NR_getgid32 53 /* Linux sparc32 specific */
#define __NR_ioctl 54 /* Common */
#define __NR_reboot 55 /* Common */
@@ -169,8 +169,8 @@
/* #define __NR_getmsg 151 SunOS Specific */
/* #define __NR_putmsg 152 SunOS Specific */
#define __NR_poll 153 /* Common */
-/* #define __NR_ni_syscall 154 ENOSYS under SunOS */
-/* #define __NR_nfssvc 155 SunOS Specific */
+#define __NR_getdents64 154 /* Linux specific */
+#define __NR_fcntl64 155 /* Linux sparc32 Specific */
/* #define __NR_getdirentries 156 SunOS Specific */
#define __NR_statfs 157 /* Common */
#define __NR_fstatfs 158 /* Common */
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 0f42cad91..e297d6f96 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -1,4 +1,4 @@
-/* $Id: bitops.h,v 1.29 2000/06/30 10:18:39 davem Exp $
+/* $Id: bitops.h,v 1.30 2000/08/10 23:49:16 davem Exp $
* bitops.h: Bit string operations on the V9.
*
* Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -158,6 +158,8 @@ extern __inline__ unsigned long find_next_zero_bit(void *addr, unsigned long siz
found_first:
tmp |= ~0UL << size;
+ if (tmp == ~0UL) /* Are any bits zero? */
+ return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
@@ -217,6 +219,8 @@ extern __inline__ unsigned long find_next_zero_le_bit(void *addr, unsigned long
tmp = __swab64p(p);
found_first:
tmp |= (~0UL << size);
+ if (tmp == ~0UL) /* Are any bits zero? */
+ return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
}
diff --git a/include/asm-sparc64/fcntl.h b/include/asm-sparc64/fcntl.h
index 8c7935dec..bd087fc21 100644
--- a/include/asm-sparc64/fcntl.h
+++ b/include/asm-sparc64/fcntl.h
@@ -1,4 +1,4 @@
-/* $Id: fcntl.h,v 1.8 2000/07/06 01:41:45 davem Exp $ */
+/* $Id: fcntl.h,v 1.10 2000/08/12 20:49:49 jj Exp $ */
#ifndef _SPARC64_FCNTL_H
#define _SPARC64_FCNTL_H
@@ -34,6 +34,12 @@
#define F_SETSIG 10 /* for sockets. */
#define F_GETSIG 11 /* for sockets. */
+#ifdef __KERNEL__
+#define F_GETLK64 12
+#define F_SETLK64 13
+#define F_SETLKW64 14
+#endif
+
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
@@ -73,4 +79,8 @@ struct flock32 {
};
#endif
+#ifdef __KERNEL__
+#define flock64 flock
+#endif
+
#endif /* !(_SPARC64_FCNTL_H) */
diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h
index e4007b644..02d05c96d 100644
--- a/include/asm-sparc64/hardirq.h
+++ b/include/asm-sparc64/hardirq.h
@@ -39,7 +39,7 @@ typedef struct {
/*
* Are we in an interrupt context? Either doing bottom half
- * or hardware interrupt processing? On any cpu?
+ * or hardware interrupt processing?
*/
#define in_interrupt() ((local_irq_count(smp_processor_id()) + \
local_bh_count(smp_processor_id())) != 0)
@@ -52,22 +52,18 @@ typedef struct {
#define hardirq_trylock(cpu) ((void)(cpu), local_irq_count(smp_processor_id()) == 0)
#define hardirq_endlock(cpu) do { (void)(cpu); } while(0)
-#define hardirq_enter(cpu) ((void)(cpu), local_irq_count(smp_processor_id())++)
-#define hardirq_exit(cpu) ((void)(cpu), local_irq_count(smp_processor_id())--)
-
#define synchronize_irq() barrier()
#else /* (CONFIG_SMP) */
static __inline__ int irqs_running(void)
{
- enum brlock_indices idx = BR_GLOBALIRQ_LOCK;
- int i, count = 0;
+ int i;
for (i = 0; i < smp_num_cpus; i++)
- count += (__brlock_array[cpu_logical_map(i)][idx] != 0);
-
- return count;
+ if (local_irq_count(cpu_logical_map(i)))
+ return 1;
+ return 0;
}
extern unsigned char global_irq_holder;
@@ -85,7 +81,7 @@ static inline int hardirq_trylock(int cpu)
{
spinlock_t *lock = &__br_write_locks[BR_GLOBALIRQ_LOCK].lock;
- return (!irqs_running() && !spin_is_locked(lock));
+ return (!local_irq_count(cpu) && !spin_is_locked(lock));
}
#define hardirq_endlock(cpu) do { (void)(cpu); } while (0)
diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h
index 4b61cc432..65862f7c4 100644
--- a/include/asm-sparc64/kdebug.h
+++ b/include/asm-sparc64/kdebug.h
@@ -1,77 +1,9 @@
-/* $Id: kdebug.h,v 1.3 1997/12/14 23:24:47 ecd Exp $
- * kdebug.h: Defines and definitions for debugging the Linux kernel
- * under various kernel debuggers.
- *
- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
- */
#ifndef _SPARC64_KDEBUG_H
#define _SPARC64_KDEBUG_H
-#include <asm/openprom.h>
-
-/* XXX This needs to all be fixed for Ultra/V9 -DaveM */
-
-/* The debugger lives in 1MB of virtual address space right underneath
- * the boot prom.
- */
-
-#define DEBUG_FIRSTVADDR 0xffc00000
-#define DEBUG_LASTVADDR LINUX_OPPROM_BEGVM
-
-/* Breakpoints are enter through trap table entry 126. So in sparc assembly
- * if you want to drop into the debugger you do:
- *
- * t DEBUG_BP_TRAP
- */
-
-#define DEBUG_BP_TRAP 126
-
-#ifndef __ASSEMBLY__
-/* The debug vector is passed in %o1 at boot time. It is a pointer to
- * a structure in the debuggers address space. Here is its format.
+/*
+ * No kernel debugger on sparc64. Kept here because drivers/sbus/char/
+ * includes it for sparc32 sake.
*/
-typedef unsigned int (*debugger_funct)(void);
-
-struct kernel_debug {
- /* First the entry point into the debugger. You jump here
- * to give control over to the debugger.
- */
- unsigned long kdebug_entry;
- unsigned long kdebug_trapme; /* Figure out later... */
- /* The following is the number of pages that the debugger has
- * taken from to total pool.
- */
- unsigned long *kdebug_stolen_pages;
- /* Ok, after you remap yourself and/or change the trap table
- * from what you were left with at boot time you have to call
- * this synchronization function so the debugger can check out
- * what you have done.
- */
- debugger_funct teach_debugger;
-}; /* I think that is it... */
-
-extern struct kernel_debug *linux_dbvec;
-
-/* Use this macro in C-code to enter the debugger. */
-extern __inline__ void sp_enter_debugger(void)
-{
- __asm__ __volatile__("jmpl %0, %%o7\n\t"
- "nop\n\t" : :
- "r" (linux_dbvec) : "o7", "memory");
-}
-
-#define SP_ENTER_DEBUGGER do { \
- if((linux_dbvec!=0) && ((*(short *)linux_dbvec)!=-1)) \
- sp_enter_debugger(); \
- } while(0)
-
-#endif /* !(__ASSEMBLY__) */
-
-/* Some nice offset defines for assembler code. */
-#define KDEBUG_ENTRY_OFF 0x0
-#define KDEBUG_DUNNO_OFF 0x4
-#define KDEBUG_DUNNO2_OFF 0x8
-#define KDEBUG_TEACH_OFF 0xc
-
-#endif /* !(_SPARC64_KDEBUG_H) */
+#endif
diff --git a/include/asm-sparc64/machines.h b/include/asm-sparc64/machines.h
deleted file mode 100644
index b3d8fad4b..000000000
--- a/include/asm-sparc64/machines.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $Id: machines.h,v 1.2 1997/04/04 00:50:23 davem Exp $
- * machines.h: Defines for taking apart the machine type value in the
- * idprom and determining the kind of machine we are on.
- *
- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
- */
-#ifndef _SPARC64_MACHINES_H
-#define _SPARC64_MACHINES_H
-
-/* XXX This should disappear. -DaveM */
-
-struct Sun_Machine_Models {
- char *name;
- unsigned char id_machtype;
-};
-
-/* Current number of machines we know about that has an IDPROM
- * machtype entry including one entry for the 0x80 OBP machines.
- */
-#define NUM_SUN_MACHINES 15
-
-extern struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES];
-
-/* The machine type in the idprom area looks like this:
- *
- * ---------------
- * | ARCH | MACH |
- * ---------------
- * 7 4 3 0
- *
- * The ARCH field determines the architecture line (sun4, sun4c, etc).
- * The MACH field determines the machine make within that architecture.
- */
-
-#define SM_ARCH_MASK 0xf0
-#define SM_SUN4 0x20
-#define SM_SUN4C 0x50
-#define SM_SUN4M 0x70
-#define SM_SUN4M_OBP 0x80
-
-#define SM_TYP_MASK 0x0f
-/* Sun4 machines */
-#define SM_4_260 0x01 /* Sun 4/200 series */
-#define SM_4_110 0x02 /* Sun 4/100 series */
-#define SM_4_330 0x03 /* Sun 4/300 series */
-#define SM_4_470 0x04 /* Sun 4/400 series */
-
-/* Sun4c machines Full Name - PROM NAME */
-#define SM_4C_SS1 0x01 /* Sun4c SparcStation 1 - Sun 4/60 */
-#define SM_4C_IPC 0x02 /* Sun4c SparcStation IPC - Sun 4/40 */
-#define SM_4C_SS1PLUS 0x03 /* Sun4c SparcStation 1+ - Sun 4/65 */
-#define SM_4C_SLC 0x04 /* Sun4c SparcStation SLC - Sun 4/20 */
-#define SM_4C_SS2 0x05 /* Sun4c SparcStation 2 - Sun 4/75 */
-#define SM_4C_ELC 0x06 /* Sun4c SparcStation ELC - Sun 4/25 */
-#define SM_4C_IPX 0x07 /* Sun4c SparcStation IPX - Sun 4/50 */
-
-/* Sun4m machines, these predate the OpenBoot. These values only mean
- * something if the value in the ARCH field is SM_SUN4M, if it is
- * SM_SUN4M_OBP then you have the following situation:
- * 1) You either have a sun4d, a sun4e, or a recently made sun4m.
- * 2) You have to consult OpenBoot to determine which machine this is.
- */
-#define SM_4M_SS60 0x01 /* Sun4m SparcSystem 600 */
-#define SM_4M_SS50 0x02 /* Sun4m SparcStation 10 */
-#define SM_4M_SS40 0x03 /* Sun4m SparcStation 5 */
-
-/* Sun4d machines -- N/A */
-/* Sun4e machines -- N/A */
-/* Sun4u machines -- N/A */
-
-#endif /* !(_SPARC64_MACHINES_H) */
diff --git a/include/asm-sparc64/md.h b/include/asm-sparc64/md.h
deleted file mode 100644
index 373c76744..000000000
--- a/include/asm-sparc64/md.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $Id: md.h,v 1.3 1999/05/25 16:53:28 jj Exp $
- * md.h: High speed xor_block operation for RAID4/5
- * utilizing the UltraSparc Visual Instruction Set.
- *
- * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
- */
-
-#ifndef __ASM_MD_H
-#define __ASM_MD_H
-
-#include <asm/head.h>
-#include <asm/asi.h>
-
-#undef HAVE_ARCH_XORBLOCK
-
-#define MD_XORBLOCK_ALIGNMENT 64
-
-/* void __xor_block (char *dest, char *src, long len)
- * {
- * while (len--) *dest++ ^= *src++;
- * }
- *
- * Requirements:
- * !(((long)dest | (long)src) & (MD_XORBLOCK_ALIGNMENT - 1)) &&
- * !(len & 127) && len >= 256
- */
-
-static inline void __xor_block (char *dest, char *src, long len)
-{
- __asm__ __volatile__ ("
- wr %%g0, %3, %%fprs
- wr %%g0, %4, %%asi
- membar #LoadStore|#StoreLoad|#StoreStore
- sub %2, 128, %2
- ldda [%0] %4, %%f0
- ldda [%1] %4, %%f16
-1: ldda [%0 + 64] %%asi, %%f32
- fxor %%f0, %%f16, %%f16
- fxor %%f2, %%f18, %%f18
- fxor %%f4, %%f20, %%f20
- fxor %%f6, %%f22, %%f22
- fxor %%f8, %%f24, %%f24
- fxor %%f10, %%f26, %%f26
- fxor %%f12, %%f28, %%f28
- fxor %%f14, %%f30, %%f30
- stda %%f16, [%0] %4
- ldda [%1 + 64] %%asi, %%f48
- ldda [%0 + 128] %%asi, %%f0
- fxor %%f32, %%f48, %%f48
- fxor %%f34, %%f50, %%f50
- add %0, 128, %0
- fxor %%f36, %%f52, %%f52
- add %1, 128, %1
- fxor %%f38, %%f54, %%f54
- subcc %2, 128, %2
- fxor %%f40, %%f56, %%f56
- fxor %%f42, %%f58, %%f58
- fxor %%f44, %%f60, %%f60
- fxor %%f46, %%f62, %%f62
- stda %%f48, [%0 - 64] %%asi
- bne,pt %%xcc, 1b
- ldda [%1] %4, %%f16
- ldda [%0 + 64] %%asi, %%f32
- fxor %%f0, %%f16, %%f16
- fxor %%f2, %%f18, %%f18
- fxor %%f4, %%f20, %%f20
- fxor %%f6, %%f22, %%f22
- fxor %%f8, %%f24, %%f24
- fxor %%f10, %%f26, %%f26
- fxor %%f12, %%f28, %%f28
- fxor %%f14, %%f30, %%f30
- stda %%f16, [%0] %4
- ldda [%1 + 64] %%asi, %%f48
- membar #Sync
- fxor %%f32, %%f48, %%f48
- fxor %%f34, %%f50, %%f50
- fxor %%f36, %%f52, %%f52
- fxor %%f38, %%f54, %%f54
- fxor %%f40, %%f56, %%f56
- fxor %%f42, %%f58, %%f58
- fxor %%f44, %%f60, %%f60
- fxor %%f46, %%f62, %%f62
- stda %%f48, [%0 + 64] %%asi
- membar #Sync|#StoreStore|#StoreLoad
- wr %%g0, 0, %%fprs
- " : :
- "r" (dest), "r" (src), "r" (len), "i" (FPRS_FEF), "i" (ASI_BLK_P) :
- "cc", "memory");
-}
-
-#endif /* __ASM_MD_H */
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index ea7b83d5b..6c5e894b8 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -1,4 +1,4 @@
-/* $Id: mmu_context.h,v 1.43 2000/08/09 08:04:45 davem Exp $ */
+/* $Id: mmu_context.h,v 1.45 2000/08/12 13:25:52 davem Exp $ */
#ifndef __SPARC64_MMU_CONTEXT_H
#define __SPARC64_MMU_CONTEXT_H
@@ -31,7 +31,7 @@ extern void get_new_mmu_context(struct mm_struct *mm);
* address space instance (unique or shared) is instantiated.
* This just needs to set mm->context to an invalid context.
*/
-#define init_new_context(__tsk, __mm) ((__mm)->context = 0UL)
+#define init_new_context(__tsk, __mm) (((__mm)->context = 0UL), 0)
/* Destroy a dead context. This occurs when mmput drops the
* mm_users count to zero, the mmaps have been released, and
@@ -100,30 +100,36 @@ do { \
/* Switch the current MM context. */
static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk, int cpu)
{
- long dirty;
+ unsigned long ctx_valid;
spin_lock(&mm->page_table_lock);
if (CTX_VALID(mm->context))
- dirty = 0;
- else
- dirty = 1;
- if (dirty || (old_mm != mm)) {
- unsigned long vm_mask;
+ ctx_valid = 1;
+ else
+ ctx_valid = 0;
- if (dirty)
+ if (!ctx_valid || (old_mm != mm)) {
+ if (!ctx_valid)
get_new_mmu_context(mm);
- vm_mask = (1UL << cpu);
- if (!(mm->cpu_vm_mask & vm_mask)) {
- mm->cpu_vm_mask |= vm_mask;
- dirty = 1;
- }
-
load_secondary_context(mm);
- if (dirty != 0)
- clean_secondary_context();
reload_tlbmiss_state(tsk, mm);
}
+
+ {
+ unsigned long vm_mask = (1UL << cpu);
+
+ /* Even if (mm == old_mm) we _must_ check
+ * the cpu_vm_mask. If we do not we could
+ * corrupt the TLB state because of how
+ * smp_flush_tlb_{page,range,mm} on sparc64
+ * and lazy tlb switches work. -DaveM
+ */
+ if (!ctx_valid || !(mm->cpu_vm_mask & vm_mask)) {
+ mm->cpu_vm_mask |= vm_mask;
+ clean_secondary_context();
+ }
+ }
spin_unlock(&mm->page_table_lock);
}
diff --git a/include/asm-sparc64/openprom.h b/include/asm-sparc64/openprom.h
index 3218e00dd..44210c08e 100644
--- a/include/asm-sparc64/openprom.h
+++ b/include/asm-sparc64/openprom.h
@@ -1,4 +1,4 @@
-/* $Id: openprom.h,v 1.7 1998/03/15 10:14:47 ecd Exp $ */
+/* $Id: openprom.h,v 1.8 2000/08/12 19:55:25 anton Exp $ */
#ifndef __SPARC64_OPENPROM_H
#define __SPARC64_OPENPROM_H
@@ -8,12 +8,6 @@
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
*/
-/* Empirical constants... */
-#define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */
-#define LINUX_OPPROM_BEGVM 0xffd00000
-#define LINUX_OPPROM_ENDVM 0xfff00000
-#define LINUX_OPPROM_MAGIC 0x10010407
-
#ifndef __ASSEMBLY__
/* V0 prom device operations. */
struct linux_dev_v0_funcs {
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index 86bd26402..6c65d3241 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -1,4 +1,4 @@
-/* $Id: page.h,v 1.35 2000/04/13 04:45:59 davem Exp $ */
+/* $Id: page.h,v 1.36 2000/08/10 01:04:53 davem Exp $ */
#ifndef _SPARC64_PAGE_H
#define _SPARC64_PAGE_H
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index c47527736..070fb31db 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -1,4 +1,4 @@
-/* $Id: pgtable.h,v 1.130 2000/08/09 00:00:17 davem Exp $
+/* $Id: pgtable.h,v 1.131 2000/08/11 03:00:14 davem Exp $
* pgtable.h: SpitFire page table operations.
*
* Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu)
@@ -174,7 +174,6 @@ extern inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
(pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL))
#define pgd_set(pgdp, pmdp) \
(pgd_val(*(pgdp)) = (__pa((unsigned long) (pmdp)) >> 11UL))
-#define sparc64_pte_pagenr(pte) (((unsigned long) ((pte_val(pte)&~PAGE_OFFSET)-phys_base)>>PAGE_SHIFT))
#define pmd_page(pmd) ((unsigned long) __va((pmd_val(pmd)<<11UL)))
#define pgd_page(pgd) ((unsigned long) __va((pgd_val(pgd)<<11UL)))
#define pte_none(pte) (!pte_val(pte))
@@ -206,7 +205,7 @@ extern inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
#define __page_address(page) ((page)->virtual)
#define page_address(page) ({ __page_address(page); })
-#define pte_page(x) (mem_map+sparc64_pte_pagenr(x))
+#define pte_page(x) (mem_map+(((pte_val(x)&_PAGE_PADDR)-phys_base)>>PAGE_SHIFT))
/* Be very careful when you change these three, they are delicate. */
#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_ACCESSED | _PAGE_R))
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
index ea34fbefe..a6f5aa9ae 100644
--- a/include/asm-sparc64/spinlock.h
+++ b/include/asm-sparc64/spinlock.h
@@ -109,6 +109,7 @@ extern int _spin_trylock (spinlock_t *lock);
typedef unsigned int rwlock_t;
#define RW_LOCK_UNLOCKED 0
+#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)
extern void __read_lock(rwlock_t *);
extern void __read_unlock(rwlock_t *);
@@ -128,6 +129,7 @@ typedef struct {
unsigned int reader_pc[4];
} rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { 0, 0, 0, 0 } }
+#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)
extern void _do_read_lock(rwlock_t *rw, char *str);
extern void _do_read_unlock(rwlock_t *rw, char *str);
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index c7fd4cd19..f89c5d50a 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -1,4 +1,4 @@
-/* $Id: unistd.h,v 1.44 2000/05/16 16:42:33 jj Exp $ */
+/* $Id: unistd.h,v 1.47 2000/08/14 05:39:07 jj Exp $ */
#ifndef _SPARC64_UNISTD_H
#define _SPARC64_UNISTD_H
@@ -169,8 +169,8 @@
/* #define __NR_getmsg 151 SunOS Specific */
/* #define __NR_putmsg 152 SunOS Specific */
#define __NR_poll 153 /* Common */
-/* #define __NR_ni_syscall 154 ENOSYS under SunOS */
-/* #define __NR_nfssvc 155 SunOS Specific */
+#define __NR_getdents64 154 /* Linux specific */
+/* #define __NR_fcntl64 155 Linux sparc32 Specific */
/* #define __NR_getdirentries 156 SunOS Specific */
#define __NR_statfs 157 /* Common */
#define __NR_fstatfs 158 /* Common */
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index a35094450..166fa085b 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -50,8 +50,9 @@ enum chipset_type {
VIA_VP3,
VIA_MVP3,
VIA_MVP4,
- VIA_APOLLO_SUPER,
VIA_APOLLO_PRO,
+ VIA_APOLLO_KX133,
+ VIA_APOLLO_KT133,
SIS_GENERIC,
AMD_GENERIC,
AMD_IRONGATE,
diff --git a/include/linux/capi.h b/include/linux/capi.h
index b5cd26c52..0c347e003 100644
--- a/include/linux/capi.h
+++ b/include/linux/capi.h
@@ -1,38 +1,10 @@
/*
- * $Id: capi.h,v 1.3 2000/03/08 17:06:34 calle Exp $
+ * $Id: capi.h,v 1.4 2000/06/12 09:20:20 kai Exp $
*
* CAPI 2.0 Interface for Linux
*
* Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
*
- * $Log: capi.h,v $
- * Revision 1.3 2000/03/08 17:06:34 calle
- * - changes for devfs and 2.3.49
- * - capifs now configurable (no need with devfs)
- * - New Middleware ioctl CAPI_NCCI_GETUNIT
- * - Middleware again tested with 2.2.14 and 2.3.49 (with and without devfs)
- *
- * Revision 1.2 2000/03/03 15:50:42 calle
- * - kernel CAPI:
- * - Changed parameter "param" in capi_signal from __u32 to void *.
- * - rewrote notifier handling in kcapi.c
- * - new notifier NCCI_UP and NCCI_DOWN
- * - User CAPI:
- * - /dev/capi20 is now a cloning device.
- * - middleware extentions prepared.
- * - capidrv.c
- * - locking of list operations and module count updates.
- *
- * Revision 1.1 1997/03/04 21:27:33 calle
- * First version in isdn4linux
- *
- * Revision 2.2 1997/02/12 09:31:39 calle
- * new version
- *
- * Revision 1.1 1997/01/31 10:32:20 calle
- * Initial revision
- *
- *
*/
#ifndef __LINUX_CAPI_H__
diff --git a/include/linux/dirent.h b/include/linux/dirent.h
index a18f7e463..bef1120cb 100644
--- a/include/linux/dirent.h
+++ b/include/linux/dirent.h
@@ -8,4 +8,12 @@ struct dirent {
char d_name[256]; /* We must not include limits.h! */
};
+struct dirent64 {
+ __u64 d_ino;
+ __s64 d_off;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ char d_name[256];
+};
+
#endif
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index f008ca74f..97c505282 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -40,15 +40,10 @@ extern int eth_header_parse(struct sk_buff *skb,
unsigned char *haddr);
extern struct net_device * init_etherdev(struct net_device *, int);
-#if 1 /*def CONFIG_IP_ROUTER*/
static __inline__ void eth_copy_and_sum (struct sk_buff *dest, unsigned char *src, int len, int base)
{
- memcpy (dest->data, src, len);
+ memcpy (dest->data, src, len);
}
-#else
-extern void eth_copy_and_sum(struct sk_buff *dest,
- unsigned char *src, int length, int base);
-#endif
#endif
diff --git a/include/linux/file.h b/include/linux/file.h
index a206b616b..02edb29c3 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -7,6 +7,27 @@
extern void FASTCALL(fput(struct file *));
extern struct file * FASTCALL(fget(unsigned int fd));
+
+static inline int get_close_on_exec(unsigned int fd)
+{
+ struct files_struct *files = current->files;
+ int res;
+ read_lock(&files->file_lock);
+ res = FD_ISSET(fd, files->close_on_exec);
+ read_unlock(&files->file_lock);
+ return res;
+}
+
+static inline void set_close_on_exec(unsigned int fd, int flag)
+{
+ struct files_struct *files = current->files;
+ write_lock(&files->file_lock);
+ if (flag)
+ FD_SET(fd, files->close_on_exec);
+ else
+ FD_CLR(fd, files->close_on_exec);
+ write_unlock(&files->file_lock);
+}
static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd)
{
@@ -30,15 +51,6 @@ static inline struct file * fcheck(unsigned int fd)
return file;
}
-static inline struct file * frip(struct files_struct *files, unsigned int fd)
-{
- struct file * file = NULL;
-
- if (fd < files->max_fds)
- file = xchg(&files->fd[fd], NULL);
- return file;
-}
-
extern void put_filp(struct file *);
extern int get_unused_fd(void);
@@ -67,18 +79,20 @@ static inline void put_unused_fd(unsigned int fd)
* array. At any such point, we are vulnerable to a dup2() race
* installing a file in the array before us. We need to detect this and
* fput() the struct file we are about to overwrite in this case.
+ *
+ * It should never happen - if we allow dup2() do it, _really_ bad things
+ * will follow.
*/
static inline void fd_install(unsigned int fd, struct file * file)
{
struct files_struct *files = current->files;
- struct file * result;
write_lock(&files->file_lock);
- result = xchg(&files->fd[fd], file);
+ if (files->fd[fd])
+ BUG();
+ files->fd[fd] = file;
write_unlock(&files->file_lock);
- if (result)
- fput(result);
}
void put_files_struct(struct files_struct *fs);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 570aecf20..3ce2c58bd 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -71,8 +71,6 @@ extern int max_super_blocks, nr_super_blocks;
#define READA 2 /* read-ahead - don't block if no resources */
#define SPECIAL 4 /* For non-blockdevice requests in request queue */
-#define WRITERAW 5 /* raw write - don't play with buffer lists */
-
#define SEL_IN 1
#define SEL_OUT 2
#define SEL_EX 4
@@ -535,6 +533,7 @@ struct file_lock {
#ifndef OFFSET_MAX
#define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1)))
#define OFFSET_MAX INT_LIMIT(loff_t)
+#define OFFT_OFFSET_MAX INT_LIMIT(off_t)
#endif
extern struct list_head file_lock_list;
@@ -544,6 +543,9 @@ extern struct list_head file_lock_list;
extern int fcntl_getlk(unsigned int, struct flock *);
extern int fcntl_setlk(unsigned int, unsigned int, struct flock *);
+extern int fcntl_getlk64(unsigned int, struct flock64 *);
+extern int fcntl_setlk64(unsigned int, unsigned int, struct flock64 *);
+
/* fs/locks.c */
extern void locks_remove_posix(struct file *, fl_owner_t);
extern void locks_remove_flock(struct file *);
@@ -694,12 +696,25 @@ extern int vfs_unlink(struct inode *, struct dentry *);
extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
/*
+ * File types
+ */
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+
+/*
* This is the "filldir" function type, used by readdir() to let
* the kernel specify what kind of dirent layout it wants to have.
* This allows the kernel to read directories into kernel space or
* to have different dirent layouts depending on the binary type.
*/
-typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t);
+typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t, unsigned);
struct block_device_operations {
int (*open) (struct inode *, struct file *);
@@ -875,7 +890,6 @@ static inline int locks_verify_truncate(struct inode *inode,
asmlinkage long sys_open(const char *, int, int);
asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
-extern int do_close(struct files_struct *, unsigned int, int); /* yes, it's really unsigned */
extern int do_truncate(struct dentry *, loff_t start);
extern struct file *filp_open(const char *, int, int);
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 3cd0250ee..a80434823 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -29,6 +29,9 @@ static __inline__ unsigned long kmap(struct page * page) {
#define kunmap(page) do { } while (0)
+#define kmap_atomic(page,idx) kmap(page)
+#define kunmap_atomic(page,idx) kunmap(page)
+
#endif /* CONFIG_HIGHMEM */
/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 0fcf3bfb2..b01390e6f 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -38,6 +38,7 @@ struct sockaddr_ll
/* Value 4 is still used by obsolete turbo-packet. */
#define PACKET_RX_RING 5
#define PACKET_STATISTICS 6
+#define PACKET_COPY_THRESH 7
struct tpacket_stats
{
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
new file mode 100644
index 000000000..5e0aa2420
--- /dev/null
+++ b/include/linux/if_tun.h
@@ -0,0 +1,92 @@
+/*
+ * Universal TUN/TAP device driver.
+ * Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
+ *
+ * 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.
+ *
+ * $Id: if_tun.h,v 1.1 2000/08/23 05:59:28 davem Exp $
+ */
+
+#ifndef __IF_TUN_H
+#define __IF_TUN_H
+
+/* Uncomment to enable debugging */
+/* #define TUN_DEBUG 1 */
+
+#ifdef __KERNEL__
+
+#ifdef TUN_DEBUG
+#define DBG if(tun->debug)printk
+#define DBG1 if(debug==2)printk
+#else
+#define DBG( a... )
+#define DBG1( a... )
+#endif
+
+struct tun_struct {
+ char name[8];
+ unsigned long flags;
+
+ struct fasync_struct *fasync;
+ wait_queue_head_t read_wait;
+
+ struct net_device dev;
+ struct sk_buff_head txq;
+ struct net_device_stats stats;
+
+#ifdef TUN_DEBUG
+ int debug;
+#endif
+};
+
+#ifndef MIN
+#define MIN(a,b) ( (a)<(b) ? (a):(b) )
+#endif
+
+#endif /* __KERNEL__ */
+
+/* Number of devices */
+#define TUN_MAX_DEV 255
+
+/* TX queue size */
+#define TUN_TXQ_SIZE 10
+
+/* Max frame size */
+#define TUN_MAX_FRAME 4096
+
+/* TUN device flags */
+#define TUN_TUN_DEV 0x0001
+#define TUN_TAP_DEV 0x0002
+#define TUN_TYPE_MASK 0x000f
+
+#define TUN_FASYNC 0x0010
+#define TUN_NOCHECKSUM 0x0020
+#define TUN_NO_PI 0x0040
+
+#define TUN_IFF_SET 0x1000
+
+/* Ioctl defines */
+#define TUNSETNOCSUM (('T'<< 8) | 200)
+#define TUNSETDEBUG (('T'<< 8) | 201)
+#define TUNSETIFF (('T'<< 8) | 202)
+
+/* TUNSETIFF ifr flags */
+#define IFF_TUN 0x0001
+#define IFF_TAP 0x0002
+#define IFF_NO_PI 0x1000
+
+struct tun_pi {
+ unsigned short flags;
+ unsigned short proto;
+};
+#define TUN_PKT_STRIP 0x0001
+
+#endif /* __IF_TUN_H */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index fdae6abd6..9f63f388a 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -34,21 +34,10 @@ struct in6_addr
__u8 u6_addr8[16];
__u16 u6_addr16[8];
__u32 u6_addr32[4];
-#if (~0UL) > 0xffffffff
-#ifndef __RELAX_IN6_ADDR_ALIGNMENT
- /* Alas, protocols do not respect 64bit alignmnet.
- rsvp/pim/... are broken. However, it is good
- idea to force correct alignment always, when
- it is possible.
- */
- __u64 u6_addr64[2];
-#endif
-#endif
} in6_u;
#define s6_addr in6_u.u6_addr8
#define s6_addr16 in6_u.u6_addr16
#define s6_addr32 in6_u.u6_addr32
-#define s6_addr64 in6_u.u6_addr64
};
struct sockaddr_in6 {
diff --git a/include/linux/input.h b/include/linux/input.h
index a44e6f8e1..277ee6c58 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -2,7 +2,7 @@
#define _INPUT_H
/*
- * $Id: input.h,v 1.14 2000/06/03 20:18:52 vojtech Exp $
+ * $Id: input.h,v 1.18 2000/07/25 21:36:56 vojtech Exp $
*
* Copyright (c) 1999-2000 Vojtech Pavlik
*
@@ -210,7 +210,7 @@ struct input_event {
#define KEY_F22 121
#define KEY_F23 122
#define KEY_F24 123
-#define KEY_JPN 124
+#define KEY_KPCOMMA 124
#define KEY_LEFTMETA 125
#define KEY_RIGHTMETA 126
#define KEY_COMPOSE 127
@@ -266,8 +266,29 @@ struct input_event {
#define KEY_EDIT 176
#define KEY_SCROLLUP 177
#define KEY_SCROLLDOWN 178
-
-#define KEY_UNKNOWN 180
+#define KEY_KPLEFTPAREN 179
+#define KEY_KPRIGHTPAREN 180
+
+#define KEY_INTL1 181
+#define KEY_INTL2 182
+#define KEY_INTL3 183
+#define KEY_INTL4 184
+#define KEY_INTL5 185
+#define KEY_INTL6 186
+#define KEY_INTL7 187
+#define KEY_INTL8 188
+#define KEY_INTL9 189
+#define KEY_LANG1 190
+#define KEY_LANG2 191
+#define KEY_LANG3 192
+#define KEY_LANG4 193
+#define KEY_LANG5 194
+#define KEY_LANG6 195
+#define KEY_LANG7 196
+#define KEY_LANG8 197
+#define KEY_LANG9 198
+
+#define KEY_UNKNOWN 200
#define BTN_MISC 0x100
#define BTN_0 0x100
@@ -424,6 +445,8 @@ struct input_event {
#define BUS_GAMEPORT 0x14
#define BUS_PARPORT 0x15
#define BUS_AMIGA 0x16
+#define BUS_ADB 0x17
+#define BUS_I2C 0x18
#ifdef __KERNEL__
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index e9550db61..7cdd4ff43 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -1,4 +1,4 @@
-/* $Id: isdn.h,v 1.105 2000/05/18 23:14:19 keil Exp $
+/* $Id: isdn.h,v 1.106 2000/08/10 22:52:46 kai Exp $
* Main header for the Linux ISDN subsystem (linklevel).
*
diff --git a/include/linux/isdn_divertif.h b/include/linux/isdn_divertif.h
index 2892d0218..ef532bad4 100644
--- a/include/linux/isdn_divertif.h
+++ b/include/linux/isdn_divertif.h
@@ -1,6 +1,5 @@
-/*
- * $Id: isdn_divertif.h,v 1.3 1999/07/05 20:22:00 werner Exp $
- *
+/* $Id: isdn_divertif.h,v 1.4 2000/05/11 22:29:22 kai Exp $
+
* Header for the diversion supplementary interface for i4l.
*
* Copyright 1998 by Werner Cornelius (werner@isdn4linux.de)
@@ -19,15 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Log: isdn_divertif.h,v $
- * Revision 1.3 1999/07/05 20:22:00 werner
- * changes to use diversion sources for all kernel versions.
- * removed static device, only proc filesystem used
- *
- * Revision 1.2 1999/07/04 21:38:38 werner
- * ported from kernel version 2.0
- *
- *
*/
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index b9efcb696..40530168e 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -1,65 +1,17 @@
/*
- * $Id: kernelcapi.h,v 1.6 2000/03/03 15:50:42 calle Exp $
+ * $Id: kernelcapi.h,v 1.7 2000/06/12 09:20:20 kai Exp $
*
* Kernel CAPI 2.0 Interface for Linux
*
* (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
*
- * $Log: kernelcapi.h,v $
- * Revision 1.6 2000/03/03 15:50:42 calle
- * - kernel CAPI:
- * - Changed parameter "param" in capi_signal from __u32 to void *.
- * - rewrote notifier handling in kcapi.c
- * - new notifier NCCI_UP and NCCI_DOWN
- * - User CAPI:
- * - /dev/capi20 is now a cloning device.
- * - middleware extentions prepared.
- * - capidrv.c
- * - locking of list operations and module count updates.
- *
- * Revision 1.5 2000/01/28 16:45:40 calle
- * new manufacturer command KCAPI_CMD_ADDCARD (generic addcard),
- * will search named driver and call the add_card function if one exist.
- *
- * Revision 1.4 1999/09/10 17:24:19 calle
- * Changes for proposed standard for CAPI2.0:
- * - AK148 "Linux Exention"
- *
- * Revision 1.3 1999/07/01 15:26:56 calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- * - support other controllers with CAPI-2.0 (i.e. USB Controller)
- * - write a CAPI-2.0 for the passive cards
- * - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- * make menuconfig, in the past all supported cards where included
- * at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- * using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- * PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- * Revision 1.2 1999/06/21 15:24:26 calle
- * extend information in /proc.
- *
- * Revision 1.1 1997/03/04 21:27:33 calle
- * First version in isdn4linux
- *
- * Revision 2.2 1997/02/12 09:31:39 calle
- * new version
- *
- * Revision 1.1 1997/01/31 10:32:20 calle
- * Initial revision
- *
- *
*/
+
#ifndef __KERNELCAPI_H__
#define __KERNELCAPI_H__
-#define CAPI_MAXAPPL 128 /* maximum number of applications */
-#define CAPI_MAXCONTR 16 /* maximum number of controller */
+#define CAPI_MAXAPPL 20 /* maximum number of applications */
+#define CAPI_MAXCONTR 10 /* maximum number of controller */
#define CAPI_MAXDATAWINDOW 8
@@ -162,6 +114,46 @@ int detach_capi_interface(struct capi_interface_user *);
#define CAPI_MSGCTRLERNOTSUPPORTEXTEQUIP 0x110a
#define CAPI_MSGCTRLERONLYSUPPORTEXTEQUIP 0x110b
+typedef enum {
+ CapiMessageNotSupportedInCurrentState = 0x2001,
+ CapiIllContrPlciNcci = 0x2002,
+ CapiNoPlciAvailable = 0x2003,
+ CapiNoNcciAvailable = 0x2004,
+ CapiNoListenResourcesAvailable = 0x2005,
+ CapiNoFaxResourcesAvailable = 0x2006,
+ CapiIllMessageParmCoding = 0x2007,
+} RESOURCE_CODING_PROBLEM;
+
+typedef enum {
+ CapiB1ProtocolNotSupported = 0x3001,
+ CapiB2ProtocolNotSupported = 0x3002,
+ CapiB3ProtocolNotSupported = 0x3003,
+ CapiB1ProtocolParameterNotSupported = 0x3004,
+ CapiB2ProtocolParameterNotSupported = 0x3005,
+ CapiB3ProtocolParameterNotSupported = 0x3006,
+ CapiBProtocolCombinationNotSupported = 0x3007,
+ CapiNcpiNotSupported = 0x3008,
+ CapiCipValueUnknown = 0x3009,
+ CapiFlagsNotSupported = 0x300a,
+ CapiFacilityNotSupported = 0x300b,
+ CapiDataLengthNotSupportedByCurrentProtocol = 0x300c,
+ CapiResetProcedureNotSupportedByCurrentProtocol = 0x300d,
+ CapiTeiAssignmentFailed = 0x300e,
+} REQUESTED_SERVICES_PROBLEM;
+
+typedef enum {
+ CapiSuccess = 0x0000,
+ CapiSupplementaryServiceNotSupported = 0x300e,
+ CapiRequestNotAllowedInThisState = 0x3010,
+} SUPPLEMENTARY_SERVICE_INFO;
+
+typedef enum {
+ CapiProtocolErrorLayer1 = 0x3301,
+ CapiProtocolErrorLayer2 = 0x3302,
+ CapiProtocolErrorLayer3 = 0x3303,
+ CapiTimeOut = 0x3303, // SuppServiceReason
+ CapiCallGivenToOtherApplication = 0x3304,
+} CAPI_REASON;
#endif /* __KERNEL__ */
diff --git a/include/linux/major.h b/include/linux/major.h
index 17a421ab8..7b43e59d0 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -134,6 +134,8 @@
#define USB_ACM_AUX_MAJOR 167
#define USB_CHAR_MAJOR 180
+#define TUN_MAJOR 195
+
#define UNIX98_PTY_MASTER_MAJOR 128
#define UNIX98_PTY_MAJOR_COUNT 8
#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
diff --git a/include/linux/mca.h b/include/linux/mca.h
index 1604c28bc..3e83a9134 100644
--- a/include/linux/mca.h
+++ b/include/linux/mca.h
@@ -1,46 +1,50 @@
/*
- * Header for Microchannel Architecture Bus
+ * Header for Microchannel Architecture Bus
* Written by Martin Kolinek, February 1996
-*/
+ */
#ifndef _LINUX_MCA_H
#define _LINUX_MCA_H
/* The detection of MCA bus is done in the real mode (using BIOS).
- * The information is exported to the protected code, where this
+ * The information is exported to the protected code, where this
* variable is set to one in case MCA bus was detected.
-*/
+ */
#ifndef MCA_bus__is_a_macro
extern int MCA_bus;
#endif
-/* maximal number of MCA slots - actually, some machines have less, but
-they all have sufficient number of POS registers to cover 8. */
+/* Maximal number of MCA slots - actually, some machines have less, but
+ * they all have sufficient number of POS registers to cover 8.
+ */
#define MCA_MAX_SLOT_NR 8
/* MCA_NOTFOUND is an error condition. The other two indicate
- motherboard POS registers contain the adapter. They might be
- returned by the mca_find_adapter() function, and can be used as
- arguments to mca_read_stored_pos(). I'm not going to allow direct
- access to the motherboard registers until we run across an adapter
- that requires it. We don't know enough about them to know if it's
- safe.
-
- See Documentation/mca.txt or one of the existing drivers for
- more information.
-*/
+ * motherboard POS registers contain the adapter. They might be
+ * returned by the mca_find_adapter() function, and can be used as
+ * arguments to mca_read_stored_pos(). I'm not going to allow direct
+ * access to the motherboard registers until we run across an adapter
+ * that requires it. We don't know enough about them to know if it's
+ * safe.
+ *
+ * See Documentation/mca.txt or one of the existing drivers for
+ * more information.
+ */
#define MCA_NOTFOUND (-1)
#define MCA_INTEGSCSI (MCA_MAX_SLOT_NR)
#define MCA_INTEGVIDEO (MCA_MAX_SLOT_NR+1)
-
-/* max number of adapters, including both slots and various integrated
-things. */
-#define MCA_NUMADAPTERS (MCA_MAX_SLOT_NR+2)
-
-/* returns the slot of the first enabled adapter matching id. User can
-specify a starting slot beyond zero, to deal with detecting multiple
-devices. Returns MCA_NOTFOUND if id not found. Also checks the
-integrated adapters. */
+#define MCA_MOTHERBOARD (MCA_MAX_SLOT_NR+2)
+
+/* Max number of adapters, including both slots and various integrated
+ * things.
+ */
+#define MCA_NUMADAPTERS (MCA_MAX_SLOT_NR+3)
+
+/* Returns the slot of the first enabled adapter matching id. User can
+ * specify a starting slot beyond zero, to deal with detecting multiple
+ * devices. Returns MCA_NOTFOUND if id not found. Also checks the
+ * integrated adapters.
+ */
extern int mca_find_adapter(int id, int start);
extern int mca_find_unused_adapter(int id, int start);
@@ -55,39 +59,37 @@ extern void mca_mark_as_unused(int slot);
/* gets a byte out of POS register (stored in memory) */
extern unsigned char mca_read_stored_pos(int slot, int reg);
-/*
- This can be expanded later. Right now, it gives us a way of
- getting meaningful information into the MCA_info structure,
- so we can have a more interesting /proc/mca.
-*/
+/* This can be expanded later. Right now, it gives us a way of
+ * getting meaningful information into the MCA_info structure,
+ * so we can have a more interesting /proc/mca.
+ */
extern void mca_set_adapter_name(int slot, char* name);
extern char* mca_get_adapter_name(int slot);
-/*
- This sets up an information callback for /proc/mca/slot?. The
- function is called with the buffer, slot, and device pointer (or
- some equally informative context information, or nothing, if you
- prefer), and is expected to put useful information into the
- buffer. The adapter name, id, and POS registers get printed
- before this is called though, so don't do it again.
-
- This should be called with a NULL procfn when a module
- unregisters, thus preventing kernel crashes and other such
- nastiness.
-*/
+/* This sets up an information callback for /proc/mca/slot?. The
+ * function is called with the buffer, slot, and device pointer (or
+ * some equally informative context information, or nothing, if you
+ * prefer), and is expected to put useful information into the
+ * buffer. The adapter name, id, and POS registers get printed
+ * before this is called though, so don't do it again.
+ *
+ * This should be called with a NULL procfn when a module
+ * unregisters, thus preventing kernel crashes and other such
+ * nastiness.
+ */
typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev);
extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev);
/* These routines actually mess with the hardware POS registers. They
-temporarily disable the device (and interrupts), so make sure you know
-what you're doing if you use them. Furthermore, writing to a POS may
-result in two devices trying to share a resource, which in turn can
-result in multiple devices sharing memory spaces, IRQs, or even trashing
-hardware. YOU HAVE BEEN WARNED.
-
-You can only access slots with this. Motherboard registers are off
-limits.
-*/
+ * temporarily disable the device (and interrupts), so make sure you know
+ * what you're doing if you use them. Furthermore, writing to a POS may
+ * result in two devices trying to share a resource, which in turn can
+ * result in multiple devices sharing memory spaces, IRQs, or even trashing
+ * hardware. YOU HAVE BEEN WARNED.
+ *
+ * You can only access slots with this. Motherboard registers are off
+ * limits.
+ */
/* read a byte from the specified POS register. */
extern unsigned char mca_read_pos(int slot, int reg);
@@ -96,7 +98,8 @@ extern unsigned char mca_read_pos(int slot, int reg);
extern void mca_write_pos(int slot, int reg, unsigned char byte);
/* Should only be called by the NMI interrupt handler, this will do some
-fancy stuff to figure out what might have generated a NMI. */
+ * fancy stuff to figure out what might have generated a NMI.
+ */
extern void mca_handle_nmi(void);
#endif /* _LINUX_MCA_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a248e939f..f606186cf 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -384,7 +384,6 @@ extern void si_meminfo(struct sysinfo * val);
extern void swapin_readahead(swp_entry_t);
/* mmap.c */
-extern void vma_init(void);
extern void merge_segments(struct mm_struct *, unsigned long, unsigned long);
extern void insert_vm_struct(struct mm_struct *, struct vm_area_struct *);
extern void build_mmap_avl(struct mm_struct *);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f0f191483..ebe8428da 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -402,7 +402,6 @@ struct packet_type
extern struct net_device loopback_dev; /* The loopback */
extern struct net_device *dev_base; /* All devices */
extern rwlock_t dev_base_lock; /* Device list lock */
-extern struct netdev_boot_setup dev_boot_setup[];
extern int netdev_boot_setup_add(char *name, struct ifmap *map);
extern int netdev_boot_setup_check(struct net_device *dev);
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
index 44612efa0..938b43d77 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
@@ -62,21 +62,13 @@ struct ip_conntrack_tuple
} dst;
};
-#define IP_PARTS_NATIVE(n) \
-(unsigned int)((n)>>24)&0xFF, \
-(unsigned int)((n)>>16)&0xFF, \
-(unsigned int)((n)>>8)&0xFF, \
-(unsigned int)((n)&0xFF)
-
-#define IP_PARTS(n) IP_PARTS_NATIVE(ntohl(n))
-
#ifdef __KERNEL__
#define DUMP_TUPLE(tp) \
-DEBUGP("tuple %p: %u %u.%u.%u.%u:%u -> %u.%u.%u.%u:%u\n", \
+DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \
(tp), (tp)->dst.protonum, \
- IP_PARTS((tp)->src.ip), ntohs((tp)->src.u.all), \
- IP_PARTS((tp)->dst.ip), ntohs((tp)->dst.u.all))
+ NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \
+ NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all))
#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h
index a78776235..aa08d68c4 100644
--- a/include/linux/netfilter_ipv4/ip_queue.h
+++ b/include/linux/netfilter_ipv4/ip_queue.h
@@ -26,6 +26,10 @@ typedef struct ipq_packet_msg {
unsigned int hook; /* Netfilter hook we rode in on */
char indev_name[IFNAMSIZ]; /* Name of incoming interface */
char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */
+ unsigned short hw_protocol; /* Hardware protocol (network order) */
+ unsigned short hw_type; /* Hardware type */
+ unsigned char hw_addrlen; /* Hardware address length */
+ unsigned char hw_addr[8]; /* Hardware address */
size_t data_len; /* Length of packet data */
unsigned char payload[0]; /* Optional packet data */
} ipq_packet_msg_t;
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 26e8edd22..dacab2198 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -57,7 +57,7 @@ struct readdir_cd {
char dotonly;
};
typedef int (*encode_dent_fn)(struct readdir_cd *, const char *,
- int, off_t, ino_t);
+ int, off_t, ino_t, unsigned int);
typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
/*
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 323c62b83..4bb4f668b 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -151,7 +151,7 @@ int nfssvc_encode_statfsres(struct svc_rqst *, u32 *, struct nfsd_statfsres *);
int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *);
int nfssvc_encode_entry(struct readdir_cd *, const char *name,
- int namlen, off_t offset, ino_t ino);
+ int namlen, off_t offset, ino_t ino, unsigned int);
int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index f3e72151c..a5ca90410 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -292,9 +292,11 @@ int nfs3svc_release_fhandle(struct svc_rqst *, u32 *,
int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *,
struct nfsd3_fhandle_pair *);
int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
- int namlen, off_t offset, ino_t ino);
+ int namlen, off_t offset, ino_t ino,
+ unsigned int);
int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
- int namlen, off_t offset, ino_t ino);
+ int namlen, off_t offset, ino_t ino,
+ unsigned int);
#endif /* _LINUX_NFSD_XDR3_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f12c936d8..7f68d1951 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -549,6 +549,7 @@
#define PCI_VENDOR_ID_PLX 0x10b5
#define PCI_VENDOR_ID_PLX_ROMULUS 0x106a
#define PCI_DEVICE_ID_PLX_SPCOM800 0x1076
+#define PCI_DEVICE_ID_PLX_1077 0x1077
#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103
#define PCI_DEVICE_ID_PLX_9050 0x9050
#define PCI_DEVICE_ID_PLX_9060 0x9060
@@ -856,8 +857,8 @@
#define PCI_VENDOR_ID_V3 0x11b0
#define PCI_DEVICE_ID_V3_V960 0x0001
#define PCI_DEVICE_ID_V3_V350 0x0001
-#define PCI_DEVICE_ID_V3_V960V2 0x0002
-#define PCI_DEVICE_ID_V3_V350V2 0x0002
+#define PCI_DEVICE_ID_V3_V961 0x0002
+#define PCI_DEVICE_ID_V3_V351 0x0002
#define PCI_VENDOR_ID_NP 0x11bc
#define PCI_DEVICE_ID_NP_PCI_FDDI 0x0001
@@ -978,6 +979,9 @@
#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485 0x0006
#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2 0x0007
#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485 0x0008
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B
#define PCI_VENDOR_ID_PICTUREL 0x12c5
#define PCI_DEVICE_ID_PICTUREL_PCIVST 0x0081
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 08d2a1b78..ce998195c 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -89,7 +89,7 @@ extern inline mddev_t * kdev_to_mddev (kdev_t dev)
/*
* default readahead
*/
-#define MD_READAHEAD (256 * 512)
+#define MD_READAHEAD MAX_READAHEAD
extern inline int disk_faulty(mdp_disk_t * d)
{
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index f27ad591f..40738af95 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -277,9 +277,11 @@ enum
#define RTAX_CWND RTAX_CWND
RTAX_ADVMSS,
#define RTAX_ADVMSS RTAX_ADVMSS
+ RTAX_REORDERING,
+#define RTAX_REORDERING RTAX_REORDERING
};
-#define RTAX_MAX RTAX_ADVMSS
+#define RTAX_MAX RTAX_REORDERING
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d6daffe8d..db6ec43cd 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -367,6 +367,9 @@ struct task_struct {
struct signal_queue *sigqueue, **sigqueue_tail;
unsigned long sas_ss_sp;
size_t sas_ss_size;
+ int (*notifier)(void *priv);
+ void *notifier_data;
+ sigset_t *notifier_mask;
/* Thread group tracking */
u32 parent_exec_id;
@@ -543,9 +546,13 @@ extern int in_egroup_p(gid_t);
extern void release(struct task_struct * p);
+extern void proc_caches_init(void);
extern void flush_signals(struct task_struct *);
extern void flush_signal_handlers(struct task_struct *);
extern int dequeue_signal(sigset_t *, siginfo_t *);
+extern void block_all_signals(int (*notifier)(void *priv), void *priv,
+ sigset_t *mask);
+extern void unblock_all_signals(void);
extern int send_sig_info(int, struct siginfo *, struct task_struct *);
extern int force_sig_info(int, struct siginfo *, struct task_struct *);
extern int kill_pg_info(int, struct siginfo *, pid_t);
diff --git a/include/linux/serial.h b/include/linux/serial.h
index ce404ca1a..7d4178a54 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -123,6 +123,8 @@ struct serial_uart_config {
#define ASYNC_BUGGY_UART 0x4000 /* This is a buggy UART, skip some safety
* checks. Note: can be dangerous! */
+#define ASYNC_AUTOPROBE 0x8000 /* Port was autoprobed by PCI or PNP code */
+
#define ASYNC_FLAGS 0x7FFF /* Possible legal async flags */
#define ASYNC_USR_MASK 0x3430 /* Legal flags that non-privileged
* users can set or reset */
@@ -137,7 +139,6 @@ struct serial_uart_config {
#define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
#define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards
--- no longer used */
-#define ASYNC_AUTOPROBE 0x00800000 /* Port was autoprobed */
#define ASYNC_INTERNAL_FLAGS 0xFF000000 /* Internal flags */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 850837af2..c67f8c85a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -931,6 +931,12 @@ skb_cow(struct sk_buff *skb, unsigned int headroom)
return skb;
}
+#define skb_queue_walk(queue, skb) \
+ for (skb = (queue)->next; \
+ (skb != (struct sk_buff *)(queue)); \
+ skb=skb->next)
+
+
extern struct sk_buff * skb_recv_datagram(struct sock *sk,unsigned flags,int noblock, int *err);
extern unsigned int datagram_poll(struct file *file, struct socket *sock, struct poll_table_struct *wait);
extern int skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 76ccf2dbb..4f4818873 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -73,6 +73,8 @@ extern kmem_cache_t *files_cachep;
extern kmem_cache_t *filp_cachep;
extern kmem_cache_t *dquot_cachep;
extern kmem_cache_t *bh_cachep;
+extern kmem_cache_t *fs_cachep;
+extern kmem_cache_t *sigact_cachep;
#ifdef CONFIG_SMP
extern unsigned long slab_cache_drain_mask;
diff --git a/include/linux/smb.h b/include/linux/smb.h
index 852d5b0dd..1382db0dc 100644
--- a/include/linux/smb.h
+++ b/include/linux/smb.h
@@ -62,6 +62,13 @@ struct smb_conn_opt {
#ifdef __KERNEL__
+#define SMB_NLS_MAXNAMELEN 20
+struct smb_nls_codepage {
+ char local_name[SMB_NLS_MAXNAMELEN];
+ char remote_name[SMB_NLS_MAXNAMELEN];
+};
+
+
#define SMB_MAXNAMELEN 255
#define SMB_MAXPATHLEN 1024
diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h
index 375ff3112..e475057fc 100644
--- a/include/linux/smb_fs.h
+++ b/include/linux/smb_fs.h
@@ -73,13 +73,6 @@ smb_vfree(void *obj)
#define SMB_F_CACHEVALID 0x01 /* directory cache valid */
#define SMB_F_LOCALWRITE 0x02 /* file modified locally */
-/*
- * Bug fix flags
- */
-#define SMB_FIX_WIN95 0x0001 /* Win 95 server */
-#define SMB_FIX_OLDATTR 0x0002 /* Use core getattr (Win 95 speedup) */
-#define SMB_FIX_DIRATTR 0x0004 /* Use find_first for getattr */
-
/* NT1 protocol capability bits */
#define SMB_CAP_RAW_MODE 0x0001
@@ -122,6 +115,7 @@ unsigned long smb_invent_inos(unsigned long);
struct inode *smb_iget(struct super_block *, struct smb_fattr *);
/* linux/fs/smbfs/proc.c */
+int smb_setcodepage(struct smb_sb_info *server, struct smb_nls_codepage *cp);
__u32 smb_len(unsigned char *);
__u8 *smb_encode_smb_length(__u8 *, __u32);
__u8 *smb_setup_header(struct smb_sb_info *, __u8, __u16, __u16);
diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h
index 31052af1f..4bad7e928 100644
--- a/include/linux/smb_fs_sb.h
+++ b/include/linux/smb_fs_sb.h
@@ -23,7 +23,7 @@ struct smb_sb_info {
enum smb_conn_state state;
struct file * sock_file;
- struct smb_mount_data *mnt;
+ struct smb_mount_data_kernel *mnt;
unsigned char *temp_buf;
/* Connections are counted. Each time a new socket arrives,
@@ -41,8 +41,20 @@ struct smb_sb_info {
unsigned short rcls; /* The error codes we received */
unsigned short err;
- /* We use our on data_ready callback, but need the original one */
+ /* We use our own data_ready callback, but need the original one */
void *data_ready;
+
+ /* nls pointers for codepage conversions */
+ struct nls_table *remote_nls;
+ struct nls_table *local_nls;
+
+ /* utf8 can make strings longer so we can't do in-place conversion.
+ This is a buffer for temporary stuff. We only need one so no need
+ to put it on the stack. This points to temp_buf space. */
+ char *name_buf;
+
+ int (*convert)(char *, int, const char *, int,
+ struct nls_table *, struct nls_table *);
};
#endif /* __KERNEL__ */
diff --git a/include/linux/smb_mount.h b/include/linux/smb_mount.h
index 886d945d5..ea240db51 100644
--- a/include/linux/smb_mount.h
+++ b/include/linux/smb_mount.h
@@ -11,7 +11,7 @@
#include <linux/types.h>
-#define SMB_MOUNT_VERSION 6
+#define SMB_MOUNT_VERSION 6
struct smb_mount_data {
int version;
@@ -22,4 +22,37 @@ struct smb_mount_data {
__kernel_mode_t dir_mode;
};
+
+#ifdef __KERNEL__
+
+/* "vers" in big-endian */
+#define SMB_MOUNT_ASCII 0x76657273
+
+#define SMB_MOUNT_OLDVERSION 6
+#undef SMB_MOUNT_VERSION
+#define SMB_MOUNT_VERSION 7
+
+/* flags */
+#define SMB_MOUNT_WIN95 0x0001 /* Win 95 server */
+#define SMB_MOUNT_OLDATTR 0x0002 /* Use core getattr (Win 95 speedup) */
+#define SMB_MOUNT_DIRATTR 0x0004 /* Use find_first for getattr */
+#define SMB_MOUNT_CASE 0x0008 /* Be case sensitive */
+
+
+struct smb_mount_data_kernel {
+ int version;
+
+ __kernel_uid_t mounted_uid; /* Who may umount() this filesystem? */
+ __kernel_uid_t uid;
+ __kernel_gid_t gid;
+ __kernel_mode_t file_mode;
+ __kernel_mode_t dir_mode;
+
+ u32 flags;
+
+ struct smb_nls_codepage codepage;
+};
+
+#endif
+
#endif
diff --git a/include/linux/sound.h b/include/linux/sound.h
index 4921b90e2..18a673320 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -1,3 +1,28 @@
+
+/*
+ * Minor numbers for the sound driver.
+ */
+
+#define SND_DEV_CTL 0 /* Control port /dev/mixer */
+#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
+ synthesizer and MIDI output) */
+#define SND_DEV_MIDIN 2 /* Raw midi access */
+#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
+#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
+#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
+/* #define SND_DEV_STATUS 6 */ /* /dev/sndstat (obsolete) */
+#define SND_DEV_UNUSED 6
+#define SND_DEV_AWFM 7 /* Reserved */
+#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
+/* #define SND_DEV_SNDPROC 9 */ /* /dev/sndproc for programmable devices (not used) */
+/* #define SND_DEV_DMMIDI 9 */
+#define SND_DEV_SYNTH 9 /* Raw synth access /dev/synth (same as /dev/dmfm) */
+#define SND_DEV_DMFM 10 /* Raw synth access /dev/dmfm */
+#define SND_DEV_UNKNOWN11 11
+#define SND_DEV_ADSP 12 /* Like /dev/dsp (obsolete) */
+#define SND_DEV_AMIDI 13 /* Like /dev/midi (obsolete) */
+#define SND_DEV_ADMMIDI 14 /* Like /dev/dmmidi (onsolete) */
+
/*
* Sound core interface functions
*/
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 7dfe40942..91913e545 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -260,6 +260,15 @@ enum
NET_TCP_SYNACK_RETRIES=76,
NET_TCP_MAX_ORPHANS=77,
NET_TCP_MAX_TW_BUCKETS=78,
+ NET_TCP_FACK=79,
+ NET_TCP_REORDERING=80,
+ NET_TCP_ECN=81,
+ NET_TCP_DSACK=82,
+ NET_TCP_MEM=83,
+ NET_TCP_WMEM=84,
+ NET_TCP_RMEM=85,
+ NET_TCP_APP_WIN=86,
+ NET_TCP_ADV_WIN_SCALE=87,
};
enum {
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index 3c8f1d415..04e4a8a7c 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -250,19 +250,6 @@ struct ufs_timeval {
__s32 tv_usec;
};
-/*
- * File types
- */
-#define DT_UNKNOWN 0
-#define DT_FIFO 1
-#define DT_CHR 2
-#define DT_DIR 4
-#define DT_BLK 6
-#define DT_REG 8
-#define DT_LNK 10
-#define DT_SOCK 12
-#define DT_WHT 14
-
struct ufs_dir_entry {
__u32 d_ino; /* inode number of this entry */
__u16 d_reclen; /* length of this entry */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index b50c5890c..c01871586 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -261,7 +261,7 @@ struct usb_interface_descriptor {
struct usb_endpoint_descriptor *endpoint;
- unsigned char *extra;
+ unsigned char *extra; /* Extra descriptors */
int extralen;
} __attribute__ ((packed));
@@ -288,6 +288,9 @@ struct usb_config_descriptor {
__u8 MaxPower;
struct usb_interface *interface;
+
+ unsigned char *extra; /* Extra descriptors */
+ int extralen;
} __attribute__ ((packed));
/* String descriptor */
diff --git a/include/net/dst.h b/include/net/dst.h
index 4bca9c092..253d72a22 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -44,6 +44,7 @@ struct dst_entry
unsigned ssthresh;
unsigned cwnd;
unsigned advmss;
+ unsigned reordering;
unsigned long rate_last; /* rate limiting for ICMP */
unsigned long rate_tokens;
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 8bcb17085..2bd127299 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -199,7 +199,45 @@ struct linux_mib
unsigned long TCPPrequeueDropped;
unsigned long TCPHPHits;
unsigned long TCPHPHitsToUser;
- unsigned long __pad[32-26];
+ unsigned long TCPPureAcks;
+ unsigned long TCPHPAcks;
+ unsigned long TCPRenoRecovery;
+ unsigned long TCPSackRecovery;
+ unsigned long TCPSACKReneging;
+ unsigned long TCPFACKReorder;
+ unsigned long TCPSACKReorder;
+ unsigned long TCPRenoReorder;
+ unsigned long TCPTSReorder;
+ unsigned long TCPFullUndo;
+ unsigned long TCPPartialUndo;
+ unsigned long TCPDSACKUndo;
+ unsigned long TCPLossUndo;
+ unsigned long TCPLoss;
+ unsigned long TCPLostRetransmit;
+ unsigned long TCPRenoFailures;
+ unsigned long TCPSackFailures;
+ unsigned long TCPLossFailures;
+ unsigned long TCPFastRetrans;
+ unsigned long TCPForwardRetrans;
+ unsigned long TCPSlowStartRetrans;
+ unsigned long TCPTimeouts;
+ unsigned long TCPRenoRecoveryFail;
+ unsigned long TCPSackRecoveryFail;
+ unsigned long TCPSchedulerFailed;
+ unsigned long TCPRcvCollapsed;
+ unsigned long TCPDSACKOldSent;
+ unsigned long TCPDSACKOfoSent;
+ unsigned long TCPDSACKRecv;
+ unsigned long TCPDSACKOfoRecv;
+ unsigned long TCPAbortOnSyn;
+ unsigned long TCPAbortOnData;
+ unsigned long TCPAbortOnClose;
+ unsigned long TCPAbortOnMemory;
+ unsigned long TCPAbortOnTimeout;
+ unsigned long TCPAbortOnLinger;
+ unsigned long TCPAbortFailed;
+ unsigned long TCPMemoryPressures;
+ unsigned long __pad[64-64];
};
#define SNMP_INC_STATS(mib, field) ((mib)[2*smp_processor_id()+!in_softirq()].field++)
diff --git a/include/net/sock.h b/include/net/sock.h
index 87a8c3941..38b5549d6 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -268,10 +268,10 @@ struct tcp_opt {
__u8 pingpong; /* The session is interactive */
__u8 blocked; /* Delayed ACK was blocked by socket lock*/
__u32 ato; /* Predicted tick of soft clock */
+ unsigned long timeout; /* Currently scheduled timeout */
__u32 lrcvtime; /* timestamp of last received data packet*/
- __u16 last_seg_size; /* Size of last incoming segment */
- __u16 rcv_mss; /* MSS used for delayed ACK decisions */
- __u32 rcv_segs; /* Number of received segments since last ack */
+ __u16 last_seg_size; /* Size of last incoming segment */
+ __u16 rcv_mss; /* MSS used for delayed ACK decisions */
} ack;
/* Data for direct copy to user */
@@ -284,19 +284,18 @@ struct tcp_opt {
} ucopy;
__u32 snd_wl1; /* Sequence for window update */
- __u32 snd_wl2; /* Ack sequence for update */
__u32 snd_wnd; /* The window we expect to receive */
__u32 max_window; /* Maximal window ever seen from peer */
__u32 pmtu_cookie; /* Last pmtu seen by socket */
__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; /* Consecutive duplicate acks seen from other end */
- __u8 retransmits;
+ __u8 ca_state; /* State of fast-retransmit machine */
+ __u8 retransmits; /* Number of unrecovered RTO timeouts. */
- __u8 __empty1;
- __u8 sorry;
- __u8 defer_accept;
+ __u8 reordering; /* Packet reordering metric. */
+ __u8 queue_shrunk; /* Write queue has been shrunk recently.*/
+ __u8 defer_accept; /* User waits for some data after accept() */
/* RTT measurement */
__u8 backoff; /* backoff */
@@ -305,9 +304,9 @@ struct tcp_opt {
__u32 rto; /* retransmit timeout */
__u32 packets_out; /* Packets which are "in flight" */
- __u32 fackets_out; /* Non-retrans SACK'd packets */
- __u32 retrans_out; /* Fast-retransmitted packets out */
- __u32 high_seq; /* snd_nxt at onset of congestion */
+ __u32 left_out; /* Packets which leaved network */
+ __u32 retrans_out; /* Retransmitted packets out */
+
/*
* Slow start and congestion control (see also Nagle, and Karn & Partridge)
@@ -316,12 +315,11 @@ struct tcp_opt {
__u32 snd_cwnd; /* Sending congestion window */
__u16 snd_cwnd_cnt; /* Linear increase counter */
__u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
-
- __u8 nonagle; /* Disable Nagle algorithm? */
- __u8 syn_retries; /* num of allowed syn retries */
- __u16 user_mss; /* mss requested by user in ioctl */
+ __u32 snd_cwnd_used;
+ __u32 snd_cwnd_stamp;
/* Two commonly used timers in both sender and receiver paths. */
+ unsigned long timeout;
struct timer_list retransmit_timer; /* Resend (no ack) */
struct timer_list delack_timer; /* Ack delay */
@@ -329,16 +327,12 @@ struct tcp_opt {
struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */
struct sk_buff *send_head; /* Front of stuff to transmit */
- struct sk_buff *retrans_head; /* retrans head can be
- * different to the head of
- * write queue if we are doing
- * fast retransmit
- */
__u32 rcv_wnd; /* Current receiver window */
__u32 rcv_wup; /* rcv_nxt on last window update sent */
- __u32 write_seq;
- __u32 copied_seq;
+ __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
+ __u32 pushed_seq; /* Last pushed seq, required to talk to windows */
+ __u32 copied_seq; /* Head of yet unread data */
/*
* Options received (usually on last packet, some only on SYN packets).
*/
@@ -348,7 +342,7 @@ struct tcp_opt {
char saw_tstamp; /* Saw TIMESTAMP on last packet */
__u8 snd_wscale; /* Window scaling received from sender */
__u8 rcv_wscale; /* Window scaling to send to receiver */
- __u8 rexmt_done; /* Retransmitted up to send head? */
+ __u8 nonagle; /* Disable Nagle algorithm? */
__u8 keepalive_probes; /* num of allowed keep alive probes */
/* PAWS/RTTM data */
@@ -358,19 +352,37 @@ struct tcp_opt {
long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
/* SACKs data */
+ __u16 user_mss; /* mss requested by user in ioctl */
+ __u8 dsack; /* D-SACK is scheduled */
+ __u8 eff_sacks; /* Size of SACK array to send with next packet */
+ struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
- struct timer_list probe_timer; /* Probes */
__u32 window_clamp; /* Maximal window to advertise */
+ __u32 rcv_ssthresh; /* Current window clamp */
__u8 probes_out; /* unanswered 0 window probes */
__u8 num_sacks; /* Number of SACK blocks */
__u16 advmss; /* Advertised MSS */
- __u32 syn_stamp;
- __u32 syn_seq;
- __u32 fin_seq;
- __u32 urg_seq;
- __u32 urg_data;
+ __u8 syn_retries; /* num of allowed syn retries */
+ __u8 ecn_flags; /* ECN status bits. */
+ __u16 prior_ssthresh; /* ssthresh saved at recovery start */
+ __u32 lost_out; /* Lost packets */
+ __u32 sacked_out; /* SACK'd packets */
+ __u32 fackets_out; /* FACK'd packets */
+ __u32 high_seq; /* snd_nxt at onset of congestion */
+
+ __u32 retrans_stamp; /* Timestamp of the last retransmit,
+ * also used in SYN-SENT to remember stamp of
+ * the first SYN. */
+ __u32 undo_marker; /* tracking retrans started here. */
+ int undo_retrans; /* number of undoable retransmissions. */
+ __u32 syn_seq; /* Seq of received SYN. */
+ __u32 fin_seq; /* Seq of received FIN. */
+ __u32 urg_seq; /* Seq of received urgent pointer */
+ __u16 urg_data; /* Saved octet of OOB data and control flags */
+ __u8 pending; /* Scheduled timer event */
+ __u8 __empty;
/* The syn_wait_lock is necessary only to avoid tcp_get_info having
* to grab the main lock sock while browsing the listening hash
@@ -482,8 +494,8 @@ struct sock {
__u16 sport; /* Source port */
unsigned short family; /* Address family */
- unsigned char reuse, /* SO_REUSEADDR setting */
- __unused;
+ unsigned char reuse; /* SO_REUSEADDR setting */
+ unsigned char shutdown;
atomic_t refcnt; /* Reference count */
socket_lock_t lock; /* Synchronizer... */
@@ -497,6 +509,8 @@ struct sock {
atomic_t wmem_alloc; /* Transmit queue bytes committed */
struct sk_buff_head write_queue; /* Packet sending queue */
atomic_t omem_alloc; /* "o" is "option" or "other" */
+ int wmem_queued; /* Persistent queue size */
+ int forward_alloc; /* Space allocated forward. */
__u32 saddr; /* Sending source */
unsigned int allocation; /* Allocation mode */
int sndbuf; /* Size of send buffer in bytes */
@@ -539,8 +553,6 @@ struct sock {
struct proto *prot;
- unsigned short shutdown;
-
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
union {
struct ipv6_pinfo af_inet6;
@@ -734,6 +746,11 @@ static void __inline__ sock_prot_dec_use(struct proto *prot)
#define RCV_SHUTDOWN 1
#define SEND_SHUTDOWN 2
+#define SOCK_SNDBUF_LOCK 1
+#define SOCK_RCVBUF_LOCK 2
+#define SOCK_BINDADDR_LOCK 4
+
+
/* Used by processes to "lock" a socket state, so that
* interrupts and bottom half handlers won't change it
* from under us. It essentially blocks any incoming
@@ -801,8 +818,6 @@ extern struct sk_buff *sock_rmalloc(struct sock *sk,
int priority);
extern void sock_wfree(struct sk_buff *skb);
extern void sock_rfree(struct sk_buff *skb);
-extern void sock_cfree(struct sk_buff *skb);
-extern unsigned long sock_rspace(struct sock *sk);
extern unsigned long sock_wspace(struct sock *sk);
extern int sock_setsockopt(struct socket *sock, int level,
@@ -982,8 +997,6 @@ extern __inline__ void sock_put(struct sock *sk)
* we do not release it in this function, because protocol
* probably wants some additional cleanups or even continuing
* to work with this socket (TCP).
- *
- * NOTE: When softnet goes in replace _irq with _bh!
*/
extern __inline__ void sock_orphan(struct sock *sk)
{
@@ -1003,6 +1016,25 @@ extern __inline__ void sock_graft(struct sock *sk, struct socket *parent)
write_unlock_bh(&sk->callback_lock);
}
+static inline int sock_i_uid(struct sock *sk)
+{
+ int uid;
+
+ read_lock(&sk->callback_lock);
+ uid = sk->socket ? sk->socket->inode->i_uid : 0;
+ read_unlock(&sk->callback_lock);
+ return uid;
+}
+
+static inline unsigned long sock_i_ino(struct sock *sk)
+{
+ unsigned long ino;
+
+ read_lock(&sk->callback_lock);
+ ino = sk->socket ? sk->socket->inode->i_ino : 0;
+ read_unlock(&sk->callback_lock);
+ return ino;
+}
extern __inline__ struct dst_entry *
__sk_dst_get(struct sock *sk)
@@ -1110,14 +1142,6 @@ extern __inline__ void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
atomic_add(skb->truesize, &sk->rmem_alloc);
}
-extern __inline__ void skb_set_owner_c(struct sk_buff *skb, struct sock *sk)
-{
- sock_hold(sk);
- skb->sk = sk;
- skb->destructor = sock_cfree;
-}
-
-
extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
{
/* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
@@ -1194,7 +1218,7 @@ extern __inline__ void sk_wake_async(struct sock *sk, int how, int band)
}
#define SOCK_MIN_SNDBUF 2048
-#define SOCK_MIN_RCVBUF 128
+#define SOCK_MIN_RCVBUF 256
/* Must be less or equal SOCK_MIN_SNDBUF */
#define SOCK_MIN_WRITE_SPACE SOCK_MIN_SNDBUF
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 7df845895..d3a63962c 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -19,9 +19,13 @@
#define _TCP_H
#define TCP_DEBUG 1
+#define FASTRETRANS_DEBUG 1
+
+/* Be paranoid about data immediately beyond right edge of window. */
#undef TCP_FORMAL_WINDOW
-#define TCP_MORE_COARSE_ACKS
-#undef TCP_LESS_COARSE_ACKS
+
+/* Cancel timers, when they are not required. */
+#undef TCP_CLEAR_TIMERS
#include <linux/config.h>
#include <linux/tcp.h>
@@ -173,7 +177,7 @@ extern __inline__ void tcp_tw_put(struct tcp_tw_bucket *tw)
}
extern atomic_t tcp_orphan_count;
-extern int tcp_tw_count;
+extern int tcp_tw_count;
extern void tcp_time_wait(struct sock *sk, int state, int timeo);
extern void tcp_timewait_kill(struct tcp_tw_bucket *tw);
extern void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo);
@@ -242,12 +246,14 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
/* Minimal RCV_MSS. */
#define TCP_MIN_RCVMSS 536
-/*
- * How much of the receive buffer do we advertize
- * (the rest is reserved for headers and driver packet overhead)
- * Use a power of 2.
- */
-#define TCP_WINDOW_ADVERTISE_DIVISOR 2
+/* After receiving this amount of duplicate ACKs fast retransmit starts. */
+#define TCP_FASTRETRANS_THRESH 3
+
+/* Maximal reordering. */
+#define TCP_MAX_REORDERING 127
+
+/* Maximal number of ACKs sent quickly to accelerate slow-start. */
+#define TCP_MAX_QUICKACKS 16
/* urg_data states */
#define TCP_URG_VALID 0x0100
@@ -292,7 +298,6 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
#define TCP_DELACK_MAX (HZ/5) /* maximal time to delay before sending an ACK */
#define TCP_DELACK_MIN (2) /* minimal time to delay before sending an ACK,
* 2 scheduler ticks, not depending on HZ. */
-#define TCP_ATO_MAX (HZ/2) /* Clamp ATO estimator at his value. */
#define TCP_ATO_MIN 2
#define TCP_RTO_MAX (120*HZ)
#define TCP_RTO_MIN (HZ/5)
@@ -414,6 +419,19 @@ extern int sysctl_tcp_tw_recycle;
extern int sysctl_tcp_abort_on_overflow;
extern int sysctl_tcp_max_orphans;
extern int sysctl_tcp_max_tw_buckets;
+extern int sysctl_tcp_fack;
+extern int sysctl_tcp_reordering;
+extern int sysctl_tcp_ecn;
+extern int sysctl_tcp_dsack;
+extern int sysctl_tcp_mem[3];
+extern int sysctl_tcp_wmem[3];
+extern int sysctl_tcp_rmem[3];
+extern int sysctl_tcp_app_win;
+extern int sysctl_tcp_adv_win_scale;
+
+extern atomic_t tcp_memory_allocated;
+extern atomic_t tcp_sockets_allocated;
+extern int tcp_memory_pressure;
struct open_request;
@@ -606,6 +624,23 @@ extern int tcp_rcv_established(struct sock *sk,
struct tcphdr *th,
unsigned len);
+enum tcp_ack_state_t
+{
+ TCP_ACK_SCHED = 1,
+ TCP_ACK_TIMER = 2,
+ TCP_ACK_PUSHED= 4
+};
+
+static inline void tcp_schedule_ack(struct tcp_opt *tp)
+{
+ tp->ack.pending |= TCP_ACK_SCHED;
+}
+
+static inline int tcp_ack_scheduled(struct tcp_opt *tp)
+{
+ return tp->ack.pending&TCP_ACK_SCHED;
+}
+
static __inline__ void tcp_dec_quickack_mode(struct tcp_opt *tp)
{
if (tp->ack.quick && --tp->ack.quick == 0) {
@@ -614,11 +649,27 @@ static __inline__ void tcp_dec_quickack_mode(struct tcp_opt *tp)
}
}
+extern void tcp_enter_quickack_mode(struct tcp_opt *tp);
+
static __inline__ void tcp_delack_init(struct tcp_opt *tp)
{
memset(&tp->ack, 0, sizeof(tp->ack));
}
+enum tcp_ca_state
+{
+ TCP_CA_Open = 0,
+#define TCPF_CA_Open (1<<TCP_CA_Open)
+ TCP_CA_Disorder = 1,
+#define TCPF_CA_Disorder (1<<TCP_CA_Disorder)
+ TCP_CA_CWR = 2,
+#define TCPF_CA_CWR (1<<TCP_CA_CWR)
+ TCP_CA_Recovery = 3,
+#define TCPF_CA_Recovery (1<<TCP_CA_Recovery)
+ TCP_CA_Loss = 4
+#define TCPF_CA_Loss (1<<TCP_CA_Loss)
+};
+
enum tcp_tw_status
{
@@ -640,6 +691,9 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
extern int tcp_child_process(struct sock *parent,
struct sock *child,
struct sk_buff *skb);
+extern void tcp_enter_loss(struct sock *sk, int how);
+extern void tcp_clear_retrans(struct tcp_opt *tp);
+extern void tcp_update_metrics(struct sock *sk);
extern void tcp_close(struct sock *sk,
long timeout);
@@ -661,8 +715,8 @@ extern int tcp_recvmsg(struct sock *sk,
extern int tcp_listen_start(struct sock *sk);
-extern void tcp_parse_options(struct sock *sk, struct tcphdr *th,
- struct tcp_opt *tp, int no_fancy);
+extern void tcp_parse_options(struct sk_buff *skb,
+ struct tcp_opt *tp);
/*
* TCP v4 functions exported for the inet6 API
@@ -720,7 +774,6 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
extern int tcp_write_xmit(struct sock *);
extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
-extern void tcp_fack_retransmit(struct sock *);
extern void tcp_xmit_retransmit_queue(struct sock *);
extern void tcp_simple_retransmit(struct sock *);
@@ -736,7 +789,6 @@ extern void tcp_send_ack(struct sock *sk);
extern void tcp_send_delayed_ack(struct sock *sk);
/* tcp_timer.c */
-extern void tcp_reset_xmit_timer(struct sock *, int, unsigned long);
extern void tcp_init_xmit_timers(struct sock *);
extern void tcp_clear_xmit_timers(struct sock *);
@@ -744,6 +796,76 @@ extern void tcp_delete_keepalive_timer (struct sock *);
extern void tcp_reset_keepalive_timer (struct sock *, unsigned long);
extern int tcp_sync_mss(struct sock *sk, u32 pmtu);
+extern const char timer_bug_msg[];
+
+
+static inline void tcp_clear_xmit_timer(struct sock *sk, int what)
+{
+ struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
+
+ switch (what) {
+ case TCP_TIME_RETRANS:
+ case TCP_TIME_PROBE0:
+ tp->pending = 0;
+
+#ifdef TCP_CLEAR_TIMERS
+ if (timer_pending(&tp->retransmit_timer) &&
+ del_timer(&tp->retransmit_timer))
+ __sock_put(sk);
+#endif
+ break;
+ case TCP_TIME_DACK:
+ tp->ack.blocked = 0;
+ tp->ack.pending = 0;
+
+#ifdef TCP_CLEAR_TIMERS
+ if (timer_pending(&tp->delack_timer) &&
+ del_timer(&tp->delack_timer))
+ __sock_put(sk);
+#endif
+ break;
+ default:
+ printk(timer_bug_msg);
+ return;
+ };
+
+}
+
+/*
+ * Reset the retransmission timer
+ */
+static inline void tcp_reset_xmit_timer(struct sock *sk, int what, unsigned long when)
+{
+ struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
+
+ if (when > TCP_RTO_MAX) {
+#ifdef TCP_DEBUG
+ printk(KERN_DEBUG "reset_xmit_timer sk=%p %d when=0x%lx, caller=%p\n", sk, what, when, current_text_addr());
+#endif
+ when = TCP_RTO_MAX;
+ }
+
+ switch (what) {
+ case TCP_TIME_RETRANS:
+ case TCP_TIME_PROBE0:
+ tp->pending = what;
+ tp->timeout = jiffies+when;
+ if (!mod_timer(&tp->retransmit_timer, tp->timeout))
+ sock_hold(sk);
+ break;
+
+ case TCP_TIME_DACK:
+ tp->ack.pending |= TCP_ACK_TIMER;
+ tp->ack.timeout = jiffies+when;
+ if (!mod_timer(&tp->delack_timer, tp->ack.timeout))
+ sock_hold(sk);
+ break;
+
+ default:
+ printk(KERN_DEBUG "bug: unknown timer value\n");
+ };
+}
+
/* Compute the current effective MSS, taking SACKs and IP options,
* and even PMTU discovery events into account.
*/
@@ -757,9 +879,9 @@ static __inline__ unsigned int tcp_current_mss(struct sock *sk)
if (dst && dst->pmtu != tp->pmtu_cookie)
mss_now = tcp_sync_mss(sk, dst->pmtu);
- if(tp->sack_ok && tp->num_sacks)
+ if (tp->eff_sacks)
mss_now -= (TCPOLEN_SACK_BASE_ALIGNED +
- (tp->num_sacks * TCPOLEN_SACK_PERBLOCK));
+ (tp->eff_sacks * TCPOLEN_SACK_PERBLOCK));
return mss_now;
}
@@ -774,15 +896,8 @@ static __inline__ unsigned int tcp_current_mss(struct sock *sk)
extern __inline__ void tcp_initialize_rcv_mss(struct sock *sk)
{
struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
- struct dst_entry *dst = __sk_dst_get(sk);
- int mss;
- if (dst)
- mss = dst->advmss;
- else
- mss = tp->mss_cache;
-
- tp->ack.rcv_mss = max(min(mss, TCP_MIN_RCVMSS), TCP_MIN_MSS);
+ tp->ack.rcv_mss = max(min(tp->advmss, TCP_MIN_RCVMSS), TCP_MIN_MSS);
}
static __inline__ void __tcp_fast_path_on(struct tcp_opt *tp, u32 snd_wnd)
@@ -797,9 +912,6 @@ static __inline__ void tcp_fast_path_on(struct tcp_opt *tp)
__tcp_fast_path_on(tp, tp->snd_wnd>>tp->snd_wscale);
}
-
-
-
/* Compute the actual receive window we are currently advertising.
* Rcv_nxt can be after the window if our peer push more data
* than the offered window.
@@ -819,52 +931,6 @@ static __inline__ u32 tcp_receive_window(struct tcp_opt *tp)
*/
extern u32 __tcp_select_window(struct sock *sk);
-/* Chose a new window to advertise, update state in tcp_opt for the
- * socket, and return result with RFC1323 scaling applied. The return
- * value can be stuffed directly into th->window for an outgoing
- * frame.
- */
-extern __inline__ u16 tcp_select_window(struct sock *sk)
-{
- struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
- u32 cur_win = tcp_receive_window(tp);
- u32 new_win = __tcp_select_window(sk);
-
- /* Never shrink the offered window */
- if(new_win < cur_win) {
- /* Danger Will Robinson!
- * Don't update rcv_wup/rcv_wnd here or else
- * we will not be able to advertise a zero
- * window in time. --DaveM
- *
- * Relax Will Robinson.
- */
- new_win = cur_win;
- }
- tp->rcv_wnd = new_win;
- tp->rcv_wup = tp->rcv_nxt;
-
- /* RFC1323 scaling applied */
- new_win >>= tp->rcv_wscale;
-
-#ifdef TCP_FORMAL_WINDOW
- if (new_win == 0) {
- /* If we advertise zero window, disable fast path. */
- tp->pred_flags = 0;
- } else if (cur_win == 0 && tp->pred_flags == 0 &&
- skb_queue_len(&tp->out_of_order_queue) == 0 &&
- !tp->urg_data) {
- /* If we open zero window, enable fast path.
- Without this it will be open by the first data packet,
- it is too late to merge checksumming to copy.
- */
- tcp_fast_path_on(tp);
- }
-#endif
-
- return new_win;
-}
-
/* TCP timestamps are only 32-bits, this causes a slight
* complication on 64-bit systems since we store a snapshot
* of jiffies in the buffer control blocks below. We decidely
@@ -907,6 +973,12 @@ struct tcp_skb_cb {
__u8 sacked; /* State flags for SACK/FACK. */
#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */
#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
+#define TCPCB_LOST 0x04 /* SKB is lost */
+#define TCPCB_TAGBITS 0x07 /* All tag bits */
+
+#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
+#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)
+
__u16 urg_ptr; /* Valid w/URG flags is set. */
__u32 ack_seq; /* Sequence number ACK'd */
@@ -914,11 +986,28 @@ struct tcp_skb_cb {
#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0]))
+#define for_retrans_queue(skb, sk, tp) \
+ for (skb = (sk)->write_queue.next; \
+ (skb != (tp)->send_head) && \
+ (skb != (struct sk_buff *)&(sk)->write_queue); \
+ skb=skb->next)
+
+
+#include <net/tcp_ecn.h>
+
+
/*
* Compute minimal free write space needed to queue new packets.
*/
-#define tcp_min_write_space(__sk) \
- (atomic_read(&(__sk)->wmem_alloc) / 2)
+static inline int tcp_min_write_space(struct sock *sk)
+{
+ return sk->wmem_queued/2;
+}
+
+static inline int tcp_wspace(struct sock *sk)
+{
+ return sk->sndbuf - sk->wmem_queued;
+}
/* This determines how many packets are "in the network" to the best
@@ -932,89 +1021,97 @@ struct tcp_skb_cb {
* Read this equation as:
*
* "Packets sent once on transmission queue" MINUS
- * "Packets acknowledged by FACK information" PLUS
+ * "Packets left network, but not honestly ACKed yet" PLUS
* "Packets fast retransmitted"
*/
static __inline__ int tcp_packets_in_flight(struct tcp_opt *tp)
{
- return tp->packets_out - tp->fackets_out + tp->retrans_out;
+ return tp->packets_out - tp->left_out + tp->retrans_out;
}
/* Recalculate snd_ssthresh, we want to set it to:
*
* one half the current congestion window, but no
* less than two segments
- *
- * We must take into account the current send window
- * as well, however we keep track of that using different
- * units so a conversion is necessary. -DaveM
- *
- * RED-PEN.
- * RFC 2581: "an easy mistake to make is to simply use cwnd,
- * rather than FlightSize"
- * I see no references to FlightSize here. snd_wnd is not FlightSize,
- * it is also apriory characteristics.
- *
- * FlightSize = min((snd_nxt-snd_una)/mss, packets_out) ?
*/
extern __inline__ __u32 tcp_recalc_ssthresh(struct tcp_opt *tp)
{
- u32 FlightSize = (tp->snd_nxt - tp->snd_una)/tp->mss_cache;
+ return max(tp->snd_cwnd>>1, 2);
+}
+
+/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
+ * The exception is rate halving phase, when cwnd is decreasing towards
+ * ssthresh.
+ */
+extern __inline__ __u32 tcp_current_ssthresh(struct tcp_opt *tp)
+{
+ if ((1<<tp->ca_state)&(TCPF_CA_CWR|TCPF_CA_Recovery))
+ return tp->snd_ssthresh;
+ else
+ return max(tp->snd_ssthresh, (tp->snd_cwnd>>1)+(tp->snd_cwnd>>2));
+}
+
+extern void tcp_cwnd_application_limited(struct sock *sk);
- FlightSize = min(FlightSize, tcp_packets_in_flight(tp));
+/* Congestion window validation. (RFC2861) */
- return max(min(FlightSize, tp->snd_cwnd) >> 1, 2);
+static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_opt *tp)
+{
+ if (tp->packets_out >= tp->snd_cwnd) {
+ /* Network is feed fully. */
+ tp->snd_cwnd_used = 0;
+ tp->snd_cwnd_stamp = tcp_time_stamp;
+ } else {
+ /* Network starves. */
+ if (tp->packets_out > tp->snd_cwnd_used)
+ tp->snd_cwnd_used = tp->packets_out;
+
+ if ((s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= tp->rto)
+ tcp_cwnd_application_limited(sk);
+ }
}
/* Set slow start threshould and cwnd not falling to slow start */
-extern __inline__ void __tcp_enter_cong_avoid(struct tcp_opt *tp)
+extern __inline__ void __tcp_enter_cwr(struct tcp_opt *tp)
{
+ tp->undo_marker = 0;
tp->snd_ssthresh = tcp_recalc_ssthresh(tp);
- if (tp->snd_ssthresh > tp->snd_cwnd_clamp)
- tp->snd_ssthresh = tp->snd_cwnd_clamp;
- tp->snd_cwnd = tp->snd_ssthresh;
+ tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
tp->snd_cwnd_cnt = 0;
tp->high_seq = tp->snd_nxt;
+ tp->snd_cwnd_stamp = tcp_time_stamp;
+ TCP_ECN_queue_cwr(tp);
}
-extern __inline__ void tcp_enter_cong_avoid(struct tcp_opt *tp)
+extern __inline__ void tcp_enter_cwr(struct tcp_opt *tp)
{
- if (!tp->high_seq || after(tp->snd_nxt, tp->high_seq))
- __tcp_enter_cong_avoid(tp);
+ tp->prior_ssthresh = 0;
+ if (tp->ca_state < TCP_CA_CWR) {
+ __tcp_enter_cwr(tp);
+ tp->ca_state = TCP_CA_CWR;
+ }
}
+extern __u32 tcp_init_cwnd(struct tcp_opt *tp);
-/* Increase initial CWND conservatively, i.e. only if estimated
- RTT is low enough. It is not quite correct, we should use
- POWER i.e. RTT*BANDWIDTH, but we still cannot estimate this.
-
- Numbers are taken from RFC1414.
+/* Slow start with delack produces 3 packets of burst, so that
+ * it is safe "de facto".
*/
-static __inline__ __u32 tcp_init_cwnd(struct tcp_opt *tp)
+static __inline__ __u32 tcp_max_burst(struct tcp_opt *tp)
{
- __u32 cwnd;
-
- if (!tp->srtt || tp->srtt > ((HZ/50)<<3) || tp->mss_cache > 1460)
- cwnd = 2;
- else if (tp->mss_cache > 1095)
- cwnd = 3;
- else
- cwnd = 4;
-
- return min(cwnd, tp->snd_cwnd_clamp);
+ return 3;
}
-
static __inline__ int tcp_minshall_check(struct tcp_opt *tp)
{
return after(tp->snd_sml,tp->snd_una) &&
!after(tp->snd_sml, tp->snd_nxt);
}
-static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss, int len)
+static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss, struct sk_buff *skb)
{
- if (len < mss)
- tp->snd_sml = tp->snd_nxt;
+ if (skb->len < mss)
+ tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
}
/* Return 0, if packet can be sent now without violation Nagle's rules:
@@ -1041,17 +1138,6 @@ static __inline__ int tcp_nagle_check(struct tcp_opt *tp, struct sk_buff *skb, u
static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb,
unsigned cur_mss, int tail)
{
- /*
- * Reset CWND after idle period longer RTO to "restart window".
- * It is "side" effect of the function, which is _not_ good
- * from viewpoint of clarity. But we have to make it before
- * checking congestion window below. Alternative is to prepend
- * all the calls with this test.
- */
- if (tp->packets_out==0 &&
- (s32)(tcp_time_stamp - tp->lsndtime) > tp->rto)
- tp->snd_cwnd = min(tp->snd_cwnd, tcp_init_cwnd(tp));
-
/* RFC 1122 - section 4.2.3.4
*
* We must queue if
@@ -1062,8 +1148,7 @@ static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb,
* (part of SWS is done on packetization)
* Minshall version sounds: there are no _small_
* segments in flight. (tcp_nagle_check)
- * c) We are retransmiting [Nagle]
- * d) We have too many packets 'in flight'
+ * c) We have too many packets 'in flight'
*
* Don't use the nagle rule for urgent data (or
* for the final FIN -DaveM).
@@ -1081,13 +1166,12 @@ static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb,
skb_tailroom(skb) < 32) &&
((tcp_packets_in_flight(tp) < tp->snd_cwnd) ||
(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) &&
- !after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd) &&
- tp->retransmits == 0);
+ !after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd));
}
static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_opt *tp)
{
- if (!tp->packets_out && !timer_pending(&tp->probe_timer))
+ if (!tp->packets_out && !tp->pending)
tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0, tp->rto);
}
@@ -1111,6 +1195,7 @@ static __inline__ void __tcp_push_pending_frames(struct sock *sk,
tcp_write_xmit(sk))
tcp_check_probe_timer(sk, tp);
}
+ tcp_cwnd_validate(sk, tp);
}
static __inline__ void tcp_push_pending_frames(struct sock *sk,
@@ -1119,6 +1204,24 @@ static __inline__ void tcp_push_pending_frames(struct sock *sk,
__tcp_push_pending_frames(sk, tp, tcp_current_mss(sk));
}
+static __inline__ int tcp_may_send_now(struct sock *sk, struct tcp_opt *tp)
+{
+ struct sk_buff *skb = tp->send_head;
+
+ return (skb &&
+ tcp_snd_test(tp, skb, tcp_current_mss(sk), tcp_skb_is_last(sk, skb)));
+}
+
+static __inline__ void tcp_init_wl(struct tcp_opt *tp, u32 ack, u32 seq)
+{
+ tp->snd_wl1 = seq;
+}
+
+static __inline__ void tcp_update_wl(struct tcp_opt *tp, u32 ack, u32 seq)
+{
+ tp->snd_wl1 = seq;
+}
+
extern void tcp_destroy_sock(struct sock *sk);
@@ -1143,7 +1246,6 @@ static __inline__ int tcp_checksum_complete(struct sk_buff *skb)
__tcp_checksum_complete(skb);
}
-
/* Prequeue for VJ style copy to user, combined with checksumming. */
static __inline__ void tcp_prequeue_init(struct tcp_opt *tp)
@@ -1167,12 +1269,15 @@ static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
if (tp->ucopy.task) {
if ((tp->ucopy.memory += skb->truesize) <= (sk->rcvbuf<<1)) {
__skb_queue_tail(&tp->ucopy.prequeue, skb);
- if (skb_queue_len(&tp->ucopy.prequeue) == 1)
+ if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
wake_up_interruptible(sk->sleep);
+ if (!tcp_ack_scheduled(tp))
+ tcp_reset_xmit_timer(sk, TCP_TIME_DACK, (3*TCP_RTO_MIN)/4);
+ }
} else {
NET_INC_STATS_BH(TCPPrequeueDropped);
tp->ucopy.memory -= skb->truesize;
- kfree_skb(skb);
+ __kfree_skb(skb);
}
return 1;
}
@@ -1231,6 +1336,13 @@ static __inline__ void tcp_done(struct sock *sk)
tcp_destroy_sock(sk);
}
+static __inline__ void tcp_sack_reset(struct tcp_opt *tp)
+{
+ tp->dsack = 0;
+ tp->eff_sacks = 0;
+ tp->num_sacks = 0;
+}
+
static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_opt *tp, __u32 tstamp)
{
if (tp->tstamp_ok) {
@@ -1241,17 +1353,22 @@ static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_opt *
*ptr++ = htonl(tstamp);
*ptr++ = htonl(tp->ts_recent);
}
- if(tp->sack_ok && tp->num_sacks) {
+ if (tp->eff_sacks) {
+ struct tcp_sack_block *sp = tp->dsack ? tp->duplicate_sack : tp->selective_acks;
int this_sack;
*ptr++ = __constant_htonl((TCPOPT_NOP << 24) |
(TCPOPT_NOP << 16) |
(TCPOPT_SACK << 8) |
(TCPOLEN_SACK_BASE +
- (tp->num_sacks * TCPOLEN_SACK_PERBLOCK)));
- for(this_sack = 0; this_sack < tp->num_sacks; this_sack++) {
- *ptr++ = htonl(tp->selective_acks[this_sack].start_seq);
- *ptr++ = htonl(tp->selective_acks[this_sack].end_seq);
+ (tp->eff_sacks * TCPOLEN_SACK_PERBLOCK)));
+ for(this_sack = 0; this_sack < tp->eff_sacks; this_sack++) {
+ *ptr++ = htonl(sp[this_sack].start_seq);
+ *ptr++ = htonl(sp[this_sack].end_seq);
+ }
+ if (tp->dsack) {
+ tp->dsack = 0;
+ tp->eff_sacks--;
}
}
}
@@ -1330,42 +1447,44 @@ extern __inline__ void tcp_select_initial_window(int space, __u32 mss,
space >>= 1;
(*rcv_wscale)++;
}
+ if (*rcv_wscale && sysctl_tcp_app_win && space>=mss &&
+ space - max((space>>sysctl_tcp_app_win), mss>>*rcv_wscale) < 65536/2)
+ (*rcv_wscale)--;
+ }
+
+ /* Set initial window to value enough for senders,
+ * following RFC1414. Senders, not following this RFC,
+ * will be satisfied with 2.
+ */
+ if (mss > (1<<*rcv_wscale)) {
+ int init_cwnd = 4;
+ if (mss > 1460*3)
+ init_cwnd = 2;
+ else if (mss > 1460)
+ init_cwnd = 3;
+ if (*rcv_wnd > init_cwnd*mss)
+ *rcv_wnd = init_cwnd*mss;
}
/* Set the clamp no higher than max representable value */
(*window_clamp) = min(65535<<(*rcv_wscale),*window_clamp);
}
+static inline int tcp_win_from_space(int space)
+{
+ return sysctl_tcp_adv_win_scale<=0 ?
+ (space>>(-sysctl_tcp_adv_win_scale)) :
+ space - (space>>sysctl_tcp_adv_win_scale);
+}
+
/* Note: caller must be prepared to deal with negative returns */
extern __inline__ int tcp_space(struct sock *sk)
{
- return (sk->rcvbuf - atomic_read(&sk->rmem_alloc)) /
- TCP_WINDOW_ADVERTISE_DIVISOR;
+ return tcp_win_from_space(sk->rcvbuf - atomic_read(&sk->rmem_alloc));
}
extern __inline__ int tcp_full_space( struct sock *sk)
{
- return sk->rcvbuf / TCP_WINDOW_ADVERTISE_DIVISOR;
-}
-
-extern __inline__ void tcp_init_buffer_space(struct sock *sk)
-{
- struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
- int rcvbuf = tp->advmss+MAX_TCP_HEADER+16+sizeof(struct sk_buff);
- int sndbuf = tp->mss_clamp+MAX_TCP_HEADER+16+sizeof(struct sk_buff);
-
- 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);
+ return tcp_win_from_space(sk->rcvbuf);
}
extern __inline__ void tcp_acceptq_removed(struct sock *sk)
@@ -1473,61 +1592,85 @@ static __inline__ void tcp_openreq_init(struct open_request *req,
req->snd_wscale = tp->snd_wscale;
req->wscale_ok = tp->wscale_ok;
req->acked = 0;
+ req->ecn_ok = 0;
req->rmt_port = skb->h.th->source;
}
-extern const char timer_bug_msg[];
+#define TCP_MEM_QUANTUM ((int)PAGE_SIZE)
-static inline void tcp_clear_xmit_timer(struct sock *sk, int what)
+static inline void tcp_free_skb(struct sock *sk, struct sk_buff *skb)
{
- struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
- struct timer_list *timer;
-
- switch (what) {
- case TCP_TIME_RETRANS:
- timer = &tp->retransmit_timer;
- break;
- case TCP_TIME_DACK:
- tp->ack.blocked = 0;
- timer = &tp->delack_timer;
- break;
- case TCP_TIME_PROBE0:
- timer = &tp->probe_timer;
- break;
- default:
- printk(timer_bug_msg);
- return;
- };
+ sk->tp_pinfo.af_tcp.queue_shrunk = 1;
+ sk->wmem_queued -= skb->truesize;
+ sk->forward_alloc += skb->truesize;
+ __kfree_skb(skb);
+}
- if (timer_pending(timer) && del_timer(timer))
- __sock_put(sk);
+static inline void tcp_charge_skb(struct sock *sk, struct sk_buff *skb)
+{
+ sk->wmem_queued += skb->truesize;
+ sk->forward_alloc -= skb->truesize;
}
-/* This function does not return reliable answer. Use it only as advice.
- */
+extern void __tcp_mem_reclaim(struct sock *sk);
+extern int tcp_mem_schedule(struct sock *sk, int size, int kind);
-static inline int tcp_timer_is_set(struct sock *sk, int what)
+static inline void tcp_mem_reclaim(struct sock *sk)
{
- struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
- int ret;
+ if (sk->forward_alloc >= TCP_MEM_QUANTUM)
+ __tcp_mem_reclaim(sk);
+}
- switch (what) {
- case TCP_TIME_RETRANS:
- ret = timer_pending(&tp->retransmit_timer);
- break;
- case TCP_TIME_DACK:
- ret = timer_pending(&tp->delack_timer);
- break;
- case TCP_TIME_PROBE0:
- ret = timer_pending(&tp->probe_timer);
- break;
- default:
- ret = 0;
- printk(timer_bug_msg);
- };
- return ret;
+static inline void tcp_enter_memory_pressure(void)
+{
+ if (!tcp_memory_pressure) {
+ NET_INC_STATS(TCPMemoryPressures);
+ tcp_memory_pressure = 1;
+ }
}
+static inline void tcp_moderate_sndbuf(struct sock *sk)
+{
+ if (!(sk->userlocks&SOCK_SNDBUF_LOCK)) {
+ sk->sndbuf = min(sk->sndbuf, sk->wmem_queued/2);
+ sk->sndbuf = max(sk->sndbuf, SOCK_MIN_SNDBUF);
+ }
+}
+
+static inline struct sk_buff *tcp_alloc_skb(struct sock *sk, int size, int gfp)
+{
+ struct sk_buff *skb = alloc_skb(size, gfp);
+
+ if (skb) {
+ if (sk->forward_alloc >= (int)skb->truesize ||
+ tcp_mem_schedule(sk, skb->truesize, 0))
+ return skb;
+ __kfree_skb(skb);
+ } else {
+ tcp_enter_memory_pressure();
+ tcp_moderate_sndbuf(sk);
+ }
+ return NULL;
+}
+
+static inline void tcp_writequeue_purge(struct sock *sk)
+{
+ struct sk_buff *skb;
+
+ while ((skb = __skb_dequeue(&sk->write_queue)) != NULL)
+ tcp_free_skb(sk, skb);
+ tcp_mem_reclaim(sk);
+}
+
+extern void tcp_rfree(struct sk_buff *skb);
+
+static inline void tcp_set_owner_r(struct sk_buff *skb, struct sock *sk)
+{
+ skb->sk = sk;
+ skb->destructor = tcp_rfree;
+ atomic_add(skb->truesize, &sk->rmem_alloc);
+ sk->forward_alloc -= skb->truesize;
+}
extern void tcp_listen_wlock(void);
@@ -1570,28 +1713,30 @@ static inline int tcp_fin_time(struct tcp_opt *tp)
return fin_timeout;
}
-#if 0 /* TCP_DEBUG */
-#define TCP_CHECK_TIMER(sk) \
-do { struct tcp_opt *__tp = &sk->tp_pinfo.af_tcp; \
- if (sk->state != TCP_CLOSE) { \
- if (__tp->packets_out) { \
- if (!tcp_timer_is_set(sk, TCP_TIME_RETRANS) && !timer_is_running(&__tp->retransmit_timer) && net_ratelimit()) \
- printk(KERN_DEBUG "sk=%p RETRANS" __FUNCTION__ "(%d) %d\n", sk, __LINE__, sk->state); \
- } else if (__tp->send_head) { \
- if (!tcp_timer_is_set(sk, TCP_TIME_PROBE0) && !timer_is_running(&__tp->probe_timer) && net_ratelimit()) \
- printk(KERN_DEBUG "sk=%p PROBE0" __FUNCTION__ "(%d) %d\n", sk, __LINE__, sk->state); \
- } \
- if (__tp->ack.pending) { \
- if (!tcp_timer_is_set(sk, TCP_TIME_DACK) && !timer_is_running(&__tp->delack_timer) && net_ratelimit()) \
- printk(KERN_DEBUG "sk=%p DACK" __FUNCTION__ "(%d) %d\n", sk, __LINE__, sk->state); \
- } \
- if (__tp->packets_out > skb_queue_len(&sk->write_queue) || \
- (__tp->send_head && skb_queue_len(&sk->write_queue) == 0)) { \
- printk(KERN_DEBUG "sk=%p QUEUE" __FUNCTION__ "(%d) %d %d %d %p\n", sk, __LINE__, sk->state, __tp->packets_out, skb_queue_len(&sk->write_queue), __tp->send_head); \
- } \
- } } while (0)
-#else
+static inline int tcp_paws_check(struct tcp_opt *tp, int rst)
+{
+ if ((s32)(tp->rcv_tsval - tp->ts_recent) >= 0)
+ return 0;
+ if (xtime.tv_sec >= tp->ts_recent_stamp + TCP_PAWS_24DAYS)
+ return 0;
+
+ /* RST segments are not recommended to carry timestamp,
+ and, if they do, it is recommended to ignore PAWS because
+ "their cleanup function should take precedence over timestamps."
+ Certainly, it is mistake. It is necessary to understand the reasons
+ of this constraint to relax it: if peer reboots, clock may go
+ out-of-sync and half-open connections will not be reset.
+ Actually, the problem would be not existing if all
+ the implementations followed draft about maintaining clock
+ via reboots. Linux-2.2 DOES NOT!
+
+ However, we can relax time bounds for RST segments to MSL.
+ */
+ if (rst && xtime.tv_sec >= tp->ts_recent_stamp + TCP_PAWS_MSL)
+ return 0;
+ return 1;
+}
+
#define TCP_CHECK_TIMER(sk) do { } while (0);
-#endif
#endif /* _TCP_H */
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
new file mode 100644
index 000000000..db004249f
--- /dev/null
+++ b/include/net/tcp_ecn.h
@@ -0,0 +1,155 @@
+#ifndef _NET_TCP_ECN_H_
+#define _NET_TCP_ECN_H_ 1
+
+#include <linux/config.h>
+
+#ifdef CONFIG_INET_ECN
+
+#include <net/inet_ecn.h>
+
+#define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH)|TCP_FLAG_ECE|TCP_FLAG_CWR)
+
+#define TCP_ECN_OK 1
+#define TCP_ECN_QUEUE_CWR 2
+#define TCP_ECN_DEMAND_CWR 4
+
+static __inline__ void
+TCP_ECN_queue_cwr(struct tcp_opt *tp)
+{
+ if (tp->ecn_flags&TCP_ECN_OK)
+ tp->ecn_flags |= TCP_ECN_QUEUE_CWR;
+}
+
+
+/* Output functions */
+
+static __inline__ void
+TCP_ECN_send_synack(struct tcp_opt *tp, struct sk_buff *skb)
+{
+ TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_CWR;
+ if (!(tp->ecn_flags&TCP_ECN_OK))
+ TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE;
+}
+
+static __inline__ void
+TCP_ECN_send_syn(struct tcp_opt *tp, struct sk_buff *skb)
+{
+ tp->ecn_flags = 0;
+ if (sysctl_tcp_ecn) {
+ TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR;
+ tp->ecn_flags = TCP_ECN_OK;
+ }
+}
+
+static __inline__ void
+TCP_ECN_make_synack(struct open_request *req, struct tcphdr *th)
+{
+ if (req->ecn_ok)
+ th->ece = 1;
+}
+
+static __inline__ void
+TCP_ECN_send(struct sock *sk, struct tcp_opt *tp, struct sk_buff *skb, int tcp_header_len)
+{
+ if (tp->ecn_flags & TCP_ECN_OK) {
+ /* Not-retransmitted data segment: set ECT and inject CWR. */
+ if (skb->len != tcp_header_len &&
+ !before(TCP_SKB_CB(skb)->seq, tp->snd_nxt)) {
+ INET_ECN_xmit(sk);
+ if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) {
+ tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR;
+ skb->h.th->cwr = 1;
+ }
+ } else {
+ /* ACK or retransmitted segment: clear ECT|CE */
+ INET_ECN_dontxmit(sk);
+ }
+ if (tp->ecn_flags & TCP_ECN_DEMAND_CWR)
+ skb->h.th->ece = 1;
+ }
+}
+
+/* Input functions */
+
+static __inline__ void
+TCP_ECN_accept_cwr(struct tcp_opt *tp, struct sk_buff *skb)
+{
+ if (skb->h.th->cwr)
+ tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR;
+}
+
+static __inline__ void
+TCP_ECN_check_ce(struct tcp_opt *tp, struct sk_buff *skb)
+{
+ if (tp->ecn_flags&TCP_ECN_OK) {
+ if (INET_ECN_is_ce(TCP_SKB_CB(skb)->flags))
+ tp->ecn_flags |= TCP_ECN_DEMAND_CWR;
+ /* Funny extension: if ECT is not set on a segment,
+ * it is surely retransmit. It is not in ECN RFC,
+ * but Linux follows this rule. */
+ else if (!INET_ECN_is_capable((TCP_SKB_CB(skb)->flags)))
+ tcp_enter_quickack_mode(tp);
+ }
+}
+
+static __inline__ void
+TCP_ECN_rcv_synack(struct tcp_opt *tp, struct tcphdr *th)
+{
+ if ((tp->ecn_flags&TCP_ECN_OK) && (!th->ece || th->cwr))
+ tp->ecn_flags &= ~TCP_ECN_OK;
+}
+
+static __inline__ void
+TCP_ECN_rcv_syn(struct tcp_opt *tp, struct tcphdr *th)
+{
+ if ((tp->ecn_flags&TCP_ECN_OK) && (!th->ece || !th->cwr))
+ tp->ecn_flags &= ~TCP_ECN_OK;
+}
+
+static __inline__ int
+TCP_ECN_rcv_ecn_echo(struct tcp_opt *tp, struct tcphdr *th)
+{
+ if (th->ece && !th->syn && (tp->ecn_flags&TCP_ECN_OK))
+ return 1;
+ return 0;
+}
+
+static __inline__ void
+TCP_ECN_openreq_child(struct tcp_opt *tp, struct open_request *req)
+{
+ tp->ecn_flags = req->ecn_ok ? TCP_ECN_OK : 0;
+}
+
+static __inline__ void
+TCP_ECN_create_request(struct open_request *req, struct tcphdr *th)
+{
+ if (sysctl_tcp_ecn && th->ece && th->cwr)
+ req->ecn_ok = 1;
+}
+
+
+
+#else
+
+#define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH))
+
+
+#define TCP_ECN_send_syn(x...) do { } while (0)
+#define TCP_ECN_send_synack(x...) do { } while (0)
+#define TCP_ECN_make_synack(x...) do { } while (0)
+#define TCP_ECN_send(x...) do { } while (0)
+
+#define TCP_ECN_queue_cwr(x...) do { } while (0)
+
+#define TCP_ECN_accept_cwr(x...) do { } while (0)
+#define TCP_ECN_check_ce(x...) do { } while (0)
+#define TCP_ECN_rcv_synack(x...) do { } while (0)
+#define TCP_ECN_rcv_syn(x...) do { } while (0)
+#define TCP_ECN_rcv_ecn_echo(x...) (0)
+#define TCP_ECN_openreq_child(x...) do { } while (0)
+#define TCP_ECN_create_request(x...) do { } while (0)
+
+
+#endif
+
+#endif