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

diff -urN linux-2.5.64-bk11/Documentation/kbuild/makefiles.txt linux-2.5.64-bk12/Documentation/kbuild/makefiles.txt
--- linux-2.5.64-bk11/Documentation/kbuild/makefiles.txt	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/Documentation/kbuild/makefiles.txt	Mon Mar 31 12:36:29 2003
@@ -10,7 +10,7 @@
 	   --- 3.1 Goal definitions
 	   --- 3.2 Built-in object goals - obj-y
 	   --- 3.3 Loadable module goals - obj-m
-	   --- 3.4 Objects which export symbols - export-objs
+	   --- 3.4 Objects which export symbols
 	   --- 3.5 Library file goals - L_TARGET
 	   --- 3.6 Descending down in directories
 	   --- 3.7 Compilation flags
@@ -208,32 +208,11 @@
 	kbuild will build an ext2.o file for you out of the individual
 	parts and then link this into built-in.o, as you would expect.
 
---- 3.4 Objects which export symbols - export-objs
+--- 3.4 Objects which export symbols
 
-	When using loadable modules, not every global symbol in the
-	kernel / other modules is automatically available, only those
-	explicitly exported are available for your module.
-
-	To make a symbol available for use in modules, to "export" it,
-	use the EXPORT_SYMBOL(<symbol>) directive in your source. In
-	addition, you need to list all object files which export symbols
-	(i.e. their source contains an EXPORT_SYMBOL() directive) in the
-	Makefile variable $(export-objs).
-
-	Example:
-		#drivers/isdn/i4l/Makefile
-		# Objects that export symbols.
-		export-objs     := isdn_common.o
-
-	since isdn_common.c contains
-
-	    EXPORT_SYMBOL(register_isdn);
-
-	which makes the function register_isdn available to
-	low-level ISDN drivers.
-	There exist a EXPORT_SYMBOL_GPL() variant with similar functionality,
-	but more restrictive with what may use that symbol. The requirement
-	to list the .o file in export-objs is the same.
+	No special notation is required in the makefiles for
+	modules exporting symbols.
+	See also Documentation/modules.txt.
 
 --- 3.5 Library file goals - L_TARGET
 
@@ -400,7 +379,7 @@
 
 The second step is to add an explicit dependency to the executable.
 This can be done in two ways. Either add the dependency in a rule, 
-or utilise the variable build-targets.
+or utilise the variable $(always).
 Both possibilities are described in the following.
 
 --- 4.1 Simple Host Program
@@ -526,15 +505,15 @@
 	$(obj)/gen-devlist is updated. Note that references to
 	the host programs in special rules must be prefixed with $(obj).
 
-	(2) Use $(build-targets)
+	(2) Use $(always)
 	When there is no suitable special rule, and the host program
-	shall be built when a makefile is entered, the $(build-targets)
+	shall be built when a makefile is entered, the $(always)
 	variable shall be used.
 
 	Example:
 		#scripts/lxdialog/Makefile
 		host-progs    := lxdialog
-		build-targets := $(host-progs)
+		always        := $(host-progs)
 
 	This will tell kbuild to build lxdialog even if not referenced in
 	any rule.
@@ -543,13 +522,13 @@
 
 "make clean" deletes most generated files in the src tree where the kernel
 is compiled. This includes generated files such as host programs.
-Kbuild knows targets listed in $(host-progs) and $(EXTRA_TARGETS) and
-they are all deleted during "make clean".
+Kbuild knows targets listed in $(host-progs), $(always), $(extra-y) and
+$(targets). They are all deleted during "make clean".
 Files matching the patterns "*.[oas]", "*.ko", plus some additional files
 generated by kbuild are deleted all over the kernel src tree when
 "make clean" is executed.
 
-Additional files can be specified by means of $(clean-files).
+Additional files can be specified in kbuild makefiles by use of $(clean-files).
 
 	Example:
 		#drivers/pci/Makefile
@@ -818,31 +797,23 @@
 
 --- 6.5 Building non-kbuild targets
 
-    EXTRA_TARGETS
+    extra-y
 
-	EXTRA_TARGETS specify additional targets created in current
+	extra-y specify additional targets created in current
 	directory, in addition to any targets specified by obj-*.
 
-	Listing all targets in EXTRA_TARGETS is required for three purposes:
-	1) Avoid that the target is linked in as part of built-in.o
-	2) Enable kbuild to check changes in command lines
+	Listing all targets in extra-y is required for two purposes:
+	1) Enable kbuild to check changes in command lines
 	   - When $(call if_changed,xxx) is used
-	3) kbuild knows what file to delete during "make clean"
+	2) kbuild knows what files to delete during "make clean"
 
 	Example:
 		#arch/i386/kernel/Makefile
-		EXTRA_TARGETS := head.o init_task.o
+		extra-y := head.o init_task.o
 
-	In this example EXTRA_TARGETS is used to list object files that
+	In this example extra-y is used to list object files that
 	shall be built, but shall not be linked as part of built-in.o.
 
-	Example:
-		#arch/i386/boot/Makefile
-		EXTRA_TARGETS := vmlinux.bin bootsect bootsect.o
-
-	In this example EXTRA_TARGETS is used to list all intermediate
-	targets, and all final targets.
-	The targets are added to EXTRA_TARGETS to enable 2) and 3) above.
 	
 --- 6.6 Commands useful for building a boot image
 
@@ -861,9 +832,10 @@
 	needs an update, or the commandline has changed since last
 	invocation. The latter will force a rebuild if any options
 	to the executable have changed.
-	Any target that utilises if_changed must be listed in EXTRA_TARGETS,
+	Any target that utilises if_changed must be listed in $(targets),
 	otherwise the command line check will fail, and the target will
 	always be built.
+	Assignments to $(targets) are without $(obj)/ prefix.
 	if_changed may be used in conjunction with custom commands as
 	defined in 6.7 "Custom kbuild commands".
 	Note: It is a typical mistake to forget the FORCE prerequisite.
@@ -874,10 +846,34 @@
     objcopy
 	Copy binary. Uses OBJCOPYFLAGS usually specified in
 	arch/$(ARCH)/Makefile.
+	OBJCOPYFLAGS_$@ may be used to set additional options.
 
     gzip
 	Compress target. Use maximum compression to compress target.
 
+	Example:
+		#arch/i386/boot/Makefile
+		LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
+		LDFLAGS_setup    := -Ttext 0x0 -s --oformat binary -e begtext
+
+		targets += setup setup.o bootsect bootsect.o
+		$(obj)/setup $(obj)/bootsect: %: %.o FORCE
+			$(call if_changed,ld)
+
+	In this example there is two possible targets, requiring different
+	options to the linker. the linker options are specified using the
+	LDFLAGS_$@ syntax - one for each potential target.
+	$(targets) are assinged all potential targets, herby kbuild knows
+	the targets and will:
+		1) check for commandline changes
+		2) delete target during make clean
+
+	The ": %: %.o" part of the prerequisite is a shorthand that
+	free us from listing the setup.o and bootsect.o files.
+	Note: It is a common mistake to forget the "target :=" assignment,
+	      resulting in the target file being recompiled for no
+	      obvious reason.
+
 
 --- 6.7 Custom kbuild commands
 
@@ -894,6 +890,7 @@
 		      cmd_image = $(obj)/tools/build $(BUILDFLAGS) \
 		                                     $(obj)/vmlinux.bin > $@
 
+		targets += bzImage
 		$(obj)/bzImage: $(obj)/vmlinux.bin $(obj)/tools/build FORCE
 			$(call if_changed,image)
 			@echo 'Kernel: $@ is ready'
diff -urN linux-2.5.64-bk11/Documentation/kernel-parameters.txt linux-2.5.64-bk12/Documentation/kernel-parameters.txt
--- linux-2.5.64-bk11/Documentation/kernel-parameters.txt	Tue Mar  4 19:29:57 2003
+++ linux-2.5.64-bk12/Documentation/kernel-parameters.txt	Mon Mar 31 12:36:29 2003
@@ -71,6 +71,8 @@
 
 Parameters denoted with BOOT are actually interpreted by the boot
 loader, and have no meaning to the kernel directly.
+Do not modify the syntax of boot loader parameters without extreme
+need or coordination with <Documentation/i386/boot.txt>.
 
 Note that ALL kernel parameters listed below are CASE SENSITIVE, and that
 a trailing = on the name of any parameter states that that parameter will
@@ -502,30 +504,30 @@
 			Format: <first>,<last>
 			Specifies range of consoles to be captured by the MDA.
  
-	mem=exactmap	[KNL,BOOT,IA-32] Enable setting of an exact
-			E820 memory map, as specified by the user.
-			Such mem=exactmap lines can be constructed based on
-			BIOS output or other requirements. See the mem=nn@ss
-			option description.
-
 	mem=nn[KMG]	[KNL,BOOT] Force usage of a specific amount of memory
 			Amount of memory to be used when the kernel is not able
 			to see the whole system memory or for test.
 
-	mem=nn[KMG]@ss[KMG]
-			[KNL,BOOT] Force usage of a specific region of memory
-			Region of memory to be used, from ss to ss+nn.
+	mem=nopentium	[BUGS=IA-32] Disable usage of 4MB pages for kernel
+			memory.
 
-	mem=nn[KMG]#ss[KMG]
-			[KNL,BOOT,ACPI] Mark specific memory as ACPI data.
+	memmap=exactmap	[KNL,IA-32] Enable setting of an exact
+			E820 memory map, as specified by the user.
+			Such memmap=exactmap lines can be constructed based on
+			BIOS output or other requirements. See the memmap=nn@ss
+			option description.
+
+	memmap=nn[KMG]@ss[KMG]
+			[KNL] Force usage of a specific region of memory
 			Region of memory to be used, from ss to ss+nn.
 
-	mem=nn[KMG]$ss[KMG]
-			[KNL,BOOT,ACPI] Mark specific memory as reserved.
+	memmap=nn[KMG]#ss[KMG]
+			[KNL,ACPI] Mark specific memory as ACPI data.
 			Region of memory to be used, from ss to ss+nn.
 
-	mem=nopentium	[BUGS=IA-32] Disable usage of 4MB pages for kernel
-			memory.
+	memmap=nn[KMG]$ss[KMG]
+			[KNL,ACPI] Mark specific memory as reserved.
+			Region of memory to be used, from ss to ss+nn.
 
 	memfrac=	[KNL]
 
diff -urN linux-2.5.64-bk11/Makefile linux-2.5.64-bk12/Makefile
--- linux-2.5.64-bk11/Makefile	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/Makefile	Mon Mar 31 12:36:29 2003
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 5
 SUBLEVEL = 64
-EXTRAVERSION = -bk11
+EXTRAVERSION = -bk12
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
@@ -327,15 +327,16 @@
 #	set -e makes the rule exit immediately on error
 
 define rule_vmlinux__
-	set -e								\
+	set -e;								\
 	$(if $(filter .tmp_kallsyms%,$^),,				\
 	  echo '  GEN     .version';					\
 	  . $(srctree)/scripts/mkversion > .tmp_version;		\
 	  mv -f .tmp_version .version;					\
 	  $(MAKE) $(build)=init;					\
-	)
-	set -e								\
-	$(call cmd,vmlinux__);						\
+	)								\
+	$(if $($(quiet)cmd_vmlinux__),					\
+	  echo '  $($(quiet)cmd_vmlinux__)' &&) 			\
+	$(cmd_vmlinux__);						\
 	echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
 endef
 
@@ -478,17 +479,19 @@
 
 uts_len := 64
 
-include/linux/version.h: Makefile
-	@if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \
+define filechk_version.h
+	if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \
 	  echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
 	  exit 1; \
 	fi;
-	@echo -n '  GEN     $@'
-	@(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
+	(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
 	  echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
 	 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
-	) > $@.tmp
-	@$(update-if-changed)
+	)
+endef
+
+include/linux/version.h: Makefile
+	$(call filechk,version.h)
 
 # ---------------------------------------------------------------------------
 
@@ -557,7 +560,7 @@
 # Generate asm-offsets.h 
 # ---------------------------------------------------------------------------
 
-define generate-asm-offsets.h
+define filechk_gen-asm-offsets
 	(set -e; \
 	 echo "#ifndef __ASM_OFFSETS_H__"; \
 	 echo "#define __ASM_OFFSETS_H__"; \
@@ -573,7 +576,6 @@
 	 echo "#endif" )
 endef
 
-
 else # ifdef include_config
 
 ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
@@ -884,13 +886,27 @@
 
 cmd = @$(if $($(quiet)cmd_$(1)),echo '  $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
 
-define update-if-changed
-	if [ -r $@ ] && cmp -s $@ $@.tmp; then \
-		echo ' (unchanged)'; \
-		rm -f $@.tmp; \
-	else \
-		echo ' (updated)'; \
-		mv -f $@.tmp $@; \
+# filechk is used to check if the content of a generated file is updated.
+# Sample usage:
+# define filechk_sample
+#	echo $KERNELRELEASE
+# endef
+# version.h : Makefile
+#	$(call filechk,sample)
+# The rule defined shall write to stdout the content of the new file.
+# The existing file will be compared with the new one.
+# - If no file exist it is created
+# - If the content differ the new file is used
+# - If they are equal no change, and no timestamp update
+
+define filechk
+	@echo '  CHK     $@';
+	@set -e; $(filechk_$(1)) > $@.tmp
+	if [ -r $@ ] && cmp -s $@ $@.tmp; then	\
+		rm -f $@.tmp;			\
+	else					\
+		echo '  UPD     $@';		\
+		mv -f $@.tmp $@;		\
 	fi
 endef
 
diff -urN linux-2.5.64-bk11/arch/alpha/Makefile linux-2.5.64-bk12/arch/alpha/Makefile
--- linux-2.5.64-bk11/arch/alpha/Makefile	Tue Mar  4 19:29:24 2003
+++ linux-2.5.64-bk12/arch/alpha/Makefile	Mon Mar 31 12:36:29 2003
@@ -119,15 +119,12 @@
 				   include/config/MARKER
 
 include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
-	@echo -n '  Generating $@'
-	@$(generate-asm-offsets.h) < $< > $@.tmp
-	@$(update-if-changed)
+	$(call filechk,gen-asm-offsets)
 
 archclean:
 	$(Q)$(MAKE) -f scripts/Makefile.clean obj=$(boot)
 
-CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h.tmp \
-	       include/asm-$(ARCH)/asm_offsets.h
+CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h
 
 define archhelp
   echo '* boot		- Compressed kernel image (arch/alpha/boot/vmlinux.gz)'
diff -urN linux-2.5.64-bk11/arch/alpha/boot/Makefile linux-2.5.64-bk12/arch/alpha/boot/Makefile
--- linux-2.5.64-bk11/arch/alpha/boot/Makefile	Tue Mar  4 19:29:01 2003
+++ linux-2.5.64-bk12/arch/alpha/boot/Makefile	Mon Mar 31 12:36:29 2003
@@ -9,7 +9,7 @@
 #
 
 host-progs	:= tools/mkbb tools/objstrip
-EXTRA_TARGETS	:= vmlinux.gz vmlinux \
+targets		:= vmlinux.gz vmlinux \
 		   vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
 		   bootloader bootpheader 
 OBJSTRIP	:= $(obj)/tools/objstrip
diff -urN linux-2.5.64-bk11/arch/alpha/kernel/Makefile linux-2.5.64-bk12/arch/alpha/kernel/Makefile
--- linux-2.5.64-bk11/arch/alpha/kernel/Makefile	Tue Mar  4 19:29:17 2003
+++ linux-2.5.64-bk12/arch/alpha/kernel/Makefile	Mon Mar 31 12:36:29 2003
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-EXTRA_TARGETS	:= head.o
+extra-y		:= head.o
 EXTRA_AFLAGS	:= $(CFLAGS)
 EXTRA_CFLAGS	:= -Werror -Wno-sign-compare
 
diff -urN linux-2.5.64-bk11/arch/alpha/kernel/pci.c linux-2.5.64-bk12/arch/alpha/kernel/pci.c
--- linux-2.5.64-bk11/arch/alpha/kernel/pci.c	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/arch/alpha/kernel/pci.c	Mon Mar 31 12:36:30 2003
@@ -12,7 +12,7 @@
  * Nov 2000, Ivan Kokshaysky <ink@jurassic.park.msu.ru>
  *	     PCI-PCI bridges cleanup
  */
-
+#include <linux/config.h>
 #include <linux/string.h>
 #include <linux/pci.h>
 #include <linux/init.h>
@@ -264,45 +264,6 @@
 	}
 }
 
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *parent,
-			struct resource *res, int resource)
-{
-	struct pci_controller *hose = dev->sysdata;
-	struct resource *root;
-	int where;
-	u32 reg;
-
-	if (resource < PCI_ROM_RESOURCE) 
-		where = PCI_BASE_ADDRESS_0 + (resource * 4);
-	else if (resource == PCI_ROM_RESOURCE)
-		where = dev->rom_base_reg;
-	else {
-		return; /* Don't update non-standard resources here. */
-	}
-
-	/* Point root at the hose root. */
-	if (res->flags & IORESOURCE_IO)
-		root = hose->io_space;
-	else if (res->flags & IORESOURCE_MEM)
-		root = hose->mem_space;
-	else {
-		return; /* Don't update non-standard resources here. */
-	}
-
-	reg = (res->start - root->start) | (res->flags & 0xf);
-	pci_write_config_dword(dev, where, reg);
-	if ((res->flags & (PCI_BASE_ADDRESS_SPACE
-			   | PCI_BASE_ADDRESS_MEM_TYPE_MASK))
-	    == (PCI_BASE_ADDRESS_SPACE_MEMORY
-		| PCI_BASE_ADDRESS_MEM_TYPE_64)) {
-		pci_write_config_dword(dev, where+4, 0);
-		printk(KERN_WARNING "PCI: dev %s type 64-bit\n", dev->dev.name);
-	}
-
-	/* ??? FIXME -- record old value for shutdown.  */
-}
-
 void __init
 pcibios_update_irq(struct pci_dev *dev, int irq)
 {
@@ -334,21 +295,25 @@
 }
 
 void __devinit
-pcibios_fixup_pbus_ranges(struct pci_bus * bus,
-			  struct pbus_set_ranges_data * ranges)
+pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+			 struct resource *res)
 {
-	struct pci_controller *hose = (struct pci_controller *)bus->sysdata;
+	struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
+	unsigned long offset = 0;
 
-	ranges->io_start -= hose->io_space->start;
-	ranges->io_end -= hose->io_space->start;
-	ranges->mem_start -= hose->mem_space->start;
-	ranges->mem_end -= hose->mem_space->start;
-/* FIXME: On older alphas we could use dense memory space
-	  to access prefetchable resources. */
-	ranges->prefetch_start -= hose->mem_space->start;
-	ranges->prefetch_end -= hose->mem_space->start;
+	if (res->flags & IORESOURCE_IO)
+		offset = hose->io_space->start;
+	else if (res->flags & IORESOURCE_MEM)
+		offset = hose->mem_space->start;
+
+	region->start = res->start - offset;
+	region->end = res->end - offset;
 }
 
+#ifdef CONFIG_HOTPLUG
+EXPORT_SYMBOL(pcibios_resource_to_bus);
+#endif
+
 int
 pcibios_enable_device(struct pci_dev *dev, int mask)
 {
diff -urN linux-2.5.64-bk11/arch/arm/Makefile linux-2.5.64-bk12/arch/arm/Makefile
--- linux-2.5.64-bk11/arch/arm/Makefile	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/arch/arm/Makefile	Mon Mar 31 12:36:30 2003
@@ -211,9 +211,7 @@
 				   include/config/MARKER
 
 include/asm-$(ARCH)/constants.h: arch/$(ARCH)/kernel/asm-offsets.s
-	@echo -n '  Generating $@'
-	@$(generate-asm-offsets.h) < $< > $@.tmp
-	@$(update-if-changed)
+	$(call filechk,gen-asm-offsets)
 
 define archhelp
   echo  '* zImage        - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
diff -urN linux-2.5.64-bk11/arch/arm/boot/Makefile linux-2.5.64-bk12/arch/arm/boot/Makefile
--- linux-2.5.64-bk11/arch/arm/boot/Makefile	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-bk12/arch/arm/boot/Makefile	Mon Mar 31 12:36:30 2003
@@ -69,7 +69,7 @@
 
 export	ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS
 
-EXTRA_TARGETS := Image zImage bootpImage
+targets := Image zImage bootpImage
 
 $(obj)/Image: vmlinux FORCE
 	$(call if_changed,objcopy)
@@ -106,5 +106,4 @@
 	$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) \
 	$(obj)/zImage System.map "$(INSTALL_PATH)"
 
-clean-files := $(addprefix $(obj)/,Image zImage bootpImage)
 subdir-	    := bootp compressed
diff -urN linux-2.5.64-bk11/arch/arm/boot/bootp/Makefile linux-2.5.64-bk12/arch/arm/boot/bootp/Makefile
--- linux-2.5.64-bk11/arch/arm/boot/bootp/Makefile	Tue Mar  4 19:29:32 2003
+++ linux-2.5.64-bk12/arch/arm/boot/bootp/Makefile	Mon Mar 31 12:36:30 2003
@@ -7,7 +7,7 @@
 		 --defsym initrd_addr=$(INITRD_PHYS) \
 		 --defsym params=$(PARAMS_PHYS)
 
-EXTRA_TARGETS := bootp
+extra-y := bootp
 
 # Note that bootp.lds picks up kernel.o and initrd.o
 $(obj)/bootp:	$(addprefix $(obj)/,init.o kernel.o initrd.o bootp.lds)
diff -urN linux-2.5.64-bk11/arch/arm/boot/compressed/Makefile linux-2.5.64-bk12/arch/arm/boot/compressed/Makefile
--- linux-2.5.64-bk11/arch/arm/boot/compressed/Makefile	Tue Mar  4 19:28:59 2003
+++ linux-2.5.64-bk12/arch/arm/boot/compressed/Makefile	Mon Mar 31 12:36:30 2003
@@ -65,8 +65,8 @@
 
 SEDFLAGS	= s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;s/BSS_START/$(ZBSSADDR)/
 
-EXTRA_TARGETS := vmlinux vmlinux.lds piggy piggy.gz\
-                 piggy.o font.o head.o $(OBJS)
+targets       := vmlinux vmlinux.lds piggy piggy.gz piggy.o \
+                 font.o head.o $(OBJS)
 EXTRA_CFLAGS  := $(CFLAGS_BOOT) -fpic
 EXTRA_AFLAGS  := -traditional
 
@@ -95,7 +95,5 @@
 $(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in Makefile arch/arm/boot/Makefile .config
 	@sed "$(SEDFLAGS)" < $< > $@
 
-clean-files := $(addprefix $(obj)/,vmlinux piggy* vmlinux.lds)
-
 $(obj)/misc.o: $(obj)/misc.c include/asm/arch/uncompress.h lib/inflate.c
 
diff -urN linux-2.5.64-bk11/arch/arm/kernel/Makefile linux-2.5.64-bk12/arch/arm/kernel/Makefile
--- linux-2.5.64-bk11/arch/arm/kernel/Makefile	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/arch/arm/kernel/Makefile	Mon Mar 31 12:36:30 2003
@@ -11,9 +11,6 @@
 obj-y		:= arch.o compat.o dma.o $(ENTRY_OBJ) entry-common.o irq.o   \
 		   process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \
 		   time.o traps.o
-obj-m		:=
-obj-n		:=
-obj-		:=
 
 obj-$(CONFIG_APM)		+= apm.o
 obj-$(CONFIG_PM)		+= pm.o
@@ -35,7 +32,7 @@
 obj-$(CONFIG_DEBUG_LL)	+= debug.o
 endif
 
-EXTRA_TARGETS := $(head-y) init_task.o
+extra-y := $(head-y) init_task.o
 
 # Spell out some dependencies that `make dep' doesn't spot
 $(obj)/entry-armv.o: 	$(obj)/entry-header.S include/asm-arm/constants.h
diff -urN linux-2.5.64-bk11/arch/arm/kernel/bios32.c linux-2.5.64-bk12/arch/arm/kernel/bios32.c
--- linux-2.5.64-bk11/arch/arm/kernel/bios32.c	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/arch/arm/kernel/bios32.c	Mon Mar 31 12:36:30 2003
@@ -259,47 +259,6 @@
 	}, { 0 }
 };
 
-void __devinit
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			struct resource *res, int resource)
-{
-	struct pci_sys_data *sys = dev->sysdata;
-	u32 val, check;
-	int reg;
-
-	if (debug_pci)
-		printk("PCI: Assigning %3s %08lx to %s\n",
-			res->flags & IORESOURCE_IO ? "IO" : "MEM",
-			res->start, dev->dev.name);
-
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4*resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		reg = dev->rom_base_reg;
-	} else {
-		/* Somebody might have asked allocation of a
-		 * non-standard resource.
-		 */
-		return;
-	}
-
-	val = res->start;
-	if (res->flags & IORESOURCE_MEM)
-		val -= sys->mem_offset;
-	else
-		val -= sys->io_offset;
-	val |= res->flags & PCI_REGION_FLAG_MASK;
-
-	pci_write_config_dword(dev, reg, val);
-	pci_read_config_dword(dev, reg, &check);
-	if ((val ^ check) & ((val & PCI_BASE_ADDRESS_SPACE_IO) ?
-	    PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-			"%s/%d (%08x != %08x)\n", dev->slot_name,
-			resource, val, check);
-	}
-}
-
 void __devinit pcibios_update_irq(struct pci_dev *dev, int irq)
 {
 	if (debug_pci)
@@ -439,18 +398,26 @@
  * Convert from Linux-centric to bus-centric addresses for bridge devices.
  */
 void __devinit
-pcibios_fixup_pbus_ranges(struct pci_bus *bus, struct pbus_set_ranges_data *ranges)
+pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+			 struct resource *res)
 {
-	struct pci_sys_data *root = bus->sysdata;
+	struct pci_sys_data *root = dev->sysdata;
+	unsigned long offset = 0;
 
-	ranges->io_start -= root->io_offset;
-	ranges->io_end -= root->io_offset;
-	ranges->mem_start -= root->mem_offset;
-	ranges->mem_end -= root->mem_offset;
-	ranges->prefetch_start -= root->mem_offset;
-	ranges->prefetch_end -= root->mem_offset;
+	if (res->flags & IORESOURCE_IO)
+		offset = root->io_offset;
+	if (res->flags & IORESOURCE_MEM)
+		offset = root->mem_offset;
+
+	region->start = res->start - offset;
+	region->end   = res->end - offset;
 }
 
+#ifdef CONFIG_HOTPLUG
+EXPORT_SYMBOL(pcibios_fixup_bus);
+EXPORT_SYMBOL(pcibios_resource_to_bus);
+#endif
+
 /*
  * This is the standard PCI-PCI bridge swizzling algorithm:
  *
diff -urN linux-2.5.64-bk11/arch/arm/mach-arc/Makefile linux-2.5.64-bk12/arch/arm/mach-arc/Makefile
--- linux-2.5.64-bk11/arch/arm/mach-arc/Makefile	Tue Mar  4 19:29:02 2003
+++ linux-2.5.64-bk12/arch/arm/mach-arc/Makefile	Mon Mar 31 12:36:30 2003
@@ -6,12 +6,9 @@
 
 obj-y			:= arch.o dma.o fault.o irq.o mm.o oldlatches.o \
 			   small_page.o
-obj-m			:=
-obj-n			:=
-obj-			:=
 
 obj-$(CONFIG_DEBUG_LL)	+= debug.o
 
-EXTRA_TARGETS 		:= head.o
+extra-y 		:= head.o
 
 AFLAGS_head.o		:= -DTEXTADDR=$(TEXTADDR)
diff -urN linux-2.5.64-bk11/arch/cris/kernel/Makefile linux-2.5.64-bk12/arch/cris/kernel/Makefile
--- linux-2.5.64-bk11/arch/cris/kernel/Makefile	Tue Mar  4 19:29:23 2003
+++ linux-2.5.64-bk12/arch/cris/kernel/Makefile	Mon Mar 31 12:36:30 2003
@@ -3,7 +3,7 @@
 # Makefile for the linux kernel.
 #
 
-EXTRA_TARGETS	:= head.o
+extra-y	:= head.o
 
 obj-y   := process.o signal.o entry.o traps.o irq.o \
            ptrace.o setup.o time.o sys_cris.o shadows.o \
diff -urN linux-2.5.64-bk11/arch/i386/boot/Makefile linux-2.5.64-bk12/arch/i386/boot/Makefile
--- linux-2.5.64-bk11/arch/i386/boot/Makefile	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/arch/i386/boot/Makefile	Mon Mar 31 12:36:30 2003
@@ -25,9 +25,8 @@
 
 #RAMDISK := -DRAMDISK=512
 
-EXTRA_TARGETS	:= vmlinux.bin bootsect bootsect.o \
-		   setup setup.o zImage bzImage
-
+targets		:= vmlinux.bin bootsect bootsect.o setup setup.o \
+		   zImage bzImage
 subdir- 	:= compressed
 
 host-progs	:= tools/build
diff -urN linux-2.5.64-bk11/arch/i386/boot/compressed/Makefile linux-2.5.64-bk12/arch/i386/boot/compressed/Makefile
--- linux-2.5.64-bk11/arch/i386/boot/compressed/Makefile	Tue Mar  4 19:29:31 2003
+++ linux-2.5.64-bk12/arch/i386/boot/compressed/Makefile	Mon Mar 31 12:36:30 2003
@@ -4,7 +4,7 @@
 # create a compressed vmlinux image from the original vmlinux
 #
 
-EXTRA_TARGETS	:= vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
+targets		:= vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
 EXTRA_AFLAGS	:= -traditional
 
 LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
diff -urN linux-2.5.64-bk11/arch/i386/kernel/Makefile linux-2.5.64-bk12/arch/i386/kernel/Makefile
--- linux-2.5.64-bk11/arch/i386/kernel/Makefile	Tue Mar  4 19:29:01 2003
+++ linux-2.5.64-bk12/arch/i386/kernel/Makefile	Mon Mar 31 12:36:30 2003
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-EXTRA_TARGETS := head.o init_task.o
+extra-y := head.o init_task.o
 
 obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
 		ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \
diff -urN linux-2.5.64-bk11/arch/i386/kernel/setup.c linux-2.5.64-bk12/arch/i386/kernel/setup.c
--- linux-2.5.64-bk11/arch/i386/kernel/setup.c	Tue Mar  4 19:29:18 2003
+++ linux-2.5.64-bk12/arch/i386/kernel/setup.c	Mon Mar 31 12:36:31 2003
@@ -525,8 +525,11 @@
 		 * "mem=nopentium" disables the 4MB page tables.
 		 * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
 		 * to <mem>, overriding the bios size.
-		 * "mem=XXX[KkmM]@XXX[KkmM]" defines a memory region from
+		 * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
 		 * <start> to <start>+<mem>, overriding the bios size.
+		 *
+		 * HPA tells me bootloaders need to parse mem=, so no new
+		 * option should be mem=  [also see Documentation/i386/boot.txt]
 		 */
 		if (c == ' ' && !memcmp(from, "mem=", 4)) {
 			if (to != command_line)
@@ -535,8 +538,26 @@
 				from += 9+4;
 				clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
 				disable_pse = 1;
-			} else if (!memcmp(from+4, "exactmap", 8)) {
-				from += 8+4;
+			} else {
+				/* If the user specifies memory size, we
+				 * limit the BIOS-provided memory map to
+				 * that size. exactmap can be used to specify
+				 * the exact map. mem=number can be used to
+				 * trim the existing memory map.
+				 */
+				unsigned long long mem_size;
+ 
+				mem_size = memparse(from+4, &from);
+				limit_regions(mem_size);
+				userdef=1;
+			}
+		}
+
+		if (c == ' ' && !memcmp(from, "memmap=", 7)) {
+			if (to != command_line)
+				to--;
+			if (!memcmp(from+7, "exactmap", 8)) {
+				from += 8+7;
 				e820.nr_map = 0;
 				userdef = 1;
 			} else {
@@ -548,7 +569,7 @@
 				 */
 				unsigned long long start_at, mem_size;
  
-				mem_size = memparse(from+4, &from);
+				mem_size = memparse(from+7, &from);
 				if (*from == '@') {
 					start_at = memparse(from+1, &from);
 					add_memory_region(start_at, mem_size, E820_RAM);
diff -urN linux-2.5.64-bk11/arch/i386/pci/common.c linux-2.5.64-bk12/arch/i386/pci/common.c
--- linux-2.5.64-bk11/arch/i386/pci/common.c	Tue Mar  4 19:29:17 2003
+++ linux-2.5.64-bk12/arch/i386/pci/common.c	Mon Mar 31 12:36:31 2003
@@ -90,11 +90,6 @@
 	}
 }
 
-void __devinit
-pcibios_fixup_pbus_ranges (struct pci_bus *bus, struct pbus_set_ranges_data *ranges)
-{
-}
-
 /*
  *  Called after each bus is probed, but before its children
  *  are examined.
diff -urN linux-2.5.64-bk11/arch/i386/pci/i386.c linux-2.5.64-bk12/arch/i386/pci/i386.c
--- linux-2.5.64-bk11/arch/i386/pci/i386.c	Tue Mar  4 19:29:03 2003
+++ linux-2.5.64-bk12/arch/i386/pci/i386.c	Mon Mar 31 12:36:31 2003
@@ -33,34 +33,6 @@
 
 #include "pci.h"
 
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			struct resource *res, int resource)
-{
-	u32 new, check;
-	int reg;
-
-	new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4*resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		res->flags |= PCI_ROM_ADDRESS_ENABLE;
-		new |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else {
-		/* Somebody might have asked allocation of a non-standard resource */
-		return;
-	}
-	
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-		       new, check);
-	}
-}
-
 /*
  * We need to avoid collisions with `mirrored' VGA ports
  * and other strange ISA hardware, so we always want the
diff -urN linux-2.5.64-bk11/arch/ia64/boot/Makefile linux-2.5.64-bk12/arch/ia64/boot/Makefile
--- linux-2.5.64-bk11/arch/ia64/boot/Makefile	Tue Mar  4 19:29:23 2003
+++ linux-2.5.64-bk12/arch/ia64/boot/Makefile	Mon Mar 31 12:36:31 2003
@@ -8,16 +8,14 @@
 # Copyright (C) 1998 by David Mosberger-Tang <davidm@hpl.hp.com>
 #
 
-EXTRA_TARGETS := vmlinux.bin vmlinux.gz
-
 targets-$(CONFIG_IA64_HP_SIM)  += bootloader
 targets-$(CONFIG_IA64_GENERIC) += bootloader
-EXTRA_TARGETS += $(sort $(targets-y))
+targets := vmlinux.bin vmlinux.gz $(targets-y)
 
 quiet_cmd_cptotop = LN      $@
       cmd_cptotop = ln -f $< $@
 
-vmlinux.gz: $(obj)/vmlinux.gz $(targets-y)
+vmlinux.gz: $(obj)/vmlinux.gz $(addprefix $(obj)/,$(targets-y))
 	$(call cmd,cptotop)
 	@echo '  Kernel: $@ is ready'
 
diff -urN linux-2.5.64-bk11/arch/ia64/kernel/Makefile linux-2.5.64-bk12/arch/ia64/kernel/Makefile
--- linux-2.5.64-bk11/arch/ia64/kernel/Makefile	Tue Mar  4 19:29:54 2003
+++ linux-2.5.64-bk12/arch/ia64/kernel/Makefile	Mon Mar 31 12:36:31 2003
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-EXTRA_TARGETS	:= head.o init_task.o
+extra-y	:= head.o init_task.o
 
 obj-y := acpi.o entry.o gate.o efi.o efi_stub.o ia64_ksyms.o \
 	 irq.o irq_ia64.o irq_lsapic.o ivt.o \
diff -urN linux-2.5.64-bk11/arch/ia64/pci/pci.c linux-2.5.64-bk12/arch/ia64/pci/pci.c
--- linux-2.5.64-bk11/arch/ia64/pci/pci.c	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/arch/ia64/pci/pci.c	Mon Mar 31 12:36:31 2003
@@ -143,21 +143,7 @@
 	return;
 }
 
-void __devinit
-pcibios_update_resource (struct pci_dev *dev, struct resource *root,
-			 struct resource *res, int resource)
-{
-	unsigned long where, size;
-	u32 reg;
-
-	where = PCI_BASE_ADDRESS_0 + (resource * 4);
-	size = res->end - res->start;
-	pci_read_config_dword(dev, where, &reg);
-	reg = (reg & size) | (((u32)(res->start - root->start)) & ~size);
-	pci_write_config_dword(dev, where, reg);
-
-	/* ??? FIXME -- record old value for shutdown.  */
-}
+#warning pcibios_update_resource() is now a generic implementation - please check
 
 void __devinit
 pcibios_update_irq (struct pci_dev *dev, int irq)
@@ -167,11 +153,6 @@
 	/* ??? FIXME -- record old value for shutdown.  */
 }
 
-void __devinit
-pcibios_fixup_pbus_ranges (struct pci_bus * bus, struct pbus_set_ranges_data * ranges)
-{
-}
-
 static inline int
 pcibios_enable_resources (struct pci_dev *dev, int mask)
 {
diff -urN linux-2.5.64-bk11/arch/m68k/kernel/Makefile linux-2.5.64-bk12/arch/m68k/kernel/Makefile
--- linux-2.5.64-bk11/arch/m68k/kernel/Makefile	Tue Mar  4 19:29:32 2003
+++ linux-2.5.64-bk12/arch/m68k/kernel/Makefile	Mon Mar 31 12:36:31 2003
@@ -3,9 +3,9 @@
 #
 
 ifndef CONFIG_SUN3
-  EXTRA_TARGETS := head.o
+  extra-y := head.o
 else
-  EXTRA_TARGETS := sun3-head.o
+  extra-y := sun3-head.o
 endif 
 
 obj-y		:= entry.o process.o traps.o ints.o signal.o ptrace.o \
diff -urN linux-2.5.64-bk11/arch/m68knommu/Makefile linux-2.5.64-bk12/arch/m68knommu/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/Makefile	Tue Mar  4 19:29:31 2003
+++ linux-2.5.64-bk12/arch/m68knommu/Makefile	Mon Mar 31 12:36:31 2003
@@ -86,8 +86,7 @@
 
 head-y := arch/m68knommu/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o
 
-CLEAN_FILES := include/asm-$(ARCH)/asm-offsets.h.tmp \
-	       include/asm-$(ARCH)/asm-offsets.h \
+CLEAN_FILES := include/asm-$(ARCH)/asm-offsets.h \
 	       arch/$(ARCH)/kernel/asm-offsets.s
 
 core-y	+= arch/m68knommu/kernel/ \
@@ -104,6 +103,4 @@
 include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \
 				   include/asm include/linux/version.h \
 				   include/config/MARKER
-	@echo -n '  Generating $@'
-	@$(generate-asm-offsets.h) < $< > $@.tmp
-	@$(update-if-changed)
+	$(call filechk,gen-asm-offsets)
diff -urN linux-2.5.64-bk11/arch/m68knommu/kernel/comempci.c linux-2.5.64-bk12/arch/m68knommu/kernel/comempci.c
--- linux-2.5.64-bk11/arch/m68knommu/kernel/comempci.c	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/arch/m68knommu/kernel/comempci.c	Mon Mar 31 12:36:31 2003
@@ -60,8 +60,8 @@
  *	really assign any resources we like to devices, as long as
  *	they do not clash with other PCI devices.
  */
-unsigned int	pci_iobase = PCIBIOS_MIN_IO;	/* Arbitary start address */
-unsigned int	pci_membase = PCIBIOS_MIN_MEM;	/* Arbitary start address */
+unsigned int	pci_iobase = PCIBIOS_MIN_IO;	/* Arbitrary start address */
+unsigned int	pci_membase = PCIBIOS_MIN_MEM;	/* Arbitrary start address */
 
 #define	PCI_MINIO	0x100			/* 256 byte minimum I/O */
 #define	PCI_MINMEM	0x00010000		/* 64k minimum chunk */
diff -urN linux-2.5.64-bk11/arch/m68knommu/kernel/signal.c linux-2.5.64-bk12/arch/m68knommu/kernel/signal.c
--- linux-2.5.64-bk11/arch/m68knommu/kernel/signal.c	Tue Mar  4 19:29:29 2003
+++ linux-2.5.64-bk12/arch/m68knommu/kernel/signal.c	Mon Mar 31 12:36:31 2003
@@ -16,7 +16,7 @@
  * 1997-12-01  Modified for POSIX.1b signals by Andreas Schwab
  *
  * mathemu support by Roman Zippel
- *  (Note: fpstate in the signal context is completly ignored for the emulator
+ *  (Note: fpstate in the signal context is completely ignored for the emulator
  *         and the internal floating point format is put on stack)
  */
 
diff -urN linux-2.5.64-bk11/arch/m68knommu/platform/5206/Makefile linux-2.5.64-bk12/arch/m68knommu/platform/5206/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/platform/5206/Makefile	Tue Mar  4 19:29:36 2003
+++ linux-2.5.64-bk12/arch/m68knommu/platform/5206/Makefile	Mon Mar 31 12:36:31 2003
@@ -18,4 +18,4 @@
 
 obj-y := config.o
 
-EXTRA_TARGETS := $(BOARD)/crt0_$(MODEL).o
+extra-y := $(BOARD)/crt0_$(MODEL).o
diff -urN linux-2.5.64-bk11/arch/m68knommu/platform/5206e/Makefile linux-2.5.64-bk12/arch/m68knommu/platform/5206e/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/platform/5206e/Makefile	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/arch/m68knommu/platform/5206e/Makefile	Mon Mar 31 12:36:31 2003
@@ -18,4 +18,4 @@
 
 obj-y := config.o
 
-EXTRA_TARGETS := $(BOARD)/crt0_$(MODEL).o
+extra-y := $(BOARD)/crt0_$(MODEL).o
diff -urN linux-2.5.64-bk11/arch/m68knommu/platform/5249/Makefile linux-2.5.64-bk12/arch/m68knommu/platform/5249/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/platform/5249/Makefile	Tue Mar  4 19:29:55 2003
+++ linux-2.5.64-bk12/arch/m68knommu/platform/5249/Makefile	Mon Mar 31 12:36:31 2003
@@ -18,4 +18,4 @@
 
 obj-y := config.o
 
-EXTRA_TARGETS := $(BOARD)/crt0_$(MODEL).o
+extra-y := $(BOARD)/crt0_$(MODEL).o
diff -urN linux-2.5.64-bk11/arch/m68knommu/platform/5272/Makefile linux-2.5.64-bk12/arch/m68knommu/platform/5272/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/platform/5272/Makefile	Tue Mar  4 19:29:03 2003
+++ linux-2.5.64-bk12/arch/m68knommu/platform/5272/Makefile	Mon Mar 31 12:36:31 2003
@@ -18,4 +18,4 @@
 
 obj-y := config.o
 
-EXTRA_TARGETS := $(BOARD)/crt0_$(MODEL).o
+extra-y := $(BOARD)/crt0_$(MODEL).o
diff -urN linux-2.5.64-bk11/arch/m68knommu/platform/5307/Makefile linux-2.5.64-bk12/arch/m68knommu/platform/5307/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/platform/5307/Makefile	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/arch/m68knommu/platform/5307/Makefile	Mon Mar 31 12:36:31 2003
@@ -20,5 +20,5 @@
 obj-$(CONFIG_M5307)	+= config.o
 
 ifeq ($(CONFIG_M5307),y)
-EXTRA_TARGETS := $(BOARD)/crt0_$(MODEL).o
+extra-y := $(BOARD)/crt0_$(MODEL).o
 endif
diff -urN linux-2.5.64-bk11/arch/m68knommu/platform/5407/Makefile linux-2.5.64-bk12/arch/m68knommu/platform/5407/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/platform/5407/Makefile	Tue Mar  4 19:28:53 2003
+++ linux-2.5.64-bk12/arch/m68knommu/platform/5407/Makefile	Mon Mar 31 12:36:31 2003
@@ -18,4 +18,4 @@
 
 obj-y := config.o
 
-EXTRA_TARGETS := $(BOARD)/crt0_$(MODEL).o
+extra-y := $(BOARD)/crt0_$(MODEL).o
diff -urN linux-2.5.64-bk11/arch/m68knommu/platform/68328/Makefile linux-2.5.64-bk12/arch/m68knommu/platform/68328/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/platform/68328/Makefile	Tue Mar  4 19:29:15 2003
+++ linux-2.5.64-bk12/arch/m68knommu/platform/68328/Makefile	Mon Mar 31 12:36:32 2003
@@ -7,7 +7,7 @@
 obj-$(CONFIG_M68VZ328)	+= entry.o ints.o
 
 ifeq ($(CONFIG_M68328),y)
-EXTRA_TARGETS := $(BOARD)/bootlogo.rh $(BOARD)/crt0_$(MODEL).o
+extra-y := $(BOARD)/bootlogo.rh $(BOARD)/crt0_$(MODEL).o
 endif
 
 $(obj)/$(BOARD)/bootlogo.rh: $(src)/bootlogo.h
diff -urN linux-2.5.64-bk11/arch/m68knommu/platform/68360/Makefile linux-2.5.64-bk12/arch/m68knommu/platform/68360/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/platform/68360/Makefile	Tue Mar  4 19:29:18 2003
+++ linux-2.5.64-bk12/arch/m68knommu/platform/68360/Makefile	Mon Mar 31 12:36:32 2003
@@ -4,4 +4,4 @@
 
 obj-y := config.o commproc.o entry.o ints.o
 
-EXTRA_TARGETS := $(BOARD)/crt0_$(MODEL).o
+extra-y := $(BOARD)/crt0_$(MODEL).o
diff -urN linux-2.5.64-bk11/arch/m68knommu/platform/68EZ328/Makefile linux-2.5.64-bk12/arch/m68knommu/platform/68EZ328/Makefile
--- linux-2.5.64-bk11/arch/m68knommu/platform/68EZ328/Makefile	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-bk12/arch/m68knommu/platform/68EZ328/Makefile	Mon Mar 31 12:36:32 2003
@@ -4,7 +4,7 @@
 
 obj-y := config.o
 
-EXTRA_TARGETS := $(BOARD)/bootlogo.rh $(BOARD)/crt0_$(MODEL).o
+extra-y := $(BOARD)/bootlogo.rh $(BOARD)/crt0_$(MODEL).o
 
 $(obj)/$(BOARD)/bootlogo.rh: $(src)/bootlogo.h
 	perl $(src)/../68328/bootlogo.pl < $(src)/bootlogo.h \
diff -urN linux-2.5.64-bk11/arch/m68knommu/vmlinux.lds.S linux-2.5.64-bk12/arch/m68knommu/vmlinux.lds.S
--- linux-2.5.64-bk11/arch/m68knommu/vmlinux.lds.S	Tue Mar  4 19:29:17 2003
+++ linux-2.5.64-bk12/arch/m68knommu/vmlinux.lds.S	Mon Mar 31 12:36:32 2003
@@ -126,7 +126,7 @@
 
 /*
  *	The standard Arnewsh 5206 board only has 1MiB of ram. Not normally
- *	enough to be usefull. Assume the user has fitted something larger,
+ *	enough to be useful. Assume the user has fitted something larger,
  *	at least 4MiB in size. No point in not letting the kernel completely
  *	link, it will be obvious if it is too big when they go to load it.
  */
@@ -300,6 +300,9 @@
 		*(.initcall6.init)
 		*(.initcall7.init)
 		__initcall_end = .;
+		__con_initcall_start = .;
+		*(.con_initcall.init)
+		__con_initcall_end = .;
 		. = ALIGN(4);
 		__initramfs_start = .;
 		*(.init.ramfs)
diff -urN linux-2.5.64-bk11/arch/mips/ddb5074/pci.c linux-2.5.64-bk12/arch/mips/ddb5074/pci.c
--- linux-2.5.64-bk11/arch/mips/ddb5074/pci.c	Tue Mar  4 19:29:18 2003
+++ linux-2.5.64-bk12/arch/mips/ddb5074/pci.c	Mon Mar 31 12:36:32 2003
@@ -297,11 +297,6 @@
 	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
 }
 
-void __devinit pcibios_fixup_pbus_ranges(struct pci_bus *bus,
-					 struct pbus_set_ranges_data *ranges)
-{
-}
-
 int pcibios_enable_resources(struct pci_dev *dev)
 {
 	u16 cmd, old_cmd;
@@ -341,37 +336,6 @@
 	return pcibios_enable_resources(dev);
 }
 
-void pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			     struct resource *res, int resource)
-{
-	u32 new, check;
-	int reg;
-
-	new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4 * resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		res->flags |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else {
-		/*
-		 * Somebody might have asked allocation of a non-standard
-		 * resource
-		 */
-		return;
-	}
-
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) &
-	    ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK :
-	     PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-		       new, check);
-	}
-}
-
 void pcibios_align_resource(void *data, struct resource *res,
 			    unsigned long size, unsigned long align)
 {
diff -urN linux-2.5.64-bk11/arch/mips/ddb5476/pci.c linux-2.5.64-bk12/arch/mips/ddb5476/pci.c
--- linux-2.5.64-bk11/arch/mips/ddb5476/pci.c	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/arch/mips/ddb5476/pci.c	Mon Mar 31 12:36:32 2003
@@ -341,8 +341,10 @@
 	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
 }
 
-void __devinit pcibios_fixup_pbus_ranges(struct pci_bus *bus,
-					 struct pbus_set_ranges_data *ranges)
+#if 0	/*  original DDB5074 code */
+void __devinit
+pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+			 struct resource *res)
 {
 	/*
 	 * our caller figure out range by going through the dev structures.  
@@ -350,15 +352,14 @@
 	 * different view of the addressing space.
 	 */
 
-#if 0	/*  original DDB5074 code */
 	   if (bus->number == 0) {
 	   ranges->io_start -= bus->resource[0]->start;
 	   ranges->io_end -= bus->resource[0]->start;
 	   ranges->mem_start -= bus->resource[1]->start;
 	   ranges->mem_end -= bus->resource[1]->start;
 	   }
-#endif
 }
+#endif
 
 int pcibios_enable_resources(struct pci_dev *dev)
 {
@@ -399,37 +400,6 @@
 	return pcibios_enable_resources(dev);
 }
 
-void pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			     struct resource *res, int resource)
-{
-	u32 new, check;
-	int reg;
-
-	new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4 * resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		res->flags |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else {
-		/*
-		 * Somebody might have asked allocation of a non-standard
-		 * resource
-		 */
-		return;
-	}
-
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) &
-	    ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK :
-	     PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-		       new, check);
-	}
-}
-
 void pcibios_align_resource(void *data, struct resource *res,
 			    unsigned long size, unsigned long align)
 {
diff -urN linux-2.5.64-bk11/arch/mips/ddb5xxx/common/pci.c linux-2.5.64-bk12/arch/mips/ddb5xxx/common/pci.c
--- linux-2.5.64-bk11/arch/mips/ddb5xxx/common/pci.c	Tue Mar  4 19:29:54 2003
+++ linux-2.5.64-bk12/arch/mips/ddb5xxx/common/pci.c	Mon Mar 31 12:36:32 2003
@@ -170,11 +170,3 @@
 	/* this should not be called */
 	MIPS_ASSERT(1 == 0);
 }
-
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-                             struct resource *res, int resource)
-{
-	/* this should not be called */
-	MIPS_ASSERT(1 == 0);
-}
diff -urN linux-2.5.64-bk11/arch/mips/gt64120/common/pci.c linux-2.5.64-bk12/arch/mips/gt64120/common/pci.c
--- linux-2.5.64-bk11/arch/mips/gt64120/common/pci.c	Tue Mar  4 19:29:18 2003
+++ linux-2.5.64-bk12/arch/mips/gt64120/common/pci.c	Mon Mar 31 12:36:32 2003
@@ -785,39 +785,6 @@
 	return pcibios_enable_resources(dev);
 }
 
-void pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			     struct resource *res, int resource)
-{
-	u32 new, check;
-	int reg;
-
-	return;
-
-	new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4 * resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		res->flags |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else {
-		/*
-		 * Somebody might have asked allocation of a non-standard
-		 * resource
-		 */
-		return;
-	}
-
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) &
-	    ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK :
-	     PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-		       new, check);
-	}
-}
-
 void pcibios_align_resource(void *data, struct resource *res,
 			    unsigned long size, unsigned long align)
 {
diff -urN linux-2.5.64-bk11/arch/mips/ite-boards/generic/it8172_pci.c linux-2.5.64-bk12/arch/mips/ite-boards/generic/it8172_pci.c
--- linux-2.5.64-bk11/arch/mips/ite-boards/generic/it8172_pci.c	Tue Mar  4 19:29:31 2003
+++ linux-2.5.64-bk12/arch/mips/ite-boards/generic/it8172_pci.c	Mon Mar 31 12:36:32 2003
@@ -196,19 +196,7 @@
 	return str;
 }
 
-void __init
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-                        struct resource *res, int resource)
-{
-	unsigned long where, size;
-	u32 reg;
-
-	where = PCI_BASE_ADDRESS_0 + (resource * 4);
-	size = res->end - res->start;
-	pci_read_config_dword(dev, where, &reg);
-	reg = (reg & size) | (((u32)(res->start - root->start)) & ~size);
-	pci_write_config_dword(dev, where, reg);
-}
+#warning pcibios_update_resource() is now a generic implementation - please check
 
 void __init pcibios_fixup_bus(struct pci_bus *b)
 {
diff -urN linux-2.5.64-bk11/arch/mips/kernel/Makefile linux-2.5.64-bk12/arch/mips/kernel/Makefile
--- linux-2.5.64-bk11/arch/mips/kernel/Makefile	Tue Mar  4 19:29:17 2003
+++ linux-2.5.64-bk12/arch/mips/kernel/Makefile	Mon Mar 31 12:36:32 2003
@@ -4,7 +4,7 @@
 
 # EXTRA_AFLAGS = -mips3 -mcpu=r4000 # not used?
 
-EXTRA_TARGETS	:= head.o init_task.o
+extra-y				:= head.o init_task.o
 obj-y				+= branch.o process.o signal.o entry.o \
 				   traps.o ptrace.o vm86.o ioport.o reset.o \
 				   semaphore.o setup.o syscall.o sysmips.o \
diff -urN linux-2.5.64-bk11/arch/mips/kernel/pci.c linux-2.5.64-bk12/arch/mips/kernel/pci.c
--- linux-2.5.64-bk11/arch/mips/kernel/pci.c	Tue Mar  4 19:29:31 2003
+++ linux-2.5.64-bk12/arch/mips/kernel/pci.c	Mon Mar 31 12:36:32 2003
@@ -166,10 +166,3 @@
 {
 	/* this should not be called */
 }
-
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			struct resource *res, int resource)
-{
-	/* this should not be called */
-}
diff -urN linux-2.5.64-bk11/arch/mips/mips-boards/generic/pci.c linux-2.5.64-bk12/arch/mips/mips-boards/generic/pci.c
--- linux-2.5.64-bk11/arch/mips/mips-boards/generic/pci.c	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/arch/mips/mips-boards/generic/pci.c	Mon Mar 31 12:36:32 2003
@@ -248,19 +248,7 @@
 	{ 0 }
 };
 
-void __init
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-                        struct resource *res, int resource)
-{
-	unsigned long where, size;
-	u32 reg;
-
-	where = PCI_BASE_ADDRESS_0 + (resource * 4);
-	size = res->end - res->start;
-	pci_read_config_dword(dev, where, &reg);
-	reg = (reg & size) | (((u32)(res->start - root->start)) & ~size);
-	pci_write_config_dword(dev, where, reg);
-}
+#warning pcibios_update_resource() is now a generic implementation - please check
 
 /*
  *  Called after each bus is probed, but before its children
diff -urN linux-2.5.64-bk11/arch/mips/sni/pci.c linux-2.5.64-bk12/arch/mips/sni/pci.c
--- linux-2.5.64-bk11/arch/mips/sni/pci.c	Tue Mar  4 19:29:58 2003
+++ linux-2.5.64-bk12/arch/mips/sni/pci.c	Mon Mar 31 12:36:32 2003
@@ -137,34 +137,6 @@
 {
 }
 
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			struct resource *res, int resource)
-{
-	u32 new, check;
-	int reg;
-
-	new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4*resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		res->flags |= PCI_ROM_ADDRESS_ENABLE;
-		new |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else {
-		/* Somebody might have asked allocation of a non-standard resource */
-		return;
-	}
-	
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-		       new, check);
-	}
-}
-
 void __init pcibios_init(void)
 {
 	struct pci_ops *ops = &sni_pci_ops;
diff -urN linux-2.5.64-bk11/arch/mips64/kernel/Makefile linux-2.5.64-bk12/arch/mips64/kernel/Makefile
--- linux-2.5.64-bk11/arch/mips64/kernel/Makefile	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/arch/mips64/kernel/Makefile	Mon Mar 31 12:36:32 2003
@@ -2,7 +2,7 @@
 # Makefile for the Linux/MIPS kernel.
 #
 
-EXTRA_TARGETS	:= head.o init_task.o
+extra-y	:= head.o init_task.o
 
 obj-y	:= branch.o entry.o proc.o process.o ptrace.o r4k_cache.o r4k_fpu.o \
 	   r4k_genex.o r4k_switch.o r4k_tlb.o r4k_tlb_debug.o r4k_tlb_glue.o \
diff -urN linux-2.5.64-bk11/arch/mips64/mips-boards/generic/pci.c linux-2.5.64-bk12/arch/mips64/mips-boards/generic/pci.c
--- linux-2.5.64-bk11/arch/mips64/mips-boards/generic/pci.c	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-bk12/arch/mips64/mips-boards/generic/pci.c	Mon Mar 31 12:36:32 2003
@@ -307,19 +307,7 @@
 	{ 0 }
 };
 
-void __init
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-                        struct resource *res, int resource)
-{
-	unsigned long where, size;
-	u32 reg;
-
-	where = PCI_BASE_ADDRESS_0 + (resource * 4);
-	size = res->end - res->start;
-	pci_read_config_dword(dev, where, &reg);
-	reg = (reg & size) | (((u32)(res->start - root->start)) & ~size);
-	pci_write_config_dword(dev, where, reg);
-}
+#warning pcibios_update_resource() is now a generic implementation - please check
 
 unsigned __init int pcibios_assign_all_busses(void)
 {
diff -urN linux-2.5.64-bk11/arch/mips64/sgi-ip27/ip27-pci.c linux-2.5.64-bk12/arch/mips64/sgi-ip27/ip27-pci.c
--- linux-2.5.64-bk11/arch/mips64/sgi-ip27/ip27-pci.c	Tue Mar  4 19:29:32 2003
+++ linux-2.5.64-bk12/arch/mips64/sgi-ip27/ip27-pci.c	Mon Mar 31 12:36:32 2003
@@ -214,19 +214,7 @@
 	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
 }
 
-void __init
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-                        struct resource *res, int resource)
-{
-	unsigned long where, size;
-	u32 reg;
-
-	where = PCI_BASE_ADDRESS_0 + (resource * 4);
-	size = res->end - res->start;
-	pci_read_config_dword(dev, where, &reg);
-	reg = (reg & size) | (((u32)(res->start - root->start)) & ~size);
-	pci_write_config_dword(dev, where, reg);
-}
+#warning pcibios_update_resource() is now a generic implementation - please check
 
 void __init
 pcibios_fixup_bus(struct pci_bus *b)
@@ -234,12 +222,6 @@
 	pci_fixup_irqs(pci_swizzle, pci_map_irq);
 }
 
-void __devinit
-pcibios_fixup_pbus_ranges(struct pci_bus * bus,
-                          struct pbus_set_ranges_data * ranges)
-{
-}
-
 int __init
 pcibios_enable_device(struct pci_dev *dev)
 {
diff -urN linux-2.5.64-bk11/arch/mips64/sgi-ip32/Makefile linux-2.5.64-bk12/arch/mips64/sgi-ip32/Makefile
--- linux-2.5.64-bk11/arch/mips64/sgi-ip32/Makefile	Tue Mar  4 19:29:22 2003
+++ linux-2.5.64-bk12/arch/mips64/sgi-ip32/Makefile	Mon Mar 31 12:36:32 2003
@@ -3,7 +3,7 @@
 # under Linux.
 #
 
-EXTRA_TARGETS	:= ip32-irq-glue.o
+extra-y		:= ip32-irq-glue.o
 
 obj-y		+= ip32-irq.o ip32-rtc.o ip32-setup.o ip32-irq-glue.o \
 	 	   ip32-berr.o ip32-timer.o crime.o
diff -urN linux-2.5.64-bk11/arch/mips64/sgi-ip32/ip32-pci.c linux-2.5.64-bk12/arch/mips64/sgi-ip32/ip32-pci.c
--- linux-2.5.64-bk11/arch/mips64/sgi-ip32/ip32-pci.c	Tue Mar  4 19:29:55 2003
+++ linux-2.5.64-bk12/arch/mips64/sgi-ip32/ip32-pci.c	Mon Mar 31 12:36:32 2003
@@ -333,11 +333,6 @@
 {
 }
 
-void __init pcibios_update_resource (struct pci_dev *dev, struct resource *root,
-				     struct resource *res, int resource)
-{
-}
-
 void __init pcibios_update_irq (struct pci_dev *dev, int irq)
 {
 	pci_write_config_byte (dev, PCI_INTERRUPT_LINE, irq);
@@ -348,12 +343,6 @@
 	pci_fixup_irqs (macepci_swizzle, macepci_map_irq);
 }
 
-/* XXX anybody know what this is supposed to do? */
-void __devinit pcibios_fixup_pbus_ranges(struct pci_bus * bus,
-					 struct pbus_set_ranges_data * ranges)
-{
-}
-
 /*
  * Handle errors from the bridge.  This includes master and target aborts,
  * various command and address errors, and the interrupt test.  This gets
diff -urN linux-2.5.64-bk11/arch/parisc/Makefile linux-2.5.64-bk12/arch/parisc/Makefile
--- linux-2.5.64-bk11/arch/parisc/Makefile	Tue Mar  4 19:29:35 2003
+++ linux-2.5.64-bk12/arch/parisc/Makefile	Mon Mar 31 12:36:32 2003
@@ -91,12 +91,9 @@
 				   include/config/MARKER
 
 include/asm-parisc/offsets.h: arch/parisc/kernel/asm-offsets.s
-	@echo -n '  Generating $@'
-	@$(generate-asm-offsets.h) < $< > $@.tmp
-	@$(update-if-changed)
+	$(call filechk,gen-asm-offsets)
 
-CLEAN_FILES	+= palo.conf lifimage include/asm-parisc/offsets.h \
-		include/asm-parisc/offsets.h.tmp
+CLEAN_FILES	+= palo.conf lifimage include/asm-parisc/offsets.h
 
 define archhelp
 	@echo  '* vmlinux	- Uncompressed kernel image (./vmlinux)'
diff -urN linux-2.5.64-bk11/arch/parisc/kernel/Makefile linux-2.5.64-bk12/arch/parisc/kernel/Makefile
--- linux-2.5.64-bk11/arch/parisc/kernel/Makefile	Tue Mar  4 19:29:05 2003
+++ linux-2.5.64-bk12/arch/parisc/kernel/Makefile	Mon Mar 31 12:36:32 2003
@@ -4,7 +4,8 @@
 
 head-y			:= head.o
 head-$(CONFIG_PARISC64)	:= head64.o
-EXTRA_TARGETS	:= init_task.o pdc_cons.o process.o unaligned.o $(head-y)
+extra-y			:= init_task.o pdc_cons.o process.o
+			   unaligned.o $(head-y)
 
 AFLAGS_entry.o	:= -traditional
 AFLAGS_pacache.o := -traditional
diff -urN linux-2.5.64-bk11/arch/parisc/kernel/pci.c linux-2.5.64-bk12/arch/parisc/kernel/pci.c
--- linux-2.5.64-bk11/arch/parisc/kernel/pci.c	Tue Mar  4 19:28:53 2003
+++ linux-2.5.64-bk12/arch/parisc/kernel/pci.c	Mon Mar 31 12:36:32 2003
@@ -192,74 +192,6 @@
 }
 
 
-/* ------------------------------------
-**
-** Program one BAR in PCI config space.
-**
-** ------------------------------------
-** PAT PDC systems need this routine. PA legacy PDC does not.
-**
-** When BAR's are configured by linux, this routine will update
-** configuration space with the "normalized" address. "root" indicates
-** where the range starts and res is some portion of that range.
-**
-** VCLASS: For all PA-RISC systems except V-class, root->start would be zero.
-**
-** PAT PDC can tell us which MMIO ranges are available or already in use.
-** I/O port space and such are not memory mapped anyway for PA-Risc.
-*/
-void __devinit
-pcibios_update_resource(
-	struct pci_dev *dev,
-	struct resource *root,
-	struct resource *res,
-	int barnum
-	)
-{
-	int where;
-	u32 barval = 0;
-
-	DBG_RES("pcibios_update_resource(%s, ..., %d) [%lx,%lx]/%x\n",
-		dev->slot_name,
-		barnum, res->start, res->end, (int) res->flags);
-
-	if (barnum >= PCI_BRIDGE_RESOURCES) {
-		/* handled in PCI-PCI bridge specific support */
-		return;
-	}
-
-	if (barnum == PCI_ROM_RESOURCE) {
-		where = PCI_ROM_ADDRESS;
-	} else {
-		/* 0-5  standard PCI "regions" */
-		where = PCI_BASE_ADDRESS_0 + (barnum * 4);
-	}
-
-	if (res->flags & IORESOURCE_IO) {
-		barval = PCI_PORT_ADDR(res->start);
-	} else if (res->flags & IORESOURCE_MEM) {
-		barval = PCI_BUS_ADDR(HBA_DATA(dev->bus->dev->platform_data), res->start);
-	} else {
-		panic("pcibios_update_resource() WTF? flags not IO or MEM");
-	}
-
-	pci_write_config_dword(dev, where, barval);
-
-/* XXX FIXME - Elroy does support 64-bit (dual cycle) addressing.
-** But at least one device (Symbios 53c896) which has 64-bit BAR
-** doesn't actually work right with dual cycle addresses.
-** So ignore the whole mess for now.
-*/
-
-	if ((res->flags & (PCI_BASE_ADDRESS_SPACE
-			   | PCI_BASE_ADDRESS_MEM_TYPE_MASK))
-	    == (PCI_BASE_ADDRESS_SPACE_MEMORY
-		| PCI_BASE_ADDRESS_MEM_TYPE_64)) {
-		pci_write_config_dword(dev, where+4, 0);
-		DBGC("PCIBIOS: dev %s type 64-bit\n", dev->name);
-	}
-}
-
 /*
 ** Called by pci_set_master() - a driver interface.
 **
@@ -345,30 +277,34 @@
 /*
 ** called by drivers/pci/setup-res.c:pci_setup_bridge().
 */
-void __devinit pcibios_fixup_pbus_ranges(
-	struct pci_bus *bus,
-	struct pbus_set_ranges_data *ranges
+void __devinit pcibios_resource_to_bus(
+ 	struct pci_dev *dev,
+	struct pci_bus_region *region,
+	struct resource *res
 	)
 {
+	struct pci_bus *bus = dev->bus;
 	struct pci_hba_data *hba = HBA_DATA(bus->dev->platform_data);
 
-	/*
-	** I/O space may see busnumbers here. Something
-	** in the form of 0xbbxxxx where bb is the bus num
-	** and xxxx is the I/O port space address.
-	** Remaining address translation are done in the
-	** PCI Host adapter specific code - ie dino_out8.
-	*/
-	ranges->io_start = PCI_PORT_ADDR(ranges->io_start);
-	ranges->io_end   = PCI_PORT_ADDR(ranges->io_end);
+	if (res->flags & IORESOURCE_IO) {
+		/*
+		** I/O space may see busnumbers here. Something
+		** in the form of 0xbbxxxx where bb is the bus num
+		** and xxxx is the I/O port space address.
+		** Remaining address translation are done in the
+		** PCI Host adapter specific code - ie dino_out8.
+		*/
+		region->start = PCI_PORT_ADDR(res->start);
+		region->end   = PCI_PORT_ADDR(res->end);
+	} else if (res->flags & IORESOURCE_MEM) {
+		/* Convert MMIO addr to PCI addr (undo global virtualization) */
+		region->start = PCI_BUS_ADDR(hba, res->start);
+		region->end   = PCI_BUS_ADDR(hba, res->end);
+	}
 
-	/* Convert MMIO addr to PCI addr (undo global virtualization) */
-	ranges->mem_start = PCI_BUS_ADDR(hba, ranges->mem_start);
-	ranges->mem_end   = PCI_BUS_ADDR(hba, ranges->mem_end);
-
-	DBG_RES("pcibios_fixup_pbus_ranges(%02x, [%lx,%lx %lx,%lx])\n", bus->number,
-		ranges->io_start, ranges->io_end,
-		ranges->mem_start, ranges->mem_end);
+	DBG_RES("pcibios_resource_to_bus(%02x %s [%lx,%lx])\n",
+		bus->number, res->flags & IORESOURCE_IO ? "IO" : "MEM",
+		region->start, region->end);
 
 	/* KLUGE ALERT
 	** if this resource isn't linked to a "parent", then it seems
@@ -378,6 +314,10 @@
 	pcibios_link_hba_resources(&hba->lmmio_space, bus->resource[1]);
 }
 
+#ifdef CONFIG_HOTPLUG
+EXPORT_SYMBOL(pcibios_resource_to_bus);
+#endif
+
 #define MAX(val1, val2)   ((val1) > (val2) ? (val1) : (val2))
 
 
diff -urN linux-2.5.64-bk11/arch/ppc/Makefile linux-2.5.64-bk12/arch/ppc/Makefile
--- linux-2.5.64-bk11/arch/ppc/Makefile	Tue Mar  4 19:28:57 2003
+++ linux-2.5.64-bk12/arch/ppc/Makefile	Mon Mar 31 12:36:32 2003
@@ -80,12 +80,8 @@
 arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
 				   include/config/MARKER
 
-include/asm-$(ARCH)/offsets.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
-	@$(generate-asm-offsets.h) < $< > $@
-
-include/asm-$(ARCH)/offsets.h: include/asm-$(ARCH)/offsets.h.tmp
-	@echo -n '  Generating $@'
-	@$(update-if-changed)
+include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s 
+	$(call filechk,gen-asm-offsets)
 
 ifdef CONFIG_6xx
 # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later
@@ -106,6 +102,5 @@
 	@true
 endif
 
-CLEAN_FILES +=	include/asm-$(ARCH)/offsets.h.tmp \
-		include/asm-$(ARCH)/offsets.h \
+CLEAN_FILES +=	include/asm-$(ARCH)/offsets.h \
 		arch/$(ARCH)/kernel/asm-offsets.s
diff -urN linux-2.5.64-bk11/arch/ppc/boot/images/Makefile linux-2.5.64-bk12/arch/ppc/boot/images/Makefile
--- linux-2.5.64-bk11/arch/ppc/boot/images/Makefile	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-bk12/arch/ppc/boot/images/Makefile	Mon Mar 31 12:36:33 2003
@@ -2,9 +2,8 @@
 # This dir holds all of the images for PPC machines.
 # Tom Rini	January 2001
 
-EXTRA_TARGETS	:= vmlinux.gz
-
-GZIP_FLAGS = -v9f
+targets		:= vmlinux.gz
+GZIP_FLAGS	:= -v9f
 
 $(obj)/vmlinux.gz: vmlinux
 	$(OBJCOPY) -O binary $< $(@:.gz=)
diff -urN linux-2.5.64-bk11/arch/ppc/kernel/Makefile linux-2.5.64-bk12/arch/ppc/kernel/Makefile
--- linux-2.5.64-bk11/arch/ppc/kernel/Makefile	Tue Mar  4 19:29:35 2003
+++ linux-2.5.64-bk12/arch/ppc/kernel/Makefile	Mon Mar 31 12:36:33 2003
@@ -15,7 +15,7 @@
 HEAD-$(CONFIG_8xx)		:= head_8xx.o
 HEAD-$(CONFIG_6xx)		+= idle_6xx.o
 
-EXTRA_TARGETS	:= $(HEAD-y)
+extra-y	:= $(HEAD-y)
 
 obj-y				:= entry.o traps.o irq.o idle.o time.o misc.o \
 					process.o signal.o ptrace.o align.o \
diff -urN linux-2.5.64-bk11/arch/ppc/kernel/pci.c linux-2.5.64-bk12/arch/ppc/kernel/pci.c
--- linux-2.5.64-bk11/arch/ppc/kernel/pci.c	Tue Mar  4 19:29:18 2003
+++ linux-2.5.64-bk12/arch/ppc/kernel/pci.c	Mon Mar 31 12:36:33 2003
@@ -93,46 +93,6 @@
 	}
 }
 
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			struct resource *res, int resource)
-{
-	u32 new, check;
-	int reg;
-	struct pci_controller* hose = dev->sysdata;
-	unsigned long io_offset;
-	
-	new = res->start;
-	res->flags &= ~IORESOURCE_UNSET;
-	if (hose && res->flags & IORESOURCE_IO) {
-		io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
-		new -= io_offset;
-	}
-	if (hose && res->flags & IORESOURCE_MEM)
-		new -= hose->pci_mem_offset;
-	new |= (res->flags & PCI_REGION_FLAG_MASK);
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4*resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		res->flags |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else {
-		/* Somebody might have asked allocation of a non-standard resource */
-		return;
-	}
-
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-		       new, check);
-	}
-	printk(KERN_INFO "PCI: moved device %s resource %d (%lx) to %x\n",
-	       dev->slot_name, resource, res->flags,
-	       new & ~PCI_REGION_FLAG_MASK);
-}
-
 static void
 pcibios_fixup_resources(struct pci_dev *dev)
 {
@@ -1107,11 +1067,6 @@
 	return PCI_SLOT(dev->devfn);
 }
 
-void __devinit
-pcibios_fixup_pbus_ranges(struct pci_bus * bus, struct pbus_set_ranges_data * ranges)
-{
-}
-
 unsigned long resource_fixup(struct pci_dev * dev, struct resource * res,
 			     unsigned long start, unsigned long size)
 {
diff -urN linux-2.5.64-bk11/arch/ppc64/Makefile linux-2.5.64-bk12/arch/ppc64/Makefile
--- linux-2.5.64-bk11/arch/ppc64/Makefile	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/arch/ppc64/Makefile	Mon Mar 31 12:36:33 2003
@@ -51,10 +51,6 @@
 				   include/config/MARKER
 
 include/asm-ppc64/offsets.h: arch/ppc64/kernel/asm-offsets.s
-	@echo -n '  Generating $@'
-	@$(generate-asm-offsets.h) < $< > $@.tmp
-	@$(update-if-changed)
-
-CLEAN_FILES += include/asm-ppc64/offsets.h.tmp \
-	       include/asm-ppc64/offsets.h
+	$(call filechk,gen-asm-offsets)
 
+CLEAN_FILES += include/asm-ppc64/offsets.h
diff -urN linux-2.5.64-bk11/arch/ppc64/boot/Makefile linux-2.5.64-bk12/arch/ppc64/boot/Makefile
--- linux-2.5.64-bk11/arch/ppc64/boot/Makefile	Tue Mar  4 19:29:34 2003
+++ linux-2.5.64-bk12/arch/ppc64/boot/Makefile	Mon Mar 31 12:36:33 2003
@@ -59,12 +59,12 @@
 gz-sec  = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
 
 host-progs		:= piggy addnote addSystemMap addRamDisk
-EXTRA_TARGETS 		+= zImage zImage.initrd imagesize.c \
+targets 		+= zImage zImage.initrd imagesize.c \
 			   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
 			   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
 			   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
-			   vmlinux.sm vmlinux.initrd vmlinux.sminitrd \
-			   sysmap.o initrd.o
+			   vmlinux.sm vmlinux.initrd vmlinux.sminitrd
+extra-y			:= sysmap.o initrd.o
 
 quiet_cmd_sysmap = SYSMAP   $@
       cmd_sysmap = $(obj)/addSystemMap System.map $< $@
diff -urN linux-2.5.64-bk11/arch/ppc64/kernel/Makefile linux-2.5.64-bk12/arch/ppc64/kernel/Makefile
--- linux-2.5.64-bk11/arch/ppc64/kernel/Makefile	Tue Mar  4 19:29:53 2003
+++ linux-2.5.64-bk12/arch/ppc64/kernel/Makefile	Mon Mar 31 12:36:33 2003
@@ -3,7 +3,7 @@
 #
 
 EXTRA_CFLAGS	+= -mno-minimal-toc
-EXTRA_TARGETS	:= head.o
+extra-y		:= head.o
 obj-y               :=	setup.o entry.o traps.o irq.o idle.o \
 			time.o process.o signal.o syscalls.o misc.o ptrace.o \
 			align.o semaphore.o bitops.o stab.o htab.o pacaData.o \
diff -urN linux-2.5.64-bk11/arch/ppc64/kernel/pci.c linux-2.5.64-bk12/arch/ppc64/kernel/pci.c
--- linux-2.5.64-bk11/arch/ppc64/kernel/pci.c	Mon Mar 31 12:36:26 2003
+++ linux-2.5.64-bk12/arch/ppc64/kernel/pci.c	Mon Mar 31 12:36:33 2003
@@ -127,42 +127,6 @@
 	return NULL;
 }
 
-void __devinit pcibios_fixup_pbus_ranges(struct pci_bus *pbus,
-					 struct pbus_set_ranges_data *pranges)
-{
-}
-
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			     struct resource *res, int resource)
-{
-	u32 new, check;
-	int reg;
-	struct pci_controller* hose = PCI_GET_PHB_PTR(dev);
-	
-	new = res->start;
-	if (hose && res->flags & IORESOURCE_MEM)
-		new -= hose->pci_mem_offset;
-	new |= (res->flags & PCI_REGION_FLAG_MASK);
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4*resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		res->flags |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else {
-		/* Somebody might have asked allocation of a non-standard resource */
-		return;
-	}
-
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-		       new, check);
-	}
-}
-
 static void
 pcibios_fixup_resources(struct pci_dev* dev)
 {
diff -urN linux-2.5.64-bk11/arch/s390/Makefile linux-2.5.64-bk12/arch/s390/Makefile
--- linux-2.5.64-bk11/arch/s390/Makefile	Tue Mar  4 19:29:02 2003
+++ linux-2.5.64-bk12/arch/s390/Makefile	Mon Mar 31 12:36:33 2003
@@ -48,9 +48,6 @@
 				   include/config/MARKER
 
 include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
-	@echo -n '  Generating $@'
-	@$(generate-asm-offsets.h) < $< > $@.tmp
-	@$(update-if-changed)
+	$(call filechk,gen-asm-offsets)
 
-CLEAN_FILES += include/asm-$(ARCH)/offsets.h.tmp \
-	       include/asm-$(ARCH)/offsets.h
+CLEAN_FILES += include/asm-$(ARCH)/offsets.h
diff -urN linux-2.5.64-bk11/arch/s390/boot/Makefile linux-2.5.64-bk12/arch/s390/boot/Makefile
--- linux-2.5.64-bk11/arch/s390/boot/Makefile	Tue Mar  4 19:29:56 2003
+++ linux-2.5.64-bk12/arch/s390/boot/Makefile	Mon Mar 31 12:36:33 2003
@@ -2,8 +2,8 @@
 # Makefile for the linux s390-specific parts of the memory manager.
 #
 
-EXTRA_TARGETS := image listing
-EXTRA_AFLAGS  := -traditional
+targets		:= image listing
+EXTRA_AFLAGS	:= -traditional
 quiet_cmd_listing = OBJDUMP $@
       cmd_listing = $(OBJDUMP) --disassemble --disassemble-all \
 			       --disassemble-zeroes --reloc vmlinux > $@
diff -urN linux-2.5.64-bk11/arch/s390/kernel/Makefile linux-2.5.64-bk12/arch/s390/kernel/Makefile
--- linux-2.5.64-bk11/arch/s390/kernel/Makefile	Tue Mar  4 19:29:52 2003
+++ linux-2.5.64-bk12/arch/s390/kernel/Makefile	Mon Mar 31 12:36:33 2003
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-EXTRA_TARGETS	:= head.o init_task.o
+extra-y		:= head.o init_task.o
 EXTRA_AFLAGS	:= -traditional
 
 obj-y	:= entry.o bitmap.o traps.o time.o process.o \
diff -urN linux-2.5.64-bk11/arch/s390x/Makefile linux-2.5.64-bk12/arch/s390x/Makefile
--- linux-2.5.64-bk11/arch/s390x/Makefile	Tue Mar  4 19:29:19 2003
+++ linux-2.5.64-bk12/arch/s390x/Makefile	Mon Mar 31 12:36:33 2003
@@ -48,9 +48,6 @@
 				   include/config/MARKER
 
 include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
-	@echo -n '  Generating $@'
-	@$(generate-asm-offsets.h) < $< > $@.tmp
-	@$(update-if-changed)
+	$(call filechk,gen-asm-offsets)
 
-CLEAN_FILES += include/asm-$(ARCH)/offsets.h.tmp \
-	       include/asm-$(ARCH)/offsets.h
+CLEAN_FILES += include/asm-$(ARCH)/offsets.h
diff -urN linux-2.5.64-bk11/arch/s390x/boot/Makefile linux-2.5.64-bk12/arch/s390x/boot/Makefile
--- linux-2.5.64-bk11/arch/s390x/boot/Makefile	Tue Mar  4 19:29:19 2003
+++ linux-2.5.64-bk12/arch/s390x/boot/Makefile	Mon Mar 31 12:36:33 2003
@@ -2,8 +2,8 @@
 # Makefile for the linux s390-specific parts of the memory manager.
 #
 
-EXTRA_TARGETS := image listing
-EXTRA_AFLAGS  := -traditional
+targets		:= image listing
+EXTRA_AFLAGS	:= -traditional
 
 quiet_cmd_listing = OBJDUMP $@
       cmd_listing = $(OBJDUMP) --disassemble --disassemble-all \
diff -urN linux-2.5.64-bk11/arch/s390x/kernel/Makefile linux-2.5.64-bk12/arch/s390x/kernel/Makefile
--- linux-2.5.64-bk11/arch/s390x/kernel/Makefile	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/arch/s390x/kernel/Makefile	Mon Mar 31 12:36:33 2003
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-EXTRA_TARGETS	:= head.o init_task.o
+extra-y		:= head.o init_task.o
 EXTRA_AFLAGS	:= -traditional
 
 obj-y		:= entry.o bitmap.o traps.o time.o process.o \
diff -urN linux-2.5.64-bk11/arch/sh/kernel/Makefile linux-2.5.64-bk12/arch/sh/kernel/Makefile
--- linux-2.5.64-bk11/arch/sh/kernel/Makefile	Tue Mar  4 19:29:23 2003
+++ linux-2.5.64-bk12/arch/sh/kernel/Makefile	Mon Mar 31 12:36:33 2003
@@ -2,7 +2,7 @@
 # Makefile for the Linux/SuperH kernel.
 #
 
-EXTRA_TARGETS	:= head.o init_task.o
+extra-y	:= head.o init_task.o
 
 obj-y	:= process.o signal.o entry.o traps.o irq.o irq_ipr.o \
 	ptrace.o setup.o time.o sys_sh.o semaphore.o \
diff -urN linux-2.5.64-bk11/arch/sh/kernel/pci-dc.c linux-2.5.64-bk12/arch/sh/kernel/pci-dc.c
--- linux-2.5.64-bk11/arch/sh/kernel/pci-dc.c	Tue Mar  4 19:29:04 2003
+++ linux-2.5.64-bk12/arch/sh/kernel/pci-dc.c	Mon Mar 31 12:36:33 2003
@@ -113,10 +113,6 @@
 }
 
 
-void __devinit pcibios_fixup_pbus_ranges(struct pci_bus *bus, struct pbus_set_ranges_data *ranges)
-{
-}                                                                                
-
 void __init pcibios_fixup_bus(struct pci_bus *bus)
 {
 	struct list_head *ln;
diff -urN linux-2.5.64-bk11/arch/sh/kernel/pci-sh7751.c linux-2.5.64-bk12/arch/sh/kernel/pci-sh7751.c
--- linux-2.5.64-bk11/arch/sh/kernel/pci-sh7751.c	Tue Mar  4 19:29:31 2003
+++ linux-2.5.64-bk12/arch/sh/kernel/pci-sh7751.c	Mon Mar 31 12:36:34 2003
@@ -250,12 +250,6 @@
 	{ 0 }
 };
 
-void __devinit pcibios_fixup_pbus_ranges(struct pci_bus *b,
-					 struct pbus_set_ranges_data *range)
-{
-	/* No fixups needed */
-}
-
 /*
  *  Called after each bus is probed, but before its children
  *  are examined.
diff -urN linux-2.5.64-bk11/arch/sh/kernel/pci_st40.c linux-2.5.64-bk12/arch/sh/kernel/pci_st40.c
--- linux-2.5.64-bk11/arch/sh/kernel/pci_st40.c	Tue Mar  4 19:29:35 2003
+++ linux-2.5.64-bk12/arch/sh/kernel/pci_st40.c	Mon Mar 31 12:36:34 2003
@@ -380,12 +380,6 @@
 }
 
 
-void __devinit
-pcibios_fixup_pbus_ranges(struct pci_bus *bus,
-			  struct pbus_set_ranges_data *ranges)
-{
-}
-
 void __init pcibios_init(void)
 {
 	extern unsigned long memory_start, memory_end;
diff -urN linux-2.5.64-bk11/arch/sh/kernel/pcibios.c linux-2.5.64-bk12/arch/sh/kernel/pcibios.c
--- linux-2.5.64-bk11/arch/sh/kernel/pcibios.c	Tue Mar  4 19:29:05 2003
+++ linux-2.5.64-bk12/arch/sh/kernel/pcibios.c	Mon Mar 31 12:36:34 2003
@@ -6,7 +6,6 @@
  * This is GPL'd.
  *
  * Provided here are generic versions of:
- *	pcibios_update_resource()
  *	pcibios_align_resource()
  *	pcibios_enable_device()
  *	pcibios_set_master()
@@ -19,41 +18,12 @@
  *	pcibios_fixup_bus()
  *	pcibios_init()
  *	pcibios_setup()
- *	pcibios_fixup_pbus_ranges()
  */
 
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/init.h>
 
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			struct resource *res, int resource)
-{
-	u32 new, check;
-	int reg;
-
-	new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4*resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		res->flags |= PCI_ROM_ADDRESS_ENABLE;
-		new |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else {
-		/* Somebody might have asked allocation of a non-standard resource */
-		return;
-	}
-	
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-		       new, check);
-	}
-}
-
 /*
  * We need to avoid collisions with `mirrored' VGA ports
  * and other strange ISA hardware, so we always want the
diff -urN linux-2.5.64-bk11/arch/sparc/Makefile linux-2.5.64-bk12/arch/sparc/Makefile
--- linux-2.5.64-bk11/arch/sparc/Makefile	Tue Mar  4 19:29:00 2003
+++ linux-2.5.64-bk12/arch/sparc/Makefile	Mon Mar 31 12:36:34 2003
@@ -68,10 +68,7 @@
 				   include/config/MARKER
 
 include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
-	@echo -n '  Generating $@'
-	@$(generate-asm-offsets.h) < $< > $@.tmp
-	@$(update-if-changed)
+	$(call filechk,gen-asm-offsets)
 
-CLEAN_FILES +=	include/asm-$(ARCH)/asm_offsets.h.tmp	\
-		include/asm-$(ARCH)/asm_offsets.h	\
+CLEAN_FILES +=	include/asm-$(ARCH)/asm_offsets.h	\
 		arch/$(ARCH)/kernel/asm-offsets.s
diff -urN linux-2.5.64-bk11/arch/sparc/boot/Makefile linux-2.5.64-bk12/arch/sparc/boot/Makefile
--- linux-2.5.64-bk11/arch/sparc/boot/Makefile	Tue Mar  4 19:29:37 2003
+++ linux-2.5.64-bk12/arch/sparc/boot/Makefile	Mon Mar 31 12:36:34 2003
@@ -8,7 +8,7 @@
 ELFTOAOUT	:= elftoaout
 
 host-progs	:= piggyback btfixupprep
-EXTRA_TARGETS	:= tftpboot.img btfix.o btfix.s image
+targets		:= tftpboot.img btfix.o btfix.s image
 
 quiet_cmd_elftoaout	= ELFTOAOUT $@
       cmd_elftoaout	= $(ELFTOAOUT) $(obj)/image -o $@
diff -urN linux-2.5.64-bk11/arch/sparc/kernel/Makefile linux-2.5.64-bk12/arch/sparc/kernel/Makefile
--- linux-2.5.64-bk11/arch/sparc/kernel/Makefile	Tue Mar  4 19:29:34 2003
+++ linux-2.5.64-bk12/arch/sparc/kernel/Makefile	Mon Mar 31 12:36:34 2003
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-EXTRA_TARGETS	:= head.o init_task.o
+extra-y		:= head.o init_task.o
 
 EXTRA_AFLAGS	:= -ansi
 
diff -urN linux-2.5.64-bk11/arch/sparc/kernel/pcic.c linux-2.5.64-bk12/arch/sparc/kernel/pcic.c
--- linux-2.5.64-bk11/arch/sparc/kernel/pcic.c	Tue Mar  4 19:29:20 2003
+++ linux-2.5.64-bk12/arch/sparc/kernel/pcic.c	Mon Mar 31 12:36:34 2003
@@ -854,13 +854,6 @@
 	return str;
 }
 
-/*
- */
-void pcibios_update_resource(struct pci_dev *pdev, struct resource *res1,
-			     struct resource *res2, int index)
-{
-}
-
 void pcibios_align_resource(void *data, struct resource *res,
 			    unsigned long size, unsigned long align)
 {
diff -urN linux-2.5.64-bk11/arch/sparc64/boot/Makefile linux-2.5.64-bk12/arch/sparc64/boot/Makefile
--- linux-2.5.64-bk11/arch/sparc64/boot/Makefile	Tue Mar  4 19:28:53 2003
+++ linux-2.5.64-bk12/arch/sparc64/boot/Makefile	Mon Mar 31 12:36:34 2003
@@ -7,8 +7,8 @@
 ROOT_IMG	:= /usr/src/root.img
 ELFTOAOUT	:= elftoaout
 
-host-progs    := piggyback
-EXTRA_TARGETS := tftpboot.img vmlinux.aout
+host-progs	:= piggyback
+targets		:= tftpboot.img vmlinux.aout
 
 quiet_cmd_elftoaout = ELT2AOUT $@
       cmd_elftoaout = $(ELFTOAOUT) vmlinux -o $@
diff -urN linux-2.5.64-bk11/arch/sparc64/kernel/Makefile linux-2.5.64-bk12/arch/sparc64/kernel/Makefile
--- linux-2.5.64-bk11/arch/sparc64/kernel/Makefile	Tue Mar  4 19:29:02 2003
+++ linux-2.5.64-bk12/arch/sparc64/kernel/Makefile	Mon Mar 31 12:36:34 2003
@@ -5,7 +5,7 @@
 EXTRA_AFLAGS := -ansi
 EXTRA_CFLAGS := -Werror
 
-EXTRA_TARGETS	:= head.o init_task.o
+extra-y		:= head.o init_task.o
 
 obj-y		:= process.o setup.o cpu.o idprom.o \
 		   traps.o devices.o auxio.o \
diff -urN linux-2.5.64-bk11/arch/sparc64/kernel/pci.c linux-2.5.64-bk12/arch/sparc64/kernel/pci.c
--- linux-2.5.64-bk11/arch/sparc64/kernel/pci.c	Tue Mar  4 19:28:52 2003
+++ linux-2.5.64-bk12/arch/sparc64/kernel/pci.c	Mon Mar 31 12:36:34 2003
@@ -470,20 +470,10 @@
 	return err;
 }
 
-void pcibios_update_resource(struct pci_dev *pdev, struct resource *res1,
-			     struct resource *res2, int index)
-{
-}
-
 void pcibios_update_irq(struct pci_dev *pdev, int irq)
 {
 }
 
-void __devinit pcibios_fixup_pbus_ranges(struct pci_bus *pbus,
-					 struct pbus_set_ranges_data *pranges)
-{
-}
-
 void pcibios_align_resource(void *data, struct resource *res,
 			    unsigned long size, unsigned long align)
 {
diff -urN linux-2.5.64-bk11/arch/um/kernel/tt/Makefile linux-2.5.64-bk12/arch/um/kernel/tt/Makefile
--- linux-2.5.64-bk11/arch/um/kernel/tt/Makefile	Tue Mar  4 19:29:19 2003
+++ linux-2.5.64-bk12/arch/um/kernel/tt/Makefile	Mon Mar 31 12:36:34 2003
@@ -3,7 +3,7 @@
 # Licensed under the GPL
 #
 
-EXTRA_TARGETS := unmap_fin.o
+extra-y := unmap_fin.o
 
 obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \
 	syscall_kern.o syscall_user.o time.o tlb.o tracer.o trap_user.o \
diff -urN linux-2.5.64-bk11/arch/um/sys-i386/util/Makefile linux-2.5.64-bk12/arch/um/sys-i386/util/Makefile
--- linux-2.5.64-bk11/arch/um/sys-i386/util/Makefile	Tue Mar  4 19:29:53 2003
+++ linux-2.5.64-bk12/arch/um/sys-i386/util/Makefile	Mon Mar 31 12:36:34 2003
@@ -1,6 +1,7 @@
-EXTRA_TARGETS	:= mk_sc mk_thread mk_thread_kern.o
 
 host-progs	:= mk_sc
+always		:= $(host-progs) mk_thread
+targets		:= mk_thread_kern.o mk_thread_user.o
 
 mk_sc-objs	:= mk_sc.o
 
@@ -11,6 +12,6 @@
 	$(CC) $(USER_CFLAGS) -c -o $@ $<
 
 clean :
-	$(RM) -f $(EXTRA_TARGETS)
+	$(RM) -f $(build-targets)
 
 archmrproper : clean
diff -urN linux-2.5.64-bk11/arch/um/util/Makefile linux-2.5.64-bk12/arch/um/util/Makefile
--- linux-2.5.64-bk11/arch/um/util/Makefile	Tue Mar  4 19:29:54 2003
+++ linux-2.5.64-bk12/arch/um/util/Makefile	Mon Mar 31 12:36:34 2003
@@ -1,4 +1,6 @@
-EXTRA_TARGETS := mk_task mk_constants
+always		:= mk_task mk_constants
+targets		:= mk_task_user.o mk_task_kern.o \
+		   mk_constants_user.o mk_constants_kern.o
 
 $(obj)/mk_task: $(obj)/mk_task_user.o $(obj)/mk_task_kern.o
 	$(CC) -o $@ $^
@@ -16,6 +18,6 @@
 	$(CC) $(CFLAGS) -c $< -o $@
 
 clean:
-	$(RM) $(EXTRA_TARGETS)
+	$(RM) $(build-targets)
 
 archmrproper:
diff -urN linux-2.5.64-bk11/arch/v850/Makefile linux-2.5.64-bk12/arch/v850/Makefile
--- linux-2.5.64-bk11/arch/v850/Makefile	Tue Mar  4 19:29:56 2003
+++ linux-2.5.64-bk12/arch/v850/Makefile	Mon Mar 31 12:36:34 2003
@@ -55,14 +55,10 @@
 # Generate constants from C code for use by asm files
 arch/$(ARCH)/kernel/asm-consts.s: include/asm include/linux/version.h \
 				   include/config/MARKER
-include/asm-$(ARCH)/asm-consts.h.tmp: arch/$(ARCH)/kernel/asm-consts.s
-	@$(generate-asm-offsets.h) < $< > $@
-include/asm-$(ARCH)/asm-consts.h: include/asm-$(ARCH)/asm-consts.h.tmp
-	@echo -n '  Generating $@'
-	@$(update-if-changed)
 
+include/asm-$(ARCH)/asm-consts.h: arch/$(ARCH)/kernel/asm-consts.s
+	$(call filechk,gen-asm-offsets)
 
-CLEAN_FILES += include/asm-$(ARCH)/asm-consts.h.tmp \
-	       include/asm-$(ARCH)/asm-consts.h \
+CLEAN_FILES += include/asm-$(ARCH)/asm-consts.h \
 	       arch/$(ARCH)/kernel/asm-consts.s \
 	       root_fs_image.o
diff -urN linux-2.5.64-bk11/arch/v850/kernel/Makefile linux-2.5.64-bk12/arch/v850/kernel/Makefile
--- linux-2.5.64-bk11/arch/v850/kernel/Makefile	Tue Mar  4 19:29:55 2003
+++ linux-2.5.64-bk12/arch/v850/kernel/Makefile	Mon Mar 31 12:36:34 2003
@@ -9,7 +9,7 @@
 # for more details.
 #
 
-EXTRA_TARGETS := head.o init_task.o
+extra-y := head.o init_task.o
 
 obj-y += intv.o entry.o process.o syscalls.o time.o semaphore.o setup.o \
 	 signal.o irq.o mach.o ptrace.o bug.o
diff -urN linux-2.5.64-bk11/arch/v850/kernel/rte_mb_a_pci.c linux-2.5.64-bk12/arch/v850/kernel/rte_mb_a_pci.c
--- linux-2.5.64-bk11/arch/v850/kernel/rte_mb_a_pci.c	Tue Mar  4 19:29:03 2003
+++ linux-2.5.64-bk12/arch/v850/kernel/rte_mb_a_pci.c	Mon Mar 31 12:36:34 2003
@@ -287,44 +287,20 @@
 	pci_write_config_byte (dev, PCI_INTERRUPT_LINE, irq);
 }
 
-void __nomods_init
-pcibios_update_resource (struct pci_dev *dev, struct resource *root,
-			 struct resource *r, int resource)
+void __devinit
+pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+			struct resource *res)
 {
-	u32 new, check;
-	int reg;
+	unsigned long offset = 0;
 
-	if (r->flags & IORESOURCE_IO)
-		new = (((r->start - MB_A_PCI_IO_ADDR)
-			& PCI_BASE_ADDRESS_IO_MASK)
-		       | PCI_BASE_ADDRESS_SPACE_IO);
-	else if (r->flags & IORESOURCE_MEM)
-		new = (((r->start - MB_A_PCI_MEM_ADDR)
-			& PCI_BASE_ADDRESS_MEM_MASK)
-		       | PCI_BASE_ADDRESS_MEM_TYPE_32
-		       | ((r->flags & IORESOURCE_PREFETCH)
-			  ? PCI_BASE_ADDRESS_MEM_PREFETCH
-			  : 0)
-		       | PCI_BASE_ADDRESS_SPACE_MEMORY);
-	else
-		panic ("pcibios_update_resource: unknown resource type");
-
-	if (resource < 6)
-		reg = PCI_BASE_ADDRESS_0 + 4*resource;
-	else if (resource == PCI_ROM_RESOURCE) {
-		r->flags |= PCI_ROM_ADDRESS_ENABLE;
-		new |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else
-		return;
-	
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk (KERN_ERR "PCI: Error while updating region "
-			"%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-			new, check);
+	if (res->flags & IORESOURCE_IO) {
+		offset = MB_A_PCI_IO_ADDR;
+	} else if (res->flags & IORESOURCE_MEM) {
+		offset = MB_A_PCI_MEM_ADDR;
 	}
+
+	region->start = res->start - offset;
+	region->end = res->end - offset;
 }
 
 
diff -urN linux-2.5.64-bk11/arch/x86_64/Makefile linux-2.5.64-bk12/arch/x86_64/Makefile
--- linux-2.5.64-bk11/arch/x86_64/Makefile	Tue Mar  4 19:29:34 2003
+++ linux-2.5.64-bk12/arch/x86_64/Makefile	Mon Mar 31 12:36:34 2003
@@ -86,15 +86,10 @@
 arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
 				   include/config/MARKER
 
-include/asm-$(ARCH)/offset.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
-
 include/asm-$(ARCH)/offset.h: arch/$(ARCH)/kernel/asm-offsets.s
-	@echo -n '  Generating $@'
-	@$(generate-asm-offsets.h) < $< > $@.tmp
-	@$(update-if-changed)
+	$(call filechk,gen-asm-offsets)
 
-CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \
-	       include/asm-$(ARCH)/offset.h
+CLEAN_FILES += include/asm-$(ARCH)/offset.h
 
 define archhelp
   echo  '* bzImage	- Compressed kernel image (arch/$(ARCH)/boot/bzImage)'
diff -urN linux-2.5.64-bk11/arch/x86_64/boot/Makefile linux-2.5.64-bk12/arch/x86_64/boot/Makefile
--- linux-2.5.64-bk11/arch/x86_64/boot/Makefile	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/arch/x86_64/boot/Makefile	Mon Mar 31 12:36:34 2003
@@ -25,8 +25,8 @@
 
 #RAMDISK := -DRAMDISK=512
 
-EXTRA_TARGETS	:= vmlinux.bin bootsect bootsect.o \
-		   setup setup.o bzImage
+targets		:= vmlinux.bin bootsect bootsect.o \
+		   setup setup.o bzImage mtools.conf
 
 EXTRA_CFLAGS := -m32
 
diff -urN linux-2.5.64-bk11/arch/x86_64/boot/compressed/Makefile linux-2.5.64-bk12/arch/x86_64/boot/compressed/Makefile
--- linux-2.5.64-bk11/arch/x86_64/boot/compressed/Makefile	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/arch/x86_64/boot/compressed/Makefile	Mon Mar 31 12:36:34 2003
@@ -6,7 +6,7 @@
 # Note all the files here are compiled/linked as 32bit executables.
 #
 
-EXTRA_TARGETS	:= vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
+targets		:= vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
 EXTRA_AFLAGS	:= -traditional -m32
 
 # cannot use EXTRA_CFLAGS because base CFLAGS contains -mkernel which conflicts with
diff -urN linux-2.5.64-bk11/arch/x86_64/kernel/Makefile linux-2.5.64-bk12/arch/x86_64/kernel/Makefile
--- linux-2.5.64-bk11/arch/x86_64/kernel/Makefile	Tue Mar  4 19:29:32 2003
+++ linux-2.5.64-bk12/arch/x86_64/kernel/Makefile	Mon Mar 31 12:36:34 2003
@@ -2,8 +2,8 @@
 # Makefile for the linux kernel.
 #
 
-EXTRA_TARGETS 	:= head.o head64.o init_task.o
-EXTRA_AFLAGS  := -traditional
+extra-y 	:= head.o head64.o init_task.o
+EXTRA_AFLAGS	:= -traditional
 obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o \
 		ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \
 		pci-dma.o x8664_ksyms.o i387.o syscall.o vsyscall.o \
diff -urN linux-2.5.64-bk11/arch/x86_64/pci/x86-64.c linux-2.5.64-bk12/arch/x86_64/pci/x86-64.c
--- linux-2.5.64-bk11/arch/x86_64/pci/x86-64.c	Tue Mar  4 19:29:52 2003
+++ linux-2.5.64-bk12/arch/x86_64/pci/x86-64.c	Mon Mar 31 12:36:35 2003
@@ -33,34 +33,6 @@
 
 #include "pci.h"
 
-void
-pcibios_update_resource(struct pci_dev *dev, struct resource *root,
-			struct resource *res, int resource)
-{
-	u32 new, check;
-	int reg;
-
-	new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
-	if (resource < 6) {
-		reg = PCI_BASE_ADDRESS_0 + 4*resource;
-	} else if (resource == PCI_ROM_RESOURCE) {
-		res->flags |= PCI_ROM_ADDRESS_ENABLE;
-		new |= PCI_ROM_ADDRESS_ENABLE;
-		reg = dev->rom_base_reg;
-	} else {
-		/* Somebody might have asked allocation of a non-standard resource */
-		return;
-	}
-	
-	pci_write_config_dword(dev, reg, new);
-	pci_read_config_dword(dev, reg, &check);
-	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
-		       new, check);
-	}
-}
-
 /*
  * We need to avoid collisions with `mirrored' VGA ports
  * and other strange ISA hardware, so we always want the
diff -urN linux-2.5.64-bk11/drivers/md/md.c linux-2.5.64-bk12/drivers/md/md.c
--- linux-2.5.64-bk11/drivers/md/md.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/md/md.c	Mon Mar 31 12:36:36 2003
@@ -2818,9 +2818,11 @@
 
 void md_wakeup_thread(mdk_thread_t *thread)
 {
-	dprintk("md: waking up MD thread %p.\n", thread);
-	set_bit(THREAD_WAKEUP, &thread->flags);
-	wake_up(&thread->wqueue);
+	if (thread) {
+		dprintk("md: waking up MD thread %p.\n", thread);
+		set_bit(THREAD_WAKEUP, &thread->flags);
+		wake_up(&thread->wqueue);
+	}
 }
 
 mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
diff -urN linux-2.5.64-bk11/drivers/media/radio/miropcm20-rds.c linux-2.5.64-bk12/drivers/media/radio/miropcm20-rds.c
--- linux-2.5.64-bk11/drivers/media/radio/miropcm20-rds.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/media/radio/miropcm20-rds.c	Mon Mar 31 12:36:36 2003
@@ -113,7 +113,7 @@
 
 static struct miscdevice rds_miscdev = {
 	.minor		= MISC_DYNAMIC_MINOR,
-	.name		= "radiotext"
+	.name		= "radiotext",
 	.fops		= &rds_fops,
 };
 
@@ -128,7 +128,7 @@
 	error = devfs_mk_symlink(NULL, "v4l/rds/radiotext", 0,
 				 "../misc/radiotext", NULL, NULL);
 	if (error)
-		misc_deregister(&rds_miscdev)
+		misc_deregister(&rds_miscdev);
 
 	return error;
 }
@@ -136,7 +136,7 @@
 static void __exit miropcm20_rds_cleanup(void)
 {
 	devfs_remove("v4l/rds/radiotext");
-	misc_deregister(&rds_miscdev)
+	misc_deregister(&rds_miscdev);
 }
 
 module_init(miropcm20_rds_init);
diff -urN linux-2.5.64-bk11/drivers/net/e100/e100_main.c linux-2.5.64-bk12/drivers/net/e100/e100_main.c
--- linux-2.5.64-bk11/drivers/net/e100/e100_main.c	Tue Mar  4 19:29:18 2003
+++ linux-2.5.64-bk12/drivers/net/e100/e100_main.c	Mon Mar 31 12:36:36 2003
@@ -3784,11 +3784,15 @@
 		return -EOPNOTSUPP;
 	}
 
-	if (copy_to_user(ifr->ifr_data, &info, sizeof (info)))
+	if (copy_to_user(ifr->ifr_data, &info, sizeof (info))) {
+		kfree(strings);
 		return -EFAULT;
+	}
 
-	if (copy_to_user(usr_strings, strings, info.len * ETH_GSTRING_LEN))
+	if (copy_to_user(usr_strings, strings, info.len * ETH_GSTRING_LEN)) {
+		kfree(strings);
 		return -EFAULT;
+	}
 
 	kfree(strings);
 	return 0;
diff -urN linux-2.5.64-bk11/drivers/pci/pci.ids linux-2.5.64-bk12/drivers/pci/pci.ids
--- linux-2.5.64-bk11/drivers/pci/pci.ids	Tue Mar  4 19:29:19 2003
+++ linux-2.5.64-bk12/drivers/pci/pci.ids	Mon Mar 31 12:36:36 2003
@@ -5440,6 +5440,11 @@
 		14f1 2004  Dynalink 56PMi
 	8234  RS8234 ATM SAR Controller [ServiceSAR Plus]
 14f2  MOBILITY Electronics
+	0120  EV1000 bridge
+	0121  EV1000 Parallel port
+	0122  EV1000 Serial port
+	0123  EV1000 Keyboard controller
+	0124  EV1000 Mouse controller
 14f3  BROADLOGIC
 14f4  TOKYO Electronic Industry CO Ltd
 14f5  SOPAC Ltd
diff -urN linux-2.5.64-bk11/drivers/pci/probe.c linux-2.5.64-bk12/drivers/pci/probe.c
--- linux-2.5.64-bk11/drivers/pci/probe.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/pci/probe.c	Mon Mar 31 12:36:36 2003
@@ -15,6 +15,9 @@
 #define DBG(x...)
 #endif
 
+#define CARDBUS_LATENCY_TIMER	176	/* secondary latency timer */
+#define CARDBUS_RESERVE_BUSNR	3
+
 LIST_HEAD(pci_root_buses);
 LIST_HEAD(pci_devices);
 
@@ -291,12 +294,15 @@
  */
 int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass)
 {
-	unsigned int buses;
 	struct pci_bus *child;
 	int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
+	u32 buses;
 
 	pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses);
-	DBG("Scanning behind PCI bridge %s, config %06x, pass %d\n", dev->slot_name, buses & 0xffffff, pass);
+
+	DBG("Scanning behind PCI bridge %s, config %06x, pass %d\n",
+	    dev->slot_name, buses & 0xffffff, pass);
+
 	if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) {
 		unsigned int cmax;
 		/*
@@ -333,8 +339,10 @@
 		 * yenta.c forces a secondary latency timer of 176.
 		 * Copy that behaviour here.
 		 */
-		if (is_cardbus)
-			buses = (buses & 0x00ffffff) | (176 << 24);
+		if (is_cardbus) {
+			buses &= ~0xff000000;
+			buses |= CARDBUS_LATENCY_TIMER << 24;
+		}
 			
 		/*
 		 * We need to blast all three values with a single write.
@@ -350,7 +358,7 @@
 			 * as cards with a PCI-to-PCI bridge can be
 			 * inserted later.
 			 */
-			max += 3;
+			max += CARDBUS_RESERVE_BUSNR;
 		}
 		/*
 		 * Set the subordinate bus number to its real value.
@@ -358,6 +366,7 @@
 		child->subordinate = max;
 		pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
 	}
+
 	sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number);
 
 	return max;
@@ -391,17 +400,20 @@
 {
 	u32 class;
 
-	sprintf(dev->slot_name, "%02x:%02x.%d", dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
-	sprintf(dev->dev.name, "PCI device %04x:%04x", dev->vendor, dev->device);
+	sprintf(dev->slot_name, "%02x:%02x.%d", dev->bus->number,
+		PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
+	sprintf(dev->dev.name, "PCI device %04x:%04x",
+		dev->vendor, dev->device);
+
 	INIT_LIST_HEAD(&dev->pools);
-	
+
 	pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
 	class >>= 8;				    /* upper 3 bytes */
 	dev->class = class;
 	class >>= 8;
 
-	DBG("Found %02x:%02x [%04x/%04x] %06x %02x\n", dev->bus->number, dev->devfn,
-		dev->vendor, dev->device, class, dev->hdr_type);
+	DBG("Found %02x:%02x [%04x/%04x] %06x %02x\n", dev->bus->number,
+	    dev->devfn, dev->vendor, dev->device, class, dev->hdr_type);
 
 	/* "Unknown power state" */
 	dev->current_state = 4;
@@ -468,7 +480,8 @@
 		return NULL;
 
 	/* some broken boards return 0 or ~0 if a slot is empty: */
-	if (l == 0xffffffff || l == 0x00000000 || l == 0x0000ffff || l == 0xffff0000)
+	if (l == 0xffffffff || l == 0x00000000 ||
+	    l == 0x0000ffff || l == 0xffff0000)
 		return NULL;
 
 	dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
@@ -520,11 +533,14 @@
 		struct pci_dev *dev;
 
 		dev = pci_scan_device(bus, devfn);
-		if (!dev)
-			continue;
-
-		if (func != 0)
+		if (func == 0) {
+			if (!dev)
+				break;
+		} else {
+			if (!dev)
+				continue;
 			dev->multifunction = 1;
+		}
 
 		/* Fix up broken headers */
 		pci_fixup_device(PCI_FIXUP_HEADER, dev);
@@ -647,7 +663,8 @@
 	if (b) {
 		b->sysdata = sysdata;
 		b->ops = ops;
-		b->subordinate = pci_do_scan_bus(b);
+		b->subordinate = pci_scan_child_bus(b);
+		pci_bus_add_devices(b);
 	}
 	return b;
 }
diff -urN linux-2.5.64-bk11/drivers/pci/setup-bus.c linux-2.5.64-bk12/drivers/pci/setup-bus.c
--- linux-2.5.64-bk11/drivers/pci/setup-bus.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/pci/setup-bus.c	Mon Mar 31 12:36:36 2003
@@ -72,40 +72,29 @@
    requires that if there is no I/O ports or memory behind the
    bridge, corresponding range must be turned off by writing base
    value greater than limit to the bridge's base/limit registers.  */
-static void __devinit
-pci_setup_bridge(struct pci_bus *bus)
+static void __devinit pci_setup_bridge(struct pci_bus *bus)
 {
-	struct pbus_set_ranges_data ranges;
 	struct pci_dev *bridge = bus->self;
+	struct pci_bus_region region;
 	u32 l;
 
-	if (!bridge || (bridge->class >> 8) != PCI_CLASS_BRIDGE_PCI)
-		return;
-
-	ranges.io_start = bus->resource[0]->start;
-	ranges.io_end = bus->resource[0]->end;
-	ranges.mem_start = bus->resource[1]->start;
-	ranges.mem_end = bus->resource[1]->end;
-	ranges.prefetch_start = bus->resource[2]->start;
-	ranges.prefetch_end = bus->resource[2]->end;
-	pcibios_fixup_pbus_ranges(bus, &ranges);
-
 	DBGC((KERN_INFO "PCI: Bus %d, bridge: %s\n",
 			bus->number, bridge->dev.name));
 
 	/* Set up the top and bottom of the PCI I/O segment for this bus. */
+	pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
 	if (bus->resource[0]->flags & IORESOURCE_IO) {
 		pci_read_config_dword(bridge, PCI_IO_BASE, &l);
 		l &= 0xffff0000;
-		l |= (ranges.io_start >> 8) & 0x00f0;
-		l |= ranges.io_end & 0xf000;
+		l |= (region.start >> 8) & 0x00f0;
+		l |= region.end & 0xf000;
 		/* Set up upper 16 bits of I/O base/limit. */
 		pci_write_config_word(bridge, PCI_IO_BASE_UPPER16,
-				      ranges.io_start >> 16);
+				      region.start >> 16);
 		pci_write_config_word(bridge, PCI_IO_LIMIT_UPPER16,
-				      ranges.io_end >> 16);
+				      region.end >> 16);
 		DBGC((KERN_INFO "  IO window: %04lx-%04lx\n",
-				ranges.io_start, ranges.io_end));
+				region.start, region.end));
 	}
 	else {
 		/* Clear upper 16 bits of I/O base/limit. */
@@ -117,11 +106,12 @@
 
 	/* Set up the top and bottom of the PCI Memory segment
 	   for this bus. */
+	pcibios_resource_to_bus(bridge, &region, bus->resource[1]);
 	if (bus->resource[1]->flags & IORESOURCE_MEM) {
-		l = (ranges.mem_start >> 16) & 0xfff0;
-		l |= ranges.mem_end & 0xfff00000;
+		l = (region.start >> 16) & 0xfff0;
+		l |= region.end & 0xfff00000;
 		DBGC((KERN_INFO "  MEM window: %08lx-%08lx\n",
-				ranges.mem_start, ranges.mem_end));
+				region.start, region.end));
 	}
 	else {
 		l = 0x0000fff0;
@@ -134,11 +124,12 @@
 	pci_write_config_dword(bridge, PCI_PREF_LIMIT_UPPER32, 0);
 
 	/* Set up PREF base/limit. */
+	pcibios_resource_to_bus(bridge, &region, bus->resource[2]);
 	if (bus->resource[2]->flags & IORESOURCE_PREFETCH) {
-		l = (ranges.prefetch_start >> 16) & 0xfff0;
-		l |= ranges.prefetch_end & 0xfff00000;
+		l = (region.start >> 16) & 0xfff0;
+		l |= region.end & 0xfff00000;
 		DBGC((KERN_INFO "  PREFETCH window: %08lx-%08lx\n",
-				ranges.prefetch_start, ranges.prefetch_end));
+				region.start, region.end));
 	}
 	else {
 		l = 0x0000fff0;
@@ -284,7 +275,7 @@
 				order = 0;
 			/* Exclude ranges with size > align from
 			   calculation of the alignment. */
-			if (size == align)
+			if (r_size == align)
 				aligns[order] += align;
 			if (order > max_order)
 				max_order = order;
diff -urN linux-2.5.64-bk11/drivers/pci/setup-res.c linux-2.5.64-bk12/drivers/pci/setup-res.c
--- linux-2.5.64-bk11/drivers/pci/setup-res.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/pci/setup-res.c	Mon Mar 31 12:36:36 2003
@@ -33,6 +33,59 @@
 #endif
 
 
+static void
+pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
+{
+	struct pci_bus_region region;
+	u32 new, check, mask;
+	int reg;
+
+	pcibios_resource_to_bus(dev, &region, res);
+
+	DBGC((KERN_ERR "  got res [%lx:%lx] bus [%lx:%lx] for "
+	      "resource %d of %s\n", res->start, res->end,
+	      region.start, region.end, resno, dev->dev.name));
+
+	new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
+	if (res->flags & IORESOURCE_IO)
+		mask = (u32)PCI_BASE_ADDRESS_IO_MASK;
+	else
+		mask = (u32)PCI_BASE_ADDRESS_MEM_MASK;
+
+	if (resno < 6) {
+		reg = PCI_BASE_ADDRESS_0 + 4 * resno;
+	} else if (resno == PCI_ROM_RESOURCE) {
+		new |= res->flags & PCI_ROM_ADDRESS_ENABLE;
+		reg = dev->rom_base_reg;
+	} else {
+		/* Hmm, non-standard resource. */
+		printk("PCI: trying to set non-standard region %s/%d\n",
+		       dev->slot_name, resno);
+		return;
+	}
+
+	pci_write_config_dword(dev, reg, new);
+	pci_read_config_dword(dev, reg, &check);
+
+	if ((new ^ check) & mask) {
+		printk(KERN_ERR "PCI: Error while updating region "
+		       "%s/%d (%08x != %08x)\n", dev->slot_name, resno,
+		       new, check);
+	}
+
+	if ((new & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
+	    (PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64)) {
+		new = 0; /* currently everyone zeros the high address */
+		pci_write_config_dword(dev, reg + 4, new);
+		pci_read_config_dword(dev, reg + 4, &check);
+		if (check != new) {
+			printk(KERN_ERR "PCI: Error updating region "
+			       "%s/%d (high %08x != %08x)\n",
+			       dev->slot_name, resno, new, check);
+		}
+	}
+}
+
 int __init
 pci_claim_resource(struct pci_dev *dev, int resource)
 {
@@ -89,10 +142,7 @@
 		printk(KERN_ERR "PCI: Failed to allocate resource %d(%lx-%lx) for %s\n",
 		       resno, res->start, res->end, dev->slot_name);
 	} else {
-		DBGC((KERN_ERR "  got res[%lx:%lx] for resource %d of %s\n",
-		      res->start, res->end, i, dev->dev.name));
-		/* Update PCI config space.  */
-		pcibios_update_resource(dev, res->parent, res, resno);
+		pci_update_resource(dev, res, resno);
 	}
 
 	return ret;
diff -urN linux-2.5.64-bk11/drivers/scsi/aacraid/linit.c linux-2.5.64-bk12/drivers/scsi/aacraid/linit.c
--- linux-2.5.64-bk11/drivers/scsi/aacraid/linit.c	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/drivers/scsi/aacraid/linit.c	Mon Mar 31 12:36:37 2003
@@ -679,27 +679,26 @@
  */
  
 static Scsi_Host_Template driver_template = {
-	module:			THIS_MODULE,
-	name:           	"AAC",
-	proc_info:      	aac_procinfo,
-	detect:         	aac_detect,
-	release:        	aac_release,
-	info:           	aac_driverinfo,
-	ioctl:          	aac_ioctl,
-	queuecommand:   	aac_queuecommand,
-	bios_param:     	aac_biosparm,	
-	slave_configure:	aac_slave_configure,
-	can_queue:      	AAC_NUM_IO_FIB,	
-	this_id:        	16,
-	sg_tablesize:   	16,
-	max_sectors:    	128,
-	cmd_per_lun:    	AAC_NUM_IO_FIB,
-	eh_abort_handler:       aac_eh_abort,
-	eh_device_reset_handler:aac_eh_device_reset,
-	eh_bus_reset_handler:	aac_eh_bus_reset,
-	eh_host_reset_handler:	aac_eh_reset,
-
-	use_clustering:		ENABLE_CLUSTERING,
+	.module				= THIS_MODULE,
+	.name           		= "AAC",
+	.proc_info      		= aac_procinfo,
+	.detect         		= aac_detect,
+	.release        		= aac_release,
+	.info           		= aac_driverinfo,
+	.ioctl          		= aac_ioctl,
+	.queuecommand   		= aac_queuecommand,
+	.bios_param     		= aac_biosparm,	
+	.slave_configure		= aac_slave_configure,
+	.can_queue      		= AAC_NUM_IO_FIB,	
+	.this_id        		= 16,
+	.sg_tablesize   		= 16,
+	.max_sectors    		= 128,
+	.cmd_per_lun    		= 1,
+	.eh_abort_handler       	= aac_eh_abort,
+	.eh_device_reset_handler 	= aac_eh_device_reset,
+	.eh_bus_reset_handler		= aac_eh_bus_reset,
+	.eh_host_reset_handler		= aac_eh_reset,
+	.use_clustering			= ENABLE_CLUSTERING,
 };
 
 #include "scsi_module.c"
diff -urN linux-2.5.64-bk11/drivers/scsi/hosts.h linux-2.5.64-bk12/drivers/scsi/hosts.h
--- linux-2.5.64-bk11/drivers/scsi/hosts.h	Tue Mar  4 19:29:15 2003
+++ linux-2.5.64-bk12/drivers/scsi/hosts.h	Mon Mar 31 12:36:37 2003
@@ -549,6 +549,7 @@
     void (*detach)(Scsi_Device *);
     int (*init_command)(Scsi_Cmnd *);     /* Used by new queueing code. 
                                            Selects command for blkdevs */
+    void (*rescan)(Scsi_Device *);
     struct device_driver scsi_driverfs_driver;
 };
 
diff -urN linux-2.5.64-bk11/drivers/scsi/osst.c linux-2.5.64-bk12/drivers/scsi/osst.c
--- linux-2.5.64-bk11/drivers/scsi/osst.c	Tue Mar  4 19:29:18 2003
+++ linux-2.5.64-bk12/drivers/scsi/osst.c	Mon Mar 31 12:36:37 2003
@@ -606,7 +606,7 @@
 {
 	unsigned char	cmd[MAX_COMMAND_SIZE];
 	Scsi_Request  * SRpnt;
-	long		startwait = jiffies;
+	unsigned long	startwait = jiffies;
 #if DEBUG
 	int		dbg  = debugging;
 	char          * name = tape_name(STp);
@@ -673,7 +673,7 @@
 {
 	unsigned char	cmd[MAX_COMMAND_SIZE];
 	Scsi_Request  * SRpnt;
-	long		startwait = jiffies;
+	unsigned long	startwait = jiffies;
 #if DEBUG
 	int		dbg = debugging;
 	char          * name = tape_name(STp);
@@ -777,8 +777,8 @@
 #define OSST_POLL_PER_SEC 10
 static int osst_wait_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int curr, int minlast, int to)
 {
-	long	startwait     = jiffies;
-	char  * name          = tape_name(STp);
+	unsigned long	startwait     = jiffies;
+	char	      * name          = tape_name(STp);
 #if DEBUG
 	char	notyetprinted = 1;
 #endif
@@ -1288,7 +1288,7 @@
 	int             logical_blk_num  = ntohl(STp->buffer->aux->logical_blk_num) 
 						- (nframes + pending - 1) * blks_per_frame;
 	char          * name             = tape_name(STp);
-	long		startwait        = jiffies;
+	unsigned long	startwait        = jiffies;
 #if DEBUG
 	int		dbg              = debugging;
 #endif
@@ -1477,7 +1477,7 @@
 	int		expected  = 0;
 	int		attempts  = 1000 / skip;
 	int		flag      = 1;
-	long		startwait = jiffies;
+	unsigned long	startwait = jiffies;
 #if DEBUG
 	int		dbg       = debugging;
 #endif
diff -urN linux-2.5.64-bk11/drivers/scsi/qlogicfc.c linux-2.5.64-bk12/drivers/scsi/qlogicfc.c
--- linux-2.5.64-bk11/drivers/scsi/qlogicfc.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/scsi/qlogicfc.c	Mon Mar 31 12:36:37 2003
@@ -836,14 +836,22 @@
 
 	short param[8];
 	int i, j;
-	struct id_name_map temp[QLOGICFC_MAX_ID + 1];
+	struct id_name_map *map; /* base of array [QLOGICFC_MAX_ID + 1] */
+	struct id_name_map *mapx; /* array entry pointer */
 	struct isp2x00_hostdata *hostdata;
 
-	isp2x00_disable_irqs(host);
-
-	memset(temp, 0, sizeof(temp));
 	hostdata = (struct isp2x00_hostdata *) host->hostdata;
 
+	map = kmalloc((QLOGICFC_MAX_ID + 1) * sizeof(struct id_name_map), GFP_ATOMIC);
+	if (!map) {
+	        printk("qlogicfc%d : error getting memory -- cannot make port database.\n",
+				hostdata->host_id);
+		goto fini;
+	}
+	memset(map, 0, (QLOGICFC_MAX_ID + 1) * sizeof(struct id_name_map));
+
+	isp2x00_disable_irqs(host);
+
 #if ISP2x00_FABRIC
 	for (i = 0x81; i < QLOGICFC_MAX_ID; i++) {
 		param[0] = MBOX_PORT_LOGOUT;
@@ -868,72 +876,74 @@
 	if (param[0] == MBOX_COMMAND_COMPLETE) {
 		hostdata->port_id = ((u_int) param[3]) << 16;
 		hostdata->port_id |= param[2];
-		temp[0].loop_id = param[1];
-		temp[0].wwn = hostdata->wwn;
+		map->loop_id = param[1];
+		map->wwn = hostdata->wwn;
 	}
 	else {
 	        printk("qlogicfc%d : error getting scsi id.\n", hostdata->host_id);
 	}
 
-        for (i = 0; i <=QLOGICFC_MAX_ID; i++)
-                temp[i].loop_id = temp[0].loop_id;
+        for (i = 0, mapx = map; i <= QLOGICFC_MAX_ID; i++, mapx++)
+                mapx->loop_id = map->loop_id;
    
-        for (i = 0, j = 1; i <= QLOGICFC_MAX_LOOP_ID; i++) {
+        for (i = 0, j = 1, mapx = map + 1; i <= QLOGICFC_MAX_LOOP_ID; i++) {
                 param[0] = MBOX_GET_PORT_NAME;
 		param[1] = (i << 8) & 0xff00;
 
 		isp2x00_mbox_command(host, param);
 
 		if (param[0] == MBOX_COMMAND_COMPLETE) {
-			temp[j].loop_id = i;
-			temp[j].wwn = ((u64) (param[2] & 0xff)) << 56;
-			temp[j].wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48;
-			temp[j].wwn |= ((u64) (param[3] & 0xff)) << 40;
-			temp[j].wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32;
-			temp[j].wwn |= ((u64) (param[6] & 0xff)) << 24;
-			temp[j].wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16;
-			temp[j].wwn |= ((u64) (param[7] & 0xff)) << 8;
-			temp[j].wwn |= ((u64) ((param[7] >> 8) & 0xff));
+			mapx->loop_id = i;
+			mapx->wwn = ((u64) (param[2] & 0xff)) << 56;
+			mapx->wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48;
+			mapx->wwn |= ((u64) (param[3] & 0xff)) << 40;
+			mapx->wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32;
+			mapx->wwn |= ((u64) (param[6] & 0xff)) << 24;
+			mapx->wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16;
+			mapx->wwn |= ((u64) (param[7] & 0xff)) << 8;
+			mapx->wwn |= ((u64) ((param[7] >> 8) & 0xff));
 
 			j++;
-
+			mapx++;
 		}
 	}
 
 
 #if ISP2x00_FABRIC
-	isp2x00_init_fabric(host, temp, j);
+	isp2x00_init_fabric(host, map, j);
 #endif
 
-	for (i = 0; i <= QLOGICFC_MAX_ID; i++) {
-		if (temp[i].wwn != hostdata->port_db[i].wwn) {
-			for (j = 0; j <= QLOGICFC_MAX_ID; j++) {
-				if (temp[j].wwn == hostdata->port_db[i].wwn) {
-					hostdata->port_db[i].loop_id = temp[j].loop_id;
+	for (i = 0, mapx = map; i <= QLOGICFC_MAX_ID; i++, mapx++) {
+		struct id_name_map *tmap; /* second array entry pointer */
+		if (mapx->wwn != hostdata->port_db[i].wwn) {
+			for (j = 0, tmap = map; j <= QLOGICFC_MAX_ID; j++, tmap++) {
+				if (tmap->wwn == hostdata->port_db[i].wwn) {
+					hostdata->port_db[i].loop_id = tmap->loop_id;
 					break;
 				}
 			}
 			if (j == QLOGICFC_MAX_ID + 1)
-				hostdata->port_db[i].loop_id = temp[0].loop_id;
+				hostdata->port_db[i].loop_id = map->loop_id;
 
 			for (j = 0; j <= QLOGICFC_MAX_ID; j++) {
-				if (hostdata->port_db[j].wwn == temp[i].wwn || !hostdata->port_db[j].wwn) {
+				if (hostdata->port_db[j].wwn == mapx->wwn || !hostdata->port_db[j].wwn) {
 					break;
 				}
 			}
 			if (j == QLOGICFC_MAX_ID + 1)
 				printk("qlogicfc%d : Too many scsi devices, no more room in port map.\n", hostdata->host_id);
 			if (!hostdata->port_db[j].wwn) {
-				hostdata->port_db[j].loop_id = temp[i].loop_id;
-				hostdata->port_db[j].wwn = temp[i].wwn;
+				hostdata->port_db[j].loop_id = mapx->loop_id;
+				hostdata->port_db[j].wwn = mapx->wwn;
 			}
 		} else
-			hostdata->port_db[i].loop_id = temp[i].loop_id;
+			hostdata->port_db[i].loop_id = mapx->loop_id;
 
 	}
 
 	isp2x00_enable_irqs(host);
-
+	kfree(map);
+fini:
 	return 0;
 }
 
diff -urN linux-2.5.64-bk11/drivers/scsi/scsi.c linux-2.5.64-bk12/drivers/scsi/scsi.c
--- linux-2.5.64-bk11/drivers/scsi/scsi.c	Tue Mar  4 19:29:19 2003
+++ linux-2.5.64-bk12/drivers/scsi/scsi.c	Mon Mar 31 12:36:37 2003
@@ -96,12 +96,7 @@
 Scsi_Cmnd *last_cmnd;
 static unsigned long serial_number;
 
-struct softscsi_data {
-	Scsi_Cmnd *head;
-	Scsi_Cmnd *tail;
-};
-
-static struct softscsi_data softscsi_data[NR_CPUS] __cacheline_aligned;
+static struct list_head done_q[NR_CPUS] __cacheline_aligned;
 
 /*
  * List of all highlevel drivers.
@@ -637,79 +632,60 @@
 }
 
 /**
- * scsi_done - Mark this command as done
- * @SCpnt: The SCSI Command which we think we've completed.
+ * scsi_done - Enqueue the finished SCSI command into the done queue.
+ * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives
+ * ownership back to SCSI Core -- i.e. the LLDD has finished with it.
  *
- * This function is the mid-level interrupt routine, which decides how
- * to handle error conditions.  Each invocation of this function must
- * do one and *only* one of the following:
+ * This function is the mid-level's (SCSI Core) interrupt routine, which
+ * regains ownership of the SCSI command (de facto) from a LLDD, and enqueues
+ * the command to the done queue for further processing.
  *
- *      1) Insert command in BH queue.
- *      2) Activate error handler for host.
+ * This is the producer of the done queue who enqueues at the tail.
  *
- * There is no longer a problem with stack overflow.  Interrupts queue
- * Scsi_Cmnd on a per-CPU queue and the softirq handler removes them
- * from the queue one at a time.
- *
- * This function is sometimes called from interrupt context, but sometimes
- * from task context.
+ * This function is interrupt context safe.
  */
-void scsi_done(Scsi_Cmnd * SCpnt)
+void scsi_done(struct scsi_cmnd *cmd)
 {
+	int cpu;
 	unsigned long flags;
-	int cpu, tstatus;
-	struct softscsi_data *queue;
+	struct list_head *pdone_q;
 
 	/*
 	 * We don't have to worry about this one timing out any more.
-	 */
-	tstatus = scsi_delete_timer(SCpnt);
-
-	/*
-	 * If we are unable to remove the timer, it means that the command
-	 * has already timed out.  In this case, we have no choice but to
+	 * If we are unable to remove the timer, then the command
+	 * has already timed out.  In which case, we have no choice but to
 	 * let the timeout function run, as we have no idea where in fact
 	 * that function could really be.  It might be on another processor,
 	 * etc, etc.
 	 */
-	if (!tstatus) {
+	if (!scsi_delete_timer(cmd))
 		return;
-	}
 
 	/* Set the serial numbers back to zero */
-	SCpnt->serial_number = 0;
-	SCpnt->serial_number_at_timeout = 0;
-	SCpnt->state = SCSI_STATE_BHQUEUE;
-	SCpnt->owner = SCSI_OWNER_BH_HANDLER;
-	SCpnt->bh_next = NULL;
+	cmd->serial_number = 0;
+	cmd->serial_number_at_timeout = 0;
+	cmd->state = SCSI_STATE_BHQUEUE;
+	cmd->owner = SCSI_OWNER_BH_HANDLER;
 
 	/*
-	 * Next, put this command in the softirq queue.
-	 *
-	 * This is a per-CPU queue, so we just disable local interrupts
+	 * Next, enqueue the command into the done queue.
+	 * It is a per-CPU queue, so we just disable local interrupts
 	 * and need no spinlock.
 	 */
-
 	local_irq_save(flags);
 
 	cpu = smp_processor_id();
-	queue = &softscsi_data[cpu];
-
-	if (!queue->head) {
-		queue->head = SCpnt;
-		queue->tail = SCpnt;
-	} else {
-		queue->tail->bh_next = SCpnt;
-		queue->tail = SCpnt;
-	}
-
+	pdone_q = &done_q[cpu];
+	list_add_tail(&cmd->eh_entry, pdone_q);
 	cpu_raise_softirq(cpu, SCSI_SOFTIRQ);
 
 	local_irq_restore(flags);
 }
 
 /**
- * scsi_softirq - Perform post-interrupt handling for completed commands
+ * scsi_softirq - Perform post-interrupt processing of finished SCSI commands.
+ *
+ * This is the consumer of the done queue.
  *
  * This is called with all interrupts enabled.  This should reduce
  * interrupt latency, stack depth, and reentrancy of the low-level
@@ -717,88 +693,92 @@
  */
 static void scsi_softirq(struct softirq_action *h)
 {
-	int cpu = smp_processor_id();
-	struct softscsi_data *queue = &softscsi_data[cpu];
+	LIST_HEAD(local_q);
 
-	while (queue->head) {
-		Scsi_Cmnd *SCpnt, *SCnext;
+	local_irq_disable();
+	list_splice_init(&done_q[smp_processor_id()], &local_q);
+	local_irq_enable();
+
+	while (!list_empty(&local_q)) {
+		struct scsi_cmnd *cmd = list_entry(local_q.next,
+						   struct scsi_cmnd, eh_entry);
+		list_del_init(&cmd->eh_entry);
 
-		local_irq_disable();
-		SCpnt = queue->head;
-		queue->head = NULL;
-		local_irq_enable();
+		switch (scsi_decide_disposition(cmd)) {
+		case SUCCESS:
+			/*
+			 * Add to BH queue.
+			 */
+			SCSI_LOG_MLCOMPLETE(3,
+					    printk("Command finished %d %d "
+						   "0x%x\n",
+					   cmd->device->host->host_busy,
+					   cmd->device->host->host_failed,
+						   cmd->result));
 
-		for (; SCpnt; SCpnt = SCnext) {
-			SCnext = SCpnt->bh_next;
+			scsi_finish_command(cmd);
+			break;
+		case NEEDS_RETRY:
+			/*
+			 * We only come in here if we want to retry a
+			 * command.  The test to see whether the
+			 * command should be retried should be keeping
+			 * track of the number of tries, so we don't
+			 * end up looping, of course.
+			 */
+			SCSI_LOG_MLCOMPLETE(3, printk("Command needs retry "
+						      "%d %d 0x%x\n",
+					      cmd->device->host->host_busy,
+					      cmd->device->host->host_failed,
+						      cmd->result));
 
-			switch (scsi_decide_disposition(SCpnt)) {
-			case SUCCESS:
-				/*
-				 * Add to BH queue.
-				 */
-				SCSI_LOG_MLCOMPLETE(3, printk("Command finished %d %d 0x%x\n", SCpnt->device->host->host_busy,
-						SCpnt->device->host->host_failed,
-							 SCpnt->result));
-
-				scsi_finish_command(SCpnt);
-				break;
-			case NEEDS_RETRY:
-				/*
-				 * We only come in here if we want to retry a
-				 * command.  The test to see whether the
-				 * command should be retried should be keeping
-				 * track of the number of tries, so we don't
-				 * end up looping, of course.
-				 */
-				SCSI_LOG_MLCOMPLETE(3, printk("Command needs retry %d %d 0x%x\n", SCpnt->device->host->host_busy,
-				SCpnt->device->host->host_failed, SCpnt->result));
+			scsi_retry_command(cmd);
+			break;
+		case ADD_TO_MLQUEUE:
+			/* 
+			 * This typically happens for a QUEUE_FULL
+			 * message - typically only when the queue
+			 * depth is only approximate for a given
+			 * device.  Adding a command to the queue for
+			 * the device will prevent further commands
+			 * from being sent to the device, so we
+			 * shouldn't end up with tons of things being
+			 * sent down that shouldn't be.
+			 */
+			SCSI_LOG_MLCOMPLETE(3, printk("Command rejected as "
+						      "device queue full, "
+						      "put on ml queue %p\n",
+						      cmd));
+			scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY);
+			break;
+		default:
+			/*
+			 * Here we have a fatal error of some sort.
+			 * Turn it over to the error handler.
+			 */
+			SCSI_LOG_MLCOMPLETE(3,
+					    printk("Command failed %p %x "
+						   "busy=%d failed=%d\n",
+						   cmd, cmd->result,
+					   cmd->device->host->host_busy,
+					   cmd->device->host->host_failed));
 
-				scsi_retry_command(SCpnt);
-				break;
-			case ADD_TO_MLQUEUE:
-				/* 
-				 * This typically happens for a QUEUE_FULL
-				 * message - typically only when the queue
-				 * depth is only approximate for a given
-				 * device.  Adding a command to the queue for
-				 * the device will prevent further commands
-				 * from being sent to the device, so we
-				 * shouldn't end up with tons of things being
-				 * sent down that shouldn't be.
-				 */
-				SCSI_LOG_MLCOMPLETE(3, printk("Command rejected as device queue full, put on ml queue %p\n",
-                                                              SCpnt));
-				scsi_queue_insert(SCpnt, SCSI_MLQUEUE_DEVICE_BUSY);
-				break;
-			default:
-				/*
-				 * Here we have a fatal error of some sort.
-				 * Turn it over to the error handler.
-				 */
-				SCSI_LOG_MLCOMPLETE(3,
-					printk("Command failed %p %x busy=%d failed=%d\n",
-						SCpnt, SCpnt->result,
-						SCpnt->device->host->host_busy,
-						SCpnt->device->host->host_failed));
+			/*
+			 * Dump the sense information too.
+			 */
+			if ((status_byte(cmd->result)&CHECK_CONDITION) != 0) {
+				SCSI_LOG_MLCOMPLETE(3, print_sense("bh", cmd));
+			}
 
+			if (!scsi_eh_scmd_add(cmd, 0)) {
 				/*
-				 * Dump the sense information too.
+				 * We only get here if the error
+				 * recovery thread has died.
 				 */
-				if ((status_byte(SCpnt->result) & CHECK_CONDITION) != 0) {
-					SCSI_LOG_MLCOMPLETE(3, print_sense("bh", SCpnt));
-				}
-
-				if (!scsi_eh_scmd_add(SCpnt, 0))
-				{
-					/*
-					 * We only get here if the error
-					 * recovery thread has died.
-					 */
-					scsi_finish_command(SCpnt);
-				}
-			}	/* switch */
-		}		/* for(; SCpnt...) */
-	}			/* while(queue->head) */
+				scsi_finish_command(cmd);
+			}
+		}
+	}
 }
 
 /*
@@ -1284,6 +1264,21 @@
 	up_read(&scsi_devicelist_mutex);
 }
 
+void scsi_rescan_device(struct scsi_device *sdev)
+{
+	struct Scsi_Device_Template *sdt;
+
+	down_read(&scsi_devicelist_mutex);
+	list_for_each_entry(sdt, &scsi_devicelist, list) {
+		if (!try_module_get(sdt->module))
+			continue;
+		if (*sdt->rescan)
+			(*sdt->rescan)(sdev);
+		module_put(sdt->module);
+	}
+	up_read(&scsi_devicelist_mutex);
+}
+
 int scsi_device_get(struct scsi_device *sdev)
 {
 	if (!try_module_get(sdev->host->hostt->module))
@@ -1481,7 +1476,7 @@
 
 static int __init init_scsi(void)
 {
-	int error;
+	int error, i;
 
 	error = scsi_init_queue();
 	if (error)
@@ -1496,6 +1491,9 @@
 	if (error)
 		goto cleanup_devlist;
 
+	for (i = 0; i < NR_CPUS; i++)
+		INIT_LIST_HEAD(&done_q[i]);
+
 	scsi_host_init();
 	devfs_mk_dir(NULL, "scsi", NULL);
 	open_softirq(SCSI_SOFTIRQ, scsi_softirq, NULL);
diff -urN linux-2.5.64-bk11/drivers/scsi/scsi.h linux-2.5.64-bk12/drivers/scsi/scsi.h
--- linux-2.5.64-bk11/drivers/scsi/scsi.h	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/scsi/scsi.h	Mon Mar 31 12:36:37 2003
@@ -741,8 +741,7 @@
 	 * abort, etc are in process. 
 	 */
 	unsigned volatile char internal_timeout;
-	struct scsi_cmnd *bh_next;	/* To enumerate the commands waiting 
-					   to be processed. */
+
 	unsigned char cmd_len;
 	unsigned char old_cmd_len;
 	unsigned char sc_data_direction;
diff -urN linux-2.5.64-bk11/drivers/scsi/scsi_debug.c linux-2.5.64-bk12/drivers/scsi/scsi_debug.c
--- linux-2.5.64-bk11/drivers/scsi/scsi_debug.c	Tue Mar  4 19:29:24 2003
+++ linux-2.5.64-bk12/drivers/scsi/scsi_debug.c	Mon Mar 31 12:36:37 2003
@@ -11,7 +11,7 @@
  *  (or disk like devices) sharing a common amount of RAM 
  *  
  *
- *  For documentation see http://www.torque.net/sg/sdebug.html
+ *  For documentation see http://www.torque.net/sg/sdebug25.html
  *
  *   D. Gilbert (dpg) work for Magneto-Optical device test [20010421]
  *   dpg: work for devfs large number of disks [20010809]
@@ -54,38 +54,37 @@
 
 #include "scsi_debug.h"
 
-static const char * scsi_debug_version_str = "Version: 1.67 (20021221)";
-
-#ifndef SCSI_CMD_READ_16
-#define SCSI_CMD_READ_16 0x88
-#endif
-#ifndef SCSI_CMD_WRITE_16
-#define SCSI_CMD_WRITE_16 0x8a
-#endif
+static const char * scsi_debug_version_str = "Version: 1.68 (20030314)";
 
 #define SDEBUG_TAGGED_QUEUING 0 /* 0 | MSG_SIMPLE_TAG | MSG_ORDERED_TAG */
 
 /* Default values for driver parameters */
 #define DEF_NUM_DEVS   1
 #define DEF_DEV_SIZE_MB   8
-#define DEF_EVERY_NTH   100
+#define DEF_EVERY_NTH   0
 #define DEF_DELAY   1
 #define DEF_MAX_LUNS   2
 #define DEF_SCSI_LEVEL   3
 #define DEF_NUM_HOST   1
 #define DEF_OPTS   0
 
-#define MAX_NUM_HOSTS   128
-
 /* bit mask values for scsi_debug_opts */
 #define SCSI_DEBUG_OPT_NOISE   1
 #define SCSI_DEBUG_OPT_MEDIUM_ERR   2
-#define SCSI_DEBUG_OPT_EVERY_NTH   4
+#define SCSI_DEBUG_OPT_TIMEOUT   4
+#define SCSI_DEBUG_OPT_RECOVERED_ERR   8
+/* When "every_nth" > 0 then modulo "every_nth" commands:
+ *   - a no response is simulated if SCSI_DEBUG_OPT_TIMEOUT is set
+ *   - a RECOVERED_ERROR is simulated on successful read and write
+ *     commands if SCSI_DEBUG_OPT_RECOVERED_ERR is set.
+ */
 
-#define OPT_MEDIUM_ERR_ADDR   0x1234
+/* when 1==SCSI_DEBUG_OPT_MEDIUM_ERR, a medium error is simulated at this
+ * sector on read commands: */
+#define OPT_MEDIUM_ERR_ADDR   0x1234 /* that's sector 4660 in decimal */
 
 static int scsi_debug_dev_size_mb = DEF_DEV_SIZE_MB;
-static int scsi_debug_num_devs = DEF_NUM_DEVS;
+static int scsi_debug_num_devs = DEF_NUM_DEVS; /* max devs per host */
 static int scsi_debug_opts = DEF_OPTS;
 static int scsi_debug_every_nth = DEF_EVERY_NTH;
 static int scsi_debug_cmnd_count = 0;
@@ -112,25 +111,28 @@
 #define SECT_SIZE (1 << POW2_SECT_SIZE)
 #define SECT_SIZE_PER(TGT) SECT_SIZE
 
-struct sdebug_host_info {
-	struct Scsi_Host *shost;
-	struct device *dev;
-};
-
-struct sdebug_host_info * scsi_debug_hosts;
-
 #define SDEBUG_SENSE_LEN 32
 
 struct sdebug_dev_info {
+	struct list_head dev_list;
 	unsigned char sense_buff[SDEBUG_SENSE_LEN];	/* weak nexus */
 	unsigned int channel;
 	unsigned int target;
 	unsigned int lun;
-	struct Scsi_Host *host;
+	struct sdebug_host_info *sdbg_host;
 	char reset;
 	char used;
 };
-static struct sdebug_dev_info * devInfop;
+
+struct sdebug_host_info {
+	struct list_head host_list;
+	struct Scsi_Host *shost;
+	struct device *dev;
+	struct list_head dev_info_list;
+};
+
+static LIST_HEAD(sdebug_host_list);
+static spinlock_t sdebug_host_list_lock = SPIN_LOCK_UNLOCKED;
 
 typedef void (* done_funct_t) (struct scsi_cmnd *);
 
@@ -156,11 +158,20 @@
 static rwlock_t atomic_rw = RW_LOCK_UNLOCKED;
 
 static char sdebug_proc_name[] = "scsi_debug";
+
+static int sdebug_driver_probe(struct device *);
+static int sdebug_driver_remove(struct device *);
+
 static struct device_driver sdebug_driverfs_driver = {
-	.name = sdebug_proc_name,
-	.devclass = &shost_devclass,
+	.name 		= sdebug_proc_name,
+	.probe          = sdebug_driver_probe,
+	.remove         = sdebug_driver_remove,
+	.devclass 	= &shost_devclass,
 };
 
+static const int check_condition_result = 
+		(DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
+
 /* function declarations */
 static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff,
 			int bufflen, struct sdebug_dev_info * devip);
@@ -174,7 +185,7 @@
 static int resp_report_luns(unsigned char * cmd, unsigned char * buff,
 			    int bufflen, struct sdebug_dev_info * devip);
 static void timer_intr_handler(unsigned long);
-static struct sdebug_dev_info * devInfoReg(struct scsi_cmnd *scmd);
+static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev);
 static void mk_sense_buffer(struct sdebug_dev_info * devip, int key, 
 			    int asc, int asq, int inbandLen);
 static int check_reset(struct scsi_cmnd * SCpnt, 
@@ -189,15 +200,29 @@
                            const char * dev_id_str, int dev_id_str_len);
 static void do_create_driverfs_files(void);
 static void do_remove_driverfs_files(void);
-static void sdebug_add_shost(int num);
-static void sdebug_remove_shost(int num);
 
-static int sdebug_add_adapter(int num);
-static void sdebug_remove_adapter(int num);
+static int sdebug_add_adapter(void);
+static void sdebug_remove_adapter(void);
 static struct device pseudo_primary;
 static struct bus_type pseudo_lld_bus;
-int scsi_debug_register_driver(struct device_driver *);
-int scsi_debug_unregister_driver(struct device_driver *);
+static int scsi_debug_register_driver(struct device_driver *);
+static int scsi_debug_unregister_driver(struct device_driver *);
+
+static struct sdebug_host_info * 
+		sdebug_shost_to_host_info(struct Scsi_Host *shost)
+{
+	struct sdebug_host_info * sdbg_host, * found = NULL;
+
+	spin_lock(&sdebug_host_list_lock);
+	list_for_each_entry(sdbg_host, &sdebug_host_list, host_list) {
+		if (sdbg_host->shost == shost) {
+			found = sdbg_host;
+			break;
+		}
+	}
+	spin_unlock(&sdebug_host_list_lock);
+	return found;
+}
 
 static unsigned char * scatg2virt(const struct scatterlist * sclp)
 {
@@ -222,6 +247,7 @@
 	unsigned long capac;
 	struct sdebug_dev_info * devip = NULL;
 	unsigned char * sbuff;
+	int inj_recovered = 0;
 
 	if (done == NULL)
 		return 0;	/* assume mid level reprocessing command */
@@ -250,16 +276,18 @@
 	if (SCpnt->device->lun >= scsi_debug_max_luns)
 		return schedule_resp(SCpnt, NULL, done, 
 				     DID_NO_CONNECT << 16, 0);
-	devip = devInfoReg(SCpnt);
+	devip = devInfoReg(SCpnt->device);
 	if (NULL == devip)
 		return schedule_resp(SCpnt, NULL, done, 
 				     DID_NO_CONNECT << 16, 0);
 
-        if ((SCSI_DEBUG_OPT_EVERY_NTH & scsi_debug_opts) &&
-            (scsi_debug_every_nth > 0) &&
+        if ((scsi_debug_every_nth > 0) &&
             (++scsi_debug_cmnd_count >= scsi_debug_every_nth)) {
                 scsi_debug_cmnd_count =0;
-                return 0; /* ignore command causing timeout */
+		if (SCSI_DEBUG_OPT_TIMEOUT & scsi_debug_opts)
+			return 0; /* ignore command causing timeout */
+		else if (SCSI_DEBUG_OPT_RECOVERED_ERR & scsi_debug_opts)
+			inj_recovered = 1; /* to reads and writes below */
         }
 
 	switch (*cmd) {
@@ -269,8 +297,8 @@
 	case REQUEST_SENSE:	/* mandatory */
 		/* Since this driver indicates autosense by placing the
 		 * sense buffer in the scsi_cmnd structure in the response
-		 * (when CHECK_CONDITION is set), the mid level shouldn't
-		 * need to call REQUEST_SENSE */
+		 * (when SAM_STAT_CHECK_CONDITION is set), the mid level
+		 * shouldn't need to call REQUEST_SENSE */
 		if (devip) {
 			sbuff = devip->sense_buff;
 			memcpy(buff, sbuff, (bufflen < SDEBUG_SENSE_LEN) ? 
@@ -326,14 +354,14 @@
 			buff[7] = SECT_SIZE_PER(target) & 0xff;
 		}
 		break;
-	case SCSI_CMD_READ_16:	/* SBC-2 */
+	case READ_16:
 	case READ_12:
 	case READ_10:
 	case READ_6:
 		if ((errsts = check_reset(SCpnt, devip)))
 			break;
 		upper_blk = 0;
-		if ((*cmd) == SCSI_CMD_READ_16) {
+		if ((*cmd) == READ_16) {
 			upper_blk = cmd[5] + (cmd[4] << 8) + 
 				    (cmd[3] << 16) + (cmd[2] << 24);
 			block = cmd[9] + (cmd[8] << 8) + 
@@ -355,18 +383,22 @@
 			num = cmd[4];
 		}
 		errsts = resp_read(SCpnt, upper_blk, block, num, devip);
+		if (inj_recovered && (0 == errsts)) {
+			mk_sense_buffer(devip, RECOVERED_ERROR, 0x5d, 0, 14);
+			errsts = check_condition_result;
+		}
 		break;
 	case REPORT_LUNS:
 		errsts = resp_report_luns(cmd, buff, bufflen, devip);
 		break;
-	case SCSI_CMD_WRITE_16:	/* SBC-2 */
+	case WRITE_16:
 	case WRITE_12:
 	case WRITE_10:
 	case WRITE_6:
 		if ((errsts = check_reset(SCpnt, devip)))
 			break;
 		upper_blk = 0;
-		if ((*cmd) == SCSI_CMD_WRITE_16) {
+		if ((*cmd) == WRITE_16) {
 			upper_blk = cmd[5] + (cmd[4] << 8) + 
 				    (cmd[3] << 16) + (cmd[2] << 24);
 			block = cmd[9] + (cmd[8] << 8) + 
@@ -388,6 +420,10 @@
 			num = cmd[4];
 		}
 		errsts = resp_write(SCpnt, upper_blk, block, num, devip);
+		if (inj_recovered && (0 == errsts)) {
+			mk_sense_buffer(devip, RECOVERED_ERROR, 0x5d, 0, 14);
+			errsts = check_condition_result;
+		}
 		break;
 	case MODE_SENSE:
 	case MODE_SENSE_10:
@@ -400,7 +436,7 @@
 		if ((errsts = check_reset(SCpnt, devip)))
 			break;
 		mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x20, 0, 14);
-		errsts = (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+		errsts = check_condition_result;
 		break;
 	}
 	return schedule_resp(SCpnt, devip, done, errsts, scsi_debug_delay);
@@ -420,7 +456,7 @@
 	if (devip->reset) {
 		devip->reset = 0;
 		mk_sense_buffer(devip, UNIT_ATTENTION, 0x29, 0, 14);
-		return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+		return check_condition_result;
 	}
 	return 0;
 }
@@ -481,12 +517,12 @@
 	arr[0] = pq_pdt;
 	if (0x2 & cmd[1]) {  /* CMDDT bit set */
 		mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14);
-		return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+		return check_condition_result;
 	} else if (0x1 & cmd[1]) {  /* EVPD bit set */
 		int dev_id_num, len;
 		char dev_id_str[6];
 		
-		dev_id_num = ((devip->host->host_no + 1) * 2000) +
+		dev_id_num = ((devip->sdbg_host->shost->host_no + 1) * 2000) +
 			     (devip->target * 1000) + devip->lun;
 		len = snprintf(dev_id_str, 6, "%d", dev_id_num);
 		len = (len > 6) ? 6 : len;
@@ -506,7 +542,7 @@
 		} else {
 			/* Illegal request, invalid field in cdb */
 			mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14);
-			return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+			return check_condition_result;
 		}
 		memcpy(buff, arr, min_len); 
 		return 0;
@@ -619,7 +655,7 @@
 	memset(arr, 0, SDEBUG_MAX_MSENSE_SZ);
 	if (0x3 == pcontrol) {  /* Saving values not supported */
 		mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x39, 0, 14);
-		return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+		return check_condition_result;
 	}
 	dev_spec = DEV_READONLY(target) ? 0x80 : 0x0;
 	if (msense_6) {
@@ -662,7 +698,7 @@
 		break;
 	default:
 		mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14);
-		return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+		return check_condition_result;
 	}
 	if (msense_6)
 		arr[0] = offset - 1;
@@ -686,14 +722,14 @@
 
 	if (upper_blk || (block + num > sdebug_capacity)) {
 		mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x21, 0, 14);
-		return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+		return check_condition_result;
 	}
 	if ((SCSI_DEBUG_OPT_MEDIUM_ERR & scsi_debug_opts) &&
-	    (block >= OPT_MEDIUM_ERR_ADDR) && 
-	    (block < (OPT_MEDIUM_ERR_ADDR + num))) {
+	    (block <= OPT_MEDIUM_ERR_ADDR) && 
+	    ((block + num) > OPT_MEDIUM_ERR_ADDR)) {
 		mk_sense_buffer(devip, MEDIUM_ERROR, 0x11, 0, 14);
 		/* claim unrecoverable read error */
-		return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+		return check_condition_result;
 	}
 	read_lock_irqsave(&atomic_rw, iflags);
         sgcount = 0;
@@ -735,7 +771,7 @@
 
 	if (upper_blk || (block + num > sdebug_capacity)) {
 		mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x21, 0, 14);
-		return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+		return check_condition_result;
 	}
 
 	write_lock_irqsave(&atomic_rw, iflags);
@@ -776,7 +812,7 @@
 	alloc_len = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24);
 	if ((alloc_len < 16) || (select_report > 2)) {
 		mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14);
-		return (DRIVER_SENSE << 24) | (CHECK_CONDITION << 1);
+		return check_condition_result;
 	}
 	if (bufflen > 3) {
 		lun_cnt = min((int)(bufflen / sizeof(ScsiLun)),
@@ -810,15 +846,24 @@
 		return;
 	}
 	sqcp->in_use = 0;
-	if (sqcp->done_funct)
+	if (sqcp->done_funct) {
+		sqcp->a_cmnd->result = sqcp->scsi_result;
 		sqcp->done_funct(sqcp->a_cmnd); /* callback to mid level */
+	}
 	sqcp->done_funct = NULL;
 	spin_unlock_irqrestore(&queued_arr_lock, iflags);
 }
 
+static int scsi_debug_slave_alloc(struct scsi_device * sdp)
+{
+	if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
+		printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %u>\n",
+		       sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
+	return 0;
+}
+
 static int scsi_debug_slave_configure(struct scsi_device * sdp)
 {
-	int k;
 	struct sdebug_dev_info * devip; 
 
 	if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
@@ -826,16 +871,8 @@
 		       sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
 	if (sdp->host->max_cmd_len != SCSI_DEBUG_MAX_CMD_LEN)
 		sdp->host->max_cmd_len = SCSI_DEBUG_MAX_CMD_LEN;
-	for (k = 0; k < scsi_debug_num_devs; ++k) {
-		devip = &devInfop[k];
-		if ((devip->channel == sdp->channel) &&
-		    (devip->target == sdp->id) &&
-		    (devip->lun == sdp->lun) &&
-		    (devip->host == sdp->host)) {
-			sdp->hostdata = devip;
-			break;
-		}
-	}
+	devip = devInfoReg(sdp);
+	sdp->hostdata = devip;
 	if (sdp->host->cmd_per_lun)
 		scsi_adjust_queue_depth(sdp, SDEBUG_TAGGED_QUEUING, 
 					sdp->host->cmd_per_lun);
@@ -852,43 +889,47 @@
 		       sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
 	if (devip) {
 		/* make this slot avaliable for re-use */
-		memset(devip, 0, sizeof(struct sdebug_dev_info));
+		devip->used = 0;
 		sdp->hostdata = NULL;
 	}
 }
 
-static struct sdebug_dev_info * devInfoReg(struct scsi_cmnd *scmd)
+static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev)
 {
-	int k;
-	struct scsi_device * sdp = scmd->device;
+	struct sdebug_host_info * sdbg_host;
+	struct sdebug_dev_info * open_devip = NULL;
 	struct sdebug_dev_info * devip =
-			(struct sdebug_dev_info *)sdp->hostdata;
+			(struct sdebug_dev_info *)sdev->hostdata;
 
 	if (devip)
 		return devip;
-	for (k = 0; k < scsi_debug_num_devs; ++k) {
-		devip = &devInfop[k];
-		if ((devip->channel == scmd->device->channel) &&
-		    (devip->target == scmd->device->id) &&
-		    (devip->lun == scmd->device->lun) &&
-		    (devip->host == scmd->device->host))
-			return devip;
-	}
-	for (k = 0; k < scsi_debug_num_devs; ++k) {
-		devip = &devInfop[k];
-		if (!devip->used) {
-			devip->channel = scmd->device->channel;
-			devip->target = scmd->device->id;
-			devip->lun = scmd->device->lun;
-			devip->host = scmd->device->host;
-			devip->reset = 1;
-			devip->used = 1;
-			memset(devip->sense_buff, 0, SDEBUG_SENSE_LEN);
-			devip->sense_buff[0] = 0x70;
-			return devip;
+	sdbg_host = sdebug_shost_to_host_info(sdev->host);
+        if(! sdbg_host) {
+                printk(KERN_ERR "Unable to locate host info\n");
+		return NULL;
+        }
+	list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) {
+		if ((devip->used) && (devip->channel == sdev->channel) &&
+                    (devip->target == sdev->id) &&
+                    (devip->lun == sdev->lun))
+                        return devip;
+		else {
+			if ((!devip->used) && (!open_devip))
+				open_devip = devip;
 		}
 	}
-	return NULL;
+        if (open_devip) {
+		open_devip->channel = sdev->channel;
+		open_devip->target = sdev->id;
+		open_devip->lun = sdev->lun;
+		open_devip->sdbg_host = sdbg_host;
+		open_devip->reset = 1;
+		open_devip->used = 1;
+		memset(open_devip->sense_buff, 0, SDEBUG_SENSE_LEN);
+		open_devip->sense_buff[0] = 0x70;
+		return open_devip;
+        }
+        return NULL;
 }
 
 static void mk_sense_buffer(struct sdebug_dev_info * devip, int key, 
@@ -946,7 +987,7 @@
 		printk(KERN_INFO "scsi_debug: device_reset\n");
 	++num_dev_resets;
 	if (SCpnt) {
-		devip = devInfoReg(SCpnt);
+		devip = devInfoReg(SCpnt->device);
 		if (devip)
 			devip->reset = 1;
 	}
@@ -955,17 +996,21 @@
 
 static int scsi_debug_bus_reset(struct scsi_cmnd * SCpnt)
 {
-	struct scsi_device * sdp;
-	struct Scsi_Host * hp;
-	int k;
+	struct sdebug_host_info *sdbg_host;
+        struct sdebug_dev_info * dev_info;
+        struct scsi_device * sdp;
+        struct Scsi_Host * hp;
 
 	if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
 		printk(KERN_INFO "scsi_debug: bus_reset\n");
 	++num_bus_resets;
-	if (SCpnt && ((sdp = SCpnt->device)) && ((hp = SCpnt->device->host))) {
-		for (k = 0; k < scsi_debug_num_devs; ++k) {
-			if (hp == devInfop[k].host)
-				devInfop[k].reset = 1;
+	if (SCpnt && ((sdp = SCpnt->device)) && ((hp = sdp->host))) {
+		sdbg_host = sdebug_shost_to_host_info(hp);
+		if (sdbg_host) {
+			list_for_each_entry(dev_info,
+                                            &sdbg_host->dev_info_list,
+                                            dev_list)
+				dev_info->reset = 1;
 		}
 	}
 	return SUCCESS;
@@ -973,15 +1018,20 @@
 
 static int scsi_debug_host_reset(struct scsi_cmnd * SCpnt)
 {
-	int k;
+	struct sdebug_host_info * sdbg_host;
+        struct sdebug_dev_info * dev_info;
 
 	if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
 		printk(KERN_INFO "scsi_debug: host_reset\n");
 	++num_host_resets;
-	for (k = 0; k < scsi_debug_num_devs; ++k)
-		devInfop[k].reset = 1;
+        spin_lock(&sdebug_host_list_lock);
+        list_for_each_entry(sdbg_host, &sdebug_host_list, host_list) {
+                list_for_each_entry(dev_info, &sdbg_host->dev_info_list,
+                                    dev_list)
+                        dev_info->reset = 1;
+        }
+        spin_unlock(&sdebug_host_list_lock);
 	stop_all_queued();
-
 	return SUCCESS;
 }
 
@@ -1063,7 +1113,7 @@
 	}
 	if (cmnd && devip) {
 		/* simulate autosense by this driver */
-		if (CHECK_CONDITION == status_byte(scsi_result))
+		if (SAM_STAT_CHECK_CONDITION == (scsi_result & 0xff))
 			memcpy(cmnd->sense_buffer, devip->sense_buff, 
 			       (SCSI_SENSE_BUFFERSIZE > SDEBUG_SENSE_LEN) ?
 			       SDEBUG_SENSE_LEN : SCSI_SENSE_BUFFERSIZE);
@@ -1099,6 +1149,8 @@
 		sqcp->cmnd_timer.expires = jiffies + delta_jiff;
 		add_timer(&sqcp->cmnd_timer);
 		spin_unlock_irqrestore(&queued_arr_lock, iflags);
+		if (cmnd)
+			cmnd->result = 0;
 		return 0;
 	}
 }
@@ -1120,7 +1172,7 @@
 MODULE_DESCRIPTION("SCSI debug adapter driver");
 MODULE_LICENSE("GPL");
 
-MODULE_PARM_DESC(num_devs, "number of SCSI devices to simulate");
+MODULE_PARM_DESC(num_devs, "number of SCSI devices per host to simulate");
 MODULE_PARM_DESC(max_luns, "number of SCSI LUNs per target to simulate");
 MODULE_PARM_DESC(scsi_level, "SCSI level to simulate");
 MODULE_PARM_DESC(dev_size_mb, "size in MB of ram shared by devs");
@@ -1163,7 +1215,7 @@
 		if (1 != sscanf(arr, "%d", &pos))
 			return -EINVAL;
 		scsi_debug_opts = pos;
-		if (SCSI_DEBUG_OPT_EVERY_NTH & scsi_debug_opts)
+		if (scsi_debug_every_nth > 0)
                         scsi_debug_cmnd_count = 0;
 		return length;
 	}
@@ -1192,12 +1244,12 @@
 	return len;
 }
 
-static ssize_t sdebug_delay_read(struct device_driver * ddp, char * buf)
+static ssize_t sdebug_delay_show(struct device_driver * ddp, char * buf) 
 {
-        return sprintf(buf, "%d\n", scsi_debug_delay);
+        return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_delay);
 }
 
-static ssize_t sdebug_delay_write(struct device_driver * ddp, 
+static ssize_t sdebug_delay_store(struct device_driver * ddp, 
 				  const char * buf, size_t count)
 {
         int delay;
@@ -1211,15 +1263,15 @@
 	}
 	return -EINVAL;
 }
-DRIVER_ATTR(delay, S_IRUGO | S_IWUSR, sdebug_delay_read, 
-	    sdebug_delay_write)
+DRIVER_ATTR(delay, S_IRUGO | S_IWUSR, sdebug_delay_show, 
+	    sdebug_delay_store)
 
-static ssize_t sdebug_opts_read(struct device_driver * ddp, char * buf)
+static ssize_t sdebug_opts_show(struct device_driver * ddp, char * buf) 
 {
-        return sprintf(buf, "0x%x\n", scsi_debug_opts);
+        return snprintf(buf, PAGE_SIZE, "0x%x\n", scsi_debug_opts);
 }
 
-static ssize_t sdebug_opts_write(struct device_driver * ddp, 
+static ssize_t sdebug_opts_store(struct device_driver * ddp, 
 				 const char * buf, size_t count)
 {
         int opts;
@@ -1237,50 +1289,76 @@
 	return -EINVAL;
 opts_done:
 	scsi_debug_opts = opts;
+	scsi_debug_cmnd_count = 0;
 	return count;
 }
-DRIVER_ATTR(opts, S_IRUGO | S_IWUSR, sdebug_opts_read, 
-	    sdebug_opts_write)
+DRIVER_ATTR(opts, S_IRUGO | S_IWUSR, sdebug_opts_show, 
+	    sdebug_opts_store)
 
-static ssize_t sdebug_num_devs_read(struct device_driver * ddp, char * buf)
+static ssize_t sdebug_num_devs_show(struct device_driver * ddp, char * buf) 
+{
+        return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_num_devs);
+}
+static ssize_t sdebug_num_devs_store(struct device_driver * ddp, 
+				     const char * buf, size_t count)
 {
-        return sprintf(buf, "%d\n", scsi_debug_num_devs);
+        int n;
+
+	if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) {
+		scsi_debug_num_devs = n;
+		return count;
+	}
+	return -EINVAL;
 }
-DRIVER_ATTR(num_devs, S_IRUGO, sdebug_num_devs_read, NULL) 
+DRIVER_ATTR(num_devs, S_IRUGO | S_IWUSR, sdebug_num_devs_show, 
+	    sdebug_num_devs_store) 
 
-static ssize_t sdebug_dev_size_mb_read(struct device_driver * ddp, char * buf)
+static ssize_t sdebug_dev_size_mb_show(struct device_driver * ddp, char * buf) 
 {
-        return sprintf(buf, "%d\n", scsi_debug_dev_size_mb);
+        return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_dev_size_mb);
 }
-DRIVER_ATTR(dev_size_mb, S_IRUGO, sdebug_dev_size_mb_read, NULL) 
+DRIVER_ATTR(dev_size_mb, S_IRUGO, sdebug_dev_size_mb_show, NULL) 
 
-static ssize_t sdebug_every_nth_read(struct device_driver * ddp, char * buf)
+static ssize_t sdebug_every_nth_show(struct device_driver * ddp, char * buf) 
 {
-        return sprintf(buf, "%d\n", scsi_debug_every_nth);
+        return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_every_nth);
+}
+static ssize_t sdebug_every_nth_store(struct device_driver * ddp, 
+				      const char * buf, size_t count)
+{
+        int nth;
+
+	if ((count > 0) && (1 == sscanf(buf, "%d", &nth)) && (nth >= 0)) {
+		scsi_debug_every_nth = nth;
+		scsi_debug_cmnd_count = 0;
+		return count;
+	}
+	return -EINVAL;
 }
-DRIVER_ATTR(every_nth, S_IRUGO, sdebug_every_nth_read, NULL) 
+DRIVER_ATTR(every_nth, S_IRUGO | S_IWUSR, sdebug_every_nth_show,
+	    sdebug_every_nth_store) 
 
-static ssize_t sdebug_max_luns_read(struct device_driver * ddp, char * buf)
+static ssize_t sdebug_max_luns_show(struct device_driver * ddp, char * buf) 
 {
-        return sprintf(buf, "%d\n", scsi_debug_max_luns);
+        return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_max_luns);
 }
-DRIVER_ATTR(max_luns, S_IRUGO, sdebug_max_luns_read, NULL) 
+DRIVER_ATTR(max_luns, S_IRUGO, sdebug_max_luns_show, NULL) 
 
-static ssize_t sdebug_scsi_level_read(struct device_driver * ddp, char * buf)
+static ssize_t sdebug_scsi_level_show(struct device_driver * ddp, char * buf) 
 {
-        return sprintf(buf, "%d\n", scsi_debug_scsi_level);
+        return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_scsi_level);
 }
-DRIVER_ATTR(scsi_level, S_IRUGO, sdebug_scsi_level_read, NULL) 
+DRIVER_ATTR(scsi_level, S_IRUGO, sdebug_scsi_level_show, NULL) 
 
-static ssize_t sdebug_add_host_read(struct device_driver * ddp, char * buf)
+static ssize_t sdebug_add_host_show(struct device_driver * ddp, char * buf) 
 {
-        return sprintf(buf, "%d\n", scsi_debug_add_host);
+        return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_add_host);
 }
 
-static ssize_t sdebug_add_host_write(struct device_driver * ddp, 
-				  const char * buf, size_t count)
+static ssize_t sdebug_add_host_store(struct device_driver * ddp, 
+				     const char * buf, size_t count)
 {
-        int delta_hosts, k;
+        int delta_hosts;
 	char work[20];
 
         if (1 != sscanf(buf, "%10s", work))
@@ -1297,33 +1375,17 @@
 	}
 	if (delta_hosts > 0) {
 		do {
-			for (k = 0; k < MAX_NUM_HOSTS; ++k) {
-				if (NULL == scsi_debug_hosts[k].shost) {
-					sdebug_add_shost(k);
-					break;
-				}
-			}
-			if (k == MAX_NUM_HOSTS)
-				break;
-			++scsi_debug_add_host;
+			sdebug_add_adapter();
 		} while (--delta_hosts);
 	} else if (delta_hosts < 0) {
 		do {
-			for (k = MAX_NUM_HOSTS - 1; k >= 0; --k) {
-				if (scsi_debug_hosts[k].shost) {
-					sdebug_remove_shost(k);
-					break;
-				}
-			}
-			if (k < 0)
-				break;
-			--scsi_debug_add_host;
+			sdebug_remove_adapter();
 		} while (++delta_hosts);
 	}
 	return count;
 }
-DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_read, 
-	    sdebug_add_host_write)
+DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show, 
+	    sdebug_add_host_store)
 
 static void do_create_driverfs_files()
 {
@@ -1349,44 +1411,10 @@
 	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_delay);
 }
 
-static void sdebug_add_shost(int num)
-{
-	struct Scsi_Host * hpnt;
-	int err;
-
-	if (sdebug_add_adapter(num)){
-		printk(KERN_ERR "sdebug_add_shost: sdebug_add_adapter failed\n");
-		return;
-	}
-	hpnt = scsi_register(&sdebug_driver_template, 0);
-	if (NULL == hpnt) {
-		sdebug_remove_adapter(num);
-		printk(KERN_ERR "sdebug_add_shost: scsi_register failed\n");
-		return;
-	}
-	err = scsi_add_host(hpnt, scsi_debug_hosts[num].dev);
-	if (err) {
-		printk(KERN_ERR "sdebug_add_shost: scsi_add_host failed\n");
-		scsi_unregister(hpnt);
-		sdebug_remove_adapter(num);
-		return;
-	}
-	hpnt->max_lun = scsi_debug_max_luns;
-
-	scsi_debug_hosts[num].shost = hpnt;
-}
-
-static void sdebug_remove_shost(int num)
-{
-	scsi_remove_host(scsi_debug_hosts[num].shost);
-	scsi_unregister(scsi_debug_hosts[num].shost);
-	sdebug_remove_adapter(num);
-	scsi_debug_hosts[num].shost = NULL;
-}
-
 static int __init scsi_debug_init(void)
 {
 	unsigned long sz;
+	int host_to_add;
 	int k;
 
 	sdebug_store_size = (unsigned long)scsi_debug_dev_size_mb * 1048576;
@@ -1409,30 +1437,10 @@
 			       (sdebug_sectors_per * sdebug_heads);
 	}
 
-	if (scsi_debug_num_devs > 0) {
-		sz = sizeof(struct sdebug_dev_info) * scsi_debug_num_devs;
-		devInfop = vmalloc(sz);
-		if (NULL == devInfop) {
-			printk(KERN_ERR "scsi_debug_init: out of memory\n");
-			return -ENOMEM;
-		}
-		memset(devInfop, 0, sz);
-	}
-
-	sz = sizeof(struct sdebug_host_info) * MAX_NUM_HOSTS;
-	scsi_debug_hosts = vmalloc(sz);
-	if (NULL == scsi_debug_hosts) {
-		printk(KERN_ERR "scsi_debug_init: out of memory 1\n");
-		return -ENOMEM;
-	}
-	memset(scsi_debug_hosts, 0, sz);
-
 	sz = sdebug_store_size;
 	fake_storep = vmalloc(sz);
 	if (NULL == fake_storep) {
 		printk(KERN_ERR "scsi_debug_init: out of memory, 1\n");
-		if (devInfop)
-			vfree(devInfop);
 		return -ENOMEM;
 	}
 	memset(fake_storep, 0, sz);
@@ -1446,15 +1454,16 @@
 
 	sdebug_driver_template.proc_name = (char *)sdebug_proc_name;
 
-	for (k = 0; (k < scsi_debug_add_host) && (k < MAX_NUM_HOSTS); k++) {
-		sdebug_add_shost(k);
-		if (NULL == scsi_debug_hosts[k].shost) {
-			printk(KERN_ERR "scsi_debug_init: "
-			       "sdebug_add_shost failed k=%d\n", k);
-			break;
-		}
-	}
-	scsi_debug_add_host = k;        // number of hosts actually present
+	host_to_add = scsi_debug_add_host;
+        scsi_debug_add_host = 0;
+
+        for (k = 0; k < host_to_add; k++) {
+                if (sdebug_add_adapter()) {
+                        printk(KERN_ERR "scsi_debug_init: "
+                               "sdebug_add_adapter failed k=%d\n", k);
+                        break;
+                }
+        }
 
 	if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) {
 		printk(KERN_INFO "scsi_debug: ... built %d host(s)\n",
@@ -1465,13 +1474,7 @@
 
 static void __exit scsi_debug_exit(void)
 {
-	int k;
-
-	for (k = MAX_NUM_HOSTS - 1; k >= 0; --k) {
-		if (scsi_debug_hosts[k].shost) {
-			sdebug_remove_shost(k);
-		}
-	}
+	/* free up adapters here ?? */
 	stop_all_queued();
 	do_remove_driverfs_files();
 	scsi_debug_unregister_driver(&sdebug_driverfs_driver);
@@ -1479,8 +1482,6 @@
 	device_unregister(&pseudo_primary);
 
 	vfree(fake_storep);
-	if (devInfop)
-		vfree(devInfop);
 }
 
 device_initcall(scsi_debug_init);
@@ -1502,7 +1503,7 @@
         .match = pseudo_lld_bus_match,
 };
 
-int scsi_debug_register_driver(struct device_driver *dev_driver)
+static int scsi_debug_register_driver(struct device_driver *dev_driver)
 {
 	dev_driver->bus = &pseudo_lld_bus;
 	driver_register(dev_driver);
@@ -1510,36 +1511,168 @@
 	return 0;
 }
 
-int scsi_debug_unregister_driver(struct device_driver *dev_driver)
+static int scsi_debug_unregister_driver(struct device_driver *dev_driver)
 {
 	driver_unregister(dev_driver);
 	return 0;
 }
 
-static int sdebug_add_adapter(int num)
+static void sdebug_release_adapter(struct device * dev)
 {
-	struct device * dev;
+        kfree(dev);
+}
 
-	dev = kmalloc(sizeof(*dev),GFP_KERNEL);
-	if (NULL == dev) {
-		printk(KERN_ERR "%s: out of memory\n", __FUNCTION__);
-		return 1;
-	}
+static int sdebug_add_adapter()
+{
+        struct device * dev;
+        int error;
+
+        dev = kmalloc(sizeof(*dev),GFP_KERNEL);
+        if (NULL == dev) {
+                printk(KERN_ERR "%s: out of memory at line %d\n",
+                       __FUNCTION__, __LINE__);
+                return -ENOMEM;
+        }
+        memset(dev, 0, sizeof(*dev));
 
-	memset(dev, 0, sizeof(*dev));
-	dev->bus = &pseudo_lld_bus;
-	dev->parent = &pseudo_primary;
-	sprintf(dev->name, "scsi debug adapter");
-	sprintf(dev->bus_id, "adapter%d", num);
+        dev->bus = &pseudo_lld_bus;
+        dev->parent = &pseudo_primary;
+        dev->release = &sdebug_release_adapter;
+        sprintf(dev->name, "scsi debug adapter");
+        sprintf(dev->bus_id, "adapter%d", scsi_debug_add_host);
 
-	device_register(dev);
+        error = device_register(dev);
 
-	scsi_debug_hosts[num].dev = dev;
+        if (error)
+                kfree(dev);
+        else
+                ++scsi_debug_add_host;
 
-	return 0;
+        return error;
+}
+
+static void sdebug_remove_adapter()
+{
+        struct sdebug_host_info * sdbg_host = NULL;
+
+        spin_lock(&sdebug_host_list_lock);
+        if (!list_empty(&sdebug_host_list))
+                sdbg_host = list_entry(sdebug_host_list.prev,
+                                       struct sdebug_host_info, host_list);
+        spin_unlock(&sdebug_host_list_lock);
+
+        device_unregister(sdbg_host->dev);
+        --scsi_debug_add_host;
+}
+
+static int sdebug_driver_probe(struct device * dev)
+{
+	int k;
+        int error = 0;
+        struct sdebug_host_info *sdbg_host;
+        struct sdebug_dev_info *sdbg_devinfo;
+        struct list_head *lh, *lh_sf;
+        struct Scsi_Host *hpnt;
+
+        sdbg_host = kmalloc(sizeof(*sdbg_host),GFP_KERNEL);
+        if (NULL == sdbg_host) {
+                printk(KERN_ERR "%s: out of memory at line %d\n",
+                       __FUNCTION__, __LINE__);
+                return -ENOMEM;
+        }
+        memset(sdbg_host, 0, sizeof(*sdbg_host));
+
+        INIT_LIST_HEAD(&sdbg_host->dev_info_list);
+
+        for (k = 0; k < scsi_debug_num_devs; k++) {
+                sdbg_devinfo = kmalloc(sizeof(*sdbg_devinfo),GFP_KERNEL);
+                if (NULL == sdbg_devinfo) {
+                        printk(KERN_ERR "%s: out of memory at line %d\n",
+                               __FUNCTION__, __LINE__);
+                        error = -ENOMEM;
+                }
+                memset(sdbg_devinfo, 0, sizeof(*sdbg_devinfo));
+                sdbg_devinfo->sdbg_host = sdbg_host;
+                list_add_tail(&sdbg_devinfo->dev_list,
+                              &sdbg_host->dev_info_list);
+        }
+
+        list_add_tail(&sdbg_host->host_list, &sdebug_host_list);
+
+        hpnt = scsi_register(&sdebug_driver_template, 0);
+        if (NULL == hpnt) {
+                printk(KERN_ERR "%s: scsi_register failed\n", __FUNCTION__);
+                error = -ENODEV;
+                goto clean1;
+        }
+
+        sdbg_host->shost = hpnt;
+        sdbg_host->dev = dev;
+        hpnt->max_lun = scsi_debug_max_luns;
+
+        error = scsi_add_host(hpnt, sdbg_host->dev);
+        if (error) {
+                printk(KERN_ERR "%s: scsi_add_host failed\n", __FUNCTION__);
+                error = -ENODEV;
+                goto clean2;
+        }
+
+
+        return 0;
+
+clean2:
+        scsi_unregister(hpnt);
+clean1:
+        list_for_each_safe(lh, lh_sf, &sdbg_host->dev_info_list) {
+                sdbg_devinfo = list_entry(lh, struct sdebug_dev_info,
+                                          dev_list);
+                list_del(&sdbg_devinfo->dev_list);
+                kfree(sdbg_devinfo);
+        }
+
+        kfree(sdbg_host);
+
+        return error;
 }
 
-static void sdebug_remove_adapter(int num)
+static int sdebug_driver_remove(struct device * dev)
 {
-	device_unregister(scsi_debug_hosts[num].dev);
+        struct list_head *lh, *lh_sf;
+        struct sdebug_dev_info *sdbg_devinfo;
+        struct sdebug_host_info *sdbg_host, *found = NULL;
+
+        spin_lock(&sdebug_host_list_lock);
+        list_for_each_entry(sdbg_host, &sdebug_host_list, host_list) {
+                if (sdbg_host->dev == dev) {
+                        list_del(&sdbg_host->host_list);
+                        found = sdbg_host;
+                        break;
+                }
+        }
+        spin_unlock(&sdebug_host_list_lock);
+
+        if (!found) {
+                printk(KERN_ERR "%s: sdebug_host_info not found\n",
+                       __FUNCTION__);
+                return -ENODEV;
+        }
+
+
+        if (scsi_remove_host(sdbg_host->shost)) {
+                printk(KERN_ERR "%s: scsi_remove_host failed\n", __FUNCTION__);
+                return -EBUSY;
+        }
+
+        scsi_unregister(sdbg_host->shost);
+
+        list_for_each_safe(lh, lh_sf, &sdbg_host->dev_info_list) {
+                sdbg_devinfo = list_entry(lh, struct sdebug_dev_info,
+                                          dev_list);
+                list_del(&sdbg_devinfo->dev_list);
+                kfree(sdbg_devinfo);
+        }
+
+        kfree(sdbg_host);
+
+        return 0;
 }
diff -urN linux-2.5.64-bk11/drivers/scsi/scsi_debug.h linux-2.5.64-bk12/drivers/scsi/scsi_debug.h
--- linux-2.5.64-bk11/drivers/scsi/scsi_debug.h	Tue Mar  4 19:29:18 2003
+++ linux-2.5.64-bk12/drivers/scsi/scsi_debug.h	Mon Mar 31 12:36:37 2003
@@ -2,6 +2,7 @@
 
 #include <linux/types.h>
 
+static int scsi_debug_slave_alloc(struct scsi_device *);
 static int scsi_debug_slave_configure(struct scsi_device *);
 static void scsi_debug_slave_destroy(struct scsi_device *);
 static int scsi_debug_queuecommand(struct scsi_cmnd *, 
@@ -27,8 +28,9 @@
 	.proc_info =		scsi_debug_proc_info,
 	.name =			"SCSI DEBUG",
 	.info =			scsi_debug_info,
+	.slave_alloc =		scsi_debug_slave_alloc,
 	.slave_configure =	scsi_debug_slave_configure,
-	.slave_destroy =		scsi_debug_slave_destroy,
+	.slave_destroy =	scsi_debug_slave_destroy,
 	.ioctl =		scsi_debug_ioctl,
 	.queuecommand =		scsi_debug_queuecommand,
 	.eh_abort_handler =	scsi_debug_abort,
diff -urN linux-2.5.64-bk11/drivers/scsi/scsi_error.c linux-2.5.64-bk12/drivers/scsi/scsi_error.c
--- linux-2.5.64-bk11/drivers/scsi/scsi_error.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/scsi/scsi_error.c	Mon Mar 31 12:36:37 2003
@@ -597,28 +597,6 @@
 }
 
 /**
- * scsi_eh_retry_cmd - Retry the original command
- * @scmd:	Original failed SCSI cmd.
- *
- * Notes:
- *    This function will *not* return until the command either times out,
- *    or it completes.
- **/
-static int scsi_eh_retry_cmd(struct scsi_cmnd *scmd)
-{
-	int rtn = SUCCESS;
-
-	for (; scmd->retries < scmd->allowed; scmd->retries++) {
-		scsi_setup_cmd_retry(scmd);
-		rtn = scsi_send_eh_cmnd(scmd, scmd->timeout_per_command);
-		if (rtn != NEEDS_RETRY)
-			break;
-	}
-
-	return rtn;
-}
-
-/**
  * scsi_eh_finish_cmd - Handle a cmd that eh is finished with.
  * @scmd:	Original SCSI cmd that eh has finished.
  * @done_q:	Queue for processed commands.
diff -urN linux-2.5.64-bk11/drivers/scsi/scsi_lib.c linux-2.5.64-bk12/drivers/scsi/scsi_lib.c
--- linux-2.5.64-bk11/drivers/scsi/scsi_lib.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/scsi/scsi_lib.c	Mon Mar 31 12:36:37 2003
@@ -125,7 +125,6 @@
 	 */
 	cmd->state = SCSI_STATE_MLQUEUE;
 	cmd->owner = SCSI_OWNER_MIDLEVEL;
-	cmd->bh_next = NULL;
 
 	/*
 	 * Decrement the counters, since these commands are no longer
diff -urN linux-2.5.64-bk11/drivers/scsi/scsi_scan.c linux-2.5.64-bk12/drivers/scsi/scsi_scan.c
--- linux-2.5.64-bk11/drivers/scsi/scsi_scan.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/scsi/scsi_scan.c	Mon Mar 31 12:36:37 2003
@@ -385,83 +385,92 @@
 	struct scsi_device *sdev, *device;
 
 	sdev = kmalloc(sizeof(*sdev), GFP_ATOMIC);
-	if (sdev != NULL) {
-		memset(sdev, 0, sizeof(Scsi_Device));
-		sdev->vendor = scsi_null_device_strs;
-		sdev->model = scsi_null_device_strs;
-		sdev->rev = scsi_null_device_strs;
-		sdev->host = shost;
-		sdev->id = id;
-		sdev->lun = lun;
-		sdev->channel = channel;
-		sdev->online = TRUE;
-		INIT_LIST_HEAD(&sdev->siblings);
-		INIT_LIST_HEAD(&sdev->same_target_siblings);
-		INIT_LIST_HEAD(&sdev->cmd_list);
-		spin_lock_init(&sdev->list_lock);
-		/*
-		 * Some low level driver could use device->type
-		 */
-		sdev->type = -1;
-		/*
-		 * Assume that the device will have handshaking problems,
-		 * and then fix this field later if it turns out it
-		 * doesn't
-		 */
-		sdev->borken = 1;
-
-		if (!q || *q == NULL) {
-			sdev->request_queue = scsi_alloc_queue(shost);
-			if (!sdev->request_queue)
-				goto out_bail;
-		} else {
-			sdev->request_queue = *q;
-			*q = NULL;
-		}
+	if (!sdev)
+		goto out;
+
+	memset(sdev, 0, sizeof(*sdev));
+	sdev->vendor = scsi_null_device_strs;
+	sdev->model = scsi_null_device_strs;
+	sdev->rev = scsi_null_device_strs;
+	sdev->host = shost;
+	sdev->id = id;
+	sdev->lun = lun;
+	sdev->channel = channel;
+	sdev->online = TRUE;
+	INIT_LIST_HEAD(&sdev->siblings);
+	INIT_LIST_HEAD(&sdev->same_target_siblings);
+	INIT_LIST_HEAD(&sdev->cmd_list);
+	spin_lock_init(&sdev->list_lock);
+
+	/*
+	 * Some low level driver could use device->type
+	 */
+	sdev->type = -1;
+
+	/*
+	 * Assume that the device will have handshaking problems,
+	 * and then fix this field later if it turns out it
+	 * doesn't
+	 */
+	sdev->borken = 1;
+
+	if (!q || *q == NULL) {
+		sdev->request_queue = scsi_alloc_queue(shost);
+		if (!sdev->request_queue)
+			goto out_free_dev;
+	} else {
+		sdev->request_queue = *q;
+		*q = NULL;
+	}
+
+	sdev->request_queue->queuedata = sdev;
+	scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
+	init_waitqueue_head(&sdev->scpnt_wait);
+
+	if (shost->hostt->slave_alloc) {
+		if (shost->hostt->slave_alloc(sdev))
+			goto out_free_queue;
+	}
 
-		sdev->request_queue->queuedata = sdev;
-		scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
-		init_waitqueue_head(&sdev->scpnt_wait);
-
-		if (shost->hostt->slave_alloc)
-			if (shost->hostt->slave_alloc(sdev)) {
-				goto out_bail;
-			}
-		/*
-		 * If there are any same target siblings, add this to the
-		 * sibling list
-		 */
-		list_for_each_entry(device, &shost->my_devices, siblings) {
-			if(device->id == sdev->id &&
-			   device->channel == sdev->channel) {
-				list_add_tail(&sdev->same_target_siblings,
-					      &device->same_target_siblings);
-				sdev->scsi_level = device->scsi_level;
-				break;
-			}
+	/*
+	 * If there are any same target siblings, add this to the
+	 * sibling list
+	 */
+	list_for_each_entry(device, &shost->my_devices, siblings) {
+		if (device->id == sdev->id &&
+		    device->channel == sdev->channel) {
+			list_add_tail(&sdev->same_target_siblings,
+				      &device->same_target_siblings);
+			sdev->scsi_level = device->scsi_level;
+			break;
 		}
-		/*
-		 * If there wasn't another lun already configured at this
-		 * target, then default this device to SCSI_2 until we
-		 * know better
-		 */
-		if(!sdev->scsi_level)
-			sdev->scsi_level = SCSI_2;
-		/*
-		 * Add it to the end of the shost->my_devices list.
-		 */
-		list_add_tail(&sdev->siblings, &shost->my_devices);
-		return (sdev);
 	}
-out_bail:
-	printk(ALLOC_FAILURE_MSG, __FUNCTION__);
+
+	/*
+	 * If there wasn't another lun already configured at this
+	 * target, then default this device to SCSI_2 until we
+	 * know better
+	 */
+	if (!sdev->scsi_level)
+		sdev->scsi_level = SCSI_2;
+
+	/*
+	 * Add it to the end of the shost->my_devices list.
+	 */
+	list_add_tail(&sdev->siblings, &shost->my_devices);
+	return sdev;
+
+out_free_queue:
 	if (q && sdev->request_queue) {
 		*q = sdev->request_queue;
 		sdev->request_queue = NULL;
 	} else if (sdev->request_queue)
 		scsi_free_queue(sdev->request_queue);
 
+out_free_dev:
 	kfree(sdev);
+out:
+	printk(ALLOC_FAILURE_MSG, __FUNCTION__);
 	return NULL;
 }
 
diff -urN linux-2.5.64-bk11/drivers/scsi/scsi_sysfs.c linux-2.5.64-bk12/drivers/scsi/scsi_sysfs.c
--- linux-2.5.64-bk11/drivers/scsi/scsi_sysfs.c	Tue Mar  4 19:29:02 2003
+++ linux-2.5.64-bk12/drivers/scsi/scsi_sysfs.c	Mon Mar 31 12:36:37 2003
@@ -266,6 +266,25 @@
 sdev_rd_attr (rev, "%.4s\n");
 sdev_rw_attr_bit (online);
 
+static ssize_t
+show_rescan_field (struct device *dev, char *buf)
+{
+	return 0; 
+}
+
+static ssize_t
+store_rescan_field (struct device *dev, const char *buf, size_t count) 
+{
+	int ret = ENODEV;
+	struct scsi_device *sdev;
+	sdev = to_scsi_device(dev);
+	if (sdev)
+		ret = scsi_rescan_device(sdev);
+	return ret;
+}
+
+static DEVICE_ATTR(rescan, S_IRUGO | S_IWUSR, show_rescan_field, store_rescan_field)
+
 static struct device_attribute * const sdev_attrs[] = {
 	&dev_attr_device_blocked,
 	&dev_attr_queue_depth,
@@ -276,6 +295,7 @@
 	&dev_attr_model,
 	&dev_attr_rev,
 	&dev_attr_online,
+	&dev_attr_rescan,
 };
 
 /**
diff -urN linux-2.5.64-bk11/drivers/scsi/sd.c linux-2.5.64-bk12/drivers/scsi/sd.c
--- linux-2.5.64-bk11/drivers/scsi/sd.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/drivers/scsi/sd.c	Mon Mar 31 12:36:37 2003
@@ -93,10 +93,12 @@
 
 static int sd_attach(struct scsi_device *);
 static void sd_detach(struct scsi_device *);
+static void sd_rescan(struct scsi_device *);
 static int sd_init_command(struct scsi_cmnd *);
 static int sd_synchronize_cache(struct scsi_disk *, int);
 static int sd_notifier(struct notifier_block *, unsigned long, void *);
-
+static void sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
+		 struct scsi_request *SRpnt, unsigned char *buffer);
 static struct notifier_block sd_notifier_block = {sd_notifier, NULL, 0}; 
 
 static struct Scsi_Device_Template sd_template = {
@@ -106,6 +108,7 @@
 	.scsi_type	= TYPE_DISK,
 	.attach		= sd_attach,
 	.detach		= sd_detach,
+	.rescan		= sd_rescan,
 	.init_command	= sd_init_command,
 	.scsi_driverfs_driver = {
 		.name   = "sd",
@@ -629,6 +632,38 @@
 	return 1;
 }
 
+static void sd_rescan(struct scsi_device * sdp)
+{
+	unsigned char *buffer;
+	struct scsi_disk *sdkp = sd_find_by_sdev(sdp);
+	struct gendisk *gd;
+	struct scsi_request *SRpnt;
+
+	if (!sdkp || sdp->online == FALSE || !sdkp->media_present)
+		return;
+		
+	gd = sdkp->disk;
+	
+	SCSI_LOG_HLQUEUE(3, printk("sd_rescan: disk=%s\n", gd->disk_name));
+	
+	SRpnt = scsi_allocate_request(sdp);
+	if (!SRpnt) {
+		printk(KERN_WARNING "(sd_rescan:) Request allocation "
+		       "failure.\n");
+		return;
+	}
+
+	if (sdkp->device->host->unchecked_isa_dma)
+		buffer = kmalloc(512, GFP_DMA);
+	else
+		buffer = kmalloc(512, GFP_KERNEL);
+
+    	sd_read_capacity(sdkp, gd->disk_name, SRpnt, buffer);
+	set_capacity(gd, sdkp->capacity);	
+	scsi_release_request(SRpnt);
+	kfree(buffer);
+}
+
 static int sd_revalidate_disk(struct gendisk *disk)
 {
 	struct scsi_disk *sdkp = scsi_disk(disk);
diff -urN linux-2.5.64-bk11/drivers/scsi/sg.c linux-2.5.64-bk12/drivers/scsi/sg.c
--- linux-2.5.64-bk11/drivers/scsi/sg.c	Tue Mar  4 19:29:18 2003
+++ linux-2.5.64-bk12/drivers/scsi/sg.c	Mon Mar 31 12:36:37 2003
@@ -18,10 +18,8 @@
  *
  */
 #include <linux/config.h>
-#ifdef CONFIG_PROC_FS
-static char *sg_version_str = "Version: 3.5.27 (20030130)";
-#endif
-static int sg_version_num = 30527;	/* 2 digits for each component */
+static char *sg_version_str = "3.5.28 [20030308]";
+static int sg_version_num = 30528;	/* 2 digits for each component */
 /*
  *  D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes:
  *      - scsi logging is available via SCSI_LOG_TIMEOUT macros. First
@@ -56,6 +54,7 @@
 #include <linux/poll.h>
 #include <linux/vmalloc.h>
 #include <linux/smp_lock.h>
+#include <linux/moduleparam.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -1327,27 +1326,6 @@
 	.fasync = sg_fasync,
 };
 
-#ifndef MODULE
-static int __init
-sg_def_reserved_size_setup(char *str)
-{
-	int tmp;
-
-	if (get_option(&str, &tmp) == 1) {
-		def_reserved_size = tmp;
-		if (tmp >= 0)
-			sg_big_buff = tmp;
-		return 1;
-	} else {
-		printk(KERN_WARNING "sg_def_reserved_size : usage "
-		       "sg_def_reserved_size=n (n could be 65536, 131072 or 262144)\n");
-		return 0;
-	}
-}
-
-__setup("sg_def_reserved_size=", sg_def_reserved_size_setup);
-#endif
-
 /* Driverfs file support */
 static ssize_t
 sg_device_kdev_read(struct device *driverfs_dev, char *page)
@@ -1564,16 +1542,77 @@
 		scsi_sleep(2);	/* dirty detach so delay device destruction */
 }
 
+/* Set 'perm' (4th argument) to 0 to disable module_param's definition
+ * of sysfs parameters (which module_param doesn't yet support).
+ * Sysfs parameters defined explicitly below.
+ */
+module_param_named(def_reserved_size, def_reserved_size, int, 0);
+module_param_named(allow_dio, sg_allow_dio, int, 0);
+
 MODULE_AUTHOR("Douglas Gilbert");
 MODULE_DESCRIPTION("SCSI generic (sg) driver");
-
-#ifdef MODULE_LICENSE
 MODULE_LICENSE("GPL");
-#endif
 
-MODULE_PARM(def_reserved_size, "i");
 MODULE_PARM_DESC(def_reserved_size, "size of buffer reserved for each fd");
 
+static ssize_t sg_allow_dio_show(struct device_driver * ddp, char * buf)
+{
+	return snprintf(buf, PAGE_SIZE, "%d\n", sg_allow_dio);
+}
+static ssize_t sg_allow_dio_store(struct device_driver * ddp,
+				  const char * buf, size_t count)
+{
+	if (1 == sscanf(buf, "%d", &sg_allow_dio)) {
+		sg_allow_dio = sg_allow_dio ? 1 : 0;
+		return count;
+	}
+	return -EINVAL;
+}
+DRIVER_ATTR(allow_dio, S_IRUGO | S_IWUSR, sg_allow_dio_show, 
+	    sg_allow_dio_store)
+
+static ssize_t sg_def_reserved_show(struct device_driver * ddp, char * buf)
+{
+	return snprintf(buf, PAGE_SIZE, "%d\n", sg_big_buff);
+}
+static ssize_t sg_def_reserved_store(struct device_driver * ddp,
+				     const char * buf, size_t count)
+{
+	if (1 == sscanf(buf, "%d", &def_reserved_size)) {
+		if (def_reserved_size >= 0) {
+			sg_big_buff = def_reserved_size;
+			return count;
+		}
+	}
+	return -EINVAL;
+}
+DRIVER_ATTR(def_reserved_size, S_IRUGO | S_IWUSR, sg_def_reserved_show, 
+	    sg_def_reserved_store)
+
+static ssize_t sg_version_show(struct device_driver * ddp, char * buf)
+{
+	return snprintf(buf, PAGE_SIZE, "%s\n", sg_version_str);
+}
+DRIVER_ATTR(version, S_IRUGO, sg_version_show, NULL)
+
+static void do_create_driverfs_files(void)
+{
+	struct device_driver * driverfs = &sg_template.scsi_driverfs_driver;
+
+	driver_create_file(driverfs, &driver_attr_allow_dio);
+	driver_create_file(driverfs, &driver_attr_def_reserved_size);
+	driver_create_file(driverfs, &driver_attr_version);
+}
+
+static void do_remove_driverfs_files(void)
+{
+	struct device_driver * driverfs = &sg_template.scsi_driverfs_driver;
+
+	driver_remove_file(driverfs, &driver_attr_version);
+	driver_remove_file(driverfs, &driver_attr_def_reserved_size);
+	driver_remove_file(driverfs, &driver_attr_allow_dio);
+}
+
 static int __init
 init_sg(void)
 {
@@ -1591,12 +1630,14 @@
 #ifdef CONFIG_PROC_FS
 	sg_proc_init();
 #endif				/* CONFIG_PROC_FS */
+	do_create_driverfs_files();
 	return 0;
 }
 
 static void __exit
 exit_sg(void)
 {
+	do_remove_driverfs_files();
 #ifdef CONFIG_PROC_FS
 	sg_proc_cleanup();
 #endif				/* CONFIG_PROC_FS */
@@ -2656,10 +2697,6 @@
 static struct proc_dir_entry *sg_proc_sgp = NULL;
 
 static char sg_proc_sg_dirname[] = "sg";
-static const char *sg_proc_leaf_names[] = { "allow_dio", "def_reserved_size",
-	"debug", "devices", "device_hdr", "device_strs",
-	"hosts", "host_hdr", "host_strs", "version"
-};
 
 static int sg_proc_adio_read(char *buffer, char **start, off_t offset,
 			     int size, int *eof, void *data);
@@ -2693,13 +2730,21 @@
 				int size, int *eof, void *data);
 static int sg_proc_version_info(char *buffer, int *len, off_t * begin,
 				off_t offset, int size);
-static read_proc_t *sg_proc_leaf_reads[] = {
-	sg_proc_adio_read, sg_proc_dressz_read, sg_proc_debug_read,
-	sg_proc_dev_read, sg_proc_devhdr_read, sg_proc_devstrs_read,
-	sg_proc_version_read
+
+struct sg_proc_leaf {
+	const char * name;
+	read_proc_t * rf;
+	write_proc_t * wf;
 };
-static write_proc_t *sg_proc_leaf_writes[] = {
-	sg_proc_adio_write, sg_proc_dressz_write, 0, 0, 0, 0, 0, 0, 0, 0
+
+static struct sg_proc_leaf sg_proc_leaf_arr[] = {
+	{"allow_dio", sg_proc_adio_read, sg_proc_adio_write},
+	{"def_reserved_size", sg_proc_dressz_read, sg_proc_dressz_write},
+	{"debug", sg_proc_debug_read, NULL},
+	{"devices", sg_proc_dev_read, NULL},
+	{"device_hdr", sg_proc_devhdr_read, NULL},
+	{"device_strs", sg_proc_devstrs_read, NULL},
+	{"version", sg_proc_version_read, NULL}
 };
 
 #define PRINT_PROC(fmt,args...)                                 \
@@ -2729,9 +2774,10 @@
 sg_proc_init()
 {
 	int k, mask;
-	int leaves =
-	    sizeof (sg_proc_leaf_names) / sizeof (sg_proc_leaf_names[0]);
+	int num_leaves =
+	    sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]);
 	struct proc_dir_entry *pdep;
+	struct sg_proc_leaf * leaf;
 
 	if (!proc_scsi)
 		return 1;
@@ -2739,14 +2785,14 @@
 					S_IFDIR | S_IRUGO | S_IXUGO, proc_scsi);
 	if (!sg_proc_sgp)
 		return 1;
-	for (k = 0; k < leaves; ++k) {
-		mask = sg_proc_leaf_writes[k] ? S_IRUGO | S_IWUSR : S_IRUGO;
-		pdep =
-		    create_proc_entry(sg_proc_leaf_names[k], mask, sg_proc_sgp);
+	for (k = 0; k < num_leaves; ++k) {
+		leaf = &sg_proc_leaf_arr[k];
+		mask = leaf->wf ? S_IRUGO | S_IWUSR : S_IRUGO;
+		pdep = create_proc_entry(leaf->name, mask, sg_proc_sgp);
 		if (pdep) {
-			pdep->read_proc = sg_proc_leaf_reads[k];
-			if (sg_proc_leaf_writes[k])
-				pdep->write_proc = sg_proc_leaf_writes[k];
+			pdep->read_proc = leaf->rf;
+			if (leaf->wf)
+				pdep->write_proc = leaf->wf;
 		}
 	}
 	return 0;
@@ -2756,13 +2802,13 @@
 sg_proc_cleanup()
 {
 	int k;
-	int leaves =
-	    sizeof (sg_proc_leaf_names) / sizeof (sg_proc_leaf_names[0]);
+	int num_leaves =
+	    sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]);
 
 	if ((!proc_scsi) || (!sg_proc_sgp))
 		return;
-	for (k = 0; k < leaves; ++k)
-		remove_proc_entry(sg_proc_leaf_names[k], sg_proc_sgp);
+	for (k = 0; k < num_leaves; ++k)
+		remove_proc_entry(sg_proc_leaf_arr[k].name, sg_proc_sgp);
 	remove_proc_entry(sg_proc_sg_dirname, proc_scsi);
 }
 
diff -urN linux-2.5.64-bk11/fs/Kconfig linux-2.5.64-bk12/fs/Kconfig
--- linux-2.5.64-bk11/fs/Kconfig	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/fs/Kconfig	Mon Mar 31 12:36:37 2003
@@ -377,10 +377,6 @@
 	  If you don't know whether you need it, then you don't need it:
 	  answer N.
 
-config HUGETLBFS
-	bool "HugeTLB file system support"
-	depends on HUGETLB_PAGE
-
 config QUOTA
 	bool "Quota support"
 	help
@@ -819,6 +815,10 @@
 
 	  See <file:Documentation/filesystems/tmpfs.txt> for details.
 
+config HUGETLBFS
+	bool "HugeTLB file system support"
+	depends on HUGETLB_PAGE
+
 config RAMFS
 	bool
 	default y
diff -urN linux-2.5.64-bk11/fs/affs/Changes linux-2.5.64-bk12/fs/affs/Changes
--- linux-2.5.64-bk11/fs/affs/Changes	Tue Mar  4 19:29:22 2003
+++ linux-2.5.64-bk12/fs/affs/Changes	Mon Mar 31 12:36:37 2003
@@ -28,6 +28,11 @@
 
 Please direct bug reports to: zippel@linux-m68k.org
 
+Version 3.20
+------------
+- kill kernel lock
+- fix for a possible bitmap corruption
+
 Version 3.19
 ------------
 
diff -urN linux-2.5.64-bk11/fs/affs/bitmap.c linux-2.5.64-bk12/fs/affs/bitmap.c
--- linux-2.5.64-bk11/fs/affs/bitmap.c	Tue Mar  4 19:29:52 2003
+++ linux-2.5.64-bk12/fs/affs/bitmap.c	Mon Mar 31 12:36:37 2003
@@ -185,6 +185,8 @@
 	/* search for the next bmap buffer with free bits */
 	i = sbi->s_bmap_count;
 	do {
+		if (--i < 0)
+			goto err_full;
 		bmap++;
 		bm++;
 		if (bmap < sbi->s_bmap_count)
@@ -192,8 +194,6 @@
 		/* restart search at zero */
 		bmap = 0;
 		bm = sbi->s_bitmap;
-		if (--i <= 0)
-			goto err_full;
 	} while (!bm->bm_free);
 	blk = bmap * sbi->s_bmap_bits;
 
@@ -216,8 +216,8 @@
 	mask = ~0UL << (bit & 31);
 	blk &= ~31UL;
 
-	tmp = be32_to_cpu(*data) & mask;
-	if (tmp)
+	tmp = be32_to_cpu(*data);
+	if (tmp & mask)
 		goto find_bit;
 
 	/* scan the rest of the buffer */
@@ -230,10 +230,11 @@
 			goto find_bmap;
 	} while (!(tmp = *data));
 	tmp = be32_to_cpu(tmp);
+	mask = ~0;
 
 find_bit:
 	/* finally look for a free bit in the word */
-	bit = ffs(tmp) - 1;
+	bit = ffs(tmp & mask) - 1;
 	blk += bit + sbi->s_reserved;
 	mask2 = mask = 1 << (bit & 31);
 	AFFS_I(inode)->i_lastalloc = blk;
@@ -266,8 +267,8 @@
 	sbi->s_bmap_bh = NULL;
 	sbi->s_last_bmap = ~0;
 err_full:
-	pr_debug("failed\n");
 	up(&sbi->s_bmlock);
+	pr_debug("failed\n");
 	return 0;
 }
 
diff -urN linux-2.5.64-bk11/fs/affs/dir.c linux-2.5.64-bk12/fs/affs/dir.c
--- linux-2.5.64-bk11/fs/affs/dir.c	Tue Mar  4 19:29:33 2003
+++ linux-2.5.64-bk12/fs/affs/dir.c	Mon Mar 31 12:36:37 2003
@@ -65,8 +65,6 @@
 	int			 stored;
 	int			 res;
 
-	lock_kernel();
-	
 	pr_debug("AFFS: readdir(ino=%lu,f_pos=%lx)\n",inode->i_ino,(unsigned long)filp->f_pos);
 
 	stored = 0;
@@ -162,7 +160,6 @@
 	affs_brelse(dir_bh);
 	affs_brelse(fh_bh);
 	affs_unlock_dir(inode);
-	unlock_kernel();
 	pr_debug("AFFS: readdir()=%d\n", stored);
 	return res;
 }
diff -urN linux-2.5.64-bk11/fs/affs/inode.c linux-2.5.64-bk12/fs/affs/inode.c
--- linux-2.5.64-bk11/fs/affs/inode.c	Tue Mar  4 19:29:17 2003
+++ linux-2.5.64-bk12/fs/affs/inode.c	Mon Mar 31 12:36:37 2003
@@ -195,11 +195,9 @@
 	if (!inode->i_nlink)
 		// possibly free block
 		return;
-	lock_kernel();
 	bh = affs_bread(sb, inode->i_ino);
 	if (!bh) {
 		affs_error(sb,"write_inode","Cannot read block %lu",inode->i_ino);
-		unlock_kernel();
 		return;
 	}
 	tail = AFFS_TAIL(sb, bh);
@@ -227,7 +225,7 @@
 	affs_fix_checksum(sb, bh);
 	mark_buffer_dirty_inode(bh, inode);
 	affs_brelse(bh);
-	unlock_kernel();
+	affs_free_prealloc(inode);
 }
 
 int
@@ -236,8 +234,6 @@
 	struct inode *inode = dentry->d_inode;
 	int error;
 
-	lock_kernel();
-
 	pr_debug("AFFS: notify_change(%lu,0x%x)\n",inode->i_ino,attr->ia_valid);
 
 	error = inode_change_ok(inode,attr);
@@ -257,7 +253,6 @@
 	if (!error && (attr->ia_valid & ATTR_MODE))
 		mode_to_prot(inode);
 out:
-	unlock_kernel();
 	return error;
 }
 
@@ -265,15 +260,13 @@
 affs_put_inode(struct inode *inode)
 {
 	pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
-	lock_kernel();
 	affs_free_prealloc(inode);
 	if (atomic_read(&inode->i_count) == 1) {
+		down(&inode->i_sem);
 		if (inode->i_size != AFFS_I(inode)->mmu_private)
 			affs_truncate(inode);
-		//if (inode->i_nlink)
-		//	affs_clear_inode(inode);
+		up(&inode->i_sem);
 	}
-	unlock_kernel();
 }
 
 void
@@ -284,9 +277,7 @@
 	if (S_ISREG(inode->i_mode))
 		affs_truncate(inode);
 	clear_inode(inode);
-	lock_kernel();
 	affs_free_block(inode->i_sb, inode->i_ino);
-	unlock_kernel();
 }
 
 void
diff -urN linux-2.5.64-bk11/fs/affs/namei.c linux-2.5.64-bk12/fs/affs/namei.c
--- linux-2.5.64-bk11/fs/affs/namei.c	Tue Mar  4 19:29:04 2003
+++ linux-2.5.64-bk12/fs/affs/namei.c	Mon Mar 31 12:36:37 2003
@@ -218,12 +218,10 @@
 
 	pr_debug("AFFS: lookup(\"%.*s\")\n",(int)dentry->d_name.len,dentry->d_name.name);
 
-	lock_kernel();
 	affs_lock_dir(dir);
 	bh = affs_find_entry(dir, dentry);
 	affs_unlock_dir(dir);
 	if (IS_ERR(bh)) {
-		unlock_kernel();
 		return ERR_PTR(PTR_ERR(bh));
 	}
 	if (bh) {
@@ -240,12 +238,10 @@
 		affs_brelse(bh);
 		inode = iget(sb, ino);
 		if (!inode) {
-			unlock_kernel();
 			return ERR_PTR(-EACCES);
 		}
 	}
 	dentry->d_op = AFFS_SB(sb)->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations;
-	unlock_kernel();
 	d_add(dentry, inode);
 	return NULL;
 }
@@ -253,17 +249,10 @@
 int
 affs_unlink(struct inode *dir, struct dentry *dentry)
 {
-	int res;
 	pr_debug("AFFS: unlink(dir=%d, \"%.*s\")\n", (u32)dir->i_ino,
 		 (int)dentry->d_name.len, dentry->d_name.name);
 
-	if (!dentry->d_inode)
-		return -ENOENT;
-
-	lock_kernel();
-	res = affs_remove_header(dentry);
-	unlock_kernel();
-	return res;
+	return affs_remove_header(dentry);
 }
 
 int
@@ -276,12 +265,9 @@
 	pr_debug("AFFS: create(%lu,\"%.*s\",0%o)\n",dir->i_ino,(int)dentry->d_name.len,
 		 dentry->d_name.name,mode);
 
-	lock_kernel();
 	inode = affs_new_inode(dir);
-	if (!inode) {
-		unlock_kernel();
+	if (!inode)
 		return -ENOSPC;
-	}
 
 	inode->i_mode = mode;
 	mode_to_prot(inode);
@@ -294,10 +280,8 @@
 	if (error) {
 		inode->i_nlink = 0;
 		iput(inode);
-		unlock_kernel();
 		return error;
 	}
-	unlock_kernel();
 	return 0;
 }
 
@@ -310,12 +294,9 @@
 	pr_debug("AFFS: mkdir(%lu,\"%.*s\",0%o)\n",dir->i_ino,
 		 (int)dentry->d_name.len,dentry->d_name.name,mode);
 
-	lock_kernel();
 	inode = affs_new_inode(dir);
-	if (!inode) {
-		unlock_kernel();
+	if (!inode)
 		return -ENOSPC;
-	}
 
 	inode->i_mode = S_IFDIR | mode;
 	mode_to_prot(inode);
@@ -328,10 +309,8 @@
 		inode->i_nlink = 0;
 		mark_inode_dirty(inode);
 		iput(inode);
-		unlock_kernel();
 		return error;
 	}
-	unlock_kernel();
 	return 0;
 }
 
@@ -357,14 +336,10 @@
 	pr_debug("AFFS: symlink(%lu,\"%.*s\" -> \"%s\")\n",dir->i_ino,
 		 (int)dentry->d_name.len,dentry->d_name.name,symname);
 
-	lock_kernel();
 	maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1;
-	error = -ENOSPC;
 	inode  = affs_new_inode(dir);
-	if (!inode) {
-		unlock_kernel();
+	if (!inode)
 		return -ENOSPC;
-	}
 
 	inode->i_op = &affs_symlink_inode_operations;
 	inode->i_data.a_ops = &affs_symlink_aops;
@@ -410,7 +385,6 @@
 	error = affs_add_entry(dir, inode, dentry, ST_SOFTLINK);
 	if (error)
 		goto err;
-	unlock_kernel();
 
 	return 0;
 
@@ -418,7 +392,6 @@
 	inode->i_nlink = 0;
 	mark_inode_dirty(inode);
 	iput(inode);
-	unlock_kernel();
 	return error;
 }
 
@@ -426,23 +399,11 @@
 affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
 {
 	struct inode *inode = old_dentry->d_inode;
-	int error;
 
 	pr_debug("AFFS: link(%u, %u, \"%.*s\")\n", (u32)inode->i_ino, (u32)dir->i_ino,
 		 (int)dentry->d_name.len,dentry->d_name.name);
 
-	lock_kernel();
-	error = affs_add_entry(dir, inode, dentry, ST_LINKFILE);
-	if (error) {
-		/* WTF??? */
-		inode->i_nlink = 0;
-		mark_inode_dirty(inode);
-		iput(inode);
-		unlock_kernel();
-		return error;
-	}
-	unlock_kernel();
-	return 0;
+	return affs_add_entry(dir, inode, dentry, ST_LINKFILE);
 }
 
 int
@@ -453,21 +414,19 @@
 	struct buffer_head *bh = NULL;
 	int retval;
 
-	lock_kernel();
 	pr_debug("AFFS: rename(old=%u,\"%*s\" to new=%u,\"%*s\")\n",
 		 (u32)old_dir->i_ino, (int)old_dentry->d_name.len, old_dentry->d_name.name,
 		 (u32)new_dir->i_ino, (int)new_dentry->d_name.len, new_dentry->d_name.name);
 
-	if ((retval = affs_check_name(new_dentry->d_name.name,new_dentry->d_name.len)))
-		goto done;
+	retval = affs_check_name(new_dentry->d_name.name,new_dentry->d_name.len);
+	if (retval)
+		return retval;
 
 	/* Unlink destination if it already exists */
 	if (new_dentry->d_inode) {
 		retval = affs_remove_header(new_dentry);
-		if (retval) {
-			unlock_kernel();
+		if (retval)
 			return retval;
-		}
 	}
 
 	retval = -EIO;
@@ -493,6 +452,5 @@
 done:
 	mark_buffer_dirty_inode(bh, retval ? old_dir : new_dir);
 	affs_brelse(bh);
-	unlock_kernel();
 	return retval;
 }
diff -urN linux-2.5.64-bk11/fs/affs/super.c linux-2.5.64-bk12/fs/affs/super.c
--- linux-2.5.64-bk11/fs/affs/super.c	Tue Mar  4 19:29:31 2003
+++ linux-2.5.64-bk12/fs/affs/super.c	Mon Mar 31 12:36:37 2003
@@ -40,7 +40,6 @@
 affs_put_super(struct super_block *sb)
 {
 	struct affs_sb_info *sbi = AFFS_SB(sb);
-	lock_kernel();
 	pr_debug("AFFS: put_super()\n");
 
 	if (!(sb->s_flags & MS_RDONLY)) {
@@ -58,7 +57,6 @@
 	affs_brelse(sbi->s_root_bh);
 	kfree(sbi);
 	sb->s_fs_info = NULL;
-	unlock_kernel();
 	return;
 }
 
@@ -67,7 +65,7 @@
 {
 	int clean = 2;
 	struct affs_sb_info *sbi = AFFS_SB(sb);
-	lock_kernel();
+
 	if (!(sb->s_flags & MS_RDONLY)) {
 		//	if (sbi->s_bitmap[i].bm_bh) {
 		//		if (buffer_dirty(sbi->s_bitmap[i].bm_bh)) {
@@ -81,7 +79,7 @@
 	} else
 		sb->s_dirt = 0;
 
-	unlock_kernel();
+	pr_debug("AFFS: write_super() at %lu, clean=%d\n", get_seconds(), clean);
 }
 
 static kmem_cache_t * affs_inode_cachep;
diff -urN linux-2.5.64-bk11/fs/affs/symlink.c linux-2.5.64-bk12/fs/affs/symlink.c
--- linux-2.5.64-bk11/fs/affs/symlink.c	Tue Mar  4 19:29:02 2003
+++ linux-2.5.64-bk12/fs/affs/symlink.c	Mon Mar 31 12:36:37 2003
@@ -32,9 +32,7 @@
 	pr_debug("AFFS: follow_link(ino=%lu)\n",inode->i_ino);
 
 	err = -EIO;
-	lock_kernel();
 	bh = affs_bread(inode->i_sb, inode->i_ino);
-	unlock_kernel();
 	if (!bh)
 		goto fail;
 	i  = 0;
@@ -63,9 +61,7 @@
 		j++;
 	}
 	link[i] = '\0';
-	lock_kernel();
 	affs_brelse(bh);
-	unlock_kernel();
 	SetPageUptodate(page);
 	kunmap(page);
 	unlock_page(page);
diff -urN linux-2.5.64-bk11/fs/dcache.c linux-2.5.64-bk12/fs/dcache.c
--- linux-2.5.64-bk11/fs/dcache.c	Tue Mar  4 19:28:59 2003
+++ linux-2.5.64-bk12/fs/dcache.c	Mon Mar 31 12:36:37 2003
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/mount.h>
 #include <asm/uaccess.h>
+#include <linux/security.h>
 
 #define DCACHE_PARANOIA 1
 /* #define DCACHE_DEBUG 1 */
@@ -760,6 +761,7 @@
 void d_instantiate(struct dentry *entry, struct inode * inode)
 {
 	if (!list_empty(&entry->d_alias)) BUG();
+	security_d_instantiate(entry, inode);
 	spin_lock(&dcache_lock);
 	if (inode)
 		list_add(&entry->d_alias, &inode->i_dentry);
@@ -890,6 +892,7 @@
 	struct dentry *new = NULL;
 
 	if (inode && S_ISDIR(inode->i_mode)) {
+		security_d_instantiate(dentry, inode);
 		spin_lock(&dcache_lock);
 		if (!list_empty(&inode->i_dentry)) {
 			new = list_entry(inode->i_dentry.next, struct dentry, d_alias);
diff -urN linux-2.5.64-bk11/fs/devfs/base.c linux-2.5.64-bk12/fs/devfs/base.c
--- linux-2.5.64-bk11/fs/devfs/base.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/fs/devfs/base.c	Mon Mar 31 12:36:37 2003
@@ -1802,8 +1802,11 @@
 static struct file_operations *devfs_get_ops (devfs_handle_t de)
 {
     struct file_operations *ops = de->u.cdev.ops;
-    struct module *owner = ops->owner;
+    struct module *owner;
 
+    if (!ops)
+	return NULL;
+    owner = ops->owner;
     read_lock (&de->parent->u.dir.lock);  /*  Prevent module from unloading  */
     if ( (de->next == de) || !try_module_get (owner) )
     {   /*  Entry is already unhooked or module is unloading  */
diff -urN linux-2.5.64-bk11/fs/exportfs/expfs.c linux-2.5.64-bk12/fs/exportfs/expfs.c
--- linux-2.5.64-bk11/fs/exportfs/expfs.c	Tue Mar  4 19:29:33 2003
+++ linux-2.5.64-bk12/fs/exportfs/expfs.c	Mon Mar 31 12:36:37 2003
@@ -353,7 +353,7 @@
 	/*
 	 * Open the directory ...
 	 */
-	error = init_private_file(&file, dentry, FMODE_READ);
+	error = open_private_file(&file, dentry, O_RDONLY);
 	if (error)
 		goto out;
 	error = -EINVAL;
@@ -381,8 +381,7 @@
 	}
 
 out_close:
-	if (file.f_op->release)
-		file.f_op->release(dir, &file);
+	close_private_file(&file);
 out:
 	return error;
 }
diff -urN linux-2.5.64-bk11/fs/ext2/balloc.c linux-2.5.64-bk12/fs/ext2/balloc.c
--- linux-2.5.64-bk11/fs/ext2/balloc.c	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/fs/ext2/balloc.c	Mon Mar 31 12:36:37 2003
@@ -395,7 +395,7 @@
 			goto io_error;
 		group_alloc = group_reserve_blocks(desc, gdp_bh, es_alloc);
 	}
-	if (bit >= sbi->s_groups_count) {
+	if (!group_alloc) {
 		*err = -ENOSPC;
 		goto out_release;
 	}
diff -urN linux-2.5.64-bk11/fs/ext2/ext2.h linux-2.5.64-bk12/fs/ext2/ext2.h
--- linux-2.5.64-bk11/fs/ext2/ext2.h	Tue Mar  4 19:29:54 2003
+++ linux-2.5.64-bk12/fs/ext2/ext2.h	Mon Mar 31 12:36:37 2003
@@ -112,6 +112,7 @@
 extern void ext2_discard_prealloc (struct inode *);
 extern void ext2_truncate (struct inode *);
 extern int ext2_setattr (struct dentry *, struct iattr *);
+extern void ext2_set_inode_flags(struct inode *inode);
 
 /* ioctl.c */
 extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
diff -urN linux-2.5.64-bk11/fs/ext2/ialloc.c linux-2.5.64-bk12/fs/ext2/ialloc.c
--- linux-2.5.64-bk11/fs/ext2/ialloc.c	Tue Mar  4 19:29:19 2003
+++ linux-2.5.64-bk12/fs/ext2/ialloc.c	Mon Mar 31 12:36:37 2003
@@ -545,10 +545,7 @@
 	ei->i_prealloc_count = 0;
 	ei->i_dir_start_lookup = 0;
 	ei->i_state = EXT2_STATE_NEW;
-	if (ei->i_flags & EXT2_SYNC_FL)
-		inode->i_flags |= S_SYNC;
-	if (ei->i_flags & EXT2_DIRSYNC_FL)
-		inode->i_flags |= S_DIRSYNC;
+	ext2_set_inode_flags(inode);
 	inode->i_generation = EXT2_SB(sb)->s_next_generation++;
 	insert_inode_hash(inode);
 
diff -urN linux-2.5.64-bk11/fs/ext2/inode.c linux-2.5.64-bk12/fs/ext2/inode.c
--- linux-2.5.64-bk11/fs/ext2/inode.c	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-bk12/fs/ext2/inode.c	Mon Mar 31 12:36:37 2003
@@ -1011,6 +1011,23 @@
 	return ERR_PTR(-EIO);
 }
 
+void ext2_set_inode_flags(struct inode *inode)
+{
+	unsigned int flags = EXT2_I(inode)->i_flags;
+
+	inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
+	if (flags & EXT2_SYNC_FL)
+		inode->i_flags |= S_SYNC;
+	if (flags & EXT2_APPEND_FL)
+		inode->i_flags |= S_APPEND;
+	if (flags & EXT2_IMMUTABLE_FL)
+		inode->i_flags |= S_IMMUTABLE;
+	if (flags & EXT2_NOATIME_FL)
+		inode->i_flags |= S_NOATIME;
+	if (flags & EXT2_DIRSYNC_FL)
+		inode->i_flags |= S_DIRSYNC;
+}
+
 void ext2_read_inode (struct inode * inode)
 {
 	struct ext2_inode_info *ei = EXT2_I(inode);
@@ -1108,14 +1125,7 @@
 				   le32_to_cpu(raw_inode->i_block[0]));
 	}
 	brelse (bh);
-	if (ei->i_flags & EXT2_SYNC_FL)
-		inode->i_flags |= S_SYNC;
-	if (ei->i_flags & EXT2_APPEND_FL)
-		inode->i_flags |= S_APPEND;
-	if (ei->i_flags & EXT2_IMMUTABLE_FL)
-		inode->i_flags |= S_IMMUTABLE;
-	if (ei->i_flags & EXT2_NOATIME_FL)
-		inode->i_flags |= S_NOATIME;
+	ext2_set_inode_flags(inode);
 	return;
 	
 bad_inode:
diff -urN linux-2.5.64-bk11/fs/ext2/ioctl.c linux-2.5.64-bk12/fs/ext2/ioctl.c
--- linux-2.5.64-bk11/fs/ext2/ioctl.c	Tue Mar  4 19:29:55 2003
+++ linux-2.5.64-bk12/fs/ext2/ioctl.c	Mon Mar 31 12:36:37 2003
@@ -58,22 +58,7 @@
 		flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE;
 		ei->i_flags = flags;
 
-		if (flags & EXT2_SYNC_FL)
-			inode->i_flags |= S_SYNC;
-		else
-			inode->i_flags &= ~S_SYNC;
-		if (flags & EXT2_APPEND_FL)
-			inode->i_flags |= S_APPEND;
-		else
-			inode->i_flags &= ~S_APPEND;
-		if (flags & EXT2_IMMUTABLE_FL)
-			inode->i_flags |= S_IMMUTABLE;
-		else
-			inode->i_flags &= ~S_IMMUTABLE;
-		if (flags & EXT2_NOATIME_FL)
-			inode->i_flags |= S_NOATIME;
-		else
-			inode->i_flags &= ~S_NOATIME;
+		ext2_set_inode_flags(inode);
 		inode->i_ctime = CURRENT_TIME;
 		mark_inode_dirty(inode);
 		return 0;
diff -urN linux-2.5.64-bk11/fs/ext3/ialloc.c linux-2.5.64-bk12/fs/ext3/ialloc.c
--- linux-2.5.64-bk11/fs/ext3/ialloc.c	Tue Mar  4 19:29:19 2003
+++ linux-2.5.64-bk12/fs/ext3/ialloc.c	Mon Mar 31 12:36:37 2003
@@ -568,10 +568,7 @@
 #endif
 	ei->i_block_group = group;
 	
-	if (ei->i_flags & EXT3_SYNC_FL)
-		inode->i_flags |= S_SYNC;
-	if (ei->i_flags & EXT3_DIRSYNC_FL)
-		inode->i_flags |= S_DIRSYNC;
+	ext3_set_inode_flags(inode);
 	if (IS_DIRSYNC(inode))
 		handle->h_sync = 1;
 	insert_inode_hash(inode);
diff -urN linux-2.5.64-bk11/fs/ext3/inode.c linux-2.5.64-bk12/fs/ext3/inode.c
--- linux-2.5.64-bk11/fs/ext3/inode.c	Tue Mar  4 19:29:30 2003
+++ linux-2.5.64-bk12/fs/ext3/inode.c	Mon Mar 31 12:36:37 2003
@@ -2209,6 +2209,24 @@
 	return -EIO;
 }
 
+void ext3_set_inode_flags(struct inode *inode)
+{
+	unsigned int flags = EXT3_I(inode)->i_flags;
+
+	inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
+	if (flags & EXT3_SYNC_FL)
+		inode->i_flags |= S_SYNC;
+	if (flags & EXT3_APPEND_FL)
+		inode->i_flags |= S_APPEND;
+	if (flags & EXT3_IMMUTABLE_FL)
+		inode->i_flags |= S_IMMUTABLE;
+	if (flags & EXT3_NOATIME_FL)
+		inode->i_flags |= S_NOATIME;
+	if (flags & EXT3_DIRSYNC_FL)
+		inode->i_flags |= S_DIRSYNC;
+}
+
+
 void ext3_read_inode(struct inode * inode)
 {
 	struct ext3_iloc iloc;
@@ -2320,14 +2338,7 @@
 		init_special_inode(inode, inode->i_mode,
 				   le32_to_cpu(iloc.raw_inode->i_block[0]));
 	}
-	if (ei->i_flags & EXT3_SYNC_FL)
-		inode->i_flags |= S_SYNC;
-	if (ei->i_flags & EXT3_APPEND_FL)
-		inode->i_flags |= S_APPEND;
-	if (ei->i_flags & EXT3_IMMUTABLE_FL)
-		inode->i_flags |= S_IMMUTABLE;
-	if (ei->i_flags & EXT3_NOATIME_FL)
-		inode->i_flags |= S_NOATIME;
+	ext3_set_inode_flags(inode);
 	return;
 	
 bad_inode:
diff -urN linux-2.5.64-bk11/fs/ext3/ioctl.c linux-2.5.64-bk12/fs/ext3/ioctl.c
--- linux-2.5.64-bk11/fs/ext3/ioctl.c	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/fs/ext3/ioctl.c	Mon Mar 31 12:36:37 2003
@@ -85,22 +85,7 @@
 		flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
 		ei->i_flags = flags;
 
-		if (flags & EXT3_SYNC_FL)
-			inode->i_flags |= S_SYNC;
-		else
-			inode->i_flags &= ~S_SYNC;
-		if (flags & EXT3_APPEND_FL)
-			inode->i_flags |= S_APPEND;
-		else
-			inode->i_flags &= ~S_APPEND;
-		if (flags & EXT3_IMMUTABLE_FL)
-			inode->i_flags |= S_IMMUTABLE;
-		else
-			inode->i_flags &= ~S_IMMUTABLE;
-		if (flags & EXT3_NOATIME_FL)
-			inode->i_flags |= S_NOATIME;
-		else
-			inode->i_flags &= ~S_NOATIME;
+		ext3_set_inode_flags(inode);
 		inode->i_ctime = CURRENT_TIME;
 
 		err = ext3_mark_iloc_dirty(handle, inode, &iloc);
diff -urN linux-2.5.64-bk11/fs/file_table.c linux-2.5.64-bk12/fs/file_table.c
--- linux-2.5.64-bk11/fs/file_table.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/fs/file_table.c	Mon Mar 31 12:36:37 2003
@@ -93,23 +93,42 @@
 
 /*
  * Clear and initialize a (private) struct file for the given dentry,
- * and call the open function (if any).  The caller must verify that
- * inode->i_fop is not NULL.
+ * allocate the security structure, and call the open function (if any).  
+ * The file should be released using close_private_file.
  */
-int init_private_file(struct file *filp, struct dentry *dentry, int mode)
+int open_private_file(struct file *filp, struct dentry *dentry, int flags)
 {
+	int error;
 	memset(filp, 0, sizeof(*filp));
 	eventpoll_init_file(filp);
-	filp->f_mode   = mode;
+	filp->f_flags  = flags;
+	filp->f_mode   = (flags+1) & O_ACCMODE;
 	atomic_set(&filp->f_count, 1);
 	filp->f_dentry = dentry;
 	filp->f_uid    = current->fsuid;
 	filp->f_gid    = current->fsgid;
 	filp->f_op     = dentry->d_inode->i_fop;
-	if (filp->f_op->open)
-		return filp->f_op->open(dentry->d_inode, filp);
-	else
-		return 0;
+	error = security_file_alloc(filp);
+	if (!error)
+		if (filp->f_op && filp->f_op->open) {
+			error = filp->f_op->open(dentry->d_inode, filp);
+			if (error)
+				security_file_free(filp);
+		}
+	return error;
+}
+
+/*
+ * Release a private file by calling the release function (if any) and
+ * freeing the security structure.
+ */
+void close_private_file(struct file *file)
+{
+	struct inode * inode = file->f_dentry->d_inode;
+
+	if (file->f_op && file->f_op->release)
+		file->f_op->release(inode, file);
+	security_file_free(file);
 }
 
 void fput(struct file * file)
diff -urN linux-2.5.64-bk11/fs/inode.c linux-2.5.64-bk12/fs/inode.c
--- linux-2.5.64-bk11/fs/inode.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/fs/inode.c	Mon Mar 31 12:36:37 2003
@@ -129,6 +129,7 @@
 		inode->i_pipe = NULL;
 		inode->i_bdev = NULL;
 		inode->i_cdev = NULL;
+		inode->i_rdev = to_kdev_t(0);
 		inode->i_security = NULL;
 		if (security_inode_alloc(inode)) {
 			if (inode->i_sb->s_op->destroy_inode)
diff -urN linux-2.5.64-bk11/fs/namei.c linux-2.5.64-bk12/fs/namei.c
--- linux-2.5.64-bk11/fs/namei.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/fs/namei.c	Mon Mar 31 12:36:37 2003
@@ -361,10 +361,8 @@
 			result = dir->i_op->lookup(dir, dentry);
 			if (result)
 				dput(dentry);
-			else {
+			else
 				result = dentry;
-				security_inode_post_lookup(dir, result);
-			}
 		}
 		up(&dir->i_sem);
 		return result;
@@ -894,10 +892,9 @@
 		if (!new)
 			goto out;
 		dentry = inode->i_op->lookup(inode, new);
-		if (!dentry) {
+		if (!dentry)
 			dentry = new;
-			security_inode_post_lookup(inode, dentry);
-		} else
+		else
 			dput(new);
 	}
 out:
diff -urN linux-2.5.64-bk11/fs/nfsd/vfs.c linux-2.5.64-bk12/fs/nfsd/vfs.c
--- linux-2.5.64-bk11/fs/nfsd/vfs.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/fs/nfsd/vfs.c	Mon Mar 31 12:36:37 2003
@@ -442,7 +442,7 @@
 {
 	struct dentry	*dentry;
 	struct inode	*inode;
-	int		flags = O_RDONLY|O_LARGEFILE, mode = FMODE_READ, err;
+	int		flags = O_RDONLY|O_LARGEFILE, err;
 
 	/*
 	 * If we get here, then the client has already done an "open",
@@ -479,14 +479,12 @@
 			goto out_nfserr;
 
 		flags = O_WRONLY|O_LARGEFILE;
-		mode  = FMODE_WRITE;
 
 		DQUOT_INIT(inode);
 	}
 
-	err = init_private_file(filp, dentry, mode);
+	err = open_private_file(filp, dentry, flags);
 	if (!err) {
-		filp->f_flags = flags;
 		filp->f_vfsmnt = fhp->fh_export->ex_mnt;
 	} else if (access & MAY_WRITE)
 		put_write_access(inode);
@@ -507,8 +505,7 @@
 	struct dentry	*dentry = filp->f_dentry;
 	struct inode	*inode = dentry->d_inode;
 
-	if (filp->f_op->release)
-		filp->f_op->release(inode, filp);
+	close_private_file(filp);
 	if (filp->f_mode & FMODE_WRITE)
 		put_write_access(inode);
 }
diff -urN linux-2.5.64-bk11/fs/super.c linux-2.5.64-bk12/fs/super.c
--- linux-2.5.64-bk11/fs/super.c	Tue Mar  4 19:29:17 2003
+++ linux-2.5.64-bk12/fs/super.c	Mon Mar 31 12:36:37 2003
@@ -611,6 +611,7 @@
 	struct file_system_type *type = get_fs_type(fstype);
 	struct super_block *sb = ERR_PTR(-ENOMEM);
 	struct vfsmount *mnt;
+	int error;
 
 	if (!type)
 		return ERR_PTR(-ENODEV);
@@ -621,6 +622,9 @@
 	sb = type->get_sb(type, flags, name, data);
 	if (IS_ERR(sb))
 		goto out_mnt;
+ 	error = security_sb_kern_mount(sb);
+ 	if (error) 
+ 		goto out_sb;
 	mnt->mnt_sb = sb;
 	mnt->mnt_root = dget(sb->s_root);
 	mnt->mnt_mountpoint = sb->s_root;
@@ -628,6 +632,10 @@
 	up_write(&sb->s_umount);
 	put_filesystem(type);
 	return mnt;
+out_sb:
+	up_write(&sb->s_umount);
+	deactivate_super(sb);
+	sb = ERR_PTR(error);
 out_mnt:
 	free_vfsmnt(mnt);
 out:
diff -urN linux-2.5.64-bk11/include/asm-alpha/pci.h linux-2.5.64-bk12/include/asm-alpha/pci.h
--- linux-2.5.64-bk11/include/asm-alpha/pci.h	Tue Mar  4 19:28:53 2003
+++ linux-2.5.64-bk12/include/asm-alpha/pci.h	Mon Mar 31 12:36:37 2003
@@ -190,6 +190,11 @@
 
 /* Return the index of the PCI controller for device PDEV. */
 extern int pci_controller_num(struct pci_dev *pdev);
+
+extern void
+pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+			 struct resource *res);
+
 #endif /* __KERNEL__ */
 
 /* Values for the `which' argument to sys_pciconfig_iobase.  */
diff -urN linux-2.5.64-bk11/include/asm-arm/pci.h linux-2.5.64-bk12/include/asm-arm/pci.h
--- linux-2.5.64-bk11/include/asm-arm/pci.h	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/include/asm-arm/pci.h	Mon Mar 31 12:36:37 2003
@@ -175,6 +175,10 @@
 extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                                enum pci_mmap_state mmap_state, int write_combine);
 
+extern void
+pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+			 struct resource *res);
+
 #endif /* __KERNEL__ */
  
 #endif
diff -urN linux-2.5.64-bk11/include/asm-generic/pci.h linux-2.5.64-bk12/include/asm-generic/pci.h
--- linux-2.5.64-bk11/include/asm-generic/pci.h	Wed Dec 31 16:00:00 1969
+++ linux-2.5.64-bk12/include/asm-generic/pci.h	Mon Mar 31 12:36:37 2003
@@ -0,0 +1,25 @@
+/*
+ * linux/include/asm-generic/pci.h
+ *
+ *  Copyright (C) 2003 Russell King
+ */
+#ifndef _ASM_GENERIC_PCI_H
+#define _ASM_GENERIC_PCI_H
+
+/**
+ * pcibios_resource_to_bus - convert resource to PCI bus address
+ * @dev: device which owns this resource
+ * @region: converted bus-centric region (start,end)
+ * @res: resource to convert
+ *
+ * Convert a resource to a PCI device bus address or bus window.
+ */
+static inline void
+pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+			 struct resource *res)
+{
+	region->start = res->start;
+	region->end = res->end;
+}
+
+#endif
diff -urN linux-2.5.64-bk11/include/asm-i386/pci.h linux-2.5.64-bk12/include/asm-i386/pci.h
--- linux-2.5.64-bk11/include/asm-i386/pci.h	Tue Mar  4 19:29:17 2003
+++ linux-2.5.64-bk12/include/asm-i386/pci.h	Mon Mar 31 12:36:38 2003
@@ -105,4 +105,7 @@
 /* implement the pci_ DMA API in terms of the generic device dma_ one */
 #include <asm-generic/pci-dma-compat.h>
 
+/* generic pci stuff */
+#include <asm-generic/pci.h>
+
 #endif /* __i386_PCI_H */
diff -urN linux-2.5.64-bk11/include/asm-ia64/pci.h linux-2.5.64-bk12/include/asm-ia64/pci.h
--- linux-2.5.64-bk11/include/asm-ia64/pci.h	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/include/asm-ia64/pci.h	Mon Mar 31 12:36:38 2003
@@ -97,4 +97,7 @@
 extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
 				enum pci_mmap_state mmap_state, int write_combine);
 
+/* generic pci stuff */
+#include <asm-generic/pci.h>
+
 #endif /* _ASM_IA64_PCI_H */
diff -urN linux-2.5.64-bk11/include/asm-mips/pci.h linux-2.5.64-bk12/include/asm-mips/pci.h
--- linux-2.5.64-bk11/include/asm-mips/pci.h	Tue Mar  4 19:29:31 2003
+++ linux-2.5.64-bk12/include/asm-mips/pci.h	Mon Mar 31 12:36:38 2003
@@ -252,4 +252,7 @@
 
 #endif /* __KERNEL__ */
 
+/* generic pci stuff */
+#include <asm-generic/pci.h>
+
 #endif /* _ASM_PCI_H */
diff -urN linux-2.5.64-bk11/include/asm-mips64/pci.h linux-2.5.64-bk12/include/asm-mips64/pci.h
--- linux-2.5.64-bk11/include/asm-mips64/pci.h	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-bk12/include/asm-mips64/pci.h	Mon Mar 31 12:36:38 2003
@@ -272,4 +272,8 @@
 
 #endif /* __KERNEL__ */
 
+/* generic pci stuff */
+#include <asm-generic/pci.h>
+
 #endif /* _ASM_PCI_H */
+
diff -urN linux-2.5.64-bk11/include/asm-parisc/pci.h linux-2.5.64-bk12/include/asm-parisc/pci.h
--- linux-2.5.64-bk11/include/asm-parisc/pci.h	Tue Mar  4 19:29:32 2003
+++ linux-2.5.64-bk12/include/asm-parisc/pci.h	Mon Mar 31 12:36:38 2003
@@ -186,4 +186,8 @@
 /* export the pci_ DMA API in terms of the dma_ one */
 #include <asm-generic/pci-dma-compat.h>
 
+extern void
+pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
+			 struct resource *res);
+
 #endif /* __ASM_PARISC_PCI_H */
diff -urN linux-2.5.64-bk11/include/asm-ppc/pci.h linux-2.5.64-bk12/include/asm-ppc/pci.h
--- linux-2.5.64-bk11/include/asm-ppc/pci.h	Tue Mar  4 19:29:32 2003
+++ linux-2.5.64-bk12/include/asm-ppc/pci.h	Mon Mar 31 12:36:38 2003
@@ -273,4 +273,7 @@
 
 #endif	/* __KERNEL__ */
 
+/* generic pci stuff */
+#include <asm-generic/pci.h>
+
 #endif /* __PPC_PCI_H */
diff -urN linux-2.5.64-bk11/include/asm-ppc64/pci.h linux-2.5.64-bk12/include/asm-ppc64/pci.h
--- linux-2.5.64-bk11/include/asm-ppc64/pci.h	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/include/asm-ppc64/pci.h	Mon Mar 31 12:36:39 2003
@@ -124,4 +124,7 @@
 	
 #endif	/* __KERNEL__ */
 
+/* generic pci stuff */
+#include <asm-generic/pci.h>
+
 #endif /* __PPC64_PCI_H */
diff -urN linux-2.5.64-bk11/include/asm-sh/pci.h linux-2.5.64-bk12/include/asm-sh/pci.h
--- linux-2.5.64-bk11/include/asm-sh/pci.h	Tue Mar  4 19:29:30 2003
+++ linux-2.5.64-bk12/include/asm-sh/pci.h	Mon Mar 31 12:36:39 2003
@@ -240,6 +240,8 @@
 
 #endif /* __KERNEL__ */
 
+/* generic pci stuff */
+#include <asm-generic/pci.h>
 
 #endif /* __ASM_SH_PCI_H */
 
diff -urN linux-2.5.64-bk11/include/asm-sparc64/pci.h linux-2.5.64-bk12/include/asm-sparc64/pci.h
--- linux-2.5.64-bk11/include/asm-sparc64/pci.h	Tue Mar  4 19:29:00 2003
+++ linux-2.5.64-bk12/include/asm-sparc64/pci.h	Mon Mar 31 12:36:39 2003
@@ -207,4 +207,7 @@
 
 #endif /* __KERNEL__ */
 
+/* generic pci stuff */
+#include <asm-generic/pci.h>
+
 #endif /* __SPARC64_PCI_H */
diff -urN linux-2.5.64-bk11/include/asm-x86_64/pci.h linux-2.5.64-bk12/include/asm-x86_64/pci.h
--- linux-2.5.64-bk11/include/asm-x86_64/pci.h	Tue Mar  4 19:29:17 2003
+++ linux-2.5.64-bk12/include/asm-x86_64/pci.h	Mon Mar 31 12:36:39 2003
@@ -279,4 +279,7 @@
 
 #endif /* __KERNEL__ */
 
+/* generic pci stuff */
+#include <asm-generic/pci.h>
+
 #endif /* __x8664_PCI_H */
diff -urN linux-2.5.64-bk11/include/linux/aio.h linux-2.5.64-bk12/include/linux/aio.h
--- linux-2.5.64-bk11/include/linux/aio.h	Tue Mar  4 19:28:55 2003
+++ linux-2.5.64-bk12/include/linux/aio.h	Mon Mar 31 12:36:39 2003
@@ -37,9 +37,9 @@
 #define kiocbSetKicked(iocb)	set_bit(KIF_KICKED, &(iocb)->ki_flags)
 #define kiocbSetCancelled(iocb)	set_bit(KIF_CANCELLED, &(iocb)->ki_flags)
 
-#define kiocbClearLocked(iocb)	set_bit(KIF_LOCKED, &(iocb)->ki_flags)
-#define kiocbClearKicked(iocb)	set_bit(KIF_KICKED, &(iocb)->ki_flags)
-#define kiocbClearCancelled(iocb)	set_bit(KIF_CANCELLED, &(iocb)->ki_flags)
+#define kiocbClearLocked(iocb)	clear_bit(KIF_LOCKED, &(iocb)->ki_flags)
+#define kiocbClearKicked(iocb)	clear_bit(KIF_KICKED, &(iocb)->ki_flags)
+#define kiocbClearCancelled(iocb)	clear_bit(KIF_CANCELLED, &(iocb)->ki_flags)
 
 #define kiocbIsLocked(iocb)	test_bit(0, &(iocb)->ki_flags)
 #define kiocbIsKicked(iocb)	test_bit(1, &(iocb)->ki_flags)
diff -urN linux-2.5.64-bk11/include/linux/ext3_fs.h linux-2.5.64-bk12/include/linux/ext3_fs.h
--- linux-2.5.64-bk11/include/linux/ext3_fs.h	Tue Mar  4 19:29:23 2003
+++ linux-2.5.64-bk12/include/linux/ext3_fs.h	Mon Mar 31 12:36:39 2003
@@ -730,6 +730,7 @@
 extern void ext3_dirty_inode(struct inode *);
 extern int ext3_change_inode_journal_flag(struct inode *, int);
 extern void ext3_truncate (struct inode *);
+extern void ext3_set_inode_flags(struct inode *);
 
 /* ioctl.c */
 extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
diff -urN linux-2.5.64-bk11/include/linux/fs.h linux-2.5.64-bk12/include/linux/fs.h
--- linux-2.5.64-bk11/include/linux/fs.h	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/include/linux/fs.h	Mon Mar 31 12:36:39 2003
@@ -456,7 +456,10 @@
 #define get_file(x)	atomic_inc(&(x)->f_count)
 #define file_count(x)	atomic_read(&(x)->f_count)
 
-extern int init_private_file(struct file *, struct dentry *, int);
+/* Initialize and open a private file and allocate its security structure. */
+extern int open_private_file(struct file *, struct dentry *, int);
+/* Release a private file and free its security structure. */
+extern void close_private_file(struct file *file);
 
 #define	MAX_NON_LFS	((1UL<<31) - 1)
 
diff -urN linux-2.5.64-bk11/include/linux/pci.h linux-2.5.64-bk12/include/linux/pci.h
--- linux-2.5.64-bk11/include/linux/pci.h	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/include/linux/pci.h	Mon Mar 31 12:36:39 2003
@@ -485,11 +485,9 @@
 	int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val);
 };
 
-struct pbus_set_ranges_data
-{
-	unsigned long io_start, io_end;
-	unsigned long mem_start, mem_end;
-	unsigned long prefetch_start, prefetch_end;
+struct pci_bus_region {
+	unsigned long start;
+	unsigned long end;
 };
 
 struct pci_driver {
@@ -531,10 +529,7 @@
 /* Used only when drivers/pci/setup.c is used */
 void pcibios_align_resource(void *, struct resource *,
 			    unsigned long, unsigned long);
-void pcibios_update_resource(struct pci_dev *, struct resource *,
-			     struct resource *, int);
 void pcibios_update_irq(struct pci_dev *, int irq);
-void pcibios_fixup_pbus_ranges(struct pci_bus *, struct pbus_set_ranges_data *);
 
 /* Generic PCI functions used internally */
 
diff -urN linux-2.5.64-bk11/include/linux/security.h linux-2.5.64-bk12/include/linux/security.h
--- linux-2.5.64-bk11/include/linux/security.h	Tue Mar  4 19:29:32 2003
+++ linux-2.5.64-bk12/include/linux/security.h	Mon Mar 31 12:36:39 2003
@@ -48,6 +48,7 @@
 extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
 extern void cap_task_kmod_set_label (void);
 extern void cap_task_reparent_to_init (struct task_struct *p);
+extern int cap_syslog (int type);
 
 static inline int cap_netlink_send (struct sk_buff *skb)
 {
@@ -62,7 +63,6 @@
 	return 0;
 }
 
-
 /*
  * Values used in the task_security_ops calls
  */
@@ -351,10 +351,6 @@
  *	@mnt is the vfsmount where the dentry was looked up
  *	@dentry contains the dentry structure for the file.
  *	Return 0 if permission is granted.
- * @inode_post_lookup:
- *	Set the security attributes for a file after it has been looked up.
- *	@inode contains the inode structure for parent directory.
- *	@d contains the dentry structure for the file.
  * @inode_delete:
  *	@inode contains the inode structure for deleted inode.
  *	This hook is called when a deleted inode is released (i.e. an inode
@@ -926,11 +922,23 @@
  *	is NULL.
  *	@file contains the file structure for the accounting file (may be NULL).
  *	Return 0 if permission is granted.
+ * @sysctl:
+ *	Check permission before accessing the @table sysctl variable in the
+ *	manner specified by @op.
+ *	@table contains the ctl_table structure for the sysctl variable.
+ *	@op contains the operation (001 = search, 002 = write, 004 = read).
+ *	Return 0 if permission is granted.
  * @capable:
  *	Check whether the @tsk process has the @cap capability.
  *	@tsk contains the task_struct for the process.
  *	@cap contains the capability <include/linux/capability.h>.
  *	Return 0 if the capability is granted for @tsk.
+ * @syslog:
+ *	Check permission before accessing the kernel message ring or changing
+ *	logging to the console.
+ *	See the syslog(2) manual page for an explanation of the @type values.  
+ *	@type contains the type of action.
+ *	Return 0 if permission is granted.
  *
  * @register_security:
  * 	allow module stacking.
@@ -957,9 +965,11 @@
 			    kernel_cap_t * inheritable,
 			    kernel_cap_t * permitted);
 	int (*acct) (struct file * file);
+	int (*sysctl) (ctl_table * table, int op);
 	int (*capable) (struct task_struct * tsk, int cap);
 	int (*quotactl) (int cmds, int type, int id, struct super_block * sb);
 	int (*quota_on) (struct file * f);
+	int (*syslog) (int type);
 
 	int (*bprm_alloc_security) (struct linux_binprm * bprm);
 	void (*bprm_free_security) (struct linux_binprm * bprm);
@@ -969,6 +979,7 @@
 
 	int (*sb_alloc_security) (struct super_block * sb);
 	void (*sb_free_security) (struct super_block * sb);
+	int (*sb_kern_mount) (struct super_block *sb);
 	int (*sb_statfs) (struct super_block * sb);
 	int (*sb_mount) (char *dev_name, struct nameidata * nd,
 			 char *type, unsigned long flags, void *data);
@@ -1022,7 +1033,6 @@
 	int (*inode_permission_lite) (struct inode *inode, int mask);
 	int (*inode_setattr)	(struct dentry *dentry, struct iattr *attr);
 	int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
-	void (*inode_post_lookup) (struct inode *inode, struct dentry *d);
         void (*inode_delete) (struct inode *inode);
 	int (*inode_setxattr) (struct dentry *dentry, char *name, void *value,
 			       size_t size, int flags);
@@ -1111,6 +1121,8 @@
 	int (*unregister_security) (const char *name,
 	                            struct security_operations *ops);
 
+	void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
+
 #ifdef CONFIG_SECURITY_NETWORK
 	int (*unix_stream_connect) (struct socket * sock,
 				    struct socket * other, struct sock * newsk);
@@ -1178,6 +1190,11 @@
 	return security_ops->acct (file);
 }
 
+static inline int security_sysctl(ctl_table * table, int op)
+{
+	return security_ops->sysctl(table, op);
+}
+
 static inline int security_quotactl (int cmds, int type, int id,
 				     struct super_block *sb)
 {
@@ -1189,6 +1206,11 @@
 	return security_ops->quota_on (file);
 }
 
+static inline int security_syslog(int type)
+{
+	return security_ops->syslog(type);
+}
+
 static inline int security_bprm_alloc (struct linux_binprm *bprm)
 {
 	return security_ops->bprm_alloc_security (bprm);
@@ -1220,6 +1242,11 @@
 	security_ops->sb_free_security (sb);
 }
 
+static inline int security_sb_kern_mount (struct super_block *sb)
+{
+	return security_ops->sb_kern_mount (sb);
+}
+
 static inline int security_sb_statfs (struct super_block *sb)
 {
 	return security_ops->sb_statfs (sb);
@@ -1426,12 +1453,6 @@
 	return security_ops->inode_getattr (mnt, dentry);
 }
 
-static inline void security_inode_post_lookup (struct inode *inode,
-					       struct dentry *dentry)
-{
-	security_ops->inode_post_lookup (inode, dentry);
-}
-
 static inline void security_inode_delete (struct inode *inode)
 {
 	security_ops->inode_delete (inode);
@@ -1729,6 +1750,11 @@
 	return security_ops->sem_semop(sma, sops, nsops, alter);
 }
 
+static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
+{
+	security_ops->d_instantiate (dentry, inode);
+}
+
 static inline int security_netlink_send(struct sk_buff * skb)
 {
 	return security_ops->netlink_send(skb);
@@ -1793,6 +1819,11 @@
 	return 0;
 }
 
+static inline int security_sysctl(ctl_table * table, int op)
+{
+	return 0;
+}
+
 static inline int security_quotactl (int cmds, int type, int id,
 				     struct super_block * sb)
 {
@@ -1804,6 +1835,11 @@
 	return 0;
 }
 
+static inline int security_syslog(int type)
+{
+	return cap_syslog(type);
+}
+
 static inline int security_bprm_alloc (struct linux_binprm *bprm)
 {
 	return 0;
@@ -1835,6 +1871,11 @@
 static inline void security_sb_free (struct super_block *sb)
 { }
 
+static inline int security_sb_kern_mount (struct super_block *sb)
+{
+	return 0;
+}
+
 static inline int security_sb_statfs (struct super_block *sb)
 {
 	return 0;
@@ -2013,10 +2054,6 @@
 	return 0;
 }
 
-static inline void security_inode_post_lookup (struct inode *inode,
-					       struct dentry *dentry)
-{ }
-
 static inline void security_inode_delete (struct inode *inode)
 { }
 
@@ -2300,6 +2337,9 @@
 	return 0;
 }
 
+static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
+{ }
+
 /*
  * The netlink capability defaults need to be used inline by default
  * (rather than hooking into the capability module) to reduce overhead
diff -urN linux-2.5.64-bk11/include/linux/writeback.h linux-2.5.64-bk12/include/linux/writeback.h
--- linux-2.5.64-bk11/include/linux/writeback.h	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-bk12/include/linux/writeback.h	Mon Mar 31 12:36:40 2003
@@ -79,6 +79,7 @@
 extern int dirty_expire_centisecs;
 
 
+void page_writeback_init(void);
 void balance_dirty_pages(struct address_space *mapping);
 void balance_dirty_pages_ratelimited(struct address_space *mapping);
 int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
diff -urN linux-2.5.64-bk11/init/Makefile linux-2.5.64-bk12/init/Makefile
--- linux-2.5.64-bk11/init/Makefile	Tue Mar  4 19:29:17 2003
+++ linux-2.5.64-bk12/init/Makefile	Mon Mar 31 12:36:40 2003
@@ -21,5 +21,5 @@
 # actual file if its content has changed.
 
 include/linux/compile.h: FORCE
-	@echo -n '  GEN     $@'
+	@echo '  CHK     $@'
 	@sh $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
diff -urN linux-2.5.64-bk11/init/main.c linux-2.5.64-bk12/init/main.c
--- linux-2.5.64-bk11/init/main.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/init/main.c	Mon Mar 31 12:36:40 2003
@@ -35,6 +35,7 @@
 #include <linux/profile.h>
 #include <linux/rcupdate.h>
 #include <linux/moduleparam.h>
+#include <linux/writeback.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -439,6 +440,8 @@
 	vfs_caches_init(num_physpages);
 	radix_tree_init();
 	signals_init();
+	/* rootfs populating might need page-writeback */
+	page_writeback_init();
 	populate_rootfs();
 #ifdef CONFIG_PROC_FS
 	proc_root_init();
diff -urN linux-2.5.64-bk11/kernel/ksyms.c linux-2.5.64-bk12/kernel/ksyms.c
--- linux-2.5.64-bk11/kernel/ksyms.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/kernel/ksyms.c	Mon Mar 31 12:36:40 2003
@@ -177,7 +177,8 @@
 EXPORT_SYMBOL(end_buffer_io_sync);
 EXPORT_SYMBOL(__mark_inode_dirty);
 EXPORT_SYMBOL(get_empty_filp);
-EXPORT_SYMBOL(init_private_file);
+EXPORT_SYMBOL(open_private_file);
+EXPORT_SYMBOL(close_private_file);
 EXPORT_SYMBOL(filp_open);
 EXPORT_SYMBOL(filp_close);
 EXPORT_SYMBOL(put_filp);
diff -urN linux-2.5.64-bk11/kernel/printk.c linux-2.5.64-bk12/kernel/printk.c
--- linux-2.5.64-bk11/kernel/printk.c	Tue Mar  4 19:29:55 2003
+++ linux-2.5.64-bk12/kernel/printk.c	Mon Mar 31 12:36:40 2003
@@ -28,6 +28,7 @@
 #include <linux/config.h>
 #include <linux/delay.h>
 #include <linux/smp.h>
+#include <linux/security.h>
 
 #include <asm/uaccess.h>
 
@@ -161,6 +162,10 @@
 	char c;
 	int error = 0;
 
+	error = security_syslog(type);
+	if (error)
+		return error;
+
 	switch (type) {
 	case 0:		/* Close log */
 		break;
@@ -273,8 +278,6 @@
 
 asmlinkage long sys_syslog(int type, char * buf, int len)
 {
-	if ((type != 3) && !capable(CAP_SYS_ADMIN))
-		return -EPERM;
 	return do_syslog(type, buf, len);
 }
 
diff -urN linux-2.5.64-bk11/kernel/sched.c linux-2.5.64-bk12/kernel/sched.c
--- linux-2.5.64-bk11/kernel/sched.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/kernel/sched.c	Mon Mar 31 12:36:40 2003
@@ -342,10 +342,10 @@
  */
 static inline int activate_task(task_t *p, runqueue_t *rq)
 {
-	unsigned long sleep_time = jiffies - p->last_run;
+	long sleep_time = jiffies - p->last_run - 1;
 	int requeue_waker = 0;
 
-	if (sleep_time) {
+	if (sleep_time > 0) {
 		int sleep_avg;
 
 		/*
@@ -846,7 +846,7 @@
 }
 
 /*
- * Find the busiest node. All previous node loads contribute with a 
+ * Find the busiest node. All previous node loads contribute with a
  * geometrically deccaying weight to the load measure:
  *      load_{t} = load_{t-1}/2 + nr_node_running_{t}
  * This way sudden load peaks are flattened out a bit.
@@ -854,7 +854,7 @@
 static int find_busiest_node(int this_node)
 {
 	int i, node = -1, load, this_load, maxload;
-	
+
 	this_load = maxload = (this_rq()->prev_node_load[this_node] >> 1)
 		+ atomic_read(&node_nr_running[this_node]);
 	this_rq()->prev_node_load[this_node] = this_load;
@@ -1194,8 +1194,8 @@
 	runqueue_t *rq = this_rq();
 	task_t *p = current;
 
- 	if (rcu_pending(cpu))
- 		rcu_check_callbacks(cpu, user_ticks);
+	if (rcu_pending(cpu))
+		rcu_check_callbacks(cpu, user_ticks);
 
 	if (p == rq->idle) {
 		/* note: this timer irq context must be accounted for as well */
@@ -1353,7 +1353,7 @@
 	if (likely(prev != next)) {
 		rq->nr_switches++;
 		rq->curr = next;
-	
+
 		prepare_arch_switch(rq, next);
 		prev = context_switch(rq, prev, next);
 		barrier();
@@ -1483,7 +1483,7 @@
 }
 
 #endif
- 
+
 void complete(struct completion *x)
 {
 	unsigned long flags;
@@ -1567,7 +1567,7 @@
 void sleep_on(wait_queue_head_t *q)
 {
 	SLEEP_ON_VAR
-	
+
 	current->state = TASK_UNINTERRUPTIBLE;
 
 	SLEEP_ON_HEAD
@@ -1578,7 +1578,7 @@
 long sleep_on_timeout(wait_queue_head_t *q, long timeout)
 {
 	SLEEP_ON_VAR
-	
+
 	current->state = TASK_UNINTERRUPTIBLE;
 
 	SLEEP_ON_HEAD
@@ -2472,12 +2472,12 @@
 
 static void kstat_init_cpu(int cpu)
 {
-        /* Add any initialisation to kstat here */
-        /* Useful when cpu offlining logic is added.. */
+	/* Add any initialisation to kstat here */
+	/* Useful when cpu offlining logic is added.. */
 }
 
 static int __devinit kstat_cpu_notify(struct notifier_block *self,
-                                unsigned long action, void *hcpu)
+					unsigned long action, void *hcpu)
 {
 	int cpu = (unsigned long)hcpu;
 	switch(action) {
@@ -2489,7 +2489,7 @@
 	}
 	return NOTIFY_OK;
 }
- 
+
 static struct notifier_block __devinitdata kstat_nb = {
 	.notifier_call  = kstat_cpu_notify,
 	.next           = NULL,
@@ -2498,7 +2498,7 @@
 __init static void init_kstat(void) {
 	kstat_cpu_notify(&kstat_nb, (unsigned long)CPU_UP_PREPARE,
 			(void *)(long)smp_processor_id());
-	register_cpu_notifier(&kstat_nb);  
+	register_cpu_notifier(&kstat_nb);
 }
 
 void __init sched_init(void)
@@ -2538,7 +2538,6 @@
 	rq->idle = current;
 	set_task_cpu(current, smp_processor_id());
 	wake_up_forked_process(current);
-	current->prio = MAX_PRIO;
 
 	init_timers();
 
diff -urN linux-2.5.64-bk11/kernel/sys.c linux-2.5.64-bk12/kernel/sys.c
--- linux-2.5.64-bk11/kernel/sys.c	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-bk12/kernel/sys.c	Mon Mar 31 12:36:40 2003
@@ -212,18 +212,25 @@
 
 static int set_one_prio(struct task_struct *p, int niceval, int error)
 {
+	int no_nice;
+
 	if (p->uid != current->euid &&
 		p->uid != current->uid && !capable(CAP_SYS_NICE)) {
 		error = -EPERM;
 		goto out;
 	}
-
+	if (niceval < task_nice(p) && !capable(CAP_SYS_NICE)) {
+		error = -EACCES;
+		goto out;
+	}
+	no_nice = security_task_setnice(p, niceval);
+	if (no_nice) {
+		error = no_nice;
+		goto out;
+	}
 	if (error == -ESRCH)
 		error = 0;
-	if (niceval < task_nice(p) && !capable(CAP_SYS_NICE))
-		error = -EACCES;
-	else
-		set_user_nice(p, niceval);
+	set_user_nice(p, niceval);
 out:
 	return error;
 }
@@ -941,6 +948,10 @@
 	}
 
 ok_pgid:
+	err = security_task_setpgid(p, pgid);
+	if (err)
+		goto out;
+
 	if (p->pgrp != pgid) {
 		detach_pid(p, PIDTYPE_PGID);
 		p->pgrp = pgid;
diff -urN linux-2.5.64-bk11/kernel/sysctl.c linux-2.5.64-bk12/kernel/sysctl.c
--- linux-2.5.64-bk11/kernel/sysctl.c	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-bk12/kernel/sysctl.c	Mon Mar 31 12:36:40 2003
@@ -33,6 +33,7 @@
 #include <linux/highuid.h>
 #include <linux/writeback.h>
 #include <linux/hugetlb.h>
+#include <linux/security.h>
 #include <asm/uaccess.h>
 
 #ifdef CONFIG_ROOT_NFS
@@ -432,6 +433,10 @@
 
 static inline int ctl_perm(ctl_table *table, int op)
 {
+	int error;
+	error = security_sysctl(table, op);
+	if (error)
+		return error;
 	return test_perm(table->mode, op);
 }
 
diff -urN linux-2.5.64-bk11/mm/memory.c linux-2.5.64-bk12/mm/memory.c
--- linux-2.5.64-bk11/mm/memory.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/mm/memory.c	Mon Mar 31 12:36:40 2003
@@ -484,16 +484,6 @@
 #define ZAP_BLOCK_SIZE	(~(0UL))
 #endif
 
-/*
- * hugepage regions must be unmapped with HPAGE_SIZE granularity
- */
-static inline unsigned long zap_block_size(struct vm_area_struct *vma)
-{
-	if (is_vm_hugetlb_page(vma))
-		return HPAGE_SIZE;
-	return ZAP_BLOCK_SIZE;
-}
-
 /**
  * unmap_vmas - unmap a range of memory covered by a list of vma's
  * @tlbp: address of the caller's struct mmu_gather
@@ -524,7 +514,7 @@
 		struct vm_area_struct *vma, unsigned long start_addr,
 		unsigned long end_addr, unsigned long *nr_accounted)
 {
-	unsigned long zap_bytes = zap_block_size(vma);
+	unsigned long zap_bytes = ZAP_BLOCK_SIZE;
 	unsigned long tlb_start;	/* For tlb_finish_mmu */
 	int tlb_start_valid = 0;
 	int ret = 0;
@@ -554,7 +544,12 @@
 
 		ret++;
 		while (start != end) {
-			unsigned long block = min(zap_bytes, end - start);
+			unsigned long block;
+
+			if (is_vm_hugetlb_page(vma))
+				block = end - start;
+			else
+				block = min(zap_bytes, end - start);
 
 			if (!tlb_start_valid) {
 				tlb_start = start;
@@ -564,7 +559,7 @@
 			unmap_page_range(*tlbp, vma, start, start + block);
 			start += block;
 			zap_bytes -= block;
-			if (zap_bytes != 0)
+			if ((long)zap_bytes > 0)
 				continue;
 			if (need_resched()) {
 				tlb_finish_mmu(*tlbp, tlb_start, start);
@@ -572,7 +567,7 @@
 				*tlbp = tlb_gather_mmu(mm, 0);
 				tlb_start_valid = 0;
 			}
-			zap_bytes = zap_block_size(vma);
+			zap_bytes = ZAP_BLOCK_SIZE;
 		}
 		if (vma->vm_next && vma->vm_next->vm_start < vma->vm_end)
 			printk("%s: VMA list is not sorted correctly!\n",
diff -urN linux-2.5.64-bk11/mm/page-writeback.c linux-2.5.64-bk12/mm/page-writeback.c
--- linux-2.5.64-bk11/mm/page-writeback.c	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/mm/page-writeback.c	Mon Mar 31 12:36:40 2003
@@ -369,7 +369,7 @@
  * dirty memory thresholds: allowing too much dirty highmem pins an excessive
  * number of buffer_heads.
  */
-static int __init page_writeback_init(void)
+void __init page_writeback_init(void)
 {
 	long buffer_pages = nr_free_buffer_pages();
 	long correction;
@@ -392,9 +392,7 @@
 	add_timer(&wb_timer);
 	set_ratelimit();
 	register_cpu_notifier(&ratelimit_nb);
-	return 0;
 }
-module_init(page_writeback_init);
 
 int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {
diff -urN linux-2.5.64-bk11/scripts/Makefile linux-2.5.64-bk12/scripts/Makefile
--- linux-2.5.64-bk11/scripts/Makefile	Tue Mar  4 19:29:20 2003
+++ linux-2.5.64-bk12/scripts/Makefile	Mon Mar 31 12:36:41 2003
@@ -8,11 +8,11 @@
 # docproc: 	 Preprocess .tmpl file in order to generate .sgml docs
 # conmakehash:	 Create arrays for initializing the kernel console tables
 
-host-progs    := fixdep split-include conmakehash docproc kallsyms modpost \
-		 mk_elfconfig
-build-targets := $(host-progs) empty.o
+host-progs	:= fixdep split-include conmakehash docproc kallsyms modpost \
+		   mk_elfconfig
+always		:= $(host-progs) empty.o
 
-modpost-objs  := modpost.o file2alias.o
+modpost-objs	:= modpost.o file2alias.o
 
 subdir-$(CONFIG_MODVERSIONS)	+= genksyms
 
@@ -20,7 +20,7 @@
 subdir-	+= lxdialog kconfig
 
 # fixdep is needed to compile other host programs
-$(addprefix $(obj)/,$(filter-out fixdep,$(build-targets)) $(subdir-y)): $(obj)/fixdep
+$(addprefix $(obj)/,$(filter-out fixdep,$(always)) $(subdir-y)): $(obj)/fixdep
 
 # dependencies on generated files need to be listed explicitly
 
@@ -32,4 +32,4 @@
 $(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE
 	$(call if_changed,elfconfig)
 
-targets += $(obj)/elfconfig.h
+targets += elfconfig.h
diff -urN linux-2.5.64-bk11/scripts/Makefile.build linux-2.5.64-bk12/scripts/Makefile.build
--- linux-2.5.64-bk11/scripts/Makefile.build	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/scripts/Makefile.build	Mon Mar 31 12:36:41 2003
@@ -15,6 +15,14 @@
 
 include scripts/Makefile.lib
 
+ifdef EXTRA_TARGETS
+$(warning kbuild: $(obj)/Makefile - Usage of EXTRA_TARGETS is obsolete in 2.5. Please fix!)
+endif
+
+ifdef build-targets
+$(warning kbuild: $(obj)/Makefile - Usage of build-targets is obsolete in 2.5. Please fix!)
+endif
+
 ifdef export-objs
 $(warning kbuild: $(obj)/Makefile - Usage of export-objs is obsolete in 2.5. Please fix!)
 endif
@@ -53,9 +61,9 @@
 
 touch-module = @echo $(@:.o=.ko) > $(MODVERDIR)/$(@F:.o=.mod)
 
-__build: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
+__build: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(extra-y)) \
 	 $(if $(KBUILD_MODULES),$(obj-m)) \
-	 $(subdir-ym) $(build-targets)
+	 $(subdir-ym) $(always)
 	@:
 
 # Module versioning
@@ -198,8 +206,7 @@
 %.o: %.S FORCE
 	$(call if_changed_dep,as_o_S)
 
-targets += $(real-objs-y) $(real-objs-m) $(EXTRA_TARGETS) $(MAKECMDGOALS) \
-	   $(build-targets)
+targets += $(real-objs-y) $(real-objs-m) $(extra-y) $(MAKECMDGOALS) $(always)
 
 # Build the compiled-in targets
 # ---------------------------------------------------------------------------
diff -urN linux-2.5.64-bk11/scripts/Makefile.clean linux-2.5.64-bk12/scripts/Makefile.clean
--- linux-2.5.64-bk11/scripts/Makefile.clean	Tue Mar  4 19:28:52 2003
+++ linux-2.5.64-bk12/scripts/Makefile.clean	Mon Mar 31 12:36:41 2003
@@ -28,15 +28,13 @@
 
 # Add subdir path
 
-EXTRA_TARGETS	:= $(addprefix $(obj)/,$(EXTRA_TARGETS))
-clean-files	:= $(addprefix $(obj)/,$(clean-files))
-host-progs	:= $(addprefix $(obj)/,$(host-progs))
 subdir-ymn	:= $(addprefix $(obj)/,$(subdir-ymn))
+__clean-files	:= $(wildcard $(addprefix $(obj)/, \
+		   $(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \
+		   $(targets) $(clean-files)))
 
 # ==========================================================================
 
-__clean-files := $(wildcard $(EXTRA_TARGETS) $(host-progs) $(clean-files) $(targets))
-
 quiet_cmd_clean = CLEAN   $(obj)
       cmd_clean = rm -f $(__clean-files); $(clean-rule)
 
diff -urN linux-2.5.64-bk11/scripts/Makefile.lib linux-2.5.64-bk12/scripts/Makefile.lib
--- linux-2.5.64-bk11/scripts/Makefile.lib	Tue Mar  4 19:29:19 2003
+++ linux-2.5.64-bk12/scripts/Makefile.lib	Mon Mar 31 12:36:41 2003
@@ -8,6 +8,8 @@
 empty   :=
 space   := $(empty) $(empty)
 
+# Backward compatibility - to be removed...
+extra-y	+= $(EXTRA_TARGETS)
 # Figure out what we need to build from the various variables
 # ===========================================================================
 
@@ -51,7 +53,7 @@
 subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
 
 # Replace multi-part objects by their individual parts, look at local dir only
-real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(EXTRA_TARGETS)
+real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
 real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
 
 # C code
@@ -84,8 +86,9 @@
 
 # Add subdir path
 
-EXTRA_TARGETS	:= $(addprefix $(obj)/,$(EXTRA_TARGETS))
-build-targets	:= $(addprefix $(obj)/,$(build-targets))
+extra-y		:= $(addprefix $(obj)/,$(extra-y))
+always		:= $(addprefix $(obj)/,$(always))
+targets		:= $(addprefix $(obj)/,$(targets))
 obj-y		:= $(addprefix $(obj)/,$(obj-y))
 obj-m		:= $(addprefix $(obj)/,$(obj-m))
 subdir-obj-y	:= $(addprefix $(obj)/,$(subdir-obj-y))
diff -urN linux-2.5.64-bk11/scripts/genksyms/Makefile linux-2.5.64-bk12/scripts/genksyms/Makefile
--- linux-2.5.64-bk11/scripts/genksyms/Makefile	Tue Mar  4 19:29:36 2003
+++ linux-2.5.64-bk12/scripts/genksyms/Makefile	Mon Mar 31 12:36:41 2003
@@ -1,6 +1,6 @@
 
 host-progs	:= genksyms
-build-targets	:= $(host-progs)
+always		:= $(host-progs)
 
 genksyms-objs	:= genksyms.o parse.o lex.o
 
diff -urN linux-2.5.64-bk11/scripts/lxdialog/Makefile linux-2.5.64-bk12/scripts/lxdialog/Makefile
--- linux-2.5.64-bk11/scripts/lxdialog/Makefile	Tue Mar  4 19:29:33 2003
+++ linux-2.5.64-bk12/scripts/lxdialog/Makefile	Mon Mar 31 12:36:41 2003
@@ -15,8 +15,8 @@
 endif
 endif
 
-host-progs    := lxdialog
-build-targets := $(host-progs)
+host-progs	:= lxdialog
+always		:= $(host-progs)
 
 lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \
 		 util.o lxdialog.o msgbox.o
diff -urN linux-2.5.64-bk11/scripts/mkcompile_h linux-2.5.64-bk12/scripts/mkcompile_h
--- linux-2.5.64-bk11/scripts/mkcompile_h	Tue Mar  4 19:29:57 2003
+++ linux-2.5.64-bk12/scripts/mkcompile_h	Mon Mar 31 12:36:41 2003
@@ -10,7 +10,7 @@
 # do "compiled by root"
 
 if [ -r $TARGET -a ! -O include/linux/autoconf.h ]; then
-  echo ' (not modified)'
+  echo "  SKIPPED $TARGET"
   exit 0
 fi
 
@@ -70,10 +70,9 @@
       grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' $TARGET > .tmpver.1 && \
       grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' .tmpcompile > .tmpver.2 && \
       cmp -s .tmpver.1 .tmpver.2; then
-   echo ' (unchanged)'
    rm -f .tmpcompile
 else
-   echo ' (updated)'
+   echo "  UPD     $TARGET"
    mv -f .tmpcompile $TARGET
 fi
-#rm -f .tmpver.1 .tmpver.2
+rm -f .tmpver.1 .tmpver.2
diff -urN linux-2.5.64-bk11/security/capability.c linux-2.5.64-bk12/security/capability.c
--- linux-2.5.64-bk11/security/capability.c	Tue Mar  4 19:29:16 2003
+++ linux-2.5.64-bk12/security/capability.c	Mon Mar 31 12:36:41 2003
@@ -263,6 +263,13 @@
 	return;
 }
 
+int cap_syslog (int type)
+{
+	if ((type != 3) && !capable(CAP_SYS_ADMIN))
+		return -EPERM;
+	return 0;
+}
+
 EXPORT_SYMBOL(cap_capable);
 EXPORT_SYMBOL(cap_ptrace);
 EXPORT_SYMBOL(cap_capget);
@@ -273,6 +280,7 @@
 EXPORT_SYMBOL(cap_task_post_setuid);
 EXPORT_SYMBOL(cap_task_kmod_set_label);
 EXPORT_SYMBOL(cap_task_reparent_to_init);
+EXPORT_SYMBOL(cap_syslog);
 
 #ifdef CONFIG_SECURITY
 
@@ -292,6 +300,8 @@
 	.task_post_setuid =		cap_task_post_setuid,
 	.task_kmod_set_label =		cap_task_kmod_set_label,
 	.task_reparent_to_init =	cap_task_reparent_to_init,
+
+	.syslog =                       cap_syslog,
 };
 
 #if defined(CONFIG_SECURITY_CAPABILITIES_MODULE)
diff -urN linux-2.5.64-bk11/security/dummy.c linux-2.5.64-bk12/security/dummy.c
--- linux-2.5.64-bk11/security/dummy.c	Tue Mar  4 19:29:03 2003
+++ linux-2.5.64-bk12/security/dummy.c	Mon Mar 31 12:36:41 2003
@@ -75,6 +75,11 @@
 	return -EPERM;
 }
 
+static int dummy_sysctl (ctl_table * table, int op)
+{
+	return 0;
+}
+
 static int dummy_quotactl (int cmds, int type, int id, struct super_block *sb)
 {
 	return 0;
@@ -85,6 +90,13 @@
 	return 0;
 }
 
+static int dummy_syslog (int type)
+{
+	if ((type != 3) && current->euid)
+		return -EPERM;
+	return 0;
+}
+
 static int dummy_bprm_alloc_security (struct linux_binprm *bprm)
 {
 	return 0;
@@ -120,6 +132,11 @@
 	return;
 }
 
+static int dummy_sb_kern_mount (struct super_block *sb)
+{
+	return 0;
+}
+
 static int dummy_sb_statfs (struct super_block *sb)
 {
 	return 0;
@@ -306,11 +323,6 @@
 	return 0;
 }
 
-static void dummy_inode_post_lookup (struct inode *ino, struct dentry *d)
-{
-	return;
-}
-
 static void dummy_inode_delete (struct inode *ino)
 {
 	return;
@@ -719,6 +731,12 @@
 	return -EINVAL;
 }
 
+static void dummy_d_instantiate (struct dentry *dentry, struct inode *inode)
+{
+	return;
+}
+
+
 struct security_operations dummy_security_ops;
 
 #define set_to_dummy_if_null(ops, function)				\
@@ -740,6 +758,8 @@
 	set_to_dummy_if_null(ops, capable);
 	set_to_dummy_if_null(ops, quotactl);
 	set_to_dummy_if_null(ops, quota_on);
+	set_to_dummy_if_null(ops, sysctl);
+	set_to_dummy_if_null(ops, syslog);
 	set_to_dummy_if_null(ops, bprm_alloc_security);
 	set_to_dummy_if_null(ops, bprm_free_security);
 	set_to_dummy_if_null(ops, bprm_compute_creds);
@@ -747,6 +767,7 @@
 	set_to_dummy_if_null(ops, bprm_check_security);
 	set_to_dummy_if_null(ops, sb_alloc_security);
 	set_to_dummy_if_null(ops, sb_free_security);
+	set_to_dummy_if_null(ops, sb_kern_mount);
 	set_to_dummy_if_null(ops, sb_statfs);
 	set_to_dummy_if_null(ops, sb_mount);
 	set_to_dummy_if_null(ops, sb_check_sb);
@@ -780,7 +801,6 @@
 	set_to_dummy_if_null(ops, inode_permission_lite);
 	set_to_dummy_if_null(ops, inode_setattr);
 	set_to_dummy_if_null(ops, inode_getattr);
-	set_to_dummy_if_null(ops, inode_post_lookup);
 	set_to_dummy_if_null(ops, inode_delete);
 	set_to_dummy_if_null(ops, inode_setxattr);
 	set_to_dummy_if_null(ops, inode_getxattr);
@@ -839,6 +859,7 @@
 	set_to_dummy_if_null(ops, netlink_recv);
 	set_to_dummy_if_null(ops, register_security);
 	set_to_dummy_if_null(ops, unregister_security);
+	set_to_dummy_if_null(ops, d_instantiate);
 #ifdef CONFIG_SECURITY_NETWORK
 	set_to_dummy_if_null(ops, unix_stream_connect);
 	set_to_dummy_if_null(ops, unix_may_send);
diff -urN linux-2.5.64-bk11/usr/Makefile linux-2.5.64-bk12/usr/Makefile
--- linux-2.5.64-bk11/usr/Makefile	Mon Mar 31 12:36:27 2003
+++ linux-2.5.64-bk12/usr/Makefile	Mon Mar 31 12:36:42 2003
@@ -25,10 +25,10 @@
 $(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio $(initramfs-y) FORCE
 	$(call if_changed,cpio)
 
-targets += $(obj)/initramfs_data.cpio
+targets += initramfs_data.cpio
 
 $(obj)/initramfs_data.cpio.gz: $(obj)/initramfs_data.cpio FORCE
 	$(call if_changed,gzip)
 
-targets += $(obj)/initramfs_data.cpio.gz
+targets += initramfs_data.cpio.gz
 
