## Automatically generated incremental diff
## From:   linux-2.4.22-bk51
## To:     linux-2.4.22-bk52
## Robot:  $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $

diff -urN linux-2.4.22-bk51/Makefile linux-2.4.22-bk52/Makefile
--- linux-2.4.22-bk51/Makefile	2003-11-12 02:51:00.000000000 -0800
+++ linux-2.4.22-bk52/Makefile	2003-11-12 02:51:08.000000000 -0800
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 22
-EXTRAVERSION = -bk51
+EXTRAVERSION = -bk52
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
diff -urN linux-2.4.22-bk51/arch/x86_64/defconfig linux-2.4.22-bk52/arch/x86_64/defconfig
--- linux-2.4.22-bk51/arch/x86_64/defconfig	2003-11-12 02:51:02.000000000 -0800
+++ linux-2.4.22-bk52/arch/x86_64/defconfig	2003-11-12 02:51:09.000000000 -0800
@@ -5,7 +5,7 @@
 CONFIG_X86=y
 # CONFIG_ISA is not set
 # CONFIG_SBUS is not set
-CONFIG_UID16=y
+# CONFIG_UID16 is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 CONFIG_X86_CMPXCHG=y
@@ -73,7 +73,6 @@
 # ACPI Support
 #
 CONFIG_ACPI=y
-# CONFIG_ACPI_HT_ONLY is not set
 CONFIG_ACPI_BOOT=y
 CONFIG_ACPI_BUS=y
 CONFIG_ACPI_INTERPRETER=y
@@ -154,6 +153,12 @@
 # CONFIG_SYN_COOKIES is not set
 # CONFIG_IPV6 is not set
 # CONFIG_KHTTPD is not set
+
+#
+#    SCTP Configuration (EXPERIMENTAL)
+#
+CONFIG_IPV6_SCTP__=y
+# CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
 # CONFIG_VLAN_8021Q is not set
 
@@ -319,6 +324,7 @@
 # CONFIG_SCSI_IN2000 is not set
 # CONFIG_SCSI_AM53C974 is not set
 # CONFIG_SCSI_MEGARAID is not set
+# CONFIG_SCSI_MEGARAID2 is not set
 # CONFIG_SCSI_BUSLOGIC is not set
 # CONFIG_SCSI_CPQFCTS is not set
 # CONFIG_SCSI_DMX3191D is not set
@@ -603,9 +609,6 @@
 # CONFIG_NTFS_RW is not set
 # CONFIG_HPFS_FS is not set
 CONFIG_PROC_FS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
 CONFIG_DEVPTS_FS=y
 # CONFIG_QNX4FS_FS is not set
 # CONFIG_QNX4FS_RW is not set
@@ -718,6 +721,11 @@
 # CONFIG_USB is not set
 
 #
+# Support for USB gadgets
+#
+# CONFIG_USB_GADGET is not set
+
+#
 # Bluetooth support
 #
 # CONFIG_BLUEZ is not set
diff -urN linux-2.4.22-bk51/arch/x86_64/ia32/sys_ia32.c linux-2.4.22-bk52/arch/x86_64/ia32/sys_ia32.c
--- linux-2.4.22-bk51/arch/x86_64/ia32/sys_ia32.c	2003-11-12 02:51:02.000000000 -0800
+++ linux-2.4.22-bk52/arch/x86_64/ia32/sys_ia32.c	2003-11-12 02:51:09.000000000 -0800
@@ -16,7 +16,7 @@
  *
  * This file assumes that there is a hole at the end of user address space.
  *
- * $Id: sys_ia32.c,v 1.65 2003/10/11 15:16:35 ak Exp $
+ * $Id: sys_ia32.c,v 1.66 2003/11/10 13:09:54 ak Exp $
  */
 
 #include <linux/config.h>
@@ -118,13 +118,18 @@
 asmlinkage long
 sys32_newstat(char * filename, struct stat32 *statbuf)
 {
+	char *name;
 	int ret;
 	struct stat s;
 	mm_segment_t old_fs = get_fs();
 	
+	name = getname(filename);
+	if (IS_ERR(name))
+		return PTR_ERR(name);
 	set_fs (KERNEL_DS);
-	ret = sys_newstat(filename, &s);
+	ret = sys_newstat(name, &s);
 	set_fs (old_fs);
+	putname(name);
 	if (ret)
 	return ret;
 	return putstat(statbuf, &s);
@@ -135,13 +140,18 @@
 asmlinkage long
 sys32_newlstat(char * filename, struct stat32 *statbuf)
 {
+	char *name;
 	int ret;
 	struct stat s;
 	mm_segment_t old_fs = get_fs();
 	
+	name = getname(filename);
+	if (IS_ERR(name))
+		return PTR_ERR(name);
 	set_fs (KERNEL_DS);
-	ret = sys_newlstat(filename, &s);
+	ret = sys_newlstat(name, &s);
 	set_fs (old_fs);
+	putname(name);
 	if (ret) 
 	return ret;
 	return putstat(statbuf, &s);
@@ -192,13 +202,18 @@
 asmlinkage long
 sys32_stat64(char * filename, struct stat64 *statbuf)
 {
+	char *name;
 	int ret;
 	struct stat s;
 	mm_segment_t old_fs = get_fs();
 	
+	name = getname(filename);
+	if (IS_ERR(name))
+		return PTR_ERR(name);	
 	set_fs (KERNEL_DS);
-	ret = sys_newstat(filename, &s);
+	ret = sys_newstat(name, &s);
 	set_fs (old_fs);
+	putname(name);
 	if (ret)
 	return ret;
 	return putstat64(statbuf, &s);
@@ -207,13 +222,18 @@
 asmlinkage long
 sys32_lstat64(char * filename, struct stat64 *statbuf)
 {
+	char *name;
 	int ret;
 	struct stat s;
 	mm_segment_t old_fs = get_fs();
 	
+	name = getname(filename);
+	if (IS_ERR(name))
+		return PTR_ERR(name);
 	set_fs (KERNEL_DS);
-	ret = sys_newlstat(filename, &s);
+	ret = sys_newlstat(name, &s);
 	set_fs (old_fs);
+	putname(name); 
 	if (ret)
 	return ret;
 	return putstat64(statbuf, &s);
@@ -501,10 +521,15 @@
 	int ret;
 	struct statfs s;
 	mm_segment_t old_fs = get_fs();
+	const char *name;
 	
+	name = getname(path);
+	if (IS_ERR(name))
+		return PTR_ERR(name);
 	set_fs (KERNEL_DS);
-	ret = sys_statfs((const char *)path, &s);
+	ret = sys_statfs(name, &s);
 	set_fs (old_fs);
+	putname(name);
 	if (put_statfs(buf, &s))
 		return -EFAULT;
 	return ret;
@@ -2997,7 +3022,7 @@
 
 static int __init ia32_init (void)
 {
-	printk("IA32 emulation $Id: sys_ia32.c,v 1.65 2003/10/11 15:16:35 ak Exp $\n");  
+	printk("IA32 emulation $Id: sys_ia32.c,v 1.66 2003/11/10 13:09:54 ak Exp $\n");  
 	ia32_exec_domain.signal_map = default_exec_domain.signal_map;
 	ia32_exec_domain.signal_invmap = default_exec_domain.signal_invmap;
 	register_exec_domain(&ia32_exec_domain);
diff -urN linux-2.4.22-bk51/arch/x86_64/kernel/head.S linux-2.4.22-bk52/arch/x86_64/kernel/head.S
--- linux-2.4.22-bk51/arch/x86_64/kernel/head.S	2003-11-12 02:51:02.000000000 -0800
+++ linux-2.4.22-bk52/arch/x86_64/kernel/head.S	2003-11-12 02:51:09.000000000 -0800
@@ -6,7 +6,7 @@
  *  Copyright (C) 2000 Karsten Keil <kkeil@suse.de>
  *  Copyright (C) 2001,2002 Andi Kleen <ak@suse.de>
  *
- *  $Id: head.S,v 1.57 2003/07/11 15:58:46 ak Exp $
+ *  $Id: head.S,v 1.58 2003/11/02 05:05:31 ak Exp $
  */
 
 
@@ -39,6 +39,9 @@
 
 	movl %ebx,%ebp	/* Save trampoline flag */
 	
+	movl $__KERNEL_DS,%eax
+	movl %eax,%ds
+	
 	/* First check if extended functions are implemented */
 	movl	$0x80000000, %eax
 	cpuid
@@ -119,25 +122,11 @@
 	movl	$0x100F00, %eax
 	lgdt	(%eax)
 
+second:		
 	movl    $0x100F10, %eax
 	/* Finally jump in 64bit mode */
 	ljmp	*(%eax)
 
-second:
-	/* abuse syscall to get into 64bit mode. this way we don't need
-	   a working low identity mapping just for the short 32bit roundtrip. 
-	   XXX kludge. this should not be needed. */
-	movl  $MSR_STAR,%ecx
-	xorl  %eax,%eax
-	movl  $(__USER32_CS<<16)|__KERNEL_CS,%edx
-	wrmsr
-
-	movl  $MSR_CSTAR,%ecx
-	movl  $0xffffffff,%edx
-	movl  $0x80100100,%eax	# reach_long64 absolute
-	wrmsr
-	syscall
-
 	.code64
 	.org 0x100	
 reach_long64:
diff -urN linux-2.4.22-bk51/arch/x86_64/mm/fault.c linux-2.4.22-bk52/arch/x86_64/mm/fault.c
--- linux-2.4.22-bk51/arch/x86_64/mm/fault.c	2003-11-12 02:51:02.000000000 -0800
+++ linux-2.4.22-bk52/arch/x86_64/mm/fault.c	2003-11-12 02:51:09.000000000 -0800
@@ -237,6 +237,14 @@
 	if (in_interrupt() || !mm)
 		goto bad_area_nosemaphore;
 
+	/* 
+	 * Work around K8 errata #100. See the K8 specification update for 
+	 * details. Any code segment in LDT is compatibility mode.
+	 */
+	if ((regs->cs == __USER32_CS || (regs->cs & (1<<2))) &&
+		(address >> 32))
+		return;
+
 again:
 	down_read(&mm->mmap_sem);
 
diff -urN linux-2.4.22-bk51/drivers/char/agp/agpgart_be.c linux-2.4.22-bk52/drivers/char/agp/agpgart_be.c
--- linux-2.4.22-bk51/drivers/char/agp/agpgart_be.c	2003-11-12 02:51:02.000000000 -0800
+++ linux-2.4.22-bk52/drivers/char/agp/agpgart_be.c	2003-11-12 02:51:10.000000000 -0800
@@ -49,7 +49,9 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/page.h>
+#ifdef CONFIG_X86
 #include <asm/msr.h>
+#endif
 
 #include <linux/agp_backend.h>
 #include "agp.h"
@@ -3839,8 +3841,6 @@
 		 return -ENODEV;
 	apbase = (apbase & 0x7fff) << 25;
 
-	/* AK: most likely the shadow into the primary device is not needed */
-
 	pci_read_config_dword(agp_bridge.dev, NVIDIA_X86_64_0_APBASE, &apbar);
 	apbar &= ~PCI_BASE_ADDRESS_MEM_MASK;
 	apbar |= apbase;
@@ -4811,8 +4811,55 @@
 	return 0;
 }
 
+#define SYSCFG          0xC0010010
+#define IORR_BASE0      0xC0010016
+#define IORR_MASK0      0xC0010017
+#define AMD_K7_NUM_IORR 2
+
+static int nvidia_init_iorr(u32 base, u32 size)
+{
+	u32 base_hi, base_lo;
+	u32 mask_hi, mask_lo;
+	u32 sys_hi, sys_lo;
+	u32 iorr_addr, free_iorr_addr;
+
+	/* Find the iorr that is already used for the base */
+	/* If not found, determine the uppermost available iorr */
+	free_iorr_addr = AMD_K7_NUM_IORR;
+	for(iorr_addr = 0; iorr_addr < AMD_K7_NUM_IORR; iorr_addr++) {
+		rdmsr(IORR_BASE0 + 2 * iorr_addr, base_lo, base_hi);
+		rdmsr(IORR_MASK0 + 2 * iorr_addr, mask_lo, mask_hi);
+
+		if ((base_lo & 0xfffff000) == (base & 0xfffff000))
+			break;
+
+		if ((mask_lo & 0x00000800) == 0)
+			free_iorr_addr = iorr_addr;
+	}
+	
+	if (iorr_addr >= AMD_K7_NUM_IORR) {
+		iorr_addr = free_iorr_addr;
+		if (iorr_addr >= AMD_K7_NUM_IORR)
+			return -EINVAL;
+	}
+
+    base_hi = 0x0;
+    base_lo = (base & ~0xfff) | 0x18;
+    mask_hi = 0xf;
+    mask_lo = ((~(size - 1)) & 0xfffff000) | 0x800;
+    wrmsr(IORR_BASE0 + 2 * iorr_addr, base_lo, base_hi);
+    wrmsr(IORR_MASK0 + 2 * iorr_addr, mask_lo, mask_hi);
+
+    rdmsr(SYSCFG, sys_lo, sys_hi);
+    sys_lo |= 0x00100000;
+    wrmsr(SYSCFG, sys_lo, sys_hi);
+
+	return 0;
+}
+
 static int nvidia_configure(void)
 {
+	int err;
 	int i, num_dirs;
 	u32 apbase, aplimit;
 	aper_size_info_8 *current_size;
@@ -4833,9 +4880,9 @@
 	pci_write_config_dword(nvidia_private.dev_2, NVIDIA_2_APLIMIT, aplimit);
 	pci_write_config_dword(nvidia_private.dev_3, NVIDIA_3_APBASE, apbase);
 	pci_write_config_dword(nvidia_private.dev_3, NVIDIA_3_APLIMIT, aplimit);
-
-	/* The original driver changed the IORR. We don't do that
-	   because this should be handled by the BIOS. */
+	err = nvidia_init_iorr(apbase, current_size->size * 1024 * 1024);
+	if (err) 
+		return err;
 
 	/* directory size is 64k */
 	num_dirs = current_size->size / 64;
@@ -4893,6 +4940,10 @@
 	previous_size = A_SIZE_8(agp_bridge.previous_size);
 	pci_write_config_byte(agp_bridge.dev, NVIDIA_0_APSIZE,
 		previous_size->size_value);
+
+	/* restore iorr for previous aperture size */
+	nvidia_init_iorr(agp_bridge.gart_bus_addr,
+		previous_size->size * 1024 * 1024);
 }
 
 static void nvidia_tlbflush(agp_memory * mem)
diff -urN linux-2.4.22-bk51/include/asm-i386/checksum.h linux-2.4.22-bk52/include/asm-i386/checksum.h
--- linux-2.4.22-bk51/include/asm-i386/checksum.h	2002-08-02 17:39:45.000000000 -0700
+++ linux-2.4.22-bk52/include/asm-i386/checksum.h	2003-11-12 02:51:23.000000000 -0800
@@ -92,7 +92,8 @@
 	   are modified, we must also specify them as outputs, or gcc
 	   will assume they contain their original values. */
 	: "=r" (sum), "=r" (iph), "=r" (ihl)
-	: "1" (iph), "2" (ihl));
+	: "1" (iph), "2" (ihl)
+	: "memory");
 	return(sum);
 }
 
diff -urN linux-2.4.22-bk51/include/asm-x86_64/checksum.h linux-2.4.22-bk52/include/asm-x86_64/checksum.h
--- linux-2.4.22-bk51/include/asm-x86_64/checksum.h	2003-06-13 07:51:38.000000000 -0700
+++ linux-2.4.22-bk52/include/asm-x86_64/checksum.h	2003-11-12 02:51:24.000000000 -0800
@@ -68,7 +68,8 @@
 	   are modified, we must also specify them as outputs, or gcc
 	   will assume they contain their original values. */
 	: "=r" (sum), "=r" (iph), "=r" (ihl)
-	: "1" (iph), "2" (ihl));
+	: "1" (iph), "2" (ihl) 
+	: "memory");
 	return(sum);
 }
 
