aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/kernel/vmlinux.lds.S8
-rw-r--r--arch/arm/kernel/vmlinux.lds.S8
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c4
-rw-r--r--arch/arm/mach-lh7a40x/Kconfig4
-rw-r--r--arch/avr32/Makefile21
-rw-r--r--arch/avr32/boot/images/Makefile4
-rw-r--r--arch/avr32/configs/atstk1002_defconfig253
-rw-r--r--arch/avr32/kernel/avr32_ksyms.c9
-rw-r--r--arch/avr32/kernel/kprobes.c2
-rw-r--r--arch/avr32/kernel/module.c4
-rw-r--r--arch/avr32/kernel/ptrace.c2
-rw-r--r--arch/avr32/kernel/vmlinux.lds.c8
-rw-r--r--arch/avr32/lib/Makefile1
-rw-r--r--arch/avr32/lib/io-readsb.S47
-rw-r--r--arch/avr32/lib/io-writesb.S52
-rw-r--r--arch/avr32/mach-at32ap/hsmc.h4
-rw-r--r--arch/avr32/mach-at32ap/intc.h6
-rw-r--r--arch/avr32/mach-at32ap/pio.h6
-rw-r--r--arch/avr32/mach-at32ap/sm.h6
-rw-r--r--arch/avr32/mm/init.c2
-rw-r--r--arch/avr32/mm/ioremap.c2
-rw-r--r--arch/frv/kernel/vmlinux.lds.S8
-rw-r--r--arch/h8300/kernel/vmlinux.lds.S8
-rw-r--r--arch/i386/kernel/setup.c2
-rw-r--r--arch/i386/kernel/vmlinux.lds.S8
-rw-r--r--arch/i386/mach-visws/visws_apic.c7
-rw-r--r--arch/i386/pci/fixup.c55
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S8
-rw-r--r--arch/ia64/pci/Makefile2
-rw-r--r--arch/ia64/pci/fixup.c69
-rw-r--r--arch/m32r/kernel/vmlinux.lds.S8
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds8
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds8
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S8
-rw-r--r--arch/mips/kernel/vmlinux.lds.S8
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S8
-rw-r--r--arch/powerpc/boot/Makefile2
-rw-r--r--arch/powerpc/configs/cell_defconfig19
-rw-r--r--arch/powerpc/kernel/cputable.c86
-rw-r--r--arch/powerpc/kernel/head_64.S21
-rw-r--r--arch/powerpc/kernel/misc_32.S74
-rw-r--r--arch/powerpc/kernel/misc_64.S124
-rw-r--r--arch/powerpc/kernel/module_32.c39
-rw-r--r--arch/powerpc/kernel/module_64.c49
-rw-r--r--arch/powerpc/kernel/prom.c8
-rw-r--r--arch/powerpc/kernel/setup_32.c8
-rw-r--r--arch/powerpc/kernel/setup_64.c11
-rw-r--r--arch/powerpc/kernel/time.c63
-rw-r--r--arch/powerpc/kernel/vdso.c43
-rw-r--r--arch/powerpc/kernel/vdso32/vdso32.lds.S12
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S6
-rw-r--r--arch/powerpc/kernel/vdso64/vdso64.lds.S10
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S8
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/hw_ops.c2
-rw-r--r--arch/powerpc/platforms/chrp/setup.c4
-rw-r--r--arch/powerpc/platforms/iseries/setup.c5
-rw-r--r--arch/powerpc/platforms/powermac/sleep.S3
-rw-r--r--arch/powerpc/sysdev/i8259.c5
-rw-r--r--arch/powerpc/sysdev/ipic.c4
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_fast.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_slow.c2
-rw-r--r--arch/powerpc/sysdev/tsi108_dev.c4
-rw-r--r--arch/ppc/boot/simple/relocate.S6
-rw-r--r--arch/ppc/kernel/misc.S74
-rw-r--r--arch/ppc/kernel/setup.c10
-rw-r--r--arch/ppc/kernel/vmlinux.lds.S8
-rw-r--r--arch/s390/appldata/appldata_base.c1
-rw-r--r--arch/s390/kernel/compat_linux.c4
-rw-r--r--arch/s390/kernel/compat_signal.c12
-rw-r--r--arch/s390/kernel/compat_wrapper.S2
-rw-r--r--arch/s390/kernel/signal.c12
-rw-r--r--arch/s390/kernel/traps.c20
-rw-r--r--arch/s390/kernel/vmlinux.lds.S8
-rw-r--r--arch/sh/kernel/vmlinux.lds.S8
-rw-r--r--arch/sh64/kernel/vmlinux.lds.S8
-rw-r--r--arch/sparc/kernel/ebus.c8
-rw-r--r--arch/sparc/kernel/of_device.c2
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S8
-rw-r--r--arch/sparc64/kernel/central.c4
-rw-r--r--arch/sparc64/kernel/ebus.c8
-rw-r--r--arch/sparc64/kernel/isa.c8
-rw-r--r--arch/sparc64/kernel/of_device.c35
-rw-r--r--arch/sparc64/kernel/pci_iommu.c2
-rw-r--r--arch/sparc64/kernel/prom.c30
-rw-r--r--arch/sparc64/kernel/vmlinux.lds.S8
-rw-r--r--arch/v850/kernel/vmlinux.lds.S8
-rw-r--r--arch/x86_64/kernel/io_apic.c62
-rw-r--r--arch/x86_64/kernel/smpboot.c7
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S8
-rw-r--r--arch/x86_64/pci/mmconfig.c5
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S8
-rw-r--r--drivers/base/Kconfig4
-rw-r--r--drivers/base/dd.c30
-rw-r--r--drivers/block/cciss.c8
-rw-r--r--drivers/char/drm/drm_bufs.c4
-rw-r--r--drivers/char/drm/drm_sysfs.c43
-rw-r--r--drivers/char/drm/mga_drv.c1
-rw-r--r--drivers/char/drm/r300_cmdbuf.c33
-rw-r--r--drivers/char/drm/radeon_state.c109
-rw-r--r--drivers/char/drm/savage_bci.c1
-rw-r--r--drivers/char/drm/savage_state.c2
-rw-r--r--drivers/char/watchdog/sc1200wdt.c9
-rw-r--r--drivers/fc4/fc.c28
-rw-r--r--drivers/fc4/fcp_impl.h15
-rw-r--r--drivers/ide/pci/generic.c6
-rw-r--r--drivers/ieee1394/ohci1394.c19
-rw-r--r--drivers/md/md.c8
-rw-r--r--drivers/md/multipath.c2
-rw-r--r--drivers/md/raid1.c4
-rw-r--r--drivers/md/raid10.c4
-rw-r--r--drivers/message/fusion/mptbase.h4
-rw-r--r--drivers/message/fusion/mptfc.c89
-rw-r--r--drivers/misc/ioc4.c4
-rw-r--r--drivers/mtd/nand/nand_base.c1
-rw-r--r--drivers/net/Kconfig1
-rw-r--r--drivers/net/e100.c10
-rw-r--r--drivers/net/e1000/e1000_ethtool.c4
-rw-r--r--drivers/net/e1000/e1000_hw.h6
-rw-r--r--drivers/net/e1000/e1000_main.c41
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c6
-rw-r--r--drivers/pci/pci-driver.c13
-rw-r--r--drivers/pci/quirks.c73
-rw-r--r--drivers/pci/rom.c5
-rw-r--r--drivers/s390/cio/css.c7
-rw-r--r--drivers/s390/cio/device.c3
-rw-r--r--drivers/s390/cio/device.h1
-rw-r--r--drivers/s390/crypto/ap_bus.c7
-rw-r--r--drivers/s390/scsi/zfcp_def.h4
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c1
-rw-r--r--drivers/sbus/sbus.c4
-rw-r--r--drivers/scsi/aic7xxx/aic79xx.h66
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c350
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_inline.h30
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c45
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.h5
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm_pci.c2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_pci.c7
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_proc.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx.h11
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c40
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c72
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.h13
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_pci.c4
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_proc.c10
-rw-r--r--drivers/scsi/aic7xxx_old.c2
-rw-r--r--drivers/scsi/aic94xx/aic94xx_hwi.h1
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c2
-rw-r--r--drivers/scsi/aic94xx/aic94xx_sds.c4
-rw-r--r--drivers/scsi/fdomain.c30
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c2
-rw-r--r--drivers/scsi/libiscsi.c69
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c3
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c3
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c42
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.h46
-rw-r--r--drivers/scsi/pcmcia/nsp_debug.c4
-rw-r--r--drivers/scsi/pcmcia/nsp_message.c4
-rw-r--r--drivers/scsi/psi240i.c31
-rw-r--r--drivers/scsi/psi240i.h6
-rw-r--r--drivers/scsi/qla1280.c7
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c51
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.h14
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c23
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c91
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c35
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h2
-rw-r--r--drivers/scsi/qla4xxx/ql4_dbg.h4
-rw-r--r--drivers/scsi/qla4xxx/ql4_glbl.h2
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c10
-rw-r--r--drivers/scsi/qlogicfas408.c18
-rw-r--r--drivers/scsi/qlogicfas408.h29
-rw-r--r--drivers/scsi/scsi_debug.c141
-rw-r--r--drivers/scsi/scsi_lib.c2
-rw-r--r--drivers/scsi/scsi_sysfs.c2
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c246
-rw-r--r--drivers/scsi/st.c5
-rw-r--r--drivers/scsi/sun3_NCR5380.c109
-rw-r--r--drivers/scsi/sun3_scsi.c7
-rw-r--r--drivers/scsi/sun3_scsi.h7
-rw-r--r--drivers/scsi/sun3_scsi_vme.c7
-rw-r--r--drivers/scsi/tmscsim.c1
-rw-r--r--drivers/video/backlight/corgi_bl.c4
-rw-r--r--drivers/video/intelfb/intelfbhw.c6
-rw-r--r--fs/Kconfig2
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/dcache.c19
-rw-r--r--fs/ext4/resize.c23
-rw-r--r--fs/hugetlbfs/inode.c25
-rw-r--r--fs/jbd/transaction.c15
-rw-r--r--fs/jbd2/transaction.c15
-rw-r--r--fs/splice.c9
-rw-r--r--include/asm-arm/arch-pxa/irqs.h2
-rw-r--r--include/asm-avr32/atomic.h8
-rw-r--r--include/asm-avr32/io.h33
-rw-r--r--include/asm-generic/vmlinux.lds.h17
-rw-r--r--include/asm-i386/mach-visws/do_timer.h53
-rw-r--r--include/asm-i386/mach-visws/mach_apic.h5
-rw-r--r--include/asm-powerpc/asm-compat.h52
-rw-r--r--include/asm-powerpc/cputable.h37
-rw-r--r--include/asm-powerpc/firmware.h17
-rw-r--r--include/asm-powerpc/i8259.h1
-rw-r--r--include/asm-powerpc/ppc_asm.h18
-rw-r--r--include/asm-powerpc/prom.h10
-rw-r--r--include/asm-powerpc/reg.h26
-rw-r--r--include/asm-powerpc/time.h27
-rw-r--r--include/asm-powerpc/timex.h20
-rw-r--r--include/asm-x86_64/hw_irq.h2
-rw-r--r--include/linux/compat.h2
-rw-r--r--include/linux/init.h28
-rw-r--r--include/linux/mmzone.h6
-rw-r--r--include/linux/pagemap.h14
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/taskstats_kern.h31
-rw-r--r--include/linux/vmalloc.h3
-rw-r--r--include/scsi/libiscsi.h3
-rw-r--r--include/scsi/scsi.h5
-rw-r--r--include/scsi/scsi_transport_iscsi.h4
-rw-r--r--kernel/compat.c2
-rw-r--r--kernel/cpu.c12
-rw-r--r--kernel/exit.c1
-rw-r--r--kernel/fork.c3
-rw-r--r--kernel/module.c2
-rw-r--r--kernel/taskstats.c70
-rw-r--r--kernel/time/ntp.c2
-rw-r--r--kernel/tsacct.c7
-rw-r--r--kernel/workqueue.c6
-rw-r--r--lib/string.c2
-rw-r--r--mm/filemap.c24
-rw-r--r--mm/hugetlb.c3
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/sparse.c2
-rw-r--r--mm/vmalloc.c18
-rw-r--r--mm/vmscan.c63
-rw-r--r--mm/vmstat.c2
-rw-r--r--net/bridge/br_sysfs_br.c2
-rw-r--r--net/ieee80211/Kconfig2
-rw-r--r--net/ipv4/tcp_cubic.c6
-rw-r--r--net/ipv4/tcp_htcp.c2
-rw-r--r--scripts/mod/modpost.c2
246 files changed, 2704 insertions, 2095 deletions
diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index 71470e9d93ba..76bf071e376c 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -48,13 +48,7 @@ SECTIONS
48 . = ALIGN(8); 48 . = ALIGN(8);
49 __initcall_start = .; 49 __initcall_start = .;
50 .initcall.init : { 50 .initcall.init : {
51 *(.initcall1.init) 51 INITCALLS
52 *(.initcall2.init)
53 *(.initcall3.init)
54 *(.initcall4.init)
55 *(.initcall5.init)
56 *(.initcall6.init)
57 *(.initcall7.init)
58 } 52 }
59 __initcall_end = .; 53 __initcall_end = .;
60 54
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 3ca574ee2772..a8fa75ea07a9 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -45,13 +45,7 @@ SECTIONS
45 *(.early_param.init) 45 *(.early_param.init)
46 __early_end = .; 46 __early_end = .;
47 __initcall_start = .; 47 __initcall_start = .;
48 *(.initcall1.init) 48 INITCALLS
49 *(.initcall2.init)
50 *(.initcall3.init)
51 *(.initcall4.init)
52 *(.initcall5.init)
53 *(.initcall6.init)
54 *(.initcall7.init)
55 __initcall_end = .; 49 __initcall_end = .;
56 __con_initcall_start = .; 50 __con_initcall_start = .;
57 *(.con_initcall.init) 51 *(.con_initcall.init)
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index 9ee63834e603..0fdd03ab36e6 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -135,11 +135,11 @@ static void ixdp2400_pci_postinit(void)
135 if (ixdp2x00_master_npu()) { 135 if (ixdp2x00_master_npu()) {
136 dev = pci_get_bus_and_slot(1, IXDP2400_SLAVE_ENET_DEVFN); 136 dev = pci_get_bus_and_slot(1, IXDP2400_SLAVE_ENET_DEVFN);
137 pci_remove_bus_device(dev); 137 pci_remove_bus_device(dev);
138 pci_dev_put(dev) 138 pci_dev_put(dev);
139 } else { 139 } else {
140 dev = pci_get_bus_and_slot(1, IXDP2400_MASTER_ENET_DEVFN); 140 dev = pci_get_bus_and_slot(1, IXDP2400_MASTER_ENET_DEVFN);
141 pci_remove_bus_device(dev); 141 pci_remove_bus_device(dev);
142 pci_dev_put(dev) 142 pci_dev_put(dev);
143 143
144 ixdp2x00_slave_pci_postinit(); 144 ixdp2x00_slave_pci_postinit();
145 } 145 }
diff --git a/arch/arm/mach-lh7a40x/Kconfig b/arch/arm/mach-lh7a40x/Kconfig
index 558a34f53b1c..147b01928a9b 100644
--- a/arch/arm/mach-lh7a40x/Kconfig
+++ b/arch/arm/mach-lh7a40x/Kconfig
@@ -14,7 +14,7 @@ config MACH_LPD7A400
14 bool "LPD7A400 Card Engine" 14 bool "LPD7A400 Card Engine"
15 select ARCH_LH7A400 15 select ARCH_LH7A400
16# select IDE_POLL 16# select IDE_POLL
17 select HAS_TOUCHSCREEN_ADS7843_LH7 17# select HAS_TOUCHSCREEN_ADS7843_LH7
18 help 18 help
19 Say Y here if you are using Logic Product Development's 19 Say Y here if you are using Logic Product Development's
20 LPD7A400 CardEngine. For the time being, the LPD7A400 and 20 LPD7A400 CardEngine. For the time being, the LPD7A400 and
@@ -24,7 +24,7 @@ config MACH_LPD7A404
24 bool "LPD7A404 Card Engine" 24 bool "LPD7A404 Card Engine"
25 select ARCH_LH7A404 25 select ARCH_LH7A404
26# select IDE_POLL 26# select IDE_POLL
27 select HAS_TOUCHSCREEN_ADC_LH7 27# select HAS_TOUCHSCREEN_ADC_LH7
28 help 28 help
29 Say Y here if you are using Logic Product Development's 29 Say Y here if you are using Logic Product Development's
30 LPD7A404 CardEngine. For the time being, the LPD7A400 and 30 LPD7A404 CardEngine. For the time being, the LPD7A400 and
diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
index cefc95a73980..7b842e98efed 100644
--- a/arch/avr32/Makefile
+++ b/arch/avr32/Makefile
@@ -7,7 +7,7 @@
7 7
8# Default target when executing plain make 8# Default target when executing plain make
9.PHONY: all 9.PHONY: all
10all: uImage vmlinux.elf linux.lst 10all: uImage vmlinux.elf
11 11
12KBUILD_DEFCONFIG := atstk1002_defconfig 12KBUILD_DEFCONFIG := atstk1002_defconfig
13 13
@@ -21,9 +21,7 @@ cpuflags-$(CONFIG_CPU_AP7000) += -mcpu=ap7000
21CFLAGS += $(cpuflags-y) 21CFLAGS += $(cpuflags-y)
22AFLAGS += $(cpuflags-y) 22AFLAGS += $(cpuflags-y)
23 23
24CHECKFLAGS += -D__avr32__ 24CHECKFLAGS += -D__avr32__ -D__BIG_ENDIAN
25
26LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
27 25
28head-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/head.o 26head-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/head.o
29head-y += arch/avr32/kernel/head.o 27head-y += arch/avr32/kernel/head.o
@@ -32,7 +30,7 @@ core-$(CONFIG_BOARD_ATSTK1000) += arch/avr32/boards/atstk1000/
32core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/ 30core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/
33core-y += arch/avr32/kernel/ 31core-y += arch/avr32/kernel/
34core-y += arch/avr32/mm/ 32core-y += arch/avr32/mm/
35libs-y += arch/avr32/lib/ #$(LIBGCC) 33libs-y += arch/avr32/lib/
36 34
37archincdir-$(CONFIG_PLATFORM_AT32AP) := arch-at32ap 35archincdir-$(CONFIG_PLATFORM_AT32AP) := arch-at32ap
38 36
@@ -48,6 +46,8 @@ endif
48 46
49archprepare: include/asm-avr32/.arch 47archprepare: include/asm-avr32/.arch
50 48
49CLEAN_FILES += include/asm-avr32/.arch include/asm-avr32/arch
50
51BOOT_TARGETS := vmlinux.elf vmlinux.bin uImage uImage.srec 51BOOT_TARGETS := vmlinux.elf vmlinux.bin uImage uImage.srec
52 52
53.PHONY: $(BOOT_TARGETS) install 53.PHONY: $(BOOT_TARGETS) install
@@ -71,14 +71,19 @@ vmlinux.elf vmlinux.bin uImage.srec uImage vmlinux.cso: vmlinux
71install: vmlinux 71install: vmlinux
72 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ 72 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
73 73
74linux.s: vmlinux 74vmlinux.s: vmlinux
75 $(call if_changed,disasm) 75 $(call if_changed,disasm)
76 76
77linux.lst: vmlinux 77vmlinux.lst: vmlinux
78 $(call if_changed,listing) 78 $(call if_changed,listing)
79 79
80CLEAN_FILES += vmlinux.s vmlinux.lst
81
82archclean:
83 $(Q)$(MAKE) $(clean)=$(boot)
84
80define archhelp 85define archhelp
81 @echo '* vmlinux.elf - ELF image with load address 0' 86 @echo '* vmlinux.elf - ELF image with load address 0'
82 @echo ' vmlinux.cso - PathFinder CSO image' 87 @echo ' vmlinux.cso - PathFinder CSO image'
83 @echo ' uImage - Create a bootable image for U-Boot' 88 @echo '* uImage - Create a bootable image for U-Boot'
84endef 89endef
diff --git a/arch/avr32/boot/images/Makefile b/arch/avr32/boot/images/Makefile
index ccd74eeecec3..219720a47bf9 100644
--- a/arch/avr32/boot/images/Makefile
+++ b/arch/avr32/boot/images/Makefile
@@ -37,14 +37,12 @@ OBJCOPYFLAGS_vmlinux.elf := --change-section-lma .text-0x80000000 \
37 --change-section-lma .data-0x80000000 \ 37 --change-section-lma .data-0x80000000 \
38 --change-section-lma .init-0x80000000 \ 38 --change-section-lma .init-0x80000000 \
39 --change-section-lma .bss-0x80000000 \ 39 --change-section-lma .bss-0x80000000 \
40 --change-section-lma .initrd-0x80000000 \
41 --change-section-lma __param-0x80000000 \ 40 --change-section-lma __param-0x80000000 \
42 --change-section-lma __ksymtab-0x80000000 \ 41 --change-section-lma __ksymtab-0x80000000 \
43 --change-section-lma __ksymtab_gpl-0x80000000 \ 42 --change-section-lma __ksymtab_gpl-0x80000000 \
44 --change-section-lma __kcrctab-0x80000000 \ 43 --change-section-lma __kcrctab-0x80000000 \
45 --change-section-lma __kcrctab_gpl-0x80000000 \ 44 --change-section-lma __kcrctab_gpl-0x80000000 \
46 --change-section-lma __ksymtab_strings-0x80000000 \ 45 --change-section-lma __ksymtab_strings-0x80000000 \
47 --change-section-lma .got-0x80000000 \
48 --set-start 0xa0000000 46 --set-start 0xa0000000
49$(obj)/vmlinux.elf: vmlinux FORCE 47$(obj)/vmlinux.elf: vmlinux FORCE
50 $(call if_changed,objcopy) 48 $(call if_changed,objcopy)
@@ -59,4 +57,4 @@ install: $(BOOTIMAGE)
59 sh $(srctree)/install-kernel.sh $< 57 sh $(srctree)/install-kernel.sh $<
60 58
61# Generated files to be removed upon make clean 59# Generated files to be removed upon make clean
62clean-files := vmlinux* uImage uImage.srec 60clean-files := vmlinux.elf vmlinux.bin vmlinux.gz uImage uImage.srec
diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig
index 6c2c5e00dfc7..ae92a14ef9a0 100644
--- a/arch/avr32/configs/atstk1002_defconfig
+++ b/arch/avr32/configs/atstk1002_defconfig
@@ -1,13 +1,14 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-rc1 3# Linux kernel version: 2.6.19-rc2
4# Tue Jul 11 12:41:36 2006 4# Fri Oct 20 11:52:37 2006
5# 5#
6CONFIG_AVR32=y 6CONFIG_AVR32=y
7CONFIG_GENERIC_HARDIRQS=y 7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_HARDIRQS_SW_RESEND=y 8CONFIG_HARDIRQS_SW_RESEND=y
9CONFIG_GENERIC_IRQ_PROBE=y 9CONFIG_GENERIC_IRQ_PROBE=y
10CONFIG_RWSEM_GENERIC_SPINLOCK=y 10CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_TIME=y
11CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 14CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -25,16 +26,23 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
25CONFIG_LOCALVERSION="" 26CONFIG_LOCALVERSION=""
26# CONFIG_LOCALVERSION_AUTO is not set 27# CONFIG_LOCALVERSION_AUTO is not set
27CONFIG_SWAP=y 28CONFIG_SWAP=y
28# CONFIG_SYSVIPC is not set 29CONFIG_SYSVIPC=y
29# CONFIG_POSIX_MQUEUE is not set 30# CONFIG_IPC_NS is not set
30# CONFIG_BSD_PROCESS_ACCT is not set 31CONFIG_POSIX_MQUEUE=y
31CONFIG_SYSCTL=y 32CONFIG_BSD_PROCESS_ACCT=y
32# CONFIG_AUDIT is not set 33CONFIG_BSD_PROCESS_ACCT_V3=y
34CONFIG_TASKSTATS=y
35CONFIG_TASK_DELAY_ACCT=y
36# CONFIG_UTS_NS is not set
37CONFIG_AUDIT=y
33# CONFIG_IKCONFIG is not set 38# CONFIG_IKCONFIG is not set
34# CONFIG_RELAY is not set 39CONFIG_RELAY=y
35CONFIG_INITRAMFS_SOURCE="" 40CONFIG_INITRAMFS_SOURCE=""
36CONFIG_CC_OPTIMIZE_FOR_SIZE=y 41CONFIG_CC_OPTIMIZE_FOR_SIZE=y
42# CONFIG_TASK_XACCT is not set
43CONFIG_SYSCTL=y
37CONFIG_EMBEDDED=y 44CONFIG_EMBEDDED=y
45# CONFIG_SYSCTL_SYSCALL is not set
38CONFIG_KALLSYMS=y 46CONFIG_KALLSYMS=y
39# CONFIG_KALLSYMS_ALL is not set 47# CONFIG_KALLSYMS_ALL is not set
40# CONFIG_KALLSYMS_EXTRA_PASS is not set 48# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -43,14 +51,15 @@ CONFIG_PRINTK=y
43CONFIG_BUG=y 51CONFIG_BUG=y
44CONFIG_ELF_CORE=y 52CONFIG_ELF_CORE=y
45# CONFIG_BASE_FULL is not set 53# CONFIG_BASE_FULL is not set
46# CONFIG_FUTEX is not set 54CONFIG_FUTEX=y
47# CONFIG_EPOLL is not set 55CONFIG_EPOLL=y
48CONFIG_SHMEM=y 56CONFIG_SHMEM=y
49# CONFIG_SLAB is not set 57CONFIG_SLAB=y
50# CONFIG_VM_EVENT_COUNTERS is not set 58CONFIG_VM_EVENT_COUNTERS=y
59CONFIG_RT_MUTEXES=y
51# CONFIG_TINY_SHMEM is not set 60# CONFIG_TINY_SHMEM is not set
52CONFIG_BASE_SMALL=1 61CONFIG_BASE_SMALL=1
53CONFIG_SLOB=y 62# CONFIG_SLOB is not set
54 63
55# 64#
56# Loadable module support 65# Loadable module support
@@ -65,6 +74,7 @@ CONFIG_MODULE_UNLOAD=y
65# 74#
66# Block layer 75# Block layer
67# 76#
77CONFIG_BLOCK=y
68# CONFIG_BLK_DEV_IO_TRACE is not set 78# CONFIG_BLK_DEV_IO_TRACE is not set
69 79
70# 80#
@@ -166,10 +176,12 @@ CONFIG_IP_PNP_DHCP=y
166# CONFIG_INET_TUNNEL is not set 176# CONFIG_INET_TUNNEL is not set
167# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 177# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
168# CONFIG_INET_XFRM_MODE_TUNNEL is not set 178# CONFIG_INET_XFRM_MODE_TUNNEL is not set
179# CONFIG_INET_XFRM_MODE_BEET is not set
169CONFIG_INET_DIAG=y 180CONFIG_INET_DIAG=y
170CONFIG_INET_TCP_DIAG=y 181CONFIG_INET_TCP_DIAG=y
171# CONFIG_TCP_CONG_ADVANCED is not set 182# CONFIG_TCP_CONG_ADVANCED is not set
172CONFIG_TCP_CONG_BIC=y 183CONFIG_TCP_CONG_CUBIC=y
184CONFIG_DEFAULT_TCP_CONG="cubic"
173# CONFIG_IPV6 is not set 185# CONFIG_IPV6 is not set
174# CONFIG_INET6_XFRM_TUNNEL is not set 186# CONFIG_INET6_XFRM_TUNNEL is not set
175# CONFIG_INET6_TUNNEL is not set 187# CONFIG_INET6_TUNNEL is not set
@@ -199,7 +211,6 @@ CONFIG_TCP_CONG_BIC=y
199# CONFIG_ATALK is not set 211# CONFIG_ATALK is not set
200# CONFIG_X25 is not set 212# CONFIG_X25 is not set
201# CONFIG_LAPB is not set 213# CONFIG_LAPB is not set
202# CONFIG_NET_DIVERT is not set
203# CONFIG_ECONET is not set 214# CONFIG_ECONET is not set
204# CONFIG_WAN_ROUTER is not set 215# CONFIG_WAN_ROUTER is not set
205 216
@@ -212,7 +223,6 @@ CONFIG_TCP_CONG_BIC=y
212# Network testing 223# Network testing
213# 224#
214# CONFIG_NET_PKTGEN is not set 225# CONFIG_NET_PKTGEN is not set
215# CONFIG_NET_TCPPROBE is not set
216# CONFIG_HAMRADIO is not set 226# CONFIG_HAMRADIO is not set
217# CONFIG_IRDA is not set 227# CONFIG_IRDA is not set
218# CONFIG_BT is not set 228# CONFIG_BT is not set
@@ -239,7 +249,84 @@ CONFIG_STANDALONE=y
239# 249#
240# Memory Technology Devices (MTD) 250# Memory Technology Devices (MTD)
241# 251#
242# CONFIG_MTD is not set 252CONFIG_MTD=y
253# CONFIG_MTD_DEBUG is not set
254# CONFIG_MTD_CONCAT is not set
255CONFIG_MTD_PARTITIONS=y
256# CONFIG_MTD_REDBOOT_PARTS is not set
257CONFIG_MTD_CMDLINE_PARTS=y
258
259#
260# User Modules And Translation Layers
261#
262CONFIG_MTD_CHAR=y
263CONFIG_MTD_BLOCK=y
264# CONFIG_FTL is not set
265# CONFIG_NFTL is not set
266# CONFIG_INFTL is not set
267# CONFIG_RFD_FTL is not set
268# CONFIG_SSFDC is not set
269
270#
271# RAM/ROM/Flash chip drivers
272#
273CONFIG_MTD_CFI=y
274# CONFIG_MTD_JEDECPROBE is not set
275CONFIG_MTD_GEN_PROBE=y
276# CONFIG_MTD_CFI_ADV_OPTIONS is not set
277CONFIG_MTD_MAP_BANK_WIDTH_1=y
278CONFIG_MTD_MAP_BANK_WIDTH_2=y
279CONFIG_MTD_MAP_BANK_WIDTH_4=y
280# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
281# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
282# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
283CONFIG_MTD_CFI_I1=y
284CONFIG_MTD_CFI_I2=y
285# CONFIG_MTD_CFI_I4 is not set
286# CONFIG_MTD_CFI_I8 is not set
287# CONFIG_MTD_CFI_INTELEXT is not set
288CONFIG_MTD_CFI_AMDSTD=y
289# CONFIG_MTD_CFI_STAA is not set
290CONFIG_MTD_CFI_UTIL=y
291# CONFIG_MTD_RAM is not set
292# CONFIG_MTD_ROM is not set
293# CONFIG_MTD_ABSENT is not set
294# CONFIG_MTD_OBSOLETE_CHIPS is not set
295
296#
297# Mapping drivers for chip access
298#
299# CONFIG_MTD_COMPLEX_MAPPINGS is not set
300CONFIG_MTD_PHYSMAP=y
301CONFIG_MTD_PHYSMAP_START=0x8000000
302CONFIG_MTD_PHYSMAP_LEN=0x0
303CONFIG_MTD_PHYSMAP_BANKWIDTH=2
304# CONFIG_MTD_PLATRAM is not set
305
306#
307# Self-contained MTD device drivers
308#
309# CONFIG_MTD_SLRAM is not set
310# CONFIG_MTD_PHRAM is not set
311# CONFIG_MTD_MTDRAM is not set
312# CONFIG_MTD_BLOCK2MTD is not set
313
314#
315# Disk-On-Chip Device Drivers
316#
317# CONFIG_MTD_DOC2000 is not set
318# CONFIG_MTD_DOC2001 is not set
319# CONFIG_MTD_DOC2001PLUS is not set
320
321#
322# NAND Flash Device Drivers
323#
324# CONFIG_MTD_NAND is not set
325
326#
327# OneNAND Flash Device Drivers
328#
329# CONFIG_MTD_ONENAND is not set
243 330
244# 331#
245# Parallel port support 332# Parallel port support
@@ -260,11 +347,18 @@ CONFIG_BLK_DEV_NBD=m
260CONFIG_BLK_DEV_RAM=m 347CONFIG_BLK_DEV_RAM=m
261CONFIG_BLK_DEV_RAM_COUNT=16 348CONFIG_BLK_DEV_RAM_COUNT=16
262CONFIG_BLK_DEV_RAM_SIZE=4096 349CONFIG_BLK_DEV_RAM_SIZE=4096
350CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
263CONFIG_BLK_DEV_INITRD=y 351CONFIG_BLK_DEV_INITRD=y
264# CONFIG_CDROM_PKTCDVD is not set 352# CONFIG_CDROM_PKTCDVD is not set
265# CONFIG_ATA_OVER_ETH is not set 353# CONFIG_ATA_OVER_ETH is not set
266 354
267# 355#
356# Misc devices
357#
358# CONFIG_SGI_IOC4 is not set
359# CONFIG_TIFM_CORE is not set
360
361#
268# ATA/ATAPI/MFM/RLL support 362# ATA/ATAPI/MFM/RLL support
269# 363#
270# CONFIG_IDE is not set 364# CONFIG_IDE is not set
@@ -274,6 +368,12 @@ CONFIG_BLK_DEV_INITRD=y
274# 368#
275# CONFIG_RAID_ATTRS is not set 369# CONFIG_RAID_ATTRS is not set
276# CONFIG_SCSI is not set 370# CONFIG_SCSI is not set
371# CONFIG_SCSI_NETLINK is not set
372
373#
374# Serial ATA (prod) and Parallel ATA (experimental) drivers
375#
376# CONFIG_ATA is not set
277 377
278# 378#
279# Multi-device support (RAID and LVM) 379# Multi-device support (RAID and LVM)
@@ -305,14 +405,11 @@ CONFIG_TUN=m
305# 405#
306# PHY device support 406# PHY device support
307# 407#
308# CONFIG_PHYLIB is not set
309 408
310# 409#
311# Ethernet (10 or 100Mbit) 410# Ethernet (10 or 100Mbit)
312# 411#
313CONFIG_NET_ETHERNET=y 412# CONFIG_NET_ETHERNET is not set
314CONFIG_MII=y
315CONFIG_MACB=y
316 413
317# 414#
318# Ethernet (1000 Mbit) 415# Ethernet (1000 Mbit)
@@ -341,10 +438,11 @@ CONFIG_PPP=m
341CONFIG_PPP_ASYNC=m 438CONFIG_PPP_ASYNC=m
342# CONFIG_PPP_SYNC_TTY is not set 439# CONFIG_PPP_SYNC_TTY is not set
343CONFIG_PPP_DEFLATE=m 440CONFIG_PPP_DEFLATE=m
344# CONFIG_PPP_BSDCOMP is not set 441CONFIG_PPP_BSDCOMP=m
345# CONFIG_PPP_MPPE is not set 442# CONFIG_PPP_MPPE is not set
346# CONFIG_PPPOE is not set 443# CONFIG_PPPOE is not set
347# CONFIG_SLIP is not set 444# CONFIG_SLIP is not set
445CONFIG_SLHC=m
348# CONFIG_SHAPER is not set 446# CONFIG_SHAPER is not set
349# CONFIG_NETCONSOLE is not set 447# CONFIG_NETCONSOLE is not set
350# CONFIG_NETPOLL is not set 448# CONFIG_NETPOLL is not set
@@ -417,7 +515,6 @@ CONFIG_UNIX98_PTYS=y
417# TPM devices 515# TPM devices
418# 516#
419# CONFIG_TCG_TPM is not set 517# CONFIG_TCG_TPM is not set
420# CONFIG_TELCLOCK is not set
421 518
422# 519#
423# I2C support 520# I2C support
@@ -427,23 +524,13 @@ CONFIG_UNIX98_PTYS=y
427# 524#
428# SPI support 525# SPI support
429# 526#
430CONFIG_SPI=y 527# CONFIG_SPI is not set
431# CONFIG_SPI_DEBUG is not set 528# CONFIG_SPI_MASTER is not set
432CONFIG_SPI_MASTER=y
433
434#
435# SPI Master Controller Drivers
436#
437CONFIG_SPI_ATMEL=m
438# CONFIG_SPI_BITBANG is not set
439
440#
441# SPI Protocol Masters
442#
443 529
444# 530#
445# Dallas's 1-wire bus 531# Dallas's 1-wire bus
446# 532#
533# CONFIG_W1 is not set
447 534
448# 535#
449# Hardware Monitoring support 536# Hardware Monitoring support
@@ -452,14 +539,9 @@ CONFIG_SPI_ATMEL=m
452# CONFIG_HWMON_VID is not set 539# CONFIG_HWMON_VID is not set
453 540
454# 541#
455# Misc devices
456#
457
458#
459# Multimedia devices 542# Multimedia devices
460# 543#
461# CONFIG_VIDEO_DEV is not set 544# CONFIG_VIDEO_DEV is not set
462CONFIG_VIDEO_V4L2=y
463 545
464# 546#
465# Digital Video Broadcasting Devices 547# Digital Video Broadcasting Devices
@@ -470,28 +552,8 @@ CONFIG_VIDEO_V4L2=y
470# Graphics support 552# Graphics support
471# 553#
472# CONFIG_FIRMWARE_EDID is not set 554# CONFIG_FIRMWARE_EDID is not set
473CONFIG_FB=m 555# CONFIG_FB is not set
474CONFIG_FB_CFB_FILLRECT=m 556# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
475CONFIG_FB_CFB_COPYAREA=m
476CONFIG_FB_CFB_IMAGEBLIT=m
477# CONFIG_FB_MACMODES is not set
478# CONFIG_FB_BACKLIGHT is not set
479# CONFIG_FB_MODE_HELPERS is not set
480# CONFIG_FB_TILEBLITTING is not set
481CONFIG_FB_SIDSA=m
482CONFIG_FB_SIDSA_DEFAULT_BPP=24
483# CONFIG_FB_S1D13XXX is not set
484# CONFIG_FB_VIRTUAL is not set
485
486#
487# Logo configuration
488#
489# CONFIG_LOGO is not set
490CONFIG_BACKLIGHT_LCD_SUPPORT=y
491# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
492CONFIG_LCD_CLASS_DEVICE=m
493CONFIG_LCD_DEVICE=y
494CONFIG_LCD_LTV350QV=m
495 557
496# 558#
497# Sound 559# Sound
@@ -561,18 +623,21 @@ CONFIG_LCD_LTV350QV=m
561# 623#
562# File systems 624# File systems
563# 625#
564CONFIG_EXT2_FS=y 626CONFIG_EXT2_FS=m
565# CONFIG_EXT2_FS_XATTR is not set 627# CONFIG_EXT2_FS_XATTR is not set
566# CONFIG_EXT2_FS_XIP is not set 628# CONFIG_EXT2_FS_XIP is not set
567# CONFIG_EXT3_FS is not set 629# CONFIG_EXT3_FS is not set
630# CONFIG_EXT4DEV_FS is not set
568# CONFIG_REISERFS_FS is not set 631# CONFIG_REISERFS_FS is not set
569# CONFIG_JFS_FS is not set 632# CONFIG_JFS_FS is not set
570# CONFIG_FS_POSIX_ACL is not set 633# CONFIG_FS_POSIX_ACL is not set
571# CONFIG_XFS_FS is not set 634# CONFIG_XFS_FS is not set
635# CONFIG_GFS2_FS is not set
572# CONFIG_OCFS2_FS is not set 636# CONFIG_OCFS2_FS is not set
573CONFIG_MINIX_FS=m 637CONFIG_MINIX_FS=m
574CONFIG_ROMFS_FS=m 638# CONFIG_ROMFS_FS is not set
575# CONFIG_INOTIFY is not set 639CONFIG_INOTIFY=y
640CONFIG_INOTIFY_USER=y
576# CONFIG_QUOTA is not set 641# CONFIG_QUOTA is not set
577# CONFIG_DNOTIFY is not set 642# CONFIG_DNOTIFY is not set
578# CONFIG_AUTOFS_FS is not set 643# CONFIG_AUTOFS_FS is not set
@@ -600,8 +665,10 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
600# 665#
601CONFIG_PROC_FS=y 666CONFIG_PROC_FS=y
602CONFIG_PROC_KCORE=y 667CONFIG_PROC_KCORE=y
668CONFIG_PROC_SYSCTL=y
603CONFIG_SYSFS=y 669CONFIG_SYSFS=y
604CONFIG_TMPFS=y 670CONFIG_TMPFS=y
671# CONFIG_TMPFS_POSIX_ACL is not set
605# CONFIG_HUGETLB_PAGE is not set 672# CONFIG_HUGETLB_PAGE is not set
606CONFIG_RAMFS=y 673CONFIG_RAMFS=y
607CONFIG_CONFIGFS_FS=m 674CONFIG_CONFIGFS_FS=m
@@ -616,6 +683,16 @@ CONFIG_CONFIGFS_FS=m
616# CONFIG_BEFS_FS is not set 683# CONFIG_BEFS_FS is not set
617# CONFIG_BFS_FS is not set 684# CONFIG_BFS_FS is not set
618# CONFIG_EFS_FS is not set 685# CONFIG_EFS_FS is not set
686# CONFIG_JFFS_FS is not set
687CONFIG_JFFS2_FS=y
688CONFIG_JFFS2_FS_DEBUG=0
689CONFIG_JFFS2_FS_WRITEBUFFER=y
690# CONFIG_JFFS2_SUMMARY is not set
691# CONFIG_JFFS2_FS_XATTR is not set
692# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
693CONFIG_JFFS2_ZLIB=y
694CONFIG_JFFS2_RTIME=y
695# CONFIG_JFFS2_RUBIN is not set
619# CONFIG_CRAMFS is not set 696# CONFIG_CRAMFS is not set
620# CONFIG_VXFS_FS is not set 697# CONFIG_VXFS_FS is not set
621# CONFIG_HPFS_FS is not set 698# CONFIG_HPFS_FS is not set
@@ -626,26 +703,10 @@ CONFIG_CONFIGFS_FS=m
626# 703#
627# Network File Systems 704# Network File Systems
628# 705#
629CONFIG_NFS_FS=y 706# CONFIG_NFS_FS is not set
630CONFIG_NFS_V3=y
631# CONFIG_NFS_V3_ACL is not set
632# CONFIG_NFS_V4 is not set
633# CONFIG_NFS_DIRECTIO is not set
634# CONFIG_NFSD is not set 707# CONFIG_NFSD is not set
635CONFIG_ROOT_NFS=y
636CONFIG_LOCKD=y
637CONFIG_LOCKD_V4=y
638CONFIG_NFS_COMMON=y
639CONFIG_SUNRPC=y
640# CONFIG_RPCSEC_GSS_KRB5 is not set
641# CONFIG_RPCSEC_GSS_SPKM3 is not set
642# CONFIG_SMB_FS is not set 708# CONFIG_SMB_FS is not set
643CONFIG_CIFS=m 709# CONFIG_CIFS is not set
644# CONFIG_CIFS_STATS is not set
645# CONFIG_CIFS_WEAK_PW_HASH is not set
646# CONFIG_CIFS_XATTR is not set
647# CONFIG_CIFS_DEBUG2 is not set
648# CONFIG_CIFS_EXPERIMENTAL is not set
649# CONFIG_NCP_FS is not set 710# CONFIG_NCP_FS is not set
650# CONFIG_CODA_FS is not set 711# CONFIG_CODA_FS is not set
651# CONFIG_AFS_FS is not set 712# CONFIG_AFS_FS is not set
@@ -665,7 +726,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
665CONFIG_NLS_CODEPAGE_437=m 726CONFIG_NLS_CODEPAGE_437=m
666# CONFIG_NLS_CODEPAGE_737 is not set 727# CONFIG_NLS_CODEPAGE_737 is not set
667# CONFIG_NLS_CODEPAGE_775 is not set 728# CONFIG_NLS_CODEPAGE_775 is not set
668CONFIG_NLS_CODEPAGE_850=m 729# CONFIG_NLS_CODEPAGE_850 is not set
669# CONFIG_NLS_CODEPAGE_852 is not set 730# CONFIG_NLS_CODEPAGE_852 is not set
670# CONFIG_NLS_CODEPAGE_855 is not set 731# CONFIG_NLS_CODEPAGE_855 is not set
671# CONFIG_NLS_CODEPAGE_857 is not set 732# CONFIG_NLS_CODEPAGE_857 is not set
@@ -705,13 +766,17 @@ CONFIG_NLS_UTF8=m
705# Kernel hacking 766# Kernel hacking
706# 767#
707CONFIG_TRACE_IRQFLAGS_SUPPORT=y 768CONFIG_TRACE_IRQFLAGS_SUPPORT=y
708CONFIG_PRINTK_TIME=y 769# CONFIG_PRINTK_TIME is not set
770CONFIG_ENABLE_MUST_CHECK=y
709CONFIG_MAGIC_SYSRQ=y 771CONFIG_MAGIC_SYSRQ=y
710# CONFIG_UNUSED_SYMBOLS is not set 772# CONFIG_UNUSED_SYMBOLS is not set
711CONFIG_DEBUG_KERNEL=y 773CONFIG_DEBUG_KERNEL=y
712CONFIG_LOG_BUF_SHIFT=14 774CONFIG_LOG_BUF_SHIFT=14
713CONFIG_DETECT_SOFTLOCKUP=y 775CONFIG_DETECT_SOFTLOCKUP=y
714# CONFIG_SCHEDSTATS is not set 776# CONFIG_SCHEDSTATS is not set
777# CONFIG_DEBUG_SLAB is not set
778# CONFIG_DEBUG_RT_MUTEXES is not set
779# CONFIG_RT_MUTEX_TESTER is not set
715# CONFIG_DEBUG_SPINLOCK is not set 780# CONFIG_DEBUG_SPINLOCK is not set
716# CONFIG_DEBUG_MUTEXES is not set 781# CONFIG_DEBUG_MUTEXES is not set
717# CONFIG_DEBUG_RWSEMS is not set 782# CONFIG_DEBUG_RWSEMS is not set
@@ -722,11 +787,13 @@ CONFIG_DEBUG_BUGVERBOSE=y
722# CONFIG_DEBUG_INFO is not set 787# CONFIG_DEBUG_INFO is not set
723CONFIG_DEBUG_FS=y 788CONFIG_DEBUG_FS=y
724# CONFIG_DEBUG_VM is not set 789# CONFIG_DEBUG_VM is not set
790# CONFIG_DEBUG_LIST is not set
725CONFIG_FRAME_POINTER=y 791CONFIG_FRAME_POINTER=y
726# CONFIG_UNWIND_INFO is not set 792# CONFIG_UNWIND_INFO is not set
727CONFIG_FORCED_INLINING=y 793CONFIG_FORCED_INLINING=y
794# CONFIG_HEADERS_CHECK is not set
728# CONFIG_RCU_TORTURE_TEST is not set 795# CONFIG_RCU_TORTURE_TEST is not set
729CONFIG_KPROBES=y 796# CONFIG_KPROBES is not set
730 797
731# 798#
732# Security options 799# Security options
@@ -740,15 +807,13 @@ CONFIG_KPROBES=y
740# CONFIG_CRYPTO is not set 807# CONFIG_CRYPTO is not set
741 808
742# 809#
743# Hardware crypto devices
744#
745
746#
747# Library routines 810# Library routines
748# 811#
749CONFIG_CRC_CCITT=m 812CONFIG_CRC_CCITT=m
750# CONFIG_CRC16 is not set 813# CONFIG_CRC16 is not set
751CONFIG_CRC32=m 814CONFIG_CRC32=y
752# CONFIG_LIBCRC32C is not set 815# CONFIG_LIBCRC32C is not set
753CONFIG_ZLIB_INFLATE=m 816CONFIG_AUDIT_GENERIC=y
754CONFIG_ZLIB_DEFLATE=m 817CONFIG_ZLIB_INFLATE=y
818CONFIG_ZLIB_DEFLATE=y
819CONFIG_PLIST=y
diff --git a/arch/avr32/kernel/avr32_ksyms.c b/arch/avr32/kernel/avr32_ksyms.c
index 04f767a272b7..372e3f8b2417 100644
--- a/arch/avr32/kernel/avr32_ksyms.c
+++ b/arch/avr32/kernel/avr32_ksyms.c
@@ -7,6 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/io.h>
10#include <linux/module.h> 11#include <linux/module.h>
11 12
12#include <asm/checksum.h> 13#include <asm/checksum.h>
@@ -53,3 +54,11 @@ EXPORT_SYMBOL(find_next_zero_bit);
53EXPORT_SYMBOL(find_first_bit); 54EXPORT_SYMBOL(find_first_bit);
54EXPORT_SYMBOL(find_next_bit); 55EXPORT_SYMBOL(find_next_bit);
55EXPORT_SYMBOL(generic_find_next_zero_le_bit); 56EXPORT_SYMBOL(generic_find_next_zero_le_bit);
57
58/* I/O primitives (lib/io-*.S) */
59EXPORT_SYMBOL(__raw_readsb);
60EXPORT_SYMBOL(__raw_readsw);
61EXPORT_SYMBOL(__raw_readsl);
62EXPORT_SYMBOL(__raw_writesb);
63EXPORT_SYMBOL(__raw_writesw);
64EXPORT_SYMBOL(__raw_writesl);
diff --git a/arch/avr32/kernel/kprobes.c b/arch/avr32/kernel/kprobes.c
index 6caf9e8d8080..ca41fc1edbe1 100644
--- a/arch/avr32/kernel/kprobes.c
+++ b/arch/avr32/kernel/kprobes.c
@@ -109,7 +109,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
109 void *addr = (void *)regs->pc; 109 void *addr = (void *)regs->pc;
110 int ret = 0; 110 int ret = 0;
111 111
112 pr_debug("kprobe_handler: kprobe_running=%d\n", 112 pr_debug("kprobe_handler: kprobe_running=%p\n",
113 kprobe_running()); 113 kprobe_running());
114 114
115 /* 115 /*
diff --git a/arch/avr32/kernel/module.c b/arch/avr32/kernel/module.c
index dfc32f2817b6..b599eae64576 100644
--- a/arch/avr32/kernel/module.c
+++ b/arch/avr32/kernel/module.c
@@ -263,7 +263,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
263 * value of PC. Just subtract the value of 263 * value of PC. Just subtract the value of
264 * GOT, and we're done. 264 * GOT, and we're done.
265 */ 265 */
266 pr_debug("GOTPC: PC=0x%lx, got_offset=0x%lx, core=0x%p\n", 266 pr_debug("GOTPC: PC=0x%x, got_offset=0x%lx, core=0x%p\n",
267 relocation, module->arch.got_offset, 267 relocation, module->arch.got_offset,
268 module->module_core); 268 module->module_core);
269 relocation -= ((unsigned long)module->module_core 269 relocation -= ((unsigned long)module->module_core
@@ -282,7 +282,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
282 && (relocation & 0xffff0000) != 0xffff0000) 282 && (relocation & 0xffff0000) != 0xffff0000)
283 return reloc_overflow(module, "R_AVR32_GOT16S", 283 return reloc_overflow(module, "R_AVR32_GOT16S",
284 relocation); 284 relocation);
285 pr_debug("GOT reloc @ 0x%lx -> %lu\n", 285 pr_debug("GOT reloc @ 0x%x -> %u\n",
286 rel->r_offset, relocation); 286 rel->r_offset, relocation);
287 value = *location; 287 value = *location;
288 value = ((value & 0xffff0000) 288 value = ((value & 0xffff0000)
diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c
index 3c89e59029ab..f2e81cd79002 100644
--- a/arch/avr32/kernel/ptrace.c
+++ b/arch/avr32/kernel/ptrace.c
@@ -157,7 +157,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
157 unsigned long tmp; 157 unsigned long tmp;
158 int ret; 158 int ret;
159 159
160 pr_debug("arch_ptrace(%ld, %ld, %#lx, %#lx)\n", 160 pr_debug("arch_ptrace(%ld, %d, %#lx, %#lx)\n",
161 request, child->pid, addr, data); 161 request, child->pid, addr, data);
162 162
163 pr_debug("ptrace: Enabling monitor mode...\n"); 163 pr_debug("ptrace: Enabling monitor mode...\n");
diff --git a/arch/avr32/kernel/vmlinux.lds.c b/arch/avr32/kernel/vmlinux.lds.c
index cdd627c6b7dc..5c4424e362b5 100644
--- a/arch/avr32/kernel/vmlinux.lds.c
+++ b/arch/avr32/kernel/vmlinux.lds.c
@@ -38,13 +38,7 @@ SECTIONS
38 __setup_end = .; 38 __setup_end = .;
39 . = ALIGN(4); 39 . = ALIGN(4);
40 __initcall_start = .; 40 __initcall_start = .;
41 *(.initcall1.init) 41 INITCALLS
42 *(.initcall2.init)
43 *(.initcall3.init)
44 *(.initcall4.init)
45 *(.initcall5.init)
46 *(.initcall6.init)
47 *(.initcall7.init)
48 __initcall_end = .; 42 __initcall_end = .;
49 __con_initcall_start = .; 43 __con_initcall_start = .;
50 *(.con_initcall.init) 44 *(.con_initcall.init)
diff --git a/arch/avr32/lib/Makefile b/arch/avr32/lib/Makefile
index 09ac43e40522..084d95bac5e7 100644
--- a/arch/avr32/lib/Makefile
+++ b/arch/avr32/lib/Makefile
@@ -7,4 +7,5 @@ lib-y += strncpy_from_user.o strnlen_user.o
7lib-y += delay.o memset.o memcpy.o findbit.o 7lib-y += delay.o memset.o memcpy.o findbit.o
8lib-y += csum_partial.o csum_partial_copy_generic.o 8lib-y += csum_partial.o csum_partial_copy_generic.o
9lib-y += io-readsw.o io-readsl.o io-writesw.o io-writesl.o 9lib-y += io-readsw.o io-readsl.o io-writesw.o io-writesl.o
10lib-y += io-readsb.o io-writesb.o
10lib-y += __avr32_lsl64.o __avr32_lsr64.o __avr32_asr64.o 11lib-y += __avr32_lsl64.o __avr32_lsr64.o __avr32_asr64.o
diff --git a/arch/avr32/lib/io-readsb.S b/arch/avr32/lib/io-readsb.S
new file mode 100644
index 000000000000..b319d5e71749
--- /dev/null
+++ b/arch/avr32/lib/io-readsb.S
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9 .text
10.Lnot_word_aligned:
111: ld.ub r8, r12[0]
12 sub r10, 1
13 st.b r11++, r8
14 reteq r12
15 tst r11, r9
16 brne 1b
17
18 /* fall through */
19
20 .global __raw_readsb
21 .type __raw_readsb,@function
22__raw_readsb:
23 cp.w r10, 0
24 mov r9, 3
25 reteq r12
26
27 tst r11, r9
28 brne .Lnot_word_aligned
29
30 sub r10, 4
31 brlt 2f
32
331: ldins.b r8:t, r12[0]
34 ldins.b r8:u, r12[0]
35 ldins.b r8:l, r12[0]
36 ldins.b r8:b, r12[0]
37 st.w r11++, r8
38 sub r10, 4
39 brge 1b
40
412: sub r10, -4
42 reteq r12
43
443: ld.uh r8, r12[0]
45 sub r10, 1
46 st.b r11++, r8
47 brne 3b
diff --git a/arch/avr32/lib/io-writesb.S b/arch/avr32/lib/io-writesb.S
new file mode 100644
index 000000000000..b4ebaacccf68
--- /dev/null
+++ b/arch/avr32/lib/io-writesb.S
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9 .text
10.Lnot_word_aligned:
111: ld.ub r8, r11++
12 sub r10, 1
13 st.b r12[0], r8
14 reteq r12
15 tst r11, r9
16 brne 1b
17
18 /* fall through */
19
20 .global __raw_writesb
21 .type __raw_writesb,@function
22__raw_writesb:
23 cp.w r10, 0
24 mov r9, 3
25 reteq r12
26
27 tst r11, r9
28 brne .Lnot_word_aligned
29
30 sub r10, 4
31 brlt 2f
32
331: ld.w r8, r11++
34 bfextu r9, r8, 24, 8
35 st.b r12[0], r9
36 bfextu r9, r8, 16, 8
37 st.b r12[0], r9
38 bfextu r9, r8, 8, 8
39 st.b r12[0], r9
40 st.b r12[0], r8
41 sub r10, 4
42 brge 1b
43
442: sub r10, -4
45 reteq r12
46
473: ld.ub r8, r11++
48 sub r10, 1
49 st.b r12[0], r8
50 brne 3b
51
52 retal r12
diff --git a/arch/avr32/mach-at32ap/hsmc.h b/arch/avr32/mach-at32ap/hsmc.h
index 5681276fafdb..d1d48e26e393 100644
--- a/arch/avr32/mach-at32ap/hsmc.h
+++ b/arch/avr32/mach-at32ap/hsmc.h
@@ -120,8 +120,8 @@
120 120
121/* Register access macros */ 121/* Register access macros */
122#define hsmc_readl(port,reg) \ 122#define hsmc_readl(port,reg) \
123 readl((port)->regs + HSMC_##reg) 123 __raw_readl((port)->regs + HSMC_##reg)
124#define hsmc_writel(port,reg,value) \ 124#define hsmc_writel(port,reg,value) \
125 writel((value), (port)->regs + HSMC_##reg) 125 __raw_writel((value), (port)->regs + HSMC_##reg)
126 126
127#endif /* __ASM_AVR32_HSMC_H__ */ 127#endif /* __ASM_AVR32_HSMC_H__ */
diff --git a/arch/avr32/mach-at32ap/intc.h b/arch/avr32/mach-at32ap/intc.h
index d289ca2fff13..4d3664e43a8e 100644
--- a/arch/avr32/mach-at32ap/intc.h
+++ b/arch/avr32/mach-at32ap/intc.h
@@ -321,7 +321,9 @@
321#define INTC_MKBF(name, value) (((value) & ((1 << INTC_##name##_SIZE) - 1)) << INTC_##name##_OFFSET) 321#define INTC_MKBF(name, value) (((value) & ((1 << INTC_##name##_SIZE) - 1)) << INTC_##name##_OFFSET)
322#define INTC_GETBF(name, value) (((value) >> INTC_##name##_OFFSET) & ((1 << INTC_##name##_SIZE) - 1)) 322#define INTC_GETBF(name, value) (((value) >> INTC_##name##_OFFSET) & ((1 << INTC_##name##_SIZE) - 1))
323 323
324#define intc_readl(port,reg) readl((port)->regs + INTC_##reg) 324#define intc_readl(port,reg) \
325#define intc_writel(port,reg,value) writel((value), (port)->regs + INTC_##reg) 325 __raw_readl((port)->regs + INTC_##reg)
326#define intc_writel(port,reg,value) \
327 __raw_writel((value), (port)->regs + INTC_##reg)
326 328
327#endif /* __ASM_AVR32_PERIHP_INTC_H__ */ 329#endif /* __ASM_AVR32_PERIHP_INTC_H__ */
diff --git a/arch/avr32/mach-at32ap/pio.h b/arch/avr32/mach-at32ap/pio.h
index cfea12351599..50fa3aca32c5 100644
--- a/arch/avr32/mach-at32ap/pio.h
+++ b/arch/avr32/mach-at32ap/pio.h
@@ -170,8 +170,10 @@
170#define PIO_BFINS(name,value,old) (((old) & ~(((1 << PIO_##name##_SIZE) - 1) << PIO_##name##_OFFSET)) | PIO_BF(name,value)) 170#define PIO_BFINS(name,value,old) (((old) & ~(((1 << PIO_##name##_SIZE) - 1) << PIO_##name##_OFFSET)) | PIO_BF(name,value))
171 171
172/* Register access macros */ 172/* Register access macros */
173#define pio_readl(port,reg) readl((port)->regs + PIO_##reg) 173#define pio_readl(port,reg) \
174#define pio_writel(port,reg,value) writel((value), (port)->regs + PIO_##reg) 174 __raw_readl((port)->regs + PIO_##reg)
175#define pio_writel(port,reg,value) \
176 __raw_writel((value), (port)->regs + PIO_##reg)
175 177
176void at32_init_pio(struct platform_device *pdev); 178void at32_init_pio(struct platform_device *pdev);
177 179
diff --git a/arch/avr32/mach-at32ap/sm.h b/arch/avr32/mach-at32ap/sm.h
index 27565822ae2a..cad02b512bcb 100644
--- a/arch/avr32/mach-at32ap/sm.h
+++ b/arch/avr32/mach-at32ap/sm.h
@@ -234,7 +234,9 @@
234#define SM_BFINS(name,value,old) (((old) & ~(((1 << SM_##name##_SIZE) - 1) << SM_##name##_OFFSET)) | SM_BF(name,value)) 234#define SM_BFINS(name,value,old) (((old) & ~(((1 << SM_##name##_SIZE) - 1) << SM_##name##_OFFSET)) | SM_BF(name,value))
235 235
236/* Register access macros */ 236/* Register access macros */
237#define sm_readl(port,reg) readl((port)->regs + SM_##reg) 237#define sm_readl(port,reg) \
238#define sm_writel(port,reg,value) writel((value), (port)->regs + SM_##reg) 238 __raw_readl((port)->regs + SM_##reg)
239#define sm_writel(port,reg,value) \
240 __raw_writel((value), (port)->regs + SM_##reg)
239 241
240#endif /* __ASM_AVR32_SM_H__ */ 242#endif /* __ASM_AVR32_SM_H__ */
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index 3e6c41039808..70da6894acc1 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -206,7 +206,7 @@ void __init setup_bootmem(void)
206 206
207 if (mem_ramdisk) { 207 if (mem_ramdisk) {
208#ifdef CONFIG_BLK_DEV_INITRD 208#ifdef CONFIG_BLK_DEV_INITRD
209 initrd_start = __va(mem_ramdisk->addr); 209 initrd_start = (unsigned long)__va(mem_ramdisk->addr);
210 initrd_end = initrd_start + mem_ramdisk->size; 210 initrd_end = initrd_start + mem_ramdisk->size;
211 211
212 print_memory_map("RAMDISK images", mem_ramdisk); 212 print_memory_map("RAMDISK images", mem_ramdisk);
diff --git a/arch/avr32/mm/ioremap.c b/arch/avr32/mm/ioremap.c
index 8cfec65e37f7..3437c82434ac 100644
--- a/arch/avr32/mm/ioremap.c
+++ b/arch/avr32/mm/ioremap.c
@@ -77,6 +77,8 @@ void __iounmap(void __iomem *addr)
77 77
78 if ((unsigned long)addr >= P4SEG) 78 if ((unsigned long)addr >= P4SEG)
79 return; 79 return;
80 if (PXSEG(addr) == P2SEG)
81 return;
80 82
81 p = remove_vm_area((void *)(PAGE_MASK & (unsigned long __force)addr)); 83 p = remove_vm_area((void *)(PAGE_MASK & (unsigned long __force)addr));
82 if (unlikely(!p)) { 84 if (unlikely(!p)) {
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index f474534ba78a..9c1fb12367fa 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -44,13 +44,7 @@ SECTIONS
44 44
45 __initcall_start = .; 45 __initcall_start = .;
46 .initcall.init : { 46 .initcall.init : {
47 *(.initcall1.init) 47 INITCALLS
48 *(.initcall2.init)
49 *(.initcall3.init)
50 *(.initcall4.init)
51 *(.initcall5.init)
52 *(.initcall6.init)
53 *(.initcall7.init)
54 } 48 }
55 __initcall_end = .; 49 __initcall_end = .;
56 __con_initcall_start = .; 50 __con_initcall_start = .;
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
index 6406c388f88a..756325dd480e 100644
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ b/arch/h8300/kernel/vmlinux.lds.S
@@ -118,13 +118,7 @@ SECTIONS
118 . = ALIGN(0x4) ; 118 . = ALIGN(0x4) ;
119 ___setup_end = .; 119 ___setup_end = .;
120 ___initcall_start = .; 120 ___initcall_start = .;
121 *(.initcall1.init) 121 INITCALLS
122 *(.initcall2.init)
123 *(.initcall3.init)
124 *(.initcall4.init)
125 *(.initcall5.init)
126 *(.initcall6.init)
127 *(.initcall7.init)
128 ___initcall_end = .; 122 ___initcall_end = .;
129 ___con_initcall_start = .; 123 ___con_initcall_start = .;
130 *(.con_initcall.init) 124 *(.con_initcall.init)
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 519e63c3c130..141041dde74d 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -846,7 +846,7 @@ efi_find_max_pfn(unsigned long start, unsigned long end, void *arg)
846static int __init 846static int __init
847efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg) 847efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg)
848{ 848{
849 memory_present(0, start, end); 849 memory_present(0, PFN_UP(start), PFN_DOWN(end));
850 return 0; 850 return 0;
851} 851}
852 852
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index 1e7ac1c44ddc..adc1f232afee 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -126,13 +126,7 @@ SECTIONS
126 __setup_end = .; 126 __setup_end = .;
127 __initcall_start = .; 127 __initcall_start = .;
128 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { 128 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
129 *(.initcall1.init) 129 INITCALLS
130 *(.initcall2.init)
131 *(.initcall3.init)
132 *(.initcall4.init)
133 *(.initcall5.init)
134 *(.initcall6.init)
135 *(.initcall7.init)
136 } 130 }
137 __initcall_end = .; 131 __initcall_end = .;
138 __con_initcall_start = .; 132 __con_initcall_start = .;
diff --git a/arch/i386/mach-visws/visws_apic.c b/arch/i386/mach-visws/visws_apic.c
index 07097ed48890..38c2b13124d9 100644
--- a/arch/i386/mach-visws/visws_apic.c
+++ b/arch/i386/mach-visws/visws_apic.c
@@ -122,7 +122,7 @@ static void end_cobalt_irq(unsigned int irq)
122 spin_unlock_irqrestore(&cobalt_lock, flags); 122 spin_unlock_irqrestore(&cobalt_lock, flags);
123} 123}
124 124
125static struct hw_interrupt_type cobalt_irq_type = { 125static struct irq_chip cobalt_irq_type = {
126 .typename = "Cobalt-APIC", 126 .typename = "Cobalt-APIC",
127 .startup = startup_cobalt_irq, 127 .startup = startup_cobalt_irq,
128 .shutdown = disable_cobalt_irq, 128 .shutdown = disable_cobalt_irq,
@@ -159,7 +159,7 @@ static void end_piix4_master_irq(unsigned int irq)
159 spin_unlock_irqrestore(&cobalt_lock, flags); 159 spin_unlock_irqrestore(&cobalt_lock, flags);
160} 160}
161 161
162static struct hw_interrupt_type piix4_master_irq_type = { 162static struct irq_chip piix4_master_irq_type = {
163 .typename = "PIIX4-master", 163 .typename = "PIIX4-master",
164 .startup = startup_piix4_master_irq, 164 .startup = startup_piix4_master_irq,
165 .ack = ack_cobalt_irq, 165 .ack = ack_cobalt_irq,
@@ -167,9 +167,8 @@ static struct hw_interrupt_type piix4_master_irq_type = {
167}; 167};
168 168
169 169
170static struct hw_interrupt_type piix4_virtual_irq_type = { 170static struct irq_chip piix4_virtual_irq_type = {
171 .typename = "PIIX4-virtual", 171 .typename = "PIIX4-virtual",
172 .startup = startup_8259A_irq,
173 .shutdown = disable_8259A_irq, 172 .shutdown = disable_8259A_irq,
174 .enable = enable_8259A_irq, 173 .enable = enable_8259A_irq,
175 .disable = disable_8259A_irq, 174 .disable = disable_8259A_irq,
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
index 908b410f4c93..c1949ff38d61 100644
--- a/arch/i386/pci/fixup.c
+++ b/arch/i386/pci/fixup.c
@@ -343,6 +343,61 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC, pcie_ro
343DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_rootport_aspm_quirk ); 343DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_rootport_aspm_quirk );
344 344
345/* 345/*
346 * Fixup to mark boot BIOS video selected by BIOS before it changes
347 *
348 * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
349 *
350 * The standard boot ROM sequence for an x86 machine uses the BIOS
351 * to select an initial video card for boot display. This boot video
352 * card will have it's BIOS copied to C0000 in system RAM.
353 * IORESOURCE_ROM_SHADOW is used to associate the boot video
354 * card with this copy. On laptops this copy has to be used since
355 * the main ROM may be compressed or combined with another image.
356 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
357 * is marked here since the boot video device will be the only enabled
358 * video device at this point.
359 */
360
361static void __devinit pci_fixup_video(struct pci_dev *pdev)
362{
363 struct pci_dev *bridge;
364 struct pci_bus *bus;
365 u16 config;
366
367 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
368 return;
369
370 /* Is VGA routed to us? */
371 bus = pdev->bus;
372 while (bus) {
373 bridge = bus->self;
374
375 /*
376 * From information provided by
377 * "David Miller" <davem@davemloft.net>
378 * The bridge control register is valid for PCI header
379 * type BRIDGE, or CARDBUS. Host to PCI controllers use
380 * PCI header type NORMAL.
381 */
382 if (bridge
383 &&((bridge->hdr_type == PCI_HEADER_TYPE_BRIDGE)
384 ||(bridge->hdr_type == PCI_HEADER_TYPE_CARDBUS))) {
385 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
386 &config);
387 if (!(config & PCI_BRIDGE_CTL_VGA))
388 return;
389 }
390 bus = bus->parent;
391 }
392 pci_read_config_word(pdev, PCI_COMMAND, &config);
393 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
394 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
395 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
396 }
397}
398DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
399
400/*
346 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A. 401 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A.
347 * 402 *
348 * We pretend to bring them out of full D3 state, and restore the proper 403 * We pretend to bring them out of full D3 state, and restore the proper
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index b3b2e389d6b2..d6083a0936f4 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -128,13 +128,7 @@ SECTIONS
128 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) 128 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET)
129 { 129 {
130 __initcall_start = .; 130 __initcall_start = .;
131 *(.initcall1.init) 131 INITCALLS
132 *(.initcall2.init)
133 *(.initcall3.init)
134 *(.initcall4.init)
135 *(.initcall5.init)
136 *(.initcall6.init)
137 *(.initcall7.init)
138 __initcall_end = .; 132 __initcall_end = .;
139 } 133 }
140 134
diff --git a/arch/ia64/pci/Makefile b/arch/ia64/pci/Makefile
index e66889e6922a..fb14dc520d2d 100644
--- a/arch/ia64/pci/Makefile
+++ b/arch/ia64/pci/Makefile
@@ -1,4 +1,4 @@
1# 1#
2# Makefile for the ia64-specific parts of the pci bus 2# Makefile for the ia64-specific parts of the pci bus
3# 3#
4obj-y := pci.o 4obj-y := pci.o fixup.o
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
new file mode 100644
index 000000000000..245dc1fedc24
--- /dev/null
+++ b/arch/ia64/pci/fixup.c
@@ -0,0 +1,69 @@
1/*
2 * Exceptions for specific devices. Usually work-arounds for fatal design flaws.
3 * Derived from fixup.c of i386 tree.
4 */
5
6#include <linux/pci.h>
7#include <linux/init.h>
8
9#include <asm/machvec.h>
10
11/*
12 * Fixup to mark boot BIOS video selected by BIOS before it changes
13 *
14 * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
15 *
16 * The standard boot ROM sequence for an x86 machine uses the BIOS
17 * to select an initial video card for boot display. This boot video
18 * card will have it's BIOS copied to C0000 in system RAM.
19 * IORESOURCE_ROM_SHADOW is used to associate the boot video
20 * card with this copy. On laptops this copy has to be used since
21 * the main ROM may be compressed or combined with another image.
22 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
23 * is marked here since the boot video device will be the only enabled
24 * video device at this point.
25 */
26
27static void __devinit pci_fixup_video(struct pci_dev *pdev)
28{
29 struct pci_dev *bridge;
30 struct pci_bus *bus;
31 u16 config;
32
33 if ((strcmp(platform_name, "dig") != 0)
34 && (strcmp(platform_name, "hpzx1") != 0))
35 return;
36 /* Maybe, this machine supports legacy memory map. */
37
38 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
39 return;
40
41 /* Is VGA routed to us? */
42 bus = pdev->bus;
43 while (bus) {
44 bridge = bus->self;
45
46 /*
47 * From information provided by
48 * "David Miller" <davem@davemloft.net>
49 * The bridge control register is valid for PCI header
50 * type BRIDGE, or CARDBUS. Host to PCI controllers use
51 * PCI header type NORMAL.
52 */
53 if (bridge
54 &&((bridge->hdr_type == PCI_HEADER_TYPE_BRIDGE)
55 ||(bridge->hdr_type == PCI_HEADER_TYPE_CARDBUS))) {
56 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
57 &config);
58 if (!(config & PCI_BRIDGE_CTL_VGA))
59 return;
60 }
61 bus = bus->parent;
62 }
63 pci_read_config_word(pdev, PCI_COMMAND, &config);
64 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
65 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
66 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
67 }
68}
69DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S
index 13c7bb698e37..358b9cee2c65 100644
--- a/arch/m32r/kernel/vmlinux.lds.S
+++ b/arch/m32r/kernel/vmlinux.lds.S
@@ -83,13 +83,7 @@ SECTIONS
83 __setup_end = .; 83 __setup_end = .;
84 __initcall_start = .; 84 __initcall_start = .;
85 .initcall.init : { 85 .initcall.init : {
86 *(.initcall1.init) 86 INITCALLS
87 *(.initcall2.init)
88 *(.initcall3.init)
89 *(.initcall4.init)
90 *(.initcall5.init)
91 *(.initcall6.init)
92 *(.initcall7.init)
93 } 87 }
94 __initcall_end = .; 88 __initcall_end = .;
95 __con_initcall_start = .; 89 __con_initcall_start = .;
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 69d1d3d30c78..d2794452b195 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -54,13 +54,7 @@ SECTIONS
54 __setup_end = .; 54 __setup_end = .;
55 __initcall_start = .; 55 __initcall_start = .;
56 .initcall.init : { 56 .initcall.init : {
57 *(.initcall1.init) 57 INITCALLS
58 *(.initcall2.init)
59 *(.initcall3.init)
60 *(.initcall4.init)
61 *(.initcall5.init)
62 *(.initcall6.init)
63 *(.initcall7.init)
64 } 58 }
65 __initcall_end = .; 59 __initcall_end = .;
66 __con_initcall_start = .; 60 __con_initcall_start = .;
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index 65cc39c24185..2550b4ae2732 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -48,13 +48,7 @@ __init_begin = .;
48 __setup_end = .; 48 __setup_end = .;
49 __initcall_start = .; 49 __initcall_start = .;
50 .initcall.init : { 50 .initcall.init : {
51 *(.initcall1.init) 51 INITCALLS
52 *(.initcall2.init)
53 *(.initcall3.init)
54 *(.initcall4.init)
55 *(.initcall5.init)
56 *(.initcall6.init)
57 *(.initcall7.init)
58 } 52 }
59 __initcall_end = .; 53 __initcall_end = .;
60 __con_initcall_start = .; 54 __con_initcall_start = .;
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index ccd2ceb05cfb..58afa8be604e 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -140,13 +140,7 @@ SECTIONS {
140 *(.init.setup) 140 *(.init.setup)
141 __setup_end = .; 141 __setup_end = .;
142 __initcall_start = .; 142 __initcall_start = .;
143 *(.initcall1.init) 143 INITCALLS
144 *(.initcall2.init)
145 *(.initcall3.init)
146 *(.initcall4.init)
147 *(.initcall5.init)
148 *(.initcall6.init)
149 *(.initcall7.init)
150 __initcall_end = .; 144 __initcall_end = .;
151 __con_initcall_start = .; 145 __con_initcall_start = .;
152 *(.con_initcall.init) 146 *(.con_initcall.init)
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 0bb9cd889456..25ed3337ce35 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -91,13 +91,7 @@ SECTIONS
91 91
92 __initcall_start = .; 92 __initcall_start = .;
93 .initcall.init : { 93 .initcall.init : {
94 *(.initcall1.init) 94 INITCALLS
95 *(.initcall2.init)
96 *(.initcall3.init)
97 *(.initcall4.init)
98 *(.initcall5.init)
99 *(.initcall6.init)
100 *(.initcall7.init)
101 } 95 }
102 __initcall_end = .; 96 __initcall_end = .;
103 97
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index b3677fc8eef5..7b943b45f7cd 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -153,13 +153,7 @@ SECTIONS
153 __setup_end = .; 153 __setup_end = .;
154 __initcall_start = .; 154 __initcall_start = .;
155 .initcall.init : { 155 .initcall.init : {
156 *(.initcall1.init) 156 INITCALLS
157 *(.initcall2.init)
158 *(.initcall3.init)
159 *(.initcall4.init)
160 *(.initcall5.init)
161 *(.initcall6.init)
162 *(.initcall7.init)
163 } 157 }
164 __initcall_end = .; 158 __initcall_end = .;
165 __con_initcall_start = .; 159 __con_initcall_start = .;
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 37ddfcab0003..4b2be611f77f 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -115,7 +115,7 @@ endif
115quiet_cmd_wrap = WRAP $@ 115quiet_cmd_wrap = WRAP $@
116 cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) vmlinux 116 cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) vmlinux
117quiet_cmd_wrap_initrd = WRAP $@ 117quiet_cmd_wrap_initrd = WRAP $@
118 cmd_wrap_initrd =$(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \ 118 cmd_wrap_initrd =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
119 -i $(obj)/ramdisk.image.gz vmlinux 119 -i $(obj)/ramdisk.image.gz vmlinux
120 120
121$(obj)/zImage.chrp: vmlinux $(wrapperbits) 121$(obj)/zImage.chrp: vmlinux $(wrapperbits)
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index 892d5dd3254e..0aba06d7d2ec 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -254,6 +254,7 @@ CONFIG_SYN_COOKIES=y
254CONFIG_INET_TUNNEL=y 254CONFIG_INET_TUNNEL=y
255CONFIG_INET_XFRM_MODE_TRANSPORT=y 255CONFIG_INET_XFRM_MODE_TRANSPORT=y
256CONFIG_INET_XFRM_MODE_TUNNEL=y 256CONFIG_INET_XFRM_MODE_TUNNEL=y
257# CONFIG_INET_XFRM_MODE_BEET is not set
257CONFIG_INET_DIAG=y 258CONFIG_INET_DIAG=y
258CONFIG_INET_TCP_DIAG=y 259CONFIG_INET_TCP_DIAG=y
259# CONFIG_TCP_CONG_ADVANCED is not set 260# CONFIG_TCP_CONG_ADVANCED is not set
@@ -275,7 +276,9 @@ CONFIG_INET6_XFRM_TUNNEL=m
275CONFIG_INET6_TUNNEL=m 276CONFIG_INET6_TUNNEL=m
276CONFIG_INET6_XFRM_MODE_TRANSPORT=y 277CONFIG_INET6_XFRM_MODE_TRANSPORT=y
277CONFIG_INET6_XFRM_MODE_TUNNEL=y 278CONFIG_INET6_XFRM_MODE_TUNNEL=y
279# CONFIG_INET6_XFRM_MODE_BEET is not set
278# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 280# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
281# CONFIG_IPV6_SIT is not set
279CONFIG_IPV6_TUNNEL=m 282CONFIG_IPV6_TUNNEL=m
280# CONFIG_IPV6_SUBTREES is not set 283# CONFIG_IPV6_SUBTREES is not set
281# CONFIG_IPV6_MULTIPLE_TABLES is not set 284# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -406,6 +409,12 @@ CONFIG_BLK_DEV_INITRD=y
406# CONFIG_ATA_OVER_ETH is not set 409# CONFIG_ATA_OVER_ETH is not set
407 410
408# 411#
412# Misc devices
413#
414# CONFIG_SGI_IOC4 is not set
415# CONFIG_TIFM_CORE is not set
416
417#
409# ATA/ATAPI/MFM/RLL support 418# ATA/ATAPI/MFM/RLL support
410# 419#
411CONFIG_IDE=y 420CONFIG_IDE=y
@@ -738,7 +747,6 @@ CONFIG_GEN_RTC=y
738# TPM devices 747# TPM devices
739# 748#
740# CONFIG_TCG_TPM is not set 749# CONFIG_TCG_TPM is not set
741# CONFIG_TELCLOCK is not set
742 750
743# 751#
744# I2C support 752# I2C support
@@ -802,6 +810,7 @@ CONFIG_I2C_ALGOBIT=y
802# 810#
803# Dallas's 1-wire bus 811# Dallas's 1-wire bus
804# 812#
813# CONFIG_W1 is not set
805 814
806# 815#
807# Hardware Monitoring support 816# Hardware Monitoring support
@@ -810,14 +819,9 @@ CONFIG_I2C_ALGOBIT=y
810# CONFIG_HWMON_VID is not set 819# CONFIG_HWMON_VID is not set
811 820
812# 821#
813# Misc devices
814#
815
816#
817# Multimedia devices 822# Multimedia devices
818# 823#
819# CONFIG_VIDEO_DEV is not set 824# CONFIG_VIDEO_DEV is not set
820CONFIG_VIDEO_V4L2=y
821 825
822# 826#
823# Digital Video Broadcasting Devices 827# Digital Video Broadcasting Devices
@@ -923,6 +927,7 @@ CONFIG_EXT3_FS=y
923CONFIG_EXT3_FS_XATTR=y 927CONFIG_EXT3_FS_XATTR=y
924# CONFIG_EXT3_FS_POSIX_ACL is not set 928# CONFIG_EXT3_FS_POSIX_ACL is not set
925# CONFIG_EXT3_FS_SECURITY is not set 929# CONFIG_EXT3_FS_SECURITY is not set
930# CONFIG_EXT4DEV_FS is not set
926CONFIG_JBD=y 931CONFIG_JBD=y
927# CONFIG_JBD_DEBUG is not set 932# CONFIG_JBD_DEBUG is not set
928CONFIG_FS_MBCACHE=y 933CONFIG_FS_MBCACHE=y
@@ -930,6 +935,7 @@ CONFIG_FS_MBCACHE=y
930# CONFIG_JFS_FS is not set 935# CONFIG_JFS_FS is not set
931CONFIG_FS_POSIX_ACL=y 936CONFIG_FS_POSIX_ACL=y
932# CONFIG_XFS_FS is not set 937# CONFIG_XFS_FS is not set
938# CONFIG_GFS2_FS is not set
933# CONFIG_OCFS2_FS is not set 939# CONFIG_OCFS2_FS is not set
934# CONFIG_MINIX_FS is not set 940# CONFIG_MINIX_FS is not set
935# CONFIG_ROMFS_FS is not set 941# CONFIG_ROMFS_FS is not set
@@ -1129,6 +1135,7 @@ CONFIG_DEBUG_FS=y
1129# CONFIG_DEBUG_VM is not set 1135# CONFIG_DEBUG_VM is not set
1130# CONFIG_DEBUG_LIST is not set 1136# CONFIG_DEBUG_LIST is not set
1131# CONFIG_FORCED_INLINING is not set 1137# CONFIG_FORCED_INLINING is not set
1138# CONFIG_HEADERS_CHECK is not set
1132# CONFIG_RCU_TORTURE_TEST is not set 1139# CONFIG_RCU_TORTURE_TEST is not set
1133# CONFIG_DEBUG_STACKOVERFLOW is not set 1140# CONFIG_DEBUG_STACKOVERFLOW is not set
1134# CONFIG_DEBUG_STACK_USAGE is not set 1141# CONFIG_DEBUG_STACK_USAGE is not set
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 95382f994404..bfd499ee3753 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -18,6 +18,7 @@
18 18
19#include <asm/oprofile_impl.h> 19#include <asm/oprofile_impl.h>
20#include <asm/cputable.h> 20#include <asm/cputable.h>
21#include <asm/prom.h> /* for PTRRELOC on ARCH=ppc */
21 22
22struct cpu_spec* cur_cpu_spec = NULL; 23struct cpu_spec* cur_cpu_spec = NULL;
23EXPORT_SYMBOL(cur_cpu_spec); 24EXPORT_SYMBOL(cur_cpu_spec);
@@ -73,7 +74,7 @@ extern void __restore_cpu_ppc970(void);
73#define PPC_FEATURE_SPE_COMP 0 74#define PPC_FEATURE_SPE_COMP 0
74#endif 75#endif
75 76
76struct cpu_spec cpu_specs[] = { 77static struct cpu_spec cpu_specs[] = {
77#ifdef CONFIG_PPC64 78#ifdef CONFIG_PPC64
78 { /* Power3 */ 79 { /* Power3 */
79 .pvr_mask = 0xffff0000, 80 .pvr_mask = 0xffff0000,
@@ -227,6 +228,21 @@ struct cpu_spec cpu_specs[] = {
227 .oprofile_type = PPC_OPROFILE_POWER4, 228 .oprofile_type = PPC_OPROFILE_POWER4,
228 .platform = "ppc970", 229 .platform = "ppc970",
229 }, 230 },
231 { /* PPC970GX */
232 .pvr_mask = 0xffff0000,
233 .pvr_value = 0x00450000,
234 .cpu_name = "PPC970GX",
235 .cpu_features = CPU_FTRS_PPC970,
236 .cpu_user_features = COMMON_USER_POWER4 |
237 PPC_FEATURE_HAS_ALTIVEC_COMP,
238 .icache_bsize = 128,
239 .dcache_bsize = 128,
240 .num_pmcs = 8,
241 .cpu_setup = __setup_cpu_ppc970,
242 .oprofile_cpu_type = "ppc64/970",
243 .oprofile_type = PPC_OPROFILE_POWER4,
244 .platform = "ppc970",
245 },
230 { /* Power5 GR */ 246 { /* Power5 GR */
231 .pvr_mask = 0xffff0000, 247 .pvr_mask = 0xffff0000,
232 .pvr_value = 0x003a0000, 248 .pvr_value = 0x003a0000,
@@ -1152,3 +1168,71 @@ struct cpu_spec cpu_specs[] = {
1152#endif /* !CLASSIC_PPC */ 1168#endif /* !CLASSIC_PPC */
1153#endif /* CONFIG_PPC32 */ 1169#endif /* CONFIG_PPC32 */
1154}; 1170};
1171
1172struct cpu_spec *identify_cpu(unsigned long offset)
1173{
1174 struct cpu_spec *s = cpu_specs;
1175 struct cpu_spec **cur = &cur_cpu_spec;
1176 unsigned int pvr = mfspr(SPRN_PVR);
1177 int i;
1178
1179 s = PTRRELOC(s);
1180 cur = PTRRELOC(cur);
1181
1182 if (*cur != NULL)
1183 return PTRRELOC(*cur);
1184
1185 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
1186 if ((pvr & s->pvr_mask) == s->pvr_value) {
1187 *cur = cpu_specs + i;
1188#ifdef CONFIG_PPC64
1189 /* ppc64 expects identify_cpu to also call setup_cpu
1190 * for that processor. I will consolidate that at a
1191 * later time, for now, just use our friend #ifdef.
1192 * we also don't need to PTRRELOC the function pointer
1193 * on ppc64 as we are running at 0 in real mode.
1194 */
1195 if (s->cpu_setup) {
1196 s->cpu_setup(offset, s);
1197 }
1198#endif /* CONFIG_PPC64 */
1199 return s;
1200 }
1201 BUG();
1202 return NULL;
1203}
1204
1205void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
1206{
1207 struct fixup_entry {
1208 unsigned long mask;
1209 unsigned long value;
1210 long start_off;
1211 long end_off;
1212 } *fcur, *fend;
1213
1214 fcur = fixup_start;
1215 fend = fixup_end;
1216
1217 for (; fcur < fend; fcur++) {
1218 unsigned int *pstart, *pend, *p;
1219
1220 if ((value & fcur->mask) == fcur->value)
1221 continue;
1222
1223 /* These PTRRELOCs will disappear once the new scheme for
1224 * modules and vdso is implemented
1225 */
1226 pstart = ((unsigned int *)fcur) + (fcur->start_off / 4);
1227 pend = ((unsigned int *)fcur) + (fcur->end_off / 4);
1228
1229 for (p = pstart; p < pend; p++) {
1230 *p = 0x60000000u;
1231 asm volatile ("dcbst 0, %0" : : "r" (p));
1232 }
1233 asm volatile ("sync" : : : "memory");
1234 for (p = pstart; p < pend; p++)
1235 asm volatile ("icbi 0,%0" : : "r" (p));
1236 asm volatile ("sync; isync" : : : "memory");
1237 }
1238}
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 645c7f10fb28..291e3629b504 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -1580,11 +1580,6 @@ _STATIC(__start_initialization_iSeries)
1580 li r0,0 1580 li r0,0
1581 stdu r0,-STACK_FRAME_OVERHEAD(r1) 1581 stdu r0,-STACK_FRAME_OVERHEAD(r1)
1582 1582
1583 LOAD_REG_IMMEDIATE(r3,cpu_specs)
1584 LOAD_REG_IMMEDIATE(r4,cur_cpu_spec)
1585 li r5,0
1586 bl .identify_cpu
1587
1588 LOAD_REG_IMMEDIATE(r2,__toc_start) 1583 LOAD_REG_IMMEDIATE(r2,__toc_start)
1589 addi r2,r2,0x4000 1584 addi r2,r2,0x4000
1590 addi r2,r2,0x4000 1585 addi r2,r2,0x4000
@@ -1646,6 +1641,8 @@ _GLOBAL(__start_initialization_multiplatform)
1646 cmpwi r0,0x3c /* 970FX */ 1641 cmpwi r0,0x3c /* 970FX */
1647 beq 1f 1642 beq 1f
1648 cmpwi r0,0x44 /* 970MP */ 1643 cmpwi r0,0x44 /* 970MP */
1644 beq 1f
1645 cmpwi r0,0x45 /* 970GX */
1649 bne 2f 1646 bne 2f
16501: bl .__cpu_preinit_ppc970 16471: bl .__cpu_preinit_ppc970
16512: 16482:
@@ -1964,13 +1961,6 @@ _STATIC(start_here_multiplatform)
1964 addi r2,r2,0x4000 1961 addi r2,r2,0x4000
1965 add r2,r2,r26 1962 add r2,r2,r26
1966 1963
1967 LOAD_REG_IMMEDIATE(r3, cpu_specs)
1968 add r3,r3,r26
1969 LOAD_REG_IMMEDIATE(r4,cur_cpu_spec)
1970 add r4,r4,r26
1971 mr r5,r26
1972 bl .identify_cpu
1973
1974 /* Do very early kernel initializations, including initial hash table, 1964 /* Do very early kernel initializations, including initial hash table,
1975 * stab and slb setup before we turn on relocation. */ 1965 * stab and slb setup before we turn on relocation. */
1976 1966
@@ -2000,13 +1990,6 @@ _STATIC(start_here_common)
2000 li r0,0 1990 li r0,0
2001 stdu r0,-STACK_FRAME_OVERHEAD(r1) 1991 stdu r0,-STACK_FRAME_OVERHEAD(r1)
2002 1992
2003 /* Apply the CPUs-specific fixups (nop out sections not relevant
2004 * to this CPU
2005 */
2006 li r3,0
2007 bl .do_cpu_ftr_fixups
2008 bl .do_fw_ftr_fixups
2009
2010 /* ptr to current */ 1993 /* ptr to current */
2011 LOAD_REG_IMMEDIATE(r4, init_task) 1994 LOAD_REG_IMMEDIATE(r4, init_task)
2012 std r4,PACACURRENT(r13) 1995 std r4,PACACURRENT(r13)
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 88fd73fdf048..412bea3cf813 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -102,80 +102,6 @@ _GLOBAL(reloc_got2)
102 blr 102 blr
103 103
104/* 104/*
105 * identify_cpu,
106 * called with r3 = data offset and r4 = CPU number
107 * doesn't change r3
108 */
109_GLOBAL(identify_cpu)
110 addis r8,r3,cpu_specs@ha
111 addi r8,r8,cpu_specs@l
112 mfpvr r7
1131:
114 lwz r5,CPU_SPEC_PVR_MASK(r8)
115 and r5,r5,r7
116 lwz r6,CPU_SPEC_PVR_VALUE(r8)
117 cmplw 0,r6,r5
118 beq 1f
119 addi r8,r8,CPU_SPEC_ENTRY_SIZE
120 b 1b
1211:
122 addis r6,r3,cur_cpu_spec@ha
123 addi r6,r6,cur_cpu_spec@l
124 sub r8,r8,r3
125 stw r8,0(r6)
126 blr
127
128/*
129 * do_cpu_ftr_fixups - goes through the list of CPU feature fixups
130 * and writes nop's over sections of code that don't apply for this cpu.
131 * r3 = data offset (not changed)
132 */
133_GLOBAL(do_cpu_ftr_fixups)
134 /* Get CPU 0 features */
135 addis r6,r3,cur_cpu_spec@ha
136 addi r6,r6,cur_cpu_spec@l
137 lwz r4,0(r6)
138 add r4,r4,r3
139 lwz r4,CPU_SPEC_FEATURES(r4)
140
141 /* Get the fixup table */
142 addis r6,r3,__start___ftr_fixup@ha
143 addi r6,r6,__start___ftr_fixup@l
144 addis r7,r3,__stop___ftr_fixup@ha
145 addi r7,r7,__stop___ftr_fixup@l
146
147 /* Do the fixup */
1481: cmplw 0,r6,r7
149 bgelr
150 addi r6,r6,16
151 lwz r8,-16(r6) /* mask */
152 and r8,r8,r4
153 lwz r9,-12(r6) /* value */
154 cmplw 0,r8,r9
155 beq 1b
156 lwz r8,-8(r6) /* section begin */
157 lwz r9,-4(r6) /* section end */
158 subf. r9,r8,r9
159 beq 1b
160 /* write nops over the section of code */
161 /* todo: if large section, add a branch at the start of it */
162 srwi r9,r9,2
163 mtctr r9
164 add r8,r8,r3
165 lis r0,0x60000000@h /* nop */
1663: stw r0,0(r8)
167 andi. r10,r4,CPU_FTR_SPLIT_ID_CACHE@l
168 beq 2f
169 dcbst 0,r8 /* suboptimal, but simpler */
170 sync
171 icbi 0,r8
1722: addi r8,r8,4
173 bdnz 3b
174 sync /* additional sync needed on g4 */
175 isync
176 b 1b
177
178/*
179 * call_setup_cpu - call the setup_cpu function for this cpu 105 * call_setup_cpu - call the setup_cpu function for this cpu
180 * r3 = data offset, r24 = cpu number 106 * r3 = data offset, r24 = cpu number
181 * 107 *
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index c70e20708a1f..21fd2c662a99 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -246,130 +246,6 @@ _GLOBAL(__flush_dcache_icache)
246 isync 246 isync
247 blr 247 blr
248 248
249/*
250 * identify_cpu and calls setup_cpu
251 * In: r3 = base of the cpu_specs array
252 * r4 = address of cur_cpu_spec
253 * r5 = relocation offset
254 */
255_GLOBAL(identify_cpu)
256 mfpvr r7
2571:
258 lwz r8,CPU_SPEC_PVR_MASK(r3)
259 and r8,r8,r7
260 lwz r9,CPU_SPEC_PVR_VALUE(r3)
261 cmplw 0,r9,r8
262 beq 1f
263 addi r3,r3,CPU_SPEC_ENTRY_SIZE
264 b 1b
2651:
266 sub r0,r3,r5
267 std r0,0(r4)
268 ld r4,CPU_SPEC_SETUP(r3)
269 cmpdi 0,r4,0
270 add r4,r4,r5
271 beqlr
272 ld r4,0(r4)
273 add r4,r4,r5
274 mtctr r4
275 /* Calling convention for cpu setup is r3=offset, r4=cur_cpu_spec */
276 mr r4,r3
277 mr r3,r5
278 bctr
279
280/*
281 * do_cpu_ftr_fixups - goes through the list of CPU feature fixups
282 * and writes nop's over sections of code that don't apply for this cpu.
283 * r3 = data offset (not changed)
284 */
285_GLOBAL(do_cpu_ftr_fixups)
286 /* Get CPU 0 features */
287 LOAD_REG_IMMEDIATE(r6,cur_cpu_spec)
288 sub r6,r6,r3
289 ld r4,0(r6)
290 sub r4,r4,r3
291 ld r4,CPU_SPEC_FEATURES(r4)
292 /* Get the fixup table */
293 LOAD_REG_IMMEDIATE(r6,__start___ftr_fixup)
294 sub r6,r6,r3
295 LOAD_REG_IMMEDIATE(r7,__stop___ftr_fixup)
296 sub r7,r7,r3
297 /* Do the fixup */
2981: cmpld r6,r7
299 bgelr
300 addi r6,r6,32
301 ld r8,-32(r6) /* mask */
302 and r8,r8,r4
303 ld r9,-24(r6) /* value */
304 cmpld r8,r9
305 beq 1b
306 ld r8,-16(r6) /* section begin */
307 ld r9,-8(r6) /* section end */
308 subf. r9,r8,r9
309 beq 1b
310 /* write nops over the section of code */
311 /* todo: if large section, add a branch at the start of it */
312 srwi r9,r9,2
313 mtctr r9
314 sub r8,r8,r3
315 lis r0,0x60000000@h /* nop */
3163: stw r0,0(r8)
317 andi. r10,r4,CPU_FTR_SPLIT_ID_CACHE@l
318 beq 2f
319 dcbst 0,r8 /* suboptimal, but simpler */
320 sync
321 icbi 0,r8
3222: addi r8,r8,4
323 bdnz 3b
324 sync /* additional sync needed on g4 */
325 isync
326 b 1b
327
328/*
329 * do_fw_ftr_fixups - goes through the list of firmware feature fixups
330 * and writes nop's over sections of code that don't apply for this firmware.
331 * r3 = data offset (not changed)
332 */
333_GLOBAL(do_fw_ftr_fixups)
334 /* Get firmware features */
335 LOAD_REG_IMMEDIATE(r6,powerpc_firmware_features)
336 sub r6,r6,r3
337 ld r4,0(r6)
338 /* Get the fixup table */
339 LOAD_REG_IMMEDIATE(r6,__start___fw_ftr_fixup)
340 sub r6,r6,r3
341 LOAD_REG_IMMEDIATE(r7,__stop___fw_ftr_fixup)
342 sub r7,r7,r3
343 /* Do the fixup */
3441: cmpld r6,r7
345 bgelr
346 addi r6,r6,32
347 ld r8,-32(r6) /* mask */
348 and r8,r8,r4
349 ld r9,-24(r6) /* value */
350 cmpld r8,r9
351 beq 1b
352 ld r8,-16(r6) /* section begin */
353 ld r9,-8(r6) /* section end */
354 subf. r9,r8,r9
355 beq 1b
356 /* write nops over the section of code */
357 /* todo: if large section, add a branch at the start of it */
358 srwi r9,r9,2
359 mtctr r9
360 sub r8,r8,r3
361 lis r0,0x60000000@h /* nop */
3623: stw r0,0(r8)
363BEGIN_FTR_SECTION
364 dcbst 0,r8 /* suboptimal, but simpler */
365 sync
366 icbi 0,r8
367END_FTR_SECTION_IFSET(CPU_FTR_SPLIT_ID_CACHE)
368 addi r8,r8,4
369 bdnz 3b
370 sync /* additional sync needed on g4 */
371 isync
372 b 1b
373 249
374#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) 250#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
375/* 251/*
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
index 92f4e5f64f02..e2c3c6a85f33 100644
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -24,6 +24,8 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/cache.h> 25#include <linux/cache.h>
26 26
27#include "setup.h"
28
27#if 0 29#if 0
28#define DEBUGP printk 30#define DEBUGP printk
29#else 31#else
@@ -269,33 +271,50 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
269 return 0; 271 return 0;
270} 272}
271 273
274static const Elf_Shdr *find_section(const Elf_Ehdr *hdr,
275 const Elf_Shdr *sechdrs,
276 const char *name)
277{
278 char *secstrings;
279 unsigned int i;
280
281 secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
282 for (i = 1; i < hdr->e_shnum; i++)
283 if (strcmp(secstrings+sechdrs[i].sh_name, name) == 0)
284 return &sechdrs[i];
285 return NULL;
286}
287
272int module_finalize(const Elf_Ehdr *hdr, 288int module_finalize(const Elf_Ehdr *hdr,
273 const Elf_Shdr *sechdrs, 289 const Elf_Shdr *sechdrs,
274 struct module *me) 290 struct module *me)
275{ 291{
276 char *secstrings; 292 const Elf_Shdr *sect;
277 unsigned int i;
278 293
279 me->arch.bug_table = NULL; 294 me->arch.bug_table = NULL;
280 me->arch.num_bugs = 0; 295 me->arch.num_bugs = 0;
281 296
282 /* Find the __bug_table section, if present */ 297 /* Find the __bug_table section, if present */
283 secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; 298 sect = find_section(hdr, sechdrs, "__bug_table");
284 for (i = 1; i < hdr->e_shnum; i++) { 299 if (sect != NULL) {
285 if (strcmp(secstrings+sechdrs[i].sh_name, "__bug_table")) 300 me->arch.bug_table = (void *) sect->sh_addr;
286 continue; 301 me->arch.num_bugs = sect->sh_size / sizeof(struct bug_entry);
287 me->arch.bug_table = (void *) sechdrs[i].sh_addr;
288 me->arch.num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry);
289 break;
290 } 302 }
291 303
292 /* 304 /*
293 * Strictly speaking this should have a spinlock to protect against 305 * Strictly speaking this should have a spinlock to protect against
294 * traversals, but since we only traverse on BUG()s, a spinlock 306 * traversals, but since we only traverse on BUG()s, a spinlock
295 * could potentially lead to deadlock and thus be counter-productive. 307 * could potentially lead to deadlock and thus be counter-productive.
296 */ 308 */
297 list_add(&me->arch.bug_list, &module_bug_list); 309 list_add(&me->arch.bug_list, &module_bug_list);
298 310
311 /* Apply feature fixups */
312 sect = find_section(hdr, sechdrs, "__ftr_fixup");
313 if (sect != NULL)
314 do_feature_fixups(cur_cpu_spec->cpu_features,
315 (void *)sect->sh_addr,
316 (void *)sect->sh_addr + sect->sh_size);
317
299 return 0; 318 return 0;
300} 319}
301 320
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index ba34001fca8e..8dd1f0aae5d6 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -22,6 +22,9 @@
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <asm/module.h> 23#include <asm/module.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/firmware.h>
26
27#include "setup.h"
25 28
26/* FIXME: We don't do .init separately. To do this, we'd need to have 29/* FIXME: We don't do .init separately. To do this, we'd need to have
27 a separate r2 value in the init and core section, and stub between 30 a separate r2 value in the init and core section, and stub between
@@ -400,6 +403,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
400 | (value & 0x03fffffc); 403 | (value & 0x03fffffc);
401 break; 404 break;
402 405
406 case R_PPC64_REL64:
407 /* 64 bits relative (used by features fixups) */
408 *location = value - (unsigned long)location;
409 break;
410
403 default: 411 default:
404 printk("%s: Unknown ADD relocation: %lu\n", 412 printk("%s: Unknown ADD relocation: %lu\n",
405 me->name, 413 me->name,
@@ -413,23 +421,33 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
413 421
414LIST_HEAD(module_bug_list); 422LIST_HEAD(module_bug_list);
415 423
416int module_finalize(const Elf_Ehdr *hdr, 424static const Elf_Shdr *find_section(const Elf_Ehdr *hdr,
417 const Elf_Shdr *sechdrs, struct module *me) 425 const Elf_Shdr *sechdrs,
426 const char *name)
418{ 427{
419 char *secstrings; 428 char *secstrings;
420 unsigned int i; 429 unsigned int i;
421 430
431 secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
432 for (i = 1; i < hdr->e_shnum; i++)
433 if (strcmp(secstrings+sechdrs[i].sh_name, name) == 0)
434 return &sechdrs[i];
435 return NULL;
436}
437
438int module_finalize(const Elf_Ehdr *hdr,
439 const Elf_Shdr *sechdrs, struct module *me)
440{
441 const Elf_Shdr *sect;
442
422 me->arch.bug_table = NULL; 443 me->arch.bug_table = NULL;
423 me->arch.num_bugs = 0; 444 me->arch.num_bugs = 0;
424 445
425 /* Find the __bug_table section, if present */ 446 /* Find the __bug_table section, if present */
426 secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; 447 sect = find_section(hdr, sechdrs, "__bug_table");
427 for (i = 1; i < hdr->e_shnum; i++) { 448 if (sect != NULL) {
428 if (strcmp(secstrings+sechdrs[i].sh_name, "__bug_table")) 449 me->arch.bug_table = (void *) sect->sh_addr;
429 continue; 450 me->arch.num_bugs = sect->sh_size / sizeof(struct bug_entry);
430 me->arch.bug_table = (void *) sechdrs[i].sh_addr;
431 me->arch.num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry);
432 break;
433 } 451 }
434 452
435 /* 453 /*
@@ -439,6 +457,19 @@ int module_finalize(const Elf_Ehdr *hdr,
439 */ 457 */
440 list_add(&me->arch.bug_list, &module_bug_list); 458 list_add(&me->arch.bug_list, &module_bug_list);
441 459
460 /* Apply feature fixups */
461 sect = find_section(hdr, sechdrs, "__ftr_fixup");
462 if (sect != NULL)
463 do_feature_fixups(cur_cpu_spec->cpu_features,
464 (void *)sect->sh_addr,
465 (void *)sect->sh_addr + sect->sh_size);
466
467 sect = find_section(hdr, sechdrs, "__fw_ftr_fixup");
468 if (sect != NULL)
469 do_feature_fixups(powerpc_firmware_features,
470 (void *)sect->sh_addr,
471 (void *)sect->sh_addr + sect->sh_size);
472
442 return 0; 473 return 0;
443} 474}
444 475
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 865b9648d0d5..bdb412d4b748 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1014,7 +1014,7 @@ EXPORT_SYMBOL(find_all_nodes);
1014/** Checks if the given "compat" string matches one of the strings in 1014/** Checks if the given "compat" string matches one of the strings in
1015 * the device's "compatible" property 1015 * the device's "compatible" property
1016 */ 1016 */
1017int device_is_compatible(struct device_node *device, const char *compat) 1017int device_is_compatible(const struct device_node *device, const char *compat)
1018{ 1018{
1019 const char* cp; 1019 const char* cp;
1020 int cplen, l; 1020 int cplen, l;
@@ -1491,7 +1491,8 @@ static int __init prom_reconfig_setup(void)
1491__initcall(prom_reconfig_setup); 1491__initcall(prom_reconfig_setup);
1492#endif 1492#endif
1493 1493
1494struct property *of_find_property(struct device_node *np, const char *name, 1494struct property *of_find_property(const struct device_node *np,
1495 const char *name,
1495 int *lenp) 1496 int *lenp)
1496{ 1497{
1497 struct property *pp; 1498 struct property *pp;
@@ -1512,7 +1513,8 @@ struct property *of_find_property(struct device_node *np, const char *name,
1512 * Find a property with a given name for a given node 1513 * Find a property with a given name for a given node
1513 * and return the value. 1514 * and return the value.
1514 */ 1515 */
1515const void *get_property(struct device_node *np, const char *name, int *lenp) 1516const void *get_property(const struct device_node *np, const char *name,
1517 int *lenp)
1516{ 1518{
1517 struct property *pp = of_find_property(np,name,lenp); 1519 struct property *pp = of_find_property(np,name,lenp);
1518 return pp ? pp->value : NULL; 1520 return pp ? pp->value : NULL;
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 191d0ab09222..a4c2964a3ca6 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -91,6 +91,7 @@ int ucache_bsize;
91unsigned long __init early_init(unsigned long dt_ptr) 91unsigned long __init early_init(unsigned long dt_ptr)
92{ 92{
93 unsigned long offset = reloc_offset(); 93 unsigned long offset = reloc_offset();
94 struct cpu_spec *spec;
94 95
95 /* First zero the BSS -- use memset_io, some platforms don't have 96 /* First zero the BSS -- use memset_io, some platforms don't have
96 * caches on yet */ 97 * caches on yet */
@@ -100,8 +101,11 @@ unsigned long __init early_init(unsigned long dt_ptr)
100 * Identify the CPU type and fix up code sections 101 * Identify the CPU type and fix up code sections
101 * that depend on which cpu we have. 102 * that depend on which cpu we have.
102 */ 103 */
103 identify_cpu(offset, 0); 104 spec = identify_cpu(offset);
104 do_cpu_ftr_fixups(offset); 105
106 do_feature_fixups(spec->cpu_features,
107 PTRRELOC(&__start___ftr_fixup),
108 PTRRELOC(&__stop___ftr_fixup));
105 109
106 return KERNELBASE + offset; 110 return KERNELBASE + offset;
107} 111}
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 4b2e32eab9dc..16278968dab6 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -170,6 +170,9 @@ void __init setup_paca(int cpu)
170 170
171void __init early_setup(unsigned long dt_ptr) 171void __init early_setup(unsigned long dt_ptr)
172{ 172{
173 /* Identify CPU type */
174 identify_cpu(0);
175
173 /* Assume we're on cpu 0 for now. Don't write to the paca yet! */ 176 /* Assume we're on cpu 0 for now. Don't write to the paca yet! */
174 setup_paca(0); 177 setup_paca(0);
175 178
@@ -348,6 +351,14 @@ void __init setup_system(void)
348{ 351{
349 DBG(" -> setup_system()\n"); 352 DBG(" -> setup_system()\n");
350 353
354 /* Apply the CPUs-specific and firmware specific fixups to kernel
355 * text (nop out sections not relevant to this CPU or this firmware)
356 */
357 do_feature_fixups(cur_cpu_spec->cpu_features,
358 &__start___ftr_fixup, &__stop___ftr_fixup);
359 do_feature_fixups(powerpc_firmware_features,
360 &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
361
351 /* 362 /*
352 * Unflatten the device-tree passed by prom_init or kexec 363 * Unflatten the device-tree passed by prom_init or kexec
353 */ 364 */
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 5b59bc18dfe7..a1b5e4b16151 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -220,11 +220,8 @@ static void account_process_time(struct pt_regs *regs)
220 */ 220 */
221struct cpu_purr_data { 221struct cpu_purr_data {
222 int initialized; /* thread is running */ 222 int initialized; /* thread is running */
223 u64 tb0; /* timebase at origin time */
224 u64 purr0; /* PURR at origin time */
225 u64 tb; /* last TB value read */ 223 u64 tb; /* last TB value read */
226 u64 purr; /* last PURR value read */ 224 u64 purr; /* last PURR value read */
227 u64 stolen; /* stolen time so far */
228 spinlock_t lock; 225 spinlock_t lock;
229}; 226};
230 227
@@ -234,10 +231,8 @@ static void snapshot_tb_and_purr(void *data)
234{ 231{
235 struct cpu_purr_data *p = &__get_cpu_var(cpu_purr_data); 232 struct cpu_purr_data *p = &__get_cpu_var(cpu_purr_data);
236 233
237 p->tb0 = mftb(); 234 p->tb = mftb();
238 p->purr0 = mfspr(SPRN_PURR); 235 p->purr = mfspr(SPRN_PURR);
239 p->tb = p->tb0;
240 p->purr = 0;
241 wmb(); 236 wmb();
242 p->initialized = 1; 237 p->initialized = 1;
243} 238}
@@ -258,37 +253,24 @@ void snapshot_timebases(void)
258 253
259void calculate_steal_time(void) 254void calculate_steal_time(void)
260{ 255{
261 u64 tb, purr, t0; 256 u64 tb, purr;
262 s64 stolen; 257 s64 stolen;
263 struct cpu_purr_data *p0, *pme, *phim; 258 struct cpu_purr_data *pme;
264 int cpu;
265 259
266 if (!cpu_has_feature(CPU_FTR_PURR)) 260 if (!cpu_has_feature(CPU_FTR_PURR))
267 return; 261 return;
268 cpu = smp_processor_id(); 262 pme = &per_cpu(cpu_purr_data, smp_processor_id());
269 pme = &per_cpu(cpu_purr_data, cpu);
270 if (!pme->initialized) 263 if (!pme->initialized)
271 return; /* this can happen in early boot */ 264 return; /* this can happen in early boot */
272 p0 = &per_cpu(cpu_purr_data, cpu & ~1); 265 spin_lock(&pme->lock);
273 phim = &per_cpu(cpu_purr_data, cpu ^ 1);
274 spin_lock(&p0->lock);
275 tb = mftb(); 266 tb = mftb();
276 purr = mfspr(SPRN_PURR) - pme->purr0; 267 purr = mfspr(SPRN_PURR);
277 if (!phim->initialized || !cpu_online(cpu ^ 1)) { 268 stolen = (tb - pme->tb) - (purr - pme->purr);
278 stolen = (tb - pme->tb) - (purr - pme->purr); 269 if (stolen > 0)
279 } else {
280 t0 = pme->tb0;
281 if (phim->tb0 < t0)
282 t0 = phim->tb0;
283 stolen = phim->tb - t0 - phim->purr - purr - p0->stolen;
284 }
285 if (stolen > 0) {
286 account_steal_time(current, stolen); 270 account_steal_time(current, stolen);
287 p0->stolen += stolen;
288 }
289 pme->tb = tb; 271 pme->tb = tb;
290 pme->purr = purr; 272 pme->purr = purr;
291 spin_unlock(&p0->lock); 273 spin_unlock(&pme->lock);
292} 274}
293 275
294/* 276/*
@@ -297,30 +279,17 @@ void calculate_steal_time(void)
297 */ 279 */
298static void snapshot_purr(void) 280static void snapshot_purr(void)
299{ 281{
300 int cpu; 282 struct cpu_purr_data *pme;
301 u64 purr;
302 struct cpu_purr_data *p0, *pme, *phim;
303 unsigned long flags; 283 unsigned long flags;
304 284
305 if (!cpu_has_feature(CPU_FTR_PURR)) 285 if (!cpu_has_feature(CPU_FTR_PURR))
306 return; 286 return;
307 cpu = smp_processor_id(); 287 pme = &per_cpu(cpu_purr_data, smp_processor_id());
308 pme = &per_cpu(cpu_purr_data, cpu); 288 spin_lock_irqsave(&pme->lock, flags);
309 p0 = &per_cpu(cpu_purr_data, cpu & ~1); 289 pme->tb = mftb();
310 phim = &per_cpu(cpu_purr_data, cpu ^ 1); 290 pme->purr = mfspr(SPRN_PURR);
311 spin_lock_irqsave(&p0->lock, flags);
312 pme->tb = pme->tb0 = mftb();
313 purr = mfspr(SPRN_PURR);
314 if (!phim->initialized) {
315 pme->purr = 0;
316 pme->purr0 = purr;
317 } else {
318 /* set p->purr and p->purr0 for no change in p0->stolen */
319 pme->purr = phim->tb - phim->tb0 - phim->purr - p0->stolen;
320 pme->purr0 = purr - pme->purr;
321 }
322 pme->initialized = 1; 291 pme->initialized = 1;
323 spin_unlock_irqrestore(&p0->lock, flags); 292 spin_unlock_irqrestore(&pme->lock, flags);
324} 293}
325 294
326#endif /* CONFIG_PPC_SPLPAR */ 295#endif /* CONFIG_PPC_SPLPAR */
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 1a7e19cdab39..c913ad5cad29 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -36,6 +36,8 @@
36#include <asm/vdso.h> 36#include <asm/vdso.h>
37#include <asm/vdso_datapage.h> 37#include <asm/vdso_datapage.h>
38 38
39#include "setup.h"
40
39#undef DEBUG 41#undef DEBUG
40 42
41#ifdef DEBUG 43#ifdef DEBUG
@@ -586,6 +588,43 @@ static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32,
586 return 0; 588 return 0;
587} 589}
588 590
591
592static __init int vdso_fixup_features(struct lib32_elfinfo *v32,
593 struct lib64_elfinfo *v64)
594{
595 void *start32;
596 unsigned long size32;
597
598#ifdef CONFIG_PPC64
599 void *start64;
600 unsigned long size64;
601
602 start64 = find_section64(v64->hdr, "__ftr_fixup", &size64);
603 if (start64)
604 do_feature_fixups(cur_cpu_spec->cpu_features,
605 start64, start64 + size64);
606
607 start64 = find_section64(v64->hdr, "__fw_ftr_fixup", &size64);
608 if (start64)
609 do_feature_fixups(powerpc_firmware_features,
610 start64, start64 + size64);
611#endif /* CONFIG_PPC64 */
612
613 start32 = find_section32(v32->hdr, "__ftr_fixup", &size32);
614 if (start32)
615 do_feature_fixups(cur_cpu_spec->cpu_features,
616 start32, start32 + size32);
617
618#ifdef CONFIG_PPC64
619 start32 = find_section32(v32->hdr, "__fw_ftr_fixup", &size32);
620 if (start32)
621 do_feature_fixups(powerpc_firmware_features,
622 start32, start32 + size32);
623#endif /* CONFIG_PPC64 */
624
625 return 0;
626}
627
589static __init int vdso_fixup_alt_funcs(struct lib32_elfinfo *v32, 628static __init int vdso_fixup_alt_funcs(struct lib32_elfinfo *v32,
590 struct lib64_elfinfo *v64) 629 struct lib64_elfinfo *v64)
591{ 630{
@@ -634,6 +673,9 @@ static __init int vdso_setup(void)
634 if (vdso_fixup_datapage(&v32, &v64)) 673 if (vdso_fixup_datapage(&v32, &v64))
635 return -1; 674 return -1;
636 675
676 if (vdso_fixup_features(&v32, &v64))
677 return -1;
678
637 if (vdso_fixup_alt_funcs(&v32, &v64)) 679 if (vdso_fixup_alt_funcs(&v32, &v64))
638 return -1; 680 return -1;
639 681
@@ -714,6 +756,7 @@ void __init vdso_init(void)
714 * Setup the syscall map in the vDOS 756 * Setup the syscall map in the vDOS
715 */ 757 */
716 vdso_setup_syscall_map(); 758 vdso_setup_syscall_map();
759
717 /* 760 /*
718 * Initialize the vDSO images in memory, that is do necessary 761 * Initialize the vDSO images in memory, that is do necessary
719 * fixups of vDSO symbols, locate trampolines, etc... 762 * fixups of vDSO symbols, locate trampolines, etc...
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index 6187af2d54c3..26e138c4ce17 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -32,6 +32,18 @@ SECTIONS
32 PROVIDE (_etext = .); 32 PROVIDE (_etext = .);
33 PROVIDE (etext = .); 33 PROVIDE (etext = .);
34 34
35 . = ALIGN(8);
36 __ftr_fixup : {
37 *(__ftr_fixup)
38 }
39
40#ifdef CONFIG_PPC64
41 . = ALIGN(8);
42 __fw_ftr_fixup : {
43 *(__fw_ftr_fixup)
44 }
45#endif
46
35 /* Other stuff is appended to the text segment: */ 47 /* Other stuff is appended to the text segment: */
36 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 48 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
37 .rodata1 : { *(.rodata1) } 49 .rodata1 : { *(.rodata1) }
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index 56e76ff5498f..40ffd9b6cef7 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -229,8 +229,10 @@ V_FUNCTION_BEGIN(__do_get_xsec)
229 xor r0,r8,r8 /* create dependency */ 229 xor r0,r8,r8 /* create dependency */
230 add r3,r3,r0 230 add r3,r3,r0
231 231
232 /* Get TB & offset it */ 232 /* Get TB & offset it. We use the MFTB macro which will generate
233 mftb r7 233 * workaround code for Cell.
234 */
235 MFTB(r7)
234 ld r9,CFG_TB_ORIG_STAMP(r3) 236 ld r9,CFG_TB_ORIG_STAMP(r3)
235 subf r7,r9,r7 237 subf r7,r9,r7
236 238
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index 4a2b6dc0960c..2d70f35d50b5 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -31,6 +31,16 @@ SECTIONS
31 PROVIDE (_etext = .); 31 PROVIDE (_etext = .);
32 PROVIDE (etext = .); 32 PROVIDE (etext = .);
33 33
34 . = ALIGN(8);
35 __ftr_fixup : {
36 *(__ftr_fixup)
37 }
38
39 . = ALIGN(8);
40 __fw_ftr_fixup : {
41 *(__fw_ftr_fixup)
42 }
43
34 /* Other stuff is appended to the text segment: */ 44 /* Other stuff is appended to the text segment: */
35 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 45 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
36 .rodata1 : { *(.rodata1) } 46 .rodata1 : { *(.rodata1) }
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index cb0e8d46c3e8..e8342d867536 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -108,13 +108,7 @@ SECTIONS
108 108
109 .initcall.init : { 109 .initcall.init : {
110 __initcall_start = .; 110 __initcall_start = .;
111 *(.initcall1.init) 111 INITCALLS
112 *(.initcall2.init)
113 *(.initcall3.init)
114 *(.initcall4.init)
115 *(.initcall5.init)
116 *(.initcall6.init)
117 *(.initcall7.init)
118 __initcall_end = .; 112 __initcall_end = .;
119 } 113 }
120 114
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 506f6b79f893..6a927effcc77 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -76,7 +76,7 @@ static inline int mmcra_must_set_sample(void)
76{ 76{
77 if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p) || 77 if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p) ||
78 __is_processor(PV_970) || __is_processor(PV_970FX) || 78 __is_processor(PV_970) || __is_processor(PV_970FX) ||
79 __is_processor(PV_970MP)) 79 __is_processor(PV_970MP) || __is_processor(PV_970GX))
80 return 1; 80 return 1;
81 81
82 return 0; 82 return 0;
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 0de8e114e6b6..533e2723e184 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -385,7 +385,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
385 udata = (void __user *)buf; 385 udata = (void __user *)buf;
386 386
387 spu_acquire(ctx); 387 spu_acquire(ctx);
388 for (count = 0; count <= len; count += 4, udata++) { 388 for (count = 0; (count + 4) <= len; count += 4, udata++) {
389 int ret; 389 int ret;
390 ret = ctx->ops->mbox_read(ctx, &mbox_data); 390 ret = ctx->ops->mbox_read(ctx, &mbox_data);
391 if (ret == 0) 391 if (ret == 0)
diff --git a/arch/powerpc/platforms/cell/spufs/hw_ops.c b/arch/powerpc/platforms/cell/spufs/hw_ops.c
index efc452e71ab0..d805ffed892d 100644
--- a/arch/powerpc/platforms/cell/spufs/hw_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/hw_ops.c
@@ -147,7 +147,7 @@ static void spu_hw_signal1_write(struct spu_context *ctx, u32 data)
147 147
148static u32 spu_hw_signal2_read(struct spu_context *ctx) 148static u32 spu_hw_signal2_read(struct spu_context *ctx)
149{ 149{
150 return in_be32(&ctx->spu->problem->signal_notify1); 150 return in_be32(&ctx->spu->problem->signal_notify2);
151} 151}
152 152
153static void spu_hw_signal2_write(struct spu_context *ctx, u32 data) 153static void spu_hw_signal2_write(struct spu_context *ctx, u32 data)
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index cae3d13229b9..49b8dabcbc99 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -477,8 +477,10 @@ static void __init chrp_find_8259(void)
477 " address, polling\n"); 477 " address, polling\n");
478 478
479 i8259_init(pic, chrp_int_ack); 479 i8259_init(pic, chrp_int_ack);
480 if (ppc_md.get_irq == NULL) 480 if (ppc_md.get_irq == NULL) {
481 ppc_md.get_irq = i8259_irq; 481 ppc_md.get_irq = i8259_irq;
482 irq_set_default_host(i8259_get_host());
483 }
482 if (chrp_mpic != NULL) { 484 if (chrp_mpic != NULL) {
483 cascade_irq = irq_of_parse_and_map(pic, 0); 485 cascade_irq = irq_of_parse_and_map(pic, 0);
484 if (cascade_irq == NO_IRQ) 486 if (cascade_irq == NO_IRQ)
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index a0ff7ba7d666..6f73469fd3b0 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -694,6 +694,11 @@ void * __init iSeries_early_setup(void)
694{ 694{
695 unsigned long phys_mem_size; 695 unsigned long phys_mem_size;
696 696
697 /* Identify CPU type. This is done again by the common code later
698 * on but calling this function multiple times is fine.
699 */
700 identify_cpu(0);
701
697 powerpc_firmware_features |= FW_FEATURE_ISERIES; 702 powerpc_firmware_features |= FW_FEATURE_ISERIES;
698 powerpc_firmware_features |= FW_FEATURE_LPAR; 703 powerpc_firmware_features |= FW_FEATURE_LPAR;
699 704
diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
index 1174ca128efa..adee28da353f 100644
--- a/arch/powerpc/platforms/powermac/sleep.S
+++ b/arch/powerpc/platforms/powermac/sleep.S
@@ -45,7 +45,8 @@
45 .section .text 45 .section .text
46 .align 5 46 .align 5
47 47
48#if defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ_PMAC) 48#if defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ_PMAC) || \
49 (defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC32))
49 50
50/* This gets called by via-pmu.c late during the sleep process. 51/* This gets called by via-pmu.c late during the sleep process.
51 * The PMU was already send the sleep command and will shut us down 52 * The PMU was already send the sleep command and will shut us down
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index 0450265d73bb..ad87adc975bc 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -224,6 +224,11 @@ static struct irq_host_ops i8259_host_ops = {
224 .xlate = i8259_host_xlate, 224 .xlate = i8259_host_xlate,
225}; 225};
226 226
227struct irq_host *i8259_get_host(void)
228{
229 return i8259_host;
230}
231
227/** 232/**
228 * i8259_init - Initialize the legacy controller 233 * i8259_init - Initialize the legacy controller
229 * @node: device node of the legacy PIC (can be NULL, but then, it will match 234 * @node: device node of the legacy PIC (can be NULL, but then, it will match
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index bc4d4a7f9657..746f78c15375 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -473,9 +473,9 @@ static int ipic_set_irq_type(unsigned int virq, unsigned int flow_type)
473 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK; 473 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
474 if (flow_type & IRQ_TYPE_LEVEL_LOW) { 474 if (flow_type & IRQ_TYPE_LEVEL_LOW) {
475 desc->status |= IRQ_LEVEL; 475 desc->status |= IRQ_LEVEL;
476 set_irq_handler(virq, handle_level_irq); 476 desc->handle_irq = handle_level_irq;
477 } else { 477 } else {
478 set_irq_handler(virq, handle_edge_irq); 478 desc->handle_irq = handle_edge_irq;
479 } 479 }
480 480
481 /* only EXT IRQ senses are programmable on ipic 481 /* only EXT IRQ senses are programmable on ipic
diff --git a/arch/powerpc/sysdev/qe_lib/ucc.c b/arch/powerpc/sysdev/qe_lib/ucc.c
index 916c9e5df57f..ac12a44d516f 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc.c
@@ -207,6 +207,7 @@ int ucc_set_qe_mux_rxtx(int ucc_num, enum qe_clock clock, enum comm_dir mode)
207 case QE_CLK18: source = 8; break; 207 case QE_CLK18: source = 8; break;
208 case QE_CLK7: source = 9; break; 208 case QE_CLK7: source = 9; break;
209 case QE_CLK8: source = 10; break; 209 case QE_CLK8: source = 10; break;
210 case QE_CLK16: source = 11; break;
210 default: source = -1; break; 211 default: source = -1; break;
211 } 212 }
212 break; 213 break;
@@ -222,6 +223,7 @@ int ucc_set_qe_mux_rxtx(int ucc_num, enum qe_clock clock, enum comm_dir mode)
222 case QE_CLK22: source = 8; break; 223 case QE_CLK22: source = 8; break;
223 case QE_CLK7: source = 9; break; 224 case QE_CLK7: source = 9; break;
224 case QE_CLK8: source = 10; break; 225 case QE_CLK8: source = 10; break;
226 case QE_CLK16: source = 11; break;
225 default: source = -1; break; 227 default: source = -1; break;
226 } 228 }
227 break; 229 break;
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
index c2be7348fcbd..75fa3104a43a 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
@@ -163,7 +163,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
163 163
164 /* check if the UCC port number is in range. */ 164 /* check if the UCC port number is in range. */
165 if ((uf_info->ucc_num < 0) || (uf_info->ucc_num > UCC_MAX_NUM - 1)) { 165 if ((uf_info->ucc_num < 0) || (uf_info->ucc_num > UCC_MAX_NUM - 1)) {
166 uccf_err("ucc_fast_init: Illagal UCC number!"); 166 uccf_err("ucc_fast_init: Illegal UCC number!");
167 return -EINVAL; 167 return -EINVAL;
168 } 168 }
169 169
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_slow.c b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
index 1fb88ef7cf06..a49da6b73ecf 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_slow.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
@@ -152,7 +152,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
152 152
153 /* check if the UCC port number is in range. */ 153 /* check if the UCC port number is in range. */
154 if ((us_info->ucc_num < 0) || (us_info->ucc_num > UCC_MAX_NUM - 1)) { 154 if ((us_info->ucc_num < 0) || (us_info->ucc_num > UCC_MAX_NUM - 1)) {
155 uccs_err("ucc_slow_init: Illagal UCC number!"); 155 uccs_err("ucc_slow_init: Illegal UCC number!");
156 return -EINVAL; 156 return -EINVAL;
157 } 157 }
158 158
diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c
index 11de090eb901..97f37ef4bbbf 100644
--- a/arch/powerpc/sysdev/tsi108_dev.c
+++ b/arch/powerpc/sysdev/tsi108_dev.c
@@ -48,7 +48,7 @@ phys_addr_t get_csrbase(void)
48 tsi = of_find_node_by_type(NULL, "tsi-bridge"); 48 tsi = of_find_node_by_type(NULL, "tsi-bridge");
49 if (tsi) { 49 if (tsi) {
50 unsigned int size; 50 unsigned int size;
51 void *prop = get_property(tsi, "reg", &size); 51 const void *prop = get_property(tsi, "reg", &size);
52 tsi108_csr_base = of_translate_address(tsi, prop); 52 tsi108_csr_base = of_translate_address(tsi, prop);
53 of_node_put(tsi); 53 of_node_put(tsi);
54 }; 54 };
@@ -79,7 +79,7 @@ static int __init tsi108_eth_of_init(void)
79 hw_info tsi_eth_data; 79 hw_info tsi_eth_data;
80 unsigned int *id; 80 unsigned int *id;
81 unsigned int *phy_id; 81 unsigned int *phy_id;
82 void *mac_addr; 82 const void *mac_addr;
83 phandle *ph; 83 phandle *ph;
84 84
85 memset(r, 0, sizeof(r)); 85 memset(r, 0, sizeof(r));
diff --git a/arch/ppc/boot/simple/relocate.S b/arch/ppc/boot/simple/relocate.S
index 0c021556d78e..1bbbcd2f2bcb 100644
--- a/arch/ppc/boot/simple/relocate.S
+++ b/arch/ppc/boot/simple/relocate.S
@@ -154,8 +154,8 @@ do_relocate_out:
154 154
155start_ldr: 155start_ldr:
156/* Clear all of BSS and set up stack for C calls */ 156/* Clear all of BSS and set up stack for C calls */
157 lis r3,edata@h 157 lis r3,__bss_start@h
158 ori r3,r3,edata@l 158 ori r3,r3,__bss_start@l
159 lis r4,end@h 159 lis r4,end@h
160 ori r4,r4,end@l 160 ori r4,r4,end@l
161 subi r3,r3,4 161 subi r3,r3,4
@@ -163,7 +163,7 @@ start_ldr:
163 li r0,0 163 li r0,0
16450: stwu r0,4(r3) 16450: stwu r0,4(r3)
165 cmpw cr0,r3,r4 165 cmpw cr0,r3,r4
166 bne 50b 166 blt 50b
16790: mr r9,r1 /* Save old stack pointer (in case it matters) */ 16790: mr r9,r1 /* Save old stack pointer (in case it matters) */
168 lis r1,.stack@h 168 lis r1,.stack@h
169 ori r1,r1,.stack@l 169 ori r1,r1,.stack@l
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 5f6684012ded..d319f9ba2379 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -110,80 +110,6 @@ _GLOBAL(reloc_got2)
110 blr 110 blr
111 111
112/* 112/*
113 * identify_cpu,
114 * called with r3 = data offset and r4 = CPU number
115 * doesn't change r3
116 */
117_GLOBAL(identify_cpu)
118 addis r8,r3,cpu_specs@ha
119 addi r8,r8,cpu_specs@l
120 mfpvr r7
1211:
122 lwz r5,CPU_SPEC_PVR_MASK(r8)
123 and r5,r5,r7
124 lwz r6,CPU_SPEC_PVR_VALUE(r8)
125 cmplw 0,r6,r5
126 beq 1f
127 addi r8,r8,CPU_SPEC_ENTRY_SIZE
128 b 1b
1291:
130 addis r6,r3,cur_cpu_spec@ha
131 addi r6,r6,cur_cpu_spec@l
132 sub r8,r8,r3
133 stw r8,0(r6)
134 blr
135
136/*
137 * do_cpu_ftr_fixups - goes through the list of CPU feature fixups
138 * and writes nop's over sections of code that don't apply for this cpu.
139 * r3 = data offset (not changed)
140 */
141_GLOBAL(do_cpu_ftr_fixups)
142 /* Get CPU 0 features */
143 addis r6,r3,cur_cpu_spec@ha
144 addi r6,r6,cur_cpu_spec@l
145 lwz r4,0(r6)
146 add r4,r4,r3
147 lwz r4,CPU_SPEC_FEATURES(r4)
148
149 /* Get the fixup table */
150 addis r6,r3,__start___ftr_fixup@ha
151 addi r6,r6,__start___ftr_fixup@l
152 addis r7,r3,__stop___ftr_fixup@ha
153 addi r7,r7,__stop___ftr_fixup@l
154
155 /* Do the fixup */
1561: cmplw 0,r6,r7
157 bgelr
158 addi r6,r6,16
159 lwz r8,-16(r6) /* mask */
160 and r8,r8,r4
161 lwz r9,-12(r6) /* value */
162 cmplw 0,r8,r9
163 beq 1b
164 lwz r8,-8(r6) /* section begin */
165 lwz r9,-4(r6) /* section end */
166 subf. r9,r8,r9
167 beq 1b
168 /* write nops over the section of code */
169 /* todo: if large section, add a branch at the start of it */
170 srwi r9,r9,2
171 mtctr r9
172 add r8,r8,r3
173 lis r0,0x60000000@h /* nop */
1743: stw r0,0(r8)
175 andi. r10,r4,CPU_FTR_SPLIT_ID_CACHE@l
176 beq 2f
177 dcbst 0,r8 /* suboptimal, but simpler */
178 sync
179 icbi 0,r8
1802: addi r8,r8,4
181 bdnz 3b
182 sync /* additional sync needed on g4 */
183 isync
184 b 1b
185
186/*
187 * call_setup_cpu - call the setup_cpu function for this cpu 113 * call_setup_cpu - call the setup_cpu function for this cpu
188 * r3 = data offset, r24 = cpu number 114 * r3 = data offset, r24 = cpu number
189 * 115 *
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index 75fe13815be2..27faeca2c7a2 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -38,6 +38,7 @@
38#include <asm/nvram.h> 38#include <asm/nvram.h>
39#include <asm/xmon.h> 39#include <asm/xmon.h>
40#include <asm/ocp.h> 40#include <asm/ocp.h>
41#include <asm/prom.h>
41 42
42#define USES_PPC_SYS (defined(CONFIG_85xx) || defined(CONFIG_83xx) || \ 43#define USES_PPC_SYS (defined(CONFIG_85xx) || defined(CONFIG_83xx) || \
43 defined(CONFIG_MPC10X_BRIDGE) || defined(CONFIG_8260) || \ 44 defined(CONFIG_MPC10X_BRIDGE) || defined(CONFIG_8260) || \
@@ -53,8 +54,6 @@
53 54
54extern void platform_init(unsigned long r3, unsigned long r4, 55extern void platform_init(unsigned long r3, unsigned long r4,
55 unsigned long r5, unsigned long r6, unsigned long r7); 56 unsigned long r5, unsigned long r6, unsigned long r7);
56extern void identify_cpu(unsigned long offset, unsigned long cpu);
57extern void do_cpu_ftr_fixups(unsigned long offset);
58extern void reloc_got2(unsigned long offset); 57extern void reloc_got2(unsigned long offset);
59 58
60extern void ppc6xx_idle(void); 59extern void ppc6xx_idle(void);
@@ -301,6 +300,7 @@ early_init(int r3, int r4, int r5)
301{ 300{
302 unsigned long phys; 301 unsigned long phys;
303 unsigned long offset = reloc_offset(); 302 unsigned long offset = reloc_offset();
303 struct cpu_spec *spec;
304 304
305 /* Default */ 305 /* Default */
306 phys = offset + KERNELBASE; 306 phys = offset + KERNELBASE;
@@ -313,8 +313,10 @@ early_init(int r3, int r4, int r5)
313 * Identify the CPU type and fix up code sections 313 * Identify the CPU type and fix up code sections
314 * that depend on which cpu we have. 314 * that depend on which cpu we have.
315 */ 315 */
316 identify_cpu(offset, 0); 316 spec = identify_cpu(offset);
317 do_cpu_ftr_fixups(offset); 317 do_feature_fixups(spec->cpu_features,
318 PTRRELOC(&__start___ftr_fixup),
319 PTRRELOC(&__stop___ftr_fixup));
318 320
319 return phys; 321 return phys;
320} 322}
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S
index 095fd3323323..16e8661e1fec 100644
--- a/arch/ppc/kernel/vmlinux.lds.S
+++ b/arch/ppc/kernel/vmlinux.lds.S
@@ -115,13 +115,7 @@ SECTIONS
115 __setup_end = .; 115 __setup_end = .;
116 __initcall_start = .; 116 __initcall_start = .;
117 .initcall.init : { 117 .initcall.init : {
118 *(.initcall1.init) 118 INITCALLS
119 *(.initcall2.init)
120 *(.initcall3.init)
121 *(.initcall4.init)
122 *(.initcall5.init)
123 *(.initcall6.init)
124 *(.initcall7.init)
125 } 119 }
126 __initcall_end = .; 120 __initcall_end = .;
127 121
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index 45c9fa7d7545..af1e8fc7d985 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -310,6 +310,7 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
310 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) { 310 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) {
311 return -EFAULT; 311 return -EFAULT;
312 } 312 }
313 interval = 0;
313 sscanf(buf, "%i", &interval); 314 sscanf(buf, "%i", &interval);
314 if (interval <= 0) { 315 if (interval <= 0) {
315 P_ERROR("Timer CPU interval has to be > 0!\n"); 316 P_ERROR("Timer CPU interval has to be > 0!\n");
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 2001767e1dc7..5b33f823863a 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -757,7 +757,9 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
757 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp))) 757 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
758 error = -EFAULT; 758 error = -EFAULT;
759 } 759 }
760 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); 760 if (copy_to_user(args->__unused, tmp.__unused,
761 sizeof(tmp.__unused)))
762 error = -EFAULT;
761 } 763 }
762 return error; 764 return error;
763} 765}
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index d49b876a83bf..861888ab8c13 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -169,12 +169,12 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
169 compat_old_sigset_t mask; 169 compat_old_sigset_t mask;
170 if (!access_ok(VERIFY_READ, act, sizeof(*act)) || 170 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
171 __get_user(sa_handler, &act->sa_handler) || 171 __get_user(sa_handler, &act->sa_handler) ||
172 __get_user(sa_restorer, &act->sa_restorer)) 172 __get_user(sa_restorer, &act->sa_restorer) ||
173 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
174 __get_user(mask, &act->sa_mask))
173 return -EFAULT; 175 return -EFAULT;
174 new_ka.sa.sa_handler = (__sighandler_t) sa_handler; 176 new_ka.sa.sa_handler = (__sighandler_t) sa_handler;
175 new_ka.sa.sa_restorer = (void (*)(void)) sa_restorer; 177 new_ka.sa.sa_restorer = (void (*)(void)) sa_restorer;
176 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
177 __get_user(mask, &act->sa_mask);
178 siginitset(&new_ka.sa.sa_mask, mask); 178 siginitset(&new_ka.sa.sa_mask, mask);
179 } 179 }
180 180
@@ -185,10 +185,10 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
185 sa_restorer = (unsigned long) old_ka.sa.sa_restorer; 185 sa_restorer = (unsigned long) old_ka.sa.sa_restorer;
186 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || 186 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
187 __put_user(sa_handler, &oact->sa_handler) || 187 __put_user(sa_handler, &oact->sa_handler) ||
188 __put_user(sa_restorer, &oact->sa_restorer)) 188 __put_user(sa_restorer, &oact->sa_restorer) ||
189 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
190 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
189 return -EFAULT; 191 return -EFAULT;
190 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
191 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
192 } 192 }
193 193
194 return ret; 194 return ret;
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index cb0efae6802f..71e54ef0931e 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1664,4 +1664,4 @@ sys_getcpu_wrapper:
1664 llgtr %r2,%r2 # unsigned * 1664 llgtr %r2,%r2 # unsigned *
1665 llgtr %r3,%r3 # unsigned * 1665 llgtr %r3,%r3 # unsigned *
1666 llgtr %r4,%r4 # struct getcpu_cache * 1666 llgtr %r4,%r4 # struct getcpu_cache *
1667 jg sys_tee 1667 jg sys_getcpu
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 4392a77cbae8..4c8a7954ef48 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -80,10 +80,10 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
80 old_sigset_t mask; 80 old_sigset_t mask;
81 if (!access_ok(VERIFY_READ, act, sizeof(*act)) || 81 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
82 __get_user(new_ka.sa.sa_handler, &act->sa_handler) || 82 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
83 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) 83 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
84 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
85 __get_user(mask, &act->sa_mask))
84 return -EFAULT; 86 return -EFAULT;
85 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
86 __get_user(mask, &act->sa_mask);
87 siginitset(&new_ka.sa.sa_mask, mask); 87 siginitset(&new_ka.sa.sa_mask, mask);
88 } 88 }
89 89
@@ -92,10 +92,10 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
92 if (!ret && oact) { 92 if (!ret && oact) {
93 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || 93 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
94 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || 94 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
95 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) 95 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
96 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
97 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
96 return -EFAULT; 98 return -EFAULT;
97 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
98 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
99 } 99 }
100 100
101 return ret; 101 return ret;
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 66375a5e3d12..92ecffbc8d82 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -462,7 +462,8 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
462 local_irq_enable(); 462 local_irq_enable();
463 463
464 if (regs->psw.mask & PSW_MASK_PSTATE) { 464 if (regs->psw.mask & PSW_MASK_PSTATE) {
465 get_user(*((__u16 *) opcode), (__u16 __user *) location); 465 if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
466 return;
466 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { 467 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
467 if (current->ptrace & PT_PTRACED) 468 if (current->ptrace & PT_PTRACED)
468 force_sig(SIGTRAP, current); 469 force_sig(SIGTRAP, current);
@@ -470,20 +471,25 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
470 signal = SIGILL; 471 signal = SIGILL;
471#ifdef CONFIG_MATHEMU 472#ifdef CONFIG_MATHEMU
472 } else if (opcode[0] == 0xb3) { 473 } else if (opcode[0] == 0xb3) {
473 get_user(*((__u16 *) (opcode+2)), location+1); 474 if (get_user(*((__u16 *) (opcode+2)), location+1))
475 return;
474 signal = math_emu_b3(opcode, regs); 476 signal = math_emu_b3(opcode, regs);
475 } else if (opcode[0] == 0xed) { 477 } else if (opcode[0] == 0xed) {
476 get_user(*((__u32 *) (opcode+2)), 478 if (get_user(*((__u32 *) (opcode+2)),
477 (__u32 __user *)(location+1)); 479 (__u32 __user *)(location+1)))
480 return;
478 signal = math_emu_ed(opcode, regs); 481 signal = math_emu_ed(opcode, regs);
479 } else if (*((__u16 *) opcode) == 0xb299) { 482 } else if (*((__u16 *) opcode) == 0xb299) {
480 get_user(*((__u16 *) (opcode+2)), location+1); 483 if (get_user(*((__u16 *) (opcode+2)), location+1))
484 return;
481 signal = math_emu_srnm(opcode, regs); 485 signal = math_emu_srnm(opcode, regs);
482 } else if (*((__u16 *) opcode) == 0xb29c) { 486 } else if (*((__u16 *) opcode) == 0xb29c) {
483 get_user(*((__u16 *) (opcode+2)), location+1); 487 if (get_user(*((__u16 *) (opcode+2)), location+1))
488 return;
484 signal = math_emu_stfpc(opcode, regs); 489 signal = math_emu_stfpc(opcode, regs);
485 } else if (*((__u16 *) opcode) == 0xb29d) { 490 } else if (*((__u16 *) opcode) == 0xb29d) {
486 get_user(*((__u16 *) (opcode+2)), location+1); 491 if (get_user(*((__u16 *) (opcode+2)), location+1))
492 return;
487 signal = math_emu_lfpc(opcode, regs); 493 signal = math_emu_lfpc(opcode, regs);
488#endif 494#endif
489 } else 495 } else
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index af9e69a03011..fe0f2e97ba7b 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -83,13 +83,7 @@ SECTIONS
83 __setup_end = .; 83 __setup_end = .;
84 __initcall_start = .; 84 __initcall_start = .;
85 .initcall.init : { 85 .initcall.init : {
86 *(.initcall1.init) 86 INITCALLS
87 *(.initcall2.init)
88 *(.initcall3.init)
89 *(.initcall4.init)
90 *(.initcall5.init)
91 *(.initcall6.init)
92 *(.initcall7.init)
93 } 87 }
94 __initcall_end = .; 88 __initcall_end = .;
95 __con_initcall_start = .; 89 __con_initcall_start = .;
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index 5eb930918186..77b4026d5688 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -76,13 +76,7 @@ SECTIONS
76 __setup_end = .; 76 __setup_end = .;
77 __initcall_start = .; 77 __initcall_start = .;
78 .initcall.init : { 78 .initcall.init : {
79 *(.initcall1.init) 79 INITCALLS
80 *(.initcall2.init)
81 *(.initcall3.init)
82 *(.initcall4.init)
83 *(.initcall5.init)
84 *(.initcall6.init)
85 *(.initcall7.init)
86 } 80 }
87 __initcall_end = .; 81 __initcall_end = .;
88 __con_initcall_start = .; 82 __con_initcall_start = .;
diff --git a/arch/sh64/kernel/vmlinux.lds.S b/arch/sh64/kernel/vmlinux.lds.S
index a8fcc3a71585..95c4d753e357 100644
--- a/arch/sh64/kernel/vmlinux.lds.S
+++ b/arch/sh64/kernel/vmlinux.lds.S
@@ -108,13 +108,7 @@ SECTIONS
108 __setup_end = .; 108 __setup_end = .;
109 __initcall_start = .; 109 __initcall_start = .;
110 .initcall.init : C_PHYS(.initcall.init) { 110 .initcall.init : C_PHYS(.initcall.init) {
111 *(.initcall1.init) 111 INITCALLS
112 *(.initcall2.init)
113 *(.initcall3.init)
114 *(.initcall4.init)
115 *(.initcall5.init)
116 *(.initcall6.init)
117 *(.initcall7.init)
118 } 112 }
119 __initcall_end = .; 113 __initcall_end = .;
120 __con_initcall_start = .; 114 __con_initcall_start = .;
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index 75ac24d229b1..ba58c3a061fd 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -237,12 +237,12 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d
237 dev->ofdev.node = dp; 237 dev->ofdev.node = dp;
238 dev->ofdev.dev.parent = &dev->bus->ofdev.dev; 238 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
239 dev->ofdev.dev.bus = &ebus_bus_type; 239 dev->ofdev.dev.bus = &ebus_bus_type;
240 strcpy(dev->ofdev.dev.bus_id, dp->path_component_name); 240 sprintf(dev->ofdev.dev.bus_id, "ebus[%08x]", dp->node);
241 241
242 /* Register with core */ 242 /* Register with core */
243 if (of_device_register(&dev->ofdev) != 0) 243 if (of_device_register(&dev->ofdev) != 0)
244 printk(KERN_DEBUG "ebus: device registration error for %s!\n", 244 printk(KERN_DEBUG "ebus: device registration error for %s!\n",
245 dev->ofdev.dev.bus_id); 245 dp->path_component_name);
246 246
247 if ((dp = dp->child) != NULL) { 247 if ((dp = dp->child) != NULL) {
248 dev->children = (struct linux_ebus_child *) 248 dev->children = (struct linux_ebus_child *)
@@ -332,12 +332,12 @@ void __init ebus_init(void)
332 ebus->ofdev.node = dp; 332 ebus->ofdev.node = dp;
333 ebus->ofdev.dev.parent = &pdev->dev; 333 ebus->ofdev.dev.parent = &pdev->dev;
334 ebus->ofdev.dev.bus = &ebus_bus_type; 334 ebus->ofdev.dev.bus = &ebus_bus_type;
335 strcpy(ebus->ofdev.dev.bus_id, dp->path_component_name); 335 sprintf(ebus->ofdev.dev.bus_id, "ebus%d", num_ebus);
336 336
337 /* Register with core */ 337 /* Register with core */
338 if (of_device_register(&ebus->ofdev) != 0) 338 if (of_device_register(&ebus->ofdev) != 0)
339 printk(KERN_DEBUG "ebus: device registration error for %s!\n", 339 printk(KERN_DEBUG "ebus: device registration error for %s!\n",
340 ebus->ofdev.dev.bus_id); 340 dp->path_component_name);
341 341
342 342
343 nd = dp->child; 343 nd = dp->child;
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index 74bef2a2d37f..46200c43ffb1 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -651,7 +651,7 @@ build_resources:
651 if (!parent) 651 if (!parent)
652 strcpy(op->dev.bus_id, "root"); 652 strcpy(op->dev.bus_id, "root");
653 else 653 else
654 strcpy(op->dev.bus_id, dp->path_component_name); 654 sprintf(op->dev.bus_id, "%08x", dp->node);
655 655
656 if (of_device_register(op)) { 656 if (of_device_register(op)) {
657 printk("%s: Could not register of device.\n", 657 printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 1dd78c84888a..5cc5ff7f8824 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -49,13 +49,7 @@ SECTIONS
49 __setup_end = .; 49 __setup_end = .;
50 __initcall_start = .; 50 __initcall_start = .;
51 .initcall.init : { 51 .initcall.init : {
52 *(.initcall1.init) 52 INITCALLS
53 *(.initcall2.init)
54 *(.initcall3.init)
55 *(.initcall4.init)
56 *(.initcall5.init)
57 *(.initcall6.init)
58 *(.initcall7.init)
59 } 53 }
60 __initcall_end = .; 54 __initcall_end = .;
61 __con_initcall_start = .; 55 __con_initcall_start = .;
diff --git a/arch/sparc64/kernel/central.c b/arch/sparc64/kernel/central.c
index b66336db00ee..e724c54af029 100644
--- a/arch/sparc64/kernel/central.c
+++ b/arch/sparc64/kernel/central.c
@@ -126,6 +126,10 @@ static void probe_other_fhcs(void)
126 int board; 126 int board;
127 u32 tmp; 127 u32 tmp;
128 128
129 if (dp->parent &&
130 dp->parent->parent != NULL)
131 continue;
132
129 fhc = (struct linux_fhc *) 133 fhc = (struct linux_fhc *)
130 central_alloc_bootmem(sizeof(struct linux_fhc)); 134 central_alloc_bootmem(sizeof(struct linux_fhc));
131 if (fhc == NULL) 135 if (fhc == NULL)
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c
index 2df25c2b4071..35bf895fdeee 100644
--- a/arch/sparc64/kernel/ebus.c
+++ b/arch/sparc64/kernel/ebus.c
@@ -389,12 +389,12 @@ static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_de
389 dev->ofdev.node = dp; 389 dev->ofdev.node = dp;
390 dev->ofdev.dev.parent = &dev->bus->ofdev.dev; 390 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
391 dev->ofdev.dev.bus = &ebus_bus_type; 391 dev->ofdev.dev.bus = &ebus_bus_type;
392 strcpy(dev->ofdev.dev.bus_id, dp->path_component_name); 392 sprintf(dev->ofdev.dev.bus_id, "ebus[%08x]", dp->node);
393 393
394 /* Register with core */ 394 /* Register with core */
395 if (of_device_register(&dev->ofdev) != 0) 395 if (of_device_register(&dev->ofdev) != 0)
396 printk(KERN_DEBUG "ebus: device registration error for %s!\n", 396 printk(KERN_DEBUG "ebus: device registration error for %s!\n",
397 dev->ofdev.dev.bus_id); 397 dp->path_component_name);
398 398
399 dp = dp->child; 399 dp = dp->child;
400 if (dp) { 400 if (dp) {
@@ -494,12 +494,12 @@ void __init ebus_init(void)
494 ebus->ofdev.node = dp; 494 ebus->ofdev.node = dp;
495 ebus->ofdev.dev.parent = &pdev->dev; 495 ebus->ofdev.dev.parent = &pdev->dev;
496 ebus->ofdev.dev.bus = &ebus_bus_type; 496 ebus->ofdev.dev.bus = &ebus_bus_type;
497 strcpy(ebus->ofdev.dev.bus_id, dp->path_component_name); 497 sprintf(ebus->ofdev.dev.bus_id, "ebus%d", num_ebus);
498 498
499 /* Register with core */ 499 /* Register with core */
500 if (of_device_register(&ebus->ofdev) != 0) 500 if (of_device_register(&ebus->ofdev) != 0)
501 printk(KERN_DEBUG "ebus: device registration error for %s!\n", 501 printk(KERN_DEBUG "ebus: device registration error for %s!\n",
502 ebus->ofdev.dev.bus_id); 502 dp->path_component_name);
503 503
504 504
505 child = dp->child; 505 child = dp->child;
diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c
index 0f3aec72ef5f..f028e68b23f2 100644
--- a/arch/sparc64/kernel/isa.c
+++ b/arch/sparc64/kernel/isa.c
@@ -115,12 +115,12 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
115 isa_dev->ofdev.node = dp; 115 isa_dev->ofdev.node = dp;
116 isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev; 116 isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev;
117 isa_dev->ofdev.dev.bus = &isa_bus_type; 117 isa_dev->ofdev.dev.bus = &isa_bus_type;
118 strcpy(isa_dev->ofdev.dev.bus_id, dp->path_component_name); 118 sprintf(isa_dev->ofdev.dev.bus_id, "isa[%08x]", dp->node);
119 119
120 /* Register with core */ 120 /* Register with core */
121 if (of_device_register(&isa_dev->ofdev) != 0) { 121 if (of_device_register(&isa_dev->ofdev) != 0) {
122 printk(KERN_DEBUG "isa: device registration error for %s!\n", 122 printk(KERN_DEBUG "isa: device registration error for %s!\n",
123 isa_dev->ofdev.dev.bus_id); 123 dp->path_component_name);
124 kfree(isa_dev); 124 kfree(isa_dev);
125 goto next_sibling; 125 goto next_sibling;
126 } 126 }
@@ -191,12 +191,12 @@ void __init isa_init(void)
191 isa_br->ofdev.node = dp; 191 isa_br->ofdev.node = dp;
192 isa_br->ofdev.dev.parent = &pdev->dev; 192 isa_br->ofdev.dev.parent = &pdev->dev;
193 isa_br->ofdev.dev.bus = &isa_bus_type; 193 isa_br->ofdev.dev.bus = &isa_bus_type;
194 strcpy(isa_br->ofdev.dev.bus_id, dp->path_component_name); 194 sprintf(isa_br->ofdev.dev.bus_id, "isa%d", index);
195 195
196 /* Register with core */ 196 /* Register with core */
197 if (of_device_register(&isa_br->ofdev) != 0) { 197 if (of_device_register(&isa_br->ofdev) != 0) {
198 printk(KERN_DEBUG "isa: device registration error for %s!\n", 198 printk(KERN_DEBUG "isa: device registration error for %s!\n",
199 isa_br->ofdev.dev.bus_id); 199 dp->path_component_name);
200 kfree(isa_br); 200 kfree(isa_br);
201 return; 201 return;
202 } 202 }
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index d3dfb2a36d47..8cc14fc6b6f1 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -402,16 +402,22 @@ static void of_bus_sbus_count_cells(struct device_node *child,
402 *sizec = 1; 402 *sizec = 1;
403} 403}
404 404
405static int of_bus_sbus_map(u32 *addr, const u32 *range, int na, int ns, int pna) 405/*
406{ 406 * FHC/Central bus specific translator.
407 return of_bus_default_map(addr, range, na, ns, pna); 407 *
408} 408 * This is just needed to hard-code the address and size cell
409 409 * counts. 'fhc' and 'central' nodes lack the #address-cells and
410static unsigned int of_bus_sbus_get_flags(u32 *addr) 410 * #size-cells properties, and if you walk to the root on such
411 * Enterprise boxes all you'll get is a #size-cells of 2 which is
412 * not what we want to use.
413 */
414static int of_bus_fhc_match(struct device_node *np)
411{ 415{
412 return IORESOURCE_MEM; 416 return !strcmp(np->name, "fhc") ||
417 !strcmp(np->name, "central");
413} 418}
414 419
420#define of_bus_fhc_count_cells of_bus_sbus_count_cells
415 421
416/* 422/*
417 * Array of bus specific translators 423 * Array of bus specific translators
@@ -433,8 +439,17 @@ static struct of_bus of_busses[] = {
433 .addr_prop_name = "reg", 439 .addr_prop_name = "reg",
434 .match = of_bus_sbus_match, 440 .match = of_bus_sbus_match,
435 .count_cells = of_bus_sbus_count_cells, 441 .count_cells = of_bus_sbus_count_cells,
436 .map = of_bus_sbus_map, 442 .map = of_bus_default_map,
437 .get_flags = of_bus_sbus_get_flags, 443 .get_flags = of_bus_default_get_flags,
444 },
445 /* FHC */
446 {
447 .name = "fhc",
448 .addr_prop_name = "reg",
449 .match = of_bus_fhc_match,
450 .count_cells = of_bus_fhc_count_cells,
451 .map = of_bus_default_map,
452 .get_flags = of_bus_default_get_flags,
438 }, 453 },
439 /* Default */ 454 /* Default */
440 { 455 {
@@ -846,7 +861,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
846 if (!parent) 861 if (!parent)
847 strcpy(op->dev.bus_id, "root"); 862 strcpy(op->dev.bus_id, "root");
848 else 863 else
849 sprintf(op->dev.bus_id, "%s@%08x", dp->name, dp->node); 864 sprintf(op->dev.bus_id, "%08x", dp->node);
850 865
851 if (of_device_register(op)) { 866 if (of_device_register(op)) {
852 printk("%s: Could not register of device.\n", 867 printk("%s: Could not register of device.\n",
diff --git a/arch/sparc64/kernel/pci_iommu.c b/arch/sparc64/kernel/pci_iommu.c
index 82e5455134c6..2e7f1427088a 100644
--- a/arch/sparc64/kernel/pci_iommu.c
+++ b/arch/sparc64/kernel/pci_iommu.c
@@ -281,7 +281,7 @@ static void pci_4u_free_consistent(struct pci_dev *pdev, size_t size, void *cpu,
281 281
282 spin_lock_irqsave(&iommu->lock, flags); 282 spin_lock_irqsave(&iommu->lock, flags);
283 283
284 free_npages(iommu, dvma, npages); 284 free_npages(iommu, dvma - iommu->page_table_map_base, npages);
285 285
286 spin_unlock_irqrestore(&iommu->lock, flags); 286 spin_unlock_irqrestore(&iommu->lock, flags);
287 287
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index e21cd6afa709..c60efb3cb22e 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -1079,23 +1079,22 @@ static void sun4v_vdev_irq_trans_init(struct device_node *dp)
1079 1079
1080static void irq_trans_init(struct device_node *dp) 1080static void irq_trans_init(struct device_node *dp)
1081{ 1081{
1082 const char *model;
1083#ifdef CONFIG_PCI 1082#ifdef CONFIG_PCI
1083 const char *model;
1084 int i; 1084 int i;
1085#endif 1085#endif
1086 1086
1087#ifdef CONFIG_PCI
1087 model = of_get_property(dp, "model", NULL); 1088 model = of_get_property(dp, "model", NULL);
1088 if (!model) 1089 if (!model)
1089 model = of_get_property(dp, "compatible", NULL); 1090 model = of_get_property(dp, "compatible", NULL);
1090 if (!model) 1091 if (model) {
1091 return; 1092 for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) {
1092 1093 struct irq_trans *t = &pci_irq_trans_table[i];
1093#ifdef CONFIG_PCI
1094 for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) {
1095 struct irq_trans *t = &pci_irq_trans_table[i];
1096 1094
1097 if (!strcmp(model, t->name)) 1095 if (!strcmp(model, t->name))
1098 return t->init(dp); 1096 return t->init(dp);
1097 }
1099 } 1098 }
1100#endif 1099#endif
1101#ifdef CONFIG_SBUS 1100#ifdef CONFIG_SBUS
@@ -1103,8 +1102,9 @@ static void irq_trans_init(struct device_node *dp)
1103 !strcmp(dp->name, "sbi")) 1102 !strcmp(dp->name, "sbi"))
1104 return sbus_irq_trans_init(dp); 1103 return sbus_irq_trans_init(dp);
1105#endif 1104#endif
1106 if (!strcmp(dp->name, "central")) 1105 if (!strcmp(dp->name, "fhc") &&
1107 return central_irq_trans_init(dp->child); 1106 !strcmp(dp->parent->name, "central"))
1107 return central_irq_trans_init(dp);
1108 if (!strcmp(dp->name, "virtual-devices")) 1108 if (!strcmp(dp->name, "virtual-devices"))
1109 return sun4v_vdev_irq_trans_init(dp); 1109 return sun4v_vdev_irq_trans_init(dp);
1110} 1110}
@@ -1516,7 +1516,7 @@ static char * __init get_one_property(phandle node, const char *name)
1516 return buf; 1516 return buf;
1517} 1517}
1518 1518
1519static struct device_node * __init create_node(phandle node) 1519static struct device_node * __init create_node(phandle node, struct device_node *parent)
1520{ 1520{
1521 struct device_node *dp; 1521 struct device_node *dp;
1522 1522
@@ -1525,6 +1525,7 @@ static struct device_node * __init create_node(phandle node)
1525 1525
1526 dp = prom_early_alloc(sizeof(*dp)); 1526 dp = prom_early_alloc(sizeof(*dp));
1527 dp->unique_id = unique_id++; 1527 dp->unique_id = unique_id++;
1528 dp->parent = parent;
1528 1529
1529 kref_init(&dp->kref); 1530 kref_init(&dp->kref);
1530 1531
@@ -1543,12 +1544,11 @@ static struct device_node * __init build_tree(struct device_node *parent, phandl
1543{ 1544{
1544 struct device_node *dp; 1545 struct device_node *dp;
1545 1546
1546 dp = create_node(node); 1547 dp = create_node(node, parent);
1547 if (dp) { 1548 if (dp) {
1548 *(*nextp) = dp; 1549 *(*nextp) = dp;
1549 *nextp = &dp->allnext; 1550 *nextp = &dp->allnext;
1550 1551
1551 dp->parent = parent;
1552 dp->path_component_name = build_path_component(dp); 1552 dp->path_component_name = build_path_component(dp);
1553 dp->full_name = build_full_name(dp); 1553 dp->full_name = build_full_name(dp);
1554 1554
@@ -1564,7 +1564,7 @@ void __init prom_build_devicetree(void)
1564{ 1564{
1565 struct device_node **nextp; 1565 struct device_node **nextp;
1566 1566
1567 allnodes = create_node(prom_root_node); 1567 allnodes = create_node(prom_root_node, NULL);
1568 allnodes->path_component_name = ""; 1568 allnodes->path_component_name = "";
1569 allnodes->full_name = "/"; 1569 allnodes->full_name = "/";
1570 1570
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index b097379a49a8..bd9de8c2a2aa 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -57,13 +57,7 @@ SECTIONS
57 __setup_end = .; 57 __setup_end = .;
58 __initcall_start = .; 58 __initcall_start = .;
59 .initcall.init : { 59 .initcall.init : {
60 *(.initcall1.init) 60 INITCALLS
61 *(.initcall2.init)
62 *(.initcall3.init)
63 *(.initcall4.init)
64 *(.initcall5.init)
65 *(.initcall6.init)
66 *(.initcall7.init)
67 } 61 }
68 __initcall_end = .; 62 __initcall_end = .;
69 __con_initcall_start = .; 63 __con_initcall_start = .;
diff --git a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
index 63399219cd9f..88d087f527c9 100644
--- a/arch/v850/kernel/vmlinux.lds.S
+++ b/arch/v850/kernel/vmlinux.lds.S
@@ -140,13 +140,7 @@
140 ___setup_end = . ; \ 140 ___setup_end = . ; \
141 ___initcall_start = . ; \ 141 ___initcall_start = . ; \
142 *(.initcall.init) \ 142 *(.initcall.init) \
143 *(.initcall1.init) \ 143 INITCALLS \
144 *(.initcall2.init) \
145 *(.initcall3.init) \
146 *(.initcall4.init) \
147 *(.initcall5.init) \
148 *(.initcall6.init) \
149 *(.initcall7.init) \
150 . = ALIGN (4) ; \ 144 . = ALIGN (4) ; \
151 ___initcall_end = . ; \ 145 ___initcall_end = . ; \
152 ___con_initcall_start = .; \ 146 ___con_initcall_start = .; \
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index b000017e4b5d..fe429e5d6b29 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -63,7 +63,7 @@ int timer_over_8254 __initdata = 1;
63static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; 63static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
64 64
65static DEFINE_SPINLOCK(ioapic_lock); 65static DEFINE_SPINLOCK(ioapic_lock);
66static DEFINE_SPINLOCK(vector_lock); 66DEFINE_SPINLOCK(vector_lock);
67 67
68/* 68/*
69 * # of IRQ routing registers 69 * # of IRQ routing registers
@@ -612,15 +612,15 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
612 * Also, we've got to be careful not to trash gate 612 * Also, we've got to be careful not to trash gate
613 * 0x80, because int 0x80 is hm, kind of importantish. ;) 613 * 0x80, because int 0x80 is hm, kind of importantish. ;)
614 */ 614 */
615 static struct { 615 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
616 int vector;
617 int offset;
618 } pos[NR_CPUS] = { [ 0 ... NR_CPUS - 1] = {FIRST_DEVICE_VECTOR, 0} };
619 int old_vector = -1; 616 int old_vector = -1;
620 int cpu; 617 int cpu;
621 618
622 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); 619 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
623 620
621 /* Only try and allocate irqs on cpus that are present */
622 cpus_and(mask, mask, cpu_online_map);
623
624 if (irq_vector[irq] > 0) 624 if (irq_vector[irq] > 0)
625 old_vector = irq_vector[irq]; 625 old_vector = irq_vector[irq];
626 if (old_vector > 0) { 626 if (old_vector > 0) {
@@ -630,15 +630,15 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
630 } 630 }
631 631
632 for_each_cpu_mask(cpu, mask) { 632 for_each_cpu_mask(cpu, mask) {
633 cpumask_t domain; 633 cpumask_t domain, new_mask;
634 int first, new_cpu; 634 int new_cpu;
635 int vector, offset; 635 int vector, offset;
636 636
637 domain = vector_allocation_domain(cpu); 637 domain = vector_allocation_domain(cpu);
638 first = first_cpu(domain); 638 cpus_and(new_mask, domain, cpu_online_map);
639 639
640 vector = pos[first].vector; 640 vector = current_vector;
641 offset = pos[first].offset; 641 offset = current_offset;
642next: 642next:
643 vector += 8; 643 vector += 8;
644 if (vector >= FIRST_SYSTEM_VECTOR) { 644 if (vector >= FIRST_SYSTEM_VECTOR) {
@@ -646,24 +646,24 @@ next:
646 offset = (offset + 1) % 8; 646 offset = (offset + 1) % 8;
647 vector = FIRST_DEVICE_VECTOR + offset; 647 vector = FIRST_DEVICE_VECTOR + offset;
648 } 648 }
649 if (unlikely(pos[first].vector == vector)) 649 if (unlikely(current_vector == vector))
650 continue; 650 continue;
651 if (vector == IA32_SYSCALL_VECTOR) 651 if (vector == IA32_SYSCALL_VECTOR)
652 goto next; 652 goto next;
653 for_each_cpu_mask(new_cpu, domain) 653 for_each_cpu_mask(new_cpu, new_mask)
654 if (per_cpu(vector_irq, new_cpu)[vector] != -1) 654 if (per_cpu(vector_irq, new_cpu)[vector] != -1)
655 goto next; 655 goto next;
656 /* Found one! */ 656 /* Found one! */
657 for_each_cpu_mask(new_cpu, domain) { 657 current_vector = vector;
658 pos[new_cpu].vector = vector; 658 current_offset = offset;
659 pos[new_cpu].offset = offset;
660 }
661 if (old_vector >= 0) { 659 if (old_vector >= 0) {
660 cpumask_t old_mask;
662 int old_cpu; 661 int old_cpu;
663 for_each_cpu_mask(old_cpu, irq_domain[irq]) 662 cpus_and(old_mask, irq_domain[irq], cpu_online_map);
663 for_each_cpu_mask(old_cpu, old_mask)
664 per_cpu(vector_irq, old_cpu)[old_vector] = -1; 664 per_cpu(vector_irq, old_cpu)[old_vector] = -1;
665 } 665 }
666 for_each_cpu_mask(new_cpu, domain) 666 for_each_cpu_mask(new_cpu, new_mask)
667 per_cpu(vector_irq, new_cpu)[vector] = irq; 667 per_cpu(vector_irq, new_cpu)[vector] = irq;
668 irq_vector[irq] = vector; 668 irq_vector[irq] = vector;
669 irq_domain[irq] = domain; 669 irq_domain[irq] = domain;
@@ -684,6 +684,32 @@ static int assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
684 return vector; 684 return vector;
685} 685}
686 686
687void __setup_vector_irq(int cpu)
688{
689 /* Initialize vector_irq on a new cpu */
690 /* This function must be called with vector_lock held */
691 unsigned long flags;
692 int irq, vector;
693
694
695 /* Mark the inuse vectors */
696 for (irq = 0; irq < NR_IRQ_VECTORS; ++irq) {
697 if (!cpu_isset(cpu, irq_domain[irq]))
698 continue;
699 vector = irq_vector[irq];
700 per_cpu(vector_irq, cpu)[vector] = irq;
701 }
702 /* Mark the free vectors */
703 for (vector = 0; vector < NR_VECTORS; ++vector) {
704 irq = per_cpu(vector_irq, cpu)[vector];
705 if (irq < 0)
706 continue;
707 if (!cpu_isset(cpu, irq_domain[irq]))
708 per_cpu(vector_irq, cpu)[vector] = -1;
709 }
710}
711
712
687extern void (*interrupt[NR_IRQS])(void); 713extern void (*interrupt[NR_IRQS])(void);
688 714
689static struct irq_chip ioapic_chip; 715static struct irq_chip ioapic_chip;
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 7b7a6870288a..62c2e747af58 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -581,12 +581,16 @@ void __cpuinit start_secondary(void)
581 * smp_call_function(). 581 * smp_call_function().
582 */ 582 */
583 lock_ipi_call_lock(); 583 lock_ipi_call_lock();
584 spin_lock(&vector_lock);
584 585
586 /* Setup the per cpu irq handling data structures */
587 __setup_vector_irq(smp_processor_id());
585 /* 588 /*
586 * Allow the master to continue. 589 * Allow the master to continue.
587 */ 590 */
588 cpu_set(smp_processor_id(), cpu_online_map); 591 cpu_set(smp_processor_id(), cpu_online_map);
589 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; 592 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
593 spin_unlock(&vector_lock);
590 unlock_ipi_call_lock(); 594 unlock_ipi_call_lock();
591 595
592 cpu_idle(); 596 cpu_idle();
@@ -799,7 +803,6 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
799 cpu, node); 803 cpu, node);
800 } 804 }
801 805
802
803 alternatives_smp_switch(1); 806 alternatives_smp_switch(1);
804 807
805 c_idle.idle = get_idle_for_cpu(cpu); 808 c_idle.idle = get_idle_for_cpu(cpu);
@@ -1246,8 +1249,10 @@ int __cpu_disable(void)
1246 local_irq_disable(); 1249 local_irq_disable();
1247 remove_siblinginfo(cpu); 1250 remove_siblinginfo(cpu);
1248 1251
1252 spin_lock(&vector_lock);
1249 /* It's now safe to remove this processor from the online map */ 1253 /* It's now safe to remove this processor from the online map */
1250 cpu_clear(cpu, cpu_online_map); 1254 cpu_clear(cpu, cpu_online_map);
1255 spin_unlock(&vector_lock);
1251 remove_cpu_from_maps(); 1256 remove_cpu_from_maps();
1252 fixup_irqs(cpu_online_map); 1257 fixup_irqs(cpu_online_map);
1253 return 0; 1258 return 0;
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index 1283614c9b24..edb24aa714b4 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -175,13 +175,7 @@ SECTIONS
175 __setup_end = .; 175 __setup_end = .;
176 __initcall_start = .; 176 __initcall_start = .;
177 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { 177 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
178 *(.initcall1.init) 178 INITCALLS
179 *(.initcall2.init)
180 *(.initcall3.init)
181 *(.initcall4.init)
182 *(.initcall5.init)
183 *(.initcall6.init)
184 *(.initcall7.init)
185 } 179 }
186 __initcall_end = .; 180 __initcall_end = .;
187 __con_initcall_start = .; 181 __con_initcall_start = .;
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index 7732f4254d21..e61093b34c26 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -220,7 +220,7 @@ void __init pci_mmcfg_init(int type)
220 220
221 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL); 221 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL);
222 if (pci_mmcfg_virt == NULL) { 222 if (pci_mmcfg_virt == NULL) {
223 printk("PCI: Can not allocate memory for mmconfig structures\n"); 223 printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n");
224 return; 224 return;
225 } 225 }
226 for (i = 0; i < pci_mmcfg_config_num; ++i) { 226 for (i = 0; i < pci_mmcfg_config_num; ++i) {
@@ -228,7 +228,8 @@ void __init pci_mmcfg_init(int type)
228 pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address, 228 pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address,
229 MMCONFIG_APER_MAX); 229 MMCONFIG_APER_MAX);
230 if (!pci_mmcfg_virt[i].virt) { 230 if (!pci_mmcfg_virt[i].virt) {
231 printk("PCI: Cannot map mmconfig aperture for segment %d\n", 231 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for "
232 "segment %d\n",
232 pci_mmcfg_config[i].pci_segment_group_number); 233 pci_mmcfg_config[i].pci_segment_group_number);
233 return; 234 return;
234 } 235 }
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index ab6cdbd5eb68..cfe75f528725 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -184,13 +184,7 @@ SECTIONS
184 184
185 __initcall_start = .; 185 __initcall_start = .;
186 .initcall.init : { 186 .initcall.init : {
187 *(.initcall1.init) 187 INITCALLS
188 *(.initcall2.init)
189 *(.initcall3.init)
190 *(.initcall4.init)
191 *(.initcall5.init)
192 *(.initcall6.init)
193 *(.initcall7.init)
194 } 188 }
195 __initcall_end = .; 189 __initcall_end = .;
196 190
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 0b4e22436935..1429f3a2629e 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -37,8 +37,8 @@ config DEBUG_DRIVER
37 37
38 If you are unsure about this, say N here. 38 If you are unsure about this, say N here.
39 39
40endmenu
41
42config SYS_HYPERVISOR 40config SYS_HYPERVISOR
43 bool 41 bool
44 default n 42 default n
43
44endmenu
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index db01b95a47a5..c5d6bb4290ad 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -18,6 +18,7 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/kthread.h> 20#include <linux/kthread.h>
21#include <linux/wait.h>
21 22
22#include "base.h" 23#include "base.h"
23#include "power/power.h" 24#include "power/power.h"
@@ -70,6 +71,8 @@ struct stupid_thread_structure {
70}; 71};
71 72
72static atomic_t probe_count = ATOMIC_INIT(0); 73static atomic_t probe_count = ATOMIC_INIT(0);
74static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue);
75
73static int really_probe(void *void_data) 76static int really_probe(void *void_data)
74{ 77{
75 struct stupid_thread_structure *data = void_data; 78 struct stupid_thread_structure *data = void_data;
@@ -121,6 +124,7 @@ probe_failed:
121done: 124done:
122 kfree(data); 125 kfree(data);
123 atomic_dec(&probe_count); 126 atomic_dec(&probe_count);
127 wake_up(&probe_waitqueue);
124 return ret; 128 return ret;
125} 129}
126 130
@@ -337,6 +341,32 @@ void driver_detach(struct device_driver * drv)
337 } 341 }
338} 342}
339 343
344#ifdef CONFIG_PCI_MULTITHREAD_PROBE
345static int __init wait_for_probes(void)
346{
347 DEFINE_WAIT(wait);
348
349 printk(KERN_INFO "%s: waiting for %d threads\n", __FUNCTION__,
350 atomic_read(&probe_count));
351 if (!atomic_read(&probe_count))
352 return 0;
353 while (atomic_read(&probe_count)) {
354 prepare_to_wait(&probe_waitqueue, &wait, TASK_UNINTERRUPTIBLE);
355 if (atomic_read(&probe_count))
356 schedule();
357 }
358 finish_wait(&probe_waitqueue, &wait);
359 return 0;
360}
361
362core_initcall_sync(wait_for_probes);
363postcore_initcall_sync(wait_for_probes);
364arch_initcall_sync(wait_for_probes);
365subsys_initcall_sync(wait_for_probes);
366fs_initcall_sync(wait_for_probes);
367device_initcall_sync(wait_for_probes);
368late_initcall_sync(wait_for_probes);
369#endif
340 370
341EXPORT_SYMBOL_GPL(device_bind_driver); 371EXPORT_SYMBOL_GPL(device_bind_driver);
342EXPORT_SYMBOL_GPL(device_release_driver); 372EXPORT_SYMBOL_GPL(device_release_driver);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index bc6602606fb5..6ffe2b2bdacc 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1992,8 +1992,8 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
1992 *block_size = BLOCK_SIZE; 1992 *block_size = BLOCK_SIZE;
1993 } 1993 }
1994 if (*total_size != (__u32) 0) 1994 if (*total_size != (__u32) 0)
1995 printk(KERN_INFO " blocks= %lld block_size= %d\n", 1995 printk(KERN_INFO " blocks= %llu block_size= %d\n",
1996 *total_size, *block_size); 1996 (unsigned long long)*total_size, *block_size);
1997 kfree(buf); 1997 kfree(buf);
1998 return; 1998 return;
1999} 1999}
@@ -2027,8 +2027,8 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
2027 *total_size = 0; 2027 *total_size = 0;
2028 *block_size = BLOCK_SIZE; 2028 *block_size = BLOCK_SIZE;
2029 } 2029 }
2030 printk(KERN_INFO " blocks= %lld block_size= %d\n", 2030 printk(KERN_INFO " blocks= %llu block_size= %d\n",
2031 *total_size, *block_size); 2031 (unsigned long long)*total_size, *block_size);
2032 kfree(buf); 2032 kfree(buf);
2033 return; 2033 return;
2034} 2034}
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index 029baea33b62..6eafff13dab6 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -237,6 +237,8 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
237 237
238 list = drm_alloc(sizeof(*list), DRM_MEM_MAPS); 238 list = drm_alloc(sizeof(*list), DRM_MEM_MAPS);
239 if (!list) { 239 if (!list) {
240 if (map->type == _DRM_REGISTERS)
241 drm_ioremapfree(map->handle, map->size, dev);
240 drm_free(map, sizeof(*map), DRM_MEM_MAPS); 242 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
241 return -EINVAL; 243 return -EINVAL;
242 } 244 }
@@ -252,6 +254,8 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
252 map->offset; 254 map->offset;
253 ret = drm_map_handle(dev, &list->hash, user_token, 0); 255 ret = drm_map_handle(dev, &list->hash, user_token, 0);
254 if (ret) { 256 if (ret) {
257 if (map->type == _DRM_REGISTERS)
258 drm_ioremapfree(map->handle, map->size, dev);
255 drm_free(map, sizeof(*map), DRM_MEM_MAPS); 259 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
256 drm_free(list, sizeof(*list), DRM_MEM_MAPS); 260 drm_free(list, sizeof(*list), DRM_MEM_MAPS);
257 mutex_unlock(&dev->struct_mutex); 261 mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
index 51ad98c685c3..ba4b8de83cf0 100644
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -42,13 +42,24 @@ static CLASS_ATTR(version, S_IRUGO, version_show, NULL);
42struct class *drm_sysfs_create(struct module *owner, char *name) 42struct class *drm_sysfs_create(struct module *owner, char *name)
43{ 43{
44 struct class *class; 44 struct class *class;
45 int err;
45 46
46 class = class_create(owner, name); 47 class = class_create(owner, name);
47 if (!class) 48 if (!class) {
48 return class; 49 err = -ENOMEM;
50 goto err_out;
51 }
52
53 err = class_create_file(class, &class_attr_version);
54 if (err)
55 goto err_out_class;
49 56
50 class_create_file(class, &class_attr_version);
51 return class; 57 return class;
58
59err_out_class:
60 class_destroy(class);
61err_out:
62 return ERR_PTR(err);
52} 63}
53 64
54/** 65/**
@@ -96,20 +107,36 @@ static struct class_device_attribute class_device_attrs[] = {
96struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head) 107struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head)
97{ 108{
98 struct class_device *class_dev; 109 struct class_device *class_dev;
99 int i; 110 int i, j, err;
100 111
101 class_dev = class_device_create(cs, NULL, 112 class_dev = class_device_create(cs, NULL,
102 MKDEV(DRM_MAJOR, head->minor), 113 MKDEV(DRM_MAJOR, head->minor),
103 &(head->dev->pdev)->dev, 114 &(head->dev->pdev)->dev,
104 "card%d", head->minor); 115 "card%d", head->minor);
105 if (!class_dev) 116 if (!class_dev) {
106 return NULL; 117 err = -ENOMEM;
118 goto err_out;
119 }
107 120
108 class_set_devdata(class_dev, head); 121 class_set_devdata(class_dev, head);
109 122
110 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 123 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
111 class_device_create_file(class_dev, &class_device_attrs[i]); 124 err = class_device_create_file(class_dev,
125 &class_device_attrs[i]);
126 if (err)
127 goto err_out_files;
128 }
129
112 return class_dev; 130 return class_dev;
131
132err_out_files:
133 if (i > 0)
134 for (j = 0; j < i; j++)
135 class_device_remove_file(class_dev,
136 &class_device_attrs[i]);
137 class_device_unregister(class_dev);
138err_out:
139 return ERR_PTR(err);
113} 140}
114 141
115/** 142/**
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index e30f556b79f1..be49dbb9ec3f 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -47,6 +47,7 @@ static struct drm_driver driver = {
47 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | 47 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA |
48 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | 48 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
49 DRIVER_IRQ_VBL, 49 DRIVER_IRQ_VBL,
50 .dev_priv_size = sizeof(drm_mga_buf_priv_t),
50 .load = mga_driver_load, 51 .load = mga_driver_load,
51 .unload = mga_driver_unload, 52 .unload = mga_driver_unload,
52 .lastclose = mga_driver_lastclose, 53 .lastclose = mga_driver_lastclose,
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c
index 26bdf2ca59d7..d14477ba3679 100644
--- a/drivers/char/drm/r300_cmdbuf.c
+++ b/drivers/char/drm/r300_cmdbuf.c
@@ -538,6 +538,36 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv,
538 return 0; 538 return 0;
539} 539}
540 540
541static __inline__ int r300_emit_indx_buffer(drm_radeon_private_t *dev_priv,
542 drm_radeon_kcmd_buffer_t *cmdbuf)
543{
544 u32 *cmd = (u32 *) cmdbuf->buf;
545 int count, ret;
546 RING_LOCALS;
547
548 count=(cmd[0]>>16) & 0x3fff;
549
550 if ((cmd[1] & 0x8000ffff) != 0x80000810) {
551 DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]);
552 return DRM_ERR(EINVAL);
553 }
554 ret = r300_check_offset(dev_priv, cmd[2]);
555 if (ret) {
556 DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]);
557 return DRM_ERR(EINVAL);
558 }
559
560 BEGIN_RING(count+2);
561 OUT_RING(cmd[0]);
562 OUT_RING_TABLE((int *)(cmdbuf->buf + 4), count + 1);
563 ADVANCE_RING();
564
565 cmdbuf->buf += (count+2)*4;
566 cmdbuf->bufsz -= (count+2)*4;
567
568 return 0;
569}
570
541static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, 571static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv,
542 drm_radeon_kcmd_buffer_t *cmdbuf) 572 drm_radeon_kcmd_buffer_t *cmdbuf)
543{ 573{
@@ -578,10 +608,11 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv,
578 case RADEON_CNTL_BITBLT_MULTI: 608 case RADEON_CNTL_BITBLT_MULTI:
579 return r300_emit_bitblt_multi(dev_priv, cmdbuf); 609 return r300_emit_bitblt_multi(dev_priv, cmdbuf);
580 610
611 case RADEON_CP_INDX_BUFFER: /* DRAW_INDX_2 without INDX_BUFFER seems to lock up the gpu */
612 return r300_emit_indx_buffer(dev_priv, cmdbuf);
581 case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */ 613 case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */
582 case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */ 614 case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */
583 case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */ 615 case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */
584 case RADEON_CP_INDX_BUFFER: /* DRAW_INDX_2 without INDX_BUFFER seems to lock up the gpu */
585 case RADEON_WAIT_FOR_IDLE: 616 case RADEON_WAIT_FOR_IDLE:
586 case RADEON_CP_NOP: 617 case RADEON_CP_NOP:
587 /* these packets are safe */ 618 /* these packets are safe */
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c
index feac5f005d47..6e04fdd732ac 100644
--- a/drivers/char/drm/radeon_state.c
+++ b/drivers/char/drm/radeon_state.c
@@ -275,6 +275,8 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
275 unsigned int *cmdsz) 275 unsigned int *cmdsz)
276{ 276{
277 u32 *cmd = (u32 *) cmdbuf->buf; 277 u32 *cmd = (u32 *) cmdbuf->buf;
278 u32 offset, narrays;
279 int count, i, k;
278 280
279 *cmdsz = 2 + ((cmd[0] & RADEON_CP_PACKET_COUNT_MASK) >> 16); 281 *cmdsz = 2 + ((cmd[0] & RADEON_CP_PACKET_COUNT_MASK) >> 16);
280 282
@@ -288,10 +290,106 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
288 return DRM_ERR(EINVAL); 290 return DRM_ERR(EINVAL);
289 } 291 }
290 292
291 /* Check client state and fix it up if necessary */ 293 switch(cmd[0] & 0xff00) {
292 if (cmd[0] & 0x8000) { /* MSB of opcode: next DWORD GUI_CNTL */ 294 /* XXX Are there old drivers needing other packets? */
293 u32 offset;
294 295
296 case RADEON_3D_DRAW_IMMD:
297 case RADEON_3D_DRAW_VBUF:
298 case RADEON_3D_DRAW_INDX:
299 case RADEON_WAIT_FOR_IDLE:
300 case RADEON_CP_NOP:
301 case RADEON_3D_CLEAR_ZMASK:
302/* case RADEON_CP_NEXT_CHAR:
303 case RADEON_CP_PLY_NEXTSCAN:
304 case RADEON_CP_SET_SCISSORS: */ /* probably safe but will never need them? */
305 /* these packets are safe */
306 break;
307
308 case RADEON_CP_3D_DRAW_IMMD_2:
309 case RADEON_CP_3D_DRAW_VBUF_2:
310 case RADEON_CP_3D_DRAW_INDX_2:
311 case RADEON_3D_CLEAR_HIZ:
312 /* safe but r200 only */
313 if (dev_priv->microcode_version != UCODE_R200) {
314 DRM_ERROR("Invalid 3d packet for r100-class chip\n");
315 return DRM_ERR(EINVAL);
316 }
317 break;
318
319 case RADEON_3D_LOAD_VBPNTR:
320 count = (cmd[0] >> 16) & 0x3fff;
321
322 if (count > 18) { /* 12 arrays max */
323 DRM_ERROR("Too large payload in 3D_LOAD_VBPNTR (count=%d)\n",
324 count);
325 return DRM_ERR(EINVAL);
326 }
327
328 /* carefully check packet contents */
329 narrays = cmd[1] & ~0xc000;
330 k = 0;
331 i = 2;
332 while ((k < narrays) && (i < (count + 2))) {
333 i++; /* skip attribute field */
334 if (radeon_check_and_fixup_offset(dev_priv, filp_priv, &cmd[i])) {
335 DRM_ERROR
336 ("Invalid offset (k=%d i=%d) in 3D_LOAD_VBPNTR packet.\n",
337 k, i);
338 return DRM_ERR(EINVAL);
339 }
340 k++;
341 i++;
342 if (k == narrays)
343 break;
344 /* have one more to process, they come in pairs */
345 if (radeon_check_and_fixup_offset(dev_priv, filp_priv, &cmd[i])) {
346 DRM_ERROR
347 ("Invalid offset (k=%d i=%d) in 3D_LOAD_VBPNTR packet.\n",
348 k, i);
349 return DRM_ERR(EINVAL);
350 }
351 k++;
352 i++;
353 }
354 /* do the counts match what we expect ? */
355 if ((k != narrays) || (i != (count + 2))) {
356 DRM_ERROR
357 ("Malformed 3D_LOAD_VBPNTR packet (k=%d i=%d narrays=%d count+1=%d).\n",
358 k, i, narrays, count + 1);
359 return DRM_ERR(EINVAL);
360 }
361 break;
362
363 case RADEON_3D_RNDR_GEN_INDX_PRIM:
364 if (dev_priv->microcode_version != UCODE_R100) {
365 DRM_ERROR("Invalid 3d packet for r200-class chip\n");
366 return DRM_ERR(EINVAL);
367 }
368 if (radeon_check_and_fixup_offset(dev_priv, filp_priv, &cmd[1])) {
369 DRM_ERROR("Invalid rndr_gen_indx offset\n");
370 return DRM_ERR(EINVAL);
371 }
372 break;
373
374 case RADEON_CP_INDX_BUFFER:
375 if (dev_priv->microcode_version != UCODE_R200) {
376 DRM_ERROR("Invalid 3d packet for r100-class chip\n");
377 return DRM_ERR(EINVAL);
378 }
379 if ((cmd[1] & 0x8000ffff) != 0x80000810) {
380 DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]);
381 return DRM_ERR(EINVAL);
382 }
383 if (radeon_check_and_fixup_offset(dev_priv, filp_priv, &cmd[2])) {
384 DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]);
385 return DRM_ERR(EINVAL);
386 }
387 break;
388
389 case RADEON_CNTL_HOSTDATA_BLT:
390 case RADEON_CNTL_PAINT_MULTI:
391 case RADEON_CNTL_BITBLT_MULTI:
392 /* MSB of opcode: next DWORD GUI_CNTL */
295 if (cmd[1] & (RADEON_GMC_SRC_PITCH_OFFSET_CNTL 393 if (cmd[1] & (RADEON_GMC_SRC_PITCH_OFFSET_CNTL
296 | RADEON_GMC_DST_PITCH_OFFSET_CNTL)) { 394 | RADEON_GMC_DST_PITCH_OFFSET_CNTL)) {
297 offset = cmd[2] << 10; 395 offset = cmd[2] << 10;
@@ -313,6 +411,11 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
313 } 411 }
314 cmd[3] = (cmd[3] & 0xffc00000) | offset >> 10; 412 cmd[3] = (cmd[3] & 0xffc00000) | offset >> 10;
315 } 413 }
414 break;
415
416 default:
417 DRM_ERROR("Invalid packet type %x\n", cmd[0] & 0xff00);
418 return DRM_ERR(EINVAL);
316 } 419 }
317 420
318 return 0; 421 return 0;
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c
index 59c7520bf9a2..a9a84f88df5e 100644
--- a/drivers/char/drm/savage_bci.c
+++ b/drivers/char/drm/savage_bci.c
@@ -728,6 +728,7 @@ static int savage_do_init_bci(drm_device_t * dev, drm_savage_init_t * init)
728 dev_priv->status = NULL; 728 dev_priv->status = NULL;
729 } 729 }
730 if (dev_priv->dma_type == SAVAGE_DMA_AGP && init->buffers_offset) { 730 if (dev_priv->dma_type == SAVAGE_DMA_AGP && init->buffers_offset) {
731 dev->agp_buffer_token = init->buffers_offset;
731 dev->agp_buffer_map = drm_core_findmap(dev, 732 dev->agp_buffer_map = drm_core_findmap(dev,
732 init->buffers_offset); 733 init->buffers_offset);
733 if (!dev->agp_buffer_map) { 734 if (!dev->agp_buffer_map) {
diff --git a/drivers/char/drm/savage_state.c b/drivers/char/drm/savage_state.c
index ef2581d16146..1ca1e9cb5a33 100644
--- a/drivers/char/drm/savage_state.c
+++ b/drivers/char/drm/savage_state.c
@@ -994,7 +994,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS)
994 if (cmdbuf.size) { 994 if (cmdbuf.size) {
995 kcmd_addr = drm_alloc(cmdbuf.size * 8, DRM_MEM_DRIVER); 995 kcmd_addr = drm_alloc(cmdbuf.size * 8, DRM_MEM_DRIVER);
996 if (kcmd_addr == NULL) 996 if (kcmd_addr == NULL)
997 return ENOMEM; 997 return DRM_ERR(ENOMEM);
998 998
999 if (DRM_COPY_FROM_USER(kcmd_addr, cmdbuf.cmd_addr, 999 if (DRM_COPY_FROM_USER(kcmd_addr, cmdbuf.cmd_addr,
1000 cmdbuf.size * 8)) 1000 cmdbuf.size * 8))
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c
index d8d0f28e0acf..e3239833e4b0 100644
--- a/drivers/char/watchdog/sc1200wdt.c
+++ b/drivers/char/watchdog/sc1200wdt.c
@@ -392,7 +392,7 @@ static int __init sc1200wdt_init(void)
392 if (io == -1) { 392 if (io == -1) {
393 printk(KERN_ERR PFX "io parameter must be specified\n"); 393 printk(KERN_ERR PFX "io parameter must be specified\n");
394 ret = -EINVAL; 394 ret = -EINVAL;
395 goto out_clean; 395 goto out_pnp;
396 } 396 }
397 397
398#if defined CONFIG_PNP 398#if defined CONFIG_PNP
@@ -405,7 +405,7 @@ static int __init sc1200wdt_init(void)
405 if (!request_region(io, io_len, SC1200_MODULE_NAME)) { 405 if (!request_region(io, io_len, SC1200_MODULE_NAME)) {
406 printk(KERN_ERR PFX "Unable to register IO port %#x\n", io); 406 printk(KERN_ERR PFX "Unable to register IO port %#x\n", io);
407 ret = -EBUSY; 407 ret = -EBUSY;
408 goto out_clean; 408 goto out_pnp;
409 } 409 }
410 410
411 ret = sc1200wdt_probe(); 411 ret = sc1200wdt_probe();
@@ -435,6 +435,11 @@ out_rbt:
435out_io: 435out_io:
436 release_region(io, io_len); 436 release_region(io, io_len);
437 437
438out_pnp:
439#if defined CONFIG_PNP
440 if (isapnp)
441 pnp_unregister_driver(&scl200wdt_pnp_driver);
442#endif
438 goto out_clean; 443 goto out_clean;
439} 444}
440 445
diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c
index 22d17474755f..ca4e67a022d0 100644
--- a/drivers/fc4/fc.c
+++ b/drivers/fc4/fc.c
@@ -70,9 +70,9 @@
70 70
71#define FCP_CMND(SCpnt) ((fcp_cmnd *)&(SCpnt->SCp)) 71#define FCP_CMND(SCpnt) ((fcp_cmnd *)&(SCpnt->SCp))
72#define FC_SCMND(SCpnt) ((fc_channel *)(SCpnt->device->host->hostdata[0])) 72#define FC_SCMND(SCpnt) ((fc_channel *)(SCpnt->device->host->hostdata[0]))
73#define SC_FCMND(fcmnd) ((Scsi_Cmnd *)((long)fcmnd - (long)&(((Scsi_Cmnd *)0)->SCp))) 73#define SC_FCMND(fcmnd) ((struct scsi_cmnd *)((long)fcmnd - (long)&(((struct scsi_cmnd *)0)->SCp)))
74 74
75static int fcp_scsi_queue_it(fc_channel *, Scsi_Cmnd *, fcp_cmnd *, int); 75static int fcp_scsi_queue_it(fc_channel *, struct scsi_cmnd *, fcp_cmnd *, int);
76void fcp_queue_empty(fc_channel *); 76void fcp_queue_empty(fc_channel *);
77 77
78static void fcp_scsi_insert_queue (fc_channel *fc, fcp_cmnd *fcmd) 78static void fcp_scsi_insert_queue (fc_channel *fc, fcp_cmnd *fcmd)
@@ -378,14 +378,14 @@ void fcp_register(fc_channel *fc, u8 type, int unregister)
378 printk ("FC: %segistering unknown type %02x\n", unregister ? "Unr" : "R", type); 378 printk ("FC: %segistering unknown type %02x\n", unregister ? "Unr" : "R", type);
379} 379}
380 380
381static void fcp_scsi_done(Scsi_Cmnd *SCpnt); 381static void fcp_scsi_done(struct scsi_cmnd *SCpnt);
382 382
383static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hdr *fch) 383static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hdr *fch)
384{ 384{
385 fcp_cmnd *fcmd; 385 fcp_cmnd *fcmd;
386 fcp_rsp *rsp; 386 fcp_rsp *rsp;
387 int host_status; 387 int host_status;
388 Scsi_Cmnd *SCpnt; 388 struct scsi_cmnd *SCpnt;
389 int sense_len; 389 int sense_len;
390 int rsp_status; 390 int rsp_status;
391 391
@@ -757,13 +757,14 @@ void fcp_release(fc_channel *fcchain, int count) /* count must > 0 */
757} 757}
758 758
759 759
760static void fcp_scsi_done (Scsi_Cmnd *SCpnt) 760static void fcp_scsi_done(struct scsi_cmnd *SCpnt)
761{ 761{
762 if (FCP_CMND(SCpnt)->done) 762 if (FCP_CMND(SCpnt)->done)
763 FCP_CMND(SCpnt)->done(SCpnt); 763 FCP_CMND(SCpnt)->done(SCpnt);
764} 764}
765 765
766static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, int prepare) 766static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt,
767 fcp_cmnd *fcmd, int prepare)
767{ 768{
768 long i; 769 long i;
769 fcp_cmd *cmd; 770 fcp_cmd *cmd;
@@ -837,7 +838,8 @@ static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, i
837 return 0; 838 return 0;
838} 839}
839 840
840int fcp_scsi_queuecommand(Scsi_Cmnd *SCpnt, void (* done)(Scsi_Cmnd *)) 841int fcp_scsi_queuecommand(struct scsi_cmnd *SCpnt,
842 void (* done)(struct scsi_cmnd *))
841{ 843{
842 fcp_cmnd *fcmd = FCP_CMND(SCpnt); 844 fcp_cmnd *fcmd = FCP_CMND(SCpnt);
843 fc_channel *fc = FC_SCMND(SCpnt); 845 fc_channel *fc = FC_SCMND(SCpnt);
@@ -873,7 +875,7 @@ void fcp_queue_empty(fc_channel *fc)
873 } 875 }
874} 876}
875 877
876int fcp_scsi_abort(Scsi_Cmnd *SCpnt) 878int fcp_scsi_abort(struct scsi_cmnd *SCpnt)
877{ 879{
878 /* Internal bookkeeping only. Lose 1 cmd_slots slot. */ 880 /* Internal bookkeeping only. Lose 1 cmd_slots slot. */
879 fcp_cmnd *fcmd = FCP_CMND(SCpnt); 881 fcp_cmnd *fcmd = FCP_CMND(SCpnt);
@@ -910,7 +912,7 @@ int fcp_scsi_abort(Scsi_Cmnd *SCpnt)
910} 912}
911 913
912#if 0 914#if 0
913void fcp_scsi_reset_done(Scsi_Cmnd *SCpnt) 915void fcp_scsi_reset_done(struct scsi_cmnd *SCpnt)
914{ 916{
915 fc_channel *fc = FC_SCMND(SCpnt); 917 fc_channel *fc = FC_SCMND(SCpnt);
916 918
@@ -921,7 +923,7 @@ void fcp_scsi_reset_done(Scsi_Cmnd *SCpnt)
921 923
922#define FCP_RESET_TIMEOUT (2*HZ) 924#define FCP_RESET_TIMEOUT (2*HZ)
923 925
924int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt) 926int fcp_scsi_dev_reset(struct scsi_cmnd *SCpnt)
925{ 927{
926#if 0 /* broken junk, but if davem wants to compile this driver, let him.. */ 928#if 0 /* broken junk, but if davem wants to compile this driver, let him.. */
927 unsigned long flags; 929 unsigned long flags;
@@ -931,7 +933,7 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt)
931 DECLARE_MUTEX_LOCKED(sem); 933 DECLARE_MUTEX_LOCKED(sem);
932 934
933 if (!fc->rst_pkt) { 935 if (!fc->rst_pkt) {
934 fc->rst_pkt = (Scsi_Cmnd *) kmalloc(sizeof(SCpnt), GFP_KERNEL); 936 fc->rst_pkt = (struct scsi_cmnd *) kmalloc(sizeof(SCpnt), GFP_KERNEL);
935 if (!fc->rst_pkt) return FAILED; 937 if (!fc->rst_pkt) return FAILED;
936 938
937 fcmd = FCP_CMND(fc->rst_pkt); 939 fcmd = FCP_CMND(fc->rst_pkt);
@@ -999,7 +1001,7 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt)
999 return SUCCESS; 1001 return SUCCESS;
1000} 1002}
1001 1003
1002static int __fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) 1004static int __fcp_scsi_host_reset(struct scsi_cmnd *SCpnt)
1003{ 1005{
1004 fc_channel *fc = FC_SCMND(SCpnt); 1006 fc_channel *fc = FC_SCMND(SCpnt);
1005 fcp_cmnd *fcmd = FCP_CMND(SCpnt); 1007 fcp_cmnd *fcmd = FCP_CMND(SCpnt);
@@ -1020,7 +1022,7 @@ static int __fcp_scsi_host_reset(Scsi_Cmnd *SCpnt)
1020 else return FAILED; 1022 else return FAILED;
1021} 1023}
1022 1024
1023int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) 1025int fcp_scsi_host_reset(struct scsi_cmnd *SCpnt)
1024{ 1026{
1025 unsigned long flags; 1027 unsigned long flags;
1026 int rc; 1028 int rc;
diff --git a/drivers/fc4/fcp_impl.h b/drivers/fc4/fcp_impl.h
index c397c84bef63..1ac61330592e 100644
--- a/drivers/fc4/fcp_impl.h
+++ b/drivers/fc4/fcp_impl.h
@@ -39,7 +39,7 @@ struct _fc_channel;
39typedef struct fcp_cmnd { 39typedef struct fcp_cmnd {
40 struct fcp_cmnd *next; 40 struct fcp_cmnd *next;
41 struct fcp_cmnd *prev; 41 struct fcp_cmnd *prev;
42 void (*done)(Scsi_Cmnd *); 42 void (*done)(struct scsi_cmnd *);
43 unsigned short proto; 43 unsigned short proto;
44 unsigned short token; 44 unsigned short token;
45 unsigned int did; 45 unsigned int did;
@@ -94,14 +94,14 @@ typedef struct _fc_channel {
94 long *scsi_bitmap; 94 long *scsi_bitmap;
95 long scsi_bitmap_end; 95 long scsi_bitmap_end;
96 int scsi_free; 96 int scsi_free;
97 int (*encode_addr)(Scsi_Cmnd *, u16 *, struct _fc_channel *, fcp_cmnd *); 97 int (*encode_addr)(struct scsi_cmnd *, u16 *, struct _fc_channel *, fcp_cmnd *);
98 fcp_cmnd *scsi_que; 98 fcp_cmnd *scsi_que;
99 char scsi_name[4]; 99 char scsi_name[4];
100 fcp_cmnd **cmd_slots; 100 fcp_cmnd **cmd_slots;
101 int channels; 101 int channels;
102 int targets; 102 int targets;
103 long *ages; 103 long *ages;
104 Scsi_Cmnd *rst_pkt; 104 struct scsi_cmnd *rst_pkt;
105 fcp_posmap *posmap; 105 fcp_posmap *posmap;
106 /* LOGIN stuff */ 106 /* LOGIN stuff */
107 fcp_cmnd *login; 107 fcp_cmnd *login;
@@ -155,9 +155,10 @@ int fc_do_prli(fc_channel *, unsigned char);
155 for_each_fc_channel(fc) \ 155 for_each_fc_channel(fc) \
156 if (fc->state == FC_STATE_ONLINE) 156 if (fc->state == FC_STATE_ONLINE)
157 157
158int fcp_scsi_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *)); 158int fcp_scsi_queuecommand(struct scsi_cmnd *,
159int fcp_scsi_abort(Scsi_Cmnd *); 159 void (* done) (struct scsi_cmnd *));
160int fcp_scsi_dev_reset(Scsi_Cmnd *); 160int fcp_scsi_abort(struct scsi_cmnd *);
161int fcp_scsi_host_reset(Scsi_Cmnd *); 161int fcp_scsi_dev_reset(struct scsi_cmnd *);
162int fcp_scsi_host_reset(struct scsi_cmnd *);
162 163
163#endif /* !(_FCP_SCSI_H) */ 164#endif /* !(_FCP_SCSI_H) */
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index ad418ce882ca..e72ab36a5494 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -247,8 +247,10 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi
247 (!(PCI_FUNC(dev->devfn) & 1))) 247 (!(PCI_FUNC(dev->devfn) & 1)))
248 goto out; 248 goto out;
249 249
250 if (dev->vendor == PCI_VENDOR_ID_JMICRON && PCI_FUNC(dev->devfn) != 1) 250 if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
251 goto out; 251 if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1)
252 goto out;
253 }
252 254
253 if (dev->vendor != PCI_VENDOR_ID_JMICRON) { 255 if (dev->vendor != PCI_VENDOR_ID_JMICRON) {
254 pci_read_config_word(dev, PCI_COMMAND, &command); 256 pci_read_config_word(dev, PCI_COMMAND, &command);
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index dea13525df88..6e8ea9110c46 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -3552,12 +3552,21 @@ static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
3552{ 3552{
3553 int err; 3553 int err;
3554 3554
3555 printk(KERN_INFO "%s does not fully support suspend and resume yet\n",
3556 OHCI1394_DRIVER_NAME);
3557
3555 err = pci_save_state(pdev); 3558 err = pci_save_state(pdev);
3556 if (err) 3559 if (err) {
3557 goto out; 3560 printk(KERN_ERR "%s: pci_save_state failed with %d\n",
3561 OHCI1394_DRIVER_NAME, err);
3562 return err;
3563 }
3558 err = pci_set_power_state(pdev, pci_choose_state(pdev, state)); 3564 err = pci_set_power_state(pdev, pci_choose_state(pdev, state));
3565#ifdef OHCI1394_DEBUG
3559 if (err) 3566 if (err)
3560 goto out; 3567 printk(KERN_DEBUG "%s: pci_set_power_state failed with %d\n",
3568 OHCI1394_DRIVER_NAME, err);
3569#endif /* OHCI1394_DEBUG */
3561 3570
3562/* PowerMac suspend code comes last */ 3571/* PowerMac suspend code comes last */
3563#ifdef CONFIG_PPC_PMAC 3572#ifdef CONFIG_PPC_PMAC
@@ -3570,8 +3579,8 @@ static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
3570 pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0); 3579 pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0);
3571 } 3580 }
3572#endif /* CONFIG_PPC_PMAC */ 3581#endif /* CONFIG_PPC_PMAC */
3573out: 3582
3574 return err; 3583 return 0;
3575} 3584}
3576#endif /* CONFIG_PM */ 3585#endif /* CONFIG_PM */
3577 3586
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7daa7b1e145f..50ab4a936e30 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2003,6 +2003,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
2003 kobject_init(&rdev->kobj); 2003 kobject_init(&rdev->kobj);
2004 2004
2005 rdev->desc_nr = -1; 2005 rdev->desc_nr = -1;
2006 rdev->saved_raid_disk = -1;
2006 rdev->flags = 0; 2007 rdev->flags = 0;
2007 rdev->data_offset = 0; 2008 rdev->data_offset = 0;
2008 rdev->sb_events = 0; 2009 rdev->sb_events = 0;
@@ -4044,11 +4045,8 @@ static int update_size(mddev_t *mddev, unsigned long size)
4044 return -EBUSY; 4045 return -EBUSY;
4045 ITERATE_RDEV(mddev,rdev,tmp) { 4046 ITERATE_RDEV(mddev,rdev,tmp) {
4046 sector_t avail; 4047 sector_t avail;
4047 if (rdev->sb_offset > rdev->data_offset) 4048 avail = rdev->size * 2;
4048 avail = (rdev->sb_offset*2) - rdev->data_offset; 4049
4049 else
4050 avail = get_capacity(rdev->bdev->bd_disk)
4051 - rdev->data_offset;
4052 if (fit && (size == 0 || size > avail/2)) 4050 if (fit && (size == 0 || size > avail/2))
4053 size = avail/2; 4051 size = avail/2;
4054 if (avail < ((sector_t)size << 1)) 4052 if (avail < ((sector_t)size << 1))
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index a6260f0e3b9e..14da37fee37b 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -277,6 +277,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
277 set_bit(Faulty, &rdev->flags); 277 set_bit(Faulty, &rdev->flags);
278 set_bit(MD_CHANGE_DEVS, &mddev->flags); 278 set_bit(MD_CHANGE_DEVS, &mddev->flags);
279 conf->working_disks--; 279 conf->working_disks--;
280 mddev->degraded++;
280 printk(KERN_ALERT "multipath: IO failure on %s," 281 printk(KERN_ALERT "multipath: IO failure on %s,"
281 " disabling IO path. \n Operation continuing" 282 " disabling IO path. \n Operation continuing"
282 " on %d IO paths.\n", 283 " on %d IO paths.\n",
@@ -336,6 +337,7 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
336 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); 337 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9);
337 338
338 conf->working_disks++; 339 conf->working_disks++;
340 mddev->degraded--;
339 rdev->raid_disk = path; 341 rdev->raid_disk = path;
340 set_bit(In_sync, &rdev->flags); 342 set_bit(In_sync, &rdev->flags);
341 rcu_assign_pointer(p->rdev, rdev); 343 rcu_assign_pointer(p->rdev, rdev);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index dc9d2def0270..656fae912fe3 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1474,8 +1474,8 @@ static void fix_read_error(conf_t *conf, int read_disk,
1474 "raid1:%s: read error corrected " 1474 "raid1:%s: read error corrected "
1475 "(%d sectors at %llu on %s)\n", 1475 "(%d sectors at %llu on %s)\n",
1476 mdname(mddev), s, 1476 mdname(mddev), s,
1477 (unsigned long long)sect + 1477 (unsigned long long)(sect +
1478 rdev->data_offset, 1478 rdev->data_offset),
1479 bdevname(rdev->bdev, b)); 1479 bdevname(rdev->bdev, b));
1480 } 1480 }
1481 } 1481 }
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 74f17a9a6ebb..7492d6033ac6 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1470,8 +1470,8 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
1470 "raid10:%s: read error corrected" 1470 "raid10:%s: read error corrected"
1471 " (%d sectors at %llu on %s)\n", 1471 " (%d sectors at %llu on %s)\n",
1472 mdname(mddev), s, 1472 mdname(mddev), s,
1473 (unsigned long long)sect+ 1473 (unsigned long long)(sect+
1474 rdev->data_offset, 1474 rdev->data_offset),
1475 bdevname(rdev->bdev, b)); 1475 bdevname(rdev->bdev, b));
1476 1476
1477 rdev_dec_pending(rdev, mddev); 1477 rdev_dec_pending(rdev, mddev);
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index c537d71c18e4..a4afad4ecab2 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -75,8 +75,8 @@
75#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR 75#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
76#endif 76#endif
77 77
78#define MPT_LINUX_VERSION_COMMON "3.04.01" 78#define MPT_LINUX_VERSION_COMMON "3.04.02"
79#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.01" 79#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.02"
80#define WHAT_MAGIC_STRING "@" "(" "#" ")" 80#define WHAT_MAGIC_STRING "@" "(" "#" ")"
81 81
82#define show_mptmod_ver(s,ver) \ 82#define show_mptmod_ver(s,ver) \
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index e57bb035a021..1dd491773150 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -96,6 +96,10 @@ static int mptfc_qcmd(struct scsi_cmnd *SCpnt,
96static void mptfc_target_destroy(struct scsi_target *starget); 96static void mptfc_target_destroy(struct scsi_target *starget);
97static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); 97static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout);
98static void __devexit mptfc_remove(struct pci_dev *pdev); 98static void __devexit mptfc_remove(struct pci_dev *pdev);
99static int mptfc_abort(struct scsi_cmnd *SCpnt);
100static int mptfc_dev_reset(struct scsi_cmnd *SCpnt);
101static int mptfc_bus_reset(struct scsi_cmnd *SCpnt);
102static int mptfc_host_reset(struct scsi_cmnd *SCpnt);
99 103
100static struct scsi_host_template mptfc_driver_template = { 104static struct scsi_host_template mptfc_driver_template = {
101 .module = THIS_MODULE, 105 .module = THIS_MODULE,
@@ -110,10 +114,10 @@ static struct scsi_host_template mptfc_driver_template = {
110 .target_destroy = mptfc_target_destroy, 114 .target_destroy = mptfc_target_destroy,
111 .slave_destroy = mptscsih_slave_destroy, 115 .slave_destroy = mptscsih_slave_destroy,
112 .change_queue_depth = mptscsih_change_queue_depth, 116 .change_queue_depth = mptscsih_change_queue_depth,
113 .eh_abort_handler = mptscsih_abort, 117 .eh_abort_handler = mptfc_abort,
114 .eh_device_reset_handler = mptscsih_dev_reset, 118 .eh_device_reset_handler = mptfc_dev_reset,
115 .eh_bus_reset_handler = mptscsih_bus_reset, 119 .eh_bus_reset_handler = mptfc_bus_reset,
116 .eh_host_reset_handler = mptscsih_host_reset, 120 .eh_host_reset_handler = mptfc_host_reset,
117 .bios_param = mptscsih_bios_param, 121 .bios_param = mptscsih_bios_param,
118 .can_queue = MPT_FC_CAN_QUEUE, 122 .can_queue = MPT_FC_CAN_QUEUE,
119 .this_id = -1, 123 .this_id = -1,
@@ -171,6 +175,77 @@ static struct fc_function_template mptfc_transport_functions = {
171 .show_host_symbolic_name = 1, 175 .show_host_symbolic_name = 1,
172}; 176};
173 177
178static int
179mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
180 int (*func)(struct scsi_cmnd *SCpnt),
181 const char *caller)
182{
183 struct scsi_device *sdev = SCpnt->device;
184 struct Scsi_Host *shost = sdev->host;
185 struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
186 unsigned long flags;
187 int ready;
188
189 spin_lock_irqsave(shost->host_lock, flags);
190 while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
191 spin_unlock_irqrestore(shost->host_lock, flags);
192 dfcprintk ((MYIOC_s_INFO_FMT
193 "mptfc_block_error_handler.%d: %d:%d, port status is "
194 "DID_IMM_RETRY, deferring %s recovery.\n",
195 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
196 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
197 SCpnt->device->id,SCpnt->device->lun,caller));
198 msleep(1000);
199 spin_lock_irqsave(shost->host_lock, flags);
200 }
201 spin_unlock_irqrestore(shost->host_lock, flags);
202
203 if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) {
204 dfcprintk ((MYIOC_s_INFO_FMT
205 "%s.%d: %d:%d, failing recovery, "
206 "port state %d, vdev %p.\n", caller,
207 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
208 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
209 SCpnt->device->id,SCpnt->device->lun,ready,
210 SCpnt->device->hostdata));
211 return FAILED;
212 }
213 dfcprintk ((MYIOC_s_INFO_FMT
214 "%s.%d: %d:%d, executing recovery.\n", caller,
215 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
216 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
217 SCpnt->device->id,SCpnt->device->lun));
218 return (*func)(SCpnt);
219}
220
221static int
222mptfc_abort(struct scsi_cmnd *SCpnt)
223{
224 return
225 mptfc_block_error_handler(SCpnt, mptscsih_abort, __FUNCTION__);
226}
227
228static int
229mptfc_dev_reset(struct scsi_cmnd *SCpnt)
230{
231 return
232 mptfc_block_error_handler(SCpnt, mptscsih_dev_reset, __FUNCTION__);
233}
234
235static int
236mptfc_bus_reset(struct scsi_cmnd *SCpnt)
237{
238 return
239 mptfc_block_error_handler(SCpnt, mptscsih_bus_reset, __FUNCTION__);
240}
241
242static int
243mptfc_host_reset(struct scsi_cmnd *SCpnt)
244{
245 return
246 mptfc_block_error_handler(SCpnt, mptscsih_host_reset, __FUNCTION__);
247}
248
174static void 249static void
175mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) 250mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
176{ 251{
@@ -562,6 +637,12 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
562 return 0; 637 return 0;
563 } 638 }
564 639
640 if (!SCpnt->device->hostdata) { /* vdev */
641 SCpnt->result = DID_NO_CONNECT << 16;
642 done(SCpnt);
643 return 0;
644 }
645
565 /* dd_data is null until finished adding target */ 646 /* dd_data is null until finished adding target */
566 ri = *((struct mptfc_rport_info **)rport->dd_data); 647 ri = *((struct mptfc_rport_info **)rport->dd_data);
567 if (unlikely(!ri)) { 648 if (unlikely(!ri)) {
diff --git a/drivers/misc/ioc4.c b/drivers/misc/ioc4.c
index 79354bbbbd6a..b995a15b7526 100644
--- a/drivers/misc/ioc4.c
+++ b/drivers/misc/ioc4.c
@@ -210,8 +210,8 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd)
210 210
211 do_div(ns, IOC4_EXTINT_COUNT_DIVISOR); 211 do_div(ns, IOC4_EXTINT_COUNT_DIVISOR);
212 printk(KERN_DEBUG 212 printk(KERN_DEBUG
213 "IOC4 %s: PCI clock is %lld ns.\n", 213 "IOC4 %s: PCI clock is %llu ns.\n",
214 pci_name(idd->idd_pdev), ns); 214 pci_name(idd->idd_pdev), (unsigned long long)ns);
215 } 215 }
216 216
217 /* Remember results. We store the extint clock period rather 217 /* Remember results. We store the extint clock period rather
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index baece61169f4..41bfcae1fbf4 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1479,6 +1479,7 @@ static void nand_write_page_syndrome(struct mtd_info *mtd,
1479 * @buf: the data to write 1479 * @buf: the data to write
1480 * @page: page number to write 1480 * @page: page number to write
1481 * @cached: cached programming 1481 * @cached: cached programming
1482 * @raw: use _raw version of write_page
1482 */ 1483 */
1483static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip, 1484static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
1484 const uint8_t *buf, int page, int cached, int raw) 1485 const uint8_t *buf, int page, int cached, int raw)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e2ed24918a58..e38846eb51fa 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2717,6 +2717,7 @@ config PPP_MPPE
2717 select CRYPTO 2717 select CRYPTO
2718 select CRYPTO_SHA1 2718 select CRYPTO_SHA1
2719 select CRYPTO_ARC4 2719 select CRYPTO_ARC4
2720 select CRYPTO_ECB
2720 ---help--- 2721 ---help---
2721 Support for the MPPE Encryption protocol, as employed by the 2722 Support for the MPPE Encryption protocol, as employed by the
2722 Microsoft Point-to-Point Tunneling Protocol. 2723 Microsoft Point-to-Point Tunneling Protocol.
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index a3a08a5dd185..19ab3441269c 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2719,7 +2719,10 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2719 struct net_device *netdev = pci_get_drvdata(pdev); 2719 struct net_device *netdev = pci_get_drvdata(pdev);
2720 struct nic *nic = netdev_priv(netdev); 2720 struct nic *nic = netdev_priv(netdev);
2721 2721
2722 netif_poll_disable(nic->netdev); 2722#ifdef CONFIG_E100_NAPI
2723 if (netif_running(netdev))
2724 netif_poll_disable(nic->netdev);
2725#endif
2723 del_timer_sync(&nic->watchdog); 2726 del_timer_sync(&nic->watchdog);
2724 netif_carrier_off(nic->netdev); 2727 netif_carrier_off(nic->netdev);
2725 2728
@@ -2763,7 +2766,10 @@ static void e100_shutdown(struct pci_dev *pdev)
2763 struct net_device *netdev = pci_get_drvdata(pdev); 2766 struct net_device *netdev = pci_get_drvdata(pdev);
2764 struct nic *nic = netdev_priv(netdev); 2767 struct nic *nic = netdev_priv(netdev);
2765 2768
2766 netif_poll_disable(nic->netdev); 2769#ifdef CONFIG_E100_NAPI
2770 if (netif_running(netdev))
2771 netif_poll_disable(nic->netdev);
2772#endif
2767 del_timer_sync(&nic->watchdog); 2773 del_timer_sync(&nic->watchdog);
2768 netif_carrier_off(nic->netdev); 2774 netif_carrier_off(nic->netdev);
2769 2775
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 773821e4cf57..c564adbd669b 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -461,7 +461,8 @@ e1000_get_regs(struct net_device *netdev,
461 regs_buff[24] = (uint32_t)phy_data; /* phy local receiver status */ 461 regs_buff[24] = (uint32_t)phy_data; /* phy local receiver status */
462 regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ 462 regs_buff[25] = regs_buff[24]; /* phy remote receiver status */
463 if (hw->mac_type >= e1000_82540 && 463 if (hw->mac_type >= e1000_82540 &&
464 hw->media_type == e1000_media_type_copper) { 464 hw->mac_type < e1000_82571 &&
465 hw->media_type == e1000_media_type_copper) {
465 regs_buff[26] = E1000_READ_REG(hw, MANC); 466 regs_buff[26] = E1000_READ_REG(hw, MANC);
466 } 467 }
467} 468}
@@ -1690,6 +1691,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol
1690 int retval = 1; /* fail by default */ 1691 int retval = 1; /* fail by default */
1691 1692
1692 switch (hw->device_id) { 1693 switch (hw->device_id) {
1694 case E1000_DEV_ID_82542:
1693 case E1000_DEV_ID_82543GC_FIBER: 1695 case E1000_DEV_ID_82543GC_FIBER:
1694 case E1000_DEV_ID_82543GC_COPPER: 1696 case E1000_DEV_ID_82543GC_COPPER:
1695 case E1000_DEV_ID_82544EI_FIBER: 1697 case E1000_DEV_ID_82544EI_FIBER:
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 112447fd8bf2..449a60303e07 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1961,9 +1961,9 @@ struct e1000_hw {
1961#define E1000_RXDCTL_GRAN 0x01000000 /* RXDCTL Granularity */ 1961#define E1000_RXDCTL_GRAN 0x01000000 /* RXDCTL Granularity */
1962 1962
1963/* Transmit Descriptor Control */ 1963/* Transmit Descriptor Control */
1964#define E1000_TXDCTL_PTHRESH 0x000000FF /* TXDCTL Prefetch Threshold */ 1964#define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */
1965#define E1000_TXDCTL_HTHRESH 0x0000FF00 /* TXDCTL Host Threshold */ 1965#define E1000_TXDCTL_HTHRESH 0x00003F00 /* TXDCTL Host Threshold */
1966#define E1000_TXDCTL_WTHRESH 0x00FF0000 /* TXDCTL Writeback Threshold */ 1966#define E1000_TXDCTL_WTHRESH 0x003F0000 /* TXDCTL Writeback Threshold */
1967#define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */ 1967#define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */
1968#define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */ 1968#define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */
1969#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ 1969#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index fa849831d099..8d04752777a8 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -35,7 +35,7 @@ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
35#else 35#else
36#define DRIVERNAPI "-NAPI" 36#define DRIVERNAPI "-NAPI"
37#endif 37#endif
38#define DRV_VERSION "7.2.9-k2"DRIVERNAPI 38#define DRV_VERSION "7.2.9-k4"DRIVERNAPI
39char e1000_driver_version[] = DRV_VERSION; 39char e1000_driver_version[] = DRV_VERSION;
40static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 40static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
41 41
@@ -699,7 +699,10 @@ e1000_reset(struct e1000_adapter *adapter)
699 phy_data); 699 phy_data);
700 } 700 }
701 701
702 if ((adapter->en_mng_pt) && (adapter->hw.mac_type < e1000_82571)) { 702 if ((adapter->en_mng_pt) &&
703 (adapter->hw.mac_type >= e1000_82540) &&
704 (adapter->hw.mac_type < e1000_82571) &&
705 (adapter->hw.media_type == e1000_media_type_copper)) {
703 manc = E1000_READ_REG(&adapter->hw, MANC); 706 manc = E1000_READ_REG(&adapter->hw, MANC);
704 manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST); 707 manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
705 E1000_WRITE_REG(&adapter->hw, MANC, manc); 708 E1000_WRITE_REG(&adapter->hw, MANC, manc);
@@ -1076,8 +1079,9 @@ e1000_remove(struct pci_dev *pdev)
1076 1079
1077 flush_scheduled_work(); 1080 flush_scheduled_work();
1078 1081
1079 if (adapter->hw.mac_type < e1000_82571 && 1082 if (adapter->hw.mac_type >= e1000_82540 &&
1080 adapter->hw.media_type == e1000_media_type_copper) { 1083 adapter->hw.mac_type < e1000_82571 &&
1084 adapter->hw.media_type == e1000_media_type_copper) {
1081 manc = E1000_READ_REG(&adapter->hw, MANC); 1085 manc = E1000_READ_REG(&adapter->hw, MANC);
1082 if (manc & E1000_MANC_SMBUS_EN) { 1086 if (manc & E1000_MANC_SMBUS_EN) {
1083 manc |= E1000_MANC_ARP_EN; 1087 manc |= E1000_MANC_ARP_EN;
@@ -1804,9 +1808,11 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
1804 * followed by the page buffers. Therefore, skb->data is 1808 * followed by the page buffers. Therefore, skb->data is
1805 * sized to hold the largest protocol header. 1809 * sized to hold the largest protocol header.
1806 */ 1810 */
1811 /* allocations using alloc_page take too long for regular MTU
1812 * so only enable packet split for jumbo frames */
1807 pages = PAGE_USE_COUNT(adapter->netdev->mtu); 1813 pages = PAGE_USE_COUNT(adapter->netdev->mtu);
1808 if ((adapter->hw.mac_type > e1000_82547_rev_2) && (pages <= 3) && 1814 if ((adapter->hw.mac_type >= e1000_82571) && (pages <= 3) &&
1809 PAGE_SIZE <= 16384) 1815 PAGE_SIZE <= 16384 && (rctl & E1000_RCTL_LPE))
1810 adapter->rx_ps_pages = pages; 1816 adapter->rx_ps_pages = pages;
1811 else 1817 else
1812 adapter->rx_ps_pages = 0; 1818 adapter->rx_ps_pages = 0;
@@ -2986,6 +2992,11 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2986 return NETDEV_TX_OK; 2992 return NETDEV_TX_OK;
2987 } 2993 }
2988 2994
2995 /* 82571 and newer doesn't need the workaround that limited descriptor
2996 * length to 4kB */
2997 if (adapter->hw.mac_type >= e1000_82571)
2998 max_per_txd = 8192;
2999
2989#ifdef NETIF_F_TSO 3000#ifdef NETIF_F_TSO
2990 mss = skb_shinfo(skb)->gso_size; 3001 mss = skb_shinfo(skb)->gso_size;
2991 /* The controller does a simple calculation to 3002 /* The controller does a simple calculation to
@@ -3775,9 +3786,6 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3775 3786
3776 length = le16_to_cpu(rx_desc->length); 3787 length = le16_to_cpu(rx_desc->length);
3777 3788
3778 /* adjust length to remove Ethernet CRC */
3779 length -= 4;
3780
3781 if (unlikely(!(status & E1000_RXD_STAT_EOP))) { 3789 if (unlikely(!(status & E1000_RXD_STAT_EOP))) {
3782 /* All receives must fit into a single buffer */ 3790 /* All receives must fit into a single buffer */
3783 E1000_DBG("%s: Receive packet consumed multiple" 3791 E1000_DBG("%s: Receive packet consumed multiple"
@@ -3805,6 +3813,10 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3805 } 3813 }
3806 } 3814 }
3807 3815
3816 /* adjust length to remove Ethernet CRC, this must be
3817 * done after the TBI_ACCEPT workaround above */
3818 length -= 4;
3819
3808 /* code added for copybreak, this should improve 3820 /* code added for copybreak, this should improve
3809 * performance for small packets with large amounts 3821 * performance for small packets with large amounts
3810 * of reassembly being done in the stack */ 3822 * of reassembly being done in the stack */
@@ -4773,8 +4785,9 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4773 pci_enable_wake(pdev, PCI_D3cold, 0); 4785 pci_enable_wake(pdev, PCI_D3cold, 0);
4774 } 4786 }
4775 4787
4776 if (adapter->hw.mac_type < e1000_82571 && 4788 if (adapter->hw.mac_type >= e1000_82540 &&
4777 adapter->hw.media_type == e1000_media_type_copper) { 4789 adapter->hw.mac_type < e1000_82571 &&
4790 adapter->hw.media_type == e1000_media_type_copper) {
4778 manc = E1000_READ_REG(&adapter->hw, MANC); 4791 manc = E1000_READ_REG(&adapter->hw, MANC);
4779 if (manc & E1000_MANC_SMBUS_EN) { 4792 if (manc & E1000_MANC_SMBUS_EN) {
4780 manc |= E1000_MANC_ARP_EN; 4793 manc |= E1000_MANC_ARP_EN;
@@ -4825,8 +4838,9 @@ e1000_resume(struct pci_dev *pdev)
4825 4838
4826 netif_device_attach(netdev); 4839 netif_device_attach(netdev);
4827 4840
4828 if (adapter->hw.mac_type < e1000_82571 && 4841 if (adapter->hw.mac_type >= e1000_82540 &&
4829 adapter->hw.media_type == e1000_media_type_copper) { 4842 adapter->hw.mac_type < e1000_82571 &&
4843 adapter->hw.media_type == e1000_media_type_copper) {
4830 manc = E1000_READ_REG(&adapter->hw, MANC); 4844 manc = E1000_READ_REG(&adapter->hw, MANC);
4831 manc &= ~(E1000_MANC_ARP_EN); 4845 manc &= ~(E1000_MANC_ARP_EN);
4832 E1000_WRITE_REG(&adapter->hw, MANC, manc); 4846 E1000_WRITE_REG(&adapter->hw, MANC, manc);
@@ -4944,6 +4958,7 @@ static void e1000_io_resume(struct pci_dev *pdev)
4944 netif_device_attach(netdev); 4958 netif_device_attach(netdev);
4945 4959
4946 if (adapter->hw.mac_type >= e1000_82540 && 4960 if (adapter->hw.mac_type >= e1000_82540 &&
4961 adapter->hw.mac_type < e1000_82571 &&
4947 adapter->hw.media_type == e1000_media_type_copper) { 4962 adapter->hw.media_type == e1000_media_type_copper) {
4948 manc = E1000_READ_REG(&adapter->hw, MANC); 4963 manc = E1000_READ_REG(&adapter->hw, MANC);
4949 manc &= ~(E1000_MANC_ARP_EN); 4964 manc &= ~(E1000_MANC_ARP_EN);
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index c44311ac2fd3..16167b016266 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -1807,8 +1807,8 @@ u8 acpiphp_get_power_status(struct acpiphp_slot *slot)
1807 1807
1808 1808
1809/* 1809/*
1810 * latch closed: 1 1810 * latch open: 1
1811 * latch open: 0 1811 * latch closed: 0
1812 */ 1812 */
1813u8 acpiphp_get_latch_status(struct acpiphp_slot *slot) 1813u8 acpiphp_get_latch_status(struct acpiphp_slot *slot)
1814{ 1814{
@@ -1816,7 +1816,7 @@ u8 acpiphp_get_latch_status(struct acpiphp_slot *slot)
1816 1816
1817 sta = get_slot_status(slot); 1817 sta = get_slot_status(slot);
1818 1818
1819 return (sta & ACPI_STA_SHOW_IN_UI) ? 1 : 0; 1819 return (sta & ACPI_STA_SHOW_IN_UI) ? 0 : 1;
1820} 1820}
1821 1821
1822 1822
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index b1c0c707d96c..194f1d21d3d7 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -265,6 +265,13 @@ static int pci_device_remove(struct device * dev)
265 } 265 }
266 266
267 /* 267 /*
268 * If the device is still on, set the power state as "unknown",
269 * since it might change by the next time we load the driver.
270 */
271 if (pci_dev->current_state == PCI_D0)
272 pci_dev->current_state = PCI_UNKNOWN;
273
274 /*
268 * We would love to complain here if pci_dev->is_enabled is set, that 275 * We would love to complain here if pci_dev->is_enabled is set, that
269 * the driver should have called pci_disable_device(), but the 276 * the driver should have called pci_disable_device(), but the
270 * unfortunate fact is there are too many odd BIOS and bridge setups 277 * unfortunate fact is there are too many odd BIOS and bridge setups
@@ -288,6 +295,12 @@ static int pci_device_suspend(struct device * dev, pm_message_t state)
288 suspend_report_result(drv->suspend, i); 295 suspend_report_result(drv->suspend, i);
289 } else { 296 } else {
290 pci_save_state(pci_dev); 297 pci_save_state(pci_dev);
298 /*
299 * mark its power state as "unknown", since we don't know if
300 * e.g. the BIOS will change its device state when we suspend.
301 */
302 if (pci_dev->current_state == PCI_D0)
303 pci_dev->current_state = PCI_UNKNOWN;
291 } 304 }
292 return i; 305 return i;
293} 306}
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index e8a7f1b1b2bc..204b1c8e972b 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -714,33 +714,6 @@ static void __devinit quirk_vt82c598_id(struct pci_dev *dev)
714} 714}
715DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id ); 715DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id );
716 716
717#ifdef CONFIG_ACPI_SLEEP
718
719/*
720 * Some VIA systems boot with the abnormal status flag set. This can cause
721 * the BIOS to re-POST the system on resume rather than passing control
722 * back to the OS. Clear the flag on boot
723 */
724static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev)
725{
726 u32 reg;
727
728 acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
729 &reg);
730
731 if (reg & 0x800) {
732 printk("Clearing abnormal poweroff flag\n");
733 acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
734 ACPI_REGISTER_PM1_STATUS,
735 (u16)0x800);
736 }
737}
738
739DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_abnormal_poweroff);
740DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_abnormal_poweroff);
741
742#endif
743
744/* 717/*
745 * CardBus controllers have a legacy base address that enables them 718 * CardBus controllers have a legacy base address that enables them
746 * to respond as i82365 pcmcia controllers. We don't want them to 719 * to respond as i82365 pcmcia controllers. We don't want them to
@@ -1619,52 +1592,6 @@ static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
1619} 1592}
1620DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); 1593DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
1621 1594
1622/*
1623 * Fixup to mark boot BIOS video selected by BIOS before it changes
1624 *
1625 * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
1626 *
1627 * The standard boot ROM sequence for an x86 machine uses the BIOS
1628 * to select an initial video card for boot display. This boot video
1629 * card will have it's BIOS copied to C0000 in system RAM.
1630 * IORESOURCE_ROM_SHADOW is used to associate the boot video
1631 * card with this copy. On laptops this copy has to be used since
1632 * the main ROM may be compressed or combined with another image.
1633 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
1634 * is marked here since the boot video device will be the only enabled
1635 * video device at this point.
1636 */
1637
1638static void __devinit fixup_video(struct pci_dev *pdev)
1639{
1640 struct pci_dev *bridge;
1641 struct pci_bus *bus;
1642 u16 config;
1643
1644 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
1645 return;
1646
1647 /* Is VGA routed to us? */
1648 bus = pdev->bus;
1649 while (bus) {
1650 bridge = bus->self;
1651 if (bridge) {
1652 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
1653 &config);
1654 if (!(config & PCI_BRIDGE_CTL_VGA))
1655 return;
1656 }
1657 bus = bus->parent;
1658 }
1659 pci_read_config_word(pdev, PCI_COMMAND, &config);
1660 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
1661 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
1662 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
1663 }
1664}
1665DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, fixup_video);
1666
1667
1668static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end) 1595static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end)
1669{ 1596{
1670 while (f < end) { 1597 while (f < end) {
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 43e4a49f2cc4..e1dcefc69bb4 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -72,8 +72,9 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
72 int last_image; 72 int last_image;
73 73
74 /* 74 /*
75 * IORESOURCE_ROM_SHADOW set if the VGA enable bit of the Bridge Control 75 * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy
76 * register is set for embedded VGA. 76 * memory map if the VGA enable bit of the Bridge Control register is
77 * set for embedded VGA.
77 */ 78 */
78 if (res->flags & IORESOURCE_ROM_SHADOW) { 79 if (res->flags & IORESOURCE_ROM_SHADOW) {
79 /* primary video rom always starts here */ 80 /* primary video rom always starts here */
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index a2dee5bf5a17..ad7f7e1c0163 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -271,10 +271,6 @@ static int css_evaluate_known_subchannel(struct subchannel *sch, int slow)
271 /* Reset intparm to zeroes. */ 271 /* Reset intparm to zeroes. */
272 sch->schib.pmcw.intparm = 0; 272 sch->schib.pmcw.intparm = 0;
273 cio_modify(sch); 273 cio_modify(sch);
274
275 /* Probe if necessary. */
276 if (action == UNREGISTER_PROBE)
277 ret = css_probe_device(sch->schid);
278 break; 274 break;
279 case REPROBE: 275 case REPROBE:
280 device_trigger_reprobe(sch); 276 device_trigger_reprobe(sch);
@@ -283,6 +279,9 @@ static int css_evaluate_known_subchannel(struct subchannel *sch, int slow)
283 break; 279 break;
284 } 280 }
285 spin_unlock_irqrestore(&sch->lock, flags); 281 spin_unlock_irqrestore(&sch->lock, flags);
282 /* Probe if necessary. */
283 if (action == UNREGISTER_PROBE)
284 ret = css_probe_device(sch->schid);
286 285
287 return ret; 286 return ret;
288} 287}
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 94bdd4d8a4c9..39c98f940507 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -532,8 +532,7 @@ device_remove_files(struct device *dev)
532 532
533/* this is a simple abstraction for device_register that sets the 533/* this is a simple abstraction for device_register that sets the
534 * correct bus type and adds the bus specific files */ 534 * correct bus type and adds the bus specific files */
535int 535static int ccw_device_register(struct ccw_device *cdev)
536ccw_device_register(struct ccw_device *cdev)
537{ 536{
538 struct device *dev = &cdev->dev; 537 struct device *dev = &cdev->dev;
539 int ret; 538 int ret;
diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h
index c6140cc97a80..9233b5c0bcc8 100644
--- a/drivers/s390/cio/device.h
+++ b/drivers/s390/cio/device.h
@@ -78,7 +78,6 @@ void io_subchannel_recog_done(struct ccw_device *cdev);
78 78
79int ccw_device_cancel_halt_clear(struct ccw_device *); 79int ccw_device_cancel_halt_clear(struct ccw_device *);
80 80
81int ccw_device_register(struct ccw_device *);
82void ccw_device_do_unreg_rereg(void *); 81void ccw_device_do_unreg_rereg(void *);
83void ccw_device_call_sch_unregister(void *); 82void ccw_device_call_sch_unregister(void *);
84 83
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index c5ccd20b110c..79d89c368919 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -739,11 +739,16 @@ static void ap_scan_bus(void *data)
739 dev = bus_find_device(&ap_bus_type, NULL, 739 dev = bus_find_device(&ap_bus_type, NULL,
740 (void *)(unsigned long)qid, 740 (void *)(unsigned long)qid,
741 __ap_scan_bus); 741 __ap_scan_bus);
742 rc = ap_query_queue(qid, &queue_depth, &device_type);
743 if (dev && rc) {
744 put_device(dev);
745 device_unregister(dev);
746 continue;
747 }
742 if (dev) { 748 if (dev) {
743 put_device(dev); 749 put_device(dev);
744 continue; 750 continue;
745 } 751 }
746 rc = ap_query_queue(qid, &queue_depth, &device_type);
747 if (rc) 752 if (rc)
748 continue; 753 continue;
749 rc = ap_init_queue(qid); 754 rc = ap_init_queue(qid);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 8f882690994d..74c0eac083e4 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -107,6 +107,10 @@ zfcp_address_to_sg(void *address, struct scatterlist *list)
107 (ZFCP_MAX_SBALS_PER_REQ * ZFCP_MAX_SBALES_PER_SBAL - 2) 107 (ZFCP_MAX_SBALS_PER_REQ * ZFCP_MAX_SBALES_PER_SBAL - 2)
108 /* request ID + QTCB in SBALE 0 + 1 of first SBAL in chain */ 108 /* request ID + QTCB in SBALE 0 + 1 of first SBAL in chain */
109 109
110#define ZFCP_MAX_SECTORS (ZFCP_MAX_SBALES_PER_REQ * 8)
111 /* max. number of (data buffer) SBALEs in largest SBAL chain
112 multiplied with number of sectors per 4k block */
113
110/* FIXME(tune): free space should be one max. SBAL chain plus what? */ 114/* FIXME(tune): free space should be one max. SBAL chain plus what? */
111#define ZFCP_QDIO_PCI_INTERVAL (QDIO_MAX_BUFFERS_PER_Q \ 115#define ZFCP_QDIO_PCI_INTERVAL (QDIO_MAX_BUFFERS_PER_Q \
112 - (ZFCP_MAX_SBALS_PER_REQ + 4)) 116 - (ZFCP_MAX_SBALS_PER_REQ + 4))
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 4d2bc7981324..452d96f92a14 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -58,6 +58,7 @@ struct zfcp_data zfcp_data = {
58 .cmd_per_lun = 1, 58 .cmd_per_lun = 1,
59 .use_clustering = 1, 59 .use_clustering = 1,
60 .sdev_attrs = zfcp_sysfs_sdev_attrs, 60 .sdev_attrs = zfcp_sysfs_sdev_attrs,
61 .max_sectors = ZFCP_MAX_SECTORS,
61 }, 62 },
62 .driver_version = ZFCP_VERSION, 63 .driver_version = ZFCP_VERSION,
63}; 64};
diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c
index 935952ef88f1..98fcbb3d5560 100644
--- a/drivers/sbus/sbus.c
+++ b/drivers/sbus/sbus.c
@@ -61,11 +61,11 @@ static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sde
61 else 61 else
62 sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev; 62 sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev;
63 sdev->ofdev.dev.bus = &sbus_bus_type; 63 sdev->ofdev.dev.bus = &sbus_bus_type;
64 strcpy(sdev->ofdev.dev.bus_id, dp->path_component_name); 64 sprintf(sdev->ofdev.dev.bus_id, "sbus[%08x]", dp->node);
65 65
66 if (of_device_register(&sdev->ofdev) != 0) 66 if (of_device_register(&sdev->ofdev) != 0)
67 printk(KERN_DEBUG "sbus: device registration error for %s!\n", 67 printk(KERN_DEBUG "sbus: device registration error for %s!\n",
68 sdev->ofdev.dev.bus_id); 68 dp->path_component_name);
69} 69}
70 70
71static void __init sbus_bus_ranges_init(struct device_node *dp, struct sbus_bus *sbus) 71static void __init sbus_bus_ranges_init(struct device_node *dp, struct sbus_bus *sbus)
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
index df3346b5caf8..170a4344cbb2 100644
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -53,14 +53,6 @@ struct ahd_platform_data;
53struct scb_platform_data; 53struct scb_platform_data;
54 54
55/****************************** Useful Macros *********************************/ 55/****************************** Useful Macros *********************************/
56#ifndef MAX
57#define MAX(a,b) (((a) > (b)) ? (a) : (b))
58#endif
59
60#ifndef MIN
61#define MIN(a,b) (((a) < (b)) ? (a) : (b))
62#endif
63
64#ifndef TRUE 56#ifndef TRUE
65#define TRUE 1 57#define TRUE 1
66#endif 58#endif
@@ -972,8 +964,6 @@ int ahd_read_seeprom(struct ahd_softc *ahd, uint16_t *buf,
972 964
973int ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf, 965int ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf,
974 u_int start_addr, u_int count); 966 u_int start_addr, u_int count);
975int ahd_wait_seeprom(struct ahd_softc *ahd);
976int ahd_verify_vpd_cksum(struct vpd_config *vpd);
977int ahd_verify_cksum(struct seeprom_config *sc); 967int ahd_verify_cksum(struct seeprom_config *sc);
978int ahd_acquire_seeprom(struct ahd_softc *ahd); 968int ahd_acquire_seeprom(struct ahd_softc *ahd);
979void ahd_release_seeprom(struct ahd_softc *ahd); 969void ahd_release_seeprom(struct ahd_softc *ahd);
@@ -1320,8 +1310,6 @@ struct ahd_pci_identity {
1320 char *name; 1310 char *name;
1321 ahd_device_setup_t *setup; 1311 ahd_device_setup_t *setup;
1322}; 1312};
1323extern struct ahd_pci_identity ahd_pci_ident_table [];
1324extern const u_int ahd_num_pci_devs;
1325 1313
1326/***************************** VL/EISA Declarations ***************************/ 1314/***************************** VL/EISA Declarations ***************************/
1327struct aic7770_identity { 1315struct aic7770_identity {
@@ -1339,15 +1327,6 @@ extern const int ahd_num_aic7770_devs;
1339/*************************** Function Declarations ****************************/ 1327/*************************** Function Declarations ****************************/
1340/******************************************************************************/ 1328/******************************************************************************/
1341void ahd_reset_cmds_pending(struct ahd_softc *ahd); 1329void ahd_reset_cmds_pending(struct ahd_softc *ahd);
1342u_int ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl);
1343void ahd_busy_tcl(struct ahd_softc *ahd,
1344 u_int tcl, u_int busyid);
1345static __inline void ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl);
1346static __inline void
1347ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl)
1348{
1349 ahd_busy_tcl(ahd, tcl, SCB_LIST_NULL);
1350}
1351 1330
1352/***************************** PCI Front End *********************************/ 1331/***************************** PCI Front End *********************************/
1353struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t); 1332struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t);
@@ -1356,7 +1335,6 @@ int ahd_pci_config(struct ahd_softc *,
1356int ahd_pci_test_register_access(struct ahd_softc *); 1335int ahd_pci_test_register_access(struct ahd_softc *);
1357 1336
1358/************************** SCB and SCB queue management **********************/ 1337/************************** SCB and SCB queue management **********************/
1359int ahd_probe_scbs(struct ahd_softc *);
1360void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, 1338void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd,
1361 struct scb *scb); 1339 struct scb *scb);
1362int ahd_match_scb(struct ahd_softc *ahd, struct scb *scb, 1340int ahd_match_scb(struct ahd_softc *ahd, struct scb *scb,
@@ -1374,33 +1352,20 @@ int ahd_parse_vpddata(struct ahd_softc *ahd,
1374int ahd_parse_cfgdata(struct ahd_softc *ahd, 1352int ahd_parse_cfgdata(struct ahd_softc *ahd,
1375 struct seeprom_config *sc); 1353 struct seeprom_config *sc);
1376void ahd_intr_enable(struct ahd_softc *ahd, int enable); 1354void ahd_intr_enable(struct ahd_softc *ahd, int enable);
1377void ahd_update_coalescing_values(struct ahd_softc *ahd,
1378 u_int timer,
1379 u_int maxcmds,
1380 u_int mincmds);
1381void ahd_enable_coalescing(struct ahd_softc *ahd,
1382 int enable);
1383void ahd_pause_and_flushwork(struct ahd_softc *ahd); 1355void ahd_pause_and_flushwork(struct ahd_softc *ahd);
1384int ahd_suspend(struct ahd_softc *ahd); 1356int ahd_suspend(struct ahd_softc *ahd);
1385int ahd_resume(struct ahd_softc *ahd);
1386void ahd_set_unit(struct ahd_softc *, int); 1357void ahd_set_unit(struct ahd_softc *, int);
1387void ahd_set_name(struct ahd_softc *, char *); 1358void ahd_set_name(struct ahd_softc *, char *);
1388struct scb *ahd_get_scb(struct ahd_softc *ahd, u_int col_idx); 1359struct scb *ahd_get_scb(struct ahd_softc *ahd, u_int col_idx);
1389void ahd_free_scb(struct ahd_softc *ahd, struct scb *scb); 1360void ahd_free_scb(struct ahd_softc *ahd, struct scb *scb);
1390void ahd_alloc_scbs(struct ahd_softc *ahd);
1391void ahd_free(struct ahd_softc *ahd); 1361void ahd_free(struct ahd_softc *ahd);
1392int ahd_reset(struct ahd_softc *ahd, int reinit); 1362int ahd_reset(struct ahd_softc *ahd, int reinit);
1393void ahd_shutdown(void *arg);
1394int ahd_write_flexport(struct ahd_softc *ahd, 1363int ahd_write_flexport(struct ahd_softc *ahd,
1395 u_int addr, u_int value); 1364 u_int addr, u_int value);
1396int ahd_read_flexport(struct ahd_softc *ahd, u_int addr, 1365int ahd_read_flexport(struct ahd_softc *ahd, u_int addr,
1397 uint8_t *value); 1366 uint8_t *value);
1398int ahd_wait_flexport(struct ahd_softc *ahd);
1399 1367
1400/*************************** Interrupt Services *******************************/ 1368/*************************** Interrupt Services *******************************/
1401void ahd_pci_intr(struct ahd_softc *ahd);
1402void ahd_clear_intstat(struct ahd_softc *ahd);
1403void ahd_flush_qoutfifo(struct ahd_softc *ahd);
1404void ahd_run_qoutfifo(struct ahd_softc *ahd); 1369void ahd_run_qoutfifo(struct ahd_softc *ahd);
1405#ifdef AHD_TARGET_MODE 1370#ifdef AHD_TARGET_MODE
1406void ahd_run_tqinfifo(struct ahd_softc *ahd, int paused); 1371void ahd_run_tqinfifo(struct ahd_softc *ahd, int paused);
@@ -1409,7 +1374,6 @@ void ahd_handle_hwerrint(struct ahd_softc *ahd);
1409void ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat); 1374void ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat);
1410void ahd_handle_scsiint(struct ahd_softc *ahd, 1375void ahd_handle_scsiint(struct ahd_softc *ahd,
1411 u_int intstat); 1376 u_int intstat);
1412void ahd_clear_critical_section(struct ahd_softc *ahd);
1413 1377
1414/***************************** Error Recovery *********************************/ 1378/***************************** Error Recovery *********************************/
1415typedef enum { 1379typedef enum {
@@ -1426,23 +1390,9 @@ int ahd_search_disc_list(struct ahd_softc *ahd, int target,
1426 char channel, int lun, u_int tag, 1390 char channel, int lun, u_int tag,
1427 int stop_on_first, int remove, 1391 int stop_on_first, int remove,
1428 int save_state); 1392 int save_state);
1429void ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb);
1430int ahd_reset_channel(struct ahd_softc *ahd, char channel, 1393int ahd_reset_channel(struct ahd_softc *ahd, char channel,
1431 int initiate_reset); 1394 int initiate_reset);
1432int ahd_abort_scbs(struct ahd_softc *ahd, int target,
1433 char channel, int lun, u_int tag,
1434 role_t role, uint32_t status);
1435void ahd_restart(struct ahd_softc *ahd);
1436void ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo);
1437void ahd_handle_scb_status(struct ahd_softc *ahd,
1438 struct scb *scb);
1439void ahd_handle_scsi_status(struct ahd_softc *ahd,
1440 struct scb *scb);
1441void ahd_calc_residual(struct ahd_softc *ahd,
1442 struct scb *scb);
1443/*************************** Utility Functions ********************************/ 1395/*************************** Utility Functions ********************************/
1444struct ahd_phase_table_entry*
1445 ahd_lookup_phase_entry(int phase);
1446void ahd_compile_devinfo(struct ahd_devinfo *devinfo, 1396void ahd_compile_devinfo(struct ahd_devinfo *devinfo,
1447 u_int our_id, u_int target, 1397 u_int our_id, u_int target,
1448 u_int lun, char channel, 1398 u_int lun, char channel,
@@ -1450,14 +1400,6 @@ void ahd_compile_devinfo(struct ahd_devinfo *devinfo,
1450/************************** Transfer Negotiation ******************************/ 1400/************************** Transfer Negotiation ******************************/
1451void ahd_find_syncrate(struct ahd_softc *ahd, u_int *period, 1401void ahd_find_syncrate(struct ahd_softc *ahd, u_int *period,
1452 u_int *ppr_options, u_int maxsync); 1402 u_int *ppr_options, u_int maxsync);
1453void ahd_validate_offset(struct ahd_softc *ahd,
1454 struct ahd_initiator_tinfo *tinfo,
1455 u_int period, u_int *offset,
1456 int wide, role_t role);
1457void ahd_validate_width(struct ahd_softc *ahd,
1458 struct ahd_initiator_tinfo *tinfo,
1459 u_int *bus_width,
1460 role_t role);
1461/* 1403/*
1462 * Negotiation types. These are used to qualify if we should renegotiate 1404 * Negotiation types. These are used to qualify if we should renegotiate
1463 * even if our goal and current transport parameters are identical. 1405 * even if our goal and current transport parameters are identical.
@@ -1486,11 +1428,6 @@ typedef enum {
1486 AHD_QUEUE_TAGGED 1428 AHD_QUEUE_TAGGED
1487} ahd_queue_alg; 1429} ahd_queue_alg;
1488 1430
1489void ahd_set_tags(struct ahd_softc *ahd,
1490 struct scsi_cmnd *cmd,
1491 struct ahd_devinfo *devinfo,
1492 ahd_queue_alg alg);
1493
1494/**************************** Target Mode *************************************/ 1431/**************************** Target Mode *************************************/
1495#ifdef AHD_TARGET_MODE 1432#ifdef AHD_TARGET_MODE
1496void ahd_send_lstate_events(struct ahd_softc *, 1433void ahd_send_lstate_events(struct ahd_softc *,
@@ -1528,10 +1465,8 @@ extern uint32_t ahd_debug;
1528#define AHD_SHOW_INT_COALESCING 0x10000 1465#define AHD_SHOW_INT_COALESCING 0x10000
1529#define AHD_DEBUG_SEQUENCER 0x20000 1466#define AHD_DEBUG_SEQUENCER 0x20000
1530#endif 1467#endif
1531void ahd_print_scb(struct scb *scb);
1532void ahd_print_devinfo(struct ahd_softc *ahd, 1468void ahd_print_devinfo(struct ahd_softc *ahd,
1533 struct ahd_devinfo *devinfo); 1469 struct ahd_devinfo *devinfo);
1534void ahd_dump_sglist(struct scb *scb);
1535void ahd_dump_card_state(struct ahd_softc *ahd); 1470void ahd_dump_card_state(struct ahd_softc *ahd);
1536int ahd_print_register(ahd_reg_parse_entry_t *table, 1471int ahd_print_register(ahd_reg_parse_entry_t *table,
1537 u_int num_entries, 1472 u_int num_entries,
@@ -1540,5 +1475,4 @@ int ahd_print_register(ahd_reg_parse_entry_t *table,
1540 u_int value, 1475 u_int value,
1541 u_int *cur_column, 1476 u_int *cur_column,
1542 u_int wrap_point); 1477 u_int wrap_point);
1543void ahd_dump_scbs(struct ahd_softc *ahd);
1544#endif /* _AIC79XX_H_ */ 1478#endif /* _AIC79XX_H_ */
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 653818d2f802..07a86a30f676 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -52,7 +52,7 @@
52 52
53 53
54/***************************** Lookup Tables **********************************/ 54/***************************** Lookup Tables **********************************/
55char *ahd_chip_names[] = 55static char *ahd_chip_names[] =
56{ 56{
57 "NONE", 57 "NONE",
58 "aic7901", 58 "aic7901",
@@ -237,10 +237,33 @@ static int ahd_handle_target_cmd(struct ahd_softc *ahd,
237 struct target_cmd *cmd); 237 struct target_cmd *cmd);
238#endif 238#endif
239 239
240static int ahd_abort_scbs(struct ahd_softc *ahd, int target,
241 char channel, int lun, u_int tag,
242 role_t role, uint32_t status);
243static void ahd_alloc_scbs(struct ahd_softc *ahd);
244static void ahd_busy_tcl(struct ahd_softc *ahd, u_int tcl,
245 u_int scbid);
246static void ahd_calc_residual(struct ahd_softc *ahd,
247 struct scb *scb);
248static void ahd_clear_critical_section(struct ahd_softc *ahd);
249static void ahd_clear_intstat(struct ahd_softc *ahd);
250static void ahd_enable_coalescing(struct ahd_softc *ahd,
251 int enable);
252static u_int ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl);
253static void ahd_freeze_devq(struct ahd_softc *ahd,
254 struct scb *scb);
255static void ahd_handle_scb_status(struct ahd_softc *ahd,
256 struct scb *scb);
257static struct ahd_phase_table_entry* ahd_lookup_phase_entry(int phase);
258static void ahd_shutdown(void *arg);
259static void ahd_update_coalescing_values(struct ahd_softc *ahd,
260 u_int timer,
261 u_int maxcmds,
262 u_int mincmds);
263static int ahd_verify_vpd_cksum(struct vpd_config *vpd);
264static int ahd_wait_seeprom(struct ahd_softc *ahd);
265
240/******************************** Private Inlines *****************************/ 266/******************************** Private Inlines *****************************/
241static __inline void ahd_assert_atn(struct ahd_softc *ahd);
242static __inline int ahd_currently_packetized(struct ahd_softc *ahd);
243static __inline int ahd_set_active_fifo(struct ahd_softc *ahd);
244 267
245static __inline void 268static __inline void
246ahd_assert_atn(struct ahd_softc *ahd) 269ahd_assert_atn(struct ahd_softc *ahd)
@@ -294,11 +317,44 @@ ahd_set_active_fifo(struct ahd_softc *ahd)
294 } 317 }
295} 318}
296 319
320static __inline void
321ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl)
322{
323 ahd_busy_tcl(ahd, tcl, SCB_LIST_NULL);
324}
325
326/*
327 * Determine whether the sequencer reported a residual
328 * for this SCB/transaction.
329 */
330static __inline void
331ahd_update_residual(struct ahd_softc *ahd, struct scb *scb)
332{
333 uint32_t sgptr;
334
335 sgptr = ahd_le32toh(scb->hscb->sgptr);
336 if ((sgptr & SG_STATUS_VALID) != 0)
337 ahd_calc_residual(ahd, scb);
338}
339
340static __inline void
341ahd_complete_scb(struct ahd_softc *ahd, struct scb *scb)
342{
343 uint32_t sgptr;
344
345 sgptr = ahd_le32toh(scb->hscb->sgptr);
346 if ((sgptr & SG_STATUS_VALID) != 0)
347 ahd_handle_scb_status(ahd, scb);
348 else
349 ahd_done(ahd, scb);
350}
351
352
297/************************* Sequencer Execution Control ************************/ 353/************************* Sequencer Execution Control ************************/
298/* 354/*
299 * Restart the sequencer program from address zero 355 * Restart the sequencer program from address zero
300 */ 356 */
301void 357static void
302ahd_restart(struct ahd_softc *ahd) 358ahd_restart(struct ahd_softc *ahd)
303{ 359{
304 360
@@ -342,7 +398,7 @@ ahd_restart(struct ahd_softc *ahd)
342 ahd_unpause(ahd); 398 ahd_unpause(ahd);
343} 399}
344 400
345void 401static void
346ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo) 402ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo)
347{ 403{
348 ahd_mode_state saved_modes; 404 ahd_mode_state saved_modes;
@@ -366,7 +422,7 @@ ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo)
366 * Flush and completed commands that are sitting in the command 422 * Flush and completed commands that are sitting in the command
367 * complete queues down on the chip but have yet to be dma'ed back up. 423 * complete queues down on the chip but have yet to be dma'ed back up.
368 */ 424 */
369void 425static void
370ahd_flush_qoutfifo(struct ahd_softc *ahd) 426ahd_flush_qoutfifo(struct ahd_softc *ahd)
371{ 427{
372 struct scb *scb; 428 struct scb *scb;
@@ -905,6 +961,51 @@ ahd_handle_hwerrint(struct ahd_softc *ahd)
905 ahd_free(ahd); 961 ahd_free(ahd);
906} 962}
907 963
964#ifdef AHD_DEBUG
965static void
966ahd_dump_sglist(struct scb *scb)
967{
968 int i;
969
970 if (scb->sg_count > 0) {
971 if ((scb->ahd_softc->flags & AHD_64BIT_ADDRESSING) != 0) {
972 struct ahd_dma64_seg *sg_list;
973
974 sg_list = (struct ahd_dma64_seg*)scb->sg_list;
975 for (i = 0; i < scb->sg_count; i++) {
976 uint64_t addr;
977 uint32_t len;
978
979 addr = ahd_le64toh(sg_list[i].addr);
980 len = ahd_le32toh(sg_list[i].len);
981 printf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
982 i,
983 (uint32_t)((addr >> 32) & 0xFFFFFFFF),
984 (uint32_t)(addr & 0xFFFFFFFF),
985 sg_list[i].len & AHD_SG_LEN_MASK,
986 (sg_list[i].len & AHD_DMA_LAST_SEG)
987 ? " Last" : "");
988 }
989 } else {
990 struct ahd_dma_seg *sg_list;
991
992 sg_list = (struct ahd_dma_seg*)scb->sg_list;
993 for (i = 0; i < scb->sg_count; i++) {
994 uint32_t len;
995
996 len = ahd_le32toh(sg_list[i].len);
997 printf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
998 i,
999 (len & AHD_SG_HIGH_ADDR_MASK) >> 24,
1000 ahd_le32toh(sg_list[i].addr),
1001 len & AHD_SG_LEN_MASK,
1002 len & AHD_DMA_LAST_SEG ? " Last" : "");
1003 }
1004 }
1005 }
1006}
1007#endif /* AHD_DEBUG */
1008
908void 1009void
909ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) 1010ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
910{ 1011{
@@ -1053,10 +1154,12 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
1053 * If a target takes us into the command phase 1154 * If a target takes us into the command phase
1054 * assume that it has been externally reset and 1155 * assume that it has been externally reset and
1055 * has thus lost our previous packetized negotiation 1156 * has thus lost our previous packetized negotiation
1056 * agreement. 1157 * agreement. Since we have not sent an identify
1057 * Revert to async/narrow transfers until we 1158 * message and may not have fully qualified the
1058 * can renegotiate with the device and notify 1159 * connection, we change our command to TUR, assert
1059 * the OSM about the reset. 1160 * ATN and ABORT the task when we go to message in
1161 * phase. The OSM will see the REQUEUE_REQUEST
1162 * status and retry the command.
1060 */ 1163 */
1061 scbid = ahd_get_scbptr(ahd); 1164 scbid = ahd_get_scbptr(ahd);
1062 scb = ahd_lookup_scb(ahd, scbid); 1165 scb = ahd_lookup_scb(ahd, scbid);
@@ -1083,7 +1186,28 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
1083 ahd_set_syncrate(ahd, &devinfo, /*period*/0, 1186 ahd_set_syncrate(ahd, &devinfo, /*period*/0,
1084 /*offset*/0, /*ppr_options*/0, 1187 /*offset*/0, /*ppr_options*/0,
1085 AHD_TRANS_ACTIVE, /*paused*/TRUE); 1188 AHD_TRANS_ACTIVE, /*paused*/TRUE);
1086 scb->flags |= SCB_EXTERNAL_RESET; 1189 /* Hand-craft TUR command */
1190 ahd_outb(ahd, SCB_CDB_STORE, 0);
1191 ahd_outb(ahd, SCB_CDB_STORE+1, 0);
1192 ahd_outb(ahd, SCB_CDB_STORE+2, 0);
1193 ahd_outb(ahd, SCB_CDB_STORE+3, 0);
1194 ahd_outb(ahd, SCB_CDB_STORE+4, 0);
1195 ahd_outb(ahd, SCB_CDB_STORE+5, 0);
1196 ahd_outb(ahd, SCB_CDB_LEN, 6);
1197 scb->hscb->control &= ~(TAG_ENB|SCB_TAG_TYPE);
1198 scb->hscb->control |= MK_MESSAGE;
1199 ahd_outb(ahd, SCB_CONTROL, scb->hscb->control);
1200 ahd_outb(ahd, MSG_OUT, HOST_MSG);
1201 ahd_outb(ahd, SAVED_SCSIID, scb->hscb->scsiid);
1202 /*
1203 * The lun is 0, regardless of the SCB's lun
1204 * as we have not sent an identify message.
1205 */
1206 ahd_outb(ahd, SAVED_LUN, 0);
1207 ahd_outb(ahd, SEQ_FLAGS, 0);
1208 ahd_assert_atn(ahd);
1209 scb->flags &= ~SCB_PACKETIZED;
1210 scb->flags |= SCB_ABORT|SCB_EXTERNAL_RESET;
1087 ahd_freeze_devq(ahd, scb); 1211 ahd_freeze_devq(ahd, scb);
1088 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ); 1212 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ);
1089 ahd_freeze_scb(scb); 1213 ahd_freeze_scb(scb);
@@ -1519,8 +1643,10 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat)
1519 /* 1643 /*
1520 * Ignore external resets after a bus reset. 1644 * Ignore external resets after a bus reset.
1521 */ 1645 */
1522 if (((status & SCSIRSTI) != 0) && (ahd->flags & AHD_BUS_RESET_ACTIVE)) 1646 if (((status & SCSIRSTI) != 0) && (ahd->flags & AHD_BUS_RESET_ACTIVE)) {
1647 ahd_outb(ahd, CLRSINT1, CLRSCSIRSTI);
1523 return; 1648 return;
1649 }
1524 1650
1525 /* 1651 /*
1526 * Clear bus reset flag 1652 * Clear bus reset flag
@@ -2200,6 +2326,22 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)
2200 if (sent_msg == MSG_ABORT_TAG) 2326 if (sent_msg == MSG_ABORT_TAG)
2201 tag = SCB_GET_TAG(scb); 2327 tag = SCB_GET_TAG(scb);
2202 2328
2329 if ((scb->flags & SCB_EXTERNAL_RESET) != 0) {
2330 /*
2331 * This abort is in response to an
2332 * unexpected switch to command phase
2333 * for a packetized connection. Since
2334 * the identify message was never sent,
2335 * "saved lun" is 0. We really want to
2336 * abort only the SCB that encountered
2337 * this error, which could have a different
2338 * lun. The SCB will be retried so the OS
2339 * will see the UA after renegotiating to
2340 * packetized.
2341 */
2342 tag = SCB_GET_TAG(scb);
2343 saved_lun = scb->hscb->lun;
2344 }
2203 found = ahd_abort_scbs(ahd, target, 'A', saved_lun, 2345 found = ahd_abort_scbs(ahd, target, 'A', saved_lun,
2204 tag, ROLE_INITIATOR, 2346 tag, ROLE_INITIATOR,
2205 CAM_REQ_ABORTED); 2347 CAM_REQ_ABORTED);
@@ -2523,7 +2665,7 @@ ahd_force_renegotiation(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
2523} 2665}
2524 2666
2525#define AHD_MAX_STEPS 2000 2667#define AHD_MAX_STEPS 2000
2526void 2668static void
2527ahd_clear_critical_section(struct ahd_softc *ahd) 2669ahd_clear_critical_section(struct ahd_softc *ahd)
2528{ 2670{
2529 ahd_mode_state saved_modes; 2671 ahd_mode_state saved_modes;
@@ -2646,7 +2788,7 @@ ahd_clear_critical_section(struct ahd_softc *ahd)
2646/* 2788/*
2647 * Clear any pending interrupt status. 2789 * Clear any pending interrupt status.
2648 */ 2790 */
2649void 2791static void
2650ahd_clear_intstat(struct ahd_softc *ahd) 2792ahd_clear_intstat(struct ahd_softc *ahd)
2651{ 2793{
2652 AHD_ASSERT_MODES(ahd, ~(AHD_MODE_UNKNOWN_MSK|AHD_MODE_CFG_MSK), 2794 AHD_ASSERT_MODES(ahd, ~(AHD_MODE_UNKNOWN_MSK|AHD_MODE_CFG_MSK),
@@ -2677,6 +2819,8 @@ ahd_clear_intstat(struct ahd_softc *ahd)
2677#ifdef AHD_DEBUG 2819#ifdef AHD_DEBUG
2678uint32_t ahd_debug = AHD_DEBUG_OPTS; 2820uint32_t ahd_debug = AHD_DEBUG_OPTS;
2679#endif 2821#endif
2822
2823#if 0
2680void 2824void
2681ahd_print_scb(struct scb *scb) 2825ahd_print_scb(struct scb *scb)
2682{ 2826{
@@ -2701,49 +2845,7 @@ ahd_print_scb(struct scb *scb)
2701 SCB_GET_TAG(scb)); 2845 SCB_GET_TAG(scb));
2702 ahd_dump_sglist(scb); 2846 ahd_dump_sglist(scb);
2703} 2847}
2704 2848#endif /* 0 */
2705void
2706ahd_dump_sglist(struct scb *scb)
2707{
2708 int i;
2709
2710 if (scb->sg_count > 0) {
2711 if ((scb->ahd_softc->flags & AHD_64BIT_ADDRESSING) != 0) {
2712 struct ahd_dma64_seg *sg_list;
2713
2714 sg_list = (struct ahd_dma64_seg*)scb->sg_list;
2715 for (i = 0; i < scb->sg_count; i++) {
2716 uint64_t addr;
2717 uint32_t len;
2718
2719 addr = ahd_le64toh(sg_list[i].addr);
2720 len = ahd_le32toh(sg_list[i].len);
2721 printf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
2722 i,
2723 (uint32_t)((addr >> 32) & 0xFFFFFFFF),
2724 (uint32_t)(addr & 0xFFFFFFFF),
2725 sg_list[i].len & AHD_SG_LEN_MASK,
2726 (sg_list[i].len & AHD_DMA_LAST_SEG)
2727 ? " Last" : "");
2728 }
2729 } else {
2730 struct ahd_dma_seg *sg_list;
2731
2732 sg_list = (struct ahd_dma_seg*)scb->sg_list;
2733 for (i = 0; i < scb->sg_count; i++) {
2734 uint32_t len;
2735
2736 len = ahd_le32toh(sg_list[i].len);
2737 printf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
2738 i,
2739 (len & AHD_SG_HIGH_ADDR_MASK) >> 24,
2740 ahd_le32toh(sg_list[i].addr),
2741 len & AHD_SG_LEN_MASK,
2742 len & AHD_DMA_LAST_SEG ? " Last" : "");
2743 }
2744 }
2745 }
2746}
2747 2849
2748/************************* Transfer Negotiation *******************************/ 2850/************************* Transfer Negotiation *******************************/
2749/* 2851/*
@@ -2850,14 +2952,14 @@ ahd_devlimited_syncrate(struct ahd_softc *ahd,
2850 transinfo = &tinfo->goal; 2952 transinfo = &tinfo->goal;
2851 *ppr_options &= (transinfo->ppr_options|MSG_EXT_PPR_PCOMP_EN); 2953 *ppr_options &= (transinfo->ppr_options|MSG_EXT_PPR_PCOMP_EN);
2852 if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { 2954 if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) {
2853 maxsync = MAX(maxsync, AHD_SYNCRATE_ULTRA2); 2955 maxsync = max(maxsync, (u_int)AHD_SYNCRATE_ULTRA2);
2854 *ppr_options &= ~MSG_EXT_PPR_DT_REQ; 2956 *ppr_options &= ~MSG_EXT_PPR_DT_REQ;
2855 } 2957 }
2856 if (transinfo->period == 0) { 2958 if (transinfo->period == 0) {
2857 *period = 0; 2959 *period = 0;
2858 *ppr_options = 0; 2960 *ppr_options = 0;
2859 } else { 2961 } else {
2860 *period = MAX(*period, transinfo->period); 2962 *period = max(*period, (u_int)transinfo->period);
2861 ahd_find_syncrate(ahd, period, ppr_options, maxsync); 2963 ahd_find_syncrate(ahd, period, ppr_options, maxsync);
2862 } 2964 }
2863} 2965}
@@ -2906,7 +3008,7 @@ ahd_find_syncrate(struct ahd_softc *ahd, u_int *period,
2906 * Truncate the given synchronous offset to a value the 3008 * Truncate the given synchronous offset to a value the
2907 * current adapter type and syncrate are capable of. 3009 * current adapter type and syncrate are capable of.
2908 */ 3010 */
2909void 3011static void
2910ahd_validate_offset(struct ahd_softc *ahd, 3012ahd_validate_offset(struct ahd_softc *ahd,
2911 struct ahd_initiator_tinfo *tinfo, 3013 struct ahd_initiator_tinfo *tinfo,
2912 u_int period, u_int *offset, int wide, 3014 u_int period, u_int *offset, int wide,
@@ -2924,12 +3026,12 @@ ahd_validate_offset(struct ahd_softc *ahd,
2924 maxoffset = MAX_OFFSET_PACED; 3026 maxoffset = MAX_OFFSET_PACED;
2925 } else 3027 } else
2926 maxoffset = MAX_OFFSET_NON_PACED; 3028 maxoffset = MAX_OFFSET_NON_PACED;
2927 *offset = MIN(*offset, maxoffset); 3029 *offset = min(*offset, maxoffset);
2928 if (tinfo != NULL) { 3030 if (tinfo != NULL) {
2929 if (role == ROLE_TARGET) 3031 if (role == ROLE_TARGET)
2930 *offset = MIN(*offset, tinfo->user.offset); 3032 *offset = min(*offset, (u_int)tinfo->user.offset);
2931 else 3033 else
2932 *offset = MIN(*offset, tinfo->goal.offset); 3034 *offset = min(*offset, (u_int)tinfo->goal.offset);
2933 } 3035 }
2934} 3036}
2935 3037
@@ -2937,7 +3039,7 @@ ahd_validate_offset(struct ahd_softc *ahd,
2937 * Truncate the given transfer width parameter to a value the 3039 * Truncate the given transfer width parameter to a value the
2938 * current adapter type is capable of. 3040 * current adapter type is capable of.
2939 */ 3041 */
2940void 3042static void
2941ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo, 3043ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo,
2942 u_int *bus_width, role_t role) 3044 u_int *bus_width, role_t role)
2943{ 3045{
@@ -2955,9 +3057,9 @@ ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo,
2955 } 3057 }
2956 if (tinfo != NULL) { 3058 if (tinfo != NULL) {
2957 if (role == ROLE_TARGET) 3059 if (role == ROLE_TARGET)
2958 *bus_width = MIN(tinfo->user.width, *bus_width); 3060 *bus_width = min((u_int)tinfo->user.width, *bus_width);
2959 else 3061 else
2960 *bus_width = MIN(tinfo->goal.width, *bus_width); 3062 *bus_width = min((u_int)tinfo->goal.width, *bus_width);
2961 } 3063 }
2962} 3064}
2963 3065
@@ -3210,7 +3312,7 @@ ahd_set_width(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
3210/* 3312/*
3211 * Update the current state of tagged queuing for a given target. 3313 * Update the current state of tagged queuing for a given target.
3212 */ 3314 */
3213void 3315static void
3214ahd_set_tags(struct ahd_softc *ahd, struct scsi_cmnd *cmd, 3316ahd_set_tags(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
3215 struct ahd_devinfo *devinfo, ahd_queue_alg alg) 3317 struct ahd_devinfo *devinfo, ahd_queue_alg alg)
3216{ 3318{
@@ -3466,7 +3568,7 @@ ahd_print_devinfo(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
3466 devinfo->target, devinfo->lun); 3568 devinfo->target, devinfo->lun);
3467} 3569}
3468 3570
3469struct ahd_phase_table_entry* 3571static struct ahd_phase_table_entry*
3470ahd_lookup_phase_entry(int phase) 3572ahd_lookup_phase_entry(int phase)
3471{ 3573{
3472 struct ahd_phase_table_entry *entry; 3574 struct ahd_phase_table_entry *entry;
@@ -5351,7 +5453,7 @@ ahd_free(struct ahd_softc *ahd)
5351 return; 5453 return;
5352} 5454}
5353 5455
5354void 5456static void
5355ahd_shutdown(void *arg) 5457ahd_shutdown(void *arg)
5356{ 5458{
5357 struct ahd_softc *ahd; 5459 struct ahd_softc *ahd;
@@ -5480,7 +5582,7 @@ ahd_reset(struct ahd_softc *ahd, int reinit)
5480/* 5582/*
5481 * Determine the number of SCBs available on the controller 5583 * Determine the number of SCBs available on the controller
5482 */ 5584 */
5483int 5585static int
5484ahd_probe_scbs(struct ahd_softc *ahd) { 5586ahd_probe_scbs(struct ahd_softc *ahd) {
5485 int i; 5587 int i;
5486 5588
@@ -5929,7 +6031,7 @@ ahd_free_scb(struct ahd_softc *ahd, struct scb *scb)
5929 ahd_platform_scb_free(ahd, scb); 6031 ahd_platform_scb_free(ahd, scb);
5930} 6032}
5931 6033
5932void 6034static void
5933ahd_alloc_scbs(struct ahd_softc *ahd) 6035ahd_alloc_scbs(struct ahd_softc *ahd)
5934{ 6036{
5935 struct scb_data *scb_data; 6037 struct scb_data *scb_data;
@@ -6057,9 +6159,9 @@ ahd_alloc_scbs(struct ahd_softc *ahd)
6057#endif 6159#endif
6058 } 6160 }
6059 6161
6060 newcount = MIN(scb_data->sense_left, scb_data->scbs_left); 6162 newcount = min(scb_data->sense_left, scb_data->scbs_left);
6061 newcount = MIN(newcount, scb_data->sgs_left); 6163 newcount = min(newcount, scb_data->sgs_left);
6062 newcount = MIN(newcount, (AHD_SCB_MAX_ALLOC - scb_data->numscbs)); 6164 newcount = min(newcount, (AHD_SCB_MAX_ALLOC - scb_data->numscbs));
6063 for (i = 0; i < newcount; i++) { 6165 for (i = 0; i < newcount; i++) {
6064 struct scb_platform_data *pdata; 6166 struct scb_platform_data *pdata;
6065 u_int col_tag; 6167 u_int col_tag;
@@ -6982,7 +7084,7 @@ ahd_intr_enable(struct ahd_softc *ahd, int enable)
6982 ahd_outb(ahd, HCNTRL, hcntrl); 7084 ahd_outb(ahd, HCNTRL, hcntrl);
6983} 7085}
6984 7086
6985void 7087static void
6986ahd_update_coalescing_values(struct ahd_softc *ahd, u_int timer, u_int maxcmds, 7088ahd_update_coalescing_values(struct ahd_softc *ahd, u_int timer, u_int maxcmds,
6987 u_int mincmds) 7089 u_int mincmds)
6988{ 7090{
@@ -7000,7 +7102,7 @@ ahd_update_coalescing_values(struct ahd_softc *ahd, u_int timer, u_int maxcmds,
7000 ahd_outb(ahd, INT_COALESCING_MINCMDS, -mincmds); 7102 ahd_outb(ahd, INT_COALESCING_MINCMDS, -mincmds);
7001} 7103}
7002 7104
7003void 7105static void
7004ahd_enable_coalescing(struct ahd_softc *ahd, int enable) 7106ahd_enable_coalescing(struct ahd_softc *ahd, int enable)
7005{ 7107{
7006 7108
@@ -7070,6 +7172,7 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd)
7070 ahd->flags &= ~AHD_ALL_INTERRUPTS; 7172 ahd->flags &= ~AHD_ALL_INTERRUPTS;
7071} 7173}
7072 7174
7175#if 0
7073int 7176int
7074ahd_suspend(struct ahd_softc *ahd) 7177ahd_suspend(struct ahd_softc *ahd)
7075{ 7178{
@@ -7083,7 +7186,9 @@ ahd_suspend(struct ahd_softc *ahd)
7083 ahd_shutdown(ahd); 7186 ahd_shutdown(ahd);
7084 return (0); 7187 return (0);
7085} 7188}
7189#endif /* 0 */
7086 7190
7191#if 0
7087int 7192int
7088ahd_resume(struct ahd_softc *ahd) 7193ahd_resume(struct ahd_softc *ahd)
7089{ 7194{
@@ -7093,6 +7198,7 @@ ahd_resume(struct ahd_softc *ahd)
7093 ahd_restart(ahd); 7198 ahd_restart(ahd);
7094 return (0); 7199 return (0);
7095} 7200}
7201#endif /* 0 */
7096 7202
7097/************************** Busy Target Table *********************************/ 7203/************************** Busy Target Table *********************************/
7098/* 7204/*
@@ -7125,7 +7231,7 @@ ahd_index_busy_tcl(struct ahd_softc *ahd, u_int *saved_scbid, u_int tcl)
7125/* 7231/*
7126 * Return the untagged transaction id for a given target/channel lun. 7232 * Return the untagged transaction id for a given target/channel lun.
7127 */ 7233 */
7128u_int 7234static u_int
7129ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl) 7235ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl)
7130{ 7236{
7131 u_int scbid; 7237 u_int scbid;
@@ -7138,7 +7244,7 @@ ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl)
7138 return (scbid); 7244 return (scbid);
7139} 7245}
7140 7246
7141void 7247static void
7142ahd_busy_tcl(struct ahd_softc *ahd, u_int tcl, u_int scbid) 7248ahd_busy_tcl(struct ahd_softc *ahd, u_int tcl, u_int scbid)
7143{ 7249{
7144 u_int scb_offset; 7250 u_int scb_offset;
@@ -7186,7 +7292,7 @@ ahd_match_scb(struct ahd_softc *ahd, struct scb *scb, int target,
7186 return match; 7292 return match;
7187} 7293}
7188 7294
7189void 7295static void
7190ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb) 7296ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb)
7191{ 7297{
7192 int target; 7298 int target;
@@ -7690,7 +7796,7 @@ ahd_add_scb_to_free_list(struct ahd_softc *ahd, u_int scbid)
7690 * been modified from CAM_REQ_INPROG. This routine assumes that the sequencer 7796 * been modified from CAM_REQ_INPROG. This routine assumes that the sequencer
7691 * is paused before it is called. 7797 * is paused before it is called.
7692 */ 7798 */
7693int 7799static int
7694ahd_abort_scbs(struct ahd_softc *ahd, int target, char channel, 7800ahd_abort_scbs(struct ahd_softc *ahd, int target, char channel,
7695 int lun, u_int tag, role_t role, uint32_t status) 7801 int lun, u_int tag, role_t role, uint32_t status)
7696{ 7802{
@@ -7920,6 +8026,11 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
7920 ahd_clear_fifo(ahd, 1); 8026 ahd_clear_fifo(ahd, 1);
7921 8027
7922 /* 8028 /*
8029 * Clear SCSI interrupt status
8030 */
8031 ahd_outb(ahd, CLRSINT1, CLRSCSIRSTI);
8032
8033 /*
7923 * Reenable selections 8034 * Reenable selections
7924 */ 8035 */
7925 ahd_outb(ahd, SIMODE1, ahd_inb(ahd, SIMODE1) | ENSCSIRST); 8036 ahd_outb(ahd, SIMODE1, ahd_inb(ahd, SIMODE1) | ENSCSIRST);
@@ -7952,10 +8063,6 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
7952 } 8063 }
7953 } 8064 }
7954#endif 8065#endif
7955 /* Notify the XPT that a bus reset occurred */
7956 ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD,
7957 CAM_LUN_WILDCARD, AC_BUS_RESET);
7958
7959 /* 8066 /*
7960 * Revert to async/narrow transfers until we renegotiate. 8067 * Revert to async/narrow transfers until we renegotiate.
7961 */ 8068 */
@@ -7977,6 +8084,10 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
7977 } 8084 }
7978 } 8085 }
7979 8086
8087 /* Notify the XPT that a bus reset occurred */
8088 ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD,
8089 CAM_LUN_WILDCARD, AC_BUS_RESET);
8090
7980 ahd_restart(ahd); 8091 ahd_restart(ahd);
7981 8092
7982 return (found); 8093 return (found);
@@ -8019,18 +8130,8 @@ ahd_stat_timer(void *arg)
8019} 8130}
8020 8131
8021/****************************** Status Processing *****************************/ 8132/****************************** Status Processing *****************************/
8022void
8023ahd_handle_scb_status(struct ahd_softc *ahd, struct scb *scb)
8024{
8025 if (scb->hscb->shared_data.istatus.scsi_status != 0) {
8026 ahd_handle_scsi_status(ahd, scb);
8027 } else {
8028 ahd_calc_residual(ahd, scb);
8029 ahd_done(ahd, scb);
8030 }
8031}
8032 8133
8033void 8134static void
8034ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb) 8135ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
8035{ 8136{
8036 struct hardware_scb *hscb; 8137 struct hardware_scb *hscb;
@@ -8238,10 +8339,21 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
8238 } 8339 }
8239} 8340}
8240 8341
8342static void
8343ahd_handle_scb_status(struct ahd_softc *ahd, struct scb *scb)
8344{
8345 if (scb->hscb->shared_data.istatus.scsi_status != 0) {
8346 ahd_handle_scsi_status(ahd, scb);
8347 } else {
8348 ahd_calc_residual(ahd, scb);
8349 ahd_done(ahd, scb);
8350 }
8351}
8352
8241/* 8353/*
8242 * Calculate the residual for a just completed SCB. 8354 * Calculate the residual for a just completed SCB.
8243 */ 8355 */
8244void 8356static void
8245ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb) 8357ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb)
8246{ 8358{
8247 struct hardware_scb *hscb; 8359 struct hardware_scb *hscb;
@@ -8668,7 +8780,7 @@ ahd_resolve_seqaddr(struct ahd_softc *ahd, u_int address)
8668 if (skip_addr > i) { 8780 if (skip_addr > i) {
8669 int end_addr; 8781 int end_addr;
8670 8782
8671 end_addr = MIN(address, skip_addr); 8783 end_addr = min(address, skip_addr);
8672 address_offset += end_addr - i; 8784 address_offset += end_addr - i;
8673 i = skip_addr; 8785 i = skip_addr;
8674 } else { 8786 } else {
@@ -9092,6 +9204,7 @@ ahd_dump_card_state(struct ahd_softc *ahd)
9092 ahd_unpause(ahd); 9204 ahd_unpause(ahd);
9093} 9205}
9094 9206
9207#if 0
9095void 9208void
9096ahd_dump_scbs(struct ahd_softc *ahd) 9209ahd_dump_scbs(struct ahd_softc *ahd)
9097{ 9210{
@@ -9117,6 +9230,7 @@ ahd_dump_scbs(struct ahd_softc *ahd)
9117 ahd_set_scbptr(ahd, saved_scb_index); 9230 ahd_set_scbptr(ahd, saved_scb_index);
9118 ahd_restore_modes(ahd, saved_modes); 9231 ahd_restore_modes(ahd, saved_modes);
9119} 9232}
9233#endif /* 0 */
9120 9234
9121/**************************** Flexport Logic **********************************/ 9235/**************************** Flexport Logic **********************************/
9122/* 9236/*
@@ -9219,7 +9333,7 @@ ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf,
9219/* 9333/*
9220 * Wait ~100us for the serial eeprom to satisfy our request. 9334 * Wait ~100us for the serial eeprom to satisfy our request.
9221 */ 9335 */
9222int 9336static int
9223ahd_wait_seeprom(struct ahd_softc *ahd) 9337ahd_wait_seeprom(struct ahd_softc *ahd)
9224{ 9338{
9225 int cnt; 9339 int cnt;
@@ -9237,7 +9351,7 @@ ahd_wait_seeprom(struct ahd_softc *ahd)
9237 * Validate the two checksums in the per_channel 9351 * Validate the two checksums in the per_channel
9238 * vital product data struct. 9352 * vital product data struct.
9239 */ 9353 */
9240int 9354static int
9241ahd_verify_vpd_cksum(struct vpd_config *vpd) 9355ahd_verify_vpd_cksum(struct vpd_config *vpd)
9242{ 9356{
9243 int i; 9357 int i;
@@ -9316,6 +9430,24 @@ ahd_release_seeprom(struct ahd_softc *ahd)
9316 /* Currently a no-op */ 9430 /* Currently a no-op */
9317} 9431}
9318 9432
9433/*
9434 * Wait at most 2 seconds for flexport arbitration to succeed.
9435 */
9436static int
9437ahd_wait_flexport(struct ahd_softc *ahd)
9438{
9439 int cnt;
9440
9441 AHD_ASSERT_MODES(ahd, AHD_MODE_SCSI_MSK, AHD_MODE_SCSI_MSK);
9442 cnt = 1000000 * 2 / 5;
9443 while ((ahd_inb(ahd, BRDCTL) & FLXARBACK) == 0 && --cnt)
9444 ahd_delay(5);
9445
9446 if (cnt == 0)
9447 return (ETIMEDOUT);
9448 return (0);
9449}
9450
9319int 9451int
9320ahd_write_flexport(struct ahd_softc *ahd, u_int addr, u_int value) 9452ahd_write_flexport(struct ahd_softc *ahd, u_int addr, u_int value)
9321{ 9453{
@@ -9357,24 +9489,6 @@ ahd_read_flexport(struct ahd_softc *ahd, u_int addr, uint8_t *value)
9357 return (0); 9489 return (0);
9358} 9490}
9359 9491
9360/*
9361 * Wait at most 2 seconds for flexport arbitration to succeed.
9362 */
9363int
9364ahd_wait_flexport(struct ahd_softc *ahd)
9365{
9366 int cnt;
9367
9368 AHD_ASSERT_MODES(ahd, AHD_MODE_SCSI_MSK, AHD_MODE_SCSI_MSK);
9369 cnt = 1000000 * 2 / 5;
9370 while ((ahd_inb(ahd, BRDCTL) & FLXARBACK) == 0 && --cnt)
9371 ahd_delay(5);
9372
9373 if (cnt == 0)
9374 return (ETIMEDOUT);
9375 return (0);
9376}
9377
9378/************************* Target Mode ****************************************/ 9492/************************* Target Mode ****************************************/
9379#ifdef AHD_TARGET_MODE 9493#ifdef AHD_TARGET_MODE
9380cam_status 9494cam_status
diff --git a/drivers/scsi/aic7xxx/aic79xx_inline.h b/drivers/scsi/aic7xxx/aic79xx_inline.h
index a3266e066c00..2ceb67f4af2a 100644
--- a/drivers/scsi/aic7xxx/aic79xx_inline.h
+++ b/drivers/scsi/aic7xxx/aic79xx_inline.h
@@ -418,10 +418,6 @@ ahd_targetcmd_offset(struct ahd_softc *ahd, u_int index)
418} 418}
419 419
420/*********************** Miscelaneous Support Functions ***********************/ 420/*********************** Miscelaneous Support Functions ***********************/
421static __inline void ahd_complete_scb(struct ahd_softc *ahd,
422 struct scb *scb);
423static __inline void ahd_update_residual(struct ahd_softc *ahd,
424 struct scb *scb);
425static __inline struct ahd_initiator_tinfo * 421static __inline struct ahd_initiator_tinfo *
426 ahd_fetch_transinfo(struct ahd_softc *ahd, 422 ahd_fetch_transinfo(struct ahd_softc *ahd,
427 char channel, u_int our_id, 423 char channel, u_int our_id,
@@ -467,32 +463,6 @@ static __inline uint32_t
467 ahd_get_sense_bufaddr(struct ahd_softc *ahd, 463 ahd_get_sense_bufaddr(struct ahd_softc *ahd,
468 struct scb *scb); 464 struct scb *scb);
469 465
470static __inline void
471ahd_complete_scb(struct ahd_softc *ahd, struct scb *scb)
472{
473 uint32_t sgptr;
474
475 sgptr = ahd_le32toh(scb->hscb->sgptr);
476 if ((sgptr & SG_STATUS_VALID) != 0)
477 ahd_handle_scb_status(ahd, scb);
478 else
479 ahd_done(ahd, scb);
480}
481
482/*
483 * Determine whether the sequencer reported a residual
484 * for this SCB/transaction.
485 */
486static __inline void
487ahd_update_residual(struct ahd_softc *ahd, struct scb *scb)
488{
489 uint32_t sgptr;
490
491 sgptr = ahd_le32toh(scb->hscb->sgptr);
492 if ((sgptr & SG_STATUS_VALID) != 0)
493 ahd_calc_residual(ahd, scb);
494}
495
496/* 466/*
497 * Return pointers to the transfer negotiation information 467 * Return pointers to the transfer negotiation information
498 * for the specified our_id/remote_id pair. 468 * for the specified our_id/remote_id pair.
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index f8e60486167d..9bfcca5ede08 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -293,7 +293,7 @@ static uint32_t aic79xx_seltime;
293 * force all outstanding transactions to be serviced prior to a new 293 * force all outstanding transactions to be serviced prior to a new
294 * transaction. 294 * transaction.
295 */ 295 */
296uint32_t aic79xx_periodic_otag; 296static uint32_t aic79xx_periodic_otag;
297 297
298/* Some storage boxes are using an LSI chip which has a bug making it 298/* Some storage boxes are using an LSI chip which has a bug making it
299 * impossible to use aic79xx Rev B chip in 320 speeds. The following 299 * impossible to use aic79xx Rev B chip in 320 speeds. The following
@@ -773,6 +773,7 @@ struct scsi_host_template aic79xx_driver_template = {
773#endif 773#endif
774 .can_queue = AHD_MAX_QUEUE, 774 .can_queue = AHD_MAX_QUEUE,
775 .this_id = -1, 775 .this_id = -1,
776 .max_sectors = 8192,
776 .cmd_per_lun = 2, 777 .cmd_per_lun = 2,
777 .use_clustering = ENABLE_CLUSTERING, 778 .use_clustering = ENABLE_CLUSTERING,
778 .slave_alloc = ahd_linux_slave_alloc, 779 .slave_alloc = ahd_linux_slave_alloc,
@@ -1813,9 +1814,9 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd,
1813 u_int sense_offset; 1814 u_int sense_offset;
1814 1815
1815 if (scb->flags & SCB_SENSE) { 1816 if (scb->flags & SCB_SENSE) {
1816 sense_size = MIN(sizeof(struct scsi_sense_data) 1817 sense_size = min(sizeof(struct scsi_sense_data)
1817 - ahd_get_sense_residual(scb), 1818 - ahd_get_sense_residual(scb),
1818 sizeof(cmd->sense_buffer)); 1819 (u_long)sizeof(cmd->sense_buffer));
1819 sense_offset = 0; 1820 sense_offset = 0;
1820 } else { 1821 } else {
1821 /* 1822 /*
@@ -1824,7 +1825,8 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd,
1824 */ 1825 */
1825 siu = (struct scsi_status_iu_header *) 1826 siu = (struct scsi_status_iu_header *)
1826 scb->sense_data; 1827 scb->sense_data;
1827 sense_size = MIN(scsi_4btoul(siu->sense_length), 1828 sense_size = min_t(size_t,
1829 scsi_4btoul(siu->sense_length),
1828 sizeof(cmd->sense_buffer)); 1830 sizeof(cmd->sense_buffer));
1829 sense_offset = SIU_SENSE_OFFSET(siu); 1831 sense_offset = SIU_SENSE_OFFSET(siu);
1830 } 1832 }
@@ -2634,8 +2636,22 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp)
2634 pcomp ? "Enable" : "Disable"); 2636 pcomp ? "Enable" : "Disable");
2635#endif 2637#endif
2636 2638
2637 if (pcomp) 2639 if (pcomp) {
2640 uint8_t precomp;
2641
2642 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
2643 struct ahd_linux_iocell_opts *iocell_opts;
2644
2645 iocell_opts = &aic79xx_iocell_info[ahd->unit];
2646 precomp = iocell_opts->precomp;
2647 } else {
2648 precomp = AIC79XX_DEFAULT_PRECOMP;
2649 }
2638 ppr_options |= MSG_EXT_PPR_PCOMP_EN; 2650 ppr_options |= MSG_EXT_PPR_PCOMP_EN;
2651 AHD_SET_PRECOMP(ahd, precomp);
2652 } else {
2653 AHD_SET_PRECOMP(ahd, 0);
2654 }
2639 2655
2640 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, 2656 ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
2641 starget->channel + 'A', ROLE_INITIATOR); 2657 starget->channel + 'A', ROLE_INITIATOR);
@@ -2678,7 +2694,25 @@ static void ahd_linux_set_hold_mcs(struct scsi_target *starget, int hold)
2678 ahd_unlock(ahd, &flags); 2694 ahd_unlock(ahd, &flags);
2679} 2695}
2680 2696
2697static void ahd_linux_get_signalling(struct Scsi_Host *shost)
2698{
2699 struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata;
2700 unsigned long flags;
2701 u8 mode;
2702
2703 ahd_lock(ahd, &flags);
2704 ahd_pause(ahd);
2705 mode = ahd_inb(ahd, SBLKCTL);
2706 ahd_unpause(ahd);
2707 ahd_unlock(ahd, &flags);
2681 2708
2709 if (mode & ENAB40)
2710 spi_signalling(shost) = SPI_SIGNAL_LVD;
2711 else if (mode & ENAB20)
2712 spi_signalling(shost) = SPI_SIGNAL_SE;
2713 else
2714 spi_signalling(shost) = SPI_SIGNAL_UNKNOWN;
2715}
2682 2716
2683static struct spi_function_template ahd_linux_transport_functions = { 2717static struct spi_function_template ahd_linux_transport_functions = {
2684 .set_offset = ahd_linux_set_offset, 2718 .set_offset = ahd_linux_set_offset,
@@ -2703,6 +2737,7 @@ static struct spi_function_template ahd_linux_transport_functions = {
2703 .show_pcomp_en = 1, 2737 .show_pcomp_en = 1,
2704 .set_hold_mcs = ahd_linux_set_hold_mcs, 2738 .set_hold_mcs = ahd_linux_set_hold_mcs,
2705 .show_hold_mcs = 1, 2739 .show_hold_mcs = 1,
2740 .get_signalling = ahd_linux_get_signalling,
2706}; 2741};
2707 2742
2708static int __init 2743static int __init
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
index fb3d4dd54413..3a67fc578d78 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -506,9 +506,6 @@ struct info_str {
506 int pos; 506 int pos;
507}; 507};
508 508
509void ahd_format_transinfo(struct info_str *info,
510 struct ahd_transinfo *tinfo);
511
512/******************************** Locking *************************************/ 509/******************************** Locking *************************************/
513static __inline void 510static __inline void
514ahd_lockinit(struct ahd_softc *ahd) 511ahd_lockinit(struct ahd_softc *ahd)
@@ -582,8 +579,6 @@ ahd_unlock(struct ahd_softc *ahd, unsigned long *flags)
582#define PCIXM_STATUS_MAXCRDS 0x1C00 /* Maximum Cumulative Read Size */ 579#define PCIXM_STATUS_MAXCRDS 0x1C00 /* Maximum Cumulative Read Size */
583#define PCIXM_STATUS_RCVDSCEM 0x2000 /* Received a Split Comp w/Error msg */ 580#define PCIXM_STATUS_RCVDSCEM 0x2000 /* Received a Split Comp w/Error msg */
584 581
585extern struct pci_driver aic79xx_pci_driver;
586
587typedef enum 582typedef enum
588{ 583{
589 AHD_POWER_STATE_D0, 584 AHD_POWER_STATE_D0,
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
index 4b5354201807..2001fe890e71 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
@@ -82,7 +82,7 @@ static struct pci_device_id ahd_linux_pci_id_table[] = {
82 82
83MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table); 83MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table);
84 84
85struct pci_driver aic79xx_pci_driver = { 85static struct pci_driver aic79xx_pci_driver = {
86 .name = "aic79xx", 86 .name = "aic79xx",
87 .probe = ahd_linux_pci_dev_probe, 87 .probe = ahd_linux_pci_dev_probe,
88 .remove = ahd_linux_pci_dev_remove, 88 .remove = ahd_linux_pci_dev_remove,
diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c
index 14850f31aafa..c07735819cd1 100644
--- a/drivers/scsi/aic7xxx/aic79xx_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_pci.c
@@ -97,7 +97,7 @@ static ahd_device_setup_t ahd_aic7901A_setup;
97static ahd_device_setup_t ahd_aic7902_setup; 97static ahd_device_setup_t ahd_aic7902_setup;
98static ahd_device_setup_t ahd_aic790X_setup; 98static ahd_device_setup_t ahd_aic790X_setup;
99 99
100struct ahd_pci_identity ahd_pci_ident_table [] = 100static struct ahd_pci_identity ahd_pci_ident_table [] =
101{ 101{
102 /* aic7901 based controllers */ 102 /* aic7901 based controllers */
103 { 103 {
@@ -201,7 +201,7 @@ struct ahd_pci_identity ahd_pci_ident_table [] =
201 } 201 }
202}; 202};
203 203
204const u_int ahd_num_pci_devs = ARRAY_SIZE(ahd_pci_ident_table); 204static const u_int ahd_num_pci_devs = ARRAY_SIZE(ahd_pci_ident_table);
205 205
206#define DEVCONFIG 0x40 206#define DEVCONFIG 0x40
207#define PCIXINITPAT 0x0000E000ul 207#define PCIXINITPAT 0x0000E000ul
@@ -245,6 +245,7 @@ static int ahd_check_extport(struct ahd_softc *ahd);
245static void ahd_configure_termination(struct ahd_softc *ahd, 245static void ahd_configure_termination(struct ahd_softc *ahd,
246 u_int adapter_control); 246 u_int adapter_control);
247static void ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat); 247static void ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat);
248static void ahd_pci_intr(struct ahd_softc *ahd);
248 249
249struct ahd_pci_identity * 250struct ahd_pci_identity *
250ahd_find_pci_device(ahd_dev_softc_t pci) 251ahd_find_pci_device(ahd_dev_softc_t pci)
@@ -757,7 +758,7 @@ static const char *pci_status_strings[] =
757 "%s: Address or Write Phase Parity Error Detected in %s.\n" 758 "%s: Address or Write Phase Parity Error Detected in %s.\n"
758}; 759};
759 760
760void 761static void
761ahd_pci_intr(struct ahd_softc *ahd) 762ahd_pci_intr(struct ahd_softc *ahd)
762{ 763{
763 uint8_t pci_status[8]; 764 uint8_t pci_status[8];
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
index c5f0ee591509..6b28bebcbca0 100644
--- a/drivers/scsi/aic7xxx/aic79xx_proc.c
+++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
@@ -136,7 +136,7 @@ copy_info(struct info_str *info, char *fmt, ...)
136 return (len); 136 return (len);
137} 137}
138 138
139void 139static void
140ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) 140ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo)
141{ 141{
142 u_int speed; 142 u_int speed;
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
index 62ff8c3dc2bb..954c7c24501d 100644
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -54,14 +54,6 @@ struct scb_platform_data;
54struct seeprom_descriptor; 54struct seeprom_descriptor;
55 55
56/****************************** Useful Macros *********************************/ 56/****************************** Useful Macros *********************************/
57#ifndef MAX
58#define MAX(a,b) (((a) > (b)) ? (a) : (b))
59#endif
60
61#ifndef MIN
62#define MIN(a,b) (((a) < (b)) ? (a) : (b))
63#endif
64
65#ifndef TRUE 57#ifndef TRUE
66#define TRUE 1 58#define TRUE 1
67#endif 59#endif
@@ -1135,8 +1127,6 @@ struct ahc_pci_identity {
1135 char *name; 1127 char *name;
1136 ahc_device_setup_t *setup; 1128 ahc_device_setup_t *setup;
1137}; 1129};
1138extern struct ahc_pci_identity ahc_pci_ident_table[];
1139extern const u_int ahc_num_pci_devs;
1140 1130
1141/***************************** VL/EISA Declarations ***************************/ 1131/***************************** VL/EISA Declarations ***************************/
1142struct aic7770_identity { 1132struct aic7770_identity {
@@ -1289,6 +1279,7 @@ typedef enum {
1289} ahc_queue_alg; 1279} ahc_queue_alg;
1290 1280
1291void ahc_set_tags(struct ahc_softc *ahc, 1281void ahc_set_tags(struct ahc_softc *ahc,
1282 struct scsi_cmnd *cmd,
1292 struct ahc_devinfo *devinfo, 1283 struct ahc_devinfo *devinfo,
1293 ahc_queue_alg alg); 1284 ahc_queue_alg alg);
1294 1285
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 93e4e40944b6..50ef785224de 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -1671,7 +1671,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc,
1671 transinfo = &tinfo->goal; 1671 transinfo = &tinfo->goal;
1672 *ppr_options &= transinfo->ppr_options; 1672 *ppr_options &= transinfo->ppr_options;
1673 if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { 1673 if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) {
1674 maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2); 1674 maxsync = max(maxsync, (u_int)AHC_SYNCRATE_ULTRA2);
1675 *ppr_options &= ~MSG_EXT_PPR_DT_REQ; 1675 *ppr_options &= ~MSG_EXT_PPR_DT_REQ;
1676 } 1676 }
1677 if (transinfo->period == 0) { 1677 if (transinfo->period == 0) {
@@ -1679,7 +1679,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc,
1679 *ppr_options = 0; 1679 *ppr_options = 0;
1680 return (NULL); 1680 return (NULL);
1681 } 1681 }
1682 *period = MAX(*period, transinfo->period); 1682 *period = max(*period, (u_int)transinfo->period);
1683 return (ahc_find_syncrate(ahc, period, ppr_options, maxsync)); 1683 return (ahc_find_syncrate(ahc, period, ppr_options, maxsync));
1684} 1684}
1685 1685
@@ -1804,12 +1804,12 @@ ahc_validate_offset(struct ahc_softc *ahc,
1804 else 1804 else
1805 maxoffset = MAX_OFFSET_8BIT; 1805 maxoffset = MAX_OFFSET_8BIT;
1806 } 1806 }
1807 *offset = MIN(*offset, maxoffset); 1807 *offset = min(*offset, maxoffset);
1808 if (tinfo != NULL) { 1808 if (tinfo != NULL) {
1809 if (role == ROLE_TARGET) 1809 if (role == ROLE_TARGET)
1810 *offset = MIN(*offset, tinfo->user.offset); 1810 *offset = min(*offset, (u_int)tinfo->user.offset);
1811 else 1811 else
1812 *offset = MIN(*offset, tinfo->goal.offset); 1812 *offset = min(*offset, (u_int)tinfo->goal.offset);
1813 } 1813 }
1814} 1814}
1815 1815
@@ -1835,9 +1835,9 @@ ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo,
1835 } 1835 }
1836 if (tinfo != NULL) { 1836 if (tinfo != NULL) {
1837 if (role == ROLE_TARGET) 1837 if (role == ROLE_TARGET)
1838 *bus_width = MIN(tinfo->user.width, *bus_width); 1838 *bus_width = min((u_int)tinfo->user.width, *bus_width);
1839 else 1839 else
1840 *bus_width = MIN(tinfo->goal.width, *bus_width); 1840 *bus_width = min((u_int)tinfo->goal.width, *bus_width);
1841 } 1841 }
1842} 1842}
1843 1843
@@ -1986,7 +1986,7 @@ ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
1986 tinfo->curr.ppr_options = ppr_options; 1986 tinfo->curr.ppr_options = ppr_options;
1987 1987
1988 ahc_send_async(ahc, devinfo->channel, devinfo->target, 1988 ahc_send_async(ahc, devinfo->channel, devinfo->target,
1989 CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); 1989 CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
1990 if (bootverbose) { 1990 if (bootverbose) {
1991 if (offset != 0) { 1991 if (offset != 0) {
1992 printf("%s: target %d synchronous at %sMHz%s, " 1992 printf("%s: target %d synchronous at %sMHz%s, "
@@ -2056,7 +2056,7 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
2056 tinfo->curr.width = width; 2056 tinfo->curr.width = width;
2057 2057
2058 ahc_send_async(ahc, devinfo->channel, devinfo->target, 2058 ahc_send_async(ahc, devinfo->channel, devinfo->target,
2059 CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); 2059 CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
2060 if (bootverbose) { 2060 if (bootverbose) {
2061 printf("%s: target %d using %dbit transfers\n", 2061 printf("%s: target %d using %dbit transfers\n",
2062 ahc_name(ahc), devinfo->target, 2062 ahc_name(ahc), devinfo->target,
@@ -2074,12 +2074,14 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
2074 * Update the current state of tagged queuing for a given target. 2074 * Update the current state of tagged queuing for a given target.
2075 */ 2075 */
2076void 2076void
2077ahc_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, 2077ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
2078 ahc_queue_alg alg) 2078 struct ahc_devinfo *devinfo, ahc_queue_alg alg)
2079{ 2079{
2080 ahc_platform_set_tags(ahc, devinfo, alg); 2080 struct scsi_device *sdev = cmd->device;
2081
2082 ahc_platform_set_tags(ahc, sdev, devinfo, alg);
2081 ahc_send_async(ahc, devinfo->channel, devinfo->target, 2083 ahc_send_async(ahc, devinfo->channel, devinfo->target,
2082 devinfo->lun, AC_TRANSFER_NEG, &alg); 2084 devinfo->lun, AC_TRANSFER_NEG);
2083} 2085}
2084 2086
2085/* 2087/*
@@ -3489,7 +3491,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
3489 printf("(%s:%c:%d:%d): refuses tagged commands. " 3491 printf("(%s:%c:%d:%d): refuses tagged commands. "
3490 "Performing non-tagged I/O\n", ahc_name(ahc), 3492 "Performing non-tagged I/O\n", ahc_name(ahc),
3491 devinfo->channel, devinfo->target, devinfo->lun); 3493 devinfo->channel, devinfo->target, devinfo->lun);
3492 ahc_set_tags(ahc, devinfo, AHC_QUEUE_NONE); 3494 ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_NONE);
3493 mask = ~0x23; 3495 mask = ~0x23;
3494 } else { 3496 } else {
3495 printf("(%s:%c:%d:%d): refuses %s tagged commands. " 3497 printf("(%s:%c:%d:%d): refuses %s tagged commands. "
@@ -3497,7 +3499,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
3497 ahc_name(ahc), devinfo->channel, devinfo->target, 3499 ahc_name(ahc), devinfo->channel, devinfo->target,
3498 devinfo->lun, tag_type == MSG_ORDERED_TASK 3500 devinfo->lun, tag_type == MSG_ORDERED_TASK
3499 ? "ordered" : "head of queue"); 3501 ? "ordered" : "head of queue");
3500 ahc_set_tags(ahc, devinfo, AHC_QUEUE_BASIC); 3502 ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_BASIC);
3501 mask = ~0x03; 3503 mask = ~0x03;
3502 } 3504 }
3503 3505
@@ -3763,7 +3765,7 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
3763 3765
3764 if (status != CAM_SEL_TIMEOUT) 3766 if (status != CAM_SEL_TIMEOUT)
3765 ahc_send_async(ahc, devinfo->channel, devinfo->target, 3767 ahc_send_async(ahc, devinfo->channel, devinfo->target,
3766 CAM_LUN_WILDCARD, AC_SENT_BDR, NULL); 3768 CAM_LUN_WILDCARD, AC_SENT_BDR);
3767 3769
3768 if (message != NULL 3770 if (message != NULL
3769 && (verbose_level <= bootverbose)) 3771 && (verbose_level <= bootverbose))
@@ -4406,7 +4408,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc)
4406 physaddr = sg_map->sg_physaddr; 4408 physaddr = sg_map->sg_physaddr;
4407 4409
4408 newcount = (PAGE_SIZE / (AHC_NSEG * sizeof(struct ahc_dma_seg))); 4410 newcount = (PAGE_SIZE / (AHC_NSEG * sizeof(struct ahc_dma_seg)));
4409 newcount = MIN(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs)); 4411 newcount = min(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs));
4410 for (i = 0; i < newcount; i++) { 4412 for (i = 0; i < newcount; i++) {
4411 struct scb_platform_data *pdata; 4413 struct scb_platform_data *pdata;
4412#ifndef __linux__ 4414#ifndef __linux__
@@ -6018,7 +6020,7 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset)
6018#endif 6020#endif
6019 /* Notify the XPT that a bus reset occurred */ 6021 /* Notify the XPT that a bus reset occurred */
6020 ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD, 6022 ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD,
6021 CAM_LUN_WILDCARD, AC_BUS_RESET, NULL); 6023 CAM_LUN_WILDCARD, AC_BUS_RESET);
6022 6024
6023 /* 6025 /*
6024 * Revert to async/narrow transfers until we renegotiate. 6026 * Revert to async/narrow transfers until we renegotiate.
@@ -6442,7 +6444,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
6442 if (skip_addr > i) { 6444 if (skip_addr > i) {
6443 int end_addr; 6445 int end_addr;
6444 6446
6445 end_addr = MIN(address, skip_addr); 6447 end_addr = min(address, skip_addr);
6446 address_offset += end_addr - i; 6448 address_offset += end_addr - i;
6447 i = skip_addr; 6449 i = skip_addr;
6448 } else { 6450 } else {
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 43ab753d2739..660f26e23a38 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -328,7 +328,7 @@ static uint32_t aic7xxx_seltime;
328 * force all outstanding transactions to be serviced prior to a new 328 * force all outstanding transactions to be serviced prior to a new
329 * transaction. 329 * transaction.
330 */ 330 */
331uint32_t aic7xxx_periodic_otag; 331static uint32_t aic7xxx_periodic_otag;
332 332
333/* 333/*
334 * Module information and settable options. 334 * Module information and settable options.
@@ -512,7 +512,6 @@ ahc_linux_target_alloc(struct scsi_target *starget)
512 struct seeprom_config *sc = ahc->seep_config; 512 struct seeprom_config *sc = ahc->seep_config;
513 unsigned long flags; 513 unsigned long flags;
514 struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget); 514 struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget);
515 struct ahc_linux_target *targ = scsi_transport_target_data(starget);
516 unsigned short scsirate; 515 unsigned short scsirate;
517 struct ahc_devinfo devinfo; 516 struct ahc_devinfo devinfo;
518 struct ahc_initiator_tinfo *tinfo; 517 struct ahc_initiator_tinfo *tinfo;
@@ -533,7 +532,6 @@ ahc_linux_target_alloc(struct scsi_target *starget)
533 BUG_ON(*ahc_targp != NULL); 532 BUG_ON(*ahc_targp != NULL);
534 533
535 *ahc_targp = starget; 534 *ahc_targp = starget;
536 memset(targ, 0, sizeof(*targ));
537 535
538 if (sc) { 536 if (sc) {
539 int maxsync = AHC_SYNCRATE_DT; 537 int maxsync = AHC_SYNCRATE_DT;
@@ -594,14 +592,11 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)
594 struct ahc_softc *ahc = 592 struct ahc_softc *ahc =
595 *((struct ahc_softc **)sdev->host->hostdata); 593 *((struct ahc_softc **)sdev->host->hostdata);
596 struct scsi_target *starget = sdev->sdev_target; 594 struct scsi_target *starget = sdev->sdev_target;
597 struct ahc_linux_target *targ = scsi_transport_target_data(starget);
598 struct ahc_linux_device *dev; 595 struct ahc_linux_device *dev;
599 596
600 if (bootverbose) 597 if (bootverbose)
601 printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id); 598 printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id);
602 599
603 BUG_ON(targ->sdev[sdev->lun] != NULL);
604
605 dev = scsi_transport_device_data(sdev); 600 dev = scsi_transport_device_data(sdev);
606 memset(dev, 0, sizeof(*dev)); 601 memset(dev, 0, sizeof(*dev));
607 602
@@ -618,8 +613,6 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)
618 */ 613 */
619 dev->maxtags = 0; 614 dev->maxtags = 0;
620 615
621 targ->sdev[sdev->lun] = sdev;
622
623 spi_period(starget) = 0; 616 spi_period(starget) = 0;
624 617
625 return 0; 618 return 0;
@@ -644,22 +637,6 @@ ahc_linux_slave_configure(struct scsi_device *sdev)
644 return 0; 637 return 0;
645} 638}
646 639
647static void
648ahc_linux_slave_destroy(struct scsi_device *sdev)
649{
650 struct ahc_softc *ahc;
651 struct ahc_linux_device *dev = scsi_transport_device_data(sdev);
652 struct ahc_linux_target *targ = scsi_transport_target_data(sdev->sdev_target);
653
654 ahc = *((struct ahc_softc **)sdev->host->hostdata);
655 if (bootverbose)
656 printf("%s: Slave Destroy %d\n", ahc_name(ahc), sdev->id);
657
658 BUG_ON(dev->active);
659
660 targ->sdev[sdev->lun] = NULL;
661}
662
663#if defined(__i386__) 640#if defined(__i386__)
664/* 641/*
665 * Return the disk geometry for the given SCSI device. 642 * Return the disk geometry for the given SCSI device.
@@ -777,11 +754,11 @@ struct scsi_host_template aic7xxx_driver_template = {
777#endif 754#endif
778 .can_queue = AHC_MAX_QUEUE, 755 .can_queue = AHC_MAX_QUEUE,
779 .this_id = -1, 756 .this_id = -1,
757 .max_sectors = 8192,
780 .cmd_per_lun = 2, 758 .cmd_per_lun = 2,
781 .use_clustering = ENABLE_CLUSTERING, 759 .use_clustering = ENABLE_CLUSTERING,
782 .slave_alloc = ahc_linux_slave_alloc, 760 .slave_alloc = ahc_linux_slave_alloc,
783 .slave_configure = ahc_linux_slave_configure, 761 .slave_configure = ahc_linux_slave_configure,
784 .slave_destroy = ahc_linux_slave_destroy,
785 .target_alloc = ahc_linux_target_alloc, 762 .target_alloc = ahc_linux_target_alloc,
786 .target_destroy = ahc_linux_target_destroy, 763 .target_destroy = ahc_linux_target_destroy,
787}; 764};
@@ -1203,21 +1180,13 @@ void
1203ahc_platform_free(struct ahc_softc *ahc) 1180ahc_platform_free(struct ahc_softc *ahc)
1204{ 1181{
1205 struct scsi_target *starget; 1182 struct scsi_target *starget;
1206 int i, j; 1183 int i;
1207 1184
1208 if (ahc->platform_data != NULL) { 1185 if (ahc->platform_data != NULL) {
1209 /* destroy all of the device and target objects */ 1186 /* destroy all of the device and target objects */
1210 for (i = 0; i < AHC_NUM_TARGETS; i++) { 1187 for (i = 0; i < AHC_NUM_TARGETS; i++) {
1211 starget = ahc->platform_data->starget[i]; 1188 starget = ahc->platform_data->starget[i];
1212 if (starget != NULL) { 1189 if (starget != NULL) {
1213 for (j = 0; j < AHC_NUM_LUNS; j++) {
1214 struct ahc_linux_target *targ =
1215 scsi_transport_target_data(starget);
1216
1217 if (targ->sdev[j] == NULL)
1218 continue;
1219 targ->sdev[j] = NULL;
1220 }
1221 ahc->platform_data->starget[i] = NULL; 1190 ahc->platform_data->starget[i] = NULL;
1222 } 1191 }
1223 } 1192 }
@@ -1251,24 +1220,13 @@ ahc_platform_freeze_devq(struct ahc_softc *ahc, struct scb *scb)
1251} 1220}
1252 1221
1253void 1222void
1254ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, 1223ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
1255 ahc_queue_alg alg) 1224 struct ahc_devinfo *devinfo, ahc_queue_alg alg)
1256{ 1225{
1257 struct scsi_target *starget;
1258 struct ahc_linux_target *targ;
1259 struct ahc_linux_device *dev; 1226 struct ahc_linux_device *dev;
1260 struct scsi_device *sdev;
1261 u_int target_offset;
1262 int was_queuing; 1227 int was_queuing;
1263 int now_queuing; 1228 int now_queuing;
1264 1229
1265 target_offset = devinfo->target;
1266 if (devinfo->channel != 'A')
1267 target_offset += 8;
1268 starget = ahc->platform_data->starget[target_offset];
1269 targ = scsi_transport_target_data(starget);
1270 BUG_ON(targ == NULL);
1271 sdev = targ->sdev[devinfo->lun];
1272 if (sdev == NULL) 1230 if (sdev == NULL)
1273 return; 1231 return;
1274 dev = scsi_transport_device_data(sdev); 1232 dev = scsi_transport_device_data(sdev);
@@ -1401,11 +1359,15 @@ ahc_linux_device_queue_depth(struct scsi_device *sdev)
1401 tags = ahc_linux_user_tagdepth(ahc, &devinfo); 1359 tags = ahc_linux_user_tagdepth(ahc, &devinfo);
1402 if (tags != 0 && sdev->tagged_supported != 0) { 1360 if (tags != 0 && sdev->tagged_supported != 0) {
1403 1361
1404 ahc_set_tags(ahc, &devinfo, AHC_QUEUE_TAGGED); 1362 ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_TAGGED);
1363 ahc_send_async(ahc, devinfo.channel, devinfo.target,
1364 devinfo.lun, AC_TRANSFER_NEG);
1405 ahc_print_devinfo(ahc, &devinfo); 1365 ahc_print_devinfo(ahc, &devinfo);
1406 printf("Tagged Queuing enabled. Depth %d\n", tags); 1366 printf("Tagged Queuing enabled. Depth %d\n", tags);
1407 } else { 1367 } else {
1408 ahc_set_tags(ahc, &devinfo, AHC_QUEUE_NONE); 1368 ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_NONE);
1369 ahc_send_async(ahc, devinfo.channel, devinfo.target,
1370 devinfo.lun, AC_TRANSFER_NEG);
1409 } 1371 }
1410} 1372}
1411 1373
@@ -1629,7 +1591,7 @@ ahc_platform_flushwork(struct ahc_softc *ahc)
1629 1591
1630void 1592void
1631ahc_send_async(struct ahc_softc *ahc, char channel, 1593ahc_send_async(struct ahc_softc *ahc, char channel,
1632 u_int target, u_int lun, ac_code code, void *arg) 1594 u_int target, u_int lun, ac_code code)
1633{ 1595{
1634 switch (code) { 1596 switch (code) {
1635 case AC_TRANSFER_NEG: 1597 case AC_TRANSFER_NEG:
@@ -1875,9 +1837,9 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
1875 if (scb->flags & SCB_SENSE) { 1837 if (scb->flags & SCB_SENSE) {
1876 u_int sense_size; 1838 u_int sense_size;
1877 1839
1878 sense_size = MIN(sizeof(struct scsi_sense_data) 1840 sense_size = min(sizeof(struct scsi_sense_data)
1879 - ahc_get_sense_residual(scb), 1841 - ahc_get_sense_residual(scb),
1880 sizeof(cmd->sense_buffer)); 1842 (u_long)sizeof(cmd->sense_buffer));
1881 memcpy(cmd->sense_buffer, 1843 memcpy(cmd->sense_buffer,
1882 ahc_get_sense_buf(ahc, scb), sense_size); 1844 ahc_get_sense_buf(ahc, scb), sense_size);
1883 if (sense_size < sizeof(cmd->sense_buffer)) 1845 if (sense_size < sizeof(cmd->sense_buffer))
@@ -1946,7 +1908,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
1946 } 1908 }
1947 ahc_set_transaction_status(scb, CAM_REQUEUE_REQ); 1909 ahc_set_transaction_status(scb, CAM_REQUEUE_REQ);
1948 ahc_set_scsi_status(scb, SCSI_STATUS_OK); 1910 ahc_set_scsi_status(scb, SCSI_STATUS_OK);
1949 ahc_platform_set_tags(ahc, &devinfo, 1911 ahc_platform_set_tags(ahc, sdev, &devinfo,
1950 (dev->flags & AHC_DEV_Q_BASIC) 1912 (dev->flags & AHC_DEV_Q_BASIC)
1951 ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); 1913 ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
1952 break; 1914 break;
@@ -1957,7 +1919,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
1957 */ 1919 */
1958 dev->openings = 1; 1920 dev->openings = 1;
1959 ahc_set_scsi_status(scb, SCSI_STATUS_BUSY); 1921 ahc_set_scsi_status(scb, SCSI_STATUS_BUSY);
1960 ahc_platform_set_tags(ahc, &devinfo, 1922 ahc_platform_set_tags(ahc, sdev, &devinfo,
1961 (dev->flags & AHC_DEV_Q_BASIC) 1923 (dev->flags & AHC_DEV_Q_BASIC)
1962 ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); 1924 ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
1963 break; 1925 break;
@@ -2599,8 +2561,6 @@ ahc_linux_init(void)
2599 if (!ahc_linux_transport_template) 2561 if (!ahc_linux_transport_template)
2600 return -ENODEV; 2562 return -ENODEV;
2601 2563
2602 scsi_transport_reserve_target(ahc_linux_transport_template,
2603 sizeof(struct ahc_linux_target));
2604 scsi_transport_reserve_device(ahc_linux_transport_template, 2564 scsi_transport_reserve_device(ahc_linux_transport_template,
2605 sizeof(struct ahc_linux_device)); 2565 sizeof(struct ahc_linux_device));
2606 2566
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h
index a87a4ce090df..85ae5d836fa4 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.h
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h
@@ -256,7 +256,6 @@ typedef enum {
256 AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */ 256 AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */
257} ahc_linux_dev_flags; 257} ahc_linux_dev_flags;
258 258
259struct ahc_linux_target;
260struct ahc_linux_device { 259struct ahc_linux_device {
261 /* 260 /*
262 * The number of transactions currently 261 * The number of transactions currently
@@ -329,12 +328,6 @@ struct ahc_linux_device {
329#define AHC_OTAG_THRESH 500 328#define AHC_OTAG_THRESH 500
330}; 329};
331 330
332struct ahc_linux_target {
333 struct scsi_device *sdev[AHC_NUM_LUNS];
334 struct ahc_transinfo last_tinfo;
335 struct ahc_softc *ahc;
336};
337
338/********************* Definitions Required by the Core ***********************/ 331/********************* Definitions Required by the Core ***********************/
339/* 332/*
340 * Number of SG segments we require. So long as the S/G segments for 333 * Number of SG segments we require. So long as the S/G segments for
@@ -533,8 +526,6 @@ ahc_unlock(struct ahc_softc *ahc, unsigned long *flags)
533#define PCIR_SUBVEND_0 0x2c 526#define PCIR_SUBVEND_0 0x2c
534#define PCIR_SUBDEV_0 0x2e 527#define PCIR_SUBDEV_0 0x2e
535 528
536extern struct pci_driver aic7xxx_pci_driver;
537
538typedef enum 529typedef enum
539{ 530{
540 AHC_POWER_STATE_D0, 531 AHC_POWER_STATE_D0,
@@ -824,7 +815,7 @@ ahc_freeze_scb(struct scb *scb)
824 } 815 }
825} 816}
826 817
827void ahc_platform_set_tags(struct ahc_softc *ahc, 818void ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
828 struct ahc_devinfo *devinfo, ahc_queue_alg); 819 struct ahc_devinfo *devinfo, ahc_queue_alg);
829int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target, 820int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target,
830 char channel, int lun, u_int tag, 821 char channel, int lun, u_int tag,
@@ -834,7 +825,7 @@ irqreturn_t
834void ahc_platform_flushwork(struct ahc_softc *ahc); 825void ahc_platform_flushwork(struct ahc_softc *ahc);
835void ahc_done(struct ahc_softc*, struct scb*); 826void ahc_done(struct ahc_softc*, struct scb*);
836void ahc_send_async(struct ahc_softc *, char channel, 827void ahc_send_async(struct ahc_softc *, char channel,
837 u_int target, u_int lun, ac_code, void *); 828 u_int target, u_int lun, ac_code);
838void ahc_print_path(struct ahc_softc *, struct scb *); 829void ahc_print_path(struct ahc_softc *, struct scb *);
839void ahc_platform_dump_card_state(struct ahc_softc *ahc); 830void ahc_platform_dump_card_state(struct ahc_softc *ahc);
840 831
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index d20ca514e9f3..ea5687df732d 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -130,7 +130,7 @@ static struct pci_device_id ahc_linux_pci_id_table[] = {
130 130
131MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table); 131MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table);
132 132
133struct pci_driver aic7xxx_pci_driver = { 133static struct pci_driver aic7xxx_pci_driver = {
134 .name = "aic7xxx", 134 .name = "aic7xxx",
135 .probe = ahc_linux_pci_dev_probe, 135 .probe = ahc_linux_pci_dev_probe,
136 .remove = ahc_linux_pci_dev_remove, 136 .remove = ahc_linux_pci_dev_remove,
diff --git a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c
index 63cab2d74552..09c8172c9e5e 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c
@@ -168,7 +168,7 @@ static ahc_device_setup_t ahc_aha394XX_setup;
168static ahc_device_setup_t ahc_aha494XX_setup; 168static ahc_device_setup_t ahc_aha494XX_setup;
169static ahc_device_setup_t ahc_aha398XX_setup; 169static ahc_device_setup_t ahc_aha398XX_setup;
170 170
171struct ahc_pci_identity ahc_pci_ident_table [] = 171static struct ahc_pci_identity ahc_pci_ident_table [] =
172{ 172{
173 /* aic7850 based controllers */ 173 /* aic7850 based controllers */
174 { 174 {
@@ -559,7 +559,7 @@ struct ahc_pci_identity ahc_pci_ident_table [] =
559 } 559 }
560}; 560};
561 561
562const u_int ahc_num_pci_devs = ARRAY_SIZE(ahc_pci_ident_table); 562static const u_int ahc_num_pci_devs = ARRAY_SIZE(ahc_pci_ident_table);
563 563
564#define AHC_394X_SLOT_CHANNEL_A 4 564#define AHC_394X_SLOT_CHANNEL_A 4
565#define AHC_394X_SLOT_CHANNEL_B 5 565#define AHC_394X_SLOT_CHANNEL_B 5
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 5914b4aa4a8f..99e5443e7535 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -182,7 +182,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
182 u_int our_id, char channel, u_int target_id, 182 u_int our_id, char channel, u_int target_id,
183 u_int target_offset) 183 u_int target_offset)
184{ 184{
185 struct ahc_linux_target *targ;
186 struct scsi_target *starget; 185 struct scsi_target *starget;
187 struct ahc_initiator_tinfo *tinfo; 186 struct ahc_initiator_tinfo *tinfo;
188 struct ahc_tmode_tstate *tstate; 187 struct ahc_tmode_tstate *tstate;
@@ -198,7 +197,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
198 starget = ahc->platform_data->starget[target_offset]; 197 starget = ahc->platform_data->starget[target_offset];
199 if (!starget) 198 if (!starget)
200 return; 199 return;
201 targ = scsi_transport_target_data(starget);
202 200
203 copy_info(info, "\tGoal: "); 201 copy_info(info, "\tGoal: ");
204 ahc_format_transinfo(info, &tinfo->goal); 202 ahc_format_transinfo(info, &tinfo->goal);
@@ -208,7 +206,7 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
208 for (lun = 0; lun < AHC_NUM_LUNS; lun++) { 206 for (lun = 0; lun < AHC_NUM_LUNS; lun++) {
209 struct scsi_device *sdev; 207 struct scsi_device *sdev;
210 208
211 sdev = targ->sdev[lun]; 209 sdev = scsi_device_lookup_by_target(starget, lun);
212 210
213 if (sdev == NULL) 211 if (sdev == NULL)
214 continue; 212 continue;
@@ -383,11 +381,11 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
383 } 381 }
384 copy_info(&info, "\n"); 382 copy_info(&info, "\n");
385 383
386 max_targ = 15; 384 max_targ = 16;
387 if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) 385 if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
388 max_targ = 7; 386 max_targ = 8;
389 387
390 for (i = 0; i <= max_targ; i++) { 388 for (i = 0; i < max_targ; i++) {
391 u_int our_id; 389 u_int our_id;
392 u_int target_id; 390 u_int target_id;
393 char channel; 391 char channel;
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index bcd7fffab907..46eed10b25d9 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -2646,7 +2646,7 @@ static void aic7xxx_done_cmds_complete(struct aic7xxx_host *p)
2646 2646
2647 while (p->completeq.head != NULL) { 2647 while (p->completeq.head != NULL) {
2648 cmd = p->completeq.head; 2648 cmd = p->completeq.head;
2649 p->completeq.head = (struct scsi_Cmnd *) cmd->host_scribble; 2649 p->completeq.head = (struct scsi_cmnd *) cmd->host_scribble;
2650 cmd->host_scribble = NULL; 2650 cmd->host_scribble = NULL;
2651 cmd->scsi_done(cmd); 2651 cmd->scsi_done(cmd);
2652 } 2652 }
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.h b/drivers/scsi/aic94xx/aic94xx_hwi.h
index 14319d1d6804..7b6aca02cf70 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.h
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.h
@@ -46,6 +46,7 @@
46#define PCI_DEVICE_ID_ADAPTEC2_RAZOR10 0x410 46#define PCI_DEVICE_ID_ADAPTEC2_RAZOR10 0x410
47#define PCI_DEVICE_ID_ADAPTEC2_RAZOR12 0x412 47#define PCI_DEVICE_ID_ADAPTEC2_RAZOR12 0x412
48#define PCI_DEVICE_ID_ADAPTEC2_RAZOR1E 0x41E 48#define PCI_DEVICE_ID_ADAPTEC2_RAZOR1E 0x41E
49#define PCI_DEVICE_ID_ADAPTEC2_RAZOR1F 0x41F
49#define PCI_DEVICE_ID_ADAPTEC2_RAZOR30 0x430 50#define PCI_DEVICE_ID_ADAPTEC2_RAZOR30 0x430
50#define PCI_DEVICE_ID_ADAPTEC2_RAZOR32 0x432 51#define PCI_DEVICE_ID_ADAPTEC2_RAZOR32 0x432
51#define PCI_DEVICE_ID_ADAPTEC2_RAZOR3E 0x43E 52#define PCI_DEVICE_ID_ADAPTEC2_RAZOR3E 0x43E
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 99743ca29ca1..a4cc432bbdab 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -814,6 +814,8 @@ static const struct pci_device_id aic94xx_pci_table[] __devinitdata = {
814 0, 0, 1}, 814 0, 0, 1},
815 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR1E), 815 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR1E),
816 0, 0, 1}, 816 0, 0, 1},
817 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR1F),
818 0, 0, 1},
817 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR30), 819 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR30),
818 0, 0, 2}, 820 0, 0, 2},
819 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR32), 821 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR32),
diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c b/drivers/scsi/aic94xx/aic94xx_sds.c
index 83574b5b4e69..de7c04d4254d 100644
--- a/drivers/scsi/aic94xx/aic94xx_sds.c
+++ b/drivers/scsi/aic94xx/aic94xx_sds.c
@@ -630,10 +630,6 @@ static int asd_flash_getid(struct asd_ha_struct *asd_ha)
630 630
631 reg = asd_read_reg_dword(asd_ha, EXSICNFGR); 631 reg = asd_read_reg_dword(asd_ha, EXSICNFGR);
632 632
633 if (!(reg & FLASHEX)) {
634 ASD_DPRINTK("flash doesn't exist\n");
635 return -ENOENT;
636 }
637 if (pci_read_config_dword(asd_ha->pcidev, PCI_CONF_FLSH_BAR, 633 if (pci_read_config_dword(asd_ha->pcidev, PCI_CONF_FLSH_BAR,
638 &asd_ha->hw_prof.flash.bar)) { 634 &asd_ha->hw_prof.flash.bar)) {
639 asd_printk("couldn't read PCI_CONF_FLSH_BAR of %s\n", 635 asd_printk("couldn't read PCI_CONF_FLSH_BAR of %s\n",
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 65e6e7b7ba07..5d4ea6f77953 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -387,6 +387,7 @@ static void __iomem * bios_mem;
387static int bios_major; 387static int bios_major;
388static int bios_minor; 388static int bios_minor;
389static int PCI_bus; 389static int PCI_bus;
390static struct pci_dev *PCI_dev;
390static int Quantum; /* Quantum board variant */ 391static int Quantum; /* Quantum board variant */
391static int interrupt_level; 392static int interrupt_level;
392static volatile int in_command; 393static volatile int in_command;
@@ -812,9 +813,10 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_
812 PCI_DEVICE_ID_FD_36C70 ); 813 PCI_DEVICE_ID_FD_36C70 );
813#endif 814#endif
814 815
815 if ((pdev = pci_find_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL) 816 if ((pdev = pci_get_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL)
816 return 0; 817 return 0;
817 if (pci_enable_device(pdev)) return 0; 818 if (pci_enable_device(pdev))
819 goto fail;
818 820
819#if DEBUG_DETECT 821#if DEBUG_DETECT
820 printk( "scsi: <fdomain> TMC-3260 detect:" 822 printk( "scsi: <fdomain> TMC-3260 detect:"
@@ -831,7 +833,7 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_
831 pci_irq = pdev->irq; 833 pci_irq = pdev->irq;
832 834
833 if (!request_region( pci_base, 0x10, "fdomain" )) 835 if (!request_region( pci_base, 0x10, "fdomain" ))
834 return 0; 836 goto fail;
835 837
836 /* Now we have the I/O base address and interrupt from the PCI 838 /* Now we have the I/O base address and interrupt from the PCI
837 configuration registers. */ 839 configuration registers. */
@@ -848,17 +850,22 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_
848 if (!fdomain_is_valid_port(pci_base)) { 850 if (!fdomain_is_valid_port(pci_base)) {
849 printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" ); 851 printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" );
850 release_region(pci_base, 0x10); 852 release_region(pci_base, 0x10);
851 return 0; 853 goto fail;
852 } 854 }
853 855
854 /* Fill in a few global variables. Ugh. */ 856 /* Fill in a few global variables. Ugh. */
855 bios_major = bios_minor = -1; 857 bios_major = bios_minor = -1;
856 PCI_bus = 1; 858 PCI_bus = 1;
859 PCI_dev = pdev;
857 Quantum = 0; 860 Quantum = 0;
858 bios_base = 0; 861 bios_base = 0;
859 862
860 return 1; 863 return 1;
864fail:
865 pci_dev_put(pdev);
866 return 0;
861} 867}
868
862#endif 869#endif
863 870
864struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) 871struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
@@ -909,8 +916,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
909 if (setup_called) { 916 if (setup_called) {
910 printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n"); 917 printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n");
911 } 918 }
912 release_region(port_base, 0x10); 919 goto fail;
913 return NULL;
914 } 920 }
915 921
916 if (this_id) { 922 if (this_id) {
@@ -942,8 +948,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
942 /* Log IRQ with kernel */ 948 /* Log IRQ with kernel */
943 if (!interrupt_level) { 949 if (!interrupt_level) {
944 printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" ); 950 printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" );
945 release_region(port_base, 0x10); 951 goto fail;
946 return NULL;
947 } else { 952 } else {
948 /* Register the IRQ with the kernel */ 953 /* Register the IRQ with the kernel */
949 954
@@ -964,11 +969,14 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
964 printk(KERN_ERR " Send mail to faith@acm.org\n" ); 969 printk(KERN_ERR " Send mail to faith@acm.org\n" );
965 } 970 }
966 printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" ); 971 printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" );
967 release_region(port_base, 0x10); 972 goto fail;
968 return NULL;
969 } 973 }
970 } 974 }
971 return shpnt; 975 return shpnt;
976fail:
977 pci_dev_put(pdev);
978 release_region(port_base, 0x10);
979 return NULL;
972} 980}
973 981
974static int fdomain_16x0_detect(struct scsi_host_template *tpnt) 982static int fdomain_16x0_detect(struct scsi_host_template *tpnt)
@@ -1714,6 +1722,8 @@ static int fdomain_16x0_release(struct Scsi_Host *shpnt)
1714 free_irq(shpnt->irq, shpnt); 1722 free_irq(shpnt->irq, shpnt);
1715 if (shpnt->io_port && shpnt->n_io_port) 1723 if (shpnt->io_port && shpnt->n_io_port)
1716 release_region(shpnt->io_port, shpnt->n_io_port); 1724 release_region(shpnt->io_port, shpnt->n_io_port);
1725 if (PCI_bus)
1726 pci_dev_put(PCI_dev);
1717 return 0; 1727 return 0;
1718} 1728}
1719 1729
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 669ea4fff166..fbc1d5c3b0a7 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1213,7 +1213,7 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq,
1213 "ibmvscsi: Re-enabling adapter!\n"); 1213 "ibmvscsi: Re-enabling adapter!\n");
1214 purge_requests(hostdata, DID_REQUEUE); 1214 purge_requests(hostdata, DID_REQUEUE);
1215 if ((ibmvscsi_reenable_crq_queue(&hostdata->queue, 1215 if ((ibmvscsi_reenable_crq_queue(&hostdata->queue,
1216 hostdata) == 0) || 1216 hostdata)) ||
1217 (ibmvscsi_send_crq(hostdata, 1217 (ibmvscsi_send_crq(hostdata,
1218 0xC001000000000000LL, 0))) { 1218 0xC001000000000000LL, 0))) {
1219 atomic_set(&hostdata->request_limit, 1219 atomic_set(&hostdata->request_limit,
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index c542d0e95e68..2865ebd557ef 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -481,8 +481,8 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
481 break; 481 break;
482 case ISCSI_OP_ASYNC_EVENT: 482 case ISCSI_OP_ASYNC_EVENT:
483 conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; 483 conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;
484 /* we need sth like iscsi_async_event_rsp() */ 484 if (iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen))
485 rc = ISCSI_ERR_BAD_OPCODE; 485 rc = ISCSI_ERR_CONN_FAILED;
486 break; 486 break;
487 default: 487 default:
488 rc = ISCSI_ERR_BAD_OPCODE; 488 rc = ISCSI_ERR_BAD_OPCODE;
@@ -578,6 +578,27 @@ void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err)
578} 578}
579EXPORT_SYMBOL_GPL(iscsi_conn_failure); 579EXPORT_SYMBOL_GPL(iscsi_conn_failure);
580 580
581static int iscsi_xmit_imm_task(struct iscsi_conn *conn)
582{
583 struct iscsi_hdr *hdr = conn->mtask->hdr;
584 int rc, was_logout = 0;
585
586 if ((hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGOUT) {
587 conn->session->state = ISCSI_STATE_IN_RECOVERY;
588 iscsi_block_session(session_to_cls(conn->session));
589 was_logout = 1;
590 }
591 rc = conn->session->tt->xmit_mgmt_task(conn, conn->mtask);
592 if (rc)
593 return rc;
594
595 if (was_logout) {
596 set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
597 return -ENODATA;
598 }
599 return 0;
600}
601
581/** 602/**
582 * iscsi_data_xmit - xmit any command into the scheduled connection 603 * iscsi_data_xmit - xmit any command into the scheduled connection
583 * @conn: iscsi connection 604 * @conn: iscsi connection
@@ -623,7 +644,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
623 conn->ctask = NULL; 644 conn->ctask = NULL;
624 } 645 }
625 if (conn->mtask) { 646 if (conn->mtask) {
626 rc = tt->xmit_mgmt_task(conn, conn->mtask); 647 rc = iscsi_xmit_imm_task(conn);
627 if (rc) 648 if (rc)
628 goto again; 649 goto again;
629 /* done with this in-progress mtask */ 650 /* done with this in-progress mtask */
@@ -638,7 +659,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
638 list_add_tail(&conn->mtask->running, 659 list_add_tail(&conn->mtask->running,
639 &conn->mgmt_run_list); 660 &conn->mgmt_run_list);
640 spin_unlock_bh(&conn->session->lock); 661 spin_unlock_bh(&conn->session->lock);
641 rc = tt->xmit_mgmt_task(conn, conn->mtask); 662 rc = iscsi_xmit_imm_task(conn);
642 if (rc) 663 if (rc)
643 goto again; 664 goto again;
644 } 665 }
@@ -661,8 +682,6 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
661 spin_unlock_bh(&conn->session->lock); 682 spin_unlock_bh(&conn->session->lock);
662 683
663 rc = tt->xmit_cmd_task(conn, conn->ctask); 684 rc = tt->xmit_cmd_task(conn, conn->ctask);
664 if (rc)
665 goto again;
666 685
667 spin_lock_bh(&conn->session->lock); 686 spin_lock_bh(&conn->session->lock);
668 __iscsi_put_ctask(conn->ctask); 687 __iscsi_put_ctask(conn->ctask);
@@ -778,6 +797,10 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
778 } 797 }
779 798
780 conn = session->leadconn; 799 conn = session->leadconn;
800 if (!conn) {
801 reason = FAILURE_SESSION_FREED;
802 goto fault;
803 }
781 804
782 if (!__kfifo_get(session->cmdpool.queue, (void*)&ctask, 805 if (!__kfifo_get(session->cmdpool.queue, (void*)&ctask,
783 sizeof(void*))) { 806 sizeof(void*))) {
@@ -1377,7 +1400,6 @@ iscsi_session_setup(struct iscsi_transport *iscsit,
1377 } 1400 }
1378 1401
1379 spin_lock_init(&session->lock); 1402 spin_lock_init(&session->lock);
1380 INIT_LIST_HEAD(&session->connections);
1381 1403
1382 /* initialize immediate command pool */ 1404 /* initialize immediate command pool */
1383 if (iscsi_pool_init(&session->mgmtpool, session->mgmtpool_max, 1405 if (iscsi_pool_init(&session->mgmtpool, session->mgmtpool_max,
@@ -1580,16 +1602,11 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
1580 kfree(conn->persistent_address); 1602 kfree(conn->persistent_address);
1581 __kfifo_put(session->mgmtpool.queue, (void*)&conn->login_mtask, 1603 __kfifo_put(session->mgmtpool.queue, (void*)&conn->login_mtask,
1582 sizeof(void*)); 1604 sizeof(void*));
1583 list_del(&conn->item); 1605 if (session->leadconn == conn) {
1584 if (list_empty(&session->connections))
1585 session->leadconn = NULL; 1606 session->leadconn = NULL;
1586 if (session->leadconn && session->leadconn == conn)
1587 session->leadconn = container_of(session->connections.next,
1588 struct iscsi_conn, item);
1589
1590 if (session->leadconn == NULL)
1591 /* no connections exits.. reset sequencing */ 1607 /* no connections exits.. reset sequencing */
1592 session->cmdsn = session->max_cmdsn = session->exp_cmdsn = 1; 1608 session->cmdsn = session->max_cmdsn = session->exp_cmdsn = 1;
1609 }
1593 spin_unlock_bh(&session->lock); 1610 spin_unlock_bh(&session->lock);
1594 1611
1595 kfifo_free(conn->immqueue); 1612 kfifo_free(conn->immqueue);
@@ -1777,32 +1794,12 @@ int iscsi_conn_bind(struct iscsi_cls_session *cls_session,
1777 struct iscsi_cls_conn *cls_conn, int is_leading) 1794 struct iscsi_cls_conn *cls_conn, int is_leading)
1778{ 1795{
1779 struct iscsi_session *session = class_to_transport_session(cls_session); 1796 struct iscsi_session *session = class_to_transport_session(cls_session);
1780 struct iscsi_conn *tmp = ERR_PTR(-EEXIST), *conn = cls_conn->dd_data; 1797 struct iscsi_conn *conn = cls_conn->dd_data;
1781 1798
1782 /* lookup for existing connection */
1783 spin_lock_bh(&session->lock); 1799 spin_lock_bh(&session->lock);
1784 list_for_each_entry(tmp, &session->connections, item) {
1785 if (tmp == conn) {
1786 if (conn->c_stage != ISCSI_CONN_STOPPED ||
1787 conn->stop_stage == STOP_CONN_TERM) {
1788 printk(KERN_ERR "iscsi: can't bind "
1789 "non-stopped connection (%d:%d)\n",
1790 conn->c_stage, conn->stop_stage);
1791 spin_unlock_bh(&session->lock);
1792 return -EIO;
1793 }
1794 break;
1795 }
1796 }
1797 if (tmp != conn) {
1798 /* bind new iSCSI connection to session */
1799 conn->session = session;
1800 list_add(&conn->item, &session->connections);
1801 }
1802 spin_unlock_bh(&session->lock);
1803
1804 if (is_leading) 1800 if (is_leading)
1805 session->leadconn = conn; 1801 session->leadconn = conn;
1802 spin_unlock_bh(&session->lock);
1806 1803
1807 /* 1804 /*
1808 * Unblock xmitworker(), Login Phase will pass through. 1805 * Unblock xmitworker(), Login Phase will pass through.
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 9496e87c135e..2a4e02e7a392 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -594,7 +594,8 @@ lpfc_soft_wwpn_show(struct class_device *cdev, char *buf)
594{ 594{
595 struct Scsi_Host *host = class_to_shost(cdev); 595 struct Scsi_Host *host = class_to_shost(cdev);
596 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; 596 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;
597 return snprintf(buf, PAGE_SIZE, "0x%llx\n", phba->cfg_soft_wwpn); 597 return snprintf(buf, PAGE_SIZE, "0x%llx\n",
598 (unsigned long long)phba->cfg_soft_wwpn);
598} 599}
599 600
600 601
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index 1b53afb1cb57..3add7c237859 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -188,7 +188,8 @@ lpfc_alloc_ct_rsp(struct lpfc_hba * phba, int cmdcode, struct ulp_bde64 * bpl,
188 188
189 if (!mp->virt) { 189 if (!mp->virt) {
190 kfree(mp); 190 kfree(mp);
191 lpfc_free_ct_rsp(phba, mlist); 191 if (mlist)
192 lpfc_free_ct_rsp(phba, mlist);
192 return NULL; 193 return NULL;
193 } 194 }
194 195
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index b1d346049525..f2d79c3f0b8e 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -183,7 +183,7 @@ static void nsp_cs_dmessage(const char *func, int line, int mask, char *fmt, ...
183 * Clenaup parameters and call done() functions. 183 * Clenaup parameters and call done() functions.
184 * You must be set SCpnt->result before call this function. 184 * You must be set SCpnt->result before call this function.
185 */ 185 */
186static void nsp_scsi_done(Scsi_Cmnd *SCpnt) 186static void nsp_scsi_done(struct scsi_cmnd *SCpnt)
187{ 187{
188 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 188 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
189 189
@@ -192,7 +192,8 @@ static void nsp_scsi_done(Scsi_Cmnd *SCpnt)
192 SCpnt->scsi_done(SCpnt); 192 SCpnt->scsi_done(SCpnt);
193} 193}
194 194
195static int nsp_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) 195static int nsp_queuecommand(struct scsi_cmnd *SCpnt,
196 void (*done)(struct scsi_cmnd *))
196{ 197{
197#ifdef NSP_DEBUG 198#ifdef NSP_DEBUG
198 /*unsigned int host_id = SCpnt->device->host->this_id;*/ 199 /*unsigned int host_id = SCpnt->device->host->this_id;*/
@@ -365,7 +366,7 @@ static int nsphw_init(nsp_hw_data *data)
365/* 366/*
366 * Start selection phase 367 * Start selection phase
367 */ 368 */
368static int nsphw_start_selection(Scsi_Cmnd *SCpnt) 369static int nsphw_start_selection(struct scsi_cmnd *SCpnt)
369{ 370{
370 unsigned int host_id = SCpnt->device->host->this_id; 371 unsigned int host_id = SCpnt->device->host->this_id;
371 unsigned int base = SCpnt->device->host->io_port; 372 unsigned int base = SCpnt->device->host->io_port;
@@ -446,7 +447,7 @@ static struct nsp_sync_table nsp_sync_table_20M[] = {
446/* 447/*
447 * setup synchronous data transfer mode 448 * setup synchronous data transfer mode
448 */ 449 */
449static int nsp_analyze_sdtr(Scsi_Cmnd *SCpnt) 450static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt)
450{ 451{
451 unsigned char target = scmd_id(SCpnt); 452 unsigned char target = scmd_id(SCpnt);
452// unsigned char lun = SCpnt->device->lun; 453// unsigned char lun = SCpnt->device->lun;
@@ -504,7 +505,7 @@ static int nsp_analyze_sdtr(Scsi_Cmnd *SCpnt)
504/* 505/*
505 * start ninja hardware timer 506 * start ninja hardware timer
506 */ 507 */
507static void nsp_start_timer(Scsi_Cmnd *SCpnt, int time) 508static void nsp_start_timer(struct scsi_cmnd *SCpnt, int time)
508{ 509{
509 unsigned int base = SCpnt->device->host->io_port; 510 unsigned int base = SCpnt->device->host->io_port;
510 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 511 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
@@ -517,7 +518,8 @@ static void nsp_start_timer(Scsi_Cmnd *SCpnt, int time)
517/* 518/*
518 * wait for bus phase change 519 * wait for bus phase change
519 */ 520 */
520static int nsp_negate_signal(Scsi_Cmnd *SCpnt, unsigned char mask, char *str) 521static int nsp_negate_signal(struct scsi_cmnd *SCpnt, unsigned char mask,
522 char *str)
521{ 523{
522 unsigned int base = SCpnt->device->host->io_port; 524 unsigned int base = SCpnt->device->host->io_port;
523 unsigned char reg; 525 unsigned char reg;
@@ -544,9 +546,9 @@ static int nsp_negate_signal(Scsi_Cmnd *SCpnt, unsigned char mask, char *str)
544/* 546/*
545 * expect Ninja Irq 547 * expect Ninja Irq
546 */ 548 */
547static int nsp_expect_signal(Scsi_Cmnd *SCpnt, 549static int nsp_expect_signal(struct scsi_cmnd *SCpnt,
548 unsigned char current_phase, 550 unsigned char current_phase,
549 unsigned char mask) 551 unsigned char mask)
550{ 552{
551 unsigned int base = SCpnt->device->host->io_port; 553 unsigned int base = SCpnt->device->host->io_port;
552 int time_out; 554 int time_out;
@@ -579,7 +581,7 @@ static int nsp_expect_signal(Scsi_Cmnd *SCpnt,
579/* 581/*
580 * transfer SCSI message 582 * transfer SCSI message
581 */ 583 */
582static int nsp_xfer(Scsi_Cmnd *SCpnt, int phase) 584static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase)
583{ 585{
584 unsigned int base = SCpnt->device->host->io_port; 586 unsigned int base = SCpnt->device->host->io_port;
585 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 587 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
@@ -619,7 +621,7 @@ static int nsp_xfer(Scsi_Cmnd *SCpnt, int phase)
619/* 621/*
620 * get extra SCSI data from fifo 622 * get extra SCSI data from fifo
621 */ 623 */
622static int nsp_dataphase_bypass(Scsi_Cmnd *SCpnt) 624static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)
623{ 625{
624 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 626 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
625 unsigned int count; 627 unsigned int count;
@@ -651,7 +653,7 @@ static int nsp_dataphase_bypass(Scsi_Cmnd *SCpnt)
651/* 653/*
652 * accept reselection 654 * accept reselection
653 */ 655 */
654static int nsp_reselected(Scsi_Cmnd *SCpnt) 656static int nsp_reselected(struct scsi_cmnd *SCpnt)
655{ 657{
656 unsigned int base = SCpnt->device->host->io_port; 658 unsigned int base = SCpnt->device->host->io_port;
657 unsigned int host_id = SCpnt->device->host->this_id; 659 unsigned int host_id = SCpnt->device->host->this_id;
@@ -690,7 +692,7 @@ static int nsp_reselected(Scsi_Cmnd *SCpnt)
690/* 692/*
691 * count how many data transferd 693 * count how many data transferd
692 */ 694 */
693static int nsp_fifo_count(Scsi_Cmnd *SCpnt) 695static int nsp_fifo_count(struct scsi_cmnd *SCpnt)
694{ 696{
695 unsigned int base = SCpnt->device->host->io_port; 697 unsigned int base = SCpnt->device->host->io_port;
696 unsigned int count; 698 unsigned int count;
@@ -717,7 +719,7 @@ static int nsp_fifo_count(Scsi_Cmnd *SCpnt)
717/* 719/*
718 * read data in DATA IN phase 720 * read data in DATA IN phase
719 */ 721 */
720static void nsp_pio_read(Scsi_Cmnd *SCpnt) 722static void nsp_pio_read(struct scsi_cmnd *SCpnt)
721{ 723{
722 unsigned int base = SCpnt->device->host->io_port; 724 unsigned int base = SCpnt->device->host->io_port;
723 unsigned long mmio_base = SCpnt->device->host->base; 725 unsigned long mmio_base = SCpnt->device->host->base;
@@ -812,7 +814,7 @@ static void nsp_pio_read(Scsi_Cmnd *SCpnt)
812/* 814/*
813 * write data in DATA OUT phase 815 * write data in DATA OUT phase
814 */ 816 */
815static void nsp_pio_write(Scsi_Cmnd *SCpnt) 817static void nsp_pio_write(struct scsi_cmnd *SCpnt)
816{ 818{
817 unsigned int base = SCpnt->device->host->io_port; 819 unsigned int base = SCpnt->device->host->io_port;
818 unsigned long mmio_base = SCpnt->device->host->base; 820 unsigned long mmio_base = SCpnt->device->host->base;
@@ -905,7 +907,7 @@ static void nsp_pio_write(Scsi_Cmnd *SCpnt)
905/* 907/*
906 * setup synchronous/asynchronous data transfer mode 908 * setup synchronous/asynchronous data transfer mode
907 */ 909 */
908static int nsp_nexus(Scsi_Cmnd *SCpnt) 910static int nsp_nexus(struct scsi_cmnd *SCpnt)
909{ 911{
910 unsigned int base = SCpnt->device->host->io_port; 912 unsigned int base = SCpnt->device->host->io_port;
911 unsigned char target = scmd_id(SCpnt); 913 unsigned char target = scmd_id(SCpnt);
@@ -952,7 +954,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
952{ 954{
953 unsigned int base; 955 unsigned int base;
954 unsigned char irq_status, irq_phase, phase; 956 unsigned char irq_status, irq_phase, phase;
955 Scsi_Cmnd *tmpSC; 957 struct scsi_cmnd *tmpSC;
956 unsigned char target, lun; 958 unsigned char target, lun;
957 unsigned int *sync_neg; 959 unsigned int *sync_neg;
958 int i, tmp; 960 int i, tmp;
@@ -1530,7 +1532,7 @@ nsp_proc_info(
1530/*---------------------------------------------------------------*/ 1532/*---------------------------------------------------------------*/
1531 1533
1532/* 1534/*
1533static int nsp_eh_abort(Scsi_Cmnd *SCpnt) 1535static int nsp_eh_abort(struct scsi_cmnd *SCpnt)
1534{ 1536{
1535 nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt); 1537 nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt);
1536 1538
@@ -1558,7 +1560,7 @@ static int nsp_bus_reset(nsp_hw_data *data)
1558 return SUCCESS; 1560 return SUCCESS;
1559} 1561}
1560 1562
1561static int nsp_eh_bus_reset(Scsi_Cmnd *SCpnt) 1563static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt)
1562{ 1564{
1563 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 1565 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
1564 1566
@@ -1567,7 +1569,7 @@ static int nsp_eh_bus_reset(Scsi_Cmnd *SCpnt)
1567 return nsp_bus_reset(data); 1569 return nsp_bus_reset(data);
1568} 1570}
1569 1571
1570static int nsp_eh_host_reset(Scsi_Cmnd *SCpnt) 1572static int nsp_eh_host_reset(struct scsi_cmnd *SCpnt)
1571{ 1573{
1572 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 1574 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
1573 1575
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index a88714f4c05b..625ca97da52d 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -266,7 +266,7 @@ typedef struct _nsp_hw_data {
266 266
267 int TimerCount; 267 int TimerCount;
268 int SelectionTimeOut; 268 int SelectionTimeOut;
269 Scsi_Cmnd *CurrentSC; 269 struct scsi_cmnd *CurrentSC;
270 //int CurrnetTarget; 270 //int CurrnetTarget;
271 271
272 int FifoCount; 272 int FifoCount;
@@ -319,30 +319,34 @@ static int nsp_proc_info (
319 int hostno, 319 int hostno,
320#endif 320#endif
321 int inout); 321 int inout);
322static int nsp_queuecommand(Scsi_Cmnd *SCpnt, void (* done)(Scsi_Cmnd *SCpnt)); 322static int nsp_queuecommand(struct scsi_cmnd *SCpnt,
323 void (* done)(struct scsi_cmnd *SCpnt));
323 324
324/* Error handler */ 325/* Error handler */
325/*static int nsp_eh_abort (Scsi_Cmnd *SCpnt);*/ 326/*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/
326/*static int nsp_eh_device_reset(Scsi_Cmnd *SCpnt);*/ 327/*static int nsp_eh_device_reset(struct scsi_cmnd *SCpnt);*/
327static int nsp_eh_bus_reset (Scsi_Cmnd *SCpnt); 328static int nsp_eh_bus_reset (struct scsi_cmnd *SCpnt);
328static int nsp_eh_host_reset (Scsi_Cmnd *SCpnt); 329static int nsp_eh_host_reset (struct scsi_cmnd *SCpnt);
329static int nsp_bus_reset (nsp_hw_data *data); 330static int nsp_bus_reset (nsp_hw_data *data);
330 331
331/* */ 332/* */
332static int nsphw_init (nsp_hw_data *data); 333static int nsphw_init (nsp_hw_data *data);
333static int nsphw_start_selection(Scsi_Cmnd *SCpnt); 334static int nsphw_start_selection(struct scsi_cmnd *SCpnt);
334static void nsp_start_timer (Scsi_Cmnd *SCpnt, int time); 335static void nsp_start_timer (struct scsi_cmnd *SCpnt, int time);
335static int nsp_fifo_count (Scsi_Cmnd *SCpnt); 336static int nsp_fifo_count (struct scsi_cmnd *SCpnt);
336static void nsp_pio_read (Scsi_Cmnd *SCpnt); 337static void nsp_pio_read (struct scsi_cmnd *SCpnt);
337static void nsp_pio_write (Scsi_Cmnd *SCpnt); 338static void nsp_pio_write (struct scsi_cmnd *SCpnt);
338static int nsp_nexus (Scsi_Cmnd *SCpnt); 339static int nsp_nexus (struct scsi_cmnd *SCpnt);
339static void nsp_scsi_done (Scsi_Cmnd *SCpnt); 340static void nsp_scsi_done (struct scsi_cmnd *SCpnt);
340static int nsp_analyze_sdtr (Scsi_Cmnd *SCpnt); 341static int nsp_analyze_sdtr (struct scsi_cmnd *SCpnt);
341static int nsp_negate_signal (Scsi_Cmnd *SCpnt, unsigned char mask, char *str); 342static int nsp_negate_signal (struct scsi_cmnd *SCpnt,
342static int nsp_expect_signal (Scsi_Cmnd *SCpnt, unsigned char current_phase, unsigned char mask); 343 unsigned char mask, char *str);
343static int nsp_xfer (Scsi_Cmnd *SCpnt, int phase); 344static int nsp_expect_signal (struct scsi_cmnd *SCpnt,
344static int nsp_dataphase_bypass (Scsi_Cmnd *SCpnt); 345 unsigned char current_phase,
345static int nsp_reselected (Scsi_Cmnd *SCpnt); 346 unsigned char mask);
347static int nsp_xfer (struct scsi_cmnd *SCpnt, int phase);
348static int nsp_dataphase_bypass (struct scsi_cmnd *SCpnt);
349static int nsp_reselected (struct scsi_cmnd *SCpnt);
346static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht); 350static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht);
347 351
348/* Interrupt handler */ 352/* Interrupt handler */
@@ -355,8 +359,8 @@ static void __exit nsp_cs_exit(void);
355 359
356/* Debug */ 360/* Debug */
357#ifdef NSP_DEBUG 361#ifdef NSP_DEBUG
358static void show_command (Scsi_Cmnd *SCpnt); 362static void show_command (struct scsi_cmnd *SCpnt);
359static void show_phase (Scsi_Cmnd *SCpnt); 363static void show_phase (struct scsi_cmnd *SCpnt);
360static void show_busphase(unsigned char stat); 364static void show_busphase(unsigned char stat);
361static void show_message (nsp_hw_data *data); 365static void show_message (nsp_hw_data *data);
362#else 366#else
diff --git a/drivers/scsi/pcmcia/nsp_debug.c b/drivers/scsi/pcmcia/nsp_debug.c
index 62e5c60067fd..2f75fe6e35a7 100644
--- a/drivers/scsi/pcmcia/nsp_debug.c
+++ b/drivers/scsi/pcmcia/nsp_debug.c
@@ -138,12 +138,12 @@ static void print_commandk (unsigned char *command)
138 printk("\n"); 138 printk("\n");
139} 139}
140 140
141static void show_command(Scsi_Cmnd *SCpnt) 141static void show_command(struct scsi_cmnd *SCpnt)
142{ 142{
143 print_commandk(SCpnt->cmnd); 143 print_commandk(SCpnt->cmnd);
144} 144}
145 145
146static void show_phase(Scsi_Cmnd *SCpnt) 146static void show_phase(struct scsi_cmnd *SCpnt)
147{ 147{
148 int i = SCpnt->SCp.phase; 148 int i = SCpnt->SCp.phase;
149 149
diff --git a/drivers/scsi/pcmcia/nsp_message.c b/drivers/scsi/pcmcia/nsp_message.c
index d7057737ff34..ef593b70d0f0 100644
--- a/drivers/scsi/pcmcia/nsp_message.c
+++ b/drivers/scsi/pcmcia/nsp_message.c
@@ -8,7 +8,7 @@
8 8
9/* $Id: nsp_message.c,v 1.6 2003/07/26 14:21:09 elca Exp $ */ 9/* $Id: nsp_message.c,v 1.6 2003/07/26 14:21:09 elca Exp $ */
10 10
11static void nsp_message_in(Scsi_Cmnd *SCpnt) 11static void nsp_message_in(struct scsi_cmnd *SCpnt)
12{ 12{
13 unsigned int base = SCpnt->device->host->io_port; 13 unsigned int base = SCpnt->device->host->io_port;
14 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 14 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
@@ -50,7 +50,7 @@ static void nsp_message_in(Scsi_Cmnd *SCpnt)
50 50
51} 51}
52 52
53static void nsp_message_out(Scsi_Cmnd *SCpnt) 53static void nsp_message_out(struct scsi_cmnd *SCpnt)
54{ 54{
55 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 55 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
56 int ret = 1; 56 int ret = 1;
diff --git a/drivers/scsi/psi240i.c b/drivers/scsi/psi240i.c
index a720c9265e66..ac0419e2714a 100644
--- a/drivers/scsi/psi240i.c
+++ b/drivers/scsi/psi240i.c
@@ -87,11 +87,11 @@ typedef struct
87 { 87 {
88 USHORT ports[13]; 88 USHORT ports[13];
89 OUR_DEVICE device[8]; 89 OUR_DEVICE device[8];
90 Scsi_Cmnd *pSCmnd; 90 struct scsi_cmnd *pSCmnd;
91 IDE_STRUCT ide; 91 IDE_STRUCT ide;
92 ULONG startSector; 92 ULONG startSector;
93 USHORT sectorCount; 93 USHORT sectorCount;
94 Scsi_Cmnd *SCpnt; 94 struct scsi_cmnd *SCpnt;
95 VOID *buffer; 95 VOID *buffer;
96 USHORT expectingIRQ; 96 USHORT expectingIRQ;
97 } ADAPTER240I, *PADAPTER240I; 97 } ADAPTER240I, *PADAPTER240I;
@@ -253,12 +253,12 @@ static ULONG DecodeError (struct Scsi_Host *pshost, UCHAR status)
253 ****************************************************************/ 253 ****************************************************************/
254static void Irq_Handler (int irq, void *dev_id) 254static void Irq_Handler (int irq, void *dev_id)
255 { 255 {
256 struct Scsi_Host *shost; // Pointer to host data block 256 struct Scsi_Host *shost; // Pointer to host data block
257 PADAPTER240I padapter; // Pointer to adapter control structure 257 PADAPTER240I padapter; // Pointer to adapter control structure
258 USHORT *pports; // I/O port array 258 USHORT *pports; // I/O port array
259 Scsi_Cmnd *SCpnt; 259 struct scsi_cmnd *SCpnt;
260 UCHAR status; 260 UCHAR status;
261 int z; 261 int z;
262 262
263 DEB(printk ("\npsi240i received interrupt\n")); 263 DEB(printk ("\npsi240i received interrupt\n"));
264 264
@@ -389,12 +389,17 @@ static irqreturn_t do_Irq_Handler (int irq, void *dev_id)
389 * Returns: Status code. 389 * Returns: Status code.
390 * 390 *
391 ****************************************************************/ 391 ****************************************************************/
392static int Psi240i_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) 392static int Psi240i_QueueCommand(struct scsi_cmnd *SCpnt,
393 void (*done)(struct scsi_cmnd *))
393 { 394 {
394 UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB 395 UCHAR *cdb = (UCHAR *)SCpnt->cmnd;
395 PADAPTER240I padapter = HOSTDATA (SCpnt->device->host); // Pointer to adapter control structure 396 // Pointer to SCSI CDB
396 POUR_DEVICE pdev = &padapter->device [SCpnt->device->id];// Pointer to device information 397 PADAPTER240I padapter = HOSTDATA (SCpnt->device->host);
397 UCHAR rc; // command return code 398 // Pointer to adapter control structure
399 POUR_DEVICE pdev = &padapter->device [SCpnt->device->id];
400 // Pointer to device information
401 UCHAR rc;
402 // command return code
398 403
399 SCpnt->scsi_done = done; 404 SCpnt->scsi_done = done;
400 padapter->ide.ide.ides.spigot = pdev->spigot; 405 padapter->ide.ide.ides.spigot = pdev->spigot;
diff --git a/drivers/scsi/psi240i.h b/drivers/scsi/psi240i.h
index 6a598766df51..21ebb9214004 100644
--- a/drivers/scsi/psi240i.h
+++ b/drivers/scsi/psi240i.h
@@ -309,7 +309,7 @@ typedef struct _IDENTIFY_DATA2 {
309#endif // PSI_EIDE_SCSIOP 309#endif // PSI_EIDE_SCSIOP
310 310
311// function prototypes 311// function prototypes
312int Psi240i_Command (Scsi_Cmnd *SCpnt); 312int Psi240i_Command(struct scsi_cmnd *SCpnt);
313int Psi240i_Abort (Scsi_Cmnd *SCpnt); 313int Psi240i_Abort(struct scsi_cmnd *SCpnt);
314int Psi240i_Reset (Scsi_Cmnd *SCpnt, unsigned int flags); 314int Psi240i_Reset(struct scsi_cmnd *SCpnt, unsigned int flags);
315#endif 315#endif
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 2521d548dd59..16af5b79e587 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -931,11 +931,10 @@ qla1280_error_action(struct scsi_cmnd *cmd, enum action action)
931 931
932 case BUS_RESET: 932 case BUS_RESET:
933 if (qla1280_verbose) 933 if (qla1280_verbose)
934 printk(KERN_INFO "qla1280(%ld:%d): Issuing BUS " 934 printk(KERN_INFO "qla1280(%ld:%d): Issued bus "
935 "DEVICE RESET\n", ha->host_no, bus); 935 "reset.\n", ha->host_no, bus);
936 if (qla1280_bus_reset(ha, bus == 0)) 936 if (qla1280_bus_reset(ha, bus) == 0)
937 result = SUCCESS; 937 result = SUCCESS;
938
939 break; 938 break;
940 939
941 case ADAPTER_RESET: 940 case ADAPTER_RESET:
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index ee75a71f3c66..285c8e8ff1a0 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -379,21 +379,37 @@ static struct bin_attribute sysfs_sfp_attr = {
379 .read = qla2x00_sysfs_read_sfp, 379 .read = qla2x00_sysfs_read_sfp,
380}; 380};
381 381
382static struct sysfs_entry {
383 char *name;
384 struct bin_attribute *attr;
385 int is4GBp_only;
386} bin_file_entries[] = {
387 { "fw_dump", &sysfs_fw_dump_attr, },
388 { "nvram", &sysfs_nvram_attr, },
389 { "optrom", &sysfs_optrom_attr, },
390 { "optrom_ctl", &sysfs_optrom_ctl_attr, },
391 { "vpd", &sysfs_vpd_attr, 1 },
392 { "sfp", &sysfs_sfp_attr, 1 },
393 { 0 },
394};
395
382void 396void
383qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha) 397qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
384{ 398{
385 struct Scsi_Host *host = ha->host; 399 struct Scsi_Host *host = ha->host;
400 struct sysfs_entry *iter;
401 int ret;
386 402
387 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); 403 for (iter = bin_file_entries; iter->name; iter++) {
388 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); 404 if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)))
389 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr); 405 continue;
390 sysfs_create_bin_file(&host->shost_gendev.kobj, 406
391 &sysfs_optrom_ctl_attr); 407 ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
392 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { 408 iter->attr);
393 sysfs_create_bin_file(&host->shost_gendev.kobj, 409 if (ret)
394 &sysfs_vpd_attr); 410 qla_printk(KERN_INFO, ha,
395 sysfs_create_bin_file(&host->shost_gendev.kobj, 411 "Unable to create sysfs %s binary attribute "
396 &sysfs_sfp_attr); 412 "(%d).\n", iter->name, ret);
397 } 413 }
398} 414}
399 415
@@ -401,17 +417,14 @@ void
401qla2x00_free_sysfs_attr(scsi_qla_host_t *ha) 417qla2x00_free_sysfs_attr(scsi_qla_host_t *ha)
402{ 418{
403 struct Scsi_Host *host = ha->host; 419 struct Scsi_Host *host = ha->host;
420 struct sysfs_entry *iter;
421
422 for (iter = bin_file_entries; iter->name; iter++) {
423 if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)))
424 continue;
404 425
405 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
406 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
407 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
408 sysfs_remove_bin_file(&host->shost_gendev.kobj,
409 &sysfs_optrom_ctl_attr);
410 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
411 sysfs_remove_bin_file(&host->shost_gendev.kobj,
412 &sysfs_vpd_attr);
413 sysfs_remove_bin_file(&host->shost_gendev.kobj, 426 sysfs_remove_bin_file(&host->shost_gendev.kobj,
414 &sysfs_sfp_attr); 427 iter->attr);
415 } 428 }
416 429
417 if (ha->beacon_blink_led == 1) 430 if (ha->beacon_blink_led == 1)
diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h
index 90dad7e88985..5b12278968e0 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.h
+++ b/drivers/scsi/qla2xxx/qla_dbg.h
@@ -38,7 +38,7 @@
38* Macros use for debugging the driver. 38* Macros use for debugging the driver.
39*/ 39*/
40 40
41#define DEBUG(x) do { if (qla2_extended_error_logging) { x; } } while (0) 41#define DEBUG(x) do { if (ql2xextended_error_logging) { x; } } while (0)
42 42
43#if defined(QL_DEBUG_LEVEL_1) 43#if defined(QL_DEBUG_LEVEL_1)
44#define DEBUG1(x) do {x;} while (0) 44#define DEBUG1(x) do {x;} while (0)
@@ -46,12 +46,12 @@
46#define DEBUG1(x) do {} while (0) 46#define DEBUG1(x) do {} while (0)
47#endif 47#endif
48 48
49#define DEBUG2(x) do { if (qla2_extended_error_logging) { x; } } while (0) 49#define DEBUG2(x) do { if (ql2xextended_error_logging) { x; } } while (0)
50#define DEBUG2_3(x) do { if (qla2_extended_error_logging) { x; } } while (0) 50#define DEBUG2_3(x) do { if (ql2xextended_error_logging) { x; } } while (0)
51#define DEBUG2_3_11(x) do { if (qla2_extended_error_logging) { x; } } while (0) 51#define DEBUG2_3_11(x) do { if (ql2xextended_error_logging) { x; } } while (0)
52#define DEBUG2_9_10(x) do { if (qla2_extended_error_logging) { x; } } while (0) 52#define DEBUG2_9_10(x) do { if (ql2xextended_error_logging) { x; } } while (0)
53#define DEBUG2_11(x) do { if (qla2_extended_error_logging) { x; } } while (0) 53#define DEBUG2_11(x) do { if (ql2xextended_error_logging) { x; } } while (0)
54#define DEBUG2_13(x) do { if (qla2_extended_error_logging) { x; } } while (0) 54#define DEBUG2_13(x) do { if (ql2xextended_error_logging) { x; } } while (0)
55 55
56#if defined(QL_DEBUG_LEVEL_3) 56#if defined(QL_DEBUG_LEVEL_3)
57#define DEBUG3(x) do {x;} while (0) 57#define DEBUG3(x) do {x;} while (0)
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index bab33f6d0bdb..c4fc40f8e8ca 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1545,6 +1545,9 @@ typedef struct fc_port {
1545 spinlock_t rport_lock; 1545 spinlock_t rport_lock;
1546 struct fc_rport *rport, *drport; 1546 struct fc_rport *rport, *drport;
1547 u32 supported_classes; 1547 u32 supported_classes;
1548
1549 unsigned long last_queue_full;
1550 unsigned long last_ramp_up;
1548} fc_port_t; 1551} fc_port_t;
1549 1552
1550/* 1553/*
@@ -2255,6 +2258,7 @@ typedef struct scsi_qla_host {
2255 uint16_t mgmt_svr_loop_id; 2258 uint16_t mgmt_svr_loop_id;
2256 2259
2257 uint32_t login_retry_count; 2260 uint32_t login_retry_count;
2261 int max_q_depth;
2258 2262
2259 /* Fibre Channel Device List. */ 2263 /* Fibre Channel Device List. */
2260 struct list_head fcports; 2264 struct list_head fcports;
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 7da69832d74c..32ebeec45ff0 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -48,6 +48,7 @@ extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
48extern void qla2x00_reg_remote_port(scsi_qla_host_t *, fc_port_t *); 48extern void qla2x00_reg_remote_port(scsi_qla_host_t *, fc_port_t *);
49 49
50extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *); 50extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *);
51extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *);
51 52
52/* 53/*
53 * Global Data in qla_os.c source file. 54 * Global Data in qla_os.c source file.
@@ -60,7 +61,8 @@ extern int ql2xplogiabsentdevice;
60extern int ql2xloginretrycount; 61extern int ql2xloginretrycount;
61extern int ql2xfdmienable; 62extern int ql2xfdmienable;
62extern int ql2xallocfwdump; 63extern int ql2xallocfwdump;
63extern int qla2_extended_error_logging; 64extern int ql2xextended_error_logging;
65extern int ql2xqfullrampup;
64 66
65extern void qla2x00_sp_compl(scsi_qla_host_t *, srb_t *); 67extern void qla2x00_sp_compl(scsi_qla_host_t *, srb_t *);
66 68
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 833b93085fd3..08cb5e3fb553 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1644,7 +1644,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1644 * Set host adapter parameters. 1644 * Set host adapter parameters.
1645 */ 1645 */
1646 if (nv->host_p[0] & BIT_7) 1646 if (nv->host_p[0] & BIT_7)
1647 qla2_extended_error_logging = 1; 1647 ql2xextended_error_logging = 1;
1648 ha->flags.disable_risc_code_load = ((nv->host_p[0] & BIT_4) ? 1 : 0); 1648 ha->flags.disable_risc_code_load = ((nv->host_p[0] & BIT_4) ? 1 : 0);
1649 /* Always load RISC code on non ISP2[12]00 chips. */ 1649 /* Always load RISC code on non ISP2[12]00 chips. */
1650 if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) 1650 if (!IS_QLA2100(ha) && !IS_QLA2200(ha))
@@ -3948,3 +3948,24 @@ qla24xx_load_risc(scsi_qla_host_t *ha, uint32_t *srisc_addr)
3948fail_fw_integrity: 3948fail_fw_integrity:
3949 return QLA_FUNCTION_FAILED; 3949 return QLA_FUNCTION_FAILED;
3950} 3950}
3951
3952void
3953qla2x00_try_to_stop_firmware(scsi_qla_host_t *ha)
3954{
3955 int ret, retries;
3956
3957 if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
3958 return;
3959
3960 ret = qla2x00_stop_firmware(ha);
3961 for (retries = 5; ret != QLA_SUCCESS && retries ; retries--) {
3962 qla2x00_reset_chip(ha);
3963 if (qla2x00_chip_diag(ha) != QLA_SUCCESS)
3964 continue;
3965 if (qla2x00_setup_chip(ha) != QLA_SUCCESS)
3966 continue;
3967 qla_printk(KERN_INFO, ha,
3968 "Attempting retry of stop-firmware command...\n");
3969 ret = qla2x00_stop_firmware(ha);
3970 }
3971}
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 626c7178a434..d3b6df4d55c8 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -6,6 +6,8 @@
6 */ 6 */
7#include "qla_def.h" 7#include "qla_def.h"
8 8
9#include <scsi/scsi_tcq.h>
10
9static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t); 11static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t);
10static void qla2x00_async_event(scsi_qla_host_t *, uint16_t *); 12static void qla2x00_async_event(scsi_qla_host_t *, uint16_t *);
11static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t); 13static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t);
@@ -593,6 +595,67 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
593 } 595 }
594} 596}
595 597
598static void
599qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, void *data)
600{
601 fc_port_t *fcport = data;
602
603 if (fcport->ha->max_q_depth <= sdev->queue_depth)
604 return;
605
606 if (sdev->ordered_tags)
607 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG,
608 sdev->queue_depth + 1);
609 else
610 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG,
611 sdev->queue_depth + 1);
612
613 fcport->last_ramp_up = jiffies;
614
615 DEBUG2(qla_printk(KERN_INFO, fcport->ha,
616 "scsi(%ld:%d:%d:%d): Queue depth adjusted-up to %d.\n",
617 fcport->ha->host_no, sdev->channel, sdev->id, sdev->lun,
618 sdev->queue_depth));
619}
620
621static void
622qla2x00_adjust_sdev_qdepth_down(struct scsi_device *sdev, void *data)
623{
624 fc_port_t *fcport = data;
625
626 if (!scsi_track_queue_full(sdev, sdev->queue_depth - 1))
627 return;
628
629 DEBUG2(qla_printk(KERN_INFO, fcport->ha,
630 "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
631 fcport->ha->host_no, sdev->channel, sdev->id, sdev->lun,
632 sdev->queue_depth));
633}
634
635static inline void
636qla2x00_ramp_up_queue_depth(scsi_qla_host_t *ha, srb_t *sp)
637{
638 fc_port_t *fcport;
639 struct scsi_device *sdev;
640
641 sdev = sp->cmd->device;
642 if (sdev->queue_depth >= ha->max_q_depth)
643 return;
644
645 fcport = sp->fcport;
646 if (time_before(jiffies,
647 fcport->last_ramp_up + ql2xqfullrampup * HZ))
648 return;
649 if (time_before(jiffies,
650 fcport->last_queue_full + ql2xqfullrampup * HZ))
651 return;
652
653 spin_unlock_irq(&ha->hardware_lock);
654 starget_for_each_device(sdev->sdev_target, fcport,
655 qla2x00_adjust_sdev_qdepth_up);
656 spin_lock_irq(&ha->hardware_lock);
657}
658
596/** 659/**
597 * qla2x00_process_completed_request() - Process a Fast Post response. 660 * qla2x00_process_completed_request() - Process a Fast Post response.
598 * @ha: SCSI driver HA context 661 * @ha: SCSI driver HA context
@@ -624,6 +687,8 @@ qla2x00_process_completed_request(struct scsi_qla_host *ha, uint32_t index)
624 687
625 /* Save ISP completion status */ 688 /* Save ISP completion status */
626 sp->cmd->result = DID_OK << 16; 689 sp->cmd->result = DID_OK << 16;
690
691 qla2x00_ramp_up_queue_depth(ha, sp);
627 qla2x00_sp_compl(ha, sp); 692 qla2x00_sp_compl(ha, sp);
628 } else { 693 } else {
629 DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n", 694 DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n",
@@ -823,6 +888,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
823 */ 888 */
824 switch (comp_status) { 889 switch (comp_status) {
825 case CS_COMPLETE: 890 case CS_COMPLETE:
891 case CS_QUEUE_FULL:
826 if (scsi_status == 0) { 892 if (scsi_status == 0) {
827 cp->result = DID_OK << 16; 893 cp->result = DID_OK << 16;
828 break; 894 break;
@@ -849,6 +915,20 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
849 } 915 }
850 cp->result = DID_OK << 16 | lscsi_status; 916 cp->result = DID_OK << 16 | lscsi_status;
851 917
918 if (lscsi_status == SAM_STAT_TASK_SET_FULL) {
919 DEBUG2(printk(KERN_INFO
920 "scsi(%ld): QUEUE FULL status detected "
921 "0x%x-0x%x.\n", ha->host_no, comp_status,
922 scsi_status));
923
924 /* Adjust queue depth for all luns on the port. */
925 fcport->last_queue_full = jiffies;
926 spin_unlock_irq(&ha->hardware_lock);
927 starget_for_each_device(cp->device->sdev_target,
928 fcport, qla2x00_adjust_sdev_qdepth_down);
929 spin_lock_irq(&ha->hardware_lock);
930 break;
931 }
852 if (lscsi_status != SS_CHECK_CONDITION) 932 if (lscsi_status != SS_CHECK_CONDITION)
853 break; 933 break;
854 934
@@ -1066,17 +1146,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
1066 qla2x00_mark_device_lost(ha, fcport, 1, 1); 1146 qla2x00_mark_device_lost(ha, fcport, 1, 1);
1067 break; 1147 break;
1068 1148
1069 case CS_QUEUE_FULL:
1070 DEBUG2(printk(KERN_INFO
1071 "scsi(%ld): QUEUE FULL status detected 0x%x-0x%x.\n",
1072 ha->host_no, comp_status, scsi_status));
1073
1074 /* SCSI Mid-Layer handles device queue full */
1075
1076 cp->result = DID_OK << 16 | lscsi_status;
1077
1078 break;
1079
1080 default: 1149 default:
1081 DEBUG3(printk("scsi(%ld): Error detected (unknown status) " 1150 DEBUG3(printk("scsi(%ld): Error detected (unknown status) "
1082 "0x%x-0x%x.\n", ha->host_no, comp_status, scsi_status)); 1151 "0x%x-0x%x.\n", ha->host_no, comp_status, scsi_status));
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3f20d765563e..208607be78c7 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -61,9 +61,9 @@ MODULE_PARM_DESC(ql2xallocfwdump,
61 "during HBA initialization. Memory allocation requirements " 61 "during HBA initialization. Memory allocation requirements "
62 "vary by ISP type. Default is 1 - allocate memory."); 62 "vary by ISP type. Default is 1 - allocate memory.");
63 63
64int qla2_extended_error_logging; 64int ql2xextended_error_logging;
65module_param(qla2_extended_error_logging, int, S_IRUGO|S_IRUSR); 65module_param(ql2xextended_error_logging, int, S_IRUGO|S_IRUSR);
66MODULE_PARM_DESC(qla2_extended_error_logging, 66MODULE_PARM_DESC(ql2xextended_error_logging,
67 "Option to enable extended error logging, " 67 "Option to enable extended error logging, "
68 "Default is 0 - no logging. 1 - log errors."); 68 "Default is 0 - no logging. 1 - log errors.");
69 69
@@ -77,6 +77,19 @@ MODULE_PARM_DESC(ql2xfdmienable,
77 "Enables FDMI registratons " 77 "Enables FDMI registratons "
78 "Default is 0 - no FDMI. 1 - perfom FDMI."); 78 "Default is 0 - no FDMI. 1 - perfom FDMI.");
79 79
80#define MAX_Q_DEPTH 32
81static int ql2xmaxqdepth = MAX_Q_DEPTH;
82module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR);
83MODULE_PARM_DESC(ql2xmaxqdepth,
84 "Maximum queue depth to report for target devices.");
85
86int ql2xqfullrampup = 120;
87module_param(ql2xqfullrampup, int, S_IRUGO|S_IWUSR);
88MODULE_PARM_DESC(ql2xqfullrampup,
89 "Number of seconds to wait to begin to ramp-up the queue "
90 "depth for a device after a queue-full condition has been "
91 "detected. Default is 120 seconds.");
92
80/* 93/*
81 * SCSI host template entry points 94 * SCSI host template entry points
82 */ 95 */
@@ -1104,9 +1117,9 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
1104 struct fc_rport *rport = starget_to_rport(sdev->sdev_target); 1117 struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
1105 1118
1106 if (sdev->tagged_supported) 1119 if (sdev->tagged_supported)
1107 scsi_activate_tcq(sdev, 32); 1120 scsi_activate_tcq(sdev, ha->max_q_depth);
1108 else 1121 else
1109 scsi_deactivate_tcq(sdev, 32); 1122 scsi_deactivate_tcq(sdev, ha->max_q_depth);
1110 1123
1111 rport->dev_loss_tmo = ha->port_down_retry_count + 5; 1124 rport->dev_loss_tmo = ha->port_down_retry_count + 5;
1112 1125
@@ -1413,6 +1426,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1413 ha->link_data_rate = PORT_SPEED_UNKNOWN; 1426 ha->link_data_rate = PORT_SPEED_UNKNOWN;
1414 ha->optrom_size = OPTROM_SIZE_2300; 1427 ha->optrom_size = OPTROM_SIZE_2300;
1415 1428
1429 ha->max_q_depth = MAX_Q_DEPTH;
1430 if (ql2xmaxqdepth != 0 && ql2xmaxqdepth <= 0xffffU)
1431 ha->max_q_depth = ql2xmaxqdepth;
1432
1416 /* Assign ISP specific operations. */ 1433 /* Assign ISP specific operations. */
1417 ha->isp_ops.pci_config = qla2100_pci_config; 1434 ha->isp_ops.pci_config = qla2100_pci_config;
1418 ha->isp_ops.reset_chip = qla2x00_reset_chip; 1435 ha->isp_ops.reset_chip = qla2x00_reset_chip;
@@ -1712,8 +1729,10 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1712 if (ha->eft) 1729 if (ha->eft)
1713 qla2x00_trace_control(ha, TC_DISABLE, 0, 0); 1730 qla2x00_trace_control(ha, TC_DISABLE, 0, 0);
1714 1731
1732 ha->flags.online = 0;
1733
1715 /* Stop currently executing firmware. */ 1734 /* Stop currently executing firmware. */
1716 qla2x00_stop_firmware(ha); 1735 qla2x00_try_to_stop_firmware(ha);
1717 1736
1718 /* turn-off interrupts on the card */ 1737 /* turn-off interrupts on the card */
1719 if (ha->interrupts_on) 1738 if (ha->interrupts_on)
@@ -1721,8 +1740,6 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1721 1740
1722 qla2x00_mem_free(ha); 1741 qla2x00_mem_free(ha);
1723 1742
1724 ha->flags.online = 0;
1725
1726 /* Detach interrupts */ 1743 /* Detach interrupts */
1727 if (ha->host->irq) 1744 if (ha->host->irq)
1728 free_irq(ha->host->irq, ha); 1745 free_irq(ha->host->irq, ha);
@@ -2697,7 +2714,7 @@ qla2x00_module_init(void)
2697 2714
2698 /* Derive version string. */ 2715 /* Derive version string. */
2699 strcpy(qla2x00_version_str, QLA2XXX_VERSION); 2716 strcpy(qla2x00_version_str, QLA2XXX_VERSION);
2700 if (qla2_extended_error_logging) 2717 if (ql2xextended_error_logging)
2701 strcat(qla2x00_version_str, "-debug"); 2718 strcat(qla2x00_version_str, "-debug");
2702 2719
2703 qla2xxx_transport_template = 2720 qla2xxx_transport_template =
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index e57bf45a3393..1fa0bce6b24e 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
7/* 7/*
8 * Driver version 8 * Driver version
9 */ 9 */
10#define QLA2XXX_VERSION "8.01.07-k2" 10#define QLA2XXX_VERSION "8.01.07-k3"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 1 13#define QLA_DRIVER_MINOR_VER 1
diff --git a/drivers/scsi/qla4xxx/ql4_dbg.h b/drivers/scsi/qla4xxx/ql4_dbg.h
index 3e99dcfd5a9f..d861c3b411c8 100644
--- a/drivers/scsi/qla4xxx/ql4_dbg.h
+++ b/drivers/scsi/qla4xxx/ql4_dbg.h
@@ -22,14 +22,14 @@
22#endif 22#endif
23 23
24#if defined(QL_DEBUG_LEVEL_2) 24#if defined(QL_DEBUG_LEVEL_2)
25#define DEBUG2(x) do {if(qla4_extended_error_logging == 2) x;} while (0); 25#define DEBUG2(x) do {if(ql4xextended_error_logging == 2) x;} while (0);
26#define DEBUG2_3(x) do {x;} while (0); 26#define DEBUG2_3(x) do {x;} while (0);
27#else /* */ 27#else /* */
28#define DEBUG2(x) do {} while (0); 28#define DEBUG2(x) do {} while (0);
29#endif /* */ 29#endif /* */
30 30
31#if defined(QL_DEBUG_LEVEL_3) 31#if defined(QL_DEBUG_LEVEL_3)
32#define DEBUG3(x) do {if(qla4_extended_error_logging == 3) x;} while (0); 32#define DEBUG3(x) do {if(ql4xextended_error_logging == 3) x;} while (0);
33#else /* */ 33#else /* */
34#define DEBUG3(x) do {} while (0); 34#define DEBUG3(x) do {} while (0);
35#if !defined(QL_DEBUG_LEVEL_2) 35#if !defined(QL_DEBUG_LEVEL_2)
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h
index 2c803edf2de8..1b221ff0f6f7 100644
--- a/drivers/scsi/qla4xxx/ql4_glbl.h
+++ b/drivers/scsi/qla4xxx/ql4_glbl.h
@@ -72,7 +72,7 @@ int qla4xxx_reinitialize_ddb_list(struct scsi_qla_host * ha);
72int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha, 72int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha,
73 uint32_t fw_ddb_index, uint32_t state); 73 uint32_t fw_ddb_index, uint32_t state);
74 74
75extern int qla4_extended_error_logging; 75extern int ql4xextended_error_logging;
76extern int ql4xdiscoverywait; 76extern int ql4xdiscoverywait;
77extern int ql4xdontresethba; 77extern int ql4xdontresethba;
78#endif /* _QLA4x_GBL_H */ 78#endif /* _QLA4x_GBL_H */
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index ef82399c0858..b721dc5dd711 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -701,7 +701,7 @@ void qla4xxx_get_conn_event_log(struct scsi_qla_host * ha)
701 DEBUG3(printk("scsi%ld: Connection Event Log Dump (%d entries):\n", 701 DEBUG3(printk("scsi%ld: Connection Event Log Dump (%d entries):\n",
702 ha->host_no, num_valid_entries)); 702 ha->host_no, num_valid_entries));
703 703
704 if (qla4_extended_error_logging == 3) { 704 if (ql4xextended_error_logging == 3) {
705 if (oldest_entry == 0) { 705 if (oldest_entry == 0) {
706 /* Circular Buffer has not wrapped around */ 706 /* Circular Buffer has not wrapped around */
707 for (i=0; i < num_valid_entries; i++) { 707 for (i=0; i < num_valid_entries; i++) {
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 178fcddcfd81..5b8db6109536 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -34,9 +34,9 @@ MODULE_PARM_DESC(ql4xdontresethba,
34 " default it will reset hba :0" 34 " default it will reset hba :0"
35 " set to 1 to avoid resetting HBA"); 35 " set to 1 to avoid resetting HBA");
36 36
37int qla4_extended_error_logging = 0; /* 0 = off, 1 = log errors */ 37int ql4xextended_error_logging = 0; /* 0 = off, 1 = log errors */
38module_param(qla4_extended_error_logging, int, S_IRUGO | S_IRUSR); 38module_param(ql4xextended_error_logging, int, S_IRUGO | S_IRUSR);
39MODULE_PARM_DESC(qla4_extended_error_logging, 39MODULE_PARM_DESC(ql4xextended_error_logging,
40 "Option to enable extended error logging, " 40 "Option to enable extended error logging, "
41 "Default is 0 - no logging, 1 - debug logging"); 41 "Default is 0 - no logging, 1 - debug logging");
42 42
@@ -1714,7 +1714,7 @@ static int __init qla4xxx_module_init(void)
1714 1714
1715 /* Derive version string. */ 1715 /* Derive version string. */
1716 strcpy(qla4xxx_version_str, QLA4XXX_DRIVER_VERSION); 1716 strcpy(qla4xxx_version_str, QLA4XXX_DRIVER_VERSION);
1717 if (qla4_extended_error_logging) 1717 if (ql4xextended_error_logging)
1718 strcat(qla4xxx_version_str, "-debug"); 1718 strcat(qla4xxx_version_str, "-debug");
1719 1719
1720 qla4xxx_scsi_transport = 1720 qla4xxx_scsi_transport =
@@ -1724,13 +1724,13 @@ static int __init qla4xxx_module_init(void)
1724 goto release_srb_cache; 1724 goto release_srb_cache;
1725 } 1725 }
1726 1726
1727 printk(KERN_INFO "QLogic iSCSI HBA Driver\n");
1728 ret = pci_register_driver(&qla4xxx_pci_driver); 1727 ret = pci_register_driver(&qla4xxx_pci_driver);
1729 if (ret) 1728 if (ret)
1730 goto unregister_transport; 1729 goto unregister_transport;
1731 1730
1732 printk(KERN_INFO "QLogic iSCSI HBA Driver\n"); 1731 printk(KERN_INFO "QLogic iSCSI HBA Driver\n");
1733 return 0; 1732 return 0;
1733
1734unregister_transport: 1734unregister_transport:
1735 iscsi_unregister_transport(&qla4xxx_iscsi_transport); 1735 iscsi_unregister_transport(&qla4xxx_iscsi_transport);
1736release_srb_cache: 1736release_srb_cache:
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
index e0725353c99c..2e7db18f5aef 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -209,7 +209,7 @@ static int ql_wai(struct qlogicfas408_priv *priv)
209 * caller must hold host lock 209 * caller must hold host lock
210 */ 210 */
211 211
212static void ql_icmd(Scsi_Cmnd * cmd) 212static void ql_icmd(struct scsi_cmnd *cmd)
213{ 213{
214 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); 214 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
215 int qbase = priv->qbase; 215 int qbase = priv->qbase;
@@ -256,7 +256,7 @@ static void ql_icmd(Scsi_Cmnd * cmd)
256 * Process scsi command - usually after interrupt 256 * Process scsi command - usually after interrupt
257 */ 257 */
258 258
259static unsigned int ql_pcmd(Scsi_Cmnd * cmd) 259static unsigned int ql_pcmd(struct scsi_cmnd *cmd)
260{ 260{
261 unsigned int i, j; 261 unsigned int i, j;
262 unsigned long k; 262 unsigned long k;
@@ -407,7 +407,7 @@ static unsigned int ql_pcmd(Scsi_Cmnd * cmd)
407 407
408static void ql_ihandl(void *dev_id) 408static void ql_ihandl(void *dev_id)
409{ 409{
410 Scsi_Cmnd *icmd; 410 struct scsi_cmnd *icmd;
411 struct Scsi_Host *host = dev_id; 411 struct Scsi_Host *host = dev_id;
412 struct qlogicfas408_priv *priv = get_priv_by_host(host); 412 struct qlogicfas408_priv *priv = get_priv_by_host(host);
413 int qbase = priv->qbase; 413 int qbase = priv->qbase;
@@ -447,7 +447,8 @@ irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id)
447 * Queued command 447 * Queued command
448 */ 448 */
449 449
450int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) 450int qlogicfas408_queuecommand(struct scsi_cmnd *cmd,
451 void (*done) (struct scsi_cmnd *))
451{ 452{
452 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); 453 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
453 if (scmd_id(cmd) == priv->qinitid) { 454 if (scmd_id(cmd) == priv->qinitid) {
@@ -470,9 +471,8 @@ int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
470 * Return bios parameters 471 * Return bios parameters
471 */ 472 */
472 473
473int qlogicfas408_biosparam(struct scsi_device * disk, 474int qlogicfas408_biosparam(struct scsi_device *disk, struct block_device *dev,
474 struct block_device *dev, 475 sector_t capacity, int ip[])
475 sector_t capacity, int ip[])
476{ 476{
477/* This should mimic the DOS Qlogic driver's behavior exactly */ 477/* This should mimic the DOS Qlogic driver's behavior exactly */
478 ip[0] = 0x40; 478 ip[0] = 0x40;
@@ -494,7 +494,7 @@ int qlogicfas408_biosparam(struct scsi_device * disk,
494 * Abort a command in progress 494 * Abort a command in progress
495 */ 495 */
496 496
497int qlogicfas408_abort(Scsi_Cmnd * cmd) 497int qlogicfas408_abort(struct scsi_cmnd *cmd)
498{ 498{
499 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); 499 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
500 priv->qabort = 1; 500 priv->qabort = 1;
@@ -508,7 +508,7 @@ int qlogicfas408_abort(Scsi_Cmnd * cmd)
508 * the PCMCIA qlogic_stub code. This wants fixing 508 * the PCMCIA qlogic_stub code. This wants fixing
509 */ 509 */
510 510
511int qlogicfas408_bus_reset(Scsi_Cmnd * cmd) 511int qlogicfas408_bus_reset(struct scsi_cmnd *cmd)
512{ 512{
513 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); 513 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
514 unsigned long flags; 514 unsigned long flags;
diff --git a/drivers/scsi/qlogicfas408.h b/drivers/scsi/qlogicfas408.h
index 8fd5555c75b1..260626427a32 100644
--- a/drivers/scsi/qlogicfas408.h
+++ b/drivers/scsi/qlogicfas408.h
@@ -75,15 +75,15 @@
75/*----------------------------------------------------------------*/ 75/*----------------------------------------------------------------*/
76 76
77struct qlogicfas408_priv { 77struct qlogicfas408_priv {
78 int qbase; /* Port */ 78 int qbase; /* Port */
79 int qinitid; /* initiator ID */ 79 int qinitid; /* initiator ID */
80 int qabort; /* Flag to cause an abort */ 80 int qabort; /* Flag to cause an abort */
81 int qlirq; /* IRQ being used */ 81 int qlirq; /* IRQ being used */
82 int int_type; /* type of irq, 2 for ISA board, 0 for PCMCIA */ 82 int int_type; /* type of irq, 2 for ISA board, 0 for PCMCIA */
83 char qinfo[80]; /* description */ 83 char qinfo[80]; /* description */
84 Scsi_Cmnd *qlcmd; /* current command being processed */ 84 struct scsi_cmnd *qlcmd; /* current command being processed */
85 struct Scsi_Host *shost; /* pointer back to host */ 85 struct Scsi_Host *shost; /* pointer back to host */
86 struct qlogicfas408_priv *next; /* next private struct */ 86 struct qlogicfas408_priv *next; /* next private struct */
87}; 87};
88 88
89/* The qlogic card uses two register maps - These macros select which one */ 89/* The qlogic card uses two register maps - These macros select which one */
@@ -103,12 +103,13 @@ struct qlogicfas408_priv {
103#define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0]) 103#define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0])
104 104
105irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id); 105irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id);
106int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)); 106int qlogicfas408_queuecommand(struct scsi_cmnd * cmd,
107 void (*done) (struct scsi_cmnd *));
107int qlogicfas408_biosparam(struct scsi_device * disk, 108int qlogicfas408_biosparam(struct scsi_device * disk,
108 struct block_device *dev, 109 struct block_device *dev,
109 sector_t capacity, int ip[]); 110 sector_t capacity, int ip[]);
110int qlogicfas408_abort(Scsi_Cmnd * cmd); 111int qlogicfas408_abort(struct scsi_cmnd * cmd);
111int qlogicfas408_bus_reset(Scsi_Cmnd * cmd); 112int qlogicfas408_bus_reset(struct scsi_cmnd * cmd);
112const char *qlogicfas408_info(struct Scsi_Host *host); 113const char *qlogicfas408_info(struct Scsi_Host *host);
113int qlogicfas408_get_chip_type(int qbase, int int_type); 114int qlogicfas408_get_chip_type(int qbase, int int_type);
114void qlogicfas408_setup(int qbase, int id, int int_type); 115void qlogicfas408_setup(int qbase, int id, int int_type);
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 9c0f35820e3e..30ee3d72c021 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -52,7 +52,7 @@
52#include "scsi_debug.h" 52#include "scsi_debug.h"
53 53
54#define SCSI_DEBUG_VERSION "1.80" 54#define SCSI_DEBUG_VERSION "1.80"
55static const char * scsi_debug_version_date = "20060914"; 55static const char * scsi_debug_version_date = "20061018";
56 56
57/* Additional Sense Code (ASC) used */ 57/* Additional Sense Code (ASC) used */
58#define NO_ADDITIONAL_SENSE 0x0 58#define NO_ADDITIONAL_SENSE 0x0
@@ -254,6 +254,8 @@ static int resp_requests(struct scsi_cmnd * SCpnt,
254 struct sdebug_dev_info * devip); 254 struct sdebug_dev_info * devip);
255static int resp_start_stop(struct scsi_cmnd * scp, 255static int resp_start_stop(struct scsi_cmnd * scp,
256 struct sdebug_dev_info * devip); 256 struct sdebug_dev_info * devip);
257static int resp_report_tgtpgs(struct scsi_cmnd * scp,
258 struct sdebug_dev_info * devip);
257static int resp_readcap(struct scsi_cmnd * SCpnt, 259static int resp_readcap(struct scsi_cmnd * SCpnt,
258 struct sdebug_dev_info * devip); 260 struct sdebug_dev_info * devip);
259static int resp_readcap16(struct scsi_cmnd * SCpnt, 261static int resp_readcap16(struct scsi_cmnd * SCpnt,
@@ -287,9 +289,9 @@ static void __init sdebug_build_parts(unsigned char * ramp);
287static void __init init_all_queued(void); 289static void __init init_all_queued(void);
288static void stop_all_queued(void); 290static void stop_all_queued(void);
289static int stop_queued_cmnd(struct scsi_cmnd * cmnd); 291static int stop_queued_cmnd(struct scsi_cmnd * cmnd);
290static int inquiry_evpd_83(unsigned char * arr, int target_dev_id, 292static int inquiry_evpd_83(unsigned char * arr, int port_group_id,
291 int dev_id_num, const char * dev_id_str, 293 int target_dev_id, int dev_id_num,
292 int dev_id_str_len); 294 const char * dev_id_str, int dev_id_str_len);
293static int inquiry_evpd_88(unsigned char * arr, int target_dev_id); 295static int inquiry_evpd_88(unsigned char * arr, int target_dev_id);
294static int do_create_driverfs_files(void); 296static int do_create_driverfs_files(void);
295static void do_remove_driverfs_files(void); 297static void do_remove_driverfs_files(void);
@@ -422,6 +424,15 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done)
422 } 424 }
423 errsts = resp_readcap16(SCpnt, devip); 425 errsts = resp_readcap16(SCpnt, devip);
424 break; 426 break;
427 case MAINTENANCE_IN:
428 if (MI_REPORT_TARGET_PGS != cmd[1]) {
429 mk_sense_buffer(devip, ILLEGAL_REQUEST,
430 INVALID_OPCODE, 0);
431 errsts = check_condition_result;
432 break;
433 }
434 errsts = resp_report_tgtpgs(SCpnt, devip);
435 break;
425 case READ_16: 436 case READ_16:
426 case READ_12: 437 case READ_12:
427 case READ_10: 438 case READ_10:
@@ -665,8 +676,9 @@ static const char * inq_vendor_id = "Linux ";
665static const char * inq_product_id = "scsi_debug "; 676static const char * inq_product_id = "scsi_debug ";
666static const char * inq_product_rev = "0004"; 677static const char * inq_product_rev = "0004";
667 678
668static int inquiry_evpd_83(unsigned char * arr, int target_dev_id, 679static int inquiry_evpd_83(unsigned char * arr, int port_group_id,
669 int dev_id_num, const char * dev_id_str, 680 int target_dev_id, int dev_id_num,
681 const char * dev_id_str,
670 int dev_id_str_len) 682 int dev_id_str_len)
671{ 683{
672 int num, port_a; 684 int num, port_a;
@@ -720,6 +732,15 @@ static int inquiry_evpd_83(unsigned char * arr, int target_dev_id,
720 arr[num++] = (port_a >> 16) & 0xff; 732 arr[num++] = (port_a >> 16) & 0xff;
721 arr[num++] = (port_a >> 8) & 0xff; 733 arr[num++] = (port_a >> 8) & 0xff;
722 arr[num++] = port_a & 0xff; 734 arr[num++] = port_a & 0xff;
735 /* NAA-5, Target port group identifier */
736 arr[num++] = 0x61; /* proto=sas, binary */
737 arr[num++] = 0x95; /* piv=1, target port group id */
738 arr[num++] = 0x0;
739 arr[num++] = 0x4;
740 arr[num++] = 0;
741 arr[num++] = 0;
742 arr[num++] = (port_group_id >> 8) & 0xff;
743 arr[num++] = port_group_id & 0xff;
723 /* NAA-5, Target device identifier */ 744 /* NAA-5, Target device identifier */
724 arr[num++] = 0x61; /* proto=sas, binary */ 745 arr[num++] = 0x61; /* proto=sas, binary */
725 arr[num++] = 0xa3; /* piv=1, target device, naa */ 746 arr[num++] = 0xa3; /* piv=1, target device, naa */
@@ -928,12 +949,12 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target,
928 struct sdebug_dev_info * devip) 949 struct sdebug_dev_info * devip)
929{ 950{
930 unsigned char pq_pdt; 951 unsigned char pq_pdt;
931 unsigned char arr[SDEBUG_MAX_INQ_ARR_SZ]; 952 unsigned char * arr;
932 unsigned char *cmd = (unsigned char *)scp->cmnd; 953 unsigned char *cmd = (unsigned char *)scp->cmnd;
933 int alloc_len, n; 954 int alloc_len, n, ret;
934 955
935 alloc_len = (cmd[3] << 8) + cmd[4]; 956 alloc_len = (cmd[3] << 8) + cmd[4];
936 memset(arr, 0, SDEBUG_MAX_INQ_ARR_SZ); 957 arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_KERNEL);
937 if (devip->wlun) 958 if (devip->wlun)
938 pq_pdt = 0x1e; /* present, wlun */ 959 pq_pdt = 0x1e; /* present, wlun */
939 else if (scsi_debug_no_lun_0 && (0 == devip->lun)) 960 else if (scsi_debug_no_lun_0 && (0 == devip->lun))
@@ -944,12 +965,15 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target,
944 if (0x2 & cmd[1]) { /* CMDDT bit set */ 965 if (0x2 & cmd[1]) { /* CMDDT bit set */
945 mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 966 mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB,
946 0); 967 0);
968 kfree(arr);
947 return check_condition_result; 969 return check_condition_result;
948 } else if (0x1 & cmd[1]) { /* EVPD bit set */ 970 } else if (0x1 & cmd[1]) { /* EVPD bit set */
949 int lu_id_num, target_dev_id, len; 971 int lu_id_num, port_group_id, target_dev_id, len;
950 char lu_id_str[6]; 972 char lu_id_str[6];
951 int host_no = devip->sdbg_host->shost->host_no; 973 int host_no = devip->sdbg_host->shost->host_no;
952 974
975 port_group_id = (((host_no + 1) & 0x7f) << 8) +
976 (devip->channel & 0x7f);
953 if (0 == scsi_debug_vpd_use_hostno) 977 if (0 == scsi_debug_vpd_use_hostno)
954 host_no = 0; 978 host_no = 0;
955 lu_id_num = devip->wlun ? -1 : (((host_no + 1) * 2000) + 979 lu_id_num = devip->wlun ? -1 : (((host_no + 1) * 2000) +
@@ -977,8 +1001,9 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target,
977 memcpy(&arr[4], lu_id_str, len); 1001 memcpy(&arr[4], lu_id_str, len);
978 } else if (0x83 == cmd[2]) { /* device identification */ 1002 } else if (0x83 == cmd[2]) { /* device identification */
979 arr[1] = cmd[2]; /*sanity */ 1003 arr[1] = cmd[2]; /*sanity */
980 arr[3] = inquiry_evpd_83(&arr[4], target_dev_id, 1004 arr[3] = inquiry_evpd_83(&arr[4], port_group_id,
981 lu_id_num, lu_id_str, len); 1005 target_dev_id, lu_id_num,
1006 lu_id_str, len);
982 } else if (0x84 == cmd[2]) { /* Software interface ident. */ 1007 } else if (0x84 == cmd[2]) { /* Software interface ident. */
983 arr[1] = cmd[2]; /*sanity */ 1008 arr[1] = cmd[2]; /*sanity */
984 arr[3] = inquiry_evpd_84(&arr[4]); 1009 arr[3] = inquiry_evpd_84(&arr[4]);
@@ -1012,17 +1037,22 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target,
1012 /* Illegal request, invalid field in cdb */ 1037 /* Illegal request, invalid field in cdb */
1013 mk_sense_buffer(devip, ILLEGAL_REQUEST, 1038 mk_sense_buffer(devip, ILLEGAL_REQUEST,
1014 INVALID_FIELD_IN_CDB, 0); 1039 INVALID_FIELD_IN_CDB, 0);
1040 kfree(arr);
1015 return check_condition_result; 1041 return check_condition_result;
1016 } 1042 }
1017 len = min(((arr[2] << 8) + arr[3]) + 4, alloc_len); 1043 len = min(((arr[2] << 8) + arr[3]) + 4, alloc_len);
1018 return fill_from_dev_buffer(scp, arr, 1044 ret = fill_from_dev_buffer(scp, arr,
1019 min(len, SDEBUG_MAX_INQ_ARR_SZ)); 1045 min(len, SDEBUG_MAX_INQ_ARR_SZ));
1046 kfree(arr);
1047 return ret;
1020 } 1048 }
1021 /* drops through here for a standard inquiry */ 1049 /* drops through here for a standard inquiry */
1022 arr[1] = DEV_REMOVEABLE(target) ? 0x80 : 0; /* Removable disk */ 1050 arr[1] = DEV_REMOVEABLE(target) ? 0x80 : 0; /* Removable disk */
1023 arr[2] = scsi_debug_scsi_level; 1051 arr[2] = scsi_debug_scsi_level;
1024 arr[3] = 2; /* response_data_format==2 */ 1052 arr[3] = 2; /* response_data_format==2 */
1025 arr[4] = SDEBUG_LONG_INQ_SZ - 5; 1053 arr[4] = SDEBUG_LONG_INQ_SZ - 5;
1054 if (0 == scsi_debug_vpd_use_hostno)
1055 arr[5] = 0x10; /* claim: implicit TGPS */
1026 arr[6] = 0x10; /* claim: MultiP */ 1056 arr[6] = 0x10; /* claim: MultiP */
1027 /* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */ 1057 /* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */
1028 arr[7] = 0xa; /* claim: LINKED + CMDQUE */ 1058 arr[7] = 0xa; /* claim: LINKED + CMDQUE */
@@ -1039,8 +1069,10 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target,
1039 arr[n++] = 0x3; arr[n++] = 0x60; /* SSC-2 no version */ 1069 arr[n++] = 0x3; arr[n++] = 0x60; /* SSC-2 no version */
1040 } 1070 }
1041 arr[n++] = 0xc; arr[n++] = 0xf; /* SAS-1.1 rev 10 */ 1071 arr[n++] = 0xc; arr[n++] = 0xf; /* SAS-1.1 rev 10 */
1042 return fill_from_dev_buffer(scp, arr, 1072 ret = fill_from_dev_buffer(scp, arr,
1043 min(alloc_len, SDEBUG_LONG_INQ_SZ)); 1073 min(alloc_len, SDEBUG_LONG_INQ_SZ));
1074 kfree(arr);
1075 return ret;
1044} 1076}
1045 1077
1046static int resp_requests(struct scsi_cmnd * scp, 1078static int resp_requests(struct scsi_cmnd * scp,
@@ -1171,6 +1203,87 @@ static int resp_readcap16(struct scsi_cmnd * scp,
1171 min(alloc_len, SDEBUG_READCAP16_ARR_SZ)); 1203 min(alloc_len, SDEBUG_READCAP16_ARR_SZ));
1172} 1204}
1173 1205
1206#define SDEBUG_MAX_TGTPGS_ARR_SZ 1412
1207
1208static int resp_report_tgtpgs(struct scsi_cmnd * scp,
1209 struct sdebug_dev_info * devip)
1210{
1211 unsigned char *cmd = (unsigned char *)scp->cmnd;
1212 unsigned char * arr;
1213 int host_no = devip->sdbg_host->shost->host_no;
1214 int n, ret, alen, rlen;
1215 int port_group_a, port_group_b, port_a, port_b;
1216
1217 alen = ((cmd[6] << 24) + (cmd[7] << 16) + (cmd[8] << 8)
1218 + cmd[9]);
1219
1220 arr = kzalloc(SDEBUG_MAX_TGTPGS_ARR_SZ, GFP_KERNEL);
1221 /*
1222 * EVPD page 0x88 states we have two ports, one
1223 * real and a fake port with no device connected.
1224 * So we create two port groups with one port each
1225 * and set the group with port B to unavailable.
1226 */
1227 port_a = 0x1; /* relative port A */
1228 port_b = 0x2; /* relative port B */
1229 port_group_a = (((host_no + 1) & 0x7f) << 8) +
1230 (devip->channel & 0x7f);
1231 port_group_b = (((host_no + 1) & 0x7f) << 8) +
1232 (devip->channel & 0x7f) + 0x80;
1233
1234 /*
1235 * The asymmetric access state is cycled according to the host_id.
1236 */
1237 n = 4;
1238 if (0 == scsi_debug_vpd_use_hostno) {
1239 arr[n++] = host_no % 3; /* Asymm access state */
1240 arr[n++] = 0x0F; /* claim: all states are supported */
1241 } else {
1242 arr[n++] = 0x0; /* Active/Optimized path */
1243 arr[n++] = 0x01; /* claim: only support active/optimized paths */
1244 }
1245 arr[n++] = (port_group_a >> 8) & 0xff;
1246 arr[n++] = port_group_a & 0xff;
1247 arr[n++] = 0; /* Reserved */
1248 arr[n++] = 0; /* Status code */
1249 arr[n++] = 0; /* Vendor unique */
1250 arr[n++] = 0x1; /* One port per group */
1251 arr[n++] = 0; /* Reserved */
1252 arr[n++] = 0; /* Reserved */
1253 arr[n++] = (port_a >> 8) & 0xff;
1254 arr[n++] = port_a & 0xff;
1255 arr[n++] = 3; /* Port unavailable */
1256 arr[n++] = 0x08; /* claim: only unavailalbe paths are supported */
1257 arr[n++] = (port_group_b >> 8) & 0xff;
1258 arr[n++] = port_group_b & 0xff;
1259 arr[n++] = 0; /* Reserved */
1260 arr[n++] = 0; /* Status code */
1261 arr[n++] = 0; /* Vendor unique */
1262 arr[n++] = 0x1; /* One port per group */
1263 arr[n++] = 0; /* Reserved */
1264 arr[n++] = 0; /* Reserved */
1265 arr[n++] = (port_b >> 8) & 0xff;
1266 arr[n++] = port_b & 0xff;
1267
1268 rlen = n - 4;
1269 arr[0] = (rlen >> 24) & 0xff;
1270 arr[1] = (rlen >> 16) & 0xff;
1271 arr[2] = (rlen >> 8) & 0xff;
1272 arr[3] = rlen & 0xff;
1273
1274 /*
1275 * Return the smallest value of either
1276 * - The allocated length
1277 * - The constructed command length
1278 * - The maximum array size
1279 */
1280 rlen = min(alen,n);
1281 ret = fill_from_dev_buffer(scp, arr,
1282 min(rlen, SDEBUG_MAX_TGTPGS_ARR_SZ));
1283 kfree(arr);
1284 return ret;
1285}
1286
1174/* <<Following mode page info copied from ST318451LW>> */ 1287/* <<Following mode page info copied from ST318451LW>> */
1175 1288
1176static int resp_err_recov_pg(unsigned char * p, int pcontrol, int target) 1289static int resp_err_recov_pg(unsigned char * p, int pcontrol, int target)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 743f67ed7640..d2c02df12fdc 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1084,7 +1084,7 @@ static void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd)
1084{ 1084{
1085 struct request *req = cmd->request; 1085 struct request *req = cmd->request;
1086 1086
1087 BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd)); 1087 BUILD_BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd));
1088 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); 1088 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd));
1089 cmd->cmd_len = req->cmd_len; 1089 cmd->cmd_len = req->cmd_len;
1090 if (!req->data_len) 1090 if (!req->data_len)
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index e7fe565b96de..e1a91665d1c2 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -192,6 +192,7 @@ static CLASS_DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost
192shost_rd_attr(unique_id, "%u\n"); 192shost_rd_attr(unique_id, "%u\n");
193shost_rd_attr(host_busy, "%hu\n"); 193shost_rd_attr(host_busy, "%hu\n");
194shost_rd_attr(cmd_per_lun, "%hd\n"); 194shost_rd_attr(cmd_per_lun, "%hd\n");
195shost_rd_attr(can_queue, "%hd\n");
195shost_rd_attr(sg_tablesize, "%hu\n"); 196shost_rd_attr(sg_tablesize, "%hu\n");
196shost_rd_attr(unchecked_isa_dma, "%d\n"); 197shost_rd_attr(unchecked_isa_dma, "%d\n");
197shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); 198shost_rd_attr2(proc_name, hostt->proc_name, "%s\n");
@@ -200,6 +201,7 @@ static struct class_device_attribute *scsi_sysfs_shost_attrs[] = {
200 &class_device_attr_unique_id, 201 &class_device_attr_unique_id,
201 &class_device_attr_host_busy, 202 &class_device_attr_host_busy,
202 &class_device_attr_cmd_per_lun, 203 &class_device_attr_cmd_per_lun,
204 &class_device_attr_can_queue,
203 &class_device_attr_sg_tablesize, 205 &class_device_attr_sg_tablesize,
204 &class_device_attr_unchecked_isa_dma, 206 &class_device_attr_unchecked_isa_dma,
205 &class_device_attr_proc_name, 207 &class_device_attr_proc_name,
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 7b0019cccce3..2d3baa99ca25 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -21,7 +21,6 @@
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 22 */
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/mempool.h>
25#include <linux/mutex.h> 24#include <linux/mutex.h>
26#include <net/tcp.h> 25#include <net/tcp.h>
27#include <scsi/scsi.h> 26#include <scsi/scsi.h>
@@ -149,30 +148,6 @@ static DECLARE_TRANSPORT_CLASS(iscsi_connection_class,
149static struct sock *nls; 148static struct sock *nls;
150static DEFINE_MUTEX(rx_queue_mutex); 149static DEFINE_MUTEX(rx_queue_mutex);
151 150
152struct mempool_zone {
153 mempool_t *pool;
154 atomic_t allocated;
155 int size;
156 int hiwat;
157 struct list_head freequeue;
158 spinlock_t freelock;
159};
160
161static struct mempool_zone *z_reply;
162
163/*
164 * Z_MAX_* - actual mempool size allocated at the mempool_zone_init() time
165 * Z_HIWAT_* - zone's high watermark when if_error bit will be set to -ENOMEM
166 * so daemon will notice OOM on NETLINK tranposrt level and will
167 * be able to predict or change operational behavior
168 */
169#define Z_MAX_REPLY 8
170#define Z_HIWAT_REPLY 6
171#define Z_MAX_PDU 8
172#define Z_HIWAT_PDU 6
173#define Z_MAX_ERROR 16
174#define Z_HIWAT_ERROR 12
175
176static LIST_HEAD(sesslist); 151static LIST_HEAD(sesslist);
177static DEFINE_SPINLOCK(sesslock); 152static DEFINE_SPINLOCK(sesslock);
178static LIST_HEAD(connlist); 153static LIST_HEAD(connlist);
@@ -414,59 +389,11 @@ int iscsi_destroy_session(struct iscsi_cls_session *session)
414} 389}
415EXPORT_SYMBOL_GPL(iscsi_destroy_session); 390EXPORT_SYMBOL_GPL(iscsi_destroy_session);
416 391
417static void mempool_zone_destroy(struct mempool_zone *zp)
418{
419 mempool_destroy(zp->pool);
420 kfree(zp);
421}
422
423static void*
424mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data)
425{
426 struct mempool_zone *zone = pool_data;
427
428 return alloc_skb(zone->size, gfp_mask);
429}
430
431static void
432mempool_zone_free_skb(void *element, void *pool_data)
433{
434 kfree_skb(element);
435}
436
437static struct mempool_zone *
438mempool_zone_init(unsigned max, unsigned size, unsigned hiwat)
439{
440 struct mempool_zone *zp;
441
442 zp = kzalloc(sizeof(*zp), GFP_KERNEL);
443 if (!zp)
444 return NULL;
445
446 zp->size = size;
447 zp->hiwat = hiwat;
448 INIT_LIST_HEAD(&zp->freequeue);
449 spin_lock_init(&zp->freelock);
450 atomic_set(&zp->allocated, 0);
451
452 zp->pool = mempool_create(max, mempool_zone_alloc_skb,
453 mempool_zone_free_skb, zp);
454 if (!zp->pool) {
455 kfree(zp);
456 return NULL;
457 }
458
459 return zp;
460}
461
462static void iscsi_conn_release(struct device *dev) 392static void iscsi_conn_release(struct device *dev)
463{ 393{
464 struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev); 394 struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev);
465 struct device *parent = conn->dev.parent; 395 struct device *parent = conn->dev.parent;
466 396
467 mempool_zone_destroy(conn->z_pdu);
468 mempool_zone_destroy(conn->z_error);
469
470 kfree(conn); 397 kfree(conn);
471 put_device(parent); 398 put_device(parent);
472} 399}
@@ -476,31 +403,6 @@ static int iscsi_is_conn_dev(const struct device *dev)
476 return dev->release == iscsi_conn_release; 403 return dev->release == iscsi_conn_release;
477} 404}
478 405
479static int iscsi_create_event_pools(struct iscsi_cls_conn *conn)
480{
481 conn->z_pdu = mempool_zone_init(Z_MAX_PDU,
482 NLMSG_SPACE(sizeof(struct iscsi_uevent) +
483 sizeof(struct iscsi_hdr) +
484 DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH),
485 Z_HIWAT_PDU);
486 if (!conn->z_pdu) {
487 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not allocate "
488 "pdu zone for new conn\n");
489 return -ENOMEM;
490 }
491
492 conn->z_error = mempool_zone_init(Z_MAX_ERROR,
493 NLMSG_SPACE(sizeof(struct iscsi_uevent)),
494 Z_HIWAT_ERROR);
495 if (!conn->z_error) {
496 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not allocate "
497 "error zone for new conn\n");
498 mempool_zone_destroy(conn->z_pdu);
499 return -ENOMEM;
500 }
501 return 0;
502}
503
504/** 406/**
505 * iscsi_create_conn - create iscsi class connection 407 * iscsi_create_conn - create iscsi class connection
506 * @session: iscsi cls session 408 * @session: iscsi cls session
@@ -533,12 +435,9 @@ iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid)
533 conn->transport = transport; 435 conn->transport = transport;
534 conn->cid = cid; 436 conn->cid = cid;
535 437
536 if (iscsi_create_event_pools(conn))
537 goto free_conn;
538
539 /* this is released in the dev's release function */ 438 /* this is released in the dev's release function */
540 if (!get_device(&session->dev)) 439 if (!get_device(&session->dev))
541 goto free_conn_pools; 440 goto free_conn;
542 441
543 snprintf(conn->dev.bus_id, BUS_ID_SIZE, "connection%d:%u", 442 snprintf(conn->dev.bus_id, BUS_ID_SIZE, "connection%d:%u",
544 session->sid, cid); 443 session->sid, cid);
@@ -555,8 +454,6 @@ iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid)
555 454
556release_parent_ref: 455release_parent_ref:
557 put_device(&session->dev); 456 put_device(&session->dev);
558free_conn_pools:
559
560free_conn: 457free_conn:
561 kfree(conn); 458 kfree(conn);
562 return NULL; 459 return NULL;
@@ -599,81 +496,31 @@ iscsi_if_transport_lookup(struct iscsi_transport *tt)
599 return NULL; 496 return NULL;
600} 497}
601 498
602static inline struct list_head *skb_to_lh(struct sk_buff *skb)
603{
604 return (struct list_head *)&skb->cb;
605}
606
607static void
608mempool_zone_complete(struct mempool_zone *zone)
609{
610 unsigned long flags;
611 struct list_head *lh, *n;
612
613 spin_lock_irqsave(&zone->freelock, flags);
614 list_for_each_safe(lh, n, &zone->freequeue) {
615 struct sk_buff *skb = (struct sk_buff *)((char *)lh -
616 offsetof(struct sk_buff, cb));
617 if (!skb_shared(skb)) {
618 list_del(skb_to_lh(skb));
619 mempool_free(skb, zone->pool);
620 atomic_dec(&zone->allocated);
621 }
622 }
623 spin_unlock_irqrestore(&zone->freelock, flags);
624}
625
626static struct sk_buff*
627mempool_zone_get_skb(struct mempool_zone *zone)
628{
629 struct sk_buff *skb;
630
631 skb = mempool_alloc(zone->pool, GFP_ATOMIC);
632 if (skb)
633 atomic_inc(&zone->allocated);
634 return skb;
635}
636
637static int 499static int
638iscsi_broadcast_skb(struct mempool_zone *zone, struct sk_buff *skb, gfp_t gfp) 500iscsi_broadcast_skb(struct sk_buff *skb, gfp_t gfp)
639{ 501{
640 unsigned long flags;
641 int rc; 502 int rc;
642 503
643 skb_get(skb);
644 rc = netlink_broadcast(nls, skb, 0, 1, gfp); 504 rc = netlink_broadcast(nls, skb, 0, 1, gfp);
645 if (rc < 0) { 505 if (rc < 0) {
646 mempool_free(skb, zone->pool);
647 printk(KERN_ERR "iscsi: can not broadcast skb (%d)\n", rc); 506 printk(KERN_ERR "iscsi: can not broadcast skb (%d)\n", rc);
648 return rc; 507 return rc;
649 } 508 }
650 509
651 spin_lock_irqsave(&zone->freelock, flags);
652 INIT_LIST_HEAD(skb_to_lh(skb));
653 list_add(skb_to_lh(skb), &zone->freequeue);
654 spin_unlock_irqrestore(&zone->freelock, flags);
655 return 0; 510 return 0;
656} 511}
657 512
658static int 513static int
659iscsi_unicast_skb(struct mempool_zone *zone, struct sk_buff *skb, int pid) 514iscsi_unicast_skb(struct sk_buff *skb, int pid)
660{ 515{
661 unsigned long flags;
662 int rc; 516 int rc;
663 517
664 skb_get(skb);
665 rc = netlink_unicast(nls, skb, pid, MSG_DONTWAIT); 518 rc = netlink_unicast(nls, skb, pid, MSG_DONTWAIT);
666 if (rc < 0) { 519 if (rc < 0) {
667 mempool_free(skb, zone->pool);
668 printk(KERN_ERR "iscsi: can not unicast skb (%d)\n", rc); 520 printk(KERN_ERR "iscsi: can not unicast skb (%d)\n", rc);
669 return rc; 521 return rc;
670 } 522 }
671 523
672 spin_lock_irqsave(&zone->freelock, flags);
673 INIT_LIST_HEAD(skb_to_lh(skb));
674 list_add(skb_to_lh(skb), &zone->freequeue);
675 spin_unlock_irqrestore(&zone->freelock, flags);
676
677 return 0; 524 return 0;
678} 525}
679 526
@@ -692,9 +539,7 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
692 if (!priv) 539 if (!priv)
693 return -EINVAL; 540 return -EINVAL;
694 541
695 mempool_zone_complete(conn->z_pdu); 542 skb = alloc_skb(len, GFP_ATOMIC);
696
697 skb = mempool_zone_get_skb(conn->z_pdu);
698 if (!skb) { 543 if (!skb) {
699 iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED); 544 iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED);
700 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver " 545 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver "
@@ -707,15 +552,13 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
707 memset(ev, 0, sizeof(*ev)); 552 memset(ev, 0, sizeof(*ev));
708 ev->transport_handle = iscsi_handle(conn->transport); 553 ev->transport_handle = iscsi_handle(conn->transport);
709 ev->type = ISCSI_KEVENT_RECV_PDU; 554 ev->type = ISCSI_KEVENT_RECV_PDU;
710 if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat)
711 ev->iferror = -ENOMEM;
712 ev->r.recv_req.cid = conn->cid; 555 ev->r.recv_req.cid = conn->cid;
713 ev->r.recv_req.sid = iscsi_conn_get_sid(conn); 556 ev->r.recv_req.sid = iscsi_conn_get_sid(conn);
714 pdu = (char*)ev + sizeof(*ev); 557 pdu = (char*)ev + sizeof(*ev);
715 memcpy(pdu, hdr, sizeof(struct iscsi_hdr)); 558 memcpy(pdu, hdr, sizeof(struct iscsi_hdr));
716 memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size); 559 memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size);
717 560
718 return iscsi_unicast_skb(conn->z_pdu, skb, priv->daemon_pid); 561 return iscsi_unicast_skb(skb, priv->daemon_pid);
719} 562}
720EXPORT_SYMBOL_GPL(iscsi_recv_pdu); 563EXPORT_SYMBOL_GPL(iscsi_recv_pdu);
721 564
@@ -731,9 +574,7 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error)
731 if (!priv) 574 if (!priv)
732 return; 575 return;
733 576
734 mempool_zone_complete(conn->z_error); 577 skb = alloc_skb(len, GFP_ATOMIC);
735
736 skb = mempool_zone_get_skb(conn->z_error);
737 if (!skb) { 578 if (!skb) {
738 dev_printk(KERN_ERR, &conn->dev, "iscsi: gracefully ignored " 579 dev_printk(KERN_ERR, &conn->dev, "iscsi: gracefully ignored "
739 "conn error (%d)\n", error); 580 "conn error (%d)\n", error);
@@ -744,13 +585,11 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error)
744 ev = NLMSG_DATA(nlh); 585 ev = NLMSG_DATA(nlh);
745 ev->transport_handle = iscsi_handle(conn->transport); 586 ev->transport_handle = iscsi_handle(conn->transport);
746 ev->type = ISCSI_KEVENT_CONN_ERROR; 587 ev->type = ISCSI_KEVENT_CONN_ERROR;
747 if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat)
748 ev->iferror = -ENOMEM;
749 ev->r.connerror.error = error; 588 ev->r.connerror.error = error;
750 ev->r.connerror.cid = conn->cid; 589 ev->r.connerror.cid = conn->cid;
751 ev->r.connerror.sid = iscsi_conn_get_sid(conn); 590 ev->r.connerror.sid = iscsi_conn_get_sid(conn);
752 591
753 iscsi_broadcast_skb(conn->z_error, skb, GFP_ATOMIC); 592 iscsi_broadcast_skb(skb, GFP_ATOMIC);
754 593
755 dev_printk(KERN_INFO, &conn->dev, "iscsi: detected conn error (%d)\n", 594 dev_printk(KERN_INFO, &conn->dev, "iscsi: detected conn error (%d)\n",
756 error); 595 error);
@@ -767,9 +606,7 @@ iscsi_if_send_reply(int pid, int seq, int type, int done, int multi,
767 int flags = multi ? NLM_F_MULTI : 0; 606 int flags = multi ? NLM_F_MULTI : 0;
768 int t = done ? NLMSG_DONE : type; 607 int t = done ? NLMSG_DONE : type;
769 608
770 mempool_zone_complete(z_reply); 609 skb = alloc_skb(len, GFP_ATOMIC);
771
772 skb = mempool_zone_get_skb(z_reply);
773 /* 610 /*
774 * FIXME: 611 * FIXME:
775 * user is supposed to react on iferror == -ENOMEM; 612 * user is supposed to react on iferror == -ENOMEM;
@@ -780,7 +617,7 @@ iscsi_if_send_reply(int pid, int seq, int type, int done, int multi,
780 nlh = __nlmsg_put(skb, pid, seq, t, (len - sizeof(*nlh)), 0); 617 nlh = __nlmsg_put(skb, pid, seq, t, (len - sizeof(*nlh)), 0);
781 nlh->nlmsg_flags = flags; 618 nlh->nlmsg_flags = flags;
782 memcpy(NLMSG_DATA(nlh), payload, size); 619 memcpy(NLMSG_DATA(nlh), payload, size);
783 return iscsi_unicast_skb(z_reply, skb, pid); 620 return iscsi_unicast_skb(skb, pid);
784} 621}
785 622
786static int 623static int
@@ -810,9 +647,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
810 do { 647 do {
811 int actual_size; 648 int actual_size;
812 649
813 mempool_zone_complete(conn->z_pdu); 650 skbstat = alloc_skb(len, GFP_ATOMIC);
814
815 skbstat = mempool_zone_get_skb(conn->z_pdu);
816 if (!skbstat) { 651 if (!skbstat) {
817 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not " 652 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not "
818 "deliver stats: OOM\n"); 653 "deliver stats: OOM\n");
@@ -825,8 +660,6 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
825 memset(evstat, 0, sizeof(*evstat)); 660 memset(evstat, 0, sizeof(*evstat));
826 evstat->transport_handle = iscsi_handle(conn->transport); 661 evstat->transport_handle = iscsi_handle(conn->transport);
827 evstat->type = nlh->nlmsg_type; 662 evstat->type = nlh->nlmsg_type;
828 if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat)
829 evstat->iferror = -ENOMEM;
830 evstat->u.get_stats.cid = 663 evstat->u.get_stats.cid =
831 ev->u.get_stats.cid; 664 ev->u.get_stats.cid;
832 evstat->u.get_stats.sid = 665 evstat->u.get_stats.sid =
@@ -845,7 +678,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
845 skb_trim(skbstat, NLMSG_ALIGN(actual_size)); 678 skb_trim(skbstat, NLMSG_ALIGN(actual_size));
846 nlhstat->nlmsg_len = actual_size; 679 nlhstat->nlmsg_len = actual_size;
847 680
848 err = iscsi_unicast_skb(conn->z_pdu, skbstat, priv->daemon_pid); 681 err = iscsi_unicast_skb(skbstat, priv->daemon_pid);
849 } while (err < 0 && err != -ECONNREFUSED); 682 } while (err < 0 && err != -ECONNREFUSED);
850 683
851 return err; 684 return err;
@@ -876,9 +709,7 @@ int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn)
876 session = iscsi_dev_to_session(conn->dev.parent); 709 session = iscsi_dev_to_session(conn->dev.parent);
877 shost = iscsi_session_to_shost(session); 710 shost = iscsi_session_to_shost(session);
878 711
879 mempool_zone_complete(conn->z_pdu); 712 skb = alloc_skb(len, GFP_KERNEL);
880
881 skb = mempool_zone_get_skb(conn->z_pdu);
882 if (!skb) { 713 if (!skb) {
883 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " 714 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "
884 "session creation event\n"); 715 "session creation event\n");
@@ -896,7 +727,7 @@ int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn)
896 * this will occur if the daemon is not up, so we just warn 727 * this will occur if the daemon is not up, so we just warn
897 * the user and when the daemon is restarted it will handle it 728 * the user and when the daemon is restarted it will handle it
898 */ 729 */
899 rc = iscsi_broadcast_skb(conn->z_pdu, skb, GFP_KERNEL); 730 rc = iscsi_broadcast_skb(skb, GFP_KERNEL);
900 if (rc < 0) 731 if (rc < 0)
901 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " 732 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "
902 "session destruction event. Check iscsi daemon\n"); 733 "session destruction event. Check iscsi daemon\n");
@@ -939,9 +770,7 @@ int iscsi_if_create_session_done(struct iscsi_cls_conn *conn)
939 session = iscsi_dev_to_session(conn->dev.parent); 770 session = iscsi_dev_to_session(conn->dev.parent);
940 shost = iscsi_session_to_shost(session); 771 shost = iscsi_session_to_shost(session);
941 772
942 mempool_zone_complete(conn->z_pdu); 773 skb = alloc_skb(len, GFP_KERNEL);
943
944 skb = mempool_zone_get_skb(conn->z_pdu);
945 if (!skb) { 774 if (!skb) {
946 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " 775 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "
947 "session creation event\n"); 776 "session creation event\n");
@@ -959,7 +788,7 @@ int iscsi_if_create_session_done(struct iscsi_cls_conn *conn)
959 * this will occur if the daemon is not up, so we just warn 788 * this will occur if the daemon is not up, so we just warn
960 * the user and when the daemon is restarted it will handle it 789 * the user and when the daemon is restarted it will handle it
961 */ 790 */
962 rc = iscsi_broadcast_skb(conn->z_pdu, skb, GFP_KERNEL); 791 rc = iscsi_broadcast_skb(skb, GFP_KERNEL);
963 if (rc < 0) 792 if (rc < 0)
964 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " 793 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "
965 "session creation event. Check iscsi daemon\n"); 794 "session creation event. Check iscsi daemon\n");
@@ -1278,9 +1107,6 @@ iscsi_if_rx(struct sock *sk, int len)
1278 err = iscsi_if_send_reply( 1107 err = iscsi_if_send_reply(
1279 NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq, 1108 NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq,
1280 nlh->nlmsg_type, 0, 0, ev, sizeof(*ev)); 1109 nlh->nlmsg_type, 0, 0, ev, sizeof(*ev));
1281 if (atomic_read(&z_reply->allocated) >=
1282 z_reply->hiwat)
1283 ev->iferror = -ENOMEM;
1284 } while (err < 0 && err != -ECONNREFUSED); 1110 } while (err < 0 && err != -ECONNREFUSED);
1285 skb_pull(skb, rlen); 1111 skb_pull(skb, rlen);
1286 } 1112 }
@@ -1584,32 +1410,6 @@ int iscsi_unregister_transport(struct iscsi_transport *tt)
1584} 1410}
1585EXPORT_SYMBOL_GPL(iscsi_unregister_transport); 1411EXPORT_SYMBOL_GPL(iscsi_unregister_transport);
1586 1412
1587static int
1588iscsi_rcv_nl_event(struct notifier_block *this, unsigned long event, void *ptr)
1589{
1590 struct netlink_notify *n = ptr;
1591
1592 if (event == NETLINK_URELEASE &&
1593 n->protocol == NETLINK_ISCSI && n->pid) {
1594 struct iscsi_cls_conn *conn;
1595 unsigned long flags;
1596
1597 mempool_zone_complete(z_reply);
1598 spin_lock_irqsave(&connlock, flags);
1599 list_for_each_entry(conn, &connlist, conn_list) {
1600 mempool_zone_complete(conn->z_error);
1601 mempool_zone_complete(conn->z_pdu);
1602 }
1603 spin_unlock_irqrestore(&connlock, flags);
1604 }
1605
1606 return NOTIFY_DONE;
1607}
1608
1609static struct notifier_block iscsi_nl_notifier = {
1610 .notifier_call = iscsi_rcv_nl_event,
1611};
1612
1613static __init int iscsi_transport_init(void) 1413static __init int iscsi_transport_init(void)
1614{ 1414{
1615 int err; 1415 int err;
@@ -1633,25 +1433,15 @@ static __init int iscsi_transport_init(void)
1633 if (err) 1433 if (err)
1634 goto unregister_conn_class; 1434 goto unregister_conn_class;
1635 1435
1636 err = netlink_register_notifier(&iscsi_nl_notifier);
1637 if (err)
1638 goto unregister_session_class;
1639
1640 nls = netlink_kernel_create(NETLINK_ISCSI, 1, iscsi_if_rx, 1436 nls = netlink_kernel_create(NETLINK_ISCSI, 1, iscsi_if_rx,
1641 THIS_MODULE); 1437 THIS_MODULE);
1642 if (!nls) { 1438 if (!nls) {
1643 err = -ENOBUFS; 1439 err = -ENOBUFS;
1644 goto unregister_notifier; 1440 goto unregister_session_class;
1645 } 1441 }
1646 1442
1647 z_reply = mempool_zone_init(Z_MAX_REPLY, 1443 return 0;
1648 NLMSG_SPACE(sizeof(struct iscsi_uevent)), Z_HIWAT_REPLY);
1649 if (z_reply)
1650 return 0;
1651 1444
1652 sock_release(nls->sk_socket);
1653unregister_notifier:
1654 netlink_unregister_notifier(&iscsi_nl_notifier);
1655unregister_session_class: 1445unregister_session_class:
1656 transport_class_unregister(&iscsi_session_class); 1446 transport_class_unregister(&iscsi_session_class);
1657unregister_conn_class: 1447unregister_conn_class:
@@ -1665,9 +1455,7 @@ unregister_transport_class:
1665 1455
1666static void __exit iscsi_transport_exit(void) 1456static void __exit iscsi_transport_exit(void)
1667{ 1457{
1668 mempool_zone_destroy(z_reply);
1669 sock_release(nls->sk_socket); 1458 sock_release(nls->sk_socket);
1670 netlink_unregister_notifier(&iscsi_nl_notifier);
1671 transport_class_unregister(&iscsi_connection_class); 1459 transport_class_unregister(&iscsi_connection_class);
1672 transport_class_unregister(&iscsi_session_class); 1460 transport_class_unregister(&iscsi_session_class);
1673 transport_class_unregister(&iscsi_host_class); 1461 transport_class_unregister(&iscsi_host_class);
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 3babdc76b3fb..e1a52c525ed4 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -1177,7 +1177,10 @@ static int st_open(struct inode *inode, struct file *filp)
1177 goto err_out; 1177 goto err_out;
1178 if ((filp->f_flags & O_NONBLOCK) == 0 && 1178 if ((filp->f_flags & O_NONBLOCK) == 0 &&
1179 retval != CHKRES_READY) { 1179 retval != CHKRES_READY) {
1180 retval = (-EIO); 1180 if (STp->ready == NO_TAPE)
1181 retval = (-ENOMEDIUM);
1182 else
1183 retval = (-EIO);
1181 goto err_out; 1184 goto err_out;
1182 } 1185 }
1183 return 0; 1186 return 0;
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index 5ec5af8e3379..3b3f3050a877 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -266,8 +266,8 @@ static struct scsi_host_template *the_template = NULL;
266 (struct NCR5380_hostdata *)(in)->hostdata 266 (struct NCR5380_hostdata *)(in)->hostdata
267#define HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata) 267#define HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata)
268 268
269#define NEXT(cmd) ((Scsi_Cmnd *)((cmd)->host_scribble)) 269#define NEXT(cmd) ((struct scsi_cmnd *)((cmd)->host_scribble))
270#define NEXTADDR(cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble)) 270#define NEXTADDR(cmd) ((struct scsi_cmnd **)&((cmd)->host_scribble))
271 271
272#define HOSTNO instance->host_no 272#define HOSTNO instance->host_no
273#define H_NO(cmd) (cmd)->device->host->host_no 273#define H_NO(cmd) (cmd)->device->host->host_no
@@ -360,7 +360,7 @@ static void __init init_tags( void )
360 * conditions. 360 * conditions.
361 */ 361 */
362 362
363static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged ) 363static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged)
364{ 364{
365 SETUP_HOSTDATA(cmd->device->host); 365 SETUP_HOSTDATA(cmd->device->host);
366 366
@@ -384,7 +384,7 @@ static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged )
384 * untagged. 384 * untagged.
385 */ 385 */
386 386
387static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) 387static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged)
388{ 388{
389 SETUP_HOSTDATA(cmd->device->host); 389 SETUP_HOSTDATA(cmd->device->host);
390 390
@@ -416,7 +416,7 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
416 * unlock the LUN. 416 * unlock the LUN.
417 */ 417 */
418 418
419static void cmd_free_tag( Scsi_Cmnd *cmd ) 419static void cmd_free_tag(struct scsi_cmnd *cmd)
420{ 420{
421 SETUP_HOSTDATA(cmd->device->host); 421 SETUP_HOSTDATA(cmd->device->host);
422 422
@@ -460,18 +460,18 @@ static void free_all_tags( void )
460 460
461 461
462/* 462/*
463 * Function: void merge_contiguous_buffers( Scsi_Cmnd *cmd ) 463 * Function: void merge_contiguous_buffers(struct scsi_cmnd *cmd)
464 * 464 *
465 * Purpose: Try to merge several scatter-gather requests into one DMA 465 * Purpose: Try to merge several scatter-gather requests into one DMA
466 * transfer. This is possible if the scatter buffers lie on 466 * transfer. This is possible if the scatter buffers lie on
467 * physical contiguous addresses. 467 * physical contiguous addresses.
468 * 468 *
469 * Parameters: Scsi_Cmnd *cmd 469 * Parameters: struct scsi_cmnd *cmd
470 * The command to work on. The first scatter buffer's data are 470 * The command to work on. The first scatter buffer's data are
471 * assumed to be already transfered into ptr/this_residual. 471 * assumed to be already transfered into ptr/this_residual.
472 */ 472 */
473 473
474static void merge_contiguous_buffers( Scsi_Cmnd *cmd ) 474static void merge_contiguous_buffers(struct scsi_cmnd *cmd)
475{ 475{
476 unsigned long endaddr; 476 unsigned long endaddr;
477#if (NDEBUG & NDEBUG_MERGING) 477#if (NDEBUG & NDEBUG_MERGING)
@@ -501,15 +501,15 @@ static void merge_contiguous_buffers( Scsi_Cmnd *cmd )
501} 501}
502 502
503/* 503/*
504 * Function : void initialize_SCp(Scsi_Cmnd *cmd) 504 * Function : void initialize_SCp(struct scsi_cmnd *cmd)
505 * 505 *
506 * Purpose : initialize the saved data pointers for cmd to point to the 506 * Purpose : initialize the saved data pointers for cmd to point to the
507 * start of the buffer. 507 * start of the buffer.
508 * 508 *
509 * Inputs : cmd - Scsi_Cmnd structure to have pointers reset. 509 * Inputs : cmd - struct scsi_cmnd structure to have pointers reset.
510 */ 510 */
511 511
512static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) 512static __inline__ void initialize_SCp(struct scsi_cmnd *cmd)
513{ 513{
514 /* 514 /*
515 * Initialize the Scsi Pointer field so that all of the commands in the 515 * Initialize the Scsi Pointer field so that all of the commands in the
@@ -753,14 +753,15 @@ static void NCR5380_print_status (struct Scsi_Host *instance)
753 do { if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ 753 do { if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \
754 pos += sprintf(pos, fmt , ## args); } while(0) 754 pos += sprintf(pos, fmt , ## args); } while(0)
755static 755static
756char *lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length); 756char *lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, char *pos, char *buffer,
757 int length);
757 758
758static int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **start, 759static int NCR5380_proc_info(struct Scsi_Host *instance, char *buffer,
759 off_t offset, int length, int inout) 760 char **start, off_t offset, int length, int inout)
760{ 761{
761 char *pos = buffer; 762 char *pos = buffer;
762 struct NCR5380_hostdata *hostdata; 763 struct NCR5380_hostdata *hostdata;
763 Scsi_Cmnd *ptr; 764 struct scsi_cmnd *ptr;
764 unsigned long flags; 765 unsigned long flags;
765 off_t begin = 0; 766 off_t begin = 0;
766#define check_offset() \ 767#define check_offset() \
@@ -784,18 +785,19 @@ static int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **s
784 if (!hostdata->connected) 785 if (!hostdata->connected)
785 SPRINTF("scsi%d: no currently connected command\n", HOSTNO); 786 SPRINTF("scsi%d: no currently connected command\n", HOSTNO);
786 else 787 else
787 pos = lprint_Scsi_Cmnd ((Scsi_Cmnd *) hostdata->connected, 788 pos = lprint_Scsi_Cmnd ((struct scsi_cmnd *) hostdata->connected,
788 pos, buffer, length); 789 pos, buffer, length);
789 SPRINTF("scsi%d: issue_queue\n", HOSTNO); 790 SPRINTF("scsi%d: issue_queue\n", HOSTNO);
790 check_offset(); 791 check_offset();
791 for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = NEXT(ptr)) { 792 for (ptr = (struct scsi_cmnd *) hostdata->issue_queue; ptr; ptr = NEXT(ptr))
793 {
792 pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); 794 pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length);
793 check_offset(); 795 check_offset();
794 } 796 }
795 797
796 SPRINTF("scsi%d: disconnected_queue\n", HOSTNO); 798 SPRINTF("scsi%d: disconnected_queue\n", HOSTNO);
797 check_offset(); 799 check_offset();
798 for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; 800 for (ptr = (struct scsi_cmnd *) hostdata->disconnected_queue; ptr;
799 ptr = NEXT(ptr)) { 801 ptr = NEXT(ptr)) {
800 pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); 802 pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length);
801 check_offset(); 803 check_offset();
@@ -810,8 +812,8 @@ static int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **s
810 return length; 812 return length;
811} 813}
812 814
813static char * 815static char *lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, char *pos, char *buffer,
814lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length) 816 int length)
815{ 817{
816 int i, s; 818 int i, s;
817 unsigned char *command; 819 unsigned char *command;
@@ -888,8 +890,8 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags)
888} 890}
889 891
890/* 892/*
891 * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd, 893 * Function : int NCR5380_queue_command (struct scsi_cmnd *cmd,
892 * void (*done)(Scsi_Cmnd *)) 894 * void (*done)(struct scsi_cmnd *))
893 * 895 *
894 * Purpose : enqueues a SCSI command 896 * Purpose : enqueues a SCSI command
895 * 897 *
@@ -906,10 +908,11 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags)
906 */ 908 */
907 909
908/* Only make static if a wrapper function is used */ 910/* Only make static if a wrapper function is used */
909static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) 911static int NCR5380_queue_command(struct scsi_cmnd *cmd,
912 void (*done)(struct scsi_cmnd *))
910{ 913{
911 SETUP_HOSTDATA(cmd->device->host); 914 SETUP_HOSTDATA(cmd->device->host);
912 Scsi_Cmnd *tmp; 915 struct scsi_cmnd *tmp;
913 unsigned long flags; 916 unsigned long flags;
914 917
915#if (NDEBUG & NDEBUG_NO_WRITE) 918#if (NDEBUG & NDEBUG_NO_WRITE)
@@ -990,7 +993,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
990 NEXT(cmd) = hostdata->issue_queue; 993 NEXT(cmd) = hostdata->issue_queue;
991 hostdata->issue_queue = cmd; 994 hostdata->issue_queue = cmd;
992 } else { 995 } else {
993 for (tmp = (Scsi_Cmnd *)hostdata->issue_queue; 996 for (tmp = (struct scsi_cmnd *)hostdata->issue_queue;
994 NEXT(tmp); tmp = NEXT(tmp)) 997 NEXT(tmp); tmp = NEXT(tmp))
995 ; 998 ;
996 LIST(cmd, tmp); 999 LIST(cmd, tmp);
@@ -1030,7 +1033,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
1030 1033
1031static void NCR5380_main (void *bl) 1034static void NCR5380_main (void *bl)
1032{ 1035{
1033 Scsi_Cmnd *tmp, *prev; 1036 struct scsi_cmnd *tmp, *prev;
1034 struct Scsi_Host *instance = first_instance; 1037 struct Scsi_Host *instance = first_instance;
1035 struct NCR5380_hostdata *hostdata = HOSTDATA(instance); 1038 struct NCR5380_hostdata *hostdata = HOSTDATA(instance);
1036 int done; 1039 int done;
@@ -1073,12 +1076,12 @@ static void NCR5380_main (void *bl)
1073 * for a target that's not busy. 1076 * for a target that's not busy.
1074 */ 1077 */
1075#if (NDEBUG & NDEBUG_LISTS) 1078#if (NDEBUG & NDEBUG_LISTS)
1076 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; 1079 for (tmp = (struct scsi_cmnd *) hostdata->issue_queue, prev = NULL;
1077 tmp && (tmp != prev); prev = tmp, tmp = NEXT(tmp)) 1080 tmp && (tmp != prev); prev = tmp, tmp = NEXT(tmp))
1078 ; 1081 ;
1079 if ((tmp == prev) && tmp) printk(" LOOP\n");/* else printk("\n");*/ 1082 if ((tmp == prev) && tmp) printk(" LOOP\n");/* else printk("\n");*/
1080#endif 1083#endif
1081 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, 1084 for (tmp = (struct scsi_cmnd *) hostdata->issue_queue,
1082 prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp) ) { 1085 prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp) ) {
1083 1086
1084#if (NDEBUG & NDEBUG_LISTS) 1087#if (NDEBUG & NDEBUG_LISTS)
@@ -1339,7 +1342,8 @@ static irqreturn_t NCR5380_intr (int irq, void *dev_id)
1339} 1342}
1340 1343
1341#ifdef NCR5380_STATS 1344#ifdef NCR5380_STATS
1342static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd) 1345static void collect_stats(struct NCR5380_hostdata *hostdata,
1346 struct scsi_cmnd *cmd)
1343{ 1347{
1344# ifdef NCR5380_STAT_LIMIT 1348# ifdef NCR5380_STAT_LIMIT
1345 if (cmd->request_bufflen > NCR5380_STAT_LIMIT) 1349 if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
@@ -1365,8 +1369,8 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd)
1365#endif 1369#endif
1366 1370
1367/* 1371/*
1368 * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, 1372 * Function : int NCR5380_select(struct Scsi_Host *instance,
1369 * int tag); 1373 * struct scsi_cmnd *cmd, int tag);
1370 * 1374 *
1371 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, 1375 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command,
1372 * including ARBITRATION, SELECTION, and initial message out for 1376 * including ARBITRATION, SELECTION, and initial message out for
@@ -1395,7 +1399,8 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd)
1395 * cmd->result host byte set to DID_BAD_TARGET. 1399 * cmd->result host byte set to DID_BAD_TARGET.
1396 */ 1400 */
1397 1401
1398static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) 1402static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd,
1403 int tag)
1399{ 1404{
1400 SETUP_HOSTDATA(instance); 1405 SETUP_HOSTDATA(instance);
1401 unsigned char tmp[3], phase; 1406 unsigned char tmp[3], phase;
@@ -1985,7 +1990,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
1985#endif 1990#endif
1986 unsigned char *data; 1991 unsigned char *data;
1987 unsigned char phase, tmp, extended_msg[10], old_phase=0xff; 1992 unsigned char phase, tmp, extended_msg[10], old_phase=0xff;
1988 Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected; 1993 struct scsi_cmnd *cmd = (struct scsi_cmnd *) hostdata->connected;
1989 1994
1990#ifdef SUN3_SCSI_VME 1995#ifdef SUN3_SCSI_VME
1991 dregs->csr |= CSR_INTR; 1996 dregs->csr |= CSR_INTR;
@@ -2272,7 +2277,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2272 local_irq_save(flags); 2277 local_irq_save(flags);
2273 LIST(cmd,hostdata->issue_queue); 2278 LIST(cmd,hostdata->issue_queue);
2274 NEXT(cmd) = hostdata->issue_queue; 2279 NEXT(cmd) = hostdata->issue_queue;
2275 hostdata->issue_queue = (Scsi_Cmnd *) cmd; 2280 hostdata->issue_queue = (struct scsi_cmnd *) cmd;
2276 local_irq_restore(flags); 2281 local_irq_restore(flags);
2277 QU_PRINTK("scsi%d: REQUEST SENSE added to head of " 2282 QU_PRINTK("scsi%d: REQUEST SENSE added to head of "
2278 "issue queue\n", H_NO(cmd)); 2283 "issue queue\n", H_NO(cmd));
@@ -2502,7 +2507,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2502 * Function : void NCR5380_reselect (struct Scsi_Host *instance) 2507 * Function : void NCR5380_reselect (struct Scsi_Host *instance)
2503 * 2508 *
2504 * Purpose : does reselection, initializing the instance->connected 2509 * Purpose : does reselection, initializing the instance->connected
2505 * field to point to the Scsi_Cmnd for which the I_T_L or I_T_L_Q 2510 * field to point to the struct scsi_cmnd for which the I_T_L or I_T_L_Q
2506 * nexus has been reestablished, 2511 * nexus has been reestablished,
2507 * 2512 *
2508 * Inputs : instance - this instance of the NCR5380. 2513 * Inputs : instance - this instance of the NCR5380.
@@ -2521,7 +2526,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
2521 unsigned char tag; 2526 unsigned char tag;
2522#endif 2527#endif
2523 unsigned char msg[3]; 2528 unsigned char msg[3];
2524 Scsi_Cmnd *tmp = NULL, *prev; 2529 struct scsi_cmnd *tmp = NULL, *prev;
2525/* unsigned long flags; */ 2530/* unsigned long flags; */
2526 2531
2527 /* 2532 /*
@@ -2577,7 +2582,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
2577 * just reestablished, and remove it from the disconnected queue. 2582 * just reestablished, and remove it from the disconnected queue.
2578 */ 2583 */
2579 2584
2580 for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; 2585 for (tmp = (struct scsi_cmnd *) hostdata->disconnected_queue, prev = NULL;
2581 tmp; prev = tmp, tmp = NEXT(tmp) ) { 2586 tmp; prev = tmp, tmp = NEXT(tmp) ) {
2582 if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun) 2587 if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun)
2583#ifdef SUPPORT_TAGS 2588#ifdef SUPPORT_TAGS
@@ -2668,11 +2673,11 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
2668 2673
2669 2674
2670/* 2675/*
2671 * Function : int NCR5380_abort (Scsi_Cmnd *cmd) 2676 * Function : int NCR5380_abort(struct scsi_cmnd *cmd)
2672 * 2677 *
2673 * Purpose : abort a command 2678 * Purpose : abort a command
2674 * 2679 *
2675 * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the 2680 * Inputs : cmd - the struct scsi_cmnd to abort, code - code to set the
2676 * host byte of the result field to, if zero DID_ABORTED is 2681 * host byte of the result field to, if zero DID_ABORTED is
2677 * used. 2682 * used.
2678 * 2683 *
@@ -2684,11 +2689,11 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
2684 * called where the loop started in NCR5380_main(). 2689 * called where the loop started in NCR5380_main().
2685 */ 2690 */
2686 2691
2687static int NCR5380_abort (Scsi_Cmnd *cmd) 2692static int NCR5380_abort(struct scsi_cmnd *cmd)
2688{ 2693{
2689 struct Scsi_Host *instance = cmd->device->host; 2694 struct Scsi_Host *instance = cmd->device->host;
2690 SETUP_HOSTDATA(instance); 2695 SETUP_HOSTDATA(instance);
2691 Scsi_Cmnd *tmp, **prev; 2696 struct scsi_cmnd *tmp, **prev;
2692 unsigned long flags; 2697 unsigned long flags;
2693 2698
2694 printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO); 2699 printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO);
@@ -2753,9 +2758,9 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
2753 * Case 2 : If the command hasn't been issued yet, we simply remove it 2758 * Case 2 : If the command hasn't been issued yet, we simply remove it
2754 * from the issue queue. 2759 * from the issue queue.
2755 */ 2760 */
2756 for (prev = (Scsi_Cmnd **) &(hostdata->issue_queue), 2761 for (prev = (struct scsi_cmnd **) &(hostdata->issue_queue),
2757 tmp = (Scsi_Cmnd *) hostdata->issue_queue; 2762 tmp = (struct scsi_cmnd *) hostdata->issue_queue;
2758 tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) 2763 tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp))
2759 if (cmd == tmp) { 2764 if (cmd == tmp) {
2760 REMOVE(5, *prev, tmp, NEXT(tmp)); 2765 REMOVE(5, *prev, tmp, NEXT(tmp));
2761 (*prev) = NEXT(tmp); 2766 (*prev) = NEXT(tmp);
@@ -2812,7 +2817,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
2812 * it from the disconnected queue. 2817 * it from the disconnected queue.
2813 */ 2818 */
2814 2819
2815 for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; 2820 for (tmp = (struct scsi_cmnd *) hostdata->disconnected_queue; tmp;
2816 tmp = NEXT(tmp)) 2821 tmp = NEXT(tmp))
2817 if (cmd == tmp) { 2822 if (cmd == tmp) {
2818 local_irq_restore(flags); 2823 local_irq_restore(flags);
@@ -2826,8 +2831,8 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
2826 do_abort (instance); 2831 do_abort (instance);
2827 2832
2828 local_irq_save(flags); 2833 local_irq_save(flags);
2829 for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue), 2834 for (prev = (struct scsi_cmnd **) &(hostdata->disconnected_queue),
2830 tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; 2835 tmp = (struct scsi_cmnd *) hostdata->disconnected_queue;
2831 tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) 2836 tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) )
2832 if (cmd == tmp) { 2837 if (cmd == tmp) {
2833 REMOVE(5, *prev, tmp, NEXT(tmp)); 2838 REMOVE(5, *prev, tmp, NEXT(tmp));
@@ -2868,7 +2873,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
2868 2873
2869 2874
2870/* 2875/*
2871 * Function : int NCR5380_bus_reset (Scsi_Cmnd *cmd) 2876 * Function : int NCR5380_bus_reset(struct scsi_cmnd *cmd)
2872 * 2877 *
2873 * Purpose : reset the SCSI bus. 2878 * Purpose : reset the SCSI bus.
2874 * 2879 *
@@ -2876,13 +2881,13 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
2876 * 2881 *
2877 */ 2882 */
2878 2883
2879static int NCR5380_bus_reset( Scsi_Cmnd *cmd) 2884static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
2880{ 2885{
2881 SETUP_HOSTDATA(cmd->device->host); 2886 SETUP_HOSTDATA(cmd->device->host);
2882 int i; 2887 int i;
2883 unsigned long flags; 2888 unsigned long flags;
2884#if 1 2889#if 1
2885 Scsi_Cmnd *connected, *disconnected_queue; 2890 struct scsi_cmnd *connected, *disconnected_queue;
2886#endif 2891#endif
2887 2892
2888 2893
@@ -2914,9 +2919,9 @@ static int NCR5380_bus_reset( Scsi_Cmnd *cmd)
2914 * remembered in local variables first. 2919 * remembered in local variables first.
2915 */ 2920 */
2916 local_irq_save(flags); 2921 local_irq_save(flags);
2917 connected = (Scsi_Cmnd *)hostdata->connected; 2922 connected = (struct scsi_cmnd *)hostdata->connected;
2918 hostdata->connected = NULL; 2923 hostdata->connected = NULL;
2919 disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue; 2924 disconnected_queue = (struct scsi_cmnd *)hostdata->disconnected_queue;
2920 hostdata->disconnected_queue = NULL; 2925 hostdata->disconnected_queue = NULL;
2921#ifdef SUPPORT_TAGS 2926#ifdef SUPPORT_TAGS
2922 free_all_tags(); 2927 free_all_tags();
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index e625b4c5833a..d56d85dd9ba0 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -119,7 +119,7 @@ module_param(setup_use_tagged_queuing, int, 0);
119static int setup_hostid = -1; 119static int setup_hostid = -1;
120module_param(setup_hostid, int, 0); 120module_param(setup_hostid, int, 0);
121 121
122static Scsi_Cmnd *sun3_dma_setup_done = NULL; 122static struct scsi_cmnd *sun3_dma_setup_done = NULL;
123 123
124#define AFTER_RESET_DELAY (HZ/2) 124#define AFTER_RESET_DELAY (HZ/2)
125 125
@@ -521,8 +521,9 @@ static inline unsigned long sun3scsi_dma_residual(struct Scsi_Host *instance)
521 return last_residual; 521 return last_residual;
522} 522}
523 523
524static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted, Scsi_Cmnd *cmd, 524static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted,
525 int write_flag) 525 struct scsi_cmnd *cmd,
526 int write_flag)
526{ 527{
527 if(blk_fs_request(cmd->request)) 528 if(blk_fs_request(cmd->request))
528 return wanted; 529 return wanted;
diff --git a/drivers/scsi/sun3_scsi.h b/drivers/scsi/sun3_scsi.h
index 834dab428019..a1103b3e2034 100644
--- a/drivers/scsi/sun3_scsi.h
+++ b/drivers/scsi/sun3_scsi.h
@@ -47,11 +47,12 @@
47 47
48#define IOBASE_SUN3_VMESCSI 0xff200000 48#define IOBASE_SUN3_VMESCSI 0xff200000
49 49
50static int sun3scsi_abort (Scsi_Cmnd *); 50static int sun3scsi_abort(struct scsi_cmnd *);
51static int sun3scsi_detect (struct scsi_host_template *); 51static int sun3scsi_detect (struct scsi_host_template *);
52static const char *sun3scsi_info (struct Scsi_Host *); 52static const char *sun3scsi_info (struct Scsi_Host *);
53static int sun3scsi_bus_reset(Scsi_Cmnd *); 53static int sun3scsi_bus_reset(struct scsi_cmnd *);
54static int sun3scsi_queue_command (Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 54static int sun3scsi_queue_command(struct scsi_cmnd *,
55 void (*done)(struct scsi_cmnd *));
55static int sun3scsi_release (struct Scsi_Host *); 56static int sun3scsi_release (struct Scsi_Host *);
56 57
57#ifndef CMD_PER_LUN 58#ifndef CMD_PER_LUN
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c
index e8faab16567b..92def310a84c 100644
--- a/drivers/scsi/sun3_scsi_vme.c
+++ b/drivers/scsi/sun3_scsi_vme.c
@@ -84,7 +84,7 @@ module_param(setup_use_tagged_queuing, int, 0);
84static int setup_hostid = -1; 84static int setup_hostid = -1;
85module_param(setup_hostid, int, 0); 85module_param(setup_hostid, int, 0);
86 86
87static Scsi_Cmnd *sun3_dma_setup_done = NULL; 87static struct scsi_cmnd *sun3_dma_setup_done = NULL;
88 88
89#define AFTER_RESET_DELAY (HZ/2) 89#define AFTER_RESET_DELAY (HZ/2)
90 90
@@ -455,8 +455,9 @@ static inline unsigned long sun3scsi_dma_residual(struct Scsi_Host *instance)
455 return last_residual; 455 return last_residual;
456} 456}
457 457
458static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted, Scsi_Cmnd *cmd, 458static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted,
459 int write_flag) 459 struct scsi_cmnd *cmd,
460 int write_flag)
460{ 461{
461 if(blk_fs_request(cmd->request)) 462 if(blk_fs_request(cmd->request))
462 return wanted; 463 return wanted;
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index d03aa6ce8fe8..fa5382e354be 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -2304,6 +2304,7 @@ static struct scsi_host_template driver_template = {
2304 .sg_tablesize = SG_ALL, 2304 .sg_tablesize = SG_ALL,
2305 .cmd_per_lun = 1, 2305 .cmd_per_lun = 1,
2306 .use_clustering = ENABLE_CLUSTERING, 2306 .use_clustering = ENABLE_CLUSTERING,
2307 .max_sectors = 0x4000, /* 8MiB = 16 * 1024 * 512 */
2307}; 2308};
2308 2309
2309/*********************************************************************** 2310/***********************************************************************
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c
index 2ebbfd95145f..d07ecb53c68b 100644
--- a/drivers/video/backlight/corgi_bl.c
+++ b/drivers/video/backlight/corgi_bl.c
@@ -111,7 +111,7 @@ static struct backlight_properties corgibl_data = {
111 .update_status = corgibl_set_intensity, 111 .update_status = corgibl_set_intensity,
112}; 112};
113 113
114static int __init corgibl_probe(struct platform_device *pdev) 114static int corgibl_probe(struct platform_device *pdev)
115{ 115{
116 struct corgibl_machinfo *machinfo = pdev->dev.platform_data; 116 struct corgibl_machinfo *machinfo = pdev->dev.platform_data;
117 117
@@ -166,4 +166,4 @@ module_exit(corgibl_exit);
166 166
167MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 167MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
168MODULE_DESCRIPTION("Corgi Backlight Driver"); 168MODULE_DESCRIPTION("Corgi Backlight Driver");
169MODULE_LICENSE("GPLv2"); 169MODULE_LICENSE("GPL");
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index eeeeff9a09eb..a95836839e1e 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -161,7 +161,7 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
161 return 1; 161 return 1;
162 162
163 /* Find the bridge device. It is always 0:0.0 */ 163 /* Find the bridge device. It is always 0:0.0 */
164 if (!(bridge_dev = pci_find_slot(0, PCI_DEVFN(0, 0)))) { 164 if (!(bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)))) {
165 ERR_MSG("cannot find bridge device\n"); 165 ERR_MSG("cannot find bridge device\n");
166 return 1; 166 return 1;
167 } 167 }
@@ -169,6 +169,8 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
169 /* Get the fb aperture size and "stolen" memory amount. */ 169 /* Get the fb aperture size and "stolen" memory amount. */
170 tmp = 0; 170 tmp = 0;
171 pci_read_config_word(bridge_dev, INTEL_GMCH_CTRL, &tmp); 171 pci_read_config_word(bridge_dev, INTEL_GMCH_CTRL, &tmp);
172 pci_dev_put(bridge_dev);
173
172 switch (pdev->device) { 174 switch (pdev->device) {
173 case PCI_DEVICE_ID_INTEL_915G: 175 case PCI_DEVICE_ID_INTEL_915G:
174 case PCI_DEVICE_ID_INTEL_915GM: 176 case PCI_DEVICE_ID_INTEL_915GM:
@@ -662,7 +664,7 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
662 int index = dinfo->pll_index; 664 int index = dinfo->pll_index;
663 DBG_MSG("intelfbhw_print_hw_state\n"); 665 DBG_MSG("intelfbhw_print_hw_state\n");
664 666
665 if (!hw || !dinfo) 667 if (!hw)
666 return; 668 return;
667 /* Read in as much of the HW state as possible. */ 669 /* Read in as much of the HW state as possible. */
668 printk("hw state dump start\n"); 670 printk("hw state dump start\n");
diff --git a/fs/Kconfig b/fs/Kconfig
index fee318e6f4bb..133dcc8a4150 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1777,6 +1777,7 @@ config RPCSEC_GSS_KRB5
1777 select CRYPTO 1777 select CRYPTO
1778 select CRYPTO_MD5 1778 select CRYPTO_MD5
1779 select CRYPTO_DES 1779 select CRYPTO_DES
1780 select CRYPTO_CBC
1780 help 1781 help
1781 Provides for secure RPC calls by means of a gss-api 1782 Provides for secure RPC calls by means of a gss-api
1782 mechanism based on Kerberos V5. This is required for 1783 mechanism based on Kerberos V5. This is required for
@@ -1795,6 +1796,7 @@ config RPCSEC_GSS_SPKM3
1795 select CRYPTO_MD5 1796 select CRYPTO_MD5
1796 select CRYPTO_DES 1797 select CRYPTO_DES
1797 select CRYPTO_CAST5 1798 select CRYPTO_CAST5
1799 select CRYPTO_CBC
1798 help 1800 help
1799 Provides for secure RPC calls by means of a gss-api 1801 Provides for secure RPC calls by means of a gss-api
1800 mechanism based on the SPKM3 public-key mechanism. 1802 mechanism based on the SPKM3 public-key mechanism.
diff --git a/fs/block_dev.c b/fs/block_dev.c
index bc8f27cc4483..702b88cbd91d 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1131,6 +1131,8 @@ static int blkdev_open(struct inode * inode, struct file * filp)
1131 filp->f_flags |= O_LARGEFILE; 1131 filp->f_flags |= O_LARGEFILE;
1132 1132
1133 bdev = bd_acquire(inode); 1133 bdev = bd_acquire(inode);
1134 if (bdev == NULL)
1135 return -ENOMEM;
1134 1136
1135 res = do_open(bdev, filp, BD_MUTEX_NORMAL); 1137 res = do_open(bdev, filp, BD_MUTEX_NORMAL);
1136 if (res) 1138 if (res)
diff --git a/fs/dcache.c b/fs/dcache.c
index a1ff91eef108..fd4a428998ef 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -478,11 +478,12 @@ static void prune_dcache(int count, struct super_block *sb)
478 up_read(s_umount); 478 up_read(s_umount);
479 } 479 }
480 spin_unlock(&dentry->d_lock); 480 spin_unlock(&dentry->d_lock);
481 /* Cannot remove the first dentry, and it isn't appropriate 481 /*
482 * to move it to the head of the list, so give up, and try 482 * Insert dentry at the head of the list as inserting at the
483 * later 483 * tail leads to a cycle.
484 */ 484 */
485 break; 485 list_add(&dentry->d_lru, &dentry_unused);
486 dentry_stat.nr_unused++;
486 } 487 }
487 spin_unlock(&dcache_lock); 488 spin_unlock(&dcache_lock);
488} 489}
@@ -556,6 +557,7 @@ repeat:
556static void shrink_dcache_for_umount_subtree(struct dentry *dentry) 557static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
557{ 558{
558 struct dentry *parent; 559 struct dentry *parent;
560 unsigned detached = 0;
559 561
560 BUG_ON(!IS_ROOT(dentry)); 562 BUG_ON(!IS_ROOT(dentry));
561 563
@@ -620,7 +622,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
620 atomic_dec(&parent->d_count); 622 atomic_dec(&parent->d_count);
621 623
622 list_del(&dentry->d_u.d_child); 624 list_del(&dentry->d_u.d_child);
623 dentry_stat.nr_dentry--; /* For d_free, below */ 625 detached++;
624 626
625 inode = dentry->d_inode; 627 inode = dentry->d_inode;
626 if (inode) { 628 if (inode) {
@@ -638,7 +640,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
638 * otherwise we ascend to the parent and move to the 640 * otherwise we ascend to the parent and move to the
639 * next sibling if there is one */ 641 * next sibling if there is one */
640 if (!parent) 642 if (!parent)
641 return; 643 goto out;
642 644
643 dentry = parent; 645 dentry = parent;
644 646
@@ -647,6 +649,11 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
647 dentry = list_entry(dentry->d_subdirs.next, 649 dentry = list_entry(dentry->d_subdirs.next,
648 struct dentry, d_u.d_child); 650 struct dentry, d_u.d_child);
649 } 651 }
652out:
653 /* several dentries were freed, need to correct nr_dentry */
654 spin_lock(&dcache_lock);
655 dentry_stat.nr_dentry -= detached;
656 spin_unlock(&dcache_lock);
650} 657}
651 658
652/* 659/*
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 1e9578052cd3..4fe49c3661b2 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -69,44 +69,49 @@ static int verify_group_input(struct super_block *sb,
69 else if (outside(input->block_bitmap, start, end)) 69 else if (outside(input->block_bitmap, start, end))
70 ext4_warning(sb, __FUNCTION__, 70 ext4_warning(sb, __FUNCTION__,
71 "Block bitmap not in group (block %llu)", 71 "Block bitmap not in group (block %llu)",
72 input->block_bitmap); 72 (unsigned long long)input->block_bitmap);
73 else if (outside(input->inode_bitmap, start, end)) 73 else if (outside(input->inode_bitmap, start, end))
74 ext4_warning(sb, __FUNCTION__, 74 ext4_warning(sb, __FUNCTION__,
75 "Inode bitmap not in group (block %llu)", 75 "Inode bitmap not in group (block %llu)",
76 input->inode_bitmap); 76 (unsigned long long)input->inode_bitmap);
77 else if (outside(input->inode_table, start, end) || 77 else if (outside(input->inode_table, start, end) ||
78 outside(itend - 1, start, end)) 78 outside(itend - 1, start, end))
79 ext4_warning(sb, __FUNCTION__, 79 ext4_warning(sb, __FUNCTION__,
80 "Inode table not in group (blocks %llu-%llu)", 80 "Inode table not in group (blocks %llu-%llu)",
81 input->inode_table, itend - 1); 81 (unsigned long long)input->inode_table, itend - 1);
82 else if (input->inode_bitmap == input->block_bitmap) 82 else if (input->inode_bitmap == input->block_bitmap)
83 ext4_warning(sb, __FUNCTION__, 83 ext4_warning(sb, __FUNCTION__,
84 "Block bitmap same as inode bitmap (%llu)", 84 "Block bitmap same as inode bitmap (%llu)",
85 input->block_bitmap); 85 (unsigned long long)input->block_bitmap);
86 else if (inside(input->block_bitmap, input->inode_table, itend)) 86 else if (inside(input->block_bitmap, input->inode_table, itend))
87 ext4_warning(sb, __FUNCTION__, 87 ext4_warning(sb, __FUNCTION__,
88 "Block bitmap (%llu) in inode table (%llu-%llu)", 88 "Block bitmap (%llu) in inode table (%llu-%llu)",
89 input->block_bitmap, input->inode_table, itend-1); 89 (unsigned long long)input->block_bitmap,
90 (unsigned long long)input->inode_table, itend - 1);
90 else if (inside(input->inode_bitmap, input->inode_table, itend)) 91 else if (inside(input->inode_bitmap, input->inode_table, itend))
91 ext4_warning(sb, __FUNCTION__, 92 ext4_warning(sb, __FUNCTION__,
92 "Inode bitmap (%llu) in inode table (%llu-%llu)", 93 "Inode bitmap (%llu) in inode table (%llu-%llu)",
93 input->inode_bitmap, input->inode_table, itend-1); 94 (unsigned long long)input->inode_bitmap,
95 (unsigned long long)input->inode_table, itend - 1);
94 else if (inside(input->block_bitmap, start, metaend)) 96 else if (inside(input->block_bitmap, start, metaend))
95 ext4_warning(sb, __FUNCTION__, 97 ext4_warning(sb, __FUNCTION__,
96 "Block bitmap (%llu) in GDT table" 98 "Block bitmap (%llu) in GDT table"
97 " (%llu-%llu)", 99 " (%llu-%llu)",
98 input->block_bitmap, start, metaend - 1); 100 (unsigned long long)input->block_bitmap,
101 start, metaend - 1);
99 else if (inside(input->inode_bitmap, start, metaend)) 102 else if (inside(input->inode_bitmap, start, metaend))
100 ext4_warning(sb, __FUNCTION__, 103 ext4_warning(sb, __FUNCTION__,
101 "Inode bitmap (%llu) in GDT table" 104 "Inode bitmap (%llu) in GDT table"
102 " (%llu-%llu)", 105 " (%llu-%llu)",
103 input->inode_bitmap, start, metaend - 1); 106 (unsigned long long)input->inode_bitmap,
107 start, metaend - 1);
104 else if (inside(input->inode_table, start, metaend) || 108 else if (inside(input->inode_table, start, metaend) ||
105 inside(itend - 1, start, metaend)) 109 inside(itend - 1, start, metaend))
106 ext4_warning(sb, __FUNCTION__, 110 ext4_warning(sb, __FUNCTION__,
107 "Inode table (%llu-%llu) overlaps" 111 "Inode table (%llu-%llu) overlaps"
108 "GDT table (%llu-%llu)", 112 "GDT table (%llu-%llu)",
109 input->inode_table, itend - 1, start, metaend - 1); 113 (unsigned long long)input->inode_table,
114 itend - 1, start, metaend - 1);
110 else 115 else
111 err = 0; 116 err = 0;
112 brelse(bh); 117 brelse(bh);
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 4ee3f006b861..0bea6a619e10 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -271,26 +271,24 @@ static void hugetlbfs_drop_inode(struct inode *inode)
271 hugetlbfs_forget_inode(inode); 271 hugetlbfs_forget_inode(inode);
272} 272}
273 273
274/*
275 * h_pgoff is in HPAGE_SIZE units.
276 * vma->vm_pgoff is in PAGE_SIZE units.
277 */
278static inline void 274static inline void
279hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff) 275hugetlb_vmtruncate_list(struct prio_tree_root *root, pgoff_t pgoff)
280{ 276{
281 struct vm_area_struct *vma; 277 struct vm_area_struct *vma;
282 struct prio_tree_iter iter; 278 struct prio_tree_iter iter;
283 279
284 vma_prio_tree_foreach(vma, &iter, root, h_pgoff, ULONG_MAX) { 280 vma_prio_tree_foreach(vma, &iter, root, pgoff, ULONG_MAX) {
285 unsigned long h_vm_pgoff;
286 unsigned long v_offset; 281 unsigned long v_offset;
287 282
288 h_vm_pgoff = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT);
289 v_offset = (h_pgoff - h_vm_pgoff) << HPAGE_SHIFT;
290 /* 283 /*
291 * Is this VMA fully outside the truncation point? 284 * Can the expression below overflow on 32-bit arches?
285 * No, because the prio_tree returns us only those vmas
286 * which overlap the truncated area starting at pgoff,
287 * and no vma on a 32-bit arch can span beyond the 4GB.
292 */ 288 */
293 if (h_vm_pgoff >= h_pgoff) 289 if (vma->vm_pgoff < pgoff)
290 v_offset = (pgoff - vma->vm_pgoff) << PAGE_SHIFT;
291 else
294 v_offset = 0; 292 v_offset = 0;
295 293
296 __unmap_hugepage_range(vma, 294 __unmap_hugepage_range(vma,
@@ -303,14 +301,14 @@ hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff)
303 */ 301 */
304static int hugetlb_vmtruncate(struct inode *inode, loff_t offset) 302static int hugetlb_vmtruncate(struct inode *inode, loff_t offset)
305{ 303{
306 unsigned long pgoff; 304 pgoff_t pgoff;
307 struct address_space *mapping = inode->i_mapping; 305 struct address_space *mapping = inode->i_mapping;
308 306
309 if (offset > inode->i_size) 307 if (offset > inode->i_size)
310 return -EINVAL; 308 return -EINVAL;
311 309
312 BUG_ON(offset & ~HPAGE_MASK); 310 BUG_ON(offset & ~HPAGE_MASK);
313 pgoff = offset >> HPAGE_SHIFT; 311 pgoff = offset >> PAGE_SHIFT;
314 312
315 inode->i_size = offset; 313 inode->i_size = offset;
316 spin_lock(&mapping->i_mmap_lock); 314 spin_lock(&mapping->i_mmap_lock);
@@ -624,7 +622,6 @@ hugetlbfs_parse_options(char *options, struct hugetlbfs_config *pconfig)
624 do_div(size, 100); 622 do_div(size, 100);
625 rest++; 623 rest++;
626 } 624 }
627 size &= HPAGE_MASK;
628 pconfig->nr_blocks = (size >> HPAGE_SHIFT); 625 pconfig->nr_blocks = (size >> HPAGE_SHIFT);
629 value = rest; 626 value = rest;
630 } else if (!strcmp(opt,"nr_inodes")) { 627 } else if (!strcmp(opt,"nr_inodes")) {
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index d5c63047a8b3..4f82bcd63e48 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -967,6 +967,13 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh)
967 */ 967 */
968 jbd_lock_bh_state(bh); 968 jbd_lock_bh_state(bh);
969 spin_lock(&journal->j_list_lock); 969 spin_lock(&journal->j_list_lock);
970
971 /* Now that we have bh_state locked, are we really still mapped? */
972 if (!buffer_mapped(bh)) {
973 JBUFFER_TRACE(jh, "unmapped buffer, bailing out");
974 goto no_journal;
975 }
976
970 if (jh->b_transaction) { 977 if (jh->b_transaction) {
971 JBUFFER_TRACE(jh, "has transaction"); 978 JBUFFER_TRACE(jh, "has transaction");
972 if (jh->b_transaction != handle->h_transaction) { 979 if (jh->b_transaction != handle->h_transaction) {
@@ -1028,6 +1035,11 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1028 sync_dirty_buffer(bh); 1035 sync_dirty_buffer(bh);
1029 jbd_lock_bh_state(bh); 1036 jbd_lock_bh_state(bh);
1030 spin_lock(&journal->j_list_lock); 1037 spin_lock(&journal->j_list_lock);
1038 /* Since we dropped the lock... */
1039 if (!buffer_mapped(bh)) {
1040 JBUFFER_TRACE(jh, "buffer got unmapped");
1041 goto no_journal;
1042 }
1031 /* The buffer may become locked again at any 1043 /* The buffer may become locked again at any
1032 time if it is redirtied */ 1044 time if it is redirtied */
1033 } 1045 }
@@ -1824,6 +1836,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1824 } 1836 }
1825 } 1837 }
1826 } else if (transaction == journal->j_committing_transaction) { 1838 } else if (transaction == journal->j_committing_transaction) {
1839 JBUFFER_TRACE(jh, "on committing transaction");
1827 if (jh->b_jlist == BJ_Locked) { 1840 if (jh->b_jlist == BJ_Locked) {
1828 /* 1841 /*
1829 * The buffer is on the committing transaction's locked 1842 * The buffer is on the committing transaction's locked
@@ -1838,7 +1851,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1838 * can remove it's next_transaction pointer from the 1851 * can remove it's next_transaction pointer from the
1839 * running transaction if that is set, but nothing 1852 * running transaction if that is set, but nothing
1840 * else. */ 1853 * else. */
1841 JBUFFER_TRACE(jh, "on committing transaction");
1842 set_buffer_freed(bh); 1854 set_buffer_freed(bh);
1843 if (jh->b_next_transaction) { 1855 if (jh->b_next_transaction) {
1844 J_ASSERT(jh->b_next_transaction == 1856 J_ASSERT(jh->b_next_transaction ==
@@ -1858,6 +1870,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1858 * i_size already for this truncate so recovery will not 1870 * i_size already for this truncate so recovery will not
1859 * expose the disk blocks we are discarding here.) */ 1871 * expose the disk blocks we are discarding here.) */
1860 J_ASSERT_JH(jh, transaction == journal->j_running_transaction); 1872 J_ASSERT_JH(jh, transaction == journal->j_running_transaction);
1873 JBUFFER_TRACE(jh, "on running transaction");
1861 may_free = __dispose_buffer(jh, transaction); 1874 may_free = __dispose_buffer(jh, transaction);
1862 } 1875 }
1863 1876
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index b6cf2be845a1..c051a94c8a97 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -967,6 +967,13 @@ int jbd2_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
967 */ 967 */
968 jbd_lock_bh_state(bh); 968 jbd_lock_bh_state(bh);
969 spin_lock(&journal->j_list_lock); 969 spin_lock(&journal->j_list_lock);
970
971 /* Now that we have bh_state locked, are we really still mapped? */
972 if (!buffer_mapped(bh)) {
973 JBUFFER_TRACE(jh, "unmapped buffer, bailing out");
974 goto no_journal;
975 }
976
970 if (jh->b_transaction) { 977 if (jh->b_transaction) {
971 JBUFFER_TRACE(jh, "has transaction"); 978 JBUFFER_TRACE(jh, "has transaction");
972 if (jh->b_transaction != handle->h_transaction) { 979 if (jh->b_transaction != handle->h_transaction) {
@@ -1028,6 +1035,11 @@ int jbd2_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1028 sync_dirty_buffer(bh); 1035 sync_dirty_buffer(bh);
1029 jbd_lock_bh_state(bh); 1036 jbd_lock_bh_state(bh);
1030 spin_lock(&journal->j_list_lock); 1037 spin_lock(&journal->j_list_lock);
1038 /* Since we dropped the lock... */
1039 if (!buffer_mapped(bh)) {
1040 JBUFFER_TRACE(jh, "buffer got unmapped");
1041 goto no_journal;
1042 }
1031 /* The buffer may become locked again at any 1043 /* The buffer may become locked again at any
1032 time if it is redirtied */ 1044 time if it is redirtied */
1033 } 1045 }
@@ -1824,6 +1836,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1824 } 1836 }
1825 } 1837 }
1826 } else if (transaction == journal->j_committing_transaction) { 1838 } else if (transaction == journal->j_committing_transaction) {
1839 JBUFFER_TRACE(jh, "on committing transaction");
1827 if (jh->b_jlist == BJ_Locked) { 1840 if (jh->b_jlist == BJ_Locked) {
1828 /* 1841 /*
1829 * The buffer is on the committing transaction's locked 1842 * The buffer is on the committing transaction's locked
@@ -1838,7 +1851,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1838 * can remove it's next_transaction pointer from the 1851 * can remove it's next_transaction pointer from the
1839 * running transaction if that is set, but nothing 1852 * running transaction if that is set, but nothing
1840 * else. */ 1853 * else. */
1841 JBUFFER_TRACE(jh, "on committing transaction");
1842 set_buffer_freed(bh); 1854 set_buffer_freed(bh);
1843 if (jh->b_next_transaction) { 1855 if (jh->b_next_transaction) {
1844 J_ASSERT(jh->b_next_transaction == 1856 J_ASSERT(jh->b_next_transaction ==
@@ -1858,6 +1870,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1858 * i_size already for this truncate so recovery will not 1870 * i_size already for this truncate so recovery will not
1859 * expose the disk blocks we are discarding here.) */ 1871 * expose the disk blocks we are discarding here.) */
1860 J_ASSERT_JH(jh, transaction == journal->j_running_transaction); 1872 J_ASSERT_JH(jh, transaction == journal->j_running_transaction);
1873 JBUFFER_TRACE(jh, "on running transaction");
1861 may_free = __dispose_buffer(jh, transaction); 1874 may_free = __dispose_buffer(jh, transaction);
1862 } 1875 }
1863 1876
diff --git a/fs/splice.c b/fs/splice.c
index 49fb9f129938..8d705954d294 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -74,7 +74,7 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe,
74 wait_on_page_writeback(page); 74 wait_on_page_writeback(page);
75 75
76 if (PagePrivate(page)) 76 if (PagePrivate(page))
77 try_to_release_page(page, mapping_gfp_mask(mapping)); 77 try_to_release_page(page, GFP_KERNEL);
78 78
79 /* 79 /*
80 * If we succeeded in removing the mapping, set LRU flag 80 * If we succeeded in removing the mapping, set LRU flag
@@ -333,7 +333,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
333 break; 333 break;
334 334
335 error = add_to_page_cache_lru(page, mapping, index, 335 error = add_to_page_cache_lru(page, mapping, index,
336 mapping_gfp_mask(mapping)); 336 GFP_KERNEL);
337 if (unlikely(error)) { 337 if (unlikely(error)) {
338 page_cache_release(page); 338 page_cache_release(page);
339 if (error == -EEXIST) 339 if (error == -EEXIST)
@@ -557,7 +557,6 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
557{ 557{
558 struct file *file = sd->file; 558 struct file *file = sd->file;
559 struct address_space *mapping = file->f_mapping; 559 struct address_space *mapping = file->f_mapping;
560 gfp_t gfp_mask = mapping_gfp_mask(mapping);
561 unsigned int offset, this_len; 560 unsigned int offset, this_len;
562 struct page *page; 561 struct page *page;
563 pgoff_t index; 562 pgoff_t index;
@@ -591,7 +590,7 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
591 goto find_page; 590 goto find_page;
592 591
593 page = buf->page; 592 page = buf->page;
594 if (add_to_page_cache(page, mapping, index, gfp_mask)) { 593 if (add_to_page_cache(page, mapping, index, GFP_KERNEL)) {
595 unlock_page(page); 594 unlock_page(page);
596 goto find_page; 595 goto find_page;
597 } 596 }
@@ -613,7 +612,7 @@ find_page:
613 * This will also lock the page 612 * This will also lock the page
614 */ 613 */
615 ret = add_to_page_cache_lru(page, mapping, index, 614 ret = add_to_page_cache_lru(page, mapping, index,
616 gfp_mask); 615 GFP_KERNEL);
617 if (unlikely(ret)) 616 if (unlikely(ret))
618 goto out; 617 goto out;
619 } 618 }
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
index f3bc70eee35b..67ed43674c63 100644
--- a/include/asm-arm/arch-pxa/irqs.h
+++ b/include/asm-arm/arch-pxa/irqs.h
@@ -73,7 +73,7 @@
73#define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i)) 73#define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i))
74 74
75#if defined(CONFIG_PXA25x) 75#if defined(CONFIG_PXA25x)
76#define PXA_LAST_GPIO 80 76#define PXA_LAST_GPIO 84
77#elif defined(CONFIG_PXA27x) 77#elif defined(CONFIG_PXA27x)
78#define PXA_LAST_GPIO 127 78#define PXA_LAST_GPIO 127
79#endif 79#endif
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
index e0b9c44c126c..c40b6032c480 100644
--- a/include/asm-avr32/atomic.h
+++ b/include/asm-avr32/atomic.h
@@ -41,7 +41,7 @@ static inline int atomic_sub_return(int i, atomic_t *v)
41 " stcond %1, %0\n" 41 " stcond %1, %0\n"
42 " brne 1b" 42 " brne 1b"
43 : "=&r"(result), "=o"(v->counter) 43 : "=&r"(result), "=o"(v->counter)
44 : "m"(v->counter), "ir"(i) 44 : "m"(v->counter), "rKs21"(i)
45 : "cc"); 45 : "cc");
46 46
47 return result; 47 return result;
@@ -58,7 +58,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
58{ 58{
59 int result; 59 int result;
60 60
61 if (__builtin_constant_p(i)) 61 if (__builtin_constant_p(i) && (i >= -1048575) && (i <= 1048576))
62 result = atomic_sub_return(-i, v); 62 result = atomic_sub_return(-i, v);
63 else 63 else
64 asm volatile( 64 asm volatile(
@@ -101,7 +101,7 @@ static inline int atomic_sub_unless(atomic_t *v, int a, int u)
101 " mov %1, 1\n" 101 " mov %1, 1\n"
102 "1:" 102 "1:"
103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter) 103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter)
104 : "m"(v->counter), "ir"(a), "ir"(u) 104 : "m"(v->counter), "rKs21"(a), "rKs21"(u)
105 : "cc", "memory"); 105 : "cc", "memory");
106 106
107 return result; 107 return result;
@@ -121,7 +121,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
121{ 121{
122 int tmp, result; 122 int tmp, result;
123 123
124 if (__builtin_constant_p(a)) 124 if (__builtin_constant_p(a) && (a >= -1048575) && (a <= 1048576))
125 result = atomic_sub_unless(v, -a, u); 125 result = atomic_sub_unless(v, -a, u);
126 else { 126 else {
127 result = 0; 127 result = 0;
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index 2fc8f111dce9..eec47500fa66 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -76,6 +76,39 @@ static inline unsigned int readl(const volatile void __iomem *addr)
76#define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l) 76#define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l)
77#define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l) 77#define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l)
78 78
79
80/*
81 * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be
82 */
83#ifndef ioread8
84
85#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; })
86
87#define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; })
88#define ioread16be(p) ({ unsigned int __v = be16_to_cpu(__raw_readw(p)); __v; })
89
90#define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; })
91#define ioread32be(p) ({ unsigned int __v = be32_to_cpu(__raw_readl(p)); __v; })
92
93#define iowrite8(v,p) __raw_writeb(v, p)
94
95#define iowrite16(v,p) __raw_writew(cpu_to_le16(v), p)
96#define iowrite16be(v,p) __raw_writew(cpu_to_be16(v), p)
97
98#define iowrite32(v,p) __raw_writel(cpu_to_le32(v), p)
99#define iowrite32be(v,p) __raw_writel(cpu_to_be32(v), p)
100
101#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
102#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
103#define ioread32_rep(p,d,c) __raw_readsl(p,d,c)
104
105#define iowrite8_rep(p,s,c) __raw_writesb(p,s,c)
106#define iowrite16_rep(p,s,c) __raw_writesw(p,s,c)
107#define iowrite32_rep(p,s,c) __raw_writesl(p,s,c)
108
109#endif
110
111
79/* 112/*
80 * These two are only here because ALSA _thinks_ it needs them... 113 * These two are only here because ALSA _thinks_ it needs them...
81 */ 114 */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9d0d11c180d9..9d873163a7ab 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -213,3 +213,20 @@
213 213
214#define NOTES \ 214#define NOTES \
215 .notes : { *(.note.*) } :note 215 .notes : { *(.note.*) } :note
216
217#define INITCALLS \
218 *(.initcall1.init) \
219 *(.initcall1s.init) \
220 *(.initcall2.init) \
221 *(.initcall2s.init) \
222 *(.initcall3.init) \
223 *(.initcall3s.init) \
224 *(.initcall4.init) \
225 *(.initcall4s.init) \
226 *(.initcall5.init) \
227 *(.initcall5s.init) \
228 *(.initcall6.init) \
229 *(.initcall6s.init) \
230 *(.initcall7.init) \
231 *(.initcall7s.init)
232
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
deleted file mode 100644
index 21cd696d4d0f..000000000000
--- a/include/asm-i386/mach-visws/do_timer.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/* defines for inline arch setup functions */
2
3#include <asm/fixmap.h>
4#include <asm/i8259.h>
5#include "cobalt.h"
6
7static inline void do_timer_interrupt_hook(void)
8{
9 /* Clear the interrupt */
10 co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);
11
12 do_timer(1);
13#ifndef CONFIG_SMP
14 update_process_times(user_mode_vm(irq_regs));
15#endif
16/*
17 * In the SMP case we use the local APIC timer interrupt to do the
18 * profiling, except when we simulate SMP mode on a uniprocessor
19 * system, in that case we have to call the local interrupt handler.
20 */
21#ifndef CONFIG_X86_LOCAL_APIC
22 profile_tick(CPU_PROFILING);
23#else
24 if (!using_apic_timer)
25 smp_local_timer_interrupt();
26#endif
27}
28
29static inline int do_timer_overflow(int count)
30{
31 int i;
32
33 spin_lock(&i8259A_lock);
34 /*
35 * This is tricky when I/O APICs are used;
36 * see do_timer_interrupt().
37 */
38 i = inb(0x20);
39 spin_unlock(&i8259A_lock);
40
41 /* assumption about timer being IRQ0 */
42 if (i & 0x01) {
43 /*
44 * We cannot detect lost timer interrupts ...
45 * well, that's why we call them lost, don't we? :)
46 * [hmm, on the Pentium and Alpha we can ... sort of]
47 */
48 count -= LATCH;
49 } else {
50 printk("do_slow_gettimeoffset(): hardware timer problem?\n");
51 }
52 return count;
53}
diff --git a/include/asm-i386/mach-visws/mach_apic.h b/include/asm-i386/mach-visws/mach_apic.h
index de438c7147a8..18afe6b6fc4d 100644
--- a/include/asm-i386/mach-visws/mach_apic.h
+++ b/include/asm-i386/mach-visws/mach_apic.h
@@ -51,6 +51,11 @@ static inline void clustered_apic_check(void)
51{ 51{
52} 52}
53 53
54static inline int apicid_to_node(int logical_apicid)
55{
56 return 0;
57}
58
54/* Mapping from cpu number to logical apicid */ 59/* Mapping from cpu number to logical apicid */
55static inline int cpu_to_logical_apicid(int cpu) 60static inline int cpu_to_logical_apicid(int cpu)
56{ 61{
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h
index 8e64be0cc47d..c89bd58ee283 100644
--- a/include/asm-powerpc/asm-compat.h
+++ b/include/asm-powerpc/asm-compat.h
@@ -14,6 +14,58 @@
14# define ASM_CONST(x) __ASM_CONST(x) 14# define ASM_CONST(x) __ASM_CONST(x)
15#endif 15#endif
16 16
17
18/*
19 * Feature section common macros
20 *
21 * Note that the entries now contain offsets between the table entry
22 * and the code rather than absolute code pointers in order to be
23 * useable with the vdso shared library. There is also an assumption
24 * that values will be negative, that is, the fixup table has to be
25 * located after the code it fixes up.
26 */
27#ifdef CONFIG_PPC64
28#ifdef __powerpc64__
29/* 64 bits kernel, 64 bits code */
30#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
3199: \
32 .section sect,"a"; \
33 .align 3; \
3498: \
35 .llong msk; \
36 .llong val; \
37 .llong label##b-98b; \
38 .llong 99b-98b; \
39 .previous
40#else /* __powerpc64__ */
41/* 64 bits kernel, 32 bits code (ie. vdso32) */
42#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
4399: \
44 .section sect,"a"; \
45 .align 3; \
4698: \
47 .llong msk; \
48 .llong val; \
49 .long 0xffffffff; \
50 .long label##b-98b; \
51 .long 0xffffffff; \
52 .long 99b-98b; \
53 .previous
54#endif /* !__powerpc64__ */
55#else /* CONFIG_PPC64 */
56/* 32 bits kernel, 32 bits code */
57#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
5899: \
59 .section sect,"a"; \
60 .align 2; \
6198: \
62 .long msk; \
63 .long val; \
64 .long label##b-98b; \
65 .long 99b-98b; \
66 .previous
67#endif /* !CONFIG_PPC64 */
68
17#ifdef __powerpc64__ 69#ifdef __powerpc64__
18 70
19/* operations for longs and pointers */ 71/* operations for longs and pointers */
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 12707ab9dc98..a9a40149a7c0 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -89,8 +89,11 @@ struct cpu_spec {
89 89
90extern struct cpu_spec *cur_cpu_spec; 90extern struct cpu_spec *cur_cpu_spec;
91 91
92extern void identify_cpu(unsigned long offset, unsigned long cpu); 92extern unsigned int __start___ftr_fixup, __stop___ftr_fixup;
93extern void do_cpu_ftr_fixups(unsigned long offset); 93
94extern struct cpu_spec *identify_cpu(unsigned long offset);
95extern void do_feature_fixups(unsigned long value, void *fixup_start,
96 void *fixup_end);
94 97
95#endif /* __ASSEMBLY__ */ 98#endif /* __ASSEMBLY__ */
96 99
@@ -144,6 +147,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
144#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000) 147#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000)
145#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000) 148#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000)
146#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000) 149#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000)
150#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000)
147 151
148#ifndef __ASSEMBLY__ 152#ifndef __ASSEMBLY__
149 153
@@ -332,7 +336,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
332#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 336#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
333 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
334 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 338 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
335 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE) 339 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_CELL_TB_BUG)
336#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 340#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 341 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
338 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \ 342 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
@@ -431,29 +435,12 @@ static inline int cpu_has_feature(unsigned long feature)
431 435
432#ifdef __ASSEMBLY__ 436#ifdef __ASSEMBLY__
433 437
434#define BEGIN_FTR_SECTION 98: 438#define BEGIN_FTR_SECTION_NESTED(label) label:
435 439#define BEGIN_FTR_SECTION BEGIN_FTR_SECTION_NESTED(97)
436#ifndef __powerpc64__ 440#define END_FTR_SECTION_NESTED(msk, val, label) \
441 MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup)
437#define END_FTR_SECTION(msk, val) \ 442#define END_FTR_SECTION(msk, val) \
43899: \ 443 END_FTR_SECTION_NESTED(msk, val, 97)
439 .section __ftr_fixup,"a"; \
440 .align 2; \
441 .long msk; \
442 .long val; \
443 .long 98b; \
444 .long 99b; \
445 .previous
446#else /* __powerpc64__ */
447#define END_FTR_SECTION(msk, val) \
44899: \
449 .section __ftr_fixup,"a"; \
450 .align 3; \
451 .llong msk; \
452 .llong val; \
453 .llong 98b; \
454 .llong 99b; \
455 .previous
456#endif /* __powerpc64__ */
457 444
458#define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk)) 445#define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk))
459#define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0) 446#define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0)
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h
index 1022737f4f34..fdf9aff71150 100644
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -96,19 +96,16 @@ extern void machine_check_fwnmi(void);
96/* This is true if we are using the firmware NMI handler (typically LPAR) */ 96/* This is true if we are using the firmware NMI handler (typically LPAR) */
97extern int fwnmi_active; 97extern int fwnmi_active;
98 98
99#else /* __ASSEMBLY__ */ 99extern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup;
100 100
101#define BEGIN_FW_FTR_SECTION 96: 101#else /* __ASSEMBLY__ */
102 102
103#define BEGIN_FW_FTR_SECTION_NESTED(label) label:
104#define BEGIN_FW_FTR_SECTION BEGIN_FW_FTR_SECTION_NESTED(97)
105#define END_FW_FTR_SECTION_NESTED(msk, val, label) \
106 MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
103#define END_FW_FTR_SECTION(msk, val) \ 107#define END_FW_FTR_SECTION(msk, val) \
10497: \ 108 END_FW_FTR_SECTION_NESTED(msk, val, 97)
105 .section __fw_ftr_fixup,"a"; \
106 .align 3; \
107 .llong msk; \
108 .llong val; \
109 .llong 96b; \
110 .llong 97b; \
111 .previous
112 109
113#define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk)) 110#define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk))
114#define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0) 111#define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0)
diff --git a/include/asm-powerpc/i8259.h b/include/asm-powerpc/i8259.h
index 78489fb8d140..db1362f8c603 100644
--- a/include/asm-powerpc/i8259.h
+++ b/include/asm-powerpc/i8259.h
@@ -7,6 +7,7 @@
7#ifdef CONFIG_PPC_MERGE 7#ifdef CONFIG_PPC_MERGE
8extern void i8259_init(struct device_node *node, unsigned long intack_addr); 8extern void i8259_init(struct device_node *node, unsigned long intack_addr);
9extern unsigned int i8259_irq(void); 9extern unsigned int i8259_irq(void);
10extern struct irq_host *i8259_get_host(void);
10#else 11#else
11extern void i8259_init(unsigned long intack_addr, int offset); 12extern void i8259_init(unsigned long intack_addr, int offset);
12extern int i8259_irq(void); 13extern int i8259_irq(void);
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index a940cfe040da..fa083d8e4663 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -30,9 +30,9 @@ BEGIN_FTR_SECTION; \
30 mfspr ra,SPRN_PURR; /* get processor util. reg */ \ 30 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
31END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ 31END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
32BEGIN_FTR_SECTION; \ 32BEGIN_FTR_SECTION; \
33 mftb ra; /* or get TB if no PURR */ \ 33 MFTB(ra); /* or get TB if no PURR */ \
34END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ 34END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
35 ld rb,PACA_STARTPURR(r13); \ 35 ld rb,PACA_STARTPURR(r13); \
36 std ra,PACA_STARTPURR(r13); \ 36 std ra,PACA_STARTPURR(r13); \
37 subf rb,rb,ra; /* subtract start value */ \ 37 subf rb,rb,ra; /* subtract start value */ \
38 ld ra,PACA_USER_TIME(r13); \ 38 ld ra,PACA_USER_TIME(r13); \
@@ -45,9 +45,9 @@ BEGIN_FTR_SECTION; \
45 mfspr ra,SPRN_PURR; /* get processor util. reg */ \ 45 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
46END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ 46END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
47BEGIN_FTR_SECTION; \ 47BEGIN_FTR_SECTION; \
48 mftb ra; /* or get TB if no PURR */ \ 48 MFTB(ra); /* or get TB if no PURR */ \
49END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ 49END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
50 ld rb,PACA_STARTPURR(r13); \ 50 ld rb,PACA_STARTPURR(r13); \
51 std ra,PACA_STARTPURR(r13); \ 51 std ra,PACA_STARTPURR(r13); \
52 subf rb,rb,ra; /* subtract start value */ \ 52 subf rb,rb,ra; /* subtract start value */ \
53 ld ra,PACA_SYSTEM_TIME(r13); \ 53 ld ra,PACA_SYSTEM_TIME(r13); \
@@ -274,6 +274,16 @@ END_FTR_SECTION_IFSET(CPU_FTR_601)
274#define ISYNC_601 274#define ISYNC_601
275#endif 275#endif
276 276
277#ifdef CONFIG_PPC_CELL
278#define MFTB(dest) \
27990: mftb dest; \
280BEGIN_FTR_SECTION_NESTED(96); \
281 cmpwi dest,0; \
282 beq- 90b; \
283END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
284#else
285#define MFTB(dest) mftb dest
286#endif
277 287
278#ifndef CONFIG_SMP 288#ifndef CONFIG_SMP
279#define TLBSYNC 289#define TLBSYNC
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 524629769336..ec11d44eaeb5 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -134,7 +134,7 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev);
134extern struct device_node *of_get_parent(const struct device_node *node); 134extern struct device_node *of_get_parent(const struct device_node *node);
135extern struct device_node *of_get_next_child(const struct device_node *node, 135extern struct device_node *of_get_next_child(const struct device_node *node,
136 struct device_node *prev); 136 struct device_node *prev);
137extern struct property *of_find_property(struct device_node *np, 137extern struct property *of_find_property(const struct device_node *np,
138 const char *name, 138 const char *name,
139 int *lenp); 139 int *lenp);
140extern struct device_node *of_node_get(struct device_node *node); 140extern struct device_node *of_node_get(struct device_node *node);
@@ -158,10 +158,12 @@ extern void of_detach_node(const struct device_node *);
158extern void finish_device_tree(void); 158extern void finish_device_tree(void);
159extern void unflatten_device_tree(void); 159extern void unflatten_device_tree(void);
160extern void early_init_devtree(void *); 160extern void early_init_devtree(void *);
161extern int device_is_compatible(struct device_node *device, const char *); 161extern int device_is_compatible(const struct device_node *device,
162 const char *);
162extern int machine_is_compatible(const char *compat); 163extern int machine_is_compatible(const char *compat);
163extern const void *get_property(struct device_node *node, const char *name, 164extern const void *get_property(const struct device_node *node,
164 int *lenp); 165 const char *name,
166 int *lenp);
165extern void print_properties(struct device_node *node); 167extern void print_properties(struct device_node *node);
166extern int prom_n_addr_cells(struct device_node* np); 168extern int prom_n_addr_cells(struct device_node* np);
167extern int prom_n_size_cells(struct device_node* np); 169extern int prom_n_size_cells(struct device_node* np);
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 8fb96811b55d..6faae7b14d55 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -591,6 +591,7 @@
591#define PV_630 0x0040 591#define PV_630 0x0040
592#define PV_630p 0x0041 592#define PV_630p 0x0041
593#define PV_970MP 0x0044 593#define PV_970MP 0x0044
594#define PV_970GX 0x0045
594#define PV_BE 0x0070 595#define PV_BE 0x0070
595#define PV_PA6T 0x0090 596#define PV_PA6T 0x0090
596 597
@@ -618,10 +619,35 @@
618 : "=r" (rval)); rval;}) 619 : "=r" (rval)); rval;})
619#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)) 620#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
620 621
622#ifdef __powerpc64__
623#ifdef CONFIG_PPC_CELL
624#define mftb() ({unsigned long rval; \
625 asm volatile( \
626 "90: mftb %0;\n" \
627 "97: cmpwi %0,0;\n" \
628 " beq- 90b;\n" \
629 "99:\n" \
630 ".section __ftr_fixup,\"a\"\n" \
631 ".align 3\n" \
632 "98:\n" \
633 " .llong %1\n" \
634 " .llong %1\n" \
635 " .llong 97b-98b\n" \
636 " .llong 99b-98b\n" \
637 ".previous" \
638 : "=r" (rval) : "i" (CPU_FTR_CELL_TB_BUG)); rval;})
639#else
621#define mftb() ({unsigned long rval; \ 640#define mftb() ({unsigned long rval; \
622 asm volatile("mftb %0" : "=r" (rval)); rval;}) 641 asm volatile("mftb %0" : "=r" (rval)); rval;})
642#endif /* !CONFIG_PPC_CELL */
643
644#else /* __powerpc64__ */
645
623#define mftbl() ({unsigned long rval; \ 646#define mftbl() ({unsigned long rval; \
624 asm volatile("mftbl %0" : "=r" (rval)); rval;}) 647 asm volatile("mftbl %0" : "=r" (rval)); rval;})
648#define mftbu() ({unsigned long rval; \
649 asm volatile("mftbu %0" : "=r" (rval)); rval;})
650#endif /* !__powerpc64__ */
625 651
626#define mttbl(v) asm volatile("mttbl %0":: "r"(v)) 652#define mttbl(v) asm volatile("mttbl %0":: "r"(v))
627#define mttbu(v) asm volatile("mttbu %0":: "r"(v)) 653#define mttbu(v) asm volatile("mttbu %0":: "r"(v))
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index b051d4c88c3b..a78285010d62 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -82,30 +82,35 @@ struct div_result {
82#define __USE_RTC() 0 82#define __USE_RTC() 0
83#endif 83#endif
84 84
85/* On ppc64 this gets us the whole timebase; on ppc32 just the lower half */ 85#ifdef CONFIG_PPC64
86
87/* For compatibility, get_tbl() is defined as get_tb() on ppc64 */
88#define get_tbl get_tb
89
90#else
91
86static inline unsigned long get_tbl(void) 92static inline unsigned long get_tbl(void)
87{ 93{
88 unsigned long tbl;
89
90#if defined(CONFIG_403GCX) 94#if defined(CONFIG_403GCX)
95 unsigned long tbl;
91 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl)); 96 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
97 return tbl;
92#else 98#else
93 asm volatile("mftb %0" : "=r" (tbl)); 99 return mftbl();
94#endif 100#endif
95 return tbl;
96} 101}
97 102
98static inline unsigned int get_tbu(void) 103static inline unsigned int get_tbu(void)
99{ 104{
105#ifdef CONFIG_403GCX
100 unsigned int tbu; 106 unsigned int tbu;
101
102#if defined(CONFIG_403GCX)
103 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu)); 107 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
108 return tbu;
104#else 109#else
105 asm volatile("mftbu %0" : "=r" (tbu)); 110 return mftbu();
106#endif 111#endif
107 return tbu;
108} 112}
113#endif /* !CONFIG_PPC64 */
109 114
110static inline unsigned int get_rtcl(void) 115static inline unsigned int get_rtcl(void)
111{ 116{
@@ -131,7 +136,7 @@ static inline u64 get_tb(void)
131{ 136{
132 return mftb(); 137 return mftb();
133} 138}
134#else 139#else /* CONFIG_PPC64 */
135static inline u64 get_tb(void) 140static inline u64 get_tb(void)
136{ 141{
137 unsigned int tbhi, tblo, tbhi2; 142 unsigned int tbhi, tblo, tbhi2;
@@ -144,7 +149,7 @@ static inline u64 get_tb(void)
144 149
145 return ((u64)tbhi << 32) | tblo; 150 return ((u64)tbhi << 32) | tblo;
146} 151}
147#endif 152#endif /* !CONFIG_PPC64 */
148 153
149static inline void set_tb(unsigned int upper, unsigned int lower) 154static inline void set_tb(unsigned int upper, unsigned int lower)
150{ 155{
diff --git a/include/asm-powerpc/timex.h b/include/asm-powerpc/timex.h
index 3b9a8e786806..92dedde761d1 100644
--- a/include/asm-powerpc/timex.h
+++ b/include/asm-powerpc/timex.h
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <asm/cputable.h> 10#include <asm/cputable.h>
11#include <asm/reg.h>
11 12
12#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */ 13#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */
13 14
@@ -15,13 +16,11 @@ typedef unsigned long cycles_t;
15 16
16static inline cycles_t get_cycles(void) 17static inline cycles_t get_cycles(void)
17{ 18{
18 cycles_t ret;
19
20#ifdef __powerpc64__ 19#ifdef __powerpc64__
21 20 return mftb();
22 __asm__ __volatile__("mftb %0" : "=r" (ret) : );
23
24#else 21#else
22 cycles_t ret;
23
25 /* 24 /*
26 * For the "cycle" counter we use the timebase lower half. 25 * For the "cycle" counter we use the timebase lower half.
27 * Currently only used on SMP. 26 * Currently only used on SMP.
@@ -30,18 +29,19 @@ static inline cycles_t get_cycles(void)
30 ret = 0; 29 ret = 0;
31 30
32 __asm__ __volatile__( 31 __asm__ __volatile__(
33 "98: mftb %0\n" 32 "97: mftb %0\n"
34 "99:\n" 33 "99:\n"
35 ".section __ftr_fixup,\"a\"\n" 34 ".section __ftr_fixup,\"a\"\n"
35 ".align 2\n"
36 "98:\n"
36 " .long %1\n" 37 " .long %1\n"
37 " .long 0\n" 38 " .long 0\n"
38 " .long 98b\n" 39 " .long 97b-98b\n"
39 " .long 99b\n" 40 " .long 99b-98b\n"
40 ".previous" 41 ".previous"
41 : "=r" (ret) : "i" (CPU_FTR_601)); 42 : "=r" (ret) : "i" (CPU_FTR_601));
42#endif
43
44 return ret; 43 return ret;
44#endif
45} 45}
46 46
47#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 792dd52fcd70..179cce755aa7 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -76,6 +76,8 @@
76#ifndef __ASSEMBLY__ 76#ifndef __ASSEMBLY__
77typedef int vector_irq_t[NR_VECTORS]; 77typedef int vector_irq_t[NR_VECTORS];
78DECLARE_PER_CPU(vector_irq_t, vector_irq); 78DECLARE_PER_CPU(vector_irq_t, vector_irq);
79extern void __setup_vector_irq(int cpu);
80extern spinlock_t vector_lock;
79 81
80/* 82/*
81 * Various low-level irq details needed by irq.c, process.c, 83 * Various low-level irq details needed by irq.c, process.c,
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f4ebf96f5308..f1553196826f 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -196,7 +196,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
196#define BITS_TO_COMPAT_LONGS(bits) \ 196#define BITS_TO_COMPAT_LONGS(bits) \
197 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG) 197 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
198 198
199long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask, 199long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
200 unsigned long bitmap_size); 200 unsigned long bitmap_size);
201long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, 201long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
202 unsigned long bitmap_size); 202 unsigned long bitmap_size);
diff --git a/include/linux/init.h b/include/linux/init.h
index e92b1455d7af..ff40ea118e3a 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -84,19 +84,29 @@ extern void setup_arch(char **);
84 * by link order. 84 * by link order.
85 * For backwards compatibility, initcall() puts the call in 85 * For backwards compatibility, initcall() puts the call in
86 * the device init subsection. 86 * the device init subsection.
87 *
88 * The `id' arg to __define_initcall() is needed so that multiple initcalls
89 * can point at the same handler without causing duplicate-symbol build errors.
87 */ 90 */
88 91
89#define __define_initcall(level,fn) \ 92#define __define_initcall(level,fn,id) \
90 static initcall_t __initcall_##fn __attribute_used__ \ 93 static initcall_t __initcall_##fn##id __attribute_used__ \
91 __attribute__((__section__(".initcall" level ".init"))) = fn 94 __attribute__((__section__(".initcall" level ".init"))) = fn
92 95
93#define core_initcall(fn) __define_initcall("1",fn) 96#define core_initcall(fn) __define_initcall("1",fn,1)
94#define postcore_initcall(fn) __define_initcall("2",fn) 97#define core_initcall_sync(fn) __define_initcall("1s",fn,1s)
95#define arch_initcall(fn) __define_initcall("3",fn) 98#define postcore_initcall(fn) __define_initcall("2",fn,2)
96#define subsys_initcall(fn) __define_initcall("4",fn) 99#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s)
97#define fs_initcall(fn) __define_initcall("5",fn) 100#define arch_initcall(fn) __define_initcall("3",fn,3)
98#define device_initcall(fn) __define_initcall("6",fn) 101#define arch_initcall_sync(fn) __define_initcall("3s",fn,3s)
99#define late_initcall(fn) __define_initcall("7",fn) 102#define subsys_initcall(fn) __define_initcall("4",fn,4)
103#define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s)
104#define fs_initcall(fn) __define_initcall("5",fn,5)
105#define fs_initcall_sync(fn) __define_initcall("5s",fn,5s)
106#define device_initcall(fn) __define_initcall("6",fn,6)
107#define device_initcall_sync(fn) __define_initcall("6s",fn,6s)
108#define late_initcall(fn) __define_initcall("7",fn,7)
109#define late_initcall_sync(fn) __define_initcall("7s",fn,7s)
100 110
101#define __initcall(fn) device_initcall(fn) 111#define __initcall(fn) device_initcall(fn)
102 112
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ed0762b283a9..e06683e2bea3 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -218,13 +218,9 @@ struct zone {
218 * under - it drives the swappiness decision: whether to unmap mapped 218 * under - it drives the swappiness decision: whether to unmap mapped
219 * pages. 219 * pages.
220 * 220 *
221 * temp_priority is used to remember the scanning priority at which 221 * Access to both this field is quite racy even on uniprocessor. But
222 * this zone was successfully refilled to free_pages == pages_high.
223 *
224 * Access to both these fields is quite racy even on uniprocessor. But
225 * it is expected to average out OK. 222 * it is expected to average out OK.
226 */ 223 */
227 int temp_priority;
228 int prev_priority; 224 int prev_priority;
229 225
230 226
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 64f950925151..c3e255bf8594 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -52,19 +52,23 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
52void release_pages(struct page **pages, int nr, int cold); 52void release_pages(struct page **pages, int nr, int cold);
53 53
54#ifdef CONFIG_NUMA 54#ifdef CONFIG_NUMA
55extern struct page *page_cache_alloc(struct address_space *x); 55extern struct page *__page_cache_alloc(gfp_t gfp);
56extern struct page *page_cache_alloc_cold(struct address_space *x);
57#else 56#else
57static inline struct page *__page_cache_alloc(gfp_t gfp)
58{
59 return alloc_pages(gfp, 0);
60}
61#endif
62
58static inline struct page *page_cache_alloc(struct address_space *x) 63static inline struct page *page_cache_alloc(struct address_space *x)
59{ 64{
60 return alloc_pages(mapping_gfp_mask(x), 0); 65 return __page_cache_alloc(mapping_gfp_mask(x));
61} 66}
62 67
63static inline struct page *page_cache_alloc_cold(struct address_space *x) 68static inline struct page *page_cache_alloc_cold(struct address_space *x)
64{ 69{
65 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0); 70 return __page_cache_alloc(mapping_gfp_mask(x)|__GFP_COLD);
66} 71}
67#endif
68 72
69typedef int filler_t(void *, struct page *); 73typedef int filler_t(void *, struct page *);
70 74
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6735c1cf334c..eafe4a7b8237 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -466,7 +466,6 @@ struct signal_struct {
466 struct pacct_struct pacct; /* per-process accounting information */ 466 struct pacct_struct pacct; /* per-process accounting information */
467#endif 467#endif
468#ifdef CONFIG_TASKSTATS 468#ifdef CONFIG_TASKSTATS
469 spinlock_t stats_lock;
470 struct taskstats *stats; 469 struct taskstats *stats;
471#endif 470#endif
472}; 471};
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index 16894b7edcc8..6562a2050a25 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -23,25 +23,26 @@ static inline void taskstats_exit_free(struct taskstats *tidstats)
23 23
24static inline void taskstats_tgid_init(struct signal_struct *sig) 24static inline void taskstats_tgid_init(struct signal_struct *sig)
25{ 25{
26 spin_lock_init(&sig->stats_lock);
27 sig->stats = NULL; 26 sig->stats = NULL;
28} 27}
29 28
30static inline void taskstats_tgid_alloc(struct signal_struct *sig) 29static inline void taskstats_tgid_alloc(struct task_struct *tsk)
31{ 30{
31 struct signal_struct *sig = tsk->signal;
32 struct taskstats *stats; 32 struct taskstats *stats;
33 unsigned long flags;
34 33
35 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); 34 if (sig->stats != NULL)
36 if (!stats)
37 return; 35 return;
38 36
39 spin_lock_irqsave(&sig->stats_lock, flags); 37 /* No problem if kmem_cache_zalloc() fails */
38 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
39
40 spin_lock_irq(&tsk->sighand->siglock);
40 if (!sig->stats) { 41 if (!sig->stats) {
41 sig->stats = stats; 42 sig->stats = stats;
42 stats = NULL; 43 stats = NULL;
43 } 44 }
44 spin_unlock_irqrestore(&sig->stats_lock, flags); 45 spin_unlock_irq(&tsk->sighand->siglock);
45 46
46 if (stats) 47 if (stats)
47 kmem_cache_free(taskstats_cache, stats); 48 kmem_cache_free(taskstats_cache, stats);
@@ -49,23 +50,13 @@ static inline void taskstats_tgid_alloc(struct signal_struct *sig)
49 50
50static inline void taskstats_tgid_free(struct signal_struct *sig) 51static inline void taskstats_tgid_free(struct signal_struct *sig)
51{ 52{
52 struct taskstats *stats = NULL; 53 if (sig->stats)
53 unsigned long flags; 54 kmem_cache_free(taskstats_cache, sig->stats);
54
55 spin_lock_irqsave(&sig->stats_lock, flags);
56 if (sig->stats) {
57 stats = sig->stats;
58 sig->stats = NULL;
59 }
60 spin_unlock_irqrestore(&sig->stats_lock, flags);
61 if (stats)
62 kmem_cache_free(taskstats_cache, stats);
63} 55}
64 56
65extern void taskstats_exit_alloc(struct taskstats **, unsigned int *); 57extern void taskstats_exit_alloc(struct taskstats **, unsigned int *);
66extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int); 58extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int);
67extern void taskstats_init_early(void); 59extern void taskstats_init_early(void);
68extern void taskstats_tgid_alloc(struct signal_struct *);
69#else 60#else
70static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu) 61static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu)
71{} 62{}
@@ -77,7 +68,7 @@ static inline void taskstats_exit_send(struct task_struct *tsk,
77{} 68{}
78static inline void taskstats_tgid_init(struct signal_struct *sig) 69static inline void taskstats_tgid_init(struct signal_struct *sig)
79{} 70{}
80static inline void taskstats_tgid_alloc(struct signal_struct *sig) 71static inline void taskstats_tgid_alloc(struct task_struct *tsk)
81{} 72{}
82static inline void taskstats_tgid_free(struct signal_struct *sig) 73static inline void taskstats_tgid_free(struct signal_struct *sig)
83{} 74{}
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index ce5f1482e6be..dc9a29d84abc 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -60,7 +60,8 @@ extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
60extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 60extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
61 unsigned long start, unsigned long end); 61 unsigned long start, unsigned long end);
62extern struct vm_struct *get_vm_area_node(unsigned long size, 62extern struct vm_struct *get_vm_area_node(unsigned long size,
63 unsigned long flags, int node); 63 unsigned long flags, int node,
64 gfp_t gfp_mask);
64extern struct vm_struct *remove_vm_area(void *addr); 65extern struct vm_struct *remove_vm_area(void *addr);
65extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 66extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
66 struct page ***pages); 67 struct page ***pages);
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 401192e56e50..61eebec00a7b 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -136,7 +136,6 @@ struct iscsi_conn {
136 136
137 /* control data */ 137 /* control data */
138 int id; /* CID */ 138 int id; /* CID */
139 struct list_head item; /* maintains list of conns */
140 int c_stage; /* connection state */ 139 int c_stage; /* connection state */
141 /* 140 /*
142 * Preallocated buffer for pdus that have data but do not 141 * Preallocated buffer for pdus that have data but do not
@@ -235,10 +234,8 @@ struct iscsi_session {
235 * - mgmtpool, * 234 * - mgmtpool, *
236 * - r2tpool */ 235 * - r2tpool */
237 int state; /* session state */ 236 int state; /* session state */
238 struct list_head item;
239 int age; /* counts session re-opens */ 237 int age; /* counts session re-opens */
240 238
241 struct list_head connections; /* list of connections */
242 int cmds_max; /* size of cmds array */ 239 int cmds_max; /* size of cmds array */
243 struct iscsi_cmd_task **cmds; /* Original Cmds arr */ 240 struct iscsi_cmd_task **cmds; /* Original Cmds arr */
244 struct iscsi_queue cmdpool; /* PDU's pool */ 241 struct iscsi_queue cmdpool; /* PDU's pool */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 84a6d5fe0920..5c0e9791441c 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -97,6 +97,7 @@ extern const unsigned char scsi_command_size[8];
97#define PERSISTENT_RESERVE_IN 0x5e 97#define PERSISTENT_RESERVE_IN 0x5e
98#define PERSISTENT_RESERVE_OUT 0x5f 98#define PERSISTENT_RESERVE_OUT 0x5f
99#define REPORT_LUNS 0xa0 99#define REPORT_LUNS 0xa0
100#define MAINTENANCE_IN 0xa3
100#define MOVE_MEDIUM 0xa5 101#define MOVE_MEDIUM 0xa5
101#define EXCHANGE_MEDIUM 0xa6 102#define EXCHANGE_MEDIUM 0xa6
102#define READ_12 0xa8 103#define READ_12 0xa8
@@ -114,6 +115,8 @@ extern const unsigned char scsi_command_size[8];
114#define SERVICE_ACTION_IN 0x9e 115#define SERVICE_ACTION_IN 0x9e
115/* values for service action in */ 116/* values for service action in */
116#define SAI_READ_CAPACITY_16 0x10 117#define SAI_READ_CAPACITY_16 0x10
118/* values for maintenance in */
119#define MI_REPORT_TARGET_PGS 0x0a
117 120
118/* Values for T10/04-262r7 */ 121/* Values for T10/04-262r7 */
119#define ATA_16 0x85 /* 16-byte pass-thru */ 122#define ATA_16 0x85 /* 16-byte pass-thru */
@@ -430,7 +433,7 @@ struct scsi_lun {
430#define SCSI_IOCTL_GET_PCI 0x5387 433#define SCSI_IOCTL_GET_PCI 0x5387
431 434
432/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */ 435/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
433static inline u32 scsi_to_u32(u8 *ptr) 436static inline __u32 scsi_to_u32(__u8 *ptr)
434{ 437{
435 return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3]; 438 return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
436} 439}
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 39e833260bd0..4b95c89c95c9 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -29,7 +29,6 @@
29struct scsi_transport_template; 29struct scsi_transport_template;
30struct iscsi_transport; 30struct iscsi_transport;
31struct Scsi_Host; 31struct Scsi_Host;
32struct mempool_zone;
33struct iscsi_cls_conn; 32struct iscsi_cls_conn;
34struct iscsi_conn; 33struct iscsi_conn;
35struct iscsi_cmd_task; 34struct iscsi_cmd_task;
@@ -157,9 +156,6 @@ struct iscsi_cls_conn {
157 156
158 int active; /* must be accessed with the connlock */ 157 int active; /* must be accessed with the connlock */
159 struct device dev; /* sysfs transport/container device */ 158 struct device dev; /* sysfs transport/container device */
160 struct mempool_zone *z_error;
161 struct mempool_zone *z_pdu;
162 struct list_head freequeue;
163}; 159};
164 160
165#define iscsi_dev_to_conn(_dev) \ 161#define iscsi_dev_to_conn(_dev) \
diff --git a/kernel/compat.c b/kernel/compat.c
index 75573e5d27b0..d4898aad6cfa 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -678,7 +678,7 @@ int get_compat_sigevent(struct sigevent *event,
678 ? -EFAULT : 0; 678 ? -EFAULT : 0;
679} 679}
680 680
681long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask, 681long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
682 unsigned long bitmap_size) 682 unsigned long bitmap_size)
683{ 683{
684 int i, j; 684 int i, j;
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 27dd3ee47099..663c920b2234 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -150,18 +150,18 @@ static int _cpu_down(unsigned int cpu)
150 p = __stop_machine_run(take_cpu_down, NULL, cpu); 150 p = __stop_machine_run(take_cpu_down, NULL, cpu);
151 mutex_unlock(&cpu_bitmask_lock); 151 mutex_unlock(&cpu_bitmask_lock);
152 152
153 if (IS_ERR(p)) { 153 if (IS_ERR(p) || cpu_online(cpu)) {
154 /* CPU didn't die: tell everyone. Can't complain. */ 154 /* CPU didn't die: tell everyone. Can't complain. */
155 if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED, 155 if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
156 (void *)(long)cpu) == NOTIFY_BAD) 156 (void *)(long)cpu) == NOTIFY_BAD)
157 BUG(); 157 BUG();
158 158
159 err = PTR_ERR(p); 159 if (IS_ERR(p)) {
160 goto out_allowed; 160 err = PTR_ERR(p);
161 } 161 goto out_allowed;
162 162 }
163 if (cpu_online(cpu))
164 goto out_thread; 163 goto out_thread;
164 }
165 165
166 /* Wait for it to sleep (leaving idle task). */ 166 /* Wait for it to sleep (leaving idle task). */
167 while (!idle_cpu(cpu)) 167 while (!idle_cpu(cpu))
diff --git a/kernel/exit.c b/kernel/exit.c
index f250a5e3e281..06de6c4e8ca3 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -128,6 +128,7 @@ static void __exit_signal(struct task_struct *tsk)
128 flush_sigqueue(&tsk->pending); 128 flush_sigqueue(&tsk->pending);
129 if (sig) { 129 if (sig) {
130 flush_sigqueue(&sig->shared_pending); 130 flush_sigqueue(&sig->shared_pending);
131 taskstats_tgid_free(sig);
131 __cleanup_signal(sig); 132 __cleanup_signal(sig);
132 } 133 }
133} 134}
diff --git a/kernel/fork.c b/kernel/fork.c
index 29ebb30850ed..3da978eec791 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -830,7 +830,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
830 if (clone_flags & CLONE_THREAD) { 830 if (clone_flags & CLONE_THREAD) {
831 atomic_inc(&current->signal->count); 831 atomic_inc(&current->signal->count);
832 atomic_inc(&current->signal->live); 832 atomic_inc(&current->signal->live);
833 taskstats_tgid_alloc(current->signal); 833 taskstats_tgid_alloc(current);
834 return 0; 834 return 0;
835 } 835 }
836 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); 836 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
@@ -897,7 +897,6 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
897void __cleanup_signal(struct signal_struct *sig) 897void __cleanup_signal(struct signal_struct *sig)
898{ 898{
899 exit_thread_group_keys(sig); 899 exit_thread_group_keys(sig);
900 taskstats_tgid_free(sig);
901 kmem_cache_free(signal_cachep, sig); 900 kmem_cache_free(signal_cachep, sig);
902} 901}
903 902
diff --git a/kernel/module.c b/kernel/module.c
index 67009bd56c52..5072a943fe35 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1342,7 +1342,7 @@ static void set_license(struct module *mod, const char *license)
1342 1342
1343 if (!license_is_gpl_compatible(license)) { 1343 if (!license_is_gpl_compatible(license)) {
1344 if (!(tainted & TAINT_PROPRIETARY_MODULE)) 1344 if (!(tainted & TAINT_PROPRIETARY_MODULE))
1345 printk(KERN_WARNING "%s: module license '%s' taints" 1345 printk(KERN_WARNING "%s: module license '%s' taints "
1346 "kernel.\n", mod->name, license); 1346 "kernel.\n", mod->name, license);
1347 add_taint_module(mod, TAINT_PROPRIETARY_MODULE); 1347 add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
1348 } 1348 }
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 5d6a8c54ee85..2039585ec5e1 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -77,7 +77,8 @@ static int prepare_reply(struct genl_info *info, u8 cmd, struct sk_buff **skbp,
77 /* 77 /*
78 * If new attributes are added, please revisit this allocation 78 * If new attributes are added, please revisit this allocation
79 */ 79 */
80 skb = nlmsg_new(genlmsg_total_size(size), GFP_KERNEL); 80 size = nlmsg_total_size(genlmsg_total_size(size));
81 skb = nlmsg_new(size, GFP_KERNEL);
81 if (!skb) 82 if (!skb)
82 return -ENOMEM; 83 return -ENOMEM;
83 84
@@ -174,21 +175,19 @@ static void send_cpu_listeners(struct sk_buff *skb, unsigned int cpu)
174 up_write(&listeners->sem); 175 up_write(&listeners->sem);
175} 176}
176 177
177static int fill_pid(pid_t pid, struct task_struct *pidtsk, 178static int fill_pid(pid_t pid, struct task_struct *tsk,
178 struct taskstats *stats) 179 struct taskstats *stats)
179{ 180{
180 int rc = 0; 181 int rc = 0;
181 struct task_struct *tsk = pidtsk;
182 182
183 if (!pidtsk) { 183 if (!tsk) {
184 read_lock(&tasklist_lock); 184 rcu_read_lock();
185 tsk = find_task_by_pid(pid); 185 tsk = find_task_by_pid(pid);
186 if (!tsk) { 186 if (tsk)
187 read_unlock(&tasklist_lock); 187 get_task_struct(tsk);
188 rcu_read_unlock();
189 if (!tsk)
188 return -ESRCH; 190 return -ESRCH;
189 }
190 get_task_struct(tsk);
191 read_unlock(&tasklist_lock);
192 } else 191 } else
193 get_task_struct(tsk); 192 get_task_struct(tsk);
194 193
@@ -214,39 +213,30 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk,
214 213
215} 214}
216 215
217static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk, 216static int fill_tgid(pid_t tgid, struct task_struct *first,
218 struct taskstats *stats) 217 struct taskstats *stats)
219{ 218{
220 struct task_struct *tsk, *first; 219 struct task_struct *tsk;
221 unsigned long flags; 220 unsigned long flags;
221 int rc = -ESRCH;
222 222
223 /* 223 /*
224 * Add additional stats from live tasks except zombie thread group 224 * Add additional stats from live tasks except zombie thread group
225 * leaders who are already counted with the dead tasks 225 * leaders who are already counted with the dead tasks
226 */ 226 */
227 first = tgidtsk; 227 rcu_read_lock();
228 if (!first) { 228 if (!first)
229 read_lock(&tasklist_lock);
230 first = find_task_by_pid(tgid); 229 first = find_task_by_pid(tgid);
231 if (!first) {
232 read_unlock(&tasklist_lock);
233 return -ESRCH;
234 }
235 get_task_struct(first);
236 read_unlock(&tasklist_lock);
237 } else
238 get_task_struct(first);
239 230
240 /* Start with stats from dead tasks */ 231 if (!first || !lock_task_sighand(first, &flags))
241 spin_lock_irqsave(&first->signal->stats_lock, flags); 232 goto out;
233
242 if (first->signal->stats) 234 if (first->signal->stats)
243 memcpy(stats, first->signal->stats, sizeof(*stats)); 235 memcpy(stats, first->signal->stats, sizeof(*stats));
244 spin_unlock_irqrestore(&first->signal->stats_lock, flags);
245 236
246 tsk = first; 237 tsk = first;
247 read_lock(&tasklist_lock);
248 do { 238 do {
249 if (tsk->exit_state == EXIT_ZOMBIE && thread_group_leader(tsk)) 239 if (tsk->exit_state)
250 continue; 240 continue;
251 /* 241 /*
252 * Accounting subsystem can call its functions here to 242 * Accounting subsystem can call its functions here to
@@ -257,15 +247,18 @@ static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk,
257 delayacct_add_tsk(stats, tsk); 247 delayacct_add_tsk(stats, tsk);
258 248
259 } while_each_thread(first, tsk); 249 } while_each_thread(first, tsk);
260 read_unlock(&tasklist_lock);
261 stats->version = TASKSTATS_VERSION;
262 250
251 unlock_task_sighand(first, &flags);
252 rc = 0;
253out:
254 rcu_read_unlock();
255
256 stats->version = TASKSTATS_VERSION;
263 /* 257 /*
264 * Accounting subsytems can also add calls here to modify 258 * Accounting subsytems can also add calls here to modify
265 * fields of taskstats. 259 * fields of taskstats.
266 */ 260 */
267 261 return rc;
268 return 0;
269} 262}
270 263
271 264
@@ -273,7 +266,7 @@ static void fill_tgid_exit(struct task_struct *tsk)
273{ 266{
274 unsigned long flags; 267 unsigned long flags;
275 268
276 spin_lock_irqsave(&tsk->signal->stats_lock, flags); 269 spin_lock_irqsave(&tsk->sighand->siglock, flags);
277 if (!tsk->signal->stats) 270 if (!tsk->signal->stats)
278 goto ret; 271 goto ret;
279 272
@@ -285,7 +278,7 @@ static void fill_tgid_exit(struct task_struct *tsk)
285 */ 278 */
286 delayacct_add_tsk(tsk->signal->stats, tsk); 279 delayacct_add_tsk(tsk->signal->stats, tsk);
287ret: 280ret:
288 spin_unlock_irqrestore(&tsk->signal->stats_lock, flags); 281 spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
289 return; 282 return;
290} 283}
291 284
@@ -419,7 +412,7 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
419 return send_reply(rep_skb, info->snd_pid); 412 return send_reply(rep_skb, info->snd_pid);
420 413
421nla_put_failure: 414nla_put_failure:
422 return genlmsg_cancel(rep_skb, reply); 415 rc = genlmsg_cancel(rep_skb, reply);
423err: 416err:
424 nlmsg_free(rep_skb); 417 nlmsg_free(rep_skb);
425 return rc; 418 return rc;
@@ -461,15 +454,10 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats,
461 size_t size; 454 size_t size;
462 int is_thread_group; 455 int is_thread_group;
463 struct nlattr *na; 456 struct nlattr *na;
464 unsigned long flags;
465 457
466 if (!family_registered || !tidstats) 458 if (!family_registered || !tidstats)
467 return; 459 return;
468 460
469 spin_lock_irqsave(&tsk->signal->stats_lock, flags);
470 is_thread_group = tsk->signal->stats ? 1 : 0;
471 spin_unlock_irqrestore(&tsk->signal->stats_lock, flags);
472
473 rc = 0; 461 rc = 0;
474 /* 462 /*
475 * Size includes space for nested attributes 463 * Size includes space for nested attributes
@@ -477,6 +465,7 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats,
477 size = nla_total_size(sizeof(u32)) + 465 size = nla_total_size(sizeof(u32)) +
478 nla_total_size(sizeof(struct taskstats)) + nla_total_size(0); 466 nla_total_size(sizeof(struct taskstats)) + nla_total_size(0);
479 467
468 is_thread_group = (tsk->signal->stats != NULL);
480 if (is_thread_group) 469 if (is_thread_group)
481 size = 2 * size; /* PID + STATS + TGID + STATS */ 470 size = 2 * size; /* PID + STATS + TGID + STATS */
482 471
@@ -519,7 +508,6 @@ send:
519 508
520nla_put_failure: 509nla_put_failure:
521 genlmsg_cancel(rep_skb, reply); 510 genlmsg_cancel(rep_skb, reply);
522 goto ret;
523err_skb: 511err_skb:
524 nlmsg_free(rep_skb); 512 nlmsg_free(rep_skb);
525ret: 513ret:
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 47195fa0ec4f..3afeaa3a73f9 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -161,9 +161,9 @@ void second_overflow(void)
161 time_adjust += MAX_TICKADJ; 161 time_adjust += MAX_TICKADJ;
162 tick_length -= MAX_TICKADJ_SCALED; 162 tick_length -= MAX_TICKADJ_SCALED;
163 } else { 163 } else {
164 time_adjust = 0;
165 tick_length += (s64)(time_adjust * NSEC_PER_USEC / 164 tick_length += (s64)(time_adjust * NSEC_PER_USEC /
166 HZ) << TICK_LENGTH_SHIFT; 165 HZ) << TICK_LENGTH_SHIFT;
166 time_adjust = 0;
167 } 167 }
168 } 168 }
169} 169}
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index db443221ba5b..65a5036a3d95 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -36,7 +36,7 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
36 36
37 /* calculate task elapsed time in timespec */ 37 /* calculate task elapsed time in timespec */
38 do_posix_clock_monotonic_gettime(&uptime); 38 do_posix_clock_monotonic_gettime(&uptime);
39 ts = timespec_sub(uptime, current->group_leader->start_time); 39 ts = timespec_sub(uptime, tsk->start_time);
40 /* rebase elapsed time to usec */ 40 /* rebase elapsed time to usec */
41 ac_etime = timespec_to_ns(&ts); 41 ac_etime = timespec_to_ns(&ts);
42 do_div(ac_etime, NSEC_PER_USEC); 42 do_div(ac_etime, NSEC_PER_USEC);
@@ -58,7 +58,10 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
58 stats->ac_uid = tsk->uid; 58 stats->ac_uid = tsk->uid;
59 stats->ac_gid = tsk->gid; 59 stats->ac_gid = tsk->gid;
60 stats->ac_pid = tsk->pid; 60 stats->ac_pid = tsk->pid;
61 stats->ac_ppid = (tsk->parent) ? tsk->parent->pid : 0; 61 rcu_read_lock();
62 stats->ac_ppid = pid_alive(tsk) ?
63 rcu_dereference(tsk->real_parent)->tgid : 0;
64 rcu_read_unlock();
62 stats->ac_utime = cputime_to_msecs(tsk->utime) * USEC_PER_MSEC; 65 stats->ac_utime = cputime_to_msecs(tsk->utime) * USEC_PER_MSEC;
63 stats->ac_stime = cputime_to_msecs(tsk->stime) * USEC_PER_MSEC; 66 stats->ac_stime = cputime_to_msecs(tsk->stime) * USEC_PER_MSEC;
64 stats->ac_minflt = tsk->min_flt; 67 stats->ac_minflt = tsk->min_flt;
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 3df9bfc7ff78..17c2f03d2c27 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -99,7 +99,7 @@ static void __queue_work(struct cpu_workqueue_struct *cwq,
99 * @wq: workqueue to use 99 * @wq: workqueue to use
100 * @work: work to queue 100 * @work: work to queue
101 * 101 *
102 * Returns non-zero if it was successfully added. 102 * Returns 0 if @work was already on a queue, non-zero otherwise.
103 * 103 *
104 * We queue the work to the CPU it was submitted, but there is no 104 * We queue the work to the CPU it was submitted, but there is no
105 * guarantee that it will be processed by that CPU. 105 * guarantee that it will be processed by that CPU.
@@ -138,7 +138,7 @@ static void delayed_work_timer_fn(unsigned long __data)
138 * @work: work to queue 138 * @work: work to queue
139 * @delay: number of jiffies to wait before queueing 139 * @delay: number of jiffies to wait before queueing
140 * 140 *
141 * Returns non-zero if it was successfully added. 141 * Returns 0 if @work was already on a queue, non-zero otherwise.
142 */ 142 */
143int fastcall queue_delayed_work(struct workqueue_struct *wq, 143int fastcall queue_delayed_work(struct workqueue_struct *wq,
144 struct work_struct *work, unsigned long delay) 144 struct work_struct *work, unsigned long delay)
@@ -169,7 +169,7 @@ EXPORT_SYMBOL_GPL(queue_delayed_work);
169 * @work: work to queue 169 * @work: work to queue
170 * @delay: number of jiffies to wait before queueing 170 * @delay: number of jiffies to wait before queueing
171 * 171 *
172 * Returns non-zero if it was successfully added. 172 * Returns 0 if @work was already on a queue, non-zero otherwise.
173 */ 173 */
174int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, 174int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
175 struct work_struct *work, unsigned long delay) 175 struct work_struct *work, unsigned long delay)
diff --git a/lib/string.c b/lib/string.c
index 63077267367e..a485d75962af 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -320,7 +320,7 @@ char *strstrip(char *s)
320 return s; 320 return s;
321 321
322 end = s + size - 1; 322 end = s + size - 1;
323 while (end != s && isspace(*end)) 323 while (end >= s && isspace(*end))
324 end--; 324 end--;
325 *(end + 1) = '\0'; 325 *(end + 1) = '\0';
326 326
diff --git a/mm/filemap.c b/mm/filemap.c
index cb26e33fd0ff..7b84dc814347 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -467,25 +467,15 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
467} 467}
468 468
469#ifdef CONFIG_NUMA 469#ifdef CONFIG_NUMA
470struct page *page_cache_alloc(struct address_space *x) 470struct page *__page_cache_alloc(gfp_t gfp)
471{ 471{
472 if (cpuset_do_page_mem_spread()) { 472 if (cpuset_do_page_mem_spread()) {
473 int n = cpuset_mem_spread_node(); 473 int n = cpuset_mem_spread_node();
474 return alloc_pages_node(n, mapping_gfp_mask(x), 0); 474 return alloc_pages_node(n, gfp, 0);
475 } 475 }
476 return alloc_pages(mapping_gfp_mask(x), 0); 476 return alloc_pages(gfp, 0);
477} 477}
478EXPORT_SYMBOL(page_cache_alloc); 478EXPORT_SYMBOL(__page_cache_alloc);
479
480struct page *page_cache_alloc_cold(struct address_space *x)
481{
482 if (cpuset_do_page_mem_spread()) {
483 int n = cpuset_mem_spread_node();
484 return alloc_pages_node(n, mapping_gfp_mask(x)|__GFP_COLD, 0);
485 }
486 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0);
487}
488EXPORT_SYMBOL(page_cache_alloc_cold);
489#endif 479#endif
490 480
491static int __sleep_on_page_lock(void *word) 481static int __sleep_on_page_lock(void *word)
@@ -826,7 +816,6 @@ struct page *
826grab_cache_page_nowait(struct address_space *mapping, unsigned long index) 816grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
827{ 817{
828 struct page *page = find_get_page(mapping, index); 818 struct page *page = find_get_page(mapping, index);
829 gfp_t gfp_mask;
830 819
831 if (page) { 820 if (page) {
832 if (!TestSetPageLocked(page)) 821 if (!TestSetPageLocked(page))
@@ -834,9 +823,8 @@ grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
834 page_cache_release(page); 823 page_cache_release(page);
835 return NULL; 824 return NULL;
836 } 825 }
837 gfp_mask = mapping_gfp_mask(mapping) & ~__GFP_FS; 826 page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~__GFP_FS);
838 page = alloc_pages(gfp_mask, 0); 827 if (page && add_to_page_cache_lru(page, mapping, index, GFP_KERNEL)) {
839 if (page && add_to_page_cache_lru(page, mapping, index, gfp_mask)) {
840 page_cache_release(page); 828 page_cache_release(page);
841 page = NULL; 829 page = NULL;
842 } 830 }
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 2dbec90dc3ba..a088f593a807 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -478,6 +478,9 @@ int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
478retry: 478retry:
479 page = find_lock_page(mapping, idx); 479 page = find_lock_page(mapping, idx);
480 if (!page) { 480 if (!page) {
481 size = i_size_read(mapping->host) >> HPAGE_SHIFT;
482 if (idx >= size)
483 goto out;
481 if (hugetlb_get_quota(mapping)) 484 if (hugetlb_get_quota(mapping))
482 goto out; 485 goto out;
483 page = alloc_huge_page(vma, address); 486 page = alloc_huge_page(vma, address);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f5fc45472d5c..b55bb358b832 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2261,7 +2261,7 @@ unsigned long __init __absent_pages_in_range(int nid,
2261 2261
2262 /* Account for ranges past physical memory on this node */ 2262 /* Account for ranges past physical memory on this node */
2263 if (range_end_pfn > prev_end_pfn) 2263 if (range_end_pfn > prev_end_pfn)
2264 hole_pages = range_end_pfn - 2264 hole_pages += range_end_pfn -
2265 max(range_start_pfn, prev_end_pfn); 2265 max(range_start_pfn, prev_end_pfn);
2266 2266
2267 return hole_pages; 2267 return hole_pages;
@@ -2407,7 +2407,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
2407 zone->zone_pgdat = pgdat; 2407 zone->zone_pgdat = pgdat;
2408 zone->free_pages = 0; 2408 zone->free_pages = 0;
2409 2409
2410 zone->temp_priority = zone->prev_priority = DEF_PRIORITY; 2410 zone->prev_priority = DEF_PRIORITY;
2411 2411
2412 zone_pcp_init(zone); 2412 zone_pcp_init(zone);
2413 INIT_LIST_HEAD(&zone->active_list); 2413 INIT_LIST_HEAD(&zone->active_list);
diff --git a/mm/sparse.c b/mm/sparse.c
index 86c52ab80878..b3c82ba30012 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -211,7 +211,7 @@ static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
211 struct page *page, *ret; 211 struct page *page, *ret;
212 unsigned long memmap_size = sizeof(struct page) * nr_pages; 212 unsigned long memmap_size = sizeof(struct page) * nr_pages;
213 213
214 page = alloc_pages(GFP_KERNEL, get_order(memmap_size)); 214 page = alloc_pages(GFP_KERNEL|__GFP_NOWARN, get_order(memmap_size));
215 if (page) 215 if (page)
216 goto got_map_page; 216 goto got_map_page;
217 217
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 1133dd3aafcf..46606c133e82 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -160,13 +160,15 @@ int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages)
160 return err; 160 return err;
161} 161}
162 162
163struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags, 163static struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags,
164 unsigned long start, unsigned long end, int node) 164 unsigned long start, unsigned long end,
165 int node, gfp_t gfp_mask)
165{ 166{
166 struct vm_struct **p, *tmp, *area; 167 struct vm_struct **p, *tmp, *area;
167 unsigned long align = 1; 168 unsigned long align = 1;
168 unsigned long addr; 169 unsigned long addr;
169 170
171 BUG_ON(in_interrupt());
170 if (flags & VM_IOREMAP) { 172 if (flags & VM_IOREMAP) {
171 int bit = fls(size); 173 int bit = fls(size);
172 174
@@ -180,7 +182,7 @@ struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags,
180 addr = ALIGN(start, align); 182 addr = ALIGN(start, align);
181 size = PAGE_ALIGN(size); 183 size = PAGE_ALIGN(size);
182 184
183 area = kmalloc_node(sizeof(*area), GFP_KERNEL, node); 185 area = kmalloc_node(sizeof(*area), gfp_mask & GFP_LEVEL_MASK, node);
184 if (unlikely(!area)) 186 if (unlikely(!area))
185 return NULL; 187 return NULL;
186 188
@@ -236,7 +238,7 @@ out:
236struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 238struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
237 unsigned long start, unsigned long end) 239 unsigned long start, unsigned long end)
238{ 240{
239 return __get_vm_area_node(size, flags, start, end, -1); 241 return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL);
240} 242}
241 243
242/** 244/**
@@ -253,9 +255,11 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags)
253 return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END); 255 return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END);
254} 256}
255 257
256struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags, int node) 258struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags,
259 int node, gfp_t gfp_mask)
257{ 260{
258 return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node); 261 return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node,
262 gfp_mask);
259} 263}
260 264
261/* Caller must hold vmlist_lock */ 265/* Caller must hold vmlist_lock */
@@ -487,7 +491,7 @@ static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
487 if (!size || (size >> PAGE_SHIFT) > num_physpages) 491 if (!size || (size >> PAGE_SHIFT) > num_physpages)
488 return NULL; 492 return NULL;
489 493
490 area = get_vm_area_node(size, VM_ALLOC, node); 494 area = get_vm_area_node(size, VM_ALLOC, node, gfp_mask);
491 if (!area) 495 if (!area)
492 return NULL; 496 return NULL;
493 497
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f05527bf792b..518540a4a2a6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -723,6 +723,20 @@ done:
723 return nr_reclaimed; 723 return nr_reclaimed;
724} 724}
725 725
726/*
727 * We are about to scan this zone at a certain priority level. If that priority
728 * level is smaller (ie: more urgent) than the previous priority, then note
729 * that priority level within the zone. This is done so that when the next
730 * process comes in to scan this zone, it will immediately start out at this
731 * priority level rather than having to build up its own scanning priority.
732 * Here, this priority affects only the reclaim-mapped threshold.
733 */
734static inline void note_zone_scanning_priority(struct zone *zone, int priority)
735{
736 if (priority < zone->prev_priority)
737 zone->prev_priority = priority;
738}
739
726static inline int zone_is_near_oom(struct zone *zone) 740static inline int zone_is_near_oom(struct zone *zone)
727{ 741{
728 return zone->pages_scanned >= (zone->nr_active + zone->nr_inactive)*3; 742 return zone->pages_scanned >= (zone->nr_active + zone->nr_inactive)*3;
@@ -746,7 +760,7 @@ static inline int zone_is_near_oom(struct zone *zone)
746 * But we had to alter page->flags anyway. 760 * But we had to alter page->flags anyway.
747 */ 761 */
748static void shrink_active_list(unsigned long nr_pages, struct zone *zone, 762static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
749 struct scan_control *sc) 763 struct scan_control *sc, int priority)
750{ 764{
751 unsigned long pgmoved; 765 unsigned long pgmoved;
752 int pgdeactivate = 0; 766 int pgdeactivate = 0;
@@ -770,7 +784,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
770 * `distress' is a measure of how much trouble we're having 784 * `distress' is a measure of how much trouble we're having
771 * reclaiming pages. 0 -> no problems. 100 -> great trouble. 785 * reclaiming pages. 0 -> no problems. 100 -> great trouble.
772 */ 786 */
773 distress = 100 >> zone->prev_priority; 787 distress = 100 >> min(zone->prev_priority, priority);
774 788
775 /* 789 /*
776 * The point of this algorithm is to decide when to start 790 * The point of this algorithm is to decide when to start
@@ -922,7 +936,7 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
922 nr_to_scan = min(nr_active, 936 nr_to_scan = min(nr_active,
923 (unsigned long)sc->swap_cluster_max); 937 (unsigned long)sc->swap_cluster_max);
924 nr_active -= nr_to_scan; 938 nr_active -= nr_to_scan;
925 shrink_active_list(nr_to_scan, zone, sc); 939 shrink_active_list(nr_to_scan, zone, sc, priority);
926 } 940 }
927 941
928 if (nr_inactive) { 942 if (nr_inactive) {
@@ -972,9 +986,7 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
972 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 986 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
973 continue; 987 continue;
974 988
975 zone->temp_priority = priority; 989 note_zone_scanning_priority(zone, priority);
976 if (zone->prev_priority > priority)
977 zone->prev_priority = priority;
978 990
979 if (zone->all_unreclaimable && priority != DEF_PRIORITY) 991 if (zone->all_unreclaimable && priority != DEF_PRIORITY)
980 continue; /* Let kswapd poll it */ 992 continue; /* Let kswapd poll it */
@@ -1024,7 +1036,6 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
1024 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 1036 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
1025 continue; 1037 continue;
1026 1038
1027 zone->temp_priority = DEF_PRIORITY;
1028 lru_pages += zone->nr_active + zone->nr_inactive; 1039 lru_pages += zone->nr_active + zone->nr_inactive;
1029 } 1040 }
1030 1041
@@ -1065,13 +1076,22 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
1065 if (!sc.all_unreclaimable) 1076 if (!sc.all_unreclaimable)
1066 ret = 1; 1077 ret = 1;
1067out: 1078out:
1079 /*
1080 * Now that we've scanned all the zones at this priority level, note
1081 * that level within the zone so that the next thread which performs
1082 * scanning of this zone will immediately start out at this priority
1083 * level. This affects only the decision whether or not to bring
1084 * mapped pages onto the inactive list.
1085 */
1086 if (priority < 0)
1087 priority = 0;
1068 for (i = 0; zones[i] != 0; i++) { 1088 for (i = 0; zones[i] != 0; i++) {
1069 struct zone *zone = zones[i]; 1089 struct zone *zone = zones[i];
1070 1090
1071 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 1091 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
1072 continue; 1092 continue;
1073 1093
1074 zone->prev_priority = zone->temp_priority; 1094 zone->prev_priority = priority;
1075 } 1095 }
1076 return ret; 1096 return ret;
1077} 1097}
@@ -1111,6 +1131,11 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
1111 .swap_cluster_max = SWAP_CLUSTER_MAX, 1131 .swap_cluster_max = SWAP_CLUSTER_MAX,
1112 .swappiness = vm_swappiness, 1132 .swappiness = vm_swappiness,
1113 }; 1133 };
1134 /*
1135 * temp_priority is used to remember the scanning priority at which
1136 * this zone was successfully refilled to free_pages == pages_high.
1137 */
1138 int temp_priority[MAX_NR_ZONES];
1114 1139
1115loop_again: 1140loop_again:
1116 total_scanned = 0; 1141 total_scanned = 0;
@@ -1118,11 +1143,8 @@ loop_again:
1118 sc.may_writepage = !laptop_mode; 1143 sc.may_writepage = !laptop_mode;
1119 count_vm_event(PAGEOUTRUN); 1144 count_vm_event(PAGEOUTRUN);
1120 1145
1121 for (i = 0; i < pgdat->nr_zones; i++) { 1146 for (i = 0; i < pgdat->nr_zones; i++)
1122 struct zone *zone = pgdat->node_zones + i; 1147 temp_priority[i] = DEF_PRIORITY;
1123
1124 zone->temp_priority = DEF_PRIORITY;
1125 }
1126 1148
1127 for (priority = DEF_PRIORITY; priority >= 0; priority--) { 1149 for (priority = DEF_PRIORITY; priority >= 0; priority--) {
1128 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ 1150 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
@@ -1183,10 +1205,9 @@ scan:
1183 if (!zone_watermark_ok(zone, order, zone->pages_high, 1205 if (!zone_watermark_ok(zone, order, zone->pages_high,
1184 end_zone, 0)) 1206 end_zone, 0))
1185 all_zones_ok = 0; 1207 all_zones_ok = 0;
1186 zone->temp_priority = priority; 1208 temp_priority[i] = priority;
1187 if (zone->prev_priority > priority)
1188 zone->prev_priority = priority;
1189 sc.nr_scanned = 0; 1209 sc.nr_scanned = 0;
1210 note_zone_scanning_priority(zone, priority);
1190 nr_reclaimed += shrink_zone(priority, zone, &sc); 1211 nr_reclaimed += shrink_zone(priority, zone, &sc);
1191 reclaim_state->reclaimed_slab = 0; 1212 reclaim_state->reclaimed_slab = 0;
1192 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL, 1213 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
@@ -1226,10 +1247,15 @@ scan:
1226 break; 1247 break;
1227 } 1248 }
1228out: 1249out:
1250 /*
1251 * Note within each zone the priority level at which this zone was
1252 * brought into a happy state. So that the next thread which scans this
1253 * zone will start out at that priority level.
1254 */
1229 for (i = 0; i < pgdat->nr_zones; i++) { 1255 for (i = 0; i < pgdat->nr_zones; i++) {
1230 struct zone *zone = pgdat->node_zones + i; 1256 struct zone *zone = pgdat->node_zones + i;
1231 1257
1232 zone->prev_priority = zone->temp_priority; 1258 zone->prev_priority = temp_priority[i];
1233 } 1259 }
1234 if (!all_zones_ok) { 1260 if (!all_zones_ok) {
1235 cond_resched(); 1261 cond_resched();
@@ -1358,7 +1384,7 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int pass,
1358 if (zone->nr_scan_active >= nr_pages || pass > 3) { 1384 if (zone->nr_scan_active >= nr_pages || pass > 3) {
1359 zone->nr_scan_active = 0; 1385 zone->nr_scan_active = 0;
1360 nr_to_scan = min(nr_pages, zone->nr_active); 1386 nr_to_scan = min(nr_pages, zone->nr_active);
1361 shrink_active_list(nr_to_scan, zone, sc); 1387 shrink_active_list(nr_to_scan, zone, sc, prio);
1362 } 1388 }
1363 } 1389 }
1364 1390
@@ -1614,6 +1640,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1614 */ 1640 */
1615 priority = ZONE_RECLAIM_PRIORITY; 1641 priority = ZONE_RECLAIM_PRIORITY;
1616 do { 1642 do {
1643 note_zone_scanning_priority(zone, priority);
1617 nr_reclaimed += shrink_zone(priority, zone, &sc); 1644 nr_reclaimed += shrink_zone(priority, zone, &sc);
1618 priority--; 1645 priority--;
1619 } while (priority >= 0 && nr_reclaimed < nr_pages); 1646 } while (priority >= 0 && nr_reclaimed < nr_pages);
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 45b124e012f5..8614e8f6743b 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -587,11 +587,9 @@ static int zoneinfo_show(struct seq_file *m, void *arg)
587 seq_printf(m, 587 seq_printf(m,
588 "\n all_unreclaimable: %u" 588 "\n all_unreclaimable: %u"
589 "\n prev_priority: %i" 589 "\n prev_priority: %i"
590 "\n temp_priority: %i"
591 "\n start_pfn: %lu", 590 "\n start_pfn: %lu",
592 zone->all_unreclaimable, 591 zone->all_unreclaimable,
593 zone->prev_priority, 592 zone->prev_priority,
594 zone->temp_priority,
595 zone->zone_start_pfn); 593 zone->zone_start_pfn);
596 spin_unlock_irqrestore(&zone->lock, flags); 594 spin_unlock_irqrestore(&zone->lock, flags);
597 seq_putc(m, '\n'); 595 seq_putc(m, '\n');
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 96bcb2ff59ab..de9d1a9473f2 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -376,7 +376,7 @@ int br_sysfs_addbr(struct net_device *dev)
376 376
377 err = sysfs_create_bin_file(brobj, &bridge_forward); 377 err = sysfs_create_bin_file(brobj, &bridge_forward);
378 if (err) { 378 if (err) {
379 pr_info("%s: can't create attribue file %s/%s\n", 379 pr_info("%s: can't create attribute file %s/%s\n",
380 __FUNCTION__, dev->name, bridge_forward.attr.name); 380 __FUNCTION__, dev->name, bridge_forward.attr.name);
381 goto out2; 381 goto out2;
382 } 382 }
diff --git a/net/ieee80211/Kconfig b/net/ieee80211/Kconfig
index f7e84e9d13ad..a64be6cdf078 100644
--- a/net/ieee80211/Kconfig
+++ b/net/ieee80211/Kconfig
@@ -32,6 +32,7 @@ config IEEE80211_CRYPT_WEP
32 depends on IEEE80211 32 depends on IEEE80211
33 select CRYPTO 33 select CRYPTO
34 select CRYPTO_ARC4 34 select CRYPTO_ARC4
35 select CRYPTO_ECB
35 select CRC32 36 select CRC32
36 ---help--- 37 ---help---
37 Include software based cipher suites in support of IEEE 38 Include software based cipher suites in support of IEEE
@@ -58,6 +59,7 @@ config IEEE80211_CRYPT_TKIP
58 depends on IEEE80211 && NET_RADIO 59 depends on IEEE80211 && NET_RADIO
59 select CRYPTO 60 select CRYPTO
60 select CRYPTO_MICHAEL_MIC 61 select CRYPTO_MICHAEL_MIC
62 select CRYPTO_ECB
61 select CRC32 63 select CRC32
62 ---help--- 64 ---help---
63 Include software based cipher suites in support of IEEE 802.11i 65 Include software based cipher suites in support of IEEE 802.11i
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
index a60ef38d75c6..6ad184802266 100644
--- a/net/ipv4/tcp_cubic.c
+++ b/net/ipv4/tcp_cubic.c
@@ -190,7 +190,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
190 */ 190 */
191 191
192 /* change the unit from HZ to bictcp_HZ */ 192 /* change the unit from HZ to bictcp_HZ */
193 t = ((tcp_time_stamp + ca->delay_min - ca->epoch_start) 193 t = ((tcp_time_stamp + (ca->delay_min>>3) - ca->epoch_start)
194 << BICTCP_HZ) / HZ; 194 << BICTCP_HZ) / HZ;
195 195
196 if (t < ca->bic_K) /* t - K */ 196 if (t < ca->bic_K) /* t - K */
@@ -259,7 +259,7 @@ static inline void measure_delay(struct sock *sk)
259 (s32)(tcp_time_stamp - ca->epoch_start) < HZ) 259 (s32)(tcp_time_stamp - ca->epoch_start) < HZ)
260 return; 260 return;
261 261
262 delay = tcp_time_stamp - tp->rx_opt.rcv_tsecr; 262 delay = (tcp_time_stamp - tp->rx_opt.rcv_tsecr)<<3;
263 if (delay == 0) 263 if (delay == 0)
264 delay = 1; 264 delay = 1;
265 265
@@ -366,7 +366,7 @@ static int __init cubictcp_register(void)
366 366
367 beta_scale = 8*(BICTCP_BETA_SCALE+beta)/ 3 / (BICTCP_BETA_SCALE - beta); 367 beta_scale = 8*(BICTCP_BETA_SCALE+beta)/ 3 / (BICTCP_BETA_SCALE - beta);
368 368
369 cube_rtt_scale = (bic_scale << 3) / 10; /* 1024*c/rtt */ 369 cube_rtt_scale = (bic_scale * 10); /* 1024*c/rtt */
370 370
371 /* calculate the "K" for (wmax-cwnd) = c/rtt * K^3 371 /* calculate the "K" for (wmax-cwnd) = c/rtt * K^3
372 * so K = cubic_root( (wmax-cwnd)*rtt/c ) 372 * so K = cubic_root( (wmax-cwnd)*rtt/c )
diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c
index 682e7d5b6f2f..283be3cb4667 100644
--- a/net/ipv4/tcp_htcp.c
+++ b/net/ipv4/tcp_htcp.c
@@ -23,7 +23,7 @@ module_param(use_bandwidth_switch, int, 0644);
23MODULE_PARM_DESC(use_bandwidth_switch, "turn on/off bandwidth switcher"); 23MODULE_PARM_DESC(use_bandwidth_switch, "turn on/off bandwidth switcher");
24 24
25struct htcp { 25struct htcp {
26 u16 alpha; /* Fixed point arith, << 7 */ 26 u32 alpha; /* Fixed point arith, << 7 */
27 u8 beta; /* Fixed point arith, << 7 */ 27 u8 beta; /* Fixed point arith, << 7 */
28 u8 modeswitch; /* Delay modeswitch until we had at least one congestion event */ 28 u8 modeswitch; /* Delay modeswitch until we had at least one congestion event */
29 u32 last_cong; /* Time since last congestion event end */ 29 u32 last_cong; /* Time since last congestion event end */
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 41277963f47a..2e1141623147 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -921,6 +921,8 @@ static int init_section_ref_ok(const char *name)
921 ".fixup", 921 ".fixup",
922 ".smp_locks", 922 ".smp_locks",
923 ".plt", /* seen on ARCH=um build on x86_64. Harmless */ 923 ".plt", /* seen on ARCH=um build on x86_64. Harmless */
924 "__ftr_fixup", /* powerpc cpu feature fixup */
925 "__fw_ftr_fixup", /* powerpc firmware feature fixup */
924 NULL 926 NULL
925 }; 927 };
926 /* Start of section names */ 928 /* Start of section names */