rpms/kernel/F-8 linux-2.6-cifs-fix-unc-path-prefix.patch, NONE, 1.1 linux-2.6-compile-fix-gcc-43.patch, NONE, 1.1 linux-2.6-debug-vm-would-have-oomkilled.patch, NONE, 1.1 linux-2.6-defaults-pci_no_msi.patch, NONE, 1.1 linux-2.6-drm-fix-master-perm.patch, NONE, 1.1 linux-2.6-drm-git-mm.patch, NONE, 1.1 linux-2.6-drm-radeon-fix-oops.patch, NONE, 1.1 linux-2.6-drm-radeon-fix-oops2.patch, NONE, 1.1 linux-2.6-e1000-corrupt-eeprom-checksum.patch, 1.2, 1.3 linux-2.6-e1000-ich9.patch, 1.2, 1.3 linux-2.6-efika-not-chrp.patch, NONE, 1.1 linux-2.6-ext34-xattr-fix.patch, NONE, 1.1 linux-2.6-imac-transparent-bridge.patch, NONE, 1.1 linux-2.6-powerpc-zImage-32MiB.patch, NONE, 1.1 linux-2.6-ppc-rtc.patch, NONE, 1.1 linux-2.6-ppc-use-libgcc.patch, NONE, 1.1 linux-2.6-vio-modalias.patch, NONE, 1.1 linux-2.6-windfarm-pm121-fix.patch, NONE, 1.1 linux-2.6-windfarm-pm121.patch, NONE, 1.1 linux-2.6-x86-dont-map-vdso-when-disabled.patch, NONE, 1.1 linux-2.6-x86-dont-read-maxlvt-if-apic-unmapped.patch, NONE, 1.1 linux-2.6-x86-dont-use-disabled-vdso-for-signals.patch, NONE, 1.1 linux-2.6-x86-fix-asm-constraint-in-do_IRQ.patch, NONE, 1.1 linux-2.6-x86-pci-revert-remove-default-rom-allocation.patch, NONE, 1.1 linux-2.6-xfs-small-buffer-reads.patch, NONE, 1.1 nouveau-drm-update.patch, NONE, 1.1 config-generic, 1.65, 1.66 kernel.spec, 1.442, 1.443 linux-2.6-build-nonintconfig.patch, 1.12, 1.13 linux-2.6-crash-driver.patch, 1.9, 1.10 linux-2.6-debug-no-quiet.patch, 1.5, 1.6 linux-2.6-debug-sizeof-structs.patch, 1.5, 1.6 linux-2.6-debug-taint-vm.patch, 1.16, 1.17 linux-2.6-devmem.patch, 1.19, 1.20 linux-2.6-execshield.patch, 1.75, 1.76 linux-2.6-firewire-git-pending.patch, 1.11, 1.12 linux-2.6-firewire-git-update.patch, 1.7, 1.8 linux-2.6-input-kill-stupid-messages.patch, 1.4, 1.5 linux-2.6-modsign-core.patch, 1.7, 1.8 linux-2.6-modsign-include.patch, 1.8, 1.9 linux-2.6-modsign-mpilib.patch, 1.5, 1.6 linux-2.6-modsign-verify.patch, 1.2, 1.3 linux-2.6-selinux-mprotect-checks.patch, 1.5, 1.6 linux-2.6-silence-noise.patch, 1.12, 1.13 linux-2.6-squashfs.patch, 1.24, 1.25 linux-2.6-upstream-reverts.patch, 1.7, 1.8 nouveau-drm.patch, 1.7, 1.8 linux-2.6-dcdbas-autoload.patch, 1.1, NONE linux-2.6-debug-resource-overflow.patch, 1.3, NONE linux-2.6-defaults-nommconf.patch, 1.3, NONE linux-2.6-drm-radeon-update.patch, 1.4, NONE linux-2.6-e1000-bad-csum-allow.patch, 1.1, NONE linux-2.6-git-initial-r500-drm.patch, 1.2, NONE linux-2.6-hwmon-coretemp-add-penryn-cpu.patch, 1.1, NONE linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch, 1.3, NONE linux-2.6-input-apple-add-aluminum-keyboard.patch, 1.1, NONE linux-2.6-input-apple-add-macbook-3rd-gen.patch, 1.1, NONE linux-2.6-input-apple-kbd-change-keycodes.patch, 1.1, NONE linux-2.6-input-apple-remove-4th-gen-kbd-quirk.patch, 1.1, NONE linux-2.6-input-apple-rename-identifiers.patch, 1.1, NONE linux-2.6-input-appletouch-macbook3-trackpad.patch, 1.1, NONE linux-2.6-isapnp-fix-limits.patch, 1.1, NONE linux-2.6-isdn-hisax-fix-request_irq-oops.patch, 1.1, NONE linux-2.6-libata-it821x-improve-emulation-handling.patch, 1.1, NONE linux-2.6-libata-pata_ataiixp-clear-simplex-b4-probe.patch, 1.1, NONE linux-2.6-net-tun-fix-rtnl-locking.patch, 1.1, NONE linux-2.6-netfilter-really-fix-oops-in-nf_nat_move_storage.patch, 1.2, NONE linux-2.6-paranoid-iret-crash-fix.patch, 1.1, NONE linux-2.6-pasemi-for-2.6.25.patch, 1.1, NONE linux-2.6-pasemi-reserve-i2c.patch, 1.1, NONE linux-2.6-pci-remove-default-pci-rom-allocation.patch, 1.1, NONE linux-2.6-pci-revert-remove-transparent-bridge-resizing.patch, 1.1, NONE linux-2.6-pnp-disable-overlapping-resources.patch, 1.1, NONE linux-2.6-pnp-extend-resource-limits.patch, 1.1, NONE linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch, 1.1, NONE linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch, 1.1, NONE linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch, 1.1, NONE linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch, 1.1, NONE linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch, 1.1, NONE linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch, 1.2, NONE linux-2.6-powerpc-spu-vicinity.patch, 1.1, NONE linux-2.6-ppc32-ucmpdi2.patch, 1.3, NONE linux-2.6-thinkpad-key-events.patch, 1.1, NONE linux-2.6-unexport-symbols.patch, 1.4, NONE linux-2.6-upstream-kcore-access.patch, 1.1, NONE linux-2.6-usb-serial-fix-recursive-lock.patch, 1.2, NONE linux-2.6-usb-serial-option-add-dell-modem-1.patch, 1.1, NONE linux-2.6-usb-serial-option-add-dell-modem-2.patch, 1.1, NONE linux-2.6-x86-asmlinkage_protect-sys_io_getevents.patch, 1.1, NONE linux-2.6-x86-clear-df-for-signals.patch, 1.2, NONE linux-2.6-x86_64-silence-up-apic-errors.patch, 1.2, NONE linux-2.6-xfs-features2-fixup-fix.patch, 1.1, NONE linux-2.6-xfs-features2-fixup.patch, 1.1, NONE linux-2.6-xfs-optimize-away-realtime-tests.patch, 1.2, NONE linux-2.6-xfs-setfattr-32bit-compat.patch, 1.1, NONE linux-2.6-xfs-xfs_mount-refactor.patch, 1.1, NONE

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Wed May 21 23:55:59 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12027

Modified Files:
	config-generic kernel.spec linux-2.6-build-nonintconfig.patch 
	linux-2.6-crash-driver.patch linux-2.6-debug-no-quiet.patch 
	linux-2.6-debug-sizeof-structs.patch 
	linux-2.6-debug-taint-vm.patch linux-2.6-devmem.patch 
	linux-2.6-execshield.patch 
	linux-2.6-firewire-git-pending.patch 
	linux-2.6-firewire-git-update.patch 
	linux-2.6-input-kill-stupid-messages.patch 
	linux-2.6-modsign-core.patch linux-2.6-modsign-include.patch 
	linux-2.6-modsign-mpilib.patch linux-2.6-modsign-verify.patch 
	linux-2.6-selinux-mprotect-checks.patch 
	linux-2.6-silence-noise.patch linux-2.6-squashfs.patch 
	linux-2.6-upstream-reverts.patch nouveau-drm.patch 
Added Files:
	linux-2.6-cifs-fix-unc-path-prefix.patch 
	linux-2.6-compile-fix-gcc-43.patch 
	linux-2.6-debug-vm-would-have-oomkilled.patch 
	linux-2.6-defaults-pci_no_msi.patch 
	linux-2.6-drm-fix-master-perm.patch linux-2.6-drm-git-mm.patch 
	linux-2.6-drm-radeon-fix-oops.patch 
	linux-2.6-drm-radeon-fix-oops2.patch 
	linux-2.6-e1000-corrupt-eeprom-checksum.patch 
	linux-2.6-e1000-ich9.patch linux-2.6-efika-not-chrp.patch 
	linux-2.6-ext34-xattr-fix.patch 
	linux-2.6-imac-transparent-bridge.patch 
	linux-2.6-powerpc-zImage-32MiB.patch linux-2.6-ppc-rtc.patch 
	linux-2.6-ppc-use-libgcc.patch linux-2.6-vio-modalias.patch 
	linux-2.6-windfarm-pm121-fix.patch 
	linux-2.6-windfarm-pm121.patch 
	linux-2.6-x86-dont-map-vdso-when-disabled.patch 
	linux-2.6-x86-dont-read-maxlvt-if-apic-unmapped.patch 
	linux-2.6-x86-dont-use-disabled-vdso-for-signals.patch 
	linux-2.6-x86-fix-asm-constraint-in-do_IRQ.patch 
	linux-2.6-x86-pci-revert-remove-default-rom-allocation.patch 
	linux-2.6-xfs-small-buffer-reads.patch 
	nouveau-drm-update.patch 
Removed Files:
	linux-2.6-dcdbas-autoload.patch 
	linux-2.6-debug-resource-overflow.patch 
	linux-2.6-defaults-nommconf.patch 
	linux-2.6-drm-radeon-update.patch 
	linux-2.6-e1000-bad-csum-allow.patch 
	linux-2.6-git-initial-r500-drm.patch 
	linux-2.6-hwmon-coretemp-add-penryn-cpu.patch 
	linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch 
	linux-2.6-input-apple-add-aluminum-keyboard.patch 
	linux-2.6-input-apple-add-macbook-3rd-gen.patch 
	linux-2.6-input-apple-kbd-change-keycodes.patch 
	linux-2.6-input-apple-remove-4th-gen-kbd-quirk.patch 
	linux-2.6-input-apple-rename-identifiers.patch 
	linux-2.6-input-appletouch-macbook3-trackpad.patch 
	linux-2.6-isapnp-fix-limits.patch 
	linux-2.6-isdn-hisax-fix-request_irq-oops.patch 
	linux-2.6-libata-it821x-improve-emulation-handling.patch 
	linux-2.6-libata-pata_ataiixp-clear-simplex-b4-probe.patch 
	linux-2.6-net-tun-fix-rtnl-locking.patch 
	linux-2.6-netfilter-really-fix-oops-in-nf_nat_move_storage.patch 
	linux-2.6-paranoid-iret-crash-fix.patch 
	linux-2.6-pasemi-for-2.6.25.patch 
	linux-2.6-pasemi-reserve-i2c.patch 
	linux-2.6-pci-remove-default-pci-rom-allocation.patch 
	linux-2.6-pci-revert-remove-transparent-bridge-resizing.patch 
	linux-2.6-pnp-disable-overlapping-resources.patch 
	linux-2.6-pnp-extend-resource-limits.patch 
	linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch 
	linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch 
	linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch 
	linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch 
	linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch 
	linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch 
	linux-2.6-powerpc-spu-vicinity.patch 
	linux-2.6-ppc32-ucmpdi2.patch 
	linux-2.6-thinkpad-key-events.patch 
	linux-2.6-unexport-symbols.patch 
	linux-2.6-upstream-kcore-access.patch 
	linux-2.6-usb-serial-fix-recursive-lock.patch 
	linux-2.6-usb-serial-option-add-dell-modem-1.patch 
	linux-2.6-usb-serial-option-add-dell-modem-2.patch 
	linux-2.6-x86-asmlinkage_protect-sys_io_getevents.patch 
	linux-2.6-x86-clear-df-for-signals.patch 
	linux-2.6-x86_64-silence-up-apic-errors.patch 
	linux-2.6-xfs-features2-fixup-fix.patch 
	linux-2.6-xfs-features2-fixup.patch 
	linux-2.6-xfs-optimize-away-realtime-tests.patch 
	linux-2.6-xfs-setfattr-32bit-compat.patch 
	linux-2.6-xfs-xfs_mount-refactor.patch 
Log Message:
* Wed May 21 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-3
- Initial cut of 2.6.25.4 kernel -- passes 'make prep'.


linux-2.6-cifs-fix-unc-path-prefix.patch:

--- NEW FILE linux-2.6-cifs-fix-unc-path-prefix.patch ---
Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=076d8423a98659a92837b07aa494cb74bfefe77c
Commit:     076d8423a98659a92837b07aa494cb74bfefe77c
Parent:     2302aca8508ee727a0c5edde3a7518a4ee03da1b
Author:     Steve French <sfrench at us.ibm.com>
AuthorDate: Fri Apr 18 23:26:26 2008 +0000
Committer:  Steve French <sfrench at us.ibm.com>
CommitDate: Fri Apr 18 23:26:26 2008 +0000

    [CIFS] Fix UNC path prefix on QueryUnixPathInfo to have correct slash
    
    When a share was in DFS and the server was Unix/Linux, we were sending paths of the form
        \\server\share/dir/file
    rather than
        //server/share/dir/file
    
    There was some discussion between me and jra over whether we should use
        /server/share/dir/file
    as MS sometimes says - but the documentation for this claims it should be
    doubleslash for this type of UNC-like path format and that works, so leaving
    it as doubleslash but converting the \ to / in the the //server/share portion.
    
    This gets Samba to now correctly return STATUS_PATH_NOT_COVERED when it is
    supposed to (Windows already did since the direction of the slash was not an issue
    for them).  Still need another minor change to fully enable DFS (need to finish
    some chages to SMBGetDFSRefer
    
    Signed-off-by: Steve French <sfrench at us.ibm.com>
---
 fs/cifs/inode.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index bc673c8..e1031b9 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -161,12 +161,14 @@ static void cifs_unix_info_to_inode(struct inode *inode,
 	spin_unlock(&inode->i_lock);
 }
 
-static const unsigned char *cifs_get_search_path(struct cifsTconInfo *pTcon,
-					const char *search_path)
+static const unsigned char *cifs_get_search_path(struct cifs_sb_info *cifs_sb,
+						const char *search_path)
 {
 	int tree_len;
 	int path_len;
+	int i;
 	char *tmp_path;
+	struct cifsTconInfo *pTcon = cifs_sb->tcon;
 
 	if (!(pTcon->Flags & SMB_SHARE_IS_IN_DFS))
 		return search_path;
@@ -180,6 +182,11 @@ static const unsigned char *cifs_get_search_path(struct cifsTconInfo *pTcon,
 		return search_path;
 
 	strncpy(tmp_path, pTcon->treeName, tree_len);
+	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
+		for (i = 0; i < tree_len; i++) {
+			if (tmp_path[i] == '\\')
+				tmp_path[i] = '/';
+		}
 	strncpy(tmp_path+tree_len, search_path, path_len);
 	tmp_path[tree_len+path_len] = 0;
 	return tmp_path;
@@ -199,7 +206,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
 	pTcon = cifs_sb->tcon;
 	cFYI(1, ("Getting info on %s", search_path));
 
-	full_path = cifs_get_search_path(pTcon, search_path);
+	full_path = cifs_get_search_path(cifs_sb, search_path);
 
 try_again_CIFSSMBUnixQPathInfo:
 	/* could have done a find first instead but this returns more info */
@@ -402,7 +409,7 @@ int cifs_get_inode_info(struct inode **pinode,
 			return -ENOMEM;
 		pfindData = (FILE_ALL_INFO *)buf;
 
-		full_path = cifs_get_search_path(pTcon, search_path);
+		full_path = cifs_get_search_path(cifs_sb, search_path);
 
 try_again_CIFSSMBQPathInfo:
 		/* could do find first instead but this returns more info */


linux-2.6-compile-fix-gcc-43.patch:

--- NEW FILE linux-2.6-compile-fix-gcc-43.patch ---
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -30,6 +30,15 @@
 
 #define MODULE_NAME_LEN (64 - sizeof(unsigned long))
 
+/* On some platforms relocations to global data cannot go into read-only
+ * sections, so 'const' makes no sense and even causes compile failures
+ * with some compilers. */
+#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
+#define __ksym_const
+#else
+#define __ksym_const const
+#endif
+
 struct kernel_symbol
 {
 	unsigned long value;
@@ -192,7 +201,7 @@ void *__symbol_get_gpl(const char *symbol);
 	static const char __kstrtab_##sym[]			\
 	__attribute__((section("__ksymtab_strings")))		\
 	= MODULE_SYMBOL_PREFIX #sym;                    	\
-	static const struct kernel_symbol __ksymtab_##sym	\
+	static __ksym_const struct kernel_symbol __ksymtab_##sym	\
 	__used							\
 	__attribute__((section("__ksymtab" sec), unused))	\
 	= { (unsigned long)&sym, __kstrtab_##sym }

linux-2.6-debug-vm-would-have-oomkilled.patch:

--- NEW FILE linux-2.6-debug-vm-would-have-oomkilled.patch ---
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index b2a2d68..3b132ee 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -67,6 +67,7 @@ extern int sysctl_overcommit_ratio;
 extern int sysctl_panic_on_oom;
 extern int sysctl_oom_kill_allocating_task;
 extern int sysctl_oom_dump_tasks;
+extern int sysctl_would_have_oomkilled;
 extern int max_threads;
 extern int core_uses_pid;
 extern int suid_dumpable;
@@ -861,6 +862,14 @@ static struct ctl_table vm_table[] = {
 		.proc_handler	= &proc_dointvec,
 	},
 	{
+		.ctl_name	= CTL_UNNUMBERED,
+		.procname	= "would_have_oomkilled",
+		.data		= &sysctl_would_have_oomkilled,
+		.maxlen		= sizeof(sysctl_would_have_oomkilled),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
 		.ctl_name	= VM_OVERCOMMIT_RATIO,
 		.procname	= "overcommit_ratio",
 		.data		= &sysctl_overcommit_ratio,
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index f255eda..3335a94 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -30,6 +30,7 @@
 int sysctl_panic_on_oom;
 int sysctl_oom_kill_allocating_task;
 int sysctl_oom_dump_tasks;
+int sysctl_would_have_oomkilled;
 static DEFINE_SPINLOCK(zone_scan_mutex);
 /* #define DEBUG */
 
@@ -321,6 +322,12 @@ static void __oom_kill_task(struct task_struct *p, int verbose)
 		return;
 	}
 
+	if (sysctl_would_have_oomkilled == 1) {
+		printk(KERN_ERR "Would have killed process %d (%s). But continuing instead.\n",
+				task_pid_nr(p), p->comm);
+		return;
+	}
+
 	if (verbose)
 		printk(KERN_ERR "Killed process %d (%s)\n",
 				task_pid_nr(p), p->comm);
@@ -363,6 +370,12 @@ static int oom_kill_task(struct task_struct *p)
 			return 1;
 	} while_each_thread(g, q);
 
+	if (sysctl_would_have_oomkilled == 1) {
+		printk(KERN_ERR "Would have killed process %d (%s). But continuing instead.\n",
+				task_pid_nr(p), p->comm);
+		return 1;
+	}
+
 	__oom_kill_task(p, 1);
 
 	/*

linux-2.6-defaults-pci_no_msi.patch:

--- NEW FILE linux-2.6-defaults-pci_no_msi.patch ---
Disable PCI MSI by default, add kernel parameter to enable it.

Signed-off-by: Chuck Ebbert <cebbert at redhat.com>

--- linux-2.6.20.noarch.orig/drivers/pci/msi.c
+++ linux-2.6.20.noarch/drivers/pci/msi.c
@@ -23,7 +23,7 @@ static DEFINE_SPINLOCK(msi_lock);
 #include "pci.h"
 #include "msi.h"
 
-static int pci_msi_enable = 1;
+static int pci_msi_enable = 0;
 
 /* Arch hooks */
 
@@ -722,6 +722,11 @@ void pci_no_msi(void)
 {
 	pci_msi_enable = 0;
 }
+
+void pci_yes_msi(void)
+{
+	pci_msi_enable = 1;
+}
 
 void pci_msi_init_pci_dev(struct pci_dev *dev)
 {
--- linux-2.6.20.noarch.orig/Documentation/kernel-parameters.txt
+++ linux-2.6.20.noarch/Documentation/kernel-parameters.txt
@@ -1429,6 +1429,9 @@ and is between 256 and 4096 characters. 
 				root domains (aka PCI segments, in ACPI-speak).
 		nommconf	[X86-32,X86_64] Disable use of MMCONFIG for PCI
 				Configuration
+		msi		[MSI] If the PCI_MSI kernel config parameter is
+				enabled, this kernel boot option can be used to
+				enable the use of MSI interrupts system-wide.
 		nomsi		[MSI] If the PCI_MSI kernel config parameter is
 				enabled, this kernel boot option can be used to
 				disable the use of MSI interrupts system-wide.
--- linux-2.6.20.noarch.orig/drivers/pci/pci.c
+++ linux-2.6.20.noarch/drivers/pci/pci.c
@@ -1642,6 +1642,8 @@ static int __devinit pci_setup(char *str
 		if (*str && (str = pcibios_setup(str)) && *str) {
 			if (!strcmp(str, "nomsi")) {
 				pci_no_msi();
+			} else if (!strcmp(str, "msi")) {
+				pci_yes_msi();
 			} else if (!strcmp(str, "noaer")) {
 				pci_no_aer();
 			} else if (!strcmp(str, "nodomains")) {
--- linux-2.6.20.noarch.orig/drivers/pci/pci.h
+++ linux-2.6.20.noarch/drivers/pci/pci.h
@@ -41,9 +41,11 @@ extern unsigned int pci_pm_d3_delay;
 
 #ifdef CONFIG_PCI_MSI
 void pci_no_msi(void);
+void pci_yes_msi(void);
 extern void pci_msi_init_pci_dev(struct pci_dev *dev);
 #else
 static inline void pci_no_msi(void) { }
+static inline void pci_yes_msi(void) { }
 static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
 #endif
 

linux-2.6-drm-fix-master-perm.patch:

--- NEW FILE linux-2.6-drm-fix-master-perm.patch ---
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
index e35126a..3b69b74 100644
--- a/drivers/char/drm/drm_ioctl.c
+++ b/drivers/char/drm/drm_ioctl.c
@@ -308,6 +308,9 @@ int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_pri
 	struct drm_set_version *sv = data;
 	int if_version, retcode = 0;
 
+	if (!file_priv->is_master)
+		return -EPERM;
+
 	if (sv->drm_di_major != -1) {
 		if (sv->drm_di_major != DRM_IF_MAJOR ||
 		    sv->drm_di_minor < 0 || sv->drm_di_minor > DRM_IF_MINOR) {
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index 9ca655d..1733c78 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -510,7 +510,7 @@ static int i915_emit_box(struct drm_device *dev,
 void i915_emit_breadcrumb(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
+	struct drm_i915_master_private *master_priv;
 	RING_LOCALS;
 
 	if (++dev_priv->counter > BREADCRUMB_MASK) {
@@ -518,8 +518,11 @@ void i915_emit_breadcrumb(struct drm_device *dev)
 		DRM_DEBUG("Breadcrumb counter wrapped around\n");
 	}
 
-	if (master_priv->sarea_priv)
-		master_priv->sarea_priv->last_enqueue = dev_priv->counter;
+	if (dev->primary && dev->primary->master) {
+		master_priv = dev->primary->master->driver_priv;
+		if (master_priv->sarea_priv)
+			master_priv->sarea_priv->last_enqueue = dev_priv->counter;
+	}
 
 	BEGIN_LP_RING(4);
 	OUT_RING(CMD_STORE_DWORD_IDX);

linux-2.6-drm-git-mm.patch:

--- NEW FILE linux-2.6-drm-git-mm.patch ---
commit 60abdfdecf0163fb3da7dc152c7d22179029badd
Author: Xiang, Haihao <haihao.xiang at intel.com>
Date:   Fri Feb 29 12:07:01 2008 +1000

    i915: i915_execbuffer ioctl32 routine, fix #13732
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit f6f86ba80ca643b826a48d0a811e5dd644c7349e
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Fri Feb 29 12:05:48 2008 +1000

    drm/ttm: Add a compat kmap_atomic_prot_pfn to do quick kernel map / unmaps of PCI- or high memory.
    
    This is substantially more efficient than drm_bo_kmap, since the mapping only lives on a single processor.  Unmapping is done use kunmap_atomic(). Flushes only a single tlb() entry.
    
    Add a support utility int drm_bo_pfn_prot() that returns the pfn and desired page protection for a given bo offset.
    
    This is all intended for relocations in bound TTMS or vram.  Mapping-accessing-unmapping must be atomic, either using preempt_xx() macros or a spinlock.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit f50888eab3d965aedbd27ec512a40db465e8b4d9
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Fri Feb 29 11:53:45 2008 +1000

    drm/i915: relocation fixes.
    
    This fixes various problems in the relocations for i915.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit 64c84bc78cf57bf5b028cda9d9dc09431aabff4b
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Fri Feb 29 11:49:39 2008 +1000

    drm/i915: Make the execbuffer code reasonably safe against errors.
    
    In particular -EAGAINs, which should be common during Xserver operation.
    Also handle the fence creation failure case.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit 9ad34ad2452af7780ddad11c1157cd24ef42f471
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Fri Feb 29 11:41:36 2008 +1000

    drm/fence: add a last queued sequence member
    
    Add an fence_class_manager::last_queued_sequence member, since a sequence number may actually turn up before the corresponding fence object has been queued on the ring.
    
    Fence drivers can use this member to determine whether a sequence number must be re-reported.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit 2f620305d4f7b28e9403d34caecafc639bea69ed
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Fri Feb 29 11:38:20 2008 +1000

    drm/i915: remove leading underscores and fixup sarea
    
    the sarea fix came from Alan Hourihane
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit b45d673ed96c158d37bb476dd0f92246427b1541
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Fri Feb 29 11:35:21 2008 +1000

    drm/i915: Add a dri2 init path that gets the lock from the dri2 sarea.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit 0d543148472264c8ad2ccbd145f953c3412a7396
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Fri Feb 29 11:31:08 2008 +1000

    drm/i915: Only look up dev_priv->mmio_map if it's not already set up
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit f7890c94ebabe07b3f7365526045c741dc4d3d8b
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Fri Feb 29 11:30:26 2008 +1000

    drm/i915: Add I915_PARAM_CHIPSET_ID param to get chipset ID.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit 28cd0c8c93179e272d76f327efffcf719ef85846
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Fri Feb 29 11:29:42 2008 +1000

    drm/i915: Make sarea_priv setup optional.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit f68e6c81fe11cf44a7b5db1ae7b3bc854f6d2e3e
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Fri Feb 29 11:27:30 2008 +1000

    drm/i915: Re-report breadcrumbs on poll to the fence manager,
    
    since a breadcrumb may actually turn up before a corresponding fence object
    has been placed on the fence ring.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit 3fdbfb6b0a7c3f839424e768cd3bf137d8993bf6
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Fri Feb 29 11:02:23 2008 +1000

    drm/i915: Avoid calling drm_fence_flush_old excessively.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit 3ffa46ff70b9e3128e4f297f05a0b48e8656588c
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Fri Feb 29 10:57:18 2008 +1000

    drm/fence: differentiate between flushes and waiting types.
    
    Add a "command_stream_barrier" method to the bo driver.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit d049bd7aa94ab159227d214b17da9aa6f5114b7e
Author: Nick Piggin <npiggin at suse.de>
Date:   Thu Feb 7 16:29:15 2008 +1000

    drm:  reimplement nopfn callers with fault
    
    Reimplement the existing nopfn handlers with ->fault so we can subsequently
    remove nopfn
    
    Signed-off-by: Nick Piggin <npiggin at suse.de>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit f35f0fbc2dd85a4c0865ef0dcb6724c7b863a94c
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Feb 7 16:21:57 2008 +1000

    drm: remove tlb flush call as no longer needed.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit adb114cd5ebd47beb4b6108e51c266a6aa118840
Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Jan 25 11:36:39 2008 +1000

    drm/i915: final i915 interface change - make reloc use copy from user
    
    Life is a lot simpler especially with relocation avoidance code, if we
    simple store the relocations in a malloced buffer and copy from user
    instead of bring up a BO everytime.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit 472d4dc9ecc22480dcd99e96d77e47fec0e99f1c
Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Jan 25 11:05:59 2008 +1000

    drm: whitespace and some label cleanups.
    
    Signed-off-by: Dave Airlie <airlied at linux.ie>

commit de12324c869d2d5d6918c5e5c5752ded2e188492
Author: Kyle McMartin <kyle at mcmartin.ca>
Date:   Thu Jan 24 16:48:24 2008 +1000

    i915: fix invalid opcode exception on cpus without clflush
    
    i915_flush_ttm was unconditionally executing a clflush instruction
    to (obviously) flush the cache. Instead, check if the cpu supports
    clflush, and if not, fall back to calling wbinvd to flush the entire
    cache.
    
    Signed-off-by: Kyle McMartin <kmcmartin at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit 88bf3e11fdde2d8b7deeb80e088a32aed697e9a8
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 24 16:47:28 2008 +1000

    drm: Add additional explanation of DRM_BO_FLAG_CACHED_MAPPED
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

commit e880b462be59edb1b66dbfe783faffc4872cfe75
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Thu Jan 24 16:44:25 2008 +1000

    drm/ttm:  Properly propagate the user-space fence flags.
    
    This avoids a sync flush when user-space has already programmed
    and MI_FLUSH in the batchbuffer.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

[...10728 lines suppressed...]
+	if (dev_priv->irq_enabled && (--dev_priv->user_irq_refcount == 0)) {
+		/*		dev_priv->irq_enable_reg &= ~USER_INT_FLAG;
+		  I915_WRITE16(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg);*/
+	}
+	spin_unlock(&dev_priv->user_irq_lock);
+}
+
+
 static int i915_wait_irq(struct drm_device * dev, int irq_nr)
 {
 	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
@@ -308,19 +411,24 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
 
 	dev_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT;
 
+	i915_user_irq_on(dev_priv);
 	DRM_WAIT_ON(ret, dev_priv->irq_queue, 3 * DRM_HZ,
 		    READ_BREADCRUMB(dev_priv) >= irq_nr);
+	i915_user_irq_off(dev_priv);
 
 	if (ret == -EBUSY) {
 		DRM_ERROR("EBUSY -- rec: %d emitted: %d\n",
 			  READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
 	}
 
-	dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
+	if (dev_priv->sarea_priv)
+		dev_priv->sarea_priv->last_dispatch =
+			READ_BREADCRUMB(dev_priv);
 	return ret;
 }
 
-static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequence,
+static int i915_driver_vblank_do_wait(struct drm_device *dev,
+				      unsigned int *sequence,
 				      atomic_t *counter)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
@@ -397,15 +505,15 @@ int i915_irq_wait(struct drm_device *dev, void *data,
 static void i915_enable_interrupt (struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
-	u16 flag;
 
-	flag = 0;
+	dev_priv->irq_enable_reg = USER_INT_FLAG;
 	if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_A)
-		flag |= VSYNC_PIPEA_FLAG;
+		dev_priv->irq_enable_reg |= VSYNC_PIPEA_FLAG;
 	if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_B)
-		flag |= VSYNC_PIPEB_FLAG;
+		dev_priv->irq_enable_reg |= VSYNC_PIPEB_FLAG;
 
-	I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | flag);
+	I915_WRITE16(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg);
+	dev_priv->irq_enabled = 1;
 }
 
 /* Set the vblank monitor pipe
@@ -464,7 +572,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	drm_i915_vblank_swap_t *swap = data;
 	drm_i915_vbl_swap_t *vbl_swap;
-	unsigned int pipe, seqtype, curseq;
+	unsigned int pipe, seqtype, curseq, plane;
 	unsigned long irqflags;
 	struct list_head *list;
 
@@ -473,18 +581,20 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
 		return -EINVAL;
 	}
 
-	if (dev_priv->sarea_priv->rotation) {
+	if (!dev_priv->sarea_priv || dev_priv->sarea_priv->rotation) {
 		DRM_DEBUG("Rotation not supported\n");
 		return -EINVAL;
 	}
 
 	if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE |
-			     _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) {
+			     _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS |
+			     _DRM_VBLANK_FLIP)) {
 		DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype);
 		return -EINVAL;
 	}
 
-	pipe = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0;
+	plane = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0;
+	pipe = i915_get_pipe(dev, plane);
 
 	seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE);
 
@@ -495,6 +605,11 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
 
 	spin_lock_irqsave(&dev->drw_lock, irqflags);
 
+	/* It makes no sense to schedule a swap for a drawable that doesn't have
+	 * valid information at this point. E.g. this could mean that the X
+	 * server is too old to push drawable information to the DRM, in which
+	 * case all such swaps would become ineffective.
+	 */
 	if (!drm_get_drawable_info(dev, swap->drawable)) {
 		spin_unlock_irqrestore(&dev->drw_lock, irqflags);
 		DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable);
@@ -517,14 +632,43 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
 		}
 	}
 
+	if (swap->seqtype & _DRM_VBLANK_FLIP) {
+		swap->sequence--;
+
+		if ((curseq - swap->sequence) <= (1<<23)) {
+			struct drm_drawable_info *drw;
+
+			LOCK_TEST_WITH_RETURN(dev, file_priv);
+
+			spin_lock_irqsave(&dev->drw_lock, irqflags);
+
+			drw = drm_get_drawable_info(dev, swap->drawable);
+
+			if (!drw) {
+				spin_unlock_irqrestore(&dev->drw_lock,
+				    irqflags);
+				DRM_DEBUG("Invalid drawable ID %d\n",
+					  swap->drawable);
+				return -EINVAL;
+			}
+
+			i915_dispatch_vsync_flip(dev, drw, plane);
+
+			spin_unlock_irqrestore(&dev->drw_lock, irqflags);
+
+			return 0;
+		}
+	}
+
 	spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
 
 	list_for_each(list, &dev_priv->vbl_swaps.head) {
 		vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head);
 
 		if (vbl_swap->drw_id == swap->drawable &&
-		    vbl_swap->pipe == pipe &&
+		    vbl_swap->plane == plane &&
 		    vbl_swap->sequence == swap->sequence) {
+			vbl_swap->flip = (swap->seqtype & _DRM_VBLANK_FLIP);
 			spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
 			DRM_DEBUG("Already scheduled\n");
 			return 0;
@@ -548,8 +692,12 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
 	DRM_DEBUG("\n");
 
 	vbl_swap->drw_id = swap->drawable;
-	vbl_swap->pipe = pipe;
+	vbl_swap->plane = plane;
 	vbl_swap->sequence = swap->sequence;
+	vbl_swap->flip = (swap->seqtype & _DRM_VBLANK_FLIP);
+
+	if (vbl_swap->flip)
+		swap->sequence++;
 
 	spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
 
@@ -567,7 +715,7 @@ void i915_driver_irq_preinstall(struct drm_device * dev)
 {
 	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
 
-	I915_WRITE16(I915REG_HWSTAM, 0xfffe);
+	I915_WRITE16(I915REG_HWSTAM, 0xeffe);
 	I915_WRITE16(I915REG_INT_MASK_R, 0x0);
 	I915_WRITE16(I915REG_INT_ENABLE_R, 0x0);
 }
@@ -580,10 +728,17 @@ void i915_driver_irq_postinstall(struct drm_device * dev)
 	INIT_LIST_HEAD(&dev_priv->vbl_swaps.head);
 	dev_priv->swaps_pending = 0;
 
-	if (!dev_priv->vblank_pipe)
-		dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A;
+	spin_lock_init(&dev_priv->user_irq_lock);
+	dev_priv->user_irq_refcount = 0;
+
 	i915_enable_interrupt(dev);
 	DRM_INIT_WAITQUEUE(&dev_priv->irq_queue);
+
+	/*
+	 * Initialize the hardware status page IRQ location.
+	 */
+
+	I915_WRITE(I915REG_INSTPM, (1 << 5) | (1 << 21));
 }
 
 void i915_driver_irq_uninstall(struct drm_device * dev)
@@ -594,6 +749,7 @@ void i915_driver_irq_uninstall(struct drm_device * dev)
 	if (!dev_priv)
 		return;
 
+	dev_priv->irq_enabled = 0;
 	I915_WRITE16(I915REG_HWSTAM, 0xffff);
 	I915_WRITE16(I915REG_INT_MASK_R, 0xffff);
 	I915_WRITE16(I915REG_INT_ENABLE_R, 0x0);

linux-2.6-drm-radeon-fix-oops.patch:

--- NEW FILE linux-2.6-drm-radeon-fix-oops.patch ---
diff -up linux-2.6.24.noarch/drivers/char/drm/radeon_state.c.da linux-2.6.24.noarch/drivers/char/drm/radeon_state.c
--- linux-2.6.24.noarch/drivers/char/drm/radeon_state.c.da	2008-03-31 11:28:35.000000000 +1000
+++ linux-2.6.24.noarch/drivers/char/drm/radeon_state.c	2008-03-31 11:28:48.000000000 +1000
@@ -3088,7 +3088,8 @@ static int radeon_cp_setparam(struct drm
 			dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE;
 		break;
 	case RADEON_SETPARAM_VBLANK_CRTC:
-		return radeon_vblank_crtc_set(dev, sp->value);
+		if (dev_priv)
+			return radeon_vblank_crtc_set(dev, sp->value);
 		break;
 	default:
 		DRM_DEBUG("Invalid parameter %d\n", sp->param);

linux-2.6-drm-radeon-fix-oops2.patch:

--- NEW FILE linux-2.6-drm-radeon-fix-oops2.patch ---
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index dd9bb45..12a870b 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1513,10 +1513,10 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
 	}
 }
 
-static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
+static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init, struct drm_file *file_priv)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
-
+	struct drm_radeon_master_private *master_priv = file_priv->master->driver_priv;
 	DRM_DEBUG("\n");
 
 	/* if we require new memory map but we don't have it fail */
@@ -1640,8 +1640,8 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 	dev_priv->buffers_offset = init->buffers_offset;
 	dev_priv->gart_textures_offset = init->gart_textures_offset;
 
-	dev_priv->sarea = drm_getsarea(dev);
-	if (!dev_priv->sarea) {
+	master_priv->sarea = drm_getsarea(dev);
+	if (!master_priv->sarea) {
 		DRM_ERROR("could not find sarea!\n");
 		radeon_do_cleanup_cp(dev);
 		return -EINVAL;
@@ -1678,7 +1678,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 	}
 
 	dev_priv->sarea_priv =
-	    (drm_radeon_sarea_t *) ((u8 *) dev_priv->sarea->handle +
+	    (drm_radeon_sarea_t *) ((u8 *) master_priv->sarea->handle +
 				    init->sarea_priv_offset);
 
 #if __OS_HAS_AGP
@@ -1970,7 +1970,7 @@ int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_pri
 	case RADEON_INIT_CP:
 	case RADEON_INIT_R200_CP:
 	case RADEON_INIT_R300_CP:
-		return radeon_do_init_cp(dev, init);
+		return radeon_do_init_cp(dev, init, file_priv);
 	case RADEON_CLEANUP_CP:
 		return radeon_do_cleanup_cp(dev);
 	}
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c
index 349ac3d..52b7c46 100644
--- a/drivers/char/drm/radeon_drv.c
+++ b/drivers/char/drm/radeon_drv.c
@@ -81,6 +81,8 @@ static struct drm_driver driver = {
 	.get_reg_ofs = drm_core_get_reg_ofs,
 	.ioctls = radeon_ioctls,
 	.dma_ioctl = radeon_cp_buffers,
+	.master_create = radeon_master_create,
+	.master_destroy = radeon_master_destroy,
 	.fops = {
 		 .owner = THIS_MODULE,
 		 .open = drm_open,
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 20faa2a..f1c58dd 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -279,7 +279,6 @@ typedef struct drm_radeon_private {
 	unsigned long buffers_offset;
 	unsigned long gart_textures_offset;
 
-	drm_local_map_t *sarea;
 	drm_local_map_t *cp_ring;
 	drm_local_map_t *ring_rptr;
 	drm_local_map_t *gart_textures;
@@ -309,6 +308,10 @@ typedef struct drm_radeon_private {
 	drm_local_map_t *mmio;
 } drm_radeon_private_t;
 
+struct drm_radeon_master_private {
+	drm_local_map_t *sarea;
+};
+
 typedef struct drm_radeon_buf_priv {
 	u32 age;
 } drm_radeon_buf_priv_t;
@@ -395,6 +398,9 @@ extern int radeon_driver_open(struct drm_device * dev, struct drm_file * filp_pr
 extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
 				unsigned long arg);
 
+extern int radeon_master_create(struct drm_device *dev, struct drm_master *master);
+extern void radeon_master_destroy(struct drm_device *dev, struct drm_master *master);
+
 /* r300_cmdbuf.c */
 extern void r300_init_reg_flags(struct drm_device *dev);
 
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c
index 3cd3972..e79359b 100644
--- a/drivers/char/drm/radeon_state.c
+++ b/drivers/char/drm/radeon_state.c
@@ -1415,10 +1415,11 @@ static void radeon_cp_dispatch_swap(struct drm_device * dev)
 	ADVANCE_RING();
 }
 
-static void radeon_cp_dispatch_flip(struct drm_device * dev)
+static void radeon_cp_dispatch_flip(struct drm_device * dev, struct drm_master *master)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
-	struct drm_sarea *sarea = (struct drm_sarea *) dev_priv->sarea->handle;
+	struct drm_radeon_master_private *master_priv = master->driver_priv;
+	struct drm_sarea *sarea = (struct drm_sarea *) master_priv->sarea->handle;
 	int offset = (dev_priv->sarea_priv->pfCurrentPage == 1)
 	    ? dev_priv->front_offset : dev_priv->back_offset;
 	RING_LOCALS;
@@ -2166,7 +2167,7 @@ static int radeon_cp_flip(struct drm_device *dev, void *data, struct drm_file *f
 	if (!dev_priv->page_flipping)
 		radeon_do_init_pageflip(dev);
 
-	radeon_cp_dispatch_flip(dev);
+	radeon_cp_dispatch_flip(dev, file_priv->master);
 
 	COMMIT_RING();
 	return 0;
@@ -3120,15 +3121,42 @@ void radeon_driver_preclose(struct drm_device *dev, struct drm_file *file_priv)
 
 void radeon_driver_lastclose(struct drm_device *dev)
 {
-	if (dev->dev_private) {
-		drm_radeon_private_t *dev_priv = dev->dev_private;
+	radeon_do_release(dev);
+}
 
-		if (dev_priv->sarea_priv &&
-		    dev_priv->sarea_priv->pfCurrentPage != 0)
-			radeon_cp_dispatch_flip(dev);
-	}
+int radeon_master_create(struct drm_device *dev, struct drm_master *master)
+{
+	/* radeon doesn't support multi-master yet so just workaround */
+	struct drm_radeon_master_private *master_priv;
+
+	master_priv = drm_calloc(1, sizeof(*master_priv), DRM_MEM_DRIVER);
+	if (!master_priv)
+		return -ENOMEM;
+	
+	master->driver_priv = master_priv;
+	return 0;
+}
+
+void radeon_master_destroy(struct drm_device *dev, struct drm_master *master)
+{
+	struct drm_radeon_master_private *master_priv = master->driver_priv;
+	drm_radeon_private_t *dev_priv = dev->dev_private;
+
+	if (!master_priv)
+		return;
+
+	if (dev_priv->sarea_priv &&
+	    dev_priv->sarea_priv->pfCurrentPage != 0)
+		radeon_cp_dispatch_flip(dev, master);
+
+	dev_priv->sarea_priv = NULL;
+
+	if (master_priv->sarea)
+		drm_rmmap(dev, master_priv->sarea);
+
+	drm_free(master_priv, sizeof(*master_priv), DRM_MEM_DRIVER);
+	master->driver_priv = NULL;
 
-	radeon_do_release(dev);
 }
 
 int radeon_driver_open(struct drm_device *dev, struct drm_file *file_priv)

linux-2.6-e1000-corrupt-eeprom-checksum.patch:

Index: linux-2.6-e1000-corrupt-eeprom-checksum.patch
===================================================================
RCS file: linux-2.6-e1000-corrupt-eeprom-checksum.patch
diff -N linux-2.6-e1000-corrupt-eeprom-checksum.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-e1000-corrupt-eeprom-checksum.patch	21 May 2008 23:55:13 -0000	1.3
@@ -0,0 +1,25 @@
+diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
+index 7c5b05a..603150b 100644
+--- a/drivers/net/e1000/e1000_main.c
++++ b/drivers/net/e1000/e1000_main.c
+@@ -258,6 +258,10 @@ static int debug = NETIF_MSG_DRV | NETIF_MSG_PROBE;
+ module_param(debug, int, 0);
+ MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
+ 
++static int eeprom_bad_csum_allow = 0;
++module_param(eeprom_bad_csum_allow, int, 0);
++MODULE_PARM_DESC(eeprom_bas_csum_allow, "Allow bad eeprom checksums");
++
+ /**
+  * e1000_init_module - Driver Registration Routine
+  *
+@@ -1081,7 +1085,8 @@ e1000_probe(struct pci_dev *pdev,
+ 		 * interface after manually setting a hw addr using
+ 		 * `ip set address`
+ 		 */
+-		memset(adapter->hw.mac_addr, 0, netdev->addr_len);
++		if (!eeprom_bad_csum_allow)
++			memset(adapter->hw.mac_addr, 0, netdev->addr_len);
+ 	} else {
+ 		/* copy the MAC address out of the EEPROM */
+ 		if (e1000_read_mac_addr(&adapter->hw))

linux-2.6-e1000-ich9.patch:

Index: linux-2.6-e1000-ich9.patch
===================================================================
RCS file: linux-2.6-e1000-ich9.patch
diff -N linux-2.6-e1000-ich9.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-e1000-ich9.patch	21 May 2008 23:55:13 -0000	1.3
@@ -0,0 +1,29 @@
+diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
+index 8f8139d..22c49ec 100644
+--- a/drivers/net/e1000e/ich8lan.c
++++ b/drivers/net/e1000e/ich8lan.c
+@@ -209,6 +209,12 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
+ 
+ 	/* Verify phy id */
+ 	switch (phy->id) {
++	case 0x0:
++		if (hw->adapter->pdev->device == 0x10be)
++			hw_dbg(hw, "got 0 phy id, trying anyway");
++			/* Fall through to IGP03E1000 case below */
++		else
++			return -E1000_ERR_PHY;
+ 	case IGP03E1000_E_PHY_ID:
+ 		phy->type = e1000_phy_igp_3;
+ 		phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
+diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
+index 3031d6d..932b4d8 100644
+--- a/drivers/net/e1000e/netdev.c
++++ b/drivers/net/e1000e/netdev.c
+@@ -4095,6 +4095,7 @@ static struct pci_device_id e1000_pci_tbl[] = {
+ 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IFE_G), board_ich9lan },
+ 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IFE_GT), board_ich9lan },
+ 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_AMT), board_ich9lan },
++	{ PCI_VDEVICE(INTEL, 0x10be), board_ich9lan },
+ 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_C), board_ich9lan },
+ 
+ 	{ }	/* terminate list */

linux-2.6-efika-not-chrp.patch:

--- NEW FILE linux-2.6-efika-not-chrp.patch ---
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 5ab4c84..723422e 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2240,6 +2240,14 @@ static void __init fixup_device_tree_efika(void)
 	if (rv != PROM_ERROR && (strcmp(prop, "chrp") == 0))
 		prom_setprop(node, "/", "device_type", "efika", sizeof("efika"));
 
+	/* CODEGEN,description is exposed in /proc/cpuinfo so
+	   change that too */
+	rv = prom_getprop(node, "CODEGEN,description", prop, sizeof(prop));
+	if (rv != PROM_ERROR && (strstr(prop, "CHRP")))
+		prom_setprop(node, "/", "CODEGEN,description",
+			     "Efika 5200B PowerPC System",
+			     sizeof("Efika 5200B PowerPC System"));
+
 	/* Fixup bestcomm interrupts property */
 	node = call_prom("finddevice", 1, 1, ADDR("/builtin/bestcomm"));
 	if (PHANDLE_VALID(node)) {

linux-2.6-ext34-xattr-fix.patch:

--- NEW FILE linux-2.6-ext34-xattr-fix.patch ---
>From stable-bounces at linux.kernel.org Wed May 14 19:45:26 2008
From: Tiger Yang <tiger.yang at oracle.com>
Date: Thu, 15 May 2008 02:45:18 GMT
Subject: ext3/4: fix uninitialized bs in ext3/4_xattr_set_handle()
To: jejb at kernel.org, stable at kernel.org
Message-ID: <200805150245.m4F2jI8E020348 at hera.kernel.org>

From: Tiger Yang <tiger.yang at oracle.com>

commit 7e01c8e5420b6c7f9d85d34c15d8c7a15c9fc720 upstream

This fix the uninitialized bs when we try to replace a xattr entry in
ibody with the new value which require more than free space.

This situation only happens we format ext3/4 with inode size more than 128 and
we have put xattr entries both in ibody and block.  The consequences about
this bug is we will lost the xattr block which pointed by i_file_acl with all
xattr entires in it.  We will alloc a new xattr block and put that large value
entry in it.  The old xattr block will become orphan block.

Signed-off-by: Tiger Yang <tiger.yang at oracle.com>
Cc: <linux-ext4 at vger.kernel.org>
Cc: Andreas Gruenbacher <agruen at suse.de>
Acked-by: Andreas Dilger <adilger at sun.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

---
 fs/ext3/xattr.c |    5 +++++
 fs/ext4/xattr.c |    5 +++++
 2 files changed, 10 insertions(+)

--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -1000,6 +1000,11 @@ ext3_xattr_set_handle(handle_t *handle, 
 			i.value = NULL;
 			error = ext3_xattr_block_set(handle, inode, &i, &bs);
 		} else if (error == -ENOSPC) {
+			if (EXT3_I(inode)->i_file_acl && !bs.s.base) {
+				error = ext3_xattr_block_find(inode, &i, &bs);
+				if (error)
+					goto cleanup;
+			}
 			error = ext3_xattr_block_set(handle, inode, &i, &bs);
 			if (error)
 				goto cleanup;
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1011,6 +1011,11 @@ ext4_xattr_set_handle(handle_t *handle, 
 			i.value = NULL;
 			error = ext4_xattr_block_set(handle, inode, &i, &bs);
 		} else if (error == -ENOSPC) {
+			if (EXT4_I(inode)->i_file_acl && !bs.s.base) {
+				error = ext4_xattr_block_find(inode, &i, &bs);
+				if (error)
+					goto cleanup;
+			}
 			error = ext4_xattr_block_set(handle, inode, &i, &bs);
 			if (error)
 				goto cleanup;


linux-2.6-imac-transparent-bridge.patch:

--- NEW FILE linux-2.6-imac-transparent-bridge.patch ---
--- linux/arch/powerpc/platforms/powermac/pci.c~	2008-03-22 19:08:07.000000000 +0000
+++ linux/arch/powerpc/platforms/powermac/pci.c	2008-03-23 09:10:46.000000000 +0000
@@ -1271,6 +1271,12 @@ void pmac_pci_fixup_pciata(struct pci_de
 	}
 }
 DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, pmac_pci_fixup_pciata);
+#else /* CONFIG_PPC64 */
+static void __devinit imac_transparent_bridge(struct pci_dev *dev)
+{
+	dev->transparent = 1;
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, 0x005b, imac_transparent_bridge);
 #endif /* CONFIG_PPC32 */
 
 /*

linux-2.6-powerpc-zImage-32MiB.patch:

--- NEW FILE linux-2.6-powerpc-zImage-32MiB.patch ---
--- linux-2.6.24.ppc64/arch/powerpc/boot/zImage.lds.S~	2008-01-24 22:58:37.000000000 +0000
+++ linux-2.6.24.ppc64/arch/powerpc/boot/zImage.lds.S	2008-03-26 16:56:50.000000000 +0000
@@ -3,7 +3,7 @@ ENTRY(_zimage_start)
 EXTERN(_zimage_start)
 SECTIONS
 {
-  . = (4*1024*1024);
+  . = (32*1024*1024);
   _start = .;
   .text      :
   {

linux-2.6-ppc-rtc.patch:

--- NEW FILE linux-2.6-ppc-rtc.patch ---
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 1e6715e..3e788b7 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -461,4 +461,12 @@ config RTC_DRV_RS5C313
 	help
 	  If you say yes here you get support for the Ricoh RS5C313 RTC chips.
 
+config RTC_DRV_PPC
+       tristate "PowerPC machine dependent RTC support"
+       depends on PPC_MERGE
+       help
+         The PowerPC kernel has machine-specific functions for accessing
+	 the RTC. This exposes that functionality through the generic RTC
+	 class.
+
 endif # RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 465db4d..e822e56 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -49,3 +49,4 @@ obj-$(CONFIG_RTC_DRV_TEST)	+= rtc-test.o
 obj-$(CONFIG_RTC_DRV_V3020)	+= rtc-v3020.o
 obj-$(CONFIG_RTC_DRV_VR41XX)	+= rtc-vr41xx.o
 obj-$(CONFIG_RTC_DRV_X1205)	+= rtc-x1205.o
+obj-$(CONFIG_RTC_DRV_PPC)	+= rtc-ppc.o
--- /dev/null	2007-12-03 03:08:41.854157978 +0000
+++ b/drivers/rtc/rtc-ppc.c	2007-12-03 16:56:15.000000000 +0000
@@ -0,0 +1,69 @@
+/*
+ * RTC driver for ppc_md RTC functions
+ *
+ * © 2007 Red Hat, Inc.
+ *
+ * Author: David Woodhouse <dwmw2 at infradead.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/rtc.h>
+#include <linux/platform_device.h>
+#include <asm/machdep.h>
+
+static int ppc_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+	ppc_md.get_rtc_time(tm);
+	return 0;
+}
+
+static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+	return ppc_md.set_rtc_time(tm);
+}
+
+static const struct rtc_class_ops ppc_rtc_ops = {
+	.set_time = ppc_rtc_set_time,
+	.read_time = ppc_rtc_read_time,
+};
+
+static struct rtc_device *rtc;
+static struct platform_device *ppc_rtc_pdev;
+
+static int __init ppc_rtc_init(void)
+{
+	if (!ppc_md.get_rtc_time || !ppc_md.set_rtc_time)
+		return -ENODEV;
+
+	ppc_rtc_pdev = platform_device_register_simple("ppc-rtc", 0, NULL, 0);
+	if (IS_ERR(ppc_rtc_pdev))
+		return PTR_ERR(ppc_rtc_pdev);
+
+	rtc = rtc_device_register("ppc_md", &ppc_rtc_pdev->dev,
+				  &ppc_rtc_ops, THIS_MODULE);
+	if (IS_ERR(rtc)) {
+		platform_device_unregister(ppc_rtc_pdev);
+		return PTR_ERR(rtc);
+	}
+
+	return 0;
+}
+
+static void __exit ppc_rtc_exit(void)
+{
+	rtc_device_unregister(rtc);
+	platform_device_unregister(ppc_rtc_pdev);
+}
+
+module_init(ppc_rtc_init);
+module_exit(ppc_rtc_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("David Woodhouse <dwmw2 at infradead.org>");
+MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");

linux-2.6-ppc-use-libgcc.patch:

--- NEW FILE linux-2.6-ppc-use-libgcc.patch ---
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 4bb023f..63e68d2 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -23,3 +23,5 @@ obj-$(CONFIG_SMP)	+= locks.o
 endif
 
 obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
+
+obj-y	+=	libgcc/
diff --git a/arch/powerpc/lib/libgcc/Makefile b/arch/powerpc/lib/libgcc/Makefile
new file mode 100644
index 0000000..36d8e1e
--- /dev/null
+++ b/arch/powerpc/lib/libgcc/Makefile
@@ -0,0 +1,2 @@
+obj-y	+=	__divdi3.o
+obj-y	+=	__udivmoddi4.o
diff --git a/arch/powerpc/lib/libgcc/__divdi3.c b/arch/powerpc/lib/libgcc/__divdi3.c
new file mode 100644
index 0000000..f23c6fe
--- /dev/null
+++ b/arch/powerpc/lib/libgcc/__divdi3.c
@@ -0,0 +1,23 @@
+#include "libgcc.h"
+
+s64 __divdi3(s64 num, s64 den)
+{
+	int minus = 0;
+	s64 v;
+
+	if (num < 0) {
+		num = -num;
+		minus = 1;
+	}
+	if (den < 0) {
+		den = -den;
+		minus ^= 1;
+	}
+
+	v = __udivmoddi4(num, den, NULL);
+	if (minus)
+		v = -v;
+
+	return v;
+}
+EXPORT_SYMBOL(__divdi3);
diff --git a/arch/powerpc/lib/libgcc/__udivmoddi4.c b/arch/powerpc/lib/libgcc/__udivmoddi4.c
new file mode 100644
index 0000000..2df0caa
--- /dev/null
+++ b/arch/powerpc/lib/libgcc/__udivmoddi4.c
@@ -0,0 +1,31 @@
+#include "libgcc.h"
+
+u64 __udivmoddi4(u64 num, u64 den, u64 * rem_p)
+{
+	u64 quot = 0, qbit = 1;
+
+	if (den == 0) {
+		BUG();
+	}
+
+	/* Left-justify denominator and count shift */
+	while ((s64) den >= 0) {
+		den <<= 1;
+		qbit <<= 1;
+	}
+
+	while (qbit) {
+		if (den <= num) {
+			num -= den;
+			quot += qbit;
+		}
+		den >>= 1;
+		qbit >>= 1;
+	}
+
+	if (rem_p)
+		*rem_p = num;
+
+	return quot;
+}
+EXPORT_SYMBOL(__udivmoddi4);
diff --git a/arch/powerpc/lib/libgcc/libgcc.h b/arch/powerpc/lib/libgcc/libgcc.h
new file mode 100644
index 0000000..4dd6a2e
--- /dev/null
+++ b/arch/powerpc/lib/libgcc/libgcc.h
@@ -0,0 +1,12 @@
+#ifndef _LIBGCC_H_
+#define _LIBGCC_H_
+
+#include <linux/types.h>
+#include <linux/module.h>
+
+/* Cribbed from klibc/libgcc/ */
+
+s64 __divdi3(s64 num, s64 den);
+u64 __udivmoddi4(u64 num, u64 den, u64 * rem_p);
+
+#endif /*_LIBGCC_H_*/

linux-2.6-vio-modalias.patch:

--- NEW FILE linux-2.6-vio-modalias.patch ---
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index f988672..12a0851 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -294,9 +294,27 @@ static ssize_t devspec_show(struct device *dev,
 	return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
 }
 
+static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+			     char *buf)
+{
+	const struct vio_dev *vio_dev = to_vio_dev(dev);
+	struct device_node *dn;
+	const char *cp;
+
+	dn = dev->archdata.of_node;
+	if (!dn)
+		return -ENODEV;
+	cp = of_get_property(dn, "compatible", NULL);
+	if (!cp)
+		return -ENODEV;
+
+	return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
+}
+
 static struct device_attribute vio_dev_attrs[] = {
 	__ATTR_RO(name),
 	__ATTR_RO(devspec),
+	__ATTR_RO(modalias),
 	__ATTR_NULL
 };
 

linux-2.6-windfarm-pm121-fix.patch:

--- NEW FILE linux-2.6-windfarm-pm121-fix.patch ---
--- linux-2.6.24.ppc64/drivers/macintosh/windfarm_pm121.c~	2008-03-22 19:13:22.000000000 +0000
+++ linux-2.6.24.ppc64/drivers/macintosh/windfarm_pm121.c	2008-03-23 09:05:54.000000000 +0000
@@ -867,7 +867,7 @@ static struct wf_control* pm121_register
 {
 	if (controls[id] == NULL && !strcmp(ct->name, match)) {
 		if (wf_get_control(ct) == 0)
-			controls[FAN_OD] = ct;
+			controls[id] = ct;
 	}
 	return controls[id];
 }
@@ -879,10 +879,10 @@ static void pm121_new_control(struct wf_
 	if (pm121_all_controls_ok)
 		return;
 
-	all = all && pm121_register_control(ct, "optical-driver-fan", FAN_OD);
-	all = all && pm121_register_control(ct, "hard-driver-fan", FAN_HD);
-	all = all && pm121_register_control(ct, "cpu-driver-fan", FAN_CPU);
-	all = all && pm121_register_control(ct, "cpufreq-clamp", CPUFREQ);
+	all = pm121_register_control(ct, "optical-drive-fan", FAN_OD) && all;
+	all = pm121_register_control(ct, "hard-drive-fan", FAN_HD) && all;
+	all = pm121_register_control(ct, "cpu-fan", FAN_CPU) && all;
+	all = pm121_register_control(ct, "cpufreq-clamp", CPUFREQ) && all;
 
 	if (all)
 		pm121_all_controls_ok = 1;
@@ -909,24 +909,24 @@ static void pm121_new_sensor(struct wf_s
 	if (pm121_all_sensors_ok)
 		return;
 
-	all = all && pm121_register_sensor(sr, "cpu-temp",
-					   &sensor_cpu_temp);
-	all = all && pm121_register_sensor(sr, "cpu-current",
-					   &sensor_cpu_current);
-	all = all && pm121_register_sensor(sr, "cpu-voltage",
-					   &sensor_cpu_voltage);
-	all = all && pm121_register_sensor(sr, "cpu-power",
-					   &sensor_cpu_power);
-	all = all && pm121_register_sensor(sr, "hard-drive-temp",
-					   &sensor_hard_drive_temp);
-	all = all && pm121_register_sensor(sr, "optical-drive-temp",
-					   &sensor_optical_drive_temp);
-	all = all && pm121_register_sensor(sr, "incoming-air-temp",
-					   &sensor_incoming_air_temp);
-	all = all && pm121_register_sensor(sr, "north-bridge-temp",
-					   &sensor_north_bridge_temp);
-	all = all && pm121_register_sensor(sr, "gpu-temp",
-					   &sensor_gpu_temp);
+	all = pm121_register_sensor(sr, "cpu-temp",
+				    &sensor_cpu_temp) && all;
+	all = pm121_register_sensor(sr, "cpu-current",
+				    &sensor_cpu_current) && all;
+	all = pm121_register_sensor(sr, "cpu-voltage",
+				    &sensor_cpu_voltage) && all;
+	all = pm121_register_sensor(sr, "cpu-power",
+				    &sensor_cpu_power) && all;
+	all = pm121_register_sensor(sr, "hard-drive-temp",
+				    &sensor_hard_drive_temp) && all;
+	all = pm121_register_sensor(sr, "optical-drive-temp",
+				    &sensor_optical_drive_temp) && all;
+	all = pm121_register_sensor(sr, "incoming-air-temp",
+				    &sensor_incoming_air_temp) && all;
+	all = pm121_register_sensor(sr, "north-bridge-temp",
+				    &sensor_north_bridge_temp) && all;
+	all = pm121_register_sensor(sr, "gpu-temp",
+				    &sensor_gpu_temp) && all;
 
 	if (all)
 		pm121_all_sensors_ok = 1;

linux-2.6-windfarm-pm121.patch:

--- NEW FILE linux-2.6-windfarm-pm121.patch ---
>From linuxppc-dev-bounces+dwmw2=infradead.org at ozlabs.org Sat Jan 26 11:57:27 2008
Return-path: <linuxppc-dev-bounces+dwmw2=infradead.org at ozlabs.org>
Envelope-to: dwmw2 at baythorne.infradead.org
Delivery-date: Sat, 26 Jan 2008 11:57:28 +0000
Received: from pentafluge.infradead.org ([2001:770:15f::1]) by
	baythorne.infradead.org with esmtps (Exim 4.68 #1 (Red Hat Linux)) id
	1JIjf4-0007PK-Lq for dwmw2 at baythorne.infradead.org; Sat, 26 Jan 2008
	11:57:27 +0000
Received: from ozlabs.org ([203.10.76.45]) by pentafluge.infradead.org with
	esmtps (Exim 4.68 #1 (Red Hat Linux)) id 1JIjep-0002yH-Db for
	dwmw2 at infradead.org; Sat, 26 Jan 2008 11:57:25 +0000
Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix)
	with ESMTP id 3F138DDE42 for <dwmw2 at infradead.org>; Sat, 26 Jan 2008
	22:57:07 +1100 (EST)
X-Original-To: linuxppc-dev at ozlabs.org
Delivered-To: linuxppc-dev at ozlabs.org
Received: from fg-out-1718.google.com (fg-out-1718.google.com
	[72.14.220.158]) by ozlabs.org (Postfix) with ESMTP id C34F2DDE05 for
	<linuxppc-dev at ozlabs.org>; Sat, 26 Jan 2008 22:56:53 +1100 (EST)
Received: by fg-out-1718.google.com with SMTP id 16so871497fgg.39 for
	<linuxppc-dev at ozlabs.org>; Sat, 26 Jan 2008 03:56:50 -0800 (PST)
Received: by 10.86.50.8 with SMTP id x8mr2930559fgx.30.1201348610311; Sat,
	26 Jan 2008 03:56:50 -0800 (PST)
Received: from ?192.168.0.1? ( [82.243.217.90]) by mx.google.com with
	ESMTPS id e11sm3476258fga.5.2008.01.26.03.56.47 (version=TLSv1/SSLv3
	cipher=RC4-MD5); Sat, 26 Jan 2008 03:56:48 -0800 (PST)
Subject: [PATCH] windfarm: add PowerMac 12,1 support
From: =?ISO-8859-1?Q?=C9tienne?= Bersac <bersace03 at gmail.com>
To: linuxppc-dev <linuxppc-dev at ozlabs.org>
Date: Sat, 26 Jan 2008 12:55:25 +0100
Message-Id: <1201348525.6859.1.camel at thilivren>
Mime-Version: 1.0
X-Mailer: Evolution 2.12.1 
X-BeenThere: linuxppc-dev at ozlabs.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>
List-Unsubscribe: <https://ozlabs.org/mailman/listinfo/linuxppc-dev>,
	<mailto:linuxppc-dev-request at ozlabs.org?subject=unsubscribe>
List-Archive: <http://ozlabs.org/pipermail/linuxppc-dev>
List-Post: <mailto:linuxppc-dev at ozlabs.org>
List-Help: <mailto:linuxppc-dev-request at ozlabs.org?subject=help>
List-Subscribe: <https://ozlabs.org/mailman/listinfo/linuxppc-dev>,
	<mailto:linuxppc-dev-request at ozlabs.org?subject=subscribe>
Content-Type: text/plain; charset="utf-8"
Sender: linuxppc-dev-bounces+dwmw2=infradead.org at ozlabs.org
Errors-To: linuxppc-dev-bounces+dwmw2=infradead.org at ozlabs.org
X-Spam-Score: 0.0 (/)
X-Evolution-Source: imap://dwmw2@pentafluge.infradead.org/
Content-Transfer-Encoding: 8bit

From: Étienne Bersac <bersace at gmail.com>

Implement a new driver named windfarm_pm121 which drive fans on PowerMac
12,1 machine : iMac G5 iSight (rev C) 17" and 20". It's based on
windfarm_pm81 driver from Benjamin Herrenschmidt.

Signed-off-by: Étienne Bersac <bersace at gmail.com>
---

Implement fan control for PowerMac 12,1 machines. This needs update to
windfarm_lm75 and windfarm_max6690 sensors drivers in order to properly
match sensors by their location. The code is based on windfarm_pm81
driver, adapted to the complexity of PowerMac 12,1 : 4 system control
loops instead of one, per-control target correction and per-model
control rubber-banding.

All the data are copied from Darwin 8.10 AppleMacRISC4PE-185.0.0 module
as well as correction formula.

diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index 3673dd2..4c048b3 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_defconfig
@@ -667,6 +667,7 @@ CONFIG_WINDFARM=y
 CONFIG_WINDFARM_PM81=y
 CONFIG_WINDFARM_PM91=y
 CONFIG_WINDFARM_PM112=y
+CONFIG_WINDFARM_PM121=y
 # CONFIG_PMAC_RACKMETER is not set
 CONFIG_NETDEVICES=y
 # CONFIG_NETDEVICES_MULTIQUEUE is not set
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index 77f50b6..2d028e6 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -234,6 +234,14 @@ config WINDFARM_PM112
 	  which are the recent dual and quad G5 machines using the
 	  970MP dual-core processor.
 
+config WINDFARM_PM121
+	tristate "Support for thermal management on PowerMac12,1"
+	depends on WINDFARM && I2C && PMAC_SMU
+	select I2C_POWERMAC
+	help
+	  This driver provides thermal control for the PowerMac12,1
+	  which is the iMac G5 (iSight) 970MP
+
 config ANSLCD
 	tristate "Support for ANS LCD display"
 	depends on ADB_CUDA && PPC_PMAC
diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile
index 2dfc3f4..e3132ef 100644
--- a/drivers/macintosh/Makefile
+++ b/drivers/macintosh/Makefile
@@ -42,4 +42,9 @@ obj-$(CONFIG_WINDFARM_PM112)	+= windfarm_pm112.o windfarm_smu_sat.o \
 				   windfarm_smu_sensors.o \
 				   windfarm_max6690_sensor.o \
 				   windfarm_lm75_sensor.o windfarm_pid.o
+obj-$(CONFIG_WINDFARM_PM121)	+= windfarm_pm121.o windfarm_smu_sat.o \
+				   windfarm_smu_controls.o \
+				   windfarm_smu_sensors.o \
+				   windfarm_max6690_sensor.o \
+				   windfarm_lm75_sensor.o windfarm_pid.o
 obj-$(CONFIG_PMAC_RACKMETER)	+= rack-meter.o
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
index 7e10c3a..b92b959 100644
--- a/drivers/macintosh/windfarm_lm75_sensor.c
+++ b/drivers/macintosh/windfarm_lm75_sensor.c
@@ -127,6 +127,12 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
 	 */
 	if (!strcmp(loc, "Hard drive") || !strcmp(loc, "DRIVE BAY"))
 		lm->sens.name = "hd-temp";
+	else if (!strcmp(loc, "Incoming Air Temp"))
+		lm->sens.name = "incoming-air-temp";
+	else if (!strcmp(loc, "ODD Temp"))
+		lm->sens.name = "optical-drive-temp";
+	else if (!strcmp(loc, "HD Temp"))
+		lm->sens.name = "hard-drive-temp";
 	else
 		goto fail;
 
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
index 5f03aab..e207a90 100644
--- a/drivers/macintosh/windfarm_max6690_sensor.c
+++ b/drivers/macintosh/windfarm_max6690_sensor.c
@@ -77,18 +77,28 @@ static struct wf_sensor_ops wf_max6690_ops = {
 	.owner		= THIS_MODULE,
 };
 
-static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr)
+static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr,
+			      const char *loc)
 {
 	struct wf_6690_sensor *max;
-	char *name = "backside-temp";
+	char *name;
 
 	max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL);
 	if (max == NULL) {
 		printk(KERN_ERR "windfarm: Couldn't create MAX6690 sensor %s: "
-		       "no memory\n", name);
+		       "no memory\n", loc);
 		return;
 	}
 
+	if (!strcmp(loc, "BACKSIDE"))
+		name = "backside-temp";
+	else if (!strcmp(loc, "NB Ambient"))
+		name = "north-bridge-temp";
+	else if (!strcmp(loc, "GPU Ambient"))
+		name = "gpu-temp";
+	else
+		goto fail;
+
 	max->sens.ops = &wf_max6690_ops;
 	max->sens.name = name;
 	max->i2c.addr = addr >> 1;
@@ -138,9 +148,7 @@ static int wf_max6690_attach(struct i2c_adapter *adapter)
 		if (loc == NULL || addr == 0)
 			continue;
 		printk("found max6690, loc=%s addr=0x%02x\n", loc, addr);
-		if (strcmp(loc, "BACKSIDE"))
-			continue;
-		wf_max6690_create(adapter, addr);
+		wf_max6690_create(adapter, addr, loc);
 	}
 
 	return 0;
diff --git a/drivers/macintosh/windfarm_pm121.c b/drivers/macintosh/windfarm_pm121.c
new file mode 100644
index 0000000..5276156
--- /dev/null
+++ b/drivers/macintosh/windfarm_pm121.c
@@ -0,0 +1,1040 @@
+/*
+ * Windfarm PowerMac thermal control. iMac G5 iSight
+ *
+ * (c) Copyright 2007 Étienne Bersac <bersace at gmail.com>
+ *
+ * Bits & pieces from windfarm_pm81.c by (c) Copyright 2005 Benjamin
+ * Herrenschmidt, IBM Corp. <benh at kernel.crashing.org>
+ *
+ * Released under the term of the GNU GPL v2.
+ *
+ *
+ *
+ * PowerMac12,1
+ * ============
+ *
+ *
+ * The algorithm used is the PID control algorithm, used the same way
+ * the published Darwin code does, using the same values that are
+ * present in the Darwin 8.10 snapshot property lists (note however
+ * that none of the code has been re-used, it's a complete
+ * re-implementation
+ *
+ * There is two models using PowerMac12,1. Model 2 is iMac G5 iSight
+ * 17" while Model 3 is iMac G5 20". They do have both the same
+ * controls with a tiny difference. The control-ids of hard-drive-fan
+ * and cpu-fan is swapped.
+ *
+ *
+ * Target Correction :
+ *
+ * controls have a target correction calculated as :
+ *
+ * new_min = ((((average_power * slope) >> 16) + offset) >> 16) + min_value
+ * new_value = max(new_value, max(new_min, 0))
+ *
+ * OD Fan control correction.
+ *
+ * # model_id: 2
+ *   offset		: -19563152
+ *   slope		:  1956315
+ *
+ * # model_id: 3
+ *   offset		: -15650652
+ *   slope		:  1565065
+ *
+ * HD Fan control correction.
+ *
+ * # model_id: 2
+ *   offset		: -15650652
+ *   slope		:  1565065
+ *
+ * # model_id: 3
+ *   offset		: -19563152
+ *   slope		:  1956315
+ *
+ * CPU Fan control correction.
+ *
+ * # model_id: 2
+ *   offset		: -25431900
+ *   slope		:  2543190
+ *
+ * # model_id: 3
+ *   offset		: -15650652
+ *   slope		:  1565065
+ *
+ *
+ * Target rubber-banding :
+ *
+ * Some controls have a target correction which depends on another
+ * control value. The correction is computed in the following way :
+ *
+ * new_min = ref_value * slope + offset
+ *
+ * ref_value is the value of the reference control. If new_min is
+ * greater than 0, then we correct the target value using :
+ *
+ * new_target = max (new_target, new_min >> 16)
+ *
+ *
+ * # model_id : 2
+ *   control	: cpu-fan
+ *   ref	: optical-drive-fan
+ *   offset	: -15650652
+ *   slope	: 1565065
+ *
+ * # model_id : 3
+ *   control	: optical-drive-fan
+ *   ref	: hard-drive-fan
+ *   offset	: -32768000
+ *   slope	: 65536
+ *
+ *
+ * In order to have the moste efficient correction with those
+ * dependencies, we must trigger HD loop before OD loop before CPU
+ * loop.
+ *
+ *
+ * The various control loops found in Darwin config file are:
+ *
+ * HD Fan control loop.
+ *
+ * # model_id: 2
+ *   control        : hard-drive-fan
+ *   sensor         : hard-drive-temp
+ *   PID params     : G_d = 0x00000000
+ *                    G_p = 0x002D70A3
+ *                    G_r = 0x00019999
+ *                    History = 2 entries
+ *                    Input target = 0x370000
+ *                    Interval = 5s
+ *
+ * # model_id: 3
+ *   control        : hard-drive-fan
+ *   sensor         : hard-drive-temp
+ *   PID params     : G_d = 0x00000000
+ *                    G_p = 0x002170A3
+ *                    G_r = 0x00019999
+ *                    History = 2 entries
+ *                    Input target = 0x370000
+ *                    Interval = 5s
+ *
+ * OD Fan control loop.
+ *
+ * # model_id: 2
+ *   control        : optical-drive-fan
+ *   sensor         : optical-drive-temp
+ *   PID params     : G_d = 0x00000000
+ *                    G_p = 0x001FAE14
+ *                    G_r = 0x00019999
+ *                    History = 2 entries
+ *                    Input target = 0x320000
+ *                    Interval = 5s
+ *
+ * # model_id: 3
+ *   control        : optical-drive-fan
+ *   sensor         : optical-drive-temp
+ *   PID params     : G_d = 0x00000000
+ *                    G_p = 0x001FAE14
+ *                    G_r = 0x00019999
+ *                    History = 2 entries
+ *                    Input target = 0x320000
+ *                    Interval = 5s
+ *
+ * GPU Fan control loop.
+ *
+ * # model_id: 2
+ *   control        : hard-drive-fan
+ *   sensor         : gpu-temp
+ *   PID params     : G_d = 0x00000000
+ *                    G_p = 0x002A6666
+ *                    G_r = 0x00019999
+ *                    History = 2 entries
+ *                    Input target = 0x5A0000
+ *                    Interval = 5s
+ *
+ * # model_id: 3
+ *   control        : cpu-fan
+ *   sensor         : gpu-temp
+ *   PID params     : G_d = 0x00000000
+ *                    G_p = 0x0010CCCC
+ *                    G_r = 0x00019999
+ *                    History = 2 entries
+ *                    Input target = 0x500000
+ *                    Interval = 5s
+ *
+ * KODIAK (aka northbridge) Fan control loop.
+ *
+ * # model_id: 2
+ *   control        : optical-drive-fan
+ *   sensor         : north-bridge-temp
+ *   PID params     : G_d = 0x00000000
+ *                    G_p = 0x003BD70A
+ *                    G_r = 0x00019999
+ *                    History = 2 entries
+ *                    Input target = 0x550000
+ *                    Interval = 5s
+ *
+ * # model_id: 3
+ *   control        : hard-drive-fan
+ *   sensor         : north-bridge-temp
+ *   PID params     : G_d = 0x00000000
+ *                    G_p = 0x0030F5C2
+ *                    G_r = 0x00019999
+ *                    History = 2 entries
+ *                    Input target = 0x550000
+ *                    Interval = 5s
+ *
+ * CPU Fan control loop.
+ *
+ *   control        : cpu-fan
+ *   sensors        : cpu-temp, cpu-power
+ *   PID params     : from SDB partition
+ *
+ *
+ * CPU Slew control loop.
+ *
+ *   control        : cpufreq-clamp
+ *   sensor         : cpu-temp
+ *
+ */
+
+#undef	DEBUG
+
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/spinlock.h>
+#include <linux/wait.h>
+#include <linux/kmod.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <asm/prom.h>
+#include <asm/machdep.h>
+#include <asm/io.h>
+#include <asm/system.h>
+#include <asm/sections.h>
+#include <asm/smu.h>
+
+#include "windfarm.h"
+#include "windfarm_pid.h"
+
+#define VERSION "0.3"
+
+static int pm121_mach_model;	/* machine model id */
+
+/* Controls & sensors */
+static struct wf_sensor	*sensor_cpu_power;
+static struct wf_sensor	*sensor_cpu_temp;
+static struct wf_sensor	*sensor_cpu_voltage;
+static struct wf_sensor	*sensor_cpu_current;
+static struct wf_sensor	*sensor_gpu_temp;
+static struct wf_sensor	*sensor_north_bridge_temp;
+static struct wf_sensor	*sensor_hard_drive_temp;
+static struct wf_sensor	*sensor_optical_drive_temp;
+static struct wf_sensor	*sensor_incoming_air_temp; /* unused ! */
+
+enum {
+	FAN_CPU,
+	FAN_HD,
+	FAN_OD,
+	CPUFREQ,
+	N_CONTROLS
+};
+static struct wf_control *controls[N_CONTROLS] = {};
+
+/* Set to kick the control loop into life */
+static int pm121_all_controls_ok, pm121_all_sensors_ok, pm121_started;
+
+enum {
+	FAILURE_FAN		= 1 << 0,
+	FAILURE_SENSOR		= 1 << 1,
+	FAILURE_OVERTEMP	= 1 << 2
+};
+
+/* All sys loops. Note the HD before the OD loop in order to have it
+   run before. */
+enum {
+	LOOP_GPU,		/* control = hd or cpu, but luckily,
+				   it doesn't matter */
+	LOOP_HD,		/* control = hd */
+	LOOP_KODIAK,		/* control = hd or od */
+	LOOP_OD,		/* control = od */
+	N_LOOPS
+};
+
+static const char *loop_names[N_LOOPS] = {
+	"GPU",
+	"HD",
+	"KODIAK",
+	"OD",
+};
+
+#define	PM121_NUM_CONFIGS	2
+
+static unsigned int pm121_failure_state;
+static int pm121_readjust, pm121_skipping;
+static s32 average_power;
+
+struct pm121_correction {
+	int	offset;
+	int	slope;
+};
+
+static struct pm121_correction corrections[N_CONTROLS][PM121_NUM_CONFIGS] = {
+	/* FAN_OD */
+	{
+		/* MODEL 2 */
+		{ .offset	= -19563152,
+		  .slope	=  1956315
+		},
+		/* MODEL 3 */
+		{ .offset	= -15650652,
+		  .slope	=  1565065
+		},
+	},
+	/* FAN_HD */
+	{
+		/* MODEL 2 */
+		{ .offset	= -15650652,
+		  .slope	=  1565065
+		},
+		/* MODEL 3 */
+		{ .offset	= -19563152,
+		  .slope	=  1956315
+		},
+	},
+	/* FAN_CPU */
+	{
+		/* MODEL 2 */
+		{ .offset	= -25431900,
+		  .slope	=  2543190
+		},
+		/* MODEL 3 */
+		{ .offset	= -15650652,
+		  .slope	=  1565065
+		},
+	},
+	/* CPUFREQ has no correction (and is not implemented at all) */
+};
+
+struct pm121_connection {
+	unsigned int	control_id;
+	unsigned int	ref_id;
+	struct pm121_correction	correction;
+};
+
+static struct pm121_connection pm121_connections[] = {
+	/* MODEL 2 */
+	{ .control_id	= FAN_CPU,
+	  .ref_id	= FAN_OD,
+	  { .offset	= -32768000,
+	    .slope	=  65536
+	  }
+	},
+	/* MODEL 3 */
+	{ .control_id	= FAN_OD,
+	  .ref_id	= FAN_HD,
+	  { .offset	= -32768000,
+	    .slope	=  65536
+	  }
+	},
+};
+
+/* pointer to the current model connection */
+static struct pm121_connection *pm121_connection;
+
+/*
+ * ****** System Fans Control Loop ******
+ *
+ */
+
+/* Since each loop handles only one control and we want to avoid
+ * writing virtual control, we store the control correction with the
+ * loop params. Some data are not set, there are common to all loop
+ * and thus, hardcoded.
+ */
+struct pm121_sys_param {
+	/* purely informative since we use mach_model-2 as index */
+	int			model_id;
+	struct wf_sensor	**sensor; /* use sensor_id instead ? */
+	s32			gp, itarget;
+	unsigned int		control_id;
+};
+
+static struct pm121_sys_param
+pm121_sys_all_params[N_LOOPS][PM121_NUM_CONFIGS] = {
+	/* GPU Fan control loop */
+	{
+		{ .model_id	= 2,
+		  .sensor	= &sensor_gpu_temp,
+		  .gp		= 0x002A6666,
+		  .itarget	= 0x5A0000,
+		  .control_id	= FAN_HD,
+		},
+		{ .model_id	= 3,
+		  .sensor	= &sensor_gpu_temp,
+		  .gp		= 0x0010CCCC,
+		  .itarget	= 0x500000,
+		  .control_id	= FAN_CPU,
+		},
+	},
+	/* HD Fan control loop */
+	{
+		{ .model_id	= 2,
+		  .sensor	= &sensor_hard_drive_temp,
+		  .gp		= 0x002D70A3,
+		  .itarget	= 0x370000,
+		  .control_id	= FAN_HD,
+		},
+		{ .model_id	= 3,
+		  .sensor	= &sensor_hard_drive_temp,
+		  .gp		= 0x002170A3,
+		  .itarget	= 0x370000,
+		  .control_id	= FAN_HD,
+		},
+	},
+	/* KODIAK Fan control loop */
+	{
+		{ .model_id	= 2,
+		  .sensor	= &sensor_north_bridge_temp,
+		  .gp		= 0x003BD70A,
+		  .itarget	= 0x550000,
+		  .control_id	= FAN_OD,
+		},
+		{ .model_id	= 3,
+		  .sensor	= &sensor_north_bridge_temp,
+		  .gp		= 0x0030F5C2,
+		  .itarget	= 0x550000,
+		  .control_id	= FAN_HD,
+		},
+	},
+	/* OD Fan control loop */
+	{
+		{ .model_id	= 2,
+		  .sensor	= &sensor_optical_drive_temp,
+		  .gp		= 0x001FAE14,
+		  .itarget	= 0x320000,
+		  .control_id	= FAN_OD,
+		},
+		{ .model_id	= 3,
+		  .sensor	= &sensor_optical_drive_temp,
+		  .gp		= 0x001FAE14,
+		  .itarget	= 0x320000,
+		  .control_id	= FAN_OD,
+		},
+	},
+};
+
+/* the hardcoded values */
+#define	PM121_SYS_GD		0x00000000
+#define	PM121_SYS_GR		0x00019999
+#define	PM121_SYS_HISTORY_SIZE	2
+#define	PM121_SYS_INTERVAL	5
+
+/* State data used by the system fans control loop
+ */
+struct pm121_sys_state {
+	int			ticks;
+	s32			setpoint;
+	struct wf_pid_state	pid;
+};
+
+struct pm121_sys_state *pm121_sys_state[N_LOOPS] = {};
+
+/*
+ * ****** CPU Fans Control Loop ******
+ *
+ */
+
+#define PM121_CPU_INTERVAL	1
+
+/* State data used by the cpu fans control loop
+ */
+struct pm121_cpu_state {
+	int			ticks;
+	s32			setpoint;
+	struct wf_cpu_pid_state	pid;
+};
+
+static struct pm121_cpu_state *pm121_cpu_state;
+
+
+
+/*
+ * ***** Implementation *****
+ *
+ */
+
+/* correction the value using the output-low-bound correction algo */
+static s32 pm121_correct(s32 new_setpoint,
+			 unsigned int control_id,
+			 s32 min)
+{
+	s32 new_min;
+	struct pm121_correction *correction;
+	correction = &corrections[control_id][pm121_mach_model - 2];
+
+	new_min = (average_power * correction->slope) >> 16;
+	new_min += correction->offset;
+	new_min = (new_min >> 16) + min;
+
+	return max(new_setpoint, max(new_min, 0));
+}
+
+static s32 pm121_connect(unsigned int control_id, s32 setpoint)
+{
+	s32 new_min, value, new_setpoint;
+
+	if (pm121_connection->control_id == control_id) {
+		controls[control_id]->ops->get_value(controls[control_id],
+						     &value);
+		new_min = value * pm121_connection->correction.slope;
+		new_min += pm121_connection->correction.offset;
+		if (new_min > 0) {
+			new_setpoint = max(setpoint, (new_min >> 16));
+			if (new_setpoint != setpoint) {
+				pr_debug("pm121: %s depending on %s, "
+					 "corrected from %d to %d RPM\n",
+					 controls[control_id]->name,
+					 controls[pm121_connection->ref_id]->name,
+					 (int) setpoint, (int) new_setpoint);
+			}
+		} else
+			new_setpoint = setpoint;
+	}
+	/* no connection */
+	else
+		new_setpoint = setpoint;
+
+	return new_setpoint;
+}
+
+/* FAN LOOPS */
+static void pm121_create_sys_fans(int loop_id)
+{
+	struct pm121_sys_param *param = NULL;
+	struct wf_pid_param pid_param;
+	struct wf_control *control = NULL;
+	int i;
+
+	/* First, locate the params for this model */
+	for (i = 0; i < PM121_NUM_CONFIGS; i++) {
+		if (pm121_sys_all_params[loop_id][i].model_id == pm121_mach_model) {
+			param = &(pm121_sys_all_params[loop_id][i]);
+			break;
+		}
+	}
+
+	/* No params found, put fans to max */
+	if (param == NULL) {
+		printk(KERN_WARNING "pm121: %s fan config not found "
+		       " for this machine model\n",
+		       loop_names[loop_id]);
+		goto fail;
+	}
+
+	control = controls[param->control_id];
+
+	/* Alloc & initialize state */
+	pm121_sys_state[loop_id] = kmalloc(sizeof(struct pm121_sys_state),
+					   GFP_KERNEL);
+	if (pm121_sys_state[loop_id] == NULL) {
+		printk(KERN_WARNING "pm121: Memory allocation error\n");
+		goto fail;
+	}
+	pm121_sys_state[loop_id]->ticks = 1;
+
+	/* Fill PID params */
+	pid_param.gd		= PM121_SYS_GD;
+	pid_param.gp		= param->gp;
+	pid_param.gr		= PM121_SYS_GR;
+	pid_param.interval	= PM121_SYS_INTERVAL;
+	pid_param.history_len	= PM121_SYS_HISTORY_SIZE;
+	pid_param.itarget	= param->itarget;
+	pid_param.min		= control->ops->get_min(control);
+	pid_param.max		= control->ops->get_max(control);
+
+	wf_pid_init(&pm121_sys_state[loop_id]->pid, &pid_param);
+
+	pr_debug("pm121: %s Fan control loop initialized.\n"
+		 "       itarged=%d.%03d, min=%d RPM, max=%d RPM\n",
+		 loop_names[loop_id], FIX32TOPRINT(pid_param.itarget),
+		 pid_param.min, pid_param.max);
+	return;
+
+ fail:
+	/* note that this is not optimal since another loop may still
+	   control the same control */
+	printk(KERN_WARNING "pm121: failed to set up %s loop "
+	       "setting \"%s\" to max speed.\n",
+	       loop_names[loop_id], control->name);
+
+	if (control)
+		wf_control_set_max(control);
+}
+
+static void pm121_sys_fans_tick(int loop_id)
+{
+	struct pm121_sys_param *param;
+	struct pm121_sys_state *st;
+	struct wf_sensor *sensor;
+	struct wf_control *control;
+	s32 temp, new_setpoint;
+	int rc;
+
+	param = &(pm121_sys_all_params[loop_id][pm121_mach_model-2]);
+	st = pm121_sys_state[loop_id];
+	sensor = *(param->sensor);
+	control = controls[param->control_id];
+
+	if (--st->ticks != 0) {
+		if (pm121_readjust)
+			goto readjust;
+		return;
+	}
+	st->ticks = PM121_SYS_INTERVAL;
+
+	rc = sensor->ops->get_value(sensor, &temp);
+	if (rc) {
+		printk(KERN_WARNING "windfarm: %s sensor error %d\n",
+		       sensor->name, rc);
+		pm121_failure_state |= FAILURE_SENSOR;
+		return;
+	}
+
+	pr_debug("pm121: %s Fan tick ! %s: %d.%03d\n",
+		 loop_names[loop_id], sensor->name,
+		 FIX32TOPRINT(temp));
+
+	new_setpoint = wf_pid_run(&st->pid, temp);
+
+	/* correction */
+	new_setpoint = pm121_correct(new_setpoint,
+				     param->control_id,
+				     st->pid.param.min);
+	/* linked corretion */
+	new_setpoint = pm121_connect(param->control_id, new_setpoint);
+
+	if (new_setpoint == st->setpoint)
+		return;
+	st->setpoint = new_setpoint;
+	pr_debug("pm121: %s corrected setpoint: %d RPM\n",
+		 control->name, (int)new_setpoint);
+ readjust:
+	if (control && pm121_failure_state == 0) {
+		rc = control->ops->set_value(control, st->setpoint);
+		if (rc) {
+			printk(KERN_WARNING "windfarm: %s fan error %d\n",
+			       control->name, rc);
+			pm121_failure_state |= FAILURE_FAN;
+		}
+	}
+}
+
+
+/* CPU LOOP */
+static void pm121_create_cpu_fans(void)
+{
+	struct wf_cpu_pid_param pid_param;
+	const struct smu_sdbp_header *hdr;
+	struct smu_sdbp_cpupiddata *piddata;
+	struct smu_sdbp_fvt *fvt;
+	struct wf_control *fan_cpu;
+	s32 tmax, tdelta, maxpow, powadj;
+
+	fan_cpu = controls[FAN_CPU];
+
+	/* First, locate the PID params in SMU SBD */
+	hdr = smu_get_sdb_partition(SMU_SDB_CPUPIDDATA_ID, NULL);
+	if (hdr == 0) {
+		printk(KERN_WARNING "pm121: CPU PID fan config not found.\n");
+		goto fail;
+	}
+	piddata = (struct smu_sdbp_cpupiddata *)&hdr[1];
+
+	/* Get the FVT params for operating point 0 (the only supported one
+	 * for now) in order to get tmax
+	 */
+	hdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL);
+	if (hdr) {
+		fvt = (struct smu_sdbp_fvt *)&hdr[1];
+		tmax = ((s32)fvt->maxtemp) << 16;
+	} else
+		tmax = 0x5e0000; /* 94 degree default */
+
+	/* Alloc & initialize state */
+	pm121_cpu_state = kmalloc(sizeof(struct pm121_cpu_state),
+				  GFP_KERNEL);
+	if (pm121_cpu_state == NULL)
+		goto fail;
+	pm121_cpu_state->ticks = 1;
+
+	/* Fill PID params */
+	pid_param.interval = PM121_CPU_INTERVAL;
+	pid_param.history_len = piddata->history_len;
+	if (pid_param.history_len > WF_CPU_PID_MAX_HISTORY) {
+		printk(KERN_WARNING "pm121: History size overflow on "
+		       "CPU control loop (%d)\n", piddata->history_len);
+		pid_param.history_len = WF_CPU_PID_MAX_HISTORY;
+	}
+	pid_param.gd = piddata->gd;
+	pid_param.gp = piddata->gp;
+	pid_param.gr = piddata->gr / pid_param.history_len;
+
+	tdelta = ((s32)piddata->target_temp_delta) << 16;
+	maxpow = ((s32)piddata->max_power) << 16;
+	powadj = ((s32)piddata->power_adj) << 16;
+
+	pid_param.tmax = tmax;
+	pid_param.ttarget = tmax - tdelta;
+	pid_param.pmaxadj = maxpow - powadj;
+
+	pid_param.min = fan_cpu->ops->get_min(fan_cpu);
+	pid_param.max = fan_cpu->ops->get_max(fan_cpu);
+
+	wf_cpu_pid_init(&pm121_cpu_state->pid, &pid_param);
+
+	pr_debug("pm121: CPU Fan control initialized.\n");
+	pr_debug("       ttarged=%d.%03d, tmax=%d.%03d, min=%d RPM, max=%d RPM,\n",
+		 FIX32TOPRINT(pid_param.ttarget), FIX32TOPRINT(pid_param.tmax),
+		 pid_param.min, pid_param.max);
+
+	return;
+
+ fail:
+	printk(KERN_WARNING "pm121: CPU fan config not found, max fan speed\n");
+
+	if (controls[CPUFREQ])
+		wf_control_set_max(controls[CPUFREQ]);
+	if (fan_cpu)
+		wf_control_set_max(fan_cpu);
+}
+
+
+static void pm121_cpu_fans_tick(struct pm121_cpu_state *st)
+{
+	s32 new_setpoint, temp, power;
+	struct wf_control *fan_cpu = NULL;
+	int rc;
+
+	if (--st->ticks != 0) {
+		if (pm121_readjust)
+			goto readjust;
+		return;
+	}
+	st->ticks = PM121_CPU_INTERVAL;
+
+	fan_cpu = controls[FAN_CPU];
+
+	rc = sensor_cpu_temp->ops->get_value(sensor_cpu_temp, &temp);
+	if (rc) {
+		printk(KERN_WARNING "pm121: CPU temp sensor error %d\n",
+		       rc);
+		pm121_failure_state |= FAILURE_SENSOR;
+		return;
+	}
+
+	rc = sensor_cpu_power->ops->get_value(sensor_cpu_power, &power);
+	if (rc) {
+		printk(KERN_WARNING "pm121: CPU power sensor error %d\n",
+		       rc);
+		pm121_failure_state |= FAILURE_SENSOR;
+		return;
+	}
+
+	pr_debug("pm121: CPU Fans tick ! CPU temp: %d.%03d°C, power: %d.%03d\n",
+		 FIX32TOPRINT(temp), FIX32TOPRINT(power));
+
+	if (temp > st->pid.param.tmax)
+		pm121_failure_state |= FAILURE_OVERTEMP;
+
+	new_setpoint = wf_cpu_pid_run(&st->pid, power, temp);
+
+	/* correction */
+	new_setpoint = pm121_correct(new_setpoint,
+				     FAN_CPU,
+				     st->pid.param.min);
+
+	/* connected correction */
+	new_setpoint = pm121_connect(FAN_CPU, new_setpoint);
+
+	if (st->setpoint == new_setpoint)
+		return;
+	st->setpoint = new_setpoint;
+	pr_debug("pm121: CPU corrected setpoint: %d RPM\n", (int)new_setpoint);
+
+ readjust:
+	if (fan_cpu && pm121_failure_state == 0) {
+		rc = fan_cpu->ops->set_value(fan_cpu, st->setpoint);
+		if (rc) {
+			printk(KERN_WARNING "pm121: %s fan error %d\n",
+			       fan_cpu->name, rc);
+			pm121_failure_state |= FAILURE_FAN;
+		}
+	}
+}
+
+/*
+ * ****** Common ******
+ *
+ */
+
+static void pm121_tick(void)
+{
+	unsigned int last_failure = pm121_failure_state;
+	unsigned int new_failure;
+	s32 total_power;
+	int i;
+
+	if (!pm121_started) {
+		pr_debug("pm121: creating control loops !\n");
+		for (i = 0; i < N_LOOPS; i++)
+			pm121_create_sys_fans(i);
+
+		pm121_create_cpu_fans();
+		pm121_started = 1;
+	}
+
+	/* skipping ticks */
+	if (pm121_skipping && --pm121_skipping)
+		return;
+
+	/* compute average power */
+	total_power = 0;
+	for (i = 0; i < pm121_cpu_state->pid.param.history_len; i++)
+		total_power += pm121_cpu_state->pid.powers[i];
+
+	average_power = total_power / pm121_cpu_state->pid.param.history_len;
+
+
+	pm121_failure_state = 0;
+	for (i = 0 ; i < N_LOOPS; i++) {
+		if (pm121_sys_state[i])
+			pm121_sys_fans_tick(i);
+	}
+
+	if (pm121_cpu_state)
+		pm121_cpu_fans_tick(pm121_cpu_state);
+
+	pm121_readjust = 0;
+	new_failure = pm121_failure_state & ~last_failure;
+
+	/* If entering failure mode, clamp cpufreq and ramp all
+	 * fans to full speed.
+	 */
+	if (pm121_failure_state && !last_failure) {
+		for (i = 0; i < N_CONTROLS; i++) {
+			if (controls[i])
+				wf_control_set_max(controls[i]);
+		}
+	}
+
+	/* If leaving failure mode, unclamp cpufreq and readjust
+	 * all fans on next iteration
+	 */
+	if (!pm121_failure_state && last_failure) {
+		if (controls[CPUFREQ])
+			wf_control_set_min(controls[CPUFREQ]);
+		pm121_readjust = 1;
+	}
+
+	/* Overtemp condition detected, notify and start skipping a couple
+	 * ticks to let the temperature go down
+	 */
+	if (new_failure & FAILURE_OVERTEMP) {
+		wf_set_overtemp();
+		pm121_skipping = 2;
+	}
+
+	/* We only clear the overtemp condition if overtemp is cleared
+	 * _and_ no other failure is present. Since a sensor error will
+	 * clear the overtemp condition (can't measure temperature) at
+	 * the control loop levels, but we don't want to keep it clear
+	 * here in this case
+	 */
+	if (new_failure == 0 && last_failure & FAILURE_OVERTEMP)
+		wf_clear_overtemp();
+}
+
+
+static struct wf_control* pm121_register_control(struct wf_control *ct,
+						 const char *match,
+						 unsigned int id)
+{
+	if (controls[id] == NULL && !strcmp(ct->name, match)) {
+		if (wf_get_control(ct) == 0)
+			controls[FAN_OD] = ct;
+	}
+	return controls[id];
+}
+
+static void pm121_new_control(struct wf_control *ct)
+{
+	int all = 1;
+
+	if (pm121_all_controls_ok)
+		return;
+
+	all = all && pm121_register_control(ct, "optical-driver-fan", FAN_OD);
+	all = all && pm121_register_control(ct, "hard-driver-fan", FAN_HD);
+	all = all && pm121_register_control(ct, "cpu-driver-fan", FAN_CPU);
+	all = all && pm121_register_control(ct, "cpufreq-clamp", CPUFREQ);
+
+	if (all)
+		pm121_all_controls_ok = 1;
+}
+
+
+
+
+static struct wf_sensor* pm121_register_sensor(struct wf_sensor *sensor,
+					       const char *match,
+					       struct wf_sensor **var)
+{
+	if (*var == NULL && !strcmp(sensor->name, match)) {
+		if (wf_get_sensor(sensor) == 0)
+			*var = sensor;
+	}
+	return *var;
+}
+
+static void pm121_new_sensor(struct wf_sensor *sr)
+{
+	int all = 1;
+
+	if (pm121_all_sensors_ok)
+		return;
+
+	all = all && pm121_register_sensor(sr, "cpu-temp",
+					   &sensor_cpu_temp);
+	all = all && pm121_register_sensor(sr, "cpu-current",
+					   &sensor_cpu_current);
+	all = all && pm121_register_sensor(sr, "cpu-voltage",
+					   &sensor_cpu_voltage);
+	all = all && pm121_register_sensor(sr, "cpu-power",
+					   &sensor_cpu_power);
+	all = all && pm121_register_sensor(sr, "hard-drive-temp",
+					   &sensor_hard_drive_temp);
+	all = all && pm121_register_sensor(sr, "optical-drive-temp",
+					   &sensor_optical_drive_temp);
+	all = all && pm121_register_sensor(sr, "incoming-air-temp",
+					   &sensor_incoming_air_temp);
+	all = all && pm121_register_sensor(sr, "north-bridge-temp",
+					   &sensor_north_bridge_temp);
+	all = all && pm121_register_sensor(sr, "gpu-temp",
+					   &sensor_gpu_temp);
+
+	if (all)
+		pm121_all_sensors_ok = 1;
+}
+
+
+
+static int pm121_notify(struct notifier_block *self,
+			unsigned long event, void *data)
+{
+	switch (event) {
+	case WF_EVENT_NEW_CONTROL:
+		pr_debug("pm121: new control %s detected\n",
+			 ((struct wf_control *)data)->name);
+		pm121_new_control(data);
+		break;
+	case WF_EVENT_NEW_SENSOR:
+		pr_debug("pm121: new sensor %s detected\n",
+			 ((struct wf_sensor *)data)->name);
+		pm121_new_sensor(data);
+		break;
+	case WF_EVENT_TICK:
+		if (pm121_all_controls_ok && pm121_all_sensors_ok)
+			pm121_tick();
+		break;
+	}
+
+	return 0;
+}
+
+static struct notifier_block pm121_events = {
+	.notifier_call	= pm121_notify,
+};
+
+static int pm121_init_pm(void)
+{
+	const struct smu_sdbp_header *hdr;
+
+	hdr = smu_get_sdb_partition(SMU_SDB_SENSORTREE_ID, NULL);
+	if (hdr != 0) {
+		struct smu_sdbp_sensortree *st =
+			(struct smu_sdbp_sensortree *)&hdr[1];
+		pm121_mach_model = st->model_id;
+	}
+
+	pm121_connection = &pm121_connections[pm121_mach_model - 2];
+
+	printk(KERN_INFO "pm121: Initializing for iMac G5 iSight model ID %d\n",
+	       pm121_mach_model);
+
+	return 0;
+}
+
+
+static int pm121_probe(struct platform_device *ddev)
+{
+	wf_register_client(&pm121_events);
+
+	return 0;
+}
+
+static int __devexit pm121_remove(struct platform_device *ddev)
+{
+	wf_unregister_client(&pm121_events);
+	return 0;
+}
+
+static struct platform_driver pm121_driver = {
+	.probe = pm121_probe,
+	.remove = __devexit_p(pm121_remove),
+	.driver = {
+		.name = "windfarm",
+		.bus = &platform_bus_type,
+	},
+};
+
+
+static int __init pm121_init(void)
+{
+	int rc = -ENODEV;
+
+	if (machine_is_compatible("PowerMac12,1"))
+		rc = pm121_init_pm();
+
+	if (rc == 0) {
+		request_module("windfarm_smu_controls");
+		request_module("windfarm_smu_sensors");
+		request_module("windfarm_smu_sat");
+		request_module("windfarm_lm75_sensor");
+		request_module("windfarm_max6690_sensor");
+		request_module("windfarm_cpufreq_clamp");
+		platform_driver_register(&pm121_driver);
+	}
+
+	return rc;
+}
+
+static void __exit pm121_exit(void)
+{
+
+	platform_driver_unregister(&pm121_driver);
+}
+
+
+module_init(pm121_init);
+module_exit(pm121_exit);
+
+MODULE_AUTHOR("Étienne Bersac <bersace at gmail.com>");
+MODULE_DESCRIPTION("Thermal control logic for iMac G5 (iSight)");
+MODULE_LICENSE("GPL");
+
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
index 58c2590..961fa0e 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -218,6 +218,10 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
 		fct->ctrl.name = "cpu-fan";
 	else if (!strcmp(l, "Hard Drive") || !strcmp(l, "Hard drive"))
 		fct->ctrl.name = "drive-bay-fan";
+	else if (!strcmp(l, "HDD Fan")) /* seen on iMac G5 iSight */
+		fct->ctrl.name = "hard-drive-fan";
+	else if (!strcmp(l, "ODD Fan")) /* same */
+		fct->ctrl.name = "optical-drive-fan";
 
 	/* Unrecognized fan, bail out */
 	if (fct->ctrl.name == NULL)



_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev at ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev
linux-2.6-x86-dont-map-vdso-when-disabled.patch:

--- NEW FILE linux-2.6-x86-dont-map-vdso-when-disabled.patch ---
From: Roland McGrath <roland at redhat.com>
Date: Wed, 9 Apr 2008 08:30:06 +0000 (-0700)
Subject: x86 vDSO: don't map 32-bit vdso when disabled
X-Git-Tag: v2.6.26-rc1~1154^2~608
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=5de253cc5b1f565f7aeb5bacd67bac37e943ceef

x86 vDSO: don't map 32-bit vdso when disabled

We map a VMA for the 32-bit vDSO even when it's disabled, which is stupid.
For the 32-bit kernel it's the vdso_enabled boot parameter/sysctl
and for the 64-bit kernel it's the vdso32 boot parameter/syscall32 sysctl.

When it's disabled, we don't pass AT_SYSINFO_EHDR so processes don't use
the vDSO for anything, but we still map it.  For the non-compat vDSO,
this means we're always putting an extra VMA somewhere, maybe lousing
up the control of the address space the user was hoping for.

Honor the setting by doing nothing in arch_setup_additional_pages.

[ also see: "x86 vDSO: don't use disabled vDSO for signal trampoline" ]

Signed-off-by: Roland McGrath <roland at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---

diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 348f134..f7e78d8 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -325,6 +325,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
 	int ret = 0;
 	bool compat;
 
+	if (vdso_enabled == VDSO_DISABLED)
+		return 0;
+
 	down_write(&mm->mmap_sem);
 
 	/* Test compat mode once here, in case someone

linux-2.6-x86-dont-read-maxlvt-if-apic-unmapped.patch:

--- NEW FILE linux-2.6-x86-dont-read-maxlvt-if-apic-unmapped.patch ---
x86: don't read maxlvt before checking if APIC is mapped

A check for unmapped apic was added before reading maxlvt but the early
read of maxlvt wasn't removed.

Signed-off-by: Chuck Ebbert <cebbert at redhat.com>

Index: linux-2.6.25.noarch/arch/x86/kernel/apic_64.c
===================================================================
--- linux-2.6.25.noarch.orig/arch/x86/kernel/apic_64.c
+++ linux-2.6.25.noarch/arch/x86/kernel/apic_64.c
@@ -524,7 +524,7 @@ int setup_profiling_timer(unsigned int m
  */
 void clear_local_APIC(void)
 {
-	int maxlvt = lapic_get_maxlvt();
+	int maxlvt;
 	u32 v;
 
 	/* APIC hasn't been mapped yet */

linux-2.6-x86-dont-use-disabled-vdso-for-signals.patch:

--- NEW FILE linux-2.6-x86-dont-use-disabled-vdso-for-signals.patch ---
From: Roland McGrath <roland at redhat.com>
Date: Wed, 9 Apr 2008 08:29:27 +0000 (-0700)
Subject: x86 vDSO: don't use disabled vDSO for signal trampoline
X-Git-Tag: v2.6.26-rc1~1154^2~609
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=1a3e4ca41c5a38975023a6e8831c309d3322889c

x86 vDSO: don't use disabled vDSO for signal trampoline

If the vDSO was not mapped, don't use it as the "restorer" for a signal
handler.  Whether we have a pointer in mm->context.vdso depends on what
happened at exec time, so we shouldn't check any global flags now.

Background:

Currently, every 32-bit exec gets the vDSO mapped even if it's disabled
(the process just doesn't get told about it).  Because it's in fact
always there, the bug that this patch fixes cannot happen now.  With
the second patch, it won't be mapped at all when it's disabled, which is
one of the things that people might really want when they disable it (so
nothing they didn't ask for goes into their address space).

The 32-bit signal handler setup when SA_RESTORER is not used refers to
current->mm->context.vdso without regard to whether the vDSO has been
disabled when the process was exec'd.  This patch fixes this not to use
it when it's null, which becomes possible after the second patch. (This
never happens in normal use, because glibc's sigaction call uses
SA_RESTORER unless glibc detected the vDSO.)

Signed-off-by: Roland McGrath <roland at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 5e7771a..05e155d 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -468,7 +468,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
 		restorer = ka->sa.sa_restorer;
 	} else {
 		/* Return stub is in 32bit vsyscall page */
-		if (current->binfmt->hasvdso)
+		if (current->mm->context.vdso)
 			restorer = VDSO32_SYMBOL(current->mm->context.vdso,
 						 sigreturn);
 		else
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index 0157a6f..011c62f 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -365,7 +365,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
 			goto give_sigsegv;
 	}
 
-	if (current->binfmt->hasvdso)
+	if (current->mm->context.vdso)
 		restorer = VDSO32_SYMBOL(current->mm->context.vdso, sigreturn);
 	else
 		restorer = &frame->retcode;

linux-2.6-x86-fix-asm-constraint-in-do_IRQ.patch:

--- NEW FILE linux-2.6-x86-fix-asm-constraint-in-do_IRQ.patch ---
From: Jan Beulich <jbeulich at novell.com>
Date: Tue, 22 Apr 2008 15:16:50 +0000 (+0100)
Subject: i386: fix asm constraint in do_IRQ()
X-Git-Tag: v2.6.26-rc1~1045^2~27
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=5065dbafc299507f16731434e95b91dadff03006

i386: fix asm constraint in do_IRQ()

Two prior changes resulted in the "ecx" clobber being lost.

Signed-off-by: Jan Beulich <jbeulich at novell.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---

diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 6ea67b7..00bda7b 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -134,7 +134,7 @@ unsigned int do_IRQ(struct pt_regs *regs)
 			: "=a" (arg1), "=d" (arg2), "=b" (bx)
 			:  "0" (irq),   "1" (desc),  "2" (isp),
 			   "D" (desc->handle_irq)
-			: "memory", "cc"
+			: "memory", "cc", "ecx"
 		);
 	} else
 #endif

linux-2.6-x86-pci-revert-remove-default-rom-allocation.patch:

--- NEW FILE linux-2.6-x86-pci-revert-remove-default-rom-allocation.patch ---
From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Fri, 9 May 2008 01:41:48 +0000 (-0700)
Subject: Revert "PCI: remove default PCI expansion ROM memory allocation"
X-Git-Tag: v2.6.26-rc2~25
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=8d539108560ec121d59eee05160236488266221c

Revert "PCI: remove default PCI expansion ROM memory allocation"

This reverts commit 9f8daccaa05c14e5643bdd4faf5aed9cc8e6f11e, which was
reported to break X startup (xf86-video-ati-6.8.0). See

	http://bugs.freedesktop.org/show_bug.cgi?id=15523

for details.

Reported-by: Laurence Withers <l at lwithers.me.uk>
Cc: Gary Hade <garyhade at us.ibm.com>
Cc: Greg KH <greg at kroah.com>
Cc: Jan Beulich <jbeulich at novell.com>
Cc: "Jun'ichi Nomura" <j-nomura at ce.jp.nec.com>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Ingo Molnar <mingo at elte.hu>
Cc: Thomas Gleixner <tglx at linutronix.de>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
[cebbert at redhat.com: backport, remove first hunk to make port easier]

diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -141,12 +128,8 @@ void __init dmi_check_skip_isa_align(void)
 
 void __devinit  pcibios_fixup_bus(struct pci_bus *b)
 {
-	struct pci_dev *dev;
-
 	pcibios_fixup_ghosts(b);
 	pci_read_bridge_bases(b);
-	list_for_each_entry(dev, &b->devices, bus_list)
-		pcibios_fixup_device_resources(dev);
 }
 
 /*

linux-2.6-xfs-small-buffer-reads.patch:

--- NEW FILE linux-2.6-xfs-small-buffer-reads.patch ---
Fix memory corruption with small buffer reads

When we have multiple buffers in a single page for a blocksize == pagesize
filesystem we might overwrite the page contents if two callers hit it
shortly after each other.  To prevent that we need to keep the page
locked until I/O is completed and the page marked uptodate.

Thanks to Eric Sandeen for triaging this bug and finding a reproducible
testcase and Dave Chinner for additional advice.

This should fix kernel.org bz #10421.


Signed-off-by: Christoph Hellwig <hch at lst.de>
Tested-by: Eric Sandeen <sandeen at sandeen.net>

Date:  Fri May 16 12:10:56 AEST 2008
Workarea:  chook.melbourne.sgi.com:/build/dgc/isms/2.6.x-xfs
Inspected by:  hch at lst.de

The following file(s) were checked into:
  longdrop.melbourne.sgi.com:/isms/linux/2.6.x-xfs-melb


Modid:  xfs-linux-melb:xfs-kern:31173a
fs/xfs/linux-2.6/xfs_buf.h - 1.125 - changed
http://oss.sgi.com/cgi-bin/cvsweb.cgi/linux/fs/xfs-2.6/xfs_buf.h.diff?r1=text&tr1=1.125&r2=text&tr2=1.124&f=h
	- Reintroduce page locking for sub-blocksize buffer read synchronisation.

fs/xfs/linux-2.6/xfs_buf.c - 1.256 - changed
http://oss.sgi.com/cgi-bin/cvsweb.cgi/linux/fs/xfs-2.6/xfs_buf.c.diff?r1=text&tr1=1.256&r2=text&tr2=1.255&f=h
	- Reintroduce page locking for sub-blocksize buffer read synchronisation.

--- linux.orig/fs/xfs/linux-2.6/xfs_buf.h	2008/04/10 04:27:53	1.124
+++ linux/fs/xfs/linux-2.6/xfs_buf.h	2008/05/16 04:28:49	1.125
@@ -66,6 +66,25 @@ typedef enum {
 	_XBF_PAGES = (1 << 18),	    /* backed by refcounted pages	   */
 	_XBF_RUN_QUEUES = (1 << 19),/* run block device task queue	   */
 	_XBF_DELWRI_Q = (1 << 21),   /* buffer on delwri queue		   */
+
+	/*
+	 * Special flag for supporting metadata blocks smaller than a FSB.
+	 *
+	 * In this case we can have multiple xfs_buf_t on a single page and
+	 * need to lock out concurrent xfs_buf_t readers as they only
+	 * serialise access to the buffer.
+	 *
+	 * If the FSB size >= PAGE_CACHE_SIZE case, we have no serialisation
+	 * between reads of the page. Hence we can have one thread read the
+	 * page and modify it, but then race with another thread that thinks
+	 * the page is not up-to-date and hence reads it again.
+	 *
+	 * The result is that the first modifcation to the page is lost.
+	 * This sort of AGF/AGI reading race can happen when unlinking inodes
+	 * that require truncation and results in the AGI unlinked list
+	 * modifications being lost.
+	 */
+	_XBF_PAGE_LOCKED = (1 << 22),
 } xfs_buf_flags_t;
 
 typedef enum {
--- linux.orig/fs/xfs/linux-2.6/xfs_buf.c	2008/05/09 04:27:47	1.255
+++ linux/fs/xfs/linux-2.6/xfs_buf.c	2008/05/16 04:28:49	1.256
@@ -386,6 +386,8 @@ _xfs_buf_lookup_pages(
 		if (unlikely(page == NULL)) {
 			if (flags & XBF_READ_AHEAD) {
 				bp->b_page_count = i;
+				for (i = 0; i < bp->b_page_count; i++)
+					unlock_page(bp->b_pages[i]);
 				return -ENOMEM;
 			}
 
@@ -415,17 +417,24 @@ _xfs_buf_lookup_pages(
 		ASSERT(!PagePrivate(page));
 		if (!PageUptodate(page)) {
 			page_count--;
-			if (blocksize < PAGE_CACHE_SIZE && !PagePrivate(page)) {
+			if (blocksize >= PAGE_CACHE_SIZE) {
+				if (flags & XBF_READ)
+					bp->b_flags |= _XBF_PAGE_LOCKED;
+			} else if (!PagePrivate(page)) {
 				if (test_page_region(page, offset, nbytes))
 					page_count++;
 			}
 		}
 
-		unlock_page(page);
 		bp->b_pages[i] = page;
 		offset = 0;
 	}
 
+	if (!(bp->b_flags & _XBF_PAGE_LOCKED)) {
+		for (i = 0; i < bp->b_page_count; i++)
+			unlock_page(bp->b_pages[i]);
+	}
+
 	if (page_count == bp->b_page_count)
 		bp->b_flags |= XBF_DONE;
 
@@ -746,6 +755,7 @@ xfs_buf_associate_memory(
 	bp->b_count_desired = len;
 	bp->b_buffer_length = buflen;
 	bp->b_flags |= XBF_MAPPED;
+	bp->b_flags &= ~_XBF_PAGE_LOCKED;
 
 	return 0;
 }
@@ -1093,8 +1103,10 @@ _xfs_buf_ioend(
 	xfs_buf_t		*bp,
 	int			schedule)
 {
-	if (atomic_dec_and_test(&bp->b_io_remaining) == 1)
+	if (atomic_dec_and_test(&bp->b_io_remaining) == 1) {
+		bp->b_flags &= ~_XBF_PAGE_LOCKED;
 		xfs_buf_ioend(bp, schedule);
+	}
 }
 
 STATIC void
@@ -1125,6 +1137,9 @@ xfs_buf_bio_end_io(
 
 		if (--bvec >= bio->bi_io_vec)
 			prefetchw(&bvec->bv_page->flags);
+
+		if (bp->b_flags & _XBF_PAGE_LOCKED)
+			unlock_page(page);
 	} while (bvec >= bio->bi_io_vec);
 
 	_xfs_buf_ioend(bp, 1);
@@ -1163,7 +1178,8 @@ _xfs_buf_ioapply(
 	 * filesystem block size is not smaller than the page size.
 	 */
 	if ((bp->b_buffer_length < PAGE_CACHE_SIZE) &&
-	    (bp->b_flags & XBF_READ) &&
+	    ((bp->b_flags & (XBF_READ|_XBF_PAGE_LOCKED)) ==
+	      (XBF_READ|_XBF_PAGE_LOCKED)) &&
 	    (blocksize >= PAGE_CACHE_SIZE)) {
 		bio = bio_alloc(GFP_NOIO, 1);
 




nouveau-drm-update.patch:

--- NEW FILE nouveau-drm-update.patch ---
commit 2ab03489c6a63b4861736f1904566c95098119bf
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Apr 14 13:38:40 2008 +1000

    nouveau: update to latest drm

diff --git a/drivers/char/drm/drm_mm.c b/drivers/char/drm/drm_mm.c
index 369a052..7d8b670 100644
--- a/drivers/char/drm/drm_mm.c
+++ b/drivers/char/drm/drm_mm.c
@@ -217,6 +217,7 @@ void drm_mm_put_block(struct drm_mm_node * cur)
 		drm_ctl_free(cur, sizeof(*cur), DRM_MEM_MM);
 	}
 }
+EXPORT_SYMBOL(drm_mm_put_block);
 
 struct drm_mm_node *drm_mm_search_free(const struct drm_mm * mm,
 				  unsigned long size,
diff --git a/drivers/char/drm/nouveau_bo.c b/drivers/char/drm/nouveau_bo.c
index 9407bd3..ab3b23a 100644
--- a/drivers/char/drm/nouveau_bo.c
+++ b/drivers/char/drm/nouveau_bo.c
@@ -198,8 +198,8 @@ nouveau_bo_move_m2mf(struct drm_buffer_object *bo, int evict, int no_wait,
 
 /* Flip pages into the GART and move if we can. */
 static int
-nouveau_bo_move_gart(struct drm_buffer_object *bo, int evict, int no_wait,
-                     struct drm_bo_mem_reg *new_mem)
+nouveau_bo_move_flipd(struct drm_buffer_object *bo, int evict, int no_wait,
+		      struct drm_bo_mem_reg *new_mem)
 {
         struct drm_device *dev = bo->dev;
         struct drm_bo_mem_reg tmp_mem;
@@ -212,11 +212,10 @@ nouveau_bo_move_gart(struct drm_buffer_object *bo, int evict, int no_wait,
 				  DRM_BO_FLAG_FORCE_CACHING);
 
         ret = drm_bo_mem_space(bo, &tmp_mem, no_wait);
-
         if (ret)
                 return ret;
 
-        ret = drm_ttm_bind (bo->ttm, &tmp_mem);
+        ret = drm_ttm_bind(bo->ttm, &tmp_mem);
         if (ret)
                 goto out_cleanup;
 
@@ -234,6 +233,7 @@ out_cleanup:
                 tmp_mem.mm_node = NULL;
                 mutex_unlock(&dev->struct_mutex);
         }
+
         return ret;
 }
 
@@ -246,16 +246,19 @@ nouveau_bo_move(struct drm_buffer_object *bo, int evict, int no_wait,
 	if (new_mem->mem_type == DRM_BO_MEM_LOCAL) {
 		if (old_mem->mem_type == DRM_BO_MEM_LOCAL)
 			return drm_bo_move_memcpy(bo, evict, no_wait, new_mem);
+		if (nouveau_bo_move_flipd(bo, evict, no_wait, new_mem))
 			return drm_bo_move_memcpy(bo, evict, no_wait, new_mem);
 	}
 	else
 	if (old_mem->mem_type == DRM_BO_MEM_LOCAL) {
+		if (1 /*nouveau_bo_move_flips(bo, evict, no_wait, new_mem)*/)
 			return drm_bo_move_memcpy(bo, evict, no_wait, new_mem);
 	}
 	else {
-//		if (nouveau_bo_move_m2mf(bo, evict, no_wait, new_mem))
+		if (nouveau_bo_move_m2mf(bo, evict, no_wait, new_mem))
 			return drm_bo_move_memcpy(bo, evict, no_wait, new_mem);
 	}
+
 	return 0;
 }
 
diff --git a/drivers/char/drm/nouveau_drm.h b/drivers/char/drm/nouveau_drm.h
index 5f07fcb..cf76205 100644
--- a/drivers/char/drm/nouveau_drm.h
+++ b/drivers/char/drm/nouveau_drm.h
@@ -87,6 +87,10 @@ struct drm_nouveau_gpuobj_free {
 #define NOUVEAU_MEM_MAPPED		0x00000100
 #define NOUVEAU_MEM_INSTANCE		0x00000200 /* internal */
 #define NOUVEAU_MEM_NOTIFIER            0x00000400 /* internal */
+#define NOUVEAU_MEM_NOVM		0x00000800 /* internal */
+#define NOUVEAU_MEM_INTERNAL (NOUVEAU_MEM_INSTANCE | \
+			      NOUVEAU_MEM_NOTIFIER | \
+			      NOUVEAU_MEM_NOVM)
 
 struct drm_nouveau_mem_alloc {
 	int flags;
diff --git a/drivers/char/drm/nouveau_drv.h b/drivers/char/drm/nouveau_drv.h
index c338964..a51e552 100644
--- a/drivers/char/drm/nouveau_drv.h
+++ b/drivers/char/drm/nouveau_drv.h
@@ -136,6 +136,7 @@ struct nouveau_channel
 	/* NV50 VM */
 	struct nouveau_gpuobj     *vm_pd;
 	struct nouveau_gpuobj_ref *vm_gart_pt;
+	struct nouveau_gpuobj_ref *vm_vram_pt;
 
 	/* Objects */
 	struct nouveau_gpuobj_ref *ramin; /* Private instmem */
@@ -290,6 +291,9 @@ struct drm_nouveau_private {
 		unsigned long sg_handle;
 	} gart_info;
 
+	/* G8x global VRAM page table */
+	struct nouveau_gpuobj *vm_vram_pt;
+
 	/* the mtrr covering the FB */
 	int fb_mtrr;
 
@@ -432,7 +436,7 @@ extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data,
 /* nouveau_irq.c */
 extern irqreturn_t nouveau_irq_handler(DRM_IRQ_ARGS);
 extern void        nouveau_irq_preinstall(struct drm_device *);
-extern void         nouveau_irq_postinstall(struct drm_device *);
+extern int         nouveau_irq_postinstall(struct drm_device *);
 extern void        nouveau_irq_uninstall(struct drm_device *);
 
 /* nouveau_sgdma.c */
diff --git a/drivers/char/drm/nouveau_fence.c b/drivers/char/drm/nouveau_fence.c
index 59dcf7d..4ad51ae 100644
--- a/drivers/char/drm/nouveau_fence.c
+++ b/drivers/char/drm/nouveau_fence.c
@@ -80,12 +80,11 @@ nouveau_fence_poll(struct drm_device *dev, uint32_t class, uint32_t waiting_type
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
 	struct drm_fence_class_manager *fc = &dev->fm.fence_class[class];
 	struct nouveau_channel *chan = dev_priv->fifos[class];
-	uint32_t pending_types = 0;
 
 	DRM_DEBUG("class=%d\n", class);
 	DRM_DEBUG("pending: 0x%08x 0x%08x\n", waiting_types, fc->waiting_types);
 
-	if (pending_types) {
+	if (waiting_types & DRM_FENCE_TYPE_EXE) {
 		uint32_t sequence = NV_READ(chan->ref_cnt);
 
 		DRM_DEBUG("got 0x%08x\n", sequence);
diff --git a/drivers/char/drm/nouveau_fifo.c b/drivers/char/drm/nouveau_fifo.c
index 056cb6d..d8fda27 100644
--- a/drivers/char/drm/nouveau_fifo.c
+++ b/drivers/char/drm/nouveau_fifo.c
@@ -390,6 +390,34 @@ nouveau_fifo_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
 	return 0;
 }
 
+static int
+nouveau_channel_idle(struct nouveau_channel *chan)
+{
+	struct drm_device *dev = chan->dev;
+	struct drm_nouveau_private *dev_priv = dev->dev_private;
+	struct nouveau_engine *engine = &dev_priv->Engine;
+	uint32_t caches;
+	int idle;
+
+	caches = NV_READ(NV03_PFIFO_CACHES);
+	NV_WRITE(NV03_PFIFO_CACHES, caches & ~1);
+
+	if (engine->fifo.channel_id(dev) != chan->id) {
+		struct nouveau_gpuobj *ramfc = chan->ramfc->gpuobj;
+
+		if (INSTANCE_RD(ramfc, 0) != INSTANCE_RD(ramfc, 1))
+			idle = 0;
+		else
+			idle = 1;
+	} else {
+		idle = (NV_READ(NV04_PFIFO_CACHE1_DMA_GET) ==
+			NV_READ(NV04_PFIFO_CACHE1_DMA_PUT));
+	}
+
+	NV_WRITE(NV03_PFIFO_CACHES, caches);
+	return idle;
+}
+
 /* stops a fifo */
 void nouveau_fifo_free(struct nouveau_channel *chan)
 {
@@ -400,22 +428,9 @@ void nouveau_fifo_free(struct nouveau_channel *chan)
 
 	DRM_INFO("%s: freeing fifo %d\n", __func__, chan->id);
 
-	/* Disable channel switching, if this channel isn't currenly
-	 * active re-enable it if there's still pending commands.
-	 * We really should do a manual context switch here, but I'm
-	 * not sure I trust our ability to do this reliably yet..
-	 */
-	NV_WRITE(NV03_PFIFO_CACHES, 0);
-	if (engine->fifo.channel_id(dev) != chan->id &&
-	    NV_READ(chan->get) != NV_READ(chan->put)) {
-		NV_WRITE(NV03_PFIFO_CACHES, 1);
-	}
-
 	/* Give the channel a chance to idle, wait 2s (hopefully) */
 	t_start = engine->timer.read(dev);
-	while (NV_READ(chan->get) != NV_READ(chan->put) ||
-	       NV_READ(NV03_PFIFO_CACHE1_GET) !=
-	       NV_READ(NV03_PFIFO_CACHE1_PUT)) {
+	while (!nouveau_channel_idle(chan)) {
 		if (engine->timer.read(dev) - t_start > 2000000000ULL) {
 			DRM_ERROR("Failed to idle channel %d before destroy."
 				  "Prepare for strangeness..\n", chan->id);
@@ -433,13 +448,6 @@ void nouveau_fifo_free(struct nouveau_channel *chan)
 	NV_WRITE(NV03_PFIFO_CACHE1_PUSH0, 0x00000000);
 	NV_WRITE(NV04_PFIFO_CACHE1_PULL0, 0x00000000);
 
-	/* stop the fifo, otherwise it could be running and
-	 * it will crash when removing gpu objects
-	 *XXX: from real-world evidence, absolutely useless..
-	 */
-	NV_WRITE(chan->get, chan->pushbuf_base);
-	NV_WRITE(chan->put, chan->pushbuf_base);
-
 	// FIXME XXX needs more code
 
 	engine->fifo.destroy_context(chan);
diff --git a/drivers/char/drm/nouveau_ioc32.c b/drivers/char/drm/nouveau_ioc32.c
index f55ae7a..4f53a50 100644
--- a/drivers/char/drm/nouveau_ioc32.c
+++ b/drivers/char/drm/nouveau_ioc32.c
@@ -57,10 +57,6 @@ long nouveau_compat_ioctl(struct file *filp, unsigned int cmd,
 	if (nr < DRM_COMMAND_BASE)
 		return drm_compat_ioctl(filp, cmd, arg);
 
-#if 0
-	if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls))
-		fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE];
-#endif
 	lock_kernel();	  /* XXX for now */
 	if (fn != NULL)
 		ret = (*fn)(filp, cmd, arg);
diff --git a/drivers/char/drm/nouveau_irq.c b/drivers/char/drm/nouveau_irq.c
index cae83ae..ec158d8 100644
--- a/drivers/char/drm/nouveau_irq.c
+++ b/drivers/char/drm/nouveau_irq.c
@@ -37,7 +37,8 @@
 #include "nouveau_reg.h"
 #include "nouveau_swmthd.h"
 
-void nouveau_irq_preinstall(struct drm_device *dev)
+void
+nouveau_irq_preinstall(struct drm_device *dev)
 {
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
 
@@ -45,14 +46,15 @@ void nouveau_irq_preinstall(struct drm_device *dev)
 	NV_WRITE(NV03_PMC_INTR_EN_0, 0);
 }
 
-void nouveau_irq_postinstall(struct drm_device *dev)
+int
+nouveau_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
 
 	/* Master enable */
 	NV_WRITE(NV03_PMC_INTR_EN_0, NV_PMC_INTR_EN_0_MASTER_ENABLE);
 
-	return;
+	return 0;
 }
 
 void
@@ -444,6 +446,28 @@ nouveau_crtc_irq_handler(struct drm_device *dev, int crtc)
 	}
 }
 
+static void
+nouveau_nv50_display_irq_handler(struct drm_device *dev)
+{
+	struct drm_nouveau_private *dev_priv = dev->dev_private;
+	uint32_t val = NV_READ(NV50_DISPLAY_SUPERVISOR);
+
+	DRM_INFO("NV50_DISPLAY_INTR - 0x%08X\n", val);
+
+	NV_WRITE(NV50_DISPLAY_SUPERVISOR, val);
+}
+
+static void
+nouveau_nv50_i2c_irq_handler(struct drm_device *dev)
+{
+	struct drm_nouveau_private *dev_priv = dev->dev_private;
+
+	DRM_INFO("NV50_I2C_INTR - 0x%08X\n", NV_READ(NV50_I2C_CONTROLLER));
+
+	/* This seems to be the way to acknowledge an interrupt. */
+	NV_WRITE(NV50_I2C_CONTROLLER, 0x7FFF7FFF);
+}
+
 irqreturn_t
 nouveau_irq_handler(DRM_IRQ_ARGS)
 {
@@ -470,6 +494,16 @@ nouveau_irq_handler(DRM_IRQ_ARGS)
 		status &= ~NV_PMC_INTR_0_CRTCn_PENDING;
 	}
 
+	if (status & NV_PMC_INTR_0_NV50_DISPLAY_PENDING) {
+		nouveau_nv50_display_irq_handler(dev);
+		status &= ~NV_PMC_INTR_0_NV50_DISPLAY_PENDING;
+	}
+
+	if (status & NV_PMC_INTR_0_NV50_I2C_PENDING) {
+		nouveau_nv50_i2c_irq_handler(dev);
+		status &= ~NV_PMC_INTR_0_NV50_I2C_PENDING;
+	}
+
 	if (status)
 		DRM_ERROR("Unhandled PMC INTR status bits 0x%08x\n", status);
 
diff --git a/drivers/char/drm/nouveau_mem.c b/drivers/char/drm/nouveau_mem.c
index 622fe99..c861267 100644
--- a/drivers/char/drm/nouveau_mem.c
+++ b/drivers/char/drm/nouveau_mem.c
@@ -296,6 +296,32 @@ uint64_t nouveau_mem_fb_amount(struct drm_device *dev)
 	return 0;
 }
 
+static void nouveau_mem_reset_agp(struct drm_device *dev)
+{
+	struct drm_nouveau_private *dev_priv = dev->dev_private;
+	uint32_t saved_pci_nv_1, saved_pci_nv_19, pmc_enable;
+
+	saved_pci_nv_1 = NV_READ(NV04_PBUS_PCI_NV_1);
+	saved_pci_nv_19 = NV_READ(NV04_PBUS_PCI_NV_19);
+
+	/* clear busmaster bit */
+	NV_WRITE(NV04_PBUS_PCI_NV_1, saved_pci_nv_1 & ~0x4);
+	/* clear SBA and AGP bits */
+	NV_WRITE(NV04_PBUS_PCI_NV_19, saved_pci_nv_19 & 0xfffff0ff);
+
+	/* power cycle pgraph, if enabled */
+	pmc_enable = NV_READ(NV03_PMC_ENABLE);
+	if (pmc_enable & NV_PMC_ENABLE_PGRAPH) {
+		NV_WRITE(NV03_PMC_ENABLE, pmc_enable & ~NV_PMC_ENABLE_PGRAPH);
+		NV_WRITE(NV03_PMC_ENABLE, NV_READ(NV03_PMC_ENABLE) |
+				NV_PMC_ENABLE_PGRAPH);
+	}
+
+	/* and restore (gives effect of resetting AGP) */
+	NV_WRITE(NV04_PBUS_PCI_NV_19, saved_pci_nv_19);
+	NV_WRITE(NV04_PBUS_PCI_NV_1, saved_pci_nv_1);
+}
+
 static int
 nouveau_mem_init_agp(struct drm_device *dev, int ttm)
 {
@@ -304,6 +330,8 @@ nouveau_mem_init_agp(struct drm_device *dev, int ttm)
 	struct drm_agp_mode mode;
 	int ret;
 
+	nouveau_mem_reset_agp(dev);
+
 	ret = drm_agp_acquire(dev);
 	if (ret) {
 		DRM_ERROR("Unable to acquire AGP: %d\n", ret);
@@ -436,6 +464,11 @@ int nouveau_mem_init(struct drm_device *dev)
 	/* Init FB */
 	dev_priv->fb_phys=drm_get_resource_start(dev,1);
 	fb_size = nouveau_mem_fb_amount(dev);
+	/* On G80, limit VRAM to 512MiB temporarily due to limits in how
+	 * we handle VRAM page tables.
+	 */
+	if (dev_priv->card_type >= NV_50 && fb_size > (512 * 1024 * 1024))
+		fb_size = (512 * 1024 * 1024);
 	/* On at least NV40, RAMIN is actually at the end of vram.
 	 * We don't want to allocate this... */
 	if (dev_priv->card_type >= NV_40)
@@ -508,6 +541,21 @@ int nouveau_mem_init(struct drm_device *dev)
 		}
 	}
 
+	/* G8x: Allocate shared page table to map real VRAM pages into */
+	if (dev_priv->card_type >= NV_50) {
+		unsigned size = ((512 * 1024 * 1024) / 65536) * 8;
+
+		ret = nouveau_gpuobj_new(dev, NULL, size, 0,
+					 NVOBJ_FLAG_ZERO_ALLOC |
+					 NVOBJ_FLAG_ALLOW_NO_REFS,
+					 &dev_priv->vm_vram_pt);
+		if (ret) {
+			DRM_ERROR("Error creating VRAM page table: %d\n", ret);
+			return ret;
+		}
+	}
+
+
 	return 0;
 }
 
@@ -526,6 +574,12 @@ struct mem_block* nouveau_mem_alloc(struct drm_device *dev, int alignment,
 	if (alignment < PAGE_SHIFT)
 		alignment = PAGE_SHIFT;
 
+	/* Align allocation sizes to 64KiB blocks on G8x.  We use a 64KiB
+	 * page size in the GPU VM.
+	 */
+	if (flags & NOUVEAU_MEM_FB && dev_priv->card_type >= NV_50)
+		size = (size + (64 * 1024)) & ~((64 * 1024) - 1);
+
 	/*
 	 * Warn about 0 sized allocations, but let it go through. It'll return 1 page
 	 */
@@ -580,6 +634,30 @@ struct mem_block* nouveau_mem_alloc(struct drm_device *dev, int alignment,
 alloc_ok:
 	block->flags=type;
 
+	/* On G8x, map memory into VM */
+	if (block->flags & NOUVEAU_MEM_FB && dev_priv->card_type >= NV_50 &&
+	    !(flags & NOUVEAU_MEM_NOVM)) {
+		struct nouveau_gpuobj *pt = dev_priv->vm_vram_pt;
+		unsigned offset = block->start;
+		unsigned count = block->size / 65536;
+
+		if (!pt) {
+			DRM_ERROR("vm alloc without vm pt\n");
+			nouveau_mem_free_block(block);
+			return NULL;
+		}
+
+		while (count--) {
+			unsigned pte = offset / 65536;
+
+			INSTANCE_WR(pt, (pte * 2) + 0, offset | 1);
+			INSTANCE_WR(pt, (pte * 2) + 1, 0x00000000);
+			offset += 65536;
+		}
+	} else {
+		block->flags |= NOUVEAU_MEM_NOVM;
+	}	
+
 	if (flags&NOUVEAU_MEM_MAPPED)
 	{
 		struct drm_map_list *entry;
@@ -621,9 +699,34 @@ alloc_ok:
 
 void nouveau_mem_free(struct drm_device* dev, struct mem_block* block)
 {
+	struct drm_nouveau_private *dev_priv = dev->dev_private;
+
 	DRM_DEBUG("freeing 0x%llx type=0x%08x\n", block->start, block->flags);
+
 	if (block->flags&NOUVEAU_MEM_MAPPED)
 		drm_rmmap(dev, block->map);
+
+	/* G8x: Remove pages from vm */
+	if (block->flags & NOUVEAU_MEM_FB && dev_priv->card_type >= NV_50 &&
+	    !(block->flags & NOUVEAU_MEM_NOVM)) {
+		struct nouveau_gpuobj *pt = dev_priv->vm_vram_pt;
+		unsigned offset = block->start;
+		unsigned count = block->size / 65536;
+
+		if (!pt) {
+			DRM_ERROR("vm free without vm pt\n");
+			goto out_free;
+		}
+
+		while (count--) {
+			unsigned pte = offset / 65536;
+			INSTANCE_WR(pt, (pte * 2) + 0, 0);
+			INSTANCE_WR(pt, (pte * 2) + 1, 0);
+			offset += 65536;
+		}
+	}
+
+out_free:
 	nouveau_mem_free_block(block);
 }
 
@@ -638,6 +741,9 @@ int nouveau_ioctl_mem_alloc(struct drm_device *dev, void *data, struct drm_file
 
 	NOUVEAU_CHECK_INITIALISED_WITH_RETURN;
 
+	if (alloc->flags & NOUVEAU_MEM_INTERNAL)
+		return -EINVAL;
+
 	block=nouveau_mem_alloc(dev, alloc->alignment, alloc->size,
 				alloc->flags, file_priv);
 	if (!block)
diff --git a/drivers/char/drm/nouveau_object.c b/drivers/char/drm/nouveau_object.c
index fbce770..df534bd 100644
--- a/drivers/char/drm/nouveau_object.c
+++ b/drivers/char/drm/nouveau_object.c
@@ -983,10 +983,14 @@ nouveau_gpuobj_channel_init(struct nouveau_channel *chan,
 			return ret;
 	}
 
-	/* NV50 VM, point offset 0-512MiB at shared PCIEGART table  */
+	/* NV50 VM
+	 *  - Allocate per-channel page-directory
+	 *  - Point offset 0-512MiB at shared PCIEGART table
+	 *  - Point offset 512-1024MiB at shared VRAM table
+	 */
 	if (dev_priv->card_type >= NV_50) {
 		uint32_t vm_offset;
-		
+
 		vm_offset = (dev_priv->chipset & 0xf0) == 0x50 ? 0x1400 : 0x200;
 		vm_offset += chan->ramin->gpuobj->im_pramin->start;
 		if ((ret = nouveau_gpuobj_new_fake(dev, vm_offset, ~0, 0x4000,
@@ -1004,6 +1008,14 @@ nouveau_gpuobj_channel_init(struct nouveau_channel *chan,
 		INSTANCE_WR(chan->vm_pd, (0+0)/4,
 			    chan->vm_gart_pt->instance | 0x03);
 		INSTANCE_WR(chan->vm_pd, (0+4)/4, 0x00000000);
+
+		if ((ret = nouveau_gpuobj_ref_add(dev, NULL, 0,
+						  dev_priv->vm_vram_pt,
+						  &chan->vm_vram_pt)))
+			return ret;
+		INSTANCE_WR(chan->vm_pd, (8+0)/4,
+			    chan->vm_vram_pt->instance | 0x61);
+		INSTANCE_WR(chan->vm_pd, (8+4)/4, 0x00000000);
 	}
 
 	/* RAMHT */
@@ -1022,6 +1034,17 @@ nouveau_gpuobj_channel_init(struct nouveau_channel *chan,
 	}
 
 	/* VRAM ctxdma */
+	if (dev_priv->card_type >= NV_50) {
+		ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY,
+					     512*1024*1024,
+					     dev_priv->fb_available_size,
+					     NV_DMA_ACCESS_RW,
+					     NV_DMA_TARGET_AGP, &vram);
+		if (ret) {
+			DRM_ERROR("Error creating VRAM ctxdma: %d\n", ret);
+			return ret;
+		}
+	} else
 	if ((ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY,
 					  0, dev_priv->fb_available_size,
 					  NV_DMA_ACCESS_RW,
@@ -1084,6 +1107,7 @@ nouveau_gpuobj_channel_takedown(struct nouveau_channel *chan)
 
 	nouveau_gpuobj_del(dev, &chan->vm_pd);
 	nouveau_gpuobj_ref_del(dev, &chan->vm_gart_pt);
+	nouveau_gpuobj_ref_del(dev, &chan->vm_vram_pt);
 
 	if (chan->ramin_heap)
 		nouveau_mem_takedown(&chan->ramin_heap);
diff --git a/drivers/char/drm/nouveau_reg.h b/drivers/char/drm/nouveau_reg.h
index 2f7d77c..1ae0177 100644
--- a/drivers/char/drm/nouveau_reg.h
+++ b/drivers/char/drm/nouveau_reg.h
@@ -85,8 +85,10 @@
 #define NV03_PMC_INTR_0                                    0x00000100
 #    define NV_PMC_INTR_0_PFIFO_PENDING                       (1<< 8)
 #    define NV_PMC_INTR_0_PGRAPH_PENDING                      (1<<12)
+#    define NV_PMC_INTR_0_NV50_I2C_PENDING                  (1<<21)
 #    define NV_PMC_INTR_0_CRTC0_PENDING                       (1<<24)
 #    define NV_PMC_INTR_0_CRTC1_PENDING                       (1<<25)
+#    define NV_PMC_INTR_0_NV50_DISPLAY_PENDING           (1<<26)
 #    define NV_PMC_INTR_0_CRTCn_PENDING                       (3<<24)
 #define NV03_PMC_INTR_EN_0                                 0x00000140
 #    define NV_PMC_INTR_EN_0_MASTER_ENABLE                    (1<< 0)
@@ -123,6 +125,8 @@
 #define NV04_PTIMER_TIME_1                                 0x00009410
 #define NV04_PTIMER_ALARM_0                                0x00009420
 
+#define NV50_I2C_CONTROLLER                           0x0000E054
+
 #define NV04_PFB_CFG0                                      0x00100200
 #define NV04_PFB_CFG1                                      0x00100204
 #define NV40_PFB_020C                                      0x0010020C
@@ -535,6 +539,9 @@
 #define NV_CRTC1_INTEN                                     0x00602140
 #    define NV_CRTC_INTR_VBLANK                                (1<<0)
 
+/* This name is a partial guess. */
+#define NV50_DISPLAY_SUPERVISOR                     0x00610024
+
 /* Fifo commands. These are not regs, neither masks */
 #define NV03_FIFO_CMD_JUMP                                 0x20000000
 #define NV03_FIFO_CMD_JUMP_OFFSET_MASK                     0x1ffffffc
diff --git a/drivers/char/drm/nouveau_state.c b/drivers/char/drm/nouveau_state.c
index 39524ae..90d5748 100644
--- a/drivers/char/drm/nouveau_state.c
+++ b/drivers/char/drm/nouveau_state.c
@@ -41,7 +41,7 @@ static int nouveau_init_card_mappings(struct drm_device *dev)
 	/* map the mmio regs */
 	ret = drm_addmap(dev, drm_get_resource_start(dev, 0),
 			      drm_get_resource_len(dev, 0),
-			      _DRM_REGISTERS, _DRM_READ_ONLY, &dev_priv->mmio);
+			      _DRM_REGISTERS, _DRM_READ_ONLY|_DRM_DRIVER, &dev_priv->mmio);
 	if (ret) {
 		DRM_ERROR("Unable to initialize the mmio mapping (%d). "
 			  "Please report your setup to " DRIVER_EMAIL "\n",
@@ -60,7 +60,7 @@ static int nouveau_init_card_mappings(struct drm_device *dev)
 		ret = drm_addmap(dev,
 				 drm_get_resource_start(dev, ramin_resource),
 				 drm_get_resource_len(dev, ramin_resource),
-				 _DRM_REGISTERS, _DRM_READ_ONLY,
+				 _DRM_REGISTERS, _DRM_READ_ONLY|_DRM_DRIVER,
 				 &dev_priv->ramin);
 		if (ret) {
 			DRM_ERROR("Failed to init RAMIN mapping, "
@@ -75,7 +75,7 @@ static int nouveau_init_card_mappings(struct drm_device *dev)
 		ret = drm_addmap(dev,
 				 drm_get_resource_start(dev, 0) + NV_RAMIN,
 				 (1*1024*1024),
-				 _DRM_REGISTERS, _DRM_READ_ONLY,
+				 _DRM_REGISTERS, _DRM_READ_ONLY|_DRM_DRIVER,
 				 &dev_priv->ramin);
 		if (ret) {
 			DRM_ERROR("Failed to map BAR0 PRAMIN: %d\n", ret);
@@ -384,6 +384,7 @@ static void nouveau_card_takedown(struct drm_device *dev)
 		nouveau_sgdma_takedown(dev);
 
 		nouveau_gpuobj_takedown(dev);
+		nouveau_gpuobj_del(dev, &dev_priv->vm_vram_pt);
 
 		nouveau_mem_close(dev);
 		engine->instmem.takedown(dev);
@@ -416,6 +417,7 @@ int nouveau_firstopen(struct drm_device *dev)
 	struct device_node *dn;
 #endif
 	int ret;
+
 	/* Map any PCI resources we need on the card */
 	ret = nouveau_init_card_mappings(dev);
 	if (ret) return ret;
@@ -559,6 +561,15 @@ void nouveau_lastclose(struct drm_device *dev)
 			drm_mtrr_del(dev_priv->fb_mtrr, drm_get_resource_start(dev, 1),nouveau_mem_fb_amount(dev), DRM_MTRR_WC);
 			dev_priv->fb_mtrr=0;
 		}
+
+		if (dev_priv->ramin) {
+			drm_rmmap(dev, dev_priv->ramin);
+			dev_priv->ramin = NULL;
+		}
+		if (dev_priv->mmio) {
+			drm_rmmap(dev, dev_priv->mmio);
+			dev_priv->mmio = NULL;
+		}
 	}
 }
 
diff --git a/drivers/char/drm/nv04_mc.c b/drivers/char/drm/nv04_mc.c
index 766f3a3..24c1f7b 100644
--- a/drivers/char/drm/nv04_mc.c
+++ b/drivers/char/drm/nv04_mc.c
@@ -7,25 +7,12 @@ int
 nv04_mc_init(struct drm_device *dev)
 {
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
-	uint32_t saved_pci_nv_1, saved_pci_nv_19;
-
-	saved_pci_nv_1 = NV_READ(NV04_PBUS_PCI_NV_1);
-	saved_pci_nv_19 = NV_READ(NV04_PBUS_PCI_NV_19);
-
-	/* clear busmaster bit */
-	NV_WRITE(NV04_PBUS_PCI_NV_1, saved_pci_nv_1 & ~(0x00000001 << 2));
-	/* clear SBA and AGP bits */
-	NV_WRITE(NV04_PBUS_PCI_NV_19, saved_pci_nv_19 & 0xfffff0ff);
 
 	/* Power up everything, resetting each individual unit will
 	 * be done later if needed.
 	 */
 	NV_WRITE(NV03_PMC_ENABLE, 0xFFFFFFFF);
 
-	/* and restore (gives effect of resetting AGP) */
-	NV_WRITE(NV04_PBUS_PCI_NV_19, saved_pci_nv_19);
-	NV_WRITE(NV04_PBUS_PCI_NV_1, saved_pci_nv_1);
-
 	return 0;
 }
 
diff --git a/drivers/char/drm/nv04_timer.c b/drivers/char/drm/nv04_timer.c
index 88dff36..616f197 100644
--- a/drivers/char/drm/nv04_timer.c
+++ b/drivers/char/drm/nv04_timer.c
@@ -11,8 +11,17 @@ nv04_timer_init(struct drm_device *dev)
 	NV_WRITE(NV04_PTIMER_INTR_EN_0, 0x00000000);
 	NV_WRITE(NV04_PTIMER_INTR_0, 0xFFFFFFFF);
 
-	NV_WRITE(NV04_PTIMER_NUMERATOR, 0x00000008);
-	NV_WRITE(NV04_PTIMER_DENOMINATOR, 0x00000003);
+	/* Just use the pre-existing values when possible for now; these regs
+	 * are not written in nv (driver writer missed a /4 on the address), and
+	 * writing 8 and 3 to the correct regs breaks the timings on the LVDS
+	 * hardware sequencing microcode.
+	 * A correct solution (involving calculations with the GPU PLL) can
+	 * be done when kernel modesetting lands
+	 */
+	if (!NV_READ(NV04_PTIMER_NUMERATOR) || !NV_READ(NV04_PTIMER_DENOMINATOR)) {
+		NV_WRITE(NV04_PTIMER_NUMERATOR, 0x00000008);
+		NV_WRITE(NV04_PTIMER_DENOMINATOR, 0x00000003);
+	}
 
 	return 0;
 }
diff --git a/drivers/char/drm/nv40_graph.c b/drivers/char/drm/nv40_graph.c
index 6ef02bf..2540fc5 100644
--- a/drivers/char/drm/nv40_graph.c
+++ b/drivers/char/drm/nv40_graph.c
@@ -28,22 +28,6 @@
 #include "drm.h"
 #include "nouveau_drv.h"
 
-/* The sizes are taken from the difference between the start of two
- * grctx addresses while running the nvidia driver.  Probably slightly
- * larger than they actually are, because of other objects being created
- * between the contexts
- */
-#define NV40_GRCTX_SIZE (175*1024)
-#define NV41_GRCTX_SIZE (92*1024)
-#define NV43_GRCTX_SIZE (70*1024)
-#define NV46_GRCTX_SIZE (70*1024) /* probably ~64KiB */
-#define NV47_GRCTX_SIZE (125*1024)
-#define NV49_GRCTX_SIZE (164640)
-#define NV4A_GRCTX_SIZE (64*1024)
-#define NV4B_GRCTX_SIZE (164640)
-#define NV4C_GRCTX_SIZE (25*1024)
-#define NV4E_GRCTX_SIZE (25*1024)
-
 /*TODO: deciper what each offset in the context represents. The below
  *      contexts are taken from dumps just after the 3D object is
  *      created.
@@ -1471,61 +1455,60 @@ nv40_graph_create_context(struct nouveau_channel *chan)
 	struct drm_device *dev = chan->dev;
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
 	void (*ctx_init)(struct drm_device *, struct nouveau_gpuobj *);
-	unsigned int ctx_size;
 	int ret;
 
+	/* These functions populate the graphics context with a whole heap
+	 * of default state.  All these functions are very similar, with
+	 * a minimal amount of chipset-specific changes.  However, as we're
+	 * currently dependant on the context programs used by the NVIDIA
+	 * binary driver these functions must match the layout expected by
+	 * them.  Hopefully at some point this will all change.
+	 */
 	switch (dev_priv->chipset) {
 	case 0x40:
-		ctx_size = NV40_GRCTX_SIZE;
 		ctx_init = nv40_graph_context_init;
 		break;
 	case 0x41:
 	case 0x42:
-		ctx_size = NV41_GRCTX_SIZE;
 		ctx_init = nv41_graph_context_init;
 		break;
 	case 0x43:
-		ctx_size = NV43_GRCTX_SIZE;
 		ctx_init = nv43_graph_context_init;
 		break;
 	case 0x46:
-		ctx_size = NV46_GRCTX_SIZE;
 		ctx_init = nv46_graph_context_init;
 		break;
 	case 0x47:
-		DRM_INFO("NV47 warning: If your card behaves strangely, please come to the irc channel\n");
-		ctx_size = NV47_GRCTX_SIZE;
 		ctx_init = nv47_graph_context_init;
 		break;
 	case 0x49:
-		ctx_size = NV49_GRCTX_SIZE;
 		ctx_init = nv49_graph_context_init;
 		break;
 	case 0x44:
 	case 0x4a:
-		ctx_size = NV4A_GRCTX_SIZE;
 		ctx_init = nv4a_graph_context_init;
 		break;
 	case 0x4b:
-		ctx_size = NV4B_GRCTX_SIZE;
 		ctx_init = nv4b_graph_context_init;
 		break;
 	case 0x4c:
 	case 0x67:
-		ctx_size = NV4C_GRCTX_SIZE;
 		ctx_init = nv4c_graph_context_init;
 		break;
 	case 0x4e:
-		ctx_size = NV4E_GRCTX_SIZE;
 		ctx_init = nv4e_graph_context_init;
 		break;
 	default:
-		ctx_size = NV40_GRCTX_SIZE;
 		ctx_init = nv40_graph_context_init;
 		break;
 	}
 
-	if ((ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, ctx_size, 16,
+	/* Allocate a 175KiB block of PRAMIN to store the context.  This
+	 * is massive overkill for a lot of chipsets, but it should be safe
+	 * until we're able to implement this properly (will happen at more
+	 * or less the same time we're able to write our own context programs.
+	 */
+	if ((ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, 175*1024, 16,
 					  NVOBJ_FLAG_ZERO_ALLOC,
 					  &chan->ramin_grctx)))
 		return ret;
@@ -1634,25 +1617,12 @@ nv40_graph_load_context(struct nouveau_channel *chan)
 	return 0;
 }
 
-/* Some voodoo that makes context switching work without the binary driver
- * initialising the card first.
- *
- * It is possible to effect how the context is saved from PGRAPH into a block
- * of instance memory by altering the values in these tables.  This may mean
- * that the context layout of each chipset is slightly different (at least
- * NV40 and C51 are different).  It would also be possible for chipsets to
- * have an identical context layout, but pull the data from different PGRAPH
- * registers.
- *
- * TODO: decode the meaning of the magic values, may provide clues about the
- *       differences between the various NV40 chipsets.
- * TODO: one we have a better idea of how each chipset differs, perhaps think
- *       about unifying these instead of providing a separate table for each
- *       chip.
- *
- * mmio-trace dumps from other nv4x/g7x/c5x cards very welcome :)
+/* These blocks of "magic numbers" are actually a microcode that the GPU uses
+ * to control how graphics contexts get saved and restored between PRAMIN
+ * and PGRAPH during a context switch.  We're currently using values seen
+ * in mmio-traces of the binary driver.
  */
-static uint32_t nv40_ctx_voodoo[] = {
+static uint32_t nv40_ctx_prog[] = {
 	0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
 	0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00408f65, 0x00409406,
 	0x0040a268, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
@@ -1684,7 +1654,7 @@ static uint32_t nv40_ctx_voodoo[] = {
 	~0
 };
 
-static uint32_t nv41_ctx_voodoo[] = {
+static uint32_t nv41_ctx_prog[] = {
 	0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
 	0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00408f65, 0x00409306,
 	0x0040a068, 0x0040198f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
@@ -1715,7 +1685,7 @@ static uint32_t nv41_ctx_voodoo[] = {
 	0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
 };
 
-static uint32_t nv43_ctx_voodoo[] = {
+static uint32_t nv43_ctx_prog[] = {
 	0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
 	0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409565, 0x00409a06,
 	0x0040a868, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
@@ -1748,7 +1718,7 @@ static uint32_t nv43_ctx_voodoo[] = {
 	~0
 };
 
-static uint32_t nv44_ctx_voodoo[] = {
+static uint32_t nv44_ctx_prog[] = {
 	0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
 	0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409a65, 0x00409f06,
 	0x0040ac68, 0x0040248f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
@@ -1781,7 +1751,7 @@ static uint32_t nv44_ctx_voodoo[] = {
 	0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
 };
 
-static uint32_t nv46_ctx_voodoo[] = {
+static uint32_t nv46_ctx_prog[] = {
 	0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
 	0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00408f65, 0x00409306,
 	0x0040a068, 0x0040198f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
@@ -1812,7 +1782,7 @@ static uint32_t nv46_ctx_voodoo[] = {
 	0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
 };
 
-static uint32_t nv47_ctx_voodoo[] = {
+static uint32_t nv47_ctx_prog[] = {
 	0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
 	0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409265, 0x00409606,
 	0x0040a368, 0x0040198f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
@@ -1845,7 +1815,7 @@ static uint32_t nv47_ctx_voodoo[] = {
 };
 
 //this is used for nv49 and nv4b
-static uint32_t nv49_4b_ctx_voodoo[] ={
+static uint32_t nv49_4b_ctx_prog[] ={
 	0x00400564, 0x00400505, 0x00408165, 0x00408206, 0x00409e68, 0x00200020,
 	0x0060000a, 0x00700080, 0x00104042, 0x00200020, 0x0060000a, 0x00700000,
 	0x001040c5, 0x00400f26, 0x00401068, 0x0060000d, 0x0070008f, 0x0070000e,
@@ -1877,7 +1847,7 @@ static uint32_t nv49_4b_ctx_voodoo[] ={
 };
 
 
-static uint32_t nv4a_ctx_voodoo[] = {
+static uint32_t nv4a_ctx_prog[] = {
 	0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
 	0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409965, 0x00409e06,
 	0x0040ac68, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
@@ -1910,7 +1880,7 @@ static uint32_t nv4a_ctx_voodoo[] = {
 	0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
 };
 
-static uint32_t nv4c_ctx_voodoo[] = {
+static uint32_t nv4c_ctx_prog[] = {
 	0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
 	0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409065, 0x00409406,
 	0x0040a168, 0x0040198f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
@@ -1941,7 +1911,7 @@ static uint32_t nv4c_ctx_voodoo[] = {
 	0x0040a405, 0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
 };
 
-static uint32_t nv4e_ctx_voodoo[] = {
+static uint32_t nv4e_ctx_prog[] = {
 	0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
 	0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409565, 0x00409a06,
 	0x0040a868, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
@@ -1988,7 +1958,7 @@ nv40_graph_init(struct drm_device *dev)
 {
 	struct drm_nouveau_private *dev_priv =
 		(struct drm_nouveau_private *)dev->dev_private;
-	uint32_t *ctx_voodoo;
+	uint32_t *ctx_prog;
 	uint32_t vramsz, tmp;
 	int i, j;
 
@@ -1998,34 +1968,34 @@ nv40_graph_init(struct drm_device *dev)
 			 NV_PMC_ENABLE_PGRAPH);
 
 	switch (dev_priv->chipset) {
-	case 0x40: ctx_voodoo = nv40_ctx_voodoo; break;
+	case 0x40: ctx_prog = nv40_ctx_prog; break;
 	case 0x41:
-	case 0x42: ctx_voodoo = nv41_ctx_voodoo; break;
-	case 0x43: ctx_voodoo = nv43_ctx_voodoo; break;
-	case 0x44: ctx_voodoo = nv44_ctx_voodoo; break;
-	case 0x46: ctx_voodoo = nv46_ctx_voodoo; break;
-	case 0x47: ctx_voodoo = nv47_ctx_voodoo; break;
-	case 0x49: ctx_voodoo = nv49_4b_ctx_voodoo; break;
-	case 0x4a: ctx_voodoo = nv4a_ctx_voodoo; break;
-	case 0x4b: ctx_voodoo = nv49_4b_ctx_voodoo; break;
+	case 0x42: ctx_prog = nv41_ctx_prog; break;
+	case 0x43: ctx_prog = nv43_ctx_prog; break;
+	case 0x44: ctx_prog = nv44_ctx_prog; break;
+	case 0x46: ctx_prog = nv46_ctx_prog; break;
+	case 0x47: ctx_prog = nv47_ctx_prog; break;
+	case 0x49: ctx_prog = nv49_4b_ctx_prog; break;
+	case 0x4a: ctx_prog = nv4a_ctx_prog; break;
+	case 0x4b: ctx_prog = nv49_4b_ctx_prog; break;
 	case 0x4c:
-	case 0x67: ctx_voodoo = nv4c_ctx_voodoo; break;
-	case 0x4e: ctx_voodoo = nv4e_ctx_voodoo; break;
+	case 0x67: ctx_prog = nv4c_ctx_prog; break;
+	case 0x4e: ctx_prog = nv4e_ctx_prog; break;
 	default:
-		DRM_ERROR("Unknown ctx_voodoo for chipset 0x%02x\n",
-				dev_priv->chipset);
-		ctx_voodoo = NULL;
+		DRM_ERROR("Context program for 0x%02x unavailable\n",
+			  dev_priv->chipset);
+		ctx_prog = NULL;
 		break;
 	}
 
-	/* Load the context voodoo onto the card */
-	if (ctx_voodoo) {
-		DRM_DEBUG("Loading context-switch voodoo\n");
+	/* Load the context program onto the card */
+	if (ctx_prog) {
+		DRM_DEBUG("Loading context program\n");
 		i = 0;
 
 		NV_WRITE(NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
-		while (ctx_voodoo[i] != ~0) {
-			NV_WRITE(NV40_PGRAPH_CTXCTL_UCODE_DATA, ctx_voodoo[i]);
+		while (ctx_prog[i] != ~0) {
+			NV_WRITE(NV40_PGRAPH_CTXCTL_UCODE_DATA, ctx_prog[i]);
 			i++;
 		}
 	}
diff --git a/drivers/char/drm/nv50_graph.c b/drivers/char/drm/nv50_graph.c
index b95afeb..55df5fc 100644
--- a/drivers/char/drm/nv50_graph.c
+++ b/drivers/char/drm/nv50_graph.c
@@ -147,44 +147,44 @@ static uint32_t nv84_ctx_voodoo[] = {
 };
  
 static uint32_t nv86_ctx_voodoo[] = {
-	0x0070008e, 0x0070009c, 0x00200020, 0x00600008, 0x0050004c, 0x00400e89, 
-	0x00200000, 0x00600007, 0x00300000, 0x00c000ff, 0x00200000, 0x008000ff, 
-	0x00700009, 0x0040dd4d, 0x00402944, 0x00402905, 0x0040290d, 0x0040b906, 
-	0x00600005, 0x004015c5, 0x00600011, 0x0040270b, 0x004021c5, 0x00700000, 
-	0x00700081, 0x00600004, 0x0050004a, 0x00216d80, 0x00600007, 0x00c02801, 
-	0x0020002e, 0x00800001, 0x005000cb, 0x0090ffff, 0x0091ffff, 0x00200020, 
-	0x00600008, 0x0050004c, 0x00600009, 0x0040b945, 0x0040d44d, 0x0070009d, 
-	0x00402dcf, 0x0070009f, 0x0050009f, 0x00402ac0, 0x00200200, 0x00600008, 
-	0x00402a4f, 0x00402ac0, 0x004030cc, 0x00700081, 0x00200000, 0x00600006, 
-	0x00700000, 0x00111bfc, 0x00700083, 0x00300000, 0x00216d80, 0x00600007, 
-	0x00c00b01, 0x0020001e, 0x00800001, 0x005000cb, 0x00c000ff, 0x00700080, 
-	0x00700083, 0x00200047, 0x00600006, 0x0011020a, 0x00200280, 0x00600007, 
-	0x00300000, 0x00c000ff, 0x00c800ff, 0x0040c407, 0x00202916, 0x008000ff, 
-	0x0040508c, 0x005000cb, 0x00a0023f, 0x00200040, 0x00600006, 0x0070000f, 
-	0x00170202, 0x0011020a, 0x00200032, 0x0010020d, 0x001c0242, 0x00120302, 
-	0x00140402, 0x00180500, 0x00130509, 0x00150550, 0x00110605, 0x0020000f, 
-	0x00100607, 0x00110700, 0x00110900, 0x00120902, 0x00110a00, 0x00160b02, 
-	0x00120b28, 0x00140b2b, 0x00110c01, 0x00111400, 0x00111405, 0x00111407, 
-	0x00111409, 0x0011140b, 0x002000cb, 0x00101500, 0x0040790f, 0x0040794b, 
-	0x00214b40, 0x00600007, 0x00200442, 0x008800ff, 0x0070008f, 0x0040798c, 
-	0x005000cb, 0x00000000, 0x0020002b, 0x00101a05, 0x00131c00, 0x00121c04, 
-	0x00141c20, 0x00111c25, 0x00131c40, 0x00121c44, 0x00141c60, 0x00111c65, 
-	0x00131f00, 0x00191f40, 0x004099e0, 0x002001d9, 0x00600006, 0x00200044, 
-	0x00102080, 0x001120c6, 0x001520c9, 0x001920d0, 0x00122100, 0x00122103, 
-	0x00162200, 0x00122207, 0x00112280, 0x00112300, 0x00112302, 0x00122380, 
-	0x0011238b, 0x00112394, 0x0011239c, 0x00000000, 0x0040a00f, 0x005000cb, 
-	0x00214b40, 0x00600007, 0x00200442, 0x008800ff, 0x005000cb, 0x0040a387, 
-	0x0060000a, 0x00000000, 0x0040b200, 0x007000a0, 0x00700080, 0x00200280, 
-	0x00600007, 0x00200004, 0x00c000ff, 0x008000ff, 0x005000cb, 0x00700000, 
-	0x00200000, 0x00600006, 0x00111bfe, 0x0040d44d, 0x00700000, 0x00200000, 
-	0x00600006, 0x00111bfe, 0x00700080, 0x0070001d, 0x0040114d, 0x00700081, 
-	0x00600004, 0x0050004a, 0x0040be88, 0x0060000b, 0x00200000, 0x00600006, 
-	0x00700000, 0x0040d40b, 0x00111bfd, 0x0040424d, 0x00202916, 0x008000fd, 
-	0x005000cb, 0x00c00002, 0x00200280, 0x00600007, 0x00200160, 0x00800002, 
-	0x005000cb, 0x00c01802, 0x002027b6, 0x00800002, 0x005000cb, 0x00404e4d, 
-	0x0060000b, 0x0040d24d, 0x00700001, 0x00700003, 0x0040d806, 0x0040d905, 
-	0x0060000d, 0x00700005, 0x0070000d, 0x00700006, 0x0070000b, 0x0070000e, 
-	0x0070001c, 0x0060000c, ~0
+	0x0070008e, 0x0070009c, 0x00200020, 0x00600008, 0x0050004c, 0x00400e89,
+	0x00200000, 0x00600007, 0x00300000, 0x00c000ff, 0x00200000, 0x008000ff,
+	0x00700009, 0x0040dd4d, 0x00402944, 0x00402905, 0x0040290d, 0x0040b906,
+	0x00600005, 0x004015c5, 0x00600011, 0x0040270b, 0x004021c5, 0x00700000,
+	0x00700081, 0x00600004, 0x0050004a, 0x00216d80, 0x00600007, 0x00c02801,
+	0x0020002e, 0x00800001, 0x005000cb, 0x0090ffff, 0x0091ffff, 0x00200020,
+	0x00600008, 0x0050004c, 0x00600009, 0x0040b945, 0x0040d44d, 0x0070009d,
+	0x00402dcf, 0x0070009f, 0x0050009f, 0x00402ac0, 0x00200200, 0x00600008,
+	0x00402a4f, 0x00402ac0, 0x004030cc, 0x00700081, 0x00200000, 0x00600006,
+	0x00700000, 0x00111bfc, 0x00700083, 0x00300000, 0x00216d80, 0x00600007,
+	0x00c00b01, 0x0020001e, 0x00800001, 0x005000cb, 0x00c000ff, 0x00700080,
+	0x00700083, 0x00200047, 0x00600006, 0x0011020a, 0x00200280, 0x00600007,
+	0x00300000, 0x00c000ff, 0x00c800ff, 0x0040c407, 0x00202916, 0x008000ff,
+	0x0040508c, 0x005000cb, 0x00a0023f, 0x00200040, 0x00600006, 0x0070000f,
+	0x00170202, 0x0011020a, 0x00200032, 0x0010020d, 0x001c0242, 0x00120302,
+	0x00140402, 0x00180500, 0x00130509, 0x00150550, 0x00110605, 0x0020000f,
+	0x00100607, 0x00110700, 0x00110900, 0x00120902, 0x00110a00, 0x00160b02,
+	0x00120b28, 0x00140b2b, 0x00110c01, 0x00111400, 0x00111405, 0x00111407,
+	0x00111409, 0x0011140b, 0x002000cb, 0x00101500, 0x0040790f, 0x0040794b,
+	0x00214b40, 0x00600007, 0x00200442, 0x008800ff, 0x0070008f, 0x0040798c,
+	0x005000cb, 0x00000000, 0x0020002b, 0x00101a05, 0x00131c00, 0x00121c04,
+	0x00141c20, 0x00111c25, 0x00131c40, 0x00121c44, 0x00141c60, 0x00111c65,
+	0x00131f00, 0x00191f40, 0x004099e0, 0x002001d9, 0x00600006, 0x00200044,
+	0x00102080, 0x001120c6, 0x001520c9, 0x001920d0, 0x00122100, 0x00122103,
+	0x00162200, 0x00122207, 0x00112280, 0x00112300, 0x00112302, 0x00122380,
+	0x0011238b, 0x00112394, 0x0011239c, 0x00000000, 0x0040a00f, 0x005000cb,
+	0x00214b40, 0x00600007, 0x00200442, 0x008800ff, 0x005000cb, 0x0040a387,
+	0x0060000a, 0x00000000, 0x0040b200, 0x007000a0, 0x00700080, 0x00200280,
+	0x00600007, 0x00200004, 0x00c000ff, 0x008000ff, 0x005000cb, 0x00700000,
+	0x00200000, 0x00600006, 0x00111bfe, 0x0040d44d, 0x00700000, 0x00200000,
+	0x00600006, 0x00111bfe, 0x00700080, 0x0070001d, 0x0040114d, 0x00700081,
+	0x00600004, 0x0050004a, 0x0040be88, 0x0060000b, 0x00200000, 0x00600006,
+	0x00700000, 0x0040d40b, 0x00111bfd, 0x0040424d, 0x00202916, 0x008000fd,
+	0x005000cb, 0x00c00002, 0x00200280, 0x00600007, 0x00200160, 0x00800002,
+	0x005000cb, 0x00c01802, 0x002027b6, 0x00800002, 0x005000cb, 0x00404e4d,
+	0x0060000b, 0x0040d24d, 0x00700001, 0x00700003, 0x0040d806, 0x0040d905,
+	0x0060000d, 0x00700005, 0x0070000d, 0x00700006, 0x0070000b, 0x0070000e,
+	0x0060000c, ~0
 };
 
 static int
@@ -245,6 +245,692 @@ nv50_graph_takedown(struct drm_device *dev)
 	DRM_DEBUG("\n");
 }
 
+static void
+nv86_graph_init_ctxvals(struct drm_device *dev, struct nouveau_gpuobj_ref *ref)
+{
+	struct drm_nouveau_private *dev_priv = dev->dev_private;
+	struct nouveau_gpuobj *ctx = ref->gpuobj;
+
+	INSTANCE_WR(ctx, 0x0/4, 0x1);
+	INSTANCE_WR(ctx, 0x10C/4, 0x30);
+	INSTANCE_WR(ctx, 0x1D4/4, 0x3);
+	INSTANCE_WR(ctx, 0x1D8/4, 0x1000);
+	INSTANCE_WR(ctx, 0x218/4, 0xFE0C);
+	INSTANCE_WR(ctx, 0x22C/4, 0x1000);
+	INSTANCE_WR(ctx, 0x258/4, 0x187);
+	INSTANCE_WR(ctx, 0x26C/4, 0x1018);
+	INSTANCE_WR(ctx, 0x270/4, 0xFF);
+	INSTANCE_WR(ctx, 0x2AC/4, 0x4);
+	INSTANCE_WR(ctx, 0x2B0/4, 0x44D00DF);
+	INSTANCE_WR(ctx, 0x2B8/4, 0x600);
+	INSTANCE_WR(ctx, 0x2D0/4, 0x1000000);
+	INSTANCE_WR(ctx, 0x2D4/4, 0xFF);
+	INSTANCE_WR(ctx, 0x2DC/4, 0x400);
+	INSTANCE_WR(ctx, 0x2F4/4, 0x1);
+	INSTANCE_WR(ctx, 0x2F8/4, 0x80);
+	INSTANCE_WR(ctx, 0x2FC/4, 0x4);
+	INSTANCE_WR(ctx, 0x318/4, 0x2);
+	INSTANCE_WR(ctx, 0x31C/4, 0x1);
+	INSTANCE_WR(ctx, 0x328/4, 0x1);
+	INSTANCE_WR(ctx, 0x32C/4, 0x100);
+	INSTANCE_WR(ctx, 0x344/4, 0x2);
+	INSTANCE_WR(ctx, 0x348/4, 0x1);
+	INSTANCE_WR(ctx, 0x34C/4, 0x1);
+	INSTANCE_WR(ctx, 0x35C/4, 0x1);
+	INSTANCE_WR(ctx, 0x360/4, 0x3FFFFF);
+	INSTANCE_WR(ctx, 0x364/4, 0x1FFF);
+	INSTANCE_WR(ctx, 0x36C/4, 0x1);
+	INSTANCE_WR(ctx, 0x370/4, 0x1);
+	INSTANCE_WR(ctx, 0x378/4, 0x1);
+	INSTANCE_WR(ctx, 0x37C/4, 0x1);
+	INSTANCE_WR(ctx, 0x380/4, 0x1);
+	INSTANCE_WR(ctx, 0x384/4, 0x4);
+	INSTANCE_WR(ctx, 0x388/4, 0x1);
+	INSTANCE_WR(ctx, 0x38C/4, 0x1);
+	INSTANCE_WR(ctx, 0x390/4, 0x1);
+	INSTANCE_WR(ctx, 0x394/4, 0x7);
+	INSTANCE_WR(ctx, 0x398/4, 0x1);
+	INSTANCE_WR(ctx, 0x39C/4, 0x7);
+	INSTANCE_WR(ctx, 0x3A0/4, 0x1);
+	INSTANCE_WR(ctx, 0x3A4/4, 0x1);
+	INSTANCE_WR(ctx, 0x3A8/4, 0x1);
+	INSTANCE_WR(ctx, 0x3BC/4, 0x1);
+	INSTANCE_WR(ctx, 0x3C0/4, 0x100);
+	INSTANCE_WR(ctx, 0x3C8/4, 0x1);
+	INSTANCE_WR(ctx, 0x3D4/4, 0x100);
+	INSTANCE_WR(ctx, 0x3D8/4, 0x1);
+	INSTANCE_WR(ctx, 0x3DC/4, 0x100);
+	INSTANCE_WR(ctx, 0x3E4/4, 0x1);
+	INSTANCE_WR(ctx, 0x3F0/4, 0x100);
+	INSTANCE_WR(ctx, 0x404/4, 0x4);
+	INSTANCE_WR(ctx, 0x408/4, 0x70);
+	INSTANCE_WR(ctx, 0x40C/4, 0x80);
+	INSTANCE_WR(ctx, 0x420/4, 0xC);
+	INSTANCE_WR(ctx, 0x428/4, 0x8);
+	INSTANCE_WR(ctx, 0x42C/4, 0x14);
+	INSTANCE_WR(ctx, 0x434/4, 0x29);
+	INSTANCE_WR(ctx, 0x438/4, 0x27);
+	INSTANCE_WR(ctx, 0x43C/4, 0x26);
+	INSTANCE_WR(ctx, 0x440/4, 0x8);
+	INSTANCE_WR(ctx, 0x444/4, 0x4);
+	INSTANCE_WR(ctx, 0x448/4, 0x27);
+	INSTANCE_WR(ctx, 0x454/4, 0x1);
+	INSTANCE_WR(ctx, 0x458/4, 0x2);
+	INSTANCE_WR(ctx, 0x45C/4, 0x3);
+	INSTANCE_WR(ctx, 0x460/4, 0x4);
+	INSTANCE_WR(ctx, 0x464/4, 0x5);
+	INSTANCE_WR(ctx, 0x468/4, 0x6);
+	INSTANCE_WR(ctx, 0x46C/4, 0x7);
+	INSTANCE_WR(ctx, 0x470/4, 0x1);
+	INSTANCE_WR(ctx, 0x4B4/4, 0xCF);
+	INSTANCE_WR(ctx, 0x4E4/4, 0x80);
+	INSTANCE_WR(ctx, 0x4E8/4, 0x4);
+	INSTANCE_WR(ctx, 0x4EC/4, 0x4);
+	INSTANCE_WR(ctx, 0x4F0/4, 0x3);
+	INSTANCE_WR(ctx, 0x4F4/4, 0x1);
+	INSTANCE_WR(ctx, 0x500/4, 0x12);
+	INSTANCE_WR(ctx, 0x504/4, 0x10);
+	INSTANCE_WR(ctx, 0x508/4, 0xC);
+	INSTANCE_WR(ctx, 0x50C/4, 0x1);
+	INSTANCE_WR(ctx, 0x51C/4, 0x4);
+	INSTANCE_WR(ctx, 0x520/4, 0x2);
+	INSTANCE_WR(ctx, 0x524/4, 0x4);
+	INSTANCE_WR(ctx, 0x530/4, 0x3FFFFF);
+	INSTANCE_WR(ctx, 0x534/4, 0x1FFF);
+	INSTANCE_WR(ctx, 0x55C/4, 0x4);
+	INSTANCE_WR(ctx, 0x560/4, 0x14);
+	INSTANCE_WR(ctx, 0x564/4, 0x1);
+	INSTANCE_WR(ctx, 0x570/4, 0x2);
+	INSTANCE_WR(ctx, 0x57C/4, 0x1);
+	INSTANCE_WR(ctx, 0x584/4, 0x2);
+	INSTANCE_WR(ctx, 0x588/4, 0x1000);
+	INSTANCE_WR(ctx, 0x58C/4, 0xE00);
+	INSTANCE_WR(ctx, 0x590/4, 0x1000);
+	INSTANCE_WR(ctx, 0x594/4, 0x1E00);
+	INSTANCE_WR(ctx, 0x59C/4, 0x1);
+	INSTANCE_WR(ctx, 0x5A0/4, 0x1);
+	INSTANCE_WR(ctx, 0x5A4/4, 0x1);
+	INSTANCE_WR(ctx, 0x5A8/4, 0x1);
+	INSTANCE_WR(ctx, 0x5AC/4, 0x1);
+	INSTANCE_WR(ctx, 0x5BC/4, 0x200);
+	INSTANCE_WR(ctx, 0x5C4/4, 0x1);
+	INSTANCE_WR(ctx, 0x5C8/4, 0x70);
+	INSTANCE_WR(ctx, 0x5CC/4, 0x80);
+	INSTANCE_WR(ctx, 0x5D8/4, 0x1);
+	INSTANCE_WR(ctx, 0x5DC/4, 0x70);
+	INSTANCE_WR(ctx, 0x5E0/4, 0x80);
+	INSTANCE_WR(ctx, 0x5F0/4, 0x1);
+	INSTANCE_WR(ctx, 0x5F4/4, 0xCF);
+	INSTANCE_WR(ctx, 0x5FC/4, 0x1);
+	INSTANCE_WR(ctx, 0x60C/4, 0xCF);
+	INSTANCE_WR(ctx, 0x614/4, 0x2);
+	INSTANCE_WR(ctx, 0x61C/4, 0x1);
+	INSTANCE_WR(ctx, 0x624/4, 0x1);
+	INSTANCE_WR(ctx, 0x62C/4, 0xCF);
+	INSTANCE_WR(ctx, 0x630/4, 0xCF);
+	INSTANCE_WR(ctx, 0x634/4, 0x1);
+	INSTANCE_WR(ctx, 0x63C/4, 0xF80);
+	INSTANCE_WR(ctx, 0x684/4, 0x7F0080);
+	INSTANCE_WR(ctx, 0x6C0/4, 0x7F0080);
+	INSTANCE_WR(ctx, 0x6E4/4, 0x3B74F821);
+	INSTANCE_WR(ctx, 0x6E8/4, 0x89058001);
+	INSTANCE_WR(ctx, 0x6F0/4, 0x1000);
+	INSTANCE_WR(ctx, 0x6F4/4, 0x1F);
+	INSTANCE_WR(ctx, 0x6F8/4, 0x27C10FA);
+	INSTANCE_WR(ctx, 0x6FC/4, 0x400000C0);
+	INSTANCE_WR(ctx, 0x700/4, 0xB7892080);
+	INSTANCE_WR(ctx, 0x70C/4, 0x3B74F821);
+	INSTANCE_WR(ctx, 0x710/4, 0x89058001);
+	INSTANCE_WR(ctx, 0x718/4, 0x1000);
+	INSTANCE_WR(ctx, 0x71C/4, 0x1F);
+	INSTANCE_WR(ctx, 0x720/4, 0x27C10FA);
+	INSTANCE_WR(ctx, 0x724/4, 0x400000C0);
+	INSTANCE_WR(ctx, 0x728/4, 0xB7892080);
+	INSTANCE_WR(ctx, 0x734/4, 0x10040);
+	INSTANCE_WR(ctx, 0x73C/4, 0x22);
+	INSTANCE_WR(ctx, 0x748/4, 0x10040);
+	INSTANCE_WR(ctx, 0x74C/4, 0x22);
+	INSTANCE_WR(ctx, 0x764/4, 0x1800000);
+	INSTANCE_WR(ctx, 0x768/4, 0x160000);
+	INSTANCE_WR(ctx, 0x76C/4, 0x1800000);
+	INSTANCE_WR(ctx, 0x77C/4, 0x3FFFF);
+	INSTANCE_WR(ctx, 0x780/4, 0x8C0000);
+	INSTANCE_WR(ctx, 0x7A4/4, 0x10401);
+	INSTANCE_WR(ctx, 0x7AC/4, 0x78);
+	INSTANCE_WR(ctx, 0x7B4/4, 0xBF);
+	INSTANCE_WR(ctx, 0x7BC/4, 0x1210);
+	INSTANCE_WR(ctx, 0x7C0/4, 0x8000080);
+	INSTANCE_WR(ctx, 0x7E4/4, 0x1800000);
+	INSTANCE_WR(ctx, 0x7E8/4, 0x160000);
+	INSTANCE_WR(ctx, 0x7EC/4, 0x1800000);
+	INSTANCE_WR(ctx, 0x7FC/4, 0x3FFFF);
+	INSTANCE_WR(ctx, 0x800/4, 0x8C0000);
+	INSTANCE_WR(ctx, 0x824/4, 0x10401);
+	INSTANCE_WR(ctx, 0x82C/4, 0x78);
+	INSTANCE_WR(ctx, 0x834/4, 0xBF);
+	INSTANCE_WR(ctx, 0x83C/4, 0x1210);
+	INSTANCE_WR(ctx, 0x840/4, 0x8000080);
+	INSTANCE_WR(ctx, 0x868/4, 0x27070);
+	INSTANCE_WR(ctx, 0x874/4, 0x3FFFFFF);
+	INSTANCE_WR(ctx, 0x88C/4, 0x120407);
+	INSTANCE_WR(ctx, 0x890/4, 0x5091507);
+	INSTANCE_WR(ctx, 0x894/4, 0x5010202);
+	INSTANCE_WR(ctx, 0x898/4, 0x30201);
+	INSTANCE_WR(ctx, 0x8B4/4, 0x40);
+	INSTANCE_WR(ctx, 0x8B8/4, 0xD0C0B0A);
+	INSTANCE_WR(ctx, 0x8BC/4, 0x141210);
+	INSTANCE_WR(ctx, 0x8C0/4, 0x1F0);
+	INSTANCE_WR(ctx, 0x8C4/4, 0x1);
+	INSTANCE_WR(ctx, 0x8C8/4, 0x3);
+	INSTANCE_WR(ctx, 0x8D4/4, 0x39E00);
+	INSTANCE_WR(ctx, 0x8D8/4, 0x100);
+	INSTANCE_WR(ctx, 0x8DC/4, 0x3800);
+	INSTANCE_WR(ctx, 0x8E0/4, 0x404040);
+	INSTANCE_WR(ctx, 0x8E4/4, 0xFF0A);
+	INSTANCE_WR(ctx, 0x8EC/4, 0x77F005);
+	INSTANCE_WR(ctx, 0x8F0/4, 0x3F7FFF);
+	INSTANCE_WR(ctx, 0x7BA0/4, 0x21);
+	INSTANCE_WR(ctx, 0x7BC0/4, 0x1);
+	INSTANCE_WR(ctx, 0x7BE0/4, 0x2);
+	INSTANCE_WR(ctx, 0x7C00/4, 0x100);
+	INSTANCE_WR(ctx, 0x7C20/4, 0x100);
+	INSTANCE_WR(ctx, 0x7C40/4, 0x1);
+	INSTANCE_WR(ctx, 0x7CA0/4, 0x1);
+	INSTANCE_WR(ctx, 0x7CC0/4, 0x2);
+	INSTANCE_WR(ctx, 0x7CE0/4, 0x100);
+	INSTANCE_WR(ctx, 0x7D00/4, 0x100);
+	INSTANCE_WR(ctx, 0x7D20/4, 0x1);
+	INSTANCE_WR(ctx, 0x11640/4, 0x4);
+	INSTANCE_WR(ctx, 0x11660/4, 0x4);
+	INSTANCE_WR(ctx, 0x49FE0/4, 0x4);
+	INSTANCE_WR(ctx, 0x4A000/4, 0x4);
+	INSTANCE_WR(ctx, 0x4A020/4, 0x8100C12);
+	INSTANCE_WR(ctx, 0x4A040/4, 0x3);
+	INSTANCE_WR(ctx, 0x4A080/4, 0x8100C12);
+	INSTANCE_WR(ctx, 0x4A0C0/4, 0x80C14);
+	INSTANCE_WR(ctx, 0x4A0E0/4, 0x1);
+	INSTANCE_WR(ctx, 0x4A100/4, 0x80C14);
+	INSTANCE_WR(ctx, 0x4A160/4, 0x8100C12);
+	INSTANCE_WR(ctx, 0x4A180/4, 0x27);
+	INSTANCE_WR(ctx, 0x4A1E0/4, 0x1);
+	INSTANCE_WR(ctx, 0x51A20/4, 0x1);
+	INSTANCE_WR(ctx, 0x51D00/4, 0x8100C12);
+	INSTANCE_WR(ctx, 0x51EA0/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x51EC0/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x51F00/4, 0x80);
+	INSTANCE_WR(ctx, 0x51F80/4, 0x80);
+	INSTANCE_WR(ctx, 0x51FC0/4, 0x3F);
+	INSTANCE_WR(ctx, 0x52120/4, 0x2);
+	INSTANCE_WR(ctx, 0x52140/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x52160/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x52280/4, 0x4);
+	INSTANCE_WR(ctx, 0x52300/4, 0x4);
+	INSTANCE_WR(ctx, 0x52540/4, 0x1);
+	INSTANCE_WR(ctx, 0x52560/4, 0x1001);
+	INSTANCE_WR(ctx, 0x52580/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x525A0/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x525C0/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x525E0/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x52A00/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52A20/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52A40/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52A60/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52A80/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52AA0/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52AC0/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52AE0/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52B00/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52B20/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52B40/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52B60/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52B80/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52BA0/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52BC0/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52BE0/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x52C00/4, 0x10);
+	INSTANCE_WR(ctx, 0x52C60/4, 0x3);
+	INSTANCE_WR(ctx, 0xA84/4, 0xF);
+	INSTANCE_WR(ctx, 0xB24/4, 0x20);
+	INSTANCE_WR(ctx, 0xD04/4, 0x1A);
+	INSTANCE_WR(ctx, 0xEC4/4, 0x4);
+	INSTANCE_WR(ctx, 0xEE4/4, 0x4);
+	INSTANCE_WR(ctx, 0xF24/4, 0x4);
+	INSTANCE_WR(ctx, 0xF44/4, 0x8);
+	INSTANCE_WR(ctx, 0xF84/4, 0x7FF);
+	INSTANCE_WR(ctx, 0x1124/4, 0xF);
+	INSTANCE_WR(ctx, 0x3604/4, 0xF);
+	INSTANCE_WR(ctx, 0x3644/4, 0x1);
+	INSTANCE_WR(ctx, 0x41A4/4, 0xF);
+	INSTANCE_WR(ctx, 0x14844/4, 0xF);
+	INSTANCE_WR(ctx, 0x14AE4/4, 0x1);
+	INSTANCE_WR(ctx, 0x14B04/4, 0x100);
+	INSTANCE_WR(ctx, 0x14B24/4, 0x100);
+	INSTANCE_WR(ctx, 0x14B44/4, 0x11);
+	INSTANCE_WR(ctx, 0x14B84/4, 0x8);
+	INSTANCE_WR(ctx, 0x14C44/4, 0x1);
+	INSTANCE_WR(ctx, 0x14C84/4, 0x1);
+	INSTANCE_WR(ctx, 0x14CA4/4, 0x1);
+	INSTANCE_WR(ctx, 0x14CC4/4, 0x1);
+	INSTANCE_WR(ctx, 0x14CE4/4, 0xCF);
+	INSTANCE_WR(ctx, 0x14D04/4, 0x2);
+	INSTANCE_WR(ctx, 0x14DE4/4, 0x1);
+	INSTANCE_WR(ctx, 0x14E24/4, 0x1);
+	INSTANCE_WR(ctx, 0x14E44/4, 0x1);
+	INSTANCE_WR(ctx, 0x14E64/4, 0x1);
+	INSTANCE_WR(ctx, 0x14F04/4, 0x4);
+	INSTANCE_WR(ctx, 0x14F44/4, 0x1);
+	INSTANCE_WR(ctx, 0x14F64/4, 0x15);
+	INSTANCE_WR(ctx, 0x14FE4/4, 0x4444480);
+	INSTANCE_WR(ctx, 0x15764/4, 0x8100C12);
+	INSTANCE_WR(ctx, 0x15804/4, 0x100);
+	INSTANCE_WR(ctx, 0x15864/4, 0x10001);
+	INSTANCE_WR(ctx, 0x158A4/4, 0x10001);
+	INSTANCE_WR(ctx, 0x158C4/4, 0x1);
+	INSTANCE_WR(ctx, 0x158E4/4, 0x10001);
+	INSTANCE_WR(ctx, 0x15904/4, 0x1);
+	INSTANCE_WR(ctx, 0x15924/4, 0x4);
+	INSTANCE_WR(ctx, 0x15944/4, 0x2);
+	INSTANCE_WR(ctx, 0x166C4/4, 0x4E3BFDF);
+	INSTANCE_WR(ctx, 0x166E4/4, 0x4E3BFDF);
+	INSTANCE_WR(ctx, 0x16784/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x16904/4, 0x4E3BFDF);
+	INSTANCE_WR(ctx, 0x16924/4, 0x4E3BFDF);
+	INSTANCE_WR(ctx, 0x15948/4, 0x3FFFFF);
+	INSTANCE_WR(ctx, 0x159A8/4, 0x1FFF);
+	INSTANCE_WR(ctx, 0x15B88/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x15C68/4, 0x4);
+	INSTANCE_WR(ctx, 0x15C88/4, 0x1A);
+	INSTANCE_WR(ctx, 0x15CE8/4, 0x1);
+	INSTANCE_WR(ctx, 0x15F48/4, 0xFFFF00);
+	INSTANCE_WR(ctx, 0x16028/4, 0xF);
+	INSTANCE_WR(ctx, 0x16128/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x16148/4, 0x11);
+	INSTANCE_WR(ctx, 0x16348/4, 0x4);
+	INSTANCE_WR(ctx, 0x163E8/4, 0x2);
+	INSTANCE_WR(ctx, 0x16408/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x16428/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x164A8/4, 0x5);
+	INSTANCE_WR(ctx, 0x164C8/4, 0x52);
+	INSTANCE_WR(ctx, 0x16568/4, 0x1);
+	INSTANCE_WR(ctx, 0x16788/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x167A8/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x167C8/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x167E8/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16808/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16828/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16848/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16868/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16888/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x168A8/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x168C8/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x168E8/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16908/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16928/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16948/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16968/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16988/4, 0x10);
+	INSTANCE_WR(ctx, 0x16E68/4, 0x8100C12);
+	INSTANCE_WR(ctx, 0x16E88/4, 0x5);
+	INSTANCE_WR(ctx, 0x16EE8/4, 0x1);
+	INSTANCE_WR(ctx, 0x16F28/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x16F48/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x16F68/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x16F88/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x16FA8/4, 0x3);
+	INSTANCE_WR(ctx, 0x173A8/4, 0xFFFF00);
+	INSTANCE_WR(ctx, 0x173C8/4, 0x1A);
+	INSTANCE_WR(ctx, 0x17408/4, 0x3);
+	INSTANCE_WR(ctx, 0x178E8/4, 0x102);
+	INSTANCE_WR(ctx, 0x17928/4, 0x4);
+	INSTANCE_WR(ctx, 0x17948/4, 0x4);
+	INSTANCE_WR(ctx, 0x17968/4, 0x4);
+	INSTANCE_WR(ctx, 0x17988/4, 0x4);
+	INSTANCE_WR(ctx, 0x179A8/4, 0x4);
+	INSTANCE_WR(ctx, 0x179C8/4, 0x4);
+	INSTANCE_WR(ctx, 0x17A08/4, 0x7FF);
+	INSTANCE_WR(ctx, 0x17A48/4, 0x102);
+	INSTANCE_WR(ctx, 0x17B88/4, 0x4);
+	INSTANCE_WR(ctx, 0x17BA8/4, 0x4);
+	INSTANCE_WR(ctx, 0x17BC8/4, 0x4);
+	INSTANCE_WR(ctx, 0x17BE8/4, 0x4);
+	INSTANCE_WR(ctx, 0x18228/4, 0x80C14);
+	INSTANCE_WR(ctx, 0x18288/4, 0x804);
+	INSTANCE_WR(ctx, 0x182C8/4, 0x4);
+	INSTANCE_WR(ctx, 0x182E8/4, 0x4);
+	INSTANCE_WR(ctx, 0x18308/4, 0x8100C12);
+	INSTANCE_WR(ctx, 0x18348/4, 0x4);
+	INSTANCE_WR(ctx, 0x18368/4, 0x4);
+	INSTANCE_WR(ctx, 0x183A8/4, 0x10);
+	INSTANCE_WR(ctx, 0x18448/4, 0x804);
+	INSTANCE_WR(ctx, 0x18468/4, 0x1);
+	INSTANCE_WR(ctx, 0x18488/4, 0x1A);
+	INSTANCE_WR(ctx, 0x184A8/4, 0x7F);
+	INSTANCE_WR(ctx, 0x184E8/4, 0x1);
+	INSTANCE_WR(ctx, 0x18508/4, 0x80C14);
+	INSTANCE_WR(ctx, 0x18548/4, 0x8100C12);
+	INSTANCE_WR(ctx, 0x18568/4, 0x4);
+	INSTANCE_WR(ctx, 0x18588/4, 0x4);
+	INSTANCE_WR(ctx, 0x185C8/4, 0x10);
+	INSTANCE_WR(ctx, 0x18648/4, 0x1);
+	INSTANCE_WR(ctx, 0x18668/4, 0x8100C12);
+	INSTANCE_WR(ctx, 0x18748/4, 0x7FF);
+	INSTANCE_WR(ctx, 0x18768/4, 0x80C14);
+	INSTANCE_WR(ctx, 0x18E88/4, 0x1);
+	INSTANCE_WR(ctx, 0x18EE8/4, 0x10);
+	INSTANCE_WR(ctx, 0x19608/4, 0x88);
+	INSTANCE_WR(ctx, 0x19628/4, 0x88);
+	INSTANCE_WR(ctx, 0x19688/4, 0x4);
+	INSTANCE_WR(ctx, 0x19968/4, 0x26);
+	INSTANCE_WR(ctx, 0x199C8/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x19A48/4, 0x1A);
+	INSTANCE_WR(ctx, 0x19A68/4, 0x10);
+	INSTANCE_WR(ctx, 0x19F88/4, 0x52);
+	INSTANCE_WR(ctx, 0x19FC8/4, 0x26);
+	INSTANCE_WR(ctx, 0x1A008/4, 0x4);
+	INSTANCE_WR(ctx, 0x1A028/4, 0x4);
+	INSTANCE_WR(ctx, 0x1A068/4, 0x1A);
+	INSTANCE_WR(ctx, 0x1A0C8/4, 0xFFFF00);
+	INSTANCE_WR(ctx, 0x1A108/4, 0x4);
+	INSTANCE_WR(ctx, 0x1A128/4, 0x4);
+	INSTANCE_WR(ctx, 0x1A168/4, 0x80);
+	INSTANCE_WR(ctx, 0x1A188/4, 0x4);
+	INSTANCE_WR(ctx, 0x1A1A8/4, 0x80C14);
+	INSTANCE_WR(ctx, 0x1A1E8/4, 0x7FF);
+	INSTANCE_WR(ctx, 0x24A48/4, 0x4);
+	INSTANCE_WR(ctx, 0x24A68/4, 0x4);
+	INSTANCE_WR(ctx, 0x24AA8/4, 0x80);
+	INSTANCE_WR(ctx, 0x24AC8/4, 0x4);
+	INSTANCE_WR(ctx, 0x24AE8/4, 0x1);
+	INSTANCE_WR(ctx, 0x24B28/4, 0x27);
+	INSTANCE_WR(ctx, 0x24B68/4, 0x26);
+	INSTANCE_WR(ctx, 0x24BE8/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24C08/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24C28/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24C48/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24C68/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24C88/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24CA8/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24CC8/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24CE8/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24D08/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24D28/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24D48/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24D68/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24D88/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24DA8/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x24DC8/4, 0x4000000);
+	INSTANCE_WR(ctx, 0x25268/4, 0x4E3BFDF);
+	INSTANCE_WR(ctx, 0x25288/4, 0x4E3BFDF);
+	INSTANCE_WR(ctx, 0x252E8/4, 0x1FE21);
+	INSTANCE_WR(ctx, 0xB0C/4, 0x2);
+	INSTANCE_WR(ctx, 0xB4C/4, 0x1FFE67);
+	INSTANCE_WR(ctx, 0xCEC/4, 0x1);
+	INSTANCE_WR(ctx, 0xD0C/4, 0x10);
+	INSTANCE_WR(ctx, 0xD6C/4, 0x1);
+	INSTANCE_WR(ctx, 0xE0C/4, 0x4);
+	INSTANCE_WR(ctx, 0xE2C/4, 0x400);
+	INSTANCE_WR(ctx, 0xE4C/4, 0x300);
+	INSTANCE_WR(ctx, 0xE6C/4, 0x1001);
+	INSTANCE_WR(ctx, 0xE8C/4, 0x15);
+	INSTANCE_WR(ctx, 0xF4C/4, 0x2);
+	INSTANCE_WR(ctx, 0x106C/4, 0x1);
+	INSTANCE_WR(ctx, 0x108C/4, 0x10);
+	INSTANCE_WR(ctx, 0x10CC/4, 0x1);
+	INSTANCE_WR(ctx, 0x134C/4, 0x10);
+	INSTANCE_WR(ctx, 0x156C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x158C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x15AC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x15CC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x15EC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x160C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x162C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x164C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x166C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x168C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16AC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16CC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x16EC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x170C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x172C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x174C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x1A8C/4, 0x10);
+	INSTANCE_WR(ctx, 0x1ACC/4, 0x3F);
+	INSTANCE_WR(ctx, 0x1BAC/4, 0x1);
+	INSTANCE_WR(ctx, 0x1BEC/4, 0x1);
+	INSTANCE_WR(ctx, 0x1C2C/4, 0x1);
+	INSTANCE_WR(ctx, 0x1DCC/4, 0x11);
+	INSTANCE_WR(ctx, 0x1ECC/4, 0xF);
+	INSTANCE_WR(ctx, 0x1FCC/4, 0x11);
+	INSTANCE_WR(ctx, 0x20AC/4, 0x1);
+	INSTANCE_WR(ctx, 0x20CC/4, 0x1);
+	INSTANCE_WR(ctx, 0x20EC/4, 0x1);
+	INSTANCE_WR(ctx, 0x210C/4, 0x2);
+	INSTANCE_WR(ctx, 0x212C/4, 0x1);
+	INSTANCE_WR(ctx, 0x214C/4, 0x2);
+	INSTANCE_WR(ctx, 0x216C/4, 0x1);
+	INSTANCE_WR(ctx, 0x21AC/4, 0x1FFE67);
+	INSTANCE_WR(ctx, 0x21EC/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x24AC/4, 0x1);
+	INSTANCE_WR(ctx, 0x24CC/4, 0x2);
+	INSTANCE_WR(ctx, 0x24EC/4, 0x1);
+	INSTANCE_WR(ctx, 0x250C/4, 0x1);
+	INSTANCE_WR(ctx, 0x252C/4, 0x2);
+	INSTANCE_WR(ctx, 0x254C/4, 0x1);
+	INSTANCE_WR(ctx, 0x256C/4, 0x1);
+	INSTANCE_WR(ctx, 0x25EC/4, 0x11);
+	INSTANCE_WR(ctx, 0x260C/4, 0x1);
+	INSTANCE_WR(ctx, 0x328C/4, 0x2);
+	INSTANCE_WR(ctx, 0x32CC/4, 0x1FFE67);
+	INSTANCE_WR(ctx, 0x346C/4, 0x1);
+	INSTANCE_WR(ctx, 0x348C/4, 0x10);
+	INSTANCE_WR(ctx, 0x34EC/4, 0x1);
+	INSTANCE_WR(ctx, 0x358C/4, 0x4);
+	INSTANCE_WR(ctx, 0x35AC/4, 0x400);
+	INSTANCE_WR(ctx, 0x35CC/4, 0x300);
+	INSTANCE_WR(ctx, 0x35EC/4, 0x1001);
+	INSTANCE_WR(ctx, 0x360C/4, 0x15);
+	INSTANCE_WR(ctx, 0x36CC/4, 0x2);
+	INSTANCE_WR(ctx, 0x37EC/4, 0x1);
+	INSTANCE_WR(ctx, 0x380C/4, 0x10);
+	INSTANCE_WR(ctx, 0x384C/4, 0x1);
+	INSTANCE_WR(ctx, 0x3ACC/4, 0x10);
+	INSTANCE_WR(ctx, 0x3CEC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3D0C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3D2C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3D4C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3D6C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3D8C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3DAC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3DCC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3DEC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3E0C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3E2C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3E4C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3E6C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3E8C/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3EAC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x3ECC/4, 0x3F800000);
+	INSTANCE_WR(ctx, 0x420C/4, 0x10);
+	INSTANCE_WR(ctx, 0x424C/4, 0x3F);
+	INSTANCE_WR(ctx, 0x432C/4, 0x1);
+	INSTANCE_WR(ctx, 0x436C/4, 0x1);
+	INSTANCE_WR(ctx, 0x43AC/4, 0x1);
+	INSTANCE_WR(ctx, 0x454C/4, 0x11);
+	INSTANCE_WR(ctx, 0x464C/4, 0xF);
+	INSTANCE_WR(ctx, 0x474C/4, 0x11);
+	INSTANCE_WR(ctx, 0x482C/4, 0x1);
+	INSTANCE_WR(ctx, 0x484C/4, 0x1);
+	INSTANCE_WR(ctx, 0x486C/4, 0x1);
+	INSTANCE_WR(ctx, 0x488C/4, 0x2);
+	INSTANCE_WR(ctx, 0x48AC/4, 0x1);
+	INSTANCE_WR(ctx, 0x48CC/4, 0x2);
+	INSTANCE_WR(ctx, 0x48EC/4, 0x1);
+	INSTANCE_WR(ctx, 0x492C/4, 0x1FFE67);
+	INSTANCE_WR(ctx, 0x496C/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x4C2C/4, 0x1);
+	INSTANCE_WR(ctx, 0x4C4C/4, 0x2);
+	INSTANCE_WR(ctx, 0x4C6C/4, 0x1);
+	INSTANCE_WR(ctx, 0x4C8C/4, 0x1);
+	INSTANCE_WR(ctx, 0x4CAC/4, 0x2);
+	INSTANCE_WR(ctx, 0x4CCC/4, 0x1);
+	INSTANCE_WR(ctx, 0x4CEC/4, 0x1);
+	INSTANCE_WR(ctx, 0x4D6C/4, 0x11);
+	INSTANCE_WR(ctx, 0x4D8C/4, 0x1);
+	INSTANCE_WR(ctx, 0xA30/4, 0x4);
+	INSTANCE_WR(ctx, 0xCF0/4, 0x4);
+	INSTANCE_WR(ctx, 0xD10/4, 0x4);
+	INSTANCE_WR(ctx, 0xD30/4, 0x608080);
+	INSTANCE_WR(ctx, 0xDD0/4, 0x4);
+	INSTANCE_WR(ctx, 0xE30/4, 0x4);
+	INSTANCE_WR(ctx, 0xE50/4, 0x4);
+	INSTANCE_WR(ctx, 0xE70/4, 0x80);
+	INSTANCE_WR(ctx, 0xE90/4, 0x1E00);
+	INSTANCE_WR(ctx, 0xEB0/4, 0x4);
+	INSTANCE_WR(ctx, 0x1350/4, 0x4);
+	INSTANCE_WR(ctx, 0x1370/4, 0x80);
+	INSTANCE_WR(ctx, 0x1390/4, 0x4);
+	INSTANCE_WR(ctx, 0x13B0/4, 0x3020100);
+	INSTANCE_WR(ctx, 0x13D0/4, 0x3);
+	INSTANCE_WR(ctx, 0x13F0/4, 0x1E00);
+	INSTANCE_WR(ctx, 0x1410/4, 0x4);
+	INSTANCE_WR(ctx, 0x14B0/4, 0x4);
+	INSTANCE_WR(ctx, 0x14D0/4, 0x3);
+	INSTANCE_WR(ctx, 0x1550/4, 0x4);
+	INSTANCE_WR(ctx, 0x159F0/4, 0x4);
+	INSTANCE_WR(ctx, 0x15A10/4, 0x3);
+	INSTANCE_WR(ctx, 0x15C50/4, 0xF);
+	INSTANCE_WR(ctx, 0x15DD0/4, 0x4);
+	INSTANCE_WR(ctx, 0x15DF0/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x15E10/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x15E30/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x15E50/4, 0xFFFF);
+	INSTANCE_WR(ctx, 0x15F70/4, 0x1);
+	INSTANCE_WR(ctx, 0x15FF0/4, 0x1);
+	INSTANCE_WR(ctx, 0x160B0/4, 0x1);
+	INSTANCE_WR(ctx, 0x16250/4, 0x1);
+	INSTANCE_WR(ctx, 0x16270/4, 0x1);
+	INSTANCE_WR(ctx, 0x16290/4, 0x2);
+	INSTANCE_WR(ctx, 0x162B0/4, 0x1);
+	INSTANCE_WR(ctx, 0x162D0/4, 0x1);
+	INSTANCE_WR(ctx, 0x162F0/4, 0x2);
+	INSTANCE_WR(ctx, 0x16310/4, 0x1);
+	INSTANCE_WR(ctx, 0x16350/4, 0x11);
+	INSTANCE_WR(ctx, 0x16450/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x164B0/4, 0x4);
+	INSTANCE_WR(ctx, 0x16530/4, 0x11);
+	INSTANCE_WR(ctx, 0x16550/4, 0x1);
+	INSTANCE_WR(ctx, 0x16590/4, 0xCF);
+	INSTANCE_WR(ctx, 0x165B0/4, 0xCF);
+	INSTANCE_WR(ctx, 0x165D0/4, 0xCF);
+	INSTANCE_WR(ctx, 0x16730/4, 0x1);
+	INSTANCE_WR(ctx, 0x16750/4, 0x1);
+	INSTANCE_WR(ctx, 0x16770/4, 0x2);
+	INSTANCE_WR(ctx, 0x16790/4, 0x1);
+	INSTANCE_WR(ctx, 0x167B0/4, 0x1);
+	INSTANCE_WR(ctx, 0x167D0/4, 0x2);
+	INSTANCE_WR(ctx, 0x167F0/4, 0x1);
+	INSTANCE_WR(ctx, 0x16830/4, 0x1);
+	INSTANCE_WR(ctx, 0x16850/4, 0x1);
+	INSTANCE_WR(ctx, 0x16870/4, 0x1);
+	INSTANCE_WR(ctx, 0x16890/4, 0x1);
+	INSTANCE_WR(ctx, 0x168B0/4, 0x1);
+	INSTANCE_WR(ctx, 0x168D0/4, 0x1);
+	INSTANCE_WR(ctx, 0x168F0/4, 0x1);
+	INSTANCE_WR(ctx, 0x16910/4, 0x1);
+	INSTANCE_WR(ctx, 0x16930/4, 0x11);
+	INSTANCE_WR(ctx, 0x16A30/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x16A50/4, 0xF);
+	INSTANCE_WR(ctx, 0x16B50/4, 0x1FFE67);
+	INSTANCE_WR(ctx, 0x16BB0/4, 0x11);
+	INSTANCE_WR(ctx, 0x16BD0/4, 0x1);
+	INSTANCE_WR(ctx, 0x16C50/4, 0x4);
+	INSTANCE_WR(ctx, 0x16D10/4, 0x1);
+	INSTANCE_WR(ctx, 0x16DB0/4, 0x11);
+	INSTANCE_WR(ctx, 0x16EB0/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x16F30/4, 0x11);
+	INSTANCE_WR(ctx, 0x16F50/4, 0x1);
+	INSTANCE_WR(ctx, 0x16F90/4, 0x1);
+	INSTANCE_WR(ctx, 0x16FD0/4, 0x1);
+	INSTANCE_WR(ctx, 0x17010/4, 0x7FF);
+	INSTANCE_WR(ctx, 0x17050/4, 0x1);
+	INSTANCE_WR(ctx, 0x17090/4, 0x1);
+	INSTANCE_WR(ctx, 0x175F0/4, 0x8);
+	INSTANCE_WR(ctx, 0x17610/4, 0x8);
+	INSTANCE_WR(ctx, 0x17630/4, 0x8);
+	INSTANCE_WR(ctx, 0x17650/4, 0x8);
+	INSTANCE_WR(ctx, 0x17670/4, 0x8);
+	INSTANCE_WR(ctx, 0x17690/4, 0x8);
+	INSTANCE_WR(ctx, 0x176B0/4, 0x8);
+	INSTANCE_WR(ctx, 0x176D0/4, 0x8);
+	INSTANCE_WR(ctx, 0x176F0/4, 0x11);
+	INSTANCE_WR(ctx, 0x177F0/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x17810/4, 0x400);
+	INSTANCE_WR(ctx, 0x17830/4, 0x400);
+	INSTANCE_WR(ctx, 0x17850/4, 0x400);
+	INSTANCE_WR(ctx, 0x17870/4, 0x400);
+	INSTANCE_WR(ctx, 0x17890/4, 0x400);
+	INSTANCE_WR(ctx, 0x178B0/4, 0x400);
+	INSTANCE_WR(ctx, 0x178D0/4, 0x400);
+	INSTANCE_WR(ctx, 0x178F0/4, 0x400);
+	INSTANCE_WR(ctx, 0x17910/4, 0x300);
+	INSTANCE_WR(ctx, 0x17930/4, 0x300);
+	INSTANCE_WR(ctx, 0x17950/4, 0x300);
+	INSTANCE_WR(ctx, 0x17970/4, 0x300);
+	INSTANCE_WR(ctx, 0x17990/4, 0x300);
+	INSTANCE_WR(ctx, 0x179B0/4, 0x300);
+	INSTANCE_WR(ctx, 0x179D0/4, 0x300);
+	INSTANCE_WR(ctx, 0x179F0/4, 0x300);
+	INSTANCE_WR(ctx, 0x17A10/4, 0x1);
+	INSTANCE_WR(ctx, 0x17A30/4, 0xF);
+	INSTANCE_WR(ctx, 0x17B30/4, 0x20);
+	INSTANCE_WR(ctx, 0x17B50/4, 0x11);
+	INSTANCE_WR(ctx, 0x17B70/4, 0x100);
+	INSTANCE_WR(ctx, 0x17BB0/4, 0x1);
+	INSTANCE_WR(ctx, 0x17C10/4, 0x40);
+	INSTANCE_WR(ctx, 0x17C30/4, 0x100);
+	INSTANCE_WR(ctx, 0x17C70/4, 0x3);
+	INSTANCE_WR(ctx, 0x17D10/4, 0x1FFE67);
+	INSTANCE_WR(ctx, 0x17D90/4, 0x2);
+	INSTANCE_WR(ctx, 0x17DB0/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x17EF0/4, 0x1);
+	INSTANCE_WR(ctx, 0x17F90/4, 0x4);
+	INSTANCE_WR(ctx, 0x17FD0/4, 0x1);
+	INSTANCE_WR(ctx, 0x17FF0/4, 0x400);
+	INSTANCE_WR(ctx, 0x18010/4, 0x300);
+	INSTANCE_WR(ctx, 0x18030/4, 0x1001);
+	INSTANCE_WR(ctx, 0x180B0/4, 0x11);
+	INSTANCE_WR(ctx, 0x181B0/4, 0xFAC6881);
+	INSTANCE_WR(ctx, 0x181D0/4, 0xF);
+	INSTANCE_WR(ctx, 0x184D0/4, 0x1FFE67);
+	INSTANCE_WR(ctx, 0x18550/4, 0x11);
+	INSTANCE_WR(ctx, 0x185B0/4, 0x4);
+	INSTANCE_WR(ctx, 0x185F0/4, 0x1);
+	INSTANCE_WR(ctx, 0x18610/4, 0x1);
+	INSTANCE_WR(ctx, 0x18690/4, 0x1);
+	INSTANCE_WR(ctx, 0x18730/4, 0x1);
+	INSTANCE_WR(ctx, 0x18770/4, 0x1);
+	INSTANCE_WR(ctx, 0x187F0/4, 0x2A712488);
+	INSTANCE_WR(ctx, 0x18830/4, 0x4085C000);
+	INSTANCE_WR(ctx, 0x18850/4, 0x40);
+	INSTANCE_WR(ctx, 0x18870/4, 0x100);
+	INSTANCE_WR(ctx, 0x18890/4, 0x10100);
+	INSTANCE_WR(ctx, 0x188B0/4, 0x2800000);
+	INSTANCE_WR(ctx, 0x18B10/4, 0x4E3BFDF);
+	INSTANCE_WR(ctx, 0x18B30/4, 0x4E3BFDF);
+	INSTANCE_WR(ctx, 0x18B50/4, 0x1);
+	INSTANCE_WR(ctx, 0x18B90/4, 0xFFFF00);
+	INSTANCE_WR(ctx, 0x18BB0/4, 0x1);
+	INSTANCE_WR(ctx, 0x18C10/4, 0xFFFF00);
+	INSTANCE_WR(ctx, 0x18D30/4, 0x1);
+	INSTANCE_WR(ctx, 0x18D70/4, 0x1);
+	INSTANCE_WR(ctx, 0x18D90/4, 0x30201000);
+	INSTANCE_WR(ctx, 0x18DB0/4, 0x70605040);
+	INSTANCE_WR(ctx, 0x18DD0/4, 0xB8A89888);
+	INSTANCE_WR(ctx, 0x18DF0/4, 0xF8E8D8C8);
+	INSTANCE_WR(ctx, 0x18E30/4, 0x1A);
+}
+
+
 int
 nv50_graph_create_context(struct nouveau_channel *chan)
 {
@@ -272,10 +958,17 @@ nv50_graph_create_context(struct nouveau_channel *chan)
 	INSTANCE_WR(ramin, (hdr + 0x10)/4, 0);
 	INSTANCE_WR(ramin, (hdr + 0x14)/4, 0x00010000);
 
-	ret = engine->graph.load_context(chan);
-	if (ret) {
-		DRM_ERROR("Error hacking up initial context: %d\n", ret);
-		return ret;
+	switch (dev_priv->chipset) {
+		case 0x86:
+			nv86_graph_init_ctxvals(dev, chan->ramin_grctx);
+			break;
+		default:
+			ret = engine->graph.load_context(chan);
+			if (ret) {
+				DRM_ERROR("Error hacking up initial context: %d\n", ret);
+				return ret;
+			}
+			break;
 	}
 
 	INSTANCE_WR(chan->ramin_grctx->gpuobj, 0x00000/4,
diff --git a/drivers/char/drm/nv50_instmem.c b/drivers/char/drm/nv50_instmem.c
index 9687ecb..b7a51f0 100644
--- a/drivers/char/drm/nv50_instmem.c
+++ b/drivers/char/drm/nv50_instmem.c
@@ -243,7 +243,8 @@ nv50_instmem_populate(struct drm_device *dev, struct nouveau_gpuobj *gpuobj, uin
 		return -EINVAL;
 
 	gpuobj->im_backing = nouveau_mem_alloc(dev, NV50_INSTMEM_PAGE_SIZE,
-					       *sz, NOUVEAU_MEM_FB,
+					       *sz, NOUVEAU_MEM_FB |
+					       NOUVEAU_MEM_NOVM,
 					       (struct drm_file *)-2);
 	if (!gpuobj->im_backing) {
 		DRM_ERROR("Couldn't allocate vram to back PRAMIN pages\n");


Index: config-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/config-generic,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- config-generic	21 May 2008 20:42:11 -0000	1.65
+++ config-generic	21 May 2008 23:55:13 -0000	1.66
@@ -65,6 +65,9 @@
 # CONFIG_MODVERSIONS is not set
 CONFIG_MODULE_SRCVERSION_ALL=y
 CONFIG_KMOD=y
+CONFIG_MODULE_SIG=y
+# CONFIG_MODULE_SIG_FORCE is not set
+CONFIG_MODULE_VERIFY_ELF=y
 
 #
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -3098,6 +3101,7 @@
 CONFIG_CRYPTO_MD4=m
 CONFIG_CRYPTO_MD5=m
 CONFIG_CRYPTO_MICHAEL_MIC=m
+CONFIG_CRYPTO_MPILIB=y
 CONFIG_CRYPTO_NULL=m
 CONFIG_CRYPTO_PCBC=m
 CONFIG_CRYPTO_SALSA20=m
@@ -3108,6 +3112,7 @@
 CONFIG_CRYPTO_SHA1=y
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
+CONFIG_CRYPTO_SIGNATURE_DSA=y
 CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_TGR192=m
 CONFIG_CRYPTO_TWOFISH=m


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/kernel.spec,v
retrieving revision 1.442
retrieving revision 1.443
diff -u -r1.442 -r1.443
--- kernel.spec	21 May 2008 21:22:40 -0000	1.442
+++ kernel.spec	21 May 2008 23:55:13 -0000	1.443
@@ -568,31 +568,30 @@
 
 Patch41: linux-2.6-sysrq-c.patch
 Patch60: linux-2.6-x86-tune-generic.patch
-# Patch61: linux-2.6-x86-setup-add-near-jump.patch
-Patch70: linux-2.6-x86_64-silence-up-apic-errors.patch
 Patch75: linux-2.6-x86-debug-boot.patch
-# Patch76: linux-2.6-x86-dont-use-p6-nops.patch
-Patch77: linux-2.6-x86-clear-df-for-signals.patch
-Patch78: linux-2.6-x86-asmlinkage_protect-sys_io_getevents.patch
-
-Patch85: linux-2.6-alsa-hda-codec-add-AD1884A-mobile.patch
-Patch86: linux-2.6-alsa-hda-codec-add-AD1884A-x300.patch
-Patch87: linux-2.6-alsa-hda-codec-add-AD1884A.patch
-Patch91: linux-2.6-alsa-kill-annoying-messages.patch
-
-# Patch100: linux-2.6-libata-pegasos-fix.patch
-Patch117: linux-2.6-pasemi-for-2.6.25.patch
-Patch118: linux-2.6-pasemi-reserve-i2c.patch
-Patch130: linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch
-Patch131: linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch
-Patch132: linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch
-Patch133: linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch
-Patch134: linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch
-Patch135: linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch
+Patch85: linux-2.6-x86-dont-map-vdso-when-disabled.patch
+Patch86: linux-2.6-x86-dont-use-disabled-vdso-for-signals.patch
+Patch87: linux-2.6-x86-fix-asm-constraint-in-do_IRQ.patch
+Patch88: linux-2.6-x86-pci-revert-remove-default-rom-allocation.patch
+Patch89: linux-2.6-x86-dont-read-maxlvt-if-apic-unmapped.patch
+
+Patch90: linux-2.6-alsa-hda-codec-add-AD1884A-mobile.patch
+Patch91: linux-2.6-alsa-hda-codec-add-AD1884A-x300.patch
+Patch92: linux-2.6-alsa-hda-codec-add-AD1884A.patch
+Patch93: linux-2.6-alsa-kill-annoying-messages.patch
+
+Patch123: linux-2.6-ppc-rtc.patch
+Patch130: linux-2.6-ppc-use-libgcc.patch
 Patch140: linux-2.6-ps3-ehci-iso.patch
 Patch141: linux-2.6-ps3-storage-alias.patch
 Patch142: linux-2.6-ps3-legacy-bootloader-hack.patch
 Patch143: linux-2.6-g5-therm-shutdown.patch
+Patch144: linux-2.6-vio-modalias.patch
+Patch145: linux-2.6-windfarm-pm121.patch
+Patch146: linux-2.6-windfarm-pm121-fix.patch
+Patch147: linux-2.6-imac-transparent-bridge.patch
+Patch148: linux-2.6-powerpc-zImage-32MiB.patch
+Patch149: linux-2.6-efika-not-chrp.patch
 
 Patch150: linux-2.6-build-nonintconfig.patch
 Patch160: linux-2.6-execshield.patch
@@ -603,113 +602,78 @@
 Patch210: linux-2.6-modsign-ksign.patch
 Patch220: linux-2.6-modsign-core.patch
 Patch230: linux-2.6-modsign-script.patch
-Patch240: linux-2.6-debug-resource-overflow.patch
 Patch250: linux-2.6-debug-sizeof-structs.patch
 Patch260: linux-2.6-debug-nmi-timeout.patch
 Patch270: linux-2.6-debug-taint-vm.patch
 Patch280: linux-2.6-debug-spinlock-taint.patch
 Patch330: linux-2.6-debug-no-quiet.patch
+Patch340: linux-2.6-debug-vm-would-have-oomkilled.patch
 Patch350: linux-2.6-devmem.patch
 Patch370: linux-2.6-crash-driver.patch
 
-Patch381: linux-2.6-pci-remove-default-pci-rom-allocation.patch
-Patch382: linux-2.6-pci-revert-remove-transparent-bridge-resizing.patch
-Patch383: linux-2.6-isapnp-fix-limits.patch
-Patch384: linux-2.6-pnp-extend-resource-limits.patch
-Patch385: linux-2.6-pnp-disable-overlapping-resources.patch
 
 Patch400: linux-2.6-scsi-cpqarray-set-master.patch
 Patch402: linux-2.6-scsi-mpt-vmware-fix.patch
 
-Patch420: linux-2.6-squashfs.patch
-Patch423: linux-2.6-gfs-locking-exports.patch
+# filesystem patches
+Patch420: linux-2.6-cifs-fix-unc-path-prefix.patch
+Patch421: linux-2.6-squashfs.patch
+Patch422: linux-2.6-ext34-xattr-fix.patch
+Patch423: linux-2.6-xfs-small-buffer-reads.patch
+Patch424: linux-2.6-gfs-locking-exports.patch
 
 Patch430: linux-2.6-net-silence-noisy-printks.patch
-Patch431: linux-2.6-netfilter-really-fix-oops-in-nf_nat_move_storage.patch
-Patch432: linux-2.6-net-tun-fix-rtnl-locking.patch
 Patch440: linux-2.6-sha_alignment.patch
 Patch450: linux-2.6-input-kill-stupid-messages.patch
-Patch452: linux-2.6-input-appletouch-macbook3-trackpad.patch
-Patch453: linux-2.6-input-apple-rename-identifiers.patch
-Patch454: linux-2.6-input-apple-add-aluminum-keyboard.patch
-Patch455: linux-2.6-input-apple-add-macbook-3rd-gen.patch
-Patch456: linux-2.6-input-apple-kbd-change-keycodes.patch
-Patch457: linux-2.6-input-apple-remove-4th-gen-kbd-quirk.patch
 Patch460: linux-2.6-serial-460800.patch
 Patch510: linux-2.6-silence-noise.patch
 Patch570: linux-2.6-selinux-mprotect-checks.patch
-Patch590: linux-2.6-unexport-symbols.patch
 Patch600: linux-2.6-vm-silence-atomic-alloc-failures.patch
-# Patch602: linux-2.6-mm-fix-ptrace-access-beyond-vma.patch
-# Patch605: linux-2.6-futex-fix-fixups.patch
 
 Patch610: linux-2.6-defaults-fat-utf8.patch
 Patch620: linux-2.6-defaults-unicode-vt.patch
-Patch640: linux-2.6-defaults-nommconf.patch
+Patch640: linux-2.6-defaults-pci_no_msi.patch
 Patch660: linux-2.6-libata-ali-atapi-dma.patch
 Patch670: linux-2.6-ata-quirk.patch
-# Patch671: linux-2.6-libata-fix-hpt-svw-dma-masking.patch
-Patch672: linux-2.6-libata-it821x-improve-emulation-handling.patch
-Patch673: linux-2.6-libata-pata_ataiixp-clear-simplex-b4-probe.patch
 Patch674: linux-2.6-sata-eeepc-faster.patch
 
 Patch680: linux-2.6-wireless.patch
 Patch681: linux-2.6-wireless-pending.patch
 Patch690: linux-2.6-at76.patch
 
-Patch720: linux-2.6-e1000-bad-csum-allow.patch
+Patch720: linux-2.6-e1000-corrupt-eeprom-checksum.patch
 Patch721: linux-2.6-netdev-e1000-disable-alpm.patch
 Patch725: linux-2.6-netdev-atl2.patch
-# Patch731: linux-2.6-netdev-smc91c92_cs-fix-station-addr.patch
-# Patch732: linux-2.6-netdev-bonding-fix-null-deref.patch
+Patch727: linux-2.6-e1000-ich9.patch
 
 #Patch768: linux-2.6-acpi-fix-sizeof.patch
 Patch784: linux-2.6-acpi-eeepc-hotkey.patch
 
 Patch820: linux-2.6-compile-fixes.patch
+Patch821: linux-2.6-compile-fix-gcc-43.patch
 Patch1101: linux-2.6-default-mmf_dump_elf_headers.patch
-Patch1103: linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch
 
 Patch1308: linux-2.6-usb-ehci-hcd-respect-nousb.patch
-Patch1309: linux-2.6-usb-serial-fix-recursive-lock.patch
-Patch1310: linux-2.6-usb-serial-option-add-dell-modem-1.patch
-Patch1311: linux-2.6-usb-serial-option-add-dell-modem-2.patch
-
-Patch1320: linux-2.6-isdn-hisax-fix-request_irq-oops.patch
-Patch1330: linux-2.6-hwmon-coretemp-add-penryn-cpu.patch
 
 Patch1400: linux-2.6-smarter-relatime.patch
-Patch1504: linux-2.6-xfs-optimize-away-realtime-tests.patch
-Patch1509: linux-2.6-xfs-setfattr-32bit-compat.patch
-Patch1510: linux-2.6-xfs-xfs_mount-refactor.patch
-Patch1511: linux-2.6-xfs-features2-fixup.patch
-Patch1512: linux-2.6-xfs-features2-fixup-fix.patch
 
 Patch1515: linux-2.6-lirc.patch
-Patch1520: linux-2.6-dcdbas-autoload.patch
-
 
 # nouveau + drm fixes
+Patch1801: linux-2.6-drm-git-mm.patch
 Patch1802: nouveau-drm.patch
-Patch1803: linux-2.6-ppc32-ucmpdi2.patch
-Patch1804: linux-2.6-drm-radeon-update.patch
-Patch1805: linux-2.6-git-initial-r500-drm.patch
+Patch1802: nouveau-drm-update.patch
+Patch1805: linux-2.6-drm-radeon-fix-oops.patch
+Patch1806: linux-2.6-drm-radeon-fix-oops2.patch
+Patch1807: linux-2.6-drm-fix-master-perm.patch
 
 # Updated firewire stack from linux1394 git
 Patch1910: linux-2.6-firewire-git-update.patch
 Patch1911: linux-2.6-firewire-git-pending.patch
-# fix thinkpad key events for volume/brightness
-Patch2100: linux-2.6-thinkpad-key-events.patch
 
 # usb video
 Patch2400: linux-2.6-uvcvideo.patch
 
-
-# Patch up paranoid iret
-Patch3240: linux-2.6-paranoid-iret-crash-fix.patch
-# Return kcore access policy to upstream behavior (bz 241362)
-Patch3300: linux-2.6-upstream-kcore-access.patch
-
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root-%{_target_cpu}
@@ -1014,10 +978,12 @@
 ApplyPatch linux-2.6-alsa-kill-annoying-messages.patch
 
 # Nouveau DRM + drm fixes
+ApplyPatch linux-2.6-drm-git-mm.patch
 ApplyPatch nouveau-drm.patch
-ApplyPatch linux-2.6-ppc32-ucmpdi2.patch
-ApplyPatch linux-2.6-drm-radeon-update.patch
-ApplyPatch linux-2.6-git-initial-r500-drm.patch
+ApplyPatch nouveau-drm-update.patch
+ApplyPatch linux-2.6-drm-radeon-fix-oops.patch
+#ApplyPatch linux-2.6-drm-radeon-fix-oops2.patch
+#ApplyPatch linux-2.6-drm-fix-master-perm.patch
 
 # enable sysrq-c on all kernels, not only kexec
 ApplyPatch linux-2.6-sysrq-c.patch
@@ -1027,38 +993,27 @@
 # x86(-64)
 # Compile 686 kernels tuned for Pentium4.
 ApplyPatch linux-2.6-x86-tune-generic.patch
-# Suppress APIC errors on UP x86-64.
-#ApplyPatch linux-2.6-x86_64-silence-up-apic-errors.patch
 # debug early boot
 #ApplyPatch linux-2.6-x86-debug-boot.patch
-# clear DF before calling signal handlers
-# applied on top of utrace
-ApplyPatch linux-2.6-x86-clear-df-for-signals.patch
-# prevent clobber of esi on x86 by sys_io_getevents() syscall
-ApplyPatch linux-2.6-x86-asmlinkage_protect-sys_io_getevents.patch
+# don't map or use disabled x86 vdso
+ApplyPatch linux-2.6-x86-dont-map-vdso-when-disabled.patch
+ApplyPatch linux-2.6-x86-dont-use-disabled-vdso-for-signals.patch
+# ecx is clobbered during IRQs (!)
+ApplyPatch linux-2.6-x86-fix-asm-constraint-in-do_IRQ.patch
+# allocate PCI ROM by default again
+ApplyPatch linux-2.6-x86-pci-revert-remove-default-rom-allocation.patch
+# don't read the apic if it's not mapped (#447183)
+ApplyPatch linux-2.6-x86-dont-read-maxlvt-if-apic-unmapped.patch
 
 #
 # PowerPC
 #
-###  UPSTREAM PATCHES
-# fix unwind
-# FEC support on MPC52xx
-# Fixups for PA Semi Electra
-ApplyPatch linux-2.6-pasemi-for-2.6.25.patch
-ApplyPatch linux-2.6-pasemi-reserve-i2c.patch
-# Fix up ibmvscsi for combined pSeries/iSeries build
-# Move pmac_zilog to its newly-registered device number
-###  UPSTREAM PATCHES FROM 2.6.25 (we think):
-# Suspend through /sys/power/state for PowerMac instead of magic ioctl
-# Suspend through /sys/power/state
-ApplyPatch linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch
-ApplyPatch linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch
-ApplyPatch linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch
-ApplyPatch linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch
-ApplyPatch linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch
-# ppc kernel hardware watchpoint support (bz 439619)
-ApplyPatch linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch
+###  UPSTREAM PATCHES:
 ###  NOT (YET) UPSTREAM:
+# RTC class driver for ppc_md rtc functions
+ApplyPatch linux-2.6-ppc-rtc.patch
+# use libgcc
+ApplyPatch linux-2.6-ppc-use-libgcc.patch
 # The EHCI ISO patch isn't yet upstream but is needed to fix reboot
 ApplyPatch linux-2.6-ps3-ehci-iso.patch
 # The storage alias patch is Fedora-local, and allows the old 'ps3_storage'
@@ -1069,7 +1024,17 @@
 ApplyPatch linux-2.6-ps3-legacy-bootloader-hack.patch
 # Alleviate G5 thermal shutdown problems
 ApplyPatch linux-2.6-g5-therm-shutdown.patch
-# Temporary hack to work around GCC PR #25724 / #21237
+# Provide modalias in sysfs for vio devices
+ApplyPatch linux-2.6-vio-modalias.patch
+# Fan support on iMac G5 iSight
+ApplyPatch linux-2.6-windfarm-pm121.patch
+ApplyPatch linux-2.6-windfarm-pm121-fix.patch
+# Work around PCIe bridge setup on iSight
+ApplyPatch linux-2.6-imac-transparent-bridge.patch
+# Link zImage at 32MiB (for POWER machines, Efika)
+ApplyPatch linux-2.6-powerpc-zImage-32MiB.patch
+# Don't show 'CHRP' in /proc/cpuinfo on Efika
+ApplyPatch linux-2.6-efika-not-chrp.patch
 
 #
 # Exec shield
@@ -1093,7 +1058,6 @@
 # pc speaker autoload
 
 # Various low-impact patches to aid debugging.
-ApplyPatch linux-2.6-debug-resource-overflow.patch
 ApplyPatch linux-2.6-debug-sizeof-structs.patch
 ApplyPatch linux-2.6-debug-nmi-timeout.patch
 ApplyPatch linux-2.6-debug-taint-vm.patch
@@ -1101,7 +1065,7 @@
 %if !%{debugbuildsenabled}
 ApplyPatch linux-2.6-debug-no-quiet.patch
 %endif
-# try to find out what is breaking acpi-cpufreq
+ApplyPatch linux-2.6-debug-vm-would-have-oomkilled.patch
 
 #
 # Make /dev/mem a need-to-know function
@@ -1116,16 +1080,6 @@
 #
 # driver core
 #
-# fix pci resource allocation broken in 2.6.24
-ApplyPatch linux-2.6-pci-revert-remove-transparent-bridge-resizing.patch
-# make "pci=rom" work as documented: don't assign addresses to every rom by default
-ApplyPatch linux-2.6-pci-remove-default-pci-rom-allocation.patch
-# fix resource limits for isapnp devices
-ApplyPatch linux-2.6-isapnp-fix-limits.patch
-# extend memory resource limit for pnp devices
-ApplyPatch linux-2.6-pnp-extend-resource-limits.patch
-# don't let pnp claim pci resources
-ApplyPatch linux-2.6-pnp-disable-overlapping-resources.patch
 
 #
 # SCSI Bits.
@@ -1138,33 +1092,25 @@
 # fin initio driver
 
 # Filesystem patches.
+# cifs
+ApplyPatch linux-2.6-cifs-fix-unc-path-prefix.patch
 # Squashfs
 ApplyPatch linux-2.6-squashfs.patch
+# more filesystem patches
+ApplyPatch linux-2.6-ext34-xattr-fix.patch
+ApplyPatch linux-2.6-xfs-small-buffer-reads.patch
 # export symbols for gfs2 locking modules
 ApplyPatch linux-2.6-gfs-locking-exports.patch
-# cifs kernel memory corruption fixes
 
 # Networking
 # Disable easy to trigger printk's.
 ApplyPatch linux-2.6-net-silence-noisy-printks.patch
-# fix oops in netfilter again
-ApplyPatch linux-2.6-netfilter-really-fix-oops-in-nf_nat_move_storage.patch
-# fix rtnl locking on tun/tap device address change
-ApplyPatch linux-2.6-net-tun-fix-rtnl-locking.patch
 
 # Misc fixes
 # Fix SHA1 alignment problem on ia64
 ApplyPatch linux-2.6-sha_alignment.patch
 # The input layer spews crap no-one cares about.
 ApplyPatch linux-2.6-input-kill-stupid-messages.patch
-# Add support for new macbook trackpads
-ApplyPatch linux-2.6-input-appletouch-macbook3-trackpad.patch
-# Add support for new Apple keyboards
-ApplyPatch linux-2.6-input-apple-rename-identifiers.patch
-ApplyPatch linux-2.6-input-apple-add-aluminum-keyboard.patch
-ApplyPatch linux-2.6-input-apple-add-macbook-3rd-gen.patch
-ApplyPatch linux-2.6-input-apple-kbd-change-keycodes.patch
-ApplyPatch linux-2.6-input-apple-remove-4th-gen-kbd-quirk.patch
 # Allow to use 480600 baud on 16C950 UARTs
 ApplyPatch linux-2.6-serial-460800.patch
 # add ids for new wacom tablets
@@ -1177,9 +1123,6 @@
 # don't leak memory in netlabel code
 # strip extra leading slashes in pathnames
 
-# Remove kernel-internal functionality that nothing external should use.
-ApplyPatch linux-2.6-unexport-symbols.patch
-
 #
 # VM related fixes.
 #
@@ -1191,9 +1134,8 @@
 ApplyPatch linux-2.6-defaults-fat-utf8.patch
 # Use unicode VT's by default.
 # ApplyPatch linux-2.6-defaults-unicode-vt.patch
-# Disable NMI watchdog by default.
 # Disable PCI MMCONFIG by default.
-ApplyPatch linux-2.6-defaults-nommconf.patch
+ApplyPatch linux-2.6-defaults-pci_no_msi.patch
 
 # libata
 #
@@ -1201,10 +1143,6 @@
 ApplyPatch linux-2.6-libata-ali-atapi-dma.patch
 # ia64 ata quirk
 ApplyPatch linux-2.6-ata-quirk.patch
-# fix some broken it821x adapters that have broken emulation
-ApplyPatch linux-2.6-libata-it821x-improve-emulation-handling.patch
-# clear simplex DMA before probing
-ApplyPatch linux-2.6-libata-pata_ataiixp-clear-simplex-b4-probe.patch
 # make eeepc ata go faster
 ApplyPatch linux-2.6-sata-eeepc-faster.patch
 
@@ -1219,16 +1157,12 @@
 # fixups to make current wireless patches build on this kernel
 ApplyPatch linux-2.6-wireless-fixups.patch
 
-# Restore ability to add/remove virtual i/fs to mac80211 devices
-ApplyPatch linux-2.6-cfg80211-extras.patch
-
-# add module alias for "zd1211rw-mac80211"
-ApplyPatch linux-2.6-zd1211rw-module-alias.patch
-
 # Workaround for flaky e1000 EEPROMs
-ApplyPatch linux-2.6-e1000-bad-csum-allow.patch
+ApplyPatch linux-2.6-e1000-corrupt-eeprom-checksum.patch
 # disable link power savings, should fix bad eeprom checksum too
 ApplyPatch linux-2.6-netdev-e1000-disable-alpm.patch
+# make new ich9 e1000 work
+ApplyPatch linux-2.6-e1000-ich9.patch
 # add atl2 network driver for eeepc
 ApplyPatch linux-2.6-netdev-atl2.patch
 
@@ -1251,31 +1185,14 @@
 # USB
 # some usb disks spin down automatically and need allow_restart
 ApplyPatch linux-2.6-usb-ehci-hcd-respect-nousb.patch
-# usb-serial can deadlock (#431379)
-ApplyPatch linux-2.6-usb-serial-fix-recursive-lock.patch
-# support two more dell modems
-ApplyPatch linux-2.6-usb-serial-option-add-dell-modem-1.patch
-ApplyPatch linux-2.6-usb-serial-option-add-dell-modem-2.patch
 
 # ISDN
-# fix request_irq oops
-ApplyPatch linux-2.6-isdn-hisax-fix-request_irq-oops.patch
 
 # hwmon
-# add penryn cpu to coretemp
-ApplyPatch linux-2.6-hwmon-coretemp-add-penryn-cpu.patch
-
 
 # implement smarter atime updates support.
 ApplyPatch linux-2.6-smarter-relatime.patch
 
-# xfs bugfixes & stack reduction
-ApplyPatch linux-2.6-xfs-optimize-away-realtime-tests.patch
-ApplyPatch linux-2.6-xfs-setfattr-32bit-compat.patch
-ApplyPatch linux-2.6-xfs-xfs_mount-refactor.patch
-ApplyPatch linux-2.6-xfs-features2-fixup.patch
-ApplyPatch linux-2.6-xfs-features2-fixup-fix.patch
-
 #
 # misc small stuff to make things compile
 #
@@ -1284,33 +1201,24 @@
 if [ "$C" -gt 10 ]; then
 ApplyPatch linux-2.6-compile-fixes.patch
 fi
+ApplyPatch linux-2.6-compile-fix-gcc-43.patch
 
 # build id related enhancements
 ApplyPatch linux-2.6-default-mmf_dump_elf_headers.patch
-ApplyPatch linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch
 
 # http://www.lirc.org/
 ApplyPatch linux-2.6-lirc.patch
 
-# DMI autoloading for dcdbas driver
-ApplyPatch linux-2.6-dcdbas-autoload.patch
-
 # FireWire updates and fixes
 # snap from http://me.in-berlin.de/~s5r6/linux1394/updates/
 ApplyPatch linux-2.6-firewire-git-update.patch
 #ApplyPatch linux-2.6-firewire-git-pending.patch
 
-ApplyPatch linux-2.6-thinkpad-key-events.patch
-
 # usb video
 ApplyPatch linux-2.6-uvcvideo.patch
 
 # ---------- below all scheduled for 2.6.25 -----------------
 
-# Patch up paranoid iret (#431314)
-ApplyPatch linux-2.6-paranoid-iret-crash-fix.patch
-ApplyPatch linux-2.6-upstream-kcore-access.patch
-
 # SELinux perf patches
 
 # END OF PATCH APPLICATIONS
@@ -1906,6 +1814,9 @@
 
 
 %changelog
+* Wed May 21 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-3
+- Initial cut of 2.6.25.4 kernel -- passes 'make prep'.
+
 * Wed May 21 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-2
 - eeepc, wireless, acpi, lirc, and uvcvideo updates for 2.6.25.
 

linux-2.6-build-nonintconfig.patch:

Index: linux-2.6-build-nonintconfig.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-build-nonintconfig.patch,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- linux-2.6-build-nonintconfig.patch	15 Feb 2008 23:58:52 -0000	1.12
+++ linux-2.6-build-nonintconfig.patch	21 May 2008 23:55:13 -0000	1.13
@@ -1,6 +1,8 @@
---- linux-2.6.23.noarch/scripts/kconfig/Makefile~	2007-10-29 19:20:10.000000000 -0400
-+++ linux-2.6.23.noarch/scripts/kconfig/Makefile	2007-10-29 19:20:24.000000000 -0400
-@@ -29,6 +29,11 @@ oldconfig: $(obj)/conf
+diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
+index 32e8c5a..8020453 100644
+--- a/scripts/kconfig/Makefile
++++ b/scripts/kconfig/Makefile
+@@ -24,6 +24,11 @@ oldconfig: $(obj)/conf
  silentoldconfig: $(obj)/conf
  	$< -s $(Kconfig)
  
@@ -9,12 +11,14 @@
 +loose_nonint_oldconfig: $(obj)/conf
 +	$< -B $(Kconfig)
 +
- # Create new linux.po file
+ # Create new linux.pot file
  # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
  # The symlink is used to repair a deficiency in arch/um
---- linux-2.6.17/scripts/kconfig/conf.c.nonintconfig
-+++ linux-2.6.17/scripts/kconfig/conf.c
-@@ -21,6 +21,8 @@ enum {
+diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
+index fda6313..ed33b66 100644
+--- a/scripts/kconfig/conf.c
++++ b/scripts/kconfig/conf.c
+@@ -22,6 +22,8 @@ enum {
  	ask_all,
  	ask_new,
  	ask_silent,
@@ -23,7 +27,7 @@
  	set_default,
  	set_yes,
  	set_mod,
-@@ -37,6 +39,8 @@ static struct menu *rootEntry;
+@@ -38,6 +40,8 @@ static struct menu *rootEntry;
  
  static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
  
@@ -32,7 +36,7 @@
  static const char *get_help(struct menu *menu)
  {
  	if (menu_has_help(menu))
-@@ -103,6 +107,16 @@ static void conf_askvalue(struct symbol 
+@@ -112,6 +116,16 @@ static int conf_askvalue(struct symbol *sym, const char *def)
  		fflush(stdout);
  		fgets(line, 128, stdin);
  		return 1;
@@ -49,7 +53,7 @@
  	case set_default:
  		printf("%s\n", def);
  		return 1;
-@@ -346,6 +358,11 @@ static int conf_choice(struct menu *menu
+@@ -351,6 +365,11 @@ static int conf_choice(struct menu *menu)
  			printf("?");
  		printf("]: ");
  		switch (input_mode) {
@@ -61,7 +65,7 @@
  		case ask_new:
  		case ask_silent:
  			if (!is_new) {
-@@ -482,6 +499,10 @@ static void check_conf(struct menu *menu
+@@ -486,6 +505,10 @@ static void check_conf(struct menu *menu)
  			if (!conf_cnt++)
  				printf(_("*\n* Restart config...\n*\n"));
  			rootEntry = menu_get_parent_menu(menu);
@@ -72,7 +76,13 @@
  			conf(rootEntry);
  		}
  	}
-@@ -501,6 +522,12 @@ int main(int ac, char **av)
+@@ -504,11 +527,17 @@ int main(int ac, char **av)
+ 	bindtextdomain(PACKAGE, LOCALEDIR);
+ 	textdomain(PACKAGE);
+ 
+-	while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
++	while ((opt = getopt(ac, av, "osbBdD:nmyrh")) != -1) {
+ 		switch (opt) {
  		case 'o':
  			input_mode = ask_new;
  			break;
@@ -85,7 +95,7 @@
  		case 's':
  			input_mode = ask_silent;
  			valid_stdin = isatty(0) && isatty(1) && isatty(2);
-@@ -566,6 +593,8 @@ int main(int ac, char **av)
+@@ -573,6 +602,8 @@ int main(int ac, char **av)
  		}
  	case ask_all:
  	case ask_new:
@@ -94,7 +104,7 @@
  		conf_read(NULL);
  		break;
  	case set_no:
-@@ -612,7 +641,8 @@ int main(int ac, char **av)
+@@ -619,7 +650,8 @@ int main(int ac, char **av)
  	do {
  		conf_cnt = 0;
  		check_conf(&rootmenu);
@@ -104,7 +114,7 @@
  	if (conf_write(NULL)) {
  		fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
  		return 1;
-@@ -623,5 +653,5 @@ skip_check:
+@@ -630,5 +662,5 @@ skip_check:
  		return 1;
  	}
  

linux-2.6-crash-driver.patch:

Index: linux-2.6-crash-driver.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-crash-driver.patch,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- linux-2.6-crash-driver.patch	15 Feb 2008 23:58:52 -0000	1.9
+++ linux-2.6-crash-driver.patch	21 May 2008 23:55:13 -0000	1.10
@@ -1,15 +1,3 @@
-diff -urNp --exclude-from=/home/davej/.exclude linux-1050/arch/i386/mm/init.c linux-1060/arch/i386/mm/init.c
---- linux-1050/arch/x86/mm/init_32.c
-+++ linux-1060/arch/x86/mm/init_32.c
-@@ -248,6 +248,8 @@ int devmem_is_allowed(unsigned long page
-    return 0;
- }
- 
-+EXPORT_SYMBOL_GPL(page_is_ram);
-+
- #ifdef CONFIG_HIGHMEM
- pte_t *kmap_pte;
- pgprot_t kmap_prot;
 diff -urNp --exclude-from=/home/davej/.exclude linux-1050/arch/ia64/kernel/ia64_ksyms.c linux-1060/arch/ia64/kernel/ia64_ksyms.c
 --- linux-1050/arch/ia64/kernel/ia64_ksyms.c
 +++ linux-1060/arch/ia64/kernel/ia64_ksyms.c
@@ -23,24 +11,6 @@
  #ifdef ASM_SUPPORTED
  # ifdef CONFIG_SMP
  #  if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
-diff -urNp --exclude-from=/home/davej/.exclude linux-1050/arch/x86_64/mm/init.c linux-1060/arch/x86_64/mm/init.c
---- linux-1050/arch/x86/mm/init_64.c
-+++ linux-1060/arch/x86/mm/init_64.c
-@@ -6,5 +6,6 @@
-  */
- 
-+#include <linux/module.h>
- #include <linux/signal.h>
- #include <linux/sched.h>
- #include <linux/kernel.h>
-@@ -452,6 +452,7 @@ static inline int page_is_ram (unsigned 
- 	}
- 	return 0;
- }
-+EXPORT_SYMBOL_GPL(page_is_ram);
- 
- /*
-  * Memory hotplug specific functions
 diff -urNp --exclude-from=/home/davej/.exclude linux-1050/drivers/char/crash.c linux-1060/drivers/char/crash.c
 --- linux-1050/drivers/char/crash.c
 +++ linux-1060/drivers/char/crash.c
@@ -369,3 +339,15 @@
 +#endif /* __KERNEL__ */
 +
 +#endif /* _ASM_IA64_CRASH_H */
+diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
+index c004d94..13417a2 100644
+--- a/arch/x86/mm/ioremap.c
++++ b/arch/x86/mm/ioremap.c
+@@ -65,6 +65,7 @@ int page_is_ram(unsigned long pagenr)
+ 	}
+ 	return 0;
+ }
++EXPORT_SYMBOL_GPL(page_is_ram);
+ 
+ /*
+  * Fix up the linear direct mapping of the kernel to avoid cache attribute

linux-2.6-debug-no-quiet.patch:

Index: linux-2.6-debug-no-quiet.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-debug-no-quiet.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- linux-2.6-debug-no-quiet.patch	28 May 2007 06:33:16 -0000	1.5
+++ linux-2.6-debug-no-quiet.patch	21 May 2008 23:55:13 -0000	1.6
@@ -1,21 +1,24 @@
 diff --git a/init/main.c b/init/main.c
-index a92989e..f4dee52 100644
+index 8b19820..c27d2a0 100644
 --- a/init/main.c
 +++ b/init/main.c
-@@ -236,7 +236,11 @@ static int __init quiet_kernel(char *str)
+@@ -244,8 +244,12 @@ static int __init debug_kernel(char *str)
+ 
+ static int __init quiet_kernel(char *str)
  {
- 	if (*str)
- 		return 0;
 +#ifdef CONFIG_DEBUG_IGNORE_QUIET
 +	console_loglevel = 10;
 +#else
  	console_loglevel = 4;
 +#endif
- 	return 1;
+ 	return 0;
  }
  
---- linux-2.6.21.noarch/lib/Kconfig.debug~	2007-05-28 02:18:07.000000000 -0400
-+++ linux-2.6.21.noarch/lib/Kconfig.debug	2007-05-28 02:18:43.000000000 -0400
+ early_param("debug", debug_kernel);
+diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
+index a370fe8..aee5495 100644
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
 @@ -1,3 +1,8 @@
 +config DEBUG_IGNORE_QUIET
 +	bool "Ignore 'quiet' boot argument"

linux-2.6-debug-sizeof-structs.patch:

Index: linux-2.6-debug-sizeof-structs.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-debug-sizeof-structs.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- linux-2.6-debug-sizeof-structs.patch	14 Feb 2007 18:26:48 -0000	1.5
+++ linux-2.6-debug-sizeof-structs.patch	21 May 2008 23:55:13 -0000	1.6
@@ -2,7 +2,7 @@
 +++ linux-2.6/init/main.c	2006-07-11 02:49:01.000000000 -0400
 @@ -350,6 +350,10 @@ static void __init setup_per_cpu_areas(v
  }
- #endif /* !__GENERIC_PER_CPU */
+ #endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */
  
 +#include <linux/ext3_fs_i.h>
 +#include <linux/skbuff.h>
@@ -16,7 +16,7 @@
 @@ -403,6 +403,15 @@ static void __init smp_init(void)
  	/* Any cleanup work */
  	printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
- 	smp_cpus_done(max_cpus);
+ 	smp_cpus_done(setup_max_cpus);
 +
 +	printk(KERN_DEBUG "sizeof(vma)=%u bytes\n", (unsigned int) sizeof(struct vm_area_struct));
 +	printk(KERN_DEBUG "sizeof(page)=%u bytes\n", (unsigned int) sizeof(struct page));

linux-2.6-debug-taint-vm.patch:

Index: linux-2.6-debug-taint-vm.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-debug-taint-vm.patch,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- linux-2.6-debug-taint-vm.patch	2 Aug 2007 23:37:31 -0000	1.16
+++ linux-2.6-debug-taint-vm.patch	21 May 2008 23:55:13 -0000	1.17
@@ -1,40 +1,8 @@
---- linux-2.6.20.noarch/include/asm-generic/bug.h~	2007-02-12 16:18:21.000000000 -0500
-+++ linux-2.6.20.noarch/include/asm-generic/bug.h	2007-02-12 16:19:57.000000000 -0500
-@@ -3,6 +3,10 @@
- 
- #include <linux/compiler.h>
- 
-+#ifndef __ASSEMBLY__
-+extern const char *print_tainted(void);
-+#endif
-+
- #ifdef CONFIG_BUG
- 
- #ifdef CONFIG_GENERIC_BUG
-@@ -22,7 +26,7 @@ struct bug_entry {
- 
- #ifndef HAVE_ARCH_BUG
- #define BUG() do { \
--	printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
-+	printk("BUG: failure at %s:%d/%s()! (%s)\n", __FILE__, __LINE__, __FUNCTION__, print_tainted()); \
- 	panic("BUG!"); \
- } while (0)
- #endif
-@@ -39,8 +39,8 @@ struct bug_entry {
- #define WARN_ON(condition) ({						\
- 	int __ret_warn_on = !!(condition);				\
- 	if (unlikely(__ret_warn_on)) {					\
--		printk("WARNING: at %s:%d %s()\n", __FILE__,		\
--			__LINE__, __FUNCTION__);			\
-+		printk("WARNING: at %s:%d %s() (%s)\n", __FILE__,	\
-+			__LINE__, __FUNCTION__, print_tainted());	\
- 		dump_stack();						\
- 	}								\
- 	unlikely(__ret_warn_on);					\
-diff -urNp --exclude-from=/home/davej/.exclude linux-1740/kernel/panic.c linux-2000/kernel/panic.c
---- linux-1740/kernel/panic.c
-+++ linux-2000/kernel/panic.c
-@@ -151,6 +151,7 @@ const char *print_tainted(void)
+diff --git a/kernel/panic.c b/kernel/panic.c
+index 6f6e03e..198fc58 100644
+--- a/kernel/panic.c
++++ b/kernel/panic.c
+@@ -173,6 +173,7 @@ const char *print_tainted(void)
  		snprintf(buf, sizeof(buf), "Not tainted");
  	return(buf);
  }
@@ -42,26 +10,11 @@
  
  void add_taint(unsigned flag)
  {
---- linux-2.6.15/mm/page_alloc.c~	2006-01-07 20:48:33.000000000 -0500
-+++ linux-2.6.15/mm/page_alloc.c	2006-01-07 20:49:24.000000000 -0500
-@@ -137,12 +137,12 @@ static inline int bad_range(struct zone 
- static void bad_page(struct page *page)
- {
- 	printk(KERN_EMERG "Bad page state in process '%s'\n"
--		KERN_EMERG "page:%p flags:0x%0*lx mapping:%p mapcount:%d count:%d\n"
-+		KERN_EMERG "page:%p flags:0x%0*lx mapping:%p mapcount:%d count:%d (%s)\n"
- 		KERN_EMERG "Trying to fix it up, but a reboot is needed\n"
- 		KERN_EMERG "Backtrace:\n",
- 		current->comm, page, (int)(2*sizeof(unsigned long)),
- 		(unsigned long)page->flags, page->mapping,
--		page_mapcount(page), page_count(page));
-+		page_mapcount(page), page_count(page), print_tainted());
- 	dump_stack();
- 	page->flags &= ~(1 << PG_lru	|
- 			1 << PG_private |
---- linux-2.6.21.noarch/mm/slab.c~	2007-05-27 22:57:44.000000000 -0400
-+++ linux-2.6.21.noarch/mm/slab.c	2007-05-27 22:58:08.000000000 -0400
-@@ -1816,8 +1816,8 @@ static void check_poison_obj(struct kmem
+diff --git a/mm/slab.c b/mm/slab.c
+index 2e338a5..e5627f9 100644
+--- a/mm/slab.c
++++ b/mm/slab.c
+@@ -1846,8 +1846,8 @@ static void check_poison_obj(struct kmem_cache *cachep, void *objp)
  			/* Print header */
  			if (lines == 0) {
  				printk(KERN_ERR
@@ -72,7 +25,7 @@
  				print_objinfo(cachep, objp, 0);
  			}
  			/* Hexdump the affected line */
-@@ -2924,8 +2924,8 @@ static void check_slabp(struct kmem_cach
+@@ -2935,8 +2935,8 @@ static void check_slabp(struct kmem_cache *cachep, struct slab *slabp)
  	if (entries != cachep->num - slabp->inuse) {
  bad:
  		printk(KERN_ERR "slab: Internal list corruption detected in "
@@ -83,9 +36,11 @@
  		for (i = 0;
  		     i < sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t);
  		     i++) {
---- linux-2.6.22.noarch/mm/slub.c~	2007-07-20 14:15:05.000000000 -0400
-+++ linux-2.6.22.noarch/mm/slub.c	2007-07-20 14:17:37.000000000 -0400
-@@ -450,7 +450,7 @@ static void slab_bug(struct kmem_cache *
+diff --git a/mm/slub.c b/mm/slub.c
+index 9c1d9f3..e11d58d 100644
+--- a/mm/slub.c
++++ b/mm/slub.c
+@@ -451,7 +451,7 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...)
  	va_end(args);
  	printk(KERN_ERR "========================================"
  			"=====================================\n");
@@ -94,3 +49,35 @@
  	printk(KERN_ERR "----------------------------------------"
  			"-------------------------------------\n\n");
  }
+diff --git a/kernel/panic.c b/kernel/panic.c
+index d9e90cf..570b1f6 100644
+--- a/kernel/panic.c
++++ b/kernel/panic.c
+@@ -306,8 +306,8 @@ void warn_on_slowpath(const char *file, int line)
+ 	sprint_symbol(function, caller);
+ 
+ 	printk(KERN_WARNING "------------[ cut here ]------------\n");
+-	printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file,
+-		line, function);
++	printk(KERN_WARNING "WARNING: at %s:%d %s() (%s)\n", file,
++		line, function, print_tainted());
+ 	print_modules();
+ 	dump_stack();
+ 	print_oops_end_marker();
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c
+index 402a504..2085092 100644
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -225,10 +225,10 @@ static void bad_page(struct page *page)
+ 	void *pc = page_get_page_cgroup(page);
+ 
+ 	printk(KERN_EMERG "Bad page state in process '%s'\n" KERN_EMERG
+-		"page:%p flags:0x%0*lx mapping:%p mapcount:%d count:%d\n",
++		"page:%p flags:0x%0*lx mapping:%p mapcount:%d count:%d (%s)\n",
+ 		current->comm, page, (int)(2*sizeof(unsigned long)),
+ 		(unsigned long)page->flags, page->mapping,
+-		page_mapcount(page), page_count(page));
++		page_mapcount(page), page_count(page), print_tainted());
+ 	if (pc) {
+ 		printk(KERN_EMERG "cgroup:%p\n", pc);
+ 		page_reset_bad_cgroup(page);

linux-2.6-devmem.patch:

Index: linux-2.6-devmem.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-devmem.patch,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- linux-2.6-devmem.patch	15 Feb 2008 23:58:52 -0000	1.19
+++ linux-2.6-devmem.patch	21 May 2008 23:55:13 -0000	1.20
@@ -1,582 +1,119 @@
+From: Arjan van de Ven <arjan at linux.intel.com>
+Subject: [PATCH] make /dev/kmem a config option
 
-Restrict the abilities of /dev/mem and /dev/kmem
-Make them read-only, and also restrict which areas of
-memory can be read.
+This patch makes /dev/kmem a config option; /dev/kmem is VERY rarely
+used, and when used, it's generally for no good (rootkits tend to be
+the most common users). With this config option, users have the
+choice to disable /dev/kmem, saving some size as well.
 
-Original by Arjan van de Ven
-Signed-off-by: Dave Jones <davej at redhat.com>
+A patch to disable /dev/kmem has been in the Fedora and RHEL kernels for
+4+ years now without any known problems or legit users of /dev/kmem.
 
-Index: linux-2.6/arch/i386/mm/init.c
-===================================================================
---- linux-2.6.orig/arch/x86/mm/init_32.c
-+++ linux-2.6/arch/x86/mm/init_32.c
-@@ -233,6 +233,25 @@ int page_is_ram(unsigned long pagenr)
- 	return 0;
- }
- 
-+/*
-+ * devmem_is_allowed() checks to see if /dev/mem access to a certain address is
-+ * valid. The argument is a physical page number.
-+ *
-+ *
-+ * On x86, access has to be given to the first megabyte of ram because that area
-+ * contains bios code and data regions used by X and dosemu and similar apps.
-+ * Access has to be given to non-kernel-ram areas as well, these contain the PCI
-+ * mmio resources as well as potential bios/acpi data regions.
-+ */
-+int devmem_is_allowed(unsigned long pagenr)
-+{
-+	if (pagenr <= 256)
-+		return 1;
-+	if (!page_is_ram(pagenr))
-+		return 1;
-+	return 0;
-+}
-+
- #ifdef CONFIG_HIGHMEM
- pte_t *kmap_pte;
- pgprot_t kmap_prot;
-Index: linux-2.6/arch/ia64/mm/init.c
-===================================================================
---- linux-2.6.orig/arch/ia64/mm/init.c
-+++ linux-2.6/arch/ia64/mm/init.c
-@@ -263,6 +263,12 @@ free_initrd_mem (unsigned long start, un
- 	}
- }
- 
-+int page_is_ram(unsigned long pagenr)
-+{
-+      //FIXME: implement w/efi walk
-+      return 1;
-+}
-+
- /*
-  * This installs a clean page in the kernel's page table.
-  */
-Index: linux-2.6/arch/powerpc/mm/mem.c
-===================================================================
---- linux-2.6.orig/arch/powerpc/mm/mem.c
-+++ linux-2.6/arch/powerpc/mm/mem.c
-@@ -45,6 +45,7 @@
- #include <asm/prom.h>
- #include <asm/lmb.h>
- #include <asm/sections.h>
-+#include <asm/rtas.h>
- #include <asm/vdso.h>
- 
- #include "mmu_decl.h"
-@@ -343,6 +344,19 @@ void __init mem_init(void)
- 	max_mapnr = max_pfn;
- 	totalram_pages += free_all_bootmem();
- #endif
-+
-+#ifdef CONFIG_PPC_PSERIES
-+	/* Mark the RTAS pages as PG_reserved so userspace can mmap them */
-+	if (rtas_rmo_buf) {
-+		unsigned long pfn, start_pfn, end_pfn;
-+
-+		start_pfn = rtas_rmo_buf >> PAGE_SHIFT;
-+		end_pfn = (rtas_rmo_buf + RTAS_RMOBUF_MAX) >>  PAGE_SHIFT;
-+		for (pfn = start_pfn; pfn < end_pfn; pfn++)
-+			SetPageReserved(pfn_to_page(pfn));
-+	}
-+#endif
-+
- 	for_each_online_pgdat(pgdat) {
- 		for (i = 0; i < pgdat->node_spanned_pages; i++) {
- 			if (!pfn_valid(pgdat->node_start_pfn + i))
---- linux-2.6.21.noarch/arch/s390/mm/init.c~	2007-05-27 23:04:09.000000000 -0400
-+++ linux-2.6.21.noarch/arch/s390/mm/init.c	2007-05-27 23:04:20.000000000 -0400
-@@ -156,6 +156,11 @@ void __init paging_init(void)
- 	free_area_init_nodes(max_zone_pfns);
- }
- 
-+int page_is_ram(unsigned long pagenr)
-+{
-+	return pagenr < max_mapnr;
-+}
-+
- void __init mem_init(void)
- {
- 	unsigned long codesize, reservedpages, datasize, initsize;
-Index: linux-2.6/arch/x86_64/mm/init.c
-===================================================================
---- linux-2.6.orig/arch/x86/mm/init_64.c
-+++ linux-2.6/arch/x86/mm/init_64.c
-@@ -452,6 +452,28 @@ void __init clear_kernel_mapping(unsigne
- 	__flush_tlb_all();
- } 
- 
-+static int page_is_ram(unsigned long pagenr)
-+{
-+	int i;
-+
-+	for (i = 0; i < e820.nr_map; i++) {
-+		unsigned long addr, end;
-+
-+		if (e820.map[i].type != E820_RAM)	/* not usable memory */
-+			continue;
-+		/*
-+		 * !!!FIXME!!! Some BIOSen report areas as RAM that
-+		 * are not. Notably the 640->1Mb area. We need a sanity
-+		 * check here.
-+		 */
-+		addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT;
-+		end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT;
-+		if  ((pagenr >= addr) && (pagenr < end))
-+			return 1;
-+	}
-+	return 0;
-+}
-+
- /*
-  * Memory hotplug specific functions
-  */
-@@ -534,6 +556,26 @@ int __add_pages(struct zone *z, unsigned
- }
- #endif
- 
-+/*
-+ * devmem_is_allowed() checks to see if /dev/mem access to a certain address is
-+ * valid. The argument is a physical page number.
-+ *
-+ *
-+ * On x86-64, access has to be given to the first 1MB of ram because that area
-+ * contains bios code and data regions used by X and dosemu and similar apps.
-+ * Access has to be given to non-kernel-ram areas as well, these contain the
-+ * PCI MMIO resources as well as potential bios/acpi data regions.
-+ */
-+int devmem_is_allowed(unsigned long pagenr)
-+{
-+	if (pagenr <= 256)
-+		return 1;
-+	if (!page_is_ram(pagenr))
-+		return 1;
-+	return 0;
-+}
-+
-+
- static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
- 			 kcore_vsyscall;
- 
-Index: linux-2.6/fs/proc/kcore.c
-===================================================================
---- linux-2.6.orig/fs/proc/kcore.c
-+++ linux-2.6/fs/proc/kcore.c
-@@ -25,7 +25,7 @@
- 
- static int open_kcore(struct inode * inode, struct file * filp)
- {
--	return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
-+	return -EPERM;
- }
- 
- static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *);
-Index: linux-2.6/include/asm-alpha/page.h
-===================================================================
---- linux-2.6.orig/include/asm-alpha/page.h
-+++ linux-2.6/include/asm-alpha/page.h
-@@ -93,6 +93,8 @@ typedef unsigned long pgprot_t;
- #define VM_DATA_DEFAULT_FLAGS		(VM_READ | VM_WRITE | VM_EXEC | \
- 					 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
- 
-+#define devmem_is_allowed(x) 1
-+
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-Index: linux-2.6/include/asm-arm/page.h
-===================================================================
---- linux-2.6.orig/include/asm-arm/page.h
-+++ linux-2.6/include/asm-arm/page.h
-@@ -192,6 +192,8 @@ typedef unsigned long pgprot_t;
- 
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #endif
-Index: linux-2.6/include/asm-cris/page.h
-===================================================================
---- linux-2.6.orig/include/asm-cris/page.h
-+++ linux-2.6/include/asm-cris/page.h
-@@ -76,6 +76,8 @@ typedef struct { unsigned long pgprot; }
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #endif /* _CRIS_PAGE_H */
-Index: linux-2.6/include/asm-h8300/page.h
-===================================================================
---- linux-2.6.orig/include/asm-h8300/page.h
-+++ linux-2.6/include/asm-h8300/page.h
-@@ -78,6 +78,8 @@ extern unsigned long memory_end;
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #endif /* _H8300_PAGE_H */
-Index: linux-2.6/include/asm-i386/page.h
-===================================================================
---- linux-2.6.orig/include/asm-x86/page_32.h
-+++ linux-2.6/include/asm-x86/page_32.h
-@@ -108,6 +108,8 @@ extern int sysctl_legacy_va_layout;
- 
- extern int page_is_ram(unsigned long pagenr);
- 
-+extern int devmem_is_allowed(unsigned long pagenr);
-+
- #endif /* __ASSEMBLY__ */
- 
- #ifdef __ASSEMBLY__
-Index: linux-2.6/include/asm-ia64/page.h
-===================================================================
---- linux-2.6.orig/include/asm-ia64/page.h
-+++ linux-2.6/include/asm-ia64/page.h
-@@ -227,5 +227,6 @@ get_order (unsigned long size)
- 					 (((current->personality & READ_IMPLIES_EXEC) != 0)	\
- 					  ? VM_EXEC : 0))
- 
-+#define devmem_is_allowed(x) 1
- # endif /* __KERNEL__ */
- #endif /* _ASM_IA64_PAGE_H */
-Index: linux-2.6/include/asm-m68k/page.h
-===================================================================
---- linux-2.6.orig/include/asm-m68k/page.h
-+++ linux-2.6/include/asm-m68k/page.h
-@@ -177,6 +177,8 @@ static inline void *__va(unsigned long x
- 
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #endif /* _M68K_PAGE_H */
-Index: linux-2.6/include/asm-m68knommu/page.h
-===================================================================
---- linux-2.6.orig/include/asm-m68knommu/page.h
-+++ linux-2.6/include/asm-m68knommu/page.h
-@@ -77,6 +77,8 @@ extern unsigned long memory_end;
- 
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #endif /* _M68KNOMMU_PAGE_H */
-Index: linux-2.6/include/asm-mips/page.h
-===================================================================
---- linux-2.6.orig/include/asm-mips/page.h
-+++ linux-2.6/include/asm-mips/page.h
-@@ -178,4 +178,6 @@ typedef struct { unsigned long pgprot; }
- 
- #endif /* defined (__KERNEL__) */
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* _ASM_PAGE_H */
-Index: linux-2.6/include/asm-parisc/page.h
-===================================================================
---- linux-2.6.orig/include/asm-parisc/page.h
-+++ linux-2.6/include/asm-parisc/page.h
-@@ -169,6 +169,8 @@ extern int npmem_ranges;
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #endif /* _PARISC_PAGE_H */
-Index: linux-2.6/include/asm-ppc/page.h
-===================================================================
---- linux-2.6.orig/include/asm-ppc/page.h
-+++ linux-2.6/include/asm-ppc/page.h
-@@ -173,6 +173,8 @@ extern __inline__ int get_order(unsigned
- /* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
- #define __HAVE_ARCH_GATE_AREA		1
- 
-+#define devmem_is_allowed(x) 1
-+
- #include <asm-generic/memory_model.h>
- #endif /* __KERNEL__ */
- #endif /* _PPC_PAGE_H */
-Index: linux-2.6/include/asm-powerpc/page.h
-===================================================================
---- linux-2.6.orig/include/asm-powerpc/page.h
-+++ linux-2.6/include/asm-powerpc/page.h
-@@ -191,6 +191,8 @@ extern const char *arch_vma_name(struct 
- #include <asm-generic/memory_model.h>
- #endif /* __ASSEMBLY__ */
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #endif /* _ASM_POWERPC_PAGE_H */
-Index: linux-2.6/include/asm-s390/page.h
-===================================================================
---- linux-2.6.orig/include/asm-s390/page.h
-+++ linux-2.6/include/asm-s390/page.h
-@@ -148,6 +148,8 @@ page_get_storage_key(unsigned long addr)
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #endif /* _S390_PAGE_H */
---- linux-2.6.22.noarch/include/asm-sh/page.h~	2007-07-20 14:22:49.000000000 -0400
-+++ linux-2.6.22.noarch/include/asm-sh/page.h	2007-07-20 14:22:54.000000000 -0400
-@@ -158,5 +158,7 @@ typedef struct { unsigned long pgd; } pg
- #define ARCH_KMALLOC_MINALIGN	4
- #define ARCH_SLAB_MINALIGN	4
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- #endif /* __ASM_SH_PAGE_H */
-Index: linux-2.6/include/asm-sh64/page.h
-===================================================================
---- linux-2.6.orig/include/asm-sh64/page.h
-+++ linux-2.6/include/asm-sh64/page.h
-@@ -115,5 +115,7 @@ typedef struct { unsigned long pgprot; }
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- #endif /* __ASM_SH64_PAGE_H */
-Index: linux-2.6/include/asm-sparc/page.h
-===================================================================
---- linux-2.6.orig/include/asm-sparc/page.h
-+++ linux-2.6/include/asm-sparc/page.h
-@@ -163,6 +163,8 @@ extern unsigned long pfn_base;
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #endif /* _SPARC_PAGE_H */
-Index: linux-2.6/include/asm-sparc64/page.h
-===================================================================
---- linux-2.6.orig/include/asm-sparc64/page.h
-+++ linux-2.6/include/asm-sparc64/page.h
-@@ -141,6 +141,8 @@ typedef unsigned long pgprot_t;
- #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
- 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
- 
-+#define devmem_is_allowed(x) 1
-+
- #include <asm-generic/page.h>
- 
- #endif /* __KERNEL__ */
---- linux-2.6.21.noarch/include/asm-um/page.h~	2007-05-27 23:05:22.000000000 -0400
-+++ linux-2.6.21.noarch/include/asm-um/page.h	2007-05-27 23:05:34.000000000 -0400
-@@ -114,6 +114,8 @@ extern unsigned long uml_physmem;
- extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
- #define HAVE_ARCH_VALIDATE
- 
-+#define devmem_is_allowed(x) 1
-+
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-Index: linux-2.6/include/asm-v850/page.h
-===================================================================
---- linux-2.6.orig/include/asm-v850/page.h
-+++ linux-2.6/include/asm-v850/page.h
-@@ -126,6 +126,8 @@ typedef unsigned long pgprot_t;
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* KERNEL */
- 
- #endif /* __V850_PAGE_H__ */
-Index: linux-2.6/include/asm-x86_64/page.h
+Signed-off-by: Arjan van de Ven <arjan at linux.intel.com>
+---
+ drivers/char/Kconfig |    8 ++++++++
+ drivers/char/mem.c   |   10 ++++++++++
+ 2 files changed, 18 insertions(+)
+
+Index: linux.trees.git/drivers/char/Kconfig
 ===================================================================
---- linux-2.6.orig/include/asm-x86/page_64.h
-+++ linux-2.6/include/asm-x86/page_64.h
-@@ -138,6 +138,10 @@ typedef struct { unsigned long pgprot; }
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
-+#ifndef __ASSEMBLY__
-+extern int devmem_is_allowed(unsigned long pagenr);
-+#endif
-+
- #endif /* __KERNEL__ */
+--- linux.trees.git.orig/drivers/char/Kconfig
++++ linux.trees.git/drivers/char/Kconfig
+@@ -80,6 +80,14 @@ config VT_HW_CONSOLE_BINDING
+ 	 information. For framebuffer console users, please refer to
+ 	 <file:Documentation/fb/fbcon.txt>.
  
- #endif /* _X86_64_PAGE_H */
---- linux-2.6.20.noarch/fs/proc/kcore.c.orig	2007-06-04 15:44:29.000000000 -0400
-+++ linux-2.6.20.noarch/fs/proc/kcore.c	2007-06-04 15:48:57.000000000 -0400
-@@ -23,10 +23,10 @@
- #include <asm/io.h>
- 
- #define CORE_STR "CORE"
--
-+unsigned int allow_kcore_access;
- static int open_kcore(struct inode * inode, struct file * filp)
- {
--	return -EPERM;
-+	return (capable(CAP_SYS_RAWIO) && allow_kcore_access) ? 0 : -EPERM;
- }
- 
- static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *);
---- linux-2.6.23.noarch/arch/x86/kernel/setup_32.c~	2007-10-22 01:29:17.000000000 -0400
-+++ linux-2.6.23.noarch/arch/x86/kernel/setup_32.c	2007-10-22 01:29:41.000000000 -0400
-@@ -391,12 +391,16 @@ static inline unsigned long long get_tot
- }
- 
- #ifdef CONFIG_KEXEC
-+extern int allow_kcore_access;
-+
- static void __init reserve_crashkernel(void)
- {
- 	unsigned long long total_mem;
- 	unsigned long long crash_size, crash_base;
- 	int ret;
- 
-+	allow_kcore_access = 1;	/*enable ability to read /proc/kcore*/
-+
- 	total_mem = get_total_mem();
- 
- 	ret = parse_crashkernel(boot_command_line, total_mem,
---- linux-2.6.23.noarch/drivers/char/Kconfig~	2007-11-15 14:10:18.000000000 -0500
-+++ linux-2.6.23.noarch/drivers/char/Kconfig	2007-11-15 14:10:40.000000000 -0500
-@@ -1062,6 +1062,20 @@ config DEVPORT
- 	depends on ISA || PCI
- 	default y
- 
-+config WRITABLE_DEVMEM
-+	bool "Allow writing to /dev/mem"
++config DEVKMEM
++	bool "/dev/kmem virtual device support"
 +	help
-+	  Very little software actually requires a writable /dev/mem
-+	  Disabling this feature will close off a potential attack
-+	  vector for kernel rootkits.
-+
-+config WRITABLE_DEVKMEM
-+	bool "Allow writing to /dev/kmem"
-+	help
-+	  Very little software actually requires a writable /dev/kmem
-+	  Disabling this feature will close off a potential attack
-+	  vector for kernel rootkits.
-+
- source "drivers/s390/char/Kconfig"
- 
- endmenu
---- vanilla/drivers/char/mem.c	2007-11-15 14:15:27.000000000 -0500
-+++ linux-2.6.23.noarch/drivers/char/mem.c	2007-11-15 14:13:54.000000000 -0500
-@@ -108,6 +108,23 @@ static inline int valid_mmap_phys_addr_r
- }
- #endif
- 
-+static inline int range_is_allowed(unsigned long from, unsigned long to)
-+{
-+	unsigned long cursor;
-+
-+	cursor = from >> PAGE_SHIFT;
-+	while ((cursor << PAGE_SHIFT) < to) {
-+		if (!devmem_is_allowed(cursor)) {
-+			printk(KERN_INFO "Program %s tried to read /dev/mem "
-+				"between %lx->%lx.\n",
-+				current->comm, from, to);
-+			return 0;
-+		}
-+		cursor++;
-+	}
-+	return 1;
-+}
-+
- /*
-  * This funcion reads the *physical* memory. The f_pos points directly to the 
-  * memory location. 
-@@ -157,6 +174,9 @@ static ssize_t read_mem(struct file * fi
- 		 */
- 		ptr = xlate_dev_mem_ptr(p);
- 
-+		//FIXME: Add write-once sysctl
-+		//if (!range_is_allowed(p, p+count))
-+		//	return -EPERM;
- 		if (copy_to_user(buf, ptr, sz))
- 			return -EFAULT;
- 		buf += sz;
-@@ -169,6 +189,7 @@ static ssize_t read_mem(struct file * fi
- 	return read;
++	  Say Y here if you want to support the /dev/kmem device. The
++	  /dev/kmem device is rarely used, but can be used for certain
++	  kind of kernel debugging operations.
++	  When in doubt, say "N".
++
+ config SERIAL_NONSTANDARD
+ 	bool "Non-standard serial port support"
+ 	depends on HAS_IOMEM
+Index: linux.trees.git/drivers/char/mem.c
+===================================================================
+--- linux.trees.git.orig/drivers/char/mem.c
++++ linux.trees.git/drivers/char/mem.c
+@@ -295,6 +295,7 @@ static int mmap_mem(struct file * file, 
+ 	return 0;
  }
  
-+#ifdef CONFIG_WRITABLE_DEVMEM
- static ssize_t write_mem(struct file * file, const char __user * buf, 
- 			 size_t count, loff_t *ppos)
++#ifdef CONFIG_DEVKMEM
+ static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
  {
-@@ -214,6 +235,8 @@ static ssize_t write_mem(struct file * f
- 		 */
- 		ptr = xlate_dev_mem_ptr(p);
- 
-+		if (!range_is_allowed(ptr, ptr+sz))
-+			return -EPERM;
- 		copied = copy_from_user(ptr, buf, sz);
- 		if (copied) {
- 			written += sz - copied;
-@@ -230,6 +253,9 @@ static ssize_t write_mem(struct file * f
- 	*ppos += written;
- 	return written;
+ 	unsigned long pfn;
+@@ -315,6 +316,7 @@ static int mmap_kmem(struct file * file,
+ 	vma->vm_pgoff = pfn;
+ 	return mmap_mem(file, vma);
  }
-+#else
-+#define write_mem 0
 +#endif
  
- #ifndef __HAVE_PHYS_MEM_ACCESS_PROT
- static pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
-@@ -363,6 +389,9 @@ static ssize_t read_kmem(struct file *fi
- 	ssize_t low_count, read, sz;
- 	char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
- 
-+	//FIXME: Add write-once sysctl
-+	//return -EPERM;
-+
- 	read = 0;
- 	if (p < (unsigned long) high_memory) {
- 		low_count = count;
-@@ -439,6 +468,7 @@ static ssize_t read_kmem(struct file *fi
- }
- 
+ #ifdef CONFIG_CRASH_DUMP
+ /*
+@@ -353,6 +355,7 @@ static ssize_t read_oldmem(struct file *
+ extern long vread(char *buf, char *addr, unsigned long count);
+ extern long vwrite(char *buf, char *addr, unsigned long count);
  
-+#ifdef CONFIG_WRITABLE_DEVKMEM
- static inline ssize_t
- do_write_kmem(void *p, unsigned long realp, const char __user * buf,
- 	      size_t count, loff_t *ppos)
-@@ -557,6 +587,9 @@ static ssize_t write_kmem(struct file * 
++#ifdef CONFIG_DEVKMEM
+ /*
+  * This function reads the *virtual* memory as seen by the kernel.
+  */
+@@ -557,6 +560,7 @@ static ssize_t write_kmem(struct file * 
   	*ppos = p;
   	return virtr + wrote;
  }
-+#else
-+#define write_kmem 0
 +#endif
  
  #ifdef CONFIG_DEVPORT
  static ssize_t read_port(struct file * file, char __user * buf,
-@@ -873,7 +906,6 @@ static const struct {
+@@ -734,6 +738,7 @@ static const struct file_operations mem_
+ 	.get_unmapped_area = get_unmapped_area_mem,
+ };
+ 
++#ifdef CONFIG_DEVKMEM
+ static const struct file_operations kmem_fops = {
+ 	.llseek		= memory_lseek,
+ 	.read		= read_kmem,
+@@ -742,6 +747,7 @@ static const struct file_operations kmem
+ 	.open		= open_kmem,
+ 	.get_unmapped_area = get_unmapped_area_mem,
+ };
++#endif
+ 
+ static const struct file_operations null_fops = {
+ 	.llseek		= null_lseek,
+@@ -820,11 +826,13 @@ static int memory_open(struct inode * in
+ 			filp->f_mapping->backing_dev_info =
+ 				&directly_mappable_cdev_bdi;
+ 			break;
++#ifdef CONFIG_DEVKMEM
+ 		case 2:
+ 			filp->f_op = &kmem_fops;
+ 			filp->f_mapping->backing_dev_info =
+ 				&directly_mappable_cdev_bdi;
+ 			break;
++#endif
+ 		case 3:
+ 			filp->f_op = &null_fops;
+ 			break;
+@@ -873,7 +881,9 @@ static const struct {
  	const struct file_operations	*fops;
  } devlist[] = { /* list of minor devices */
  	{1, "mem",     S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
--	{2, "kmem",    S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
++#ifdef CONFIG_DEVKMEM
+ 	{2, "kmem",    S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
++#endif
  	{3, "null",    S_IRUGO | S_IWUGO,           &null_fops},
  #ifdef CONFIG_DEVPORT
  	{4, "port",    S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
+
+
+-- 
+If you want to reach me at my work email, use arjan at linux.intel.com
+For development, discussion and tips for power savings, 
+visit http://www.lesswatts.org
+

linux-2.6-execshield.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.75 -r 1.76 linux-2.6-execshield.patch
Index: linux-2.6-execshield.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-execshield.patch,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- linux-2.6-execshield.patch	15 Feb 2008 23:58:52 -0000	1.75
+++ linux-2.6-execshield.patch	21 May 2008 23:55:13 -0000	1.76
@@ -1,24 +1,33 @@
-Index: linux-2.6/arch/i386/kernel/cpu/common.c
-===================================================================
---- linux-2.6.orig/arch/x86/kernel/cpu/common.c
-+++ linux-2.6/arch/x86/kernel/cpu/common.c
-@@ -437,6 +437,13 @@ void __cpuinit identify_cpu(struct cpuin
- 	if (disable_pse)
- 		clear_bit(X86_FEATURE_PSE, c->x86_capability);
+diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
+index f86a3c4..4c5f70d 100644
+--- a/arch/x86/kernel/cpu/common.c
++++ b/arch/x86/kernel/cpu/common.c
+@@ -478,6 +478,20 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
+ 	 * we do "generic changes."
+ 	 */
  
++	/*
++	 *  emulation of NX with segment limits unfortunately means
++	 *  we have to disable the fast system calls, due to the way that
++	 *  sysexit clears the segment limits on return.
++	 *  If we have either disabled exec-shield on the boot command line,
++	 *  or we have NX, then we don't need to do this.
++	 */
 +	if (exec_shield != 0) {
 +#ifdef CONFIG_X86_PAE
 +		if (!test_bit(X86_FEATURE_NX, c->x86_capability))
 +#endif
-+		clear_bit(X86_FEATURE_SEP, c->x86_capability);
++			clear_bit(X86_FEATURE_SEP, c->x86_capability);
 +	}
 +
  	/* If the model name is still unset, do table lookup. */
  	if ( !c->x86_model_id[0] ) {
  		char *p;
---- linux-2.6.21.noarch/arch/x86/kernel/process_32.c~	2007-05-27 22:27:45.000000000 -0400
-+++ linux-2.6.21.noarch/arch/x86/kernel/process_32.c	2007-05-27 22:28:22.000000000 -0400
-@@ -649,7 +649,8 @@ struct task_struct fastcall * __switch_t
+diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
+index a7d50a5..83f7b4e 100644
+--- a/arch/x86/kernel/process_32.c
++++ b/arch/x86/kernel/process_32.c
+@@ -677,7 +677,8 @@ struct task_struct * __switch_to(struct task_struct *prev_p, struct task_struct
  	/* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
  
  	__unlazy_fpu(prev_p);
@@ -28,24 +37,32 @@
  
  	/* we're going to use this soon, after a few expensive things */
  	if (next_p->fpu_counter > 5)
-@@ -907,3 +909,60 @@ unsigned long arch_align_stack(unsigned 
- 		sp -= get_random_int() % 8192;
- 	return sp & ~0xf;
+diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
+index a7d50a5..86e35cb 100644
+--- a/arch/x86/kernel/process_32.c
++++ b/arch/x86/kernel/process_32.c
+@@ -847,3 +847,39 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
+ 	unsigned long range_end = mm->brk + 0x02000000;
+ 	return randomize_range(mm->brk, range_end, 0) ? : mm->brk;
  }
 +
-+void arch_add_exec_range(struct mm_struct *mm, unsigned long limit)
++static void modify_cs(struct mm_struct *mm, unsigned long limit)
 +{
-+	if (limit > mm->context.exec_limit) {
-+		mm->context.exec_limit = limit;
-+		set_user_cs(&mm->context.user_cs, limit);
-+		if (mm == current->mm) {
-+			preempt_disable();
-+			load_user_cs_desc(smp_processor_id(), mm);
-+			preempt_enable();
-+		}
++	mm->context.exec_limit = limit;
++	set_user_cs(&mm->context.user_cs, limit);
++	if (mm == current->mm) {
++		preempt_disable();
++		load_user_cs_desc(smp_processor_id(), mm);
++		preempt_enable();
 +	}
 +}
 +
++void arch_add_exec_range(struct mm_struct *mm, unsigned long limit)
++{
++	if (limit > mm->context.exec_limit)
++		modify_cs(mm, limit);
++}
++
 +void arch_remove_exec_range(struct mm_struct *mm, unsigned long old_end)
 +{
 +	struct vm_area_struct *vma;
@@ -55,14 +72,7 @@
 +		for (vma = mm->mmap; vma; vma = vma->vm_next)
 +			if ((vma->vm_flags & VM_EXEC) && (vma->vm_end > limit))
 +				limit = vma->vm_end;
-+
-+		mm->context.exec_limit = limit;
-+		set_user_cs(&mm->context.user_cs, limit);
-+		if (mm == current->mm) {
-+			preempt_disable();
-+			load_user_cs_desc(smp_processor_id(), mm);
-+			preempt_enable();
-+		}
++		modify_cs(mm, limit);
 +	}
 +}
 +
@@ -71,26 +81,61 @@
 +	mm->context.exec_limit = 0;
 +	set_user_cs(&mm->context.user_cs, 0);
 +}
-+
-+/*
-+ * Generate random brk address between 128MB and 196MB. (if the layout
-+ * allows it.)
-+ */
-+void randomize_brk(unsigned long old_brk)
-+{
-+	unsigned long new_brk, range_start, range_end;
-+
-+	range_start = 0x08000000;
-+	if (current->mm->brk >= range_start)
-+		range_start = current->mm->brk;
-+	range_end = range_start + 0x02000000;
-+	new_brk = randomize_range(range_start, range_end, 0);
-+	if (new_brk)
-+		current->mm->brk = new_brk;
-+}
-+
---- linux-2.6.22.noarch/arch/x86/kernel/smp_32.c~	2007-07-20 13:48:03.000000000 -0400
-+++ linux-2.6.22.noarch/arch/x86/kernel/smp_32.c	2007-07-20 13:48:08.000000000 -0400
+diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c
+index 309366f..8a940dc 100644
+--- a/arch/x86/kernel/setup64.c
++++ b/arch/x86/kernel/setup64.c
+@@ -45,46 +45,6 @@ EXPORT_SYMBOL_GPL(__supported_pte_mask);
+ 
+ static int do_not_nx __cpuinitdata = 0;
+ 
+-/* noexec=on|off
+-Control non executable mappings for 64bit processes.
+-
+-on	Enable(default)
+-off	Disable
+-*/ 
+-static int __init nonx_setup(char *str)
+-{
+-	if (!str)
+-		return -EINVAL;
+-	if (!strncmp(str, "on", 2)) {
+-                __supported_pte_mask |= _PAGE_NX; 
+- 		do_not_nx = 0; 
+-	} else if (!strncmp(str, "off", 3)) {
+-		do_not_nx = 1;
+-		__supported_pte_mask &= ~_PAGE_NX;
+-        }
+-	return 0;
+-} 
+-early_param("noexec", nonx_setup);
+-
+-int force_personality32 = 0; 
+-
+-/* noexec32=on|off
+-Control non executable heap for 32bit processes.
+-To control the stack too use noexec=off
+-
+-on	PROT_READ does not imply PROT_EXEC for 32bit processes
+-off	PROT_READ implies PROT_EXEC (default)
+-*/
+-static int __init nonx32_setup(char *str)
+-{
+-	if (!strcmp(str, "on"))
+-		force_personality32 &= ~READ_IMPLIES_EXEC;
+-	else if (!strcmp(str, "off"))
+-		force_personality32 |= READ_IMPLIES_EXEC;
+-	return 1;
+-}
+-__setup("noexec32=", nonx32_setup);
+-
+ /*
+  * Copy data used in early init routines from the initial arrays to the
+  * per cpu data areas.  These arrays then become expendable and the
+diff --git a/arch/x86/kernel/smp_32.c b/arch/x86/kernel/smp_32.c
+index dc0cde9..cca75b4 100644
+--- a/arch/x86/kernel/smp_32.c
++++ b/arch/x86/kernel/smp_32.c
 @@ -22,6 +22,7 @@
  
  #include <asm/mtrr.h>
@@ -99,7 +144,7 @@
  #include <asm/mmu_context.h>
  #include <mach_apic.h>
  
[...1854 lines suppressed...]
--#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
-+#define BAD_ADDR(x) IS_ERR_VALUE(x)
- 
- static int set_brk(unsigned long start, unsigned long end)
- {
-@@ -295,33 +295,70 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
- #ifndef elf_map
- 
- static unsigned long elf_map(struct file *filep, unsigned long addr,
--		struct elf_phdr *eppnt, int prot, int type)
-+		struct elf_phdr *eppnt, int prot, int type,
-+		unsigned long total_size)
- {
- 	unsigned long map_addr;
--	unsigned long pageoffset = ELF_PAGEOFFSET(eppnt->p_vaddr);
-+	unsigned long size = eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr);
-+	unsigned long off = eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr);
-+	addr = ELF_PAGESTART(addr);
-+	size = ELF_PAGEALIGN(size);
- 
--	down_write(&current->mm->mmap_sem);
- 	/* mmap() will return -EINVAL if given a zero size, but a
- 	 * segment with zero filesize is perfectly valid */
--	if (eppnt->p_filesz + pageoffset)
--		map_addr = do_mmap(filep, ELF_PAGESTART(addr),
--				   eppnt->p_filesz + pageoffset, prot, type,
--				   eppnt->p_offset - pageoffset);
--	else
--		map_addr = ELF_PAGESTART(addr);
-+	if (!size)
-+		return addr;
-+
-+	down_write(&current->mm->mmap_sem);
-+	/*
-+	* total_size is the size of the ELF (interpreter) image.
-+	* The _first_ mmap needs to know the full size, otherwise
-+	* randomization might put this image into an overlapping
-+	* position with the ELF binary image. (since size < total_size)
-+	* So we first map the 'big' image - and unmap the remainder at
-+	* the end. (which unmap is needed for ELF images with holes.)
-+	*/
-+	if (total_size) {
-+		total_size = ELF_PAGEALIGN(total_size);
-+		map_addr = do_mmap(filep, addr, total_size, prot, type, off);
-+		if (!BAD_ADDR(map_addr))
-+			do_munmap(current->mm, map_addr+size, total_size-size);
-+	} else
-+		map_addr = do_mmap(filep, addr, size, prot, type, off);
-+
- 	up_write(&current->mm->mmap_sem);
- 	return(map_addr);
- }
- 
- #endif /* !elf_map */
- 
-+static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
-+{
-+	int i, first_idx = -1, last_idx = -1;
-+
-+	for (i = 0; i < nr; i++) {
-+		if (cmds[i].p_type == PT_LOAD) {
-+			last_idx = i;
-+			if (first_idx == -1)
-+				first_idx = i;
-+		}
-+	}
-+	if (first_idx == -1)
-+		return 0;
-+
-+	return cmds[last_idx].p_vaddr + cmds[last_idx].p_memsz -
-+				ELF_PAGESTART(cmds[first_idx].p_vaddr);
-+}
-+
-+
- /* This is much more generalized than the library routine read function,
-    so we keep this separate.  Technically the library read function
-    is only provided so that we can read a.out libraries that have
-    an ELF header */
- 
- static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
--		struct file *interpreter, unsigned long *interp_load_addr)
-+		struct file *interpreter, unsigned long *interp_map_addr,
-+		unsigned long no_base)
- {
- 	struct elf_phdr *elf_phdata;
- 	struct elf_phdr *eppnt;
-@@ -329,6 +366,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
- 	int load_addr_set = 0;
- 	unsigned long last_bss = 0, elf_bss = 0;
- 	unsigned long error = ~0UL;
-+	unsigned long total_size;
- 	int retval, i, size;
- 
- 	/* First of all, some simple consistency checks */
-@@ -367,6 +405,12 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
- 		goto out_close;
- 	}
- 
-+	total_size = total_mapping_size(elf_phdata, interp_elf_ex->e_phnum);
-+	if (!total_size) {
-+		error = -EINVAL;
-+		goto out_close;
-+	}
-+
- 	eppnt = elf_phdata;
- 	for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) {
- 		if (eppnt->p_type == PT_LOAD) {
-@@ -384,9 +428,14 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
- 			vaddr = eppnt->p_vaddr;
- 			if (interp_elf_ex->e_type == ET_EXEC || load_addr_set)
- 				elf_type |= MAP_FIXED;
-+			else if (no_base && interp_elf_ex->e_type == ET_DYN)
-+				load_addr = -vaddr;
- 
- 			map_addr = elf_map(interpreter, load_addr + vaddr,
--					   eppnt, elf_prot, elf_type);
-+					   eppnt, elf_prot, elf_type, total_size);
-+			total_size = 0;
-+			if (!*interp_map_addr)
-+				*interp_map_addr = map_addr;
- 			error = map_addr;
- 			if (BAD_ADDR(map_addr))
- 				goto out_close;
-@@ -452,8 +501,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
- 			goto out_close;
- 	}
- 
--	*interp_load_addr = load_addr;
--	error = ((unsigned long)interp_elf_ex->e_entry) + load_addr;
-+	error = load_addr;
- 
- out_close:
- 	kfree(elf_phdata);
-@@ -550,7 +598,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
- 	int elf_exec_fileno;
- 	int retval, i;
- 	unsigned int size;
--	unsigned long elf_entry, interp_load_addr = 0;
-+	unsigned long elf_entry;
-+	unsigned long interp_load_addr = 0;
- 	unsigned long start_code, end_code, start_data, end_data;
- 	unsigned long reloc_func_desc = 0;
- 	char passed_fileno[6];
-@@ -814,9 +863,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
- 	current->mm->start_stack = bprm->p;
- 
- 	/* Now we do a little grungy work by mmaping the ELF image into
--	   the correct location in memory.  At this point, we assume that
--	   the image should be loaded at fixed address, not at a variable
--	   address. */
-+	   the correct location in memory. */
- 	for(i = 0, elf_ppnt = elf_phdata;
- 	    i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
- 		int elf_prot = 0, elf_flags;
-@@ -870,11 +917,15 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
- 			 * default mmap base, as well as whatever program they
- 			 * might try to exec.  This is because the brk will
- 			 * follow the loader, and is not movable.  */
-+#ifdef CONFIG_X86
-+			load_bias = 0;
-+#else
- 			load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
-+#endif
- 		}
- 
- 		error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
--				elf_prot, elf_flags);
-+				elf_prot, elf_flags, 0);
- 		if (BAD_ADDR(error)) {
- 			send_sig(SIGKILL, current, 0);
- 			retval = IS_ERR((void *)error) ?
-@@ -950,13 +1001,25 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
- 	}
- 
- 	if (elf_interpreter) {
--		if (interpreter_type == INTERPRETER_AOUT)
-+		if (interpreter_type == INTERPRETER_AOUT) {
- 			elf_entry = load_aout_interp(&loc->interp_ex,
- 						     interpreter);
--		else
-+		} else {
-+			unsigned long uninitialized_var(interp_map_addr);
-+
- 			elf_entry = load_elf_interp(&loc->interp_elf_ex,
- 						    interpreter,
--						    &interp_load_addr);
-+						    &interp_map_addr,
-+						    load_bias);
-+			if (!BAD_ADDR(elf_entry)) {
-+				/*
-+				 * load_elf_interp() returns relocation
-+				 * adjustment
-+				 */
-+				interp_load_addr = elf_entry;
-+				elf_entry += loc->interp_elf_ex.e_entry;
-+			}
-+		}
- 		if (BAD_ADDR(elf_entry)) {
- 			force_sig(SIGSEGV, current);
- 			retval = IS_ERR((void *)elf_entry) ?

linux-2.6-firewire-git-pending.patch:

Index: linux-2.6-firewire-git-pending.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-firewire-git-pending.patch,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- linux-2.6-firewire-git-pending.patch	15 Apr 2008 19:17:32 -0000	1.11
+++ linux-2.6-firewire-git-pending.patch	21 May 2008 23:55:13 -0000	1.12
@@ -3,4 +3,104 @@
 # tree, which we think we're going to want...
 #
 
+Date: Sat, 12 Apr 2008 22:31:25 +0200 (CEST)
+From: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Subject: [PATCH update] firewire: fw-ohci: work around generation bug in TI
+	controllers (fix AV/C and more)
+To: linux1394-devel at lists.sourceforge.net
+Cc: linux-kernel at vger.kernel.org
+
+Unlike the ohci1394 driver, fw-ohci uses the selfIDGeneration field of
+bus reset packets to determine the generation of incoming requests as
+per OHCI 1.1 clause 8.4.2.3.  This is more precise --- provided that the
+controller inserts the correct generation.  Texas Instruments chips
+often don't.
+
+This prevented the transmission of response packets, which for example
+broke AV/C transactions as used when communicating with miniDV cameras
+and any other AV/C devices.
+
+There is apparently no way to detect and adjust incorrect generations.
+Therefore we ignore the generation of bus reset packets from TI chips
+and use the generation of the self ID buffer instead.  Alas this is
+received at a slightly wrong time.  In rare cases, this could cause us
+to not respond to legitimate requests or to respond to expired requests.
+(The latter is less likely because the bus reset packet AR event is
+typically handled before the self ID complete event.)
+
+Bug reported by Mladen Kuntner, who was extraordinarily patient while
+dealing with the driver maintainers.
+https://bugzilla.redhat.com/show_bug.cgi?id=243081
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
+---
+
+update: use a quirk flag for simpler code
+
+ drivers/firewire/fw-ohci.c |   21 ++++++++++++++++-----
+ 1 file changed, 16 insertions(+), 5 deletions(-)
+
+Index: linux/drivers/firewire/fw-ohci.c
+===================================================================
+--- linux.orig/drivers/firewire/fw-ohci.c
++++ linux/drivers/firewire/fw-ohci.c
+@@ -181,6 +181,7 @@ struct fw_ohci {
+ 	int request_generation;	/* for timestamping incoming requests */
+ 	u32 bus_seconds;
+ 	bool old_uninorth;
++	bool bus_reset_packet_quirk;
+ 
+ 	/*
+ 	 * Spinlock for accessing fw_ohci data.  Never call out of
+@@ -571,14 +572,19 @@ static __le32 *handle_ar_packet(struct a
+ 	 * generation.  We only need this for requests; for responses
+ 	 * we use the unique tlabel for finding the matching
+ 	 * request.
++	 *
++	 * Alas some chips sometimes emit bus reset packets with a
++	 * wrong generation.  We set the correct generation for these
++	 * at a slightly incorrect time (in bus_reset_tasklet).
+ 	 */
+-
+-	if (evt == OHCI1394_evt_bus_reset)
+-		ohci->request_generation = (p.header[2] >> 16) & 0xff;
+-	else if (ctx == &ohci->ar_request_ctx)
++	if (evt == OHCI1394_evt_bus_reset) {
++		if (!ohci->bus_reset_packet_quirk)
++			ohci->request_generation = (p.header[2] >> 16) & 0xff;
++	} else if (ctx == &ohci->ar_request_ctx) {
+ 		fw_core_handle_request(&ohci->card, &p);
+-	else
++	} else {
+ 		fw_core_handle_response(&ohci->card, &p);
++	}
+ 
+ 	return buffer + length + 1;
+ }
+@@ -1285,6 +1291,9 @@ static void bus_reset_tasklet(unsigned l
+ 	context_stop(&ohci->at_response_ctx);
+ 	reg_write(ohci, OHCI1394_IntEventClear, OHCI1394_busReset);
+ 
++	if (ohci->bus_reset_packet_quirk)
++		ohci->request_generation = generation;
++
+ 	/*
+ 	 * This next bit is unrelated to the AT context stuff but we
+ 	 * have to do it under the spinlock also.  If a new config rom
+@@ -2360,6 +2369,8 @@ pci_probe(struct pci_dev *dev, const str
+ 	ohci->old_uninorth = dev->vendor == PCI_VENDOR_ID_APPLE &&
+ 			     dev->device == PCI_DEVICE_ID_APPLE_UNI_N_FW;
+ #endif
++	ohci->bus_reset_packet_quirk = dev->vendor == PCI_VENDOR_ID_TI;
++
+ 	spin_lock_init(&ohci->lock);
+ 
+ 	tasklet_init(&ohci->bus_reset_tasklet,
+
+-- 
+Stefan Richter
+-=====-==--- -=-- -==--
+http://arcgraph.de/sr/
+
 

linux-2.6-firewire-git-update.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.7 -r 1.8 linux-2.6-firewire-git-update.patch
Index: linux-2.6-firewire-git-update.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-firewire-git-update.patch,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- linux-2.6-firewire-git-update.patch	16 Apr 2008 20:49:08 -0000	1.7
+++ linux-2.6-firewire-git-update.patch	21 May 2008 23:55:13 -0000	1.8
@@ -1,6374 +1,1845 @@
-IEEE 1394 updates for Linux 2.6.24 (v702 2008-04-12)
+git diff in linux1394-2.6.git vs. v2.6.25-rc9, April 12, 2008
 
- MAINTAINERS                              |    4 
- drivers/firewire/Kconfig                 |   55 -
- drivers/firewire/fw-card.c               |  111 +--
- drivers/firewire/fw-cdev.c               |   33 
- drivers/firewire/fw-device.c             |  360 +++++++---
- drivers/firewire/fw-device.h             |   60 +
- drivers/firewire/fw-iso.c                |    5 
- drivers/firewire/fw-ohci.c               |  801 +++++++++++++++++------
- drivers/firewire/fw-ohci.h               |    2 
- drivers/firewire/fw-sbp2.c               |  652 +++++++++++++-----
- drivers/firewire/fw-topology.c           |   32 
- drivers/firewire/fw-topology.h           |   11 
- drivers/firewire/fw-transaction.c        |   85 +-
- drivers/firewire/fw-transaction.h        |   25 
- drivers/ieee1394/dma.c                   |   37 -
- drivers/ieee1394/dv1394.c                |    4 
- drivers/ieee1394/highlevel.c             |    6 
- drivers/ieee1394/ieee1394_core.c         |    2 
- drivers/ieee1394/ieee1394_transactions.c |   68 -
- drivers/ieee1394/nodemgr.c               |    6 
- drivers/ieee1394/ohci1394.c              |  241 +++---
- drivers/ieee1394/pcilynx.c               |   15 
- drivers/ieee1394/raw1394.c               |    6 
- drivers/ieee1394/sbp2.c                  |   76 +-
- drivers/ieee1394/sbp2.h                  |    3 
- drivers/ieee1394/video1394.c             |    4 
- lib/Kconfig.debug                        |   12 
- 27 files changed, 1799 insertions(+), 917 deletions(-)
-
-========================================================================
-Date: Sat, 12 Apr 2008 22:31:25 +0200 (CEST)
-From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: firewire: fw-ohci: work around generation bug in TI controllers (fix AV/C and more)
-
-Unlike the ohci1394 driver, fw-ohci uses the selfIDGeneration field of
-bus reset packets to determine the generation of incoming requests as
-per OHCI 1.1 clause 8.4.2.3.  This is more precise --- provided that the
-controller inserts the correct generation.  Texas Instruments chips
-often don't.
-
-This prevented the transmission of response packets, which for example
-broke AV/C transactions as used when communicating with miniDV cameras
-and any other AV/C devices.
-
-There is apparently no way to detect and adjust incorrect generations.
-Therefore we ignore the generation of bus reset packets from TI chips
-and use the generation of the self ID buffer instead.  Alas this is
-received at a slightly wrong time.  In rare cases, this could cause us
-to not respond to legitimate requests or to respond to expired requests.
-(The latter is less likely because the bus reset packet AR event is
-typically handled before the self ID complete event.)
-
-Bug reported by Mladen Kuntner, who was extraordinarily patient while
-dealing with the driver maintainers.
-https://bugzilla.redhat.com/show_bug.cgi?id=243081
-
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
----
- drivers/firewire/fw-ohci.c |   21 ++++++++++++++++-----
- 1 file changed, 16 insertions(+), 5 deletions(-)
-
-========================================================================
-Date: Fri, 11 Apr 2008 00:51:15 +0200 (CEST)
-From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: firewire: fw-ohci: extend logging of bus generations and node ID
-
-Extend the logging of "AR evt_bus_reset, link internal" to "AR
-evt_bus_reset, generation ${selfIDGeneration}".  That way we can check
-whether this generation matches the one seen in self ID complete event
-logging.  See OHCI 1.1 clause 8.4.2.3.
-
-Also extend logging of "firewire_ohci: * selfIDs, generation *" by
-"local node ID ffc*" in self ID logging to make the local node in AT/AR
-event logs more obvious.
-
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
----
- drivers/firewire/fw-ohci.c |   17 ++++++++++++-----
- 1 file changed, 12 insertions(+), 5 deletions(-)
-
-========================================================================
-Date: Fri, 11 Apr 2008 00:08:08 +0200
-From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: firewire: fw-ohci: add option for remote debugging - amendment
-
-(reduced backport version for 2.6.24 and older)
-
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
----
- lib/Kconfig.debug |    7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-========================================================================
-Date: Mon, 7 Apr 2008 22:33:35 +0200 (CEST)
-From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: firewire: fw-ohci: conditionally log busReset interrupts
-
-Add a debug option to watch bus reset interrupt events.  Half of this
-patch is taken from Jarod Wilson's first version of the JMicron fix.
-
-BusReset interrupts are only generated if the respective module
-parameter flag was set before the controller is being initialized.
-Else we keep this event masked to reduce IRQ load in normal operation
-and to avoid potential problems with buggy chips.
-
-Note, this is unlike the other IRQ events whose logging can be enabled
-any time after chip initialization.  This and the influence on what
-interrupts the chip generates is why I added an extra flag for it.
-
-Also, reorder the debug parameter flags according to their perceived
-usefulness.
-
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Signed-off-by: Jarod Wilson <jwilson at redhat.com>
----
- drivers/firewire/fw-ohci.c |   28 ++++++++++++++++++++--------
- 1 file changed, 20 insertions(+), 8 deletions(-)
-
-========================================================================
-Date: Mon, 7 Apr 2008 22:32:33 +0200 (CEST)
-From: Jarod Wilson <jwilson at redhat.com>
-Subject: firewire: fw-ohci: don't append to AT context when it's not active
-
-I finally tracked down the issues with this JMicron PCI-e card in my
-possession to a failure to comply with section 7.2.3.2 of the OHCI 1.1
-specification (thanks to Kristian for the pointer to illustrate that it
-is indeed a flaw in this card, not the driver). The controller should
-simply flush the packets we've appended to its AT queue if a bus reset
-occurs before they've been transmitted and we'll try again, but
-something goes wrong and the controller winds up hung.
-
-However, we can avoid the problem by simply checking if the
-IntEvent.busReset register had been set before we try appending to the
-AT context. When busReset is set, the AT context is completely halted
-until busReset is cleared, so there's no point in appending AT packets
-until the register is cleared. So at_context_queue_packet() now checks
-for busReset being set, and bails with an RCODE_GENERATION packet ack,
-which results in us trying to append the packet again after recognizing
-the fact there has been a bus reset, and clearing busReset.
-
-Signed-off-by: Jarod Wilson <jwilson at redhat.com>
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
----
- drivers/firewire/fw-ohci.c |   15 +++++++++++++--
- 1 file changed, 13 insertions(+), 2 deletions(-)
-
-========================================================================
-Date: Thu, 3 Apr 2008 17:18:23 -0400
-From: Jarod Wilson <jwilson at redhat.com>
-Subject: firewire: fw-ohci: log regAccessFail events
-
-While trying to debug this piece of crap JMicron PCI-e controller in my
-possession, one thought was that perhaps I was encountering register access
-failures. I'm not, but logging them would be good, so we can see if they
-are a real problem we should be taking into account anywhere in the code.
-
-Signed-off-by: Jarod Wilson <jwilson at redhat.com>
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de> (added list contact)
----
- drivers/firewire/fw-ohci.c |   13 ++++++++++---
- drivers/firewire/fw-ohci.h |    1 +
- 2 files changed, 11 insertions(+), 3 deletions(-)
-
-========================================================================
-Date: Fri, 28 Mar 2008 10:02:50 -0400
-From: Jarod Wilson <jwilson at redhat.com>
-Subject: firewire: fw-ohci: make sure HCControl register LPS bit is set
-
-I've now witnessed multiple occasions where one of my controllers (a very
-poorly working JMicron PCIe card) fails to get its registers properly set
-up in ohci_enable(), apparently due to an occasionally very slow to
-initiate SClk. The easy fix for this problem is to add a tiny while loop
-to try again a time or three after initially enabling LPS before we
-move on (or give up).
-
-Of course, the card still isn't fully functional yet, but this gets it at
-least one tiny step closer...
-
-Signed-off-by: Jarod Wilson <jwilson at redhat.com>
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
----
- drivers/firewire/fw-ohci.c |   17 +++++++++++++++--
- 1 file changed, 15 insertions(+), 2 deletions(-)
-
-========================================================================
-Date: Thu, 27 Mar 2008 10:48:37 -0400 (EDT)
-From: "Robert P. J. Day" <rpjday at crashcourse.ca>
-Subject: ieee1394: Remove superfluous calls to kobject_set_name().
[...9190 lines suppressed...]
- 	depends on EXPERIMENTAL=n
- 
-@@ -21,27 +19,7 @@ config FIREWIRE
-           NOTE:
- 
- 	  You should only build ONE of the stacks, unless you REALLY know what
--	  you are doing.  If you install both, you should configure them only as
--	  modules rather than link them statically, and you should blacklist one
--	  of the concurrent low-level drivers in /etc/modprobe.conf.  Add either
--
--	      blacklist firewire-ohci
--	  or
--	      blacklist ohci1394
--
--	  there depending on which driver you DON'T want to have auto-loaded.
--	  You can optionally do the same with the other IEEE 1394/ FireWire
--	  drivers.
--
--	  If you have an old modprobe which doesn't implement the blacklist
--	  directive, use either
--
--	       install firewire-ohci /bin/true
--	  or
--	       install ohci1394 /bin/true
--
--	  and so on, depending on which modules you DON't want to have
--	  auto-loaded.
-+	  you are doing.
- 
- config FIREWIRE_OHCI
- 	tristate "Support for OHCI FireWire host controllers"
-@@ -57,8 +35,29 @@ config FIREWIRE_OHCI
- 
-           NOTE:
- 
--	  If you also build ohci1394 of the classic stack, blacklist either
--	  ohci1394 or firewire-ohci to let hotplug load only the desired driver.
-+	  You should only build ohci1394 or firewire-ohci, but not both.
-+	  If you nevertheless want to install both, you should configure them
-+	  only as modules and blacklist the driver(s) which you don't want to
-+	  have auto-loaded.  Add either
-+
-+	      blacklist firewire-ohci
-+	  or
-+	      blacklist ohci1394
-+	      blacklist video1394
-+	      blacklist dv1394
-+
-+	  to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf
-+	  depending on your distribution.  The latter two modules should be
-+	  blacklisted together with ohci1394 because they depend on ohci1394.
-+
-+	  If you have an old modprobe which doesn't implement the blacklist
-+	  directive, use "install modulename /bin/true" for the modules to be
-+	  blacklisted.
-+
-+config FIREWIRE_OHCI_DEBUG
-+	bool
-+	depends on FIREWIRE_OHCI
-+	default y
+diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
+index 37e7e10..04e96ba 100644
+--- a/drivers/ieee1394/raw1394.c
++++ b/drivers/ieee1394/raw1394.c
+@@ -2959,7 +2959,6 @@ MODULE_DEVICE_TABLE(ieee1394, raw1394_id_table);
  
- config FIREWIRE_SBP2
- 	tristate "Support for storage devices (SBP-2 protocol driver)"
-@@ -75,9 +74,3 @@ config FIREWIRE_SBP2
+ static struct hpsb_protocol_driver raw1394_driver = {
+ 	.name = "raw1394",
+-	.id_table = raw1394_id_table,
+ };
  
- 	  You should also enable support for disks, CD-ROMs, etc. in the SCSI
- 	  configuration section.
--
--          NOTE:
--
--	  If you also build sbp2 of the classic stack, blacklist either sbp2
--	  or firewire-sbp2 to let hotplug load only the desired driver.
--
-Index: linux-2.6.24/drivers/firewire/fw-ohci.h
-===================================================================
---- linux-2.6.24.orig/drivers/firewire/fw-ohci.h
-+++ linux-2.6.24/drivers/firewire/fw-ohci.h
-@@ -30,6 +30,7 @@
- #define  OHCI1394_HCControl_softReset		0x00010000
- #define OHCI1394_SelfIDBuffer                 0x064
- #define OHCI1394_SelfIDCount                  0x068
-+#define  OHCI1394_SelfIDCount_selfIDError	0x80000000
- #define OHCI1394_IRMultiChanMaskHiSet         0x070
- #define OHCI1394_IRMultiChanMaskHiClear       0x074
- #define OHCI1394_IRMultiChanMaskLoSet         0x078
-@@ -124,6 +125,7 @@
- #define OHCI1394_lockRespErr		0x00000200
- #define OHCI1394_selfIDComplete		0x00010000
- #define OHCI1394_busReset		0x00020000
-+#define OHCI1394_regAccessFail		0x00040000
- #define OHCI1394_phy			0x00080000
- #define OHCI1394_cycleSynch		0x00100000
- #define OHCI1394_cycle64Seconds		0x00200000
-Index: linux-2.6.24/drivers/firewire/fw-iso.c
-===================================================================
---- linux-2.6.24.orig/drivers/firewire/fw-iso.c
-+++ linux-2.6.24/drivers/firewire/fw-iso.c
-@@ -126,7 +126,6 @@ fw_iso_context_create(struct fw_card *ca
+ /******************************************************************************/
+@@ -3004,7 +3003,6 @@ static int __init init_raw1394(void)
  
- 	return ctx;
+ 	cdev_init(&raw1394_cdev, &raw1394_fops);
+ 	raw1394_cdev.owner = THIS_MODULE;
+-	kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME);
+ 	ret = cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1);
+ 	if (ret) {
+ 		HPSB_ERR("raw1394 failed to register minor device block");
+diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
+index f53f72d..16b9d0a 100644
+--- a/drivers/ieee1394/sbp2.c
++++ b/drivers/ieee1394/sbp2.c
+@@ -615,7 +615,7 @@ static struct sbp2_command_info *sbp2util_allocate_command_orb(
+ 		cmd->Current_SCpnt = Current_SCpnt;
+ 		list_add_tail(&cmd->list, &lu->cmd_orb_inuse);
+ 	} else
+-		SBP2_ERR("%s: no orbs available", __FUNCTION__);
++		SBP2_ERR("%s: no orbs available", __func__);
+ 	spin_unlock_irqrestore(&lu->cmd_orb_lock, flags);
+ 	return cmd;
  }
--EXPORT_SYMBOL(fw_iso_context_create);
- 
- void fw_iso_context_destroy(struct fw_iso_context *ctx)
- {
-@@ -134,14 +133,12 @@ void fw_iso_context_destroy(struct fw_is
+@@ -1294,7 +1294,7 @@ static int sbp2_set_busy_timeout(struct sbp2_lu *lu)
  
- 	card->driver->free_iso_context(ctx);
+ 	data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE);
+ 	if (hpsb_node_write(lu->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4))
+-		SBP2_ERR("%s error", __FUNCTION__);
++		SBP2_ERR("%s error", __func__);
+ 	return 0;
  }
--EXPORT_SYMBOL(fw_iso_context_destroy);
  
- int
- fw_iso_context_start(struct fw_iso_context *ctx, int cycle, int sync, int tags)
- {
- 	return ctx->card->driver->start_iso(ctx, cycle, sync, tags);
- }
--EXPORT_SYMBOL(fw_iso_context_start);
+@@ -1985,11 +1985,8 @@ static int sbp2scsi_slave_alloc(struct scsi_device *sdev)
+ 	lu->sdev = sdev;
+ 	sdev->allow_restart = 1;
  
- int
- fw_iso_context_queue(struct fw_iso_context *ctx,
-@@ -153,11 +150,9 @@ fw_iso_context_queue(struct fw_iso_conte
+-	/*
+-	 * Update the dma alignment (minimum alignment requirements for
+-	 * start and end of DMA transfers) to be a sector
+-	 */
+-	blk_queue_update_dma_alignment(sdev->request_queue, 511);
++	/* SBP-2 requires quadlet alignment of the data buffers. */
++	blk_queue_update_dma_alignment(sdev->request_queue, 4 - 1);
+ 
+ 	if (lu->workarounds & SBP2_WORKAROUND_INQUIRY_36)
+ 		sdev->inquiry_len = 36;
+diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
+index bd28adf..e03024e 100644
+--- a/drivers/ieee1394/video1394.c
++++ b/drivers/ieee1394/video1394.c
+@@ -1315,8 +1315,7 @@ static struct ieee1394_device_id video1394_id_table[] = {
+ MODULE_DEVICE_TABLE(ieee1394, video1394_id_table);
  
- 	return card->driver->queue_iso(ctx, packet, buffer, payload);
- }
--EXPORT_SYMBOL(fw_iso_context_queue);
+ static struct hpsb_protocol_driver video1394_driver = {
+-	.name		= VIDEO1394_DRIVER_NAME,
+-	.id_table	= video1394_id_table,
++	.name = VIDEO1394_DRIVER_NAME,
+ };
  
- int
- fw_iso_context_stop(struct fw_iso_context *ctx)
- {
- 	return ctx->card->driver->stop_iso(ctx);
- }
--EXPORT_SYMBOL(fw_iso_context_stop);
+ 
+@@ -1504,7 +1503,6 @@ static int __init video1394_init_module (void)
+ 
+ 	cdev_init(&video1394_cdev, &video1394_fops);
+ 	video1394_cdev.owner = THIS_MODULE;
+-	kobject_set_name(&video1394_cdev.kobj, VIDEO1394_DRIVER_NAME);
+ 	ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);
+ 	if (ret) {
+ 		PRINT_G(KERN_ERR, "video1394: unable to get minor device block");

linux-2.6-input-kill-stupid-messages.patch:

Index: linux-2.6-input-kill-stupid-messages.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-input-kill-stupid-messages.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- linux-2.6-input-kill-stupid-messages.patch	6 Jul 2007 14:55:01 -0000	1.4
+++ linux-2.6-input-kill-stupid-messages.patch	21 May 2008 23:55:13 -0000	1.5
@@ -13,5 +13,5 @@
  				       data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
 +#endif
  			goto out;
- 		case ATKBD_RET_HANGEUL:
- 		case ATKBD_RET_HANJA:
+ 		case ATKBD_RET_ERR:
+ 			atkbd->err_count++;

linux-2.6-modsign-core.patch:

Index: linux-2.6-modsign-core.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-modsign-core.patch,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- linux-2.6-modsign-core.patch	13 Feb 2007 19:36:12 -0000	1.7
+++ linux-2.6-modsign-core.patch	21 May 2008 23:55:13 -0000	1.8
@@ -627,12 +627,12 @@
  	printk("Modules linked in:");
 -	list_for_each_entry(mod, &modules, list)
 +	list_for_each_entry(mod, &modules, list) {
- 		printk(" %s%s", mod->name, taint_flags(mod->taints, buf));
+		printk(" %s%s", mod->name, module_flags(mod, buf));
 +#if CONFIG_MODULE_SIG      
 +		if (!mod->gpgsig_ok)
 +			printk("(U)");
 +#endif
 +	}
+ 	if (last_unloaded_module[0])
+ 		printk(" [last unloaded: %s]", last_unloaded_module);
  	printk("\n");
- }
- 

linux-2.6-modsign-include.patch:

Index: linux-2.6-modsign-include.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-modsign-include.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux-2.6-modsign-include.patch	15 Feb 2008 23:58:52 -0000	1.8
+++ linux-2.6-modsign-include.patch	21 May 2008 23:55:13 -0000	1.9
@@ -103,25 +103,34 @@
  
  #define MODULE_SYMBOL_PREFIX "_"
  
-diff --git a/include/asm-i386/module.h b/include/asm-i386/module.h
+diff --git a/include/x86/module.h b/include/asm-x86/module.h
 index 02f8f54..42ab093 100644
---- a/include/asm-x86/module_32.h
-+++ b/include/asm-x86/module_32.h
-@@ -6,9 +6,14 @@ struct mod_arch_specific
- {
- };
+--- a/include/asm-x86/module.h
++++ b/include/asm-x86/module.h
+@@ -6,13 +6,23 @@
+ struct mod_arch_specific {};
  
+ #ifdef CONFIG_X86_32
 +#define MODULES_ARE_ELF32
- #define Elf_Shdr Elf32_Shdr
- #define Elf_Sym Elf32_Sym
- #define Elf_Ehdr Elf32_Ehdr
+ # define Elf_Shdr Elf32_Shdr
+ # define Elf_Sym Elf32_Sym
+ # define Elf_Ehdr Elf32_Ehdr
 +#define Elf_Rel Elf32_Rel
 +#define Elf_Rela Elf32_Rela
 +#define ELF_R_TYPE(X)	ELF32_R_TYPE(X)
 +#define ELF_R_SYM(X)	ELF32_R_SYM(X)
+ #else
++#define MODULES_ARE_ELF64
+ # define Elf_Shdr Elf64_Shdr
+ # define Elf_Sym Elf64_Sym
+ # define Elf_Ehdr Elf64_Ehdr
++#define Elf_Rel Elf64_Rel
++#define Elf_Rela Elf64_Rela
++#define ELF_R_TYPE(X)	ELF64_R_TYPE(X)
++#define ELF_R_SYM(X)	ELF64_R_SYM(X)
+ #endif
  
- #ifdef CONFIG_M386
- #define MODULE_PROC_FAMILY "386 "
+ #ifdef CONFIG_X86_64
 diff --git a/include/asm-ia64/module.h b/include/asm-ia64/module.h
 index d2da61e..191355a 100644
 --- a/include/asm-ia64/module.h
@@ -381,21 +390,3 @@
  
  /* Make empty sections for module_frob_arch_sections to expand. */
  #ifdef MODULE
-diff --git a/include/asm-x86_64/module.h b/include/asm-x86_64/module.h
-index 67f8f69..3a7373a 100644
---- a/include/asm-x86/module_64.h
-+++ b/include/asm-x86/module_64.h
-@@ -3,8 +3,13 @@ #define _ASM_X8664_MODULE_H
- 
- struct mod_arch_specific {}; 
- 
-+#define MODULES_ARE_ELF64
- #define Elf_Shdr Elf64_Shdr
- #define Elf_Sym Elf64_Sym
- #define Elf_Ehdr Elf64_Ehdr
-+#define Elf_Rel Elf64_Rel
-+#define Elf_Rela Elf64_Rela
-+#define ELF_R_TYPE(X)	ELF64_R_TYPE(X)
-+#define ELF_R_SYM(X)	ELF64_R_SYM(X)
- 
- #endif 

linux-2.6-modsign-mpilib.patch:

Index: linux-2.6-modsign-mpilib.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-modsign-mpilib.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- linux-2.6-modsign-mpilib.patch	15 Feb 2008 23:58:52 -0000	1.5
+++ linux-2.6-modsign-mpilib.patch	21 May 2008 23:55:13 -0000	1.6
@@ -51,8 +51,8 @@
 --- a/crypto/Kconfig
 +++ b/crypto/Kconfig
 @@ -465,6 +465,12 @@ config CRYPTO_TEST
- 	  Authenc: Combined mode wrapper for IPsec.
- 	  This is required for IPSec.
+ 	help
+ 	  This is the LZO algorithm.
  
 +config CRYPTO_MPILIB
 +	bool "Multiprecision maths library (EXPERIMENTAL)"

linux-2.6-modsign-verify.patch:

Index: linux-2.6-modsign-verify.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-modsign-verify.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-modsign-verify.patch	28 May 2007 03:29:08 -0000	1.2
+++ linux-2.6-modsign-verify.patch	21 May 2008 23:55:13 -0000	1.3
@@ -473,13 +473,13 @@
 --- a/kernel/module.c
 +++ b/kernel/module.c
 @@ -45,6 +45,7 @@
- #include <asm/semaphore.h>
  #include <asm/cacheflush.h>
  #include <linux/license.h>
+ #include <asm/sections.h>
 +#include "module-verify.h"
  
- extern int module_sysfs_initialized;
- 
+ #if 0
+ #define DEBUGP printk
 @@ -1591,8 +1592,10 @@ static struct module *load_module(void _
  		goto free_hdr;
  	}

linux-2.6-selinux-mprotect-checks.patch:

Index: linux-2.6-selinux-mprotect-checks.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-selinux-mprotect-checks.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- linux-2.6-selinux-mprotect-checks.patch	16 Feb 2006 05:48:18 -0000	1.5
+++ linux-2.6-selinux-mprotect-checks.patch	21 May 2008 23:55:13 -0000	1.6
@@ -1,3 +1,6 @@
+This needs a fixed toolchain, and a userspace rebuild to work.
+For this reason, it's had difficulty getting upstream.
+
 --- linux-2.6.16-rc3/security/selinux/hooks.c	2006-02-13 13:19:09.000000000 -0500
 +++ linux-2.6.16-rc3-x/security/selinux/hooks.c	2006-02-14 14:44:48.000000000 -0500
 @@ -2365,7 +2365,6 @@ static int selinux_file_ioctl(struct fil

linux-2.6-silence-noise.patch:

Index: linux-2.6-silence-noise.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-silence-noise.patch,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- linux-2.6-silence-noise.patch	15 Feb 2008 23:58:52 -0000	1.12
+++ linux-2.6-silence-noise.patch	21 May 2008 23:55:13 -0000	1.13
@@ -78,17 +78,22 @@
  	pci_restore_msi_state(dev);
 
 
---- linux-2.6.22.noarch/drivers/base/power/main.c~	2007-07-13 15:44:37.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/base/power/main.c	2007-07-13 15:44:44.000000000 -0400
-@@ -37,6 +37,3 @@ int device_pm_add(struct device *dev)
+diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
+index d887d5c..80be564 100644
+--- a/drivers/base/power/main.c
++++ b/drivers/base/power/main.c
+@@ -64,9 +64,6 @@ int (*platform_enable_wakeup)(struct device *dev, int is_on);
+  */
+ void device_pm_add(struct device *dev)
  {
 -	pr_debug("PM: Adding info for %s:%s\n",
 -		 dev->bus ? dev->bus->name : "No Bus",
 -		 kobject_name(&dev->kobj));
  	mutex_lock(&dpm_list_mtx);
  	list_add_tail(&dev->power.entry, &dpm_active);
-@@ -51,9 +48,6 @@ int device_pm_add(struct device *dev)
- 
+ 	mutex_unlock(&dpm_list_mtx);
+@@ -80,9 +77,6 @@ void device_pm_add(struct device *dev)
+  */
  void device_pm_remove(struct device *dev)
  {
 -	pr_debug("PM: Removing info for %s:%s\n",
@@ -97,3 +102,31 @@
  	mutex_lock(&dpm_list_mtx);
  	dpm_sysfs_remove(dev);
  	list_del_init(&dev->power.entry);
+--- linux-2.6.24.noarch/arch/x86/pci/mmconfig-shared.c~	2008-04-12 20:04:01.000000000 -0400
++++ linux-2.6.24.noarch/arch/x86/pci/mmconfig-shared.c	2008-04-12 20:05:35.000000000 -0400
+@@ -191,7 +191,7 @@ static void __init pci_mmcfg_reject_brok
+ 	if (pci_mmcfg_config_num == 1 &&
+ 	    cfg->pci_segment == 0 &&
+ 	    (cfg->start_bus_number | cfg->end_bus_number) == 0) {
+-		printk(KERN_ERR "PCI: start and end of bus number is 0. "
++		printk(KERN_DEBUG "PCI: start and end of bus number is 0. "
+ 		       "Rejected as broken MCFG.\n");
+ 		goto reject;
+ 	}
+@@ -203,14 +203,14 @@ static void __init pci_mmcfg_reject_brok
+ 	if (type == 1 && !e820_all_mapped(cfg->address,
+ 					  cfg->address + MMCONFIG_APER_MIN,
+ 					  E820_RESERVED)) {
+-		printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not"
++		printk(KERN_DEBUG "PCI: BIOS Bug: MCFG area at %Lx is not"
+ 		       " E820-reserved\n", cfg->address);
+ 		goto reject;
+ 	}
+ 	return;
+ 
+ reject:
+-	printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
++	printk(KERN_DEBUG "PCI: Not using MMCONFIG.\n");
+ 	kfree(pci_mmcfg_config);
+ 	pci_mmcfg_config = NULL;
+ 	pci_mmcfg_config_num = 0;

linux-2.6-squashfs.patch:

Index: linux-2.6-squashfs.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-squashfs.patch,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- linux-2.6-squashfs.patch	15 Feb 2008 23:58:52 -0000	1.24
+++ linux-2.6-squashfs.patch	21 May 2008 23:55:13 -0000	1.25
@@ -1,7 +1,8 @@
-diff -x .gitignore -Nurp linux-2.6.24/fs/Kconfig linux-2.6.24-squashfs3.3/fs/Kconfig
---- linux-2.6.24/fs/Kconfig	2007-10-25 17:41:45.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/fs/Kconfig	2007-11-01 05:06:25.000000000 +0000
-@@ -1396,6 +1396,56 @@ config CRAMFS
+diff --git a/fs/Kconfig b/fs/Kconfig
+index d731282..cab44a1 100644
+--- a/fs/Kconfig
++++ b/fs/Kconfig
+@@ -1367,6 +1367,56 @@ config CRAMFS
  
  	  If unsure, say N.
  
@@ -58,10 +59,11 @@
  config VXFS_FS
  	tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
  	depends on BLOCK
-diff -x .gitignore -Nurp linux-2.6.24/fs/Makefile linux-2.6.24-squashfs3.3/fs/Makefile
---- linux-2.6.24/fs/Makefile	2007-10-25 17:41:45.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/fs/Makefile	2007-11-01 05:08:09.000000000 +0000
-@@ -72,6 +72,7 @@ obj-$(CONFIG_JBD)		+= jbd/
+diff --git a/fs/Makefile b/fs/Makefile
+index 1e7a11b..3faf857 100644
+--- a/fs/Makefile
++++ b/fs/Makefile
+@@ -73,6 +73,7 @@ obj-$(CONFIG_JBD)		+= jbd/
  obj-$(CONFIG_JBD2)		+= jbd2/
  obj-$(CONFIG_EXT2_FS)		+= ext2/
  obj-$(CONFIG_CRAMFS)		+= cramfs/
@@ -69,10 +71,25 @@
  obj-y				+= ramfs/
  obj-$(CONFIG_HUGETLBFS)		+= hugetlbfs/
  obj-$(CONFIG_CODA_FS)		+= coda/
-diff -x .gitignore -Nurp linux-2.6.24/fs/squashfs/inode.c linux-2.6.24-squashfs3.3/fs/squashfs/inode.c
---- linux-2.6.24/fs/squashfs/inode.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/fs/squashfs/inode.c	2007-11-01 05:05:00.000000000 +0000
-@@ -0,0 +1,2192 @@
+diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
+new file mode 100644
+index 0000000..1bc7b06
+--- /dev/null
++++ b/fs/squashfs/Makefile
+@@ -0,0 +1,7 @@
++#
++# Makefile for the linux squashfs routines.
++#
++
++obj-$(CONFIG_SQUASHFS) += squashfs.o
++squashfs-y += inode.o
++squashfs-y += squashfs2_0.o
+diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
+new file mode 100644
+index 0000000..f578528
+--- /dev/null
++++ b/fs/squashfs/inode.c
+@@ -0,0 +1,2178 @@
 +/*
 + * Squashfs - a compressed read only filesystem for Linux
 + *
@@ -112,7 +129,6 @@
 +
 +int squashfs_cached_blks;
 +
-+static void vfs_read_inode(struct inode *i);
 +static struct dentry *squashfs_get_parent(struct dentry *child);
 +static int squashfs_read_inode(struct inode *i, squashfs_inode_t inode);
 +static int squashfs_statfs(struct dentry *, struct kstatfs *);
@@ -158,7 +174,6 @@
 +	.destroy_inode = squashfs_destroy_inode,
 +	.statfs = squashfs_statfs,
 +	.put_super = squashfs_put_super,
-+	.read_inode = vfs_read_inode
 +};
 +
 +static struct export_operations squashfs_export_ops = {
@@ -707,22 +722,10 @@
 +}
 +	
 +
-+static void vfs_read_inode(struct inode *i)
-+{
-+	struct squashfs_sb_info *msblk = i->i_sb->s_fs_info;
-+	squashfs_inode_t inode = squashfs_inode_lookup(i->i_sb, i->i_ino);
-+
-+	TRACE("Entered vfs_read_inode\n");
-+
-+	if(inode != SQUASHFS_INVALID_BLK)
-+		(msblk->read_inode)(i, inode);
-+}
-+
-+
 +static struct dentry *squashfs_get_parent(struct dentry *child)
 +{
 +	struct inode *i = child->d_inode;
-+	struct inode *parent = iget(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode);
++	struct inode *parent = iget_locked(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode);
 +	struct dentry *rv;
 +
 +	TRACE("Entered squashfs_get_parent\n");
@@ -2265,20 +2268,103 @@
 +MODULE_DESCRIPTION("squashfs 3.2-r2-CVS, a compressed read-only filesystem");
 +MODULE_AUTHOR("Phillip Lougher <phillip at lougher.demon.co.uk>");
 +MODULE_LICENSE("GPL");
-diff -x .gitignore -Nurp linux-2.6.24/fs/squashfs/Makefile linux-2.6.24-squashfs3.3/fs/squashfs/Makefile
---- linux-2.6.24/fs/squashfs/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/fs/squashfs/Makefile	2005-11-20 14:31:00.000000000 +0000
-@@ -0,0 +1,7 @@
-+#
-+# Makefile for the linux squashfs routines.
-+#
+diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h
+new file mode 100644
+index 0000000..ea7b6c3
+--- /dev/null
++++ b/fs/squashfs/squashfs.h
+@@ -0,0 +1,86 @@
++/*
++ * Squashfs - a compressed read only filesystem for Linux
++ *
++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
++ * Phillip Lougher <phillip at lougher.demon.co.uk>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2,
++ * or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++ *
++ * squashfs.h
++ */
 +
-+obj-$(CONFIG_SQUASHFS) += squashfs.o
-+squashfs-y += inode.o
-+squashfs-y += squashfs2_0.o
-diff -x .gitignore -Nurp linux-2.6.24/fs/squashfs/squashfs2_0.c linux-2.6.24-squashfs3.3/fs/squashfs/squashfs2_0.c
---- linux-2.6.24/fs/squashfs/squashfs2_0.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/fs/squashfs/squashfs2_0.c	2007-10-25 00:43:59.000000000 +0100
++#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
++#undef CONFIG_SQUASHFS_1_0_COMPATIBILITY
++#endif
++
++#ifdef SQUASHFS_TRACE
++#define TRACE(s, args...)	printk(KERN_NOTICE "SQUASHFS: "s, ## args)
++#else
++#define TRACE(s, args...)	{}
++#endif
++
++#define ERROR(s, args...)	printk(KERN_ERR "SQUASHFS error: "s, ## args)
++
++#define SERROR(s, args...)	do { \
++				if (!silent) \
++				printk(KERN_ERR "SQUASHFS error: "s, ## args);\
++				} while(0)
++
++#define WARNING(s, args...)	printk(KERN_WARNING "SQUASHFS: "s, ## args)
++
++static inline struct squashfs_inode_info *SQUASHFS_I(struct inode *inode)
++{
++	return list_entry(inode, struct squashfs_inode_info, vfs_inode);
++}
++
++#if defined(CONFIG_SQUASHFS_1_0_COMPATIBILITY ) || defined(CONFIG_SQUASHFS_2_0_COMPATIBILITY)
++#define SQSH_EXTERN
++extern unsigned int squashfs_read_data(struct super_block *s, char *buffer,
++				long long index, unsigned int length,
++				long long *next_index, int srclength);
++extern int squashfs_get_cached_block(struct super_block *s, void *buffer,
++				long long block, unsigned int offset,
++				int length, long long *next_block,
++				unsigned int *next_offset);
++extern void release_cached_fragment(struct squashfs_sb_info *msblk, struct
++					squashfs_fragment_cache *fragment);
++extern struct squashfs_fragment_cache *get_cached_fragment(struct super_block
++					*s, long long start_block,
++					int length);
++extern struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode, unsigned int inode_number);
++extern const struct address_space_operations squashfs_symlink_aops;
++extern const struct address_space_operations squashfs_aops;
++extern struct inode_operations squashfs_dir_inode_ops;
++#else
++#define SQSH_EXTERN static
++#endif
++
++#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
++extern int squashfs_1_0_supported(struct squashfs_sb_info *msblk);
++#else
++static inline int squashfs_1_0_supported(struct squashfs_sb_info *msblk)
++{
++	return 0;
++}
++#endif
++
++#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY
++extern int squashfs_2_0_supported(struct squashfs_sb_info *msblk);
++#else
++static inline int squashfs_2_0_supported(struct squashfs_sb_info *msblk)
++{
++	return 0;
++}
++#endif
+diff --git a/fs/squashfs/squashfs2_0.c b/fs/squashfs/squashfs2_0.c
+new file mode 100644
+index 0000000..fa909c8
+--- /dev/null
++++ b/fs/squashfs/squashfs2_0.c
 @@ -0,0 +1,740 @@
 +/*
 + * Squashfs - a compressed read only filesystem for Linux
@@ -3020,99 +3106,11 @@
 +
 +	return 1;
 +}
-diff -x .gitignore -Nurp linux-2.6.24/fs/squashfs/squashfs.h linux-2.6.24-squashfs3.3/fs/squashfs/squashfs.h
---- linux-2.6.24/fs/squashfs/squashfs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/fs/squashfs/squashfs.h	2007-08-19 04:23:16.000000000 +0100
-@@ -0,0 +1,86 @@
-+/*
-+ * Squashfs - a compressed read only filesystem for Linux
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
-+ * Phillip Lougher <phillip at lougher.demon.co.uk>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * as published by the Free Software Foundation; either version 2,
-+ * or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ *
-+ * squashfs.h
-+ */
-+
-+#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
-+#undef CONFIG_SQUASHFS_1_0_COMPATIBILITY
-+#endif
-+
-+#ifdef SQUASHFS_TRACE
-+#define TRACE(s, args...)	printk(KERN_NOTICE "SQUASHFS: "s, ## args)
-+#else
-+#define TRACE(s, args...)	{}
-+#endif
-+
-+#define ERROR(s, args...)	printk(KERN_ERR "SQUASHFS error: "s, ## args)
-+
-+#define SERROR(s, args...)	do { \
-+				if (!silent) \
-+				printk(KERN_ERR "SQUASHFS error: "s, ## args);\
-+				} while(0)
-+
-+#define WARNING(s, args...)	printk(KERN_WARNING "SQUASHFS: "s, ## args)
-+
-+static inline struct squashfs_inode_info *SQUASHFS_I(struct inode *inode)
-+{
-+	return list_entry(inode, struct squashfs_inode_info, vfs_inode);
-+}
-+
-+#if defined(CONFIG_SQUASHFS_1_0_COMPATIBILITY ) || defined(CONFIG_SQUASHFS_2_0_COMPATIBILITY)
-+#define SQSH_EXTERN
-+extern unsigned int squashfs_read_data(struct super_block *s, char *buffer,
-+				long long index, unsigned int length,
-+				long long *next_index, int srclength);
-+extern int squashfs_get_cached_block(struct super_block *s, void *buffer,
-+				long long block, unsigned int offset,
-+				int length, long long *next_block,
-+				unsigned int *next_offset);
-+extern void release_cached_fragment(struct squashfs_sb_info *msblk, struct
-+					squashfs_fragment_cache *fragment);
-+extern struct squashfs_fragment_cache *get_cached_fragment(struct super_block
-+					*s, long long start_block,
-+					int length);
-+extern struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode, unsigned int inode_number);
-+extern const struct address_space_operations squashfs_symlink_aops;
-+extern const struct address_space_operations squashfs_aops;
-+extern struct inode_operations squashfs_dir_inode_ops;
-+#else
-+#define SQSH_EXTERN static
-+#endif
-+
-+#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
-+extern int squashfs_1_0_supported(struct squashfs_sb_info *msblk);
-+#else
-+static inline int squashfs_1_0_supported(struct squashfs_sb_info *msblk)
-+{
-+	return 0;
-+}
-+#endif
-+
-+#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY
-+extern int squashfs_2_0_supported(struct squashfs_sb_info *msblk);
-+#else
-+static inline int squashfs_2_0_supported(struct squashfs_sb_info *msblk)
-+{
-+	return 0;
-+}
-+#endif
-diff -x .gitignore -Nurp linux-2.6.24/include/linux/squashfs_fs.h linux-2.6.24-squashfs3.3/include/linux/squashfs_fs.h
---- linux-2.6.24/include/linux/squashfs_fs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/include/linux/squashfs_fs.h	2007-11-01 03:50:57.000000000 +0000
+diff --git a/include/linux/squashfs_fs.h b/include/linux/squashfs_fs.h
+new file mode 100644
+index 0000000..e60308e
+--- /dev/null
++++ b/include/linux/squashfs_fs.h
 @@ -0,0 +1,935 @@
 +#ifndef SQUASHFS_FS
 +#define SQUASHFS_FS
@@ -4049,9 +4047,11 @@
 +
 +#endif
 +#endif
-diff -x .gitignore -Nurp linux-2.6.24/include/linux/squashfs_fs_i.h linux-2.6.24-squashfs3.3/include/linux/squashfs_fs_i.h
---- linux-2.6.24/include/linux/squashfs_fs_i.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/include/linux/squashfs_fs_i.h	2007-08-19 04:24:08.000000000 +0100
+diff --git a/include/linux/squashfs_fs_i.h b/include/linux/squashfs_fs_i.h
+new file mode 100644
+index 0000000..76a3a5a
+--- /dev/null
++++ b/include/linux/squashfs_fs_i.h
 @@ -0,0 +1,45 @@
 +#ifndef SQUASHFS_FS_I
 +#define SQUASHFS_FS_I
@@ -4098,9 +4098,11 @@
 +	struct inode	vfs_inode;
 +};
 +#endif
-diff -x .gitignore -Nurp linux-2.6.24/include/linux/squashfs_fs_sb.h linux-2.6.24-squashfs3.3/include/linux/squashfs_fs_sb.h
---- linux-2.6.24/include/linux/squashfs_fs_sb.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/include/linux/squashfs_fs_sb.h	2007-08-19 04:24:26.000000000 +0100
+diff --git a/include/linux/squashfs_fs_sb.h b/include/linux/squashfs_fs_sb.h
+new file mode 100644
+index 0000000..e5fa802
+--- /dev/null
++++ b/include/linux/squashfs_fs_sb.h
 @@ -0,0 +1,76 @@
 +#ifndef SQUASHFS_FS_SB
 +#define SQUASHFS_FS_SB
@@ -4178,9 +4180,10 @@
 +	int			(*read_fragment_index_table)(struct super_block *s);
 +};
 +#endif
-diff -x .gitignore -Nurp linux-2.6.24/init/do_mounts_rd.c linux-2.6.24-squashfs3.3/init/do_mounts_rd.c
---- linux-2.6.24/init/do_mounts_rd.c	2007-10-25 17:41:49.000000000 +0100
-+++ linux-2.6.24-squashfs3.3/init/do_mounts_rd.c	2007-11-01 05:06:25.000000000 +0000
+diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
+index 3ac5904..0ddd43c 100644
+--- a/init/do_mounts_rd.c
++++ b/init/do_mounts_rd.c
 @@ -5,6 +5,7 @@
  #include <linux/ext2_fs.h>
  #include <linux/romfs_fs.h>
@@ -4189,7 +4192,7 @@
  #include <linux/initrd.h>
  #include <linux/string.h>
  
-@@ -39,6 +40,7 @@ static int __init crd_load(int in_fd, in
+@@ -39,6 +40,7 @@ static int __init crd_load(int in_fd, int out_fd);
   * numbers could not be found.
   *
   * We currently check for the following magic numbers:
@@ -4197,7 +4200,7 @@
   * 	minix
   * 	ext2
   *	romfs
-@@ -53,6 +55,7 @@ identify_ramdisk_image(int fd, int start
+@@ -53,6 +55,7 @@ identify_ramdisk_image(int fd, int start_block)
  	struct ext2_super_block *ext2sb;
  	struct romfs_super_block *romfsb;
  	struct cramfs_super *cramfsb;
@@ -4205,7 +4208,7 @@
  	int nblocks = -1;
  	unsigned char *buf;
  
-@@ -64,6 +67,7 @@ identify_ramdisk_image(int fd, int start
+@@ -64,6 +67,7 @@ identify_ramdisk_image(int fd, int start_block)
  	ext2sb = (struct ext2_super_block *) buf;
  	romfsb = (struct romfs_super_block *) buf;
  	cramfsb = (struct cramfs_super *) buf;
@@ -4213,7 +4216,7 @@
  	memset(buf, 0xe5, size);
  
  	/*
-@@ -101,6 +105,18 @@ identify_ramdisk_image(int fd, int start
+@@ -101,6 +105,18 @@ identify_ramdisk_image(int fd, int start_block)
  		goto done;
  	}
  

linux-2.6-upstream-reverts.patch:

Index: linux-2.6-upstream-reverts.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/linux-2.6-upstream-reverts.patch,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- linux-2.6-upstream-reverts.patch	24 Mar 2008 22:04:51 -0000	1.7
+++ linux-2.6-upstream-reverts.patch	21 May 2008 23:55:13 -0000	1.8
@@ -1,942 +1,186 @@
-From stable-bounces at linux.kernel.org Sat Jan 26 04:57:05 2008
-From: Michael Buesch <mb at bu3sch.de>
-Date: Sat, 26 Jan 2008 13:54:52 +0100
-Subject: b43: Reject new firmware early
-To: stable at kernel.org
-Cc: linux-wireless at vger.kernel.org, Bcm43xx-dev at lists.berlios.de
-Message-ID: <200801261354.52659.mb at bu3sch.de>
-Content-Disposition: inline
-
-From: Michael Buesch <mb at bu3sch.de>
-
-(not in mainline, as it is not applicable.)
-
-We must reject new incompatible firmware early to avoid
-running into strange transmission failures.
-
-The current development tree supports newer firmware revisions.
-These revisions cause strange failures on the stable 2.6.24 kernel.
-Add a check to avoid confusing users a lot.
-
-Signed-off-by: Michael Buesch <mb at bu3sch.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
-
----
- drivers/net/wireless/b43/main.c |   12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
---- a/drivers/net/wireless/b43/main.c
-+++ b/drivers/net/wireless/b43/main.c
-@@ -1800,6 +1800,18 @@ static int b43_upload_microcode(struct b
- 		err = -EOPNOTSUPP;
- 		goto out;
- 	}
-+	if (fwrev > 351) {
-+		b43err(dev->wl, "YOUR FIRMWARE IS TOO NEW. Please downgrade your "
-+		       "firmware.\n");
-+		b43err(dev->wl, "Use this firmware tarball: "
-+		       "http://downloads.openwrt.org/sources/broadcom-wl-4.80.53.0.tar.bz2\n");
-+		b43err(dev->wl, "Use this b43-fwcutter tarball: "
-+		       "http://bu3sch.de/b43/fwcutter/b43-fwcutter-009.tar.bz2\n");
-+		b43err(dev->wl, "Read, understand and _do_ what this message says, please.\n");
-+		b43_write32(dev, B43_MMIO_MACCTL, 0);
-+		err = -EOPNOTSUPP;
-+		goto out;
-+	}
- 	b43dbg(dev->wl, "Loading firmware version %u.%u "
- 	       "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n",
- 	       fwrev, fwpatch,
-From stable-bounces at linux.kernel.org Fri Jan 25 05:42:44 2008
-From: Stefano Brivio <stefano.brivio at polimi.it>
-Date: Fri, 25 Jan 2008 14:32:00 +0100
-Subject: b43legacy: fix DMA slot resource leakage
-To: stable at kernel.org
-Cc: Michael at hera.kernel.org, linux-wireless at vger.kernel.org, bcm43xx-dev at lists.berlios.de, Buesch <mb at bu3sch.de>
-Message-ID: <20080125143200.4a77d304 at morte>
-
-From: Stefano Brivio <stefano.brivio at polimi.it>
-
-patch 8dd0100ce9511e52614ecd0a6587c13ce5769c8b in mainline.
-
-This fixes four resource leakages.
-In any error path we must deallocate the DMA frame slots we
-previously allocated by request_slot().
-This is done by storing the ring pointers before doing any ring
-allocation and restoring the old pointers in case of an error.
-
-This patch by Michael Buesch has been ported to b43legacy.
-
-Cc: Michael Buesch <mb at bu3sch.de>
-Signed-off-by: Stefano Brivio <stefano.brivio at polimi.it>
-Signed-off-by: John W. Linville <linville at tuxdriver.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
-
----
- drivers/net/wireless/b43legacy/dma.c |   14 ++++++++++++--
- 1 file changed, 12 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/b43legacy/dma.c
-+++ b/drivers/net/wireless/b43legacy/dma.c
-@@ -1164,7 +1164,7 @@ static int dma_tx_fragment(struct b43leg
- {
- 	const struct b43legacy_dma_ops *ops = ring->ops;
- 	u8 *header;
--	int slot;
-+	int slot, old_top_slot, old_used_slots;
- 	int err;
- 	struct b43legacy_dmadesc_generic *desc;
- 	struct b43legacy_dmadesc_meta *meta;
-@@ -1174,6 +1174,9 @@ static int dma_tx_fragment(struct b43leg
- #define SLOTS_PER_PACKET  2
- 	B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0);
- 
-+	old_top_slot = ring->current_slot;
-+	old_used_slots = ring->used_slots;
-+
- 	/* Get a slot for the header. */
- 	slot = request_slot(ring);
- 	desc = ops->idx2desc(ring, slot, &meta_hdr);
-@@ -1184,8 +1187,11 @@ static int dma_tx_fragment(struct b43leg
- 	err = b43legacy_generate_txhdr(ring->dev, header,
- 				 skb->data, skb->len, ctl,
- 				 generate_cookie(ring, slot));
--	if (unlikely(err))
-+	if (unlikely(err)) {
-+		ring->current_slot = old_top_slot;
-+		ring->used_slots = old_used_slots;
- 		return err;
-+	}
- 
- 	meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header,
- 				       sizeof(struct b43legacy_txhdr_fw3), 1);
-@@ -1208,6 +1214,8 @@ static int dma_tx_fragment(struct b43leg
- 	if (dma_mapping_error(meta->dmaaddr)) {
- 		bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
- 		if (!bounce_skb) {
-+			ring->current_slot = old_top_slot;
-+			ring->used_slots = old_used_slots;
- 			err = -ENOMEM;
- 			goto out_unmap_hdr;
- 		}
-@@ -1218,6 +1226,8 @@ static int dma_tx_fragment(struct b43leg
- 		meta->skb = skb;
- 		meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
- 		if (dma_mapping_error(meta->dmaaddr)) {
-+			ring->current_slot = old_top_slot;
-+			ring->used_slots = old_used_slots;
- 			err = -EIO;
- 			goto out_free_bounce;
- 		}
-From stable-bounces at linux.kernel.org Fri Jan 25 05:40:25 2008
-From: Stefano Brivio <stefano.brivio at polimi.it>
-Date: Fri, 25 Jan 2008 14:29:50 +0100
-Subject: b43legacy: drop packets we are not able to encrypt
-To: stable at kernel.org
-Cc: Michael at hera.kernel.org, linux-wireless at vger.kernel.org, bcm43xx-dev at lists.berlios.de, Buesch <mb at bu3sch.de>
-Message-ID: <20080125142950.3146020a at morte>
-
-From: Stefano Brivio <stefano.brivio at polimi.it>
-
-patch 9eca9a8e81928685b4de00ecef83a7c13c340fc9 in mainline.
-
-We must drop any packets we are not able to encrypt.
-We must not send them unencrypted or with an all-zero-key (which
-basically is the same as unencrypted, from a security point of view).
-
-This might only trigger shortly after resume before mac80211 reassociated
-and reconfigured the keys.
-
-It is safe to drop these packets, as the association they belong to
-is not guaranteed anymore anyway.
-This is a security fix in the sense that it prevents information leakage.
-
-This patch by Michael Buesch has been ported to b43legacy.
-
-Cc: Michael Buesch <mb at bu3sch.de>
-Signed-off-by: Stefano Brivio <stefano.brivio at polimi.it>
-Signed-off-by: John W. Linville <linville at tuxdriver.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
-
----
- drivers/net/wireless/b43legacy/dma.c  |   11 ++++++++++-
- drivers/net/wireless/b43legacy/pio.c  |   18 +++++++++++++++---
- drivers/net/wireless/b43legacy/xmit.c |   15 ++++++++++++---
- drivers/net/wireless/b43legacy/xmit.h |    2 +-
- 4 files changed, 38 insertions(+), 8 deletions(-)
-
---- a/drivers/net/wireless/b43legacy/dma.c
-+++ b/drivers/net/wireless/b43legacy/dma.c
-@@ -1181,9 +1181,11 @@ static int dma_tx_fragment(struct b43leg
- 
- 	header = &(ring->txhdr_cache[slot * sizeof(
- 			       struct b43legacy_txhdr_fw3)]);
--	b43legacy_generate_txhdr(ring->dev, header,
-+	err = b43legacy_generate_txhdr(ring->dev, header,
- 				 skb->data, skb->len, ctl,
- 				 generate_cookie(ring, slot));
-+	if (unlikely(err))
-+		return err;
- 
- 	meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header,
- 				       sizeof(struct b43legacy_txhdr_fw3), 1);
-@@ -1282,6 +1284,13 @@ int b43legacy_dma_tx(struct b43legacy_wl
- 	B43legacy_BUG_ON(ring->stopped);
- 
- 	err = dma_tx_fragment(ring, skb, ctl);
-+	if (unlikely(err == -ENOKEY)) {
-+		/* Drop this packet, as we don't have the encryption key
-+		 * anymore and must not transmit it unencrypted. */
-+		dev_kfree_skb_any(skb);
-+		err = 0;
-+		goto out_unlock;
-+	}
- 	if (unlikely(err)) {
- 		b43legacyerr(dev->wl, "DMA tx mapping failure\n");
- 		goto out_unlock;
---- a/drivers/net/wireless/b43legacy/pio.c
-+++ b/drivers/net/wireless/b43legacy/pio.c
-@@ -181,7 +181,7 @@ union txhdr_union {
- 	struct b43legacy_txhdr_fw3 txhdr_fw3;
- };
- 
--static void pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
-+static int pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
- 				  struct sk_buff *skb,
- 				  struct b43legacy_pio_txpacket *packet,
- 				  size_t txhdr_size)
-@@ -189,14 +189,17 @@ static void pio_tx_write_fragment(struct
- 	union txhdr_union txhdr_data;
- 	u8 *txhdr = NULL;
- 	unsigned int octets;
-+	int err;
- 
- 	txhdr = (u8 *)(&txhdr_data.txhdr_fw3);
- 
- 	B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0);
--	b43legacy_generate_txhdr(queue->dev,
-+	err = b43legacy_generate_txhdr(queue->dev,
- 				 txhdr, skb->data, skb->len,
- 				 &packet->txstat.control,
- 				 generate_cookie(queue, packet));
-+	if (err)
-+		return err;
- 
- 	tx_start(queue);
- 	octets = skb->len + txhdr_size;
-@@ -204,6 +207,8 @@ static void pio_tx_write_fragment(struct
- 		octets--;
- 	tx_data(queue, txhdr, (u8 *)skb->data, octets);
- 	tx_complete(queue, skb);
-+
-+	return 0;
+diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
+index 48e9124..4ec1915 100644
+--- a/drivers/net/wireless/b43/dma.c
++++ b/drivers/net/wireless/b43/dma.c
+@@ -822,6 +822,18 @@ static u64 supported_dma_mask(struct b43_wldev *dev)
+ 	return DMA_30BIT_MASK;
  }
  
- static void free_txpacket(struct b43legacy_pio_txpacket *packet,
-@@ -226,6 +231,7 @@ static int pio_tx_packet(struct b43legac
- 	struct b43legacy_pioqueue *queue = packet->queue;
- 	struct sk_buff *skb = packet->skb;
- 	u16 octets;
++static enum b43_dmatype dma_mask_to_engine_type(u64 dmamask)
++{
++	if (dmamask == DMA_30BIT_MASK)
++		return B43_DMA_30BIT;
++	if (dmamask == DMA_32BIT_MASK)
++		return B43_DMA_32BIT;
++	if (dmamask == DMA_64BIT_MASK)
++		return B43_DMA_64BIT;
++	B43_WARN_ON(1);
++	return B43_DMA_30BIT;
++}
++
+ /* Main initialization function. */
+ static
+ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
+@@ -982,6 +994,42 @@ void b43_dma_free(struct b43_wldev *dev)
+ 	dma->tx_ring0 = NULL;
+ }
+ 
++static int b43_dma_set_mask(struct b43_wldev *dev, u64 mask)
++{
++	u64 orig_mask = mask;
++	bool fallback = 0;
 +	int err;
- 
- 	octets = (u16)skb->len + sizeof(struct b43legacy_txhdr_fw3);
- 	if (queue->tx_devq_size < octets) {
-@@ -247,8 +253,14 @@ static int pio_tx_packet(struct b43legac
- 	if (queue->tx_devq_used + octets > queue->tx_devq_size)
- 		return -EBUSY;
- 	/* Now poke the device. */
--	pio_tx_write_fragment(queue, skb, packet,
-+	err = pio_tx_write_fragment(queue, skb, packet,
- 			      sizeof(struct b43legacy_txhdr_fw3));
-+	if (unlikely(err == -ENOKEY)) {
-+		/* Drop this packet, as we don't have the encryption key
-+		 * anymore and must not transmit it unencrypted. */
-+		free_txpacket(packet, 1);
-+		return 0;
++
++	/* Try to set the DMA mask. If it fails, try falling back to a
++	 * lower mask, as we can always also support a lower one. */
++	while (1) {
++		err = ssb_dma_set_mask(dev->dev, mask);
++		if (!err)
++			break;
++		if (mask == DMA_64BIT_MASK) {
++			mask = DMA_32BIT_MASK;
++			fallback = 1;
++			continue;
++		}
++		if (mask == DMA_32BIT_MASK) {
++			mask = DMA_30BIT_MASK;
++			fallback = 1;
++			continue;
++		}
++		b43err(dev->wl, "The machine/kernel does not support "
++		       "the required %u-bit DMA mask\n",
++		       (unsigned int)dma_mask_to_engine_type(orig_mask));
++		return -EOPNOTSUPP;
++	}
++	if (fallback) {
++		b43info(dev->wl, "DMA mask fallback from %u-bit to %u-bit\n",
++			(unsigned int)dma_mask_to_engine_type(orig_mask),
++			(unsigned int)dma_mask_to_engine_type(mask));
 +	}
- 
- 	/* Account for the packet size.
- 	 * (We must not overflow the device TX queue)
---- a/drivers/net/wireless/b43legacy/xmit.c
-+++ b/drivers/net/wireless/b43legacy/xmit.c
-@@ -181,7 +181,7 @@ static u8 b43legacy_calc_fallback_rate(u
- 	return 0;
- }
- 
--static void generate_txhdr_fw3(struct b43legacy_wldev *dev,
-+static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
- 			       struct b43legacy_txhdr_fw3 *txhdr,
- 			       const unsigned char *fragment_data,
- 			       unsigned int fragment_len,
-@@ -252,6 +252,13 @@ static void generate_txhdr_fw3(struct b4
- 			iv_len = min((size_t)txctl->iv_len,
- 				     ARRAY_SIZE(txhdr->iv));
- 			memcpy(txhdr->iv, ((u8 *)wlhdr) + wlhdr_len, iv_len);
-+		} else {
-+			/* This key is invalid. This might only happen
-+			 * in a short timeframe after machine resume before
-+			 * we were able to reconfigure keys.
-+			 * Drop this packet completely. Do not transmit it
-+			 * unencrypted to avoid leaking information. */
-+			return -ENOKEY;
- 		}
- 	}
- 	b43legacy_generate_plcp_hdr((struct b43legacy_plcp_hdr4 *)
-@@ -344,16 +351,18 @@ static void generate_txhdr_fw3(struct b4
- 	/* Apply the bitfields */
- 	txhdr->mac_ctl = cpu_to_le32(mac_ctl);
- 	txhdr->phy_ctl = cpu_to_le16(phy_ctl);
 +
 +	return 0;
- }
- 
--void b43legacy_generate_txhdr(struct b43legacy_wldev *dev,
-+int b43legacy_generate_txhdr(struct b43legacy_wldev *dev,
- 			      u8 *txhdr,
- 			      const unsigned char *fragment_data,
- 			      unsigned int fragment_len,
- 			      const struct ieee80211_tx_control *txctl,
- 			      u16 cookie)
- {
--	generate_txhdr_fw3(dev, (struct b43legacy_txhdr_fw3 *)txhdr,
-+	return generate_txhdr_fw3(dev, (struct b43legacy_txhdr_fw3 *)txhdr,
- 			   fragment_data, fragment_len,
- 			   txctl, cookie);
- }
---- a/drivers/net/wireless/b43legacy/xmit.h
-+++ b/drivers/net/wireless/b43legacy/xmit.h
-@@ -76,7 +76,7 @@ struct b43legacy_txhdr_fw3 {
- 
- 
- 
--void b43legacy_generate_txhdr(struct b43legacy_wldev *dev,
-+int b43legacy_generate_txhdr(struct b43legacy_wldev *dev,
- 			      u8 *txhdr,
- 			      const unsigned char *fragment_data,
- 			      unsigned int fragment_len,
-From stable-bounces at linux.kernel.org Fri Jan 25 05:37:00 2008
-From: Stefano Brivio <stefano.brivio at polimi.it>
-Date: Fri, 25 Jan 2008 14:26:21 +0100
-Subject: b43legacy: fix suspend/resume
-To: stable at kernel.org
-Cc: Michael at hera.kernel.org, linux-wireless at vger.kernel.org, bcm43xx-dev at lists.berlios.de, Buesch <mb at bu3sch.de>
-Message-ID: <20080125142621.0d240fd8 at morte>
-
-From: Stefano Brivio <stefano.brivio at polimi.it>
-
-patch ada50731c0346bf900dc387edd3a6961297bf2d3 in mainline.
-
-This patch makes suspend/resume work with the b43legacy driver.
-We must not overwrite the MAC addresses in the init function, as this
-would also overwrite the MAC on resume. With an all-zero MAC the device
-firmware is not able to ACK any received packets anymore.
-Fix this by moving the initializion stuff that must be done on init but
-not on resume to the start function.
-Also zero out filter_flags to make sure we don't have some flags
-from a previous instance for a tiny timeframe until mac80211 reconfigures
-them.
-
-This patch by Michael Buesch has been ported to b43legacy.
-
-Cc: Michael Buesch <mb at bu3sch.de>
-Signed-off-by: Stefano Brivio <stefano.brivio at polimi.it>
-Signed-off-by: John W. Linville <linville at tuxdriver.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
-
----
- drivers/net/wireless/b43legacy/main.c |    9 +++++++--
- 1 file changed, 7 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/b43legacy/main.c
-+++ b/drivers/net/wireless/b43legacy/main.c
-@@ -3215,8 +3215,6 @@ static int b43legacy_wireless_core_init(
- 	b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0414, 0x01F4);
- 
- 	ssb_bus_powerup(bus, 1); /* Enable dynamic PCTL */
--	memset(wl->bssid, 0, ETH_ALEN);
--	memset(wl->mac_addr, 0, ETH_ALEN);
- 	b43legacy_upload_card_macaddress(dev);
- 	b43legacy_security_init(dev);
- 	b43legacy_rng_init(wl);
-@@ -3311,6 +3309,13 @@ static int b43legacy_start(struct ieee80
- 	int did_init = 0;
- 	int err = 0;
- 
-+	/* Kill all old instance specific information to make sure
-+	 * the card won't use it in the short timeframe between start
-+	 * and mac80211 reconfiguring it. */
-+	memset(wl->bssid, 0, ETH_ALEN);
-+	memset(wl->mac_addr, 0, ETH_ALEN);
-+	wl->filter_flags = 0;
-+
- 	mutex_lock(&wl->mutex);
- 
- 	if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) {
-From stable-bounces at linux.kernel.org Fri Jan 25 05:34:45 2008
-From: Stefano Brivio <stefano.brivio at polimi.it>
-Date: Fri, 25 Jan 2008 14:24:05 +0100
-Subject: b43legacy: fix PIO crash
-To: stable at kernel.org
-Cc: linux-wireless at vger.kernel.org, bcm43xx-dev at lists.berlios.de
-Message-ID: <20080125142405.00429ede at morte>
-
-From: Stefano Brivio <stefano.brivio at polimi.it>
-
-patch 0cd67d48b519c3d8d89d238fab1cf68a5289638a in mainline.
-
-Fix the crash reported below, which seems to happen on bcm4306 rev. 2 devices
-only while using PIO:
-
-Oops: 0000 [#1] PREEMPT
-Modules linked in: b43(F) rfkill(F) led_class(F) input_polldev(F) arc4 b43legacy mac80211 cfg80211 i915 drm snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device ohci1394 ieee1394 ssb pcmcia snd_intel8x0m ehci_hcd uhci_hcd evdev
-
-Pid: 0, comm: swapper Tainted: GF	(2.6.24st3 #2)
-EIP: 0060:[<f90f667b>] EFLAGS: 00010002 CPU: 0
-EIP is at b43legacy_pio_handle_txstatus+0xbb/0x210 [b43legacy]
-EAX: 0000049b EBX: f11f8044 ECX: 00000001 EDX: 00000000
-ESI: f1ff8000 EDI: 00000000 EBP: f11f8040 ESP: c04f4ef4
- DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
-Process swapper (pid: 0, ti=c04f4000 task=c0488300 task.ti=c04b8000)
-Stack: f90f2788 c05009f0 c0500900 000010f7 f1053823 c04f4f24 dfb8e800 00000003
-       f1368000 00000007 00000296 f90f1975 00001000 010c0800 01000000 00000007
-       f90f6391 f11f8000 00000082 c04f4f4a 00000000 00004fd0 10f70000 8c061000
-Call Trace:
- [<f90f2788>] b43legacy_debugfs_log_txstat+0x48/0xb0 [b43legacy]
- [<f90f1975>] b43legacy_handle_hwtxstatus+0x75/0x80 [b43legacy]
- [<f90f6391>] b43legacy_pio_rx+0x201/0x280 [b43legacy]
- [<f90e4fa3>] b43legacy_interrupt_tasklet+0x2e3/0x870 [b43legacy]
- [<c0123567>] tasklet_action+0x27/0x60
- [<c01237b4>] __do_softirq+0x54/0xb0
- [<c010686b>] do_softirq+0x7b/0xe0
- [<c01457c0>] handle_level_irq+0x0/0x110
- [<c01457c0>] handle_level_irq+0x0/0x110
- [<c0123758>] irq_exit+0x38/0x40
- [<c0106953>] do_IRQ+0x83/0xd0
- [<c011812f>] __update_rq_clock+0x4f/0x180
- [<c0104b4f>] common_interrupt+0x23/0x28
- [<c011007b>] wakeup_code+0x7b/0xde
- [<c02b1039>] acpi_processor_idle+0x24a/0x3c9
- [<c01025c7>] cpu_idle+0x47/0x80
- [<c04b9ad5>] start_kernel+0x205/0x290
- [<c04b9360>] unknown_bootoption+0x0/0x1f0
- =======================
-Code: 0f 00 00 81 fb ff 00 00 00 0f 87 36 01 00 00 8d 04 db 85 ff 8d 6c c6 40 8d 5d 04 0f 85 ef 00 00 00 fe 4e 0e 0f b7 46 0c 8b 53 04 <8b> 4a 50 29 c8 83 e8 52 66 89 46 0c 8b 54 24 14 80 7a 0b 00 74
-EIP: [<f90f667b>] b43legacy_pio_handle_txstatus+0xbb/0x210 [b43legacy] SS:ESP 0068:c04f4ef4
-Kernel panic - not syncing: Fatal exception in interrupt
-
-Signed-off-by: Stefano Brivio <stefano.brivio at polimi.it>
-Signed-off-by: John W. Linville <linville at tuxdriver.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
-
----
- drivers/net/wireless/b43legacy/pio.c |    3 +++
- 1 file changed, 3 insertions(+)
-
---- a/drivers/net/wireless/b43legacy/pio.c
-+++ b/drivers/net/wireless/b43legacy/pio.c
-@@ -486,6 +486,9 @@ void b43legacy_pio_handle_txstatus(struc
- 	queue = parse_cookie(dev, status->cookie, &packet);
- 	B43legacy_WARN_ON(!queue);
- 
-+	if (!packet->skb)
-+		return;
++}
 +
- 	queue->tx_devq_packets--;
- 	queue->tx_devq_used -= (packet->skb->len +
- 				sizeof(struct b43legacy_txhdr_fw3));
-From stable-bounces at linux.kernel.org Fri Jan 25 03:23:28 2008
-From: Michael Buesch <mb at bu3sch.de>
-Date: Fri, 25 Jan 2008 12:20:20 +0100
-Subject: b43: Fix dma-slot resource leakage
-To: stable at kernel.org
-Cc: linux-wireless at vger.kernel.org, bcm43xx-dev at lists.berlios.de
-Message-ID: <200801251220.20332.mb at bu3sch.de>
-Content-Disposition: inline
-
-From: Michael Buesch <mb at bu3sch.de>
-
-patch 8dd0100ce9511e52614ecd0a6587c13ce5769c8b in mainline.
-
-This fixes four resource leakages.
-In any error path we must deallocate the DMA frame slots we
-previously allocated by request_slot().
-This is done by storing the ring pointers before doing any ring
-allocation and restoring the old pointers in case of an error.
-
-Signed-off-by: Michael Buesch <mb at bu3sch.de>
-Signed-off-by: Stefano Brivio <stefano.brivio at polimi.it>
-Signed-off-by: John W. Linville <linville at tuxdriver.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
-
----
- drivers/net/wireless/b43/dma.c |   19 ++++++++++++++++---
- 1 file changed, 16 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/b43/dma.c
-+++ b/drivers/net/wireless/b43/dma.c
-@@ -1106,7 +1106,7 @@ static int dma_tx_fragment(struct b43_dm
+ int b43_dma_init(struct b43_wldev *dev)
  {
- 	const struct b43_dma_ops *ops = ring->ops;
- 	u8 *header;
--	int slot;
-+	int slot, old_top_slot, old_used_slots;
- 	int err;
- 	struct b43_dmadesc_generic *desc;
- 	struct b43_dmadesc_meta *meta;
-@@ -1116,6 +1116,9 @@ static int dma_tx_fragment(struct b43_dm
- #define SLOTS_PER_PACKET  2
- 	B43_WARN_ON(skb_shinfo(skb)->nr_frags);
- 
-+	old_top_slot = ring->current_slot;
-+	old_used_slots = ring->used_slots;
-+
- 	/* Get a slot for the header. */
- 	slot = request_slot(ring);
- 	desc = ops->idx2desc(ring, slot, &meta_hdr);
-@@ -1125,13 +1128,19 @@ static int dma_tx_fragment(struct b43_dm
- 	err = b43_generate_txhdr(ring->dev, header,
- 			   skb->data, skb->len, ctl,
- 			   generate_cookie(ring, slot));
--	if (unlikely(err))
-+	if (unlikely(err)) {
-+		ring->current_slot = old_top_slot;
-+		ring->used_slots = old_used_slots;
- 		return err;
-+	}
- 
- 	meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header,
- 					   sizeof(struct b43_txhdr_fw4), 1);
--	if (dma_mapping_error(meta_hdr->dmaaddr))
-+	if (dma_mapping_error(meta_hdr->dmaaddr)) {
-+		ring->current_slot = old_top_slot;
-+		ring->used_slots = old_used_slots;
- 		return -EIO;
-+	}
- 	ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr,
- 			     sizeof(struct b43_txhdr_fw4), 1, 0, 0);
- 
-@@ -1149,6 +1158,8 @@ static int dma_tx_fragment(struct b43_dm
- 	if (dma_mapping_error(meta->dmaaddr)) {
- 		bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
- 		if (!bounce_skb) {
-+			ring->current_slot = old_top_slot;
-+			ring->used_slots = old_used_slots;
- 			err = -ENOMEM;
- 			goto out_unmap_hdr;
- 		}
-@@ -1159,6 +1170,8 @@ static int dma_tx_fragment(struct b43_dm
- 		meta->skb = skb;
- 		meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
- 		if (dma_mapping_error(meta->dmaaddr)) {
-+			ring->current_slot = old_top_slot;
-+			ring->used_slots = old_used_slots;
- 			err = -EIO;
- 			goto out_free_bounce;
- 		}
-From stable-bounces at linux.kernel.org Fri Jan 25 03:23:38 2008
-From: Michael Buesch <mb at bu3sch.de>
-Date: Fri, 25 Jan 2008 12:15:07 +0100
-Subject: b43: Drop packets we are not able to encrypt
-To: stable at kernel.org
-Cc: linux-wireless at vger.kernel.org, bcm43xx-dev at lists.berlios.de
-Message-ID: <200801251215.08164.mb at bu3sch.de>
-Content-Disposition: inline
-
-From: Michael Buesch <mb at bu3sch.de>
-
-patch 09552ccd8277e6382097e93a40f7311a09449367 in mainline
-
-We must drop any packets we are not able to encrypt.
-We must not send them unencrypted or with an all-zero-key (which
-basically is the same as unencrypted, from a security point of view).
-
-This might only trigger shortly after resume before mac80211 reassociated
-and reconfigured the keys.
-
-It is safe to drop these packets, as the association they belong to
-is not guaranteed anymore anyway.
-This is a security fix in the sense that it prevents information leakage.
-
-Signed-off-by: Michael Buesch <mb at bu3sch.de>
-Signed-off-by: John W. Linville <linville at tuxdriver.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
-
----
- drivers/net/wireless/b43/dma.c  |   11 ++++++++++-
- drivers/net/wireless/b43/xmit.c |   20 +++++++++++++++-----
- drivers/net/wireless/b43/xmit.h |    2 +-
- 3 files changed, 26 insertions(+), 7 deletions(-)
-
---- a/drivers/net/wireless/b43/dma.c
-+++ b/drivers/net/wireless/b43/dma.c
-@@ -1122,9 +1122,11 @@ static int dma_tx_fragment(struct b43_dm
- 	memset(meta_hdr, 0, sizeof(*meta_hdr));
- 
- 	header = &(ring->txhdr_cache[slot * sizeof(struct b43_txhdr_fw4)]);
--	b43_generate_txhdr(ring->dev, header,
-+	err = b43_generate_txhdr(ring->dev, header,
- 			   skb->data, skb->len, ctl,
- 			   generate_cookie(ring, slot));
-+	if (unlikely(err))
+ 	struct b43_dma *dma = &dev->dma;
+@@ -991,27 +1039,10 @@ int b43_dma_init(struct b43_wldev *dev)
+ 	enum b43_dmatype type;
+ 
+ 	dmamask = supported_dma_mask(dev);
+-	switch (dmamask) {
+-	default:
+-		B43_WARN_ON(1);
+-	case DMA_30BIT_MASK:
+-		type = B43_DMA_30BIT;
+-		break;
+-	case DMA_32BIT_MASK:
+-		type = B43_DMA_32BIT;
+-		break;
+-	case DMA_64BIT_MASK:
+-		type = B43_DMA_64BIT;
+-		break;
+-	}
+-	err = ssb_dma_set_mask(dev->dev, dmamask);
+-	if (err) {
+-		b43err(dev->wl, "The machine/kernel does not support "
+-		       "the required DMA mask (0x%08X%08X)\n",
+-		       (unsigned int)((dmamask & 0xFFFFFFFF00000000ULL) >> 32),
+-		       (unsigned int)(dmamask & 0x00000000FFFFFFFFULL));
+-		return -EOPNOTSUPP;
+-	}
++	type = dma_mask_to_engine_type(dmamask);
++	err = b43_dma_set_mask(dev, dmamask);
++	if (err)
 +		return err;
  
- 	meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header,
- 					   sizeof(struct b43_txhdr_fw4), 1);
-@@ -1219,6 +1221,13 @@ int b43_dma_tx(struct b43_wldev *dev,
- 	B43_WARN_ON(ring->stopped);
- 
- 	err = dma_tx_fragment(ring, skb, ctl);
-+	if (unlikely(err == -ENOKEY)) {
-+		/* Drop this packet, as we don't have the encryption key
-+		 * anymore and must not transmit it unencrypted. */
-+		dev_kfree_skb_any(skb);
-+		err = 0;
-+		goto out_unlock;
-+	}
- 	if (unlikely(err)) {
- 		b43err(dev->wl, "DMA tx mapping failure\n");
- 		goto out_unlock;
---- a/drivers/net/wireless/b43/xmit.c
-+++ b/drivers/net/wireless/b43/xmit.c
-@@ -177,7 +177,7 @@ static u8 b43_calc_fallback_rate(u8 bitr
- 	return 0;
- }
- 
--static void generate_txhdr_fw4(struct b43_wldev *dev,
-+static int generate_txhdr_fw4(struct b43_wldev *dev,
- 			       struct b43_txhdr_fw4 *txhdr,
- 			       const unsigned char *fragment_data,
- 			       unsigned int fragment_len,
-@@ -235,7 +235,15 @@ static void generate_txhdr_fw4(struct b4
- 
- 		B43_WARN_ON(key_idx >= dev->max_nr_keys);
- 		key = &(dev->key[key_idx]);
--		B43_WARN_ON(!key->keyconf);
-+
-+		if (unlikely(!key->keyconf)) {
-+			/* This key is invalid. This might only happen
-+			 * in a short timeframe after machine resume before
-+			 * we were able to reconfigure keys.
-+			 * Drop this packet completely. Do not transmit it
-+			 * unencrypted to avoid leaking information. */
-+			return -ENOKEY;
-+		}
+ 	err = -ENOMEM;
+ 	/* setup TX DMA channels. */
+diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
+index c73a75b..f23317e 100644
+--- a/drivers/net/wireless/b43/main.c
++++ b/drivers/net/wireless/b43/main.c
+@@ -78,6 +78,11 @@ static int modparam_nohwcrypt;
+ module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
+ MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
+ 
++static int modparam_btcoex = 1;
++module_param_named(btcoex, modparam_btcoex, int, 0444);
++MODULE_PARM_DESC(btcoex, "Enable Bluetooth coexistance (default on)");
++
++
+ static const struct ssb_device_id b43_ssb_tbl[] = {
+ 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5),
+ 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 6),
+@@ -3339,6 +3344,8 @@ static void b43_bluetooth_coext_enable(struct b43_wldev *dev)
+ 	struct ssb_sprom *sprom = &dev->dev->bus->sprom;
+ 	u32 hf;
  
- 		/* Hardware appends ICV. */
- 		plcp_fragment_len += txctl->icv_len;
-@@ -352,16 +360,18 @@ static void generate_txhdr_fw4(struct b4
- 	txhdr->mac_ctl = cpu_to_le32(mac_ctl);
- 	txhdr->phy_ctl = cpu_to_le16(phy_ctl);
- 	txhdr->extra_ft = extra_ft;
-+
-+	return 0;
++	if (!modparam_btcoex)
++		return;
+ 	if (!(sprom->boardflags_lo & B43_BFL_BTCOEXIST))
+ 		return;
+ 	if (dev->phy.type != B43_PHYTYPE_B && !dev->phy.gmode)
+@@ -3350,11 +3357,13 @@ static void b43_bluetooth_coext_enable(struct b43_wldev *dev)
+ 	else
+ 		hf |= B43_HF_BTCOEX;
+ 	b43_hf_write(dev, hf);
+-	//TODO
  }
  
--void b43_generate_txhdr(struct b43_wldev *dev,
-+int b43_generate_txhdr(struct b43_wldev *dev,
- 			u8 * txhdr,
- 			const unsigned char *fragment_data,
- 			unsigned int fragment_len,
- 			const struct ieee80211_tx_control *txctl, u16 cookie)
- {
--	generate_txhdr_fw4(dev, (struct b43_txhdr_fw4 *)txhdr,
--			   fragment_data, fragment_len, txctl, cookie);
-+	return generate_txhdr_fw4(dev, (struct b43_txhdr_fw4 *)txhdr,
-+				  fragment_data, fragment_len, txctl, cookie);
+ static void b43_bluetooth_coext_disable(struct b43_wldev *dev)
+-{				//TODO
++{
++	if (!modparam_btcoex)
++		return;
++	//TODO
  }
  
- static s8 b43_rssi_postprocess(struct b43_wldev *dev,
---- a/drivers/net/wireless/b43/xmit.h
-+++ b/drivers/net/wireless/b43/xmit.h
-@@ -82,7 +82,7 @@ struct b43_txhdr_fw4 {
- #define  B43_TX4_PHY_ANT1		0x0100	/* Use antenna 1 */
- #define  B43_TX4_PHY_ANTLAST	0x0300	/* Use last used antenna */
- 
--void b43_generate_txhdr(struct b43_wldev *dev,
-+int b43_generate_txhdr(struct b43_wldev *dev,
- 			u8 * txhdr,
- 			const unsigned char *fragment_data,
- 			unsigned int fragment_len,
-From stable-bounces at linux.kernel.org Fri Jan 25 03:23:28 2008
-From: Michael Buesch <mb at bu3sch.de>
-Date: Fri, 25 Jan 2008 12:11:45 +0100
-Subject: b43: Fix suspend/resume
-To: stable at kernel.org
-Cc: linux-wireless at vger.kernel.org, bcm43xx-dev at lists.berlios.de
-Message-ID: <200801251211.45980.mb at bu3sch.de>
-Content-Disposition: inline
-
-From: Michael Buesch <mb at bu3sch.de>
-
-patch 7be1bb6b798d506693d2d8668e801951996b5a4a in mainline.
-
-This patch makes suspend/resume work with the b43 driver.
-We must not overwrite the MAC addresses in the init function, as this
-would also overwrite the MAC on resume. With an all-zero MAC the device
-firmware is not able to ACK any received packets anymore.
-Fix this by moving the initializion stuff that must be done on init but
-not on resume to the start function.
-Also zero out filter_flags to make sure we don't have some flags
-from a previous instance for a tiny timeframe until mac80211 reconfigures
-them.
-
-Signed-off-by: Michael Buesch <mb at bu3sch.de>
-Signed-off-by: John W. Linville <linville at tuxdriver.com>
-Signed-off-by: David S. Miller <davem at davemloft.net>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
-
----
- drivers/net/wireless/b43/main.c |    9 +++++++--
- 1 file changed, 7 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/b43/main.c
-+++ b/drivers/net/wireless/b43/main.c
-@@ -3395,8 +3395,6 @@ static int b43_wireless_core_init(struct
- 	b43_bluetooth_coext_enable(dev);
- 
- 	ssb_bus_powerup(bus, 1);	/* Enable dynamic PCTL */
--	memset(wl->bssid, 0, ETH_ALEN);
--	memset(wl->mac_addr, 0, ETH_ALEN);
- 	b43_upload_card_macaddress(dev);
- 	b43_security_init(dev);
- 	b43_rng_init(wl);
-@@ -3493,6 +3491,13 @@ static int b43_start(struct ieee80211_hw
- 	int did_init = 0;
- 	int err = 0;
- 
-+	/* Kill all old instance specific information to make sure
-+	 * the card won't use it in the short timeframe between start
-+	 * and mac80211 reconfiguring it. */
-+	memset(wl->bssid, 0, ETH_ALEN);
-+	memset(wl->mac_addr, 0, ETH_ALEN);
-+	wl->filter_flags = 0;
-+
- 	/* First register RFkill.
- 	 * LEDs that are registered later depend on it. */
- 	b43_rfkill_init(dev);
-From aurelien at aurel32.net  Tue Mar 11 10:41:45 2008
-Date: Sat, 8 Mar 2008 11:43:52 +0100
-From: Aurelien Jarno <aurelien at aurel32.net>
-To: Greg Kroah-Hartman <greg at kroah.com>, Chris Wright <chrisw at sous-sol.org>
-Cc: stable at kernel.org, Ingo Molnar <mingo at redhat.com>, "H. Peter Anvin" <hpa at zytor.com>
-Subject: x86: Clear DF before calling signal handler
-Message-ID: <20080308104352.GA18303 at hall.aurel32.net>
-
-From: Aurelien Jarno <aurelien at aurel32.net>
-
-x86: Clear DF before calling signal handler
-
-The Linux kernel currently does not clear the direction flag before
-calling a signal handler, whereas the x86/x86-64 ABI requires that.
-This become a real problem with gcc version 4.3, which assumes that
-the direction flag is correctly cleared at the entry of a function.
-
-This patches changes the setup_frame() functions to clear the
-direction before entering the signal handler.
-
-This is a backport of patch e40cd10ccff3d9fbffd57b93780bee4b7b9bff51
-("x86: clear DF before calling signal handler") that has been applied
-in 2.6.25-rc.
-
-Signed-off-by: Aurelien Jarno <aurelien at aurel32.net>
-Signed-off-by: Chris Wright <chrisw at sous-sol.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
----
-
-FEDORA revert: we add this fix on top of utrace
-
- arch/x86/ia32/ia32_signal.c |    4 ++--
- arch/x86/kernel/signal_32.c |    4 ++--
- arch/x86/kernel/signal_64.c |    2 +-
- 3 files changed, 5 insertions(+), 5 deletions(-)
-
---- a/arch/x86/ia32/ia32_signal.c
-+++ b/arch/x86/ia32/ia32_signal.c
-@@ -494,7 +494,7 @@ int ia32_setup_frame(int sig, struct k_s
- 	regs->ss = __USER32_DS; 
- 
- 	set_fs(USER_DS);
--	regs->eflags &= ~TF_MASK;
-+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
- 	if (test_thread_flag(TIF_SINGLESTEP))
- 		ptrace_notify(SIGTRAP);
- 
-@@ -600,7 +600,7 @@ int ia32_setup_rt_frame(int sig, struct 
- 	regs->ss = __USER32_DS; 
- 
- 	set_fs(USER_DS);
--	regs->eflags &= ~TF_MASK;
-+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
- 	if (test_thread_flag(TIF_SINGLESTEP))
- 		ptrace_notify(SIGTRAP);
- 
---- a/arch/x86/kernel/signal_32.c
-+++ b/arch/x86/kernel/signal_32.c
-@@ -396,7 +396,7 @@ static int setup_frame(int sig, struct k
- 	 * The tracer may want to single-step inside the
- 	 * handler too.
- 	 */
--	regs->eflags &= ~TF_MASK;
-+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
- 	if (test_thread_flag(TIF_SINGLESTEP))
- 		ptrace_notify(SIGTRAP);
- 
-@@ -489,7 +489,7 @@ static int setup_rt_frame(int sig, struc
- 	 * The tracer may want to single-step inside the
- 	 * handler too.
- 	 */
--	regs->eflags &= ~TF_MASK;
-+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
- 	if (test_thread_flag(TIF_SINGLESTEP))
- 		ptrace_notify(SIGTRAP);
- 
---- a/arch/x86/kernel/signal_64.c
-+++ b/arch/x86/kernel/signal_64.c
-@@ -295,7 +295,7 @@ static int setup_rt_frame(int sig, struc
- 	   see include/asm-x86_64/uaccess.h for details. */
- 	set_fs(USER_DS);
- 
--	regs->eflags &= ~TF_MASK;
-+	regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
- 	if (test_thread_flag(TIF_SINGLESTEP))
- 		ptrace_notify(SIGTRAP);
- #ifdef DEBUG_SIG
-From stable-bounces at linux.kernel.org  Wed Mar 12 14:13:11 2008
-From: Michael Buesch <mb at bu3sch.de>
-To: stable at kernel.org
-Date: Fri, 29 Feb 2008 12:55:41 +0100
-Content-Disposition: inline
-Message-Id: <200802291255.41906.mb at bu3sch.de>
-Cc: Greg KH <greg at kroah.com>, linux-wireless at vger.kernel.org, bcm43xx-dev at lists.berlios.de, alexey.zaytsev at gmail.com
-Subject: b43: Backport bcm4311 fix
-
-From: Michael Buesch <mb at bu3sch.de>
-
-This is a backport of upstream commit 013978b6 ("b43: Changes to enable
-BCM4311 rev 02 with wireless core revision 13") and the changes include
-the following:
-
-(1) Add the 802.11 rev 13 device to the ssb_device_id table to load b43.
-(2) Add PHY revision 9 to the supported list.
-(3) Change the 2-bit routing code for address extensions to 0b10 rather
-    than the 0b01 used for the 32-bit case.
-(4) Remove some magic numbers in the DMA setup.
-
-The DMA implementation for this chip supports full 64-bit addressing with
-one exception. Whenever the Descriptor Ring Buffer is in high memory, a
-fatal DMA error occurs. This problem was not present in 2.6.24-rc2 due
-to code to "Bias the placement of kernel pages at lower PFNs". When
-commit 44048d70 reverted that code, the DMA error appeared. As a "fix",
-use the GFP_DMA flag when allocating the buffer for 64-bit DMA. At present,
-this problem is thought to arise from a hardware error.
-
-Signed-off-by: Michael Buesch <mb at bu3sch.de>
-Cc: Larry Finger <Larry.Finger at lwfinger.net>
-Cc: John W. Linville <linville at tuxdriver.com>
-Cc: Alexey Zaytsev <alexey.zaytsev at gmail.com>
-Signed-off-by: Chris Wright <chrisw at sous-sol.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
-
----
- drivers/net/wireless/b43/dma.c  |   30 ++++++++++++++++++++++--------
- drivers/net/wireless/b43/main.c |    3 ++-
- 2 files changed, 24 insertions(+), 9 deletions(-)
-
---- a/drivers/net/wireless/b43/dma.c
-+++ b/drivers/net/wireless/b43/dma.c
-@@ -165,7 +165,7 @@ static void op64_fill_descriptor(struct 
- 	addrhi = (((u64) dmaaddr >> 32) & ~SSB_DMA_TRANSLATION_MASK);
- 	addrext = (((u64) dmaaddr >> 32) & SSB_DMA_TRANSLATION_MASK)
- 	    >> SSB_DMA_TRANSLATION_SHIFT;
--	addrhi |= ssb_dma_translation(ring->dev->dev);
-+	addrhi |= (ssb_dma_translation(ring->dev->dev) << 1);
- 	if (slot == ring->nr_slots - 1)
- 		ctl0 |= B43_DMA64_DCTL0_DTABLEEND;
- 	if (start)
-@@ -426,9 +426,21 @@ static inline
- static int alloc_ringmemory(struct b43_dmaring *ring)
- {
- 	struct device *dev = ring->dev->dev->dev;
-+	gfp_t flags = GFP_KERNEL;
+ static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev)
+@@ -4000,8 +4009,16 @@ static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl)
+ 	return err;
+ }
  
-+	/* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
-+	 * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing
-+	 * has shown that 4K is sufficient for the latter as long as the buffer
-+	 * does not cross an 8K boundary.
-+	 *
-+	 * For unknown reasons - possibly a hardware error - the BCM4311 rev
-+	 * 02, which uses 64-bit DMA, needs the ring buffer in very low memory,
-+	 * which accounts for the GFP_DMA flag below.
-+	 */
-+	if (ring->dma64)
-+		flags |= GFP_DMA;
- 	ring->descbase = dma_alloc_coherent(dev, B43_DMA_RINGMEMSIZE,
--					    &(ring->dmabase), GFP_KERNEL);
-+					    &(ring->dmabase), flags);
- 	if (!ring->descbase) {
- 		b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
- 		return -ENOMEM;
-@@ -483,7 +495,7 @@ int b43_dmacontroller_rx_reset(struct b4
- 	return 0;
++#define IS_PDEV(pdev, _vendor, _device, _subvendor, _subdevice)		( \
++	(pdev->vendor == PCI_VENDOR_ID_##_vendor) &&			\
++	(pdev->device == _device) &&					\
++	(pdev->subsystem_vendor == PCI_VENDOR_ID_##_subvendor) &&	\
++	(pdev->subsystem_device == _subdevice)				)
++
+ static void b43_sprom_fixup(struct ssb_bus *bus)
+ {
++	struct pci_dev *pdev;
++
+ 	/* boardflags workarounds */
+ 	if (bus->boardinfo.vendor == SSB_BOARDVENDOR_DELL &&
+ 	    bus->chip_id == 0x4301 && bus->boardinfo.rev == 0x74)
+@@ -4009,6 +4026,13 @@ static void b43_sprom_fixup(struct ssb_bus *bus)
+ 	if (bus->boardinfo.vendor == PCI_VENDOR_ID_APPLE &&
+ 	    bus->boardinfo.type == 0x4E && bus->boardinfo.rev > 0x40)
+ 		bus->sprom.boardflags_lo |= B43_BFL_PACTRL;
++	if (bus->bustype == SSB_BUSTYPE_PCI) {
++		pdev = bus->host_pci;
++		if (IS_PDEV(pdev, BROADCOM, 0x4318, ASUSTEK, 0x100F) ||
++		    IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0015) ||
++		    IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0013))
++			bus->sprom.boardflags_lo &= ~B43_BFL_BTCOEXIST;
++	}
  }
  
--/* Reset the RX DMA channel */
-+/* Reset the TX DMA channel */
- int b43_dmacontroller_tx_reset(struct b43_wldev *dev, u16 mmio_base, int dma64)
- {
- 	int i;
-@@ -647,7 +659,7 @@ static int dmacontroller_setup(struct b4
- 			b43_dma_write(ring, B43_DMA64_TXRINGHI,
- 				      ((ringbase >> 32) &
- 				       ~SSB_DMA_TRANSLATION_MASK)
--				      | trans);
-+				      | (trans << 1));
- 		} else {
- 			u32 ringbase = (u32) (ring->dmabase);
- 
-@@ -680,8 +692,9 @@ static int dmacontroller_setup(struct b4
- 			b43_dma_write(ring, B43_DMA64_RXRINGHI,
- 				      ((ringbase >> 32) &
- 				       ~SSB_DMA_TRANSLATION_MASK)
--				      | trans);
--			b43_dma_write(ring, B43_DMA64_RXINDEX, 200);
-+				      | (trans << 1));
-+			b43_dma_write(ring, B43_DMA64_RXINDEX, ring->nr_slots *
-+				      sizeof(struct b43_dmadesc64));
- 		} else {
- 			u32 ringbase = (u32) (ring->dmabase);
- 
-@@ -695,11 +708,12 @@ static int dmacontroller_setup(struct b4
- 			b43_dma_write(ring, B43_DMA32_RXRING,
- 				      (ringbase & ~SSB_DMA_TRANSLATION_MASK)
- 				      | trans);
--			b43_dma_write(ring, B43_DMA32_RXINDEX, 200);
-+			b43_dma_write(ring, B43_DMA32_RXINDEX, ring->nr_slots *
-+				      sizeof(struct b43_dmadesc32));
- 		}
+ static void b43_wireless_exit(struct ssb_device *dev, struct b43_wl *wl)
+diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
+index b434df7..274a448 100644
+--- a/drivers/ssb/pci.c
++++ b/drivers/ssb/pci.c
+@@ -482,6 +482,11 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
+ 			goto unsupported;
  	}
  
--      out:
-+out:
- 	return err;
- }
- 
---- a/drivers/net/wireless/b43/main.c
-+++ b/drivers/net/wireless/b43/main.c
-@@ -101,6 +101,7 @@ static const struct ssb_device_id b43_ss
- 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 7),
- 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 9),
- 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 10),
-+	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 13),
- 	SSB_DEVTABLE_END
- };
- 
-@@ -3079,7 +3080,7 @@ static int b43_phy_versioning(struct b43
- 			unsupported = 1;
- 		break;
- 	case B43_PHYTYPE_G:
--		if (phy_rev > 8)
-+		if (phy_rev > 9)
- 			unsupported = 1;
- 		break;
- 	default:
++	if (out->boardflags_lo == 0xFFFF)
++		out->boardflags_lo = 0;  /* per specs */
++	if (out->boardflags_hi == 0xFFFF)
++		out->boardflags_hi = 0;  /* per specs */
++
+ 	return 0;
+ unsupported:
+ 	ssb_printk(KERN_WARNING PFX "Unsupported SPROM revision %d "

nouveau-drm.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.7 -r 1.8 nouveau-drm.patch
Index: nouveau-drm.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/nouveau-drm.patch,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- nouveau-drm.patch	6 Mar 2008 05:18:18 -0000	1.7
+++ nouveau-drm.patch	21 May 2008 23:55:13 -0000	1.8
@@ -1,54 +1,60 @@
-From f4e9f548d49b0bc9fbbfbee635f96e79a2f472ae Mon Sep 17 00:00:00 2001
-From: Dave Airlie <airlied at voynix.(none)>
-Date: Thu, 6 Sep 2007 00:10:19 +1000
-Subject: [PATCH] drm: add nouveau latest code
+From 2e677c51e2e77e78695eda61b52704144a490bec Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied at redhat.com>
+Date: Fri, 29 Feb 2008 15:58:37 +1000
+Subject: [PATCH] nouveau: rebased master from git
 
 ---
- drivers/char/drm/Kconfig            |    5 +
+ drivers/char/drm/Kconfig            |    7 +
  drivers/char/drm/Makefile           |   12 +
  drivers/char/drm/drmP.h             |    4 +-
- drivers/char/drm/drm_bufs.c         |    6 +-
+ drivers/char/drm/drm_bufs.c         |    5 +-
+ drivers/char/drm/drm_drv.c          |    4 +
  drivers/char/drm/drm_irq.c          |    3 +-
  drivers/char/drm/drm_pciids.h       |  262 ++++
- drivers/char/drm/nouveau_dma.c      |  177 +++
- drivers/char/drm/nouveau_dma.h      |   98 ++
- drivers/char/drm/nouveau_drm.h      |  166 ++
- drivers/char/drm/nouveau_drv.c      |   96 ++
- drivers/char/drm/nouveau_drv.h      |  584 +++++++
- drivers/char/drm/nouveau_fifo.c     |  557 +++++++
- drivers/char/drm/nouveau_ioc32.c    |   72 +
- drivers/char/drm/nouveau_irq.c      |  430 ++++++
- drivers/char/drm/nouveau_mem.c      |  616 ++++++++
- drivers/char/drm/nouveau_notifier.c |  173 +++
- drivers/char/drm/nouveau_object.c   | 1148 ++++++++++++++
- drivers/char/drm/nouveau_reg.h      |  538 +++++++
- drivers/char/drm/nouveau_sgdma.c    |  311 ++++
- drivers/char/drm/nouveau_state.c    |  569 +++++++
- drivers/char/drm/nv04_fb.c          |   24 +
- drivers/char/drm/nv04_fifo.c        |  129 ++
- drivers/char/drm/nv04_graph.c       |  415 +++++
- drivers/char/drm/nv04_instmem.c     |  160 ++
- drivers/char/drm/nv04_mc.c          |   23 +
- drivers/char/drm/nv04_timer.c       |   45 +
- drivers/char/drm/nv10_fb.c          |   26 +
- drivers/char/drm/nv10_fifo.c        |  160 ++
- drivers/char/drm/nv10_graph.c       |  777 ++++++++++
- drivers/char/drm/nv20_graph.c       |  249 +++
- drivers/char/drm/nv30_graph.c       | 2911 +++++++++++++++++++++++++++++++++++
- drivers/char/drm/nv40_fb.c          |   56 +
- drivers/char/drm/nv40_fifo.c        |  208 +++
- drivers/char/drm/nv40_graph.c       | 1906 +++++++++++++++++++++++
- drivers/char/drm/nv40_mc.c          |   39 +
- drivers/char/drm/nv50_fifo.c        |  327 ++++
- drivers/char/drm/nv50_graph.c       |  316 ++++
- drivers/char/drm/nv50_instmem.c     |  320 ++++
+ drivers/char/drm/nouveau_bo.c   |  293 +++++
+ drivers/char/drm/nouveau_dma.c      |  172 +++
+ drivers/char/drm/nouveau_dma.h      |   96 ++
+ drivers/char/drm/nouveau_drm.h      |  166 +++
+ drivers/char/drm/nouveau_drv.c      |  108 ++
+ drivers/char/drm/nouveau_drv.h      |  602 ++++++++++
+ drivers/char/drm/nouveau_fence.c    |  120 ++
+ drivers/char/drm/nouveau_fifo.c     |  590 ++++++++++
+ drivers/char/drm/nouveau_ioc32.c    |   72 ++
+ drivers/char/drm/nouveau_irq.c      |  477 ++++++++
+ drivers/char/drm/nouveau_mem.c      |  674 +++++++++++
+ drivers/char/drm/nouveau_notifier.c |  165 +++
+ drivers/char/drm/nouveau_object.c   | 1148 ++++++++++++++++++
+ drivers/char/drm/nouveau_reg.h      |  586 +++++++++
+ drivers/char/drm/nouveau_sgdma.c    |  341 ++++++
+ drivers/char/drm/nouveau_state.c    |  694 +++++++++++
+ drivers/char/drm/nouveau_swmthd.c   |  191 +++
+ drivers/char/drm/nouveau_swmthd.h   |   33 +
+ drivers/char/drm/nv04_fb.c          |   23 +
+ drivers/char/drm/nv04_fifo.c        |  138 +++
+ drivers/char/drm/nv04_graph.c       |  516 ++++++++
+ drivers/char/drm/nv04_instmem.c     |  159 +++
+ drivers/char/drm/nv04_mc.c          |   35 +
+ drivers/char/drm/nv04_timer.c       |   44 +
+ drivers/char/drm/nv10_fb.c          |   25 +
+ drivers/char/drm/nv10_fifo.c        |  169 +++
+ drivers/char/drm/nv10_graph.c       |  871 ++++++++++++++
+ drivers/char/drm/nv20_graph.c       |  889 ++++++++++++++
+ drivers/char/drm/nv40_fb.c          |   62 +
+ drivers/char/drm/nv40_fifo.c        |  199 ++++
+ drivers/char/drm/nv40_graph.c       | 2225 +++++++++++++++++++++++++++++++++++
+ drivers/char/drm/nv40_mc.c          |   38 +
+ drivers/char/drm/nv50_fifo.c        |  339 ++++++
+ drivers/char/drm/nv50_graph.c       |  363 ++++++
+ drivers/char/drm/nv50_instmem.c     |  323 +++++
  drivers/char/drm/nv50_mc.c          |   43 +
- 39 files changed, 13957 insertions(+), 4 deletions(-)
+ 43 files changed, 13282 insertions(+), 4 deletions(-)
+ create mode 100644 drivers/char/drm/nouveau_bo.c
  create mode 100644 drivers/char/drm/nouveau_dma.c
  create mode 100644 drivers/char/drm/nouveau_dma.h
  create mode 100644 drivers/char/drm/nouveau_drm.h
  create mode 100644 drivers/char/drm/nouveau_drv.c
  create mode 100644 drivers/char/drm/nouveau_drv.h
+ create mode 100644 drivers/char/drm/nouveau_fence.c
  create mode 100644 drivers/char/drm/nouveau_fifo.c
  create mode 100644 drivers/char/drm/nouveau_ioc32.c
  create mode 100644 drivers/char/drm/nouveau_irq.c
@@ -58,6 +64,8 @@
  create mode 100644 drivers/char/drm/nouveau_reg.h
  create mode 100644 drivers/char/drm/nouveau_sgdma.c
  create mode 100644 drivers/char/drm/nouveau_state.c
+ create mode 100644 drivers/char/drm/nouveau_swmthd.c
+ create mode 100644 drivers/char/drm/nouveau_swmthd.h
  create mode 100644 drivers/char/drm/nv04_fb.c
  create mode 100644 drivers/char/drm/nv04_fifo.c
  create mode 100644 drivers/char/drm/nv04_graph.c
@@ -68,7 +76,6 @@
  create mode 100644 drivers/char/drm/nv10_fifo.c
  create mode 100644 drivers/char/drm/nv10_graph.c
  create mode 100644 drivers/char/drm/nv20_graph.c
- create mode 100644 drivers/char/drm/nv30_graph.c
  create mode 100644 drivers/char/drm/nv40_fb.c
  create mode 100644 drivers/char/drm/nv40_fifo.c
  create mode 100644 drivers/char/drm/nv40_graph.c
@@ -79,40 +86,42 @@
  create mode 100644 drivers/char/drm/nv50_mc.c
 
 diff --git a/drivers/char/drm/Kconfig b/drivers/char/drm/Kconfig
-index 0b7ffa5..0220619 100644
+index 610d6fd..6b98529 100644
 --- a/drivers/char/drm/Kconfig
 +++ b/drivers/char/drm/Kconfig
-@@ -106,3 +106,8 @@ config DRM_SAVAGE
+@@ -105,3 +105,10 @@ config DRM_SAVAGE
+ 	help
  	  Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
  	  chipset. If M is selected the module will be called savage.
- 
++
 +config DRM_NOUVEAU
 +	tristate "Nvidia video cards"
 +	depends on DRM
 +	help
-+		Choose this for nvidia open source 3d driver
++	  Choose this for nvidia open source 3d driver
++
 diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
-index 6915a05..f798916 100644
+index 85c4f9e..721548c 100644
 --- a/drivers/char/drm/Makefile
 +++ b/drivers/char/drm/Makefile
-@@ -14,6 +14,16 @@ mga-objs    := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
+@@ -15,6 +15,16 @@ mga-objs    := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
  i810-objs   := i810_drv.o i810_dma.o
  i830-objs   := i830_drv.o i830_dma.o i830_irq.o
- i915-objs   := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
+ i915-objs   := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_fence.o i915_buffer.o
 +nouveau-objs := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \
-+		nouveau_object.o nouveau_irq.o nouveau_notifier.o \
-+		nouveau_sgdma.o nouveau_dma.o \
++		nouveau_object.o nouveau_irq.o nouveau_notifier.o nouveau_swmthd.o \
++		nouveau_sgdma.o nouveau_dma.o nouveau_bo.o nouveau_fence.o \
 +		nv04_timer.o \
 +		nv04_mc.o nv40_mc.o nv50_mc.o \
 +		nv04_fb.o nv10_fb.o nv40_fb.o \
 +		nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \
-+		nv04_graph.o nv10_graph.o nv20_graph.o nv30_graph.o \
++		nv04_graph.o nv10_graph.o nv20_graph.o \
 +		nv40_graph.o nv50_graph.o \
 +		nv04_instmem.o nv50_instmem.o
  radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
  sis-objs    := sis_drv.o sis_mm.o
  savage-objs := savage_drv.o savage_bci.o savage_state.o
-@@ -25,6 +35,7 @@ radeon-objs += radeon_ioc32.o
+@@ -26,6 +36,7 @@ radeon-objs += radeon_ioc32.o
  mga-objs    += mga_ioc32.o
  r128-objs   += r128_ioc32.o
  i915-objs   += i915_ioc32.o
@@ -120,7 +129,7 @@
  endif
  
  obj-$(CONFIG_DRM)	+= drm.o
-@@ -35,6 +46,7 @@ obj-$(CONFIG_DRM_MGA)	+= mga.o
+@@ -36,6 +47,7 @@ obj-$(CONFIG_DRM_MGA)	+= mga.o
  obj-$(CONFIG_DRM_I810)	+= i810.o
  obj-$(CONFIG_DRM_I830)	+= i830.o
  obj-$(CONFIG_DRM_I915)  += i915.o
@@ -129,10 +138,10 @@
  obj-$(CONFIG_DRM_SAVAGE)+= savage.o
  obj-$(CONFIG_DRM_VIA)	+=via.o
 diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
-index 9dd0760..d539c96 100644
+index c6df504..7fb3a2f 100644
 --- a/drivers/char/drm/drmP.h
 +++ b/drivers/char/drm/drmP.h
-@@ -967,7 +967,8 @@ extern unsigned long drm_get_resource_start(struct drm_device *dev,
+@@ -1033,7 +1033,8 @@ extern unsigned long drm_get_resource_start(struct drm_device *dev,
  					    unsigned int resource);
  extern unsigned long drm_get_resource_len(struct drm_device *dev,
[...9359 lines suppressed...]
-+static void
++static int
 +nv50_graph_init_ctxctl(struct drm_device *dev)
 +{
 +	struct drm_nouveau_private *dev_priv = dev->dev_private;
-+	uint32_t *voodoo;
++	uint32_t *voodoo = NULL;
 +
 +	DRM_DEBUG("\n");
 +
@@ -13809,34 +13153,42 @@
 +	case 0x84:
 +		voodoo = nv84_ctx_voodoo;
 +		break;
++	case 0x86:
++		voodoo = nv86_ctx_voodoo;
++		break;
 +	default:
 +		DRM_ERROR("no voodoo for chipset NV%02x\n", dev_priv->chipset);
-+		break;
++		return -EINVAL;
 +	}
 +
-+	if (voodoo) {
-+		NV_WRITE(NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
-+		while (*voodoo != ~0) {
-+			NV_WRITE(NV40_PGRAPH_CTXCTL_UCODE_DATA, *voodoo);
-+			voodoo++;
-+		}
++	NV_WRITE(NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
++	while (*voodoo != ~0) {
++		NV_WRITE(NV40_PGRAPH_CTXCTL_UCODE_DATA, *voodoo);
++		voodoo++;
 +	}
 +
 +	NV_WRITE(0x400320, 4);
 +	NV_WRITE(NV40_PGRAPH_CTXCTL_CUR, 0);
 +	NV_WRITE(NV20_PGRAPH_CHANNEL_CTX_POINTER, 0);
++
++	return 0;
 +}
 +
-+int 
++int
 +nv50_graph_init(struct drm_device *dev)
 +{
++	int ret;
++
 +	DRM_DEBUG("\n");
 +
 +	nv50_graph_init_reset(dev);
 +	nv50_graph_init_intr(dev);
 +	nv50_graph_init_regs__nv(dev);
 +	nv50_graph_init_regs(dev);
-+	nv50_graph_init_ctxctl(dev);
++
++	ret = nv50_graph_init_ctxctl(dev);
++	if (ret)
++		return ret;
 +
 +	return 0;
 +}
@@ -13859,11 +13211,10 @@
 +
 +	DRM_DEBUG("ch%d\n", chan->id);
 +
-+	if ((ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0,
-+					  grctx_size, 0x1000,
-+					  NVOBJ_FLAG_ZERO_ALLOC |
-+					  NVOBJ_FLAG_ZERO_FREE,
-+					  &chan->ramin_grctx)))
++	ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, grctx_size, 0x1000,
++				     NVOBJ_FLAG_ZERO_ALLOC |
++				     NVOBJ_FLAG_ZERO_FREE, &chan->ramin_grctx);
++	if (ret)
 +		return ret;
 +
 +	hdr = IS_G80 ? 0x200 : 0x20;
@@ -13875,11 +13226,16 @@
 +	INSTANCE_WR(ramin, (hdr + 0x10)/4, 0);
 +	INSTANCE_WR(ramin, (hdr + 0x14)/4, 0x00010000);
 +
-+	if ((ret = engine->graph.load_context(chan))) {
++	ret = engine->graph.load_context(chan);
++	if (ret) {
 +		DRM_ERROR("Error hacking up initial context: %d\n", ret);
 +		return ret;
 +	}
 +
++	INSTANCE_WR(chan->ramin_grctx->gpuobj, 0x00000/4,
++		    chan->ramin->instance >> 12);
++	INSTANCE_WR(chan->ramin_grctx->gpuobj, 0x0011c/4, 0x00000002);
++
 +	return 0;
 +}
 +
@@ -13909,10 +13265,10 @@
 +	DRM_DEBUG("inst=0x%08x, save=%d\n", inst, save);
 +
 +	old_cp = NV_READ(NV20_PGRAPH_CHANNEL_CTX_POINTER);
-+	NV_WRITE(NV20_PGRAPH_CHANNEL_CTX_POINTER, inst | (1<<31));
++	NV_WRITE(NV20_PGRAPH_CHANNEL_CTX_POINTER, inst);
 +	NV_WRITE(0x400824, NV_READ(0x400824) |
 +		 (save ? NV40_PGRAPH_CTXCTL_0310_XFER_SAVE :
-+		  	 NV40_PGRAPH_CTXCTL_0310_XFER_LOAD));
++			 NV40_PGRAPH_CTXCTL_0310_XFER_LOAD));
 +	NV_WRITE(NV40_PGRAPH_CTXCTL_0304, NV40_PGRAPH_CTXCTL_0304_XFER_CTX);
 +
 +	for (i = 0; i < tv; i++) {
@@ -13936,19 +13292,15 @@
 +{
 +	struct drm_device *dev = chan->dev;
 +	struct drm_nouveau_private *dev_priv = dev->dev_private;
-+	uint32_t inst = ((chan->ramin->instance >> 12) | (1<<31));
++	uint32_t inst = chan->ramin->instance >> 12;
 +	int ret; (void)ret;
 +
 +	DRM_DEBUG("ch%d\n", chan->id);
 +
-+#if 0
-+	if ((ret = nv50_graph_transfer_context(dev, inst, 0)))
-+		return ret;
-+#endif
 +
 +	NV_WRITE(NV20_PGRAPH_CHANNEL_CTX_POINTER, inst);
 +	NV_WRITE(0x400320, 4);
-+	NV_WRITE(NV40_PGRAPH_CTXCTL_CUR, inst);
++	NV_WRITE(NV40_PGRAPH_CTXCTL_CUR, inst | (1<<31));
 +
 +	return 0;
 +}
@@ -13957,19 +13309,18 @@
 +nv50_graph_save_context(struct nouveau_channel *chan)
 +{
 +	struct drm_device *dev = chan->dev;
-+	uint32_t inst = ((chan->ramin->instance >> 12) | (1<<31));
++	uint32_t inst = chan->ramin->instance >> 12;
 +
 +	DRM_DEBUG("ch%d\n", chan->id);
 +
 +	return nv50_graph_transfer_context(dev, inst, 1);
 +}
-+
 diff --git a/drivers/char/drm/nv50_instmem.c b/drivers/char/drm/nv50_instmem.c
 new file mode 100644
-index 0000000..1eeb54d
+index 0000000..9687ecb
 --- /dev/null
 +++ b/drivers/char/drm/nv50_instmem.c
-@@ -0,0 +1,320 @@
+@@ -0,0 +1,323 @@
 +/*
 + * Copyright (C) 2007 Ben Skeggs.
 + *
@@ -14041,7 +13392,11 @@
 +		return -ENOMEM;
 +	dev_priv->Engine.instmem.priv = priv;
 +
-+	/* Reserve the last MiB of VRAM, we should probably try to avoid 
++	/* Save state, will restore at takedown. */
++	for (i = 0x1700; i <= 0x1710; i+=4)
++		priv->save1700[(i-0x1700)/4] = NV_READ(i);
++
++	/* Reserve the last MiB of VRAM, we should probably try to avoid
 +	 * setting up the below tables over the top of the VBIOS image at
 +	 * some point.
 +	 */
@@ -14116,7 +13471,7 @@
 +			BAR0_WI32(priv->pramin_pt->gpuobj, i + 0, v | 1);
 +		else
 +			BAR0_WI32(priv->pramin_pt->gpuobj, i + 0, 0x00000009);
-+		BAR0_WI32(priv->pramin_pt->gpuobj, i + 4, 0x00000000); 
++		BAR0_WI32(priv->pramin_pt->gpuobj, i + 4, 0x00000000);
 +	}
 +
 +	BAR0_WI32(chan->vm_pd, 0x00, priv->pramin_pt->instance | 0x63);
@@ -14231,7 +13586,7 @@
 +			dev_priv->Engine.instmem.unbind(dev, gpuobj);
 +		nouveau_mem_free(dev, gpuobj->im_backing);
 +		gpuobj->im_backing = NULL;
-+	}	
++	}
 +}
 +
 +int
@@ -14289,7 +13644,6 @@
 +	gpuobj->im_bound = 0;
 +	return 0;
 +}
-+
 diff --git a/drivers/char/drm/nv50_mc.c b/drivers/char/drm/nv50_mc.c
 new file mode 100644
 index 0000000..b111826
@@ -14340,5 +13694,5 @@
 +{
 +}
 -- 
-1.5.2.5
+1.5.3.7
 


--- linux-2.6-dcdbas-autoload.patch DELETED ---


--- linux-2.6-debug-resource-overflow.patch DELETED ---


--- linux-2.6-defaults-nommconf.patch DELETED ---


--- linux-2.6-drm-radeon-update.patch DELETED ---


--- linux-2.6-e1000-bad-csum-allow.patch DELETED ---


--- linux-2.6-git-initial-r500-drm.patch DELETED ---


--- linux-2.6-hwmon-coretemp-add-penryn-cpu.patch DELETED ---


--- linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch DELETED ---


--- linux-2.6-input-apple-add-aluminum-keyboard.patch DELETED ---


--- linux-2.6-input-apple-add-macbook-3rd-gen.patch DELETED ---


--- linux-2.6-input-apple-kbd-change-keycodes.patch DELETED ---


--- linux-2.6-input-apple-remove-4th-gen-kbd-quirk.patch DELETED ---


--- linux-2.6-input-apple-rename-identifiers.patch DELETED ---


--- linux-2.6-input-appletouch-macbook3-trackpad.patch DELETED ---


--- linux-2.6-isapnp-fix-limits.patch DELETED ---


--- linux-2.6-isdn-hisax-fix-request_irq-oops.patch DELETED ---


--- linux-2.6-libata-it821x-improve-emulation-handling.patch DELETED ---


--- linux-2.6-libata-pata_ataiixp-clear-simplex-b4-probe.patch DELETED ---


--- linux-2.6-net-tun-fix-rtnl-locking.patch DELETED ---


--- linux-2.6-netfilter-really-fix-oops-in-nf_nat_move_storage.patch DELETED ---


--- linux-2.6-paranoid-iret-crash-fix.patch DELETED ---


--- linux-2.6-pasemi-for-2.6.25.patch DELETED ---


--- linux-2.6-pasemi-reserve-i2c.patch DELETED ---


--- linux-2.6-pci-remove-default-pci-rom-allocation.patch DELETED ---


--- linux-2.6-pci-revert-remove-transparent-bridge-resizing.patch DELETED ---


--- linux-2.6-pnp-disable-overlapping-resources.patch DELETED ---


--- linux-2.6-pnp-extend-resource-limits.patch DELETED ---


--- linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch DELETED ---


--- linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch DELETED ---


--- linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch DELETED ---


--- linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch DELETED ---


--- linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch DELETED ---


--- linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch DELETED ---


--- linux-2.6-powerpc-spu-vicinity.patch DELETED ---


--- linux-2.6-ppc32-ucmpdi2.patch DELETED ---


--- linux-2.6-thinkpad-key-events.patch DELETED ---


--- linux-2.6-unexport-symbols.patch DELETED ---


--- linux-2.6-upstream-kcore-access.patch DELETED ---


--- linux-2.6-usb-serial-fix-recursive-lock.patch DELETED ---


--- linux-2.6-usb-serial-option-add-dell-modem-1.patch DELETED ---


--- linux-2.6-usb-serial-option-add-dell-modem-2.patch DELETED ---


--- linux-2.6-x86-asmlinkage_protect-sys_io_getevents.patch DELETED ---


--- linux-2.6-x86-clear-df-for-signals.patch DELETED ---


--- linux-2.6-x86_64-silence-up-apic-errors.patch DELETED ---


--- linux-2.6-xfs-features2-fixup-fix.patch DELETED ---


--- linux-2.6-xfs-features2-fixup.patch DELETED ---


--- linux-2.6-xfs-optimize-away-realtime-tests.patch DELETED ---


--- linux-2.6-xfs-setfattr-32bit-compat.patch DELETED ---


--- linux-2.6-xfs-xfs_mount-refactor.patch DELETED ---




More information about the scm-commits mailing list